diff options
author | sayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-06-19 00:17:33 +0000 |
---|---|---|
committer | sayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-06-19 00:17:33 +0000 |
commit | 2f64c4305f43bd0d2970af561b59bd3915c1f121 (patch) | |
tree | 9819bd8cdb1d4003c3909100c418617db3fb2944 /gcc/testsuite/gcc.dg/unordered-3.c | |
parent | 7b43578784f746ad1f5a7755e51e0ef7b65c9910 (diff) | |
download | gcc-2f64c4305f43bd0d2970af561b59bd3915c1f121.tar.gz |
* fold-const.c (fold) <UNORDERED_EXPR, ORDERED_EXPR, UNLT_EXPR,
UNLE_EXPR, UNGT_EXPR, UNGE_EXPR, UNEQ_EXPR, LTGT_EXPR>: Add
constant folding for unordered comparison tree nodes. If both
operands are real constants, call fold_relational_const. If either
operand is a NaN, evaluate the other for side-effects and return a
constant. Optimize (double)float1 CMP (double)float2 into the
equivalent float1 CMP float2.
(nondestructive_fold_binary_to_constant) <UNORDERED_EXPR,
ORDERED_EXPR, UNLT_EXPR, UNLE_EXPR, UNGT_EXPR, UNGE_EXPR, UNEQ_EXPR,
LTGT_EXPR>: Call fold_relational_const for constant operands.
(fold_relational_const): Add support for unordered comparison tree
nodes. Don't constant fold "ordered" floating point comparisons
against NaN if when flag_trapping_math is set.
* gcc.dg/unordered-2.c: New test case.
* gcc.dg/unordered-3.c: New test case.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@83379 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg/unordered-3.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/unordered-3.c | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/unordered-3.c b/gcc/testsuite/gcc.dg/unordered-3.c new file mode 100644 index 00000000000..4a11a6d48d8 --- /dev/null +++ b/gcc/testsuite/gcc.dg/unordered-3.c @@ -0,0 +1,79 @@ +/* { dg-do link } */ + +void link_error (); + +void test1() +{ + if (__builtin_isgreater(1.0,__builtin_nan("")) != 0) + link_error (); + if (__builtin_isgreater(__builtin_nan(""),1.0) != 0) + link_error (); + + if (__builtin_isgreaterequal(1.0,__builtin_nan("")) != 0) + link_error (); + if (__builtin_isgreaterequal(__builtin_nan(""),1.0) != 0) + link_error (); + + if (__builtin_isless(1.0,__builtin_nan("")) != 0) + link_error (); + if (__builtin_isless(__builtin_nan(""),1.0) != 0) + link_error (); + + if (__builtin_islessequal(1.0,__builtin_nan("")) != 0) + link_error (); + if (__builtin_islessequal(__builtin_nan(""),1.0) != 0) + link_error (); + + if (__builtin_islessgreater(1.0,__builtin_nan("")) != 0) + link_error (); + if (__builtin_islessgreater(__builtin_nan(""),1.0) != 0) + link_error (); + + if (__builtin_isunordered(1.0,__builtin_nan("")) == 0) + link_error (); + if (__builtin_isunordered(__builtin_nan(""),1.0) == 0) + link_error (); +} + + +void test2(double x) +{ + if (__builtin_isgreater(x,__builtin_nan("")) != 0) + link_error (); + if (__builtin_isgreater(__builtin_nan(""),x) != 0) + link_error (); + + if (__builtin_isgreaterequal(x,__builtin_nan("")) != 0) + link_error (); + if (__builtin_isgreaterequal(__builtin_nan(""),x) != 0) + link_error (); + + if (__builtin_isless(x,__builtin_nan("")) != 0) + link_error (); + if (__builtin_isless(__builtin_nan(""),x) != 0) + link_error (); + + if (__builtin_islessequal(x,__builtin_nan("")) != 0) + link_error (); + if (__builtin_islessequal(__builtin_nan(""),x) != 0) + link_error (); + + if (__builtin_islessgreater(x,__builtin_nan("")) != 0) + link_error (); + if (__builtin_islessgreater(__builtin_nan(""),x) != 0) + link_error (); + + if (__builtin_isunordered(x,__builtin_nan("")) == 0) + link_error (); + if (__builtin_isunordered(__builtin_nan(""),x) == 0) + link_error (); +} + + +int main() +{ + test1 (); + test2 (1.0); + return 0; +} + |