Comment by Pet_Ant
Comment by Pet_Ant 10 months ago
In the "Why MIPS?" section:
> some have shitty addressing modes necessitating that they would be slow (RISCV)
What is wrong with the RISC-V addressing modes?
Comment by Pet_Ant 10 months ago
In the "Why MIPS?" section:
> some have shitty addressing modes necessitating that they would be slow (RISCV)
What is wrong with the RISC-V addressing modes?
Okay, so it's more about IMM representation within the bytecode rather than some memory addressing mode.
Well, lack of REG+REG and REG+SHIFTED_REG addressing modes handicaps it significantly. And no, it will not get magically fused by magic fusing fairies in your cpu
> Well, lack of REG+REG and REG+SHIFTED_REG addressing modes handicaps it significantly.
Does it? Well, there's a vendor specific extension for that (XTheadMemIdx):
https://github.com/XUANTIE-RV/thead-extension-spec/releases/...
Not sure about GCC, but on clang it is trivial to enable it. And if you really want to (assuming you have the hardware) you could compile exactly the same code with and without it and compare how much exactly it is handicapped if those instructions are not there.
Plus, on RISC-V multiplication/division (about which you've complained) is optional, and there is also a variant of RISC-V with only 16 registers instead of 32 (also very simple to enable on recent versions of clang, although Linux would probably need some modifications to be able to run on that).
So I'm not entirely convinced that RISC-V would be worse here.
It's not really the addressing modes, but the instruction format. Immediate values on RISC-V are not stored contiguously on certain RISC-V instructions.
On all MIPS instructions, the bits for a immediate add, load constant, branch, etc value are always stored in order.
On RISC-V, the bits are (sometimes) jumbled around. For example, on a unconditional branch, the bits for the destination offset are stored in the order of bit 19, bits 9-0, bit 10, bits 18-11. In hardware, reordering that is free, you just run your wires the right way to decode it. In software, you have to do a ton of bit manipulation to fix it up.
The reason RISC-V does that is to simplify the hardware design.