A lightweight WebAssembly runtime that is fast, secure, and standards-compliant
Revert "Cranelift: Reassociate long and narrow chains of operations into shallow and wide trees (#7466)" (#12116)
Nick Fitzgerald9a6aa39c94fd
diff --git a/cranelift/codegen/src/opts/arithmetic.isle b/cranelift/codegen/src/opts/arithmetic.isleindex 541bd8fbcd..81184532a5 100644--- a/cranelift/codegen/src/opts/arithmetic.isle+++ b/cranelift/codegen/src/opts/arithmetic.isle@@ -196,105 +196,6 @@(rule (simplify (fmul ty (fneg ty x) (fneg ty y)))(fmul ty x y))-;; (a op (b op (c op d))) ==> ((a op b) op (c op d))-;;-;; and-;;-;; (((a op b) op c) op d) ==> ((a op b) op (c op d))-;;-;; where `op` is an associative operation: `iadd`, `imul`, `band`, or `bxor`.-;;-;; This increases instruction-level parallelism and shrinks live ranges. It also-;; canonicalizes into the shallow-and-wide form for reassociating constants-;; together for cprop.-;;-;; NB: We subsume to avoid exponential e-node blow up due to reassociating very-;; large chains of operations.-;;-;; TODO: We should add `bor` rules for this as well. Unfortunately, they-;; conflict with our `bswap` recognizing rules when we `subsume`.--(rule (simplify (iadd ty a (iadd ty b (iadd ty c d))))- (subsume (iadd ty (iadd ty a b) (iadd ty c d))))-(rule (simplify (iadd ty (iadd ty (iadd ty a b) c) d))- (subsume (iadd ty (iadd ty a b) (iadd ty c d))))--(rule (simplify (imul ty a (imul ty b (imul ty c d))))- (subsume (imul ty (imul ty a b) (imul ty c d))))-(rule (simplify (imul ty (imul ty (imul ty a b) c) d))- (subsume (imul ty (imul ty a b) (imul ty c d))))--(rule (simplify (band ty a (band ty b (band ty c d))))- (subsume (band ty (band ty a b) (band ty c d))))-(rule (simplify (band ty (band ty (band ty a b) c) d))- (subsume (band ty (band ty a b) (band ty c d))))--(rule (simplify (bxor ty a (bxor ty b (bxor ty c d))))- (subsume (bxor ty (bxor ty a b) (bxor ty c d))))-(rule (simplify (bxor ty (bxor ty (bxor ty a b) c) d))- (subsume (bxor ty (bxor ty a b) (bxor ty c d))))---;; Similar rules but for associating combinations of + and ---;; a -(b-(c-d)) = (a-b) + (c-d)-(rule (simplify (isub ty a (isub ty b (isub ty c d))))- (subsume (iadd ty (isub ty a b) (isub ty c d))))--;; a -(b-(c+d)) = (a-b) + (c+d)-(rule (simplify (isub ty a (isub ty b (iadd ty c d))))- (subsume (iadd ty (isub ty a b) (iadd ty c d))))--;; a -(b+(c-d)) = (a-b) - (c-d)-(rule (simplify (isub ty a (iadd ty b (isub ty c d))))- (subsume (isub ty (isub ty a b) (isub ty c d))))--;; a -(b+(c+d)) = (a-b) - (c+d)-(rule (simplify (isub ty a (iadd ty b (iadd ty c d))))- (subsume (isub ty (isub ty a b) (iadd ty c d))))--;; a +(b-(c-d)) = (a+b) - (c-d)-(rule (simplify (iadd ty a (isub ty b (isub ty c d))))- (subsume (isub ty (iadd ty a b) (isub ty c d))))--;; a +(b-(c+d)) = (a+b) - (c+d)-(rule (simplify (iadd ty a (isub ty b (iadd ty c d))))- (subsume (isub ty (iadd ty a b) (iadd ty c d))))--;; a +(b+(c-d)) = (a+b) + (c-d)-(rule (simplify (iadd ty a (iadd ty b (isub ty c d))))- (subsume (iadd ty (iadd ty a b) (isub ty c d))))--;; and nested the other way--;; ((a-b)-c)-d = (a-b) - (c+d)-(rule (simplify (isub ty (isub ty (isub ty a b) c) d))- (subsume (isub ty (isub ty a b) (iadd ty c d))))--;; ((a-b)-c)+d = (a-b) - (c-d)-(rule (simplify (iadd ty (isub ty (isub ty a b) c) d))- (subsume (isub ty (isub ty a b) (isub ty c d))))--;; ((a-b)+c)-d = (a-b) + (c-d)-(rule (simplify (isub ty (iadd ty (isub ty a b) c) d))- (subsume (iadd ty (isub ty a b) (isub ty c d))))--;; ((a-b)+c)+d = (a-b) + (c+d)-(rule (simplify (iadd ty (iadd ty (isub ty a b) c) d))- (subsume (iadd ty (isub ty a b) (iadd ty c d))))--;; ((a+b)-c)-d = (a+b) - (c+d)-(rule (simplify (isub ty (isub ty (iadd ty a b) c) d))- (subsume (isub ty (iadd ty a b) (iadd ty c d))))--;; ((a+b)-c)+d = (a+b) - (c-d)-(rule (simplify (iadd ty (isub ty (iadd ty a b) c) d))- (subsume (isub ty (iadd ty a b) (isub ty c d))))--;; ((a+b)+c)-d = (a+b) + (c-d)-(rule (simplify (isub ty (iadd ty (iadd ty a b) c) d))- (subsume (iadd ty (iadd ty a b) (isub ty c d))))-;; Detect people open-coding `mulhi`: (x as big * y as big) >> bits;; LLVM doesn't have an intrinsic for it, so you'll see it in code like;; <https://github.com/rust-lang/rust/blob/767453eb7ca188e991ac5568c17b984dd4893e77/library/core/src/num/mod.rs#L174-L180>diff --git a/cranelift/filetests/filetests/egraph/associative-and-commutative.clif b/cranelift/filetests/filetests/egraph/associative-and-commutative.clifdeleted file mode 100644index dd1d8567f0..0000000000--- a/cranelift/filetests/filetests/egraph/associative-and-commutative.clif+++ /dev/null@@ -1,287 +0,0 @@-test optimize-set opt_level=speed-target x86_64--function %iadd_shallow_and_wide(i32, i32, i32, i32) -> i32 {-block0(v0: i32, v1: i32, v2: i32, v3: i32):- v4 = iadd v0, v1- v5 = iadd v4, v2- v6 = iadd v5, v3- return v6-; check: v4 = iadd v0, v1-; nextln: v7 = iadd v2, v3-; nextln: v8 = iadd v4, v7-; check: return v8-}--function %iadd_shallow_and_wide_twice(i32, i32, i32, i32, i32, i32) -> i32 {-block0(v0: i32, v1: i32, v2: i32, v3: i32, v4: i32, v5: i32):- v6 = iadd v0, v1- v7 = iadd v6, v2- v8 = iadd v7, v3- v9 = iadd v8, v4- v10 = iadd v9, v5- return v10-; check: v6 = iadd v0, v1-; nextln: v11 = iadd v2, v3-; nextln: v12 = iadd v6, v11-; nextln: v16 = iadd v4, v5-; nextln: v23 = iadd v12, v16-; nextln: return v23-}--function %iadd_reassociate_then_cprop(i32, i32) -> i32 {-block0(v0: i32, v1: i32):- v2 = iconst.i32 42- v3 = iconst.i32 36- v4 = iadd v0, v2- v5 = iadd v1, v3- v6 = iadd v4, v5- return v6-; check: v7 = iadd v0, v1-; nextln: v9 = iconst.i32 78-; nextln: v15 = iadd v7, v9 ; v9 = 78-; check: return v15-}--function %imul_shallow_and_wide(i32, i32, i32, i32) -> i32 {-block0(v0: i32, v1: i32, v2: i32, v3: i32):- v4 = imul v0, v1- v5 = imul v4, v2- v6 = imul v5, v3- return v6-; check: v4 = imul v0, v1-; nextln: v7 = imul v2, v3-; nextln: v8 = imul v4, v7-; check: return v8-}--function %band_shallow_and_wide(i32, i32, i32, i32) -> i32 {-block0(v0: i32, v1: i32, v2: i32, v3: i32):- v4 = band v0, v1- v5 = band v4, v2- v6 = band v5, v3- return v6-; check: v4 = band v0, v1-; nextln: v7 = band v2, v3-; nextln: v8 = band v4, v7-; check: return v8-}--function %bxor_shallow_and_wide(i32, i32, i32, i32) -> i32 {-block0(v0: i32, v1: i32, v2: i32, v3: i32):- v4 = bxor v0, v1- v5 = bxor v4, v2- v6 = bxor v5, v3- return v6-; check: v4 = bxor v0, v1-; nextln: v7 = bxor v2, v3-; nextln: v8 = bxor v4, v7-; check: return v8-}--;; We don't have any assertions about the result of optimizing this function,-;; but it's a good canary for unbounded recursion in optimization rulesets. In-;; particular, because of the shared structure in the dag, it won't be obvious-;; to rules that are pattern matching on trees that this is actually a chain,-;; and they will exhibit exponential behavior as a result.-function %iadd_big_chain(i8) -> i16 {-block0(v0: i8):- v1 = uextend.i32 v0- v2 = iconst.i32 42- v3 = iadd v1, v2- v4 = iadd v3, v3- v5 = iadd v4, v4- v6 = iadd v5, v5- v7 = iadd v6, v6- v8 = iadd v7, v7- v9 = iadd v8, v8- v10 = iadd v9, v9- v11 = iadd v10, v10- v12 = iadd v11, v11- v13 = iadd v12, v12- v14 = iadd v13, v13- v15 = iadd v14, v14- v16 = iadd v15, v15- v17 = iadd v16, v16- v18 = iadd v17, v17- v19 = iadd v18, v18- v20 = iadd v19, v19- v21 = iadd v20, v20- v22 = iadd v21, v21- v23 = iadd v22, v22- v24 = iadd v23, v23- v25 = iadd v24, v24- v26 = iadd v25, v25- v27 = iadd v26, v26- v28 = ireduce.i16 v27- return v28-}--function %iadd_sub_1_shallow_and_wide(i32, i32, i32, i32) -> i32 {-block0(v0: i32, v1: i32, v2: i32, v3: i32):- v4 = isub v2, v3- v5 = isub v1, v4- v6 = isub v0, v5- return v6-; check: v7 = isub v0, v1-; nextln: v4 = isub v2, v3-; nextln: v8 = iadd v7, v4-; check: return v8-}--function %iadd_sub_2_shallow_and_wide(i32, i32, i32, i32) -> i32 {-block0(v0: i32, v1: i32, v2: i32, v3: i32):- v4 = iadd v2, v3- v5 = isub v1, v4- v6 = isub v0, v5- return v6-; check: v7 = isub v0, v1-; nextln: v4 = iadd v2, v3-; nextln: v8 = iadd v7, v4-; check: return v8-}--function %iadd_sub_3_shallow_and_wide(i32, i32, i32, i32) -> i32 {-block0(v0: i32, v1: i32, v2: i32, v3: i32):- v4 = isub v2, v3- v5 = iadd v1, v4- v6 = isub v0, v5- return v6-; check: v7 = isub v0, v1-; nextln: v4 = isub v2, v3-; nextln: v8 = isub v7, v4-; check: return v8-}--function %iadd_sub_4_shallow_and_wide(i32, i32, i32, i32) -> i32 {-block0(v0: i32, v1: i32, v2: i32, v3: i32):- v4 = iadd v2, v3- v5 = iadd v1, v4- v6 = isub v0, v5- return v6-; check: v7 = isub v0, v1-; nextln: v4 = iadd v2, v3-; nextln: v8 = isub v7, v4-; check: return v8-}--function %iadd_sub_5_shallow_and_wide(i32, i32, i32, i32) -> i32 {-block0(v0: i32, v1: i32, v2: i32, v3: i32):- v4 = isub v2, v3- v5 = isub v1, v4- v6 = iadd v0, v5- return v6-; check: v7 = iadd v0, v1-; nextln: v4 = isub v2, v3-; nextln: v8 = isub v7, v4-; check: return v8-}--function %iadd_sub_6_shallow_and_wide(i32, i32, i32, i32) -> i32 {-block0(v0: i32, v1: i32, v2: i32, v3: i32):- v4 = iadd v2, v3- v5 = isub v1, v4- v6 = iadd v0, v5- return v6-; check: v7 = iadd v0, v1-; nextln: v4 = iadd v2, v3-; nextln: v8 = isub v7, v4-; check: return v8-}--function %iadd_sub_7_shallow_and_wide(i32, i32, i32, i32) -> i32 {-block0(v0: i32, v1: i32, v2: i32, v3: i32):- v4 = isub v2, v3- v5 = iadd v1, v4- v6 = iadd v0, v5- return v6-; check: v7 = iadd v0, v1-; nextln: v4 = isub v2, v3-; nextln: v8 = iadd v7, v4-; check: return v8-}--function %isub_add_1_shallow_and_wide(i32, i32, i32, i32) -> i32 {-block0(v0: i32, v1: i32, v2: i32, v3: i32):- v4 = isub v0, v1- v5 = isub v4, v2- v6 = isub v5, v3- return v6-; check: v4 = isub v0, v1-; nextln: v7 = iadd v2, v3-; nextln: v8 = isub v4, v7-; check: return v8-}--function %isub_add_2_shallow_and_wide(i32, i32, i32, i32) -> i32 {-block0(v0: i32, v1: i32, v2: i32, v3: i32):- v4 = isub v0, v1- v5 = isub v4, v2- v6 = iadd v5, v3- return v6-; check: v4 = isub v0, v1-; nextln: v7 = isub v2, v3-; nextln: v8 = isub v4, v7-; check: return v8-}--function %isub_add_3_shallow_and_wide(i32, i32, i32, i32) -> i32 {-block0(v0: i32, v1: i32, v2: i32, v3: i32):- v4 = isub v0, v1- v5 = iadd v4, v2- v6 = isub v5, v3- return v6-; check: v4 = isub v0, v1-; nextln: v7 = isub v2, v3-; nextln: v8 = iadd v4, v7-; check: return v8-}--function %isub_add_4_shallow_and_wide(i32, i32, i32, i32) -> i32 {-block0(v0: i32, v1: i32, v2: i32, v3: i32):- v4 = isub v0, v1- v5 = iadd v4, v2- v6 = iadd v5, v3- return v6-; check: v4 = isub v0, v1-; nextln: v7 = iadd v2, v3-; nextln: v8 = iadd v4, v7-; check: return v8-}--function %isub_add_5_shallow_and_wide(i32, i32, i32, i32) -> i32 {-block0(v0: i32, v1: i32, v2: i32, v3: i32):- v4 = iadd v0, v1- v5 = isub v4, v2- v6 = isub v5, v3- return v6-; check: v4 = iadd v0, v1-; nextln: v7 = iadd v2, v3-; nextln: v8 = isub v4, v7-; check: return v8-}--function %isub_add_6_shallow_and_wide(i32, i32, i32, i32) -> i32 {-block0(v0: i32, v1: i32, v2: i32, v3: i32):- v4 = iadd v0, v1- v5 = isub v4, v2- v6 = iadd v5, v3- return v6-; check: v4 = iadd v0, v1-; nextln: v7 = isub v2, v3-; nextln: v8 = isub v4, v7-; check: return v8-}--function %isub_add_7_shallow_and_wide(i32, i32, i32, i32) -> i32 {-block0(v0: i32, v1: i32, v2: i32, v3: i32):- v4 = iadd v0, v1- v5 = iadd v4, v2- v6 = isub v5, v3- return v6-; check: v4 = iadd v0, v1-; nextln: v7 = isub v2, v3-; nextln: v8 = iadd v4, v7-; check: return v8-}\ No newline at end of filediff --git a/cranelift/filetests/filetests/isa/x64/stack_switch.clif b/cranelift/filetests/filetests/isa/x64/stack_switch.clifindex 845c6bde38..5ae44e43cd 100644--- a/cranelift/filetests/filetests/isa/x64/stack_switch.clif+++ b/cranelift/filetests/filetests/isa/x64/stack_switch.clif@@ -143,107 +143,85 @@ block0(v0: i64, v1: i64):; VCode:; pushq %rbp; movq %rsp, %rbp-; subq $0xc0, %rsp-; movq %rbx, 0x90(%rsp)-; movq %r12, 0x98(%rsp)-; movq %r13, 0xa0(%rsp)-; movq %r14, 0xa8(%rsp)-; movq %r15, 0xb0(%rsp)+; subq $0xb0, %rsp+; movq %rbx, 0x80(%rsp)+; movq %r12, 0x88(%rsp)+; movq %r13, 0x90(%rsp)+; movq %r14, 0x98(%rsp)+; movq %r15, 0xa0(%rsp); block0:-; movq (%rdi), %r8-; movq %r8, <offset:1>+0x88(%rsp)-; movq 8(%rdi), %r8-; movq %r8, <offset:1>+0x10(%rsp)-; movq 0x10(%rdi), %r8-; movq %r8, <offset:1>+0x80(%rsp)-; movq 0x18(%rdi), %r8-; movq %r8, <offset:1>+0x78(%rsp)-; movq 0x20(%rdi), %r8-; movq %r8, <offset:1>+0x70(%rsp)-; movq 0x28(%rdi), %r8-; movq %r8, <offset:1>+0x68(%rsp)-; movq 0x30(%rdi), %r8-; movq %r8, <offset:1>+0x60(%rsp)-; movq 0x38(%rdi), %r8-; movq %r8, <offset:1>+0x58(%rsp)-; movq 0x40(%rdi), %r8-; movq %r8, <offset:1>+0x50(%rsp)-; movq 0x48(%rdi), %r8-; movq %r8, <offset:1>+0x48(%rsp)-; movq 0x50(%rdi), %r8-; movq %r8, <offset:1>+0x40(%rsp)-; movq 0x58(%rdi), %r8-; movq %r8, <offset:1>+0x38(%rsp)-; movq 0x60(%rdi), %r8-; movq %r8, <offset:1>+0x30(%rsp)-; movq 0x68(%rdi), %r8-; movq %r8, <offset:1>+0x28(%rsp)-; movq 0x70(%rdi), %r8+; movq (%rdi), %rax+; movq %rax, <offset:1>+0x78(%rsp)+; movq 8(%rdi), %rax+; movq %rax, <offset:1>+0x70(%rsp)+; movq 0x10(%rdi), %rax+; movq %rax, <offset:1>+0x68(%rsp)+; movq 0x18(%rdi), %rax+; movq %rax, <offset:1>+0x60(%rsp)+; movq 0x20(%rdi), %rax+; movq %rax, <offset:1>+0x58(%rsp)+; movq 0x28(%rdi), %rax+; movq %rax, <offset:1>+0x50(%rsp)+; movq 0x30(%rdi), %rax+; movq %rax, <offset:1>+0x48(%rsp)+; movq 0x38(%rdi), %rax+; movq %rax, <offset:1>+0x40(%rsp)+; movq 0x40(%rdi), %rax+; movq %rax, <offset:1>+0x38(%rsp)+; movq 0x48(%rdi), %rax+; movq %rax, <offset:1>+0x30(%rsp)+; movq 0x50(%rdi), %rax+; movq %rax, <offset:1>+0x28(%rsp)+; movq 0x58(%rdi), %rax+; movq %rax, <offset:1>+0x20(%rsp)+; movq 0x60(%rdi), %rax+; movq %rax, <offset:1>+0x18(%rsp)+; movq 0x68(%rdi), %rax+; movq %rax, <offset:1>+0x10(%rsp)+; movq 0x70(%rdi), %rax; movq %rdi, <offset:1>+(%rsp)-; movq %r8, <offset:1>+0x20(%rsp)+; movq %rax, <offset:1>+8(%rsp); uninit %rdi; xorq %rdi, %rdi; %rdi = stack_switch_basic %rsi, %rsi, %rdi-; movq <offset:1>+0x88(%rsp), %r8-; movq %rdi, <offset:1>+0x18(%rsp)-; movq (%r8), %r9-; movq <offset:1>+0x10(%rsp), %r8-; movq %r9, <offset:1>+8(%rsp)-; movq (%r8), %r10-; movq <offset:1>+0x80(%rsp), %r8-; movq %r10, <offset:1>+0x10(%rsp)-; movq (%r8), %r10-; movq <offset:1>+0x78(%rsp), %r8-; movq (%r8), %r11-; movq <offset:1>+0x70(%rsp), %r8-; movq (%r8), %rsi-; movq <offset:1>+0x68(%rsp), %r8-; movq (%r8), %rax-; movq <offset:1>+0x60(%rsp), %r8-; movq (%r8), %rbx-; movq <offset:1>+0x58(%rsp), %r8-; movq (%r8), %r12-; movq <offset:1>+0x50(%rsp), %r8-; movq (%r8), %r14-; movq <offset:1>+0x48(%rsp), %r8-; movq (%r8), %r15-; movq <offset:1>+0x40(%rsp), %r8-; movq (%r8), %r8-; movq <offset:1>+0x38(%rsp), %r9-; movq (%r9), %rcx-; movq <offset:1>+0x30(%rsp), %rdi-; movq (%rdi), %r13-; movq <offset:1>+0x28(%rsp), %rdx-; movq (%rdx), %rdx-; movq <offset:1>+8(%rsp), %rdi-; movq <offset:1>+0x18(%rsp), %r9-; leaq (%r9, %rdi), %rdi-; movq <offset:1>+0x10(%rsp), %r9-; movq %rdi, <offset:1>+8(%rsp)-; leaq (%r9, %r10), %r9-; leaq (%r11, %rsi), %r10-; leaq (%rax, %rbx), %r11-; leaq (%r12, %r14), %rsi-; leaq (%r15, %r8), %r8-; leaq (%rsi, %r8), %r8-; leaq (%r11, %r8), %r8-; leaq (%r10, %r8), %r8-; leaq (%rcx, %r13), %r10-; movq <offset:1>+0x20(%rsp), %rcx-; addq (%rcx), %rdx-; movq <offset:1>+(%rsp), %rdi-; leaq (%rdx, %rdi), %r11-; leaq (%r10, %r11), %r10-; leaq (%r8, %r10), %r8-; leaq (%r9, %r8), %r8-; movq <offset:1>+8(%rsp), %r9-; leaq (%r9, %r8), %rax-; movq 0x90(%rsp), %rbx-; movq 0x98(%rsp), %r12-; movq 0xa0(%rsp), %r13-; movq 0xa8(%rsp), %r14-; movq 0xb0(%rsp), %r15-; addq $0xc0, %rsp+; movq <offset:1>+0x78(%rsp), %rsi+; addq (%rsi), %rdi+; movq <offset:1>+0x70(%rsp), %rsi+; addq (%rsi), %rdi+; movq <offset:1>+0x68(%rsp), %rsi+; addq (%rsi), %rdi+; movq <offset:1>+0x60(%rsp), %rsi+; addq (%rsi), %rdi+; movq <offset:1>+0x58(%rsp), %rsi+; addq (%rsi), %rdi+; movq <offset:1>+0x50(%rsp), %rsi+; addq (%rsi), %rdi+; movq <offset:1>+0x48(%rsp), %rsi+; addq (%rsi), %rdi+; movq <offset:1>+0x40(%rsp), %rsi+; addq (%rsi), %rdi+; movq <offset:1>+0x38(%rsp), %rsi+; addq (%rsi), %rdi+; movq <offset:1>+0x30(%rsp), %rsi+; addq (%rsi), %rdi+; movq <offset:1>+0x28(%rsp), %rsi+; addq (%rsi), %rdi+; movq <offset:1>+0x20(%rsp), %rsi+; addq (%rsi), %rdi+; movq <offset:1>+0x18(%rsp), %rsi+; addq (%rsi), %rdi+; movq <offset:1>+0x10(%rsp), %rsi+; addq (%rsi), %rdi+; movq <offset:1>+8(%rsp), %rsi+; addq (%rsi), %rdi+; movq <offset:1>+(%rsp), %rax+; leaq (%rdi, %rax), %rax+; movq 0x80(%rsp), %rbx+; movq 0x88(%rsp), %r12+; movq 0x90(%rsp), %r13+; movq 0x98(%rsp), %r14+; movq 0xa0(%rsp), %r15+; addq $0xb0, %rsp; movq %rbp, %rsp; popq %rbp; retq@@ -252,44 +230,44 @@ block0(v0: i64, v1: i64):; block0: ; offset 0x0; pushq %rbp; movq %rsp, %rbp-; subq $0xc0, %rsp-; movq %rbx, 0x90(%rsp)-; movq %r12, 0x98(%rsp)-; movq %r13, 0xa0(%rsp)-; movq %r14, 0xa8(%rsp)-; movq %r15, 0xb0(%rsp)+; subq $0xb0, %rsp+; movq %rbx, 0x80(%rsp)+; movq %r12, 0x88(%rsp)+; movq %r13, 0x90(%rsp)+; movq %r14, 0x98(%rsp)+; movq %r15, 0xa0(%rsp); block1: ; offset 0x33-; movq (%rdi), %r8 ; trap: heap_oob-; movq %r8, 0x88(%rsp)-; movq 8(%rdi), %r8 ; trap: heap_oob-; movq %r8, 0x10(%rsp)-; movq 0x10(%rdi), %r8 ; trap: heap_oob-; movq %r8, 0x80(%rsp)-; movq 0x18(%rdi), %r8 ; trap: heap_oob-; movq %r8, 0x78(%rsp)-; movq 0x20(%rdi), %r8 ; trap: heap_oob-; movq %r8, 0x70(%rsp)-; movq 0x28(%rdi), %r8 ; trap: heap_oob-; movq %r8, 0x68(%rsp)-; movq 0x30(%rdi), %r8 ; trap: heap_oob-; movq %r8, 0x60(%rsp)-; movq 0x38(%rdi), %r8 ; trap: heap_oob-; movq %r8, 0x58(%rsp)-; movq 0x40(%rdi), %r8 ; trap: heap_oob-; movq %r8, 0x50(%rsp)-; movq 0x48(%rdi), %r8 ; trap: heap_oob-; movq %r8, 0x48(%rsp)-; movq 0x50(%rdi), %r8 ; trap: heap_oob-; movq %r8, 0x40(%rsp)-; movq 0x58(%rdi), %r8 ; trap: heap_oob-; movq %r8, 0x38(%rsp)-; movq 0x60(%rdi), %r8 ; trap: heap_oob-; movq %r8, 0x30(%rsp)-; movq 0x68(%rdi), %r8 ; trap: heap_oob-; movq %r8, 0x28(%rsp)-; movq 0x70(%rdi), %r8 ; trap: heap_oob+; movq (%rdi), %rax ; trap: heap_oob+; movq %rax, 0x78(%rsp)+; movq 8(%rdi), %rax ; trap: heap_oob+; movq %rax, 0x70(%rsp)+; movq 0x10(%rdi), %rax ; trap: heap_oob+; movq %rax, 0x68(%rsp)+; movq 0x18(%rdi), %rax ; trap: heap_oob+; movq %rax, 0x60(%rsp)+; movq 0x20(%rdi), %rax ; trap: heap_oob+; movq %rax, 0x58(%rsp)+; movq 0x28(%rdi), %rax ; trap: heap_oob+; movq %rax, 0x50(%rsp)+; movq 0x30(%rdi), %rax ; trap: heap_oob+; movq %rax, 0x48(%rsp)+; movq 0x38(%rdi), %rax ; trap: heap_oob+; movq %rax, 0x40(%rsp)+; movq 0x40(%rdi), %rax ; trap: heap_oob+; movq %rax, 0x38(%rsp)+; movq 0x48(%rdi), %rax ; trap: heap_oob+; movq %rax, 0x30(%rsp)+; movq 0x50(%rdi), %rax ; trap: heap_oob+; movq %rax, 0x28(%rsp)+; movq 0x58(%rdi), %rax ; trap: heap_oob+; movq %rax, 0x20(%rsp)+; movq 0x60(%rdi), %rax ; trap: heap_oob+; movq %rax, 0x18(%rsp)+; movq 0x68(%rdi), %rax ; trap: heap_oob+; movq %rax, 0x10(%rsp)+; movq 0x70(%rdi), %rax ; trap: heap_oob; movq %rdi, (%rsp)-; movq %r8, 0x20(%rsp)+; movq %rax, 8(%rsp); xorq %rdi, %rdi; movq (%rsi), %rax; movq %rsp, (%rsi)@@ -301,66 +279,44 @@ block0(v0: i64, v1: i64):; leaq 6(%rip), %rcx; movq %rcx, 0x10(%rsi); jmpq *%rax-; movq 0x88(%rsp), %r8-; movq %rdi, 0x18(%rsp)-; movq (%r8), %r9 ; trap: heap_oob-; movq 0x10(%rsp), %r8-; movq %r9, 8(%rsp)-; movq (%r8), %r10 ; trap: heap_oob-; movq 0x80(%rsp), %r8-; movq %r10, 0x10(%rsp)-; movq (%r8), %r10 ; trap: heap_oob-; movq 0x78(%rsp), %r8-; movq (%r8), %r11 ; trap: heap_oob-; movq 0x70(%rsp), %r8-; movq (%r8), %rsi ; trap: heap_oob-; movq 0x68(%rsp), %r8-; movq (%r8), %rax ; trap: heap_oob-; movq 0x60(%rsp), %r8-; movq (%r8), %rbx ; trap: heap_oob-; movq 0x58(%rsp), %r8-; movq (%r8), %r12 ; trap: heap_oob-; movq 0x50(%rsp), %r8-; movq (%r8), %r14 ; trap: heap_oob-; movq 0x48(%rsp), %r8-; movq (%r8), %r15 ; trap: heap_oob-; movq 0x40(%rsp), %r8-; movq (%r8), %r8 ; trap: heap_oob-; movq 0x38(%rsp), %r9-; movq (%r9), %rcx ; trap: heap_oob-; movq 0x30(%rsp), %rdi-; movq (%rdi), %r13 ; trap: heap_oob-; movq 0x28(%rsp), %rdx-; movq (%rdx), %rdx ; trap: heap_oob-; movq 8(%rsp), %rdi-; movq 0x18(%rsp), %r9-; addq %r9, %rdi-; movq 0x10(%rsp), %r9-; movq %rdi, 8(%rsp)-; addq %r10, %r9-; leaq (%r11, %rsi), %r10-; leaq (%rax, %rbx), %r11-; leaq (%r12, %r14), %rsi-; addq %r15, %r8-; addq %rsi, %r8-; addq %r11, %r8-; addq %r10, %r8-; leaq (%rcx, %r13), %r10-; movq 0x20(%rsp), %rcx-; addq (%rcx), %rdx ; trap: heap_oob-; movq (%rsp), %rdi-; leaq (%rdx, %rdi), %r11-; addq %r11, %r10-; addq %r10, %r8-; addq %r9, %r8-; movq 8(%rsp), %r9-; leaq (%r9, %r8), %rax-; movq 0x90(%rsp), %rbx-; movq 0x98(%rsp), %r12-; movq 0xa0(%rsp), %r13-; movq 0xa8(%rsp), %r14-; movq 0xb0(%rsp), %r15-; addq $0xc0, %rsp+; movq 0x78(%rsp), %rsi+; addq (%rsi), %rdi ; trap: heap_oob+; movq 0x70(%rsp), %rsi+; addq (%rsi), %rdi ; trap: heap_oob+; movq 0x68(%rsp), %rsi+; addq (%rsi), %rdi ; trap: heap_oob+; movq 0x60(%rsp), %rsi+; addq (%rsi), %rdi ; trap: heap_oob+; movq 0x58(%rsp), %rsi+; addq (%rsi), %rdi ; trap: heap_oob+; movq 0x50(%rsp), %rsi+; addq (%rsi), %rdi ; trap: heap_oob+; movq 0x48(%rsp), %rsi+; addq (%rsi), %rdi ; trap: heap_oob+; movq 0x40(%rsp), %rsi+; addq (%rsi), %rdi ; trap: heap_oob+; movq 0x38(%rsp), %rsi+; addq (%rsi), %rdi ; trap: heap_oob+; movq 0x30(%rsp), %rsi+; addq (%rsi), %rdi ; trap: heap_oob+; movq 0x28(%rsp), %rsi+; addq (%rsi), %rdi ; trap: heap_oob+; movq 0x20(%rsp), %rsi+; addq (%rsi), %rdi ; trap: heap_oob+; movq 0x18(%rsp), %rsi+; addq (%rsi), %rdi ; trap: heap_oob+; movq 0x10(%rsp), %rsi+; addq (%rsi), %rdi ; trap: heap_oob+; movq 8(%rsp), %rsi+; addq (%rsi), %rdi ; trap: heap_oob+; movq (%rsp), %rax+; addq %rdi, %rax+; movq 0x80(%rsp), %rbx+; movq 0x88(%rsp), %r12+; movq 0x90(%rsp), %r13+; movq 0x98(%rsp), %r14+; movq 0xa0(%rsp), %r15+; addq $0xb0, %rsp; movq %rbp, %rsp; popq %rbp; retqdiff --git a/tests/disas/gc/drc/array-fill.wat b/tests/disas/gc/drc/array-fill.watindex 2b36d44a4e..c29a4de194 100644--- a/tests/disas/gc/drc/array-fill.wat+++ b/tests/disas/gc/drc/array-fill.wat@@ -51,20 +51,19 @@;; @0027 v30 = isub v27, v29;; v64 = ishl v5, v53 ; v53 = 3;; @0027 v32 = uextend.i64 v64-;; v66 = isub v29, v32-;; v67 = isub v27, v66+;; @0027 v33 = iadd v30, v32;; @0027 v14 = iconst.i64 8;; @0027 jump block2(v30);;;; block2(v35: i64):-;; @0027 v36 = icmp eq v35, v67+;; @0027 v36 = icmp eq v35, v33;; @0027 brif v36, block4, block3;;;; block3:;; @0027 store.i64 notrap aligned little v4, v35-;; v68 = iconst.i64 8-;; v69 = iadd.i64 v35, v68 ; v68 = 8-;; @0027 jump block2(v69)+;; v66 = iconst.i64 8+;; v67 = iadd.i64 v35, v66 ; v66 = 8+;; @0027 jump block2(v67);;;; block4:;; @002a jump block1diff --git a/tests/disas/gc/drc/array-new-fixed-of-gc-refs.wat b/tests/disas/gc/drc/array-new-fixed-of-gc-refs.watindex 4b224ed7cb..955f3571e4 100644--- a/tests/disas/gc/drc/array-new-fixed-of-gc-refs.wat+++ b/tests/disas/gc/drc/array-new-fixed-of-gc-refs.wat@@ -55,8 +55,8 @@;; block2:;; @0025 v30 = uextend.i64 v91;; @0025 v32 = iadd.i64 v18, v30-;; @0025 v67 = iconst.i64 8-;; @0025 v34 = iadd v32, v67 ; v67 = 8+;; v166 = iconst.i64 8+;; @0025 v34 = iadd v32, v166 ; v166 = 8;; @0025 v35 = load.i64 notrap aligned v34;; v96 = iconst.i64 1;; @0025 v36 = iadd v35, v96 ; v96 = 1@@ -69,55 +69,55 @@;; v156 = iadd.i64 v20, v150 ; v150 = 28;; @0025 store notrap aligned little v87, v156;; v86 = load.i32 notrap v134-;; v180 = iconst.i32 1-;; v181 = band v86, v180 ; v180 = 1-;; v182 = iconst.i32 0-;; v183 = icmp eq v86, v182 ; v182 = 0-;; @0025 v45 = uextend.i32 v183-;; @0025 v46 = bor v181, v45+;; v256 = iconst.i32 1+;; v257 = band v86, v256 ; v256 = 1+;; v258 = iconst.i32 0+;; v259 = icmp eq v86, v258 ; v258 = 0+;; @0025 v45 = uextend.i32 v259+;; @0025 v46 = bor v257, v45;; @0025 brif v46, block5, block4;;;; block4:;; @0025 v47 = uextend.i64 v86;; @0025 v49 = iadd.i64 v18, v47-;; v184 = iconst.i64 8-;; @0025 v51 = iadd v49, v184 ; v184 = 8+;; v260 = iconst.i64 8+;; @0025 v51 = iadd v49, v260 ; v260 = 8;; @0025 v52 = load.i64 notrap aligned v51-;; v185 = iconst.i64 1-;; @0025 v53 = iadd v52, v185 ; v185 = 1+;; v261 = iconst.i64 1+;; @0025 v53 = iadd v52, v261 ; v261 = 1;; @0025 store notrap aligned v53, v51;; @0025 jump block5;;;; block5:;; v82 = load.i32 notrap v134;; v131 = iconst.i64 32-;; v163 = iadd.i64 v20, v131 ; v131 = 32-;; @0025 store notrap aligned little v82, v163+;; v164 = iadd.i64 v20, v131 ; v131 = 32+;; @0025 store notrap aligned little v82, v164;; v81 = load.i32 notrap v133-;; v186 = iconst.i32 1-;; v187 = band v81, v186 ; v186 = 1-;; v188 = iconst.i32 0-;; v189 = icmp eq v81, v188 ; v188 = 0-;; @0025 v62 = uextend.i32 v189-;; @0025 v63 = bor v187, v62+;; v262 = iconst.i32 1+;; v263 = band v81, v262 ; v262 = 1+;; v264 = iconst.i32 0+;; v265 = icmp eq v81, v264 ; v264 = 0+;; @0025 v62 = uextend.i32 v265+;; @0025 v63 = bor v263, v62;; @0025 brif v63, block7, block6;;;; block6:;; @0025 v64 = uextend.i64 v81;; @0025 v66 = iadd.i64 v18, v64-;; v190 = iconst.i64 8-;; @0025 v68 = iadd v66, v190 ; v190 = 8+;; v266 = iconst.i64 8+;; @0025 v68 = iadd v66, v266 ; v266 = 8;; @0025 v69 = load.i64 notrap aligned v68-;; v191 = iconst.i64 1-;; @0025 v70 = iadd v69, v191 ; v191 = 1+;; v267 = iconst.i64 1+;; @0025 v70 = iadd v69, v267 ; v267 = 1;; @0025 store notrap aligned v70, v68;; @0025 jump block7;;;; block7:;; v77 = load.i32 notrap v133-;; v165 = iconst.i64 36-;; v171 = iadd.i64 v20, v165 ; v165 = 36-;; @0025 store notrap aligned little v77, v171+;; v182 = iconst.i64 36+;; v188 = iadd.i64 v20, v182 ; v182 = 36+;; @0025 store notrap aligned little v77, v188;; @0029 jump block1;;;; block1:diff --git a/tests/disas/gc/drc/array-new-fixed.wat b/tests/disas/gc/drc/array-new-fixed.watindex 6eac419581..dd7a899e89 100644--- a/tests/disas/gc/drc/array-new-fixed.wat+++ b/tests/disas/gc/drc/array-new-fixed.wat@@ -37,12 +37,12 @@;; v32 = iconst.i64 32;; v52 = iadd v20, v32 ; v32 = 32;; @0025 store notrap aligned little v2, v52-;; v54 = iconst.i64 40-;; v60 = iadd v20, v54 ; v54 = 40-;; @0025 store notrap aligned little v3, v60-;; v62 = iconst.i64 48-;; v68 = iadd v20, v62 ; v62 = 48-;; @0025 store notrap aligned little v4, v68+;; v55 = iconst.i64 40+;; v61 = iadd v20, v55 ; v55 = 40+;; @0025 store notrap aligned little v3, v61+;; v79 = iconst.i64 48+;; v85 = iadd v20, v79 ; v79 = 48+;; @0025 store notrap aligned little v4, v85;; @0029 jump block1;;;; block1:diff --git a/tests/disas/gc/drc/array-new.wat b/tests/disas/gc/drc/array-new.watindex d59c51d265..274b4d5f54 100644--- a/tests/disas/gc/drc/array-new.wat+++ b/tests/disas/gc/drc/array-new.wat@@ -54,9 +54,9 @@;;;; block3:;; @0022 store.i64 notrap aligned little v2, v27-;; v64 = iconst.i64 8-;; v65 = iadd.i64 v27, v64 ; v64 = 8-;; @0022 jump block2(v65)+;; v57 = iconst.i64 8+;; v58 = iadd.i64 v27, v57 ; v57 = 8+;; @0022 jump block2(v58);;;; block4:;; @0025 jump block1diff --git a/tests/disas/gc/null/array-fill.wat b/tests/disas/gc/null/array-fill.watindex 590253fc61..2ddc505ea8 100644--- a/tests/disas/gc/null/array-fill.wat+++ b/tests/disas/gc/null/array-fill.wat@@ -51,19 +51,18 @@;; @0027 v30 = isub v27, v29;; v64 = ishl v5, v53 ; v53 = 3;; @0027 v32 = uextend.i64 v64-;; v66 = isub v29, v32-;; v67 = isub v27, v66+;; @0027 v33 = iadd v30, v32;; @0027 jump block2(v30);;;; block2(v35: i64):-;; @0027 v36 = icmp eq v35, v67+;; @0027 v36 = icmp eq v35, v33;; @0027 brif v36, block4, block3;;;; block3:;; @0027 store.i64 notrap aligned little v4, v35-;; v68 = iconst.i64 8-;; v69 = iadd.i64 v35, v68 ; v68 = 8-;; @0027 jump block2(v69)+;; v66 = iconst.i64 8+;; v67 = iadd.i64 v35, v66 ; v66 = 8+;; @0027 jump block2(v67);;;; block4:;; @002a jump block1diff --git a/tests/disas/gc/null/array-new-fixed-of-gc-refs.wat b/tests/disas/gc/null/array-new-fixed-of-gc-refs.watindex 963afecaf8..27ac8470a3 100644--- a/tests/disas/gc/null/array-new-fixed-of-gc-refs.wat+++ b/tests/disas/gc/null/array-new-fixed-of-gc-refs.wat@@ -48,9 +48,9 @@;; block2:;; v90 = iconst.i32 -1476394984;; @0025 v31 = load.i64 notrap aligned readonly can_move v56+24-;; v128 = band.i32 v21, v89 ; v89 = -8-;; v129 = uextend.i64 v128-;; @0025 v33 = iadd v31, v129+;; v175 = band.i32 v21, v89 ; v89 = -8+;; v176 = uextend.i64 v175+;; @0025 v33 = iadd v31, v176;; @0025 store notrap aligned v90, v33 ; v90 = -1476394984;; @0025 v37 = load.i64 notrap aligned readonly can_move v0+40;; @0025 v38 = load.i32 notrap aligned readonly can_move v37@@ -65,13 +65,13 @@;; v103 = iadd v33, v64 ; v64 = 12;; @0025 store notrap aligned little v49, v103;; v48 = load.i32 notrap v61-;; v105 = iconst.i64 16-;; v111 = iadd v33, v105 ; v105 = 16-;; @0025 store notrap aligned little v48, v111+;; v106 = iconst.i64 16+;; v112 = iadd v33, v106 ; v106 = 16+;; @0025 store notrap aligned little v48, v112;; v47 = load.i32 notrap v60-;; v113 = iconst.i64 20-;; v119 = iadd v33, v113 ; v113 = 20-;; @0025 store notrap aligned little v47, v119+;; v129 = iconst.i64 20+;; v135 = iadd v33, v129 ; v129 = 20+;; @0025 store notrap aligned little v47, v135;; @0029 jump block1;;;; block3 cold:@@ -80,6 +80,6 @@;; @0025 jump block2;;;; block1:-;; v130 = band.i32 v21, v89 ; v89 = -8-;; @0029 return v130+;; v177 = band.i32 v21, v89 ; v89 = -8+;; @0029 return v177;; }diff --git a/tests/disas/gc/null/array-new-fixed.wat b/tests/disas/gc/null/array-new-fixed.watindex 792803c244..834eb9e5ee 100644--- a/tests/disas/gc/null/array-new-fixed.wat+++ b/tests/disas/gc/null/array-new-fixed.wat@@ -39,9 +39,9 @@;; block2:;; v81 = iconst.i32 -1476394968;; @0025 v31 = load.i64 notrap aligned readonly can_move v50+24-;; v118 = band.i32 v21, v80 ; v80 = -8-;; v119 = uextend.i64 v118-;; @0025 v33 = iadd v31, v119+;; v150 = band.i32 v21, v80 ; v80 = -8+;; v151 = uextend.i64 v150+;; @0025 v33 = iadd v31, v151;; @0025 store notrap aligned v81, v33 ; v81 = -1476394968;; @0025 v37 = load.i64 notrap aligned readonly can_move v0+40;; @0025 v38 = load.i32 notrap aligned readonly can_move v37@@ -55,11 +55,11 @@;; v95 = iadd v33, v89 ; v89 = 16;; @0025 store.i64 notrap aligned little v2, v95;; v55 = iconst.i64 24-;; v102 = iadd v33, v55 ; v55 = 24-;; @0025 store.i64 notrap aligned little v3, v102+;; v103 = iadd v33, v55 ; v55 = 24+;; @0025 store.i64 notrap aligned little v3, v103;; v52 = iconst.i64 32-;; v109 = iadd v33, v52 ; v52 = 32-;; @0025 store.i64 notrap aligned little v4, v109+;; v114 = iadd v33, v52 ; v52 = 32+;; @0025 store.i64 notrap aligned little v4, v114;; @0029 jump block1;;;; block3 cold:@@ -68,6 +68,6 @@;; @0025 jump block2;;;; block1:-;; v120 = band.i32 v21, v80 ; v80 = -8-;; @0029 return v120+;; v152 = band.i32 v21, v80 ; v80 = -8+;; @0029 return v152;; }diff --git a/tests/disas/gc/null/array-new.wat b/tests/disas/gc/null/array-new.watindex 9335a04789..4a28f086e8 100644--- a/tests/disas/gc/null/array-new.wat+++ b/tests/disas/gc/null/array-new.wat@@ -52,9 +52,9 @@;; @0022 v32 = iconst.i32 -1476395008;; v74 = bor.i32 v10, v32 ; v32 = -1476395008;; @0022 v29 = load.i64 notrap aligned readonly can_move v51+24-;; v95 = band.i32 v19, v73 ; v73 = -8-;; v96 = uextend.i64 v95-;; @0022 v31 = iadd v29, v96+;; v88 = band.i32 v19, v73 ; v73 = -8+;; v89 = uextend.i64 v88+;; @0022 v31 = iadd v29, v89;; @0022 store notrap aligned v74, v31;; @0022 v35 = load.i64 notrap aligned readonly can_move v0+40;; @0022 v36 = load.i32 notrap aligned readonly can_move v35@@ -75,9 +75,9 @@;;;; block5:;; @0022 store.i64 notrap aligned little v2, v45-;; v97 = iconst.i64 8-;; v98 = iadd.i64 v45, v97 ; v97 = 8-;; @0022 jump block4(v98)+;; v90 = iconst.i64 8+;; v91 = iadd.i64 v45, v90 ; v90 = 8+;; @0022 jump block4(v91);;;; block6:;; @0025 jump block1@@ -88,6 +88,6 @@;; @0022 jump block2;;;; block1:-;; v99 = band.i32 v19, v73 ; v73 = -8-;; @0025 return v99+;; v92 = band.i32 v19, v73 ; v73 = -8+;; @0025 return v92;; }