185 lines
2.6 KiB
ArmAsm
185 lines
2.6 KiB
ArmAsm
.text
|
|
.attribute 4, 16
|
|
.attribute 5, "rv64i2p0_m2p0_a2p0_f2p0_d2p0_c2p0"
|
|
.file "55_sort_test1.sy"
|
|
.globl bubblesort
|
|
.p2align 1
|
|
.type bubblesort,@function
|
|
bubblesort:
|
|
lui a7, %hi(n)
|
|
lw a2, %lo(n)(a7)
|
|
li a1, 2
|
|
blt a2, a1, .LBB0_8
|
|
li t0, 0
|
|
addi a6, a0, 4
|
|
j .LBB0_3
|
|
.LBB0_2:
|
|
addiw t0, t0, 1
|
|
addiw a1, a2, -1
|
|
bge t0, a1, .LBB0_8
|
|
.LBB0_3:
|
|
not t1, t0
|
|
addw a1, a2, t1
|
|
blez a1, .LBB0_2
|
|
lw a5, 0(a0)
|
|
li a1, 0
|
|
mv a3, a6
|
|
j .LBB0_6
|
|
.LBB0_5:
|
|
sw a5, 0(a3)
|
|
sw a4, -4(a3)
|
|
lw a2, %lo(n)(a7)
|
|
addi a1, a1, 1
|
|
addw a4, a2, t1
|
|
addi a3, a3, 4
|
|
bge a1, a4, .LBB0_2
|
|
.LBB0_6:
|
|
lw a4, 0(a3)
|
|
blt a4, a5, .LBB0_5
|
|
mv a5, a4
|
|
addi a1, a1, 1
|
|
addw a4, a2, t1
|
|
addi a3, a3, 4
|
|
blt a1, a4, .LBB0_6
|
|
j .LBB0_2
|
|
.LBB0_8:
|
|
li a0, 0
|
|
ret
|
|
.Lfunc_end0:
|
|
.size bubblesort, .Lfunc_end0-bubblesort
|
|
|
|
.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 s2, %hi(n)
|
|
li a0, 10
|
|
sw a0, %lo(n)(s2)
|
|
li a0, 7
|
|
sw a0, 36(sp)
|
|
li a0, 9
|
|
sw a0, 44(sp)
|
|
li a0, 8
|
|
sw a0, 40(sp)
|
|
li a0, 4
|
|
sw a0, 24(sp)
|
|
li a0, 6
|
|
sw a0, 32(sp)
|
|
li a0, 5
|
|
sw a0, 28(sp)
|
|
li a0, 3
|
|
sw a0, 20(sp)
|
|
sw zero, 8(sp)
|
|
li s0, 2
|
|
sw s0, 16(sp)
|
|
li s1, 1
|
|
sw s1, 12(sp)
|
|
li a0, 0
|
|
call putint
|
|
li a0, 10
|
|
call putch
|
|
lw a0, %lo(n)(s2)
|
|
blt a0, s0, .LBB1_3
|
|
addi s0, sp, 12
|
|
.LBB1_2:
|
|
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_2
|
|
.LBB1_3:
|
|
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
|