Commit d96a5585 by Richard Biener Committed by Richard Biener

re PR middle-end/77407 (Optimize integer i / abs (i) into the sign of i)

2016-10-04  Richard Biener  <rguenther@suse.de>

	PR middle-end/77407
	* match.pd (X / abs (X) -> X < 0 ? -1 : 1): Drop vector
	type support, mark with :C.
	(X / -X -> -1): Mark with :C.

From-SVN: r240742
parent 43c40f3e
2016-10-04 Richard Biener <rguenther@suse.de>
PR middle-end/77407
* match.pd (X / abs (X) -> X < 0 ? -1 : 1): Drop vector
type support, mark with :C.
(X / -X -> -1): Mark with :C.
2016-10-04 Jakub Jelinek <jakub@redhat.com>
* defaults.h (JCR_SECTION_NAME, TARGET_USE_JCR_SECTION): Remove.
......
......@@ -155,14 +155,14 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
(negate @0)))
/* X / abs (X) is X < 0 ? -1 : 1. */
(simplify
(div @0 (abs @0))
(if ((INTEGRAL_TYPE_P (type) || VECTOR_INTEGER_TYPE_P (type))
(div:C @0 (abs @0))
(if (INTEGRAL_TYPE_P (type)
&& TYPE_OVERFLOW_UNDEFINED (type))
(cond (lt @0 { build_zero_cst (type); })
{ build_minus_one_cst (type); } { build_one_cst (type); })))
/* X / -X is -1. */
(simplify
(div @0 (negate @0))
(div:C @0 (negate @0))
(if ((INTEGRAL_TYPE_P (type) || VECTOR_INTEGER_TYPE_P (type))
&& TYPE_OVERFLOW_UNDEFINED (type))
{ build_minus_one_cst (type); })))
......
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