You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

231 lines
3.9 KiB

.data
.globl matrix
.p2align 2
matrix:
.zero 80000000
.globl a
.p2align 2
a:
.zero 400000
.text
.globl transpose
.p2align 2
transpose:
.L.transpose.0:
stp x29, x30, [sp, #-16]!
mov x29, sp
sub sp, sp, #48
str x22, [sp, #0]
str x21, [sp, #8]
str x20, [sp, #16]
str x19, [sp, #24]
mov w8, w0
mov x11, x1
mov w10, w2
sdiv w12, w8, w10
mov w8, #0
mov w9, w8
b .L.transpose.1
.L.transpose.1:
cmp w9, w12
b.lt .L.transpose.2
b .L.transpose.3
.L.transpose.2:
mov w8, #0
mov w19, w8
mov w15, w9
b .L.transpose.4
.L.transpose.3:
mov w8, #-1
mov w0, w8
ldr x22, [sp, #0]
ldr x21, [sp, #8]
ldr x20, [sp, #16]
ldr x19, [sp, #24]
add sp, sp, #48
ldp x29, x30, [sp], #16
ret
.L.transpose.4:
cmp w19, w10
b.lt .L.transpose.5
b .L.transpose.6
.L.transpose.5:
cmp w15, w19
b.lt .L.transpose.7
b .L.transpose.8
.L.transpose.6:
mov w8, #1
add w8, w15, w8
mov w9, w8
b .L.transpose.1
.L.transpose.7:
mov w8, #1
add w8, w19, w8
mov w19, w8
b .L.transpose.4
.L.transpose.8:
mul w8, w15, w10
add w20, w8, w19
sxtw x8, w20
lsl x8, x8, #2
add x8, x11, x8
ldr w21, [x8]
mul w8, w19, w12
add w22, w8, w15
sxtw x8, w20
lsl x8, x8, #2
add x8, x11, x8
ldr w9, [x8]
sxtw x8, w22
lsl x8, x8, #2
add x8, x11, x8
str w9, [x8]
sxtw x8, w20
lsl x8, x8, #2
add x8, x11, x8
str w21, [x8]
mov w8, #1
add w8, w19, w8
mov w19, w8
b .L.transpose.4
.text
.globl main
.p2align 2
main:
.L.main.0:
stp x29, x30, [sp, #-16]!
mov x29, sp
sub sp, sp, #48
str x19, [sp, #0]
str x21, [sp, #8]
str x20, [sp, #16]
bl getint
mov w20, w0
adrp x8, a
add x8, x8, :lo12:a
mov x0, x8
bl getarray
mov w19, w0
mov w8, #28
mov w0, w8
bl _sysy_starttime
mov w8, #0
mov w10, w8
b .L.main.1
.L.main.1:
cmp w10, w20
b.lt .L.main.2
b .L.main.3
.L.main.2:
adrp x8, matrix
add x8, x8, :lo12:matrix
sxtw x9, w10
lsl x9, x9, #2
add x8, x8, x9
str w10, [x8]
mov w8, #4
add w8, w10, #3
cmp w10, #0
csel w8, w8, w10, lt
asr w8, w8, #2
mov w9, #4
msub w9, w8, w9, w10
mov w8, #0
cmp w9, w8
b.eq .L.main.4
b .L.main.5
.L.main.3:
mov w8, #0
mov w21, w8
b .L.main.6
.L.main.4:
adrp x8, matrix
add x8, x8, :lo12:matrix
sxtw x9, w10
lsl x9, x9, #2
add x8, x8, x9
mov w9, #4
str w9, [x8]
b .L.main.5
.L.main.5:
mov w8, #1
add w8, w10, w8
mov w10, w8
b .L.main.1
.L.main.6:
cmp w21, w19
b.lt .L.main.7
b .L.main.8
.L.main.7:
adrp x8, a
add x8, x8, :lo12:a
sxtw x9, w21
lsl x9, x9, #2
add x8, x8, x9
ldr w9, [x8]
mov w0, w20
adrp x8, matrix
add x8, x8, :lo12:matrix
mov x1, x8
mov w2, w9
bl transpose
mov w8, w0
mov w8, #1
add w8, w21, w8
mov w21, w8
b .L.main.6
.L.main.8:
mov w8, #0
mov w11, w8
mov w12, w8
b .L.main.9
.L.main.9:
cmp w12, w19
b.lt .L.main.10
b .L.main.11
.L.main.10:
mul w10, w12, w12
adrp x9, matrix
add x9, x9, :lo12:matrix
sxtw x8, w12
lsl x8, x8, #2
add x8, x9, x8
ldr w8, [x8]
mul w8, w10, w8
add w9, w11, w8
mov w8, #1
add w8, w12, w8
mov w11, w9
mov w12, w8
b .L.main.9
.L.main.11:
mov w8, #0
cmp w11, w8
b.lt .L.main.12
mov w19, w11
b .L.main.13
.L.main.12:
mov w8, #0
sub w8, w8, w11
mov w19, w8
b .L.main.13
.L.main.13:
mov w8, #49
mov w0, w8
bl _sysy_stoptime
mov w0, w19
bl putint
mov w8, #10
mov w0, w8
bl putch
mov w8, #0
mov w0, w8
ldr x19, [sp, #0]
ldr x21, [sp, #8]
ldr x20, [sp, #16]
add sp, sp, #48
ldp x29, x30, [sp], #16
ret