This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix allocate_stack_worker_* (PR target/38130)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 18 Nov 2008 13:37:33 +0100
- Subject: [PATCH] Fix allocate_stack_worker_* (PR target/38130)
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
Hi!
Match_dup between input and output operands in these patterns is completely
unnecessary and breaks passes like web, which expects it can separate input
from output operands. From asms we convert "+r" into "=r" and "0" and
so should do allocate_stack_worker_*.
Tested by Danny Smith, approved on IRC by Honza, committed to trunk.
2008-11-18 Jakub Jelinek <jakub@redhat.com>
PR target/38130
* config/i386/i386.md (allocate_stack_worker_32,
allocate_stack_worker_64): Don't use match_dup between input and
output operand.
(allocate_stack): Adjust gen_stack_worker_{32,64} caller.
* config/i386/i386.c (ix86_expand_prologue): Likewise.
--- gcc/config/i386/i386.md.jj 2008-10-20 16:59:10.000000000 +0200
+++ gcc/config/i386/i386.md 2008-11-17 23:20:28.000000000 +0100
@@ -20196,9 +20196,10 @@
(set_attr "mode" "DI")])
(define_insn "allocate_stack_worker_32"
- [(set (match_operand:SI 0 "register_operand" "+a")
- (unspec_volatile:SI [(match_dup 0)] UNSPECV_STACK_PROBE))
- (set (reg:SI SP_REG) (minus:SI (reg:SI SP_REG) (match_dup 0)))
+ [(set (match_operand:SI 0 "register_operand" "=a")
+ (unspec_volatile:SI [(match_operand:SI 1 "register_operand" "0")]
+ UNSPECV_STACK_PROBE))
+ (set (reg:SI SP_REG) (minus:SI (reg:SI SP_REG) (match_dup 1)))
(clobber (reg:CC FLAGS_REG))]
"!TARGET_64BIT && TARGET_STACK_PROBE"
"call\t___chkstk"
@@ -20206,9 +20207,10 @@
(set_attr "length" "5")])
(define_insn "allocate_stack_worker_64"
- [(set (match_operand:DI 0 "register_operand" "+a")
- (unspec_volatile:DI [(match_dup 0)] UNSPECV_STACK_PROBE))
- (set (reg:DI SP_REG) (minus:DI (reg:DI SP_REG) (match_dup 0)))
+ [(set (match_operand:DI 0 "register_operand" "=a")
+ (unspec_volatile:DI [(match_operand:DI 1 "register_operand" "0")]
+ UNSPECV_STACK_PROBE))
+ (set (reg:DI SP_REG) (minus:DI (reg:DI SP_REG) (match_dup 1)))
(clobber (reg:DI R10_REG))
(clobber (reg:DI R11_REG))
(clobber (reg:CC FLAGS_REG))]
@@ -20240,9 +20242,9 @@
{
x = copy_to_mode_reg (Pmode, operands[1]);
if (TARGET_64BIT)
- x = gen_allocate_stack_worker_64 (x);
+ x = gen_allocate_stack_worker_64 (x, x);
else
- x = gen_allocate_stack_worker_32 (x);
+ x = gen_allocate_stack_worker_32 (x, x);
emit_insn (x);
}
--- gcc/config/i386/i386.c.jj 2008-11-15 11:14:35.000000000 +0100
+++ gcc/config/i386/i386.c 2008-11-17 23:06:06.000000000 +0100
@@ -7989,9 +7989,9 @@ ix86_expand_prologue (void)
emit_move_insn (eax, GEN_INT (allocate));
if (TARGET_64BIT)
- insn = gen_allocate_stack_worker_64 (eax);
+ insn = gen_allocate_stack_worker_64 (eax, eax);
else
- insn = gen_allocate_stack_worker_32 (eax);
+ insn = gen_allocate_stack_worker_32 (eax, eax);
insn = emit_insn (insn);
RTX_FRAME_RELATED_P (insn) = 1;
t = gen_rtx_PLUS (Pmode, stack_pointer_rtx, GEN_INT (-allocate));
Jakub