From b5d0b3d27ac0f109f014b23563ae38535e3815d4 Mon Sep 17 00:00:00 2001 From: Segher Boessenkool Date: Fri, 26 Jan 2018 22:08:47 +0100 Subject: [PATCH] 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 --- gcc/testsuite/ChangeLog | 11 +++++++++-- .../gcc.target/powerpc/safe-indirect-jump-1.c | 10 ++++++++-- .../gcc.target/powerpc/safe-indirect-jump-8.c | 16 ---------------- 3 files changed, 17 insertions(+), 20 deletions(-) delete mode 100644 gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-8.c diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 730b1488508..42ba2fd857b 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 99cfab29e6e..d1ab83a11d4 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 0a6f2312d94..00000000000 --- 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 \$} } } */ -- 2.30.2