Ensure that the docs examples verify as Cretonne IL.

Any *.cton files in the docs directory are now included when running the
test-all.sh script. This is to ensure that the examples are in fact
correct IL.

Always print NaN and Inf floats with a sign. Print the positive ones as
+NaN and +Inf to make them easier to parse.
This commit is contained in:
Jakob Stoklund Olesen
2017-04-10 12:47:16 -07:00
parent b5237b6a4a
commit 46f0393417
5 changed files with 49 additions and 36 deletions

View File

@@ -1,18 +1,20 @@
test verifier
function average(i32, i32) -> f32 {
ss1 = stack_slot 8, align 4 ; Stack slot for ``sum``.
ss1 = stack_slot 8 ; Stack slot for ``sum``.
ebb1(v1: i32, v2: i32):
v3 = f64const 0x0.0
stack_store v3, ss1
brz v2, ebb3 ; Handle count == 0.
v4 = iconst.i32 0
br ebb2(v4)
jump ebb2(v4)
ebb2(v5: i32):
v6 = imul_imm v5, 4
v7 = iadd v1, v6
v8 = heap_load.f32 v7 ; array[i]
v9 = fext.f64 v8
v9 = fpromote.f64 v8
v10 = stack_load.f64 ss1
v11 = fadd v9, v10
stack_store v11, ss1
@@ -20,12 +22,12 @@ ebb2(v5: i32):
v13 = icmp ult v12, v2
brnz v13, ebb2(v12) ; Loop backedge.
v14 = stack_load.f64 ss1
v15 = cvt_utof.f64 v2
v15 = fcvt_from_uint.f64 v2
v16 = fdiv v14, v15
v17 = ftrunc.f32 v16
v17 = fdemote.f32 v16
return v17
ebb3:
v100 = f32const qNaN
v100 = f32const +NaN
return v100
}