forked from bytecodealliance/wasmtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
winch(arm64): and, or, xor, shifts (bytecodealliance#8921)
* winch(arm64): and, or, xor, shifts Signed-off-by: Edoardo Vacchi <evacchi@users.noreply.github.com> * fmt Signed-off-by: Edoardo Vacchi <evacchi@users.noreply.github.com> * docs Signed-off-by: Edoardo Vacchi <evacchi@users.noreply.github.com> * shift Signed-off-by: Edoardo Vacchi <evacchi@users.noreply.github.com> * shifts: test cases Signed-off-by: Edoardo Vacchi <evacchi@users.noreply.github.com> * cleanup Signed-off-by: Edoardo Vacchi <evacchi@users.noreply.github.com> * apply first batch of suggestions Signed-off-by: Edoardo Vacchi <evacchi@users.noreply.github.com> * refactor shift operations Signed-off-by: Edoardo Vacchi <evacchi@users.noreply.github.com> * fix doc strings Signed-off-by: Edoardo Vacchi <evacchi@users.noreply.github.com> * Minor cleanups This commit includes very minor clean-ups, these are mechanical changes only. * Rename `shift_rr` to `shift`, as we're still passing the context in, the callee can decide what to do with the instruction arguments. * Delete the un-used `Into<AluOp> for ShiftKind` --------- Signed-off-by: Edoardo Vacchi <evacchi@users.noreply.github.com> Co-authored-by: Saúl Cabrera <saulecabrera@gmail.com>
- Loading branch information
1 parent
88b45a4
commit c69ab34
Showing
68 changed files
with
2,235 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
;;! target = "aarch64" | ||
;;! test = "winch" | ||
|
||
(module | ||
(func (result i32) | ||
(i32.const 1) | ||
(i32.const 2) | ||
(i32.and) | ||
) | ||
) | ||
;; 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 | ||
;; and w0, w0, #2 | ||
;; add sp, sp, #0x10 | ||
;; mov x28, sp | ||
;; ldp x29, x30, [sp], #0x10 | ||
;; ret |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
;;! target = "aarch64" | ||
;;! test = "winch" | ||
|
||
(module | ||
(func (result i32) | ||
(local $foo i32) | ||
(local $bar i32) | ||
|
||
(i32.const 1) | ||
(local.set $foo) | ||
|
||
(i32.const 2) | ||
(local.set $bar) | ||
|
||
(local.get $foo) | ||
(local.get $bar) | ||
(i32.and) | ||
) | ||
) | ||
;; 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] | ||
;; mov x16, #1 | ||
;; mov w0, w16 | ||
;; stur w0, [x28, #4] | ||
;; mov x16, #2 | ||
;; mov w0, w16 | ||
;; stur w0, [x28] | ||
;; ldur w0, [x28] | ||
;; ldur w1, [x28, #4] | ||
;; and w1, w1, w0 | ||
;; mov w0, w1 | ||
;; add sp, sp, #0x18 | ||
;; mov x28, sp | ||
;; ldp x29, x30, [sp], #0x10 | ||
;; ret |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
;;! target = "aarch64" | ||
;;! test = "winch" | ||
|
||
(module | ||
(func (param i32) (param i32) (result i32) | ||
(local.get 0) | ||
(local.get 1) | ||
(i32.and) | ||
) | ||
) | ||
;; 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] | ||
;; ldur w1, [x28, #4] | ||
;; and w1, w1, w0 | ||
;; mov w0, w1 | ||
;; add sp, sp, #0x18 | ||
;; mov x28, sp | ||
;; ldp x29, x30, [sp], #0x10 | ||
;; ret |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
;;! target = "aarch64" | ||
;;! test = "winch" | ||
|
||
(module | ||
(func (result i32) | ||
(i32.const 1) | ||
(i32.const 2) | ||
(i32.or) | ||
) | ||
) | ||
;; 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 | ||
;; orr w0, w0, #2 | ||
;; add sp, sp, #0x10 | ||
;; mov x28, sp | ||
;; ldp x29, x30, [sp], #0x10 | ||
;; ret |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
;;! target = "aarch64" | ||
;;! test = "winch" | ||
|
||
(module | ||
(func (result i32) | ||
(local $foo i32) | ||
(local $bar i32) | ||
|
||
(i32.const 1) | ||
(local.set $foo) | ||
|
||
(i32.const 2) | ||
(local.set $bar) | ||
|
||
(local.get $foo) | ||
(local.get $bar) | ||
(i32.or) | ||
) | ||
) | ||
;; 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] | ||
;; mov x16, #1 | ||
;; mov w0, w16 | ||
;; stur w0, [x28, #4] | ||
;; mov x16, #2 | ||
;; mov w0, w16 | ||
;; stur w0, [x28] | ||
;; ldur w0, [x28] | ||
;; ldur w1, [x28, #4] | ||
;; orr w1, w1, w0 | ||
;; mov w0, w1 | ||
;; add sp, sp, #0x18 | ||
;; mov x28, sp | ||
;; ldp x29, x30, [sp], #0x10 | ||
;; ret |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
;;! target = "aarch64" | ||
;;! test = "winch" | ||
|
||
(module | ||
(func (param i32) (param i32) (result i32) | ||
(local.get 0) | ||
(local.get 1) | ||
(i32.or) | ||
) | ||
) | ||
;; 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] | ||
;; ldur w1, [x28, #4] | ||
;; orr w1, w1, w0 | ||
;; mov w0, w1 | ||
;; add sp, sp, #0x18 | ||
;; mov x28, sp | ||
;; ldp x29, x30, [sp], #0x10 | ||
;; ret |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
;;! target = "aarch64" | ||
;;! test = "winch" | ||
|
||
(module | ||
(func (result i32) | ||
(i32.const 1) | ||
(i32.const 512) | ||
(i32.rotl) | ||
) | ||
) | ||
;; 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 | ||
;; sub w0, w0, wzr | ||
;; mov x16, #0x200 | ||
;; ror w0, w0, w16 | ||
;; add sp, sp, #0x10 | ||
;; mov x28, sp | ||
;; ldp x29, x30, [sp], #0x10 | ||
;; ret |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
;;! target = "aarch64" | ||
;;! test = "winch" | ||
|
||
(module | ||
(func (result i32) | ||
(i32.const 1) | ||
(i32.const 2) | ||
(i32.rotl) | ||
) | ||
) | ||
;; 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 | ||
;; sub w0, w0, wzr | ||
;; ror w0, w0, #2 | ||
;; add sp, sp, #0x10 | ||
;; mov x28, sp | ||
;; ldp x29, x30, [sp], #0x10 | ||
;; ret |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
;;! target = "aarch64" | ||
;;! test = "winch" | ||
|
||
(module | ||
(func (result i32) | ||
(local $foo i32) | ||
(local $bar i32) | ||
|
||
(i32.const 1) | ||
(local.set $foo) | ||
|
||
(i32.const 2) | ||
(local.set $bar) | ||
|
||
(local.get $foo) | ||
(local.get $bar) | ||
(i32.rotl) | ||
) | ||
) | ||
;; 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] | ||
;; mov x16, #1 | ||
;; mov w0, w16 | ||
;; stur w0, [x28, #4] | ||
;; mov x16, #2 | ||
;; mov w0, w16 | ||
;; stur w0, [x28] | ||
;; ldur w0, [x28] | ||
;; ldur w1, [x28, #4] | ||
;; sub w0, w0, wzr | ||
;; ror w1, w1, w0 | ||
;; mov w0, w1 | ||
;; add sp, sp, #0x18 | ||
;; mov x28, sp | ||
;; ldp x29, x30, [sp], #0x10 | ||
;; ret |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
;;! target = "aarch64" | ||
;;! test = "winch" | ||
|
||
(module | ||
(func (param i32) (param i32) (result i32) | ||
(local.get 0) | ||
(local.get 1) | ||
(i32.rotl) | ||
) | ||
) | ||
;; 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] | ||
;; ldur w1, [x28, #4] | ||
;; sub w0, w0, wzr | ||
;; ror w1, w1, w0 | ||
;; mov w0, w1 | ||
;; add sp, sp, #0x18 | ||
;; mov x28, sp | ||
;; ldp x29, x30, [sp], #0x10 | ||
;; ret |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
;;! target = "aarch64" | ||
;;! test = "winch" | ||
|
||
(module | ||
(func (result i32) | ||
(i32.const 1) | ||
(i32.const 512) | ||
(i32.rotr) | ||
) | ||
) | ||
;; 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 | ||
;; mov x16, #0x200 | ||
;; ror w0, w0, w16 | ||
;; add sp, sp, #0x10 | ||
;; mov x28, sp | ||
;; ldp x29, x30, [sp], #0x10 | ||
;; ret |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
;;! target = "aarch64" | ||
;;! test = "winch" | ||
|
||
(module | ||
(func (result i32) | ||
(i32.const 1) | ||
(i32.const 2) | ||
(i32.rotr) | ||
) | ||
) | ||
;; 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 | ||
;; ror w0, w0, #2 | ||
;; add sp, sp, #0x10 | ||
;; mov x28, sp | ||
;; ldp x29, x30, [sp], #0x10 | ||
;; ret |
Oops, something went wrong.