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 v2, rs6000] Implement 32- and 64-bit BE handling for -mno-speculate-indirect-jumps


On Tue, Jan 16, 2018 at 08:08:57PM -0600, Bill Schmidt wrote:
> This patch supercedes and extends https://gcc.gnu.org/ml/gcc-patches/2018-01/msg01479.html,
> adding the remaining big-endian support for -mno-speculate-indirect-jumps.
> This includes 32-bit support for indirect calls and sibling calls, and 
> 64-bit support for indirect calls.  The endian-neutral switch handling has
> already been committed.
> 
> Using -m32 -O2 on safe-indirect-jumps-1.c results in a test for a sibling 
> call, so this has been added as safe-indirect-jumps-8.c.  Also, 
> safe-indirect-jumps-7.c adds a variant that will not generate a sibling 
> call for -m32, so we still get indirect call coverage.
> 
> Bootstrapped and tested on powerpc64-linux-gnu and powerpc64le-linux-gnu 
> with no regressions.  Is this okay for trunk?

Okay for trunk and backports.  A few possible cleanups (okay with or
without, you need to get this in soon):

> -   (set_attr "length" "4,4,8,8")])
> +   (set (attr "length")
> +	(cond [(and (eq (symbol_ref "which_alternative") (const_int 0))
> +		    (eq (symbol_ref "rs6000_speculate_indirect_jumps")
> +			(const_int 1)))
> +		  (const_string "4")

You could leave out the "4" cases, it's the default.  Might be easier
to read.

I'd use "ne 0" instead of "eq 1", but this will work I guess.

> @@ -10909,7 +10982,13 @@
>      output_asm_insn (\"creqv 6,6,6\", operands);
>  
>    if (which_alternative >= 2)
> -    return \"b%T0\";
> +    {
> +      if (rs6000_speculate_indirect_jumps)
> +	return \"b%T0\";

You can write the block as a block ({}) instead of as a string ("*{}")
so you don't need all the backslashes.

Thanks for all the work!


Segher


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