This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v3, rs6000] Add -mspeculate-indirect-jumps option and implement non-speculating bctr / bctrl


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]