testsuite: Fix CRC testcases

Message ID 20241203072354.46945-1-garthlei@linux.alibaba.com
State New
Headers
Series testsuite: Fix CRC testcases |

Checks

Context Check Description
rivoscibot/toolchain-ci-rivos-lint success Lint passed
rivoscibot/toolchain-ci-rivos-apply-patch success Patch applied
rivoscibot/toolchain-ci-rivos-build--newlib-rv64gc-lp64d-non-multilib success Build passed
linaro-tcwg-bot/tcwg_gcc_build--master-arm success Build passed
rivoscibot/toolchain-ci-rivos-build--linux-rv64gc-lp64d-non-multilib success Build passed
rivoscibot/toolchain-ci-rivos-build--newlib-rv64gcv-lp64d-multilib success Build passed
rivoscibot/toolchain-ci-rivos-build--linux-rv64gc_zba_zbb_zbc_zbs-lp64d-multilib success Build passed
rivoscibot/toolchain-ci-rivos-build--linux-rv64gcv-lp64d-multilib success Build passed
linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_gcc_check--master-arm success Test passed
rivoscibot/toolchain-ci-rivos-test success Testing passed
linaro-tcwg-bot/tcwg_gcc_check--master-aarch64 success Test passed

Commit Message

Bohan Lei Dec. 3, 2024, 7:23 a.m. UTC
  Hi all,

The latest CRC optimization patches include some testcases that do not
work well.  Some testcases in gcc/testsuite/gcc.dg lead to UNRESOLVED
results when testing without an explicit -O<n> flag.  Other testcases in
gcc/testsuite/gcc.target/riscv do not work when testing with RV32
-march/-mabi options on riscv64* compilers, and in the opposite case.
This patch tries to deal with the aforementioned issues.

Thanks,
Bohan
---
 gcc/testsuite/gcc.dg/crc-linux-1.c                 | 2 +-
 gcc/testsuite/gcc.dg/crc-linux-2.c                 | 2 +-
 gcc/testsuite/gcc.dg/crc-linux-4.c                 | 2 +-
 gcc/testsuite/gcc.dg/crc-linux-5.c                 | 2 +-
 gcc/testsuite/gcc.dg/crc-not-crc-15.c              | 2 +-
 gcc/testsuite/gcc.dg/crc-side-instr-1.c            | 2 +-
 gcc/testsuite/gcc.dg/crc-side-instr-10.c           | 2 +-
 gcc/testsuite/gcc.dg/crc-side-instr-11.c           | 2 +-
 gcc/testsuite/gcc.dg/crc-side-instr-12.c           | 2 +-
 gcc/testsuite/gcc.dg/crc-side-instr-13.c           | 2 +-
 gcc/testsuite/gcc.dg/crc-side-instr-14.c           | 2 +-
 gcc/testsuite/gcc.dg/crc-side-instr-15.c           | 2 +-
 gcc/testsuite/gcc.dg/crc-side-instr-16.c           | 2 +-
 gcc/testsuite/gcc.dg/crc-side-instr-17.c           | 2 +-
 gcc/testsuite/gcc.dg/crc-side-instr-2.c            | 2 +-
 gcc/testsuite/gcc.dg/crc-side-instr-3.c            | 2 +-
 gcc/testsuite/gcc.dg/crc-side-instr-4.c            | 2 +-
 gcc/testsuite/gcc.dg/crc-side-instr-5.c            | 2 +-
 gcc/testsuite/gcc.dg/crc-side-instr-6.c            | 2 +-
 gcc/testsuite/gcc.dg/crc-side-instr-7.c            | 2 +-
 gcc/testsuite/gcc.dg/crc-side-instr-8.c            | 2 +-
 gcc/testsuite/gcc.dg/crc-side-instr-9.c            | 2 +-
 gcc/testsuite/gcc.target/riscv/crc-builtin-zbc32.c | 4 ++--
 gcc/testsuite/gcc.target/riscv/crc-builtin-zbc64.c | 4 ++--
 24 files changed, 26 insertions(+), 26 deletions(-)
  

Comments

