[RFC][PR target/39726 P4 regression] match.pd pattern to do type narrowing
Jeff Law
law@redhat.com
Mon Feb 2 18:04:00 GMT 2015
On 02/02/15 09:59, Joseph Myers wrote:
> On Sat, 31 Jan 2015, Jeff Law wrote:
>
>> The nice thing about wrapping the result inside a convert is the types for the
>> inner operations will propagate from the type of the inner operands, which is
>> exactly what we want. We then remove the hack assigning type and instead the
>> original type will be used for the outermost convert.
>
> Those inner operands still need converting to unsigned for arithmetic.
Yes.
>
>> And FWIW, there's no reason to restrict the pattern to just masking off the
>> sign bit. That's what the PR complains about, but we can do considerably
>> better here. That's part of the reason why I put in the iterators -- to
>> generalize this to more cases.
>
> Well, we want to move shorten_binary_op and shorten_compare to the new
> mechanism.
Absolutely. If we could have match.pd cover those cases, that'd be a
significant validation of match.pd for this class of problems. Seems
like gcc-6 stuff to me though.
I haven't looked at those routines in a long time, but reviewing them
seems wise both in the immediate term WRT this bug and ensuring we're
doing the right thing for the various corner cases.
Jeff
More information about the Gcc-patches
mailing list