Commit 1d6fadee by Prathamesh Kulkarni Committed by Prathamesh Kulkarni

match.pd ((X / Y) == 0 -> X < Y): New pattern.

2017-09-26  Prathamesh Kulkarni  <prathamesh.kulkarni@linaro.org>

	* match.pd ((X / Y) == 0 -> X < Y): New pattern.
	((X / Y) != 0 -> X >= Y): Likewise.

testsuite/
	* gcc.dg/tree-ssa/cmpdiv.c: New test.

From-SVN: r253218
parent 1262c6cf
2017-09-26 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
* match.pd ((X / Y) == 0 -> X < Y): New pattern.
((X / Y) != 0 -> X >= Y): Likewise.
2017-09-26 Carl Love <cel@us.ibm.com>
* config/rs6000/rs6000-c.c (P9V_BUILTIN_VEC_XL_LEN_R,
......@@ -1275,6 +1275,18 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
|| TYPE_OVERFLOW_WRAPS (TREE_TYPE (@0))))
(op @1 @0))))
/* Transform:
* (X / Y) == 0 -> X < Y if X, Y are unsigned.
* (X / Y) != 0 -> X >= Y, if X, Y are unsigned.
*/
(for cmp (eq ne)
ocmp (lt ge)
(simplify
(cmp (trunc_div @0 @1) integer_zerop)
(if (TYPE_UNSIGNED (TREE_TYPE (@0))
&& (VECTOR_TYPE_P (type) || !VECTOR_TYPE_P (TREE_TYPE (@0))))
(ocmp @0 @1))))
/* X == C - X can never be true if C is odd. */
(for cmp (eq ne)
(simplify
......
2017-09-26 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
* gcc.dg/tree-ssa/cmpdiv.c: New test.
2017-09-26 Carl Love <cel@us.ibm.com>
* gcc.target/powerpc/builtins-5-p9-runnable.c: Add new runable test
......
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-optimized-raw" } */
_Bool f1(unsigned x, unsigned y)
{
unsigned t1 = x / y;
_Bool t2 = (t1 != 0);
return t2;
}
_Bool f2(unsigned x, unsigned y)
{
unsigned t1 = x / y;
_Bool t2 = (t1 == 0);
return t2;
}
/* { dg-final { scan-tree-dump-not "trunc_div_expr" "optimized" } } */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment