diff options
author | Alexandre Oliva <oliva@adacore.com> | 2021-12-04 00:17:18 -0300 |
---|---|---|
committer | Alexandre Oliva <oliva@gnu.org> | 2021-12-07 22:14:02 -0300 |
commit | 0485ce9128f272fe7ccb48672f69d7be6bb26a9c (patch) | |
tree | d93e13b124e2130e2a4fd57cd3582b3cd37e0a5d /gcc/config/i386/sse.md | |
parent | 1f6b0003b6601656bef4869d9c724e2a263cb64c (diff) | |
download | gcc-0485ce9128f272fe7ccb48672f69d7be6bb26a9c.zip gcc-0485ce9128f272fe7ccb48672f69d7be6bb26a9c.tar.gz gcc-0485ce9128f272fe7ccb48672f69d7be6bb26a9c.tar.bz2 |
[PR103149] detach values through mem only if general regs won't do
When hardening compares or conditional branches, we perform redundant
tests, and to prevent them from being optimized out, we use asm
statements that preserve a value used in a compare, but in a way that
the compiler can no longer assume it's the same value, so it can't
optimize the redundant test away.
We used to use +g, but that requires general regs or mem. You might
think that, if a reg constraint can't be satisfied, the register
allocator will fall back to memory, but that's not so: we decide on
matching MEMs very early on, by using the same addressable operand on
both input and output, and only if the constraint does not allow
registers. If it does, we use gimple registers and then pseudos as
inputs and outputs, and then inputs can be substituted by equivalent
expressions, and then, if no register contraint fits (e.g. because
that mode won't fit in general regs, or won't fit in regs at all), the
register allocator will give up before even trying to allocate some
temporary memory to unify input and output.
This patch arranges for us to create and use the temporary stack slot
if we can tell the mode requires memory, or won't otherwise fit in
general regs, and thus to use +m for that asm.
for gcc/ChangeLog
PR middle-end/103149
* gimple-harden-conditionals.cc (detach_value): Use memory if
general regs won't do.
for gcc/testsuite/ChangeLog
PR middle-end/103149
* gcc.target/aarch64/pr103149.c: New.
Diffstat (limited to 'gcc/config/i386/sse.md')
0 files changed, 0 insertions, 0 deletions