From: Naveen H.S Date: Thu, 20 Jul 2017 03:57:48 +0000 (+0000) Subject: match.pd (((m1 >/=/<= m2) * d -> (m1 >/=/<= m2) ? d : 0): New pattern. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2071f8f980cc0de02af3d7d7de201f4f189058ff;p=gcc.git match.pd (((m1 >/=/<= m2) * d -> (m1 >/=/<= m2) ? d : 0): New pattern. gcc * match.pd (((m1 >/=/<= m2) * d -> (m1 >/=/<= m2) ? d : 0): New pattern. gcc/testsuite * gcc.dg/tree-ssa/vrp116.c: New Test. From-SVN: r250377 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 141eb6aad2f..499249b7d75 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2017-07-20 Naveen H.S + + * match.pd (((m1 >/=/<= m2) * d -> (m1 >/=/<= m2) ? d : 0): + New pattern. + 2017-07-19 Jan Hubicka PR middle-end/81331 diff --git a/gcc/match.pd b/gcc/match.pd index 56d13b3c175..7f5807ce2f1 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -1089,6 +1089,12 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) && tree_nop_conversion_p (type, TREE_TYPE (@1))) (convert (bit_and (bit_not @1) @0)))) +/* (m1 CMP m2) * d -> (m1 CMP m2) ? d : 0 */ +(for cmp (gt lt ge le) +(simplify + (mult (convert (cmp @0 @1)) @2) + (cond (cmp @0 @1) @2 { build_zero_cst (type); }))) + /* For integral types with undefined overflow and C != 0 fold x * C EQ/NE y * C into x EQ/NE y. */ (for cmp (eq ne) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ce75e23d7d7..0a677739c18 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2017-07-20 Naveen H.S + + * gcc.dg/tree-ssa/vrp116.c: New Test. + 2017-07-19 Michael Meissner * gcc.target/powerpc/cpu-builtin-1.c: Change test to use #ifdef diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp116.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp116.c new file mode 100644 index 00000000000..d9d7b2394cd --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp116.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-vrp1" } */ + +int +f (int m1, int m2, int c) +{ + int d = m1 > m2; + int e = d * c; + return e ? m1 : m2; +} + +/* { dg-final { scan-tree-dump-times "\\? c_\[0-9\]\\(D\\) : 0" 1 "vrp1" } } */