367 lines
5.1 KiB
ArmAsm
367 lines
5.1 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 main
|
||
|
.type main, @function
|
||
|
main:
|
||
|
.Lmain_entry:
|
||
|
lla t1,N
|
||
|
sd s0,-16(sp)
|
||
|
li t0,3
|
||
|
sw t0,0(t1)
|
||
|
mv s0,sp
|
||
|
sd ra,-8(s0)
|
||
|
addi a2,s0,-196
|
||
|
addi sp,sp,-208
|
||
|
lla t1,M
|
||
|
addi a0,sp,108
|
||
|
li t0,3
|
||
|
fsd fs0,160(sp)
|
||
|
addi t2,s0,-172
|
||
|
sw t0,0(t1)
|
||
|
sd s1,168(sp)
|
||
|
li t0,3
|
||
|
lla t1,L
|
||
|
sw t0,0(t1)
|
||
|
addi s1,s0,-208
|
||
|
fsd fs1,176(sp)
|
||
|
addi t0,zero,0
|
||
|
slli t1,t0,2
|
||
|
addi t0,s0,-136
|
||
|
add a1,t0,t1
|
||
|
addi t0,zero,0
|
||
|
slli t1,t0,2
|
||
|
addi t0,s0,-184
|
||
|
add a3,t0,t1
|
||
|
addi t0,zero,0
|
||
|
sd a3,152(sp)
|
||
|
slli t1,t0,2
|
||
|
add t0,t2,t1
|
||
|
addi t1,zero,0
|
||
|
slli t2,t1,2
|
||
|
add t1,s1,t2
|
||
|
addi t2,zero,0
|
||
|
sd t1,144(sp)
|
||
|
slli s1,t2,2
|
||
|
add t2,a0,s1
|
||
|
addi s1,zero,0
|
||
|
sd t2,136(sp)
|
||
|
slli a0,s1,2
|
||
|
add s1,a2,a0
|
||
|
li a0,4
|
||
|
sd a1,128(sp)
|
||
|
sd t0,120(sp)
|
||
|
call thrd_create
|
||
|
ld a1,128(sp)
|
||
|
mv a2,a0
|
||
|
ld t2,136(sp)
|
||
|
slliw a0,a2,2
|
||
|
ld a3,152(sp)
|
||
|
slliw a4,a2,0
|
||
|
ld t1,144(sp)
|
||
|
subw a2,a0,a4
|
||
|
li a0,5
|
||
|
ld t0,120(sp)
|
||
|
div a5,a2,a0
|
||
|
li a4,5
|
||
|
addiw a0,a2,3
|
||
|
div a2,a0,a4
|
||
|
mv a0,a5
|
||
|
j .Lmain_cond0
|
||
|
.Lmain_cond0:
|
||
|
slt a4,a0,a2
|
||
|
bge a0,a2,.Lmain_final2_split2
|
||
|
j .Lmain_body1
|
||
|
.Lmain_body1:
|
||
|
fcvt.s.w ft0,a0
|
||
|
addi a5,a0,0
|
||
|
slli a4,a5,2
|
||
|
add a5,a1,a4
|
||
|
addi a4,a0,0
|
||
|
fsw ft0,0(a5)
|
||
|
slli a5,a4,2
|
||
|
add a4,s1,a5
|
||
|
fsw ft0,0(a4)
|
||
|
addi a5,a0,0
|
||
|
slli a4,a5,2
|
||
|
add a5,a3,a4
|
||
|
addi a4,a0,0
|
||
|
fsw ft0,0(a5)
|
||
|
slli a5,a4,2
|
||
|
add a4,t2,a5
|
||
|
fsw ft0,0(a4)
|
||
|
addi a5,a0,0
|
||
|
slli a4,a5,2
|
||
|
add a5,t1,a4
|
||
|
fsw ft0,0(a5)
|
||
|
addi a4,a0,0
|
||
|
slli a5,a4,2
|
||
|
add a4,t0,a5
|
||
|
fsw ft0,0(a4)
|
||
|
addiw a4,a0,1
|
||
|
mv a0,a4
|
||
|
j .Lmain_cond0
|
||
|
.Lmain_final2_split2:
|
||
|
call thrd_join
|
||
|
addi t1,sp,108
|
||
|
li a0,4
|
||
|
flw ft4,0(t1)
|
||
|
addi t0,s0,-136
|
||
|
flw ft3,0(t0)
|
||
|
addi t1,s0,-208
|
||
|
flw ft0,0(t1)
|
||
|
addi t0,s0,-136
|
||
|
flw fa0,4(t0)
|
||
|
fmul.s ft1,ft3,ft4
|
||
|
addi t1,s0,-136
|
||
|
flw fa1,8(t1)
|
||
|
addi t0,s0,-172
|
||
|
fmul.s ft5,fa0,ft0
|
||
|
fadd.s ft2,ft1,ft5
|
||
|
flw ft1,0(t0)
|
||
|
addi t0,s0,-160
|
||
|
fmul.s ft6,fa1,ft1
|
||
|
fadd.s ft5,ft2,ft6
|
||
|
fsw ft5,0(t0)
|
||
|
addi t0,sp,108
|
||
|
flw ft5,4(t0)
|
||
|
addi t0,s0,-208
|
||
|
fmul.s ft2,ft3,ft5
|
||
|
flw ft6,4(t0)
|
||
|
addi t0,s0,-172
|
||
|
fmul.s ft7,fa0,ft6
|
||
|
fadd.s fs0,ft2,ft7
|
||
|
flw ft2,4(t0)
|
||
|
fmul.s fs1,fa1,ft2
|
||
|
addi t0,s0,-160
|
||
|
fadd.s ft7,fs0,fs1
|
||
|
fsw ft7,4(t0)
|
||
|
addi t0,sp,108
|
||
|
flw ft7,8(t0)
|
||
|
addi t0,s0,-208
|
||
|
fmul.s fs1,ft3,ft7
|
||
|
flw fs0,8(t0)
|
||
|
addi t0,s0,-172
|
||
|
fmul.s ft3,fa0,fs0
|
||
|
fadd.s fa0,fs1,ft3
|
||
|
flw ft3,8(t0)
|
||
|
addi t0,s0,-160
|
||
|
fmul.s fa2,fa1,ft3
|
||
|
fadd.s fs1,fa0,fa2
|
||
|
fsw fs1,8(t0)
|
||
|
addi t0,s0,-196
|
||
|
flw fs1,0(t0)
|
||
|
addi t0,s0,-196
|
||
|
fmul.s fa2,fs1,ft4
|
||
|
flw fa0,4(t0)
|
||
|
addi t0,s0,-196
|
||
|
fmul.s fa3,fa0,ft0
|
||
|
fadd.s fa1,fa2,fa3
|
||
|
flw fa3,8(t0)
|
||
|
addi t0,s0,-124
|
||
|
fmul.s fa2,fa3,ft1
|
||
|
fadd.s fa4,fa1,fa2
|
||
|
fsw fa4,0(t0)
|
||
|
fmul.s fa1,fs1,ft5
|
||
|
addi t0,s0,-124
|
||
|
fmul.s fa4,fa0,ft6
|
||
|
fadd.s fa2,fa1,fa4
|
||
|
fmul.s fa4,fa3,ft2
|
||
|
fadd.s fa1,fa2,fa4
|
||
|
fsw fa1,4(t0)
|
||
|
addi t0,s0,-124
|
||
|
fmul.s fa1,fs1,ft7
|
||
|
fmul.s fs1,fa0,fs0
|
||
|
fadd.s fa0,fa1,fs1
|
||
|
fmul.s fs1,fa3,ft3
|
||
|
fadd.s fa1,fa0,fs1
|
||
|
fsw fa1,8(t0)
|
||
|
addi t0,s0,-184
|
||
|
flw fs1,0(t0)
|
||
|
addi t0,s0,-184
|
||
|
fmul.s fa0,fs1,ft4
|
||
|
flw ft4,4(t0)
|
||
|
fmul.s fa1,ft4,ft0
|
||
|
addi t0,s0,-184
|
||
|
fadd.s ft0,fa0,fa1
|
||
|
flw fa1,8(t0)
|
||
|
addi t0,s0,-112
|
||
|
fmul.s fa0,fa1,ft1
|
||
|
fadd.s ft1,ft0,fa0
|
||
|
fmul.s ft0,fs1,ft5
|
||
|
fsw ft1,0(t0)
|
||
|
addi t0,s0,-112
|
||
|
fmul.s ft5,ft4,ft6
|
||
|
fadd.s ft1,ft0,ft5
|
||
|
fmul.s ft5,fa1,ft2
|
||
|
fmul.s ft2,ft4,fs0
|
||
|
fadd.s ft0,ft1,ft5
|
||
|
fsw ft0,4(t0)
|
||
|
addi t0,s0,-112
|
||
|
fmul.s ft0,fs1,ft7
|
||
|
fadd.s ft1,ft0,ft2
|
||
|
fmul.s ft2,fa1,ft3
|
||
|
fadd.s ft0,ft1,ft2
|
||
|
fsw ft0,8(t0)
|
||
|
addi t0,zero,0
|
||
|
slli t1,t0,2
|
||
|
addi t0,s0,-160
|
||
|
add s1,t0,t1
|
||
|
call thrd_create
|
||
|
mv t1,a0
|
||
|
slliw t2,t1,0
|
||
|
slliw t0,t1,2
|
||
|
subw a0,t0,t2
|
||
|
li t0,5
|
||
|
addiw a1,a0,3
|
||
|
div t1,a0,t0
|
||
|
li t0,5
|
||
|
div t2,a1,t0
|
||
|
mv a1,t1
|
||
|
j .Lmain_cond3
|
||
|
.Lmain_cond3:
|
||
|
slt t0,a1,t2
|
||
|
bge a1,t2,.Lmain_final5
|
||
|
j .Lmain_body4
|
||
|
.Lmain_body4:
|
||
|
addi t1,a1,0
|
||
|
slli t0,t1,2
|
||
|
add t1,s1,t0
|
||
|
flw ft0,0(t1)
|
||
|
fcvt.w.s t0,ft0,rtz
|
||
|
sd t2,128(sp)
|
||
|
sd a1,120(sp)
|
||
|
mv a0,t0
|
||
|
call putint
|
||
|
ld t2,128(sp)
|
||
|
ld a1,120(sp)
|
||
|
addiw t0,a1,1
|
||
|
mv a1,t0
|
||
|
j .Lmain_cond3
|
||
|
.Lmain_final5:
|
||
|
call thrd_join
|
||
|
li a0,10
|
||
|
call putch
|
||
|
addi t2,s0,-124
|
||
|
addi t1,zero,0
|
||
|
li a0,4
|
||
|
slli t0,t1,2
|
||
|
add t1,t2,t0
|
||
|
sd t1,120(sp)
|
||
|
call thrd_create
|
||
|
mv t0,a0
|
||
|
ld t1,120(sp)
|
||
|
slliw s1,t0,0
|
||
|
slliw t2,t0,2
|
||
|
subw t0,t2,s1
|
||
|
li t2,5
|
||
|
div s1,t0,t2
|
||
|
addiw t2,t0,3
|
||
|
li t0,5
|
||
|
div a1,t2,t0
|
||
|
mv t0,s1
|
||
|
j .Lmain_cond6
|
||
|
.Lmain_cond6:
|
||
|
slt t2,t0,a1
|
||
|
bge t0,a1,.Lmain_final8
|
||
|
j .Lmain_body7
|
||
|
.Lmain_body7:
|
||
|
addi t2,t0,0
|
||
|
slli s1,t2,2
|
||
|
add t2,t1,s1
|
||
|
flw ft0,0(t2)
|
||
|
sd t1,136(sp)
|
||
|
fcvt.w.s t2,ft0,rtz
|
||
|
sd t0,128(sp)
|
||
|
mv a0,t2
|
||
|
sd a1,120(sp)
|
||
|
call putint
|
||
|
ld a1,120(sp)
|
||
|
ld t1,136(sp)
|
||
|
ld t0,128(sp)
|
||
|
addiw t2,t0,1
|
||
|
mv t0,t2
|
||
|
j .Lmain_cond6
|
||
|
.Lmain_final8:
|
||
|
call thrd_join
|
||
|
li a0,10
|
||
|
call putch
|
||
|
li a0,4
|
||
|
addi t1,zero,0
|
||
|
slli t0,t1,2
|
||
|
addi t1,s0,-112
|
||
|
add t2,t1,t0
|
||
|
sd t2,120(sp)
|
||
|
call thrd_create
|
||
|
ld t2,120(sp)
|
||
|
mv s1,a0
|
||
|
slliw t0,s1,2
|
||
|
slliw t1,s1,0
|
||
|
subw s1,t0,t1
|
||
|
li t1,5
|
||
|
addiw a0,s1,3
|
||
|
div t0,s1,t1
|
||
|
li s1,5
|
||
|
div t1,a0,s1
|
||
|
mv s1,t0
|
||
|
j .Lmain_cond9
|
||
|
.Lmain_cond9:
|
||
|
slt t0,s1,t1
|
||
|
bge s1,t1,.Lmain_exit
|
||
|
j .Lmain_body10
|
||
|
.Lmain_body10:
|
||
|
addi a0,s1,0
|
||
|
slli t0,a0,2
|
||
|
add a0,t2,t0
|
||
|
flw ft0,0(a0)
|
||
|
fcvt.w.s t0,ft0,rtz
|
||
|
sd t1,128(sp)
|
||
|
sd t2,120(sp)
|
||
|
mv a0,t0
|
||
|
call putint
|
||
|
ld t1,128(sp)
|
||
|
addiw t0,s1,1
|
||
|
ld t2,120(sp)
|
||
|
mv s1,t0
|
||
|
j .Lmain_cond9
|
||
|
.Lmain_exit:
|
||
|
call thrd_join
|
||
|
li a0,10
|
||
|
call putch
|
||
|
ld ra,-8(s0)
|
||
|
addiw a0,zero,0
|
||
|
fld fs0,160(sp)
|
||
|
fld fs1,176(sp)
|
||
|
ld s1,168(sp)
|
||
|
mv sp,s0
|
||
|
ld s0,-16(s0)
|
||
|
ret
|
||
|
.size main, .-main
|
||
|
.ident "compiler: (visionfive2) 0.1.0"
|
||
|
.section .note.GNU-stack,"",@progbits
|