This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PING: PATCH [4/n]: Prepare x32: Permute the conversion and addition if one operand is a constant
On Wed, Jul 27, 2011 at 1:25 PM, Paolo Bonzini <bonzini@gnu.org> wrote:
> On 07/27/2011 07:29 PM, H.J. Lu wrote:
>>
>> If IRNORE_ADDRESS_WRAP_AROUND is TRUE, we
>> + ? also permute the conversion and addition of a constant. ?It is used to
>> + ? optimize cases where overflow of base + constant offset won't happen
>> or
>> + ? its behavior is implementation-defined for a given target. ?*/
>
> Regarding correctness: you're converting a SImode operation to DImode by
> "pushing in" the zero_extend operation. ?What makes you think that base +
> constant offset won't overflow in any case?
>
> And also: what are you gaining by allowing the wrap around? ?I don't need to
> know what ignore_address_wrap_around does, I need to know _why_ it is
> necessary.
>
We have
(zero_extend:DI (plus:SI (FOO:SI) (const_int Y)))
I want to convert it to
(plus:DI (zero_extend:DI (FOO:SI)) (const_int Y))
There is no zero-extend on (const_int Y). if FOO == 0xfffffffc and Y = 8,
(zero_extend:DI (plus:SI (FOO:SI) (const_int Y)))
gives 0x4 and
(plus:DI (zero_extend:DI (FOO:SI)) (const_int Y))
gives 0x100000004. If (plus:SI (FOO:SI) (const_int Y)) won't overflow
or its behavior is implementation-defined, the conversion is safe. If
it isn't the case, we should just drop it.
--
H.J.