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.
{
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}";
--- /dev/null
+/* 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);
+}