This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: PATCH: PR middle-end/37012: numerous stackalign relatedtestsuitefailures on i686-apple-darwin9


Firstly PREFERRED_STACK_BOUNDARY / BITS_PER_UNIT has no problem, our change doesn't assume it the minimal stack unit.

Then for
gcc/function.c:#define STACK_BYTES (STACK_BOUNDARY / BITS_PER_UNIT) 
gcc/tree-nested.c:      size += ((align/BITS_PER_UNIT) - 1) & -(STACK_BOUNDARY/BITS_PER_UNIT);

I just find them unrelate to stack realign. If they work before, they should work now.

Thanks - Joey


-----Original Message-----
From: Jack Howarth [mailto:howarth@bromo.msbb.uc.edu] 
Sent: 2008年8月4日 22:59
To: Ye, Joey
Cc: H.J. Lu; gcc-patches@gcc.gnu.org; Guo, Xuepeng; ubizjak@gmail.com
Subject: Re: PATCH: PR middle-end/37012: numerous stackalign relatedtestsuitefailures on i686-apple-darwin9

Joey,
   I was wondering about the instances of...

grep -R STACK_BOUNDARY gcc  | grep BITS_PER_UNIT

gcc/function.c:#define STACK_BYTES (STACK_BOUNDARY / BITS_PER_UNIT)
gcc/function.c:  frame_alignment = PREFERRED_STACK_BOUNDARY / BITS_PER_UNIT;
gcc/calls.c:#define STACK_BYTES (PREFERRED_STACK_BOUNDARY / BITS_PER_UNIT)
gcc/calls.c:            & (PREFERRED_STACK_BOUNDARY / BITS_PER_UNIT - 1)));
gcc/explow.c:  int align = PREFERRED_STACK_BOUNDARY / BITS_PER_UNIT;
gcc/explow.c:      int align = PREFERRED_STACK_BOUNDARY / BITS_PER_UNIT;
gcc/explow.c:           % (PREFERRED_STACK_BOUNDARY / BITS_PER_UNIT)));
gcc/tree-nested.c:      size += ((align/BITS_PER_UNIT) - 1) & -(STACK_BOUNDARY/BITS_PER_UNIT);
gcc/cfgexpand.c:    int align = PREFERRED_STACK_BOUNDARY / BITS_PER_UNIT;
gcc/cfgexpand.c:      HOST_WIDE_INT align = PREFERRED_STACK_BOUNDARY / BITS_PER_UNIT;

in the gcc/gcc subdirectory (ouside of the config/i386
subdirectory), but HJ seems to think they will be okay.
                Jack


On Mon, Aug 04, 2008 at 10:14:44PM +0800, Ye, Joey wrote:
> 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));


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]