1 | /*
|
---|
2 | * MMX/3DNow!/SSE/SSE2/SSE3/SSSE3/SSE4/PNI support
|
---|
3 | *
|
---|
4 | * Copyright (c) 2005 Fabrice Bellard
|
---|
5 | * Copyright (c) 2008 Intel Corporation <[email protected]>
|
---|
6 | *
|
---|
7 | * This library is free software; you can redistribute it and/or
|
---|
8 | * modify it under the terms of the GNU Lesser General Public
|
---|
9 | * License as published by the Free Software Foundation; either
|
---|
10 | * version 2 of the License, or (at your option) any later version.
|
---|
11 | *
|
---|
12 | * This library is distributed in the hope that it will be useful,
|
---|
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
15 | * Lesser General Public License for more details.
|
---|
16 | *
|
---|
17 | * You should have received a copy of the GNU Lesser General Public
|
---|
18 | * License along with this library; if not, write to the Free Software
|
---|
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
---|
20 | */
|
---|
21 |
|
---|
22 | /*
|
---|
23 | * Oracle LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
|
---|
24 | * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
|
---|
25 | * the Lesser General Public License version 2.1 (LGPLv2) at this time for any software where
|
---|
26 | * a choice of LGPL license versions is made available with the language indicating
|
---|
27 | * that LGPLv2 or any later version may be used, or where a choice of which version
|
---|
28 | * of the LGPL is applied is otherwise unspecified.
|
---|
29 | */
|
---|
30 |
|
---|
31 | #if SHIFT == 0
|
---|
32 | #define Reg MMXReg
|
---|
33 | #ifndef VBOX
|
---|
34 | #define XMM_ONLY(x...)
|
---|
35 | #else
|
---|
36 | #define XMM_ONLY(x)
|
---|
37 | #endif
|
---|
38 | #define B(n) MMX_B(n)
|
---|
39 | #define W(n) MMX_W(n)
|
---|
40 | #define L(n) MMX_L(n)
|
---|
41 | #define Q(n) q
|
---|
42 | #define SUFFIX _mmx
|
---|
43 | #else
|
---|
44 | #define Reg XMMReg
|
---|
45 | #ifndef VBOX
|
---|
46 | #define XMM_ONLY(x...) x
|
---|
47 | #else
|
---|
48 | #define XMM_ONLY(x) x
|
---|
49 | #endif
|
---|
50 | #define B(n) XMM_B(n)
|
---|
51 | #define W(n) XMM_W(n)
|
---|
52 | #define L(n) XMM_L(n)
|
---|
53 | #define Q(n) XMM_Q(n)
|
---|
54 | #define SUFFIX _xmm
|
---|
55 | #endif
|
---|
56 |
|
---|
57 | void glue(helper_psrlw, SUFFIX)(Reg *d, Reg *s)
|
---|
58 | {
|
---|
59 | int shift;
|
---|
60 |
|
---|
61 | if (s->Q(0) > 15) {
|
---|
62 | d->Q(0) = 0;
|
---|
63 | #if SHIFT == 1
|
---|
64 | d->Q(1) = 0;
|
---|
65 | #endif
|
---|
66 | } else {
|
---|
67 | shift = s->B(0);
|
---|
68 | d->W(0) >>= shift;
|
---|
69 | d->W(1) >>= shift;
|
---|
70 | d->W(2) >>= shift;
|
---|
71 | d->W(3) >>= shift;
|
---|
72 | #if SHIFT == 1
|
---|
73 | d->W(4) >>= shift;
|
---|
74 | d->W(5) >>= shift;
|
---|
75 | d->W(6) >>= shift;
|
---|
76 | d->W(7) >>= shift;
|
---|
77 | #endif
|
---|
78 | }
|
---|
79 | }
|
---|
80 |
|
---|
81 | void glue(helper_psraw, SUFFIX)(Reg *d, Reg *s)
|
---|
82 | {
|
---|
83 | int shift;
|
---|
84 |
|
---|
85 | if (s->Q(0) > 15) {
|
---|
86 | shift = 15;
|
---|
87 | } else {
|
---|
88 | shift = s->B(0);
|
---|
89 | }
|
---|
90 | d->W(0) = (int16_t)d->W(0) >> shift;
|
---|
91 | d->W(1) = (int16_t)d->W(1) >> shift;
|
---|
92 | d->W(2) = (int16_t)d->W(2) >> shift;
|
---|
93 | d->W(3) = (int16_t)d->W(3) >> shift;
|
---|
94 | #if SHIFT == 1
|
---|
95 | d->W(4) = (int16_t)d->W(4) >> shift;
|
---|
96 | d->W(5) = (int16_t)d->W(5) >> shift;
|
---|
97 | d->W(6) = (int16_t)d->W(6) >> shift;
|
---|
98 | d->W(7) = (int16_t)d->W(7) >> shift;
|
---|
99 | #endif
|
---|
100 | }
|
---|
101 |
|
---|
102 | void glue(helper_psllw, SUFFIX)(Reg *d, Reg *s)
|
---|
103 | {
|
---|
104 | int shift;
|
---|
105 |
|
---|
106 | if (s->Q(0) > 15) {
|
---|
107 | d->Q(0) = 0;
|
---|
108 | #if SHIFT == 1
|
---|
109 | d->Q(1) = 0;
|
---|
110 | #endif
|
---|
111 | } else {
|
---|
112 | shift = s->B(0);
|
---|
113 | d->W(0) <<= shift;
|
---|
114 | d->W(1) <<= shift;
|
---|
115 | d->W(2) <<= shift;
|
---|
116 | d->W(3) <<= shift;
|
---|
117 | #if SHIFT == 1
|
---|
118 | d->W(4) <<= shift;
|
---|
119 | d->W(5) <<= shift;
|
---|
120 | d->W(6) <<= shift;
|
---|
121 | d->W(7) <<= shift;
|
---|
122 | #endif
|
---|
123 | }
|
---|
124 | }
|
---|
125 |
|
---|
126 | void glue(helper_psrld, SUFFIX)(Reg *d, Reg *s)
|
---|
127 | {
|
---|
128 | int shift;
|
---|
129 |
|
---|
130 | if (s->Q(0) > 31) {
|
---|
131 | d->Q(0) = 0;
|
---|
132 | #if SHIFT == 1
|
---|
133 | d->Q(1) = 0;
|
---|
134 | #endif
|
---|
135 | } else {
|
---|
136 | shift = s->B(0);
|
---|
137 | d->L(0) >>= shift;
|
---|
138 | d->L(1) >>= shift;
|
---|
139 | #if SHIFT == 1
|
---|
140 | d->L(2) >>= shift;
|
---|
141 | d->L(3) >>= shift;
|
---|
142 | #endif
|
---|
143 | }
|
---|
144 | }
|
---|
145 |
|
---|
146 | void glue(helper_psrad, SUFFIX)(Reg *d, Reg *s)
|
---|
147 | {
|
---|
148 | int shift;
|
---|
149 |
|
---|
150 | if (s->Q(0) > 31) {
|
---|
151 | shift = 31;
|
---|
152 | } else {
|
---|
153 | shift = s->B(0);
|
---|
154 | }
|
---|
155 | d->L(0) = (int32_t)d->L(0) >> shift;
|
---|
156 | d->L(1) = (int32_t)d->L(1) >> shift;
|
---|
157 | #if SHIFT == 1
|
---|
158 | d->L(2) = (int32_t)d->L(2) >> shift;
|
---|
159 | d->L(3) = (int32_t)d->L(3) >> shift;
|
---|
160 | #endif
|
---|
161 | }
|
---|
162 |
|
---|
163 | void glue(helper_pslld, SUFFIX)(Reg *d, Reg *s)
|
---|
164 | {
|
---|
165 | int shift;
|
---|
166 |
|
---|
167 | if (s->Q(0) > 31) {
|
---|
168 | d->Q(0) = 0;
|
---|
169 | #if SHIFT == 1
|
---|
170 | d->Q(1) = 0;
|
---|
171 | #endif
|
---|
172 | } else {
|
---|
173 | shift = s->B(0);
|
---|
174 | d->L(0) <<= shift;
|
---|
175 | d->L(1) <<= shift;
|
---|
176 | #if SHIFT == 1
|
---|
177 | d->L(2) <<= shift;
|
---|
178 | d->L(3) <<= shift;
|
---|
179 | #endif
|
---|
180 | }
|
---|
181 | }
|
---|
182 |
|
---|
183 | void glue(helper_psrlq, SUFFIX)(Reg *d, Reg *s)
|
---|
184 | {
|
---|
185 | int shift;
|
---|
186 |
|
---|
187 | if (s->Q(0) > 63) {
|
---|
188 | d->Q(0) = 0;
|
---|
189 | #if SHIFT == 1
|
---|
190 | d->Q(1) = 0;
|
---|
191 | #endif
|
---|
192 | } else {
|
---|
193 | shift = s->B(0);
|
---|
194 | d->Q(0) >>= shift;
|
---|
195 | #if SHIFT == 1
|
---|
196 | d->Q(1) >>= shift;
|
---|
197 | #endif
|
---|
198 | }
|
---|
199 | }
|
---|
200 |
|
---|
201 | void glue(helper_psllq, SUFFIX)(Reg *d, Reg *s)
|
---|
202 | {
|
---|
203 | int shift;
|
---|
204 |
|
---|
205 | if (s->Q(0) > 63) {
|
---|
206 | d->Q(0) = 0;
|
---|
207 | #if SHIFT == 1
|
---|
208 | d->Q(1) = 0;
|
---|
209 | #endif
|
---|
210 | } else {
|
---|
211 | shift = s->B(0);
|
---|
212 | d->Q(0) <<= shift;
|
---|
213 | #if SHIFT == 1
|
---|
214 | d->Q(1) <<= shift;
|
---|
215 | #endif
|
---|
216 | }
|
---|
217 | }
|
---|
218 |
|
---|
219 | #if SHIFT == 1
|
---|
220 | void glue(helper_psrldq, SUFFIX)(Reg *d, Reg *s)
|
---|
221 | {
|
---|
222 | int shift, i;
|
---|
223 |
|
---|
224 | shift = s->L(0);
|
---|
225 | if (shift > 16)
|
---|
226 | shift = 16;
|
---|
227 | for(i = 0; i < 16 - shift; i++)
|
---|
228 | d->B(i) = d->B(i + shift);
|
---|
229 | for(i = 16 - shift; i < 16; i++)
|
---|
230 | d->B(i) = 0;
|
---|
231 | }
|
---|
232 |
|
---|
233 | void glue(helper_pslldq, SUFFIX)(Reg *d, Reg *s)
|
---|
234 | {
|
---|
235 | int shift, i;
|
---|
236 |
|
---|
237 | shift = s->L(0);
|
---|
238 | if (shift > 16)
|
---|
239 | shift = 16;
|
---|
240 | for(i = 15; i >= shift; i--)
|
---|
241 | d->B(i) = d->B(i - shift);
|
---|
242 | for(i = 0; i < shift; i++)
|
---|
243 | d->B(i) = 0;
|
---|
244 | }
|
---|
245 | #endif
|
---|
246 |
|
---|
247 | #define SSE_HELPER_B(name, F)\
|
---|
248 | void glue(name, SUFFIX) (Reg *d, Reg *s)\
|
---|
249 | {\
|
---|
250 | d->B(0) = F(d->B(0), s->B(0));\
|
---|
251 | d->B(1) = F(d->B(1), s->B(1));\
|
---|
252 | d->B(2) = F(d->B(2), s->B(2));\
|
---|
253 | d->B(3) = F(d->B(3), s->B(3));\
|
---|
254 | d->B(4) = F(d->B(4), s->B(4));\
|
---|
255 | d->B(5) = F(d->B(5), s->B(5));\
|
---|
256 | d->B(6) = F(d->B(6), s->B(6));\
|
---|
257 | d->B(7) = F(d->B(7), s->B(7));\
|
---|
258 | XMM_ONLY(\
|
---|
259 | d->B(8) = F(d->B(8), s->B(8));\
|
---|
260 | d->B(9) = F(d->B(9), s->B(9));\
|
---|
261 | d->B(10) = F(d->B(10), s->B(10));\
|
---|
262 | d->B(11) = F(d->B(11), s->B(11));\
|
---|
263 | d->B(12) = F(d->B(12), s->B(12));\
|
---|
264 | d->B(13) = F(d->B(13), s->B(13));\
|
---|
265 | d->B(14) = F(d->B(14), s->B(14));\
|
---|
266 | d->B(15) = F(d->B(15), s->B(15));\
|
---|
267 | )\
|
---|
268 | }
|
---|
269 |
|
---|
270 | #define SSE_HELPER_W(name, F)\
|
---|
271 | void glue(name, SUFFIX) (Reg *d, Reg *s)\
|
---|
272 | {\
|
---|
273 | d->W(0) = F(d->W(0), s->W(0));\
|
---|
274 | d->W(1) = F(d->W(1), s->W(1));\
|
---|
275 | d->W(2) = F(d->W(2), s->W(2));\
|
---|
276 | d->W(3) = F(d->W(3), s->W(3));\
|
---|
277 | XMM_ONLY(\
|
---|
278 | d->W(4) = F(d->W(4), s->W(4));\
|
---|
279 | d->W(5) = F(d->W(5), s->W(5));\
|
---|
280 | d->W(6) = F(d->W(6), s->W(6));\
|
---|
281 | d->W(7) = F(d->W(7), s->W(7));\
|
---|
282 | )\
|
---|
283 | }
|
---|
284 |
|
---|
285 | #define SSE_HELPER_L(name, F)\
|
---|
286 | void glue(name, SUFFIX) (Reg *d, Reg *s)\
|
---|
287 | {\
|
---|
288 | d->L(0) = F(d->L(0), s->L(0));\
|
---|
289 | d->L(1) = F(d->L(1), s->L(1));\
|
---|
290 | XMM_ONLY(\
|
---|
291 | d->L(2) = F(d->L(2), s->L(2));\
|
---|
292 | d->L(3) = F(d->L(3), s->L(3));\
|
---|
293 | )\
|
---|
294 | }
|
---|
295 |
|
---|
296 | #define SSE_HELPER_Q(name, F)\
|
---|
297 | void glue(name, SUFFIX) (Reg *d, Reg *s)\
|
---|
298 | {\
|
---|
299 | d->Q(0) = F(d->Q(0), s->Q(0));\
|
---|
300 | XMM_ONLY(\
|
---|
301 | d->Q(1) = F(d->Q(1), s->Q(1));\
|
---|
302 | )\
|
---|
303 | }
|
---|
304 |
|
---|
305 | #if SHIFT == 0
|
---|
306 | #ifndef VBOX
|
---|
307 | static inline int satub(int x)
|
---|
308 | #else /* VBOX */
|
---|
309 | DECLINLINE(int) satub(int x)
|
---|
310 | #endif /* VBOX */
|
---|
311 | {
|
---|
312 | if (x < 0)
|
---|
313 | return 0;
|
---|
314 | else if (x > 255)
|
---|
315 | return 255;
|
---|
316 | else
|
---|
317 | return x;
|
---|
318 | }
|
---|
319 |
|
---|
320 | #ifndef VBOX
|
---|
321 | static inline int satuw(int x)
|
---|
322 | #else /* VBOX */
|
---|
323 | DECLINLINE(int) satuw(int x)
|
---|
324 | #endif /* VBOX */
|
---|
325 | {
|
---|
326 | if (x < 0)
|
---|
327 | return 0;
|
---|
328 | else if (x > 65535)
|
---|
329 | return 65535;
|
---|
330 | else
|
---|
331 | return x;
|
---|
332 | }
|
---|
333 |
|
---|
334 | #ifndef VBOX
|
---|
335 | static inline int satsb(int x)
|
---|
336 | #else /* VBOX */
|
---|
337 | DECLINLINE(int) satsb(int x)
|
---|
338 | #endif /* VBOX */
|
---|
339 | {
|
---|
340 | if (x < -128)
|
---|
341 | return -128;
|
---|
342 | else if (x > 127)
|
---|
343 | return 127;
|
---|
344 | else
|
---|
345 | return x;
|
---|
346 | }
|
---|
347 |
|
---|
348 | #ifndef VBOX
|
---|
349 | static inline int satsw(int x)
|
---|
350 | #else /* VBOX */
|
---|
351 | DECLINLINE(int) satsw(int x)
|
---|
352 | #endif /* VBOX */
|
---|
353 | {
|
---|
354 | if (x < -32768)
|
---|
355 | return -32768;
|
---|
356 | else if (x > 32767)
|
---|
357 | return 32767;
|
---|
358 | else
|
---|
359 | return x;
|
---|
360 | }
|
---|
361 |
|
---|
362 | #define FADD(a, b) ((a) + (b))
|
---|
363 | #define FADDUB(a, b) satub((a) + (b))
|
---|
364 | #define FADDUW(a, b) satuw((a) + (b))
|
---|
365 | #define FADDSB(a, b) satsb((int8_t)(a) + (int8_t)(b))
|
---|
366 | #define FADDSW(a, b) satsw((int16_t)(a) + (int16_t)(b))
|
---|
367 |
|
---|
368 | #define FSUB(a, b) ((a) - (b))
|
---|
369 | #define FSUBUB(a, b) satub((a) - (b))
|
---|
370 | #define FSUBUW(a, b) satuw((a) - (b))
|
---|
371 | #define FSUBSB(a, b) satsb((int8_t)(a) - (int8_t)(b))
|
---|
372 | #define FSUBSW(a, b) satsw((int16_t)(a) - (int16_t)(b))
|
---|
373 | #define FMINUB(a, b) ((a) < (b)) ? (a) : (b)
|
---|
374 | #define FMINSW(a, b) ((int16_t)(a) < (int16_t)(b)) ? (a) : (b)
|
---|
375 | #define FMAXUB(a, b) ((a) > (b)) ? (a) : (b)
|
---|
376 | #define FMAXSW(a, b) ((int16_t)(a) > (int16_t)(b)) ? (a) : (b)
|
---|
377 |
|
---|
378 | #define FAND(a, b) (a) & (b)
|
---|
379 | #define FANDN(a, b) ((~(a)) & (b))
|
---|
380 | #define FOR(a, b) (a) | (b)
|
---|
381 | #define FXOR(a, b) (a) ^ (b)
|
---|
382 |
|
---|
383 | #define FCMPGTB(a, b) (int8_t)(a) > (int8_t)(b) ? -1 : 0
|
---|
384 | #define FCMPGTW(a, b) (int16_t)(a) > (int16_t)(b) ? -1 : 0
|
---|
385 | #define FCMPGTL(a, b) (int32_t)(a) > (int32_t)(b) ? -1 : 0
|
---|
386 | #define FCMPEQ(a, b) (a) == (b) ? -1 : 0
|
---|
387 |
|
---|
388 | #define FMULLW(a, b) (a) * (b)
|
---|
389 | #define FMULHRW(a, b) ((int16_t)(a) * (int16_t)(b) + 0x8000) >> 16
|
---|
390 | #define FMULHUW(a, b) (a) * (b) >> 16
|
---|
391 | #define FMULHW(a, b) (int16_t)(a) * (int16_t)(b) >> 16
|
---|
392 |
|
---|
393 | #define FAVG(a, b) ((a) + (b) + 1) >> 1
|
---|
394 | #endif
|
---|
395 |
|
---|
396 | SSE_HELPER_B(helper_paddb, FADD)
|
---|
397 | SSE_HELPER_W(helper_paddw, FADD)
|
---|
398 | SSE_HELPER_L(helper_paddl, FADD)
|
---|
399 | SSE_HELPER_Q(helper_paddq, FADD)
|
---|
400 |
|
---|
401 | SSE_HELPER_B(helper_psubb, FSUB)
|
---|
402 | SSE_HELPER_W(helper_psubw, FSUB)
|
---|
403 | SSE_HELPER_L(helper_psubl, FSUB)
|
---|
404 | SSE_HELPER_Q(helper_psubq, FSUB)
|
---|
405 |
|
---|
406 | SSE_HELPER_B(helper_paddusb, FADDUB)
|
---|
407 | SSE_HELPER_B(helper_paddsb, FADDSB)
|
---|
408 | SSE_HELPER_B(helper_psubusb, FSUBUB)
|
---|
409 | SSE_HELPER_B(helper_psubsb, FSUBSB)
|
---|
410 |
|
---|
411 | SSE_HELPER_W(helper_paddusw, FADDUW)
|
---|
412 | SSE_HELPER_W(helper_paddsw, FADDSW)
|
---|
413 | SSE_HELPER_W(helper_psubusw, FSUBUW)
|
---|
414 | SSE_HELPER_W(helper_psubsw, FSUBSW)
|
---|
415 |
|
---|
416 | SSE_HELPER_B(helper_pminub, FMINUB)
|
---|
417 | SSE_HELPER_B(helper_pmaxub, FMAXUB)
|
---|
418 |
|
---|
419 | SSE_HELPER_W(helper_pminsw, FMINSW)
|
---|
420 | SSE_HELPER_W(helper_pmaxsw, FMAXSW)
|
---|
421 |
|
---|
422 | SSE_HELPER_Q(helper_pand, FAND)
|
---|
423 | SSE_HELPER_Q(helper_pandn, FANDN)
|
---|
424 | SSE_HELPER_Q(helper_por, FOR)
|
---|
425 | SSE_HELPER_Q(helper_pxor, FXOR)
|
---|
426 |
|
---|
427 | SSE_HELPER_B(helper_pcmpgtb, FCMPGTB)
|
---|
428 | SSE_HELPER_W(helper_pcmpgtw, FCMPGTW)
|
---|
429 | SSE_HELPER_L(helper_pcmpgtl, FCMPGTL)
|
---|
430 |
|
---|
431 | SSE_HELPER_B(helper_pcmpeqb, FCMPEQ)
|
---|
432 | SSE_HELPER_W(helper_pcmpeqw, FCMPEQ)
|
---|
433 | SSE_HELPER_L(helper_pcmpeql, FCMPEQ)
|
---|
434 |
|
---|
435 | SSE_HELPER_W(helper_pmullw, FMULLW)
|
---|
436 | #if SHIFT == 0
|
---|
437 | SSE_HELPER_W(helper_pmulhrw, FMULHRW)
|
---|
438 | #endif
|
---|
439 | SSE_HELPER_W(helper_pmulhuw, FMULHUW)
|
---|
440 | SSE_HELPER_W(helper_pmulhw, FMULHW)
|
---|
441 |
|
---|
442 | SSE_HELPER_B(helper_pavgb, FAVG)
|
---|
443 | SSE_HELPER_W(helper_pavgw, FAVG)
|
---|
444 |
|
---|
445 | void glue(helper_pmuludq, SUFFIX) (Reg *d, Reg *s)
|
---|
446 | {
|
---|
447 | d->Q(0) = (uint64_t)s->L(0) * (uint64_t)d->L(0);
|
---|
448 | #if SHIFT == 1
|
---|
449 | d->Q(1) = (uint64_t)s->L(2) * (uint64_t)d->L(2);
|
---|
450 | #endif
|
---|
451 | }
|
---|
452 |
|
---|
453 | void glue(helper_pmaddwd, SUFFIX) (Reg *d, Reg *s)
|
---|
454 | {
|
---|
455 | int i;
|
---|
456 |
|
---|
457 | for(i = 0; i < (2 << SHIFT); i++) {
|
---|
458 | d->L(i) = (int16_t)s->W(2*i) * (int16_t)d->W(2*i) +
|
---|
459 | (int16_t)s->W(2*i+1) * (int16_t)d->W(2*i+1);
|
---|
460 | }
|
---|
461 | }
|
---|
462 |
|
---|
463 | #if SHIFT == 0
|
---|
464 | #ifndef VBOX
|
---|
465 | static inline int abs1(int a)
|
---|
466 | #else /* VBOX */
|
---|
467 | DECLINLINE(int) abs1(int a)
|
---|
468 | #endif /* VBOX */
|
---|
469 | {
|
---|
470 | if (a < 0)
|
---|
471 | return -a;
|
---|
472 | else
|
---|
473 | return a;
|
---|
474 | }
|
---|
475 | #endif
|
---|
476 | void glue(helper_psadbw, SUFFIX) (Reg *d, Reg *s)
|
---|
477 | {
|
---|
478 | unsigned int val;
|
---|
479 |
|
---|
480 | val = 0;
|
---|
481 | val += abs1(d->B(0) - s->B(0));
|
---|
482 | val += abs1(d->B(1) - s->B(1));
|
---|
483 | val += abs1(d->B(2) - s->B(2));
|
---|
484 | val += abs1(d->B(3) - s->B(3));
|
---|
485 | val += abs1(d->B(4) - s->B(4));
|
---|
486 | val += abs1(d->B(5) - s->B(5));
|
---|
487 | val += abs1(d->B(6) - s->B(6));
|
---|
488 | val += abs1(d->B(7) - s->B(7));
|
---|
489 | d->Q(0) = val;
|
---|
490 | #if SHIFT == 1
|
---|
491 | val = 0;
|
---|
492 | val += abs1(d->B(8) - s->B(8));
|
---|
493 | val += abs1(d->B(9) - s->B(9));
|
---|
494 | val += abs1(d->B(10) - s->B(10));
|
---|
495 | val += abs1(d->B(11) - s->B(11));
|
---|
496 | val += abs1(d->B(12) - s->B(12));
|
---|
497 | val += abs1(d->B(13) - s->B(13));
|
---|
498 | val += abs1(d->B(14) - s->B(14));
|
---|
499 | val += abs1(d->B(15) - s->B(15));
|
---|
500 | d->Q(1) = val;
|
---|
501 | #endif
|
---|
502 | }
|
---|
503 |
|
---|
504 | void glue(helper_maskmov, SUFFIX) (Reg *d, Reg *s, target_ulong a0)
|
---|
505 | {
|
---|
506 | int i;
|
---|
507 | for(i = 0; i < (8 << SHIFT); i++) {
|
---|
508 | if (s->B(i) & 0x80)
|
---|
509 | stb(a0 + i, d->B(i));
|
---|
510 | }
|
---|
511 | }
|
---|
512 |
|
---|
513 | void glue(helper_movl_mm_T0, SUFFIX) (Reg *d, uint32_t val)
|
---|
514 | {
|
---|
515 | d->L(0) = val;
|
---|
516 | d->L(1) = 0;
|
---|
517 | #if SHIFT == 1
|
---|
518 | d->Q(1) = 0;
|
---|
519 | #endif
|
---|
520 | }
|
---|
521 |
|
---|
522 | #ifdef TARGET_X86_64
|
---|
523 | void glue(helper_movq_mm_T0, SUFFIX) (Reg *d, uint64_t val)
|
---|
524 | {
|
---|
525 | d->Q(0) = val;
|
---|
526 | #if SHIFT == 1
|
---|
527 | d->Q(1) = 0;
|
---|
528 | #endif
|
---|
529 | }
|
---|
530 | #endif
|
---|
531 |
|
---|
532 | #if SHIFT == 0
|
---|
533 | void glue(helper_pshufw, SUFFIX) (Reg *d, Reg *s, int order)
|
---|
534 | {
|
---|
535 | Reg r;
|
---|
536 | r.W(0) = s->W(order & 3);
|
---|
537 | r.W(1) = s->W((order >> 2) & 3);
|
---|
538 | r.W(2) = s->W((order >> 4) & 3);
|
---|
539 | r.W(3) = s->W((order >> 6) & 3);
|
---|
540 | *d = r;
|
---|
541 | }
|
---|
542 | #else
|
---|
543 | void helper_shufps(Reg *d, Reg *s, int order)
|
---|
544 | {
|
---|
545 | Reg r;
|
---|
546 | r.L(0) = d->L(order & 3);
|
---|
547 | r.L(1) = d->L((order >> 2) & 3);
|
---|
548 | r.L(2) = s->L((order >> 4) & 3);
|
---|
549 | r.L(3) = s->L((order >> 6) & 3);
|
---|
550 | *d = r;
|
---|
551 | }
|
---|
552 |
|
---|
553 | void helper_shufpd(Reg *d, Reg *s, int order)
|
---|
554 | {
|
---|
555 | Reg r;
|
---|
556 | r.Q(0) = d->Q(order & 1);
|
---|
557 | r.Q(1) = s->Q((order >> 1) & 1);
|
---|
558 | *d = r;
|
---|
559 | }
|
---|
560 |
|
---|
561 | void glue(helper_pshufd, SUFFIX) (Reg *d, Reg *s, int order)
|
---|
562 | {
|
---|
563 | Reg r;
|
---|
564 | r.L(0) = s->L(order & 3);
|
---|
565 | r.L(1) = s->L((order >> 2) & 3);
|
---|
566 | r.L(2) = s->L((order >> 4) & 3);
|
---|
567 | r.L(3) = s->L((order >> 6) & 3);
|
---|
568 | *d = r;
|
---|
569 | }
|
---|
570 |
|
---|
571 | void glue(helper_pshuflw, SUFFIX) (Reg *d, Reg *s, int order)
|
---|
572 | {
|
---|
573 | Reg r;
|
---|
574 | r.W(0) = s->W(order & 3);
|
---|
575 | r.W(1) = s->W((order >> 2) & 3);
|
---|
576 | r.W(2) = s->W((order >> 4) & 3);
|
---|
577 | r.W(3) = s->W((order >> 6) & 3);
|
---|
578 | r.Q(1) = s->Q(1);
|
---|
579 | *d = r;
|
---|
580 | }
|
---|
581 |
|
---|
582 | void glue(helper_pshufhw, SUFFIX) (Reg *d, Reg *s, int order)
|
---|
583 | {
|
---|
584 | Reg r;
|
---|
585 | r.Q(0) = s->Q(0);
|
---|
586 | r.W(4) = s->W(4 + (order & 3));
|
---|
587 | r.W(5) = s->W(4 + ((order >> 2) & 3));
|
---|
588 | r.W(6) = s->W(4 + ((order >> 4) & 3));
|
---|
589 | r.W(7) = s->W(4 + ((order >> 6) & 3));
|
---|
590 | *d = r;
|
---|
591 | }
|
---|
592 | #endif
|
---|
593 |
|
---|
594 | #if SHIFT == 1
|
---|
595 | /* FPU ops */
|
---|
596 | /* XXX: not accurate */
|
---|
597 |
|
---|
598 | #define SSE_HELPER_S(name, F)\
|
---|
599 | void helper_ ## name ## ps (Reg *d, Reg *s)\
|
---|
600 | {\
|
---|
601 | d->XMM_S(0) = F(32, d->XMM_S(0), s->XMM_S(0));\
|
---|
602 | d->XMM_S(1) = F(32, d->XMM_S(1), s->XMM_S(1));\
|
---|
603 | d->XMM_S(2) = F(32, d->XMM_S(2), s->XMM_S(2));\
|
---|
604 | d->XMM_S(3) = F(32, d->XMM_S(3), s->XMM_S(3));\
|
---|
605 | }\
|
---|
606 | \
|
---|
607 | void helper_ ## name ## ss (Reg *d, Reg *s)\
|
---|
608 | {\
|
---|
609 | d->XMM_S(0) = F(32, d->XMM_S(0), s->XMM_S(0));\
|
---|
610 | }\
|
---|
611 | void helper_ ## name ## pd (Reg *d, Reg *s)\
|
---|
612 | {\
|
---|
613 | d->XMM_D(0) = F(64, d->XMM_D(0), s->XMM_D(0));\
|
---|
614 | d->XMM_D(1) = F(64, d->XMM_D(1), s->XMM_D(1));\
|
---|
615 | }\
|
---|
616 | \
|
---|
617 | void helper_ ## name ## sd (Reg *d, Reg *s)\
|
---|
618 | {\
|
---|
619 | d->XMM_D(0) = F(64, d->XMM_D(0), s->XMM_D(0));\
|
---|
620 | }
|
---|
621 |
|
---|
622 | #define FPU_ADD(size, a, b) float ## size ## _add(a, b, &env->sse_status)
|
---|
623 | #define FPU_SUB(size, a, b) float ## size ## _sub(a, b, &env->sse_status)
|
---|
624 | #define FPU_MUL(size, a, b) float ## size ## _mul(a, b, &env->sse_status)
|
---|
625 | #define FPU_DIV(size, a, b) float ## size ## _div(a, b, &env->sse_status)
|
---|
626 | #define FPU_MIN(size, a, b) (a) < (b) ? (a) : (b)
|
---|
627 | #define FPU_MAX(size, a, b) (a) > (b) ? (a) : (b)
|
---|
628 | #define FPU_SQRT(size, a, b) float ## size ## _sqrt(b, &env->sse_status)
|
---|
629 |
|
---|
630 | SSE_HELPER_S(add, FPU_ADD)
|
---|
631 | SSE_HELPER_S(sub, FPU_SUB)
|
---|
632 | SSE_HELPER_S(mul, FPU_MUL)
|
---|
633 | SSE_HELPER_S(div, FPU_DIV)
|
---|
634 | SSE_HELPER_S(min, FPU_MIN)
|
---|
635 | SSE_HELPER_S(max, FPU_MAX)
|
---|
636 | SSE_HELPER_S(sqrt, FPU_SQRT)
|
---|
637 |
|
---|
638 |
|
---|
639 | /* float to float conversions */
|
---|
640 | void helper_cvtps2pd(Reg *d, Reg *s)
|
---|
641 | {
|
---|
642 | float32 s0, s1;
|
---|
643 | s0 = s->XMM_S(0);
|
---|
644 | s1 = s->XMM_S(1);
|
---|
645 | d->XMM_D(0) = float32_to_float64(s0, &env->sse_status);
|
---|
646 | d->XMM_D(1) = float32_to_float64(s1, &env->sse_status);
|
---|
647 | }
|
---|
648 |
|
---|
649 | void helper_cvtpd2ps(Reg *d, Reg *s)
|
---|
650 | {
|
---|
651 | d->XMM_S(0) = float64_to_float32(s->XMM_D(0), &env->sse_status);
|
---|
652 | d->XMM_S(1) = float64_to_float32(s->XMM_D(1), &env->sse_status);
|
---|
653 | d->Q(1) = 0;
|
---|
654 | }
|
---|
655 |
|
---|
656 | void helper_cvtss2sd(Reg *d, Reg *s)
|
---|
657 | {
|
---|
658 | d->XMM_D(0) = float32_to_float64(s->XMM_S(0), &env->sse_status);
|
---|
659 | }
|
---|
660 |
|
---|
661 | void helper_cvtsd2ss(Reg *d, Reg *s)
|
---|
662 | {
|
---|
663 | d->XMM_S(0) = float64_to_float32(s->XMM_D(0), &env->sse_status);
|
---|
664 | }
|
---|
665 |
|
---|
666 | /* integer to float */
|
---|
667 | void helper_cvtdq2ps(Reg *d, Reg *s)
|
---|
668 | {
|
---|
669 | d->XMM_S(0) = int32_to_float32(s->XMM_L(0), &env->sse_status);
|
---|
670 | d->XMM_S(1) = int32_to_float32(s->XMM_L(1), &env->sse_status);
|
---|
671 | d->XMM_S(2) = int32_to_float32(s->XMM_L(2), &env->sse_status);
|
---|
672 | d->XMM_S(3) = int32_to_float32(s->XMM_L(3), &env->sse_status);
|
---|
673 | }
|
---|
674 |
|
---|
675 | void helper_cvtdq2pd(Reg *d, Reg *s)
|
---|
676 | {
|
---|
677 | int32_t l0, l1;
|
---|
678 | l0 = (int32_t)s->XMM_L(0);
|
---|
679 | l1 = (int32_t)s->XMM_L(1);
|
---|
680 | d->XMM_D(0) = int32_to_float64(l0, &env->sse_status);
|
---|
681 | d->XMM_D(1) = int32_to_float64(l1, &env->sse_status);
|
---|
682 | }
|
---|
683 |
|
---|
684 | void helper_cvtpi2ps(XMMReg *d, MMXReg *s)
|
---|
685 | {
|
---|
686 | d->XMM_S(0) = int32_to_float32(s->MMX_L(0), &env->sse_status);
|
---|
687 | d->XMM_S(1) = int32_to_float32(s->MMX_L(1), &env->sse_status);
|
---|
688 | }
|
---|
689 |
|
---|
690 | void helper_cvtpi2pd(XMMReg *d, MMXReg *s)
|
---|
691 | {
|
---|
692 | d->XMM_D(0) = int32_to_float64(s->MMX_L(0), &env->sse_status);
|
---|
693 | d->XMM_D(1) = int32_to_float64(s->MMX_L(1), &env->sse_status);
|
---|
694 | }
|
---|
695 |
|
---|
696 | void helper_cvtsi2ss(XMMReg *d, uint32_t val)
|
---|
697 | {
|
---|
698 | d->XMM_S(0) = int32_to_float32(val, &env->sse_status);
|
---|
699 | }
|
---|
700 |
|
---|
701 | void helper_cvtsi2sd(XMMReg *d, uint32_t val)
|
---|
702 | {
|
---|
703 | d->XMM_D(0) = int32_to_float64(val, &env->sse_status);
|
---|
704 | }
|
---|
705 |
|
---|
706 | #ifdef TARGET_X86_64
|
---|
707 | void helper_cvtsq2ss(XMMReg *d, uint64_t val)
|
---|
708 | {
|
---|
709 | d->XMM_S(0) = int64_to_float32(val, &env->sse_status);
|
---|
710 | }
|
---|
711 |
|
---|
712 | void helper_cvtsq2sd(XMMReg *d, uint64_t val)
|
---|
713 | {
|
---|
714 | d->XMM_D(0) = int64_to_float64(val, &env->sse_status);
|
---|
715 | }
|
---|
716 | #endif
|
---|
717 |
|
---|
718 | /* float to integer */
|
---|
719 | void helper_cvtps2dq(XMMReg *d, XMMReg *s)
|
---|
720 | {
|
---|
721 | d->XMM_L(0) = float32_to_int32(s->XMM_S(0), &env->sse_status);
|
---|
722 | d->XMM_L(1) = float32_to_int32(s->XMM_S(1), &env->sse_status);
|
---|
723 | d->XMM_L(2) = float32_to_int32(s->XMM_S(2), &env->sse_status);
|
---|
724 | d->XMM_L(3) = float32_to_int32(s->XMM_S(3), &env->sse_status);
|
---|
725 | }
|
---|
726 |
|
---|
727 | void helper_cvtpd2dq(XMMReg *d, XMMReg *s)
|
---|
728 | {
|
---|
729 | d->XMM_L(0) = float64_to_int32(s->XMM_D(0), &env->sse_status);
|
---|
730 | d->XMM_L(1) = float64_to_int32(s->XMM_D(1), &env->sse_status);
|
---|
731 | d->XMM_Q(1) = 0;
|
---|
732 | }
|
---|
733 |
|
---|
734 | void helper_cvtps2pi(MMXReg *d, XMMReg *s)
|
---|
735 | {
|
---|
736 | d->MMX_L(0) = float32_to_int32(s->XMM_S(0), &env->sse_status);
|
---|
737 | d->MMX_L(1) = float32_to_int32(s->XMM_S(1), &env->sse_status);
|
---|
738 | }
|
---|
739 |
|
---|
740 | void helper_cvtpd2pi(MMXReg *d, XMMReg *s)
|
---|
741 | {
|
---|
742 | d->MMX_L(0) = float64_to_int32(s->XMM_D(0), &env->sse_status);
|
---|
743 | d->MMX_L(1) = float64_to_int32(s->XMM_D(1), &env->sse_status);
|
---|
744 | }
|
---|
745 |
|
---|
746 | int32_t helper_cvtss2si(XMMReg *s)
|
---|
747 | {
|
---|
748 | return float32_to_int32(s->XMM_S(0), &env->sse_status);
|
---|
749 | }
|
---|
750 |
|
---|
751 | int32_t helper_cvtsd2si(XMMReg *s)
|
---|
752 | {
|
---|
753 | return float64_to_int32(s->XMM_D(0), &env->sse_status);
|
---|
754 | }
|
---|
755 |
|
---|
756 | #ifdef TARGET_X86_64
|
---|
757 | int64_t helper_cvtss2sq(XMMReg *s)
|
---|
758 | {
|
---|
759 | return float32_to_int64(s->XMM_S(0), &env->sse_status);
|
---|
760 | }
|
---|
761 |
|
---|
762 | int64_t helper_cvtsd2sq(XMMReg *s)
|
---|
763 | {
|
---|
764 | return float64_to_int64(s->XMM_D(0), &env->sse_status);
|
---|
765 | }
|
---|
766 | #endif
|
---|
767 |
|
---|
768 | /* float to integer truncated */
|
---|
769 | void helper_cvttps2dq(XMMReg *d, XMMReg *s)
|
---|
770 | {
|
---|
771 | d->XMM_L(0) = float32_to_int32_round_to_zero(s->XMM_S(0), &env->sse_status);
|
---|
772 | d->XMM_L(1) = float32_to_int32_round_to_zero(s->XMM_S(1), &env->sse_status);
|
---|
773 | d->XMM_L(2) = float32_to_int32_round_to_zero(s->XMM_S(2), &env->sse_status);
|
---|
774 | d->XMM_L(3) = float32_to_int32_round_to_zero(s->XMM_S(3), &env->sse_status);
|
---|
775 | }
|
---|
776 |
|
---|
777 | void helper_cvttpd2dq(XMMReg *d, XMMReg *s)
|
---|
778 | {
|
---|
779 | d->XMM_L(0) = float64_to_int32_round_to_zero(s->XMM_D(0), &env->sse_status);
|
---|
780 | d->XMM_L(1) = float64_to_int32_round_to_zero(s->XMM_D(1), &env->sse_status);
|
---|
781 | d->XMM_Q(1) = 0;
|
---|
782 | }
|
---|
783 |
|
---|
784 | void helper_cvttps2pi(MMXReg *d, XMMReg *s)
|
---|
785 | {
|
---|
786 | d->MMX_L(0) = float32_to_int32_round_to_zero(s->XMM_S(0), &env->sse_status);
|
---|
787 | d->MMX_L(1) = float32_to_int32_round_to_zero(s->XMM_S(1), &env->sse_status);
|
---|
788 | }
|
---|
789 |
|
---|
790 | void helper_cvttpd2pi(MMXReg *d, XMMReg *s)
|
---|
791 | {
|
---|
792 | d->MMX_L(0) = float64_to_int32_round_to_zero(s->XMM_D(0), &env->sse_status);
|
---|
793 | d->MMX_L(1) = float64_to_int32_round_to_zero(s->XMM_D(1), &env->sse_status);
|
---|
794 | }
|
---|
795 |
|
---|
796 | int32_t helper_cvttss2si(XMMReg *s)
|
---|
797 | {
|
---|
798 | return float32_to_int32_round_to_zero(s->XMM_S(0), &env->sse_status);
|
---|
799 | }
|
---|
800 |
|
---|
801 | int32_t helper_cvttsd2si(XMMReg *s)
|
---|
802 | {
|
---|
803 | return float64_to_int32_round_to_zero(s->XMM_D(0), &env->sse_status);
|
---|
804 | }
|
---|
805 |
|
---|
806 | #ifdef TARGET_X86_64
|
---|
807 | int64_t helper_cvttss2sq(XMMReg *s)
|
---|
808 | {
|
---|
809 | return float32_to_int64_round_to_zero(s->XMM_S(0), &env->sse_status);
|
---|
810 | }
|
---|
811 |
|
---|
812 | int64_t helper_cvttsd2sq(XMMReg *s)
|
---|
813 | {
|
---|
814 | return float64_to_int64_round_to_zero(s->XMM_D(0), &env->sse_status);
|
---|
815 | }
|
---|
816 | #endif
|
---|
817 |
|
---|
818 | void helper_rsqrtps(XMMReg *d, XMMReg *s)
|
---|
819 | {
|
---|
820 | d->XMM_S(0) = approx_rsqrt(s->XMM_S(0));
|
---|
821 | d->XMM_S(1) = approx_rsqrt(s->XMM_S(1));
|
---|
822 | d->XMM_S(2) = approx_rsqrt(s->XMM_S(2));
|
---|
823 | d->XMM_S(3) = approx_rsqrt(s->XMM_S(3));
|
---|
824 | }
|
---|
825 |
|
---|
826 | void helper_rsqrtss(XMMReg *d, XMMReg *s)
|
---|
827 | {
|
---|
828 | d->XMM_S(0) = approx_rsqrt(s->XMM_S(0));
|
---|
829 | }
|
---|
830 |
|
---|
831 | void helper_rcpps(XMMReg *d, XMMReg *s)
|
---|
832 | {
|
---|
833 | d->XMM_S(0) = approx_rcp(s->XMM_S(0));
|
---|
834 | d->XMM_S(1) = approx_rcp(s->XMM_S(1));
|
---|
835 | d->XMM_S(2) = approx_rcp(s->XMM_S(2));
|
---|
836 | d->XMM_S(3) = approx_rcp(s->XMM_S(3));
|
---|
837 | }
|
---|
838 |
|
---|
839 | void helper_rcpss(XMMReg *d, XMMReg *s)
|
---|
840 | {
|
---|
841 | d->XMM_S(0) = approx_rcp(s->XMM_S(0));
|
---|
842 | }
|
---|
843 |
|
---|
844 | void helper_haddps(XMMReg *d, XMMReg *s)
|
---|
845 | {
|
---|
846 | XMMReg r;
|
---|
847 | r.XMM_S(0) = d->XMM_S(0) + d->XMM_S(1);
|
---|
848 | r.XMM_S(1) = d->XMM_S(2) + d->XMM_S(3);
|
---|
849 | r.XMM_S(2) = s->XMM_S(0) + s->XMM_S(1);
|
---|
850 | r.XMM_S(3) = s->XMM_S(2) + s->XMM_S(3);
|
---|
851 | *d = r;
|
---|
852 | }
|
---|
853 |
|
---|
854 | void helper_haddpd(XMMReg *d, XMMReg *s)
|
---|
855 | {
|
---|
856 | XMMReg r;
|
---|
857 | r.XMM_D(0) = d->XMM_D(0) + d->XMM_D(1);
|
---|
858 | r.XMM_D(1) = s->XMM_D(0) + s->XMM_D(1);
|
---|
859 | *d = r;
|
---|
860 | }
|
---|
861 |
|
---|
862 | void helper_hsubps(XMMReg *d, XMMReg *s)
|
---|
863 | {
|
---|
864 | XMMReg r;
|
---|
865 | r.XMM_S(0) = d->XMM_S(0) - d->XMM_S(1);
|
---|
866 | r.XMM_S(1) = d->XMM_S(2) - d->XMM_S(3);
|
---|
867 | r.XMM_S(2) = s->XMM_S(0) - s->XMM_S(1);
|
---|
868 | r.XMM_S(3) = s->XMM_S(2) - s->XMM_S(3);
|
---|
869 | *d = r;
|
---|
870 | }
|
---|
871 |
|
---|
872 | void helper_hsubpd(XMMReg *d, XMMReg *s)
|
---|
873 | {
|
---|
874 | XMMReg r;
|
---|
875 | r.XMM_D(0) = d->XMM_D(0) - d->XMM_D(1);
|
---|
876 | r.XMM_D(1) = s->XMM_D(0) - s->XMM_D(1);
|
---|
877 | *d = r;
|
---|
878 | }
|
---|
879 |
|
---|
880 | void helper_addsubps(XMMReg *d, XMMReg *s)
|
---|
881 | {
|
---|
882 | d->XMM_S(0) = d->XMM_S(0) - s->XMM_S(0);
|
---|
883 | d->XMM_S(1) = d->XMM_S(1) + s->XMM_S(1);
|
---|
884 | d->XMM_S(2) = d->XMM_S(2) - s->XMM_S(2);
|
---|
885 | d->XMM_S(3) = d->XMM_S(3) + s->XMM_S(3);
|
---|
886 | }
|
---|
887 |
|
---|
888 | void helper_addsubpd(XMMReg *d, XMMReg *s)
|
---|
889 | {
|
---|
890 | d->XMM_D(0) = d->XMM_D(0) - s->XMM_D(0);
|
---|
891 | d->XMM_D(1) = d->XMM_D(1) + s->XMM_D(1);
|
---|
892 | }
|
---|
893 |
|
---|
894 | /* XXX: unordered */
|
---|
895 | #define SSE_HELPER_CMP(name, F)\
|
---|
896 | void helper_ ## name ## ps (Reg *d, Reg *s)\
|
---|
897 | {\
|
---|
898 | d->XMM_L(0) = F(32, d->XMM_S(0), s->XMM_S(0));\
|
---|
899 | d->XMM_L(1) = F(32, d->XMM_S(1), s->XMM_S(1));\
|
---|
900 | d->XMM_L(2) = F(32, d->XMM_S(2), s->XMM_S(2));\
|
---|
901 | d->XMM_L(3) = F(32, d->XMM_S(3), s->XMM_S(3));\
|
---|
902 | }\
|
---|
903 | \
|
---|
904 | void helper_ ## name ## ss (Reg *d, Reg *s)\
|
---|
905 | {\
|
---|
906 | d->XMM_L(0) = F(32, d->XMM_S(0), s->XMM_S(0));\
|
---|
907 | }\
|
---|
908 | void helper_ ## name ## pd (Reg *d, Reg *s)\
|
---|
909 | {\
|
---|
910 | d->XMM_Q(0) = F(64, d->XMM_D(0), s->XMM_D(0));\
|
---|
911 | d->XMM_Q(1) = F(64, d->XMM_D(1), s->XMM_D(1));\
|
---|
912 | }\
|
---|
913 | \
|
---|
914 | void helper_ ## name ## sd (Reg *d, Reg *s)\
|
---|
915 | {\
|
---|
916 | d->XMM_Q(0) = F(64, d->XMM_D(0), s->XMM_D(0));\
|
---|
917 | }
|
---|
918 |
|
---|
919 | #define FPU_CMPEQ(size, a, b) float ## size ## _eq(a, b, &env->sse_status) ? -1 : 0
|
---|
920 | #define FPU_CMPLT(size, a, b) float ## size ## _lt(a, b, &env->sse_status) ? -1 : 0
|
---|
921 | #define FPU_CMPLE(size, a, b) float ## size ## _le(a, b, &env->sse_status) ? -1 : 0
|
---|
922 | #define FPU_CMPUNORD(size, a, b) float ## size ## _unordered(a, b, &env->sse_status) ? - 1 : 0
|
---|
923 | #define FPU_CMPNEQ(size, a, b) float ## size ## _eq(a, b, &env->sse_status) ? 0 : -1
|
---|
924 | #define FPU_CMPNLT(size, a, b) float ## size ## _lt(a, b, &env->sse_status) ? 0 : -1
|
---|
925 | #define FPU_CMPNLE(size, a, b) float ## size ## _le(a, b, &env->sse_status) ? 0 : -1
|
---|
926 | #define FPU_CMPORD(size, a, b) float ## size ## _unordered(a, b, &env->sse_status) ? 0 : -1
|
---|
927 |
|
---|
928 | SSE_HELPER_CMP(cmpeq, FPU_CMPEQ)
|
---|
929 | SSE_HELPER_CMP(cmplt, FPU_CMPLT)
|
---|
930 | SSE_HELPER_CMP(cmple, FPU_CMPLE)
|
---|
931 | SSE_HELPER_CMP(cmpunord, FPU_CMPUNORD)
|
---|
932 | SSE_HELPER_CMP(cmpneq, FPU_CMPNEQ)
|
---|
933 | SSE_HELPER_CMP(cmpnlt, FPU_CMPNLT)
|
---|
934 | SSE_HELPER_CMP(cmpnle, FPU_CMPNLE)
|
---|
935 | SSE_HELPER_CMP(cmpord, FPU_CMPORD)
|
---|
936 |
|
---|
937 | const int comis_eflags[4] = {CC_C, CC_Z, 0, CC_Z | CC_P | CC_C};
|
---|
938 |
|
---|
939 | void helper_ucomiss(Reg *d, Reg *s)
|
---|
940 | {
|
---|
941 | int ret;
|
---|
942 | float32 s0, s1;
|
---|
943 |
|
---|
944 | s0 = d->XMM_S(0);
|
---|
945 | s1 = s->XMM_S(0);
|
---|
946 | ret = float32_compare_quiet(s0, s1, &env->sse_status);
|
---|
947 | CC_SRC = comis_eflags[ret + 1];
|
---|
948 | }
|
---|
949 |
|
---|
950 | void helper_comiss(Reg *d, Reg *s)
|
---|
951 | {
|
---|
952 | int ret;
|
---|
953 | float32 s0, s1;
|
---|
954 |
|
---|
955 | s0 = d->XMM_S(0);
|
---|
956 | s1 = s->XMM_S(0);
|
---|
957 | ret = float32_compare(s0, s1, &env->sse_status);
|
---|
958 | CC_SRC = comis_eflags[ret + 1];
|
---|
959 | }
|
---|
960 |
|
---|
961 | void helper_ucomisd(Reg *d, Reg *s)
|
---|
962 | {
|
---|
963 | int ret;
|
---|
964 | float64 d0, d1;
|
---|
965 |
|
---|
966 | d0 = d->XMM_D(0);
|
---|
967 | d1 = s->XMM_D(0);
|
---|
968 | ret = float64_compare_quiet(d0, d1, &env->sse_status);
|
---|
969 | CC_SRC = comis_eflags[ret + 1];
|
---|
970 | }
|
---|
971 |
|
---|
972 | void helper_comisd(Reg *d, Reg *s)
|
---|
973 | {
|
---|
974 | int ret;
|
---|
975 | float64 d0, d1;
|
---|
976 |
|
---|
977 | d0 = d->XMM_D(0);
|
---|
978 | d1 = s->XMM_D(0);
|
---|
979 | ret = float64_compare(d0, d1, &env->sse_status);
|
---|
980 | CC_SRC = comis_eflags[ret + 1];
|
---|
981 | }
|
---|
982 |
|
---|
983 | uint32_t helper_movmskps(Reg *s)
|
---|
984 | {
|
---|
985 | int b0, b1, b2, b3;
|
---|
986 | b0 = s->XMM_L(0) >> 31;
|
---|
987 | b1 = s->XMM_L(1) >> 31;
|
---|
988 | b2 = s->XMM_L(2) >> 31;
|
---|
989 | b3 = s->XMM_L(3) >> 31;
|
---|
990 | return b0 | (b1 << 1) | (b2 << 2) | (b3 << 3);
|
---|
991 | }
|
---|
992 |
|
---|
993 | uint32_t helper_movmskpd(Reg *s)
|
---|
994 | {
|
---|
995 | int b0, b1;
|
---|
996 | b0 = s->XMM_L(1) >> 31;
|
---|
997 | b1 = s->XMM_L(3) >> 31;
|
---|
998 | return b0 | (b1 << 1);
|
---|
999 | }
|
---|
1000 |
|
---|
1001 | #endif
|
---|
1002 |
|
---|
1003 | uint32_t glue(helper_pmovmskb, SUFFIX)(Reg *s)
|
---|
1004 | {
|
---|
1005 | uint32_t val;
|
---|
1006 | val = 0;
|
---|
1007 | val |= (s->XMM_B(0) >> 7);
|
---|
1008 | val |= (s->XMM_B(1) >> 6) & 0x02;
|
---|
1009 | val |= (s->XMM_B(2) >> 5) & 0x04;
|
---|
1010 | val |= (s->XMM_B(3) >> 4) & 0x08;
|
---|
1011 | val |= (s->XMM_B(4) >> 3) & 0x10;
|
---|
1012 | val |= (s->XMM_B(5) >> 2) & 0x20;
|
---|
1013 | val |= (s->XMM_B(6) >> 1) & 0x40;
|
---|
1014 | val |= (s->XMM_B(7)) & 0x80;
|
---|
1015 | #if SHIFT == 1
|
---|
1016 | val |= (s->XMM_B(8) << 1) & 0x0100;
|
---|
1017 | val |= (s->XMM_B(9) << 2) & 0x0200;
|
---|
1018 | val |= (s->XMM_B(10) << 3) & 0x0400;
|
---|
1019 | val |= (s->XMM_B(11) << 4) & 0x0800;
|
---|
1020 | val |= (s->XMM_B(12) << 5) & 0x1000;
|
---|
1021 | val |= (s->XMM_B(13) << 6) & 0x2000;
|
---|
1022 | val |= (s->XMM_B(14) << 7) & 0x4000;
|
---|
1023 | val |= (s->XMM_B(15) << 8) & 0x8000;
|
---|
1024 | #endif
|
---|
1025 | return val;
|
---|
1026 | }
|
---|
1027 |
|
---|
1028 | void glue(helper_packsswb, SUFFIX) (Reg *d, Reg *s)
|
---|
1029 | {
|
---|
1030 | Reg r;
|
---|
1031 |
|
---|
1032 | r.B(0) = satsb((int16_t)d->W(0));
|
---|
1033 | r.B(1) = satsb((int16_t)d->W(1));
|
---|
1034 | r.B(2) = satsb((int16_t)d->W(2));
|
---|
1035 | r.B(3) = satsb((int16_t)d->W(3));
|
---|
1036 | #if SHIFT == 1
|
---|
1037 | r.B(4) = satsb((int16_t)d->W(4));
|
---|
1038 | r.B(5) = satsb((int16_t)d->W(5));
|
---|
1039 | r.B(6) = satsb((int16_t)d->W(6));
|
---|
1040 | r.B(7) = satsb((int16_t)d->W(7));
|
---|
1041 | #endif
|
---|
1042 | r.B((4 << SHIFT) + 0) = satsb((int16_t)s->W(0));
|
---|
1043 | r.B((4 << SHIFT) + 1) = satsb((int16_t)s->W(1));
|
---|
1044 | r.B((4 << SHIFT) + 2) = satsb((int16_t)s->W(2));
|
---|
1045 | r.B((4 << SHIFT) + 3) = satsb((int16_t)s->W(3));
|
---|
1046 | #if SHIFT == 1
|
---|
1047 | r.B(12) = satsb((int16_t)s->W(4));
|
---|
1048 | r.B(13) = satsb((int16_t)s->W(5));
|
---|
1049 | r.B(14) = satsb((int16_t)s->W(6));
|
---|
1050 | r.B(15) = satsb((int16_t)s->W(7));
|
---|
1051 | #endif
|
---|
1052 | *d = r;
|
---|
1053 | }
|
---|
1054 |
|
---|
1055 | void glue(helper_packuswb, SUFFIX) (Reg *d, Reg *s)
|
---|
1056 | {
|
---|
1057 | Reg r;
|
---|
1058 |
|
---|
1059 | r.B(0) = satub((int16_t)d->W(0));
|
---|
1060 | r.B(1) = satub((int16_t)d->W(1));
|
---|
1061 | r.B(2) = satub((int16_t)d->W(2));
|
---|
1062 | r.B(3) = satub((int16_t)d->W(3));
|
---|
1063 | #if SHIFT == 1
|
---|
1064 | r.B(4) = satub((int16_t)d->W(4));
|
---|
1065 | r.B(5) = satub((int16_t)d->W(5));
|
---|
1066 | r.B(6) = satub((int16_t)d->W(6));
|
---|
1067 | r.B(7) = satub((int16_t)d->W(7));
|
---|
1068 | #endif
|
---|
1069 | r.B((4 << SHIFT) + 0) = satub((int16_t)s->W(0));
|
---|
1070 | r.B((4 << SHIFT) + 1) = satub((int16_t)s->W(1));
|
---|
1071 | r.B((4 << SHIFT) + 2) = satub((int16_t)s->W(2));
|
---|
1072 | r.B((4 << SHIFT) + 3) = satub((int16_t)s->W(3));
|
---|
1073 | #if SHIFT == 1
|
---|
1074 | r.B(12) = satub((int16_t)s->W(4));
|
---|
1075 | r.B(13) = satub((int16_t)s->W(5));
|
---|
1076 | r.B(14) = satub((int16_t)s->W(6));
|
---|
1077 | r.B(15) = satub((int16_t)s->W(7));
|
---|
1078 | #endif
|
---|
1079 | *d = r;
|
---|
1080 | }
|
---|
1081 |
|
---|
1082 | void glue(helper_packssdw, SUFFIX) (Reg *d, Reg *s)
|
---|
1083 | {
|
---|
1084 | Reg r;
|
---|
1085 |
|
---|
1086 | r.W(0) = satsw(d->L(0));
|
---|
1087 | r.W(1) = satsw(d->L(1));
|
---|
1088 | #if SHIFT == 1
|
---|
1089 | r.W(2) = satsw(d->L(2));
|
---|
1090 | r.W(3) = satsw(d->L(3));
|
---|
1091 | #endif
|
---|
1092 | r.W((2 << SHIFT) + 0) = satsw(s->L(0));
|
---|
1093 | r.W((2 << SHIFT) + 1) = satsw(s->L(1));
|
---|
1094 | #if SHIFT == 1
|
---|
1095 | r.W(6) = satsw(s->L(2));
|
---|
1096 | r.W(7) = satsw(s->L(3));
|
---|
1097 | #endif
|
---|
1098 | *d = r;
|
---|
1099 | }
|
---|
1100 |
|
---|
1101 | #define UNPCK_OP(base_name, base) \
|
---|
1102 | \
|
---|
1103 | void glue(helper_punpck ## base_name ## bw, SUFFIX) (Reg *d, Reg *s) \
|
---|
1104 | { \
|
---|
1105 | Reg r; \
|
---|
1106 | \
|
---|
1107 | r.B(0) = d->B((base << (SHIFT + 2)) + 0); \
|
---|
1108 | r.B(1) = s->B((base << (SHIFT + 2)) + 0); \
|
---|
1109 | r.B(2) = d->B((base << (SHIFT + 2)) + 1); \
|
---|
1110 | r.B(3) = s->B((base << (SHIFT + 2)) + 1); \
|
---|
1111 | r.B(4) = d->B((base << (SHIFT + 2)) + 2); \
|
---|
1112 | r.B(5) = s->B((base << (SHIFT + 2)) + 2); \
|
---|
1113 | r.B(6) = d->B((base << (SHIFT + 2)) + 3); \
|
---|
1114 | r.B(7) = s->B((base << (SHIFT + 2)) + 3); \
|
---|
1115 | XMM_ONLY( \
|
---|
1116 | r.B(8) = d->B((base << (SHIFT + 2)) + 4); \
|
---|
1117 | r.B(9) = s->B((base << (SHIFT + 2)) + 4); \
|
---|
1118 | r.B(10) = d->B((base << (SHIFT + 2)) + 5); \
|
---|
1119 | r.B(11) = s->B((base << (SHIFT + 2)) + 5); \
|
---|
1120 | r.B(12) = d->B((base << (SHIFT + 2)) + 6); \
|
---|
1121 | r.B(13) = s->B((base << (SHIFT + 2)) + 6); \
|
---|
1122 | r.B(14) = d->B((base << (SHIFT + 2)) + 7); \
|
---|
1123 | r.B(15) = s->B((base << (SHIFT + 2)) + 7); \
|
---|
1124 | ) \
|
---|
1125 | *d = r; \
|
---|
1126 | } \
|
---|
1127 | \
|
---|
1128 | void glue(helper_punpck ## base_name ## wd, SUFFIX) (Reg *d, Reg *s) \
|
---|
1129 | { \
|
---|
1130 | Reg r; \
|
---|
1131 | \
|
---|
1132 | r.W(0) = d->W((base << (SHIFT + 1)) + 0); \
|
---|
1133 | r.W(1) = s->W((base << (SHIFT + 1)) + 0); \
|
---|
1134 | r.W(2) = d->W((base << (SHIFT + 1)) + 1); \
|
---|
1135 | r.W(3) = s->W((base << (SHIFT + 1)) + 1); \
|
---|
1136 | XMM_ONLY( \
|
---|
1137 | r.W(4) = d->W((base << (SHIFT + 1)) + 2); \
|
---|
1138 | r.W(5) = s->W((base << (SHIFT + 1)) + 2); \
|
---|
1139 | r.W(6) = d->W((base << (SHIFT + 1)) + 3); \
|
---|
1140 | r.W(7) = s->W((base << (SHIFT + 1)) + 3); \
|
---|
1141 | ) \
|
---|
1142 | *d = r; \
|
---|
1143 | } \
|
---|
1144 | \
|
---|
1145 | void glue(helper_punpck ## base_name ## dq, SUFFIX) (Reg *d, Reg *s) \
|
---|
1146 | { \
|
---|
1147 | Reg r; \
|
---|
1148 | \
|
---|
1149 | r.L(0) = d->L((base << SHIFT) + 0); \
|
---|
1150 | r.L(1) = s->L((base << SHIFT) + 0); \
|
---|
1151 | XMM_ONLY( \
|
---|
1152 | r.L(2) = d->L((base << SHIFT) + 1); \
|
---|
1153 | r.L(3) = s->L((base << SHIFT) + 1); \
|
---|
1154 | ) \
|
---|
1155 | *d = r; \
|
---|
1156 | } \
|
---|
1157 | \
|
---|
1158 | XMM_ONLY( \
|
---|
1159 | void glue(helper_punpck ## base_name ## qdq, SUFFIX) (Reg *d, Reg *s) \
|
---|
1160 | { \
|
---|
1161 | Reg r; \
|
---|
1162 | \
|
---|
1163 | r.Q(0) = d->Q(base); \
|
---|
1164 | r.Q(1) = s->Q(base); \
|
---|
1165 | *d = r; \
|
---|
1166 | } \
|
---|
1167 | )
|
---|
1168 |
|
---|
1169 | UNPCK_OP(l, 0)
|
---|
1170 | UNPCK_OP(h, 1)
|
---|
1171 |
|
---|
1172 | /* 3DNow! float ops */
|
---|
1173 | #if SHIFT == 0
|
---|
1174 | void helper_pi2fd(MMXReg *d, MMXReg *s)
|
---|
1175 | {
|
---|
1176 | d->MMX_S(0) = int32_to_float32(s->MMX_L(0), &env->mmx_status);
|
---|
1177 | d->MMX_S(1) = int32_to_float32(s->MMX_L(1), &env->mmx_status);
|
---|
1178 | }
|
---|
1179 |
|
---|
1180 | void helper_pi2fw(MMXReg *d, MMXReg *s)
|
---|
1181 | {
|
---|
1182 | d->MMX_S(0) = int32_to_float32((int16_t)s->MMX_W(0), &env->mmx_status);
|
---|
1183 | d->MMX_S(1) = int32_to_float32((int16_t)s->MMX_W(2), &env->mmx_status);
|
---|
1184 | }
|
---|
1185 |
|
---|
1186 | void helper_pf2id(MMXReg *d, MMXReg *s)
|
---|
1187 | {
|
---|
1188 | d->MMX_L(0) = float32_to_int32_round_to_zero(s->MMX_S(0), &env->mmx_status);
|
---|
1189 | d->MMX_L(1) = float32_to_int32_round_to_zero(s->MMX_S(1), &env->mmx_status);
|
---|
1190 | }
|
---|
1191 |
|
---|
1192 | void helper_pf2iw(MMXReg *d, MMXReg *s)
|
---|
1193 | {
|
---|
1194 | d->MMX_L(0) = satsw(float32_to_int32_round_to_zero(s->MMX_S(0), &env->mmx_status));
|
---|
1195 | d->MMX_L(1) = satsw(float32_to_int32_round_to_zero(s->MMX_S(1), &env->mmx_status));
|
---|
1196 | }
|
---|
1197 |
|
---|
1198 | void helper_pfacc(MMXReg *d, MMXReg *s)
|
---|
1199 | {
|
---|
1200 | MMXReg r;
|
---|
1201 | r.MMX_S(0) = float32_add(d->MMX_S(0), d->MMX_S(1), &env->mmx_status);
|
---|
1202 | r.MMX_S(1) = float32_add(s->MMX_S(0), s->MMX_S(1), &env->mmx_status);
|
---|
1203 | *d = r;
|
---|
1204 | }
|
---|
1205 |
|
---|
1206 | void helper_pfadd(MMXReg *d, MMXReg *s)
|
---|
1207 | {
|
---|
1208 | d->MMX_S(0) = float32_add(d->MMX_S(0), s->MMX_S(0), &env->mmx_status);
|
---|
1209 | d->MMX_S(1) = float32_add(d->MMX_S(1), s->MMX_S(1), &env->mmx_status);
|
---|
1210 | }
|
---|
1211 |
|
---|
1212 | void helper_pfcmpeq(MMXReg *d, MMXReg *s)
|
---|
1213 | {
|
---|
1214 | d->MMX_L(0) = float32_eq(d->MMX_S(0), s->MMX_S(0), &env->mmx_status) ? -1 : 0;
|
---|
1215 | d->MMX_L(1) = float32_eq(d->MMX_S(1), s->MMX_S(1), &env->mmx_status) ? -1 : 0;
|
---|
1216 | }
|
---|
1217 |
|
---|
1218 | void helper_pfcmpge(MMXReg *d, MMXReg *s)
|
---|
1219 | {
|
---|
1220 | d->MMX_L(0) = float32_le(s->MMX_S(0), d->MMX_S(0), &env->mmx_status) ? -1 : 0;
|
---|
1221 | d->MMX_L(1) = float32_le(s->MMX_S(1), d->MMX_S(1), &env->mmx_status) ? -1 : 0;
|
---|
1222 | }
|
---|
1223 |
|
---|
1224 | void helper_pfcmpgt(MMXReg *d, MMXReg *s)
|
---|
1225 | {
|
---|
1226 | d->MMX_L(0) = float32_lt(s->MMX_S(0), d->MMX_S(0), &env->mmx_status) ? -1 : 0;
|
---|
1227 | d->MMX_L(1) = float32_lt(s->MMX_S(1), d->MMX_S(1), &env->mmx_status) ? -1 : 0;
|
---|
1228 | }
|
---|
1229 |
|
---|
1230 | void helper_pfmax(MMXReg *d, MMXReg *s)
|
---|
1231 | {
|
---|
1232 | if (float32_lt(d->MMX_S(0), s->MMX_S(0), &env->mmx_status))
|
---|
1233 | d->MMX_S(0) = s->MMX_S(0);
|
---|
1234 | if (float32_lt(d->MMX_S(1), s->MMX_S(1), &env->mmx_status))
|
---|
1235 | d->MMX_S(1) = s->MMX_S(1);
|
---|
1236 | }
|
---|
1237 |
|
---|
1238 | void helper_pfmin(MMXReg *d, MMXReg *s)
|
---|
1239 | {
|
---|
1240 | if (float32_lt(s->MMX_S(0), d->MMX_S(0), &env->mmx_status))
|
---|
1241 | d->MMX_S(0) = s->MMX_S(0);
|
---|
1242 | if (float32_lt(s->MMX_S(1), d->MMX_S(1), &env->mmx_status))
|
---|
1243 | d->MMX_S(1) = s->MMX_S(1);
|
---|
1244 | }
|
---|
1245 |
|
---|
1246 | void helper_pfmul(MMXReg *d, MMXReg *s)
|
---|
1247 | {
|
---|
1248 | d->MMX_S(0) = float32_mul(d->MMX_S(0), s->MMX_S(0), &env->mmx_status);
|
---|
1249 | d->MMX_S(1) = float32_mul(d->MMX_S(1), s->MMX_S(1), &env->mmx_status);
|
---|
1250 | }
|
---|
1251 |
|
---|
1252 | void helper_pfnacc(MMXReg *d, MMXReg *s)
|
---|
1253 | {
|
---|
1254 | MMXReg r;
|
---|
1255 | r.MMX_S(0) = float32_sub(d->MMX_S(0), d->MMX_S(1), &env->mmx_status);
|
---|
1256 | r.MMX_S(1) = float32_sub(s->MMX_S(0), s->MMX_S(1), &env->mmx_status);
|
---|
1257 | *d = r;
|
---|
1258 | }
|
---|
1259 |
|
---|
1260 | void helper_pfpnacc(MMXReg *d, MMXReg *s)
|
---|
1261 | {
|
---|
1262 | MMXReg r;
|
---|
1263 | r.MMX_S(0) = float32_sub(d->MMX_S(0), d->MMX_S(1), &env->mmx_status);
|
---|
1264 | r.MMX_S(1) = float32_add(s->MMX_S(0), s->MMX_S(1), &env->mmx_status);
|
---|
1265 | *d = r;
|
---|
1266 | }
|
---|
1267 |
|
---|
1268 | void helper_pfrcp(MMXReg *d, MMXReg *s)
|
---|
1269 | {
|
---|
1270 | d->MMX_S(0) = approx_rcp(s->MMX_S(0));
|
---|
1271 | d->MMX_S(1) = d->MMX_S(0);
|
---|
1272 | }
|
---|
1273 |
|
---|
1274 | void helper_pfrsqrt(MMXReg *d, MMXReg *s)
|
---|
1275 | {
|
---|
1276 | d->MMX_L(1) = s->MMX_L(0) & 0x7fffffff;
|
---|
1277 | d->MMX_S(1) = approx_rsqrt(d->MMX_S(1));
|
---|
1278 | d->MMX_L(1) |= s->MMX_L(0) & 0x80000000;
|
---|
1279 | d->MMX_L(0) = d->MMX_L(1);
|
---|
1280 | }
|
---|
1281 |
|
---|
1282 | void helper_pfsub(MMXReg *d, MMXReg *s)
|
---|
1283 | {
|
---|
1284 | d->MMX_S(0) = float32_sub(d->MMX_S(0), s->MMX_S(0), &env->mmx_status);
|
---|
1285 | d->MMX_S(1) = float32_sub(d->MMX_S(1), s->MMX_S(1), &env->mmx_status);
|
---|
1286 | }
|
---|
1287 |
|
---|
1288 | void helper_pfsubr(MMXReg *d, MMXReg *s)
|
---|
1289 | {
|
---|
1290 | d->MMX_S(0) = float32_sub(s->MMX_S(0), d->MMX_S(0), &env->mmx_status);
|
---|
1291 | d->MMX_S(1) = float32_sub(s->MMX_S(1), d->MMX_S(1), &env->mmx_status);
|
---|
1292 | }
|
---|
1293 |
|
---|
1294 | void helper_pswapd(MMXReg *d, MMXReg *s)
|
---|
1295 | {
|
---|
1296 | MMXReg r;
|
---|
1297 | r.MMX_L(0) = s->MMX_L(1);
|
---|
1298 | r.MMX_L(1) = s->MMX_L(0);
|
---|
1299 | *d = r;
|
---|
1300 | }
|
---|
1301 | #endif
|
---|
1302 |
|
---|
1303 | /* SSSE3 op helpers */
|
---|
1304 | void glue(helper_pshufb, SUFFIX) (Reg *d, Reg *s)
|
---|
1305 | {
|
---|
1306 | int i;
|
---|
1307 | Reg r;
|
---|
1308 |
|
---|
1309 | for (i = 0; i < (8 << SHIFT); i++)
|
---|
1310 | r.B(i) = (s->B(i) & 0x80) ? 0 : (d->B(s->B(i) & ((8 << SHIFT) - 1)));
|
---|
1311 |
|
---|
1312 | *d = r;
|
---|
1313 | }
|
---|
1314 |
|
---|
1315 | void glue(helper_phaddw, SUFFIX) (Reg *d, Reg *s)
|
---|
1316 | {
|
---|
1317 | d->W(0) = (int16_t)d->W(0) + (int16_t)d->W(1);
|
---|
1318 | d->W(1) = (int16_t)d->W(2) + (int16_t)d->W(3);
|
---|
1319 | XMM_ONLY(d->W(2) = (int16_t)d->W(4) + (int16_t)d->W(5));
|
---|
1320 | XMM_ONLY(d->W(3) = (int16_t)d->W(6) + (int16_t)d->W(7));
|
---|
1321 | d->W((2 << SHIFT) + 0) = (int16_t)s->W(0) + (int16_t)s->W(1);
|
---|
1322 | d->W((2 << SHIFT) + 1) = (int16_t)s->W(2) + (int16_t)s->W(3);
|
---|
1323 | XMM_ONLY(d->W(6) = (int16_t)s->W(4) + (int16_t)s->W(5));
|
---|
1324 | XMM_ONLY(d->W(7) = (int16_t)s->W(6) + (int16_t)s->W(7));
|
---|
1325 | }
|
---|
1326 |
|
---|
1327 | void glue(helper_phaddd, SUFFIX) (Reg *d, Reg *s)
|
---|
1328 | {
|
---|
1329 | d->L(0) = (int32_t)d->L(0) + (int32_t)d->L(1);
|
---|
1330 | XMM_ONLY(d->L(1) = (int32_t)d->L(2) + (int32_t)d->L(3));
|
---|
1331 | d->L((1 << SHIFT) + 0) = (int32_t)s->L(0) + (int32_t)s->L(1);
|
---|
1332 | XMM_ONLY(d->L(3) = (int32_t)s->L(2) + (int32_t)s->L(3));
|
---|
1333 | }
|
---|
1334 |
|
---|
1335 | void glue(helper_phaddsw, SUFFIX) (Reg *d, Reg *s)
|
---|
1336 | {
|
---|
1337 | d->W(0) = satsw((int16_t)d->W(0) + (int16_t)d->W(1));
|
---|
1338 | d->W(1) = satsw((int16_t)d->W(2) + (int16_t)d->W(3));
|
---|
1339 | XMM_ONLY(d->W(2) = satsw((int16_t)d->W(4) + (int16_t)d->W(5)));
|
---|
1340 | XMM_ONLY(d->W(3) = satsw((int16_t)d->W(6) + (int16_t)d->W(7)));
|
---|
1341 | d->W((2 << SHIFT) + 0) = satsw((int16_t)s->W(0) + (int16_t)s->W(1));
|
---|
1342 | d->W((2 << SHIFT) + 1) = satsw((int16_t)s->W(2) + (int16_t)s->W(3));
|
---|
1343 | XMM_ONLY(d->W(6) = satsw((int16_t)s->W(4) + (int16_t)s->W(5)));
|
---|
1344 | XMM_ONLY(d->W(7) = satsw((int16_t)s->W(6) + (int16_t)s->W(7)));
|
---|
1345 | }
|
---|
1346 |
|
---|
1347 | void glue(helper_pmaddubsw, SUFFIX) (Reg *d, Reg *s)
|
---|
1348 | {
|
---|
1349 | d->W(0) = satsw((int8_t)s->B( 0) * (uint8_t)d->B( 0) +
|
---|
1350 | (int8_t)s->B( 1) * (uint8_t)d->B( 1));
|
---|
1351 | d->W(1) = satsw((int8_t)s->B( 2) * (uint8_t)d->B( 2) +
|
---|
1352 | (int8_t)s->B( 3) * (uint8_t)d->B( 3));
|
---|
1353 | d->W(2) = satsw((int8_t)s->B( 4) * (uint8_t)d->B( 4) +
|
---|
1354 | (int8_t)s->B( 5) * (uint8_t)d->B( 5));
|
---|
1355 | d->W(3) = satsw((int8_t)s->B( 6) * (uint8_t)d->B( 6) +
|
---|
1356 | (int8_t)s->B( 7) * (uint8_t)d->B( 7));
|
---|
1357 | #if SHIFT == 1
|
---|
1358 | d->W(4) = satsw((int8_t)s->B( 8) * (uint8_t)d->B( 8) +
|
---|
1359 | (int8_t)s->B( 9) * (uint8_t)d->B( 9));
|
---|
1360 | d->W(5) = satsw((int8_t)s->B(10) * (uint8_t)d->B(10) +
|
---|
1361 | (int8_t)s->B(11) * (uint8_t)d->B(11));
|
---|
1362 | d->W(6) = satsw((int8_t)s->B(12) * (uint8_t)d->B(12) +
|
---|
1363 | (int8_t)s->B(13) * (uint8_t)d->B(13));
|
---|
1364 | d->W(7) = satsw((int8_t)s->B(14) * (uint8_t)d->B(14) +
|
---|
1365 | (int8_t)s->B(15) * (uint8_t)d->B(15));
|
---|
1366 | #endif
|
---|
1367 | }
|
---|
1368 |
|
---|
1369 | void glue(helper_phsubw, SUFFIX) (Reg *d, Reg *s)
|
---|
1370 | {
|
---|
1371 | d->W(0) = (int16_t)d->W(0) - (int16_t)d->W(1);
|
---|
1372 | d->W(1) = (int16_t)d->W(2) - (int16_t)d->W(3);
|
---|
1373 | XMM_ONLY(d->W(2) = (int16_t)d->W(4) - (int16_t)d->W(5));
|
---|
1374 | XMM_ONLY(d->W(3) = (int16_t)d->W(6) - (int16_t)d->W(7));
|
---|
1375 | d->W((2 << SHIFT) + 0) = (int16_t)s->W(0) - (int16_t)s->W(1);
|
---|
1376 | d->W((2 << SHIFT) + 1) = (int16_t)s->W(2) - (int16_t)s->W(3);
|
---|
1377 | XMM_ONLY(d->W(6) = (int16_t)s->W(4) - (int16_t)s->W(5));
|
---|
1378 | XMM_ONLY(d->W(7) = (int16_t)s->W(6) - (int16_t)s->W(7));
|
---|
1379 | }
|
---|
1380 |
|
---|
1381 | void glue(helper_phsubd, SUFFIX) (Reg *d, Reg *s)
|
---|
1382 | {
|
---|
1383 | d->L(0) = (int32_t)d->L(0) - (int32_t)d->L(1);
|
---|
1384 | XMM_ONLY(d->L(1) = (int32_t)d->L(2) - (int32_t)d->L(3));
|
---|
1385 | d->L((1 << SHIFT) + 0) = (int32_t)s->L(0) - (int32_t)s->L(1);
|
---|
1386 | XMM_ONLY(d->L(3) = (int32_t)s->L(2) - (int32_t)s->L(3));
|
---|
1387 | }
|
---|
1388 |
|
---|
1389 | void glue(helper_phsubsw, SUFFIX) (Reg *d, Reg *s)
|
---|
1390 | {
|
---|
1391 | d->W(0) = satsw((int16_t)d->W(0) - (int16_t)d->W(1));
|
---|
1392 | d->W(1) = satsw((int16_t)d->W(2) - (int16_t)d->W(3));
|
---|
1393 | XMM_ONLY(d->W(2) = satsw((int16_t)d->W(4) - (int16_t)d->W(5)));
|
---|
1394 | XMM_ONLY(d->W(3) = satsw((int16_t)d->W(6) - (int16_t)d->W(7)));
|
---|
1395 | d->W((2 << SHIFT) + 0) = satsw((int16_t)s->W(0) - (int16_t)s->W(1));
|
---|
1396 | d->W((2 << SHIFT) + 1) = satsw((int16_t)s->W(2) - (int16_t)s->W(3));
|
---|
1397 | XMM_ONLY(d->W(6) = satsw((int16_t)s->W(4) - (int16_t)s->W(5)));
|
---|
1398 | XMM_ONLY(d->W(7) = satsw((int16_t)s->W(6) - (int16_t)s->W(7)));
|
---|
1399 | }
|
---|
1400 |
|
---|
1401 | #define FABSB(_, x) x > INT8_MAX ? -(int8_t ) x : x
|
---|
1402 | #define FABSW(_, x) x > INT16_MAX ? -(int16_t) x : x
|
---|
1403 | #define FABSL(_, x) x > INT32_MAX ? -(int32_t) x : x
|
---|
1404 | SSE_HELPER_B(helper_pabsb, FABSB)
|
---|
1405 | SSE_HELPER_W(helper_pabsw, FABSW)
|
---|
1406 | SSE_HELPER_L(helper_pabsd, FABSL)
|
---|
1407 |
|
---|
1408 | #define FMULHRSW(d, s) ((int16_t) d * (int16_t) s + 0x4000) >> 15
|
---|
1409 | SSE_HELPER_W(helper_pmulhrsw, FMULHRSW)
|
---|
1410 |
|
---|
1411 | #define FSIGNB(d, s) s <= INT8_MAX ? s ? d : 0 : -(int8_t ) d
|
---|
1412 | #define FSIGNW(d, s) s <= INT16_MAX ? s ? d : 0 : -(int16_t) d
|
---|
1413 | #define FSIGNL(d, s) s <= INT32_MAX ? s ? d : 0 : -(int32_t) d
|
---|
1414 | SSE_HELPER_B(helper_psignb, FSIGNB)
|
---|
1415 | SSE_HELPER_W(helper_psignw, FSIGNW)
|
---|
1416 | SSE_HELPER_L(helper_psignd, FSIGNL)
|
---|
1417 |
|
---|
1418 | void glue(helper_palignr, SUFFIX) (Reg *d, Reg *s, int32_t shift)
|
---|
1419 | {
|
---|
1420 | Reg r;
|
---|
1421 |
|
---|
1422 | /* XXX could be checked during translation */
|
---|
1423 | if (shift >= (16 << SHIFT)) {
|
---|
1424 | r.Q(0) = 0;
|
---|
1425 | XMM_ONLY(r.Q(1) = 0);
|
---|
1426 | } else {
|
---|
1427 | shift <<= 3;
|
---|
1428 | #define SHR(v, i) (i < 64 && i > -64 ? i > 0 ? v >> (i) : (v << -(i)) : 0)
|
---|
1429 | #if SHIFT == 0
|
---|
1430 | r.Q(0) = SHR(s->Q(0), shift - 0) |
|
---|
1431 | SHR(d->Q(0), shift - 64);
|
---|
1432 | #else
|
---|
1433 | r.Q(0) = SHR(s->Q(0), shift - 0) |
|
---|
1434 | SHR(s->Q(1), shift - 64) |
|
---|
1435 | SHR(d->Q(0), shift - 128) |
|
---|
1436 | SHR(d->Q(1), shift - 192);
|
---|
1437 | r.Q(1) = SHR(s->Q(0), shift + 64) |
|
---|
1438 | SHR(s->Q(1), shift - 0) |
|
---|
1439 | SHR(d->Q(0), shift - 64) |
|
---|
1440 | SHR(d->Q(1), shift - 128);
|
---|
1441 | #endif
|
---|
1442 | #undef SHR
|
---|
1443 | }
|
---|
1444 |
|
---|
1445 | *d = r;
|
---|
1446 | }
|
---|
1447 |
|
---|
1448 | #define XMM0 env->xmm_regs[0]
|
---|
1449 |
|
---|
1450 | #if SHIFT == 1
|
---|
1451 | #define SSE_HELPER_V(name, elem, num, F)\
|
---|
1452 | void glue(name, SUFFIX) (Reg *d, Reg *s)\
|
---|
1453 | {\
|
---|
1454 | d->elem(0) = F(d->elem(0), s->elem(0), XMM0.elem(0));\
|
---|
1455 | d->elem(1) = F(d->elem(1), s->elem(1), XMM0.elem(1));\
|
---|
1456 | if (num > 2) {\
|
---|
1457 | d->elem(2) = F(d->elem(2), s->elem(2), XMM0.elem(2));\
|
---|
1458 | d->elem(3) = F(d->elem(3), s->elem(3), XMM0.elem(3));\
|
---|
1459 | if (num > 4) {\
|
---|
1460 | d->elem(4) = F(d->elem(4), s->elem(4), XMM0.elem(4));\
|
---|
1461 | d->elem(5) = F(d->elem(5), s->elem(5), XMM0.elem(5));\
|
---|
1462 | d->elem(6) = F(d->elem(6), s->elem(6), XMM0.elem(6));\
|
---|
1463 | d->elem(7) = F(d->elem(7), s->elem(7), XMM0.elem(7));\
|
---|
1464 | if (num > 8) {\
|
---|
1465 | d->elem(8) = F(d->elem(8), s->elem(8), XMM0.elem(8));\
|
---|
1466 | d->elem(9) = F(d->elem(9), s->elem(9), XMM0.elem(9));\
|
---|
1467 | d->elem(10) = F(d->elem(10), s->elem(10), XMM0.elem(10));\
|
---|
1468 | d->elem(11) = F(d->elem(11), s->elem(11), XMM0.elem(11));\
|
---|
1469 | d->elem(12) = F(d->elem(12), s->elem(12), XMM0.elem(12));\
|
---|
1470 | d->elem(13) = F(d->elem(13), s->elem(13), XMM0.elem(13));\
|
---|
1471 | d->elem(14) = F(d->elem(14), s->elem(14), XMM0.elem(14));\
|
---|
1472 | d->elem(15) = F(d->elem(15), s->elem(15), XMM0.elem(15));\
|
---|
1473 | }\
|
---|
1474 | }\
|
---|
1475 | }\
|
---|
1476 | }
|
---|
1477 |
|
---|
1478 | #define SSE_HELPER_I(name, elem, num, F)\
|
---|
1479 | void glue(name, SUFFIX) (Reg *d, Reg *s, uint32_t imm)\
|
---|
1480 | {\
|
---|
1481 | d->elem(0) = F(d->elem(0), s->elem(0), ((imm >> 0) & 1));\
|
---|
1482 | d->elem(1) = F(d->elem(1), s->elem(1), ((imm >> 1) & 1));\
|
---|
1483 | if (num > 2) {\
|
---|
1484 | d->elem(2) = F(d->elem(2), s->elem(2), ((imm >> 2) & 1));\
|
---|
1485 | d->elem(3) = F(d->elem(3), s->elem(3), ((imm >> 3) & 1));\
|
---|
1486 | if (num > 4) {\
|
---|
1487 | d->elem(4) = F(d->elem(4), s->elem(4), ((imm >> 4) & 1));\
|
---|
1488 | d->elem(5) = F(d->elem(5), s->elem(5), ((imm >> 5) & 1));\
|
---|
1489 | d->elem(6) = F(d->elem(6), s->elem(6), ((imm >> 6) & 1));\
|
---|
1490 | d->elem(7) = F(d->elem(7), s->elem(7), ((imm >> 7) & 1));\
|
---|
1491 | if (num > 8) {\
|
---|
1492 | d->elem(8) = F(d->elem(8), s->elem(8), ((imm >> 8) & 1));\
|
---|
1493 | d->elem(9) = F(d->elem(9), s->elem(9), ((imm >> 9) & 1));\
|
---|
1494 | d->elem(10) = F(d->elem(10), s->elem(10), ((imm >> 10) & 1));\
|
---|
1495 | d->elem(11) = F(d->elem(11), s->elem(11), ((imm >> 11) & 1));\
|
---|
1496 | d->elem(12) = F(d->elem(12), s->elem(12), ((imm >> 12) & 1));\
|
---|
1497 | d->elem(13) = F(d->elem(13), s->elem(13), ((imm >> 13) & 1));\
|
---|
1498 | d->elem(14) = F(d->elem(14), s->elem(14), ((imm >> 14) & 1));\
|
---|
1499 | d->elem(15) = F(d->elem(15), s->elem(15), ((imm >> 15) & 1));\
|
---|
1500 | }\
|
---|
1501 | }\
|
---|
1502 | }\
|
---|
1503 | }
|
---|
1504 |
|
---|
1505 | /* SSE4.1 op helpers */
|
---|
1506 | #define FBLENDVB(d, s, m) (m & 0x80) ? s : d
|
---|
1507 | #define FBLENDVPS(d, s, m) (m & 0x80000000) ? s : d
|
---|
1508 | #define FBLENDVPD(d, s, m) (m & 0x8000000000000000LL) ? s : d
|
---|
1509 | SSE_HELPER_V(helper_pblendvb, B, 16, FBLENDVB)
|
---|
1510 | SSE_HELPER_V(helper_blendvps, L, 4, FBLENDVPS)
|
---|
1511 | SSE_HELPER_V(helper_blendvpd, Q, 2, FBLENDVPD)
|
---|
1512 |
|
---|
1513 | void glue(helper_ptest, SUFFIX) (Reg *d, Reg *s)
|
---|
1514 | {
|
---|
1515 | uint64_t zf = (s->Q(0) & d->Q(0)) | (s->Q(1) & d->Q(1));
|
---|
1516 | uint64_t cf = (s->Q(0) & ~d->Q(0)) | (s->Q(1) & ~d->Q(1));
|
---|
1517 |
|
---|
1518 | CC_SRC = (zf ? 0 : CC_Z) | (cf ? 0 : CC_C);
|
---|
1519 | }
|
---|
1520 |
|
---|
1521 | #define SSE_HELPER_F(name, elem, num, F)\
|
---|
1522 | void glue(name, SUFFIX) (Reg *d, Reg *s)\
|
---|
1523 | {\
|
---|
1524 | d->elem(0) = F(0);\
|
---|
1525 | d->elem(1) = F(1);\
|
---|
1526 | if (num > 2) {\
|
---|
1527 | d->elem(2) = F(2);\
|
---|
1528 | d->elem(3) = F(3);\
|
---|
1529 | if (num > 4) {\
|
---|
1530 | d->elem(4) = F(4);\
|
---|
1531 | d->elem(5) = F(5);\
|
---|
1532 | d->elem(6) = F(6);\
|
---|
1533 | d->elem(7) = F(7);\
|
---|
1534 | }\
|
---|
1535 | }\
|
---|
1536 | }
|
---|
1537 |
|
---|
1538 | SSE_HELPER_F(helper_pmovsxbw, W, 8, (int8_t) s->B)
|
---|
1539 | SSE_HELPER_F(helper_pmovsxbd, L, 4, (int8_t) s->B)
|
---|
1540 | SSE_HELPER_F(helper_pmovsxbq, Q, 2, (int8_t) s->B)
|
---|
1541 | SSE_HELPER_F(helper_pmovsxwd, L, 4, (int16_t) s->W)
|
---|
1542 | SSE_HELPER_F(helper_pmovsxwq, Q, 2, (int16_t) s->W)
|
---|
1543 | SSE_HELPER_F(helper_pmovsxdq, Q, 2, (int32_t) s->L)
|
---|
1544 | SSE_HELPER_F(helper_pmovzxbw, W, 8, s->B)
|
---|
1545 | SSE_HELPER_F(helper_pmovzxbd, L, 4, s->B)
|
---|
1546 | SSE_HELPER_F(helper_pmovzxbq, Q, 2, s->B)
|
---|
1547 | SSE_HELPER_F(helper_pmovzxwd, L, 4, s->W)
|
---|
1548 | SSE_HELPER_F(helper_pmovzxwq, Q, 2, s->W)
|
---|
1549 | SSE_HELPER_F(helper_pmovzxdq, Q, 2, s->L)
|
---|
1550 |
|
---|
1551 | void glue(helper_pmuldq, SUFFIX) (Reg *d, Reg *s)
|
---|
1552 | {
|
---|
1553 | d->Q(0) = (int64_t) (int32_t) d->L(0) * (int32_t) s->L(0);
|
---|
1554 | d->Q(1) = (int64_t) (int32_t) d->L(2) * (int32_t) s->L(2);
|
---|
1555 | }
|
---|
1556 |
|
---|
1557 | #define FCMPEQQ(d, s) d == s ? -1 : 0
|
---|
1558 | SSE_HELPER_Q(helper_pcmpeqq, FCMPEQQ)
|
---|
1559 |
|
---|
1560 | void glue(helper_packusdw, SUFFIX) (Reg *d, Reg *s)
|
---|
1561 | {
|
---|
1562 | d->W(0) = satuw((int32_t) d->L(0));
|
---|
1563 | d->W(1) = satuw((int32_t) d->L(1));
|
---|
1564 | d->W(2) = satuw((int32_t) d->L(2));
|
---|
1565 | d->W(3) = satuw((int32_t) d->L(3));
|
---|
1566 | d->W(4) = satuw((int32_t) s->L(0));
|
---|
1567 | d->W(5) = satuw((int32_t) s->L(1));
|
---|
1568 | d->W(6) = satuw((int32_t) s->L(2));
|
---|
1569 | d->W(7) = satuw((int32_t) s->L(3));
|
---|
1570 | }
|
---|
1571 |
|
---|
1572 | #define FMINSB(d, s) MIN((int8_t) d, (int8_t) s)
|
---|
1573 | #define FMINSD(d, s) MIN((int32_t) d, (int32_t) s)
|
---|
1574 | #define FMAXSB(d, s) MAX((int8_t) d, (int8_t) s)
|
---|
1575 | #define FMAXSD(d, s) MAX((int32_t) d, (int32_t) s)
|
---|
1576 | SSE_HELPER_B(helper_pminsb, FMINSB)
|
---|
1577 | SSE_HELPER_L(helper_pminsd, FMINSD)
|
---|
1578 | SSE_HELPER_W(helper_pminuw, MIN)
|
---|
1579 | SSE_HELPER_L(helper_pminud, MIN)
|
---|
1580 | SSE_HELPER_B(helper_pmaxsb, FMAXSB)
|
---|
1581 | SSE_HELPER_L(helper_pmaxsd, FMAXSD)
|
---|
1582 | SSE_HELPER_W(helper_pmaxuw, MAX)
|
---|
1583 | SSE_HELPER_L(helper_pmaxud, MAX)
|
---|
1584 |
|
---|
1585 | #define FMULLD(d, s) (int32_t) d * (int32_t) s
|
---|
1586 | SSE_HELPER_L(helper_pmulld, FMULLD)
|
---|
1587 |
|
---|
1588 | void glue(helper_phminposuw, SUFFIX) (Reg *d, Reg *s)
|
---|
1589 | {
|
---|
1590 | int idx = 0;
|
---|
1591 |
|
---|
1592 | if (s->W(1) < s->W(idx))
|
---|
1593 | idx = 1;
|
---|
1594 | if (s->W(2) < s->W(idx))
|
---|
1595 | idx = 2;
|
---|
1596 | if (s->W(3) < s->W(idx))
|
---|
1597 | idx = 3;
|
---|
1598 | if (s->W(4) < s->W(idx))
|
---|
1599 | idx = 4;
|
---|
1600 | if (s->W(5) < s->W(idx))
|
---|
1601 | idx = 5;
|
---|
1602 | if (s->W(6) < s->W(idx))
|
---|
1603 | idx = 6;
|
---|
1604 | if (s->W(7) < s->W(idx))
|
---|
1605 | idx = 7;
|
---|
1606 |
|
---|
1607 | d->Q(1) = 0;
|
---|
1608 | d->L(1) = 0;
|
---|
1609 | d->W(1) = idx;
|
---|
1610 | d->W(0) = s->W(idx);
|
---|
1611 | }
|
---|
1612 |
|
---|
1613 | void glue(helper_roundps, SUFFIX) (Reg *d, Reg *s, uint32_t mode)
|
---|
1614 | {
|
---|
1615 | signed char prev_rounding_mode;
|
---|
1616 |
|
---|
1617 | prev_rounding_mode = env->sse_status.float_rounding_mode;
|
---|
1618 | if (!(mode & (1 << 2)))
|
---|
1619 | switch (mode & 3) {
|
---|
1620 | case 0:
|
---|
1621 | set_float_rounding_mode(float_round_nearest_even, &env->sse_status);
|
---|
1622 | break;
|
---|
1623 | case 1:
|
---|
1624 | set_float_rounding_mode(float_round_down, &env->sse_status);
|
---|
1625 | break;
|
---|
1626 | case 2:
|
---|
1627 | set_float_rounding_mode(float_round_up, &env->sse_status);
|
---|
1628 | break;
|
---|
1629 | case 3:
|
---|
1630 | set_float_rounding_mode(float_round_to_zero, &env->sse_status);
|
---|
1631 | break;
|
---|
1632 | }
|
---|
1633 |
|
---|
1634 | d->L(0) = float64_round_to_int(s->L(0), &env->sse_status);
|
---|
1635 | d->L(1) = float64_round_to_int(s->L(1), &env->sse_status);
|
---|
1636 | d->L(2) = float64_round_to_int(s->L(2), &env->sse_status);
|
---|
1637 | d->L(3) = float64_round_to_int(s->L(3), &env->sse_status);
|
---|
1638 |
|
---|
1639 | #if 0 /* TODO */
|
---|
1640 | if (mode & (1 << 3))
|
---|
1641 | set_float_exception_flags(
|
---|
1642 | get_float_exception_flags(&env->sse_status) &
|
---|
1643 | ~float_flag_inexact,
|
---|
1644 | &env->sse_status);
|
---|
1645 | #endif
|
---|
1646 | env->sse_status.float_rounding_mode = prev_rounding_mode;
|
---|
1647 | }
|
---|
1648 |
|
---|
1649 | void glue(helper_roundpd, SUFFIX) (Reg *d, Reg *s, uint32_t mode)
|
---|
1650 | {
|
---|
1651 | signed char prev_rounding_mode;
|
---|
1652 |
|
---|
1653 | prev_rounding_mode = env->sse_status.float_rounding_mode;
|
---|
1654 | if (!(mode & (1 << 2)))
|
---|
1655 | switch (mode & 3) {
|
---|
1656 | case 0:
|
---|
1657 | set_float_rounding_mode(float_round_nearest_even, &env->sse_status);
|
---|
1658 | break;
|
---|
1659 | case 1:
|
---|
1660 | set_float_rounding_mode(float_round_down, &env->sse_status);
|
---|
1661 | break;
|
---|
1662 | case 2:
|
---|
1663 | set_float_rounding_mode(float_round_up, &env->sse_status);
|
---|
1664 | break;
|
---|
1665 | case 3:
|
---|
1666 | set_float_rounding_mode(float_round_to_zero, &env->sse_status);
|
---|
1667 | break;
|
---|
1668 | }
|
---|
1669 |
|
---|
1670 | d->Q(0) = float64_round_to_int(s->Q(0), &env->sse_status);
|
---|
1671 | d->Q(1) = float64_round_to_int(s->Q(1), &env->sse_status);
|
---|
1672 |
|
---|
1673 | #if 0 /* TODO */
|
---|
1674 | if (mode & (1 << 3))
|
---|
1675 | set_float_exception_flags(
|
---|
1676 | get_float_exception_flags(&env->sse_status) &
|
---|
1677 | ~float_flag_inexact,
|
---|
1678 | &env->sse_status);
|
---|
1679 | #endif
|
---|
1680 | env->sse_status.float_rounding_mode = prev_rounding_mode;
|
---|
1681 | }
|
---|
1682 |
|
---|
1683 | void glue(helper_roundss, SUFFIX) (Reg *d, Reg *s, uint32_t mode)
|
---|
1684 | {
|
---|
1685 | signed char prev_rounding_mode;
|
---|
1686 |
|
---|
1687 | prev_rounding_mode = env->sse_status.float_rounding_mode;
|
---|
1688 | if (!(mode & (1 << 2)))
|
---|
1689 | switch (mode & 3) {
|
---|
1690 | case 0:
|
---|
1691 | set_float_rounding_mode(float_round_nearest_even, &env->sse_status);
|
---|
1692 | break;
|
---|
1693 | case 1:
|
---|
1694 | set_float_rounding_mode(float_round_down, &env->sse_status);
|
---|
1695 | break;
|
---|
1696 | case 2:
|
---|
1697 | set_float_rounding_mode(float_round_up, &env->sse_status);
|
---|
1698 | break;
|
---|
1699 | case 3:
|
---|
1700 | set_float_rounding_mode(float_round_to_zero, &env->sse_status);
|
---|
1701 | break;
|
---|
1702 | }
|
---|
1703 |
|
---|
1704 | d->L(0) = float64_round_to_int(s->L(0), &env->sse_status);
|
---|
1705 |
|
---|
1706 | #if 0 /* TODO */
|
---|
1707 | if (mode & (1 << 3))
|
---|
1708 | set_float_exception_flags(
|
---|
1709 | get_float_exception_flags(&env->sse_status) &
|
---|
1710 | ~float_flag_inexact,
|
---|
1711 | &env->sse_status);
|
---|
1712 | #endif
|
---|
1713 | env->sse_status.float_rounding_mode = prev_rounding_mode;
|
---|
1714 | }
|
---|
1715 |
|
---|
1716 | void glue(helper_roundsd, SUFFIX) (Reg *d, Reg *s, uint32_t mode)
|
---|
1717 | {
|
---|
1718 | signed char prev_rounding_mode;
|
---|
1719 |
|
---|
1720 | prev_rounding_mode = env->sse_status.float_rounding_mode;
|
---|
1721 | if (!(mode & (1 << 2)))
|
---|
1722 | switch (mode & 3) {
|
---|
1723 | case 0:
|
---|
1724 | set_float_rounding_mode(float_round_nearest_even, &env->sse_status);
|
---|
1725 | break;
|
---|
1726 | case 1:
|
---|
1727 | set_float_rounding_mode(float_round_down, &env->sse_status);
|
---|
1728 | break;
|
---|
1729 | case 2:
|
---|
1730 | set_float_rounding_mode(float_round_up, &env->sse_status);
|
---|
1731 | break;
|
---|
1732 | case 3:
|
---|
1733 | set_float_rounding_mode(float_round_to_zero, &env->sse_status);
|
---|
1734 | break;
|
---|
1735 | }
|
---|
1736 |
|
---|
1737 | d->Q(0) = float64_round_to_int(s->Q(0), &env->sse_status);
|
---|
1738 |
|
---|
1739 | #if 0 /* TODO */
|
---|
1740 | if (mode & (1 << 3))
|
---|
1741 | set_float_exception_flags(
|
---|
1742 | get_float_exception_flags(&env->sse_status) &
|
---|
1743 | ~float_flag_inexact,
|
---|
1744 | &env->sse_status);
|
---|
1745 | #endif
|
---|
1746 | env->sse_status.float_rounding_mode = prev_rounding_mode;
|
---|
1747 | }
|
---|
1748 |
|
---|
1749 | #define FBLENDP(d, s, m) m ? s : d
|
---|
1750 | SSE_HELPER_I(helper_blendps, L, 4, FBLENDP)
|
---|
1751 | SSE_HELPER_I(helper_blendpd, Q, 2, FBLENDP)
|
---|
1752 | SSE_HELPER_I(helper_pblendw, W, 8, FBLENDP)
|
---|
1753 |
|
---|
1754 | void glue(helper_dpps, SUFFIX) (Reg *d, Reg *s, uint32_t mask)
|
---|
1755 | {
|
---|
1756 | float32 iresult = 0 /*float32_zero*/;
|
---|
1757 |
|
---|
1758 | if (mask & (1 << 4))
|
---|
1759 | iresult = float32_add(iresult,
|
---|
1760 | float32_mul(d->L(0), s->L(0), &env->sse_status),
|
---|
1761 | &env->sse_status);
|
---|
1762 | if (mask & (1 << 5))
|
---|
1763 | iresult = float32_add(iresult,
|
---|
1764 | float32_mul(d->L(1), s->L(1), &env->sse_status),
|
---|
1765 | &env->sse_status);
|
---|
1766 | if (mask & (1 << 6))
|
---|
1767 | iresult = float32_add(iresult,
|
---|
1768 | float32_mul(d->L(2), s->L(2), &env->sse_status),
|
---|
1769 | &env->sse_status);
|
---|
1770 | if (mask & (1 << 7))
|
---|
1771 | iresult = float32_add(iresult,
|
---|
1772 | float32_mul(d->L(3), s->L(3), &env->sse_status),
|
---|
1773 | &env->sse_status);
|
---|
1774 | d->L(0) = (mask & (1 << 0)) ? iresult : 0 /*float32_zero*/;
|
---|
1775 | d->L(1) = (mask & (1 << 1)) ? iresult : 0 /*float32_zero*/;
|
---|
1776 | d->L(2) = (mask & (1 << 2)) ? iresult : 0 /*float32_zero*/;
|
---|
1777 | d->L(3) = (mask & (1 << 3)) ? iresult : 0 /*float32_zero*/;
|
---|
1778 | }
|
---|
1779 |
|
---|
1780 | void glue(helper_dppd, SUFFIX) (Reg *d, Reg *s, uint32_t mask)
|
---|
1781 | {
|
---|
1782 | float64 iresult = 0 /*float64_zero*/;
|
---|
1783 |
|
---|
1784 | if (mask & (1 << 4))
|
---|
1785 | iresult = float64_add(iresult,
|
---|
1786 | float64_mul(d->Q(0), s->Q(0), &env->sse_status),
|
---|
1787 | &env->sse_status);
|
---|
1788 | if (mask & (1 << 5))
|
---|
1789 | iresult = float64_add(iresult,
|
---|
1790 | float64_mul(d->Q(1), s->Q(1), &env->sse_status),
|
---|
1791 | &env->sse_status);
|
---|
1792 | d->Q(0) = (mask & (1 << 0)) ? iresult : 0 /*float64_zero*/;
|
---|
1793 | d->Q(1) = (mask & (1 << 1)) ? iresult : 0 /*float64_zero*/;
|
---|
1794 | }
|
---|
1795 |
|
---|
1796 | void glue(helper_mpsadbw, SUFFIX) (Reg *d, Reg *s, uint32_t offset)
|
---|
1797 | {
|
---|
1798 | int s0 = (offset & 3) << 2;
|
---|
1799 | int d0 = (offset & 4) << 0;
|
---|
1800 | int i;
|
---|
1801 | Reg r;
|
---|
1802 |
|
---|
1803 | for (i = 0; i < 8; i++, d0++) {
|
---|
1804 | r.W(i) = 0;
|
---|
1805 | r.W(i) += abs1(d->B(d0 + 0) - s->B(s0 + 0));
|
---|
1806 | r.W(i) += abs1(d->B(d0 + 1) - s->B(s0 + 1));
|
---|
1807 | r.W(i) += abs1(d->B(d0 + 2) - s->B(s0 + 2));
|
---|
1808 | r.W(i) += abs1(d->B(d0 + 3) - s->B(s0 + 3));
|
---|
1809 | }
|
---|
1810 |
|
---|
1811 | *d = r;
|
---|
1812 | }
|
---|
1813 |
|
---|
1814 | /* SSE4.2 op helpers */
|
---|
1815 | /* it's unclear whether signed or unsigned */
|
---|
1816 | #define FCMPGTQ(d, s) d > s ? -1 : 0
|
---|
1817 | SSE_HELPER_Q(helper_pcmpgtq, FCMPGTQ)
|
---|
1818 |
|
---|
1819 | #ifndef VBOX
|
---|
1820 | static inline int pcmp_elen(int reg, uint32_t ctrl)
|
---|
1821 | #else /* VBOX */
|
---|
1822 | DECLINLINE(int) pcmp_elen(int reg, uint32_t ctrl)
|
---|
1823 | #endif /* VBOX */
|
---|
1824 | {
|
---|
1825 | int val;
|
---|
1826 |
|
---|
1827 | /* Presence of REX.W is indicated by a bit higher than 7 set */
|
---|
1828 | if (ctrl >> 8)
|
---|
1829 | val = abs1((int64_t) env->regs[reg]);
|
---|
1830 | else
|
---|
1831 | val = abs1((int32_t) env->regs[reg]);
|
---|
1832 |
|
---|
1833 | if (ctrl & 1) {
|
---|
1834 | if (val > 8)
|
---|
1835 | return 8;
|
---|
1836 | } else
|
---|
1837 | if (val > 16)
|
---|
1838 | return 16;
|
---|
1839 |
|
---|
1840 | return val;
|
---|
1841 | }
|
---|
1842 |
|
---|
1843 | #ifndef VBOX
|
---|
1844 | static inline int pcmp_ilen(Reg *r, uint8_t ctrl)
|
---|
1845 | #else /* VBOX */
|
---|
1846 | DECLINLINE(int) pcmp_ilen(Reg *r, uint8_t ctrl)
|
---|
1847 | #endif /* VBOX */
|
---|
1848 | {
|
---|
1849 | int val = 0;
|
---|
1850 |
|
---|
1851 | if (ctrl & 1) {
|
---|
1852 | while (val < 8 && r->W(val))
|
---|
1853 | val++;
|
---|
1854 | } else
|
---|
1855 | while (val < 16 && r->B(val))
|
---|
1856 | val++;
|
---|
1857 |
|
---|
1858 | return val;
|
---|
1859 | }
|
---|
1860 |
|
---|
1861 | #ifndef VBOX
|
---|
1862 | static inline int pcmp_val(Reg *r, uint8_t ctrl, int i)
|
---|
1863 | #else /* VBOX */
|
---|
1864 | DECLINLINE(int) pcmp_val(Reg *r, uint8_t ctrl, int i)
|
---|
1865 | #endif /* VBOX */
|
---|
1866 | {
|
---|
1867 | switch ((ctrl >> 0) & 3) {
|
---|
1868 | case 0:
|
---|
1869 | return r->B(i);
|
---|
1870 | case 1:
|
---|
1871 | return r->W(i);
|
---|
1872 | case 2:
|
---|
1873 | return (int8_t) r->B(i);
|
---|
1874 | case 3:
|
---|
1875 | default:
|
---|
1876 | return (int16_t) r->W(i);
|
---|
1877 | }
|
---|
1878 | }
|
---|
1879 |
|
---|
1880 | #ifndef VBOX
|
---|
1881 | static inline unsigned pcmpxstrx(Reg *d, Reg *s,
|
---|
1882 | #else /* VBOX */
|
---|
1883 | DECLINLINE(unsigned) pcmpxstrx(Reg *d, Reg *s,
|
---|
1884 | #endif /* VBOX */
|
---|
1885 | int8_t ctrl, int valids, int validd)
|
---|
1886 | {
|
---|
1887 | unsigned int res = 0;
|
---|
1888 | int v;
|
---|
1889 | int j, i;
|
---|
1890 | int upper = (ctrl & 1) ? 7 : 15;
|
---|
1891 |
|
---|
1892 | valids--;
|
---|
1893 | validd--;
|
---|
1894 |
|
---|
1895 | CC_SRC = (valids < upper ? CC_Z : 0) | (validd < upper ? CC_S : 0);
|
---|
1896 |
|
---|
1897 | switch ((ctrl >> 2) & 3) {
|
---|
1898 | case 0:
|
---|
1899 | for (j = valids; j >= 0; j--) {
|
---|
1900 | res <<= 1;
|
---|
1901 | v = pcmp_val(s, ctrl, j);
|
---|
1902 | for (i = validd; i >= 0; i--)
|
---|
1903 | res |= (v == pcmp_val(d, ctrl, i));
|
---|
1904 | }
|
---|
1905 | break;
|
---|
1906 | case 1:
|
---|
1907 | for (j = valids; j >= 0; j--) {
|
---|
1908 | res <<= 1;
|
---|
1909 | v = pcmp_val(s, ctrl, j);
|
---|
1910 | for (i = ((validd - 1) | 1); i >= 0; i -= 2)
|
---|
1911 | res |= (pcmp_val(d, ctrl, i - 0) <= v &&
|
---|
1912 | pcmp_val(d, ctrl, i - 1) >= v);
|
---|
1913 | }
|
---|
1914 | break;
|
---|
1915 | case 2:
|
---|
1916 | res = (2 << (upper - MAX(valids, validd))) - 1;
|
---|
1917 | res <<= MAX(valids, validd) - MIN(valids, validd);
|
---|
1918 | for (i = MIN(valids, validd); i >= 0; i--) {
|
---|
1919 | res <<= 1;
|
---|
1920 | v = pcmp_val(s, ctrl, i);
|
---|
1921 | res |= (v == pcmp_val(d, ctrl, i));
|
---|
1922 | }
|
---|
1923 | break;
|
---|
1924 | case 3:
|
---|
1925 | for (j = valids - validd; j >= 0; j--) {
|
---|
1926 | res <<= 1;
|
---|
1927 | res |= 1;
|
---|
1928 | for (i = MIN(upper - j, validd); i >= 0; i--)
|
---|
1929 | res &= (pcmp_val(s, ctrl, i + j) == pcmp_val(d, ctrl, i));
|
---|
1930 | }
|
---|
1931 | break;
|
---|
1932 | }
|
---|
1933 |
|
---|
1934 | switch ((ctrl >> 4) & 3) {
|
---|
1935 | case 1:
|
---|
1936 | res ^= (2 << upper) - 1;
|
---|
1937 | break;
|
---|
1938 | case 3:
|
---|
1939 | res ^= (2 << valids) - 1;
|
---|
1940 | break;
|
---|
1941 | }
|
---|
1942 |
|
---|
1943 | if (res)
|
---|
1944 | CC_SRC |= CC_C;
|
---|
1945 | if (res & 1)
|
---|
1946 | CC_SRC |= CC_O;
|
---|
1947 |
|
---|
1948 | return res;
|
---|
1949 | }
|
---|
1950 |
|
---|
1951 | #ifndef VBOX
|
---|
1952 | static inline int rffs1(unsigned int val)
|
---|
1953 | #else /* VBOX */
|
---|
1954 | DECLINLINE(int) rffs1(unsigned int val)
|
---|
1955 | #endif /* VBOX */
|
---|
1956 | {
|
---|
1957 | int ret = 1, hi;
|
---|
1958 |
|
---|
1959 | for (hi = sizeof(val) * 4; hi; hi /= 2)
|
---|
1960 | if (val >> hi) {
|
---|
1961 | val >>= hi;
|
---|
1962 | ret += hi;
|
---|
1963 | }
|
---|
1964 |
|
---|
1965 | return ret;
|
---|
1966 | }
|
---|
1967 |
|
---|
1968 | #ifndef VBOX
|
---|
1969 | static inline int ffs1(unsigned int val)
|
---|
1970 | #else /* VBOX */
|
---|
1971 | DECLINLINE(int) ffs1(unsigned int val)
|
---|
1972 | #endif /* VBOX */
|
---|
1973 | {
|
---|
1974 | int ret = 1, hi;
|
---|
1975 |
|
---|
1976 | for (hi = sizeof(val) * 4; hi; hi /= 2)
|
---|
1977 | if (val << hi) {
|
---|
1978 | val <<= hi;
|
---|
1979 | ret += hi;
|
---|
1980 | }
|
---|
1981 |
|
---|
1982 | return ret;
|
---|
1983 | }
|
---|
1984 |
|
---|
1985 | void glue(helper_pcmpestri, SUFFIX) (Reg *d, Reg *s, uint32_t ctrl)
|
---|
1986 | {
|
---|
1987 | unsigned int res = pcmpxstrx(d, s, ctrl,
|
---|
1988 | pcmp_elen(R_EDX, ctrl),
|
---|
1989 | pcmp_elen(R_EAX, ctrl));
|
---|
1990 |
|
---|
1991 | if (res)
|
---|
1992 | #ifndef VBOX
|
---|
1993 | env->regs[R_ECX] = ((ctrl & (1 << 6)) ? rffs1 : ffs1)(res) - 1;
|
---|
1994 | #else
|
---|
1995 | env->regs[R_ECX] = ((ctrl & (1 << 6)) ? rffs1(res) : ffs1(res)) - 1;
|
---|
1996 | #endif
|
---|
1997 | else
|
---|
1998 | env->regs[R_ECX] = 16 >> (ctrl & (1 << 0));
|
---|
1999 | }
|
---|
2000 |
|
---|
2001 | void glue(helper_pcmpestrm, SUFFIX) (Reg *d, Reg *s, uint32_t ctrl)
|
---|
2002 | {
|
---|
2003 | int i;
|
---|
2004 | unsigned int res = pcmpxstrx(d, s, ctrl,
|
---|
2005 | pcmp_elen(R_EDX, ctrl),
|
---|
2006 | pcmp_elen(R_EAX, ctrl));
|
---|
2007 |
|
---|
2008 | if ((ctrl >> 6) & 1) {
|
---|
2009 | if (ctrl & 1)
|
---|
2010 | for (i = 0; i <= 8; i--, res >>= 1)
|
---|
2011 | d->W(i) = (res & 1) ? ~0 : 0;
|
---|
2012 | else
|
---|
2013 | for (i = 0; i <= 16; i--, res >>= 1)
|
---|
2014 | d->B(i) = (res & 1) ? ~0 : 0;
|
---|
2015 | } else {
|
---|
2016 | d->Q(1) = 0;
|
---|
2017 | d->Q(0) = res;
|
---|
2018 | }
|
---|
2019 | }
|
---|
2020 |
|
---|
2021 | void glue(helper_pcmpistri, SUFFIX) (Reg *d, Reg *s, uint32_t ctrl)
|
---|
2022 | {
|
---|
2023 | unsigned int res = pcmpxstrx(d, s, ctrl,
|
---|
2024 | pcmp_ilen(s, ctrl),
|
---|
2025 | pcmp_ilen(d, ctrl));
|
---|
2026 |
|
---|
2027 | if (res)
|
---|
2028 | env->regs[R_ECX] = ((ctrl & (1 << 6)) ? rffs1 : ffs1)(res) - 1;
|
---|
2029 | else
|
---|
2030 | env->regs[R_ECX] = 16 >> (ctrl & (1 << 0));
|
---|
2031 | }
|
---|
2032 |
|
---|
2033 | void glue(helper_pcmpistrm, SUFFIX) (Reg *d, Reg *s, uint32_t ctrl)
|
---|
2034 | {
|
---|
2035 | int i;
|
---|
2036 | unsigned int res = pcmpxstrx(d, s, ctrl,
|
---|
2037 | pcmp_ilen(s, ctrl),
|
---|
2038 | pcmp_ilen(d, ctrl));
|
---|
2039 |
|
---|
2040 | if ((ctrl >> 6) & 1) {
|
---|
2041 | if (ctrl & 1)
|
---|
2042 | for (i = 0; i <= 8; i--, res >>= 1)
|
---|
2043 | d->W(i) = (res & 1) ? ~0 : 0;
|
---|
2044 | else
|
---|
2045 | for (i = 0; i <= 16; i--, res >>= 1)
|
---|
2046 | d->B(i) = (res & 1) ? ~0 : 0;
|
---|
2047 | } else {
|
---|
2048 | d->Q(1) = 0;
|
---|
2049 | d->Q(0) = res;
|
---|
2050 | }
|
---|
2051 | }
|
---|
2052 |
|
---|
2053 | #define CRCPOLY 0x1edc6f41
|
---|
2054 | #define CRCPOLY_BITREV 0x82f63b78
|
---|
2055 | target_ulong helper_crc32(uint32_t crc1, target_ulong msg, uint32_t len)
|
---|
2056 | {
|
---|
2057 | target_ulong crc = (msg & ((target_ulong) -1 >>
|
---|
2058 | (TARGET_LONG_BITS - len))) ^ crc1;
|
---|
2059 |
|
---|
2060 | while (len--)
|
---|
2061 | crc = (crc >> 1) ^ ((crc & 1) ? CRCPOLY_BITREV : 0);
|
---|
2062 |
|
---|
2063 | return crc;
|
---|
2064 | }
|
---|
2065 |
|
---|
2066 | #define POPMASK(i) ((target_ulong) -1 / ((1LL << (1 << i)) + 1))
|
---|
2067 | #define POPCOUNT(n, i) (n & POPMASK(i)) + ((n >> (1 << i)) & POPMASK(i))
|
---|
2068 | target_ulong helper_popcnt(target_ulong n, uint32_t type)
|
---|
2069 | {
|
---|
2070 | CC_SRC = n ? 0 : CC_Z;
|
---|
2071 |
|
---|
2072 | n = POPCOUNT(n, 0);
|
---|
2073 | n = POPCOUNT(n, 1);
|
---|
2074 | n = POPCOUNT(n, 2);
|
---|
2075 | n = POPCOUNT(n, 3);
|
---|
2076 | if (type == 1)
|
---|
2077 | return n & 0xff;
|
---|
2078 |
|
---|
2079 | n = POPCOUNT(n, 4);
|
---|
2080 | #ifndef TARGET_X86_64
|
---|
2081 | return n;
|
---|
2082 | #else
|
---|
2083 | if (type == 2)
|
---|
2084 | return n & 0xff;
|
---|
2085 |
|
---|
2086 | return POPCOUNT(n, 5);
|
---|
2087 | #endif
|
---|
2088 | }
|
---|
2089 | #endif
|
---|
2090 |
|
---|
2091 | #undef SHIFT
|
---|
2092 | #undef XMM_ONLY
|
---|
2093 | #undef Reg
|
---|
2094 | #undef B
|
---|
2095 | #undef W
|
---|
2096 | #undef L
|
---|
2097 | #undef Q
|
---|
2098 | #undef SUFFIX
|
---|