bytecodealliance / bytecodealliance/wasmtime

riscv64: Refactor `Inst::generate_imm`

Open
#6,922 0 comments 1 reaction 0 assignees View on GitHub
cranelift:area:riscv64
Dominant language
Rust
Stars
18.6k
Forks
1.8k
Avg merge
1d 18h
Merged PRs (30d)
126

Description

👋 Hey,

This is a followup from a [comment](https://github.com/bytecodealliance/wasmtime/pull/6915#discussion_r1307848003) from @jameysharp in 6915. `Inst::generate_imm` tries to match a 64 bit constant into a pair of `Imm20` and `Imm12`'s so that we can generate that immediate from a pair of instructions.

The current logic is quite complex and somewhat unreadable, but it doesn't need to be. @jameysharp's version is a lot cleaner, and i suspect is just missing a small fix for a few edge cases. We should clean it up.

This function should be able to generate all 32 bit constants, as well as a good number of 64 bit constants.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.