This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH GCC]Refine type conversion in result expressions for cond_expr pattern


On Wed, Nov 23, 2016 at 3:57 PM, Bin.Cheng <amker.cheng@gmail.com> wrote:
> On Wed, Nov 23, 2016 at 2:27 PM, Richard Biener
> <richard.guenther@gmail.com> wrote:
>> On Wed, Nov 23, 2016 at 2:54 PM, Bin Cheng <Bin.Cheng@arm.com> wrote:
>>> Hi,
>>> This is actually the review suggestion for patch @https://gcc.gnu.org/ml/gcc-patches/2016-11/msg02341.html, but I forgot to incorporate it when committing that patch.  Here comes this one doing that, as well as adding a missing convert keyword.  Toolchain built successfully, is it OK?
>>
>> As said you _do_ need the outermost (convert ...) on the (max .. and
>> (min ... expressions given @1 may not be of type 'type'.
> Sorry about the stupid mistake.  How about this one?  The from_type in
> the last branch looks like necessary to me.

I think

     (if (code == EQ_EXPR)
      (cond (cmp @1 (convert @3)) (convert @3) @2)))))))

is better?  We want the outer expression of type 'type' and @2 is
already 'type',
only @3 may not be.  So the only change would be to dop the unnecessary
:from_type inside the cmp and the bogus :from_type on the true arg of the cond.

Richard.


> Thanks,
> bin
>>
>>> Thanks,
>>> bin
>>>
>>> 2016-11-23  Bin Cheng  <bin.cheng@arm.com>
>>>
>>>         * match.pd: Refine type conversion in result expressions for below
>>>         pattern:
>>>         (cond (cmp (convert1? x) c1) (convert2? x) c2) -> (minmax (x c)).


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]