sysy-data/performance_c/asm/floyd-1.s

356 lines
4.9 KiB
ArmAsm
Raw Normal View History

2024-06-14 13:10:27 +08:00
.file "floyd-1.sy"
.option pic
.attribute arch, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0"
.attribute unaligned_access, 0
.attribute stack_align, 16
.text
.align 1
.globl getvalue
.type getvalue, @function
getvalue:
or a5,a2,a3
blt a5,zero,.L5
bge a2,a1,.L5
ble a1,a3,.L5
mulw a2,a2,a1
addw a2,a2,a3
slli a2,a2,2
add a0,a0,a2
lw a0,0(a0)
ret
.L5:
li a0,-1
ret
.size getvalue, .-getvalue
.align 1
.globl mem_move
.type mem_move, @function
mem_move:
ble a2,zero,.L7
addiw a5,a2,-1
li a4,8
sext.w a7,a2
bleu a5,a4,.L9
or a5,a0,a1
andi a5,a5,7
bne a5,zero,.L9
addi a5,a0,4
beq a1,a5,.L9
srliw a6,a7,1
slli a6,a6,3
mv a5,a0
mv a4,a1
add a6,a6,a0
.L10:
ld a3,0(a5)
addi a5,a5,8
addi a4,a4,8
sd a3,-8(a4)
bne a5,a6,.L10
andi a5,a2,-2
beq a7,a5,.L7
slli a5,a5,32
srli a5,a5,30
add a0,a0,a5
lw a4,0(a0)
add a1,a1,a5
sw a4,0(a1)
ret
.L9:
slli a5,a2,2
add a5,a0,a5
.L12:
lw a4,0(a0)
addi a0,a0,4
addi a1,a1,4
sw a4,-4(a1)
bne a0,a5,.L12
.L7:
ret
.size mem_move, .-mem_move
.align 1
.globl floyd
.type floyd, @function
floyd:
mv t2,a1
ble a2,zero,.L69
addi sp,sp,-32
sd s0,24(sp)
lla s0,temp
sd s1,16(sp)
sd s2,8(sp)
sd s3,0(sp)
slli t4,a2,2
mv a1,s0
mv a6,s0
li t3,0
.L26:
mv a4,a6
mv a5,a0
li a7,0
.L25:
lw a3,0(a5)
addiw t0,a7,1
mv t6,a7
sw a3,0(a4)
sext.w a7,t0
add a5,a5,t4
add a4,a4,t4
bne a2,a7,.L25
addiw a5,t3,1
addi a0,a0,4
addi a6,a6,4
beq t6,t3,.L70
mv t3,a5
j .L26
.L69:
mulw a2,a2,a2
lla a1,temp
beq a2,zero,.L58
addiw a5,a2,-1
li a4,7
sext.w a6,a2
bleu a5,a4,.L60
andi a5,t2,7
bne a5,zero,.L60
lla a5,temp+4
beq t2,a5,.L60
srliw a3,a6,1
slli a3,a3,3
mv a5,t2
lla a4,temp
add a3,a3,t2
.L63:
ld a0,0(a4)
addi a5,a5,8
addi a4,a4,8
sd a0,-8(a5)
bne a5,a3,.L63
andi a5,a2,-2
beq a5,a6,.L58
slli a5,a5,32
srli a5,a5,30
add a1,a5,a1
lw a4,0(a1)
add a5,t2,a5
sw a4,0(a5)
ret
.L70:
sext.w t3,t3
li s2,0
li s3,0
.L27:
subw s1,t3,t6
mv a6,s2
mv a0,s0
li t5,0
.L35:
mv a2,s1
lw a3,0(a0)
sext.w a4,a2
slli a4,a4,2
add a4,a4,a1
blt a3,zero,.L28
.L71:
lw a4,0(a4)
addw a5,a2,a6
slli a5,a5,2
add a5,a5,a1
addw a3,a3,a4
blt a4,zero,.L29
lw a4,0(a5)
sext.w t1,a3
blt a4,zero,.L68
bgt a4,t1,.L68
.L29:
beq a2,t3,.L28
addiw a2,a2,1
lw a3,0(a0)
sext.w a4,a2
slli a4,a4,2
add a4,a4,a1
bge a3,zero,.L71
.L28:
addiw a5,t5,1
add a0,a0,t4
addw a6,a7,a6
beq t5,t6,.L32
mv t5,a5
j .L35
.L68:
sw a3,0(a5)
j .L29
.L32:
addiw a5,s3,1
addw t3,a7,t3
addi s0,s0,4
subw s2,s2,a7
beq s3,t6,.L34
mv s3,a5
j .L27
.L34:
mulw a2,t0,t0
li a4,7
addiw a5,a2,-1
sext.w a6,a2
bleu a5,a4,.L37
andi a5,t2,7
bne a5,zero,.L37
lla a5,temp+4
beq t2,a5,.L37
srliw a3,a6,1
slli a3,a3,3
mv a5,t2
lla a4,temp
add a3,a3,t2
.L38:
ld a0,0(a4)
addi a5,a5,8
addi a4,a4,8
sd a0,-8(a5)
bne a5,a3,.L38
andi a5,a2,-2
beq a5,a6,.L22
slli a5,a5,32
srli a5,a5,30
add a1,a5,a1
lw a4,0(a1)
add a5,t2,a5
sw a4,0(a5)
.L22:
ld s0,24(sp)
ld s1,16(sp)
ld s2,8(sp)
ld s3,0(sp)
addi sp,sp,32
jr ra
.L37:
slli a2,a2,2
lla a4,temp
add a5,t2,a2
.L42:
lw a3,0(a4)
addi t2,t2,4
addi a4,a4,4
sw a3,-4(t2)
bne a5,t2,.L42
ld s0,24(sp)
ld s1,16(sp)
ld s2,8(sp)
ld s3,0(sp)
addi sp,sp,32
jr ra
.L60:
slli a2,a2,2
lla a4,temp
add a5,t2,a2
.L66:
lw a3,0(a4)
addi t2,t2,4
addi a4,a4,4
sw a3,-4(t2)
bne a5,t2,.L66
ret
.L58:
ret
.size floyd, .-floyd
.section .text.startup,"ax",@progbits
.align 1
.globl main
.type main, @function
main:
addi sp,sp,-16
sd ra,8(sp)
sd s0,0(sp)
call getint@plt
mv s0,a0
lla a0,w
call getarray@plt
li a0,64
call _sysy_starttime@plt
mv a2,s0
lla a1,dst
lla a0,w
call floyd
li a0,66
call _sysy_stoptime@plt
mulw a0,s0,s0
lla a1,dst
call putarray@plt
ld ra,8(sp)
ld s0,0(sp)
li a0,0
addi sp,sp,16
jr ra
.size main, .-main
.globl c
.globl dst
.globl w
.globl temp
.globl _sysy_idx
.globl _sysy_us
.globl _sysy_s
.globl _sysy_m
.globl _sysy_h
.globl _sysy_l2
.globl _sysy_l1
.globl _sysy_end
.globl _sysy_start
.bss
.align 3
.type c, @object
.size c, 8388608
c:
.zero 8388608
.type dst, @object
.size dst, 8388608
dst:
.zero 8388608
.type w, @object
.size w, 8388608
w:
.zero 8388608
.type temp, @object
.size temp, 8388608
temp:
.zero 8388608
.type _sysy_idx, @object
.size _sysy_idx, 4
_sysy_idx:
.zero 4
.zero 4
.type _sysy_us, @object
.size _sysy_us, 4096
_sysy_us:
.zero 4096
.type _sysy_s, @object
.size _sysy_s, 4096
_sysy_s:
.zero 4096
.type _sysy_m, @object
.size _sysy_m, 4096
_sysy_m:
.zero 4096
.type _sysy_h, @object
.size _sysy_h, 4096
_sysy_h:
.zero 4096
.type _sysy_l2, @object
.size _sysy_l2, 4096
_sysy_l2:
.zero 4096
.type _sysy_l1, @object
.size _sysy_l1, 4096
_sysy_l1:
.zero 4096
.type _sysy_end, @object
.size _sysy_end, 16
_sysy_end:
.zero 16
.type _sysy_start, @object
.size _sysy_start, 16
_sysy_start:
.zero 16
.ident "GCC: (Debian 12.2.0-13) 12.2.0"
.section .note.GNU-stack,"",@progbits