summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa/mult-abs-2.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/tree-ssa/mult-abs-2.c')
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/mult-abs-2.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/mult-abs-2.c b/gcc/testsuite/gcc.dg/tree-ssa/mult-abs-2.c
new file mode 100644
index 00000000000..d74ba2fe630
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/mult-abs-2.c
@@ -0,0 +1,38 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target c99_runtime } */
+/* { dg-options "-O2 -ffast-math -fdump-tree-gimple" } */
+/* { dg-add-options c99_runtime } */
+
+float f(float x)
+{
+ return x * (x > 0.f ? -1.f : 1.f);
+}
+float f1(float x)
+{
+ return x * (x > 0.f ? 1.f : -1.f);
+}
+float g(float x)
+{
+ return x * (x >= 0.f ? -1.f : 1.f);
+}
+float g1(float x)
+{
+ return x * (x >= 0.f ? 1.f : -1.f);
+}
+float h(float x)
+{
+ return x * (x < 0.f ? -1.f : 1.f);
+}
+float h1(float x)
+{
+ return x * (x < 0.f ? 1.f : -1.f);
+}
+float i(float x)
+{
+ return x * (x <= 0.f ? -1.f : 1.f);
+}
+float i1(float x)
+{
+ return x * (x <= 0.f ? 1.f : -1.f);
+}
+/* { dg-final { scan-tree-dump-times "ABS" 8 "gimple"} } */