aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/crc-17.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/crc-17.c')
-rw-r--r--gcc/testsuite/gcc.dg/crc-17.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/crc-17.c b/gcc/testsuite/gcc.dg/crc-17.c
new file mode 100644
index 0000000..9f04c04
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/crc-17.c
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-crc" } */
+
+#include <stdint.h>
+//in one case is called shift left, in another shift right
+uint16_t not_crc(uint16_t crc, uint8_t a) {
+ int i;
+ crc ^= a;
+ for (i = 0; i < 8; ++i) {
+ if (crc & 1)
+ crc = (crc << 1) ^ 0xA001;
+ else
+ crc = crc >> 1;
+ }
+ return crc;
+}
+
+/* { dg-final { scan-tree-dump-times "Attention! not_crc function calculates CRC." 0 "crc"} } */
+