302 lines
4.0 KiB
ArmAsm
302 lines
4.0 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
|
||
|
li t0,3
|
||
|
sd s0,-16(sp)
|
||
|
sw t0,0(t1)
|
||
|
mv s0,sp
|
||
|
li t0,3
|
||
|
addi a0,s0,-132
|
||
|
addi t2,s0,-108
|
||
|
lla t1,M
|
||
|
sw t0,0(t1)
|
||
|
addi sp,sp,-192
|
||
|
sd ra,-8(s0)
|
||
|
addi a2,s0,-144
|
||
|
li t0,3
|
||
|
lla t1,L
|
||
|
sw t0,0(t1)
|
||
|
sd s1,160(sp)
|
||
|
addi t0,zero,0
|
||
|
slli t1,t0,2
|
||
|
addi s1,s0,-180
|
||
|
addi t0,s0,-120
|
||
|
add a1,t0,t1
|
||
|
addi t0,zero,0
|
||
|
slli t1,t0,2
|
||
|
addi t0,s0,-192
|
||
|
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
|
||
|
sd t1,144(sp)
|
||
|
addi t2,zero,0
|
||
|
slli s1,t2,2
|
||
|
add t2,a0,s1
|
||
|
addi s1,zero,0
|
||
|
sd t2,136(sp)
|
||
|
slli a0,s1,2
|
||
|
add s1,a2,a0
|
||
|
sd a1,128(sp)
|
||
|
li a0,4
|
||
|
sd t0,120(sp)
|
||
|
call thrd_create
|
||
|
ld t1,144(sp)
|
||
|
mv a2,a0
|
||
|
ld a1,128(sp)
|
||
|
slliw a0,a2,0
|
||
|
ld t2,136(sp)
|
||
|
slliw a4,a2,2
|
||
|
subw a2,a4,a0
|
||
|
ld a3,152(sp)
|
||
|
li a0,5
|
||
|
ld t0,120(sp)
|
||
|
addiw a4,a2,3
|
||
|
div a5,a2,a0
|
||
|
li a0,5
|
||
|
div a2,a4,a0
|
||
|
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,t1,a4
|
||
|
addi a4,a0,0
|
||
|
fsw ft0,0(a5)
|
||
|
slli a5,a4,2
|
||
|
add a4,a3,a5
|
||
|
fsw ft0,0(a4)
|
||
|
addi a5,a0,0
|
||
|
slli a4,a5,2
|
||
|
add a5,t0,a4
|
||
|
fsw ft0,0(a5)
|
||
|
addi a4,a0,0
|
||
|
slli a5,a4,2
|
||
|
add a4,t2,a5
|
||
|
fsw ft0,0(a4)
|
||
|
addi a5,a0,0
|
||
|
slli a4,a5,2
|
||
|
add a5,s1,a4
|
||
|
fsw ft0,0(a5)
|
||
|
addi a4,a0,0
|
||
|
slli a5,a4,2
|
||
|
add a4,a1,a5
|
||
|
fsw ft0,0(a4)
|
||
|
addiw a4,a0,1
|
||
|
mv a0,a4
|
||
|
j .Lmain_cond0
|
||
|
.Lmain_final2_split2:
|
||
|
call thrd_join
|
||
|
addi t2,s0,-168
|
||
|
addi t1,s0,-96
|
||
|
addi t0,s0,-108
|
||
|
li a0,4
|
||
|
flw ft0,4(t0)
|
||
|
addi t0,s0,-192
|
||
|
fsw ft0,8(t1)
|
||
|
flw ft0,8(t0)
|
||
|
addi t1,sp,108
|
||
|
fsw ft0,4(t1)
|
||
|
addi t0,s0,-168
|
||
|
addi t1,s0,-192
|
||
|
flw ft0,0(t1)
|
||
|
fsw ft0,4(t0)
|
||
|
addi t1,s0,-108
|
||
|
addi t0,s0,-168
|
||
|
flw ft0,0(t1)
|
||
|
fsw ft0,8(t0)
|
||
|
addi t1,s0,-96
|
||
|
addi t0,s0,-180
|
||
|
flw ft0,4(t0)
|
||
|
addi t0,s0,-180
|
||
|
fsw ft0,0(t1)
|
||
|
addi t1,sp,108
|
||
|
flw ft0,8(t0)
|
||
|
fsw ft0,0(t1)
|
||
|
addi t0,s0,-96
|
||
|
addi t1,s0,-192
|
||
|
flw ft0,4(t1)
|
||
|
fsw ft0,4(t0)
|
||
|
addi t1,s0,-108
|
||
|
addi t0,sp,108
|
||
|
flw ft0,8(t1)
|
||
|
addi t1,s0,-168
|
||
|
fsw ft0,8(t0)
|
||
|
addi t0,s0,-180
|
||
|
flw ft0,0(t0)
|
||
|
fsw ft0,0(t1)
|
||
|
addi t1,zero,0
|
||
|
slli t0,t1,2
|
||
|
add t1,t2,t0
|
||
|
sd t1,120(sp)
|
||
|
call thrd_create
|
||
|
ld t1,120(sp)
|
||
|
mv t2,a0
|
||
|
slliw s1,t2,2
|
||
|
slliw t0,t2,0
|
||
|
subw t2,s1,t0
|
||
|
addiw s1,t2,3
|
||
|
li t0,5
|
||
|
div a0,t2,t0
|
||
|
li t0,5
|
||
|
div a1,s1,t0
|
||
|
mv t0,a0
|
||
|
j .Lmain_cond3
|
||
|
.Lmain_cond3:
|
||
|
slt t2,t0,a1
|
||
|
bge t0,a1,.Lmain_final5
|
||
|
j .Lmain_body4
|
||
|
.Lmain_body4:
|
||
|
addi t2,t0,0
|
||
|
slli s1,t2,2
|
||
|
add t2,t1,s1
|
||
|
flw ft0,0(t2)
|
||
|
fcvt.w.s t2,ft0,rtz
|
||
|
sd t1,136(sp)
|
||
|
sd t0,128(sp)
|
||
|
mv a0,t2
|
||
|
sd a1,120(sp)
|
||
|
call putint
|
||
|
ld t1,136(sp)
|
||
|
ld t0,128(sp)
|
||
|
ld a1,120(sp)
|
||
|
addiw t2,t0,1
|
||
|
mv t0,t2
|
||
|
j .Lmain_cond3
|
||
|
.Lmain_final5:
|
||
|
call thrd_join
|
||
|
li a0,10
|
||
|
call putch
|
||
|
li a0,4
|
||
|
addi t0,zero,0
|
||
|
slli t1,t0,2
|
||
|
addi t0,s0,-96
|
||
|
add s1,t0,t1
|
||
|
call thrd_create
|
||
|
mv t0,a0
|
||
|
slliw a0,t0,2
|
||
|
slliw t1,t0,0
|
||
|
subw t2,a0,t1
|
||
|
addiw a0,t2,3
|
||
|
li t1,5
|
||
|
div t0,t2,t1
|
||
|
li t2,5
|
||
|
div t1,a0,t2
|
||
|
mv t2,t0
|
||
|
j .Lmain_cond6
|
||
|
.Lmain_cond6:
|
||
|
slt t0,t2,t1
|
||
|
bge t2,t1,.Lmain_final8
|
||
|
j .Lmain_body7
|
||
|
.Lmain_body7:
|
||
|
addi a0,t2,0
|
||
|
slli t0,a0,2
|
||
|
add a0,s1,t0
|
||
|
flw ft0,0(a0)
|
||
|
sd t1,128(sp)
|
||
|
fcvt.w.s t0,ft0,rtz
|
||
|
sd t2,120(sp)
|
||
|
mv a0,t0
|
||
|
call putint
|
||
|
ld t1,128(sp)
|
||
|
ld t2,120(sp)
|
||
|
addiw t0,t2,1
|
||
|
mv t2,t0
|
||
|
j .Lmain_cond6
|
||
|
.Lmain_final8:
|
||
|
call thrd_join
|
||
|
li a0,10
|
||
|
call putch
|
||
|
addi t0,zero,0
|
||
|
li a0,4
|
||
|
slli t1,t0,2
|
||
|
addi t0,sp,108
|
||
|
add a1,t0,t1
|
||
|
sd a1,120(sp)
|
||
|
call thrd_create
|
||
|
ld a1,120(sp)
|
||
|
mv t1,a0
|
||
|
slliw t0,t1,0
|
||
|
slliw t2,t1,2
|
||
|
subw s1,t2,t0
|
||
|
li t0,5
|
||
|
addiw a0,s1,3
|
||
|
div t1,s1,t0
|
||
|
li t0,5
|
||
|
div t2,a0,t0
|
||
|
mv t0,t1
|
||
|
j .Lmain_cond9
|
||
|
.Lmain_cond9:
|
||
|
slt t1,t0,t2
|
||
|
bge t0,t2,.Lmain_exit
|
||
|
j .Lmain_body10
|
||
|
.Lmain_body10:
|
||
|
addi t1,t0,0
|
||
|
slli s1,t1,2
|
||
|
add t1,a1,s1
|
||
|
flw ft0,0(t1)
|
||
|
fcvt.w.s t1,ft0,rtz
|
||
|
sd t0,136(sp)
|
||
|
sd t2,128(sp)
|
||
|
mv a0,t1
|
||
|
sd a1,120(sp)
|
||
|
call putint
|
||
|
ld a1,120(sp)
|
||
|
ld t2,128(sp)
|
||
|
ld t0,136(sp)
|
||
|
addiw t1,t0,1
|
||
|
mv t0,t1
|
||
|
j .Lmain_cond9
|
||
|
.Lmain_exit:
|
||
|
call thrd_join
|
||
|
li a0,10
|
||
|
call putch
|
||
|
ld ra,-8(s0)
|
||
|
addiw a0,zero,0
|
||
|
ld s1,160(sp)
|
||
|
mv sp,s0
|
||
|
ld s0,-16(s0)
|
||
|
ret
|
||
|
.size main, .-main
|
||
|
.ident "compiler: (visionfive2) 0.1.0"
|
||
|
.section .note.GNU-stack,"",@progbits
|