------- Comment #30 from hjl dot tools at gmail dot com 2009-02-22 19:28 ------- (In reply to comment #29) > I mean aligned(64). > I guess something like this then? > Index: config/i386/i386.c > =================================================================== > --- config/i386/i386.c (revision 144373) > +++ config/i386/i386.c (working copy) > @@ -19351,6 +19351,12 @@ unsigned int > ix86_local_alignment (tree type, enum machine_mode mode, > unsigned int align) > { > + /* We don't want to align DImode to 64bit for compilation with > + -mpreferred-stack-boundary=2 to not enforce dynamic stack alignment > + prologue. */ > + if (mode == DImode && !TARGET_64BIT && ix86_preferred_stack_boundary < 64) > + align = 32; > +
It will always align DI to 4 byte in 32bit mode. Did you mean to replace it with the code below? > /* If TYPE is NULL, we are allocating a stack slot for caller-save > register in MODE. We will return the largest alignment of XF > and DF. */ > @@ -19360,6 +19366,12 @@ ix86_local_alignment (tree type, enum ma > align = GET_MODE_ALIGNMENT (DFmode); > return align; > } > + if (!TARGET_64BIT > + && align == 64 > + && ix86_preferred_stack_boundary < 64 > + && (mode == DImode || (type && TYPE_MODE (type) == DImode)) > + && (!type || !TYPE_USER_ALIGN (type))) > + align = 32; > TYPE_USER_ALIGN isn't set on DImode due to canonical type: Breakpoint 5, ix86_local_alignment (type=0x7ffff7ed2900, mode=VOIDmode, align=256) at /export/gnu/src/gcc-work/gcc/gcc/config/i386/i386.c:19433 19433 if (!type) (gdb) call debug_tree (type) <integer_type 0x7ffff7ed2900 long long unsigned int sizes-gimplified public unsigned DI size <integer_cst 0x7ffff7ec1c30 type <integer_type 0x7ffff7ed20c0 bit_size_type> constant 64> unit size <integer_cst 0x7ffff7ec1c60 type <integer_type 0x7ffff7ed2000 unsigned int> constant 8> align 64 symtab 0 alias set -1 canonical type 0x7ffff7ed2900 precision 64 min <integer_cst 0x7ffff7ec1c90 0> max <integer_cst 0x7ffff7ec1c00 18446744073709551615> pointer_to_this <pointer_type 0x7ffff7ee8780>> (gdb) -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39137