1 // Auto-generated file. Do not edit!
2 // Template: src/f32-velu/sse-rr2-lut16-p3.c.in
3 // Generator: tools/xngen
4 //
5 // Copyright 2020 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 <assert.h>
11
12 #include <smmintrin.h>
13
14 #include <xnnpack/vunary.h>
15 #include <xnnpack/common.h>
16
17
18 extern XNN_INTERNAL const float xnn_table_exp2minus_k_over_16[16];
19
xnn_f32_velu_ukernel__sse41_rr2_lut16_p3_x16(size_t n,const float * x,float * y,const union xnn_f32_elu_params params[restrict XNN_MIN_ELEMENTS (1)])20 void xnn_f32_velu_ukernel__sse41_rr2_lut16_p3_x16(
21 size_t n,
22 const float* x,
23 float* y,
24 const union xnn_f32_elu_params params[restrict XNN_MIN_ELEMENTS(1)]) XNN_DISABLE_TSAN
25 {
26 assert(n != 0);
27 assert(n % sizeof(float) == 0);
28 assert(x != NULL);
29 assert(y != NULL);
30
31 const __m128 vprescale = _mm_load_ps(params->sse.prescale);
32 const __m128 valpha = _mm_load_ps(params->sse.alpha);
33 const __m128 vbeta = _mm_load_ps(params->sse.beta);
34
35 const __m128 vsat_cutoff = _mm_set1_ps(-0x1.154246p+4f);
36 const __m128 vmagic_bias = _mm_set1_ps(0x1.800000p19f);
37 const __m128 vlog2e = _mm_set1_ps(0x1.715476p+0f);
38 const __m128i vindex_mask = _mm_set1_epi32(0xF);
39 const __m128 vminus_ln2_hi = _mm_set1_ps(-0x1.62E400p-1f);
40 const __m128 vminus_ln2_lo = _mm_set1_ps(-0x1.7F7D1Cp-20f);
41 const __m128 vc3 = _mm_set1_ps(0x1.55561Cp-3f);
42 const __m128 vc2 = _mm_set1_ps(0x1.0001ECp-1f);
43 const __m128 vone = _mm_set1_ps(1.0f);
44
45 for (; n >= 16 * sizeof(float); n -= 16 * sizeof(float)) {
46 __m128 vx0123 = _mm_loadu_ps(x);
47 __m128 vx4567 = _mm_loadu_ps(x + 4);
48 __m128 vx89AB = _mm_loadu_ps(x + 8);
49 __m128 vxCDEF = _mm_loadu_ps(x + 12);
50 x += 16;
51
52 const __m128 vz0123 = _mm_max_ps(vsat_cutoff, _mm_mul_ps(vx0123, vprescale));
53 const __m128 vz4567 = _mm_max_ps(vsat_cutoff, _mm_mul_ps(vx4567, vprescale));
54 const __m128 vz89AB = _mm_max_ps(vsat_cutoff, _mm_mul_ps(vx89AB, vprescale));
55 const __m128 vzCDEF = _mm_max_ps(vsat_cutoff, _mm_mul_ps(vxCDEF, vprescale));
56
57 __m128 vn0123 = _mm_add_ps(_mm_mul_ps(vz0123, vlog2e), vmagic_bias);
58 __m128 vn4567 = _mm_add_ps(_mm_mul_ps(vz4567, vlog2e), vmagic_bias);
59 __m128 vn89AB = _mm_add_ps(_mm_mul_ps(vz89AB, vlog2e), vmagic_bias);
60 __m128 vnCDEF = _mm_add_ps(_mm_mul_ps(vzCDEF, vlog2e), vmagic_bias);
61
62 const __m128i vidx0123 = _mm_slli_epi32(_mm_and_si128(_mm_castps_si128(vn0123), vindex_mask), 2);
63 const __m128i ven0123 = _mm_slli_epi32(_mm_castps_si128(vn0123), 19);
64 const __m128i vidx4567 = _mm_slli_epi32(_mm_and_si128(_mm_castps_si128(vn4567), vindex_mask), 2);
65 const __m128i ven4567 = _mm_slli_epi32(_mm_castps_si128(vn4567), 19);
66 const __m128i vidx89AB = _mm_slli_epi32(_mm_and_si128(_mm_castps_si128(vn89AB), vindex_mask), 2);
67 const __m128i ven89AB = _mm_slli_epi32(_mm_castps_si128(vn89AB), 19);
68 const __m128i vidxCDEF = _mm_slli_epi32(_mm_and_si128(_mm_castps_si128(vnCDEF), vindex_mask), 2);
69 const __m128i venCDEF = _mm_slli_epi32(_mm_castps_si128(vnCDEF), 19);
70
71 #if XNN_ARCH_X86_64
72 const uint64_t vidx01 = (uint64_t) _mm_cvtsi128_si64(vidx0123);
73 const uint64_t vidx23 = (uint64_t) _mm_extract_epi64(vidx0123, 1);
74 const __m128i vl0 = _mm_cvtsi32_si128(*((const int*) ((uintptr_t) xnn_table_exp2minus_k_over_16 + (uint32_t) vidx01)));
75 const __m128i vl2 = _mm_cvtsi32_si128(*((const int*) ((uintptr_t) xnn_table_exp2minus_k_over_16 + (uint32_t) vidx23)));
76 const __m128i vl01 = _mm_insert_epi32(vl0, *((const int*) ((uintptr_t) xnn_table_exp2minus_k_over_16 + (uint32_t) (vidx01 >> 32))), 1);
77 const __m128i vl23 = _mm_insert_epi32(vl2, *((const int*) ((uintptr_t) xnn_table_exp2minus_k_over_16 + (uint32_t) (vidx23 >> 32))), 1);
78 const __m128i vl0123 = _mm_unpacklo_epi64(vl01, vl23);
79 const uint64_t vidx45 = (uint64_t) _mm_cvtsi128_si64(vidx4567);
80 const uint64_t vidx67 = (uint64_t) _mm_extract_epi64(vidx4567, 1);
81 const __m128i vl4 = _mm_cvtsi32_si128(*((const int*) ((uintptr_t) xnn_table_exp2minus_k_over_16 + (uint32_t) vidx45)));
82 const __m128i vl6 = _mm_cvtsi32_si128(*((const int*) ((uintptr_t) xnn_table_exp2minus_k_over_16 + (uint32_t) vidx67)));
83 const __m128i vl45 = _mm_insert_epi32(vl4, *((const int*) ((uintptr_t) xnn_table_exp2minus_k_over_16 + (uint32_t) (vidx45 >> 32))), 1);
84 const __m128i vl67 = _mm_insert_epi32(vl6, *((const int*) ((uintptr_t) xnn_table_exp2minus_k_over_16 + (uint32_t) (vidx67 >> 32))), 1);
85 const __m128i vl4567 = _mm_unpacklo_epi64(vl45, vl67);
86 const uint64_t vidx89 = (uint64_t) _mm_cvtsi128_si64(vidx89AB);
87 const uint64_t vidxAB = (uint64_t) _mm_extract_epi64(vidx89AB, 1);
88 const __m128i vl8 = _mm_cvtsi32_si128(*((const int*) ((uintptr_t) xnn_table_exp2minus_k_over_16 + (uint32_t) vidx89)));
89 const __m128i vlA = _mm_cvtsi32_si128(*((const int*) ((uintptr_t) xnn_table_exp2minus_k_over_16 + (uint32_t) vidxAB)));
90 const __m128i vl89 = _mm_insert_epi32(vl8, *((const int*) ((uintptr_t) xnn_table_exp2minus_k_over_16 + (uint32_t) (vidx89 >> 32))), 1);
91 const __m128i vlAB = _mm_insert_epi32(vlA, *((const int*) ((uintptr_t) xnn_table_exp2minus_k_over_16 + (uint32_t) (vidxAB >> 32))), 1);
92 const __m128i vl89AB = _mm_unpacklo_epi64(vl89, vlAB);
93 const uint64_t vidxCD = (uint64_t) _mm_cvtsi128_si64(vidxCDEF);
94 const uint64_t vidxEF = (uint64_t) _mm_extract_epi64(vidxCDEF, 1);
95 const __m128i vlC = _mm_cvtsi32_si128(*((const int*) ((uintptr_t) xnn_table_exp2minus_k_over_16 + (uint32_t) vidxCD)));
96 const __m128i vlE = _mm_cvtsi32_si128(*((const int*) ((uintptr_t) xnn_table_exp2minus_k_over_16 + (uint32_t) vidxEF)));
97 const __m128i vlCD = _mm_insert_epi32(vlC, *((const int*) ((uintptr_t) xnn_table_exp2minus_k_over_16 + (uint32_t) (vidxCD >> 32))), 1);
98 const __m128i vlEF = _mm_insert_epi32(vlE, *((const int*) ((uintptr_t) xnn_table_exp2minus_k_over_16 + (uint32_t) (vidxEF >> 32))), 1);
99 const __m128i vlCDEF = _mm_unpacklo_epi64(vlCD, vlEF);
100 #else // !XNN_ARCH_X86_64
101 const uint32_t vidx0 = (uint32_t) _mm_cvtsi128_si32(vidx0123);
102 const uint32_t vidx1 = (uint32_t) _mm_extract_epi16(vidx0123, 2);
103 const uint32_t vidx2 = (uint32_t) _mm_extract_epi16(vidx0123, 4);
104 const uint32_t vidx3 = (uint32_t) _mm_extract_epi16(vidx0123, 6);
105 const __m128i vl0 = _mm_cvtsi32_si128(*((const int*) ((uintptr_t) xnn_table_exp2minus_k_over_16 + vidx0)));
106 const __m128i vl2 = _mm_cvtsi32_si128(*((const int*) ((uintptr_t) xnn_table_exp2minus_k_over_16 + vidx2)));
107 const __m128i vl01 = _mm_insert_epi32(vl0, *((const int*) ((uintptr_t) xnn_table_exp2minus_k_over_16 + vidx1)), 1);
108 const __m128i vl23 = _mm_insert_epi32(vl2, *((const int*) ((uintptr_t) xnn_table_exp2minus_k_over_16 + vidx3)), 1);
109 const __m128i vl0123 = _mm_unpacklo_epi64(vl01, vl23);
110 const uint32_t vidx4 = (uint32_t) _mm_cvtsi128_si32(vidx4567);
111 const uint32_t vidx5 = (uint32_t) _mm_extract_epi16(vidx4567, 2);
112 const uint32_t vidx6 = (uint32_t) _mm_extract_epi16(vidx4567, 4);
113 const uint32_t vidx7 = (uint32_t) _mm_extract_epi16(vidx4567, 6);
114 const __m128i vl4 = _mm_cvtsi32_si128(*((const int*) ((uintptr_t) xnn_table_exp2minus_k_over_16 + vidx4)));
115 const __m128i vl6 = _mm_cvtsi32_si128(*((const int*) ((uintptr_t) xnn_table_exp2minus_k_over_16 + vidx6)));
116 const __m128i vl45 = _mm_insert_epi32(vl4, *((const int*) ((uintptr_t) xnn_table_exp2minus_k_over_16 + vidx5)), 1);
117 const __m128i vl67 = _mm_insert_epi32(vl6, *((const int*) ((uintptr_t) xnn_table_exp2minus_k_over_16 + vidx7)), 1);
118 const __m128i vl4567 = _mm_unpacklo_epi64(vl45, vl67);
119 const uint32_t vidx8 = (uint32_t) _mm_cvtsi128_si32(vidx89AB);
120 const uint32_t vidx9 = (uint32_t) _mm_extract_epi16(vidx89AB, 2);
121 const uint32_t vidxA = (uint32_t) _mm_extract_epi16(vidx89AB, 4);
122 const uint32_t vidxB = (uint32_t) _mm_extract_epi16(vidx89AB, 6);
123 const __m128i vl8 = _mm_cvtsi32_si128(*((const int*) ((uintptr_t) xnn_table_exp2minus_k_over_16 + vidx8)));
124 const __m128i vlA = _mm_cvtsi32_si128(*((const int*) ((uintptr_t) xnn_table_exp2minus_k_over_16 + vidxA)));
125 const __m128i vl89 = _mm_insert_epi32(vl8, *((const int*) ((uintptr_t) xnn_table_exp2minus_k_over_16 + vidx9)), 1);
126 const __m128i vlAB = _mm_insert_epi32(vlA, *((const int*) ((uintptr_t) xnn_table_exp2minus_k_over_16 + vidxB)), 1);
127 const __m128i vl89AB = _mm_unpacklo_epi64(vl89, vlAB);
128 const uint32_t vidxC = (uint32_t) _mm_cvtsi128_si32(vidxCDEF);
129 const uint32_t vidxD = (uint32_t) _mm_extract_epi16(vidxCDEF, 2);
130 const uint32_t vidxE = (uint32_t) _mm_extract_epi16(vidxCDEF, 4);
131 const uint32_t vidxF = (uint32_t) _mm_extract_epi16(vidxCDEF, 6);
132 const __m128i vlC = _mm_cvtsi32_si128(*((const int*) ((uintptr_t) xnn_table_exp2minus_k_over_16 + vidxC)));
133 const __m128i vlE = _mm_cvtsi32_si128(*((const int*) ((uintptr_t) xnn_table_exp2minus_k_over_16 + vidxE)));
134 const __m128i vlCD = _mm_insert_epi32(vlC, *((const int*) ((uintptr_t) xnn_table_exp2minus_k_over_16 + vidxD)), 1);
135 const __m128i vlEF = _mm_insert_epi32(vlE, *((const int*) ((uintptr_t) xnn_table_exp2minus_k_over_16 + vidxF)), 1);
136 const __m128i vlCDEF = _mm_unpacklo_epi64(vlCD, vlEF);
137 #endif // XNN_ARCH_X86_64
138
139 vn0123 = _mm_sub_ps(vn0123, vmagic_bias);
140 __m128 vs0123 = _mm_castsi128_ps(_mm_add_epi32(vl0123, ven0123));
141 vn4567 = _mm_sub_ps(vn4567, vmagic_bias);
142 __m128 vs4567 = _mm_castsi128_ps(_mm_add_epi32(vl4567, ven4567));
143 vn89AB = _mm_sub_ps(vn89AB, vmagic_bias);
144 __m128 vs89AB = _mm_castsi128_ps(_mm_add_epi32(vl89AB, ven89AB));
145 vnCDEF = _mm_sub_ps(vnCDEF, vmagic_bias);
146 __m128 vsCDEF = _mm_castsi128_ps(_mm_add_epi32(vlCDEF, venCDEF));
147
148 __m128 vt0123 = _mm_add_ps(_mm_mul_ps(vn0123, vminus_ln2_hi), vz0123);
149 __m128 vt4567 = _mm_add_ps(_mm_mul_ps(vn4567, vminus_ln2_hi), vz4567);
150 __m128 vt89AB = _mm_add_ps(_mm_mul_ps(vn89AB, vminus_ln2_hi), vz89AB);
151 __m128 vtCDEF = _mm_add_ps(_mm_mul_ps(vnCDEF, vminus_ln2_hi), vzCDEF);
152
153 vt0123 = _mm_add_ps(_mm_mul_ps(vn0123, vminus_ln2_lo), vt0123);
154 vt4567 = _mm_add_ps(_mm_mul_ps(vn4567, vminus_ln2_lo), vt4567);
155 vt89AB = _mm_add_ps(_mm_mul_ps(vn89AB, vminus_ln2_lo), vt89AB);
156 vtCDEF = _mm_add_ps(_mm_mul_ps(vnCDEF, vminus_ln2_lo), vtCDEF);
157
158 __m128 vp0123 = _mm_add_ps(_mm_mul_ps(vc3, vt0123), vc2);
159 __m128 vp4567 = _mm_add_ps(_mm_mul_ps(vc3, vt4567), vc2);
160 __m128 vp89AB = _mm_add_ps(_mm_mul_ps(vc3, vt89AB), vc2);
161 __m128 vpCDEF = _mm_add_ps(_mm_mul_ps(vc3, vtCDEF), vc2);
162
163 vp0123 = _mm_mul_ps(vp0123, vt0123);
164 vp4567 = _mm_mul_ps(vp4567, vt4567);
165 vp89AB = _mm_mul_ps(vp89AB, vt89AB);
166 vpCDEF = _mm_mul_ps(vpCDEF, vtCDEF);
167
168 vt0123 = _mm_mul_ps(vt0123, vs0123);
169 vs0123 = _mm_sub_ps(vs0123, vone);
170 vt4567 = _mm_mul_ps(vt4567, vs4567);
171 vs4567 = _mm_sub_ps(vs4567, vone);
172 vt89AB = _mm_mul_ps(vt89AB, vs89AB);
173 vs89AB = _mm_sub_ps(vs89AB, vone);
174 vtCDEF = _mm_mul_ps(vtCDEF, vsCDEF);
175 vsCDEF = _mm_sub_ps(vsCDEF, vone);
176
177 vp0123 = _mm_add_ps(_mm_mul_ps(vp0123, vt0123), vt0123);
178 vp4567 = _mm_add_ps(_mm_mul_ps(vp4567, vt4567), vt4567);
179 vp89AB = _mm_add_ps(_mm_mul_ps(vp89AB, vt89AB), vt89AB);
180 vpCDEF = _mm_add_ps(_mm_mul_ps(vpCDEF, vtCDEF), vtCDEF);
181
182 const __m128 ve0123 = _mm_mul_ps(_mm_add_ps(vp0123, vs0123), valpha);
183 const __m128 ve4567 = _mm_mul_ps(_mm_add_ps(vp4567, vs4567), valpha);
184 const __m128 ve89AB = _mm_mul_ps(_mm_add_ps(vp89AB, vs89AB), valpha);
185 const __m128 veCDEF = _mm_mul_ps(_mm_add_ps(vpCDEF, vsCDEF), valpha);
186
187 vx0123 = _mm_mul_ps(vx0123, vbeta);
188 vx4567 = _mm_mul_ps(vx4567, vbeta);
189 vx89AB = _mm_mul_ps(vx89AB, vbeta);
190 vxCDEF = _mm_mul_ps(vxCDEF, vbeta);
191
192 const __m128 vy0123 = _mm_blendv_ps(vx0123, ve0123, vx0123);
193 const __m128 vy4567 = _mm_blendv_ps(vx4567, ve4567, vx4567);
194 const __m128 vy89AB = _mm_blendv_ps(vx89AB, ve89AB, vx89AB);
195 const __m128 vyCDEF = _mm_blendv_ps(vxCDEF, veCDEF, vxCDEF);
196
197 _mm_storeu_ps(y, vy0123);
198 _mm_storeu_ps(y + 4, vy4567);
199 _mm_storeu_ps(y + 8, vy89AB);
200 _mm_storeu_ps(y + 12, vyCDEF);
201 y += 16;
202 }
203 for (; n >= 4 * sizeof(float); n -= 4 * sizeof(float)) {
204 __m128 vx = _mm_loadu_ps(x);
205 x += 4;
206
207 const __m128 vz = _mm_max_ps(vsat_cutoff, _mm_mul_ps(vx, vprescale));
208
209 __m128 vn = _mm_add_ps(_mm_mul_ps(vz, vlog2e), vmagic_bias);
210
211 const __m128i ven = _mm_slli_epi32(_mm_castps_si128(vn), 19);
212 const __m128i vidx = _mm_slli_epi32(_mm_and_si128(_mm_castps_si128(vn), vindex_mask), 2);
213 #if XNN_ARCH_X86_64
214 const uint64_t vidx_lo = (uint64_t) _mm_cvtsi128_si64(vidx);
215 const uint64_t vidx_hi = (uint64_t) _mm_extract_epi64(vidx, 1);
216 const __m128i vl_ll = _mm_cvtsi32_si128(*((const int*) ((uintptr_t) xnn_table_exp2minus_k_over_16 + (uint32_t) vidx_lo)));
217 const __m128i vl_hl = _mm_cvtsi32_si128(*((const int*) ((uintptr_t) xnn_table_exp2minus_k_over_16 + (uint32_t) vidx_hi)));
218 const __m128i vl_lo = _mm_insert_epi32(vl_ll, *((const int*) ((uintptr_t) xnn_table_exp2minus_k_over_16 + (uint32_t) (vidx_lo >> 32))), 1);
219 const __m128i vl_hi = _mm_insert_epi32(vl_hl, *((const int*) ((uintptr_t) xnn_table_exp2minus_k_over_16 + (uint32_t) (vidx_hi >> 32))), 1);
220 #else // !XNN_ARCH_X86_64
221 const __m128i vl_ll = _mm_cvtsi32_si128(*((const int*) ((uintptr_t) xnn_table_exp2minus_k_over_16 + (uint32_t) _mm_cvtsi128_si32(vidx))));
222 const __m128i vl_hl = _mm_cvtsi32_si128(*((const int*) ((uintptr_t) xnn_table_exp2minus_k_over_16 + (uint32_t) _mm_extract_epi16(vidx, 4))));
223 const __m128i vl_lo = _mm_insert_epi32(vl_ll, *((const int*) ((uintptr_t) xnn_table_exp2minus_k_over_16 + (uint32_t) _mm_extract_epi16(vidx, 2))), 1);
224 const __m128i vl_hi = _mm_insert_epi32(vl_hl, *((const int*) ((uintptr_t) xnn_table_exp2minus_k_over_16 + (uint32_t) _mm_extract_epi16(vidx, 6))), 1);
225 #endif // XNN_ARCH_X86_64
226 const __m128i vl = _mm_unpacklo_epi64(vl_lo, vl_hi);
227 __m128 vs = _mm_castsi128_ps(_mm_add_epi32(vl, ven));
228 vn = _mm_sub_ps(vn, vmagic_bias);
229
230 __m128 vt = _mm_add_ps(_mm_mul_ps(vn, vminus_ln2_hi), vz);
231 vt = _mm_add_ps(_mm_mul_ps(vn, vminus_ln2_lo), vt);
232
233 __m128 vp = _mm_add_ps(_mm_mul_ps(vc3, vt), vc2);
234 vp = _mm_mul_ps(vp, vt);
235
236 vt = _mm_mul_ps(vt, vs);
237 vs = _mm_sub_ps(vs, vone);
238 vp = _mm_add_ps(_mm_mul_ps(vp, vt), vt);
239 const __m128 ve = _mm_mul_ps(_mm_add_ps(vp, vs), valpha);
240
241 vx = _mm_mul_ps(vx, vbeta);
242 const __m128 vy = _mm_blendv_ps(vx, ve, vx);
243
244 _mm_storeu_ps(y, vy);
245 y += 4;
246 }
247 if XNN_UNLIKELY(n != 0) {
248 __m128 vx = _mm_loadu_ps(x);
249
250 const __m128 vz = _mm_max_ps(vsat_cutoff, _mm_mul_ps(vx, vprescale));
251
252 __m128 vn = _mm_add_ps(_mm_mul_ps(vz, vlog2e), vmagic_bias);
253
254 const __m128i ven = _mm_slli_epi32(_mm_castps_si128(vn), 19);
255 const __m128i vidx = _mm_slli_epi32(_mm_and_si128(_mm_castps_si128(vn), vindex_mask), 2);
256 #if XNN_ARCH_X86_64
257 const uint64_t vidx_lo = (uint64_t) _mm_cvtsi128_si64(vidx);
258 const uint64_t vidx_hi = (uint64_t) _mm_extract_epi64(vidx, 1);
259 const __m128i vl_ll = _mm_cvtsi32_si128(*((const int*) ((uintptr_t) xnn_table_exp2minus_k_over_16 + (uint32_t) vidx_lo)));
260 const __m128i vl_hl = _mm_cvtsi32_si128(*((const int*) ((uintptr_t) xnn_table_exp2minus_k_over_16 + (uint32_t) vidx_hi)));
261 const __m128i vl_lo = _mm_insert_epi32(vl_ll, *((const int*) ((uintptr_t) xnn_table_exp2minus_k_over_16 + (uint32_t) (vidx_lo >> 32))), 1);
262 const __m128i vl_hi = _mm_insert_epi32(vl_hl, *((const int*) ((uintptr_t) xnn_table_exp2minus_k_over_16 + (uint32_t) (vidx_hi >> 32))), 1);
263 #else // !XNN_ARCH_X86_64
264 const __m128i vl_ll = _mm_cvtsi32_si128(*((const int*) ((uintptr_t) xnn_table_exp2minus_k_over_16 + (uint32_t) _mm_cvtsi128_si32(vidx))));
265 const __m128i vl_hl = _mm_cvtsi32_si128(*((const int*) ((uintptr_t) xnn_table_exp2minus_k_over_16 + (uint32_t) _mm_extract_epi16(vidx, 4))));
266 const __m128i vl_lo = _mm_insert_epi32(vl_ll, *((const int*) ((uintptr_t) xnn_table_exp2minus_k_over_16 + (uint32_t) _mm_extract_epi16(vidx, 2))), 1);
267 const __m128i vl_hi = _mm_insert_epi32(vl_hl, *((const int*) ((uintptr_t) xnn_table_exp2minus_k_over_16 + (uint32_t) _mm_extract_epi16(vidx, 6))), 1);
268 #endif // XNN_ARCH_X86_64
269 const __m128i vl = _mm_unpacklo_epi64(vl_lo, vl_hi);
270 __m128 vs = _mm_castsi128_ps(_mm_add_epi32(vl, ven));
271 vn = _mm_sub_ps(vn, vmagic_bias);
272
273 __m128 vt = _mm_add_ps(_mm_mul_ps(vn, vminus_ln2_hi), vz);
274 vt = _mm_add_ps(_mm_mul_ps(vn, vminus_ln2_lo), vt);
275
276 __m128 vp = _mm_add_ps(_mm_mul_ps(vc3, vt), vc2);
277 vp = _mm_mul_ps(vp, vt);
278
279 vt = _mm_mul_ps(vt, vs);
280 vs = _mm_sub_ps(vs, vone);
281 vp = _mm_add_ps(_mm_mul_ps(vp, vt), vt);
282 const __m128 ve = _mm_mul_ps(_mm_add_ps(vp, vs), valpha);
283
284 vx = _mm_mul_ps(vx, vbeta);
285 __m128 vy = _mm_blendv_ps(vx, ve, vx);
286
287 if (n & (2 * sizeof(float))) {
288 _mm_storel_pi((__m64*) y, vy);
289 vy = _mm_movehl_ps(vy, vy);
290 y += 2;
291 }
292 if (n & (1 * sizeof(float))) {
293 _mm_store_ss(y, vy);
294 }
295 }
296 }
297