diff options
author | Alon Zakai <alonzakai@gmail.com> | 2014-03-31 17:55:18 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2014-03-31 17:55:46 -0700 |
commit | 927f26f3729fc5279e0cb4481fb0c484ec6255c0 (patch) | |
tree | 2b4a145990431d792bb322b99a4fc987de94b1bc | |
parent | d75c0bca8116f7dcb5224c4cce971a0397faac48 (diff) |
testcase for returning nan
-rw-r--r-- | tests/cases/returnnan_fastcomp.ll | 34 | ||||
-rw-r--r-- | tests/cases/returnnan_fastcomp.txt | 3 | ||||
-rw-r--r-- | tests/hello_world.ll | 9 |
3 files changed, 41 insertions, 5 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! diff --git a/tests/hello_world.ll b/tests/hello_world.ll index ab4b199f..7090b732 100644 --- a/tests/hello_world.ll +++ b/tests/hello_world.ll @@ -2,16 +2,15 @@ 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 [15 x i8] c"hello, world!\0A\00", align 1 ; [#uses=1 type=[15 x i8]*] +@.str = private unnamed_addr constant [15 x i8] c"hello, world!\0A\00", align 1 -; [#uses=0] define i32 @main() { entry: - %retval = alloca i32, align 4 ; [#uses=1 type=i32*] + %retval = alloca i32, align 4 store i32 0, i32* %retval - %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([15 x i8]* @.str, i32 0, i32 0)) ; [#uses=0 type=i32] + %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([15 x i8]* @.str, i32 0, i32 0)) ret i32 1 } -; [#uses=1] declare i32 @printf(i8*, ...) + |