Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1972)

Unified Diff: tests_lit/llvm2ice_tests/fp_const_pool.ll

Issue 1019233002: Subzero: Fix floating-point constant pooling. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tests_lit/llvm2ice_tests/fp_const_pool.ll
diff --git a/tests_lit/llvm2ice_tests/fp_const_pool.ll b/tests_lit/llvm2ice_tests/fp_const_pool.ll
new file mode 100644
index 0000000000000000000000000000000000000000..3271e538ebf1d213ca8a2b22450095b03c363544
--- /dev/null
+++ b/tests_lit/llvm2ice_tests/fp_const_pool.ll
@@ -0,0 +1,63 @@
+; This tests that different floating point constants (such as 0.0 and -0.0)
+; remain distinct even when they sort of look equal, and also that different
+; instances of the same floating point constant (such as NaN and NaN) get the
+; same constant pool entry even when "a==a" would suggest they are different.
+
+; REQUIRES: allow_dump
+
+define void @consume_float(float %f) {
+ ret void
+}
+
+define void @consume_double(double %d) {
+ ret void
+}
+
+define void @test_zeros() {
+entry:
+ call void @consume_float(float 0.0)
+ call void @consume_float(float -0.0)
+ call void @consume_double(double 0.0)
+ call void @consume_double(double -0.0)
+ ret void
+}
+; RUN: %p2i -i %s --insts | FileCheck --check-prefix=ZERO %s
JF 2015/03/19 16:33:09 Why different RUN lines? It seems like you could j
Jim Stichnoth 2015/03/19 18:07:04 I tried to clarify this in comments, ptal. The ZE
+; ZERO: test_zeros
+; ZERO-NEXT: entry:
+; ZERO-NEXT: call void @consume_float(float 0.0
+; ZERO-NEXT: call void @consume_float(float -0.0
+; ZERO-NEXT: call void @consume_double(double 0.0
+; ZERO-NEXT: call void @consume_double(double -0.0
+
+
+define void @test_nans() {
+entry:
+ call void @consume_float(float 0x7FF8000000000000)
+ call void @consume_float(float 0x7FF8000000000000)
+ call void @consume_float(float 0xFFF8000000000000)
+ call void @consume_float(float 0xFFF8000000000000)
+ call void @consume_double(double 0x7FF8000000000000)
+ call void @consume_double(double 0x7FF8000000000000)
+ call void @consume_double(double 0xFFF8000000000000)
+ call void @consume_double(double 0xFFF8000000000000)
+ ret void
+}
+; RUN: %p2i -i %s --filetype=asm --llvm-source \
+; RUN: | FileCheck --check-prefix=NANS1 %s
+; NANS1: float nan
+; NANS1-NOT: float nan
+
+; RUN: %p2i -i %s --filetype=asm --llvm-source \
+; RUN: | FileCheck --check-prefix=NANS2 %s
+; NANS2: float -nan
+; NANS2-NOT: float -nan
+
+; RUN: %p2i -i %s --filetype=asm --llvm-source \
+; RUN: | FileCheck --check-prefix=NANS3 %s
+; NANS3: double nan
+; NANS3-NOT: double nan
+
+; RUN: %p2i -i %s --filetype=asm --llvm-source \
+; RUN: | FileCheck --check-prefix=NANS4 %s
+; NANS4: double -nan
+; NANS4-NOT: double -nan
« tests_lit/llvm2ice_tests/abi-atomics.ll ('K') | « tests_lit/llvm2ice_tests/abi-atomics.ll ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698