Xi Ruoyao Dec. 3, 2024, 7:56 a.m. UTC | #1
On Tue, 2024-12-03 at 15:23 +0800, Bohan Lei wrote:
> 
> diff --git a/gcc/testsuite/gcc.dg/crc-linux-1.c
> b/gcc/testsuite/gcc.dg/crc-linux-1.c
> index 918b423a583..3261ba48b8b 100644
> --- a/gcc/testsuite/gcc.dg/crc-linux-1.c
> +++ b/gcc/testsuite/gcc.dg/crc-linux-1.c
> @@ -1,5 +1,5 @@
>  /* { dg-do compile } */
> -/* { dg-options "-fdump-tree-crc-details -w" } */
> +/* { dg-options "-O2 -fdump-tree-crc-details -w" } */
>  /* { dg-skip-if "" { *-*-* } { "-O0" "-O1" "-Os" "-O3" "-flto" } } */

No, the current consensus is moving them from gcc.dg to gcc.dg/torture.
to fix the issue.  See
https://gcc.gnu.org/pipermail/gcc-patches/2024-December/670619.html.
  
Bohan Lei Dec. 3, 2024, 9:14 a.m. UTC | #2
Thank you for pointing it out. I guess the RV32 issue may still exist.

Bohan

------------------------------------------------------------------
From:Xi Ruoyao <xry111@xry111.site>
Send Time:2024 Dec. 3 (Tue.) 15:56
To:Bohan Lei<garthlei@linux.alibaba.com>; "gcc-patches"<gcc-patches@gcc.gnu.org>
Cc:jeffreyalaw<jeffreyalaw@gmail.com>; mariamarutunian<mariamarutunian@gmail.com>
Subject:Re: [PATCH] testsuite: Fix CRC testcases


On Tue, 2024-12-03 at 15:23 +0800, Bohan Lei wrote:
> 
> diff --git a/gcc/testsuite/gcc.dg/crc-linux-1.c
> b/gcc/testsuite/gcc.dg/crc-linux-1.c
> index 918b423a583..3261ba48b8b 100644
> --- a/gcc/testsuite/gcc.dg/crc-linux-1.c
> +++ b/gcc/testsuite/gcc.dg/crc-linux-1.c
> @@ -1,5 +1,5 @@
>  /* { dg-do compile } */
> -/* { dg-options "-fdump-tree-crc-details -w" } */
> +/* { dg-options "-O2 -fdump-tree-crc-details -w" } */
>  /* { dg-skip-if "" { *-*-* } { "-O0" "-O1" "-Os" "-O3" "-flto" } } */

No, the current consensus is moving them from gcc.dg to gcc.dg/torture.
to fix the issue.  See
https://gcc.gnu.org/pipermail/gcc-patches/2024-December/670619.html.
  
Xi Ruoyao Dec. 4, 2024, 7:12 a.m. UTC | #3
On Tue, 2024-12-03 at 17:14 +0800, Bohan Lei wrote:
> Thank you for pointing it out. I guess the RV32 issue may still exist.

Please send v2 with only the RISC-V fixes if you can still reproduce the
issue.

> 
> Bohan
> 
> ------------------------------------------------------------------
> From:Xi Ruoyao <xry111@xry111.site>
> Send Time:2024 Dec. 3 (Tue.) 15:56
> To:Bohan Lei<garthlei@linux.alibaba.com>; "gcc-
> patches"<gcc-patches@gcc.gnu.org>
> Cc:jeffreyalaw<jeffreyalaw@gmail.com>;
> mariamarutunian<mariamarutunian@gmail.com>
> Subject:Re: [PATCH] testsuite: Fix CRC testcases
> 
> 
> On Tue, 2024-12-03 at 15:23 +0800, Bohan Lei wrote:
> > 
> > diff --git a/gcc/testsuite/gcc.dg/crc-linux-1.c
> > b/gcc/testsuite/gcc.dg/crc-linux-1.c
> > index 918b423a583..3261ba48b8b 100644
> > --- a/gcc/testsuite/gcc.dg/crc-linux-1.c
> > +++ b/gcc/testsuite/gcc.dg/crc-linux-1.c
> > @@ -1,5 +1,5 @@
> >   /* { dg-do compile } */
> > -/* { dg-options "-fdump-tree-crc-details -w" } */
> > +/* { dg-options "-O2 -fdump-tree-crc-details -w" } */
> >   /* { dg-skip-if "" { *-*-* } { "-O0" "-O1" "-Os" "-O3" "-flto" } }
> > */
> 
> No, the current consensus is moving them from gcc.dg to
> gcc.dg/torture.
> to fix the issue.  See
> https://gcc.gnu.org/pipermail/gcc-patches/2024-December/670619.html.
>
  
