This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix trunc_int_for_mode in eliminate_regs_in_insn (PR target/38208)
On Fri, Nov 21, 2008 at 5:42 AM, Richard Guenther
<richard.guenther@gmail.com> wrote:
> On Fri, Nov 21, 2008 at 2:33 PM, Jakub Jelinek <jakub@redhat.com> wrote:
>> Hi!
>>
>> gcc.c-torture/compile/20080806-1.c now fails on i386 at -O3
>> -fomit-frame-pointer -funroll-loops, because gas warns about
>> addw $65544, %dx. My memcpy optimization patch just changed what comes up
>> from the tree optimizers, but it is correct. But when
>> eliminate_regs_in_insn is called on:
>>
>> (insn:HI 6 5 7 2 20080806-1.c:16 (parallel [
>> (set (reg:HI 58 [ pretmp.42 ])
>> (plus:HI (subreg:HI (reg/f:SI 20 frame) 0)
>> (const_int 136 [0x88])))
>> (clobber (reg:CC 17 flags))
>> ]) 293 {*addhi_1_lea} (expr_list:REG_UNUSED (reg:CC 17 flags)
>> (nil)))
>>
>> and wants to eliminate (reg:SI 20 frame) for
>> (plus:SI (reg:SI sp) (const_int 65408 [0xff80]))
>> it adds 136 to 0xff80, but truncates it for SImode (GET_MODE (reg))
>> instead of the mode in which the PLUS is performed (HImode,
>> GET_MODE (plus_cst_src)). So
>> (set (reg:HI 1 dx [orig:58 pretmp.42 ] [58])
>> (plus:HI (reg:HI 1 dx [orig:58 pretmp.42 ] [58])
>> (const_int 65544 [0x10008])))
>> is created, which is of course invalid.
>>
>> The following patch fixes that, bootstrapped/regtested on x86_64-linux,
>> ok for trunk?
>
> Ok.
>
> Thanks,
> Richard.
>
>> 2008-11-21 Jakub Jelinek <jakub@redhat.com>
>>
>> PR target/38208
>> * reload1.c (eliminate_regs_in_insn): For trunc_int_for_mode use
>> mode of PLUS, not mode of the eliminated register.
>>
Don't branches have the same bug?
--
H.J.