diff --git a/cranelift/docs/callex.clif b/cranelift/docs/callex.clif index 853f5c4091..1d93239199 100644 --- a/cranelift/docs/callex.clif +++ b/cranelift/docs/callex.clif @@ -4,10 +4,13 @@ function %gcd(i32 uext, i32 uext) -> i32 uext system_v { fn0 = %divmod(i32 uext, i32 uext) -> i32 uext, i32 uext ebb1(v0: i32, v1: i32): - brz v1, ebb2 + brz v1, ebb3 + jump ebb2 + +ebb2: v2, v3 = call fn0(v0, v1) return v2 -ebb2: +ebb3: return v0 } diff --git a/cranelift/docs/example.clif b/cranelift/docs/example.clif index 2bc5c9cc4c..b848f7026a 100644 --- a/cranelift/docs/example.clif +++ b/cranelift/docs/example.clif @@ -6,11 +6,14 @@ function %average(i32, i32) -> f32 system_v { ebb1(v0: i32, v1: i32): v2 = f64const 0x0.0 stack_store v2, ss0 - brz v1, ebb3 ; Handle count == 0. - v3 = iconst.i32 0 - jump ebb2(v3) + brz v1, ebb5 ; Handle count == 0. + jump ebb2 -ebb2(v4: i32): +ebb2: + v3 = iconst.i32 0 + jump ebb3(v3) + +ebb3(v4: i32): v5 = imul_imm v4, 4 v6 = iadd v0, v5 v7 = load.f32 v6 ; array[i] @@ -20,14 +23,17 @@ ebb2(v4: i32): stack_store v10, ss0 v11 = iadd_imm v4, 1 v12 = icmp ult v11, v1 - brnz v12, ebb2(v11) ; Loop backedge. + brnz v12, ebb3(v11) ; Loop backedge. + jump ebb4 + +ebb4: v13 = stack_load.f64 ss0 v14 = fcvt_from_uint.f64 v1 v15 = fdiv v13, v14 v16 = fdemote.f32 v15 return v16 -ebb3: +ebb5: v100 = f32const +NaN return v100 }