Bohan Lei Dec. 4, 2024, 7:54 a.m. UTC | #4
The RISC-V part has been fixed by another committed patch in
https://gcc.gnu.org/pipermail/gcc-patches/2024-December/670722.html.

------------------------------------------------------------------
From:Xi Ruoyao <xry111@xry111.site>
Send Time:2024 Dec. 4 (Wed.) 15:12
To:Bohan Lei<garthlei@linux.alibaba.com>
Cc:"gcc-patches"<gcc-patches@gcc.gnu.org>
Subject:Re: [PATCH] testsuite: Fix CRC testcases


On Tue, 2024-12-03 at 17:14 +0800, Bohan Lei wrote:
> Thank you for pointing it out. I guess the RV32 issue may still exist.

Please send v2 with only the RISC-V fixes if you can still reproduce the
issue.

> 
> Bohan
> 
> ------------------------------------------------------------------
> From:Xi Ruoyao <xry111@xry111.site>
> Send Time:2024 Dec. 3 (Tue.) 15:56
> To:Bohan Lei<garthlei@linux.alibaba.com>; "gcc-
> patches"<gcc-patches@gcc.gnu.org>
> Cc:jeffreyalaw<jeffreyalaw@gmail.com>;
> mariamarutunian<mariamarutunian@gmail.com>
> Subject:Re: [PATCH] testsuite: Fix CRC testcases
> 
> 
> On Tue, 2024-12-03 at 15:23 +0800, Bohan Lei wrote:
> > 
> > diff --git a/gcc/testsuite/gcc.dg/crc-linux-1.c
> > b/gcc/testsuite/gcc.dg/crc-linux-1.c
> > index 918b423a583..3261ba48b8b 100644
> > --- a/gcc/testsuite/gcc.dg/crc-linux-1.c
> > +++ b/gcc/testsuite/gcc.dg/crc-linux-1.c
> > @@ -1,5 +1,5 @@
> >   /* { dg-do compile } */
> > -/* { dg-options "-fdump-tree-crc-details -w" } */
> > +/* { dg-options "-O2 -fdump-tree-crc-details -w" } */
> >   /* { dg-skip-if "" { *-*-* } { "-O0" "-O1" "-Os" "-O3" "-flto" } }
> > */
> 
> No, the current consensus is moving them from gcc.dg to
> gcc.dg/torture.
> to fix the issue.  See
> https://gcc.gnu.org/pipermail/gcc-patches/2024-December/670619.html.
>
  
Jeff Law Dec. 4, 2024, 3:10 p.m. UTC | #5
On 12/3/24 12:56 AM, Xi Ruoyao wrote:
> On Tue, 2024-12-03 at 15:23 +0800, Bohan Lei wrote:
>>
>> diff --git a/gcc/testsuite/gcc.dg/crc-linux-1.c
>> b/gcc/testsuite/gcc.dg/crc-linux-1.c
>> index 918b423a583..3261ba48b8b 100644
>> --- a/gcc/testsuite/gcc.dg/crc-linux-1.c
>> +++ b/gcc/testsuite/gcc.dg/crc-linux-1.c
>> @@ -1,5 +1,5 @@
>>   /* { dg-do compile } */
>> -/* { dg-options "-fdump-tree-crc-details -w" } */
>> +/* { dg-options "-O2 -fdump-tree-crc-details -w" } */
>>   /* { dg-skip-if "" { *-*-* } { "-O0" "-O1" "-Os" "-O3" "-flto" } } */
> 
> No, the current consensus is moving them from gcc.dg to gcc.dg/torture.
> to fix the issue.  See
> https://gcc.gnu.org/pipermail/gcc-patches/2024-December/670619.html.
Yea, I moved them yesterday.

Jeff
  

Patch

diff --git a/gcc/testsuite/gcc.dg/crc-linux-1.c b/gcc/testsuite/gcc.dg/crc-linux-1.c
index 918b423a583..3261ba48b8b 100644
--- a/gcc/testsuite/gcc.dg/crc-linux-1.c
+++ b/gcc/testsuite/gcc.dg/crc-linux-1.c
@@ -1,5 +1,5 @@ 
 /* { dg-do compile } */
