316 lines
4.5 KiB
ArmAsm
316 lines
4.5 KiB
ArmAsm
.text
|
|
.attribute 4, 16
|
|
.attribute 5, "rv64i2p0_m2p0_a2p0_f2p0_d2p0_c2p0"
|
|
.file "floyd-1.sy"
|
|
.globl getvalue
|
|
.p2align 1
|
|
.type getvalue,@function
|
|
getvalue:
|
|
li a4, -1
|
|
srli a4, a4, 32
|
|
bltz a2, .LBB0_3
|
|
slt a5, a2, a1
|
|
xori a6, a5, 1
|
|
slti a5, a3, 0
|
|
or a6, a6, a5
|
|
slt a5, a3, a1
|
|
xori a5, a5, 1
|
|
or a5, a5, a6
|
|
bnez a5, .LBB0_3
|
|
mulw a1, a2, a1
|
|
addw a1, a1, a3
|
|
slli a1, a1, 2
|
|
add a0, a0, a1
|
|
lw a4, 0(a0)
|
|
.LBB0_3:
|
|
sext.w a0, a4
|
|
ret
|
|
.Lfunc_end0:
|
|
.size getvalue, .Lfunc_end0-getvalue
|
|
|
|
.globl mem_move
|
|
.p2align 1
|
|
.type mem_move,@function
|
|
mem_move:
|
|
blez a2, .LBB1_3
|
|
slli a2, a2, 32
|
|
srli a2, a2, 32
|
|
.LBB1_2:
|
|
lw a3, 0(a0)
|
|
sw a3, 0(a1)
|
|
addi a1, a1, 4
|
|
addi a2, a2, -1
|
|
addi a0, a0, 4
|
|
bnez a2, .LBB1_2
|
|
.LBB1_3:
|
|
ret
|
|
.Lfunc_end1:
|
|
.size mem_move, .Lfunc_end1-mem_move
|
|
|
|
.globl floyd
|
|
.p2align 1
|
|
.type floyd,@function
|
|
floyd:
|
|
addi sp, sp, -32
|
|
sd s0, 24(sp)
|
|
sd s1, 16(sp)
|
|
sd s2, 8(sp)
|
|
blez a2, .LBB2_23
|
|
li a6, 0
|
|
slli a4, a2, 32
|
|
srli t0, a4, 32
|
|
lui a3, %hi(temp)
|
|
addi a3, a3, %lo(temp)
|
|
srli t2, a4, 30
|
|
li a4, 1
|
|
li a7, -1
|
|
j .LBB2_3
|
|
.LBB2_2:
|
|
addi a6, a6, 1
|
|
sltu a4, a6, t0
|
|
addi a3, a3, 4
|
|
addi a0, a0, 4
|
|
beq a6, t0, .LBB2_7
|
|
.LBB2_3:
|
|
andi s1, a4, 1
|
|
mv a4, t0
|
|
mv a5, a3
|
|
beqz s1, .LBB2_6
|
|
li a4, 0
|
|
mv s0, t0
|
|
.LBB2_5:
|
|
add a5, a0, a4
|
|
lw a5, 0(a5)
|
|
add s1, a3, a4
|
|
sw a5, 0(s1)
|
|
addi s0, s0, -1
|
|
add a4, a4, t2
|
|
bnez s0, .LBB2_5
|
|
j .LBB2_2
|
|
.LBB2_6:
|
|
sw a7, 0(a5)
|
|
addi a4, a4, -1
|
|
add a5, a5, t2
|
|
bnez a4, .LBB2_6
|
|
j .LBB2_2
|
|
.LBB2_7:
|
|
blez a2, .LBB2_23
|
|
li a7, 0
|
|
lui a0, %hi(temp)
|
|
addi t1, a0, %lo(temp)
|
|
li a0, 1
|
|
mv a6, t1
|
|
j .LBB2_10
|
|
.LBB2_9:
|
|
addi a7, a7, 1
|
|
sltu a0, a7, t0
|
|
add a6, a6, t2
|
|
beq a7, t0, .LBB2_23
|
|
.LBB2_10:
|
|
andi a0, a0, 1
|
|
beqz a0, .LBB2_9
|
|
li t5, 0
|
|
li a0, 1
|
|
mv t4, t1
|
|
j .LBB2_13
|
|
.LBB2_12:
|
|
addi t5, t5, 1
|
|
sltu a0, t5, t0
|
|
add t4, t4, t2
|
|
beq t5, t0, .LBB2_9
|
|
.LBB2_13:
|
|
andi a0, a0, 1
|
|
beqz a0, .LBB2_12
|
|
li a3, 0
|
|
mul t3, t5, t0
|
|
add a0, t3, a7
|
|
slli a0, a0, 2
|
|
add t6, a0, t1
|
|
mv a5, t0
|
|
mv a0, a6
|
|
mv a4, t4
|
|
j .LBB2_18
|
|
.LBB2_15:
|
|
mv s1, a4
|
|
.LBB2_16:
|
|
sw s0, 0(s1)
|
|
.LBB2_17:
|
|
addi a3, a3, 1
|
|
addi a4, a4, 4
|
|
addi a5, a5, -1
|
|
addi a0, a0, 4
|
|
beqz a5, .LBB2_12
|
|
.LBB2_18:
|
|
lw s0, 0(t6)
|
|
bltz s0, .LBB2_17
|
|
lw s1, 0(a0)
|
|
bltz s1, .LBB2_17
|
|
lw s2, 0(a4)
|
|
addw s0, s0, s1
|
|
bltz s2, .LBB2_15
|
|
bgeu s0, s2, .LBB2_17
|
|
add s1, a3, t3
|
|
slli s1, s1, 2
|
|
add s1, s1, t1
|
|
j .LBB2_16
|
|
.LBB2_23:
|
|
mulw a2, a2, a2
|
|
beqz a2, .LBB2_26
|
|
lui a0, %hi(temp)
|
|
addi a0, a0, %lo(temp)
|
|
slli a2, a2, 32
|
|
srli a2, a2, 32
|
|
.LBB2_25:
|
|
lw a3, 0(a0)
|
|
sw a3, 0(a1)
|
|
addi a0, a0, 4
|
|
addi a2, a2, -1
|
|
addi a1, a1, 4
|
|
bnez a2, .LBB2_25
|
|
.LBB2_26:
|
|
ld s0, 24(sp)
|
|
ld s1, 16(sp)
|
|
ld s2, 8(sp)
|
|
addi sp, sp, 32
|
|
ret
|
|
.Lfunc_end2:
|
|
.size floyd, .Lfunc_end2-floyd
|
|
|
|
.globl main
|
|
.p2align 1
|
|
.type main,@function
|
|
main:
|
|
addi sp, sp, -32
|
|
sd ra, 24(sp)
|
|
sd s0, 16(sp)
|
|
sd s1, 8(sp)
|
|
sd s2, 0(sp)
|
|
call getint
|
|
mv s2, a0
|
|
lui a0, %hi(w)
|
|
addi s1, a0, %lo(w)
|
|
mv a0, s1
|
|
call getarray
|
|
li a0, 63
|
|
call _sysy_starttime
|
|
lui a0, %hi(dst)
|
|
addi s0, a0, %lo(dst)
|
|
mv a0, s1
|
|
mv a1, s0
|
|
mv a2, s2
|
|
call floyd
|
|
li a0, 65
|
|
call _sysy_stoptime
|
|
mulw a0, s2, s2
|
|
mv a1, s0
|
|
call putarray
|
|
li a0, 0
|
|
ld ra, 24(sp)
|
|
ld s0, 16(sp)
|
|
ld s1, 8(sp)
|
|
ld s2, 0(sp)
|
|
addi sp, sp, 32
|
|
ret
|
|
.Lfunc_end3:
|
|
.size main, .Lfunc_end3-main
|
|
|
|
.type temp,@object
|
|
.bss
|
|
.globl temp
|
|
.p2align 2
|
|
temp:
|
|
.zero 8388608
|
|
.size temp, 8388608
|
|
|
|
.type w,@object
|
|
.globl w
|
|
.p2align 2
|
|
w:
|
|
.zero 8388608
|
|
.size w, 8388608
|
|
|
|
.type dst,@object
|
|
.globl dst
|
|
.p2align 2
|
|
dst:
|
|
.zero 8388608
|
|
.size dst, 8388608
|
|
|
|
.type _sysy_start,@object
|
|
.globl _sysy_start
|
|
.p2align 3
|
|
_sysy_start:
|
|
.zero 16
|
|
.size _sysy_start, 16
|
|
|
|
.type _sysy_end,@object
|
|
.globl _sysy_end
|
|
.p2align 3
|
|
_sysy_end:
|
|
.zero 16
|
|
.size _sysy_end, 16
|
|
|
|
.type _sysy_l1,@object
|
|
.globl _sysy_l1
|
|
.p2align 2
|
|
_sysy_l1:
|
|
.zero 4096
|
|
.size _sysy_l1, 4096
|
|
|
|
.type _sysy_l2,@object
|
|
.globl _sysy_l2
|
|
.p2align 2
|
|
_sysy_l2:
|
|
.zero 4096
|
|
.size _sysy_l2, 4096
|
|
|
|
.type _sysy_h,@object
|
|
.globl _sysy_h
|
|
.p2align 2
|
|
_sysy_h:
|
|
.zero 4096
|
|
.size _sysy_h, 4096
|
|
|
|
.type _sysy_m,@object
|
|
.globl _sysy_m
|
|
.p2align 2
|
|
_sysy_m:
|
|
.zero 4096
|
|
.size _sysy_m, 4096
|
|
|
|
.type _sysy_s,@object
|
|
.globl _sysy_s
|
|
.p2align 2
|
|
_sysy_s:
|
|
.zero 4096
|
|
.size _sysy_s, 4096
|
|
|
|
.type _sysy_us,@object
|
|
.globl _sysy_us
|
|
.p2align 2
|
|
_sysy_us:
|
|
.zero 4096
|
|
.size _sysy_us, 4096
|
|
|
|
.type _sysy_idx,@object
|
|
.section .sbss,"aw",@nobits
|
|
.globl _sysy_idx
|
|
.p2align 2
|
|
_sysy_idx:
|
|
.word 0
|
|
.size _sysy_idx, 4
|
|
|
|
.type c,@object
|
|
.bss
|
|
.globl c
|
|
.p2align 2
|
|
c:
|
|
.zero 8388608
|
|
.size c, 8388608
|
|
|
|
.ident "Debian clang version 14.0.6"
|
|
.section ".note.GNU-stack","",@progbits
|
|
.addrsig
|
|
.addrsig_sym w
|
|
.addrsig_sym dst
|