diff options
author | Richard Earnshaw <rearnsha@arm.com> | 2024-03-08 16:23:53 +0000 |
---|---|---|
committer | Richard Earnshaw <rearnsha@arm.com> | 2024-03-08 17:06:18 +0000 |
commit | ac829a89fb56cfd914d5e29ed4695e499b0dbc95 (patch) | |
tree | de5a01fd4c9f03738f4a9ea400816a0d8a4b9454 | |
parent | 10c609191c4462133d6a4ea10a739167204f2cd3 (diff) | |
download | gcc-ac829a89fb56cfd914d5e29ed4695e499b0dbc95.zip gcc-ac829a89fb56cfd914d5e29ed4695e499b0dbc95.tar.gz gcc-ac829a89fb56cfd914d5e29ed4695e499b0dbc95.tar.bz2 |
arm: testsuite: tweak bics_3.c [PR113542]
This test was too simple, which meant that the compiler was sometimes
able to find a better optimization of the code than using a BICS
instruction. Fix this by changing the test slightly to produce a
sequence where BICS should always be the preferred solution.
gcc/testsuite:
PR target/113542
* gcc.target/arm/bics_3.c: Adjust code to something which should
always result in BICS.
-rw-r--r-- | gcc/testsuite/gcc.target/arm/bics_3.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/gcc/testsuite/gcc.target/arm/bics_3.c b/gcc/testsuite/gcc.target/arm/bics_3.c index e056b26..4d69389 100644 --- a/gcc/testsuite/gcc.target/arm/bics_3.c +++ b/gcc/testsuite/gcc.target/arm/bics_3.c @@ -2,13 +2,11 @@ /* { dg-options "-O2 --save-temps -fno-inline" } */ /* { dg-require-effective-target arm32 } */ -extern void abort (void); - int bics_si_test (int a, int b) { - if (a & ~b) - return 1; + if ((a & ~b) >= 0) + return 3; else return 0; } @@ -16,8 +14,8 @@ bics_si_test (int a, int b) int bics_si_test2 (int a, int b) { - if (a & ~ (b << 2)) - return 1; + if ((a & ~ (b << 2)) >= 0) + return 3; else return 0; } @@ -28,13 +26,12 @@ main (void) int a = 5; int b = 5; int c = 20; - if (bics_si_test (a, b)) - abort (); - if (bics_si_test2 (c, b)) - abort (); + if (bics_si_test (a, b) != 3) + __builtin_abort (); + if (bics_si_test2 (c, b) != 3) + __builtin_abort (); return 0; } /* { dg-final { scan-assembler-times "bics\tr\[0-9\]+, r\[0-9\]+, r\[0-9\]+" 2 } } */ /* { dg-final { scan-assembler-times "bics\tr\[0-9\]+, r\[0-9\]+, r\[0-9\]+, .sl #2" 1 } } */ - |