RISC-V: deduplicate Lui, CLui; support Li in JIT
- Closes RV-492
What
- We support
Liopcode in the JIT - Deduplicate all the 'load imm' opcodes
Secondly, while doing this
Why
- this means we can start to write more coherent unit tests (e.g. can use
Lito set an xregister to an initial value, rather than needing to manually write it. - execution wise, they're identical - they only differ in behaviour in the parser.
NB CLi was already previously deduplicated into Li, which is why it does not appear in the diff.
How
required support for immediates in the JIT. We do this via a new xvalue_of_imm function in the ICB. This then allows the immediate to be used like any other XValue (which come from the xregisters).
In future, we could take advantage of this and use xvalues that came from 'imm's with the dedicated 'immediate' instructions that cranelift offers.
Manually Testing
make -C src/riscv all
Benchmarking
master |
This MR | Improvement | |
|---|---|---|---|
| AMD Ryzen 7 7840U | X.XXX TPS | X.XXX TPS | -0.50% |
| Benchmark Machine | 3.409 TPS | 3.425 TPS | +0.47% |
Regressions
Regressions have occurred as a result of deduplication - namely some entries in the block cache will now contain Li opcode rather than CLui / CLi
Tasks for the Author
-
Link all Linear issues related to this MR using magic words (e.g. part of, relates to, closes). -
Eliminate dead code and other spurious artefacts introduced in your changes. -
Document new public functions, methods and types. -
Make sure the documentation for updated functions, methods, and types is correct. -
Add tests for bugs that have been fixed. -
Put in reasonable effort to ensure that CI will pass. make -C src/riscvdune build src/lib_riscvdune build src/rust_deps
-
Benchmark performance and populate the table above if needed. -
Explain changes to regression test captures when applicable. -
Write commit messages to reflect the changes they're about. -
Self-review your changes to ensure they are high-quality. -
Complete all of the above before assigning this MR to reviewers.
Edited by Emma Turner