1 // RUN: llvm-mc -triple i386-unknown-unknown --show-encoding %s | FileCheck %s
5 // CHECK: encoding: [0xf3,0x90]
8 // CHECK: encoding: [0x0f,0xae,0xf8]
11 // CHECK: encoding: [0x0f,0xae,0xe8]
14 // CHECK: encoding: [0x0f,0xae,0xf0]
17 // CHECK: encoding: [0x0f,0x01,0xc8]
18 monitor %eax, %ecx, %edx
20 // CHECK: encoding: [0x0f,0x01,0xc8]
23 // CHECK: encoding: [0x0f,0x01,0xc9]
26 // CHECK: encoding: [0x0f,0x01,0xc9]
30 // CHECK: encoding: [0x0f,0x01,0xc1]
33 // CHECK: encoding: [0x0f,0x01,0xc2]
36 // CHECK: encoding: [0x0f,0x01,0xc3]
39 // CHECK: encoding: [0x0f,0x01,0xc4]
42 // CHECK: encoding: [0x0f,0x01,0xf8]
46 // CHECK: encoding: [0x0f,0x01,0xf9]
49 // CHECK: movl %eax, 16(%ebp) # encoding: [0x89,0x45,0x10]
51 // CHECK: movl %eax, -16(%ebp) # encoding: [0x89,0x45,0xf0]
54 // CHECK: testb %bl, %cl # encoding: [0x84,0xcb]
57 // CHECK: cmpl %eax, %ebx # encoding: [0x39,0xc3]
60 // CHECK: addw %ax, %ax # encoding: [0x66,0x01,0xc0]
63 // CHECK: shrl %eax # encoding: [0xd1,0xe8]
66 // CHECK: shll %eax # encoding: [0xd1,0xe0]
68 // CHECK: shll %eax # encoding: [0xd1,0xe0]
71 // moffset forms of moves, rdar://7947184
72 movb 0, %al // CHECK: movb 0, %al # encoding: [0xa0,A,A,A,A]
73 movw 0, %ax // CHECK: movw 0, %ax # encoding: [0x66,0xa1,A,A,A,A]
74 movl 0, %eax // CHECK: movl 0, %eax # encoding: [0xa1,A,A,A,A]
79 // CHECK: encoding: [0xce]
82 // CHECK: encoding: [0xcc]
85 // CHECK: encoding: [0xcd,0x04]
88 // CHECK: encoding: [0xcd,0xff]
90 // CHECK: pushfl # encoding: [0x9c]
92 // CHECK: pushfl # encoding: [0x9c]
94 // CHECK: popfl # encoding: [0x9d]
96 // CHECK: popfl # encoding: [0x9d]
102 // CHECK: encoding: [0xc3]
105 // CHECK: cmoval %eax, %edx
106 // CHECK: encoding: [0x0f,0x47,0xd0]
109 // CHECK: cmovael %eax, %edx
110 // CHECK: encoding: [0x0f,0x43,0xd0]
113 // CHECK: cmovbel %eax, %edx
114 // CHECK: encoding: [0x0f,0x46,0xd0]
117 // CHECK: cmovbl %eax, %edx
118 // CHECK: encoding: [0x0f,0x42,0xd0]
121 // CHECK: cmovbw %bx, %bx
125 // CHECK: cmovbel %eax, %edx
126 // CHECK: encoding: [0x0f,0x46,0xd0]
129 // CHECK: cmovbl %eax, %edx
130 // CHECK: encoding: [0x0f,0x42,0xd0]
133 // CHECK: cmovel %eax, %edx
134 // CHECK: encoding: [0x0f,0x44,0xd0]
137 // CHECK: cmovgl %eax, %edx
138 // CHECK: encoding: [0x0f,0x4f,0xd0]
141 // CHECK: cmovgel %eax, %edx
142 // CHECK: encoding: [0x0f,0x4d,0xd0]
145 // CHECK: cmovll %eax, %edx
146 // CHECK: encoding: [0x0f,0x4c,0xd0]
149 // CHECK: cmovlel %eax, %edx
150 // CHECK: encoding: [0x0f,0x4e,0xd0]
153 // CHECK: cmovbel %eax, %edx
154 // CHECK: encoding: [0x0f,0x46,0xd0]
157 // CHECK: cmovnel %eax, %edx
158 // CHECK: encoding: [0x0f,0x45,0xd0]
161 // CHECK: cmovael %eax, %edx
162 // CHECK: encoding: [0x0f,0x43,0xd0]
165 // CHECK: cmoval %eax, %edx
166 // CHECK: encoding: [0x0f,0x47,0xd0]
169 // CHECK: cmovael %eax, %edx
170 // CHECK: encoding: [0x0f,0x43,0xd0]
173 // CHECK: cmovnel %eax, %edx
174 // CHECK: encoding: [0x0f,0x45,0xd0]
177 // CHECK: cmovlel %eax, %edx
178 // CHECK: encoding: [0x0f,0x4e,0xd0]
181 // CHECK: cmovgel %eax, %edx
182 // CHECK: encoding: [0x0f,0x4d,0xd0]
185 // CHECK: cmovnel %eax, %edx
186 // CHECK: encoding: [0x0f,0x45,0xd0]
189 // CHECK: cmovlel %eax, %edx
190 // CHECK: encoding: [0x0f,0x4e,0xd0]
193 // CHECK: cmovll %eax, %edx
194 // CHECK: encoding: [0x0f,0x4c,0xd0]
197 // CHECK: cmovgel %eax, %edx
198 // CHECK: encoding: [0x0f,0x4d,0xd0]
201 // CHECK: cmovgl %eax, %edx
202 // CHECK: encoding: [0x0f,0x4f,0xd0]
205 // CHECK: cmovnol %eax, %edx
206 // CHECK: encoding: [0x0f,0x41,0xd0]
209 // CHECK: cmovnpl %eax, %edx
210 // CHECK: encoding: [0x0f,0x4b,0xd0]
213 // CHECK: cmovnsl %eax, %edx
214 // CHECK: encoding: [0x0f,0x49,0xd0]
217 // CHECK: cmovnel %eax, %edx
218 // CHECK: encoding: [0x0f,0x45,0xd0]
221 // CHECK: cmovol %eax, %edx
222 // CHECK: encoding: [0x0f,0x40,0xd0]
225 // CHECK: cmovpl %eax, %edx
226 // CHECK: encoding: [0x0f,0x4a,0xd0]
229 // CHECK: cmovsl %eax, %edx
230 // CHECK: encoding: [0x0f,0x48,0xd0]
233 // CHECK: cmovel %eax, %edx
234 // CHECK: encoding: [0x0f,0x44,0xd0]
237 // CHECK: cmpps $0, %xmm0, %xmm1
238 // CHECK: encoding: [0x0f,0xc2,0xc8,0x00]
239 cmpps $0, %xmm0, %xmm1
240 // CHECK: cmpps $0, (%eax), %xmm1
241 // CHECK: encoding: [0x0f,0xc2,0x08,0x00]
242 cmpps $0, 0(%eax), %xmm1
243 // CHECK: cmppd $0, %xmm0, %xmm1
244 // CHECK: encoding: [0x66,0x0f,0xc2,0xc8,0x00]
245 cmppd $0, %xmm0, %xmm1
246 // CHECK: cmppd $0, (%eax), %xmm1
247 // CHECK: encoding: [0x66,0x0f,0xc2,0x08,0x00]
248 cmppd $0, 0(%eax), %xmm1
249 // CHECK: cmpss $0, %xmm0, %xmm1
250 // CHECK: encoding: [0xf3,0x0f,0xc2,0xc8,0x00]
251 cmpss $0, %xmm0, %xmm1
252 // CHECK: cmpss $0, (%eax), %xmm1
253 // CHECK: encoding: [0xf3,0x0f,0xc2,0x08,0x00]
254 cmpss $0, 0(%eax), %xmm1
255 // CHECK: cmpsd $0, %xmm0, %xmm1
256 // CHECK: encoding: [0xf2,0x0f,0xc2,0xc8,0x00]
257 cmpsd $0, %xmm0, %xmm1
258 // CHECK: cmpsd $0, (%eax), %xmm1
259 // CHECK: encoding: [0xf2,0x0f,0xc2,0x08,0x00]
260 cmpsd $0, 0(%eax), %xmm1
262 // Check matching of instructions which embed the SSE comparison code.
264 // CHECK: cmpps $0, %xmm0, %xmm1
265 // CHECK: encoding: [0x0f,0xc2,0xc8,0x00]
268 // CHECK: cmppd $1, %xmm0, %xmm1
269 // CHECK: encoding: [0x66,0x0f,0xc2,0xc8,0x01]
272 // CHECK: cmpss $2, %xmm0, %xmm1
273 // CHECK: encoding: [0xf3,0x0f,0xc2,0xc8,0x02]
276 // CHECK: cmppd $3, %xmm0, %xmm1
277 // CHECK: encoding: [0x66,0x0f,0xc2,0xc8,0x03]
278 cmpunordpd %xmm0, %xmm1
280 // CHECK: cmpps $4, %xmm0, %xmm1
281 // CHECK: encoding: [0x0f,0xc2,0xc8,0x04]
282 cmpneqps %xmm0, %xmm1
284 // CHECK: cmppd $5, %xmm0, %xmm1
285 // CHECK: encoding: [0x66,0x0f,0xc2,0xc8,0x05]
286 cmpnltpd %xmm0, %xmm1
288 // CHECK: cmpss $6, %xmm0, %xmm1
289 // CHECK: encoding: [0xf3,0x0f,0xc2,0xc8,0x06]
290 cmpnless %xmm0, %xmm1
292 // CHECK: cmpsd $7, %xmm0, %xmm1
293 // CHECK: encoding: [0xf2,0x0f,0xc2,0xc8,0x07]
294 cmpordsd %xmm0, %xmm1
297 // CHECK: fmul %st(0)
298 // CHECK: encoding: [0xd8,0xc8]
301 // CHECK: fadd %st(0)
302 // CHECK: encoding: [0xd8,0xc0]
305 // CHECK: fsub %st(0)
306 // CHECK: encoding: [0xd8,0xe0]
309 // CHECK: fsubr %st(0)
310 // CHECK: encoding: [0xd8,0xe8]
313 // CHECK: fdivr %st(0)
314 // CHECK: encoding: [0xd8,0xf8]
317 // CHECK: fdiv %st(0)
318 // CHECK: encoding: [0xd8,0xf0]
322 // CHECK: movl %cs, %eax
323 // CHECK: encoding: [0x8c,0xc8]
326 // CHECK: movw %cs, %ax
327 // CHECK: encoding: [0x66,0x8c,0xc8]
330 // CHECK: movl %cs, (%eax)
331 // CHECK: encoding: [0x8c,0x08]
334 // CHECK: movw %cs, (%eax)
335 // CHECK: encoding: [0x66,0x8c,0x08]
338 // CHECK: movl %eax, %cs
339 // CHECK: encoding: [0x8e,0xc8]
342 // CHECK: movl (%eax), %cs
343 // CHECK: encoding: [0x8e,0x08]
346 // CHECK: movw (%eax), %cs
347 // CHECK: encoding: [0x66,0x8e,0x08]
351 // CHECK: movl %cr0, %eax
352 // CHECK: encoding: [0x0f,0x20,0xc0]
355 // CHECK: movl %cr1, %eax
356 // CHECK: encoding: [0x0f,0x20,0xc8]
359 // CHECK: movl %cr2, %eax
360 // CHECK: encoding: [0x0f,0x20,0xd0]
363 // CHECK: movl %cr3, %eax
364 // CHECK: encoding: [0x0f,0x20,0xd8]
367 // CHECK: movl %cr4, %eax
368 // CHECK: encoding: [0x0f,0x20,0xe0]
371 // CHECK: movl %dr0, %eax
372 // CHECK: encoding: [0x0f,0x21,0xc0]
375 // CHECK: movl %dr1, %eax
376 // CHECK: encoding: [0x0f,0x21,0xc8]
379 // CHECK: movl %dr1, %eax
380 // CHECK: encoding: [0x0f,0x21,0xc8]
383 // CHECK: movl %dr2, %eax
384 // CHECK: encoding: [0x0f,0x21,0xd0]
387 // CHECK: movl %dr3, %eax
388 // CHECK: encoding: [0x0f,0x21,0xd8]
391 // CHECK: movl %dr4, %eax
392 // CHECK: encoding: [0x0f,0x21,0xe0]
395 // CHECK: movl %dr5, %eax
396 // CHECK: encoding: [0x0f,0x21,0xe8]
399 // CHECK: movl %dr6, %eax
400 // CHECK: encoding: [0x0f,0x21,0xf0]
403 // CHECK: movl %dr7, %eax
404 // CHECK: encoding: [0x0f,0x21,0xf8]
409 // CHECK: encoding: [0x9b]
413 // CHECK: [0x65,0x8b,0x05,0x7c,0x00,0x00,0x00]
414 // FIXME: This is a correct bug poor encoding: Use 65 a1 7c 00 00 00
418 // CHECK: encoding: [0x60]
422 // CHECK: encoding: [0x61]
426 // CHECK: encoding: [0x60]
430 // CHECK: encoding: [0x61]
433 // CHECK: jmpl *8(%eax)
434 // CHECK: encoding: [0xff,0x60,0x08]
438 // CHECK: lcalll $2, $4660
439 // CHECK: encoding: [0x9a,0x34,0x12,0x00,0x00,0x02,0x00]
447 // CHECK: encoding: [0x67,0xe3,A]
450 // CHECK: encoding: [0xe3,A]
455 // CHECK: encoding: [0xcf]
458 // CHECK: encoding: [0x66,0xcf]
461 // CHECK: encoding: [0xcf]
466 // CHECK: encoding: [0x0f,0x07]
469 // CHECK: encoding: [0x0f,0x07]
472 testl %ecx, -24(%ebp)
473 // CHECK: testl -24(%ebp), %ecx
474 testl -24(%ebp), %ecx
475 // CHECK: testl -24(%ebp), %ecx
481 // CHECK: encoding: [0x0e]
484 // CHECK: encoding: [0x1e]
487 // CHECK: encoding: [0x16]
490 // CHECK: encoding: [0x06]
493 // CHECK: encoding: [0x0f,0xa0]
496 // CHECK: encoding: [0x0f,0xa8]
500 // CHECK: encoding: [0x66,0x0e]
503 // CHECK: encoding: [0x66,0x1e]
506 // CHECK: encoding: [0x66,0x16]
509 // CHECK: encoding: [0x66,0x06]
512 // CHECK: encoding: [0x66,0x0f,0xa0]
515 // CHECK: encoding: [0x66,0x0f,0xa8]
519 // CHECK: encoding: [0x17]
522 // CHECK: encoding: [0x1f]
525 // CHECK: encoding: [0x07]
553 setneb %cl // CHECK: setne %cl
554 setcb %bl // CHECK: setb %bl
555 setnaeb %bl // CHECK: setb %bl
558 // CHECK: lcalll $31438, $31438
559 // CHECK: lcalll $31438, $31438
560 // CHECK: ljmpl $31438, $31438
561 // CHECK: ljmpl $31438, $31438
563 calll $0x7ace,$0x7ace
564 lcalll $0x7ace,$0x7ace
566 ljmpl $0x7ace,$0x7ace
568 // CHECK: lcalll $31438, $31438
569 // CHECK: lcalll $31438, $31438
570 // CHECK: ljmpl $31438, $31438
571 // CHECK: ljmpl $31438, $31438
574 lcall $0x7ace,$0x7ace
582 // CHECK: incb %al # encoding: [0xfe,0xc0]
585 // CHECK: incw %ax # encoding: [0x66,0x40]
588 // CHECK: incl %eax # encoding: [0x40]
591 // CHECK: decb %al # encoding: [0xfe,0xc8]
594 // CHECK: decw %ax # encoding: [0x66,0x48]
597 // CHECK: decl %eax # encoding: [0x48]
600 // CHECK: pshufw $14, %mm4, %mm0 # encoding: [0x0f,0x70,0xc4,0x0e]
601 pshufw $14, %mm4, %mm0
603 // CHECK: pshufw $90, %mm4, %mm0 # encoding: [0x0f,0x70,0xc4,0x5a]
605 pshufw $90, %mm4, %mm0
609 // CHECK: encoding: [0x37]
613 // CHECK: encoding: [0xd5,0x01]
617 // CHECK: encoding: [0xd5,0x0a]
621 // CHECK: encoding: [0xd5,0x0a]
625 // CHECK: encoding: [0xd4,0x02]
629 // CHECK: encoding: [0xd4,0x0a]
633 // CHECK: encoding: [0xd4,0x0a]
637 // CHECK: encoding: [0x3f]
641 // CHECK: encoding: [0x27]
645 // CHECK: encoding: [0x2f]
648 // CHECK: retw $31438
649 // CHECK: encoding: [0x66,0xc2,0xce,0x7a]
652 // CHECK: lretw $31438
653 // CHECK: encoding: [0x66,0xca,0xce,0x7a]
656 // CHECK: bound 2(%eax), %bx
657 // CHECK: encoding: [0x66,0x62,0x58,0x02]
660 // CHECK: bound 4(%ebx), %ecx
661 // CHECK: encoding: [0x62,0x4b,0x04]
664 // CHECK: arpl %bx, %bx
665 // CHECK: encoding: [0x63,0xdb]
668 // CHECK: arpl %bx, 6(%ecx)
669 // CHECK: encoding: [0x63,0x59,0x06]
672 // CHECK: lgdtw 4(%eax)
673 // CHECK: encoding: [0x66,0x0f,0x01,0x50,0x04]
676 // CHECK: lgdt 4(%eax)
677 // CHECK: encoding: [0x0f,0x01,0x50,0x04]
680 // CHECK: lgdt 4(%eax)
681 // CHECK: encoding: [0x0f,0x01,0x50,0x04]
684 // CHECK: lidtw 4(%eax)
685 // CHECK: encoding: [0x66,0x0f,0x01,0x58,0x04]
688 // CHECK: lidt 4(%eax)
689 // CHECK: encoding: [0x0f,0x01,0x58,0x04]
692 // CHECK: lidt 4(%eax)
693 // CHECK: encoding: [0x0f,0x01,0x58,0x04]
696 // CHECK: sgdtw 4(%eax)
697 // CHECK: encoding: [0x66,0x0f,0x01,0x40,0x04]
700 // CHECK: sgdt 4(%eax)
701 // CHECK: encoding: [0x0f,0x01,0x40,0x04]
704 // CHECK: sgdt 4(%eax)
705 // CHECK: encoding: [0x0f,0x01,0x40,0x04]
708 // CHECK: sidtw 4(%eax)
709 // CHECK: encoding: [0x66,0x0f,0x01,0x48,0x04]
712 // CHECK: sidt 4(%eax)
713 // CHECK: encoding: [0x0f,0x01,0x48,0x04]
716 // CHECK: sidt 4(%eax)
717 // CHECK: encoding: [0x0f,0x01,0x48,0x04]
720 // CHECK: fcompi %st(2)
721 // CHECK: encoding: [0xdf,0xf2]
724 // CHECK: fcompi %st(2)
725 // CHECK: encoding: [0xdf,0xf2]
729 // CHECK: encoding: [0xdf,0xf1]
732 // CHECK: fucompi %st(2)
733 // CHECK: encoding: [0xdf,0xea]
736 // CHECK: fucompi %st(2)
737 // CHECK: encoding: [0xdf,0xea]
741 // CHECK: encoding: [0xdf,0xe9]
744 // CHECK: fldcw 32493
745 // CHECK: encoding: [0xd9,0x2d,0xed,0x7e,0x00,0x00]
748 // CHECK: fldcw 32493
749 // CHECK: encoding: [0xd9,0x2d,0xed,0x7e,0x00,0x00]
752 // CHECK: fnstcw 32493
753 // CHECK: encoding: [0xd9,0x3d,0xed,0x7e,0x00,0x00]
756 // CHECK: fnstcw 32493
757 // CHECK: encoding: [0xd9,0x3d,0xed,0x7e,0x00,0x00]
761 // CHECK: encoding: [0x9b]
765 // CHECK: encoding: [0x9b]
768 // CHECK: fnstsw 32493
769 // CHECK: encoding: [0xdd,0x3d,0xed,0x7e,0x00,0x00]
772 // CHECK: fnstsw 32493
773 // CHECK: encoding: [0xdd,0x3d,0xed,0x7e,0x00,0x00]
777 // CHECK: encoding: [0x9b]
781 // CHECK: encoding: [0x9b]
785 // CHECK: encoding: [0x0f,0x00,0x25,0xed,0x7e,0x00,0x00]
789 // CHECK: encoding: [0x0f,0x00,0x25,0xed,0x7e,0x00,0x00]
793 // CHECK: encoding: [0x9b]
797 // CHECK: encoding: [0xdb,0xe2]
801 // CHECK: encoding: [0x0f,0x0b]
805 // CHECK: encoding: [0x0f,0x0b]
809 // CHECK: encoding: [0x0f,0xb9]
813 // CHECK: encoding: [0xe1,A]
817 // CHECK: encoding: [0xe0,A]
820 // CHECK: outsb # encoding: [0x6e]
824 outsb %ds:(%esi), %dx
827 // CHECK: outsw # encoding: [0x66,0x6f]
831 outsw %ds:(%esi), %dx
834 // CHECK: outsl # encoding: [0x6f]
837 outsl %ds:(%esi), %dx
840 // CHECK: insb # encoding: [0x6c]
845 // CHECK: insw # encoding: [0x66,0x6d]
850 // CHECK: insl # encoding: [0x6d]
855 // CHECK: movsb # encoding: [0xa4]
859 movsb %ds:(%esi), %es:(%edi)
860 movsb (%esi), %es:(%edi)
862 // CHECK: movsw # encoding: [0x66,0xa5]
866 movsw %ds:(%esi), %es:(%edi)
867 movsw (%esi), %es:(%edi)
869 // CHECK: movsd # encoding: [0xa5]
873 movsl %ds:(%esi), %es:(%edi)
874 movsl (%esi), %es:(%edi)
876 // CHECK: lodsb # encoding: [0xac]
882 lodsb %ds:(%esi), %al
887 // CHECK: lodsw # encoding: [0x66,0xad]
893 lodsw %ds:(%esi), %ax
898 // CHECK: lodsl # encoding: [0xad]
904 lodsl %ds:(%esi), %eax
906 lods %ds:(%esi), %eax
909 // CHECK: stosb # encoding: [0xaa]
913 stosb %al, %es:(%edi)
916 // CHECK: stosw # encoding: [0x66,0xab]
920 stosw %ax, %es:(%edi)
923 // CHECK: stosl # encoding: [0xab]
927 stosl %eax, %es:(%edi)
928 stos %eax, %es:(%edi)
931 // CHECK: encoding: [0x66,0x0f,0x00,0xc8]
935 // CHECK: encoding: [0x0f,0x00,0xc8]
941 // CHECK: encoding: [0xde,0xe1]
945 // CHECK: fsubp %st(2)
946 // CHECK: encoding: [0xde,0xe2]
950 // CHECK: xchgl %eax, %eax
951 // CHECK: encoding: [0x87,0xc0]
954 // CHECK: xchgw %ax, %ax
955 // CHECK: encoding: [0x66,0x87,0xc0]
958 // CHECK: xchgl %ecx, %eax
959 // CHECK: encoding: [0x91]
962 // CHECK: xchgl %ecx, %eax
963 // CHECK: encoding: [0x91]