http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47744

--- Comment #16 from Uros Bizjak <ubizjak at gmail dot com> 2011-07-17 21:14:05 
UTC ---
Following patch to original ix86_decompose_address solves all failures for me:

--cut here--
Index: i386.c
===================================================================
--- i386.c    (revision 176373)
+++ i386.c    (working copy)
@@ -11149,8 +11149,11 @@ ix86_decompose_address (rtx addr, struct
         return 0;
           break;

-        case REG:
         case SUBREG:
+          if (GET_CODE (op) != REG)
+        return 0;
+
+        case REG:
           if (!base)
         base = op;
           else if (!index)
--cut here--

The patch simply prevents subregs of anything else than registers in addresses.

So, instead of mess as in comment 14, we have a sequence of two instructions:

(insn 185 87 89 3 (set (reg:DI 0 ax)
        (plus:DI (reg/f:DI 7 sp)
            (const_int 200 [0xc8]))) pr47744.c:5 248 {*lea_1}
     (nil))

(insn 89 185 90 3 (set (reg:SI 40 r11 [177])
        (plus:SI (plus:SI (mult:SI (reg:SI 40 r11 [175])
                    (const_int 8 [0x8]))
                (reg:SI 0 ax))
            (const_int -160 [0xffffffffffffff60]))) pr47744.c:5 286
{*lea_general_3}
     (nil))

Please note, that "normal" lea instructions are now generated, no need for some
special x32 versions.

BTW: I'd also argue that this sequence is more correct w.r.t. to overflows, but
I didn't investigate this since it is already late in the night here...

Reply via email to