This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH v2, rs6000] Implement 32- and 64-bit BE handling for -mno-speculate-indirect-jumps
- 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: Wed, 17 Jan 2018 14:38:49 -0600
- Subject: Re: [PATCH v2, rs6000] Implement 32- and 64-bit BE handling for -mno-speculate-indirect-jumps
- Authentication-results: sourceware.org; auth=none
- References: <3e150d8a-f6be-4334-b4ed-63155bfc4119@linux.vnet.ibm.com>
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