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.
riscv64: Refactor implementation of
{u,s}{div,rem}
(bytecodeallianc…
…e#7136) * riscv64: Refactor implementation of `{u,s}{div,rem}` This commit's goal is to remove the usage of `gen_icmp` with division-related instructions in the riscv64 backend. I've opted for a slightly more verbose approach than what was present prior to make sign/zero extensions more precise and additionally enable some immediate-related optimizations. Divison/remainder by an immediate will no longer emit checks to see if a trap needs to be emitted. Instead only the raw `div`/`rem` instructions are emitted. Additionally a few minor sign extensions are now avoided such as the dividend in 32-bit remainders/division because only the low 32-bits are inspected. Finally, while I was here, I went ahead an added `has_m` guards to all these lowering rules. The M extension is always required with riscv64 right now and won't work if it's turned off, but I figure it's not too bad to add in terms of completeness for now. As to the meat of the commit, the check for trapping value as part of division now happens without `gen_icmp` but instead `gen_trapif` which enables avoiding materializing the comparison's value into a register. * Fix tests
- Loading branch information
1 parent
9d34197
commit c927662
Showing
4 changed files
with
199 additions
and
256 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
Oops, something went wrong.