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
+2017-07-20 Naveen H.S <Naveen.Hurugalawadi@cavium.com>
+
+ * match.pd (((m1 >/</>=/<= m2) * d -> (m1 >/</>=/<= m2) ? d : 0):
+ New pattern.
+
2017-07-19 Jan Hubicka <hubicka@ucw.cz>
PR middle-end/81331
&& 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)
+2017-07-20 Naveen H.S <Naveen.Hurugalawadi@cavium.com>
+
+ * gcc.dg/tree-ssa/vrp116.c: New Test.
+
2017-07-19 Michael Meissner <meissner@linux.vnet.ibm.com>
* gcc.target/powerpc/cpu-builtin-1.c: Change test to use #ifdef
--- /dev/null
+/* { 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" } } */