Comment by sylware

1 day ago

I don't feel comfy using duplicate instructions for a 'R'educed instruction set.

That said, I know in some cases it could increase performance since the code would use less memory (and certainly more things which I don't know because I am not into modern advanced hardware CPU micro-architecture design).

It's just an alternative encoding for exactly the same instructions, it does not make the ISA more complex.

If you are writing assembly you probably are using compressed instructions already since your assembler can do the substitions transparently, e.g.

  addi a0,a0,10 -> c.addi a0,10

Example: https://godbolt.org/z/MG3v3jx7P (the disassembly shows addi but the instruction is only two bytes).

They offer a nice reduction in code size with basically no downsides :)

  • I explicitely do disable register ABI alias names, pseudo-instructions and transparent "optimizations", because I run the RISC-V binary in my own x86_64 assembly written little RISC-V machine code interpreter which does support only the core instructions (and a linux syscall translation layer). I may start to add the compressed instructions someday though.