summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2019-09-11 08:22:51 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2019-09-11 08:22:51 +0000
commitdc5b11916a2e318bd15d60f6cfd01d1e306ffbfb (patch)
treedd0d5d06c0d4a33dc39c300327569ab15d817659 /gcc
parent3d34b7afaeeb9422493873041c2aa14474eac129 (diff)
revert: match.pd: Add flag_unsafe_math_optimizations check before deciding on the widest type in...
2019-09-11 Richard Biener <rguenther@suse.de> Revert 2019-09-09 Barnaby Wilks <barnaby.wilks@arm.com> * match.pd: Add flag_unsafe_math_optimizations check before deciding on the widest type in a binary math operation. * gcc.dg/fold-binary-math-casts.c: New test. From-SVN: r275632
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/match.pd12
-rw-r--r--gcc/testsuite/ChangeLog7
-rw-r--r--gcc/testsuite/gcc.dg/fold-binary-math-casts.c58
4 files changed, 17 insertions, 68 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index a0badf5ac96..0aa93bceb4b 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2019-09-11 Richard Biener <rguenther@suse.de>
+
+ Revert
+ 2019-09-09 Barnaby Wilks <barnaby.wilks@arm.com>
+
+ * match.pd: Add flag_unsafe_math_optimizations check
+ before deciding on the widest type in a binary math operation.
+
2019-09-10 Richard Sandiford <richard.sandiford@arm.com>
* doc/tm.texi.in: Document that exactly one of CALL_USED_REGISTERS
diff --git a/gcc/match.pd b/gcc/match.pd
index 309a094071b..05009bb7a5a 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -5056,18 +5056,10 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
&& newtype == type
&& types_match (newtype, type))
(op (convert:newtype @1) (convert:newtype @2))
- (with
- {
- if (!flag_unsafe_math_optimizations)
- {
- if (TYPE_PRECISION (ty1) > TYPE_PRECISION (newtype))
+ (with { if (TYPE_PRECISION (ty1) > TYPE_PRECISION (newtype))
newtype = ty1;
-
if (TYPE_PRECISION (ty2) > TYPE_PRECISION (newtype))
- newtype = ty2;
- }
- }
-
+ newtype = ty2; }
/* Sometimes this transformation is safe (cannot
change results through affecting double rounding
cases) and sometimes it is not. If NEWTYPE is
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index bbb5d9520fb..8b3dfbbecf0 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2019-09-11 Richard Biener <rguenther@suse.de>
+
+ Revert
+ 2019-09-09 Barnaby Wilks <barnaby.wilks@arm.com>
+
+ * gcc.dg/fold-binary-math-casts.c: New test.
+
2019-09-10 Marek Polacek <polacek@redhat.com>
PR c++/91673 - ICE with noexcept in alias-declaration.
diff --git a/gcc/testsuite/gcc.dg/fold-binary-math-casts.c b/gcc/testsuite/gcc.dg/fold-binary-math-casts.c
deleted file mode 100644
index 53c247fa143..00000000000
--- a/gcc/testsuite/gcc.dg/fold-binary-math-casts.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/* { dg-do compile } */
-/* { dg-options "-Ofast -fdump-tree-optimized" } */
-
-#include <math.h>
-
-float
-f (float x, float y)
-{
- double z = 1.0 / x;
- return z * y;
-}
-
-float
-g (float x, float y)
-{
- double a = 1.0 / x;
- double b = 1.0 / y;
- long double k = x*x*x*x*x*x;
-
- return a + b - k;
-}
-
-float
-h (float x)
-{
- double a = x * 2.0;
- double b = a / 3.5f;
- return a + b;
-}
-
-float
-i (float y, float z)
-{
- return pow (y, 2.0) / (double) (y + z);
-}
-
-float
-j (float x, float y)
-{
- double t = 4.0 * x;
- double z = t + y;
- return z;
-}
-
-float
-k (float a)
-{
- return 1.0 / sqrtf (a);
-}
-
-float
-l (float a)
-{
- return (double) a * (a / 2.0);
-}
-
-/* { dg-final { scan-tree-dump-not "\\(double\\)" "optimized" } } */
-/* { dg-final { scan-tree-dump-not "\\(float\\)" "optimized" } } */