330 lines
4.8 KiB
ArmAsm
330 lines
4.8 KiB
ArmAsm
.text
|
|
.attribute 4, 16
|
|
.attribute 5, "rv64i2p0_m2p0_a2p0_f2p0_d2p0_c2p0"
|
|
.file "56_sort_test2.sy"
|
|
.globl insertsort
|
|
.p2align 1
|
|
.type insertsort,@function
|
|
insertsort:
|
|
lui a6, %hi(n)
|
|
lw a1, %lo(n)(a6)
|
|
li a2, 2
|
|
blt a1, a2, .LBB0_8
|
|
li a7, 0
|
|
li a1, -1
|
|
srli a3, a1, 32
|
|
addi t0, a0, 4
|
|
li t1, 1
|
|
li t2, 1
|
|
j .LBB0_4
|
|
.LBB0_2:
|
|
addi a4, a5, 1
|
|
.LBB0_3:
|
|
slli a1, a4, 32
|
|
srai a1, a1, 30
|
|
add a1, a1, a0
|
|
sw a2, 0(a1)
|
|
lw a1, %lo(n)(a6)
|
|
addi t2, t2, 1
|
|
addi a7, a7, 1
|
|
addi t0, t0, 4
|
|
bge t2, a1, .LBB0_8
|
|
.LBB0_4:
|
|
slli a1, t2, 2
|
|
add a1, a1, a0
|
|
lw a2, 0(a1)
|
|
mv a4, t0
|
|
mv a5, a7
|
|
.LBB0_5:
|
|
add a1, a3, a5
|
|
addi a1, a1, 1
|
|
and a1, a1, a3
|
|
slli a1, a1, 2
|
|
add a1, a1, a0
|
|
lw a1, 0(a1)
|
|
bge a2, a1, .LBB0_2
|
|
sw a1, 0(a4)
|
|
addi a1, a5, 1
|
|
addi a5, a5, -1
|
|
addi a4, a4, -4
|
|
blt t1, a1, .LBB0_5
|
|
li a4, 0
|
|
j .LBB0_3
|
|
.LBB0_8:
|
|
li a0, 0
|
|
ret
|
|
.Lfunc_end0:
|
|
.size insertsort, .Lfunc_end0-insertsort
|
|
|
|
.globl main
|
|
.p2align 1
|
|
.type main,@function
|
|
main:
|
|
addi sp, sp, -80
|
|
sd ra, 72(sp)
|
|
sd s0, 64(sp)
|
|
sd s1, 56(sp)
|
|
sd s2, 48(sp)
|
|
lui a0, %hi(n)
|
|
li a1, 10
|
|
sw a1, %lo(n)(a0)
|
|
li a1, 6
|
|
sw a1, 32(sp)
|
|
li a0, 5
|
|
sw a0, 36(sp)
|
|
li a0, 7
|
|
sw a0, 40(sp)
|
|
li a2, 8
|
|
sw a2, 44(sp)
|
|
sw zero, 8(sp)
|
|
li a3, 9
|
|
sw a3, 28(sp)
|
|
li a2, 4
|
|
sw a2, 24(sp)
|
|
li a2, 3
|
|
sw a2, 20(sp)
|
|
li a2, 2
|
|
sw a2, 16(sp)
|
|
li a2, 1
|
|
sw a2, 12(sp)
|
|
li a2, 6
|
|
bnez zero, .LBB1_7
|
|
sw a3, 32(sp)
|
|
lw a3, 24(sp)
|
|
li a2, 5
|
|
bge a1, a3, .LBB1_7
|
|
sw a3, 28(sp)
|
|
lw a3, 20(sp)
|
|
li a2, 4
|
|
bge a1, a3, .LBB1_7
|
|
sw a3, 24(sp)
|
|
lw a3, 16(sp)
|
|
li a2, 3
|
|
bge a1, a3, .LBB1_7
|
|
sw a3, 20(sp)
|
|
lw a3, 12(sp)
|
|
li a2, 2
|
|
bge a1, a3, .LBB1_7
|
|
sw a3, 16(sp)
|
|
lw a3, 8(sp)
|
|
li a2, 1
|
|
bge a1, a3, .LBB1_7
|
|
li a2, 0
|
|
sw a3, 12(sp)
|
|
.LBB1_7:
|
|
slli a3, a2, 2
|
|
addi a2, sp, 8
|
|
add a3, a3, a2
|
|
sw a1, 0(a3)
|
|
lw a1, 36(sp)
|
|
lw a3, 32(sp)
|
|
bge a1, a3, .LBB1_15
|
|
sw a3, 36(sp)
|
|
lw a3, 28(sp)
|
|
li a0, 6
|
|
bge a1, a3, .LBB1_15
|
|
sw a3, 32(sp)
|
|
lw a3, 24(sp)
|
|
li a0, 5
|
|
bge a1, a3, .LBB1_15
|
|
sw a3, 28(sp)
|
|
lw a3, 20(sp)
|
|
li a0, 4
|
|
bge a1, a3, .LBB1_15
|
|
sw a3, 24(sp)
|
|
lw a3, 16(sp)
|
|
li a0, 3
|
|
bge a1, a3, .LBB1_15
|
|
sw a3, 20(sp)
|
|
lw a3, 12(sp)
|
|
li a0, 2
|
|
bge a1, a3, .LBB1_15
|
|
sw a3, 16(sp)
|
|
lw a3, 8(sp)
|
|
li a0, 1
|
|
bge a1, a3, .LBB1_15
|
|
li a0, 0
|
|
sw a3, 12(sp)
|
|
.LBB1_15:
|
|
slli a0, a0, 2
|
|
add a0, a0, a2
|
|
sw a1, 0(a0)
|
|
lw a0, 40(sp)
|
|
lw a2, 36(sp)
|
|
li a1, 8
|
|
bge a0, a2, .LBB1_24
|
|
sw a2, 40(sp)
|
|
lw a2, 32(sp)
|
|
li a1, 7
|
|
bge a0, a2, .LBB1_24
|
|
sw a2, 36(sp)
|
|
lw a2, 28(sp)
|
|
li a1, 6
|
|
bge a0, a2, .LBB1_24
|
|
sw a2, 32(sp)
|
|
lw a2, 24(sp)
|
|
li a1, 5
|
|
bge a0, a2, .LBB1_24
|
|
sw a2, 28(sp)
|
|
lw a2, 20(sp)
|
|
li a1, 4
|
|
bge a0, a2, .LBB1_24
|
|
sw a2, 24(sp)
|
|
lw a2, 16(sp)
|
|
li a1, 3
|
|
bge a0, a2, .LBB1_24
|
|
sw a2, 20(sp)
|
|
lw a2, 12(sp)
|
|
li a1, 2
|
|
bge a0, a2, .LBB1_24
|
|
sw a2, 16(sp)
|
|
lw a2, 8(sp)
|
|
li a1, 1
|
|
bge a0, a2, .LBB1_24
|
|
li a1, 0
|
|
sw a2, 12(sp)
|
|
.LBB1_24:
|
|
slli a1, a1, 2
|
|
addi s0, sp, 8
|
|
add a1, a1, s0
|
|
sw a0, 0(a1)
|
|
lw a0, 44(sp)
|
|
lw a2, 40(sp)
|
|
li a1, 9
|
|
bge a0, a2, .LBB1_34
|
|
sw a2, 44(sp)
|
|
lw a2, 36(sp)
|
|
li a1, 8
|
|
bge a0, a2, .LBB1_34
|
|
sw a2, 40(sp)
|
|
lw a2, 32(sp)
|
|
li a1, 7
|
|
bge a0, a2, .LBB1_34
|
|
sw a2, 36(sp)
|
|
lw a2, 28(sp)
|
|
li a1, 6
|
|
bge a0, a2, .LBB1_34
|
|
sw a2, 32(sp)
|
|
lw a2, 24(sp)
|
|
li a1, 5
|
|
bge a0, a2, .LBB1_34
|
|
sw a2, 28(sp)
|
|
lw a2, 20(sp)
|
|
li a1, 4
|
|
bge a0, a2, .LBB1_34
|
|
sw a2, 24(sp)
|
|
lw a2, 16(sp)
|
|
li a1, 3
|
|
bge a0, a2, .LBB1_34
|
|
sw a2, 20(sp)
|
|
lw a2, 12(sp)
|
|
li a1, 2
|
|
bge a0, a2, .LBB1_34
|
|
sw a2, 16(sp)
|
|
lw a2, 8(sp)
|
|
li a1, 1
|
|
bge a0, a2, .LBB1_34
|
|
li a1, 0
|
|
sw a2, 12(sp)
|
|
.LBB1_34:
|
|
li s1, 0
|
|
slli a1, a1, 2
|
|
add a1, a1, s0
|
|
sw a0, 0(a1)
|
|
lui s2, %hi(n)
|
|
.LBB1_35:
|
|
lw a0, 0(s0)
|
|
call putint
|
|
li a0, 10
|
|
call putch
|
|
lw a0, %lo(n)(s2)
|
|
addi s1, s1, 1
|
|
addi s0, s0, 4
|
|
blt s1, a0, .LBB1_35
|
|
li a0, 0
|
|
ld ra, 72(sp)
|
|
ld s0, 64(sp)
|
|
ld s1, 56(sp)
|
|
ld s2, 48(sp)
|
|
addi sp, sp, 80
|
|
ret
|
|
.Lfunc_end1:
|
|
.size main, .Lfunc_end1-main
|
|
|
|
.type n,@object
|
|
.section .sbss,"aw",@nobits
|
|
.globl n
|
|
.p2align 2
|
|
n:
|
|
.word 0
|
|
.size n, 4
|
|
|
|
.type _sysy_start,@object
|
|
.bss
|
|
.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
|
|
|
|
.ident "Debian clang version 14.0.6"
|
|
.section ".note.GNU-stack","",@progbits
|
|
.addrsig
|