-/* { dg-options "-fdump-tree-crc-details -w" } */
+/* { dg-options "-O2 -fdump-tree-crc-details -w" } */
 /* { dg-skip-if "" { *-*-* } { "-O0" "-O1" "-Os" "-O3" "-flto" } } */
 
 #include <stdlib.h>
diff --git a/gcc/testsuite/gcc.dg/crc-linux-2.c b/gcc/testsuite/gcc.dg/crc-linux-2.c
index 990a28cef6f..156d9986aaf 100644
--- a/gcc/testsuite/gcc.dg/crc-linux-2.c
+++ b/gcc/testsuite/gcc.dg/crc-linux-2.c
@@ -1,5 +1,5 @@ 
 /* { dg-do compile } */
-/* { dg-options "-fdump-tree-crc-details" } */
+/* { dg-options "-O2 -fdump-tree-crc-details" } */
 /* { dg-skip-if "" { *-*-* } { "-O0" "-O1" "-Os" "-flto" } } */
 
 #include <stddef.h>
diff --git a/gcc/testsuite/gcc.dg/crc-linux-4.c b/gcc/testsuite/gcc.dg/crc-linux-4.c
index 50cbbba49d2..81f35ae2bc5 100644
--- a/gcc/testsuite/gcc.dg/crc-linux-4.c
+++ b/gcc/testsuite/gcc.dg/crc-linux-4.c
@@ -1,5 +1,5 @@ 
 /* { dg-do compile } */
-/* { dg-options "-fdump-tree-crc-details -w" } */
+/* { dg-options "-O2 -fdump-tree-crc-details -w" } */
 /* { dg-skip-if "" { *-*-* } { "-O0" "-O1" "-Os" "-flto" } } */
 
 /* We don't detect, it's optimized to branch-less CRC.  */
diff --git a/gcc/testsuite/gcc.dg/crc-linux-5.c b/gcc/testsuite/gcc.dg/crc-linux-5.c
index ff3cc25fb66..873257daa8c 100644
--- a/gcc/testsuite/gcc.dg/crc-linux-5.c
+++ b/gcc/testsuite/gcc.dg/crc-linux-5.c
@@ -1,5 +1,5 @@ 
 /* { dg-do compile } */
-/* { dg-options "-fdump-tree-crc-details" } */
+/* { dg-options "-O2 -fdump-tree-crc-details" } */
 /* { dg-skip-if "" { *-*-* } { "-O0" "-O1" "-Os" "-flto" } } */
 
 #include <stddef.h>
diff --git a/gcc/testsuite/gcc.dg/crc-not-crc-15.c b/gcc/testsuite/gcc.dg/crc-not-crc-15.c
index cf7993a2c49..05b46ae68da 100644
--- a/gcc/testsuite/gcc.dg/crc-not-crc-15.c
+++ b/gcc/testsuite/gcc.dg/crc-not-crc-15.c
@@ -1,5 +1,5 @@ 
 /* { dg-do compile } */
-/* { dg-options "-fdump-tree-crc" } */
+/* { dg-options "-O2 -fdump-tree-crc" } */
 /* { dg-skip-if "" { *-*-* } { "-O0" "-O1" "-Os" "-O3" "-flto" } } */
 
 /* With -O3 the cycles is split into 2,
diff --git a/gcc/testsuite/gcc.dg/crc-side-instr-1.c b/gcc/testsuite/gcc.dg/crc-side-instr-1.c
index 69738d5c866..d9977d9865f 100644
--- a/gcc/testsuite/gcc.dg/crc-side-instr-1.c
+++ b/gcc/testsuite/gcc.dg/crc-side-instr-1.c
@@ -1,5 +1,5 @@ 
 /* { dg-do compile } */
-/* { dg-options "-fdump-tree-crc-details" } */
+/* { dg-options "-O2 -fdump-tree-crc-details" } */
 /* { dg-skip-if "" { *-*-* } { "-O0" "-O1" "-Os" "-flto" } } */
 
 #include <stdint.h>
diff --git a/gcc/testsuite/gcc.dg/crc-side-instr-10.c b/gcc/testsuite/gcc.dg/crc-side-instr-10.c
index 765572cf9b7..3c807aec9db 100644
--- a/gcc/testsuite/gcc.dg/crc-side-instr-10.c
+++ b/gcc/testsuite/gcc.dg/crc-side-instr-10.c
@@ -1,5 +1,5 @@ 
 /* { dg-do compile } */
