344 lines
4.9 KiB
ArmAsm
344 lines
4.9 KiB
ArmAsm
|
.file "shuffle1.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 hash
|
||
|
.type hash, @function
|
||
|
hash:
|
||
|
lw a5,.LANCHOR0
|
||
|
remw a0,a0,a5
|
||
|
ret
|
||
|
.size hash, .-hash
|
||
|
.align 1
|
||
|
.globl insert
|
||
|
.type insert, @function
|
||
|
insert:
|
||
|
lla t5,.LANCHOR0
|
||
|
lw a7,0(t5)
|
||
|
lla t4,head
|
||
|
lw a5,4(t5)
|
||
|
remw a7,a0,a7
|
||
|
lla a2,key
|
||
|
addiw t1,a5,1
|
||
|
mv t6,t1
|
||
|
lla a6,next
|
||
|
slli a7,a7,2
|
||
|
add a4,t4,a7
|
||
|
lw t3,0(a4)
|
||
|
mv a5,t3
|
||
|
bne t3,zero,.L4
|
||
|
j .L11
|
||
|
.L6:
|
||
|
lw a5,0(a3)
|
||
|
beq a5,zero,.L12
|
||
|
.L4:
|
||
|
slli a5,a5,2
|
||
|
add a4,a2,a5
|
||
|
lw a4,0(a4)
|
||
|
add a3,a6,a5
|
||
|
bne a4,a0,.L6
|
||
|
lla a4,nextvalue
|
||
|
add a5,a4,a5
|
||
|
lw a3,0(a5)
|
||
|
slli t1,t1,2
|
||
|
add a4,a4,t1
|
||
|
sw a3,0(a4)
|
||
|
lla a4,value
|
||
|
add a4,a4,t1
|
||
|
sw t6,4(t5)
|
||
|
sw t6,0(a5)
|
||
|
sw a1,0(a4)
|
||
|
li a0,1
|
||
|
ret
|
||
|
.L11:
|
||
|
slli a5,t1,2
|
||
|
sw t1,0(a4)
|
||
|
lla a6,value
|
||
|
lla a4,nextvalue
|
||
|
lla a3,next
|
||
|
add a2,a2,a5
|
||
|
add a6,a6,a5
|
||
|
add a3,a3,a5
|
||
|
add a5,a4,a5
|
||
|
sw a0,0(a2)
|
||
|
sw t1,4(t5)
|
||
|
sw a1,0(a6)
|
||
|
sw zero,0(a3)
|
||
|
sw zero,0(a5)
|
||
|
li a0,0
|
||
|
ret
|
||
|
.L12:
|
||
|
slli a5,t1,2
|
||
|
lla a4,value
|
||
|
add a4,a4,a5
|
||
|
sw a1,0(a4)
|
||
|
lla a4,nextvalue
|
||
|
add a6,a6,a5
|
||
|
add a2,a2,a5
|
||
|
add t4,t4,a7
|
||
|
add a5,a4,a5
|
||
|
sw a0,0(a2)
|
||
|
sw t6,4(t5)
|
||
|
sw t3,0(a6)
|
||
|
sw t6,0(t4)
|
||
|
sw zero,0(a5)
|
||
|
li a0,0
|
||
|
ret
|
||
|
.size insert, .-insert
|
||
|
.align 1
|
||
|
.globl reduce
|
||
|
.type reduce, @function
|
||
|
reduce:
|
||
|
lw a5,.LANCHOR0
|
||
|
remw a5,a0,a5
|
||
|
lla a4,head
|
||
|
mv a3,a0
|
||
|
slli a5,a5,2
|
||
|
add a5,a4,a5
|
||
|
lw a0,0(a5)
|
||
|
beq a0,zero,.L14
|
||
|
lla a1,key
|
||
|
lla a2,next
|
||
|
j .L17
|
||
|
.L15:
|
||
|
lw a0,0(a4)
|
||
|
beq a0,zero,.L14
|
||
|
.L17:
|
||
|
slli a0,a0,2
|
||
|
add a5,a1,a0
|
||
|
lw a5,0(a5)
|
||
|
add a4,a2,a0
|
||
|
bne a5,a3,.L15
|
||
|
li a5,0
|
||
|
lla a2,value
|
||
|
lla a3,nextvalue
|
||
|
j .L16
|
||
|
.L24:
|
||
|
slli a0,a0,2
|
||
|
.L16:
|
||
|
add a4,a2,a0
|
||
|
add a0,a3,a0
|
||
|
lw a4,0(a4)
|
||
|
lw a0,0(a0)
|
||
|
addw a5,a4,a5
|
||
|
bne a0,zero,.L24
|
||
|
mv a0,a5
|
||
|
ret
|
||
|
.L14:
|
||
|
ret
|
||
|
.size reduce, .-reduce
|
||
|
.section .text.startup,"ax",@progbits
|
||
|
.align 1
|
||
|
.globl main
|
||
|
.type main, @function
|
||
|
main:
|
||
|
addi sp,sp,-48
|
||
|
sd ra,40(sp)
|
||
|
sd s0,32(sp)
|
||
|
sd s2,16(sp)
|
||
|
sd s4,0(sp)
|
||
|
sd s1,24(sp)
|
||
|
sd s3,8(sp)
|
||
|
call getint@plt
|
||
|
mv a5,a0
|
||
|
lla s4,.LANCHOR0
|
||
|
lla a0,keys
|
||
|
sw a5,0(s4)
|
||
|
call getarray@plt
|
||
|
mv s2,a0
|
||
|
lla a0,values
|
||
|
call getarray@plt
|
||
|
lla a0,requests
|
||
|
call getarray@plt
|
||
|
mv s0,a0
|
||
|
li a0,80
|
||
|
call _sysy_starttime@plt
|
||
|
ble s2,zero,.L26
|
||
|
slli s3,s2,2
|
||
|
lla s1,keys
|
||
|
lla s2,values
|
||
|
add s3,s3,s1
|
||
|
.L27:
|
||
|
lw a0,0(s1)
|
||
|
lw a1,0(s2)
|
||
|
addi s1,s1,4
|
||
|
addi s2,s2,4
|
||
|
call insert
|
||
|
bne s1,s3,.L27
|
||
|
.L26:
|
||
|
ble s0,zero,.L28
|
||
|
lw t6,0(s4)
|
||
|
lla a0,requests
|
||
|
slli t4,s0,2
|
||
|
lla t3,ans
|
||
|
add t4,t4,a0
|
||
|
lla t5,head
|
||
|
lla a6,key
|
||
|
lla a1,next
|
||
|
lla t1,value
|
||
|
lla a7,nextvalue
|
||
|
.L33:
|
||
|
lw a2,0(a0)
|
||
|
remw a5,a2,t6
|
||
|
slli a5,a5,2
|
||
|
add a5,t5,a5
|
||
|
lw a5,0(a5)
|
||
|
bne a5,zero,.L32
|
||
|
j .L29
|
||
|
.L30:
|
||
|
lw a5,0(a3)
|
||
|
beq a5,zero,.L29
|
||
|
.L32:
|
||
|
slli a5,a5,2
|
||
|
add a4,a6,a5
|
||
|
lw a4,0(a4)
|
||
|
add a3,a1,a5
|
||
|
bne a4,a2,.L30
|
||
|
li a4,0
|
||
|
j .L31
|
||
|
.L43:
|
||
|
slli a5,a5,2
|
||
|
.L31:
|
||
|
add a3,t1,a5
|
||
|
add a5,a7,a5
|
||
|
lw a3,0(a3)
|
||
|
lw a5,0(a5)
|
||
|
addw a4,a3,a4
|
||
|
bne a5,zero,.L43
|
||
|
mv a5,a4
|
||
|
.L29:
|
||
|
sw a5,0(t3)
|
||
|
addi a0,a0,4
|
||
|
addi t3,t3,4
|
||
|
bne t4,a0,.L33
|
||
|
.L28:
|
||
|
li a0,92
|
||
|
call _sysy_stoptime@plt
|
||
|
mv a0,s0
|
||
|
lla a1,ans
|
||
|
call putarray@plt
|
||
|
ld ra,40(sp)
|
||
|
ld s0,32(sp)
|
||
|
ld s1,24(sp)
|
||
|
ld s2,16(sp)
|
||
|
ld s3,8(sp)
|
||
|
ld s4,0(sp)
|
||
|
li a0,0
|
||
|
addi sp,sp,48
|
||
|
jr ra
|
||
|
.size main, .-main
|
||
|
.globl ans
|
||
|
.globl requests
|
||
|
.globl values
|
||
|
.globl keys
|
||
|
.globl cnt
|
||
|
.globl value
|
||
|
.globl key
|
||
|
.globl nextvalue
|
||
|
.globl next
|
||
|
.globl head
|
||
|
.globl bucket
|
||
|
.globl hashmod
|
||
|
.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 hashmod, @object
|
||
|
.size hashmod, 4
|
||
|
hashmod:
|
||
|
.zero 4
|
||
|
.type cnt, @object
|
||
|
.size cnt, 4
|
||
|
cnt:
|
||
|
.zero 4
|
||
|
.type ans, @object
|
||
|
.size ans, 40000000
|
||
|
ans:
|
||
|
.zero 40000000
|
||
|
.type requests, @object
|
||
|
.size requests, 40000000
|
||
|
requests:
|
||
|
.zero 40000000
|
||
|
.type values, @object
|
||
|
.size values, 40000000
|
||
|
values:
|
||
|
.zero 40000000
|
||
|
.type keys, @object
|
||
|
.size keys, 40000000
|
||
|
keys:
|
||
|
.zero 40000000
|
||
|
.type value, @object
|
||
|
.size value, 40000000
|
||
|
value:
|
||
|
.zero 40000000
|
||
|
.type key, @object
|
||
|
.size key, 40000000
|
||
|
key:
|
||
|
.zero 40000000
|
||
|
.type nextvalue, @object
|
||
|
.size nextvalue, 40000000
|
||
|
nextvalue:
|
||
|
.zero 40000000
|
||
|
.type next, @object
|
||
|
.size next, 40000000
|
||
|
next:
|
||
|
.zero 40000000
|
||
|
.type head, @object
|
||
|
.size head, 40000000
|
||
|
head:
|
||
|
.zero 40000000
|
||
|
.type bucket, @object
|
||
|
.size bucket, 40000000
|
||
|
bucket:
|
||
|
.zero 40000000
|
||
|
.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
|