summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa/copy-sign-1.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/tree-ssa/copy-sign-1.c')
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/copy-sign-1.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/copy-sign-1.c b/gcc/testsuite/gcc.dg/tree-ssa/copy-sign-1.c
new file mode 100644
index 00000000000..de3e7b242ce
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/copy-sign-1.c
@@ -0,0 +1,37 @@
+/* { 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 > 0.f ? -1.f : 1.f);
+}
+float f1(float x)
+{
+ return (x > 0.f ? 1.f : -1.f);
+}
+float g(float x)
+{
+ return (x >= 0.f ? -1.f : 1.f);
+}
+float g1(float x)
+{
+ return (x >= 0.f ? 1.f : -1.f);
+}
+float h(float x)
+{
+ return (x < 0.f ? -1.f : 1.f);
+}
+float h1(float x)
+{
+ return (x < 0.f ? 1.f : -1.f);
+}
+float i(float x)
+{
+ return (x <= 0.f ? -1.f : 1.f);
+}
+float i1(float x)
+{
+ return (x <= 0.f ? 1.f : -1.f);
+}
+/* { dg-final { scan-tree-dump-times "copysign" 8 "gimple"} } */