266 lines
3.8 KiB
ArmAsm
266 lines
3.8 KiB
ArmAsm
.file "00_bitset2.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 set
|
|
.type set, @function
|
|
set:
|
|
addi sp,sp,-160
|
|
addi a4,sp,44
|
|
sd s0,144(sp)
|
|
sd s1,136(sp)
|
|
sd s2,128(sp)
|
|
mv s0,a1
|
|
mv s2,a0
|
|
li a1,0
|
|
mv a0,a4
|
|
mv s1,a2
|
|
li a2,80
|
|
sd ra,152(sp)
|
|
call memset@plt
|
|
li a5,1
|
|
slli a1,a5,35
|
|
slli a2,a5,37
|
|
slli a3,a5,39
|
|
mv a4,a0
|
|
slli a0,a5,33
|
|
slli a5,a5,41
|
|
addi a5,a5,256
|
|
addi a3,a3,64
|
|
addi a0,a0,1
|
|
addi a1,a1,4
|
|
addi a2,a2,16
|
|
sd a5,32(sp)
|
|
li a5,1024
|
|
sd a3,24(sp)
|
|
sd a0,0(sp)
|
|
sd a1,8(sp)
|
|
sd a2,16(sp)
|
|
sw a5,40(sp)
|
|
addi a3,sp,124
|
|
.L2:
|
|
slliw a5,a5,1
|
|
sw a5,0(a4)
|
|
addi a4,a4,4
|
|
bne a3,a4,.L2
|
|
li a5,299008
|
|
addi a5,a5,991
|
|
bgt s0,a5,.L3
|
|
li a5,30
|
|
divw a4,s0,a5
|
|
remw a5,s0,a5
|
|
slli a4,a4,2
|
|
add s2,s2,a4
|
|
lw a3,0(s2)
|
|
slli a5,a5,2
|
|
addi a5,a5,128
|
|
add a5,a5,sp
|
|
lw a1,-128(a5)
|
|
divw a5,a3,a1
|
|
srliw a2,a5,31
|
|
addw a4,a5,a2
|
|
andi a4,a4,1
|
|
subw a4,a4,a2
|
|
beq a4,s1,.L4
|
|
andi a5,a5,1
|
|
bne a5,zero,.L5
|
|
li a5,1
|
|
beq s1,a5,.L9
|
|
.L5:
|
|
li a5,1
|
|
beq a4,a5,.L10
|
|
.L4:
|
|
sw a3,0(s2)
|
|
.L3:
|
|
ld ra,152(sp)
|
|
ld s0,144(sp)
|
|
ld s1,136(sp)
|
|
ld s2,128(sp)
|
|
li a0,0
|
|
addi sp,sp,160
|
|
jr ra
|
|
.L10:
|
|
bne s1,zero,.L4
|
|
subw a3,a3,a1
|
|
j .L4
|
|
.L9:
|
|
addw a3,a3,a1
|
|
j .L4
|
|
.size set, .-set
|
|
.align 1
|
|
.globl rand
|
|
.type rand, @function
|
|
rand:
|
|
lla a4,.LANCHOR0
|
|
lla a3,.LANCHOR1
|
|
lw a1,0(a4)
|
|
lw a5,0(a3)
|
|
lw a2,4(a4)
|
|
lw a4,8(a4)
|
|
mulw a5,a5,a1
|
|
addw a5,a5,a2
|
|
remw a0,a5,a4
|
|
bge a0,zero,.L12
|
|
addw a0,a0,a4
|
|
.L12:
|
|
sw a0,0(a3)
|
|
ret
|
|
.size rand, .-rand
|
|
.section .text.startup,"ax",@progbits
|
|
.align 1
|
|
.globl main
|
|
.type main, @function
|
|
main:
|
|
addi sp,sp,-80
|
|
sd ra,72(sp)
|
|
sd s2,48(sp)
|
|
sd s5,24(sp)
|
|
sd s0,64(sp)
|
|
sd s1,56(sp)
|
|
sd s3,40(sp)
|
|
sd s4,32(sp)
|
|
sd s6,16(sp)
|
|
sd s7,8(sp)
|
|
call getint@plt
|
|
mv s5,a0
|
|
call getint@plt
|
|
mv a5,a0
|
|
lla s2,.LANCHOR1
|
|
li a0,58
|
|
sw a5,0(s2)
|
|
call _sysy_starttime@plt
|
|
ble s5,zero,.L19
|
|
lla a5,.LANCHOR0
|
|
lw s7,0(a5)
|
|
lw s0,0(s2)
|
|
lw s6,4(a5)
|
|
lw s4,8(a5)
|
|
li s3,299008
|
|
addiw s3,s3,992
|
|
lla s1,a
|
|
.L20:
|
|
mulw s0,s7,s0
|
|
mv a0,s1
|
|
addiw s5,s5,-1
|
|
addw s0,s0,s6
|
|
remw a1,s0,s4
|
|
bge a1,zero,.L16
|
|
addw a1,a1,s4
|
|
.L16:
|
|
mulw a5,s7,a1
|
|
addw a5,a5,s6
|
|
remw s0,a5,s4
|
|
addw a4,s0,s4
|
|
srliw a6,a4,31
|
|
addw a2,a4,a6
|
|
andi a3,a2,1
|
|
remw a1,a1,s3
|
|
andi a2,s0,1
|
|
blt s0,zero,.L17
|
|
sw s0,0(s2)
|
|
call set
|
|
bne s5,zero,.L20
|
|
.L19:
|
|
li a0,66
|
|
call _sysy_stoptime@plt
|
|
li a0,8192
|
|
addi a0,a0,1808
|
|
lla a1,a
|
|
call putarray@plt
|
|
ld ra,72(sp)
|
|
ld s0,64(sp)
|
|
ld s1,56(sp)
|
|
ld s2,48(sp)
|
|
ld s3,40(sp)
|
|
ld s4,32(sp)
|
|
ld s5,24(sp)
|
|
ld s6,16(sp)
|
|
ld s7,8(sp)
|
|
li a0,0
|
|
addi sp,sp,80
|
|
jr ra
|
|
.L17:
|
|
subw a2,a3,a6
|
|
mv a0,s1
|
|
sext.w s0,a4
|
|
sw a4,0(s2)
|
|
call set
|
|
bne s5,zero,.L20
|
|
j .L19
|
|
.size main, .-main
|
|
.globl a
|
|
.globl staticvalue
|
|
.globl seed
|
|
.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
|
|
.data
|
|
.align 3
|
|
.set .LANCHOR0,. + 0
|
|
.type seed, @object
|
|
.size seed, 12
|
|
seed:
|
|
.word 19971231
|
|
.word 19981013
|
|
.word 1000000007
|
|
.bss
|
|
.align 3
|
|
.set .LANCHOR1,. + 0
|
|
.type staticvalue, @object
|
|
.size staticvalue, 4
|
|
staticvalue:
|
|
.zero 4
|
|
.zero 4
|
|
.type a, @object
|
|
.size a, 40000
|
|
a:
|
|
.zero 40000
|
|
.type _sysy_idx, @object
|
|
.size _sysy_idx, 4
|
|
_sysy_idx:
|
|
.zero 4
|
|
.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
|