Re: [RFC][PR target/39726 P4 regression] match.pd pattern to do type narrowing

2015-02-11 Thread Joseph Myers
On Tue, 10 Feb 2015, Jeff Law wrote: > I think the way to go is to always convert the inner operands to an unsigned > type. In fact, everything except the outer convert should be using an > unsigned type of the same size/precision as @0's type. The outer convert > should, of course, be the final

Re: [RFC][PR target/39726 P4 regression] match.pd pattern to do type narrowing

2015-02-11 Thread Jakub Jelinek
On Wed, Feb 11, 2015 at 08:56:20AM -0700, Jeff Law wrote: > On 02/11/15 04:16, Richard Biener wrote: > >> > >>Application of this pattern (and the one I posted for 47477) is a concern > >>for targets that don't do sub-word arithmetic/logicals. But I just did a > >>sniff test of one such target (v8

Re: [RFC][PR target/39726 P4 regression] match.pd pattern to do type narrowing

2015-02-11 Thread Jeff Law
On 02/11/15 04:16, Richard Biener wrote: Application of this pattern (and the one I posted for 47477) is a concern for targets that don't do sub-word arithmetic/logicals. But I just did a sniff test of one such target (v850-elf because it was handy) and I couldn't spot a change in the end code

Re: [RFC][PR target/39726 P4 regression] match.pd pattern to do type narrowing

2015-02-11 Thread Richard Biener
On Wed, Feb 11, 2015 at 7:43 AM, Jeff Law wrote: > On 02/03/15 05:23, Joseph Myers wrote: >> >> >>> +&& TYPE_PRECISION (TREE_TYPE (@0)) == TYPE_PRECISION (TREE_TYPE >>> (@1)) >>> +&& TYPE_UNSIGNED (TREE_TYPE (@0)) == TYPE_UNSIGNED (TREE_TYPE >>> (@1)) >>> +&& TYPE_PRECISION

Re: [RFC][PR target/39726 P4 regression] match.pd pattern to do type narrowing

2015-02-10 Thread Jeff Law
On 02/03/15 05:23, Joseph Myers wrote: +&& TYPE_PRECISION (TREE_TYPE (@0)) == TYPE_PRECISION (TREE_TYPE (@1)) +&& TYPE_UNSIGNED (TREE_TYPE (@0)) == TYPE_UNSIGNED (TREE_TYPE (@1)) +&& TYPE_PRECISION (type) > TYPE_PRECISION (TREE_TYPE (@0))) + (convert (bit_and (inner

Re: [RFC][PR target/39726 P4 regression] match.pd pattern to do type narrowing

2015-02-09 Thread Jeff Law
On 02/09/15 06:42, Richard Biener wrote: On Mon, Feb 9, 2015 at 8:15 AM, Jeff Law wrote: On 02/03/15 04:39, Richard Biener wrote: I found that explicit types were ignored in some cases. It was frustrating to say the least. Huh, that would be a bug. Do you have a pattern where that happen

Re: [RFC][PR target/39726 P4 regression] match.pd pattern to do type narrowing

2015-02-09 Thread Richard Biener
On Mon, Feb 9, 2015 at 8:15 AM, Jeff Law wrote: > On 02/03/15 04:39, Richard Biener wrote: >>> >>> I found that explicit types were ignored in some cases. It was >>> frustrating to say the least. >> >> >> Huh, that would be a bug. Do you have a pattern where that happens? > > I'll have to recrea

Re: [RFC][PR target/39726 P4 regression] match.pd pattern to do type narrowing

2015-02-08 Thread Jeff Law
On 02/03/15 04:39, Richard Biener wrote: I found that explicit types were ignored in some cases. It was frustrating to say the least. Huh, that would be a bug. Do you have a pattern where that happens? I'll have to recreate them. In the mean time consider something else I'm playing with tha

Re: [RFC][PR target/39726 P4 regression] match.pd pattern to do type narrowing

2015-02-07 Thread Jeff Law
On 02/03/15 05:23, Joseph Myers wrote: On Tue, 3 Feb 2015, Jeff Law wrote: +/* Given a bit-wise operation performed in mode P1 on operands + in some narrower type P2 that feeds an outer masking operation. + See if the mask turns off all the bits outside P2, and if so + perform the all the

Re: [RFC][PR target/39726 P4 regression] match.pd pattern to do type narrowing

2015-02-03 Thread Joseph Myers
On Tue, 3 Feb 2015, Jeff Law wrote: > +/* Given a bit-wise operation performed in mode P1 on operands > + in some narrower type P2 that feeds an outer masking operation. > + See if the mask turns off all the bits outside P2, and if so > + perform the all the operations in P2 and just convert

Re: [RFC][PR target/39726 P4 regression] match.pd pattern to do type narrowing

2015-02-03 Thread Richard Biener
On February 2, 2015 7:32:15 PM CET, Jeff Law wrote: >On 02/02/15 01:57, Richard Biener 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 the

Re: [RFC][PR target/39726 P4 regression] match.pd pattern to do type narrowing

2015-02-02 Thread Jeff Law
On 02/02/15 11:04, Jeff Law wrote: 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

Re: [RFC][PR target/39726 P4 regression] match.pd pattern to do type narrowing

2015-02-02 Thread Jeff Law
On 02/02/15 01:57, Richard Biener 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 b

Re: [RFC][PR target/39726 P4 regression] match.pd pattern to do type narrowing

2015-02-02 Thread Jeff Law
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

Re: [RFC][PR target/39726 P4 regression] match.pd pattern to do type narrowing

2015-02-02 Thread Joseph Myers
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

Re: [RFC][PR target/39726 P4 regression] match.pd pattern to do type narrowing

2015-02-02 Thread Richard Biener
On Sun, Feb 1, 2015 at 6:46 AM, Jeff Law wrote: > On 01/31/15 17:47, Joseph Myers wrote: >> >> On Fri, 30 Jan 2015, Jeff Law wrote: >> >>> +/* If we are testing a single bit resulting from a binary >>> + operation in precision P1 where the operands were widened >>> + precision P2 and the teste

Re: [RFC][PR target/39726 P4 regression] match.pd pattern to do type narrowing

2015-01-31 Thread Jeff Law
On 01/31/15 17:47, Joseph Myers wrote: On Fri, 30 Jan 2015, Jeff Law wrote: +/* If we are testing a single bit resulting from a binary + operation in precision P1 where the operands were widened + precision P2 and the tested bit is the sign bit for + precision P2. Rewrite so the binary o

Re: [RFC][PR target/39726 P4 regression] match.pd pattern to do type narrowing

2015-01-31 Thread Joseph Myers
On Fri, 30 Jan 2015, Jeff Law wrote: > +/* If we are testing a single bit resulting from a binary > + operation in precision P1 where the operands were widened > + precision P2 and the tested bit is the sign bit for > + precision P2. Rewrite so the binary operation is in > + precision P2.

[RFC][PR target/39726 P4 regression] match.pd pattern to do type narrowing

2015-01-30 Thread Jeff Law
So I've gone round and round with BZ39726. The basic idea here is we have an operation on widened operands that feeds a narrow comparison. ie, the two inputs are QImode, extended to SImode, subtracted, then we want to conditionally branch on the result of sign bit of QImode. If we could ju