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
This commit is contained in:
Richard Biener 2015-06-26 07:50:12 +00:00 committed by Richard Biener
parent 6c1a2b3d11
commit 7318e44f9f
4 changed files with 21 additions and 6 deletions

View File

@ -1,3 +1,13 @@
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>

View File

@ -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. */

View File

@ -1,3 +1,7 @@
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

View File

@ -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" } }