diff options
author | Geoffrey Keating <geoffk@apple.com> | 2003-05-05 19:33:52 +0000 |
---|---|---|
committer | Geoffrey Keating <geoffk@gcc.gnu.org> | 2003-05-05 19:33:52 +0000 |
commit | bc9ec0e06b4e074b2a5c75c21f8f7eefbdb88c8f (patch) | |
tree | 0e5be2a8db71f0d0635751e3cb960ed2c9c73e7b /gcc/testsuite | |
parent | e3e9f1084699af912b12b5a63c64c72dc868854f (diff) | |
download | gcc-bc9ec0e06b4e074b2a5c75c21f8f7eefbdb88c8f.zip gcc-bc9ec0e06b4e074b2a5c75c21f8f7eefbdb88c8f.tar.gz gcc-bc9ec0e06b4e074b2a5c75c21f8f7eefbdb88c8f.tar.bz2 |
rs6000.c (validate_condition_mode): Use flag_finite_math_only.
2003-05-05 Geoffrey Keating <geoffk@apple.com>
* config/rs6000/rs6000.c (validate_condition_mode): Use
flag_finite_math_only.
(rs6000_reverse_condition): Never return UNKNOWN; use
flag_finite_math_only.
(rs6000_generate_compare): Use flag_finite_math_only.
(rs6000_emit_cmove): Handle UNLE. Support UNEQ under -ffast-math.
Use HONOR_* rather than flag_unsafe_math_optimizations. Correct
UNGE and GT cases. Handle UNEQ and LTGT when ! HONOR_NANS.
Index: testsuite/ChangeLog
2003-05-05 Geoffrey Keating <geoffk@apple.com>
* gcc.c-torture/execute/ieee/fp-cmp-8.c: New test.
* gcc.dg/ppc-fsel-2.c: New test.
From-SVN: r66499
Diffstat (limited to 'gcc/testsuite')
-rw-r--r-- | gcc/testsuite/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-8.c | 141 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/ppc-fsel-2.c | 80 |
3 files changed, 224 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 536043a..90eb31b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -4,6 +4,9 @@ 2003-05-05 Geoffrey Keating <geoffk@apple.com> + * gcc.c-torture/execute/ieee/fp-cmp-8.c: New test. + * gcc.dg/ppc-fsel-2.c: New test. + * gcc.dg/unused-5.c: New test. 2003-05-05 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net> diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-8.c b/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-8.c new file mode 100644 index 0000000..225539b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-8.c @@ -0,0 +1,141 @@ +/* Like fp-cmp-4.c, but test that the cmove patterns are correct. */ + +static double +test_isunordered(double x, double y, double a, double b) +{ + return __builtin_isunordered(x, y) ? a : b; +} + +static double +test_not_isunordered(double x, double y, double a, double b) +{ + return !__builtin_isunordered(x, y) ? a : b; +} + +static double +test_isless(double x, double y, double a, double b) +{ + return __builtin_isless(x, y) ? a : b; +} + +static double +test_not_isless(double x, double y, double a, double b) +{ + return !__builtin_isless(x, y) ? a : b; +} + +static double +test_islessequal(double x, double y, double a, double b) +{ + return __builtin_islessequal(x, y) ? a : b; +} + +static double +test_not_islessequal(double x, double y, double a, double b) +{ + return !__builtin_islessequal(x, y) ? a : b; +} + +static double +test_isgreater(double x, double y, double a, double b) +{ + return __builtin_isgreater(x, y) ? a : b; +} + +static double +test_not_isgreater(double x, double y, double a, double b) +{ + return !__builtin_isgreater(x, y) ? a : b; +} + +static double +test_isgreaterequal(double x, double y, double a, double b) +{ + return __builtin_isgreaterequal(x, y) ? a : b; +} + +static double +test_not_isgreaterequal(double x, double y, double a, double b) +{ + return !__builtin_isgreaterequal(x, y) ? a : b; +} + +static double +test_islessgreater(double x, double y, double a, double b) +{ + return __builtin_islessgreater(x, y) ? a : b; +} + +static double +test_not_islessgreater(double x, double y, double a, double b) +{ + return !__builtin_islessgreater(x, y) ? a : b; +} + +static void +one_test(double x, double y, int expected, + double (*pos) (double, double, double, double), + double (*neg) (double, double, double, double)) +{ + if (((*pos)(x, y, 1.0, 2.0) == 1.0) != expected) + abort (); + if (((*neg)(x, y, 3.0, 4.0) == 4.0) != expected) + abort (); +} + +#define NAN (0.0 / 0.0) +#define INF (1.0 / 0.0) + +int +main() +{ + struct try + { + double x, y; + int result[6]; + }; + + static struct try const data[] = + { + { NAN, NAN, { 1, 0, 0, 0, 0, 0 } }, + { 0.0, NAN, { 1, 0, 0, 0, 0, 0 } }, + { NAN, 0.0, { 1, 0, 0, 0, 0, 0 } }, + { 0.0, 0.0, { 0, 0, 1, 0, 1, 0 } }, + { 1.0, 2.0, { 0, 1, 1, 0, 0, 1 } }, + { 2.0, 1.0, { 0, 0, 0, 1, 1, 1 } }, + { INF, 0.0, { 0, 0, 0, 1, 1, 1 } }, + { 1.0, INF, { 0, 1, 1, 0, 0, 1 } }, + { INF, INF, { 0, 0, 1, 0, 1, 0 } }, + { 0.0, -INF, { 0, 0, 0, 1, 1, 1 } }, + { -INF, 1.0, { 0, 1, 1, 0, 0, 1 } }, + { -INF, -INF, { 0, 0, 1, 0, 1, 0 } }, + { INF, -INF, { 0, 0, 0, 1, 1, 1 } }, + { -INF, INF, { 0, 1, 1, 0, 0, 1 } }, + }; + + struct test + { + double (*pos)(double, double, double, double); + double (*neg)(double, double, double, double); + }; + + static struct test const tests[] = + { + { test_isunordered, test_not_isunordered }, + { test_isless, test_not_isless }, + { test_islessequal, test_not_islessequal }, + { test_isgreater, test_not_isgreater }, + { test_isgreaterequal, test_not_isgreaterequal }, + { test_islessgreater, test_not_islessgreater } + }; + + const int n = sizeof(data) / sizeof(data[0]); + int i, j; + + for (i = 0; i < n; ++i) + for (j = 0; j < 6; ++j) + one_test (data[i].x, data[i].y, data[i].result[j], + tests[j].pos, tests[j].neg); + + exit (0); +} diff --git a/gcc/testsuite/gcc.dg/ppc-fsel-2.c b/gcc/testsuite/gcc.dg/ppc-fsel-2.c new file mode 100644 index 0000000..9768b16 --- /dev/null +++ b/gcc/testsuite/gcc.dg/ppc-fsel-2.c @@ -0,0 +1,80 @@ +/* { dg-do compile { target powerpc*-*-* } } */ +/* { dg-options "-O -mpowerpc-gfxopt -g0 -ffinite-math-only" } */ +/* { dg-final { scan-assembler-not "^L" } } */ + +/* Every single one of these should be compiled into straight-line + code using fsel (or, in a few cases, hardwired to 'true' or + 'false'), no branches anywhere. */ + +double +test_isunordered(double x, double y, double a, double b) +{ + return __builtin_isunordered(x, y) ? a : b; +} + +double +test_not_isunordered(double x, double y, double a, double b) +{ + return !__builtin_isunordered(x, y) ? a : b; +} + +double +test_isless(double x, double y, double a, double b) +{ + return __builtin_isless(x, y) ? a : b; +} + +double +test_not_isless(double x, double y, double a, double b) +{ + return !__builtin_isless(x, y) ? a : b; +} + +double +test_islessequal(double x, double y, double a, double b) +{ + return __builtin_islessequal(x, y) ? a : b; +} + +double +test_not_islessequal(double x, double y, double a, double b) +{ + return !__builtin_islessequal(x, y) ? a : b; +} + +double +test_isgreater(double x, double y, double a, double b) +{ + return __builtin_isgreater(x, y) ? a : b; +} + +double +test_not_isgreater(double x, double y, double a, double b) +{ + return !__builtin_isgreater(x, y) ? a : b; +} + +double +test_isgreaterequal(double x, double y, double a, double b) +{ + return __builtin_isgreaterequal(x, y) ? a : b; +} + +double +test_not_isgreaterequal(double x, double y, double a, double b) +{ + return !__builtin_isgreaterequal(x, y) ? a : b; +} + +double +test_islessgreater(double x, double y, double a, double b) +{ + return __builtin_islessgreater(x, y) ? a : b; +} + +double +test_not_islessgreater(double x, double y, double a, double b) +{ + return !__builtin_islessgreater(x, y) ? a : b; +} + |