summaryrefslogtreecommitdiff
path: root/test/CodeGen/const-unordered-compare.c
diff options
context:
space:
mode:
authorMon P Wang <wangmp@apple.com>2010-04-29 05:53:29 +0000
committerMon P Wang <wangmp@apple.com>2010-04-29 05:53:29 +0000
commitfc39dc4c7886723310419b1869cf651ca55b7af4 (patch)
treef0789cc89d713529bb2b45f40ae1cd549fae6566 /test/CodeGen/const-unordered-compare.c
parent77e2c67411084c47b1cf511a191b31adf38662ba (diff)
downloadclang-fc39dc4c7886723310419b1869cf651ca55b7af4.tar.gz
A not equal for an unordered relation should return true as specified in IEEE-754, e.g.,
NAN != NAN ? 1 : 0 should return 1. Also fix the case for complex. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102598 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/const-unordered-compare.c')
-rw-r--r--test/CodeGen/const-unordered-compare.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/CodeGen/const-unordered-compare.c b/test/CodeGen/const-unordered-compare.c
new file mode 100644
index 0000000000..ac7d35bcd5
--- /dev/null
+++ b/test/CodeGen/const-unordered-compare.c
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
+
+// Checks folding of an unordered comparison
+int nan_ne_check() {
+ // CHECK: store i32 1
+ return (__builtin_nanf("") != __builtin_nanf("")) ? 1 : 0;
+}