PR 100170: Fix eq/ne tests on power10.
authorMichael Meissner <meissner@linux.ibm.com>
Tue, 27 Jul 2021 01:27:00 +0000 (21:27 -0400)
committerMichael Meissner <meissner@linux.ibm.com>
Tue, 27 Jul 2021 01:32:39 +0000 (21:32 -0400)
This patch updates eq/ne tests in the testsuite to adjust the test if
power10 code generation is used.

2021-07-26  Michael Meissner  <meissner@linux.ibm.com>

gcc/testsuite/
PR testsuite/100170
* gcc.target/powerpc/ppc-eq0-1.c: Adjust insn counts if power10
code is generated.
* gcc.target/powerpc/ppc-ne0-1.c: (ne0): Adjust insn counts if
power10 code is generated.
(plus_ne0): Move to ppc-ne0-2.c.
(cmp_plus_ne): Likewise.
(plus_ne0_cmp): Likewise.
* gcc.target/powerpc/ppc-ne0-2.c: New file.

gcc/testsuite/gcc.target/powerpc/ppc-eq0-1.c
gcc/testsuite/gcc.target/powerpc/ppc-ne0-1.c
gcc/testsuite/gcc.target/powerpc/ppc-ne0-2.c [new file with mode: 0644]

index 496a6e3..9f9b13e 100644 (file)
@@ -7,4 +7,4 @@ int foo(int x)
   return x == 0;
 }
 
-/* { dg-final { scan-assembler "cntlzw|isel" } } */
+/* { dg-final { scan-assembler {\m(cntlzw|isel|setbc)\M} } } */
index 63c4b60..27ed38f 100644 (file)
@@ -1,33 +1,13 @@
 /* PR target/51274 */
 /* { dg-do compile } */
-/* { dg-options "-O2 -mno-isel" } */
+/* { dg-options "-O2" } */
 
-/* { dg-final { scan-assembler-times "addic" 4 } } */
-/* { dg-final { scan-assembler-times "subfe" 1 } } */
-/* { dg-final { scan-assembler-times "addze" 3 } } */
+/* { dg-final { scan-assembler-times {\mcmp[wd]i\M} 1 { target {   has_arch_pwr10 } } } } */
+/* { dg-final { scan-assembler-times {\msetbcr\M}   1 { target {   has_arch_pwr10 } } } } */
+/* { dg-final { scan-assembler-times {\maddic\M}    1 { target { ! has_arch_pwr10 } } } } */
+/* { dg-final { scan-assembler-times {\msubfe\M}    1 { target { ! has_arch_pwr10 } } } } */
 
 long ne0(long a)
 {
   return a != 0;
 }
-
-long plus_ne0(long a, long b)
-{
-  return (a != 0) + b;
-}
-
-void dummy(void);
-
-void cmp_plus_ne0(long a, long b)
-{
-  if ((a != 0) + b)
-    dummy();
-}
-
-long plus_ne0_cmp(long a, long b)
-{
-  a = (a != 0) + b;
-  if (a)
-    dummy();
-  return a;
-}
diff --git a/gcc/testsuite/gcc.target/powerpc/ppc-ne0-2.c b/gcc/testsuite/gcc.target/powerpc/ppc-ne0-2.c
new file mode 100644 (file)
index 0000000..9b0b025
--- /dev/null
@@ -0,0 +1,27 @@
+/* PR target/51274 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+/* { dg-final { scan-assembler-times {\maddic\M} 3 } } */
+/* { dg-final { scan-assembler-times {\maddze\M} 3 } } */
+
+long plus_ne0(long a, long b)
+{
+  return (a != 0) + b;
+}
+
+void dummy(void);
+
+void cmp_plus_ne0(long a, long b)
+{
+  if ((a != 0) + b)
+    dummy();
+}
+
+long plus_ne0_cmp(long a, long b)
+{
+  a = (a != 0) + b;
+  if (a)
+    dummy();
+  return a;
+}