This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Fix PR target/24284 (take 2)
- From: Eric Botcazou <ebotcazou at libertysurf dot fr>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 13 Oct 2005 00:17:06 +0200
- Subject: Fix PR target/24284 (take 2)
The previous patch has fixed the 32-bit mode but broken the 64-bit mode...
The problem boils down to
static rtx
gen_stack_pointer_inc (rtx increment)
{
if (TARGET_ARCH64)
return gen_adddi3 (stack_pointer_rtx, stack_pointer_rtx, increment);
else
return gen_addsi3 (stack_pointer_rtx, stack_pointer_rtx, increment);
}
and its sibling gen_stack_pointer_dec: addsi3 is a define_insn while adddi3 is
a define_expand (although always emitting 1 insn if TARGET_ARCH64) so
gen_addsi3 generates bodies of insn while gen_adddi3 generates insns.
Fixed by not being lazy and building the patterns by hand.
Bootstrapped/regtested on SPARC/Solaris 10 (mainline, RTL check, multilib), on
SPARC/Solaris 9 (4.0 branch, 64-bit) and SPARC/Solaris 8 (4.0 branch, 32-bit)
and applied to mainline and 4.0 branch.
2005-10-12 Eric Botcazou <ebotcazou@libertysurf.fr>
PR target/24284
* config/sparc/sparc.c (gen_stack_pointer_inc): Build by hand.
(gen_stack_pointer_dec): Likewise.
--
Eric Botcazou
Index: config/sparc/sparc.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sparc/sparc.c,v
retrieving revision 1.382
diff -u -p -r1.382 sparc.c
--- config/sparc/sparc.c 10 Oct 2005 22:24:46 -0000 1.382
+++ config/sparc/sparc.c 11 Oct 2005 21:19:33 -0000
@@ -3826,10 +3826,11 @@ gen_save_register_window (rtx increment)
static rtx
gen_stack_pointer_inc (rtx increment)
{
- if (TARGET_ARCH64)
- return gen_adddi3 (stack_pointer_rtx, stack_pointer_rtx, increment);
- else
- return gen_addsi3 (stack_pointer_rtx, stack_pointer_rtx, increment);
+ return gen_rtx_SET (VOIDmode,
+ stack_pointer_rtx,
+ gen_rtx_PLUS (Pmode,
+ stack_pointer_rtx,
+ increment));
}
/* Generate a decrement for the stack pointer. */
@@ -3837,10 +3838,11 @@ gen_stack_pointer_inc (rtx increment)
static rtx
gen_stack_pointer_dec (rtx decrement)
{
- if (TARGET_ARCH64)
- return gen_subdi3 (stack_pointer_rtx, stack_pointer_rtx, decrement);
- else
- return gen_subsi3 (stack_pointer_rtx, stack_pointer_rtx, decrement);
+ return gen_rtx_SET (VOIDmode,
+ stack_pointer_rtx,
+ gen_rtx_MINUS (Pmode,
+ stack_pointer_rtx,
+ decrement));
}
/* Expand the function prologue. The prologue is responsible for reserving