sysy-data/functional_c/asm/61_sort_test7.s

232 lines
3.4 KiB
ArmAsm

.file "61_sort_test7.sy"
.option pic
.attribute arch, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0"
.attribute unaligned_access, 0
.attribute stack_align, 16
.text
.align 1
.type merge_sort.part.0, @function
merge_sort.part.0:
addw a4,a0,a1
srliw a5,a4,31
addi sp,sp,-64
addw a5,a5,a4
sd s0,48(sp)
sd s3,24(sp)
sraiw s0,a5,1
sd s4,16(sp)
sd s5,8(sp)
sd ra,56(sp)
sd s1,40(sp)
sd s2,32(sp)
addiw a5,a0,1
mv s4,a0
mv s3,a1
mv s5,s0
bge a5,s0,.L2
mv a1,s0
call merge_sort.part.0
.L2:
addiw a5,s5,1
blt a5,s3,.L16
.L3:
bge s4,s0,.L11
ble s3,s0,.L12
addi a2,s4,100
lla a6,.LANCHOR0
slli a2,a2,2
add a2,a6,a2
mv s2,s4
mv s1,s0
mv a3,s4
j .L8
.L17:
addiw a3,a3,1
sw a4,0(a2)
addiw s2,s2,1
ble s0,a3,.L4
.L18:
addi a2,a2,4
ble s3,s1,.L5
.L8:
slli a4,a3,2
slli a5,s1,2
add a4,a6,a4
add a5,a6,a5
lw a4,0(a4)
lw a5,0(a5)
blt a4,a5,.L17
mv a4,a5
sw a4,0(a2)
addiw s1,s1,1
addiw s2,s2,1
bgt s0,a3,.L18
.L4:
ble s3,s1,.L9
addiw a2,s3,-1
subw a2,a2,s1
addi s2,s2,100
slli a5,a2,32
lla a0,.LANCHOR0
srli a2,a5,30
slli a1,s1,2
slli s2,s2,2
add a1,a0,a1
addi a2,a2,4
add a0,a0,s2
call memmove@plt
.L9:
bge s4,s3,.L1
addiw a2,s3,-1
subw a2,a2,s4
ld s0,48(sp)
slli a5,s4,2
ld ra,56(sp)
ld s1,40(sp)
ld s2,32(sp)
ld s3,24(sp)
ld s4,16(sp)
ld s5,8(sp)
slli a4,a2,32
lla a0,.LANCHOR0
srli a2,a4,30
addi a1,a5,400
add a1,a0,a1
addi a2,a2,4
add a0,a0,a5
addi sp,sp,64
tail memmove@plt
.L1:
ld ra,56(sp)
ld s0,48(sp)
ld s1,40(sp)
ld s2,32(sp)
ld s3,24(sp)
ld s4,16(sp)
ld s5,8(sp)
addi sp,sp,64
jr ra
.L12:
mv s1,s0
mv s2,s4
mv a3,s4
lla a6,.LANCHOR0
.L5:
addiw a2,s5,-1
subw a2,a2,a3
slli a5,a2,32
addiw a0,s2,100
srli a2,a5,30
slli a1,a3,2
slli a0,a0,2
addi a2,a2,4
add a1,a6,a1
add a0,a6,a0
sext.w s0,a3
call memmove@plt
addw a5,s2,s5
subw s2,a5,s0
j .L4
.L16:
mv a1,s3
mv a0,s0
call merge_sort.part.0
j .L3
.L11:
mv s1,s0
mv s2,s4
j .L4
.size merge_sort.part.0, .-merge_sort.part.0
.align 1
.globl merge_sort
.type merge_sort, @function
merge_sort:
addiw a5,a0,1
blt a5,a1,.L21
ret
.L21:
tail merge_sort.part.0
.size merge_sort, .-merge_sort
.section .text.startup,"ax",@progbits
.align 1
.globl main
.type main, @function
main:
addi sp,sp,-16
lla a0,.LANCHOR0
sd s0,0(sp)
sd ra,8(sp)
call getarray@plt
li a5,1
mv s0,a0
ble a0,a5,.L23
mv a1,a0
li a0,0
call merge_sort.part.0
.L23:
mv a0,s0
lla a1,.LANCHOR0
call putarray@plt
ld ra,8(sp)
ld s0,0(sp)
li a0,0
addi sp,sp,16
jr ra
.size main, .-main
.globl buf
.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
.set .LANCHOR0,. + 0
.type buf, @object
.size buf, 800
buf:
.zero 800
.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