diff options
author | Mariam Arutunian <mariamarutunian@gmail.com> | 2023-01-27 18:24:56 +0400 |
---|---|---|
committer | Jeff Law <jlaw@ventanamicro> | 2023-03-21 09:03:21 -0600 |
commit | 155ed5f338e4758618b27a82109dfe4ef671beb1 (patch) | |
tree | 701a7493690430c8c8694f993ffc95b71ce277c6 | |
parent | 0708601ba88e6ded34b8087094a5a24140dee285 (diff) | |
download | gcc-155ed5f338e4758618b27a82109dfe4ef671beb1.tar.gz |
Addition in testsuit: - Added gcc/testsuite/gcc.dg/crc-misc.c test - In crc-26 added new check for "gencrc function calculates CRC" massage.
-rw-r--r-- | gcc/testsuite/gcc.dg/crc-26.c | 3 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/crc-misc.c | 23 |
2 files changed, 25 insertions, 1 deletions
diff --git a/gcc/testsuite/gcc.dg/crc-26.c b/gcc/testsuite/gcc.dg/crc-26.c index 298fb39c375..9883190c886 100644 --- a/gcc/testsuite/gcc.dg/crc-26.c +++ b/gcc/testsuite/gcc.dg/crc-26.c @@ -25,4 +25,5 @@ uint8_t gencrc (uint8_t *data) /* { 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_\]* \\\^ \[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" } } */
\ 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_\]* \(<<|>>\) \[0-9]+;" "crc" } } */ +/* { dg-final { scan-tree-dump "gencrc function calculates CRC." "crc"} } */
\ No newline at end of file diff --git a/gcc/testsuite/gcc.dg/crc-misc.c b/gcc/testsuite/gcc.dg/crc-misc.c new file mode 100644 index 00000000000..d2efacb6692 --- /dev/null +++ b/gcc/testsuite/gcc.dg/crc-misc.c @@ -0,0 +1,23 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-crc-details" } */ + +#include <stdint.h> +uint32_t _crc32(uint32_t crc, uint32_t data) { + int i; + crc = crc ^ data; + + for (i = 0; i < 32; i++) { + if (crc & 0x80000000) + crc = (crc << 1) ^ 0x04C11DB7; + else + crc = (crc << 1); + } + + return crc; +} + +/* { dg-final { scan-tree-dump "_crc32 function maybe calculates CRC and returns it." "crc"} } */ +/* { dg-final { scan-tree-dump "Return size is 32" "crc"} } */ +/* { dg-final { scan-tree-dump "Loop iteration number is 31" "crc"} } */ +/* { dg-final { scan-tree-dump "Bit forward" "crc"} } */ +/* { dg-final { scan-tree-dump "_crc32 function calculates CRC." "crc"} } */
\ No newline at end of file |