A lightweight WebAssembly runtime that is fast, secure, and standards-compliant
Cranelift: add mid-end opt rules (#14464)
Hyunbin Kimef7e547f08c9
diff --git a/cranelift/codegen/src/opts/arithmetic.isle b/cranelift/codegen/src/opts/arithmetic.isleindex 68e9cb9cdb..b7f70b29b9 100644--- a/cranelift/codegen/src/opts/arithmetic.isle+++ b/cranelift/codegen/src/opts/arithmetic.isle@@ -628,3 +628,59 @@;; x %u (1 << k) --> x & ((1 << k) - 1).(rule (simplify_skeleton (urem x divisor @ (ishl ty (iconst_u ty 1) k)))(band ty x (isub ty divisor (iconst_u ty 1))))++;; (x - (y & M)) + y --> (y & ~M) + x.+(rule (simplify (iadd (fits_in_64 ty)+ (isub ty x (band ty y (iconst ty z)))+ y))+ (iadd ty (band ty y (iconst ty (imm64_not ty z))) x))+(rule (simplify (iadd (fits_in_64 ty)+ x+ (isub ty y (band ty x (iconst ty z)))))+ (iadd ty (band ty x (iconst ty (imm64_not ty z))) y))+(rule (simplify (isub (fits_in_64 ty)+ (iadd ty x y)+ (band ty x (iconst ty z))))+ (iadd ty (band ty x (iconst ty (imm64_not ty z))) y))+(rule (simplify (isub (fits_in_64 ty)+ (iadd ty x y)+ (band ty y (iconst ty z))))+ (iadd ty (band ty y (iconst ty (imm64_not ty z))) x))++;; ((1 << k) + 1) * y --> (y << k) + y.+(rule (simplify (imul ty+ (iadd ty (ishl ty (iconst_u ty 1) x) (iconst_u ty 1))+ y))+ (iadd ty (ishl ty y x) y))+(rule (simplify (imul ty+ x+ (iadd ty (ishl ty (iconst_u ty 1) y) (iconst_u ty 1))))+ (iadd ty (ishl ty x y) x))++;; x - (x & M) --> x & ~M.+(rule (simplify (isub (fits_in_64 ty) x (band ty x (iconst ty y))))+ (band ty x (iconst ty (imm64_not ty y))))++;; (x + C1) - (y + C2) --> (x - y) + (C1 - C2).+(rule (simplify (isub (fits_in_64 ty)+ (iadd ty x (iconst ty y))+ (iadd ty z (iconst ty p))))+ (iadd ty (isub ty x z) (iconst ty (imm64_sub ty y p))))+(rule (simplify (isub (fits_in_64 ty)+ (isub ty (iconst ty x) y)+ (isub ty (iconst ty z) p)))+ (iadd ty (isub ty p y) (iconst ty (imm64_sub ty x z))))+(rule (simplify (isub (fits_in_64 ty)+ (isub ty x (iconst ty y))+ (isub ty z (iconst ty p))))+ (iadd ty (isub ty x z) (iconst ty (imm64_sub ty p y))))++;; (x + C1) + (C2 - y) --> (x - y) + (C1 + C2).+(rule (simplify (iadd (fits_in_64 ty)+ (iadd ty x (iconst ty y))+ (isub ty (iconst ty z) p)))+ (iadd ty (isub ty x p) (iconst ty (imm64_add ty y z))))+(rule (simplify (iadd (fits_in_64 ty)+ (isub ty (iconst ty x) y)+ (iadd ty z (iconst ty p))))+ (iadd ty (isub ty z y) (iconst ty (imm64_add ty p x))))diff --git a/cranelift/codegen/src/opts/extends.isle b/cranelift/codegen/src/opts/extends.isleindex 21598dd23b..dbbd53b2de 100644--- a/cranelift/codegen/src/opts/extends.isle+++ b/cranelift/codegen/src/opts/extends.isle@@ -102,3 +102,15 @@(uextend ty x @ (value_type (ty_int narrow)))(uextend ty y @ (value_type narrow))))(ult rty x y))++;; uextend(x) == 0 --> x == 0.+(rule (simplify (eq ty+ (uextend ty1 x @ (value_type cty))+ (iconst_u ty1 0)))+ (eq ty x (iconst_u cty 0)))++;; uextend(x) == uextend(y) --> x == y, when x and y have the same type.+(rule (simplify (eq ty+ (uextend cty x @ (value_type ty1))+ (uextend cty y @ (value_type ty1))))+ (eq ty x y))diff --git a/cranelift/codegen/src/opts/icmp.isle b/cranelift/codegen/src/opts/icmp.isleindex 4dbb8d8f16..34d17c7b5b 100644--- a/cranelift/codegen/src/opts/icmp.isle+++ b/cranelift/codegen/src/opts/icmp.isle@@ -605,3 +605,15 @@(u64_sub (ty_bits_u64 ty) bits)))(subsume (eq rty (band ty x (iconst_s ty (i64_wrapping_sub (i64_wrapping_neg mask) 1)))(all_zero ty))))++;; (x == y) ^ 1 --> x != y.+(rule (simplify (bxor ty+ (eq ty x @ (value_type cty) y @ (value_type cty))+ (iconst_u ty 1)))+ (ne ty x y))++;; x >u (x - 1) --> x != 0, and its dual.+(rule (simplify (ugt ty x (isub cty x (iconst_u cty 1))))+ (ne ty x (iconst_u cty 0)))+(rule (simplify (ult ty (isub cty x (iconst_u cty 1)) x))+ (ne ty x (iconst_u cty 0)))diff --git a/cranelift/codegen/src/opts/selects.isle b/cranelift/codegen/src/opts/selects.isleindex afda85d12a..2134bb8704 100644--- a/cranelift/codegen/src/opts/selects.isle+++ b/cranelift/codegen/src/opts/selects.isle@@ -212,3 +212,50 @@;; (x != y) ? (x - y) : 0 ==> x - y(rule (simplify (select ty (ne cty x y) (isub ty x y) (all_zero ty)))(isub ty x y))++;; (c ? x : y) + (c ? p : q) --> c ? (x + p) : (y + q).+(rule (simplify (iadd ty (select ty x y z) (select ty x p q)))+ (select ty x (iadd ty y p) (iadd ty z q)))++;; (c ? C1 : C2) & M --> c ? (C1 & M) : (C2 & M).+(rule (simplify (band (fits_in_64 ty)+ (select ty x (iconst ty y) (iconst ty z))+ (iconst ty p)))+ (select ty x+ (iconst ty (imm64_and ty y p))+ (iconst ty (imm64_and ty z p))))+(rule (simplify (band (fits_in_64 ty)+ (iconst ty x)+ (select ty y (iconst ty z) (iconst ty p))))+ (select ty y+ (iconst ty (imm64_and ty x z))+ (iconst ty (imm64_and ty x p))))+(rule (simplify (band (fits_in_64 ty)+ (select ty x (iconst ty y) (iconst_u ty z))+ (iconst_u ty p)))+ (if-let true (u64_eq z (u64_and z p)))+ (select ty x+ (iconst ty (imm64_and ty y (imm64 p)))+ (iconst_u ty z)))++;; (x == 0) ? y : (x + y) --> y + x, and its dual.+(rule (simplify (select ty+ (eq cty x (iconst_u ty 0))+ y+ (iadd ty x y)))+ (iadd ty y x))+(rule (simplify (select ty+ (eq cty x (iconst_u ty 0))+ y+ (iadd ty y x)))+ (iadd ty y x))+(rule (simplify (select ty+ (ne cty x (iconst_u ty 0))+ (iadd ty x y)+ y))+ (iadd ty y x))+(rule (simplify (select ty+ (ne cty x (iconst_u ty 0))+ (iadd ty y x)+ y))+ (iadd ty y x))diff --git a/cranelift/codegen/src/opts/shifts.isle b/cranelift/codegen/src/opts/shifts.isleindex c49639e459..044d9000af 100644--- a/cranelift/codegen/src/opts/shifts.isle+++ b/cranelift/codegen/src/opts/shifts.isle@@ -347,3 +347,11 @@(rule (simplify (sshr ty x (band _ k (iconst_u _ mask))))(if-let mask (ty_shift_mask ty))(sshr ty x k))++;; (c ? C1 : C2) << K --> c ? (C1 << K) : (C2 << K).+(rule (simplify (ishl (fits_in_64 ty)+ (select ty x (iconst ty y) (iconst ty z))+ (iconst ty p)))+ (select ty x+ (iconst ty (imm64_shl ty y p))+ (iconst ty (imm64_shl ty z p))))diff --git a/cranelift/filetests/filetests/egraph/arithmetic.clif b/cranelift/filetests/filetests/egraph/arithmetic.clifindex 124e821dc6..cc8110893b 100644--- a/cranelift/filetests/filetests/egraph/arithmetic.clif+++ b/cranelift/filetests/filetests/egraph/arithmetic.clif@@ -705,3 +705,384 @@ block0(v0: i32):; check: v4 = imul v0, v0; check: return v4}++function %sub_mask_i32(i32) -> i32 {+block0(v0: i32):+ v1 = iconst.i32 15+ v2 = band v0, v1+ v3 = isub v0, v2+ return v3+}+; check: v4 = iconst.i32 -16+; check: v5 = band v0, v4 ; v4 = -16+; check: return v5++function %sub_mask_i64(i64) -> i64 {+block0(v0: i64):+ v1 = iconst.i64 15+ v2 = band v0, v1+ v3 = isub v0, v2+ return v3+}+; check: v4 = iconst.i64 -16+; check: v5 = band v0, v4 ; v4 = -16+; check: return v5++function %sub_offsets_i32(i32, i32) -> i32 {+block0(v0: i32, v1: i32):+ v2 = iconst.i32 5+ v3 = iconst.i32 7+ v4 = iadd v0, v2+ v5 = iadd v1, v3+ v6 = isub v4, v5+ return v6+}+; check: v7 = isub v0, v1+; check: v8 = iconst.i32 -2+; check: v9 = iadd v7, v8 ; v8 = -2+; check: return v9++function %sub_offsets_i64(i64, i64) -> i64 {+block0(v0: i64, v1: i64):+ v2 = iconst.i64 5+ v3 = iconst.i64 7+ v4 = iadd v0, v2+ v5 = iadd v1, v3+ v6 = isub v4, v5+ return v6+}+; check: v7 = isub v0, v1+; check: v8 = iconst.i64 -2+; check: v9 = iadd v7, v8 ; v8 = -2+; check: return v9++function %add_sub_offsets_i32(i32, i32) -> i32 {+block0(v0: i32, v1: i32):+ v2 = iconst.i32 5+ v3 = iconst.i32 7+ v4 = iadd v0, v2+ v5 = isub v3, v1+ v6 = iadd v4, v5+ return v6+}+; check: v17 = isub v0, v1+; check: v18 = iconst.i32 12+; check: v19 = iadd v17, v18 ; v18 = 12+; check: return v19++function %add_sub_offsets_i64(i64, i64) -> i64 {+block0(v0: i64, v1: i64):+ v2 = iconst.i64 5+ v3 = iconst.i64 7+ v4 = iadd v0, v2+ v5 = isub v3, v1+ v6 = iadd v4, v5+ return v6+}+; check: v17 = isub v0, v1+; check: v18 = iconst.i64 12+; check: v19 = iadd v17, v18 ; v18 = 12+; check: return v19++function %add_sub_mask_i32(i32, i32) -> i32 {+block0(v0: i32, v1: i32):+ v2 = iconst.i32 15+ v3 = band v1, v2+ v4 = isub v0, v3+ v5 = iadd v4, v1+ return v5+}+; check: v6 = iconst.i32 -16+; check: v7 = band v1, v6 ; v6 = -16+; check: v8 = iadd v7, v0+; check: return v8++function %add_sub_mask_i64(i64, i64) -> i64 {+block0(v0: i64, v1: i64):+ v2 = iconst.i64 15+ v3 = band v1, v2+ v4 = isub v0, v3+ v5 = iadd v4, v1+ return v5+}+; check: v6 = iconst.i64 -16+; check: v7 = band v1, v6 ; v6 = -16+; check: v8 = iadd v7, v0+; check: return v8++function %mul_shift_plus_one_i32(i32, i32) -> i32 {+block0(v0: i32, v1: i32):+ v2 = iconst.i32 1+ v3 = ishl v2, v0+ v4 = iadd v3, v2+ v5 = imul v4, v1+ return v5+}+; check: v6 = ishl v1, v0+; check: v7 = iadd v6, v1+; check: return v7++function %mul_shift_plus_one_i64(i64, i64) -> i64 {+block0(v0: i64, v1: i64):+ v2 = iconst.i64 1+ v3 = ishl v2, v0+ v4 = iadd v3, v2+ v5 = imul v4, v1+ return v5+}+; check: v6 = ishl v1, v0+; check: v7 = iadd v6, v1+; check: return v7++function %sub_offsets_wrap_i8(i8, i8) -> i8 {+block0(v0: i8, v1: i8):+ v2 = iconst.i8 100+ v3 = iconst.i8 -100+ v4 = iadd v0, v2+ v5 = iadd v1, v3+ v6 = isub v4, v5+ return v6+}+; check: v7 = isub v0, v1+; check: v8 = iconst.i8 -56+; check: v9 = iadd v7, v8 ; v8 = -56+; check: return v9++function %add_sub_offsets_wrap_i8(i8, i8) -> i8 {+block0(v0: i8, v1: i8):+ v2 = iconst.i8 100+ v3 = iconst.i8 100+ v4 = iadd v0, v2+ v5 = isub v3, v1+ v6 = iadd v4, v5+ return v6+}+; check: v17 = isub v0, v1+; check: v18 = iconst.i8 -56+; check: v19 = iadd v17, v18 ; v18 = -56+; check: return v19++function %sub_mask_noncontiguous_i8(i8) -> i8 {+block0(v0: i8):+ v1 = iconst.i8 0xaa+ v2 = band v0, v1+ v3 = isub v0, v2+ return v3+}+; check: v4 = iconst.i8 85+; check: v5 = band v0, v4 ; v4 = 85+; check: return v5++function %add_sub_offsets_commuted_i32(i32, i32) -> i32 {+block0(v0: i32, v1: i32):+ v2 = iconst.i32 5+ v3 = iconst.i32 7+ v4 = iadd v0, v2+ v5 = isub v3, v1+ v6 = iadd v5, v4+ return v6+}+; check: v17 = isub v0, v1+; check: v18 = iconst.i32 12+; check: v19 = iadd v17, v18 ; v18 = 12+; check: return v19++function %add_sub_offsets_commuted_i64(i64, i64) -> i64 {+block0(v0: i64, v1: i64):+ v2 = iconst.i64 5+ v3 = iconst.i64 7+ v4 = iadd v0, v2+ v5 = isub v3, v1+ v6 = iadd v5, v4+ return v6+}+; check: v17 = isub v0, v1+; check: v18 = iconst.i64 12+; check: v19 = iadd v17, v18 ; v18 = 12+; check: return v19++function %add_sub_mask_commuted_i32(i32, i32) -> i32 {+block0(v0: i32, v1: i32):+ v2 = iconst.i32 15+ v3 = band v1, v2+ v4 = isub v0, v3+ v5 = iadd v1, v4+ return v5+}+; check: v6 = iconst.i32 -16+; check: v7 = band v1, v6 ; v6 = -16+; check: v8 = iadd v7, v0+; check: return v8++function %add_sub_mask_commuted_i64(i64, i64) -> i64 {+block0(v0: i64, v1: i64):+ v2 = iconst.i64 15+ v3 = band v1, v2+ v4 = isub v0, v3+ v5 = iadd v1, v4+ return v5+}+; check: v6 = iconst.i64 -16+; check: v7 = band v1, v6 ; v6 = -16+; check: v8 = iadd v7, v0+; check: return v8++function %mul_shift_plus_one_commuted_i32(i32, i32) -> i32 {+block0(v0: i32, v1: i32):+ v2 = iconst.i32 1+ v3 = ishl v2, v0+ v4 = iadd v3, v2+ v5 = imul v1, v4+ return v5+}+; check: v6 = ishl v1, v0+; check: v7 = iadd v6, v1+; check: return v7++function %mul_shift_plus_one_commuted_i64(i64, i64) -> i64 {+block0(v0: i64, v1: i64):+ v2 = iconst.i64 1+ v3 = ishl v2, v0+ v4 = iadd v3, v2+ v5 = imul v1, v4+ return v5+}+; check: v6 = ishl v1, v0+; check: v7 = iadd v6, v1+; check: return v7++function %sub_constant_offsets_i32(i32, i32) -> i32 {+block0(v0: i32, v1: i32):+ v2 = iconst.i32 5+ v3 = iconst.i32 7+ v4 = isub v2, v0+ v5 = isub v3, v1+ v6 = isub v4, v5+ return v6+}+; check: v27 = isub v1, v0+; check: v28 = iconst.i32 -2+; check: v29 = iadd v27, v28 ; v28 = -2+; check: return v29++function %sub_constant_offsets_i64(i64, i64) -> i64 {+block0(v0: i64, v1: i64):+ v2 = iconst.i64 5+ v3 = iconst.i64 7+ v4 = isub v2, v0+ v5 = isub v3, v1+ v6 = isub v4, v5+ return v6+}+; check: v27 = isub v1, v0+; check: v28 = iconst.i64 -2+; check: v29 = iadd v27, v28 ; v28 = -2+; check: return v29++function %sub_sub_offsets_i32(i32, i32) -> i32 {+block0(v0: i32, v1: i32):+ v2 = iconst.i32 5+ v3 = iconst.i32 7+ v4 = isub v0, v2+ v5 = isub v1, v3+ v6 = isub v4, v5+ return v6+}+; check: v7 = isub v0, v1+; check: v8 = iconst.i32 2+; check: v9 = iadd v7, v8 ; v8 = 2+; check: return v9++function %sub_sub_offsets_i64(i64, i64) -> i64 {+block0(v0: i64, v1: i64):+ v2 = iconst.i64 5+ v3 = iconst.i64 7+ v4 = isub v0, v2+ v5 = isub v1, v3+ v6 = isub v4, v5+ return v6+}+; check: v7 = isub v0, v1+; check: v8 = iconst.i64 2+; check: v9 = iadd v7, v8 ; v8 = 2+; check: return v9++function %add_sub_left_mask_i32(i32, i32) -> i32 {+block0(v0: i32, v1: i32):+ v2 = iconst.i32 15+ v3 = band v0, v2+ v4 = iadd v0, v1+ v5 = isub v4, v3+ return v5+}+; check: v6 = iconst.i32 -16+; check: v7 = band v0, v6 ; v6 = -16+; check: v8 = iadd v7, v1+; check: return v8++function %add_sub_left_mask_i64(i64, i64) -> i64 {+block0(v0: i64, v1: i64):+ v2 = iconst.i64 15+ v3 = band v0, v2+ v4 = iadd v0, v1+ v5 = isub v4, v3+ return v5+}+; check: v6 = iconst.i64 -16+; check: v7 = band v0, v6 ; v6 = -16+; check: v8 = iadd v7, v1+; check: return v8++function %add_sub_right_mask_i32(i32, i32) -> i32 {+block0(v0: i32, v1: i32):+ v2 = iconst.i32 15+ v3 = band v1, v2+ v4 = iadd v0, v1+ v5 = isub v4, v3+ return v5+}+; check: v6 = iconst.i32 -16+; check: v7 = band v1, v6 ; v6 = -16+; check: v8 = iadd v7, v0+; check: return v8++function %add_sub_right_mask_i64(i64, i64) -> i64 {+block0(v0: i64, v1: i64):+ v2 = iconst.i64 15+ v3 = band v1, v2+ v4 = iadd v0, v1+ v5 = isub v4, v3+ return v5+}+; check: v6 = iconst.i64 -16+; check: v7 = band v1, v6 ; v6 = -16+; check: v8 = iadd v7, v0+; check: return v8++function %sub_constant_offsets_wrap_i8(i8, i8) -> i8 {+block0(v0: i8, v1: i8):+ v2 = iconst.i8 100+ v3 = iconst.i8 -100+ v4 = isub v2, v0+ v5 = isub v3, v1+ v6 = isub v4, v5+ return v6+}+; check: v29 = isub v1, v0+; check: v30 = iconst.i8 -56+; check: v31 = iadd v29, v30 ; v30 = -56+; check: return v31++function %sub_sub_offsets_wrap_i8(i8, i8) -> i8 {+block0(v0: i8, v1: i8):+ v2 = iconst.i8 100+ v3 = iconst.i8 -100+ v4 = isub v0, v2+ v5 = isub v1, v3+ v6 = isub v4, v5+ return v6+}+; check: v9 = isub v0, v1+; check: v10 = iconst.i8 56+; check: v11 = iadd v9, v10 ; v10 = 56+; check: return v11diff --git a/cranelift/filetests/filetests/egraph/extends.clif b/cranelift/filetests/filetests/egraph/extends.clifindex dfb5e96905..9305857692 100644--- a/cranelift/filetests/filetests/egraph/extends.clif+++ b/cranelift/filetests/filetests/egraph/extends.clif@@ -305,3 +305,57 @@ block0(v0: i8, v1: i16):; check: uextend.i32 v0; check: uextend.i32 v1; check: icmp ult v2, v3++function %eq_uextends_i32(i8, i8) -> i8 {+block0(v0: i8, v1: i8):+ v2 = uextend.i32 v0+ v3 = uextend.i32 v1+ v4 = icmp eq v2, v3+ return v4+}+; check: v5 = icmp eq v0, v1+; check: return v5++function %eq_uextends_i64(i8, i8) -> i8 {+block0(v0: i8, v1: i8):+ v2 = uextend.i64 v0+ v3 = uextend.i64 v1+ v4 = icmp eq v2, v3+ return v4+}+; check: v5 = icmp eq v0, v1+; check: return v5++function %eq_uextend_zero_i32(i8) -> i8 {+block0(v0: i8):+ v1 = uextend.i32 v0+ v2 = iconst.i32 0+ v3 = icmp eq v1, v2+ return v3+}+; check: v4 = iconst.i8 0+; check: v5 = icmp eq v0, v4 ; v4 = 0+; check: return v5++function %eq_uextend_zero_i64(i8) -> i8 {+block0(v0: i8):+ v1 = uextend.i64 v0+ v2 = iconst.i64 0+ v3 = icmp eq v1, v2+ return v3+}+; check: v4 = iconst.i8 0+; check: v5 = icmp eq v0, v4 ; v4 = 0+; check: return v5++function %eq_uextends_mixed_widths(i8, i16) -> i8 {+block0(v0: i8, v1: i16):+ v2 = uextend.i64 v0+ v3 = uextend.i64 v1+ v4 = icmp eq v2, v3+ return v4+}+; check: v2 = uextend.i64 v0+; check: v3 = uextend.i64 v1+; check: v4 = icmp eq v2, v3+; check: return v4diff --git a/cranelift/filetests/filetests/egraph/icmp.clif b/cranelift/filetests/filetests/egraph/icmp.clifindex a6f50c828a..974f030ad9 100644--- a/cranelift/filetests/filetests/egraph/icmp.clif+++ b/cranelift/filetests/filetests/egraph/icmp.clif@@ -1286,3 +1286,91 @@ block0(v0: i32, v1: i32):; v7 = icmp eq v0, v6; return v7; }++function %xor_eq_one_i32(i32, i32) -> i8 {+block0(v0: i32, v1: i32):+ v2 = icmp eq v0, v1+ v3 = iconst.i8 1+ v4 = bxor v2, v3+ return v4+}++; function %xor_eq_one_i32(i32, i32) -> i8 fast {+; block0(v0: i32, v1: i32):+; v5 = icmp ne v0, v1+; return v5+; }++function %xor_eq_one_i64(i64, i64) -> i8 {+block0(v0: i64, v1: i64):+ v2 = icmp eq v0, v1+ v3 = iconst.i8 1+ v4 = bxor v2, v3+ return v4+}++; function %xor_eq_one_i64(i64, i64) -> i8 fast {+; block0(v0: i64, v1: i64):+; v5 = icmp ne v0, v1+; return v5+; }++function %ugt_sub_one_i32(i32) -> i8 {+block0(v0: i32):+ v1 = iconst.i32 1+ v2 = isub v0, v1+ v3 = icmp ugt v0, v2+ return v3+}++; function %ugt_sub_one_i32(i32) -> i8 fast {+; block0(v0: i32):+; v4 = iconst.i32 0+; v5 = icmp ne v0, v4 ; v4 = 0+; return v5+; }++function %ugt_sub_one_i64(i64) -> i8 {+block0(v0: i64):+ v1 = iconst.i64 1+ v2 = isub v0, v1+ v3 = icmp ugt v0, v2+ return v3+}++; function %ugt_sub_one_i64(i64) -> i8 fast {+; block0(v0: i64):+; v4 = iconst.i64 0+; v5 = icmp ne v0, v4 ; v4 = 0+; return v5+; }++function %ult_sub_one_i32(i32) -> i8 {+block0(v0: i32):+ v1 = iconst.i32 1+ v2 = isub v0, v1+ v3 = icmp ult v2, v0+ return v3+}++; function %ult_sub_one_i32(i32) -> i8 fast {+; block0(v0: i32):+; v4 = iconst.i32 0+; v5 = icmp ne v0, v4 ; v4 = 0+; return v5+; }++function %ult_sub_one_i64(i64) -> i8 {+block0(v0: i64):+ v1 = iconst.i64 1+ v2 = isub v0, v1+ v3 = icmp ult v2, v0+ return v3+}++; function %ult_sub_one_i64(i64) -> i8 fast {+; block0(v0: i64):+; v4 = iconst.i64 0+; v5 = icmp ne v0, v4 ; v4 = 0+; return v5+; }diff --git a/cranelift/filetests/filetests/egraph/selects.clif b/cranelift/filetests/filetests/egraph/selects.clifindex b715c913b6..5aa7706572 100644--- a/cranelift/filetests/filetests/egraph/selects.clif+++ b/cranelift/filetests/filetests/egraph/selects.clif@@ -274,3 +274,299 @@ block0(v0: i32, v1: i32):; v3 = isub v0, v1; return v3; }++function %select_zero_add_i32(i32, i32) -> i32 {+block0(v0: i32, v1: i32):+ v2 = iconst.i32 0+ v3 = icmp eq v0, v2+ v4 = iadd v0, v1+ v5 = select v3, v1, v4+ return v5+}++; function %select_zero_add_i32(i32, i32) -> i32 fast {+; block0(v0: i32, v1: i32):+; v6 = iadd v1, v0+; return v6+; }++function %select_zero_add_i64(i64, i64) -> i64 {+block0(v0: i64, v1: i64):+ v2 = iconst.i64 0+ v3 = icmp eq v0, v2+ v4 = iadd v0, v1+ v5 = select v3, v1, v4+ return v5+}++; function %select_zero_add_i64(i64, i64) -> i64 fast {+; block0(v0: i64, v1: i64):+; v6 = iadd v1, v0+; return v6+; }++function %add_same_condition_selects_i32(i8, i32, i32, i32, i32) -> i32 {+block0(v0: i8, v1: i32, v2: i32, v3: i32, v4: i32):+ v5 = select v0, v1, v2+ v6 = select v0, v3, v4+ v7 = iadd v5, v6+ return v7+}++; function %add_same_condition_selects_i32(i8, i32, i32, i32, i32) -> i32 fast {+; block0(v0: i8, v1: i32, v2: i32, v3: i32, v4: i32):+; v8 = iadd v1, v3+; v9 = iadd v2, v4+; v10 = select v0, v8, v9+; return v10+; }++function %add_same_condition_selects_i64(i8, i64, i64, i64, i64) -> i64 {+block0(v0: i8, v1: i64, v2: i64, v3: i64, v4: i64):+ v5 = select v0, v1, v2+ v6 = select v0, v3, v4+ v7 = iadd v5, v6+ return v7+}++; function %add_same_condition_selects_i64(i8, i64, i64, i64, i64) -> i64 fast {+; block0(v0: i8, v1: i64, v2: i64, v3: i64, v4: i64):+; v8 = iadd v1, v3+; v9 = iadd v2, v4+; v10 = select v0, v8, v9+; return v10+; }++function %select_constant_mask_i32(i8) -> i32 {+block0(v0: i8):+ v1 = iconst.i32 11+ v2 = iconst.i32 13+ v3 = iconst.i32 7+ v4 = select v0, v1, v2+ v5 = band v4, v3+ return v5+}++; function %select_constant_mask_i32(i8) -> i32 fast {+; block0(v0: i8):+; v6 = iconst.i32 3+; v7 = iconst.i32 5+; v8 = select v0, v6, v7 ; v6 = 3, v7 = 5+; return v8+; }++function %select_constant_mask_i64(i8) -> i64 {+block0(v0: i8):+ v1 = iconst.i64 11+ v2 = iconst.i64 13+ v3 = iconst.i64 7+ v4 = select v0, v1, v2+ v5 = band v4, v3+ return v5+}++; function %select_constant_mask_i64(i8) -> i64 fast {+; block0(v0: i8):+; v6 = iconst.i64 3+; v7 = iconst.i64 5+; v8 = select v0, v6, v7 ; v6 = 3, v7 = 5+; return v8+; }++function %select_zero_add_commuted_i32(i32, i32) -> i32 {+block0(v0: i32, v1: i32):+ v2 = iconst.i32 0+ v3 = icmp eq v0, v2+ v4 = iadd v1, v0+ v5 = select v3, v1, v4+ return v5+}++; function %select_zero_add_commuted_i32(i32, i32) -> i32 fast {+; block0(v0: i32, v1: i32):+; v4 = iadd v1, v0+; return v4+; }++function %select_zero_add_commuted_i64(i64, i64) -> i64 {+block0(v0: i64, v1: i64):+ v2 = iconst.i64 0+ v3 = icmp eq v0, v2+ v4 = iadd v1, v0+ v5 = select v3, v1, v4+ return v5+}++; function %select_zero_add_commuted_i64(i64, i64) -> i64 fast {+; block0(v0: i64, v1: i64):+; v4 = iadd v1, v0+; return v4+; }++function %select_nonzero_add_i32(i32, i32) -> i32 {+block0(v0: i32, v1: i32):+ v2 = iconst.i32 0+ v3 = icmp ne v0, v2+ v4 = iadd v0, v1+ v5 = select v3, v4, v1+ return v5+}++; function %select_nonzero_add_i32(i32, i32) -> i32 fast {+; block0(v0: i32, v1: i32):+; v6 = iadd v1, v0+; return v6+; }++function %select_nonzero_add_i64(i64, i64) -> i64 {+block0(v0: i64, v1: i64):+ v2 = iconst.i64 0+ v3 = icmp ne v0, v2+ v4 = iadd v0, v1+ v5 = select v3, v4, v1+ return v5+}++; function %select_nonzero_add_i64(i64, i64) -> i64 fast {+; block0(v0: i64, v1: i64):+; v6 = iadd v1, v0+; return v6+; }++function %select_nonzero_add_commuted_i32(i32, i32) -> i32 {+block0(v0: i32, v1: i32):+ v2 = iconst.i32 0+ v3 = icmp ne v0, v2+ v4 = iadd v1, v0+ v5 = select v3, v4, v1+ return v5+}++; function %select_nonzero_add_commuted_i32(i32, i32) -> i32 fast {+; block0(v0: i32, v1: i32):+; v4 = iadd v1, v0+; return v4+; }++function %select_nonzero_add_commuted_i64(i64, i64) -> i64 {+block0(v0: i64, v1: i64):+ v2 = iconst.i64 0+ v3 = icmp ne v0, v2+ v4 = iadd v1, v0+ v5 = select v3, v4, v1+ return v5+}++; function %select_nonzero_add_commuted_i64(i64, i64) -> i64 fast {+; block0(v0: i64, v1: i64):+; v4 = iadd v1, v0+; return v4+; }++function %select_constant_mask_commuted_i32(i8) -> i32 {+block0(v0: i8):+ v1 = iconst.i32 11+ v2 = iconst.i32 13+ v3 = iconst.i32 7+ v4 = select v0, v1, v2+ v5 = band v3, v4+ return v5+}++; function %select_constant_mask_commuted_i32(i8) -> i32 fast {+; block0(v0: i8):+; v6 = iconst.i32 3+; v7 = iconst.i32 5+; v8 = select v0, v6, v7 ; v6 = 3, v7 = 5+; return v8+; }++function %select_constant_mask_commuted_i64(i8) -> i64 {+block0(v0: i8):+ v1 = iconst.i64 11+ v2 = iconst.i64 13+ v3 = iconst.i64 7+ v4 = select v0, v1, v2+ v5 = band v3, v4+ return v5+}++; function %select_constant_mask_commuted_i64(i8) -> i64 fast {+; block0(v0: i8):+; v6 = iconst.i64 3+; v7 = iconst.i64 5+; v8 = select v0, v6, v7 ; v6 = 3, v7 = 5+; return v8+; }++function %select_constant_mask_preserved_branch_i32(i8) -> i32 {+block0(v0: i8):+ v1 = iconst.i32 27+ v2 = iconst.i32 13+ v3 = iconst.i32 15+ v4 = select v0, v1, v2+ v5 = band v4, v3+ return v5+}++; function %select_constant_mask_preserved_branch_i32(i8) -> i32 fast {+; block0(v0: i8):+; v6 = iconst.i32 11+; v2 = iconst.i32 13+; v7 = select v0, v6, v2 ; v6 = 11, v2 = 13+; return v7+; }++function %select_constant_mask_preserved_branch_i64(i8) -> i64 {+block0(v0: i8):+ v1 = iconst.i64 27+ v2 = iconst.i64 13+ v3 = iconst.i64 15+ v4 = select v0, v1, v2+ v5 = band v4, v3+ return v5+}++; function %select_constant_mask_preserved_branch_i64(i8) -> i64 fast {+; block0(v0: i8):+; v6 = iconst.i64 11+; v2 = iconst.i64 13+; v7 = select v0, v6, v2 ; v6 = 11, v2 = 13+; return v7+; }++function %select_constant_mask_changed_branch_i32(i8) -> i32 {+block0(v0: i8):+ v1 = iconst.i32 27+ v2 = iconst.i32 13+ v3 = iconst.i32 7+ v4 = select v0, v1, v2+ v5 = band v4, v3+ return v5+}++; function %select_constant_mask_changed_branch_i32(i8) -> i32 fast {+; block0(v0: i8):+; v6 = iconst.i32 3+; v7 = iconst.i32 5+; v8 = select v0, v6, v7 ; v6 = 3, v7 = 5+; return v8+; }++function %select_constant_mask_changed_branch_i64(i8) -> i64 {+block0(v0: i8):+ v1 = iconst.i64 27+ v2 = iconst.i64 13+ v3 = iconst.i64 7+ v4 = select v0, v1, v2+ v5 = band v4, v3+ return v5+}++; function %select_constant_mask_changed_branch_i64(i8) -> i64 fast {+; block0(v0: i8):+; v6 = iconst.i64 3+; v7 = iconst.i64 5+; v8 = select v0, v6, v7 ; v6 = 3, v7 = 5+; return v8+; }diff --git a/cranelift/filetests/filetests/egraph/shifts.clif b/cranelift/filetests/filetests/egraph/shifts.clifindex 9247effd4c..4953d4a7c3 100644--- a/cranelift/filetests/filetests/egraph/shifts.clif+++ b/cranelift/filetests/filetests/egraph/shifts.clif@@ -816,3 +816,45 @@ block0(v0: i32x4, v1: i32):return v4}; check: ishl v0, v1++function %select_constant_shift_i32(i8) -> i32 {+block0(v0: i8):+ v1 = iconst.i32 3+ v2 = iconst.i32 5+ v3 = iconst.i32 2+ v4 = select v0, v1, v2+ v5 = ishl v4, v3+ return v5+}+; check: v6 = iconst.i32 12+; check: v7 = iconst.i32 20+; check: v8 = select v0, v6, v7 ; v6 = 12, v7 = 20+; check: return v8++function %select_constant_shift_i64(i8) -> i64 {+block0(v0: i8):+ v1 = iconst.i64 3+ v2 = iconst.i64 5+ v3 = iconst.i64 2+ v4 = select v0, v1, v2+ v5 = ishl v4, v3+ return v5+}+; check: v6 = iconst.i64 12+; check: v7 = iconst.i64 20+; check: v8 = select v0, v6, v7 ; v6 = 12, v7 = 20+; check: return v8++function %select_constant_shift_masked_i8(i8) -> i8 {+block0(v0: i8):+ v1 = iconst.i8 3+ v2 = iconst.i8 5+ v3 = iconst.i8 10+ v4 = select v0, v1, v2+ v5 = ishl v4, v3+ return v5+}+; check: v6 = iconst.i8 12+; check: v7 = iconst.i8 20+; check: v8 = select v0, v6, v7 ; v6 = 12, v7 = 20+; check: return v8diff --git a/cranelift/filetests/filetests/runtests/arithmetic.clif b/cranelift/filetests/filetests/runtests/arithmetic.clifindex d449f2ae61..327613818a 100644--- a/cranelift/filetests/filetests/runtests/arithmetic.clif+++ b/cranelift/filetests/filetests/runtests/arithmetic.clif@@ -10,6 +10,17 @@ target pulley32betarget pulley64target pulley64be+set opt_level=speed+target aarch64+target s390x+target x86_64+target riscv64 has_m+target riscv64 has_c has_zcb+target pulley32+target pulley32be+target pulley64+target pulley64be+function %add_i64(i64, i64) -> i64 {block0(v0: i64,v1: i64):v2 = iadd v0, v1@@ -1119,3 +1130,463 @@ block0(v0: i32):; run: %imul_umax_ineg_rt(-1) == 1; run: %imul_umax_ineg_rt(0x7fffffff) == 1; run: %imul_umax_ineg_rt(0x80000000) == 0++function %sub_mask_i32(i32) -> i32 {+block0(v0: i32):+ v1 = iconst.i32 15+ v2 = band v0, v1+ v3 = isub v0, v2+ return v3+}+; run: %sub_mask_i32(0) == 0+; run: %sub_mask_i32(1) == 0+; run: %sub_mask_i32(15) == 0+; run: %sub_mask_i32(16) == 16+; run: %sub_mask_i32(31) == 16+; run: %sub_mask_i32(-1) == -16+; run: %sub_mask_i32(2147483647) == 2147483632+; run: %sub_mask_i32(-2147483648) == -2147483648++function %sub_mask_i64(i64) -> i64 {+block0(v0: i64):+ v1 = iconst.i64 15+ v2 = band v0, v1+ v3 = isub v0, v2+ return v3+}+; run: %sub_mask_i64(0) == 0+; run: %sub_mask_i64(1) == 0+; run: %sub_mask_i64(15) == 0+; run: %sub_mask_i64(16) == 16+; run: %sub_mask_i64(31) == 16+; run: %sub_mask_i64(-1) == -16+; run: %sub_mask_i64(9223372036854775807) == 9223372036854775792+; run: %sub_mask_i64(-9223372036854775808) == -9223372036854775808++function %sub_offsets_i32(i32, i32) -> i32 {+block0(v0: i32, v1: i32):+ v2 = iconst.i32 5+ v3 = iconst.i32 7+ v4 = iadd v0, v2+ v5 = iadd v1, v3+ v6 = isub v4, v5+ return v6+}+; run: %sub_offsets_i32(0, 0) == -2+; run: %sub_offsets_i32(10, 3) == 5+; run: %sub_offsets_i32(-1, 2) == -5+; run: %sub_offsets_i32(-2147483648, 0) == 2147483646+; run: %sub_offsets_i32(2147483647, -1) == 2147483646+; run: %sub_offsets_i32(2147483647, -2147483648) == -3++function %sub_offsets_i64(i64, i64) -> i64 {+block0(v0: i64, v1: i64):+ v2 = iconst.i64 5+ v3 = iconst.i64 7+ v4 = iadd v0, v2+ v5 = iadd v1, v3+ v6 = isub v4, v5+ return v6+}+; run: %sub_offsets_i64(0, 0) == -2+; run: %sub_offsets_i64(10, 3) == 5+; run: %sub_offsets_i64(-1, 2) == -5+; run: %sub_offsets_i64(-9223372036854775808, 0) == 9223372036854775806+; run: %sub_offsets_i64(9223372036854775807, -1) == 9223372036854775806+; run: %sub_offsets_i64(9223372036854775807, -9223372036854775808) == -3++function %add_sub_offsets_i32(i32, i32) -> i32 {+block0(v0: i32, v1: i32):+ v2 = iconst.i32 5+ v3 = iconst.i32 7+ v4 = iadd v0, v2+ v5 = isub v3, v1+ v6 = iadd v4, v5+ return v6+}+; run: %add_sub_offsets_i32(0, 0) == 12+; run: %add_sub_offsets_i32(10, 3) == 19+; run: %add_sub_offsets_i32(-1, 2) == 9+; run: %add_sub_offsets_i32(-2147483648, 0) == -2147483636+; run: %add_sub_offsets_i32(2147483647, -1) == -2147483636+; run: %add_sub_offsets_i32(2147483647, -2147483648) == 11++function %add_sub_offsets_i64(i64, i64) -> i64 {+block0(v0: i64, v1: i64):+ v2 = iconst.i64 5+ v3 = iconst.i64 7+ v4 = iadd v0, v2+ v5 = isub v3, v1+ v6 = iadd v4, v5+ return v6+}+; run: %add_sub_offsets_i64(0, 0) == 12+; run: %add_sub_offsets_i64(10, 3) == 19+; run: %add_sub_offsets_i64(-1, 2) == 9+; run: %add_sub_offsets_i64(-9223372036854775808, 0) == -9223372036854775796+; run: %add_sub_offsets_i64(9223372036854775807, -1) == -9223372036854775796+; run: %add_sub_offsets_i64(9223372036854775807, -9223372036854775808) == 11++function %add_sub_mask_i32(i32, i32) -> i32 {+block0(v0: i32, v1: i32):+ v2 = iconst.i32 15+ v3 = band v1, v2+ v4 = isub v0, v3+ v5 = iadd v4, v1+ return v5+}+; run: %add_sub_mask_i32(0, 0) == 0+; run: %add_sub_mask_i32(0, 31) == 16+; run: %add_sub_mask_i32(1, 31) == 17+; run: %add_sub_mask_i32(-1, -1) == -17+; run: %add_sub_mask_i32(2147483647, 16) == -2147483633+; run: %add_sub_mask_i32(-2147483648, -1) == 2147483632++function %add_sub_mask_i64(i64, i64) -> i64 {+block0(v0: i64, v1: i64):+ v2 = iconst.i64 15+ v3 = band v1, v2+ v4 = isub v0, v3+ v5 = iadd v4, v1+ return v5+}+; run: %add_sub_mask_i64(0, 0) == 0+; run: %add_sub_mask_i64(0, 31) == 16+; run: %add_sub_mask_i64(1, 31) == 17+; run: %add_sub_mask_i64(-1, -1) == -17+; run: %add_sub_mask_i64(9223372036854775807, 16) == -9223372036854775793+; run: %add_sub_mask_i64(-9223372036854775808, -1) == 9223372036854775792++function %mul_shift_plus_one_i32(i32, i32) -> i32 {+block0(v0: i32, v1: i32):+ v2 = iconst.i32 1+ v3 = ishl v2, v0+ v4 = iadd v3, v2+ v5 = imul v4, v1+ return v5+}+; run: %mul_shift_plus_one_i32(0, 3) == 6+; run: %mul_shift_plus_one_i32(1, 3) == 9+; run: %mul_shift_plus_one_i32(31, 1) == -2147483647+; run: %mul_shift_plus_one_i32(31, 2) == 2+; run: %mul_shift_plus_one_i32(32, 3) == 6+; run: %mul_shift_plus_one_i32(33, -7) == -21+; run: %mul_shift_plus_one_i32(-1, -1) == 2147483647+; run: %mul_shift_plus_one_i32(1, 2147483647) == 2147483645++function %mul_shift_plus_one_i64(i64, i64) -> i64 {+block0(v0: i64, v1: i64):+ v2 = iconst.i64 1+ v3 = ishl v2, v0+ v4 = iadd v3, v2+ v5 = imul v4, v1+ return v5+}+; run: %mul_shift_plus_one_i64(0, 3) == 6+; run: %mul_shift_plus_one_i64(1, 3) == 9+; run: %mul_shift_plus_one_i64(63, 1) == -9223372036854775807+; run: %mul_shift_plus_one_i64(63, 2) == 2+; run: %mul_shift_plus_one_i64(64, 3) == 6+; run: %mul_shift_plus_one_i64(65, -7) == -21+; run: %mul_shift_plus_one_i64(-1, -1) == 9223372036854775807+; run: %mul_shift_plus_one_i64(1, 9223372036854775807) == 9223372036854775805++function %sub_offsets_wrap_i8(i8, i8) -> i8 {+block0(v0: i8, v1: i8):+ v2 = iconst.i8 100+ v3 = iconst.i8 -100+ v4 = iadd v0, v2+ v5 = iadd v1, v3+ v6 = isub v4, v5+ return v6+}+; run: %sub_offsets_wrap_i8(0, 0) == -56+; run: %sub_offsets_wrap_i8(10, 3) == -49+; run: %sub_offsets_wrap_i8(-1, 2) == -59+; run: %sub_offsets_wrap_i8(-128, 0) == 72+; run: %sub_offsets_wrap_i8(127, -1) == 72+; run: %sub_offsets_wrap_i8(127, -128) == -57++function %add_sub_offsets_wrap_i8(i8, i8) -> i8 {+block0(v0: i8, v1: i8):+ v2 = iconst.i8 100+ v3 = iconst.i8 100+ v4 = iadd v0, v2+ v5 = isub v3, v1+ v6 = iadd v4, v5+ return v6+}+; run: %add_sub_offsets_wrap_i8(0, 0) == -56+; run: %add_sub_offsets_wrap_i8(10, 3) == -49+; run: %add_sub_offsets_wrap_i8(-1, 2) == -59+; run: %add_sub_offsets_wrap_i8(-128, 0) == 72+; run: %add_sub_offsets_wrap_i8(127, -1) == 72+; run: %add_sub_offsets_wrap_i8(127, -128) == -57++function %sub_mask_noncontiguous_i8(i8) -> i8 {+block0(v0: i8):+ v1 = iconst.i8 0xaa+ v2 = band v0, v1+ v3 = isub v0, v2+ return v3+}+; run: %sub_mask_noncontiguous_i8(0) == 0+; run: %sub_mask_noncontiguous_i8(1) == 1+; run: %sub_mask_noncontiguous_i8(15) == 5+; run: %sub_mask_noncontiguous_i8(16) == 16+; run: %sub_mask_noncontiguous_i8(31) == 21+; run: %sub_mask_noncontiguous_i8(-1) == 85+; run: %sub_mask_noncontiguous_i8(127) == 85+; run: %sub_mask_noncontiguous_i8(-128) == 0++function %add_sub_offsets_commuted_i32(i32, i32) -> i32 {+block0(v0: i32, v1: i32):+ v2 = iconst.i32 5+ v3 = iconst.i32 7+ v4 = iadd v0, v2+ v5 = isub v3, v1+ v6 = iadd v5, v4+ return v6+}+; run: %add_sub_offsets_commuted_i32(0, 0) == 12+; run: %add_sub_offsets_commuted_i32(10, 3) == 19+; run: %add_sub_offsets_commuted_i32(-1, 2) == 9+; run: %add_sub_offsets_commuted_i32(-2147483648, 0) == -2147483636+; run: %add_sub_offsets_commuted_i32(2147483647, -1) == -2147483636+; run: %add_sub_offsets_commuted_i32(2147483647, -2147483648) == 11++function %add_sub_offsets_commuted_i64(i64, i64) -> i64 {+block0(v0: i64, v1: i64):+ v2 = iconst.i64 5+ v3 = iconst.i64 7+ v4 = iadd v0, v2+ v5 = isub v3, v1+ v6 = iadd v5, v4+ return v6+}+; run: %add_sub_offsets_commuted_i64(0, 0) == 12+; run: %add_sub_offsets_commuted_i64(10, 3) == 19+; run: %add_sub_offsets_commuted_i64(-1, 2) == 9+; run: %add_sub_offsets_commuted_i64(-9223372036854775808, 0) == -9223372036854775796+; run: %add_sub_offsets_commuted_i64(9223372036854775807, -1) == -9223372036854775796+; run: %add_sub_offsets_commuted_i64(9223372036854775807, -9223372036854775808) == 11++function %add_sub_mask_commuted_i32(i32, i32) -> i32 {+block0(v0: i32, v1: i32):+ v2 = iconst.i32 15+ v3 = band v1, v2+ v4 = isub v0, v3+ v5 = iadd v1, v4+ return v5+}+; run: %add_sub_mask_commuted_i32(0, 0) == 0+; run: %add_sub_mask_commuted_i32(0, 31) == 16+; run: %add_sub_mask_commuted_i32(1, 31) == 17+; run: %add_sub_mask_commuted_i32(-1, -1) == -17+; run: %add_sub_mask_commuted_i32(2147483647, 16) == -2147483633+; run: %add_sub_mask_commuted_i32(-2147483648, -1) == 2147483632++function %add_sub_mask_commuted_i64(i64, i64) -> i64 {+block0(v0: i64, v1: i64):+ v2 = iconst.i64 15+ v3 = band v1, v2+ v4 = isub v0, v3+ v5 = iadd v1, v4+ return v5+}+; run: %add_sub_mask_commuted_i64(0, 0) == 0+; run: %add_sub_mask_commuted_i64(0, 31) == 16+; run: %add_sub_mask_commuted_i64(1, 31) == 17+; run: %add_sub_mask_commuted_i64(-1, -1) == -17+; run: %add_sub_mask_commuted_i64(9223372036854775807, 16) == -9223372036854775793+; run: %add_sub_mask_commuted_i64(-9223372036854775808, -1) == 9223372036854775792++function %mul_shift_plus_one_commuted_i32(i32, i32) -> i32 {+block0(v0: i32, v1: i32):+ v2 = iconst.i32 1+ v3 = ishl v2, v0+ v4 = iadd v3, v2+ v5 = imul v1, v4+ return v5+}+; run: %mul_shift_plus_one_commuted_i32(0, 3) == 6+; run: %mul_shift_plus_one_commuted_i32(1, 3) == 9+; run: %mul_shift_plus_one_commuted_i32(31, 1) == -2147483647+; run: %mul_shift_plus_one_commuted_i32(31, 2) == 2+; run: %mul_shift_plus_one_commuted_i32(32, 3) == 6+; run: %mul_shift_plus_one_commuted_i32(33, -7) == -21+; run: %mul_shift_plus_one_commuted_i32(-1, -1) == 2147483647+; run: %mul_shift_plus_one_commuted_i32(1, 2147483647) == 2147483645++function %mul_shift_plus_one_commuted_i64(i64, i64) -> i64 {+block0(v0: i64, v1: i64):+ v2 = iconst.i64 1+ v3 = ishl v2, v0+ v4 = iadd v3, v2+ v5 = imul v1, v4+ return v5+}+; run: %mul_shift_plus_one_commuted_i64(0, 3) == 6+; run: %mul_shift_plus_one_commuted_i64(1, 3) == 9+; run: %mul_shift_plus_one_commuted_i64(63, 1) == -9223372036854775807+; run: %mul_shift_plus_one_commuted_i64(63, 2) == 2+; run: %mul_shift_plus_one_commuted_i64(64, 3) == 6+; run: %mul_shift_plus_one_commuted_i64(65, -7) == -21+; run: %mul_shift_plus_one_commuted_i64(-1, -1) == 9223372036854775807+; run: %mul_shift_plus_one_commuted_i64(1, 9223372036854775807) == 9223372036854775805++function %sub_constant_offsets_i32(i32, i32) -> i32 {+block0(v0: i32, v1: i32):+ v2 = iconst.i32 5+ v3 = iconst.i32 7+ v4 = isub v2, v0+ v5 = isub v3, v1+ v6 = isub v4, v5+ return v6+}+; run: %sub_constant_offsets_i32(0, 0) == -2+; run: %sub_constant_offsets_i32(10, 3) == -9+; run: %sub_constant_offsets_i32(-1, 2) == 1+; run: %sub_constant_offsets_i32(-2147483648, 0) == 2147483646+; run: %sub_constant_offsets_i32(2147483647, -1) == 2147483646+; run: %sub_constant_offsets_i32(2147483647, -2147483648) == -1++function %sub_constant_offsets_i64(i64, i64) -> i64 {+block0(v0: i64, v1: i64):+ v2 = iconst.i64 5+ v3 = iconst.i64 7+ v4 = isub v2, v0+ v5 = isub v3, v1+ v6 = isub v4, v5+ return v6+}+; run: %sub_constant_offsets_i64(0, 0) == -2+; run: %sub_constant_offsets_i64(10, 3) == -9+; run: %sub_constant_offsets_i64(-1, 2) == 1+; run: %sub_constant_offsets_i64(-9223372036854775808, 0) == 9223372036854775806+; run: %sub_constant_offsets_i64(9223372036854775807, -1) == 9223372036854775806+; run: %sub_constant_offsets_i64(9223372036854775807, -9223372036854775808) == -1++function %sub_sub_offsets_i32(i32, i32) -> i32 {+block0(v0: i32, v1: i32):+ v2 = iconst.i32 5+ v3 = iconst.i32 7+ v4 = isub v0, v2+ v5 = isub v1, v3+ v6 = isub v4, v5+ return v6+}+; run: %sub_sub_offsets_i32(0, 0) == 2+; run: %sub_sub_offsets_i32(10, 3) == 9+; run: %sub_sub_offsets_i32(-1, 2) == -1+; run: %sub_sub_offsets_i32(-2147483648, 0) == -2147483646+; run: %sub_sub_offsets_i32(2147483647, -1) == -2147483646+; run: %sub_sub_offsets_i32(2147483647, -2147483648) == 1++function %sub_sub_offsets_i64(i64, i64) -> i64 {+block0(v0: i64, v1: i64):+ v2 = iconst.i64 5+ v3 = iconst.i64 7+ v4 = isub v0, v2+ v5 = isub v1, v3+ v6 = isub v4, v5+ return v6+}+; run: %sub_sub_offsets_i64(0, 0) == 2+; run: %sub_sub_offsets_i64(10, 3) == 9+; run: %sub_sub_offsets_i64(-1, 2) == -1+; run: %sub_sub_offsets_i64(-9223372036854775808, 0) == -9223372036854775806+; run: %sub_sub_offsets_i64(9223372036854775807, -1) == -9223372036854775806+; run: %sub_sub_offsets_i64(9223372036854775807, -9223372036854775808) == 1++function %add_sub_left_mask_i32(i32, i32) -> i32 {+block0(v0: i32, v1: i32):+ v2 = iconst.i32 15+ v3 = band v0, v2+ v4 = iadd v0, v1+ v5 = isub v4, v3+ return v5+}+; run: %add_sub_left_mask_i32(0, 0) == 0+; run: %add_sub_left_mask_i32(0, 31) == 31+; run: %add_sub_left_mask_i32(1, 31) == 31+; run: %add_sub_left_mask_i32(-1, -1) == -17+; run: %add_sub_left_mask_i32(2147483647, 16) == -2147483648+; run: %add_sub_left_mask_i32(-2147483648, -1) == 2147483647++function %add_sub_left_mask_i64(i64, i64) -> i64 {+block0(v0: i64, v1: i64):+ v2 = iconst.i64 15+ v3 = band v0, v2+ v4 = iadd v0, v1+ v5 = isub v4, v3+ return v5+}+; run: %add_sub_left_mask_i64(0, 0) == 0+; run: %add_sub_left_mask_i64(0, 31) == 31+; run: %add_sub_left_mask_i64(1, 31) == 31+; run: %add_sub_left_mask_i64(-1, -1) == -17+; run: %add_sub_left_mask_i64(9223372036854775807, 16) == -9223372036854775808+; run: %add_sub_left_mask_i64(-9223372036854775808, -1) == 9223372036854775807++function %add_sub_right_mask_i32(i32, i32) -> i32 {+block0(v0: i32, v1: i32):+ v2 = iconst.i32 15+ v3 = band v1, v2+ v4 = iadd v0, v1+ v5 = isub v4, v3+ return v5+}+; run: %add_sub_right_mask_i32(0, 0) == 0+; run: %add_sub_right_mask_i32(0, 31) == 16+; run: %add_sub_right_mask_i32(1, 31) == 17+; run: %add_sub_right_mask_i32(-1, -1) == -17+; run: %add_sub_right_mask_i32(2147483647, 16) == -2147483633+; run: %add_sub_right_mask_i32(-2147483648, -1) == 2147483632++function %add_sub_right_mask_i64(i64, i64) -> i64 {+block0(v0: i64, v1: i64):+ v2 = iconst.i64 15+ v3 = band v1, v2+ v4 = iadd v0, v1+ v5 = isub v4, v3+ return v5+}+; run: %add_sub_right_mask_i64(0, 0) == 0+; run: %add_sub_right_mask_i64(0, 31) == 16+; run: %add_sub_right_mask_i64(1, 31) == 17+; run: %add_sub_right_mask_i64(-1, -1) == -17+; run: %add_sub_right_mask_i64(9223372036854775807, 16) == -9223372036854775793+; run: %add_sub_right_mask_i64(-9223372036854775808, -1) == 9223372036854775792++function %sub_constant_offsets_wrap_i8(i8, i8) -> i8 {+block0(v0: i8, v1: i8):+ v2 = iconst.i8 100+ v3 = iconst.i8 -100+ v4 = isub v2, v0+ v5 = isub v3, v1+ v6 = isub v4, v5+ return v6+}+; run: %sub_constant_offsets_wrap_i8(0, 0) == -56+; run: %sub_constant_offsets_wrap_i8(10, 3) == -63+; run: %sub_constant_offsets_wrap_i8(-1, 2) == -53+; run: %sub_constant_offsets_wrap_i8(-128, 0) == 72+; run: %sub_constant_offsets_wrap_i8(127, -1) == 72+; run: %sub_constant_offsets_wrap_i8(127, -128) == -55++function %sub_sub_offsets_wrap_i8(i8, i8) -> i8 {+block0(v0: i8, v1: i8):+ v2 = iconst.i8 100+ v3 = iconst.i8 -100+ v4 = isub v0, v2+ v5 = isub v1, v3+ v6 = isub v4, v5+ return v6+}+; run: %sub_sub_offsets_wrap_i8(0, 0) == 56+; run: %sub_sub_offsets_wrap_i8(10, 3) == 63+; run: %sub_sub_offsets_wrap_i8(-1, 2) == 53+; run: %sub_sub_offsets_wrap_i8(-128, 0) == -72+; run: %sub_sub_offsets_wrap_i8(127, -1) == -72+; run: %sub_sub_offsets_wrap_i8(127, -128) == 55diff --git a/cranelift/filetests/filetests/runtests/extend.clif b/cranelift/filetests/filetests/runtests/extend.clifindex 6a3474a333..58533a4838 100644--- a/cranelift/filetests/filetests/runtests/extend.clif+++ b/cranelift/filetests/filetests/runtests/extend.clif@@ -325,3 +325,71 @@ block0(v0: i8, v1: i16):; run: %ult_uextend_different_input_types(255, 256) == 1; run: %ult_uextend_different_input_types(255, 254) == 0; run: %ult_uextend_different_input_types(128, 32768) == 1++function %eq_uextends_i32(i8, i8) -> i8 {+block0(v0: i8, v1: i8):+ v2 = uextend.i32 v0+ v3 = uextend.i32 v1+ v4 = icmp eq v2, v3+ return v4+}+; run: %eq_uextends_i32(0, 0) == 1+; run: %eq_uextends_i32(0, 1) == 0+; run: %eq_uextends_i32(-1, -1) == 1+; run: %eq_uextends_i32(-1, 127) == 0+; run: %eq_uextends_i32(-128, -128) == 1+; run: %eq_uextends_i32(-128, 0) == 0++function %eq_uextends_i64(i8, i8) -> i8 {+block0(v0: i8, v1: i8):+ v2 = uextend.i64 v0+ v3 = uextend.i64 v1+ v4 = icmp eq v2, v3+ return v4+}+; run: %eq_uextends_i64(0, 0) == 1+; run: %eq_uextends_i64(0, 1) == 0+; run: %eq_uextends_i64(-1, -1) == 1+; run: %eq_uextends_i64(-1, 127) == 0+; run: %eq_uextends_i64(-128, -128) == 1+; run: %eq_uextends_i64(-128, 0) == 0++function %eq_uextend_zero_i32(i8) -> i8 {+block0(v0: i8):+ v1 = uextend.i32 v0+ v2 = iconst.i32 0+ v3 = icmp eq v1, v2+ return v3+}+; run: %eq_uextend_zero_i32(0) == 1+; run: %eq_uextend_zero_i32(1) == 0+; run: %eq_uextend_zero_i32(-1) == 0+; run: %eq_uextend_zero_i32(-128) == 0+; run: %eq_uextend_zero_i32(127) == 0++function %eq_uextend_zero_i64(i8) -> i8 {+block0(v0: i8):+ v1 = uextend.i64 v0+ v2 = iconst.i64 0+ v3 = icmp eq v1, v2+ return v3+}+; run: %eq_uextend_zero_i64(0) == 1+; run: %eq_uextend_zero_i64(1) == 0+; run: %eq_uextend_zero_i64(-1) == 0+; run: %eq_uextend_zero_i64(-128) == 0+; run: %eq_uextend_zero_i64(127) == 0++function %eq_uextends_mixed_widths(i8, i16) -> i8 {+block0(v0: i8, v1: i16):+ v2 = uextend.i64 v0+ v3 = uextend.i64 v1+ v4 = icmp eq v2, v3+ return v4+}+; run: %eq_uextends_mixed_widths(0, 0) == 1+; run: %eq_uextends_mixed_widths(0, 256) == 0+; run: %eq_uextends_mixed_widths(-1, 255) == 1+; run: %eq_uextends_mixed_widths(-1, 511) == 0+; run: %eq_uextends_mixed_widths(-128, 128) == 1+; run: %eq_uextends_mixed_widths(-128, 0) == 0diff --git a/cranelift/filetests/filetests/runtests/icmp.clif b/cranelift/filetests/filetests/runtests/icmp.clifindex e658aaa50e..4418cfe186 100644--- a/cranelift/filetests/filetests/runtests/icmp.clif+++ b/cranelift/filetests/filetests/runtests/icmp.clif@@ -380,3 +380,83 @@ block0(v0: i32, v1: i32):; run: %signed_bounds_variable_limit(-1, -1) == 0; run: %signed_bounds_variable_limit(0, 1) == 1; run: %signed_bounds_variable_limit(100, 100) == 0++function %xor_eq_one_i32(i32, i32) -> i8 {+block0(v0: i32, v1: i32):+ v2 = icmp eq v0, v1+ v3 = iconst.i8 1+ v4 = bxor v2, v3+ return v4+}+; run: %xor_eq_one_i32(0, 0) == 0+; run: %xor_eq_one_i32(0, 1) == 1+; run: %xor_eq_one_i32(-1, -1) == 0+; run: %xor_eq_one_i32(-1, 2147483647) == 1+; run: %xor_eq_one_i32(-2147483648, -2147483648) == 0+; run: %xor_eq_one_i32(-2147483648, 0) == 1++function %xor_eq_one_i64(i64, i64) -> i8 {+block0(v0: i64, v1: i64):+ v2 = icmp eq v0, v1+ v3 = iconst.i8 1+ v4 = bxor v2, v3+ return v4+}+; run: %xor_eq_one_i64(0, 0) == 0+; run: %xor_eq_one_i64(0, 1) == 1+; run: %xor_eq_one_i64(-1, -1) == 0+; run: %xor_eq_one_i64(-1, 9223372036854775807) == 1+; run: %xor_eq_one_i64(-9223372036854775808, -9223372036854775808) == 0+; run: %xor_eq_one_i64(-9223372036854775808, 0) == 1++function %ugt_sub_one_i32(i32) -> i8 {+block0(v0: i32):+ v1 = iconst.i32 1+ v2 = isub v0, v1+ v3 = icmp ugt v0, v2+ return v3+}+; run: %ugt_sub_one_i32(0) == 0+; run: %ugt_sub_one_i32(1) == 1+; run: %ugt_sub_one_i32(-1) == 1+; run: %ugt_sub_one_i32(-2147483648) == 1+; run: %ugt_sub_one_i32(2147483647) == 1++function %ugt_sub_one_i64(i64) -> i8 {+block0(v0: i64):+ v1 = iconst.i64 1+ v2 = isub v0, v1+ v3 = icmp ugt v0, v2+ return v3+}+; run: %ugt_sub_one_i64(0) == 0+; run: %ugt_sub_one_i64(1) == 1+; run: %ugt_sub_one_i64(-1) == 1+; run: %ugt_sub_one_i64(-9223372036854775808) == 1+; run: %ugt_sub_one_i64(9223372036854775807) == 1++function %ult_sub_one_i32(i32) -> i8 {+block0(v0: i32):+ v1 = iconst.i32 1+ v2 = isub v0, v1+ v3 = icmp ult v2, v0+ return v3+}+; run: %ult_sub_one_i32(0) == 0+; run: %ult_sub_one_i32(1) == 1+; run: %ult_sub_one_i32(-1) == 1+; run: %ult_sub_one_i32(-2147483648) == 1+; run: %ult_sub_one_i32(2147483647) == 1++function %ult_sub_one_i64(i64) -> i8 {+block0(v0: i64):+ v1 = iconst.i64 1+ v2 = isub v0, v1+ v3 = icmp ult v2, v0+ return v3+}+; run: %ult_sub_one_i64(0) == 0+; run: %ult_sub_one_i64(1) == 1+; run: %ult_sub_one_i64(-1) == 1+; run: %ult_sub_one_i64(-9223372036854775808) == 1+; run: %ult_sub_one_i64(9223372036854775807) == 1diff --git a/cranelift/filetests/filetests/runtests/select.clif b/cranelift/filetests/filetests/runtests/select.clifindex be35248ed5..75a17ddceb 100644--- a/cranelift/filetests/filetests/runtests/select.clif+++ b/cranelift/filetests/filetests/runtests/select.clif@@ -11,6 +11,18 @@ target pulley32betarget pulley64target pulley64be+set opt_level=speed+target aarch64+target s390x+target x86_64+target riscv64+target riscv64 has_zicond+target riscv64 has_c has_zcb+target pulley32+target pulley32be+target pulley64+target pulley64be+function %select_eq_f32(f32, f32) -> i32 {block0(v0: f32, v1: f32):v2 = fcmp eq v0, v1@@ -632,3 +644,263 @@ block0(v0: i32, v1: i32):; run: %select_ne_isub_zero(7, 7) == 0; run: %select_ne_isub_zero(7, 3) == 4; run: %select_ne_isub_zero(3, 7) == -4++function %select_zero_add_i32(i32, i32) -> i32 {+block0(v0: i32, v1: i32):+ v2 = iconst.i32 0+ v3 = icmp eq v0, v2+ v4 = iadd v0, v1+ v5 = select v3, v1, v4+ return v5+}+; run: %select_zero_add_i32(0, 0) == 0+; run: %select_zero_add_i32(0, -1) == -1+; run: %select_zero_add_i32(1, 2) == 3+; run: %select_zero_add_i32(-1, 1) == 0+; run: %select_zero_add_i32(2147483647, 1) == -2147483648+; run: %select_zero_add_i32(-2147483648, -1) == 2147483647++function %select_zero_add_i64(i64, i64) -> i64 {+block0(v0: i64, v1: i64):+ v2 = iconst.i64 0+ v3 = icmp eq v0, v2+ v4 = iadd v0, v1+ v5 = select v3, v1, v4+ return v5+}+; run: %select_zero_add_i64(0, 0) == 0+; run: %select_zero_add_i64(0, -1) == -1+; run: %select_zero_add_i64(1, 2) == 3+; run: %select_zero_add_i64(-1, 1) == 0+; run: %select_zero_add_i64(9223372036854775807, 1) == -9223372036854775808+; run: %select_zero_add_i64(-9223372036854775808, -1) == 9223372036854775807++function %add_same_condition_selects_i32(i8, i32, i32, i32, i32) -> i32 {+block0(v0: i8, v1: i32, v2: i32, v3: i32, v4: i32):+ v5 = select v0, v1, v2+ v6 = select v0, v3, v4+ v7 = iadd v5, v6+ return v7+}+; run: %add_same_condition_selects_i32(0, 11, 13, 17, 19) == 32+; run: %add_same_condition_selects_i32(1, 11, 13, 17, 19) == 28+; run: %add_same_condition_selects_i32(2, 11, 13, 17, 19) == 28+; run: %add_same_condition_selects_i32(-1, 11, 13, 17, 19) == 28+; run: %add_same_condition_selects_i32(1, 2147483647, 0, 1, 0) == -2147483648+; run: %add_same_condition_selects_i32(0, 0, -2147483648, 0, -1) == 2147483647++function %add_same_condition_selects_i64(i8, i64, i64, i64, i64) -> i64 {+block0(v0: i8, v1: i64, v2: i64, v3: i64, v4: i64):+ v5 = select v0, v1, v2+ v6 = select v0, v3, v4+ v7 = iadd v5, v6+ return v7+}+; run: %add_same_condition_selects_i64(0, 11, 13, 17, 19) == 32+; run: %add_same_condition_selects_i64(1, 11, 13, 17, 19) == 28+; run: %add_same_condition_selects_i64(2, 11, 13, 17, 19) == 28+; run: %add_same_condition_selects_i64(-1, 11, 13, 17, 19) == 28+; run: %add_same_condition_selects_i64(1, 9223372036854775807, 0, 1, 0) == -9223372036854775808+; run: %add_same_condition_selects_i64(0, 0, -9223372036854775808, 0, -1) == 9223372036854775807++function %select_constant_mask_i32(i8) -> i32 {+block0(v0: i8):+ v1 = iconst.i32 11+ v2 = iconst.i32 13+ v3 = iconst.i32 7+ v4 = select v0, v1, v2+ v5 = band v4, v3+ return v5+}+; run: %select_constant_mask_i32(0) == 5+; run: %select_constant_mask_i32(1) == 3+; run: %select_constant_mask_i32(2) == 3+; run: %select_constant_mask_i32(-1) == 3++function %select_constant_mask_i64(i8) -> i64 {+block0(v0: i8):+ v1 = iconst.i64 11+ v2 = iconst.i64 13+ v3 = iconst.i64 7+ v4 = select v0, v1, v2+ v5 = band v4, v3+ return v5+}+; run: %select_constant_mask_i64(0) == 5+; run: %select_constant_mask_i64(1) == 3+; run: %select_constant_mask_i64(2) == 3+; run: %select_constant_mask_i64(-1) == 3++function %select_zero_add_commuted_i32(i32, i32) -> i32 {+block0(v0: i32, v1: i32):+ v2 = iconst.i32 0+ v3 = icmp eq v0, v2+ v4 = iadd v1, v0+ v5 = select v3, v1, v4+ return v5+}+; run: %select_zero_add_commuted_i32(0, 0) == 0+; run: %select_zero_add_commuted_i32(0, -1) == -1+; run: %select_zero_add_commuted_i32(1, 2) == 3+; run: %select_zero_add_commuted_i32(-1, 1) == 0+; run: %select_zero_add_commuted_i32(2147483647, 1) == -2147483648+; run: %select_zero_add_commuted_i32(-2147483648, -1) == 2147483647++function %select_zero_add_commuted_i64(i64, i64) -> i64 {+block0(v0: i64, v1: i64):+ v2 = iconst.i64 0+ v3 = icmp eq v0, v2+ v4 = iadd v1, v0+ v5 = select v3, v1, v4+ return v5+}+; run: %select_zero_add_commuted_i64(0, 0) == 0+; run: %select_zero_add_commuted_i64(0, -1) == -1+; run: %select_zero_add_commuted_i64(1, 2) == 3+; run: %select_zero_add_commuted_i64(-1, 1) == 0+; run: %select_zero_add_commuted_i64(9223372036854775807, 1) == -9223372036854775808+; run: %select_zero_add_commuted_i64(-9223372036854775808, -1) == 9223372036854775807++function %select_nonzero_add_i32(i32, i32) -> i32 {+block0(v0: i32, v1: i32):+ v2 = iconst.i32 0+ v3 = icmp ne v0, v2+ v4 = iadd v0, v1+ v5 = select v3, v4, v1+ return v5+}+; run: %select_nonzero_add_i32(0, 0) == 0+; run: %select_nonzero_add_i32(0, -1) == -1+; run: %select_nonzero_add_i32(1, 2) == 3+; run: %select_nonzero_add_i32(-1, 1) == 0+; run: %select_nonzero_add_i32(2147483647, 1) == -2147483648+; run: %select_nonzero_add_i32(-2147483648, -1) == 2147483647++function %select_nonzero_add_i64(i64, i64) -> i64 {+block0(v0: i64, v1: i64):+ v2 = iconst.i64 0+ v3 = icmp ne v0, v2+ v4 = iadd v0, v1+ v5 = select v3, v4, v1+ return v5+}+; run: %select_nonzero_add_i64(0, 0) == 0+; run: %select_nonzero_add_i64(0, -1) == -1+; run: %select_nonzero_add_i64(1, 2) == 3+; run: %select_nonzero_add_i64(-1, 1) == 0+; run: %select_nonzero_add_i64(9223372036854775807, 1) == -9223372036854775808+; run: %select_nonzero_add_i64(-9223372036854775808, -1) == 9223372036854775807++function %select_nonzero_add_commuted_i32(i32, i32) -> i32 {+block0(v0: i32, v1: i32):+ v2 = iconst.i32 0+ v3 = icmp ne v0, v2+ v4 = iadd v1, v0+ v5 = select v3, v4, v1+ return v5+}+; run: %select_nonzero_add_commuted_i32(0, 0) == 0+; run: %select_nonzero_add_commuted_i32(0, -1) == -1+; run: %select_nonzero_add_commuted_i32(1, 2) == 3+; run: %select_nonzero_add_commuted_i32(-1, 1) == 0+; run: %select_nonzero_add_commuted_i32(2147483647, 1) == -2147483648+; run: %select_nonzero_add_commuted_i32(-2147483648, -1) == 2147483647++function %select_nonzero_add_commuted_i64(i64, i64) -> i64 {+block0(v0: i64, v1: i64):+ v2 = iconst.i64 0+ v3 = icmp ne v0, v2+ v4 = iadd v1, v0+ v5 = select v3, v4, v1+ return v5+}+; run: %select_nonzero_add_commuted_i64(0, 0) == 0+; run: %select_nonzero_add_commuted_i64(0, -1) == -1+; run: %select_nonzero_add_commuted_i64(1, 2) == 3+; run: %select_nonzero_add_commuted_i64(-1, 1) == 0+; run: %select_nonzero_add_commuted_i64(9223372036854775807, 1) == -9223372036854775808+; run: %select_nonzero_add_commuted_i64(-9223372036854775808, -1) == 9223372036854775807++function %select_constant_mask_commuted_i32(i8) -> i32 {+block0(v0: i8):+ v1 = iconst.i32 11+ v2 = iconst.i32 13+ v3 = iconst.i32 7+ v4 = select v0, v1, v2+ v5 = band v3, v4+ return v5+}+; run: %select_constant_mask_commuted_i32(0) == 5+; run: %select_constant_mask_commuted_i32(1) == 3+; run: %select_constant_mask_commuted_i32(2) == 3+; run: %select_constant_mask_commuted_i32(-1) == 3++function %select_constant_mask_commuted_i64(i8) -> i64 {+block0(v0: i8):+ v1 = iconst.i64 11+ v2 = iconst.i64 13+ v3 = iconst.i64 7+ v4 = select v0, v1, v2+ v5 = band v3, v4+ return v5+}+; run: %select_constant_mask_commuted_i64(0) == 5+; run: %select_constant_mask_commuted_i64(1) == 3+; run: %select_constant_mask_commuted_i64(2) == 3+; run: %select_constant_mask_commuted_i64(-1) == 3++function %select_constant_mask_preserved_branch_i32(i8) -> i32 {+block0(v0: i8):+ v1 = iconst.i32 27+ v2 = iconst.i32 13+ v3 = iconst.i32 15+ v4 = select v0, v1, v2+ v5 = band v4, v3+ return v5+}+; run: %select_constant_mask_preserved_branch_i32(0) == 13+; run: %select_constant_mask_preserved_branch_i32(1) == 11+; run: %select_constant_mask_preserved_branch_i32(2) == 11+; run: %select_constant_mask_preserved_branch_i32(-1) == 11++function %select_constant_mask_preserved_branch_i64(i8) -> i64 {+block0(v0: i8):+ v1 = iconst.i64 27+ v2 = iconst.i64 13+ v3 = iconst.i64 15+ v4 = select v0, v1, v2+ v5 = band v4, v3+ return v5+}+; run: %select_constant_mask_preserved_branch_i64(0) == 13+; run: %select_constant_mask_preserved_branch_i64(1) == 11+; run: %select_constant_mask_preserved_branch_i64(2) == 11+; run: %select_constant_mask_preserved_branch_i64(-1) == 11++function %select_constant_mask_changed_branch_i32(i8) -> i32 {+block0(v0: i8):+ v1 = iconst.i32 27+ v2 = iconst.i32 13+ v3 = iconst.i32 7+ v4 = select v0, v1, v2+ v5 = band v4, v3+ return v5+}+; run: %select_constant_mask_changed_branch_i32(0) == 5+; run: %select_constant_mask_changed_branch_i32(1) == 3+; run: %select_constant_mask_changed_branch_i32(2) == 3+; run: %select_constant_mask_changed_branch_i32(-1) == 3++function %select_constant_mask_changed_branch_i64(i8) -> i64 {+block0(v0: i8):+ v1 = iconst.i64 27+ v2 = iconst.i64 13+ v3 = iconst.i64 7+ v4 = select v0, v1, v2+ v5 = band v4, v3+ return v5+}+; run: %select_constant_mask_changed_branch_i64(0) == 5+; run: %select_constant_mask_changed_branch_i64(1) == 3+; run: %select_constant_mask_changed_branch_i64(2) == 3+; run: %select_constant_mask_changed_branch_i64(-1) == 3diff --git a/cranelift/filetests/filetests/runtests/shifts.clif b/cranelift/filetests/filetests/runtests/shifts.clifindex 1981dbddd7..d96ed909d9 100644--- a/cranelift/filetests/filetests/runtests/shifts.clif+++ b/cranelift/filetests/filetests/runtests/shifts.clif@@ -1260,3 +1260,45 @@ block0(v0: i64, v1: i32):; run: %ishl_masked_count_i64_i32_mask31(3, 64) == 0x3; run: %ishl_masked_count_i64_i32_mask31(-1, 65) == 0xfffffffffffffffe; run: %ishl_masked_count_i64_i32_mask31(-128, 4294967295) == 0xffffffc000000000++function %select_constant_shift_i32(i8) -> i32 {+block0(v0: i8):+ v1 = iconst.i32 3+ v2 = iconst.i32 5+ v3 = iconst.i32 2+ v4 = select v0, v1, v2+ v5 = ishl v4, v3+ return v5+}+; run: %select_constant_shift_i32(0) == 20+; run: %select_constant_shift_i32(1) == 12+; run: %select_constant_shift_i32(2) == 12+; run: %select_constant_shift_i32(-1) == 12++function %select_constant_shift_i64(i8) -> i64 {+block0(v0: i8):+ v1 = iconst.i64 3+ v2 = iconst.i64 5+ v3 = iconst.i64 2+ v4 = select v0, v1, v2+ v5 = ishl v4, v3+ return v5+}+; run: %select_constant_shift_i64(0) == 20+; run: %select_constant_shift_i64(1) == 12+; run: %select_constant_shift_i64(2) == 12+; run: %select_constant_shift_i64(-1) == 12++function %select_constant_shift_masked_i8(i8) -> i8 {+block0(v0: i8):+ v1 = iconst.i8 3+ v2 = iconst.i8 5+ v3 = iconst.i8 10+ v4 = select v0, v1, v2+ v5 = ishl v4, v3+ return v5+}+; run: %select_constant_shift_masked_i8(0) == 20+; run: %select_constant_shift_masked_i8(1) == 12+; run: %select_constant_shift_masked_i8(2) == 12+; run: %select_constant_shift_masked_i8(-1) == 12diff --git a/tests/disas/array-fill-anyref.wat b/tests/disas/array-fill-anyref.watindex f600b9b90a..b6983ba192 100644--- a/tests/disas/array-fill-anyref.wat+++ b/tests/disas/array-fill-anyref.wat@@ -55,18 +55,18 @@;; @0030 v37 = iadd v8, v36;; @0030 v39 = icmp ugt v38, v37;; @0030 trapnz v39, user2-;; v47 = iconst.i64 0-;; @0030 v42 = icmp eq v15, v47 ; v47 = 0+;; v54 = iconst.i32 0+;; v55 = icmp eq v5, v54 ; v54 = 0;; @0030 v27 = iconst.i64 4;; @0030 v40 = iadd v29, v52-;; @0030 brif v42, block3, block2(v29)+;; @0030 brif v55, block3, block2(v29);;;; block2(v43: i64):;; @0030 store.i32 user2 little region5 v4, v43-;; v54 = iconst.i64 4-;; v55 = iadd v43, v54 ; v54 = 4-;; @0030 v46 = icmp eq v55, v40-;; @0030 brif v46, block3, block2(v55)+;; v57 = iconst.i64 4+;; v58 = iadd v43, v57 ; v57 = 4+;; @0030 v46 = icmp eq v58, v40+;; @0030 brif v46, block3, block2(v58);;;; block3:;; @0033 jump block1@@ -113,20 +113,19 @@;; @003e v37 = iadd v8, v36;; @003e v39 = icmp ugt v38, v37;; @003e trapnz v39, user2-;; v47 = iconst.i64 0-;; @003e v42 = icmp eq v15, v47 ; v47 = 0;; @003a v5 = iconst.i32 0+;; v54 = icmp eq v4, v5 ; v5 = 0;; @003e v27 = iconst.i64 4;; @003e v40 = iadd v29, v52-;; @003e brif v42, block3, block2(v29)+;; @003e brif v54, block3, block2(v29);;;; block2(v43: i64):-;; v54 = iconst.i32 0-;; @003e store user2 little region5 v54, v43 ; v54 = 0-;; v55 = iconst.i64 4-;; v56 = iadd v43, v55 ; v55 = 4-;; @003e v46 = icmp eq v56, v40-;; @003e brif v46, block3, block2(v56)+;; v56 = iconst.i32 0+;; @003e store user2 little region5 v56, v43 ; v56 = 0+;; v57 = iconst.i64 4+;; v58 = iadd v43, v57 ; v57 = 4+;; @003e v46 = icmp eq v58, v40+;; @003e brif v46, block3, block2(v58);;;; block3:;; @0041 jump block1@@ -173,20 +172,20 @@;; @004e v41 = iadd v12, v40;; @004e v43 = icmp ugt v42, v41;; @004e trapnz v43, user2-;; v57 = iconst.i64 0-;; @004e v46 = icmp eq v19, v57 ; v57 = 0+;; v64 = iconst.i32 0+;; v65 = icmp eq v4, v64 ; v64 = 0;; @0048 v5 = iconst.i32 -1;; @004e v31 = iconst.i64 4;; @004e v44 = iadd v33, v62-;; @004e brif v46, block3, block2(v33)+;; @004e brif v65, block3, block2(v33);;;; block2(v47: i64):-;; v64 = iconst.i32 -1-;; @004e store user2 little region5 v64, v47 ; v64 = -1-;; v65 = iconst.i64 4-;; v66 = iadd v47, v65 ; v65 = 4-;; @004e v50 = icmp eq v66, v44-;; @004e brif v50, block3, block2(v66)+;; v67 = iconst.i32 -1+;; @004e store user2 little region5 v67, v47 ; v67 = -1+;; v68 = iconst.i64 4+;; v69 = iadd v47, v68 ; v68 = 4+;; @004e v50 = icmp eq v69, v44+;; @004e brif v50, block3, block2(v69);;;; block3:;; @0051 jump block1diff --git a/tests/disas/array-fill-externref.wat b/tests/disas/array-fill-externref.watindex bdcc60d398..f3b54a55c1 100644--- a/tests/disas/array-fill-externref.wat+++ b/tests/disas/array-fill-externref.wat@@ -51,18 +51,18 @@;; @002f v37 = iadd v8, v36;; @002f v39 = icmp ugt v38, v37;; @002f trapnz v39, user2-;; v47 = iconst.i64 0-;; @002f v42 = icmp eq v15, v47 ; v47 = 0+;; v54 = iconst.i32 0+;; v55 = icmp eq v5, v54 ; v54 = 0;; @002f v27 = iconst.i64 4;; @002f v40 = iadd v29, v52-;; @002f brif v42, block3, block2(v29)+;; @002f brif v55, block3, block2(v29);;;; block2(v43: i64):;; @002f store.i32 user2 little region5 v4, v43-;; v54 = iconst.i64 4-;; v55 = iadd v43, v54 ; v54 = 4-;; @002f v46 = icmp eq v55, v40-;; @002f brif v46, block3, block2(v55)+;; v57 = iconst.i64 4+;; v58 = iadd v43, v57 ; v57 = 4+;; @002f v46 = icmp eq v58, v40+;; @002f brif v46, block3, block2(v58);;;; block3:;; @0032 jump block1@@ -109,20 +109,19 @@;; @003d v37 = iadd v8, v36;; @003d v39 = icmp ugt v38, v37;; @003d trapnz v39, user2-;; v47 = iconst.i64 0-;; @003d v42 = icmp eq v15, v47 ; v47 = 0;; @0039 v5 = iconst.i32 0+;; v54 = icmp eq v4, v5 ; v5 = 0;; @003d v27 = iconst.i64 4;; @003d v40 = iadd v29, v52-;; @003d brif v42, block3, block2(v29)+;; @003d brif v54, block3, block2(v29);;;; block2(v43: i64):-;; v54 = iconst.i32 0-;; @003d store user2 little region5 v54, v43 ; v54 = 0-;; v55 = iconst.i64 4-;; v56 = iadd v43, v55 ; v55 = 4-;; @003d v46 = icmp eq v56, v40-;; @003d brif v46, block3, block2(v56)+;; v56 = iconst.i32 0+;; @003d store user2 little region5 v56, v43 ; v56 = 0+;; v57 = iconst.i64 4+;; v58 = iadd v43, v57 ; v57 = 4+;; @003d v46 = icmp eq v58, v40+;; @003d brif v46, block3, block2(v58);;;; block3:;; @0040 jump block1diff --git a/tests/disas/array-fill-f32.wat b/tests/disas/array-fill-f32.watindex cbdaa1951f..50992967ee 100644--- a/tests/disas/array-fill-f32.wat+++ b/tests/disas/array-fill-f32.wat@@ -55,18 +55,18 @@;; @0030 v37 = iadd v8, v36;; @0030 v39 = icmp ugt v38, v37;; @0030 trapnz v39, user2-;; v47 = iconst.i64 0-;; @0030 v42 = icmp eq v15, v47 ; v47 = 0+;; v54 = iconst.i32 0+;; v55 = icmp eq v5, v54 ; v54 = 0;; @0030 v27 = iconst.i64 4;; @0030 v40 = iadd v29, v52-;; @0030 brif v42, block3, block2(v29)+;; @0030 brif v55, block3, block2(v29);;;; block2(v43: i64):;; @0030 store.f32 user2 little region5 v4, v43-;; v54 = iconst.i64 4-;; v55 = iadd v43, v54 ; v54 = 4-;; @0030 v46 = icmp eq v55, v40-;; @0030 brif v46, block3, block2(v55)+;; v57 = iconst.i64 4+;; v58 = iadd v43, v57 ; v57 = 4+;; @0030 v46 = icmp eq v58, v40+;; @0030 brif v46, block3, block2(v58);;;; block3:;; @0033 jump block1@@ -160,20 +160,20 @@;; @0052 v37 = iadd v8, v36;; @0052 v39 = icmp ugt v38, v37;; @0052 trapnz v39, user2-;; v47 = iconst.i64 0-;; @0052 v42 = icmp eq v15, v47 ; v47 = 0+;; v54 = iconst.i32 0+;; v55 = icmp eq v4, v54 ; v54 = 0;; @004b v5 = f32const 0x1.000000p0;; @0052 v27 = iconst.i64 4;; @0052 v40 = iadd v29, v52-;; @0052 brif v42, block3, block2(v29)+;; @0052 brif v55, block3, block2(v29);;;; block2(v43: i64):-;; v54 = f32const 0x1.000000p0-;; @0052 store user2 little region5 v54, v43 ; v54 = 0x1.000000p0-;; v55 = iconst.i64 4-;; v56 = iadd v43, v55 ; v55 = 4-;; @0052 v46 = icmp eq v56, v40-;; @0052 brif v46, block3, block2(v56)+;; v57 = f32const 0x1.000000p0+;; @0052 store user2 little region5 v57, v43 ; v57 = 0x1.000000p0+;; v58 = iconst.i64 4+;; v59 = iadd v43, v58 ; v58 = 4+;; @0052 v46 = icmp eq v59, v40+;; @0052 brif v46, block3, block2(v59);;;; block3:;; @0055 jump block1diff --git a/tests/disas/array-fill-f64.wat b/tests/disas/array-fill-f64.watindex 7ce14d7c99..ecd568fd6d 100644--- a/tests/disas/array-fill-f64.wat+++ b/tests/disas/array-fill-f64.wat@@ -55,18 +55,18 @@;; @0030 v37 = iadd v8, v36;; @0030 v39 = icmp ugt v38, v37;; @0030 trapnz v39, user2-;; v47 = iconst.i64 0-;; @0030 v42 = icmp eq v15, v47 ; v47 = 0+;; v54 = iconst.i32 0+;; v55 = icmp eq v5, v54 ; v54 = 0;; @0030 v27 = iconst.i64 8;; @0030 v40 = iadd v29, v52-;; @0030 brif v42, block3, block2(v29)+;; @0030 brif v55, block3, block2(v29);;;; block2(v43: i64):;; @0030 store.f64 user2 little region5 v4, v43-;; v54 = iconst.i64 8-;; v55 = iadd v43, v54 ; v54 = 8-;; @0030 v46 = icmp eq v55, v40-;; @0030 brif v46, block3, block2(v55)+;; v57 = iconst.i64 8+;; v58 = iadd v43, v57 ; v57 = 8+;; @0030 v46 = icmp eq v58, v40+;; @0030 brif v46, block3, block2(v58);;;; block3:;; @0033 jump block1@@ -160,20 +160,20 @@;; @005a v37 = iadd v8, v36;; @005a v39 = icmp ugt v38, v37;; @005a trapnz v39, user2-;; v47 = iconst.i64 0-;; @005a v42 = icmp eq v15, v47 ; v47 = 0+;; v54 = iconst.i32 0+;; v55 = icmp eq v4, v54 ; v54 = 0;; @004f v5 = f64const 0x1.0000000000000p0;; @005a v27 = iconst.i64 8;; @005a v40 = iadd v29, v52-;; @005a brif v42, block3, block2(v29)+;; @005a brif v55, block3, block2(v29);;;; block2(v43: i64):-;; v54 = f64const 0x1.0000000000000p0-;; @005a store user2 little region5 v54, v43 ; v54 = 0x1.0000000000000p0-;; v55 = iconst.i64 8-;; v56 = iadd v43, v55 ; v55 = 8-;; @005a v46 = icmp eq v56, v40-;; @005a brif v46, block3, block2(v56)+;; v57 = f64const 0x1.0000000000000p0+;; @005a store user2 little region5 v57, v43 ; v57 = 0x1.0000000000000p0+;; v58 = iconst.i64 8+;; v59 = iadd v43, v58 ; v58 = 8+;; @005a v46 = icmp eq v59, v40+;; @005a brif v46, block3, block2(v59);;;; block3:;; @005d jump block1diff --git a/tests/disas/array-fill-funcref.wat b/tests/disas/array-fill-funcref.watindex afa37cde81..3112d15930 100644--- a/tests/disas/array-fill-funcref.wat+++ b/tests/disas/array-fill-funcref.wat@@ -61,19 +61,19 @@;; @003b v39 = icmp ugt v38, v37;; @003b trapnz v39, user2;; @003b v40 = call fn0(v0, v4)-;; v49 = iconst.i64 0-;; @003b v44 = icmp eq v15, v49 ; v49 = 0+;; v56 = iconst.i32 0+;; v57 = icmp eq v5, v56 ; v56 = 0;; @003b v41 = ireduce.i32 v40;; @003b v27 = iconst.i64 4;; @003b v42 = iadd v29, v54-;; @003b brif v44, block3, block2(v29)+;; @003b brif v57, block3, block2(v29);;;; block2(v45: i64):;; @003b store.i32 notrap aligned little region5 v41, v45-;; v56 = iconst.i64 4-;; v57 = iadd v45, v56 ; v56 = 4-;; @003b v48 = icmp eq v57, v42-;; @003b brif v48, block3, block2(v57)+;; v59 = iconst.i64 4+;; v60 = iadd v45, v59 ; v59 = 4+;; @003b v48 = icmp eq v60, v42+;; @003b brif v48, block3, block2(v60);;;; block3:;; @003e jump block1@@ -124,18 +124,19 @@;; @0049 trapnz v39, user2;; @0045 v5 = iconst.i64 0;; @0049 v40 = call fn0(v0, v5) ; v5 = 0-;; @0049 v44 = icmp eq v15, v5 ; v5 = 0+;; v55 = iconst.i32 0+;; v56 = icmp eq v4, v55 ; v55 = 0;; @0049 v41 = ireduce.i32 v40;; @0049 v27 = iconst.i64 4;; @0049 v42 = iadd v29, v53-;; @0049 brif v44, block3, block2(v29)+;; @0049 brif v56, block3, block2(v29);;;; block2(v45: i64):;; @0049 store.i32 notrap aligned little region5 v41, v45-;; v55 = iconst.i64 4-;; v56 = iadd v45, v55 ; v55 = 4-;; @0049 v48 = icmp eq v56, v42-;; @0049 brif v48, block3, block2(v56)+;; v58 = iconst.i64 4+;; v59 = iadd v45, v58 ; v58 = 4+;; @0049 v48 = icmp eq v59, v42+;; @0049 brif v48, block3, block2(v59);;;; block3:;; @004c jump block1@@ -194,19 +195,19 @@;; @0057 v40 = icmp ugt v39, v38;; @0057 trapnz v40, user2;; @0057 v41 = call fn1(v0, v6)-;; v57 = iconst.i64 0-;; @0057 v45 = icmp eq v16, v57 ; v57 = 0+;; v64 = iconst.i32 0+;; v65 = icmp eq v4, v64 ; v64 = 0;; @0057 v42 = ireduce.i32 v41;; @0057 v28 = iconst.i64 4;; @0057 v43 = iadd v30, v62-;; @0057 brif v45, block3, block2(v30)+;; @0057 brif v65, block3, block2(v30);;;; block2(v46: i64):;; @0057 store.i32 notrap aligned little region5 v42, v46-;; v64 = iconst.i64 4-;; v65 = iadd v46, v64 ; v64 = 4-;; @0057 v49 = icmp eq v65, v43-;; @0057 brif v49, block3, block2(v65)+;; v67 = iconst.i64 4+;; v68 = iadd v46, v67 ; v67 = 4+;; @0057 v49 = icmp eq v68, v43+;; @0057 brif v49, block3, block2(v68);;;; block3:;; @005a jump block1diff --git a/tests/disas/array-fill-i16.wat b/tests/disas/array-fill-i16.watindex 98840708b3..d8a7f4e6e4 100644--- a/tests/disas/array-fill-i16.wat+++ b/tests/disas/array-fill-i16.wat@@ -59,18 +59,18 @@;; @0031 v37 = iadd v8, v36;; @0031 v39 = icmp ugt v38, v37;; @0031 trapnz v39, user2-;; v47 = iconst.i64 0-;; @0031 v42 = icmp eq v15, v47 ; v47 = 0+;; v57 = iconst.i32 0+;; v58 = icmp eq v5, v57 ; v57 = 0;; @0031 v27 = iconst.i64 2;; @0031 v40 = iadd v29, v54-;; @0031 brif v42, block3, block2(v29)+;; @0031 brif v58, block3, block2(v29);;;; block2(v43: i64):;; @0031 istore16.i32 user2 little region5 v4, v43-;; v57 = iconst.i64 2-;; v58 = iadd v43, v57 ; v57 = 2-;; @0031 v46 = icmp eq v58, v40-;; @0031 brif v46, block3, block2(v58)+;; v60 = iconst.i64 2+;; v61 = iadd v43, v60 ; v60 = 2+;; @0031 v46 = icmp eq v61, v40+;; @0031 brif v46, block3, block2(v61);;;; block3:;; @0034 jump block1@@ -211,20 +211,20 @@;; @005d v37 = iadd v8, v36;; @005d v39 = icmp ugt v38, v37;; @005d trapnz v39, user2-;; v47 = iconst.i64 0-;; @005d v42 = icmp eq v15, v47 ; v47 = 0+;; v57 = iconst.i32 0+;; v58 = icmp eq v4, v57 ; v57 = 0;; @0057 v5 = iconst.i32 0xdead;; @005d v27 = iconst.i64 2;; @005d v40 = iadd v29, v54-;; @005d brif v42, block3, block2(v29)+;; @005d brif v58, block3, block2(v29);;;; block2(v43: i64):-;; v57 = iconst.i32 0xdead-;; @005d istore16 user2 little region5 v57, v43 ; v57 = 0xdead-;; v58 = iconst.i64 2-;; v59 = iadd v43, v58 ; v58 = 2-;; @005d v46 = icmp eq v59, v40-;; @005d brif v46, block3, block2(v59)+;; v60 = iconst.i32 0xdead+;; @005d istore16 user2 little region5 v60, v43 ; v60 = 0xdead+;; v61 = iconst.i64 2+;; v62 = iadd v43, v61 ; v61 = 2+;; @005d v46 = icmp eq v62, v40+;; @005d brif v46, block3, block2(v62);;;; block3:;; @0060 jump block1diff --git a/tests/disas/array-fill-i31ref.wat b/tests/disas/array-fill-i31ref.watindex 653f7b4eaf..e19e1dd400 100644--- a/tests/disas/array-fill-i31ref.wat+++ b/tests/disas/array-fill-i31ref.wat@@ -55,18 +55,18 @@;; @0030 v37 = iadd v8, v36;; @0030 v39 = icmp ugt v38, v37;; @0030 trapnz v39, user2-;; v47 = iconst.i64 0-;; @0030 v42 = icmp eq v15, v47 ; v47 = 0+;; v54 = iconst.i32 0+;; v55 = icmp eq v5, v54 ; v54 = 0;; @0030 v27 = iconst.i64 4;; @0030 v40 = iadd v29, v52-;; @0030 brif v42, block3, block2(v29)+;; @0030 brif v55, block3, block2(v29);;;; block2(v43: i64):;; @0030 store.i32 user2 little region5 v4, v43-;; v54 = iconst.i64 4-;; v55 = iadd v43, v54 ; v54 = 4-;; @0030 v46 = icmp eq v55, v40-;; @0030 brif v46, block3, block2(v55)+;; v57 = iconst.i64 4+;; v58 = iadd v43, v57 ; v57 = 4+;; @0030 v46 = icmp eq v58, v40+;; @0030 brif v46, block3, block2(v58);;;; block3:;; @0033 jump block1@@ -113,20 +113,19 @@;; @003e v37 = iadd v8, v36;; @003e v39 = icmp ugt v38, v37;; @003e trapnz v39, user2-;; v47 = iconst.i64 0-;; @003e v42 = icmp eq v15, v47 ; v47 = 0;; @003a v5 = iconst.i32 0+;; v54 = icmp eq v4, v5 ; v5 = 0;; @003e v27 = iconst.i64 4;; @003e v40 = iadd v29, v52-;; @003e brif v42, block3, block2(v29)+;; @003e brif v54, block3, block2(v29);;;; block2(v43: i64):-;; v54 = iconst.i32 0-;; @003e store user2 little region5 v54, v43 ; v54 = 0-;; v55 = iconst.i64 4-;; v56 = iadd v43, v55 ; v55 = 4-;; @003e v46 = icmp eq v56, v40-;; @003e brif v46, block3, block2(v56)+;; v56 = iconst.i32 0+;; @003e store user2 little region5 v56, v43 ; v56 = 0+;; v57 = iconst.i64 4+;; v58 = iadd v43, v57 ; v57 = 4+;; @003e v46 = icmp eq v58, v40+;; @003e brif v46, block3, block2(v58);;;; block3:;; @0041 jump block1@@ -173,20 +172,20 @@;; @004e v41 = iadd v12, v40;; @004e v43 = icmp ugt v42, v41;; @004e trapnz v43, user2-;; v57 = iconst.i64 0-;; @004e v46 = icmp eq v19, v57 ; v57 = 0+;; v64 = iconst.i32 0+;; v65 = icmp eq v4, v64 ; v64 = 0;; @0048 v5 = iconst.i32 -1;; @004e v31 = iconst.i64 4;; @004e v44 = iadd v33, v62-;; @004e brif v46, block3, block2(v33)+;; @004e brif v65, block3, block2(v33);;;; block2(v47: i64):-;; v64 = iconst.i32 -1-;; @004e store user2 little region5 v64, v47 ; v64 = -1-;; v65 = iconst.i64 4-;; v66 = iadd v47, v65 ; v65 = 4-;; @004e v50 = icmp eq v66, v44-;; @004e brif v50, block3, block2(v66)+;; v67 = iconst.i32 -1+;; @004e store user2 little region5 v67, v47 ; v67 = -1+;; v68 = iconst.i64 4+;; v69 = iadd v47, v68 ; v68 = 4+;; @004e v50 = icmp eq v69, v44+;; @004e brif v50, block3, block2(v69);;;; block3:;; @0051 jump block1diff --git a/tests/disas/array-fill-i32.wat b/tests/disas/array-fill-i32.watindex ff7b792be2..a04b8e798d 100644--- a/tests/disas/array-fill-i32.wat+++ b/tests/disas/array-fill-i32.wat@@ -59,18 +59,18 @@;; @0031 v37 = iadd v8, v36;; @0031 v39 = icmp ugt v38, v37;; @0031 trapnz v39, user2-;; v47 = iconst.i64 0-;; @0031 v42 = icmp eq v15, v47 ; v47 = 0+;; v54 = iconst.i32 0+;; v55 = icmp eq v5, v54 ; v54 = 0;; @0031 v27 = iconst.i64 4;; @0031 v40 = iadd v29, v52-;; @0031 brif v42, block3, block2(v29)+;; @0031 brif v55, block3, block2(v29);;;; block2(v43: i64):;; @0031 store.i32 user2 little region5 v4, v43-;; v54 = iconst.i64 4-;; v55 = iadd v43, v54 ; v54 = 4-;; @0031 v46 = icmp eq v55, v40-;; @0031 brif v46, block3, block2(v55)+;; v57 = iconst.i64 4+;; v58 = iadd v43, v57 ; v57 = 4+;; @0031 v46 = icmp eq v58, v40+;; @0031 brif v46, block3, block2(v58);;;; block3:;; @0034 jump block1@@ -211,20 +211,20 @@;; @005d v37 = iadd v8, v36;; @005d v39 = icmp ugt v38, v37;; @005d trapnz v39, user2-;; v47 = iconst.i64 0-;; @005d v42 = icmp eq v15, v47 ; v47 = 0+;; v54 = iconst.i32 0+;; v55 = icmp eq v4, v54 ; v54 = 0;; @0057 v5 = iconst.i32 0xdead;; @005d v27 = iconst.i64 4;; @005d v40 = iadd v29, v52-;; @005d brif v42, block3, block2(v29)+;; @005d brif v55, block3, block2(v29);;;; block2(v43: i64):-;; v54 = iconst.i32 0xdead-;; @005d store user2 little region5 v54, v43 ; v54 = 0xdead-;; v55 = iconst.i64 4-;; v56 = iadd v43, v55 ; v55 = 4-;; @005d v46 = icmp eq v56, v40-;; @005d brif v46, block3, block2(v56)+;; v57 = iconst.i32 0xdead+;; @005d store user2 little region5 v57, v43 ; v57 = 0xdead+;; v58 = iconst.i64 4+;; v59 = iadd v43, v58 ; v58 = 4+;; @005d v46 = icmp eq v59, v40+;; @005d brif v46, block3, block2(v59);;;; block3:;; @0060 jump block1diff --git a/tests/disas/array-fill-i64.wat b/tests/disas/array-fill-i64.watindex f7a62abec5..b065ee05d1 100644--- a/tests/disas/array-fill-i64.wat+++ b/tests/disas/array-fill-i64.wat@@ -59,18 +59,18 @@;; @0031 v37 = iadd v8, v36;; @0031 v39 = icmp ugt v38, v37;; @0031 trapnz v39, user2-;; v47 = iconst.i64 0-;; @0031 v42 = icmp eq v15, v47 ; v47 = 0+;; v54 = iconst.i32 0+;; v55 = icmp eq v5, v54 ; v54 = 0;; @0031 v27 = iconst.i64 8;; @0031 v40 = iadd v29, v52-;; @0031 brif v42, block3, block2(v29)+;; @0031 brif v55, block3, block2(v29);;;; block2(v43: i64):;; @0031 store.i64 user2 little region5 v4, v43-;; v54 = iconst.i64 8-;; v55 = iadd v43, v54 ; v54 = 8-;; @0031 v46 = icmp eq v55, v40-;; @0031 brif v46, block3, block2(v55)+;; v57 = iconst.i64 8+;; v58 = iadd v43, v57 ; v57 = 8+;; @0031 v46 = icmp eq v58, v40+;; @0031 brif v46, block3, block2(v58);;;; block3:;; @0034 jump block1@@ -211,20 +211,20 @@;; @005b v37 = iadd v8, v36;; @005b v39 = icmp ugt v38, v37;; @005b trapnz v39, user2-;; v47 = iconst.i64 0-;; @005b v42 = icmp eq v15, v47 ; v47 = 0+;; v54 = iconst.i32 0+;; v55 = icmp eq v4, v54 ; v54 = 0;; @0057 v5 = iconst.i64 1;; @005b v27 = iconst.i64 8;; @005b v40 = iadd v29, v52-;; @005b brif v42, block3, block2(v29)+;; @005b brif v55, block3, block2(v29);;;; block2(v43: i64):-;; v54 = iconst.i64 1-;; @005b store user2 little region5 v54, v43 ; v54 = 1-;; v55 = iconst.i64 8-;; v56 = iadd v43, v55 ; v55 = 8-;; @005b v46 = icmp eq v56, v40-;; @005b brif v46, block3, block2(v56)+;; v57 = iconst.i64 1+;; @005b store user2 little region5 v57, v43 ; v57 = 1+;; v58 = iconst.i64 8+;; v59 = iadd v43, v58 ; v58 = 8+;; @005b v46 = icmp eq v59, v40+;; @005b brif v46, block3, block2(v59);;;; block3:;; @005e jump block1diff --git a/tests/disas/gc/array-new-default-anyref.wat b/tests/disas/gc/array-new-default-anyref.watindex 2a611ada79..8ccb0964df 100644--- a/tests/disas/gc/array-new-default-anyref.wat+++ b/tests/disas/gc/array-new-default-anyref.wat@@ -63,16 +63,16 @@;; v108 = band v104, v107 ; v107 = -16;; v110 = iadd.i32 v12, v108;; @001f store notrap aligned region3 v110, v11-;; v126 = iconst.i32 -1476394994-;; v127 = load.i64 notrap aligned readonly can_move region0 v0+8-;; v128 = load.i64 notrap aligned readonly can_move region7 v127+32-;; @001f v36 = iadd v128, v19-;; @001f store user2 region8 v126, v36 ; v126 = -1476394994-;; v129 = load.i64 notrap aligned readonly can_move region5 v0+40-;; v130 = load.i32 notrap aligned readonly can_move region6 v129-;; @001f store user2 region9 v130, v36+4-;; v131 = band.i64 v17, v16 ; v16 = -16-;; @001f istore32 user2 region10 v131, v36+8+;; v128 = iconst.i32 -1476394994+;; v129 = load.i64 notrap aligned readonly can_move region0 v0+8+;; v130 = load.i64 notrap aligned readonly can_move region7 v129+32+;; @001f v36 = iadd v130, v19+;; @001f store user2 region8 v128, v36 ; v128 = -1476394994+;; v131 = load.i64 notrap aligned readonly can_move region5 v0+40+;; v132 = load.i32 notrap aligned readonly can_move region6 v131+;; @001f store user2 region9 v132, v36+4+;; v133 = band.i64 v17, v16 ; v16 = -16+;; @001f istore32 user2 region10 v133, v36+8;; @001f jump block4(v12, v36);;;; block3 cold:@@ -92,36 +92,35 @@;; @001f v43 = iadd v41, v42 ; v42 = 16;; @001f store.i32 user2 region11 v2, v43;; @001f trapz v40, user16-;; v132 = load.i64 notrap aligned readonly can_move region0 v0+8-;; v133 = load.i64 notrap aligned readonly can_move region7 v132+32+;; v134 = load.i64 notrap aligned readonly can_move region0 v0+8+;; v135 = load.i64 notrap aligned readonly can_move region7 v134+32;; @001f v46 = uextend.i64 v40-;; @001f v49 = iadd v133, v46+;; @001f v49 = iadd v135, v46;; @001f v51 = iadd v49, v42 ; v42 = 16;; @001f v52 = load.i32 user2 readonly region11 v51;; @001f v53 = uextend.i64 v52;; @001f v59 = icmp.i64 ugt v4, v53;; @001f trapnz v59, user17-;; @001f v76 = load.i64 notrap aligned region12 v132+40+;; @001f v76 = load.i64 notrap aligned region12 v134+40;; @001f v64 = iconst.i64 20;; @001f v65 = iadd v49, v64 ; v64 = 20;; @001f v78 = uadd_overflow_trap v65, v88, user2-;; @001f v77 = iadd v133, v76+;; @001f v77 = iadd v135, v76;; @001f v79 = icmp ugt v78, v77;; @001f trapnz v79, user2-;; v112 = iconst.i64 0-;; @001f v82 = icmp.i64 eq v4, v112 ; v112 = 0;; @001f v44 = iconst.i32 0+;; v126 = icmp.i32 eq v2, v44 ; v44 = 0;; @001f v5 = iconst.i64 4;; @001f v80 = iadd v65, v88-;; @001f brif v82, block6, block5(v65)+;; @001f brif v126, block6, block5(v65);;;; block5(v83: i64):-;; v134 = iconst.i32 0-;; @001f store user2 little region13 v134, v83 ; v134 = 0-;; v135 = iconst.i64 4-;; v136 = iadd v83, v135 ; v135 = 4-;; @001f v86 = icmp eq v136, v80-;; @001f brif v86, block6, block5(v136)+;; v136 = iconst.i32 0+;; @001f store user2 little region13 v136, v83 ; v136 = 0+;; v137 = iconst.i64 4+;; v138 = iadd v83, v137 ; v137 = 4+;; @001f v86 = icmp eq v138, v80+;; @001f brif v86, block6, block5(v138);;;; block6:;; @0022 jump block1diff --git a/tests/disas/gc/array-new-default-exnref.wat b/tests/disas/gc/array-new-default-exnref.watindex dc6af66f99..83422c30a2 100644--- a/tests/disas/gc/array-new-default-exnref.wat+++ b/tests/disas/gc/array-new-default-exnref.wat@@ -63,16 +63,16 @@;; v108 = band v104, v107 ; v107 = -16;; v110 = iadd.i32 v12, v108;; @001f store notrap aligned region3 v110, v11-;; v126 = iconst.i32 -1476394994-;; v127 = load.i64 notrap aligned readonly can_move region0 v0+8-;; v128 = load.i64 notrap aligned readonly can_move region7 v127+32-;; @001f v36 = iadd v128, v19-;; @001f store user2 region8 v126, v36 ; v126 = -1476394994-;; v129 = load.i64 notrap aligned readonly can_move region5 v0+40-;; v130 = load.i32 notrap aligned readonly can_move region6 v129-;; @001f store user2 region9 v130, v36+4-;; v131 = band.i64 v17, v16 ; v16 = -16-;; @001f istore32 user2 region10 v131, v36+8+;; v128 = iconst.i32 -1476394994+;; v129 = load.i64 notrap aligned readonly can_move region0 v0+8+;; v130 = load.i64 notrap aligned readonly can_move region7 v129+32+;; @001f v36 = iadd v130, v19+;; @001f store user2 region8 v128, v36 ; v128 = -1476394994+;; v131 = load.i64 notrap aligned readonly can_move region5 v0+40+;; v132 = load.i32 notrap aligned readonly can_move region6 v131+;; @001f store user2 region9 v132, v36+4+;; v133 = band.i64 v17, v16 ; v16 = -16+;; @001f istore32 user2 region10 v133, v36+8;; @001f jump block4(v12, v36);;;; block3 cold:@@ -92,36 +92,35 @@;; @001f v43 = iadd v41, v42 ; v42 = 16;; @001f store.i32 user2 region11 v2, v43;; @001f trapz v40, user16-;; v132 = load.i64 notrap aligned readonly can_move region0 v0+8-;; v133 = load.i64 notrap aligned readonly can_move region7 v132+32+;; v134 = load.i64 notrap aligned readonly can_move region0 v0+8+;; v135 = load.i64 notrap aligned readonly can_move region7 v134+32;; @001f v46 = uextend.i64 v40-;; @001f v49 = iadd v133, v46+;; @001f v49 = iadd v135, v46;; @001f v51 = iadd v49, v42 ; v42 = 16;; @001f v52 = load.i32 user2 readonly region11 v51;; @001f v53 = uextend.i64 v52;; @001f v59 = icmp.i64 ugt v4, v53;; @001f trapnz v59, user17-;; @001f v76 = load.i64 notrap aligned region12 v132+40+;; @001f v76 = load.i64 notrap aligned region12 v134+40;; @001f v64 = iconst.i64 20;; @001f v65 = iadd v49, v64 ; v64 = 20;; @001f v78 = uadd_overflow_trap v65, v88, user2-;; @001f v77 = iadd v133, v76+;; @001f v77 = iadd v135, v76;; @001f v79 = icmp ugt v78, v77;; @001f trapnz v79, user2-;; v112 = iconst.i64 0-;; @001f v82 = icmp.i64 eq v4, v112 ; v112 = 0;; @001f v44 = iconst.i32 0+;; v126 = icmp.i32 eq v2, v44 ; v44 = 0;; @001f v5 = iconst.i64 4;; @001f v80 = iadd v65, v88-;; @001f brif v82, block6, block5(v65)+;; @001f brif v126, block6, block5(v65);;;; block5(v83: i64):-;; v134 = iconst.i32 0-;; @001f store user2 little region13 v134, v83 ; v134 = 0-;; v135 = iconst.i64 4-;; v136 = iadd v83, v135 ; v135 = 4-;; @001f v86 = icmp eq v136, v80-;; @001f brif v86, block6, block5(v136)+;; v136 = iconst.i32 0+;; @001f store user2 little region13 v136, v83 ; v136 = 0+;; v137 = iconst.i64 4+;; v138 = iadd v83, v137 ; v137 = 4+;; @001f v86 = icmp eq v138, v80+;; @001f brif v86, block6, block5(v138);;;; block6:;; @0022 jump block1diff --git a/tests/disas/gc/array-new-default-externref.wat b/tests/disas/gc/array-new-default-externref.watindex fbf83a0c1f..12cedb5d33 100644--- a/tests/disas/gc/array-new-default-externref.wat+++ b/tests/disas/gc/array-new-default-externref.wat@@ -63,16 +63,16 @@;; v108 = band v104, v107 ; v107 = -16;; v110 = iadd.i32 v12, v108;; @001f store notrap aligned region3 v110, v11-;; v126 = iconst.i32 -1476394994-;; v127 = load.i64 notrap aligned readonly can_move region0 v0+8-;; v128 = load.i64 notrap aligned readonly can_move region7 v127+32-;; @001f v36 = iadd v128, v19-;; @001f store user2 region8 v126, v36 ; v126 = -1476394994-;; v129 = load.i64 notrap aligned readonly can_move region5 v0+40-;; v130 = load.i32 notrap aligned readonly can_move region6 v129-;; @001f store user2 region9 v130, v36+4-;; v131 = band.i64 v17, v16 ; v16 = -16-;; @001f istore32 user2 region10 v131, v36+8+;; v128 = iconst.i32 -1476394994+;; v129 = load.i64 notrap aligned readonly can_move region0 v0+8+;; v130 = load.i64 notrap aligned readonly can_move region7 v129+32+;; @001f v36 = iadd v130, v19+;; @001f store user2 region8 v128, v36 ; v128 = -1476394994+;; v131 = load.i64 notrap aligned readonly can_move region5 v0+40+;; v132 = load.i32 notrap aligned readonly can_move region6 v131+;; @001f store user2 region9 v132, v36+4+;; v133 = band.i64 v17, v16 ; v16 = -16+;; @001f istore32 user2 region10 v133, v36+8;; @001f jump block4(v12, v36);;;; block3 cold:@@ -92,36 +92,35 @@;; @001f v43 = iadd v41, v42 ; v42 = 16;; @001f store.i32 user2 region11 v2, v43;; @001f trapz v40, user16-;; v132 = load.i64 notrap aligned readonly can_move region0 v0+8-;; v133 = load.i64 notrap aligned readonly can_move region7 v132+32+;; v134 = load.i64 notrap aligned readonly can_move region0 v0+8+;; v135 = load.i64 notrap aligned readonly can_move region7 v134+32;; @001f v46 = uextend.i64 v40-;; @001f v49 = iadd v133, v46+;; @001f v49 = iadd v135, v46;; @001f v51 = iadd v49, v42 ; v42 = 16;; @001f v52 = load.i32 user2 readonly region11 v51;; @001f v53 = uextend.i64 v52;; @001f v59 = icmp.i64 ugt v4, v53;; @001f trapnz v59, user17-;; @001f v76 = load.i64 notrap aligned region12 v132+40+;; @001f v76 = load.i64 notrap aligned region12 v134+40;; @001f v64 = iconst.i64 20;; @001f v65 = iadd v49, v64 ; v64 = 20;; @001f v78 = uadd_overflow_trap v65, v88, user2-;; @001f v77 = iadd v133, v76+;; @001f v77 = iadd v135, v76;; @001f v79 = icmp ugt v78, v77;; @001f trapnz v79, user2-;; v112 = iconst.i64 0-;; @001f v82 = icmp.i64 eq v4, v112 ; v112 = 0;; @001f v44 = iconst.i32 0+;; v126 = icmp.i32 eq v2, v44 ; v44 = 0;; @001f v5 = iconst.i64 4;; @001f v80 = iadd v65, v88-;; @001f brif v82, block6, block5(v65)+;; @001f brif v126, block6, block5(v65);;;; block5(v83: i64):-;; v134 = iconst.i32 0-;; @001f store user2 little region13 v134, v83 ; v134 = 0-;; v135 = iconst.i64 4-;; v136 = iadd v83, v135 ; v135 = 4-;; @001f v86 = icmp eq v136, v80-;; @001f brif v86, block6, block5(v136)+;; v136 = iconst.i32 0+;; @001f store user2 little region13 v136, v83 ; v136 = 0+;; v137 = iconst.i64 4+;; v138 = iadd v83, v137 ; v137 = 4+;; @001f v86 = icmp eq v138, v80+;; @001f brif v86, block6, block5(v138);;;; block6:;; @0022 jump block1diff --git a/tests/disas/gc/array-new-default-funcref.wat b/tests/disas/gc/array-new-default-funcref.watindex c5af3a044f..a7e6db554d 100644--- a/tests/disas/gc/array-new-default-funcref.wat+++ b/tests/disas/gc/array-new-default-funcref.wat@@ -67,16 +67,16 @@;; v119 = band v115, v118 ; v118 = -16;; v121 = iadd.i32 v12, v119;; @001f store notrap aligned region3 v121, v11-;; v136 = iconst.i32 -1476395002-;; v137 = load.i64 notrap aligned readonly can_move region0 v0+8-;; v138 = load.i64 notrap aligned readonly can_move region7 v137+32-;; @001f v36 = iadd v138, v19-;; @001f store user2 region8 v136, v36 ; v136 = -1476395002-;; v139 = load.i64 notrap aligned readonly can_move region5 v0+40-;; v140 = load.i32 notrap aligned readonly can_move region6 v139-;; @001f store user2 region9 v140, v36+4-;; v141 = band.i64 v17, v16 ; v16 = -16-;; @001f istore32 user2 region10 v141, v36+8+;; v138 = iconst.i32 -1476395002+;; v139 = load.i64 notrap aligned readonly can_move region0 v0+8+;; v140 = load.i64 notrap aligned readonly can_move region7 v139+32+;; @001f v36 = iadd v140, v19+;; @001f store user2 region8 v138, v36 ; v138 = -1476395002+;; v141 = load.i64 notrap aligned readonly can_move region5 v0+40+;; v142 = load.i32 notrap aligned readonly can_move region6 v141+;; @001f store user2 region9 v142, v36+4+;; v143 = band.i64 v17, v16 ; v16 = -16+;; @001f istore32 user2 region10 v143, v36+8;; @001f jump block4(v12, v36);;;; block3 cold:@@ -98,36 +98,37 @@;; @001f v43 = iadd v41, v42 ; v42 = 16;; @001f store.i32 user2 region11 v2, v43;; @001f trapz v40, user16-;; v142 = load.i64 notrap aligned readonly can_move region0 v0+8-;; v143 = load.i64 notrap aligned readonly can_move region7 v142+32+;; v144 = load.i64 notrap aligned readonly can_move region0 v0+8+;; v145 = load.i64 notrap aligned readonly can_move region7 v144+32;; @001f v46 = uextend.i64 v40-;; @001f v49 = iadd v143, v46+;; @001f v49 = iadd v145, v46;; @001f v51 = iadd v49, v42 ; v42 = 16;; @001f v52 = load.i32 user2 readonly region11 v51;; @001f v53 = uextend.i64 v52;; @001f v59 = icmp.i64 ugt v4, v53;; @001f trapnz v59, user17-;; @001f v76 = load.i64 notrap aligned region12 v142+40+;; @001f v76 = load.i64 notrap aligned region12 v144+40;; @001f v64 = iconst.i64 20;; @001f v65 = iadd v49, v64 ; v64 = 20;; @001f v78 = uadd_overflow_trap v65, v99, user2-;; @001f v77 = iadd v143, v76+;; @001f v77 = iadd v145, v76;; @001f v79 = icmp ugt v78, v77;; @001f trapnz v79, user2;; @001f v44 = iconst.i64 0;; @001f v80 = call fn1(v0, v44), stack_map=[i32 @ ss0+0] ; v44 = 0-;; @001f v84 = icmp.i64 eq v4, v44 ; v44 = 0+;; @001f v45 = iconst.i32 0+;; v136 = icmp.i32 eq v2, v45 ; v45 = 0;; @001f v81 = ireduce.i32 v80;; @001f v5 = iconst.i64 4;; @001f v82 = iadd v65, v99-;; @001f brif v84, block6, block5(v65)+;; @001f brif v136, block6, block5(v65);;;; block5(v85: i64):;; @001f store.i32 notrap aligned little region13 v81, v85-;; v144 = iconst.i64 4-;; v145 = iadd v85, v144 ; v144 = 4-;; @001f v88 = icmp eq v145, v82-;; @001f brif v88, block6, block5(v145)+;; v146 = iconst.i64 4+;; v147 = iadd v85, v146 ; v146 = 4+;; @001f v88 = icmp eq v147, v82+;; @001f brif v88, block6, block5(v147);;;; block6:;; @0022 jump block1diff --git a/tests/disas/gc/copying/array-fill.wat b/tests/disas/gc/copying/array-fill.watindex 8445d5d24a..fc0900c69a 100644--- a/tests/disas/gc/copying/array-fill.wat+++ b/tests/disas/gc/copying/array-fill.wat@@ -46,18 +46,18 @@;; @0027 v37 = iadd v8, v36;; @0027 v39 = icmp ugt v38, v37;; @0027 trapnz v39, user2-;; v47 = iconst.i64 0-;; @0027 v42 = icmp eq v15, v47 ; v47 = 0+;; v54 = iconst.i32 0+;; v55 = icmp eq v5, v54 ; v54 = 0;; @0027 v27 = iconst.i64 8;; @0027 v40 = iadd v29, v52-;; @0027 brif v42, block3, block2(v29)+;; @0027 brif v55, block3, block2(v29);;;; block2(v43: i64):;; @0027 store.i64 user2 little region5 v4, v43-;; v54 = iconst.i64 8-;; v55 = iadd v43, v54 ; v54 = 8-;; @0027 v46 = icmp eq v55, v40-;; @0027 brif v46, block3, block2(v55)+;; v57 = iconst.i64 8+;; v58 = iadd v43, v57 ; v57 = 8+;; @0027 v46 = icmp eq v58, v40+;; @0027 brif v46, block3, block2(v58);;;; block3:;; @002a jump block1diff --git a/tests/disas/gc/copying/array-new.wat b/tests/disas/gc/copying/array-new.watindex afa85aa7f8..3e2c5e006a 100644--- a/tests/disas/gc/copying/array-new.wat+++ b/tests/disas/gc/copying/array-new.wat@@ -62,16 +62,16 @@;; v108 = band v104, v107 ; v107 = -16;; v110 = iadd.i32 v13, v108;; @0022 store notrap aligned region3 v110, v12-;; v126 = iconst.i32 -1476395002-;; v127 = load.i64 notrap aligned readonly can_move region0 v0+8-;; v128 = load.i64 notrap aligned readonly can_move region7 v127+32-;; @0022 v37 = iadd v128, v20-;; @0022 store user2 region8 v126, v37 ; v126 = -1476395002-;; v129 = load.i64 notrap aligned readonly can_move region5 v0+40-;; v130 = load.i32 notrap aligned readonly can_move region6 v129-;; @0022 store user2 region9 v130, v37+4-;; v131 = band.i64 v18, v17 ; v17 = -16-;; @0022 istore32 user2 region10 v131, v37+8+;; v128 = iconst.i32 -1476395002+;; v129 = load.i64 notrap aligned readonly can_move region0 v0+8+;; v130 = load.i64 notrap aligned readonly can_move region7 v129+32+;; @0022 v37 = iadd v130, v20+;; @0022 store user2 region8 v128, v37 ; v128 = -1476395002+;; v131 = load.i64 notrap aligned readonly can_move region5 v0+40+;; v132 = load.i32 notrap aligned readonly can_move region6 v131+;; @0022 store user2 region9 v132, v37+4+;; v133 = band.i64 v18, v17 ; v17 = -16+;; @0022 istore32 user2 region10 v133, v37+8;; @0022 jump block4(v13, v37);;;; block3 cold:@@ -91,34 +91,34 @@;; @0022 v44 = iadd v42, v43 ; v43 = 16;; @0022 store.i32 user2 region11 v3, v44;; @0022 trapz v41, user16-;; v132 = load.i64 notrap aligned readonly can_move region0 v0+8-;; v133 = load.i64 notrap aligned readonly can_move region7 v132+32+;; v134 = load.i64 notrap aligned readonly can_move region0 v0+8+;; v135 = load.i64 notrap aligned readonly can_move region7 v134+32;; @0022 v46 = uextend.i64 v41-;; @0022 v49 = iadd v133, v46+;; @0022 v49 = iadd v135, v46;; @0022 v51 = iadd v49, v43 ; v43 = 16;; @0022 v52 = load.i32 user2 readonly region11 v51;; @0022 v53 = uextend.i64 v52;; @0022 v59 = icmp.i64 ugt v5, v53;; @0022 trapnz v59, user17-;; @0022 v76 = load.i64 notrap aligned region12 v132+40+;; @0022 v76 = load.i64 notrap aligned region12 v134+40;; @0022 v64 = iconst.i64 24;; @0022 v65 = iadd v49, v64 ; v64 = 24;; @0022 v78 = uadd_overflow_trap v65, v88, user2-;; @0022 v77 = iadd v133, v76+;; @0022 v77 = iadd v135, v76;; @0022 v79 = icmp ugt v78, v77;; @0022 trapnz v79, user2-;; v112 = iconst.i64 0-;; @0022 v82 = icmp.i64 eq v5, v112 ; v112 = 0+;; @0022 v45 = iconst.i32 0+;; v126 = icmp.i32 eq v3, v45 ; v45 = 0;; @0022 v6 = iconst.i64 8;; @0022 v80 = iadd v65, v88-;; @0022 brif v82, block6, block5(v65)+;; @0022 brif v126, block6, block5(v65);;;; block5(v83: i64):;; @0022 store.i64 user2 little region13 v2, v83-;; v134 = iconst.i64 8-;; v135 = iadd v83, v134 ; v134 = 8-;; @0022 v86 = icmp eq v135, v80-;; @0022 brif v86, block6, block5(v135)+;; v136 = iconst.i64 8+;; v137 = iadd v83, v136 ; v136 = 8+;; @0022 v86 = icmp eq v137, v80+;; @0022 brif v86, block6, block5(v137);;;; block6:;; @0025 jump block1diff --git a/tests/disas/gc/drc/array-fill.wat b/tests/disas/gc/drc/array-fill.watindex 77c99ad8b4..c88c30bf35 100644--- a/tests/disas/gc/drc/array-fill.wat+++ b/tests/disas/gc/drc/array-fill.wat@@ -47,18 +47,18 @@;; @0027 v37 = iadd v8, v36;; @0027 v39 = icmp ugt v38, v37;; @0027 trapnz v39, user2-;; v47 = iconst.i64 0-;; @0027 v42 = icmp eq v15, v47 ; v47 = 0+;; v54 = iconst.i32 0+;; v55 = icmp eq v5, v54 ; v54 = 0;; @0027 v27 = iconst.i64 8;; @0027 v40 = iadd v29, v52-;; @0027 brif v42, block3, block2(v29)+;; @0027 brif v55, block3, block2(v29);;;; block2(v43: i64):;; @0027 store.i64 user2 little region5 v4, v43-;; v54 = iconst.i64 8-;; v55 = iadd v43, v54 ; v54 = 8-;; @0027 v46 = icmp eq v55, v40-;; @0027 brif v46, block3, block2(v55)+;; v57 = iconst.i64 8+;; v58 = iadd v43, v57 ; v57 = 8+;; @0027 v46 = icmp eq v58, v40+;; @0027 brif v46, block3, block2(v58);;;; block3:;; @002a jump block1diff --git a/tests/disas/gc/drc/array-new.wat b/tests/disas/gc/drc/array-new.watindex 0bc0685d4c..a28eaa88d2 100644--- a/tests/disas/gc/drc/array-new.wat+++ b/tests/disas/gc/drc/array-new.wat@@ -55,18 +55,18 @@;; @0022 v55 = iadd v18, v54;; @0022 v57 = icmp ugt v56, v55;; @0022 trapnz v57, user2-;; v76 = iconst.i64 0-;; @0022 v60 = icmp eq v5, v76 ; v76 = 0+;; @0022 v23 = iconst.i32 0+;; v91 = icmp eq v3, v23 ; v23 = 0;; @0022 v6 = iconst.i64 8;; @0022 v58 = iadd v43, v66-;; @0022 brif v60, block3, block2(v43)+;; @0022 brif v91, block3, block2(v43);;;; block2(v61: i64):;; @0022 store.i64 user2 little region7 v2, v61-;; v91 = iconst.i64 8-;; v92 = iadd v61, v91 ; v91 = 8-;; @0022 v64 = icmp eq v92, v58-;; @0022 brif v64, block3, block2(v92)+;; v93 = iconst.i64 8+;; v94 = iadd v61, v93 ; v93 = 8+;; @0022 v64 = icmp eq v94, v58+;; @0022 brif v64, block3, block2(v94);;;; block3:;; @0025 jump block1diff --git a/tests/disas/gc/null/array-fill.wat b/tests/disas/gc/null/array-fill.watindex 15e4617553..159d51ff5f 100644--- a/tests/disas/gc/null/array-fill.wat+++ b/tests/disas/gc/null/array-fill.wat@@ -47,17 +47,17 @@;; @0027 v37 = iadd v8, v36;; @0027 v39 = icmp ugt v38, v37;; @0027 trapnz v39, user2-;; v47 = iconst.i64 0-;; @0027 v42 = icmp eq v15, v47 ; v47 = 0+;; v54 = iconst.i32 0+;; v55 = icmp eq v5, v54 ; v54 = 0;; @0027 v40 = iadd v29, v52-;; @0027 brif v42, block3, block2(v29)+;; @0027 brif v55, block3, block2(v29);;;; block2(v43: i64):;; @0027 store.i64 user2 little region5 v4, v43-;; v54 = iconst.i64 8-;; v55 = iadd v43, v54 ; v54 = 8-;; @0027 v46 = icmp eq v55, v40-;; @0027 brif v46, block3, block2(v55)+;; v57 = iconst.i64 8+;; v58 = iadd v43, v57 ; v57 = 8+;; @0027 v46 = icmp eq v58, v40+;; @0027 brif v46, block3, block2(v58);;;; block3:;; @002a jump block1diff --git a/tests/disas/gc/null/array-new.wat b/tests/disas/gc/null/array-new.watindex 78ad05dce6..96219cda54 100644--- a/tests/disas/gc/null/array-new.wat+++ b/tests/disas/gc/null/array-new.wat@@ -60,9 +60,9 @@;; @0022 v33 = iconst.i32 -1476395008;; v99 = bor.i32 v11, v33 ; v33 = -1476395008;; @0022 v30 = load.i64 notrap aligned readonly can_move region5 v24+32-;; v116 = band.i32 v19, v98 ; v98 = -8-;; v117 = uextend.i64 v116-;; @0022 v32 = iadd v30, v117+;; v118 = band.i32 v19, v98 ; v98 = -8+;; v119 = uextend.i64 v118+;; @0022 v32 = iadd v30, v119;; @0022 store user2 region8 v99, v32;; @0022 v35 = load.i64 notrap aligned readonly can_move region6 v0+40;; @0022 v36 = load.i32 notrap aligned readonly can_move region7 v35@@ -71,7 +71,7 @@;; @0022 v6 = iconst.i64 8;; @0022 v38 = iadd v32, v6 ; v6 = 8;; @0022 store.i32 user2 region10 v3, v38-;; @0022 trapz v116, user16+;; @0022 trapz v118, user16;; @0022 v70 = load.i64 notrap aligned region4 v24+40;; @0022 v58 = iconst.i64 16;; @0022 v59 = iadd v32, v58 ; v58 = 16@@ -79,17 +79,17 @@;; @0022 v71 = iadd v30, v70;; @0022 v73 = icmp ugt v72, v71;; @0022 trapnz v73, user2-;; v101 = iconst.i64 0-;; @0022 v76 = icmp.i64 eq v5, v101 ; v101 = 0+;; @0022 v39 = iconst.i32 0+;; v116 = icmp.i32 eq v3, v39 ; v39 = 0;; @0022 v74 = iadd v59, v82-;; @0022 brif v76, block5, block4(v59)+;; @0022 brif v116, block5, block4(v59);;;; block4(v77: i64):;; @0022 store.i64 user2 little region11 v2, v77-;; v118 = iconst.i64 8-;; v119 = iadd v77, v118 ; v118 = 8-;; @0022 v80 = icmp eq v119, v74-;; @0022 brif v80, block5, block4(v119)+;; v120 = iconst.i64 8+;; v121 = iadd v77, v120 ; v120 = 8+;; @0022 v80 = icmp eq v121, v74+;; @0022 brif v80, block5, block4(v121);;;; block5:;; @0025 jump block1@@ -100,6 +100,6 @@;; @0022 jump block2;;;; block1:-;; v120 = band.i32 v19, v98 ; v98 = -8-;; @0025 return v120+;; v122 = band.i32 v19, v98 ; v98 = -8+;; @0025 return v122;; }