-/* { dg-options "-fdump-tree-crc-details" } */
+/* { dg-options "-O2 -fdump-tree-crc-details" } */
 /* { dg-skip-if "" { *-*-* } { "-O0" "-O1" "-Os" "-flto" } } */
 
 typedef unsigned short ee_u16;
diff --git a/gcc/testsuite/gcc.dg/crc-side-instr-11.c b/gcc/testsuite/gcc.dg/crc-side-instr-11.c
index d8a7a88de5d..8c73c0186b0 100644
--- a/gcc/testsuite/gcc.dg/crc-side-instr-11.c
+++ b/gcc/testsuite/gcc.dg/crc-side-instr-11.c
@@ -1,5 +1,5 @@ 
 /* { dg-do compile } */
-/* { dg-options "-fdump-tree-crc-details" } */
+/* { dg-options "-O2 -fdump-tree-crc-details" } */
 /* { dg-skip-if "" { *-*-* } { "-O0" "-O1" "-Os" "-flto" } } */
 
 typedef unsigned short ee_u16;
diff --git a/gcc/testsuite/gcc.dg/crc-side-instr-12.c b/gcc/testsuite/gcc.dg/crc-side-instr-12.c
index 4511c08dc6b..7098ed074ac 100644
--- a/gcc/testsuite/gcc.dg/crc-side-instr-12.c
+++ b/gcc/testsuite/gcc.dg/crc-side-instr-12.c
@@ -1,5 +1,5 @@ 
 /* { dg-do compile } */
-/* { dg-options "-fdump-tree-crc-details" } */
+/* { dg-options "-O2 -fdump-tree-crc-details" } */
 /* { dg-skip-if "" { *-*-* } { "-O0" "-O1" "-Os" "-flto" } } */
 
 typedef unsigned short ee_u16;
diff --git a/gcc/testsuite/gcc.dg/crc-side-instr-13.c b/gcc/testsuite/gcc.dg/crc-side-instr-13.c
index 968a35bf4df..7a0fea11eb3 100644
--- a/gcc/testsuite/gcc.dg/crc-side-instr-13.c
+++ b/gcc/testsuite/gcc.dg/crc-side-instr-13.c
@@ -1,5 +1,5 @@ 
 /* { dg-do compile } */
-/* { dg-options "-fdump-tree-crc-details" } */
+/* { dg-options "-O2 -fdump-tree-crc-details" } */
 /* { dg-skip-if "" { *-*-* } { "-O0" "-O1" "-Os" "-flto" } } */
 
 typedef unsigned short ee_u16;
diff --git a/gcc/testsuite/gcc.dg/crc-side-instr-14.c b/gcc/testsuite/gcc.dg/crc-side-instr-14.c
index c8b671f571e..da2d0434253 100644
--- a/gcc/testsuite/gcc.dg/crc-side-instr-14.c
+++ b/gcc/testsuite/gcc.dg/crc-side-instr-14.c
@@ -1,5 +1,5 @@ 
 /* { dg-do compile } */
-/* { dg-options "-fdump-tree-crc-details" } */
+/* { dg-options "-O2 -fdump-tree-crc-details" } */
 /* { dg-skip-if "" { *-*-* } { "-O0" "-O1" "-Os" "-flto" } } */
 
 #include <stdio.h>
diff --git a/gcc/testsuite/gcc.dg/crc-side-instr-15.c b/gcc/testsuite/gcc.dg/crc-side-instr-15.c
index ec3c879034d..78ef1e91ee7 100644
--- a/gcc/testsuite/gcc.dg/crc-side-instr-15.c
+++ b/gcc/testsuite/gcc.dg/crc-side-instr-15.c
@@ -1,5 +1,5 @@ 
 /* { dg-do compile } */
-/* { dg-options "-fdump-tree-crc-details" } */
+/* { dg-options "-O2 -fdump-tree-crc-details" } */
 /* { dg-skip-if "" { *-*-* } { "-O0" "-O1" "-Os" "-flto" } } */
 
 typedef unsigned short ee_u16;
diff --git a/gcc/testsuite/gcc.dg/crc-side-instr-16.c b/gcc/testsuite/gcc.dg/crc-side-instr-16.c
index 2f14c90ab11..665d0571f23 100644
--- a/gcc/testsuite/gcc.dg/crc-side-instr-16.c
+++ b/gcc/testsuite/gcc.dg/crc-side-instr-16.c
@@ -1,5 +1,5 @@ 
 /* { dg-do compile } */
