382 lines
5.1 KiB
ArmAsm
382 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 N
|
||
|
.type N, @object
|
||
|
.size N, 4
|
||
|
N:
|
||
|
.word 0
|
||
|
.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
|
||
|
.text
|
||
|
.align 3
|
||
|
.globl main
|
||
|
.type main, @function
|
||
|
main:
|
||
|
.Lmain_entry:
|
||
|
sd s0,-16(sp)
|
||
|
li t0,3
|
||
|
lla t1,N
|
||
|
sw t0,0(t1)
|
||
|
mv s0,sp
|
||
|
addi a0,s0,-128
|
||
|
addi a2,s0,-224
|
||
|
li t0,3
|
||
|
addi t2,s0,-116
|
||
|
addi sp,sp,-224
|
||
|
lla t1,M
|
||
|
sw t0,0(t1)
|
||
|
sd ra,-8(s0)
|
||
|
lla t1,L
|
||
|
li t0,3
|
||
|
sd s3,184(sp)
|
||
|
sw t0,0(t1)
|
||
|
sd s1,192(sp)
|
||
|
addi t0,zero,0
|
||
|
slli t1,t0,2
|
||
|
sd s2,200(sp)
|
||
|
addi s1,s0,-212
|
||
|
addi t0,s0,-200
|
||
|
add a1,t0,t1
|
||
|
addi t0,zero,0
|
||
|
slli t1,t0,2
|
||
|
addi t0,s0,-140
|
||
|
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
|
||
|
mv a2,a0
|
||
|
ld a3,152(sp)
|
||
|
ld t0,120(sp)
|
||
|
slliw a4,a2,2
|
||
|
ld t1,144(sp)
|
||
|
slliw a0,a2,0
|
||
|
ld t2,136(sp)
|
||
|
subw a2,a4,a0
|
||
|
addiw a4,a2,3
|
||
|
li a0,5
|
||
|
div a5,a2,a0
|
||
|
ld a1,128(sp)
|
||
|
li a0,5
|
||
|
div a2,a4,a0
|
||
|
mv a0,a5
|
||
|
j .Lmain_cond0
|
||
|
.Lmain_cond0:
|
||
|
slt a4,a0,a2
|
||
|
bge a0,a2,.Lmain_entry_inline0
|
||
|
j .Lmain_body1
|
||
|
.Lmain_body1:
|
||
|
fcvt.s.w ft0,a0
|
||
|
addi a5,a0,0
|
||
|
slli a4,a5,2
|
||
|
add a5,t0,a4
|
||
|
addi a4,a0,0
|
||
|
fsw ft0,0(a5)
|
||
|
slli a5,a4,2
|
||
|
add a4,s1,a5
|
||
|
addi a5,a0,0
|
||
|
fsw ft0,0(a4)
|
||
|
slli a4,a5,2
|
||
|
add a5,t1,a4
|
||
|
fsw ft0,0(a5)
|
||
|
addi a4,a0,0
|
||
|
slli a5,a4,2
|
||
|
add a4,a3,a5
|
||
|
addi a5,a0,0
|
||
|
fsw ft0,0(a4)
|
||
|
slli a4,a5,2
|
||
|
add a5,t2,a4
|
||
|
addi a4,a0,0
|
||
|
fsw ft0,0(a5)
|
||
|
slli a5,a4,2
|
||
|
add a4,a1,a5
|
||
|
fsw ft0,0(a4)
|
||
|
addiw a4,a0,1
|
||
|
mv a0,a4
|
||
|
j .Lmain_cond0
|
||
|
.Lmain_entry_inline0:
|
||
|
call thrd_join
|
||
|
addi s1,s0,-200
|
||
|
addi t1,zero,0
|
||
|
slli t0,t1,2
|
||
|
addi t2,s0,-224
|
||
|
add t1,t2,t0
|
||
|
addi a0,s0,-140
|
||
|
addi t2,zero,0
|
||
|
slli t0,t2,2
|
||
|
add t2,s1,t0
|
||
|
addi s1,zero,0
|
||
|
slli t0,s1,2
|
||
|
add s1,a0,t0
|
||
|
addi a0,zero,0
|
||
|
slli t0,a0,2
|
||
|
addi a0,s0,-152
|
||
|
add a1,a0,t0
|
||
|
addi t0,zero,0
|
||
|
slli a0,t0,2
|
||
|
addi t0,s0,-188
|
||
|
add a2,t0,a0
|
||
|
addi t0,zero,0
|
||
|
slli a0,t0,2
|
||
|
addi t0,s0,-128
|
||
|
add a3,t0,a0
|
||
|
addi t0,zero,0
|
||
|
sd a3,176(sp)
|
||
|
slli a0,t0,2
|
||
|
addi t0,s0,-116
|
||
|
add a4,t0,a0
|
||
|
sd t1,168(sp)
|
||
|
addi t0,zero,0
|
||
|
slli a0,t0,2
|
||
|
addi t0,s0,-212
|
||
|
sd a4,160(sp)
|
||
|
add a5,t0,a0
|
||
|
addi t0,zero,0
|
||
|
slli a0,t0,2
|
||
|
sd t2,152(sp)
|
||
|
addi t0,s0,-176
|
||
|
add a6,t0,a0
|
||
|
li a0,4
|
||
|
sd a1,144(sp)
|
||
|
sd a5,136(sp)
|
||
|
sd a2,128(sp)
|
||
|
sd a6,120(sp)
|
||
|
call thrd_create
|
||
|
ld t1,168(sp)
|
||
|
mv a7,a0
|
||
|
ld a3,176(sp)
|
||
|
slliw t0,a7,0
|
||
|
ld t2,152(sp)
|
||
|
slliw a0,a7,2
|
||
|
ld a5,136(sp)
|
||
|
subw s2,a0,t0
|
||
|
ld a4,160(sp)
|
||
|
addiw s3,s2,3
|
||
|
ld a2,128(sp)
|
||
|
li t0,5
|
||
|
div a7,s2,t0
|
||
|
ld a1,144(sp)
|
||
|
ld a6,120(sp)
|
||
|
li t0,5
|
||
|
div a0,s3,t0
|
||
|
mv t0,a7
|
||
|
j .Lmain_cond0_inline1
|
||
|
.Lmain_cond0_inline1:
|
||
|
slt a7,t0,a0
|
||
|
bge t0,a0,.Lmain_final2_split5
|
||
|
j .Lmain_body1_inline4
|
||
|
.Lmain_body1_inline4:
|
||
|
addi s3,t0,0
|
||
|
addi a7,t0,0
|
||
|
slli s2,a7,2
|
||
|
add a7,a4,s2
|
||
|
flw ft0,0(a7)
|
||
|
slli s2,s3,2
|
||
|
add s3,s1,s2
|
||
|
flw ft2,0(s3)
|
||
|
addi a7,t0,0
|
||
|
slli s2,a7,2
|
||
|
add a7,a6,s2
|
||
|
fsub.s ft1,ft0,ft2
|
||
|
addi s2,t0,0
|
||
|
fsw ft1,0(a7)
|
||
|
slli a7,s2,2
|
||
|
add s2,t1,a7
|
||
|
flw ft1,0(s2)
|
||
|
addi a7,t0,0
|
||
|
slli s3,a7,2
|
||
|
add a7,a3,s3
|
||
|
flw ft0,0(a7)
|
||
|
fsub.s ft2,ft1,ft0
|
||
|
addi a7,t0,0
|
||
|
slli s2,a7,2
|
||
|
add a7,a2,s2
|
||
|
addi s2,t0,0
|
||
|
fsw ft2,0(a7)
|
||
|
slli a7,s2,2
|
||
|
add s2,a5,a7
|
||
|
flw ft0,0(s2)
|
||
|
addi a7,t0,0
|
||
|
slli s3,a7,2
|
||
|
add a7,t2,s3
|
||
|
flw ft2,0(a7)
|
||
|
addi s2,t0,0
|
||
|
fsub.s ft1,ft0,ft2
|
||
|
slli a7,s2,2
|
||
|
add s2,a1,a7
|
||
|
addiw a7,t0,1
|
||
|
mv t0,a7
|
||
|
fsw ft1,0(s2)
|
||
|
j .Lmain_cond0_inline1
|
||
|
.Lmain_final2_split5:
|
||
|
call thrd_join
|
||
|
addi t1,zero,0
|
||
|
li a0,4
|
||
|
slli t0,t1,2
|
||
|
addi t1,s0,-176
|
||
|
add t2,t1,t0
|
||
|
sd t2,120(sp)
|
||
|
call thrd_create
|
||
|
ld t2,120(sp)
|
||
|
mv t1,a0
|
||
|
slliw t0,t1,0
|
||
|
slliw s1,t1,2
|
||
|
subw t1,s1,t0
|
||
|
li t0,5
|
||
|
addiw s1,t1,3
|
||
|
div a0,t1,t0
|
||
|
li t1,5
|
||
|
div t0,s1,t1
|
||
|
mv s1,a0
|
||
|
j .Lmain_cond3
|
||
|
.Lmain_cond3:
|
||
|
slt t1,s1,t0
|
||
|
bge s1,t0,.Lmain_final5
|
||
|
j .Lmain_body4
|
||
|
.Lmain_body4:
|
||
|
addi a0,s1,0
|
||
|
slli t1,a0,2
|
||
|
add a0,t2,t1
|
||
|
flw ft0,0(a0)
|
||
|
sd t0,128(sp)
|
||
|
fcvt.w.s t1,ft0,rtz
|
||
|
sd t2,120(sp)
|
||
|
mv a0,t1
|
||
|
call putint
|
||
|
ld t2,120(sp)
|
||
|
addiw t1,s1,1
|
||
|
ld t0,128(sp)
|
||
|
mv s1,t1
|
||
|
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,-188
|
||
|
add s1,t0,t1
|
||
|
call thrd_create
|
||
|
mv t1,a0
|
||
|
slliw t0,t1,2
|
||
|
slliw t2,t1,0
|
||
|
subw a0,t0,t2
|
||
|
li t0,5
|
||
|
addiw a1,a0,3
|
||
|
div t1,a0,t0
|
||
|
li t2,5
|
||
|
div t0,a1,t2
|
||
|
mv t2,t1
|
||
|
j .Lmain_cond6
|
||
|
.Lmain_cond6:
|
||
|
slt t1,t2,t0
|
||
|
bge t2,t0,.Lmain_final8
|
||
|
j .Lmain_body7
|
||
|
.Lmain_body7:
|
||
|
addi a0,t2,0
|
||
|
slli t1,a0,2
|
||
|
add a0,s1,t1
|
||
|
flw ft0,0(a0)
|
||
|
fcvt.w.s t1,ft0,rtz
|
||
|
sd t0,128(sp)
|
||
|
sd t2,120(sp)
|
||
|
mv a0,t1
|
||
|
call putint
|
||
|
ld t0,128(sp)
|
||
|
ld t2,120(sp)
|
||
|
addiw t1,t2,1
|
||
|
mv t2,t1
|
||
|
j .Lmain_cond6
|
||
|
.Lmain_final8:
|
||
|
call thrd_join
|
||
|
li a0,10
|
||
|
call putch
|
||
|
addi t1,zero,0
|
||
|
li a0,4
|
||
|
slli t0,t1,2
|
||
|
addi t2,s0,-152
|
||
|
add t1,t2,t0
|
||
|
sd t1,120(sp)
|
||
|
call thrd_create
|
||
|
ld t1,120(sp)
|
||
|
mv t2,a0
|
||
|
slliw s1,t2,0
|
||
|
slliw t0,t2,2
|
||
|
subw t2,t0,s1
|
||
|
li t0,5
|
||
|
div s1,t2,t0
|
||
|
addiw t0,t2,3
|
||
|
li t2,5
|
||
|
div a1,t0,t2
|
||
|
mv t0,s1
|
||
|
j .Lmain_cond9
|
||
|
.Lmain_cond9:
|
||
|
slt t2,t0,a1
|
||
|
bge t0,a1,.Lmain_exit
|
||
|
j .Lmain_body10
|
||
|
.Lmain_body10:
|
||
|
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 a1,120(sp)
|
||
|
ld t1,136(sp)
|
||
|
ld t0,128(sp)
|
||
|
addiw t2,t0,1
|
||
|
mv t0,t2
|
||
|
j .Lmain_cond9
|
||
|
.Lmain_exit:
|
||
|
call thrd_join
|
||
|
li a0,10
|
||
|
call putch
|
||
|
ld s1,192(sp)
|
||
|
addiw a0,zero,0
|
||
|
ld s3,184(sp)
|
||
|
ld s2,200(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
|