gcc/gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-1.c

15 lines
321 B
C
Raw Normal View History

backport: rs6000.c (rs6000_opt_vars): Add entry for -mspeculate-indirect-jumps. [gcc] 2018-01-17 Bill Schmidt <wschmidt@linux.vnet.ibm.com> Backport from mainline 2018-01-16 Bill Schmidt <wschmidt@linux.vnet.ibm.com> * config/rs6000/rs6000.c (rs6000_opt_vars): Add entry for -mspeculate-indirect-jumps. * config/rs6000/rs6000.md (*call_indirect_elfv2<mode>): Disable for -mno-speculate-indirect-jumps. (*call_indirect_elfv2<mode>_nospec): New define_insn. (*call_value_indirect_elfv2<mode>): Disable for -mno-speculate-indirect-jumps. (*call_value_indirect_elfv2<mode>_nospec): New define_insn. (indirect_jump): Emit different RTL for -mno-speculate-indirect-jumps. (*indirect_jump<mode>): Disable for -mno-speculate-indirect-jumps. (*indirect_jump<mode>_nospec): New define_insn. (tablejump): Emit different RTL for -mno-speculate-indirect-jumps. (tablejumpsi): Disable for -mno-speculate-indirect-jumps. (tablejumpsi_nospec): New define_expand. (tablejumpdi): Disable for -mno-speculate-indirect-jumps. (tablejumpdi_nospec): New define_expand. (*tablejump<mode>_internal1): Disable for -mno-speculate-indirect-jumps. (*tablejump<mode>_internal1_nospec): New define_insn. * config/rs6000/rs6000.opt (mspeculate-indirect-jumps): New option. Backport from mainline 2018-01-17 Bill Schmidt <wschmidt@linux.vnet.ibm.com> * config/rs6000/rs6000.md (*call_indirect_nonlocal_sysv<mode>): Generate different code for -mno-speculate-indirect-jumps. (*call_value_indirect_nonlocal_sysv<mode>): Likewise. (*call_indirect_aix<mode>): Disable for -mno-speculate-indirect-jumps. (*call_indirect_aix<mode>_nospec): New define_insn. (*call_value_indirect_aix<mode>): Disable for -mno-speculate-indirect-jumps. (*call_value_indirect_aix<mode>_nospec): New define_insn. (*sibcall_nonlocal_sysv<mode>): Generate different code for -mno-speculate-indirect-jumps. (*sibcall_value_nonlocal_sysv<mode>): Likewise. [gcc/testsuite] 2018-01-17 Bill Schmidt <wschmidt@linux.vnet.ibm.com> Backport from mainline 2018-01-16 Bill Schmidt <wschmidt@linux.vnet.ibm.com> * gcc.target/powerpc/safe-indirect-jump-1.c: New file. * gcc.target/powerpc/safe-indirect-jump-2.c: New file. * gcc.target/powerpc/safe-indirect-jump-3.c: New file. * gcc.target/powerpc/safe-indirect-jump-4.c: New file. * gcc.target/powerpc/safe-indirect-jump-5.c: New file. * gcc.target/powerpc/safe-indirect-jump-6.c: New file. Backport from mainline 2018-01-17 Bill Schmidt <wschmidt@linux.vnet.ibm.com> * gcc.target/powerpc/safe-indirect-jump-1.c: Remove endian restriction, but still restrict to 64-bit. * gcc.target/powerpc/safe-indirect-jump-7.c: New file. * gcc.target/powerpc/safe-indirect-jump-8.c: New file. From-SVN: r256832
2018-01-18 02:34:10 +01:00
/* { dg-do compile { target { lp64 } } } */
/* { dg-additional-options "-mno-speculate-indirect-jumps" } */
/* Test for deliberate misprediction of indirect calls. */
extern int (*f)();
int bar ()
{
return (*f) ();
}
backport: re PR target/83946 (Safe Indirect Jumps broken on AIX) [gcc] 2018-01-21 Bill Schmidt <wschmidt@linux.vnet.ibm.com> Backport from mainline 2018-01-21 Bill Schmidt <wschmidt@linux.vnet.ibm.com> David Edelsohn <dje.gcc@gmail.com> PR target/83946 * config/rs6000/rs6000.md (*call_indirect_nonlocal_sysv<mode>): Change "crset eq" to "crset 2". (*call_value_indirect_nonlocal_sysv<mode>): Likewise. (*call_indirect_aix<mode>_nospec): Likewise. (*call_value_indirect_aix<mode>_nospec): Likewise. (*call_indirect_elfv2<mode>_nospec): Likewise. (*call_value_indirect_elfv2<mode>_nospec): Likewise. (*sibcall_nonlocal_sysv<mode>): Change "crset eq" to "crset 2"; change assembly output from . to $. (*sibcall_value_nonlocal_sysv<mode>): Likewise. (indirect_jump<mode>_nospec): Change assembly output from . to $. (*tablejump<mode>_internal1_nospec): Likewise. [gcc/testsuite] 2018-01-21 Bill Schmidt <wschmidt@linux.vnet.ibm.com> Backport from mainline 2018-01-21 Bill Schmidt <wschmidt@linux.vnet.ibm.com> David Edelsohn <dje.gcc@gmail.com> PR target/83946 * gcc.target/powerpc/safe-indirect-jump-1.c: Change expected assembly output from "crset eq" to "crset 2". * gcc.target/powerpc/safe-indirect-jump-2.c: Change expected assembly output from . to $. * gcc.target/powerpc/safe-indirect-jump-3.c: Likewise. * gcc.target/powerpc/safe-indirect-jump-1.c: Change expected assembly output from "crset eq" to "crset 2". * gcc.target/powerpc/safe-indirect-jump-8.c: Change expected assembly output from "crset eq" to "crset 2", and from . to $. From-SVN: r256932
2018-01-21 14:32:58 +01:00
/* { dg-final { scan-assembler "crset 2" } } */
backport: rs6000.c (rs6000_opt_vars): Add entry for -mspeculate-indirect-jumps. [gcc] 2018-01-17 Bill Schmidt <wschmidt@linux.vnet.ibm.com> Backport from mainline 2018-01-16 Bill Schmidt <wschmidt@linux.vnet.ibm.com> * config/rs6000/rs6000.c (rs6000_opt_vars): Add entry for -mspeculate-indirect-jumps. * config/rs6000/rs6000.md (*call_indirect_elfv2<mode>): Disable for -mno-speculate-indirect-jumps. (*call_indirect_elfv2<mode>_nospec): New define_insn. (*call_value_indirect_elfv2<mode>): Disable for -mno-speculate-indirect-jumps. (*call_value_indirect_elfv2<mode>_nospec): New define_insn. (indirect_jump): Emit different RTL for -mno-speculate-indirect-jumps. (*indirect_jump<mode>): Disable for -mno-speculate-indirect-jumps. (*indirect_jump<mode>_nospec): New define_insn. (tablejump): Emit different RTL for -mno-speculate-indirect-jumps. (tablejumpsi): Disable for -mno-speculate-indirect-jumps. (tablejumpsi_nospec): New define_expand. (tablejumpdi): Disable for -mno-speculate-indirect-jumps. (tablejumpdi_nospec): New define_expand. (*tablejump<mode>_internal1): Disable for -mno-speculate-indirect-jumps. (*tablejump<mode>_internal1_nospec): New define_insn. * config/rs6000/rs6000.opt (mspeculate-indirect-jumps): New option. Backport from mainline 2018-01-17 Bill Schmidt <wschmidt@linux.vnet.ibm.com> * config/rs6000/rs6000.md (*call_indirect_nonlocal_sysv<mode>): Generate different code for -mno-speculate-indirect-jumps. (*call_value_indirect_nonlocal_sysv<mode>): Likewise. (*call_indirect_aix<mode>): Disable for -mno-speculate-indirect-jumps. (*call_indirect_aix<mode>_nospec): New define_insn. (*call_value_indirect_aix<mode>): Disable for -mno-speculate-indirect-jumps. (*call_value_indirect_aix<mode>_nospec): New define_insn. (*sibcall_nonlocal_sysv<mode>): Generate different code for -mno-speculate-indirect-jumps. (*sibcall_value_nonlocal_sysv<mode>): Likewise. [gcc/testsuite] 2018-01-17 Bill Schmidt <wschmidt@linux.vnet.ibm.com> Backport from mainline 2018-01-16 Bill Schmidt <wschmidt@linux.vnet.ibm.com> * gcc.target/powerpc/safe-indirect-jump-1.c: New file. * gcc.target/powerpc/safe-indirect-jump-2.c: New file. * gcc.target/powerpc/safe-indirect-jump-3.c: New file. * gcc.target/powerpc/safe-indirect-jump-4.c: New file. * gcc.target/powerpc/safe-indirect-jump-5.c: New file. * gcc.target/powerpc/safe-indirect-jump-6.c: New file. Backport from mainline 2018-01-17 Bill Schmidt <wschmidt@linux.vnet.ibm.com> * gcc.target/powerpc/safe-indirect-jump-1.c: Remove endian restriction, but still restrict to 64-bit. * gcc.target/powerpc/safe-indirect-jump-7.c: New file. * gcc.target/powerpc/safe-indirect-jump-8.c: New file. From-SVN: r256832
2018-01-18 02:34:10 +01:00
/* { dg-final { scan-assembler "beqctrl-" } } */