[llvm] [clang] [RISCV] CodeGen of RVE and ilp32e/lp64e ABIs (PR #76777)

via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 4 09:57:20 PST 2024


koute wrote:

> But I think this patch can work just fine [...] Apart from vendors' need, the request is mainly from Rust language community I think.

To put our 3 cents here, [we](https://github.com/paritytech) also need it. We are (well, it's mostly me right now since it's still a prototype) currently building [a virtual machine that is based on RV32E](https://github.com/koute/polkavm) (and in the future also RV64E), and, long story short, thanks to the magic of RV32E it achieves execution performance roughly the same as [wasmtime](https://github.com/bytecodealliance/wasmtime) (which is a state-of-art WASM VM) while compiling into native code over ~200 times faster and being orders of magnitude simpler (because you can mostly naively translate RV32E machine code 1-to-1 into native AMD64 code as the reduced number of registers makes this barely possible, and the code is still very fast).

As far as testing this patch, as a fairly decent test case I've used one of the previous versions to compile DOOM into RV32E and ran it under our VM (in fact, [you can play it here it you want](https://github.com/koute/polkavm/tree/master/examples/doom)), so the patch definitely works.

Anyway, people are underestimating RV32E thinking it's only for bottom tier microcontrollers, but this couldn't be further from the truth. It's not perfect, but it's also a really great VM bytecode; dare I say, I think it's a better WASM than WASM for non-Web uses.

https://github.com/llvm/llvm-project/pull/76777


More information about the cfe-commits mailing list