1 // stop compiling if NORECBUILD build (only for Visual Studio)
2
3 #ifdef __x86_64__
4
5 #if !(defined(_MSC_VER) && defined(PCSX2_NORECBUILD))
6
7 #include "ix86-64.h"
8
9 #include <assert.h>
10
11 /********************/
12 /* MMX instructions */
13 /********************/
14
15 // r64 = mm
16
17 /* movq m64 to r64 */
MOVQMtoR(x86MMXRegType to,uptr from)18 void MOVQMtoR( x86MMXRegType to, uptr from )
19 {
20 MEMADDR_OP(0, VAROP2(0x0F, 0x6F), true, to, from, 0);
21 }
22
23 /* movq r64 to m64 */
MOVQRtoM(uptr to,x86MMXRegType from)24 void MOVQRtoM( uptr to, x86MMXRegType from )
25 {
26 MEMADDR_OP(0, VAROP2(0x0F, 0x7F), true, from, to, 0);
27 }
28
29 /* pand r64 to r64 */
PANDRtoR(x86MMXRegType to,x86MMXRegType from)30 void PANDRtoR( x86MMXRegType to, x86MMXRegType from )
31 {
32 RexRB(0, to, from);
33 write16( 0xDB0F );
34 ModRM( 3, to, from );
35 }
36
PANDNRtoR(x86MMXRegType to,x86MMXRegType from)37 void PANDNRtoR( x86MMXRegType to, x86MMXRegType from )
38 {
39 RexRB(0, to, from);
40 write16( 0xDF0F );
41 ModRM( 3, to, from );
42 }
43
44 /* por r64 to r64 */
PORRtoR(x86MMXRegType to,x86MMXRegType from)45 void PORRtoR( x86MMXRegType to, x86MMXRegType from )
46 {
47 RexRB(0, to, from);
48 write16( 0xEB0F );
49 ModRM( 3, to, from );
50 }
51
52 /* pxor r64 to r64 */
PXORRtoR(x86MMXRegType to,x86MMXRegType from)53 void PXORRtoR( x86MMXRegType to, x86MMXRegType from )
54 {
55 RexRB(0, to, from);
56 write16( 0xEF0F );
57 ModRM( 3, to, from );
58 }
59
60 /* psllq r64 to r64 */
PSLLQRtoR(x86MMXRegType to,x86MMXRegType from)61 void PSLLQRtoR( x86MMXRegType to, x86MMXRegType from )
62 {
63 RexRB(0, to, from);
64 write16( 0xF30F );
65 ModRM( 3, to, from );
66 }
67
68 /* psllq m64 to r64 */
PSLLQMtoR(x86MMXRegType to,uptr from)69 void PSLLQMtoR( x86MMXRegType to, uptr from )
70 {
71 MEMADDR_OP(0, VAROP2(0x0F, 0xF3), true, to, from, 0);
72 }
73
74 /* psllq imm8 to r64 */
PSLLQItoR(x86MMXRegType to,u8 from)75 void PSLLQItoR( x86MMXRegType to, u8 from )
76 {
77 RexB(0, to);
78 write16( 0x730F );
79 ModRM( 3, 6, to);
80 write8( from );
81 }
82
83 /* psrlq r64 to r64 */
PSRLQRtoR(x86MMXRegType to,x86MMXRegType from)84 void PSRLQRtoR( x86MMXRegType to, x86MMXRegType from )
85 {
86 RexRB(0, to, from);
87 write16( 0xD30F );
88 ModRM( 3, to, from );
89 }
90
91 /* psrlq m64 to r64 */
PSRLQMtoR(x86MMXRegType to,uptr from)92 void PSRLQMtoR( x86MMXRegType to, uptr from )
93 {
94 MEMADDR_OP(0, VAROP2(0x0F, 0xD3), true, to, from, 0);
95 }
96
97 /* psrlq imm8 to r64 */
PSRLQItoR(x86MMXRegType to,u8 from)98 void PSRLQItoR( x86MMXRegType to, u8 from )
99 {
100 RexB(0, to);
101 write16( 0x730F );
102 ModRM( 3, 2, to);
103 write8( from );
104 }
105
106 /* paddusb r64 to r64 */
PADDUSBRtoR(x86MMXRegType to,x86MMXRegType from)107 void PADDUSBRtoR( x86MMXRegType to, x86MMXRegType from )
108 {
109 RexRB(0, to, from);
110 write16( 0xDC0F );
111 ModRM( 3, to, from );
112 }
113
114 /* paddusb m64 to r64 */
PADDUSBMtoR(x86MMXRegType to,uptr from)115 void PADDUSBMtoR( x86MMXRegType to, uptr from )
116 {
117 MEMADDR_OP(0, VAROP2(0x0F, 0xDC), true, to, from, 0);
118 }
119
120 /* paddusw r64 to r64 */
PADDUSWRtoR(x86MMXRegType to,x86MMXRegType from)121 void PADDUSWRtoR( x86MMXRegType to, x86MMXRegType from )
122 {
123 RexRB(0, to, from);
124 write16( 0xDD0F );
125 ModRM( 3, to, from );
126 }
127
128 /* paddusw m64 to r64 */
PADDUSWMtoR(x86MMXRegType to,uptr from)129 void PADDUSWMtoR( x86MMXRegType to, uptr from )
130 {
131 MEMADDR_OP(0, VAROP2(0x0F, 0xDD), true, to, from, 0);
132 }
133
134 /* paddb r64 to r64 */
PADDBRtoR(x86MMXRegType to,x86MMXRegType from)135 void PADDBRtoR( x86MMXRegType to, x86MMXRegType from )
136 {
137 RexRB(0, to, from);
138 write16( 0xFC0F );
139 ModRM( 3, to, from );
140 }
141
142 /* paddb m64 to r64 */
PADDBMtoR(x86MMXRegType to,uptr from)143 void PADDBMtoR( x86MMXRegType to, uptr from )
144 {
145 MEMADDR_OP(0, VAROP2(0x0F, 0xFC), true, to, from, 0);
146 }
147
148 /* paddw r64 to r64 */
PADDWRtoR(x86MMXRegType to,x86MMXRegType from)149 void PADDWRtoR( x86MMXRegType to, x86MMXRegType from )
150 {
151 RexRB(0, to, from);
152 write16( 0xFD0F );
153 ModRM( 3, to, from );
154 }
155
156 /* paddw m64 to r64 */
PADDWMtoR(x86MMXRegType to,uptr from)157 void PADDWMtoR( x86MMXRegType to, uptr from )
158 {
159 MEMADDR_OP(0, VAROP2(0x0F, 0xFD), true, to, from, 0);
160 }
161
162 /* paddd r64 to r64 */
PADDDRtoR(x86MMXRegType to,x86MMXRegType from)163 void PADDDRtoR( x86MMXRegType to, x86MMXRegType from )
164 {
165 RexRB(0, to, from);
166 write16( 0xFE0F );
167 ModRM( 3, to, from );
168 }
169
170 /* paddd m64 to r64 */
PADDDMtoR(x86MMXRegType to,uptr from)171 void PADDDMtoR( x86MMXRegType to, uptr from )
172 {
173 MEMADDR_OP(0, VAROP2(0x0F, 0xFE), true, to, from, 0);
174 }
175
176 /* emms */
EMMS(void)177 void EMMS( void )
178 {
179 write16( 0x770F );
180 }
181
PADDSBRtoR(x86MMXRegType to,x86MMXRegType from)182 void PADDSBRtoR( x86MMXRegType to, x86MMXRegType from )
183 {
184 RexRB(0, to, from);
185 write16( 0xEC0F );
186 ModRM( 3, to, from );
187 }
188
PADDSWRtoR(x86MMXRegType to,x86MMXRegType from)189 void PADDSWRtoR( x86MMXRegType to, x86MMXRegType from )
190 {
191 RexRB(0, to, from);
192 write16( 0xED0F );
193 ModRM( 3, to, from );
194 }
195
196 // paddq m64 to r64 (sse2 only?)
PADDQMtoR(x86MMXRegType to,uptr from)197 void PADDQMtoR( x86MMXRegType to, uptr from )
198 {
199 MEMADDR_OP(0, VAROP2(0x0F, 0xD4), true, to, from, 0);
200 }
201
202 // paddq r64 to r64 (sse2 only?)
PADDQRtoR(x86MMXRegType to,x86MMXRegType from)203 void PADDQRtoR( x86MMXRegType to, x86MMXRegType from )
204 {
205 RexRB(0, to, from);
206 write16( 0xD40F );
207 ModRM( 3, to, from );
208 }
209
PSUBSBRtoR(x86MMXRegType to,x86MMXRegType from)210 void PSUBSBRtoR( x86MMXRegType to, x86MMXRegType from )
211 {
212 RexRB(0, to, from);
213 write16( 0xE80F );
214 ModRM( 3, to, from );
215 }
216
PSUBSWRtoR(x86MMXRegType to,x86MMXRegType from)217 void PSUBSWRtoR( x86MMXRegType to, x86MMXRegType from )
218 {
219 RexRB(0, to, from);
220 write16( 0xE90F );
221 ModRM( 3, to, from );
222 }
223
224
PSUBBRtoR(x86MMXRegType to,x86MMXRegType from)225 void PSUBBRtoR( x86MMXRegType to, x86MMXRegType from )
226 {
227 RexRB(0, to, from);
228 write16( 0xF80F );
229 ModRM( 3, to, from );
230 }
231
PSUBWRtoR(x86MMXRegType to,x86MMXRegType from)232 void PSUBWRtoR( x86MMXRegType to, x86MMXRegType from )
233 {
234 RexRB(0, to, from);
235 write16( 0xF90F );
236 ModRM( 3, to, from );
237 }
238
PSUBDRtoR(x86MMXRegType to,x86MMXRegType from)239 void PSUBDRtoR( x86MMXRegType to, x86MMXRegType from )
240 {
241 RexRB(0, to, from);
242 write16( 0xFA0F );
243 ModRM( 3, to, from );
244 }
245
PSUBDMtoR(x86MMXRegType to,uptr from)246 void PSUBDMtoR( x86MMXRegType to, uptr from )
247 {
248 MEMADDR_OP(0, VAROP2(0x0F, 0xFA), true, to, from, 0);
249 }
250
PSUBUSBRtoR(x86MMXRegType to,x86MMXRegType from)251 void PSUBUSBRtoR( x86MMXRegType to, x86MMXRegType from )
252 {
253 RexRB(0, to, from);
254 write16( 0xD80F );
255 ModRM( 3, to, from );
256 }
257
PSUBUSWRtoR(x86MMXRegType to,x86MMXRegType from)258 void PSUBUSWRtoR( x86MMXRegType to, x86MMXRegType from )
259 {
260 RexRB(0, to, from);
261 write16( 0xD90F );
262 ModRM( 3, to, from );
263 }
264
265 // psubq m64 to r64 (sse2 only?)
PSUBQMtoR(x86MMXRegType to,uptr from)266 void PSUBQMtoR( x86MMXRegType to, uptr from )
267 {
268 MEMADDR_OP(0, VAROP2(0x0F, 0xFB), true, to, from, 0);
269 }
270
271 // psubq r64 to r64 (sse2 only?)
PSUBQRtoR(x86MMXRegType to,x86MMXRegType from)272 void PSUBQRtoR( x86MMXRegType to, x86MMXRegType from )
273 {
274 RexRB(0, to, from);
275 write16( 0xFB0F );
276 ModRM( 3, to, from );
277 }
278
279 // pmuludq m64 to r64 (sse2 only?)
PMULUDQMtoR(x86MMXRegType to,uptr from)280 void PMULUDQMtoR( x86MMXRegType to, uptr from )
281 {
282 MEMADDR_OP(0, VAROP2(0x0F, 0xF4), true, to, from, 0);
283 }
284
285 // pmuludq r64 to r64 (sse2 only?)
PMULUDQRtoR(x86MMXRegType to,x86MMXRegType from)286 void PMULUDQRtoR( x86MMXRegType to, x86MMXRegType from )
287 {
288 RexRB(0, to, from);
289 write16( 0xF40F );
290 ModRM( 3, to, from );
291 }
292
PCMPEQBRtoR(x86MMXRegType to,x86MMXRegType from)293 void PCMPEQBRtoR( x86MMXRegType to, x86MMXRegType from )
294 {
295 RexRB(0, to, from);
296 write16( 0x740F );
297 ModRM( 3, to, from );
298 }
299
PCMPEQWRtoR(x86MMXRegType to,x86MMXRegType from)300 void PCMPEQWRtoR( x86MMXRegType to, x86MMXRegType from )
301 {
302 RexRB(0, to, from);
303 write16( 0x750F );
304 ModRM( 3, to, from );
305 }
306
PCMPEQDRtoR(x86MMXRegType to,x86MMXRegType from)307 void PCMPEQDRtoR( x86MMXRegType to, x86MMXRegType from )
308 {
309 RexRB(0, to, from);
310 write16( 0x760F );
311 ModRM( 3, to, from );
312 }
313
PCMPEQDMtoR(x86MMXRegType to,uptr from)314 void PCMPEQDMtoR( x86MMXRegType to, uptr from )
315 {
316 MEMADDR_OP(0, VAROP2(0x0F, 0x76), true, to, from, 0);
317 }
318
PCMPGTBRtoR(x86MMXRegType to,x86MMXRegType from)319 void PCMPGTBRtoR( x86MMXRegType to, x86MMXRegType from )
320 {
321 RexRB(0, to, from);
322 write16( 0x640F );
323 ModRM( 3, to, from );
324 }
325
PCMPGTWRtoR(x86MMXRegType to,x86MMXRegType from)326 void PCMPGTWRtoR( x86MMXRegType to, x86MMXRegType from )
327 {
328 RexRB(0, to, from);
329 write16( 0x650F );
330 ModRM( 3, to, from );
331 }
332
PCMPGTDRtoR(x86MMXRegType to,x86MMXRegType from)333 void PCMPGTDRtoR( x86MMXRegType to, x86MMXRegType from )
334 {
335 RexRB(0, to, from);
336 write16( 0x660F );
337 ModRM( 3, to, from );
338 }
339
PCMPGTDMtoR(x86MMXRegType to,uptr from)340 void PCMPGTDMtoR( x86MMXRegType to, uptr from )
341 {
342 MEMADDR_OP(0, VAROP2(0x0F, 0x66), true, to, from, 0);
343 }
344
PSRLWItoR(x86MMXRegType to,u8 from)345 void PSRLWItoR( x86MMXRegType to, u8 from )
346 {
347 RexB(0, to);
348 write16( 0x710F );
349 ModRM( 3, 2 , to );
350 write8( from );
351 }
352
PSRLDItoR(x86MMXRegType to,u8 from)353 void PSRLDItoR( x86MMXRegType to, u8 from )
354 {
355 RexB(0, to);
356 write16( 0x720F );
357 ModRM( 3, 2 , to );
358 write8( from );
359 }
360
PSRLDRtoR(x86MMXRegType to,x86MMXRegType from)361 void PSRLDRtoR( x86MMXRegType to, x86MMXRegType from )
362 {
363 RexRB(0, to, from);
364 write16( 0xD20F );
365 ModRM( 3, to, from );
366 }
367
PSLLWItoR(x86MMXRegType to,u8 from)368 void PSLLWItoR( x86MMXRegType to, u8 from )
369 {
370 RexB(0, to);
371 write16( 0x710F );
372 ModRM( 3, 6 , to );
373 write8( from );
374 }
375
PSLLDItoR(x86MMXRegType to,u8 from)376 void PSLLDItoR( x86MMXRegType to, u8 from )
377 {
378 RexB(0, to);
379 write16( 0x720F );
380 ModRM( 3, 6 , to );
381 write8( from );
382 }
383
PSLLDRtoR(x86MMXRegType to,x86MMXRegType from)384 void PSLLDRtoR( x86MMXRegType to, x86MMXRegType from )
385 {
386 RexRB(0, to, from);
387 write16( 0xF20F );
388 ModRM( 3, to, from );
389 }
390
PSRAWItoR(x86MMXRegType to,u8 from)391 void PSRAWItoR( x86MMXRegType to, u8 from )
392 {
393 RexB(0, to);
394 write16( 0x710F );
395 ModRM( 3, 4 , to );
396 write8( from );
397 }
398
PSRADItoR(x86MMXRegType to,u8 from)399 void PSRADItoR( x86MMXRegType to, u8 from )
400 {
401 RexB(0, to);
402 write16( 0x720F );
403 ModRM( 3, 4 , to );
404 write8( from );
405 }
406
PSRADRtoR(x86MMXRegType to,x86MMXRegType from)407 void PSRADRtoR( x86MMXRegType to, x86MMXRegType from )
408 {
409 RexRB(0, to, from);
410 write16( 0xE20F );
411 ModRM( 3, to, from );
412 }
413
414 /* por m64 to r64 */
PORMtoR(x86MMXRegType to,uptr from)415 void PORMtoR( x86MMXRegType to, uptr from )
416 {
417 MEMADDR_OP(0, VAROP2(0x0F, 0xEB), true, to, from, 0);
418 }
419
420 /* pxor m64 to r64 */
PXORMtoR(x86MMXRegType to,uptr from)421 void PXORMtoR( x86MMXRegType to, uptr from )
422 {
423 MEMADDR_OP(0, VAROP2(0x0F, 0xEF), true, to, from, 0);
424 }
425
426 /* pand m64 to r64 */
PANDMtoR(x86MMXRegType to,uptr from)427 void PANDMtoR( x86MMXRegType to, uptr from )
428 {
429 MEMADDR_OP(0, VAROP2(0x0F, 0xDB), true, to, from, 0);
430 }
431
PANDNMtoR(x86MMXRegType to,uptr from)432 void PANDNMtoR( x86MMXRegType to, uptr from )
433 {
434 MEMADDR_OP(0, VAROP2(0x0F, 0xDF), true, to, from, 0);
435 }
436
PUNPCKHDQRtoR(x86MMXRegType to,x86MMXRegType from)437 void PUNPCKHDQRtoR( x86MMXRegType to, x86MMXRegType from )
438 {
439 RexRB(0, to, from);
440 write16( 0x6A0F );
441 ModRM( 3, to, from );
442 }
443
PUNPCKHDQMtoR(x86MMXRegType to,uptr from)444 void PUNPCKHDQMtoR( x86MMXRegType to, uptr from )
445 {
446 MEMADDR_OP(0, VAROP2(0x0F, 0x6A), true, to, from, 0);
447 }
448
PUNPCKLDQRtoR(x86MMXRegType to,x86MMXRegType from)449 void PUNPCKLDQRtoR( x86MMXRegType to, x86MMXRegType from )
450 {
451 RexRB(0, to, from);
452 write16( 0x620F );
453 ModRM( 3, to, from );
454 }
455
PUNPCKLDQMtoR(x86MMXRegType to,uptr from)456 void PUNPCKLDQMtoR( x86MMXRegType to, uptr from )
457 {
458 MEMADDR_OP(0, VAROP2(0x0F, 0x62), true, to, from, 0);
459 }
460
MOVQ64ItoR(x86MMXRegType reg,u64 i)461 void MOVQ64ItoR( x86MMXRegType reg, u64 i )
462 {
463 RexR(0, reg);
464 write16(0x6F0F);
465 ModRM(0, reg, DISP32);
466 write32(2);
467 JMP8( 8 );
468 write64( i );
469 }
470
MOVQRtoR(x86MMXRegType to,x86MMXRegType from)471 void MOVQRtoR( x86MMXRegType to, x86MMXRegType from )
472 {
473 RexRB(0, to, from);
474 write16( 0x6F0F );
475 ModRM( 3, to, from );
476 }
477
MOVQRmtoROffset(x86MMXRegType to,x86IntRegType from,u32 offset)478 void MOVQRmtoROffset( x86MMXRegType to, x86IntRegType from, u32 offset )
479 {
480 RexRB(0, to, from);
481 write16( 0x6F0F );
482
483 if( offset < 128 ) {
484 ModRM( 1, to, from );
485 write8(offset);
486 }
487 else {
488 ModRM( 2, to, from );
489 write32(offset);
490 }
491 }
492
MOVQRtoRmOffset(x86IntRegType to,x86MMXRegType from,u32 offset)493 void MOVQRtoRmOffset( x86IntRegType to, x86MMXRegType from, u32 offset )
494 {
495 RexRB(0, from, to);
496 write16( 0x7F0F );
497
498 if( offset < 128 ) {
499 ModRM( 1, from , to );
500 write8(offset);
501 }
502 else {
503 ModRM( 2, from, to );
504 write32(offset);
505 }
506 }
507
508 /* movd m32 to r64 */
MOVDMtoMMX(x86MMXRegType to,uptr from)509 void MOVDMtoMMX( x86MMXRegType to, uptr from )
510 {
511 MEMADDR_OP(0, VAROP2(0x0F, 0x6E), true, to, from, 0);
512 }
513
514 /* movd r64 to m32 */
MOVDMMXtoM(uptr to,x86MMXRegType from)515 void MOVDMMXtoM( uptr to, x86MMXRegType from )
516 {
517 MEMADDR_OP(0, VAROP2(0x0F, 0x7E), true, from, to, 0);
518 }
519
MOVD32RtoMMX(x86MMXRegType to,x86IntRegType from)520 void MOVD32RtoMMX( x86MMXRegType to, x86IntRegType from )
521 {
522 RexRB(0, to, from);
523 write16( 0x6E0F );
524 ModRM( 3, to, from );
525 }
526
MOVD32RmtoMMX(x86MMXRegType to,x86IntRegType from)527 void MOVD32RmtoMMX( x86MMXRegType to, x86IntRegType from )
528 {
529 RexRB(0, to, from);
530 write16( 0x6E0F );
531 ModRM( 0, to, from );
532 }
533
MOVD32RmOffsettoMMX(x86MMXRegType to,x86IntRegType from,u32 offset)534 void MOVD32RmOffsettoMMX( x86MMXRegType to, x86IntRegType from, u32 offset )
535 {
536 RexRB(0, to, from);
537 write16( 0x6E0F );
538
539 if( offset < 128 ) {
540 ModRM( 1, to, from );
541 write8(offset);
542 }
543 else {
544 ModRM( 2, to, from );
545 write32(offset);
546 }
547 }
548
MOVD32MMXtoR(x86IntRegType to,x86MMXRegType from)549 void MOVD32MMXtoR( x86IntRegType to, x86MMXRegType from )
550 {
551 RexRB(0, from, to);
552 write16( 0x7E0F );
553 ModRM( 3, from, to );
554 }
555
MOVD32MMXtoRm(x86IntRegType to,x86MMXRegType from)556 void MOVD32MMXtoRm( x86IntRegType to, x86MMXRegType from )
557 {
558 RexRB(0, from, to);
559 write16( 0x7E0F );
560 ModRM( 0, from, to );
561 if( to >= 4 ) {
562 // no idea why
563 assert( to == ESP );
564 write8(0x24);
565 }
566
567 }
568
MOVD32MMXtoRmOffset(x86IntRegType to,x86MMXRegType from,u32 offset)569 void MOVD32MMXtoRmOffset( x86IntRegType to, x86MMXRegType from, u32 offset )
570 {
571 RexRB(0, from, to);
572 write16( 0x7E0F );
573
574 if( offset < 128 ) {
575 ModRM( 1, from, to );
576 write8(offset);
577 }
578 else {
579 ModRM( 2, from, to );
580 write32(offset);
581 }
582 }
583
584 ///* movd r32 to r64 */
585 //void MOVD32MMXtoMMX( x86MMXRegType to, x86MMXRegType from )
586 //{
587 // write16( 0x6E0F );
588 // ModRM( 3, to, from );
589 //}
590 //
591 ///* movq r64 to r32 */
592 //void MOVD64MMXtoMMX( x86MMXRegType to, x86MMXRegType from )
593 //{
594 // write16( 0x7E0F );
595 // ModRM( 3, from, to );
596 //}
597
598 // untested
PACKSSWBMMXtoMMX(x86MMXRegType to,x86MMXRegType from)599 void PACKSSWBMMXtoMMX(x86MMXRegType to, x86MMXRegType from)
600 {
601 RexRB(0, to, from);
602 write16( 0x630F );
603 ModRM( 3, to, from );
604 }
605
PACKSSDWMMXtoMMX(x86MMXRegType to,x86MMXRegType from)606 void PACKSSDWMMXtoMMX(x86MMXRegType to, x86MMXRegType from)
607 {
608 RexRB(0, to, from);
609 write16( 0x6B0F );
610 ModRM( 3, to, from );
611 }
612
PMOVMSKBMMXtoR(x86IntRegType to,x86MMXRegType from)613 void PMOVMSKBMMXtoR(x86IntRegType to, x86MMXRegType from)
614 {
615 RexRB(0, to, from);
616 write16( 0xD70F );
617 ModRM( 3, to, from );
618 }
619
PINSRWRtoMMX(x86MMXRegType to,x86SSERegType from,u8 imm8)620 void PINSRWRtoMMX( x86MMXRegType to, x86SSERegType from, u8 imm8 )
621 {
622 RexRB(0, to, from);
623 write16( 0xc40f );
624 ModRM( 3, to, from );
625 write8( imm8 );
626 }
627
PSHUFWRtoR(x86MMXRegType to,x86MMXRegType from,u8 imm8)628 void PSHUFWRtoR(x86MMXRegType to, x86MMXRegType from, u8 imm8)
629 {
630 RexRB(0, to, from);
631 write16(0x700f);
632 ModRM( 3, to, from );
633 write8(imm8);
634 }
635
PSHUFWMtoR(x86MMXRegType to,uptr from,u8 imm8)636 void PSHUFWMtoR(x86MMXRegType to, uptr from, u8 imm8)
637 {
638 MEMADDR_OP(0, VAROP2(0x0F, 0x70), true, to, from, 1 /* XXX was 0? */);
639 write8(imm8);
640 }
641
MASKMOVQRtoR(x86MMXRegType to,x86MMXRegType from)642 void MASKMOVQRtoR(x86MMXRegType to, x86MMXRegType from)
643 {
644 RexRB(0, to, from);
645 write16(0xf70f);
646 ModRM( 3, to, from );
647 }
648
649 #endif
650
651 #endif
652