Skip to content

Commit a979871

Browse files
committed
testcase for #2314
1 parent cad88b3 commit a979871

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed
+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
; ModuleID = 'a.o'
2+
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"
3+
target triple = "asmjs-unknown-emscripten"
4+
5+
@.str = private unnamed_addr constant [11 x i8] c"float: %f\0A\00", align 1
6+
7+
define void @_Z10printFloatf(float %f) #0 {
8+
entry:
9+
%conv = fpext float %f to double
10+
%call = tail call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([11 x i8]* @.str, i32 0, i32 0), double %conv)
11+
ret void
12+
}
13+
14+
define i32 @main() #1 {
15+
entry:
16+
tail call void @_Z10printFloatf(float 1.000000e+00)
17+
call void @emscripten_preinvoke()
18+
call void @_Z10printFloatf(float undef)
19+
%last = call i32 @emscripten_postinvoke()
20+
%lastf = sitofp i32 %last to float
21+
tail call void @_Z10printFloatf(float %lastf)
22+
ret i32 1
23+
}
24+
25+
declare void @emscripten_preinvoke()
26+
declare i32 @emscripten_postinvoke()
27+
declare i32 @printf(i8* nocapture, ...) #1
28+
29+
attributes #0 = { noinline nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
30+
attributes #1 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
float: 1.000000
2+
float: 0.000000
3+
float: 0.000000

0 commit comments

Comments
 (0)