mult test
This commit is contained in:
BIN
tests/a.out
BIN
tests/a.out
Binary file not shown.
9
tests/mult.c
Normal file
9
tests/mult.c
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
int main(){
|
||||||
|
unsigned int x, y;
|
||||||
|
x = 20;
|
||||||
|
x = 5;
|
||||||
|
|
||||||
|
x *= y;
|
||||||
|
}
|
||||||
32
tests/mult.s
Normal file
32
tests/mult.s
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
.file "mult.c"
|
||||||
|
.option nopic
|
||||||
|
.attribute arch, "rv32i2p1"
|
||||||
|
.attribute unaligned_access, 0
|
||||||
|
.attribute stack_align, 16
|
||||||
|
.text
|
||||||
|
.globl __mulsi3
|
||||||
|
.align 2
|
||||||
|
.globl main
|
||||||
|
.type main, @function
|
||||||
|
main:
|
||||||
|
addi sp,sp,-32
|
||||||
|
sw ra,28(sp)
|
||||||
|
sw s0,24(sp)
|
||||||
|
addi s0,sp,32
|
||||||
|
li a5,20
|
||||||
|
sw a5,-20(s0)
|
||||||
|
li a5,5
|
||||||
|
sw a5,-20(s0)
|
||||||
|
lw a1,-24(s0)
|
||||||
|
lw a0,-20(s0)
|
||||||
|
call __mulsi3
|
||||||
|
mv a5,a0
|
||||||
|
sw a5,-20(s0)
|
||||||
|
li a5,0
|
||||||
|
mv a0,a5
|
||||||
|
lw ra,28(sp)
|
||||||
|
lw s0,24(sp)
|
||||||
|
addi sp,sp,32
|
||||||
|
jr ra
|
||||||
|
.size main, .-main
|
||||||
|
.ident "GCC: () 13.2.0"
|
||||||
Reference in New Issue
Block a user