-/* { dg-options "-fdump-tree-crc-details" } */
+/* { dg-options "-O2 -fdump-tree-crc-details" } */
 /* { dg-skip-if "" { *-*-* } { "-O0" "-O1" "-Os" "-flto" } } */
 
 typedef unsigned short ee_u16;
diff --git a/gcc/testsuite/gcc.dg/crc-side-instr-17.c b/gcc/testsuite/gcc.dg/crc-side-instr-17.c
index 8f98df87446..cf67042a4f9 100644
--- a/gcc/testsuite/gcc.dg/crc-side-instr-17.c
+++ b/gcc/testsuite/gcc.dg/crc-side-instr-17.c
@@ -1,5 +1,5 @@ 
 /* { dg-do compile } */
-/* { dg-options "-fdump-tree-crc-details" } */
+/* { dg-options "-O2 -fdump-tree-crc-details" } */
 /* { dg-skip-if "" { *-*-* } { "-O0" "-O1" "-Os" "-flto" } } */
 
 typedef unsigned short ee_u16;
diff --git a/gcc/testsuite/gcc.dg/crc-side-instr-2.c b/gcc/testsuite/gcc.dg/crc-side-instr-2.c
index 23dfa3edc17..146b12c27c0 100644
--- a/gcc/testsuite/gcc.dg/crc-side-instr-2.c
+++ b/gcc/testsuite/gcc.dg/crc-side-instr-2.c
@@ -1,5 +1,5 @@ 
 /* { dg-do compile } */
-/* { dg-options "-fdump-tree-crc-details" } */
+/* { dg-options "-O2 -fdump-tree-crc-details" } */
 /* { dg-skip-if "" { *-*-* } { "-O0" "-O1" "-Os" "-flto" } } */
 
 #include <stdint.h>
diff --git a/gcc/testsuite/gcc.dg/crc-side-instr-3.c b/gcc/testsuite/gcc.dg/crc-side-instr-3.c
index 731c6624a2e..67ecef66692 100644
--- a/gcc/testsuite/gcc.dg/crc-side-instr-3.c
+++ b/gcc/testsuite/gcc.dg/crc-side-instr-3.c
@@ -1,5 +1,5 @@ 
 /* { dg-do compile } */
-/* { dg-options "-fdump-tree-crc-details" } */
+/* { dg-options "-O2 -fdump-tree-crc-details" } */
 /* { dg-skip-if "" { *-*-* } { "-O0" "-O1" "-Os" "-flto" } } */
 
 #include <stdint.h>
diff --git a/gcc/testsuite/gcc.dg/crc-side-instr-4.c b/gcc/testsuite/gcc.dg/crc-side-instr-4.c
index 7612c52c67e..294157719ca 100644
--- a/gcc/testsuite/gcc.dg/crc-side-instr-4.c
+++ b/gcc/testsuite/gcc.dg/crc-side-instr-4.c
@@ -1,5 +1,5 @@ 
 /* { dg-do compile } */
-/* { dg-options "-fdump-tree-crc-details" } */
+/* { dg-options "-O2 -fdump-tree-crc-details" } */
 /* { dg-skip-if "" { *-*-* } { "-O0" "-O1" "-Os" "-flto" } } */
 
 #include <stdint.h>
diff --git a/gcc/testsuite/gcc.dg/crc-side-instr-5.c b/gcc/testsuite/gcc.dg/crc-side-instr-5.c
index ef97028e881..75ccf3d984d 100644
--- a/gcc/testsuite/gcc.dg/crc-side-instr-5.c
+++ b/gcc/testsuite/gcc.dg/crc-side-instr-5.c
@@ -1,5 +1,5 @@ 
 /* { dg-do compile } */
-/* { dg-options "-fdump-tree-crc-details" } */
+/* { dg-options "-O2 -fdump-tree-crc-details" } */
 /* { dg-skip-if "" { *-*-* } { "-O0" "-O1" "-Os" "-flto" } } */
 
 #include <stdint.h>
