From: Mariam Arutunian Date: Fri, 27 Jan 2023 14:24:56 +0000 (+0400) Subject: Addition in testsuit: - Added gcc/testsuite/gcc.dg/crc-misc.c test - In crc-26 added... X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=155ed5f338e4758618b27a82109dfe4ef671beb1;p=thirdparty%2Fgcc.git Addition in testsuit: - Added gcc/testsuite/gcc.dg/crc-misc.c test - In crc-26 added new check for "gencrc function calculates CRC" massage. --- diff --git a/gcc/testsuite/gcc.dg/crc-26.c b/gcc/testsuite/gcc.dg/crc-26.c index 298fb39c3759..9883190c886c 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 000000000000..d2efacb66928 --- /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 +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