Commit 7318e44f by Richard Biener Committed by Richard Biener

match.pd: Allow associating FLOAT_TYPE_P when flag_associative_math.

2015-06-26  Richard Biener  <rguenther@suse.de>

	* match.pd: Allow associating FLOAT_TYPE_P when flag_associative_math.

	* gfortran.dg/reassoc_3.f90: Adjust.

2015-06-26  Richard Biener  <rguenther@suse.de>

	* match.pd: Allow (p +p off1) +p off2 to (p +p (off1 + off2))
	irrespective on whether the inner operation has a single use
	of both off are constant.

From-SVN: r224995
parent 6c1a2b3d
2015-06-26 Richard Biener <rguenther@suse.de>
* match.pd: Allow associating FLOAT_TYPE_P when flag_associative_math.
2015-06-26 Richard Biener <rguenther@suse.de>
* match.pd: Allow (p +p off1) +p off2 to (p +p (off1 + off2))
irrespective on whether the inner operation has a single use
of both off are constant.
2015-06-26 Uros Bizjak <ubizjak@gmail.com>
Segher Boessenkool <segher@kernel.crashing.org>
......
......@@ -503,7 +503,8 @@ along with GCC; see the file COPYING3. If not see
/* Associate (p +p off1) +p off2 as (p +p (off1 + off2)). */
(simplify
(pointer_plus (pointer_plus@2 @0 @1) @3)
(if (single_use (@2))
(if (single_use (@2)
|| (TREE_CODE (@1) == INTEGER_CST && TREE_CODE (@3) == INTEGER_CST))
(pointer_plus @0 (plus @1 @3))))
/* Pattern match
......@@ -561,9 +562,10 @@ along with GCC; see the file COPYING3. If not see
&& !TYPE_OVERFLOW_SANITIZED (type))
(convert @1)))
/* We can't reassociate floating-point or fixed-point plus or minus
because of saturation to +-Inf. */
(if (!FLOAT_TYPE_P (type) && !FIXED_POINT_TYPE_P (type))
/* We can't reassociate floating-point unless -fassociative-math
or fixed-point plus or minus because of saturation to +-Inf. */
(if ((!FLOAT_TYPE_P (type) || flag_associative_math)
&& !FIXED_POINT_TYPE_P (type))
/* Match patterns that allow contracting a plus-minus pair
irrespective of overflow issues. */
......
2015-06-26 Richard Biener <rguenther@suse.de>
* gfortran.dg/reassoc_3.f90: Adjust.
2015-06-26 Uros Bizjak <ubizjak@gmail.com>
PR target/66412
......
......@@ -14,5 +14,4 @@ function test(a)
end
! { dg-final { scan-tree-dump "b = 5" "original" } }
! { dg-final { scan-tree-dump "c_. = .a" "optimized" } }
! { dg-final { scan-tree-dump "return c_.;" "optimized" } }
! { dg-final { scan-tree-dump-times " = " 1 "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