On Wed, Nov 23, 2016 at 11:40 AM, Bin.Cheng <amker.ch...@gmail.com> wrote:
> On Wed, Nov 23, 2016 at 10:29 AM, Richard Biener
> <richard.guent...@gmail.com> wrote:
>> On Fri, Nov 18, 2016 at 11:20 AM, Bin Cheng <bin.ch...@arm.com> wrote:
>>> Hi,
>>> This is a rework of 
>>> https://gcc.gnu.org/ml/gcc-patches/2016-10/msg02005.html.  According to 
>>> review comment, I extended the original patch and made it covering last 
>>> kind simplification of fold_cond_expr_with_comparison (Well, this patch 
>>> handles <, <=, > and >=.  == will be handled by a follow up).  This patch 
>>> also adds several tests, some tests are for existing 
>>> fold_cond_expr_with_comparison simplification but not covered yet; others 
>>> are for new extension.
>>> Bootstrap and test on x86_64 and AArch64 along with following patches, is 
>>> it OK?
>>
>> I think you don't need the explicit types in the result
>>
>> +   (if (code == MAX_EXPR)
>> +    (convert (max @1 (convert:from_type @2)))
>> +    (if (code == MIN_EXPR)
>> +     (convert (min @1 (convert:from_type @2))))))))
>>
>> A simple (convert (max @1 (convert @2))) should work.
> Hi Richiard, could you explain about this more please?  If convert2
> appears in the code, @2 would be of type after conversion?

You convert to TREE_TYPE (@1), this is what genmatch auto-guesses
if you just write (min @1 (convert @2))

>
> Thanks,
> bin
>>
>> Otherwise ok.
>>
>> Thanks,
>> Richard.
>>
>>> Thanks,
>>> bin
>>>
>>> 2016-11-16  Bin Cheng  <bin.ch...@arm.com>
>>>
>>>         * fold-const.c (fold_cond_expr_with_comparison): Move simplification
>>>         for A cmp C1 ? A : C2 to below, also simplify remaining code.
>>>         * match.pd: Move and extend simplification from above to here:
>>>         (cond (cmp (convert1? x) c1) (convert2? x) c2) -> (minmax (x c)).
>>>         * tree-if-conv.c (ifcvt_follow_ssa_use_edges): New func.
>>>         (predicate_scalar_phi): Call fold_stmt using the new valueize func.
>>>
>>> gcc/testsuite/ChangeLog
>>> 2016-11-16  Bin Cheng  <bin.ch...@arm.com>
>>>
>>>         * gcc.dg/fold-cond_expr-1.c: New test.
>>>         * gcc.dg/fold-condcmpconv-1.c: New test.
>>>         * gcc.dg/fold-condcmpconv-2.c: New test.
>>>         * gcc.dg/tree-ssa/pr66726.c: Adjust test strings.

Reply via email to