This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH v3, rs6000] Add -mspeculate-indirect-jumps option and implement non-speculating bctr / bctrl
- From: Segher Boessenkool <segher at kernel dot crashing dot org>
- To: Bill Schmidt <wschmidt at linux dot vnet dot ibm dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, David Edelsohn <dje dot gcc at gmail dot com>
- Date: Tue, 16 Jan 2018 06:35:04 -0600
- Subject: Re: [PATCH v3, rs6000] Add -mspeculate-indirect-jumps option and implement non-speculating bctr / bctrl
- Authentication-results: sourceware.org; auth=none
- References: <cc7c2dcb-0536-de30-5999-d1b192b3978c@linux.vnet.ibm.com>
Hi!
On Mon, Jan 15, 2018 at 05:09:06PM -0600, Bill Schmidt wrote:
> @@ -12933,9 +12974,27 @@
> ""
> {
> if (TARGET_32BIT)
> - emit_jump_insn (gen_tablejumpsi (operands[0], operands[1]));
> + {
> + if (rs6000_speculate_indirect_jumps)
> + emit_jump_insn (gen_tablejumpsi (operands[0], operands[1]));
> + else
> + {
> + rtx ccreg = gen_reg_rtx (CCmode);
> + rtx jump = gen_tablejumpsi_nospec (operands[0], operands[1], ccreg);
> + emit_jump_insn (jump);
> + }
> + }
> else
> - emit_jump_insn (gen_tablejumpdi (operands[0], operands[1]));
> + {
> + if (rs6000_speculate_indirect_jumps)
> + emit_jump_insn (gen_tablejumpdi (operands[0], operands[1]));
> + else
> + {
> + rtx ccreg = gen_reg_rtx (CCmode);
> + rtx jump = gen_tablejumpdi_nospec (operands[0], operands[1], ccreg);
> + emit_jump_insn (jump);
> + }
> + }
> DONE;
> })
This is easier to read if you swap the "if"s (put the
rs6000_speculate_indirect_jumps test on the outside).
Okay for trunk with or without such a change. Also okay for the branches
after some testing (esp. on other ABIs, it is easy to break those together
with -mno-speculate-indirect-branches since no one sane would use that
combo on purpose).
Thanks!
Segher