diff options
author | James A. Morrison <phython@gcc.gnu.org> | 2005-02-13 06:41:01 +0000 |
---|---|---|
committer | James A. Morrison <phython@gcc.gnu.org> | 2005-02-13 06:41:01 +0000 |
commit | 6f49fdcc5efbe3d098c49b62c94646bc503b4d3d (patch) | |
tree | 02d5b0b7143e79e01805b4aa33e9174807bd5880 | |
parent | 60a8fb5ea9912d3e4efa5cf8393cc23b81034f76 (diff) | |
download | gcc-6f49fdcc5efbe3d098c49b62c94646bc503b4d3d.zip gcc-6f49fdcc5efbe3d098c49b62c94646bc503b4d3d.tar.gz gcc-6f49fdcc5efbe3d098c49b62c94646bc503b4d3d.tar.bz2 |
pr15784-1.c, [...]: New tests.
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.
From-SVN: r94978
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr15784-1.c | 42 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr15784-2.c | 11 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr15784-3.c | 11 |
4 files changed, 68 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 24c3941..0295cc8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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 index 0000000..0b057b5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr15784-1.c @@ -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 index 0000000..cd35742 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr15784-2.c @@ -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 index 0000000..ee90760 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr15784-3.c @@ -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" } } */ |