http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47744
H.J. Lu <hjl.tools at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ubizjak at gmail dot com --- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> 2011-02-15 06:26:32 UTC --- A kludge: diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 98fa75d..290907d 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -11735,6 +11735,40 @@ ix86_decompose_address (rtx addr, struct ix86_address * out) if (disp == const0_rtx && (base || index)) disp = NULL_RTX; + if (TARGET_X32 + && base + && GET_MODE (base) == ptr_mode + && GET_CODE (base) == SUBREG + && (disp == NULL_RTX + || disp == const0_rtx + || CONST_INT_P (disp)) + && GET_CODE (base_reg) == PLUS) + { + rtx op0 = XEXP (base_reg, 0); + rtx op1 = XEXP (base_reg, 1); + rtx c; + if (REG_P (op0) && CONST_INT_P (op1)) + { + base_reg = op0; + c = op1; + } + else if (REG_P (op1) && CONST_INT_P (op0)) + { + base_reg = op1; + c = op0; + } + else + return 0; + + if (disp == NULL_RTX + || disp == const0_rtx) + disp = c; + else + disp = GEN_INT (INTVAL (disp) + INTVAL (c)); + + base = gen_rtx_REG (ptr_mode, REGNO (base_reg)); + } + /* Allow arg pointer and stack pointer as index if there is not scaling. */ if (base_reg && index_reg && scale == 1 && (index_reg == arg_pointer_rtx