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 | b6e1362f2a78092e9739228a4e2e59474da5dcff (patch) | |
tree | 02d5b0b7143e79e01805b4aa33e9174807bd5880 | |
parent | e24b954eff5d22b80457f2e94c33214bd193f8a6 (diff) |
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.
git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@94978 138bc75d-0d04-0410-961f-82ee72b054a4
-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 24c39411f82..0295cc8eba5 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 00000000000..0b057b5af64 --- /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 00000000000..cd357421488 --- /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 00000000000..ee90760fcb0 --- /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" } } */ |