Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 7742

General • Re: My adventures in bash command line usage of full Hazard3 RISC-V ISA extensions

$
0
0
Hello.
I'm programming in RISCV assembly without the SDK, using the riscv32-unknown-elf-as compiler.

I've run some tests to use the compression options listed in the documentation.

The `Zcmp` option is not accepted because it contains an uppercase letter.

The `zcmp` and `zcb` options are rejected by the compiler.

The `c` option is accepted and does indeed reduce the instruction size.
For example, `li a0,25` translates to the code `01900513` (4 bytes) without the option and `4565` (2 bytes) with the option. However, the reduced instruction `add t0,t1` is still not accepted.

In a small program with a size of 0x35C without the `c` option, the size is reduced to 0x292 bytes with the option.
Sorry for the late reply. Which build of gcc?

Code:

riscv32-unknown-elf-gcc -v
What is listed for --with-arch= ?

I believe GCC optimizes to op codes seen in the binary, but I don't think the assembler supports using them directly from assembly language yet.

Statistics: Posted by breaker — Thu May 28, 2026 6:41 pm



Viewing all articles
Browse latest Browse all 7742

Latest Images

Trending Articles



Latest Images