diff options
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/sym-exec/condition.cc | 54 | ||||
-rw-r--r-- | gcc/sym-exec/condition.h | 4 | ||||
-rw-r--r-- | gcc/sym-exec/expression.cc | 152 | ||||
-rw-r--r-- | gcc/sym-exec/expression.h | 22 | ||||
-rw-r--r-- | gcc/sym-exec/state.cc | 102 | ||||
-rw-r--r-- | gcc/sym-exec/state.h | 27 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/crc-1.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/crc-10.c | 3 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/crc-2.c | 3 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/crc-23.c | 3 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/crc-25.c | 6 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/crc-3.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/crc-4.c | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/crc-5.c | 6 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/crc-6.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/crc-7.c | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/crc-8.c | 3 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/crc-9.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/crc-callerid.c | 8 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/crc-cc1541.c | 7 |
20 files changed, 211 insertions, 213 deletions
diff --git a/gcc/sym-exec/condition.cc b/gcc/sym-exec/condition.cc index eb4ecf9..39d9d9e 100644 --- a/gcc/sym-exec/condition.cc +++ b/gcc/sym-exec/condition.cc @@ -1,47 +1,25 @@ #include "condition.h" -bit_condition::bit_condition (value_bit *left, value_bit *right, tree_code type) +bit_condition::bit_condition (value_bit *left, value_bit *right, tree_code code) { this->left = left; this->right = right; - this->type = type; - - switch (this->type) - { - case GT_EXPR: - op_sign[0] = '>'; - op_sign[1] = '\0'; - break; - case LT_EXPR: - op_sign[0] = '<'; - op_sign[1] = '\0'; - break; - case EQ_EXPR: - op_sign[0] = '='; - op_sign[1] = '='; - break; - case NE_EXPR: - op_sign[0] = '!'; - op_sign[1] = '='; - break; - default: - op_sign[0] = '\0'; - op_sign[1] = '\0'; - } + this->code = code; + type = BIT_CONDITION; } bit_condition::bit_condition (const bit_condition &expr) { bit_expression::copy (&expr); - type = expr.get_code (); + code = expr.get_code (); } tree_code bit_condition::get_code () const { - return type; + return code; } @@ -52,8 +30,24 @@ bit_condition::copy () const } -value_type -bit_condition::get_type () const +void +bit_condition::print_expr_sign () { - return value_type::BIT_CONDITION; + switch (code) + { + case GT_EXPR: + fprintf (dump_file, " > "); + break; + case LT_EXPR: + fprintf (dump_file, " < "); + break; + case EQ_EXPR: + fprintf (dump_file, " == "); + break; + case NE_EXPR: + fprintf (dump_file, " != "); + break; + default: + fprintf (dump_file, " ? "); + } }
\ No newline at end of file diff --git a/gcc/sym-exec/condition.h b/gcc/sym-exec/condition.h index 85d5938..dc3ec38 100644 --- a/gcc/sym-exec/condition.h +++ b/gcc/sym-exec/condition.h @@ -13,14 +13,14 @@ enum condition_status { class bit_condition : public bit_expression { private: - tree_code type; + tree_code code; + void print_expr_sign (); public: bit_condition (value_bit *left, value_bit *right, tree_code type); bit_condition (const bit_condition &expr); tree_code get_code () const; value_bit *copy () const; - value_type get_type () const; }; #endif /* SYM_EXEC_CONDITION_H. */
\ No newline at end of file diff --git a/gcc/sym-exec/expression.cc b/gcc/sym-exec/expression.cc index a21d0d6..7a830eb 100644 --- a/gcc/sym-exec/expression.cc +++ b/gcc/sym-exec/expression.cc @@ -4,6 +4,25 @@ #include "expression-is-a-helper.h" +value_type +value_bit::get_type () const +{ + return type; +} + + +symbolic_bit::symbolic_bit (size_t i, tree orig) : value_bit (i), origin (orig) +{ + type = SYMBOLIC_BIT; +} + + +bit::bit (unsigned char i) : val (i) +{ + type = BIT; +} + + value_bit * bit_expression::get_left () { @@ -57,8 +76,7 @@ bit_complement_expression::bit_complement_expression (value_bit *right) { this->left = nullptr; this->right = right; - op_sign[0] = '!'; - op_sign[1] = '\0'; + type = BIT_COMPLEMENT_EXPRESSION; } @@ -101,8 +119,7 @@ bit_expression::copy (const bit_expression *expr) if (expr->right) right = expr->right->copy (); - op_sign[0] = (expr->op_sign)[0]; - op_sign[1] = (expr->op_sign)[1]; + type = expr->type; } @@ -166,8 +183,7 @@ bit_xor_expression::bit_xor_expression (value_bit *left, value_bit *right) { this->left = left; this->right = right; - op_sign[0] = '^'; - op_sign[1] = '\0'; + type = BIT_XOR_EXPRESSION; } @@ -181,8 +197,7 @@ bit_and_expression::bit_and_expression (value_bit *left, value_bit *right) { this->left = left; this->right = right; - op_sign[0] = '&'; - op_sign[1] = '\0'; + type = BIT_AND_EXPRESSION; } @@ -196,8 +211,7 @@ bit_or_expression::bit_or_expression (value_bit *left, value_bit *right) { this->left = left; this->right = right; - op_sign[0] = '|'; - op_sign[1] = '\0'; + type = BIT_OR_EXPRESSION; } @@ -212,8 +226,7 @@ shift_right_expression::shift_right_expression (value_bit *left, { this->left = left; this->right = right; - op_sign[0] = '>'; - op_sign[1] = '>'; + type = SHIFT_RIGHT_EXPRESSION; } @@ -228,8 +241,7 @@ shift_left_expression::shift_left_expression (value_bit *left, value_bit *right) { this->left = left; this->right = right; - op_sign[0] = '<'; - op_sign[1] = '<'; + type = SHIFT_LEFT_EXPRESSION; } @@ -243,8 +255,7 @@ add_expression::add_expression (value_bit *left, value_bit *right) { this->left = left; this->right = right; - op_sign[0] = '+'; - op_sign[1] = '\0'; + type = ADD_EXPRESSION; } @@ -258,8 +269,7 @@ sub_expression::sub_expression (value_bit *left, value_bit *right) { this->left = left; this->right = right; - op_sign[0] = '-'; - op_sign[1] = '\0'; + type = SUB_EXPRESSION; } @@ -269,76 +279,6 @@ sub_expression::sub_expression (const sub_expression &expr) } -value_type -symbolic_bit::get_type () const -{ - return value_type::SYMBOLIC_BIT; -} - - -value_type -bit::get_type () const -{ - return value_type::BIT; -} - - -value_type -bit_and_expression::get_type () const -{ - return value_type::BIT_AND_EXPRESSION; -} - - -value_type -bit_or_expression::get_type () const -{ - return value_type::BIT_OR_EXPRESSION; -} - - -value_type -bit_xor_expression::get_type () const -{ - return value_type::BIT_XOR_EXPRESSION; -} - - -value_type -bit_complement_expression::get_type () const -{ - return value_type::BIT_COMPLEMENT_EXPRESSION; -} - - -value_type -shift_left_expression::get_type () const -{ - return value_type::SHIFT_LEFT_EXPRESSION; -} - - -value_type -shift_right_expression::get_type () const -{ - return value_type::SHIFT_RIGHT_EXPRESSION; -} - - -value_type -add_expression::get_type () const -{ - return value_type::ADD_EXPRESSION; -} - - -value_type -sub_expression::get_type () const -{ - return value_type::SUB_EXPRESSION; -} - - tree symbolic_bit::get_origin () { @@ -366,6 +306,38 @@ bit::print () void +bit_expression::print_expr_sign () +{ + switch (type) + { + case BIT_XOR_EXPRESSION: + fprintf (dump_file, " ^ "); + break; + case BIT_AND_EXPRESSION: + fprintf (dump_file, " & "); + break; + case BIT_OR_EXPRESSION: + fprintf (dump_file, " | "); + break; + case SHIFT_RIGHT_EXPRESSION: + fprintf (dump_file, " >> "); + break; + case SHIFT_LEFT_EXPRESSION: + fprintf (dump_file, " << "); + break; + case ADD_EXPRESSION: + fprintf (dump_file, " + "); + break; + case SUB_EXPRESSION: + fprintf (dump_file, " - "); + break; + default: + fprintf (dump_file, " ?? "); + } +} + + +void bit_expression::print () { if (dump_file) @@ -376,7 +348,7 @@ bit_expression::print () else fprintf (dump_file, "null"); - fprintf (dump_file, " %.2s ", op_sign); + print_expr_sign (); if (right) right->print (); @@ -393,7 +365,7 @@ bit_complement_expression::print () { if (dump_file) { - fprintf (dump_file, "%.2s", op_sign); + fprintf (dump_file, "!"); if (right) right->print (); else diff --git a/gcc/sym-exec/expression.h b/gcc/sym-exec/expression.h index d81e459..10b501e 100644 --- a/gcc/sym-exec/expression.h +++ b/gcc/sym-exec/expression.h @@ -39,6 +39,7 @@ class value_bit { /* This will help us to understand where is moved the bit from its initial position. */ const size_t index; + value_type type; public: value_bit () : index (0) @@ -48,10 +49,10 @@ class value_bit { value_bit (const value_bit &val) : index (val.index) {}; size_t get_index () const; + value_type get_type () const; /* This will support deep copy of objects' values. */ virtual value_bit *copy () const = 0; - virtual value_type get_type () const = 0; virtual void print () = 0; virtual ~value_bit () = default; }; @@ -62,15 +63,13 @@ class symbolic_bit : public value_bit { tree origin = nullptr; public: - symbolic_bit (size_t i, tree orig) : value_bit (i), origin (orig) - {}; + symbolic_bit (size_t i, tree orig); symbolic_bit (const symbolic_bit &sym_bit) : symbolic_bit (sym_bit.index, sym_bit.origin) {}; value_bit *copy () const; void print (); - value_type get_type () const; tree get_origin (); }; @@ -83,14 +82,12 @@ class bit : public value_bit { unsigned char val = 0; public: - bit (unsigned char i) : val (i) - {}; + bit (unsigned char i); bit (const bit &b) : bit (b.val) {}; unsigned char get_val () const; void set_val (unsigned char new_val); value_bit *copy () const; - value_type get_type () const; void print (); }; @@ -102,9 +99,9 @@ class bit_expression : public value_bit { protected: value_bit *left = nullptr; value_bit *right = nullptr; - char op_sign[2]; void copy (const bit_expression *expr); + virtual void print_expr_sign (); public: value_bit *get_left (); @@ -115,7 +112,6 @@ class bit_expression : public value_bit { void set_left (value_bit *expr); void set_right (value_bit *expr); value_bit *copy () const = 0; - value_type get_type () const = 0; void print (); }; @@ -129,7 +125,6 @@ class bit_xor_expression : public bit_expression { bit_xor_expression (value_bit *left, value_bit *right); bit_xor_expression (const bit_xor_expression &expr); value_bit *copy () const; - value_type get_type () const; }; @@ -142,7 +137,6 @@ class bit_and_expression : public bit_expression { bit_and_expression (value_bit *left, value_bit *right); bit_and_expression (const bit_and_expression &expr); value_bit *copy () const; - value_type get_type () const; }; @@ -155,7 +149,6 @@ class bit_or_expression : public bit_expression { bit_or_expression (value_bit *left, value_bit *right); bit_or_expression (const bit_or_expression &expr); value_bit *copy () const; - value_type get_type () const; }; @@ -166,7 +159,6 @@ class shift_right_expression : public bit_expression { shift_right_expression (value_bit *left, value_bit *right); shift_right_expression (const shift_right_expression &expr); value_bit *copy () const; - value_type get_type () const; }; @@ -177,7 +169,6 @@ class shift_left_expression : public bit_expression { shift_left_expression (value_bit *left, value_bit *right); shift_left_expression (const shift_left_expression &expr); value_bit *copy () const; - value_type get_type () const; }; @@ -188,7 +179,6 @@ class add_expression : public bit_expression { add_expression (value_bit *left, value_bit *right); add_expression (const add_expression &expr); value_bit *copy () const; - value_type get_type () const; }; @@ -199,7 +189,6 @@ class sub_expression : public bit_expression { sub_expression (value_bit *left, value_bit *right); sub_expression (const sub_expression &expr); value_bit *copy () const; - value_type get_type () const; }; /* Bit-level negation expression. */ @@ -209,7 +198,6 @@ class bit_complement_expression : public bit_expression { bit_complement_expression (value_bit *right); bit_complement_expression (const bit_complement_expression &expr); value_bit *copy () const; - value_type get_type () const; void print (); }; diff --git a/gcc/sym-exec/state.cc b/gcc/sym-exec/state.cc index 15b74ce..1dc685a 100644 --- a/gcc/sym-exec/state.cc +++ b/gcc/sym-exec/state.cc @@ -4,7 +4,6 @@ #include "state.h" - size_t min (size_t a, size_t b, size_t c) { size_t min = (a < b ? a : b); @@ -30,7 +29,6 @@ state::state (const state &s) state::~state () { - clear_var_states (); clear_conditions (); } @@ -114,29 +112,6 @@ state::create_val_for_const (tree var, size_t size) } -/* Removes given value. */ - -void -state::free_val (value *val) -{ - free_bits (&val->number); -} - - -void -state::free_bits (vec<value_bit *> *bits) -{ - if (bits == nullptr || !bits->exists ()) - return; - - for (size_t i = 0; i < bits->length (); i++) - { - delete (*bits)[i]; - (*bits)[i] = nullptr; - } -} - - bool state::add_var_state (tree var, value *vstate) { @@ -145,7 +120,6 @@ state::add_var_state (tree var, value *vstate) for (size_t i = 0; i < size; i++) val.push ((*vstate)[i]->copy ()); - free_val (var_states.get (var)); return var_states.put (var, val); } @@ -183,12 +157,6 @@ state::clear_states (vec<state *> *states) void state::clear_var_states () { - for (auto iter = var_states.begin (); iter != var_states.end (); ++iter) - { - value *var = &(*iter).second; - for (size_t i = 0; i < var->length (); i++) - delete (*var)[i]; - } var_states.empty (); } @@ -389,9 +357,6 @@ state::do_binary_operation (tree arg1, tree arg2, tree dest, } (this->*bin_func) (arg1_val, arg2_val, dest); - free_val (&arg1_const_val); - free_val (&arg2_const_val); - print_value (var_states.get (dest)); return true; } @@ -587,7 +552,7 @@ state::do_shift_left (value *arg1, value *arg2, tree dest) for (size_t i = 0; i < get_var_size (dest); i++) { delete (*var_states.get (dest))[i]; - (*var_states.get (dest))[i] = (*result)[i]; + (*var_states.get (dest))[i] = (*result)[i]->copy (); } delete result; } @@ -615,8 +580,10 @@ state::do_shift_right (value *arg1, value *arg2, tree dest) for (size_t i = 0; i < get_var_size (dest); i++) { delete (*var_states.get (dest))[i]; - (*var_states.get (dest))[i] = (*result)[i]; + (*var_states.get (dest))[i] = (*result)[i]->copy (); } + + delete result; } else operate (arg1, arg2, nullptr, dest, &state::shift_right_sym_bits); @@ -675,20 +642,23 @@ state::additive_inverse (const value *number) size_t size = number->length (); one.push (new bit (1)); - result->push (complement_a_bit ((*number)[0]->copy ())); + result->push (complement_a_bit ((*number)[0])); for (size_t i = 1; i < size; i++) { one.push (new bit (0)); - result->push (complement_a_bit ((*number)[i]->copy ())); + result->push (complement_a_bit ((*number)[i])); } value_bit *carry = new bit (0); for (size_t i = 0; i < size; ++i) - (*result)[i] = full_adder ((*result)[i], one[i], &carry); + { + value_bit *cur_bit = (*result)[i]; + (*result)[i] = full_adder (cur_bit, one[i], &carry); + delete cur_bit; + } delete carry; - free_val (&one); return result; } @@ -707,7 +677,6 @@ state::do_sub (value *arg1, value *arg2, tree dest) { value *neg_arg2 = additive_inverse (arg2); do_add (arg1, neg_arg2, dest); - free_val (neg_arg2); delete neg_arg2; } @@ -718,9 +687,8 @@ value_bit * state::complement_a_bit (value_bit *var) { value_bit *result = nullptr; - bit *const_bit = dyn_cast<bit *> (var); - if (const_bit) - result = complement_const_bit (const_bit); + if (is_a<bit *> (var)) + result = complement_const_bit (as_a<bit *> (var)); else result = complement_sym_bit (var); @@ -758,7 +726,8 @@ state::do_complement (tree arg, tree dest) for (; i < get_var_size (dest); i++) { delete (*var_states.get (dest))[i]; - (*var_states.get (dest))[i] = complement_a_bit (new bit (0)); + bit tmp (0); + (*var_states.get (dest))[i] = complement_a_bit (&tmp); } print_value (var_states.get (dest)); @@ -797,7 +766,7 @@ state::do_assign (tree arg, tree dest) for (size_t i = 0; i < dest_val->length (); i++) { delete (*dest_val)[i]; - (*dest_val)[i] = arg_val[i]; + (*dest_val)[i] = arg_val[i]->copy (); } } else @@ -836,7 +805,7 @@ state::do_assign_pow2 (tree dest, unsigned pow) dest_val = var_states.get (dest); } else - free_val (dest_val); + dest_val->free_bits (); for (unsigned i = 0; i < dest_val->length (); i++) { @@ -971,14 +940,15 @@ state::xor_const_bits (const bit *const_bit1, const bit *const_bit2) value_bit * state::xor_var_const (const value_bit *var, const bit *const_bit) { + if (const_bit->get_val () == 0) + return var->copy (); + value_bit *var_copy = var->copy (); bit_expression *node_with_const_child = nullptr; bit_expression *tmp = nullptr; get_parent_with_const_child (var_copy, node_with_const_child, tmp); - if (const_bit->get_val () == 0) - return var->copy (); - else if (node_with_const_child != nullptr) + if (node_with_const_child != nullptr) { value_bit *left = node_with_const_child->get_left (); if (left != nullptr && is_a<bit *> (left)) @@ -1150,10 +1120,8 @@ state::do_mul (value *arg1, value *arg2, tree dest) value *temp = shifted; shifted = shift_left_by_const (shifted, 1); - free_val (temp); delete temp; } - free_val (shifted); delete shifted; } @@ -1715,8 +1683,6 @@ state::add_binary_cond (tree arg1, tree arg2, binary_cond_func cond_func) } (this->*cond_func) (arg1_val, arg2_val); - free_val (&arg1_const_val); - free_val (&arg2_const_val); print_conditions (); return true; } @@ -1817,9 +1783,8 @@ value::value (unsigned size, bool is_unsigned) : is_unsigned (is_unsigned) } -value::value (const value &other) +value::value (const value &other) : is_unsigned (other.is_unsigned) { - this->is_unsigned = other.is_unsigned; number.create (other.length ()); for (size_t i = 0; i < other.length (); ++i) { @@ -2111,4 +2076,27 @@ value_bit ** value::push (value_bit *elem) { return number.quick_push (elem); +} + + +value::~value () +{ + free_bits (); + number.release (); +} + + +/* Removes given sequence of bits. */ + +void +value::free_bits () +{ + if (!number.exists ()) + return; + + for (size_t i = 0; i < number.length (); i++) + { + delete number[i]; + number[i] = nullptr; + } }
\ No newline at end of file diff --git a/gcc/sym-exec/state.h b/gcc/sym-exec/state.h index e83b478..a7d289b 100644 --- a/gcc/sym-exec/state.h +++ b/gcc/sym-exec/state.h @@ -11,8 +11,11 @@ #include "expression-is-a-helper.h" struct value { + private: vec<value_bit *> number; - bool is_unsigned; + + public: + const bool is_unsigned; value (unsigned size, bool is_unsigned); value (const value &other); @@ -24,6 +27,10 @@ struct value { value_bit *&operator[] (unsigned i); value &operator= (const value &other); value_bit *operator[] (unsigned i) const; + ~value (); + + /* Removes given sequence of bits. */ + void free_bits (); }; /* Stores states of variables' values on bit-level. */ @@ -46,15 +53,9 @@ class state { /* The result of last added condition. */ condition_status last_cond_status = condition_status::CS_NO_COND; - /* Removes given value. */ - static void free_val (value *val); - /* Creates value for given constant tree. */ static value create_val_for_const (tree var, size_t size); - /* Removes given sequence of bits. */ - static void free_bits (vec<value_bit *> *bits); - /* Checks if sizes of arguments and destination are compatible. */ bool check_args_compatibility (tree arg1, tree arg2, tree dest); @@ -368,26 +369,30 @@ state::operate (value *arg1, value *arg2, value_bit **bit_arg, tree dest, return; value *biggest = arg1; + value_bit *sign_bit = (*arg2)[i - 1]; if (arg2->length () > arg1->length ()) - biggest = arg2; + { + biggest = arg2; + sign_bit = (*arg1)[i - 1]; + } min_iter = min (biggest->length (), dest_var->length (), dest_var->length ()); - value_bit *zero_bit = new bit (0); for (; i < min_iter; i++) { value_bit *temp = (*var_states.get (dest))[i]; (*var_states.get (dest))[i] = operate_bits (bit_op, (*biggest)[i], - zero_bit, bit_arg); + sign_bit, bit_arg); delete temp; } if (i >= dest_var->length ()) return; + sign_bit = (*biggest)[i - 1]; for (; i < dest_var->length (); i++) { value_bit *temp = (*var_states.get (dest))[i]; - (*var_states.get (dest))[i] = operate_bits (bit_op, zero_bit, zero_bit, + (*var_states.get (dest))[i] = operate_bits (bit_op, sign_bit, sign_bit, bit_arg); delete temp; } diff --git a/gcc/testsuite/gcc.dg/crc-1.c b/gcc/testsuite/gcc.dg/crc-1.c index cfa78e0..8f306c3 100644 --- a/gcc/testsuite/gcc.dg/crc-1.c +++ b/gcc/testsuite/gcc.dg/crc-1.c @@ -54,3 +54,5 @@ uint16_t gen_crc16(const uint8_t *data, uint16_t size) { /* { dg-final { scan-tree-dump "Bit forward" "crc"} } */ /* { dg-final { scan-tree-dump "Executing \[a-zA-Z_\]\[a-zA-Z0-9_\]* = \[a-zA-Z_\]\[a-zA-Z0-9_\]* \\\^ \[a-zA-Z0-9_\]+(\(\[a-zA-Z\]\))?;" "crc" } } */ /* { dg-final { scan-tree-dump "Executing \[a-zA-Z_\]\[a-zA-Z0-9_\]* = \[a-zA-Z_\]\[a-zA-Z0-9_\]* \(<<|>>\) \[0-9]+;" "crc" } } */ +/* { dg-final { scan-tree-dump-times "Return value is \\\{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0\\\}" 3 "crc" } } */ +/* { dg-final { scan-tree-dump "Polynomial's value is \\\{1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1\\\}" "crc" } } */ diff --git a/gcc/testsuite/gcc.dg/crc-10.c b/gcc/testsuite/gcc.dg/crc-10.c index 7cf77b8..7a20c1f 100644 --- a/gcc/testsuite/gcc.dg/crc-10.c +++ b/gcc/testsuite/gcc.dg/crc-10.c @@ -23,3 +23,6 @@ u8 crc8(u16 data) { /* { dg-final { scan-tree-dump "Bit forward" "crc"} } */ /* { dg-final { scan-tree-dump "Executing \[a-zA-Z_\]\[a-zA-Z0-9_\]* = \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[8\\\], \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[7\\\]\\\}" "crc" } } */ +/* { dg-final { scan-tree-dump "Polynomial's value is \\\{0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0\\\}" "crc" } } */ diff --git a/gcc/testsuite/gcc.dg/crc-2.c b/gcc/testsuite/gcc.dg/crc-2.c index 55d03bd..14e2b65 100644 --- a/gcc/testsuite/gcc.dg/crc-2.c +++ b/gcc/testsuite/gcc.dg/crc-2.c @@ -28,3 +28,6 @@ unsigned int crc16(unsigned int crcValue, unsigned char newByte) { /* { dg-final { scan-tree-dump "Executing \[a-zA-Z_\]\[a-zA-Z0-9_\]* = \[a-zA-Z_\]\[a-zA-Z0-9_\]* \\\^ \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?;" "crc" } } */ /* { dg-final { scan-tree-dump "Executing \[a-zA-Z_\]\[a-zA-Z0-9_\]* = \[a-zA-Z_\]\[a-zA-Z0-9_\]* \(<<|>>\) \[0-9]+;" "crc" } } */ /* { dg-final { scan-tree-dump "crc16 function calculates CRC!" "crc"} } */ +/* { dg-final { scan-tree-dump "Return value is \\\{\[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[30\\\], \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[29\\\], \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[28\\\], \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[27\\\], \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[26\\\], \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[25\\\], \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[24\\\], \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[23\\\], \[a-zA-Z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zA-Z\]\\\)\)?\\\[13\\\], \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[12\\\], \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[11\\\], \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[10\\\], \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[9\\\], \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[8\\\], \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[7\\\], \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[6\\\], \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[5\\\], \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[4\\\], \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[3\\\], \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[2\\\], \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[1\\\], \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[0\\\], 0\\\}" "crc"} } */ +/* { dg-final { scan-tree-dump "Polynomial's value is \\\{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0\\\}" "crc" } } */ diff --git a/gcc/testsuite/gcc.dg/crc-23.c b/gcc/testsuite/gcc.dg/crc-23.c index afc1282..1d1fd21 100644 --- a/gcc/testsuite/gcc.dg/crc-23.c +++ b/gcc/testsuite/gcc.dg/crc-23.c @@ -21,3 +21,6 @@ uint16_t crc16(uint16_t crc, uint8_t a, uint16_t polynom) { /* { dg-final { scan-tree-dump "Bit reversed" "crc"} } */ /* { dg-final { sc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a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[6\\\], \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[5\\\], \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[4\\\], \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[3\\\], \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[2\\\], \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[1\\\], \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[0\\\]\\\}" "crc" } } */ diff --git a/gcc/testsuite/gcc.dg/crc-25.c b/gcc/testsuite/gcc.dg/crc-25.c index 96add9e..f48714b 100644 --- a/gcc/testsuite/gcc.dg/crc-25.c +++ b/gcc/testsuite/gcc.dg/crc-25.c @@ -26,4 +26,8 @@ crcSlow(uint8_t message) { /* { dg-final { scan-tree-dump "Loop iteration number is 7" "crc"} } */ /* { dg-final { scan-tree-dump "Bit forward" "crc"} } */ /* { dg-final { scan-tree-dump "Executing \[a-zA-Z_\]\[a-zA-Z0-9_\]* = \[a-zA-Z_\]\[a-zA-Z0-9_\]* \(<<|>>\) \[0-9]+;" "crc" } } */ -/* { dg-final { scan-tree-dump "crcSlow function calculates CRC." "crc"} } */
\ No newline at end of file +/* { dg-final { scan-tree-dump "Executing \[a-zA-Z_\]\[a-zA-Z0-9_\]* = \[a-zA-Z_\]\[a-zA-Z0-9_\]* \\\^ \(-\)?\[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?;" "crc" } } */ +/* { dg-final { scan-tree-dump "crcSlow function calculates CRC." "crc"} } */ +/* { dg-final { scan-tree-dump "Return value is \\\{\\\(\[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[6\\\] \\\^ 1\\\), \\\(\[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[5\\\] \\\^ 1\\\), \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[4\\\], \\\(\[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[3\\\] \\\^ 1\\\), \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[2\\\], \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[1\\\], \\\(\[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[0\\\] \\\^ 1\\\), 0\\\}" "crc"} } */ +/* { dg-final { scan-tree-dump "Return value is \\\{\[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[6\\\], \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[5\\\], \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[4\\\], \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[3\\\], \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[2\\\], \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[1\\\], \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[0\\\], 0\\\}" "crc"} } */ +/* { dg-final { scan-tree-dump "Polynomial's value is \\\{1, 1, 0, 1, 0, 0, 1, 0\\\}" "crc"} } */
\ No newline at end of file diff --git a/gcc/testsuite/gcc.dg/crc-3.c b/gcc/testsuite/gcc.dg/crc-3.c index cf5267c..087e0fa 100644 --- a/gcc/testsuite/gcc.dg/crc-3.c +++ b/gcc/testsuite/gcc.dg/crc-3.c @@ -32,3 +32,7 @@ unsigned short crc16(char *data_p, unsigned short length) { /* { dg-final { scan-tree-dump "Bit reversed" "crc"} } */ /* { dg-final { scan-tree-dump "Executing \[a-zA-Z_\]\[a-zA-Z0-9_\]* = \[a-zA-Z_\]\[a-zA-Z0-9_\]* \\\^ \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?;" "crc" } } */ /* { dg-final { scan-tree-dump "Executing \[a-zA-Z_\]\[a-zA-Z0-9_\]* = \[a-zA-Z_\]\[a-zA-Z0-9_\]* \(<<|>>\) \[0-9]+;" "crc" } } */ +/* { dg-final { scan-tree-dump "Return value is \\\{\(0, \)*0\\\}" "crc" } } */ +/* { dg-final { scan-tree-dump "Return value is \\\{0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0\\\}" "crc" } } */ +/* { dg-final { scan-tree-dump "Return value is \\\{0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0\\\}" "crc" } } */ +/* { dg-final { scan-tree-dump "Polynomial's value is \\\{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0\\\}" "crc" } } */ diff --git a/gcc/testsuite/gcc.dg/crc-4.c b/gcc/testsuite/gcc.dg/crc-4.c index 7cd3d62..5f6b354 100644 --- a/gcc/testsuite/gcc.dg/crc-4.c +++ b/gcc/testsuite/gcc.dg/crc-4.c @@ -21,4 +21,7 @@ uint16_t crc16_update(uint16_t crc, uint8_t a) { /* { dg-final { scan-tree-dump "Bit reversed" "crc"} } */ /* { dg-final { scan-tree-dump "Executing \[a-zA-Z_\]\[a-zA-Z0-9_\]* = \[a-zA-Z_\]\[a-zA-Z0-9_\]* \\\^ \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?;" "crc" } } */ /* { dg-final { scan-tree-dump "Executing \[a-zA-Z_\]\[a-zA-Z0-9_\]* = \[a-zA-Z_\]\[a-zA-Z0-9_\]* \(<<|>>\) \[0-9]+;" "crc" } } */ -/* { dg-final { scan-tree-dump "crc16_update function calculates CRC!" "crc"} } */
\ No newline at end of file +/* { dg-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\\\(\[a-zA-Z\]\\\)\)?\\\[4\\\] \\\^ \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[4\\\]\\\), \\\(\[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[3\\\] \\\^ \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[3\\\]\\\), \\\(\[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[2\\\] \\\^ \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[2\\\]\\\), \\\(\[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[1\\\] \\\^ \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[1\\\]\\\)\\\}" "crc"} } */ +/* { dg-final { scan-tree-dump "Polynomial's value is \\\{1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1\\\}" "crc" } } */ diff --git a/gcc/testsuite/gcc.dg/crc-5.c b/gcc/testsuite/gcc.dg/crc-5.c index c900905..4385216 100644 --- a/gcc/testsuite/gcc.dg/crc-5.c +++ b/gcc/testsuite/gcc.dg/crc-5.c @@ -28,4 +28,8 @@ ee_u16 crcu8(ee_u8 data, ee_u16 crc) { /* { dg-final { scan-tree-dump "Bit reversed" "crc"} } */ /* { dg-final { scan-tree-dump "Executing \[a-zA-Z_\]\[a-zA-Z0-9_\]* = \[a-zA-Z_\]\[a-zA-Z0-9_\]* \\\^ \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?;" "crc" } } */ /* { dg-final { scan-tree-dump "Executing \[a-zA-Z_\]\[a-zA-Z0-9_\]* = \[a-zA-Z_\]\[a-zA-Z0-9_\]* \(<<|>>\) \[0-9]+;" "crc" } } */ -/* { dg-final { scan-tree-dump "crcu8 function calculates CRC!" "crc"} } */
\ No newline at end of file +/* { dg-final { scan-tree-dump "crcu8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-zA-Z\]\\\)\)?\\\[12\\\], \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[11\\\], \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[10\\\], \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[9\\\], \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[8\\\], \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[7\\\], \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[6\\\], \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[5\\\], \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[4\\\], \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[3\\\], \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[2\\\], \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[1\\\]\\\}" "crc"} } */ +/* { dg-final { scan-tree-dump "Polynomial's value is \\\{1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1\\\}" "crc" } } */ + diff --git a/gcc/testsuite/gcc.dg/crc-6.c b/gcc/testsuite/gcc.dg/crc-6.c index cfb40b4..7e64f7a 100644 --- a/gcc/testsuite/gcc.dg/crc-6.c +++ b/gcc/testsuite/gcc.dg/crc-6.c @@ -32,3 +32,7 @@ crcSlow(uint8_t const message[], int nBytes) { /* { dg-final { scan-tree-dump "Bit forward" "crc"} } */ /* { dg-final { scan-tree-dump "Executing \[a-zA-Z_\]\[a-zA-Z0-9_\]* = \[a-zA-Z_\]\[a-zA-Z0-9_\]* \\\^ \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?;" "crc" } } */ /* { dg-final { scan-tree-dump "Executing \[a-zA-Z_\]\[a-zA-Z0-9_\]* = \[a-zA-Z_\]\[a-zA-Z0-9_\]* \(<<|>>\) \[0-9]+;" "crc" } } */ +/* { dg-final { scan-tree-dump "Return value is \\\{\\\(\[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[6\\\] \\\^ 1\\\), \\\(\[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[5\\\] \\\^ 1\\\), \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[4\\\], \\\(\[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[3\\\] \\\^ 1\\\), \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[2\\\], \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[1\\\], \\\(\[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[0\\\] \\\^ 1\\\), 0\\\}" "crc" } } */ +/* { dg-final { scan-tree-dump "Return value is \\\{\[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[6\\\], \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[5\\\], \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[4\\\], \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[3\\\], \[a-zA-Z0-9_\]+\( \\\(\[a-zA-Z\]\\\)\)?\\\[2\\\], \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[1\\\], \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[0\\\], 0\\\}" "crc" } } */ +/* { dg-final { scan-tree-dump "Return value is \\\{\(0, \)*0\\\}" "crc" } } */ +/* { dg-final { scan-tree-dump "Polynomial's value is \\\{1, 1, 0, 1, 0, 0, 1, 0\\\}" "crc" } } */ diff --git a/gcc/testsuite/gcc.dg/crc-7.c b/gcc/testsuite/gcc.dg/crc-7.c index d042a0b..4c58145 100644 --- a/gcc/testsuite/gcc.dg/crc-7.c +++ b/gcc/testsuite/gcc.dg/crc-7.c @@ -21,4 +21,7 @@ uint16_t crc_xmodem_update(uint16_t crc, uint8_t data) { /* { dg-final { scan-tree-dump "Bit forward" "crc"} } */ /* { dg-final { scan-tree-dump "Executing \[a-zA-Z_\]\[a-zA-Z0-9_\]* = \[a-zA-Z_\]\[a-zA-Z0-9_\]* \\\^ \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?;" "crc" } } */ /* { dg-final { scan-tree-dump "Executing \[a-zA-Z_\]\[a-zA-Z0-9_\]* = \[a-zA-Z_\]\[a-zA-Z0-9_\]* \(<<|>>\) \[0-9]+;" "crc" } } */ -/* { dg-final { scan-tree-dump "crc_xmodem_update function calculates CRC!" "crc"} } */
\ No newline at end of file +/* { dg-final { scan-tree-dump "crc_xmodem_update function calculates CRC!" "crc"} } */ +/* { dg-final { scan-tree-dump "Return value is \\\{\\\(\[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[14\\\] \\\^ \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[6\\\]\\\), \\\(\[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[13\\\] \\\^ \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[5\\\]\\\), \\\(\[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[12\\\] \\\^ \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[4\\\]\\\), \\\(\\\(\[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[11\\\] \\\^ \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[3\\\]\\\) \\\^ 1\\\), \\\(\[a-zA-Z0-9_\]+\(\\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.dg/crc-8.c b/gcc/testsuite/gcc.dg/crc-8.c index ec990e1..7bdb8b9 100644 --- a/gcc/testsuite/gcc.dg/crc-8.c +++ b/gcc/testsuite/gcc.dg/crc-8.c @@ -22,3 +22,6 @@ uint8_t _crc_ibutton_update(uint8_t crc, uint8_t data) { /* { dg-final { scan-tree-dump "Executing \[a-zA-Z_\]\[a-zA-Z0-9_\]* = \[a-zA-Z_\]\[a-zA-Z0-9_\]* \\\^ \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?;" "crc" } } */ /* { dg-final { scan-tree-dump "Executing \[a-zA-Z_\]\[a-zA-Z0-9_\]* = \[a-zA-Z_\]\[a-zA-Z0-9_\]* \(<<|>>\) \[0-9]+;" "crc" } } */ /* { dg-final { scan-tree-dump "_crc_ibutton_update function calculates CRC!" "crc"} } */ +/* { dg-final { scan-tree-dump "Return value is \\\{1, \\\(\[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[7\\\] \\\^ \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[7\\\]\\\), \\\(\[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[6\\\] \\\^ \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[6\\\]\\\), \\\(\[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[5\\\] \\\^ \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[5\\\]\\\), \\\(\\\(\[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[4\\\] \\\^ \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[4\\\]\\\) \\\^ 1\\\), \\\(\\\(\[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[3\\\] \\\^ \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\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\(\\\(\[a-zA-Z\]\\\)\)?\\\[1\\\]\\\)\\\}" "crc" } } */ +/* { dg-final { scan-tree-dump "Polynomial's value is \\\{1, 0, 0, 0, 1, 1, 0, 0\\\}" "crc" } } */ diff --git a/gcc/testsuite/gcc.dg/crc-9.c b/gcc/testsuite/gcc.dg/crc-9.c index d48e9ce5..bac2150 100644 --- a/gcc/testsuite/gcc.dg/crc-9.c +++ b/gcc/testsuite/gcc.dg/crc-9.c @@ -26,3 +26,7 @@ uint8_t gencrc(uint8_t *data, size_t len) { /* { dg-final { scan-tree-dump "Bit forward" "crc"} } */ /* { dg-final { scan-tree-dump "Executing \[a-zA-Z_\]\[a-zA-Z0-9_\]* = \[a-zA-Z_\]\[a-zA-Z0-9_\]* \\\^ \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?;" "crc" } } */ /* { dg-final { scan-tree-dump "Executing \[a-zA-Z_\]\[a-zA-Z0-9_\]* = \[a-zA-Z_\]\[a-zA-Z0-9_\]* \(<<|>>\) \[0-9]+;" "crc" } } */ +/* { dg-final { scan-tree-dump "Return value is \\\{\\\(\[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[6\\\] \\\^ 1\\\), \\\(\[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[5\\\] \\\^ 1\\\), \\\(\[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[4\\\] \\\^ 0\\\), \\\(\[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[3\\\] \\\^ 0\\\), \\\(\[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[2\\\] \\\^ 1\\\), \\\(\[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[1\\\] \\\^ 1\\\), \\\(\[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[0\\\] \\\^ 1\\\), 1\\\}" "crc" } } */ +/* { dg-final { scan-tree-dump "Return value is \\\{\\\(\[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[6\\\] \\\^ 1\\\), \\\(\[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[5\\\] \\\^ 1\\\), \\\(\[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[4\\\] \\\^ 1\\\), \\\(\[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[3\\\] \\\^ 1\\\), \\\(\[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[2\\\] \\\^ 1\\\), \\\(\[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[1\\\] \\\^ 1\\\), \\\(\[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[0\\\] \\\^ 1\\\), 0\\\}" "crc" } } */ +/* { dg-final { scan-tree-dump "Return value is \\\{\(1, \)*1\\\}" "crc" } } */ +/* { dg-final { scan-tree-dump "Polynomial's value is \\\{0, 0, 1, 1, 0, 0, 0, 1\\\}" "crc" } } */ diff --git a/gcc/testsuite/gcc.dg/crc-callerid.c b/gcc/testsuite/gcc.dg/crc-callerid.c index 2d2dc74..4137d79 100644 --- a/gcc/testsuite/gcc.dg/crc-callerid.c +++ b/gcc/testsuite/gcc.dg/crc-callerid.c @@ -26,4 +26,10 @@ unsigned short calc_crc(unsigned short crc, unsigned char data) /* { dg-final { scan-tree-dump "Return size is 16" "crc"} } */ /* { dg-final { scan-tree-dump "Loop iteration number is 7" "crc"} } */ /* { dg-final { scan-tree-dump "Bit forward" "crc"} } */ -/* { dg-final { scan-tree-dump "calc_crc function calculates CRC." "crc"} } */
\ No newline at end of file +/* { dg-final { scan-tree-dump "calc_crc function calculates CRC." "crc"} } */ +/* { dg-final { scan-tree-dump "Executing \[a-zA-Z_\]\[a-zA-Z0-9_\]* = \[a-zA-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\[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[9\\\], \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[8\\\], \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[7\\\], \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[6\\\], \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[5\\\], \\\(\[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[4\\\] \\\^ 1\\\), \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[3\\\], \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[2\\\], \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[1\\\], \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[0\\\], 1\\\}" "crc"} } */ +/* { dg-final { scan-tree-dump-times "Polynomial's value is \\\{0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1\\\}" 1 "crc"} } */
\ No newline at end of file diff --git a/gcc/testsuite/gcc.dg/crc-cc1541.c b/gcc/testsuite/gcc.dg/crc-cc1541.c index 8a4ad4b..a1ba5f8 100644 --- a/gcc/testsuite/gcc.dg/crc-cc1541.c +++ b/gcc/testsuite/gcc.dg/crc-cc1541.c @@ -13,4 +13,9 @@ crc8(unsigned char value) /* { dg-final { scan-tree-dump "Return size is 8" "crc"} } */ /* { dg-final { scan-tree-dump "Loop iteration number is 7" "crc"} } */ /* { dg-final { scan-tree-dump "Bit forward" "crc"} } */ -/* { dg-final { scan-tree-dump "crc8 function calculates CRC." "crc"} } */
\ No newline at end of file +/* { dg-final { scan-tree-dump "crc8 function calculates CRC." "crc"} } */ +/* { dg-final { scan-tree-dump "Executing \[a-zA-Z_\]\[a-zA-Z0-9_\]* = \[a-zA-Z_\]\[a-zA-Z0-9_\]* \\\^ \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?;" "crc" } } */ +/* { dg-final { scan-tree-dump "Executing \[a-zA-Z_\]\[a-zA-Z0-9_\\\.\]* = \[a-zA-Z_\]\[a-zA-Z0-9_\]* \(<<|>>\) \[0-9]+;" "crc" } } */ +/* { dg-final { scan-tree-dump "Return value is \\\{\[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[6\\\], \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[5\\\], \\\(\[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[4\\\] \\\^ 1\\\), \\\(\[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[3\\\] \\\^ 1\\\), \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[2\\\], \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[1\\\], \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[0\\\], 1\\\}" "crc"} } */ +/* { dg-final { scan-tree-dump "Return value is \\\{\[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[6\\\], \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[5\\\], \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[4\\\], \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[3\\\], \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[2\\\], \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[1\\\], \[a-zA-Z0-9_\]+\(\\\(\[a-zA-Z\]\\\)\)?\\\[0\\\], 0\\\}" "crc"} } */ +/* { dg-final { scan-tree-dump "Polynomial's value is \\\{0, 0, 1, 1, 0, 0, 0, 1\\\}" "crc"} } */
\ No newline at end of file |