From: Segher Boessenkool Date: Fri, 26 Jan 2018 21:08:47 +0000 (+0100) Subject: rs6000: Fix safe-indirect-jump-[18].c X-Git-Tag: upstream/12.2.0~33775 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b5d0b3d27ac0f109f014b23563ae38535e3815d4;p=platform%2Fupstream%2Fgcc.git rs6000: Fix safe-indirect-jump-[18].c This patch merges the safe-indirect-jump-1.c and -8.c testcases, since they do the same thing. On the 64-bit and AIX ABIs the indirect call is not a sibcall, since there is code generated after the call (the restore of r2). On the 32-bit non-AIX ABIs it is a sibcall. * gcc.target/powerpc/safe-indirect-jump-1.c: Build on all targets. Make expected output depend on whether we expect sibcalls or not. * gcc.target/powerpc/safe-indirect-jump-8.c: Delete (merged into safe-indirect-jump-1.c). From-SVN: r257108 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 730b148..42ba2fd 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,6 +1,13 @@ +2018-01-26 Segher Boessenkool + + * gcc.target/powerpc/safe-indirect-jump-1.c: Build on all targets. + Make expected output depend on whether we expect sibcalls or not. + * gcc.target/powerpc/safe-indirect-jump-8.c: Delete (merged into + safe-indirect-jump-1.c). + 2018-01-26 Damian Rouson - Alessandro Fanfarillo - Soren Rasmussen + Alessandro Fanfarillo + Soren Rasmussen Fortran 2018 teams tests. diff --git a/gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-1.c b/gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-1.c index 99cfab2..d1ab83a 100644 --- a/gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-1.c +++ b/gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-1.c @@ -1,4 +1,4 @@ -/* { dg-do compile { target { lp64 } } } */ +/* { dg-do compile } */ /* { dg-additional-options "-mno-speculate-indirect-jumps" } */ /* Test for deliberate misprediction of indirect calls. */ @@ -11,4 +11,10 @@ int bar () } /* { dg-final { scan-assembler "crset 2" } } */ -/* { dg-final { scan-assembler "beqctrl-" } } */ + +/* The AIX and ELFv2 ABIs don't allow a sibcall here. */ +/* { dg-final { scan-assembler "beqctrl-" { target { lp64 || { powerpc*-*-aix* } } } } } */ + +/* The other ABIs do allow a sibcall. */ +/* { dg-final { scan-assembler "beqctr-" { target { ilp32 && !powerpc*-*-aix* } } } } */ +/* { dg-final { scan-assembler {b \$} { target { ilp32 && !powerpc*-*-aix* } } } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-8.c b/gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-8.c deleted file mode 100644 index 0a6f231..0000000 --- a/gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-8.c +++ /dev/null @@ -1,16 +0,0 @@ -/* { dg-do compile { target { ilp32 } } } */ -/* { dg-skip-if "" { powerpc*-*-aix* } } */ -/* { dg-additional-options "-O2 -mno-speculate-indirect-jumps" } */ - -/* Test for deliberate misprediction of -m32 sibcalls. */ - -extern int (*f)(); - -int bar () -{ - return (*f) (); -} - -/* { dg-final { scan-assembler "crset 2" } } */ -/* { dg-final { scan-assembler "beqctr-" } } */ -/* { dg-final { scan-assembler {b \$} } } */