aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/crc-18.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/crc-18.c')
-rw-r--r--gcc/testsuite/gcc.dg/crc-18.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/crc-18.c b/gcc/testsuite/gcc.dg/crc-18.c
new file mode 100644
index 0000000..b023fc2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/crc-18.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-crc" } */
+
+#include <stdint.h>
+
+//xor is done in case lsb is 0
+int16_t not_crc(int16_t crc, int8_t a) {
+ int i;
+ crc ^= a;
+ for (i = 0; i < 8; ++i) {
+ if (crc << 15 == 0)
+ crc = (crc >> 1) ^ 0xA001;
+ else
+ crc = crc >> 1;
+ }
+ return crc;
+}
+
+/* { dg-final { scan-tree-dump-times "Attention! not_crc function calculates CRC." 0 "crc"} } */
+