| 1 |
// Auto-generated file. Do not edit! |
| 2 |
// Template: src/f32-igemm/1x8-aarch64-neonfma-ld64.S.in |
| 3 |
// Generator: tools/xngen |
| 4 |
// |
| 5 |
// Copyright 2023 Google LLC |
| 6 |
// |
| 7 |
// This source code is licensed under the BSD-style license found in the |
| 8 |
// LICENSE file in the root directory of this source tree. |
| 9 |
|
| 10 |
#include "xnnpack/assembly.h" |
| 11 |
|
| 12 |
# void xnn_f32_igemm_minmax_ukernel_1x8__asm_aarch64_neonfma_ld64( |
| 13 |
# size_t mr, (x0) - unused. mr = 1 |
| 14 |
# size_t nc, x1 |
| 15 |
# size_t kc, x2 / x0 |
| 16 |
# size_t ks, x3 / x9 |
| 17 |
# const float** restrict a, x4 |
| 18 |
# const float* restrict w, x5 |
| 19 |
# float* restrict c, x6 |
| 20 |
# size_t cm_stride, (x7) - unused |
| 21 |
# size_t cn_stride, [sp] -> x10 |
| 22 |
# size_t a_offset, [sp + 8] -> x11 |
| 23 |
# const float* zero, [sp + 16] -> x12 |
| 24 |
# const xnn_f32_minmax_params params [sp + 24] -> (x7) |
| 25 |
|
| 26 |
# d8-d15, x19-x30 need to be preserved if used. x18 is reserved by the OS. |
| 27 |
|
| 28 |
# Register usage |
| 29 |
# A0 x8 v0 |
| 30 |
# B x5 v20 v21 v22 v23 |
| 31 |
# C0 x6 v16 v17 v18 v19 |
| 32 |
# Clamp v30, v31 |
| 33 |
|
| 34 |
BEGIN_FUNCTION xnn_f32_igemm_minmax_ukernel_1x8__asm_aarch64_neonfma_ld64 |
| 35 |
|
| 36 |
# Load cn_stride, a_offset |
| 37 |
LDP x10, x11, [sp] |
| 38 |
|
| 39 |
# Load zero, params pointer |
| 40 |
LDP x12, x7, [sp, 16] |
| 41 |
|
| 42 |
# Load min/max values |
| 43 |
LD2R {v30.4s, v31.4s}, [x7] |
| 44 |
|
| 45 |
0: |
| 46 |
# Load initial bias from w into accumulators |
| 47 |
LDP q16, q17, [x5], 32 |
| 48 |
MOVI v18.4s, 0 // second set of C for pipelining FMLA |
| 49 |
MOVI v19.4s, 0 |
| 50 |
|
| 51 |
MOV x9, x3 // p = ks |
| 52 |
|
| 53 |
1: |
| 54 |
# Load next A pointer |
| 55 |
LDR x8, [x4], 8 |
| 56 |
|
| 57 |
CMP x8, x12 // if a0 == zero |
| 58 |
ADD x8, x8, x11 // a0 += a_offset |
| 59 |
CSEL x8, x12, x8, EQ // a0 = zero, else += a0 + a_offset |
| 60 |
|
| 61 |
# Is there at least 2 floats (8 bytes) |
| 62 |
SUBS x0, x2, 8 // k = kc - 8 |
| 63 |
|
| 64 |
B.LO 4f |
| 65 |
|
| 66 |
# Main loop - 2 floats of A (8 bytes) |
| 67 |
2: |
| 68 |
LDP q20, q21, [x5], 32 |
| 69 |
LDR d0, [x8], 8 |
| 70 |
LDP q22, q23, [x5], 32 |
| 71 |
SUBS x0, x0, 8 |
| 72 |
FMLA v16.4s, v20.4s, v0.s[0] |
| 73 |
FMLA v17.4s, v21.4s, v0.s[0] |
| 74 |
FMLA v18.4s, v22.4s, v0.s[1] |
| 75 |
FMLA v19.4s, v23.4s, v0.s[1] |
| 76 |
B.HS 2b |
| 77 |
|
| 78 |
# Is there a remainder?- 1 float of A (4 bytes) |
| 79 |
TBNZ x0, 2, 4f |
| 80 |
|
| 81 |
3: |
| 82 |
# ks loop |
| 83 |
SUBS x9, x9, 8 // ks -= MR * sizeof(void*) |
| 84 |
B.HI 1b |
| 85 |
|
| 86 |
FADD v16.4s, v16.4s, v18.4s |
| 87 |
FADD v17.4s, v17.4s, v19.4s |
| 88 |
|
| 89 |
# Clamp |
| 90 |
FMAX v16.4s, v16.4s, v30.4s |
| 91 |
FMAX v17.4s, v17.4s, v30.4s |
| 92 |
FMIN v16.4s, v16.4s, v31.4s |
| 93 |
FMIN v17.4s, v17.4s, v31.4s |
| 94 |
|
| 95 |
# Store full 1 x 8 |
| 96 |
SUBS x1, x1, 8 |
| 97 |
B.LO 5f |
| 98 |
|
| 99 |
STP q16, q17, [x6] |
| 100 |
ADD x6, x6, x10 |
| 101 |
|
| 102 |
SUB x4, x4, x3 // a -= ks |
| 103 |
|
| 104 |
# nc loop |
| 105 |
B.HI 0b |
| 106 |
|
| 107 |
RET |
| 108 |
|
| 109 |
4: |
| 110 |
# Remainder- 1 float of A (4 bytes) |
| 111 |
LDP q20, q21, [x5], 32 |
| 112 |
LDR s0, [x8], 4 |
| 113 |
FMLA v16.4s, v20.4s, v0.s[0] |
| 114 |
FMLA v17.4s, v21.4s, v0.s[0] |
| 115 |
B 3b |
| 116 |
|
| 117 |
5: |
| 118 |
# Store odd channels |
| 119 |
TBZ x1, 2, 6f |
| 120 |
STR q16, [x6], 16 |
| 121 |
MOV v16.16b, v17.16b |
| 122 |
|
| 123 |
6: |
| 124 |
TBZ x1, 1, 7f |
| 125 |
STR d16, [x6], 8 |
| 126 |
DUP d16, v16.d[1] |
| 127 |
|
| 128 |
7: |
| 129 |
TBZ x1, 0, 8f |
| 130 |
STR s16, [x6], 4 |
| 131 |
8: |
| 132 |
RET |
| 133 |
|
| 134 |
END_FUNCTION xnn_f32_igemm_minmax_ukernel_1x8__asm_aarch64_neonfma_ld64 |
| 135 |
|
| 136 |
#ifdef __ELF__ |
| 137 |
.section ".note.GNU-stack","",%progbits |
| 138 |
#endif |