summaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
authorprathamesh3492 <prathamesh3492@138bc75d-0d04-0410-961f-82ee72b054a4>2016-07-27 15:09:10 +0000
committerprathamesh3492 <prathamesh3492@138bc75d-0d04-0410-961f-82ee72b054a4>2016-07-27 15:09:10 +0000
commit12dabcee024b4f6d796b17d69a6868310640d327 (patch)
tree5b760477f103aff90ce4176e8d8ee2085e644d87 /gcc/testsuite
parenta15c974194fbe985695ff7e6525b76cea8b2f44e (diff)
downloadgcc-12dabcee024b4f6d796b17d69a6868310640d327.tar.gz
2016-07-27 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
PR middle-end/71078 * match.pd (x / abs(x) -> copysign(1.0, x)): New pattern. testsuite/ * gcc.dg/tree-ssa/pr71078-1.c: New test-case. * gcc.dg/tree-ssa/pr71078-2.c: Likewise. * gcc.dg/tree-ssa/pr71078-3.c: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@238787 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/ChangeLog7
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr71078-1.c29
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr71078-2.c29
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr71078-3.c12
4 files changed, 77 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 3f8129ad6fb..3f7e5a7dd26 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2016-07-27 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
+
+ PR middle-end/71078
+ * gcc.dg/tree-ssa/pr71078-1.c: New test-case.
+ * gcc.dg/tree-ssa/pr71078-2.c: Likewise.
+ * gcc.dg/tree-ssa/pr71078-3.c: Likewise.
+
2016-07-27 Richard Biener <rguenther@suse.de>
* gcc.dg/vect/costmodel/x86_64/costmodel-pr68961.c: Remove.
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr71078-1.c b/gcc/testsuite/gcc.dg/tree-ssa/pr71078-1.c
new file mode 100644
index 00000000000..6204c148ec3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr71078-1.c
@@ -0,0 +1,29 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -ffast-math -fdump-tree-forwprop-details" } */
+
+#include <math.h>
+
+float f1(float x)
+{
+ float t1 = fabsf (x);
+ float t2 = x / t1;
+ return t2;
+}
+
+double f2(double x)
+{
+ double t1 = fabs (x);
+ double t2 = x / t1;
+ return t2;
+}
+
+long double f3 (long double x)
+{
+ long double t1 = fabsl (x);
+ long double t2 = x / t1;
+ return t2;
+}
+
+/* { dg-final { scan-tree-dump "__builtin_copysignf" "forwprop1" } } */
+/* { dg-final { scan-tree-dump "__builtin_copysign" "forwprop1" } } */
+/* { dg-final { scan-tree-dump "__builtin_copysignl" "forwprop1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr71078-2.c b/gcc/testsuite/gcc.dg/tree-ssa/pr71078-2.c
new file mode 100644
index 00000000000..96485af3984
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr71078-2.c
@@ -0,0 +1,29 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -ffast-math -fdump-tree-forwprop-details" } */
+
+#include <math.h>
+
+float f1(float x)
+{
+ float t1 = fabsf (x);
+ float t2 = t1 / x;
+ return t2;
+}
+
+double f2(double x)
+{
+ double t1 = fabs (x);
+ double t2 = t1 / x;
+ return t2;
+}
+
+long double f3 (long double x)
+{
+ long double t1 = fabsl (x);
+ long double t2 = t1 / x;
+ return t2;
+}
+
+/* { dg-final { scan-tree-dump "__builtin_copysignf" "forwprop1" } } */
+/* { dg-final { scan-tree-dump "__builtin_copysign" "forwprop1" } } */
+/* { dg-final { scan-tree-dump "__builtin_copysignl" "forwprop1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr71078-3.c b/gcc/testsuite/gcc.dg/tree-ssa/pr71078-3.c
new file mode 100644
index 00000000000..8780b6afdfe
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr71078-3.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -ffast-math -fdump-tree-forwprop-details" } */
+
+#include <math.h>
+double f(float f)
+{
+ double t1 = fabs(f);
+ double t2 = f / t1;
+ return t2;
+}
+
+/* { dg-final { scan-tree-dump "__builtin_copysign" "forwprop1" } } */