sysy-data/quick_test/asm/96_matrix_add.s

212 lines
2.7 KiB
ArmAsm

.file "test.c"
.option pic
.attribute arch, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0"
.attribute unaligned_access, 0
.attribute stack_align, 16
.data
.align 2
.globl M
.type M, @object
.size M, 4
M:
.word 0
.data
.align 2
.globl L
.type L, @object
.size L, 4
L:
.word 0
.data
.align 2
.globl N
.type N, @object
.size N, 4
N:
.word 0
.text
.align 3
.globl add
.type add, @function
add:
.Ladd_entry:
sd s0,-8(sp)
mv t1,a5
mv t2,a6
mv t0,a4
mv s0,sp
sd s2,-48(s0)
addi sp,sp,-48
sd s3,-40(s0)
mv s2,a0
mv s3,a1
sd s4,-32(s0)
li a1,0
mv s4,a2
sd s1,-24(s0)
mv a2,a3
ld a0,0(s0)
mv s1,a7
j .Ladd_cond0
.Ladd_cond0:
lla a4,M
lw a3,0(a4)
slt a4,a1,a3
bge a1,a3,.Ladd_exit
j .Ladd_body1
.Ladd_body1:
slli a3,a1,2
add a4,s2,a3
flw ft0,0(a4)
slli a3,a1,2
add a5,a2,a3
slli a3,a1,2
flw ft1,0(a5)
add a4,t2,a3
slli a3,a1,2
fadd.s ft2,ft0,ft1
fsw ft2,0(a4)
add a4,s3,a3
slli a3,a1,2
flw ft0,0(a4)
add a5,t0,a3
slli a3,a1,2
flw ft1,0(a5)
add a4,s1,a3
slli a3,a1,2
fadd.s ft2,ft0,ft1
fsw ft2,0(a4)
add a4,s4,a3
slli a3,a1,2
flw ft0,0(a4)
add a5,t1,a3
flw ft1,0(a5)
slli a3,a1,2
add a4,a0,a3
addiw a3,a1,1
mv a1,a3
fadd.s ft2,ft0,ft1
fsw ft2,0(a4)
j .Ladd_cond0
.Ladd_exit:
addiw a0,zero,0
ld s3,-40(s0)
mv sp,s0
ld s2,-48(s0)
ld s4,-32(s0)
ld s1,-24(s0)
ld s0,-8(s0)
ret
.size add, .-add
.text
.align 3
.globl main
.type main, @function
main:
.Lmain_entry:
li t0,3
lla t1,N
sd s0,-16(sp)
sw t0,0(t1)
mv s0,sp
addi a1,s0,-144
addi sp,sp,-144
sd ra,-8(s0)
addi t2,s0,-108
addi a0,s0,-132
li t0,3
lla t1,M
sw t0,0(t1)
sd s1,112(sp)
li t0,3
lla t1,L
sw t0,0(t1)
addi t0,zero,0
slli t1,t0,2
addi t0,s0,-84
add s1,t0,t1
addi t0,zero,0
slli t1,t0,2
addi t0,s0,-96
add a2,t0,t1
addi t0,zero,0
slli t1,t0,2
add t0,t2,t1
addi t1,zero,0
slli t2,t1,2
add t1,a0,t2
sd t1,104(sp)
addi t2,zero,0
slli a0,t2,2
add t2,a1,a0
sd t2,96(sp)
addi a0,zero,0
slli a3,a0,2
addi a0,s0,-120
add a1,a0,a3
li a0,4
sd a1,88(sp)
sd a2,80(sp)
sd t0,-72(s0)
call thrd_create
ld t1,104(sp)
mv a4,a0
slliw a0,a4,2
ld a2,80(sp)
ld t0,-72(s0)
slliw a3,a4,0
subw a4,a0,a3
ld a1,88(sp)
li a0,5
li a3,5
div a5,a4,a0
addiw a6,a4,3
ld t2,96(sp)
div a0,a6,a3
mv a3,a5
j .Lmain_cond0
.Lmain_cond0:
slt a4,a3,a0
bge a3,a0,.Lmain_exit
j .Lmain_body1
.Lmain_body1:
addi a4,a3,0
fcvt.s.w ft0,a3
slli a5,a4,2
add a4,t1,a5
fsw ft0,0(a4)
addi a4,a3,0
slli a5,a4,2
add a4,a1,a5
fsw ft0,0(a4)
addi a4,a3,0
slli a5,a4,2
add a4,s1,a5
fsw ft0,0(a4)
addi a4,a3,0
slli a5,a4,2
add a4,t0,a5
fsw ft0,0(a4)
addi a4,a3,0
slli a5,a4,2
add a4,t2,a5
fsw ft0,0(a4)
addi a4,a3,0
slli a5,a4,2
add a4,a2,a5
fsw ft0,0(a4)
addiw a4,a3,1
mv a3,a4
j .Lmain_cond0
.Lmain_exit:
call thrd_join
addiw a0,zero,0
ld s1,112(sp)
ld ra,-8(s0)
mv sp,s0
ld s0,-16(s0)
ret
.size main, .-main
.ident "compiler: (visionfive2) 0.1.0"
.section .note.GNU-stack,"",@progbits