Debian Codegraph @

src/f32-igemm/gen/f32-igemm-1x8-minmax-asm-aarch64-neonfma-ld64-prfm.S

raw
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_prfm(
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_prfm
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 PRFM PLDL1KEEP, [x5]
50 MOVI v19.4s, 0
51 PRFM PLDL1KEEP, [x5, 64]
52 PRFM PLDL1KEEP, [x5, 128]
53 PRFM PLDL1KEEP, [x5, 192]
54 PRFM PLDL1KEEP, [x5, 256]
55 PRFM PLDL1KEEP, [x5, 320]
56 PRFM PLDL1KEEP, [x5, 384]
57 PRFM PLDL1KEEP, [x5, 448]
58 PRFM PLDL1KEEP, [x5, 512]
59 PRFM PLDL1KEEP, [x5, 576]
60
61 MOV x9, x3 // p = ks
62
63 1:
64 # Load next A pointer
65 LDR x8, [x4], 8
66
67 CMP x8, x12 // if a0 == zero
68 ADD x8, x8, x11 // a0 += a_offset
69 CSEL x8, x12, x8, EQ // a0 = zero, else += a0 + a_offset
70
71 # Is there at least 2 floats (8 bytes)
72 SUBS x0, x2, 8 // k = kc - 8
73 PRFM PLDL1KEEP, [x8, 0] // Prefetch A
74 PRFM PLDL1KEEP, [x8, 64]
75
76 B.LO 4f
77
78 # Main loop - 2 floats of A (8 bytes)
79 2:
80 LDP q20, q21, [x5], 32
81 LDR d0, [x8], 8
82 LDP q22, q23, [x5], 32
83 SUBS x0, x0, 8
84 FMLA v16.4s, v20.4s, v0.s[0]
85 FMLA v17.4s, v21.4s, v0.s[0]
86 PRFM PLDL1KEEP, [x5, 576] // Prefetch B
87 FMLA v18.4s, v22.4s, v0.s[1]
88 FMLA v19.4s, v23.4s, v0.s[1]
89 PRFM PLDL1KEEP, [x8, 128] // Prefetch A0
90 B.HS 2b
91
92 # Is there a remainder?- 1 float of A (4 bytes)
93 TBNZ x0, 2, 4f
94
95 3:
96 # ks loop
97 SUBS x9, x9, 8 // ks -= MR * sizeof(void*)
98 B.HI 1b
99
100 FADD v16.4s, v16.4s, v18.4s
101 FADD v17.4s, v17.4s, v19.4s
102
103 # Clamp
104 FMAX v16.4s, v16.4s, v30.4s
105 FMAX v17.4s, v17.4s, v30.4s
106 FMIN v16.4s, v16.4s, v31.4s
107 FMIN v17.4s, v17.4s, v31.4s
108
109 # Store full 1 x 8
110 SUBS x1, x1, 8
111 B.LO 5f
112
113 STP q16, q17, [x6]
114 ADD x6, x6, x10
115
116 SUB x4, x4, x3 // a -= ks
117
118 # nc loop
119 B.HI 0b
120
121 RET
122
123 4:
124 # Remainder- 1 float of A (4 bytes)
125 LDP q20, q21, [x5], 32
126 LDR s0, [x8], 4
127 FMLA v16.4s, v20.4s, v0.s[0]
128 FMLA v17.4s, v21.4s, v0.s[0]
129 B 3b
130
131 5:
132 # Store odd channels
133 TBZ x1, 2, 6f
134 STR q16, [x6], 16
135 MOV v16.16b, v17.16b
136
137 6:
138 TBZ x1, 1, 7f
139 STR d16, [x6], 8
140 DUP d16, v16.d[1]
141
142 7:
143 TBZ x1, 0, 8f
144 STR s16, [x6], 4
145 8:
146 RET
147
148 END_FUNCTION xnn_f32_igemm_minmax_ukernel_1x8__asm_aarch64_neonfma_ld64_prfm
149
150 #ifdef __ELF__
151 .section ".note.GNU-stack","",%progbits
152 #endif