riscv简单例子
实现输入一个值
再将这个值输出的功能
riscv的安装详情见我的另一篇博客,点击下面蓝字即可!
.option nopic .text .align 3 .LC0: .string "%d\n" .text .align 1 .globl main .type main, @function .LC1: .string "%d" .align 3 .LC2: .string "%d " .align 3 .LC3: .string "\n" .align 3 main: addi x2,x2,-32 sd x1,24(x2) sd x8,16(x2) addi x8,x2,32 #begin add x11, x8, zero lui x15,%hi(.LC1) addi x10,x15,%lo(.LC1) call scanf lw x29, 0(x8) add x11, x29, 0 lui x15,%hi(.LC0) addi x10,x15,%lo(.LC0) call printf #end li x15,0 mv x10,x15 ld x1,24(x2) ld x8,16(x2) addi x2,x2,32 jr x1 .size main, .-main .ident "GCC: (GNU) 7.2.0"