Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Winch aarch64 jmp #9051

Merged
merged 5 commits into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions tests/disas/winch/aarch64/br/as_br_if_cond.wat
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
;;! target = "aarch64"
;;! test = "winch"
(module
(func (export "as-br_if-cond")
(block (br_if 0 (br 0)))
)
)
;; wasm[0]::function[0]:
;; stp x29, x30, [sp, #-0x10]!
;; mov x29, sp
;; mov x28, sp
;; mov x9, x0
;; sub sp, sp, #0x10
;; mov x28, sp
;; stur x0, [x28, #8]
;; stur x1, [x28]
;; add sp, sp, #0x10
;; mov x28, sp
;; ldp x29, x30, [sp], #0x10
;; ret
22 changes: 22 additions & 0 deletions tests/disas/winch/aarch64/br/as_br_value.wat
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
;;! target = "aarch64"
;;! test = "winch"
(module
(func (export "as-br-value") (result i32)
(block (result i32) (br 0 (br 0 (i32.const 9))))
)
)
;; wasm[0]::function[0]:
;; stp x29, x30, [sp, #-0x10]!
;; mov x29, sp
;; mov x28, sp
;; mov x9, x0
;; sub sp, sp, #0x10
;; mov x28, sp
;; stur x0, [x28, #8]
;; stur x1, [x28]
;; mov x16, #9
;; mov w0, w16
;; add sp, sp, #0x10
;; mov x28, sp
;; ldp x29, x30, [sp], #0x10
;; ret
27 changes: 27 additions & 0 deletions tests/disas/winch/aarch64/br/as_if_cond.wat
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
;;! target = "aarch64"
;;! test = "winch"
(module
(func (export "as-if-cond") (result i32)
(block (result i32)
(if (result i32) (br 0 (i32.const 2))
(then (i32.const 0))
(else (i32.const 1))
)
)
)
)
;; wasm[0]::function[0]:
;; stp x29, x30, [sp, #-0x10]!
;; mov x29, sp
;; mov x28, sp
;; mov x9, x0
;; sub sp, sp, #0x10
;; mov x28, sp
;; stur x0, [x28, #8]
;; stur x1, [x28]
;; mov x16, #2
;; mov w0, w16
;; add sp, sp, #0x10
;; mov x28, sp
;; ldp x29, x30, [sp], #0x10
;; ret
35 changes: 35 additions & 0 deletions tests/disas/winch/aarch64/br/as_if_else.wat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
;;! target = "aarch64"
;;! test = "winch"
(module
(func (export "as-if-else") (param i32 i32) (result i32)
(block (result i32)
(if (result i32) (local.get 0)
(then (local.get 1))
(else (br 1 (i32.const 4)))
)
)
)
)
;; wasm[0]::function[0]:
;; stp x29, x30, [sp, #-0x10]!
;; mov x29, sp
;; mov x28, sp
;; mov x9, x0
;; sub sp, sp, #0x18
;; mov x28, sp
;; stur x0, [x28, #0x10]
;; stur x1, [x28, #8]
;; stur w2, [x28, #4]
;; stur w3, [x28]
;; ldur w0, [x28, #4]
;; tst w0, w0
;; b.eq #0x40
;; b #0x38
;; 38: ldur w0, [x28]
;; b #0x48
;; 40: mov x16, #4
;; mov w0, w16
;; add sp, sp, #0x18
;; mov x28, sp
;; ldp x29, x30, [sp], #0x10
;; ret
35 changes: 35 additions & 0 deletions tests/disas/winch/aarch64/br/as_if_then.wat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
;;! target = "aarch64"
;;! test = "winch"
(module
(func (export "as-if-then") (param i32 i32) (result i32)
(block (result i32)
(if (result i32) (local.get 0)
(then (br 1 (i32.const 3)))
(else (local.get 1))
)
)
)
)
;; wasm[0]::function[0]:
;; stp x29, x30, [sp, #-0x10]!
;; mov x29, sp
;; mov x28, sp
;; mov x9, x0
;; sub sp, sp, #0x18
;; mov x28, sp
;; stur x0, [x28, #0x10]
;; stur x1, [x28, #8]
;; stur w2, [x28, #4]
;; stur w3, [x28]
;; ldur w0, [x28, #4]
;; tst w0, w0
;; b.eq #0x44
;; b #0x38
;; 38: mov x16, #3
;; mov w0, w16
;; b #0x48
;; 44: ldur w0, [x28]
;; add sp, sp, #0x18
;; mov x28, sp
;; ldp x29, x30, [sp], #0x10
;; ret
23 changes: 23 additions & 0 deletions tests/disas/winch/aarch64/br/as_loop_first.wat
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
;;! target = "aarch64"
;;! test = "winch"

(module
(func (export "as-loop-first") (result i32)
(block (result i32) (loop (result i32) (br 1 (i32.const 3)) (i32.const 2)))
)
)
;; wasm[0]::function[0]:
;; stp x29, x30, [sp, #-0x10]!
;; mov x29, sp
;; mov x28, sp
;; mov x9, x0
;; sub sp, sp, #0x10
;; mov x28, sp
;; stur x0, [x28, #8]
;; stur x1, [x28]
;; mov x16, #3
;; mov w0, w16
;; add sp, sp, #0x10
;; mov x28, sp
;; ldp x29, x30, [sp], #0x10
;; ret
41 changes: 41 additions & 0 deletions tests/disas/winch/aarch64/br/br_jump.wat
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
;;! target = "aarch64"
;;! test = "winch"
(module
(func (;0;) (result i32)
(local i32)
local.get 0
loop ;; label = @1
local.get 0
block ;; label = @2
end
br 0 (;@1;)
end
)
(export "" (func 0))
)
;; wasm[0]::function[0]:
;; stp x29, x30, [sp, #-0x10]!
;; mov x29, sp
;; mov x28, sp
;; mov x9, x0
;; sub sp, sp, #0x18
;; mov x28, sp
;; stur x0, [x28, #0x10]
;; stur x1, [x28, #8]
;; mov x16, #0
;; stur x16, [x28]
;; ldur w16, [x28, #4]
;; sub sp, sp, #8
;; mov x28, sp
;; stur x16, [x28, #8]
;; ldur w16, [x28, #0xc]
;; sub sp, sp, #8
;; mov x28, sp
;; stur x16, [x28, #8]
;; add sp, sp, #8
;; mov x28, sp
;; b #0x38
;; 54: add sp, sp, #0x18
;; mov x28, sp
;; ldp x29, x30, [sp], #0x10
;; ret
30 changes: 30 additions & 0 deletions tests/disas/winch/aarch64/br_if/as_br_if_cond.wat
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
;;! target = "aarch64"
;;! test = "winch"
(module
(func (export "as-br-if-cond")
(block (br_if 0 (br_if 0 (i32.const 1) (i32.const 1))))
)
)
;; wasm[0]::function[0]:
;; stp x29, x30, [sp, #-0x10]!
;; mov x29, sp
;; mov x28, sp
;; mov x9, x0
;; sub sp, sp, #0x10
;; mov x28, sp
;; stur x0, [x28, #8]
;; stur x1, [x28]
;; mov x16, #1
;; mov w0, w16
;; tst w0, w0
;; b.ne #0x48
;; b #0x34
;; 34: mov x16, #1
;; mov w0, w16
;; tst w0, w0
;; b.ne #0x48
;; b #0x48
;; 48: add sp, sp, #0x10
;; mov x28, sp
;; ldp x29, x30, [sp], #0x10
;; ret
27 changes: 27 additions & 0 deletions tests/disas/winch/aarch64/br_if/as_br_value.wat
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
;;! target = "aarch64"
;;! test = "winch"
(module
(func (export "as-br-value") (result i32)
(block (result i32) (br 0 (br_if 0 (i32.const 1) (i32.const 2))))
)
)
;; wasm[0]::function[0]:
;; stp x29, x30, [sp, #-0x10]!
;; mov x29, sp
;; mov x28, sp
;; mov x9, x0
;; sub sp, sp, #0x10
;; mov x28, sp
;; stur x0, [x28, #8]
;; stur x1, [x28]
;; mov x16, #2
;; mov w1, w16
;; mov x16, #1
;; mov w0, w16
;; tst w1, w1
;; b.ne #0x3c
;; b #0x3c
;; 3c: add sp, sp, #0x10
;; mov x28, sp
;; ldp x29, x30, [sp], #0x10
;; ret
41 changes: 41 additions & 0 deletions tests/disas/winch/aarch64/br_if/as_if_cond.wat
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
;;! target = "aarch64"
;;! test = "winch"
(module
(func (export "as-if-cond") (param i32) (result i32)
(block (result i32)
(if (result i32)
(br_if 0 (i32.const 1) (local.get 0))
(then (i32.const 2))
(else (i32.const 3))
)
)
)
)
;; wasm[0]::function[0]:
;; stp x29, x30, [sp, #-0x10]!
;; mov x29, sp
;; mov x28, sp
;; mov x9, x0
;; sub sp, sp, #0x18
;; mov x28, sp
;; stur x0, [x28, #0x10]
;; stur x1, [x28, #8]
;; stur w2, [x28, #4]
;; ldur w1, [x28, #4]
;; mov x16, #1
;; mov w0, w16
;; tst w1, w1
;; b.ne #0x5c
;; b #0x3c
;; 3c: tst w0, w0
;; b.eq #0x54
;; b #0x48
;; 48: mov x16, #2
;; mov w0, w16
;; b #0x5c
;; 54: mov x16, #3
;; mov w0, w16
;; add sp, sp, #0x18
;; mov x28, sp
;; ldp x29, x30, [sp], #0x10
;; ret
37 changes: 37 additions & 0 deletions tests/disas/winch/aarch64/br_if/as_local_set_value.wat
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
;;! target = "aarch64"
;;! test = "winch"
(module
(func (export "as-local-set-value") (param i32) (result i32)
(local i32)
(block (result i32)
(local.set 0 (br_if 0 (i32.const 17) (local.get 0)))
(i32.const -1)
)
)
)
;; wasm[0]::function[0]:
;; stp x29, x30, [sp, #-0x10]!
;; mov x29, sp
;; mov x28, sp
;; mov x9, x0
;; sub sp, sp, #0x18
;; mov x28, sp
;; stur x0, [x28, #0x10]
;; stur x1, [x28, #8]
;; stur w2, [x28, #4]
;; mov x16, #0
;; stur w16, [x28]
;; mov x16, #0
;; ldur w1, [x28, #4]
;; mov x16, #0x11
;; mov w0, w16
;; tst w1, w1
;; b.ne #0x54
;; b #0x48
;; 48: stur w0, [x28, #4]
;; orr x16, xzr, #0xffffffff
;; mov w0, w16
;; add sp, sp, #0x18
;; mov x28, sp
;; ldp x29, x30, [sp], #0x10
;; ret
Loading