sysy-data/functional_c/asm/58_sort_test4.s

464 lines
6.6 KiB
ArmAsm
Raw Permalink Normal View History

2024-06-14 13:34:46 +08:00
.text
.attribute 4, 16
.attribute 5, "rv64i2p0_m2p0_a2p0_f2p0_d2p0_c2p0"
.file "58_sort_test4.sy"
.globl select_sort
.p2align 1
.type select_sort,@function
select_sort:
li a2, 2
blt a1, a2, .LBB0_10
li t2, 0
addiw a2, a1, -1
slli a1, a1, 32
srli t3, a1, 32
slli a2, a2, 32
srli a6, a2, 32
addi t0, a0, 4
li t1, 1
j .LBB0_3
.LBB0_2:
addi t1, t1, 1
addi t0, t0, 4
mv t2, a7
beq a7, a6, .LBB0_10
.LBB0_3:
addi a7, t2, 1
mv t4, t2
bgeu a7, t3, .LBB0_8
mv a3, t0
mv a4, t1
mv a5, t2
j .LBB0_6
.LBB0_5:
addi a4, a4, 1
addi a3, a3, 4
mv a5, t4
beq t3, a4, .LBB0_8
.LBB0_6:
sext.w a2, a5
slli a2, a2, 2
add a2, a2, a0
lw a1, 0(a2)
lw a2, 0(a3)
mv t4, a4
blt a2, a1, .LBB0_5
mv t4, a5
j .LBB0_5
.LBB0_8:
slli a1, t4, 32
srli a1, a1, 32
beq t2, a1, .LBB0_2
sext.w a1, t4
slli a1, a1, 2
add a1, a1, a0
slli a2, t2, 2
add a2, a2, a0
lw a3, 0(a2)
lw a4, 0(a1)
sw a3, 0(a1)
sw a4, 0(a2)
j .LBB0_2
.LBB0_10:
li a0, 0
ret
.Lfunc_end0:
.size select_sort, .Lfunc_end0-select_sort
.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 a0, 9
sw a0, 16(sp)
li a0, 2
sw a0, 20(sp)
li a0, 6
sw a0, 32(sp)
li a0, 5
sw a0, 36(sp)
li a0, 7
sw a0, 40(sp)
li a0, 8
sw a0, 44(sp)
li a0, 4
sw a0, 24(sp)
sw zero, 8(sp)
li a0, 3
sw a0, 28(sp)
li a1, 1
sw a1, 12(sp)
bnez zero, .LBB1_2
slli a0, a0, 2
addi a1, sp, 8
add a0, a0, a1
lw a1, 16(sp)
lw a2, 0(a0)
sw a1, 0(a0)
sw a2, 16(sp)
.LBB1_2:
lw a1, 20(sp)
lw a2, 24(sp)
li a3, 16
blt a2, a1, .LBB1_4
li a3, 12
.LBB1_4:
addi a0, sp, 8
add a3, a3, a0
lw a4, 0(a3)
lw a5, 28(sp)
li a3, 5
blt a5, a4, .LBB1_6
slt a1, a2, a1
addi a3, a1, 3
.LBB1_6:
slli a1, a3, 2
add a1, a1, a0
lw a2, 0(a1)
lw a4, 32(sp)
li a1, 6
blt a4, a2, .LBB1_8
mv a1, a3
.LBB1_8:
slli a2, a1, 2
add a2, a2, a0
lw a3, 0(a2)
lw a4, 36(sp)
li a2, 7
blt a4, a3, .LBB1_10
mv a2, a1
.LBB1_10:
slli a1, a2, 2
add a1, a1, a0
lw a3, 0(a1)
lw a4, 40(sp)
li a1, 8
blt a4, a3, .LBB1_12
mv a1, a2
.LBB1_12:
slli a2, a1, 2
add a0, a0, a2
lw a2, 0(a0)
lw a3, 44(sp)
li a0, 9
bge a3, a2, .LBB1_47
li a1, 3
bne a0, a1, .LBB1_48
.LBB1_14:
lw a1, 24(sp)
lw a2, 28(sp)
li a3, 20
blt a2, a1, .LBB1_16
.LBB1_15:
li a3, 16
.LBB1_16:
addi a0, sp, 8
add a3, a3, a0
lw a4, 0(a3)
lw a5, 32(sp)
li a3, 6
blt a5, a4, .LBB1_18
slt a1, a2, a1
ori a3, a1, 4
.LBB1_18:
slli a1, a3, 2
add a1, a1, a0
lw a2, 0(a1)
lw a4, 36(sp)
li a1, 7
blt a4, a2, .LBB1_20
mv a1, a3
.LBB1_20:
slli a2, a1, 2
add a2, a2, a0
lw a3, 0(a2)
lw a4, 40(sp)
li a2, 8
blt a4, a3, .LBB1_22
mv a2, a1
.LBB1_22:
slli a1, a2, 2
add a0, a0, a1
lw a1, 0(a0)
lw a3, 44(sp)
li a0, 9
bge a3, a1, .LBB1_49
li a1, 4
bne a0, a1, .LBB1_50
.LBB1_24:
lw a1, 28(sp)
lw a2, 32(sp)
li a3, 24
blt a2, a1, .LBB1_26
.LBB1_25:
li a3, 20
.LBB1_26:
addi a0, sp, 8
add a3, a3, a0
lw a4, 0(a3)
lw a5, 36(sp)
li a3, 7
blt a5, a4, .LBB1_28
slt a1, a2, a1
addi a3, a1, 5
.LBB1_28:
slli a1, a3, 2
add a1, a1, a0
lw a2, 0(a1)
lw a4, 40(sp)
li a1, 8
blt a4, a2, .LBB1_30
mv a1, a3
.LBB1_30:
slli a2, a1, 2
add a0, a0, a2
lw a2, 0(a0)
lw a3, 44(sp)
li a0, 9
bge a3, a2, .LBB1_51
li a1, 5
bne a0, a1, .LBB1_52
.LBB1_32:
lw a0, 32(sp)
lw a1, 36(sp)
li a2, 28
blt a1, a0, .LBB1_34
.LBB1_33:
li a2, 24
.LBB1_34:
addi a3, sp, 8
add a2, a2, a3
lw a4, 0(a2)
lw a5, 40(sp)
li a2, 8
blt a5, a4, .LBB1_36
slt a0, a1, a0
ori a2, a0, 6
.LBB1_36:
slli a0, a2, 2
add a0, a0, a3
lw a1, 0(a0)
lw a3, 44(sp)
li a0, 9
bge a3, a1, .LBB1_53
li a1, 6
bne a0, a1, .LBB1_54
.LBB1_38:
lw a0, 36(sp)
lw a1, 40(sp)
li a2, 32
blt a1, a0, .LBB1_40
.LBB1_39:
li a2, 28
.LBB1_40:
addi a3, sp, 8
add a2, a2, a3
lw a3, 0(a2)
lw a4, 44(sp)
li a2, 9
bge a4, a3, .LBB1_55
li a0, 7
bne a2, a0, .LBB1_56
.LBB1_42:
lw a0, 40(sp)
lw a1, 44(sp)
bge a1, a0, .LBB1_44
.LBB1_43:
lw a0, 40(sp)
lw a1, 44(sp)
sw a0, 44(sp)
sw a1, 40(sp)
.LBB1_44:
li s0, 0
addi s1, sp, 8
lui s2, %hi(n)
.LBB1_45:
lw a0, 0(s1)
call putint
li a0, 10
call putch
lw a0, %lo(n)(s2)
addi s0, s0, 1
addi s1, s1, 4
blt s0, a0, .LBB1_45
li a0, 0
ld ra, 72(sp)
ld s0, 64(sp)
ld s1, 56(sp)
ld s2, 48(sp)
addi sp, sp, 80
ret
.LBB1_47:
mv a0, a1
li a1, 3
beq a0, a1, .LBB1_14
.LBB1_48:
slli a0, a0, 32
srli a0, a0, 30
addi a1, sp, 8
add a0, a0, a1
lw a1, 20(sp)
lw a2, 0(a0)
sw a1, 0(a0)
sw a2, 20(sp)
lw a1, 24(sp)
lw a2, 28(sp)
li a3, 20
bge a2, a1, .LBB1_15
j .LBB1_16
.LBB1_49:
mv a0, a2
li a1, 4
beq a0, a1, .LBB1_24
.LBB1_50:
slli a0, a0, 2
addi a1, sp, 8
add a0, a0, a1
lw a1, 24(sp)
lw a2, 0(a0)
sw a1, 0(a0)
sw a2, 24(sp)
lw a1, 28(sp)
lw a2, 32(sp)
li a3, 24
bge a2, a1, .LBB1_25
j .LBB1_26
.LBB1_51:
mv a0, a1
li a1, 5
beq a0, a1, .LBB1_32
.LBB1_52:
slli a0, a0, 2
addi a1, sp, 8
add a0, a0, a1
lw a1, 28(sp)
lw a2, 0(a0)
sw a1, 0(a0)
sw a2, 28(sp)
lw a0, 32(sp)
lw a1, 36(sp)
li a2, 28
bge a1, a0, .LBB1_33
j .LBB1_34
.LBB1_53:
mv a0, a2
li a1, 6
beq a0, a1, .LBB1_38
.LBB1_54:
slli a0, a0, 2
addi a1, sp, 8
add a0, a0, a1
lw a1, 32(sp)
lw a2, 0(a0)
sw a1, 0(a0)
sw a2, 32(sp)
lw a0, 36(sp)
lw a1, 40(sp)
li a2, 32
bge a1, a0, .LBB1_39
j .LBB1_40
.LBB1_55:
slt a0, a1, a0
addi a2, a0, 7
li a0, 7
beq a2, a0, .LBB1_42
.LBB1_56:
slli a0, a2, 2
addi a1, sp, 8
add a0, a0, a1
lw a1, 36(sp)
lw a2, 0(a0)
sw a1, 0(a0)
sw a2, 36(sp)
lw a0, 40(sp)
lw a1, 44(sp)
blt a1, a0, .LBB1_43
j .LBB1_44
.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