https://gcc.gnu.org/g:ac829a89fb56cfd914d5e29ed4695e499b0dbc95

commit r14-9399-gac829a89fb56cfd914d5e29ed4695e499b0dbc95
Author: Richard Earnshaw <rearn...@arm.com>
Date:   Fri Mar 8 16:23:53 2024 +0000

    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.

Diff:
---
 gcc/testsuite/gcc.target/arm/bics_3.c | 19 ++++++++-----------
 1 file 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 e056b264e15..4d6938948a1 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 } } */
-

Reply via email to