aboutsummaryrefslogtreecommitdiff
path: root/tests/cases
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2014-03-31 17:55:18 -0700
committerAlon Zakai <alonzakai@gmail.com>2014-03-31 17:55:46 -0700
commit927f26f3729fc5279e0cb4481fb0c484ec6255c0 (patch)
tree2b4a145990431d792bb322b99a4fc987de94b1bc /tests/cases
parentd75c0bca8116f7dcb5224c4cce971a0397faac48 (diff)
testcase for returning nan
Diffstat (limited to 'tests/cases')
-rw-r--r--tests/cases/returnnan_fastcomp.ll34
-rw-r--r--tests/cases/returnnan_fastcomp.txt3
2 files changed, 37 insertions, 0 deletions
diff --git a/tests/cases/returnnan_fastcomp.ll b/tests/cases/returnnan_fastcomp.ll
new file mode 100644
index 00000000..3a6a9f9e
--- /dev/null
+++ b/tests/cases/returnnan_fastcomp.ll
@@ -0,0 +1,34 @@
+; ModuleID = 'tests/hello_world.bc'
+target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128"
+target triple = "asmjs-unknown-emscripten"
+
+@.str = private unnamed_addr constant [18 x i8] c"hello, world %f!\0A\00", align 1
+
+define i32 @main() {
+entry:
+ %retval = alloca i32, align 4
+ store i32 0, i32* %retval
+ %f = call double @nand()
+ %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([18 x i8]* @.str, i32 0, i32 0), double %f)
+ %g = call double @zerod()
+ %call2 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([18 x i8]* @.str, i32 0, i32 0), double %g)
+ %h = call float @zerof()
+ %hd = fpext float %h to double
+ %call3 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([18 x i8]* @.str, i32 0, i32 0), double %hd)
+ ret i32 1
+}
+
+define double @nand() unnamed_addr align 2 {
+ ret double 0x7FF8000000000000
+}
+
+define double @zerod() unnamed_addr align 2 {
+ ret double 0x0000000000000000
+}
+
+define float @zerof() unnamed_addr align 2 {
+ ret float 0x0000000000000000
+}
+
+declare i32 @printf(i8*, ...)
+
diff --git a/tests/cases/returnnan_fastcomp.txt b/tests/cases/returnnan_fastcomp.txt
new file mode 100644
index 00000000..f11733ba
--- /dev/null
+++ b/tests/cases/returnnan_fastcomp.txt
@@ -0,0 +1,3 @@
+hello, world nan!
+hello, world 0.000000!
+hello, world 0.000000!