diff --git a/gcc/testsuite/gcc.dg/crc-side-instr-6.c b/gcc/testsuite/gcc.dg/crc-side-instr-6.c
index f559fa94a53..e0006793efe 100644
--- a/gcc/testsuite/gcc.dg/crc-side-instr-6.c
+++ b/gcc/testsuite/gcc.dg/crc-side-instr-6.c
@@ -1,5 +1,5 @@ 
 /* { dg-do compile } */
-/* { dg-options "-fdump-tree-crc-details" } */
+/* { dg-options "-O2 -fdump-tree-crc-details" } */
 /* { dg-skip-if "" { *-*-* } { "-O0" "-O1" "-Os" "-flto" } } */
 
 #include <stdint.h>
diff --git a/gcc/testsuite/gcc.dg/crc-side-instr-7.c b/gcc/testsuite/gcc.dg/crc-side-instr-7.c
index d80aadc6ccb..5887ae18e27 100644
--- a/gcc/testsuite/gcc.dg/crc-side-instr-7.c
+++ b/gcc/testsuite/gcc.dg/crc-side-instr-7.c
@@ -1,5 +1,5 @@ 
 /* { dg-do compile } */
-/* { dg-options "-fdump-tree-crc-details" } */
+/* { dg-options "-O2 -fdump-tree-crc-details" } */
 /* { dg-skip-if "" { *-*-* } { "-O0" "-O1" "-Os" "-flto" } } */
 
 #include <stdio.h>
diff --git a/gcc/testsuite/gcc.dg/crc-side-instr-8.c b/gcc/testsuite/gcc.dg/crc-side-instr-8.c
index 23263e156a1..562eb608e40 100644
--- a/gcc/testsuite/gcc.dg/crc-side-instr-8.c
+++ b/gcc/testsuite/gcc.dg/crc-side-instr-8.c
@@ -1,5 +1,5 @@ 
 /* { dg-do compile } */
-/* { dg-options "-fdump-tree-crc-details" } */
+/* { dg-options "-O2 -fdump-tree-crc-details" } */
 /* { dg-skip-if "" { *-*-* } { "-O0" "-O1" "-Os" "-flto" } } */
 
 #include <stdio.h>
diff --git a/gcc/testsuite/gcc.dg/crc-side-instr-9.c b/gcc/testsuite/gcc.dg/crc-side-instr-9.c
index 477318e05e0..7b2fc6a9b3d 100644
--- a/gcc/testsuite/gcc.dg/crc-side-instr-9.c
+++ b/gcc/testsuite/gcc.dg/crc-side-instr-9.c
@@ -1,5 +1,5 @@ 
 /* { dg-do compile } */
-/* { dg-options "-fdump-tree-crc-details" } */
+/* { dg-options "-O2 -fdump-tree-crc-details" } */
 /* { dg-skip-if "" { *-*-* } { "-O0" "-O1" "-Os" "-flto" } } */
 
 typedef unsigned short ee_u16;
diff --git a/gcc/testsuite/gcc.target/riscv/crc-builtin-zbc32.c b/gcc/testsuite/gcc.target/riscv/crc-builtin-zbc32.c
index 20d7d25f60e..a6703c4684b 100644
--- a/gcc/testsuite/gcc.target/riscv/crc-builtin-zbc32.c
+++ b/gcc/testsuite/gcc.target/riscv/crc-builtin-zbc32.c
@@ -1,5 +1,5 @@ 
-/* { dg-do compile { target { riscv32*-*-* } } } */
-/* { dg-options "-march=rv32gc_zbc" } */
+/* { dg-do compile } */
+/* { dg-options "-march=rv32gc_zbc -mabi=ilp32d" } */
 
 #include <stdint-gcc.h>
 
diff --git a/gcc/testsuite/gcc.target/riscv/crc-builtin-zbc64.c b/gcc/testsuite/gcc.target/riscv/crc-builtin-zbc64.c
index d99a78daaa9..97bbe052ec1 100644
--- a/gcc/testsuite/gcc.target/riscv/crc-builtin-zbc64.c
+++ b/gcc/testsuite/gcc.target/riscv/crc-builtin-zbc64.c
@@ -1,5 +1,5 @@ 
-/* { dg-do compile { target { riscv64*-*-* } } } */
-/* { dg-options "-march=rv64gc_zbc" } */
+/* { dg-do compile } */
+/* { dg-options "-march=rv64gc_zbc -mabi=lp64d" } */
 
 #include <stdint-gcc.h>