-
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.
riscv64: Refactor and improve some rotate-related codegen (#7251)
* riscv64: Refactor `rotl` rules Move from `inst.isle` to `lower.isle` since it's the only caller, reorganize the rules to be a bit cleaner, add immediate shifting specializations. * riscv64: Refactor `rotr` lowerings Same as the prior `rotl` lowerings, move the rules to `lower.isle` and additionally add constant rules. * Fix shift-by-128 * Remove empty comments
- Loading branch information
1 parent
f24abd2
commit fe7f060
Showing
3 changed files
with
191 additions
and
157 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
;;! target = "riscv64" | ||
;;! compile = true | ||
;;! settings = ["has_zbb", "opt_level=speed"] | ||
|
||
(module | ||
(func (export "rolw") (param i32 i32) (result i32) | ||
(i32.rotl (local.get 0) (local.get 1))) | ||
(func (export "rol") (param i64 i64) (result i64) | ||
(i64.rotl (local.get 0) (local.get 1))) | ||
(func (export "rolwi") (param i32 ) (result i32) | ||
(i32.rotl (local.get 0) (i32.const 100))) | ||
(func (export "roli") (param i64) (result i64) | ||
(i64.rotl (local.get 0) (i64.const 40))) | ||
|
||
(func (export "rorw") (param i32 i32) (result i32) | ||
(i32.rotr (local.get 0) (local.get 1))) | ||
(func (export "ror") (param i64 i64) (result i64) | ||
(i64.rotr (local.get 0) (local.get 1))) | ||
(func (export "rorwi") (param i32 ) (result i32) | ||
(i32.rotr (local.get 0) (i32.const 100))) | ||
(func (export "rori") (param i64) (result i64) | ||
(i64.rotr (local.get 0) (i64.const 40))) | ||
) | ||
|
||
;; function u0:0: | ||
;; block0: | ||
;; j label1 | ||
;; block1: | ||
;; rolw a0,a0,a1 | ||
;; ret | ||
;; | ||
;; function u0:1: | ||
;; block0: | ||
;; j label1 | ||
;; block1: | ||
;; rol a0,a0,a1 | ||
;; ret | ||
;; | ||
;; function u0:2: | ||
;; block0: | ||
;; j label1 | ||
;; block1: | ||
;; roriw a0,a0,28 | ||
;; ret | ||
;; | ||
;; function u0:3: | ||
;; block0: | ||
;; j label1 | ||
;; block1: | ||
;; rori a0,a0,24 | ||
;; ret | ||
;; | ||
;; function u0:4: | ||
;; block0: | ||
;; j label1 | ||
;; block1: | ||
;; rorw a0,a0,a1 | ||
;; ret | ||
;; | ||
;; function u0:5: | ||
;; block0: | ||
;; j label1 | ||
;; block1: | ||
;; ror a0,a0,a1 | ||
;; ret | ||
;; | ||
;; function u0:6: | ||
;; block0: | ||
;; j label1 | ||
;; block1: | ||
;; roriw a0,a0,100 | ||
;; ret | ||
;; | ||
;; function u0:7: | ||
;; block0: | ||
;; j label1 | ||
;; block1: | ||
;; rori a0,a0,40 | ||
;; ret |