This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
RE: PATCH: PR middle-end/37012: numerous stackalign related testsuitefailures on i686-apple-darwin9
- From: "Ye, Joey" <joey dot ye at intel dot com>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>, <gcc-patches at gcc dot gnu dot org>
- Cc: "Guo, Xuepeng" <xuepeng dot guo at intel dot com>, <ubizjak at gmail dot com>
- Date: Mon, 4 Aug 2008 22:14:44 +0800
- Subject: RE: PATCH: PR middle-end/37012: numerous stackalign related testsuitefailures on i686-apple-darwin9
- References: <20080804124408.GA16877@lucon.org>
The patch will definitely work better on Darwin. I'm only wondering if all STACK_BOUNDARY / BITS_PER_UNIT has been replaced.
Thanks - Joey
-----Original Message-----
From: H.J. Lu [mailto:hjl.tools@gmail.com]
Sent: 2008年8月4日 20:44
To: gcc-patches@gcc.gnu.org
Cc: Ye, Joey; Guo, Xuepeng; ubizjak@gmail.com
Subject: PATCH: PR middle-end/37012: numerous stackalign related testsuitefailures on i686-apple-darwin9
We used STACK_BOUNDARY / BITS_PER_UNIT as the size of register when
we were pushing/popping register to align stack. But the size of
register is UNITS_PER_WORD and STACK_BOUNDARY / BITS_PER_UNIT isn't
UNITS_PER_WORD on i686-apple-darwin9:
darwin.h:#define STACK_BOUNDARY 128
This patch changes uses UNITS_PER_WORD instead. It fixes many
failures on i686-apple-darwin9. Joey, what do you think?
H.J.
----
2008-08-04 H.J. Lu <hongjiu.lu@intel.com>
PR middle-end/37012
* config/i386/i386.c (ix86_expand_prologue): Use UNITS_PER_WORD
instead of STACK_BOUNDARY / BITS_PER_UNIT to align stack.
(ix86_expand_epilogue): Likewise.
--- i386.c.drap 2008-08-03 09:50:05.000000000 -0700
+++ gcc/config/i386/i386.c 2008-08-03 12:16:53.000000000 -0700
@@ -7658,14 +7666,13 @@ ix86_expand_prologue (void)
rtx x, y;
int align_bytes = crtl->stack_alignment_needed / BITS_PER_UNIT;
int param_ptr_offset = (call_used_regs[REGNO (crtl->drap_reg)]
- ? 0 : STACK_BOUNDARY / BITS_PER_UNIT);
+ ? 0 : UNITS_PER_WORD);
gcc_assert (stack_realign_drap);
/* Grab the argument pointer. */
x = plus_constant (stack_pointer_rtx,
- (STACK_BOUNDARY / BITS_PER_UNIT
- + param_ptr_offset));
+ (UNITS_PER_WORD + param_ptr_offset));
y = crtl->drap_reg;
/* Only need to push parameter pointer reg if it is caller
@@ -7692,8 +7699,7 @@ ix86_expand_prologue (void)
expand_builtin_return_addr etc. */
x = crtl->drap_reg;
x = gen_frame_mem (Pmode,
- plus_constant (x,
- -(STACK_BOUNDARY / BITS_PER_UNIT)));
+ plus_constant (x, -UNITS_PER_WORD));
insn = emit_insn (gen_push (x));
RTX_FRAME_RELATED_P (insn) = 1;
}
@@ -7857,7 +7863,7 @@ ix86_expand_prologue (void)
/* vDRAP is setup but after reload it turns out stack realign
isn't necessary, here we will emit prologue to setup DRAP
without stack realign adjustment */
- int drap_bp_offset = STACK_BOUNDARY / BITS_PER_UNIT * 2;
+ int drap_bp_offset = UNITS_PER_WORD * 2;
rtx x = plus_constant (hard_frame_pointer_rtx, drap_bp_offset);
insn = emit_insn (gen_rtx_SET (VOIDmode, crtl->drap_reg, x));
}
@@ -8056,11 +8062,11 @@ ix86_expand_epilogue (int style)
if (crtl->drap_reg && crtl->stack_realign_needed)
{
int param_ptr_offset = (call_used_regs[REGNO (crtl->drap_reg)]
- ? 0 : STACK_BOUNDARY / BITS_PER_UNIT);
+ ? 0 : UNITS_PER_WORD);
gcc_assert (stack_realign_drap);
emit_insn ((*ix86_gen_add3) (stack_pointer_rtx,
crtl->drap_reg,
- GEN_INT (-(STACK_BOUNDARY / BITS_PER_UNIT
+ GEN_INT (-(UNITS_PER_WORD
+ param_ptr_offset))));
if (!call_used_regs[REGNO (crtl->drap_reg)])
emit_insn ((*ix86_gen_pop1) (crtl->drap_reg));