Stream: git-wasmtime

Topic: wasmtime / PR #7113 riscv64: Improve icmp codegen


view this post on Zulip Wasmtime GitHub notifications bot (Sep 29 2023 at 16:35):

alexcrichton opened PR #7113 from alexcrichton:rv64-branches to bytecodealliance:main:

I've been curious to poke around more at riscv64 and it looks like the
handling of branches/comparisons can be improved in our backend, so this
is the first of what may be a number of commits to improve the situation
here. This commit specifically targets the icmp Cranelift instruction
when producing a 0 or 1 value as a result. This is unlikely to be used
all that much in normal programs since most of the time a comparison is
fed into a branch for example.

Nevertheless I was hoping to start simple and work my way out towards
branches eventually. My hope is that by improving this codegen this can
be extracted to helpers later on to assist branches and various other
lowerings.

One part that this commit removes is various sign-extensions around
icmp because, at least according to RISC-V's ABI, values are always
sign extended when sitting at rest in their registers. I'm not sure if
Cranelift respects this everywhere just yet, but it seems like a good
rule of thumb to follow and if it causes issues it may be best to track
down other lowering rules to fix the problems.

Additionally this does not update icmp for 128-bit integers just yet.
This is only the comparisons necessary for register-size values or
smaller.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 29 2023 at 16:35):

alexcrichton requested afonso360 for a review on PR #7113.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 29 2023 at 16:35):

alexcrichton requested elliottt for a review on PR #7113.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 29 2023 at 16:35):

alexcrichton requested wasmtime-compiler-reviewers for a review on PR #7113.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 29 2023 at 19:56):

alexcrichton closed without merge PR #7113.


Last updated: Oct 23 2024 at 20:03 UTC