Commit 3439487f by Jakub Jelinek Committed by Jakub Jelinek

re PR target/92841 (Optimize -fstack-protector-strong code generation a bit)

	PR target/92841
	* config/i386/i386.md (*stack_protect_set_3): For pic_32bit_operand
	always use lea{q}, no matter what value which_alternative has.

	* gcc.target/i386/pr92841-2.c: New test.

From-SVN: r279633
parent 99675d5c
2019-12-20 Jakub Jelinek <jakub@redhat.com>
PR target/92841
* config/i386/i386.md (*stack_protect_set_3): For pic_32bit_operand
always use lea{q}, no matter what value which_alternative has.
PR target/93002
* config/i386/i386.md (dec reg; cmp $-1, reg; jne lab): New
define_peephole2.
......@@ -19863,12 +19863,13 @@
{
output_asm_insn ("mov{q}\t{%3, %1|%1, %3}", operands);
output_asm_insn ("mov{q}\t{%1, %0|%0, %1}", operands);
if (which_alternative == 0)
if (pic_32bit_operand (operands[2], DImode))
return "lea{q}\t{%E2, %1|%1, %E2}";
else if (which_alternative == 0)
return "mov{l}\t{%k2, %k1|%k1, %k2}";
else if (which_alternative == 2)
return "movabs{q}\t{%2, %1|%1, %2}";
else if (pic_32bit_operand (operands[2], DImode)
|| ix86_use_lea_for_mov (insn, operands + 1))
else if (ix86_use_lea_for_mov (insn, operands + 1))
return "lea{q}\t{%E2, %1|%1, %E2}";
else
return "mov{q}\t{%2, %1|%1, %2}";
......
2019-12-20 Jakub Jelinek <jakub@redhat.com>
PR target/92841
* gcc.target/i386/pr92841-2.c: New test.
PR target/93002
* gcc.target/i386/pr93002.c: New test.
......
/* PR target/92841 */
/* { dg-do compile { target { { { *-*-linux* } && lp64 } && fstack_protector } } } */
/* { dg-options "-O2 -fpic -fstack-protector-strong -masm=att" } */
/* { dg-final { scan-assembler "leaq\tbuf2\\\(%rip\\\)," } } */
static char buf2[64];
void bar (char *, char *);
void
foo ()
{
char buf[64];
char *p = buf2;
asm ("" : "+a" (p));
char *q = buf;
asm ("" : "+r" (q));
bar (p, q);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment