sysy-data/hidden_functional_c/asm/24_array_only.s

300 lines
4.2 KiB
ArmAsm

.file "24_array_only.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 inc_impl
.type inc_impl, @function
inc_impl:
lw a5,0(a0)
beq a1,zero,.L3
.L2:
addiw a1,a1,-1
slliw a5,a5,1
bne a1,zero,.L2
.L3:
addiw a5,a5,1
sw a5,0(a0)
ret
.size inc_impl, .-inc_impl
.align 1
.globl inc
.type inc, @function
inc:
lw a4,.LANCHOR0
lw a5,0(a0)
beq a4,zero,.L12
.L11:
addiw a4,a4,-1
slliw a5,a5,1
bne a4,zero,.L11
.L12:
addiw a5,a5,1
sw a5,0(a0)
ret
.size inc, .-inc
.align 1
.globl add_impl
.type add_impl, @function
add_impl:
lw a5,0(a0)
beq a2,zero,.L20
.L19:
addiw a2,a2,-1
slliw a5,a5,1
bne a2,zero,.L19
sw a5,0(a0)
.L20:
lw a4,0(a1)
addw a5,a4,a5
sw a5,0(a0)
ret
.size add_impl, .-add_impl
.align 1
.globl add
.type add, @function
add:
lw a5,.LANCHOR0
lw a4,0(a0)
beq a5,zero,.L26
.L25:
addiw a5,a5,-1
slliw a4,a4,1
bne a5,zero,.L25
sw a4,0(a0)
.L26:
lw a5,0(a1)
addw a5,a5,a4
sw a5,0(a0)
ret
.size add, .-add
.align 1
.globl sub_impl
.type sub_impl, @function
sub_impl:
lw a5,0(a0)
beq a2,zero,.L32
.L31:
addiw a2,a2,-1
slliw a5,a5,1
bne a2,zero,.L31
sw a5,0(a0)
.L32:
lw a4,0(a1)
subw a5,a5,a4
sw a5,0(a0)
ret
.size sub_impl, .-sub_impl
.align 1
.globl sub
.type sub, @function
sub:
lw a5,.LANCHOR0
lw a4,0(a0)
beq a5,zero,.L38
.L37:
addiw a5,a5,-1
slliw a4,a4,1
bne a5,zero,.L37
sw a4,0(a0)
.L38:
lw a5,0(a1)
subw a4,a4,a5
sw a4,0(a0)
ret
.size sub, .-sub
.section .text.startup,"ax",@progbits
.align 1
.globl main
.type main, @function
main:
li a5,-1
addi sp,sp,-64
srli a5,a5,32
sd ra,56(sp)
sd s0,48(sp)
sd s4,16(sp)
sd s1,40(sp)
sd s2,32(sp)
sd s3,24(sp)
sd a5,8(sp)
lla s4,.LANCHOR0
call getint@plt
sw a0,0(s4)
call getint@plt
mv s0,a0
addi a0,sp,8
call getarray@plt
beq s0,zero,.L43
li s1,4
.L60:
lw s2,8(sp)
bgt s2,s1,.L44
mv s3,s2
.L52:
lw a0,8(s4)
call putint@plt
mv a0,s3
call putint@plt
mv a0,s0
call putint@plt
lw a0,8(sp)
call putint@plt
lw a2,0(s4)
beq a2,zero,.L84
lw a5,8(sp)
mv a3,a2
.L49:
slliw a4,a5,1
addiw a3,a3,-1
mv a5,a4
bne a3,zero,.L49
addw a5,a5,s0
mv a4,a2
.L47:
slliw s3,s3,1
addiw a4,a4,-1
mv a3,s3
bne a4,zero,.L47
addw s3,a3,s0
mv a4,a2
.L50:
slliw a5,a5,1
addiw a4,a4,-1
mv a3,a5
bne a4,zero,.L50
subw a3,a3,s0
.L46:
sw a3,8(sp)
ble s3,s1,.L52
.L53:
lw a5,8(s4)
mv a1,a2
mv a4,a5
addiw a5,a5,1
beq a2,zero,.L56
.L55:
slliw a4,a4,1
addiw a1,a1,-1
mv a5,a4
bne a1,zero,.L55
addiw a5,a5,1
.L57:
addiw a2,a2,-1
slliw a5,a5,1
bne a2,zero,.L57
.L56:
lw a2,12(sp)
addw a5,a3,a5
sw a5,8(s4)
beq a2,a5,.L43
ble s2,s1,.L60
lw a1,0(s4)
lw a0,8(sp)
beq a1,zero,.L82
.L61:
mv a3,a1
.L64:
addiw a3,a3,-1
slliw a5,a5,1
bne a3,zero,.L64
addiw a4,a5,1
mv a3,a1
.L65:
addiw a3,a3,-1
slliw a4,a4,1
bne a3,zero,.L65
addw a5,a4,a0
bne a2,a5,.L61
.L62:
sw a5,8(s4)
.L43:
li a0,10
call putch@plt
ld ra,56(sp)
ld s0,48(sp)
ld s1,40(sp)
ld s2,32(sp)
ld s3,24(sp)
ld s4,16(sp)
li a0,0
addi sp,sp,64
jr ra
.L84:
lw a3,8(sp)
addw s3,s0,s3
j .L46
.L44:
lw a2,0(s4)
mv a3,s2
j .L53
.L82:
addiw a5,a5,1
addw a5,a5,a0
bne a2,a5,.L82
j .L62
.size main, .-main
.globl k
.globl i
.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 k, @object
.size k, 4
k:
.zero 4
.zero 4
.type i, @object
.size i, 4
i:
.zero 4
.type _sysy_idx, @object
.size _sysy_idx, 4
_sysy_idx:
.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