sysy-data/functional_c/asm/50_short_circuit.s

177 lines
2.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 "50_short_circuit.sy"
.globl func
.p2align 1
.type func,@function
func:
addi sp, sp, -16
sd ra, 8(sp)
sd s0, 0(sp)
lui s0, %hi(g)
lw a1, %lo(g)(s0)
addw a0, a0, a1
sw a0, %lo(g)(s0)
call putint
lw a0, %lo(g)(s0)
ld ra, 8(sp)
ld s0, 0(sp)
addi sp, sp, 16
ret
.Lfunc_end0:
.size func, .Lfunc_end0-func
.globl main
.p2align 1
.type main,@function
main:
addi sp, sp, -16
sd ra, 8(sp)
sd s0, 0(sp)
call getint
li a1, 11
bge a0, a1, .LBB1_8
call getint
li a1, 12
bge a0, a1, .LBB1_9
.LBB1_2:
call getint
li a1, 100
bge a0, a1, .LBB1_10
.LBB1_3:
call getint
li a1, 101
blt a0, a1, .LBB1_5
.LBB1_4:
lui a1, %hi(g)
lw a2, %lo(g)(a1)
addw a0, a0, a2
sw a0, %lo(g)(a1)
call putint
.LBB1_5:
lui s0, %hi(g)
lw a0, %lo(g)(s0)
addiw a0, a0, 99
sw a0, %lo(g)(s0)
call putint
lw a0, %lo(g)(s0)
bnez a0, .LBB1_7
li a0, 100
sw a0, %lo(g)(s0)
li a0, 100
call putint
.LBB1_7:
li a0, 0
ld ra, 8(sp)
ld s0, 0(sp)
addi sp, sp, 16
ret
.LBB1_8:
lui a1, %hi(g)
lw a2, %lo(g)(a1)
addw a0, a0, a2
sw a0, %lo(g)(a1)
call putint
call getint
li a1, 12
blt a0, a1, .LBB1_2
.LBB1_9:
lui a1, %hi(g)
lw a2, %lo(g)(a1)
addw a0, a0, a2
sw a0, %lo(g)(a1)
call putint
call getint
li a1, 100
blt a0, a1, .LBB1_3
.LBB1_10:
lui a1, %hi(g)
lw a2, %lo(g)(a1)
addw a0, a0, a2
sw a0, %lo(g)(a1)
call putint
call getint
li a1, 101
bge a0, a1, .LBB1_4
j .LBB1_5
.Lfunc_end1:
.size main, .Lfunc_end1-main
.type g,@object
.section .sbss,"aw",@nobits
.globl g
.p2align 2
g:
.word 0
.size g, 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