diff options
author | Alon Zakai <alonzakai@gmail.com> | 2014-01-22 13:09:56 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2014-01-22 13:09:56 -0800 |
commit | 8608181c811e6c48d5c449596c4809e8e38c37ac (patch) | |
tree | df3bb6e0a2b6852aec5acf69fa75a525a816cf49 /tests/cases | |
parent | 245a29dedd9015861386ea4fafc3697c4bfcd761 (diff) |
fastcomp updates and a test for fptosi|ui on floats and doubles
Diffstat (limited to 'tests/cases')
-rw-r--r-- | tests/cases/fptosi.ll | 28 | ||||
-rw-r--r-- | tests/cases/fptosi.txt | 6 |
2 files changed, 34 insertions, 0 deletions
diff --git a/tests/cases/fptosi.ll b/tests/cases/fptosi.ll new file mode 100644 index 00000000..71bc6af8 --- /dev/null +++ b/tests/cases/fptosi.ll @@ -0,0 +1,28 @@ +; ModuleID = '/dev/shm/tmp/src.cpp.o' +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:32" +target triple = "le32-unknown-nacl" + +@.str = private unnamed_addr constant [8 x i8] c"*%.3f*\0A\00", align 1 ; [#uses=1 type=[8 x i8]*] +@.str2 = private unnamed_addr constant [6 x i8] c"*%d*\0A\00", align 1 ; [#uses=1 type=[6 x i8]*] + +; [#uses=0] +define i32 @main() { +entry: + %f = fadd float 1.000, 0.500 + %d = fadd double 3.333, 0.444 + %fd = fpext float %f to double + %call1 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([8 x i8]* @.str, i32 0, i32 0), double %fd) ; [#uses=0 type=i32] + %call2 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([8 x i8]* @.str, i32 0, i32 0), double %d) ; [#uses=0 type=i32] + %fs = fptosi float %f to i64 + %fu = fptoui float %f to i64 + %ds = fptosi double %d to i64 + %du = fptoui double %d to i64 + %call3 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([6 x i8]* @.str2, i32 0, i32 0), i64 %fs) ; [#uses=0 type=i32] + %call4 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([6 x i8]* @.str2, i32 0, i32 0), i64 %fu) ; [#uses=0 type=i32] + %call5 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([6 x i8]* @.str2, i32 0, i32 0), i64 %ds) ; [#uses=0 type=i32] + %call6 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([6 x i8]* @.str2, i32 0, i32 0), i64 %du) ; [#uses=0 type=i32] + ret i32 1 +} + +; [#uses=1] +declare i32 @printf(i8*, ...) diff --git a/tests/cases/fptosi.txt b/tests/cases/fptosi.txt new file mode 100644 index 00000000..eea925c4 --- /dev/null +++ b/tests/cases/fptosi.txt @@ -0,0 +1,6 @@ +*1.500* +*3.777* +*1* +*1* +*3* +*3* |