-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
aarch64: Add support for the
extr
instruction (#10229)
* aarch64: Add support for the `extr` instruction This is pattern-matched from `bor` patterns of a specific shape. I found this when doing some benchmarking of Wasmtime on aarch64 and I saw LLVM generating this pattern but Wasmtime didn't. I didn't perform any benchmarking between wasmtime/native though, so I'm just relying on this reducing the number of instructions to probably be a wee bit faster. * Review comments * Fixing tests
- Loading branch information
1 parent
e276d96
commit 0180c3a
Showing
11 changed files
with
342 additions
and
27 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
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
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
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
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
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
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,111 @@ | ||
test compile precise-output | ||
target aarch64 | ||
|
||
function %a64_extr_i32_12(i32, i32) -> i32 { | ||
block0(v0: i32, v1: i32): | ||
v2 = ushr_imm v0, 12 | ||
v3 = ishl_imm v1, 20 | ||
v4 = bor v2, v3 | ||
return v4 | ||
} | ||
|
||
; VCode: | ||
; block0: | ||
; extr w0, w1, w0, LSL 12 | ||
; ret | ||
; | ||
; Disassembled: | ||
; block0: ; offset 0x0 | ||
; extr w0, w1, w0, #0xc | ||
; ret | ||
|
||
function %a64_extr_i32_12_swap(i32, i32) -> i32 { | ||
block0(v0: i32, v1: i32): | ||
v2 = ishl_imm v0, 20 | ||
v3 = ushr_imm v1, 12 | ||
v4 = bor v2, v3 | ||
return v4 | ||
} | ||
|
||
; VCode: | ||
; block0: | ||
; extr w0, w0, w1, LSL 12 | ||
; ret | ||
; | ||
; Disassembled: | ||
; block0: ; offset 0x0 | ||
; extr w0, w0, w1, #0xc | ||
; ret | ||
|
||
function %a64_extr_i32_28(i32, i32) -> i32 { | ||
block0(v0: i32, v1: i32): | ||
v2 = ushr_imm v0, 4 | ||
v3 = ishl_imm v1, 28 | ||
v4 = bor v2, v3 | ||
return v4 | ||
} | ||
|
||
; VCode: | ||
; block0: | ||
; extr w0, w1, w0, LSL 4 | ||
; ret | ||
; | ||
; Disassembled: | ||
; block0: ; offset 0x0 | ||
; extr w0, w1, w0, #4 | ||
; ret | ||
|
||
function %a64_extr_i32_28_swap(i32, i32) -> i32 { | ||
block0(v0: i32, v1: i32): | ||
v2 = ishl_imm v0, 4 | ||
v3 = ushr_imm v1, 28 | ||
v4 = bor v2, v3 | ||
return v4 | ||
} | ||
|
||
; VCode: | ||
; block0: | ||
; extr w0, w0, w1, LSL 28 | ||
; ret | ||
; | ||
; Disassembled: | ||
; block0: ; offset 0x0 | ||
; extr w0, w0, w1, #0x1c | ||
; ret | ||
|
||
function %a64_extr_i64_12(i64, i64) -> i64 { | ||
block0(v0: i64, v1: i64): | ||
v2 = ushr_imm v0, 12 | ||
v3 = ishl_imm v1, 52 | ||
v4 = bor v2, v3 | ||
return v4 | ||
} | ||
|
||
; VCode: | ||
; block0: | ||
; extr x0, x1, x0, LSR 12 | ||
; ret | ||
; | ||
; Disassembled: | ||
; block0: ; offset 0x0 | ||
; extr x0, x1, x0, #0xc | ||
; ret | ||
|
||
function %a64_extr_i64_12_swap(i64, i64) -> i64 { | ||
block0(v0: i64, v1: i64): | ||
v2 = ishl_imm v0, 52 | ||
v3 = ushr_imm v1, 12 | ||
v4 = bor v2, v3 | ||
return v4 | ||
} | ||
|
||
; VCode: | ||
; block0: | ||
; extr x0, x0, x1, LSR 12 | ||
; ret | ||
; | ||
; Disassembled: | ||
; block0: ; offset 0x0 | ||
; extr x0, x0, x1, #0xc | ||
; 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
Oops, something went wrong.