blob: 8a6b1285a3853a61dc25489272c6ee32e7ee0c6c [file] [log] [blame]
XNNPACK Teamb455b122019-09-27 18:10:33 -07001// Auto-generated file. Do not edit!
2// Template: src/f32-gemm/1x8-aarch64-neonfma-cortex-a75.S.in
3// Generator: tools/xngen
4//
Frank Barchardbaa9ead2019-10-18 18:06:41 -07005// Copyright 2019 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.
XNNPACK Teamb455b122019-09-27 18:10:33 -07009
10#include <xnnpack/assembly.h>
11
12# void xnn_f32_gemminc_ukernel_1x8__aarch64_neonfma_cortex_a75(
13# size_t mr, (x0) - unused. mr = 1
14# size_t nc, x1
15# size_t kc, x2 / x0
16# const uint8_t*restrict a, x3
17# size_t a_stride, (x4) - unused
18# const void*restrict w, x5
19# uint8_t*restrict c, x6
20# size_t cm_stride, (x7) - unused
21# size_t cn_stride, [sp] -> x14
22# const float*restrict acc, [sp + 8] -> x15
Marat Dukhaneb09a6b2020-04-08 17:34:32 -070023# const union xnn_f32_minmax_params params[restrict static 1]) [sp + 16] -> x8
XNNPACK Teamb455b122019-09-27 18:10:33 -070024
25# d8-d15 need to be preserved if used.
26# x19-30 need to be preserved if used.
27
Frank Barchard1b0421b2019-10-03 16:35:50 -070028# A pointer
XNNPACK Teamb455b122019-09-27 18:10:33 -070029# x3 a0
30
Frank Barchard1b0421b2019-10-03 16:35:50 -070031# C pointer
XNNPACK Teamb455b122019-09-27 18:10:33 -070032# x6 c0
33
34# Clamp v4 v5
35
36BEGIN_FUNCTION xnn_f32_gemminc_ukernel_1x8__aarch64_neonfma_cortex_a75
37
38 # Load cn_stride, acc
39 LDP x14, x15, [sp]
40 # Load params pointer
41 LDR x8, [sp, 16]
42
Marat Dukhaneb09a6b2020-04-08 17:34:32 -070043 # Load min/max values
XNNPACK Teamb455b122019-09-27 18:10:33 -070044 LD2R {v4.4s, v5.4s}, [x8]
450:
46 # Load initial accumulators
47 LDP q16, q17, [x15], 32
48
49 MOVI v18.4s, 0 // second set of C for pipelining FMLA
Frank Barchard1b0421b2019-10-03 16:35:50 -070050 PRFM PLDL1KEEP, [x5]
XNNPACK Teamb455b122019-09-27 18:10:33 -070051 MOVI v19.4s, 0
Frank Barchard1b0421b2019-10-03 16:35:50 -070052 PRFM PLDL1KEEP, [x5, 64]
53 PRFM PLDL1KEEP, [x5, 128]
54 PRFM PLDL1KEEP, [x5, 192]
XNNPACK Teamb455b122019-09-27 18:10:33 -070055
56 # Is there at least 8 floats (32 bytes) for prologue + epilogue?
57 SUBS x0, x2, 32 // k = kc - 32
58
59 B.LO 3f
60
61 # 16 prologue
Frank Barchard1b0421b2019-10-03 16:35:50 -070062 # Read first block of 1 A and B.
XNNPACK Teamb455b122019-09-27 18:10:33 -070063 LDP q20, q21, [x5], 32
64 LDP q22, q23, [x5], 32
65 LDP q24, q25, [x5], 32
66 LDP q26, q27, [x5], 32
67 LDR q0, [x3], 16
68
69 # Is there at least 32. yes do main loop
70 SUBS x0, x0, 32
71 B.LO 2f
72
73 # Main loop - 8 floats of A (32 bytes)
741:
75 # First block of 4. FMA for first 4, loads for 2nd block of 4.
76 FMLA v16.4s, v20.4s, v0.s[0]
77 LDR q1, [x3], 16
78 FMLA v17.4s, v21.4s, v0.s[0]
79 LDP q20, q21, [x5], 32
80 FMLA v18.4s, v22.4s, v0.s[1]
Frank Barchard1b0421b2019-10-03 16:35:50 -070081 PRFM PLDL1KEEP, [x5, 96]
XNNPACK Teamb455b122019-09-27 18:10:33 -070082 FMLA v19.4s, v23.4s, v0.s[1]
83 LDP q22, q23, [x5], 32
84 FMLA v16.4s, v24.4s, v0.s[2]
85 FMLA v17.4s, v25.4s, v0.s[2]
86 LDP q24, q25, [x5], 32
XNNPACK Teamb455b122019-09-27 18:10:33 -070087 FMLA v18.4s, v26.4s, v0.s[3]
XNNPACK Teamb455b122019-09-27 18:10:33 -070088 FMLA v19.4s, v27.4s, v0.s[3]
89 LDP q26, q27, [x5], 32
90
91 # Second block of 4. FMA for second 4, loads for 1st block of 4.
92 FMLA v16.4s, v20.4s, v1.s[0]
93 LDR q0, [x3], 16
94 FMLA v17.4s, v21.4s, v1.s[0]
95 LDP q20, q21, [x5], 32
96 FMLA v18.4s, v22.4s, v1.s[1]
97 FMLA v19.4s, v23.4s, v1.s[1]
98 LDP q22, q23, [x5], 32
99 FMLA v16.4s, v24.4s, v1.s[2]
100 FMLA v17.4s, v25.4s, v1.s[2]
101 LDP q24, q25, [x5], 32
XNNPACK Teamb455b122019-09-27 18:10:33 -0700102 FMLA v18.4s, v26.4s, v1.s[3]
XNNPACK Teamb455b122019-09-27 18:10:33 -0700103 FMLA v19.4s, v27.4s, v1.s[3]
104 SUBS x0, x0, 32
105 LDP q26, q27, [x5], 32
106 B.HS 1b
107
1082:
109 # Epilogue
110
111 # First block of 4. FMA for first 4, loads for 2nd block of 4.
112 FMLA v16.4s, v20.4s, v0.s[0]
113 LDR q1, [x3], 16
114 FMLA v17.4s, v21.4s, v0.s[0]
115 LDP q20, q21, [x5], 32
116 FMLA v18.4s, v22.4s, v0.s[1]
117 FMLA v19.4s, v23.4s, v0.s[1]
118 LDP q22, q23, [x5], 32
119 FMLA v16.4s, v24.4s, v0.s[2]
120 FMLA v17.4s, v25.4s, v0.s[2]
121 LDP q24, q25, [x5], 32
XNNPACK Teamb455b122019-09-27 18:10:33 -0700122 FMLA v18.4s, v26.4s, v0.s[3]
XNNPACK Teamb455b122019-09-27 18:10:33 -0700123 FMLA v19.4s, v27.4s, v0.s[3]
124 LDP q26, q27, [x5], 32
125
126 # Second block of 4. no loads
127 FMLA v16.4s, v20.4s, v1.s[0]
128 FMLA v17.4s, v21.4s, v1.s[0]
129 FMLA v18.4s, v22.4s, v1.s[1]
130 FMLA v19.4s, v23.4s, v1.s[1]
131 FMLA v16.4s, v24.4s, v1.s[2]
132 FMLA v17.4s, v25.4s, v1.s[2]
133 FMLA v18.4s, v26.4s, v1.s[3]
134 FMLA v19.4s, v27.4s, v1.s[3]
135
1363:
137 # Is there a remainder?- 4 floats of A (16 bytes)
138 TBNZ x0, 4, 5f
139 # Is there a remainder?- 2 floats of A (8 bytes)
140 TBNZ x0, 3, 6f
141 # Is there a remainder?- 1 floats of A (4 bytes)
142 TBNZ x0, 2, 8f
143
1444:
145 FADD v16.4s, v16.4s, v18.4s
Frank Barchard73ccfb42019-12-11 22:15:22 -0800146 SUBS x1, x1, 8
XNNPACK Teamb455b122019-09-27 18:10:33 -0700147 FADD v17.4s, v17.4s, v19.4s
148
149 # Clamp
Marat Dukhana51cf482020-04-08 16:16:19 -0700150 FMAX v16.4s, v16.4s, v4.4s
151 FMAX v17.4s, v17.4s, v4.4s
152 FMIN v16.4s, v16.4s, v5.4s
153 FMIN v17.4s, v17.4s, v5.4s
XNNPACK Teamb455b122019-09-27 18:10:33 -0700154
155 # Store full 1 x 8
XNNPACK Teamb455b122019-09-27 18:10:33 -0700156 B.LO 9f
157
158 STP q16, q17, [x6]
159 ADD x6, x6, x14
160
161 SUB x3, x3, x2 // a0 -= kc
162
XNNPACK Teamb455b122019-09-27 18:10:33 -0700163 B.HI 0b
164
165 RET
166
1675:
168 # Remainder- 4 floats of A (16 bytes)
169 LDP q20, q21, [x5], 32
170 LDR q0, [x3], 16
171 FMLA v16.4s, v20.4s, v0.s[0]
172 FMLA v17.4s, v21.4s, v0.s[0]
173 LDP q22, q23, [x5], 32
174 LDP q24, q25, [x5], 32
175 LDP q26, q27, [x5], 32
176 FMLA v18.4s, v22.4s, v0.s[1]
177 FMLA v19.4s, v23.4s, v0.s[1]
178 FMLA v16.4s, v24.4s, v0.s[2]
179 FMLA v17.4s, v25.4s, v0.s[2]
180 FMLA v18.4s, v26.4s, v0.s[3]
181 FMLA v19.4s, v27.4s, v0.s[3]
182
183 TBZ x0, 3, 7f
1846:
185 # Remainder- 2 floats of A (8 bytes)
186 LDP q20, q21, [x5], 32
187 LDR d0, [x3], 8
188 FMLA v16.4s, v20.4s, v0.s[0]
189 FMLA v17.4s, v21.4s, v0.s[0]
190 LDP q22, q23, [x5], 32
191 FMLA v18.4s, v22.4s, v0.s[1]
192 FMLA v19.4s, v23.4s, v0.s[1]
1937:
194 TBZ x0, 2, 4b
1958:
196 # Remainder- 1 float of A (4 bytes)
197 LDP q20, q21, [x5], 32
198 LDR s0, [x3], 4
199 FMLA v16.4s, v20.4s, v0.s[0]
200 FMLA v17.4s, v21.4s, v0.s[0]
201 B 4b
202
203 # Store odd channels
2049:
205 TBZ x1, 2, 10f
206 STR q16, [x6], 16
207 MOV v16.16b, v17.16b
208
20910:
210 TBZ x1, 1, 11f
211 STR d16, [x6], 8
212 DUP d16, v16.d[1]
213
21411:
215 TBZ x1, 0, 12f
216 STR s16, [x6]
21712:
218 RET
219
220END_FUNCTION xnn_f32_gemminc_ukernel_1x8__aarch64_neonfma_cortex_a75
221
222#ifdef __ELF__
223.section ".note.GNU-stack","",%progbits
224#endif