xpack-riscv-none-elf-gcc-13.2.0-2/bin/riscv-none-elf-gcc -c -march=rv32i main.c
xpack-riscv-none-elf-gcc-13.2.0-2/bin/riscv-none-elf-objdump -d -M no-aliases,numeric main.o
main.o: file format elf32-littleriscv
Disassembly of section .text:
00000000 <main>:
0: fe010113 addi x2,x2,-32
4: 00812e23 sw x8,28(x2)
8: 02010413 addi x8,x2,32
c: 00200793 addi x15,x0,2
10: fef42623 sw x15,-20(x8)
14: 00300793 addi x15,x0,3
18: fef42423 sw x15,-24(x8)
1c: fec42703 lw x14,-20(x8)
20: fe842783 lw x15,-24(x8)
24: 00f707b3 add x15,x14,x15
28: fef42223 sw x15,-28(x8)
2c: 00000013 addi x0,x0,0
30: 01c12403 lw x8,28(x2)
34: 02010113 addi x2,x2,32
38: 00008067 jalr x0,0(x1)
xpack-riscv-none-elf-gcc-13.2.0-2/bin/riscv-none-elf-gcc -c -mabi=ilp32e -march=rv32ec main.c
xpack-riscv-none-elf-gcc-13.2.0-2/bin/riscv-none-elf-objdump -d -M no-aliases,numeric main.o
main.o: file format elf32-littleriscv
Disassembly of section .text:
00000000 <main>:
0: 1141 c.addi x2,-16
2: c622 c.swsp x8,12(x2)
4: 0800 c.addi4spn x8,x2,16
6: 4789 c.li x15,2
8: fef42c23 sw x15,-8(x8)
c: 478d c.li x15,3
e: fef42a23 sw x15,-12(x8)
12: ff842703 lw x14,-8(x8)
16: ff442783 lw x15,-12(x8)
1a: 97ba c.add x15,x14
1c: fef42823 sw x15,-16(x8)
20: 0001 c.addi x0,0
22: 4432 c.lwsp x8,12(x2)
24: 0141 c.addi x2,16
26: 8082 c.jr x1
不知道为啥sw lw用的非压缩指令,其实是有c.sw和c.lw的