From: Michael Meissner Date: Tue, 27 Jul 2021 01:27:00 +0000 (-0400) Subject: PR 100170: Fix eq/ne tests on power10. X-Git-Tag: upstream/12.2.0~6176 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5485e820cd0554886af282265198c7433c64c7b9;p=platform%2Fupstream%2Fgcc.git PR 100170: Fix eq/ne tests on power10. This patch updates eq/ne tests in the testsuite to adjust the test if power10 code generation is used. 2021-07-26 Michael Meissner 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. --- diff --git a/gcc/testsuite/gcc.target/powerpc/ppc-eq0-1.c b/gcc/testsuite/gcc.target/powerpc/ppc-eq0-1.c index 496a6e3..9f9b13e 100644 --- a/gcc/testsuite/gcc.target/powerpc/ppc-eq0-1.c +++ b/gcc/testsuite/gcc.target/powerpc/ppc-eq0-1.c @@ -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} } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/ppc-ne0-1.c b/gcc/testsuite/gcc.target/powerpc/ppc-ne0-1.c index 63c4b60..27ed38f 100644 --- a/gcc/testsuite/gcc.target/powerpc/ppc-ne0-1.c +++ b/gcc/testsuite/gcc.target/powerpc/ppc-ne0-1.c @@ -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 index 0000000..9b0b025 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/ppc-ne0-2.c @@ -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; +}