On Tue, Mar 13, 2012 at 9:09 PM, Uros Bizjak <ubiz...@gmail.com> wrote:
> On Tue, Mar 13, 2012 at 9:01 PM, H.J. Lu <hjl.to...@gmail.com> wrote:
>> On Tue, Mar 13, 2012 at 9:21 AM, Uros Bizjak <ubiz...@gmail.com> wrote:
>>> Hello!
>>>
>>> We allow addresses, zero extended with (AND (Dimode OP)
>>> (0x0ffffffff)). Since we now track address mode precisely, we should
>>> convert this operand to a SImode subreg before passing it further down
>>> of ix86_decompose_address function. This fixes a small hole, where
>>> operands in wrong mode could squeeze through.
>>>
>>> 2012-03-13  Uros Bizjak  <ubiz...@gmail.com>
>>>
>>>        * config/i386/i386.c (ix86_decompose_address): Handle subregs of
>>>        AND zero extended address correctly.
>>>
>>> Tested on x86_64-pc-linux-gnu {,-m32}, committed to mainline SVN.
>>
>> I think this caused:
>>
>> FAIL: gcc.target/i386/pr43766.c scan-assembler-not lea[lq]?[ \t]
>
> Ah, we also need to consider:
>
> Failed to match this instruction:
> (prefetch (and:DI (subreg:DI (plus:SI (ashift:SI (reg/v:SI 63 [ i ])
>                    (const_int 2 [0x2]))
>                (subreg:SI (reg/v/f:DI 62 [ a ]) 0)) 0)
>        (const_int 4294967295 [0xffffffff]))
>    (const_int 0 [0])
>    (const_int 3 [0x3]))

Fixed by attached patch.

Committed.

Uros.

Index: i386.c
===================================================================
--- i386.c      (revision 185351)
+++ i386.c      (working copy)
@@ -11436,11 +11436,11 @@
          addr = XEXP (addr, 0);

          /* Adjust SUBREGs.  */
-         if (GET_MODE (addr) == DImode)
+         if (GET_CODE (addr) == SUBREG
+             && GET_MODE (SUBREG_REG (addr)) == SImode)
+           addr = SUBREG_REG (addr);
+         else if (GET_MODE (addr) == DImode)
            addr = gen_rtx_SUBREG (SImode, addr, 0);
-         else if (GET_CODE (addr) == SUBREG
-                  && GET_MODE (SUBREG_REG (addr)) == SImode)
-           addr = SUBREG_REG (addr);
          else
            return 0;
        }

Reply via email to