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: Implement rem for aarch64 (bytecodealliance#9781)
* implement copy/clone for RemKind * implement remainder operation for aarch64 * add tests * fmt pass * review edits
- Loading branch information
1 parent
0fabffe
commit da41a55
Showing
23 changed files
with
750 additions
and
3 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,35 @@ | ||
;;! target = "aarch64" | ||
;;! test = "winch" | ||
|
||
(module | ||
(func (result i32) | ||
(i32.const 7) | ||
(i32.const 5) | ||
(i32.rem_s) | ||
) | ||
) | ||
|
||
;; 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, #5 | ||
;; mov w0, w16 | ||
;; mov x16, #7 | ||
;; mov w1, w16 | ||
;; cbz x0, #0x58 | ||
;; 34: sxtw x0, w0 | ||
;; sxtw x1, w1 | ||
;; sdiv x16, x1, x0 | ||
;; msub x1, x0, x16, x1 | ||
;; mov w0, w1 | ||
;; add sp, sp, #0x10 | ||
;; mov x28, sp | ||
;; ldp x29, x30, [sp], #0x10 | ||
;; ret | ||
;; 58: .byte 0x1f, 0xc1, 0x00, 0x00 |
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,35 @@ | ||
;;! target = "aarch64" | ||
;;! test = "winch" | ||
|
||
(module | ||
(func (result i32) | ||
(i32.const 1) | ||
(i32.const 0) | ||
(i32.rem_s) | ||
) | ||
) | ||
|
||
;; 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, #0 | ||
;; mov w0, w16 | ||
;; mov x16, #1 | ||
;; mov w1, w16 | ||
;; cbz x0, #0x58 | ||
;; 34: sxtw x0, w0 | ||
;; sxtw x1, w1 | ||
;; sdiv x16, x1, x0 | ||
;; msub x1, x0, x16, x1 | ||
;; mov w0, w1 | ||
;; add sp, sp, #0x10 | ||
;; mov x28, sp | ||
;; ldp x29, x30, [sp], #0x10 | ||
;; ret | ||
;; 58: .byte 0x1f, 0xc1, 0x00, 0x00 |
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,35 @@ | ||
;;! target = "aarch64" | ||
;;! test = "winch" | ||
|
||
(module | ||
(func (result i32) | ||
(i32.const 0x80000000) | ||
(i32.const -1) | ||
(i32.rem_s) | ||
) | ||
) | ||
|
||
;; 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] | ||
;; orr x16, xzr, #0xffffffff | ||
;; mov w0, w16 | ||
;; mov x16, #0x80000000 | ||
;; mov w1, w16 | ||
;; cbz x0, #0x58 | ||
;; 34: sxtw x0, w0 | ||
;; sxtw x1, w1 | ||
;; sdiv x16, x1, x0 | ||
;; msub x1, x0, x16, x1 | ||
;; mov w0, w1 | ||
;; add sp, sp, #0x10 | ||
;; mov x28, sp | ||
;; ldp x29, x30, [sp], #0x10 | ||
;; ret | ||
;; 58: .byte 0x1f, 0xc1, 0x00, 0x00 |
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,35 @@ | ||
;;! target = "aarch64" | ||
;;! test = "winch" | ||
|
||
(module | ||
(func (param i32) (param i32) (result i32) | ||
(local.get 0) | ||
(local.get 1) | ||
(i32.rem_s) | ||
) | ||
) | ||
|
||
;; 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] | ||
;; cbz x0, #0x58 | ||
;; 34: sxtw x0, w0 | ||
;; sxtw x1, w1 | ||
;; sdiv x16, x1, x0 | ||
;; msub x1, x0, x16, x1 | ||
;; mov w0, w1 | ||
;; add sp, sp, #0x18 | ||
;; mov x28, sp | ||
;; ldp x29, x30, [sp], #0x10 | ||
;; ret | ||
;; 58: .byte 0x1f, 0xc1, 0x00, 0x00 |
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,35 @@ | ||
;;! target = "aarch64" | ||
;;! test = "winch" | ||
|
||
(module | ||
(func (result i32) | ||
(i32.const 0) | ||
(i32.const 0) | ||
(i32.rem_s) | ||
) | ||
) | ||
|
||
;; 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, #0 | ||
;; mov w0, w16 | ||
;; mov x16, #0 | ||
;; mov w1, w16 | ||
;; cbz x0, #0x58 | ||
;; 34: sxtw x0, w0 | ||
;; sxtw x1, w1 | ||
;; sdiv x16, x1, x0 | ||
;; msub x1, x0, x16, x1 | ||
;; mov w0, w1 | ||
;; add sp, sp, #0x10 | ||
;; mov x28, sp | ||
;; ldp x29, x30, [sp], #0x10 | ||
;; ret | ||
;; 58: .byte 0x1f, 0xc1, 0x00, 0x00 |
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,35 @@ | ||
;;! target = "aarch64" | ||
;;! test = "winch" | ||
|
||
(module | ||
(func (result i32) | ||
(i32.const 7) | ||
(i32.const 5) | ||
(i32.rem_u) | ||
) | ||
) | ||
|
||
;; 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, #5 | ||
;; mov w0, w16 | ||
;; mov x16, #7 | ||
;; mov w1, w16 | ||
;; cbz x0, #0x58 | ||
;; 34: mov w0, w0 | ||
;; mov w1, w1 | ||
;; udiv x16, x1, x0 | ||
;; msub x1, x0, x16, x1 | ||
;; mov w0, w1 | ||
;; add sp, sp, #0x10 | ||
;; mov x28, sp | ||
;; ldp x29, x30, [sp], #0x10 | ||
;; ret | ||
;; 58: .byte 0x1f, 0xc1, 0x00, 0x00 |
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,35 @@ | ||
;;! target = "aarch64" | ||
;;! test = "winch" | ||
|
||
(module | ||
(func (result i32) | ||
(i32.const 1) | ||
(i32.const 0) | ||
(i32.rem_u) | ||
) | ||
) | ||
|
||
;; 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, #0 | ||
;; mov w0, w16 | ||
;; mov x16, #1 | ||
;; mov w1, w16 | ||
;; cbz x0, #0x58 | ||
;; 34: mov w0, w0 | ||
;; mov w1, w1 | ||
;; udiv x16, x1, x0 | ||
;; msub x1, x0, x16, x1 | ||
;; mov w0, w1 | ||
;; add sp, sp, #0x10 | ||
;; mov x28, sp | ||
;; ldp x29, x30, [sp], #0x10 | ||
;; ret | ||
;; 58: .byte 0x1f, 0xc1, 0x00, 0x00 |
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,35 @@ | ||
;;! target = "aarch64" | ||
;;! test = "winch" | ||
|
||
(module | ||
(func (param i32) (param i32) (result i32) | ||
(local.get 0) | ||
(local.get 1) | ||
(i32.rem_u) | ||
) | ||
) | ||
|
||
;; 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] | ||
;; cbz x0, #0x58 | ||
;; 34: mov w0, w0 | ||
;; mov w1, w1 | ||
;; udiv x16, x1, x0 | ||
;; msub x1, x0, x16, x1 | ||
;; mov w0, w1 | ||
;; add sp, sp, #0x18 | ||
;; mov x28, sp | ||
;; ldp x29, x30, [sp], #0x10 | ||
;; ret | ||
;; 58: .byte 0x1f, 0xc1, 0x00, 0x00 |
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,35 @@ | ||
;;! target = "aarch64" | ||
;;! test = "winch" | ||
|
||
(module | ||
(func (result i32) | ||
(i32.const -1) | ||
(i32.const -1) | ||
(i32.rem_u) | ||
) | ||
) | ||
|
||
;; 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] | ||
;; orr x16, xzr, #0xffffffff | ||
;; mov w0, w16 | ||
;; orr x16, xzr, #0xffffffff | ||
;; mov w1, w16 | ||
;; cbz x0, #0x58 | ||
;; 34: mov w0, w0 | ||
;; mov w1, w1 | ||
;; udiv x16, x1, x0 | ||
;; msub x1, x0, x16, x1 | ||
;; mov w0, w1 | ||
;; add sp, sp, #0x10 | ||
;; mov x28, sp | ||
;; ldp x29, x30, [sp], #0x10 | ||
;; ret | ||
;; 58: .byte 0x1f, 0xc1, 0x00, 0x00 |
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,35 @@ | ||
;;! target = "aarch64" | ||
;;! test = "winch" | ||
|
||
(module | ||
(func (result i32) | ||
(i32.const 0) | ||
(i32.const 0) | ||
(i32.rem_u) | ||
) | ||
) | ||
|
||
;; 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, #0 | ||
;; mov w0, w16 | ||
;; mov x16, #0 | ||
;; mov w1, w16 | ||
;; cbz x0, #0x58 | ||
;; 34: mov w0, w0 | ||
;; mov w1, w1 | ||
;; udiv x16, x1, x0 | ||
;; msub x1, x0, x16, x1 | ||
;; mov w0, w1 | ||
;; add sp, sp, #0x10 | ||
;; mov x28, sp | ||
;; ldp x29, x30, [sp], #0x10 | ||
;; ret | ||
;; 58: .byte 0x1f, 0xc1, 0x00, 0x00 |
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,33 @@ | ||
;;! target = "aarch64" | ||
;;! test = "winch" | ||
|
||
(module | ||
(func (result i64) | ||
(i64.const 7) | ||
(i64.const 5) | ||
(i64.rem_s) | ||
) | ||
) | ||
|
||
;; 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, #5 | ||
;; mov x0, x16 | ||
;; mov x16, #7 | ||
;; mov x1, x16 | ||
;; cbz x0, #0x50 | ||
;; 34: sdiv x16, x1, x0 | ||
;; msub x1, x0, x16, x1 | ||
;; mov x0, x1 | ||
;; add sp, sp, #0x10 | ||
;; mov x28, sp | ||
;; ldp x29, x30, [sp], #0x10 | ||
;; ret | ||
;; 50: .byte 0x1f, 0xc1, 0x00, 0x00 |
Oops, something went wrong.