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

304 lines
4.3 KiB
ArmAsm
Raw Permalink Normal View History

2024-08-19 10:53:00 +08:00
.file "96_matrix_add.sy"
.option nopic
.attribute arch, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0"
.attribute unaligned_access, 0
.attribute stack_align, 16
.text
.globl M
.section .sbss,"aw",@nobits
.align 2
.type M, @object
.size M, 4
M:
.zero 4
.globl L
.align 2
.type L, @object
.size L, 4
L:
.zero 4
.globl N
.align 2
.type N, @object
.size N, 4
N:
.zero 4
.text
.align 1
.globl add
.type add, @function
add:
.LFB0:
.cfi_startproc
addi sp,sp,-96
.cfi_def_cfa_offset 96
sd s0,88(sp)
.cfi_offset 8, -8
addi s0,sp,96
.cfi_def_cfa 8, 0
sd a0,-40(s0)
sd a1,-48(s0)
sd a2,-56(s0)
sd a3,-64(s0)
sd a4,-72(s0)
sd a5,-80(s0)
sd a6,-88(s0)
sd a7,-96(s0)
sw zero,-20(s0)
j .L2
.L3:
lw a5,-20(s0)
slli a5,a5,2
ld a4,-40(s0)
add a5,a4,a5
flw fa4,0(a5)
lw a5,-20(s0)
slli a5,a5,2
ld a4,-64(s0)
add a5,a4,a5
flw fa5,0(a5)
lw a5,-20(s0)
slli a5,a5,2
ld a4,-88(s0)
add a5,a4,a5
fadd.s fa5,fa4,fa5
fsw fa5,0(a5)
lw a5,-20(s0)
slli a5,a5,2
ld a4,-48(s0)
add a5,a4,a5
flw fa4,0(a5)
lw a5,-20(s0)
slli a5,a5,2
ld a4,-72(s0)
add a5,a4,a5
flw fa5,0(a5)
lw a5,-20(s0)
slli a5,a5,2
ld a4,-96(s0)
add a5,a4,a5
fadd.s fa5,fa4,fa5
fsw fa5,0(a5)
lw a5,-20(s0)
slli a5,a5,2
ld a4,-56(s0)
add a5,a4,a5
flw fa4,0(a5)
lw a5,-20(s0)
slli a5,a5,2
ld a4,-80(s0)
add a5,a4,a5
flw fa5,0(a5)
lw a5,-20(s0)
slli a5,a5,2
ld a4,0(s0)
add a5,a4,a5
fadd.s fa5,fa4,fa5
fsw fa5,0(a5)
lw a5,-20(s0)
addiw a5,a5,1
sw a5,-20(s0)
.L2:
lui a5,%hi(M)
lw a4,%lo(M)(a5)
lw a5,-20(s0)
sext.w a5,a5
blt a5,a4,.L3
li a5,0
mv a0,a5
ld s0,88(sp)
.cfi_restore 8
.cfi_def_cfa 2, 96
addi sp,sp,96
.cfi_def_cfa_offset 0
jr ra
.cfi_endproc
.LFE0:
.size add, .-add
.align 1
.globl main
.type main, @function
main:
.LFB1:
.cfi_startproc
addi sp,sp,-192
.cfi_def_cfa_offset 192
sd ra,184(sp)
sd s0,176(sp)
.cfi_offset 1, -8
.cfi_offset 8, -16
addi s0,sp,192
.cfi_def_cfa 8, 0
lui a5,%hi(N)
li a4,3
sw a4,%lo(N)(a5)
lui a5,%hi(M)
li a4,3
sw a4,%lo(M)(a5)
lui a5,%hi(L)
li a4,3
sw a4,%lo(L)(a5)
sw zero,-20(s0)
j .L6
.L7:
lw a5,-20(s0)
fcvt.s.w fa5,a5
lw a5,-20(s0)
slli a5,a5,2
addi a5,a5,-16
add a5,a5,s0
fsw fa5,-24(a5)
lw a5,-20(s0)
fcvt.s.w fa5,a5
lw a5,-20(s0)
slli a5,a5,2
addi a5,a5,-16
add a5,a5,s0
fsw fa5,-40(a5)
lw a5,-20(s0)
fcvt.s.w fa5,a5
lw a5,-20(s0)
slli a5,a5,2
addi a5,a5,-16
add a5,a5,s0
fsw fa5,-56(a5)
lw a5,-20(s0)
fcvt.s.w fa5,a5
lw a5,-20(s0)
slli a5,a5,2
addi a5,a5,-16
add a5,a5,s0
fsw fa5,-72(a5)
lw a5,-20(s0)
fcvt.s.w fa5,a5
lw a5,-20(s0)
slli a5,a5,2
addi a5,a5,-16
add a5,a5,s0
fsw fa5,-88(a5)
lw a5,-20(s0)
fcvt.s.w fa5,a5
lw a5,-20(s0)
slli a5,a5,2
addi a5,a5,-16
add a5,a5,s0
fsw fa5,-104(a5)
lw a5,-20(s0)
addiw a5,a5,1
sw a5,-20(s0)
.L6:
lui a5,%hi(M)
lw a4,%lo(M)(a5)
lw a5,-20(s0)
sext.w a5,a5
blt a5,a4,.L7
addi a7,s0,-160
addi a6,s0,-144
addi t1,s0,-120
addi a4,s0,-104
addi a3,s0,-88
addi a2,s0,-72
addi a1,s0,-56
addi a0,s0,-40
addi a5,s0,-176
sd a5,0(sp)
mv a5,t1
call add
mv a5,a0
sw a5,-20(s0)
j .L8
.L9:
lw a5,-20(s0)
slli a5,a5,2
addi a5,a5,-16
add a5,a5,s0
flw fa5,-128(a5)
fcvt.w.s a5,fa5,rtz
sw a5,-24(s0)
lw a5,-24(s0)
mv a0,a5
call putint
lw a5,-20(s0)
addiw a5,a5,1
sw a5,-20(s0)
.L8:
lui a5,%hi(N)
lw a4,%lo(N)(a5)
lw a5,-20(s0)
sext.w a5,a5
blt a5,a4,.L9
li a5,10
sw a5,-24(s0)
lw a5,-24(s0)
mv a0,a5
call putch
sw zero,-20(s0)
j .L10
.L11:
lw a5,-20(s0)
slli a5,a5,2
addi a5,a5,-16
add a5,a5,s0
flw fa5,-144(a5)
fcvt.w.s a5,fa5,rtz
sw a5,-24(s0)
lw a5,-24(s0)
mv a0,a5
call putint
lw a5,-20(s0)
addiw a5,a5,1
sw a5,-20(s0)
.L10:
lui a5,%hi(N)
lw a4,%lo(N)(a5)
lw a5,-20(s0)
sext.w a5,a5
blt a5,a4,.L11
li a5,10
sw a5,-24(s0)
lw a5,-24(s0)
mv a0,a5
call putch
sw zero,-20(s0)
j .L12
.L13:
lw a5,-20(s0)
slli a5,a5,2
addi a5,a5,-16
add a5,a5,s0
flw fa5,-160(a5)
fcvt.w.s a5,fa5,rtz
sw a5,-24(s0)
lw a5,-24(s0)
mv a0,a5
call putint
lw a5,-20(s0)
addiw a5,a5,1
sw a5,-20(s0)
.L12:
lui a5,%hi(N)
lw a4,%lo(N)(a5)
lw a5,-20(s0)
sext.w a5,a5
blt a5,a4,.L13
li a5,10
sw a5,-24(s0)
lw a5,-24(s0)
mv a0,a5
call putch
li a5,0
mv a0,a5
ld ra,184(sp)
.cfi_restore 1
ld s0,176(sp)
.cfi_restore 8
.cfi_def_cfa 2, 192
addi sp,sp,192
.cfi_def_cfa_offset 0
jr ra
.cfi_endproc
.LFE1:
.size main, .-main
.ident "GCC: (GNU) 13.3.0"
.section .note.GNU-stack,"",@progbits