2005-02-13 James A. Morrison <phython@gcc.gnu.org>
authorphython <phython@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 13 Feb 2005 06:41:01 +0000 (06:41 +0000)
committerphython <phython@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 13 Feb 2005 06:41:01 +0000 (06:41 +0000)
       * gcc.dg/pr15784-1.c, gcc.dg/pr15784-2.c, gcc.dg/pr15784-3.c: New tests.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@94978 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr15784-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/pr15784-2.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/pr15784-3.c [new file with mode: 0644]

index 24c3941..0295cc8 100644 (file)
@@ -1,3 +1,7 @@
+2005-02-13  James A. Morrison  <phython@gcc.gnu.org>
+
+       * gcc.dg/pr15784-1.c, gcc.dg/pr15784-2.c, gcc.dg/pr15784-3.c: New tests.
+
 2005-02-12  Dorit Naishlos  <dorit@il.ibm.com>
 
        * gcc.dg/vect/vect-96.c: Fix typo.
diff --git a/gcc/testsuite/gcc.dg/pr15784-1.c b/gcc/testsuite/gcc.dg/pr15784-1.c
new file mode 100644 (file)
index 0000000..0b057b5
--- /dev/null
@@ -0,0 +1,42 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-generic" } */
+/* Test for folding abs(x) where appropriate.  */
+#define abs(x) x > 0 ? x : -x
+extern double fabs (double);
+
+int a (int x) {
+       return (abs(x)) >= 0;
+}
+
+int b (int x) {
+       return (abs(x)) == 0;
+}
+
+int c (int x) {
+       return (abs(x)) != 0;
+}
+
+int d (int x) {
+       return 0 != (abs(x));
+}
+
+int e (int x) {
+       return 0 == (abs(x));
+}
+
+int f (int x) {
+       return 0 <= (abs(x));
+}
+
+int g (int x) {
+       return 0 > (abs(x));
+}
+
+int h (float x) {
+       return 0.0 > fabs(x);
+}
+
+int i (float x) {
+       return fabs(x) == -0.0;
+}
+/* { dg-final { scan-tree-dump-times "ABS_EXPR" 0 "generic" } } */
diff --git a/gcc/testsuite/gcc.dg/pr15784-2.c b/gcc/testsuite/gcc.dg/pr15784-2.c
new file mode 100644 (file)
index 0000000..cd35742
--- /dev/null
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-generic -ffast-math" } */
+/* Test for folding abs(x) where appropriate.  */
+#define abs(x) x > 0 ? x : -x
+extern double fabs (double);
+
+int a (float x) {
+       return fabs(x) >= 0.0;
+}
+
+/* { dg-final { scan-tree-dump-times "ABS_EXPR" 0 "generic" } } */
diff --git a/gcc/testsuite/gcc.dg/pr15784-3.c b/gcc/testsuite/gcc.dg/pr15784-3.c
new file mode 100644 (file)
index 0000000..ee90760
--- /dev/null
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-generic" } */
+/* Test for folding abs(x) where appropriate.  */
+#define abs(x) x > 0 ? x : -x
+extern double fabs (double);
+
+int a (float x) {
+       return fabs(x) >= 0.0;
+}
+
+/* { dg-final { scan-tree-dump-times "ABS_EXPR" 1 "generic" } } */