History

[x86] Fix some asm problems

A bag of assembler fixes, to be either compatible with GAS (e.g. order of 'test' operands), accept more instructions, count correct foo{bwlq} variants on x86_64, fix modrm/sib bytes on x86_64 to not use %rip relative addressing mode, to not use invalid insns in tests/asmtest.S for x86_64. Result is that now output of GAS and of tcc on tests/asmtest.S is mostly the same.

Michael Matz committed 10 years ago

Commit 5e47b081 parent f5f82ab5 files · +168 −47Browse files

Unified · Split

5 files
  1. i386-asm.c +71 −16
  2. i386-asm.h +1 −1
  3. i386-tok.h +3 −7
  4. tests/asmtest.S +67 −8
  5. x86_64-asm.h +26 −15
i386-asm.c+71−16
@@ -115,11 +115,13 @@ enum { · 114 unmodified lines
115115 #define OP_ADDR (1 << OPT_ADDR)
116116 #define OP_INDIR (1 << OPT_INDIR)
117117 #ifdef TCC_TARGET_X86_64
118−# define OP_REG64 (1 << OPT_REG64)
119−# define OP_IM64 (1 << OPT_IM64)
118+# define OP_REG64 (1 << OPT_REG64)
119+# define OP_IM64 (1 << OPT_IM64)
120+# define OP_EA32 (OP_EA << 1)
120121 #else
121122 # define OP_REG64 0
122123 # define OP_IM64 0
124+# define OP_EA32 0
123125 #endif
124126
125127 #define OP_EA 0x40000000
@@ -268,15 +270,17 @@ static inline int get_reg_shift(TCCState *s1) · 142 unmodified lines
268270 return shift;
269271 }
270272
271−static int asm_parse_reg(void)
273+static int asm_parse_reg(int *type)
272274 {
273275 int reg = 0;
276+ *type = 0;
274277 if (tok != '%')
275278 goto error_32;
276279 next();
277280 if (tok >= TOK_ASM_eax && tok <= TOK_ASM_edi) {
278281 reg = tok - TOK_ASM_eax;
279282 #ifdef TCC_TARGET_X86_64
283+ *type = OP_EA32;
280284 } else if (tok >= TOK_ASM_rax && tok <= TOK_ASM_rdi) {
281285 reg = tok - TOK_ASM_rax;
282286 #endif
@@ -393,20 +397,23 @@ static void parse_operand(TCCState *s1, Operand *op) · 110 unmodified lines
393397 }
394398 }
395399 if (tok == '(') {
400+ int type = 0;
396401 next();
397402 if (tok != ',') {
398− op->reg = asm_parse_reg();
403+ op->reg = asm_parse_reg(&type);
399404 }
400405 if (tok == ',') {
401406 next();
402407 if (tok != ',') {
403− op->reg2 = asm_parse_reg();
408+ op->reg2 = asm_parse_reg(&type);
404409 }
405410 if (tok == ',') {
406411 next();
407412 op->shift = get_reg_shift(s1);
408413 }
409414 }
415+ if (type & OP_EA32)
416+ op->type |= OP_EA32;
410417 skip(')');
411418 }
412419 if (op->reg == -1 && op->reg2 == -1)
@@ -493,10 +500,15 @@ static inline void asm_modrm(int reg, Operand *op) · 80 unmodified lines
493500 gen_expr16(&op->e);
494501 } else if (tcc_state->seg_size == 32)
495502 #endif
496− {
503+ {
504+#ifdef TCC_TARGET_X86_64
505+ g(0x04 + (reg << 3));
506+ g(0x25);
507+#else
497508 g(0x05 + (reg << 3));
498− gen_expr32(&op->e);
499− }
509+#endif
510+ gen_expr32(&op->e);
511+ }
500512 } else {
501513 sib_reg1 = op->reg;
502514 /* fist compute displacement encoding */
@@ -583,6 +595,8 @@ ST_FUNC void asm_opcode(TCCState *s1, int opcode) · 80 unmodified lines
583595 int nb_ops, s;
584596 Operand ops[MAX_OPERANDS], *pop;
585597 int op_type[3]; /* decoded op type */
598+ int alltypes; /* OR of all operand types */
599+ int autosize;
586600 #ifdef I386_ASM_16
587601 static int a32 = 0, o32 = 0, addr32 = 0, data32 = 0;
588602 #endif
@@ -596,6 +610,7 @@ ST_FUNC void asm_opcode(TCCState *s1, int opcode) · 7 unmodified lines
596610 pop = ops;
597611 nb_ops = 0;
598612 seg_prefix = 0;
613+ alltypes = 0;
599614 for(;;) {
600615 if (tok == ';' || tok == TOK_LINEFEED)
601616 break;
@@ -645,6 +660,13 @@ ST_FUNC void asm_opcode(TCCState *s1, int opcode) · 43 unmodified lines
645660 if (!(opcode >= pa->sym && opcode < pa->sym + NB_TEST_OPCODES))
646661 continue;
647662 } else if (pa->instr_type & OPC_B) {
663+#ifdef TCC_TARGET_X86_64
664+ /* Some instructions don't have the full size but only
665+ bwl form. insb e.g. */
666+ if ((pa->instr_type & OPC_WLQ) != OPC_WLQ
667+ && !(opcode >= pa->sym && opcode < pa->sym + NBWLX-1))
668+ continue;
669+#endif
648670 if (!(opcode >= pa->sym && opcode < pa->sym + NBWLX))
649671 continue;
650672 s = opcode - pa->sym;
@@ -659,6 +681,7 @@ ST_FUNC void asm_opcode(TCCState *s1, int opcode) · 8 unmodified lines
659681 if (pa->nb_ops != nb_ops)
660682 continue;
661683 /* now decode and check each operand */
684+ alltypes = 0;
662685 for(i = 0; i < nb_ops; i++) {
663686 int op1, op2;
664687 op1 = pa->op_type[i];
@@ -687,9 +710,10 @@ ST_FUNC void asm_opcode(TCCState *s1, int opcode) · 22 unmodified lines
687710 }
688711 if (op1 & OPT_EA)
689712 v |= OP_EA;
690− op_type[i] = v;
713+ op_type[i] = v;
691714 if ((ops[i].type & v) == 0)
692715 goto next;
716+ alltypes |= ops[i].type;
693717 }
694718 /* all is matching ! */
695719 break;
@@ -725,12 +749,19 @@ ST_FUNC void asm_opcode(TCCState *s1, int opcode) · 29 unmodified lines
725749 }
726750 }
727751 /* if the size is unknown, then evaluate it (OPC_B or OPC_WL case) */
728− if (s == NBWLX-1) {
729− for(i = 0; s == NBWLX-1 && i < nb_ops; i++) {
752+ autosize = NBWLX-1;
753+#ifdef TCC_TARGET_X86_64
754+ /* XXX the autosize should rather be zero, to not have to adjust this
755+ all the time. */
756+ if ((pa->instr_type & OPC_WLQ) != OPC_WLQ)
757+ autosize = NBWLX-2;
758+#endif
759+ if (s == autosize) {
760+ for(i = 0; s == autosize && i < nb_ops; i++) {
730761 if ((ops[i].type & OP_REG) && !(op_type[i] & (OP_CL | OP_DX)))
731762 s = reg_to_size[ops[i].type & OP_REG];
732763 }
733− if (s == NBWLX-1) {
764+ if (s == autosize) {
734765 if ((opcode == TOK_ASM_push || opcode == TOK_ASM_pop) &&
735766 (ops[0].type & (OP_SEG | OP_IM8S | OP_IM32 | OP_IM64)))
736767 s = 2;
@@ -770,14 +801,38 @@ ST_FUNC void asm_opcode(TCCState *s1, int opcode) · 33 unmodified lines
770801
771802 addr32 = data32 = 0;
772803 #else
804+#ifdef TCC_TARGET_X86_64
805+ /* Generate addr32 prefix if needed */
806+ for(i = 0; i < nb_ops; i++) {
807+ if (ops[i].type & OP_EA32) {
808+ g(0x67);
809+ break;
810+ }
811+ }
812+#endif
773813 /* generate data16 prefix if needed */
774814 if (s == 1 || (pa->instr_type & OPC_D16))
775815 g(0x66);
776816 #ifdef TCC_TARGET_X86_64
777− else if (s == 3) {
817+ if (s == 3 || (alltypes & OP_REG64)) {
778818 /* generate REX prefix */
779− if ((opcode != TOK_ASM_push && opcode != TOK_ASM_pop)
780− || !(ops[0].type & OP_REG64))
819+ int default64 = 0;
820+ for(i = 0; i < nb_ops; i++) {
821+ if (op_type[i] == OP_REG64) {
822+ /* If only 64bit regs are accepted in one operand
823+ this is a default64 instruction without need for
824+ REX prefixes. */
825+ default64 = 1;
826+ break;
827+ }
828+ }
829+ /* XXX find better encoding for the default64 instructions. */
830+ if (((opcode != TOK_ASM_push && opcode != TOK_ASM_pop
831+ && opcode != TOK_ASM_pushw && opcode != TOK_ASM_pushl
832+ && opcode != TOK_ASM_pushq && opcode != TOK_ASM_popw
833+ && opcode != TOK_ASM_popl && opcode != TOK_ASM_popq
834+ && opcode != TOK_ASM_call && opcode != TOK_ASM_jmp))
835+ && !default64)
781836 g(0x48);
782837 }
783838 #endif
@@ -838,7 +893,7 @@ ST_FUNC void asm_opcode(TCCState *s1, int opcode) · 54 unmodified lines
838893 goto no_short_jump;
839894 if (sym->r != cur_text_section->sh_num)
840895 goto no_short_jump;
841− jmp_disp = ops[0].e.v + sym->jnext - ind - 2;
896+ jmp_disp = ops[0].e.v + sym->jnext - ind - 2 - (v >= 0xff);
842897 if (jmp_disp == (int8_t)jmp_disp) {
843898 /* OK to generate jump */
844899 is_short_jmp = 1;
i386-asm.h+1−1
@@ -165,8 +165,8 @@ ALT(DEF_ASM_OP2(addb, 0x04, 0, OPC_ARITH | OPC_BWL, OPT_IM, OPT_EAX)) · 164 unmodified lines
165165 ALT(DEF_ASM_OP2(addb, 0x80, 0, OPC_ARITH | OPC_MODRM | OPC_BWL, OPT_IM, OPT_EA | OPT_REG))
166166 ALT(DEF_ASM_OP2(addw, 0x83, 0, OPC_ARITH | OPC_MODRM | OPC_WL, OPT_IM8S, OPT_EA | OPT_REG))
167167
168−ALT(DEF_ASM_OP2(testb, 0x84, 0, OPC_MODRM | OPC_BWL, OPT_EA | OPT_REG, OPT_REG))
169168 ALT(DEF_ASM_OP2(testb, 0x84, 0, OPC_MODRM | OPC_BWL, OPT_REG, OPT_EA | OPT_REG))
169+ALT(DEF_ASM_OP2(testb, 0x84, 0, OPC_MODRM | OPC_BWL, OPT_EA | OPT_REG, OPT_REG))
170170 ALT(DEF_ASM_OP2(testb, 0xa8, 0, OPC_BWL, OPT_IM, OPT_EAX))
171171 ALT(DEF_ASM_OP2(testb, 0xf6, 0, OPC_MODRM | OPC_BWL, OPT_IM, OPT_EA | OPT_REG))
172172
i386-tok.h+3−7
@@ -126,12 +126,8 @@ · 125 unmodified lines
126126 DEF_BWLX(shr)
127127 DEF_BWLX(sar)
128128
129− DEF_ASM(shldw)
130− DEF_ASM(shldl)
131− DEF_ASM(shld)
132− DEF_ASM(shrdw)
133− DEF_ASM(shrdl)
134− DEF_ASM(shrd)
129+ DEF_WLX(shld)
130+ DEF_WLX(shrd)
135131
136132 DEF_ASM(pushw)
137133 DEF_ASM(pushl)
@@ -150,7 +146,7 @@ · 12 unmodified lines
150146 DEF_BWL(in)
151147 DEF_BWL(out)
152148
153− DEF_WL(movzb)
149+ DEF_WLX(movzb)
154150 DEF_ASM(movzwl)
155151 DEF_ASM(movsbw)
156152 DEF_ASM(movsbl)
tests/asmtest.S+67−8
@@ -38,7 +38,7 @@ mov %al, 0x10000 · 37 unmodified lines
3838
3939 mov $1, %edx
4040 mov $1, %dx
41−mov $1, %dl
41+mov $1, %cl
4242 movb $2, 0x100(%ebx,%edx,2)
4343 movw $2, 0x100(%ebx,%edx,2)
4444 movl $2, 0x100(%ebx,%edx,2)
@@ -48,12 +48,20 @@ movw %ax, 0x100(%ebx,%edx,2) · 3 unmodified lines
4848
4949 mov %eax, 0x12(,%edx,2)
5050
51+#ifdef __i386__
5152 mov %cr3, %edx
5253 mov %ecx, %cr3
5354 movl %cr3, %eax
5455 movl %tr3, %eax
5556 movl %db3, %ebx
5657 movl %dr6, %eax
58+#else
59+mov %cr3, %rdx
60+mov %rcx, %cr3
61+movq %cr3, %rax
62+movq %db3, %rbx
63+movq %dr6, %rax
64+#endif
5765 movl %fs, %ecx
5866 movl %ebx, %fs
5967
@@ -69,18 +77,28 @@ movl %ebx, %fs · 9 unmodified lines
6977 movzb 0x1000, %ax
7078
7179
80+#ifdef __i386__
7281 pushl %eax
73− pushw %ax
7482 push %eax
7583 push %cs
84+#else
85+ pushq %rax
86+ push %rax
87+#endif
88+ pushw %ax
7689 push %gs
7790 push $1
7891 push $100
7992
93+#ifdef __i386__
8094 popl %eax
81− popw %ax
8295 pop %eax
8396 pop %ds
97+#else
98+ popq %rax
99+ pop %rax
100+#endif
101+ popw %ax
84102 pop %fs
85103
86104 xchg %eax, %ecx
@@ -111,11 +129,13 @@ movl %ebx, %fs · 24 unmodified lines
111129 leal 0x1000(%ebx), %ecx
112130 lea 0x1000(%ebx), %ecx
113131
132+#ifdef __i386__
114133 les 0x2000, %eax
115134 lds 0x2000, %ebx
135+ lss 0x2000, %edx
136+#endif
116137 lfs 0x2000, %ecx
117138 lgs 0x2000, %edx
118− lss 0x2000, %edx
119139
120140 addl $0x123, %eax
121141 add $0x123, %ebx
@@ -195,7 +215,11 @@ shrd %eax, %edx · 73 unmodified lines
195215 L4:
196216 call 0x1000
197217 call L4
218+#ifdef __i386__
198219 call *%eax
220+#else
221+call *%rax
222+#endif
199223 call *0x1000
200224 call func1
201225
@@ -204,19 +228,37 @@ call func1 · 2 unmodified lines
204228 L5:
205229 L6:
206230
231+#ifdef __i386__
207232 lcall $0x100, $0x1000
233+#else
234+lcall *0x100
235+lcall *(%rax)
236+#endif
208237
209238 jmp 0x1000
239+#ifdef __i386__
210240 jmp *%eax
241+#else
242+jmp *%rax
243+#endif
211244 jmp *0x1000
212245
246+#ifdef __i386__
213247 ljmp $0x100, $0x1000
248+#else
249+ljmp *0x100
250+ljmp *(%rdi)
251+#endif
214252
215253 ret
216−retl
217−
218254 ret $10
255+#ifdef __i386__
256+retl
219257 retl $10
258+#else
259+retq
260+retq $10
261+#endif
220262
221263 lret
222264
@@ -436,8 +478,10 @@ fucomip %st(5), %st · 213 unmodified lines
436478 int $3
437479 int $0x10
438480
481+#ifdef __i386__
439482 pusha
440483 popa
484+#endif
441485 clc
442486 cld
443487 cli
@@ -445,19 +489,27 @@ int $0x10 · 1 unmodified line
445489 cmc
446490 lahf
447491 sahf
492+#ifdef __i386__
448493 pushfl
449494 popfl
495+#else
496+ pushfq
497+ popfq
498+#endif
450499 pushf
451500 popf
452501 stc
453502 std
454503 sti
504+#ifdef __i386__
455505 aaa
456506 aas
457507 daa
458508 das
459509 aad
460510 aam
511+ into
512+#endif
461513 cbw
462514 cwd
463515 cwde
@@ -468,7 +520,6 @@ int $0x10 · 4 unmodified lines
468520 cltd
469521 leave
470522 int3
471− into
472523 iret
473524 rsm
474525 hlt
@@ -558,10 +609,12 @@ int $0x10 · 83 unmodified lines
558609
559610
560611
612+#ifdef __i386__
561613 boundl %edx, 0x10000
562614 boundw %bx, 0x1000
563−
615+
564616 arpl %bx, 0x1000
617+#endif
565618 lar 0x1000, %eax
566619 lgdt 0x1000
567620 lidt 0x1000
@@ -579,15 +632,21 @@ int $0x10 · 11 unmodified lines
579632 verr 0x1000
580633 verw 0x1000
581634
635+#ifdef __i386__
582636 push %ds
583637 pushw %ds
584638 pushl %ds
585639 pop %ds
586640 popw %ds
587641 popl %ds
642+#endif
588643 fxsave 1(%ebx)
589644 fxrstor 1(%ecx)
645+#ifdef __i386__
590646 pushl $1
647+#else
648+ pushq $1
649+#endif
591650 pushw $1
592651 push $1
593652
x86_64-asm.h+26−15
@@ -5,8 +5,8 @@ · 4 unmodified lines
55 DEF_ASM_OP0(cmc, 0xf5)
66 DEF_ASM_OP0(lahf, 0x9f)
77 DEF_ASM_OP0(sahf, 0x9e)
8− DEF_ASM_OP0(pushfl, 0x9c)
9− DEF_ASM_OP0(popfl, 0x9d)
8+ DEF_ASM_OP0(pushfq, 0x9c)
9+ DEF_ASM_OP0(popfq, 0x9d)
1010 DEF_ASM_OP0(pushf, 0x9c)
1111 DEF_ASM_OP0(popf, 0x9d)
1212 DEF_ASM_OP0(stc, 0xf9)
@@ -34,14 +34,15 @@ · 21 unmodified lines
3434 DEF_ASM_OP0(hlt, 0xf4)
3535 DEF_ASM_OP0(wait, 0x9b)
3636 DEF_ASM_OP0(nop, 0x90)
37+ DEF_ASM_OP0(pause, 0xf390)
3738 DEF_ASM_OP0(xlat, 0xd7)
3839
3940 /* strings */
4041 ALT(DEF_ASM_OP0L(cmpsb, 0xa6, 0, OPC_BWLQ))
4142 ALT(DEF_ASM_OP0L(scmpb, 0xa6, 0, OPC_BWLQ))
4243
43−ALT(DEF_ASM_OP0L(insb, 0x6c, 0, OPC_BWLQ))
44−ALT(DEF_ASM_OP0L(outsb, 0x6e, 0, OPC_BWLQ))
44+ALT(DEF_ASM_OP0L(insb, 0x6c, 0, OPC_BWL))
45+ALT(DEF_ASM_OP0L(outsb, 0x6e, 0, OPC_BWL))
4546
4647 ALT(DEF_ASM_OP0L(lodsb, 0xac, 0, OPC_BWLQ))
4748 ALT(DEF_ASM_OP0L(slodb, 0xac, 0, OPC_BWLQ))
@@ -90,8 +91,10 @@ ALT(DEF_ASM_OP2(btcw, 0x0fba, 7, OPC_MODRM | OPC_WLQ, OPT_IM8, OPT_REGW | OPT_EA · 42 unmodified lines
9091 DEF_ASM_OP0(ud2, 0x0f0b)
9192
9293 /* NOTE: we took the same order as gas opcode definition order */
94+/* Right now we can't express the fact that 0xa1/0xa3 can't use $eax and a
95+ 32 bit moffset as operands.
9396 ALT(DEF_ASM_OP2(movb, 0xa0, 0, OPC_BWLQ, OPT_ADDR, OPT_EAX))
94−ALT(DEF_ASM_OP2(movb, 0xa2, 0, OPC_BWLQ, OPT_EAX, OPT_ADDR))
97+ALT(DEF_ASM_OP2(movb, 0xa2, 0, OPC_BWLQ, OPT_EAX, OPT_ADDR)) */
9598 ALT(DEF_ASM_OP2(movb, 0x88, 0, OPC_MODRM | OPC_BWLQ, OPT_REG, OPT_EA | OPT_REG))
9699 ALT(DEF_ASM_OP2(movb, 0x8a, 0, OPC_MODRM | OPC_BWLQ, OPT_EA | OPT_REG, OPT_REG))
97100 ALT(DEF_ASM_OP2(movb, 0xb0, 0, OPC_REG | OPC_BWLQ, OPT_IM, OPT_REG))
@@ -102,25 +105,28 @@ ALT(DEF_ASM_OP2(movw, 0x8e, 0, OPC_MODRM | OPC_WLQ, OPT_EA | OPT_REG, OPT_SEG)) · 4 unmodified lines
102105
103106 ALT(DEF_ASM_OP2(movw, 0x0f20, 0, OPC_MODRM | OPC_WLQ, OPT_CR, OPT_REG64))
104107 ALT(DEF_ASM_OP2(movw, 0x0f21, 0, OPC_MODRM | OPC_WLQ, OPT_DB, OPT_REG64))
105−ALT(DEF_ASM_OP2(movw, 0x0f24, 0, OPC_MODRM | OPC_WLQ, OPT_TR, OPT_REG64))
106108 ALT(DEF_ASM_OP2(movw, 0x0f22, 0, OPC_MODRM | OPC_WLQ, OPT_REG64, OPT_CR))
107109 ALT(DEF_ASM_OP2(movw, 0x0f23, 0, OPC_MODRM | OPC_WLQ, OPT_REG64, OPT_DB))
108−ALT(DEF_ASM_OP2(movw, 0x0f26, 0, OPC_MODRM | OPC_WLQ, OPT_REG64, OPT_TR))
109110
110111 ALT(DEF_ASM_OP2(movsbl, 0x0fbe, 0, OPC_MODRM, OPT_REG8 | OPT_EA, OPT_REG32))
111112 ALT(DEF_ASM_OP2(movsbw, 0x0fbe, 0, OPC_MODRM | OPC_D16, OPT_REG8 | OPT_EA, OPT_REG16))
112113 ALT(DEF_ASM_OP2(movswl, 0x0fbf, 0, OPC_MODRM, OPT_REG16 | OPT_EA, OPT_REG32))
113114 ALT(DEF_ASM_OP2(movslq, 0x4863, 0, OPC_MODRM, OPT_REG32 | OPT_EA, OPT_REG))
114−ALT(DEF_ASM_OP2(movzbw, 0x0fb6, 0, OPC_MODRM | OPC_WL, OPT_REG8 | OPT_EA, OPT_REGW))
115+ALT(DEF_ASM_OP2(movzbw, 0x0fb6, 0, OPC_MODRM | OPC_WLQ, OPT_REG8 | OPT_EA, OPT_REGW))
115116 ALT(DEF_ASM_OP2(movzwl, 0x0fb7, 0, OPC_MODRM, OPT_REG16 | OPT_EA, OPT_REG32))
116117
118+ALT(DEF_ASM_OP1(pushq, 0x6a, 0, 0, OPT_IM8S))
119+ALT(DEF_ASM_OP1(push, 0x6a, 0, 0, OPT_IM8S))
120+ALT(DEF_ASM_OP1(pushw, 0x6a, 0, OPC_D16, OPT_IM8S))
117121 ALT(DEF_ASM_OP1(pushw, 0x50, 0, OPC_REG | OPC_WLQ, OPT_REG64))
122+ALT(DEF_ASM_OP1(pushw, 0x50, 0, OPC_REG | OPC_WLQ, OPT_REG16))
118123 ALT(DEF_ASM_OP1(pushw, 0xff, 6, OPC_MODRM | OPC_WLQ, OPT_REG64 | OPT_EA))
124+ALT(DEF_ASM_OP1(pushw, 0x68, 0, OPC_D16, OPT_IM16))
119125 ALT(DEF_ASM_OP1(pushw, 0x68, 0, OPC_WLQ, OPT_IM32))
120126 ALT(DEF_ASM_OP1(pushw, 0x06, 0, OPC_WLQ, OPT_SEG))
121− DEF_ASM_OP1(pushb, 0x6a, 0, OPC_B, OPT_IM8S)
122127
123−ALT(DEF_ASM_OP1(popw, 0x58, 0, OPC_REG | OPC_WLQ, OPT_REGW))
128+ALT(DEF_ASM_OP1(popw, 0x58, 0, OPC_REG | OPC_WLQ, OPT_REG64))
129+ALT(DEF_ASM_OP1(popw, 0x58, 0, OPC_REG | OPC_WLQ, OPT_REG16))
124130 ALT(DEF_ASM_OP1(popw, 0x8f, 0, OPC_MODRM | OPC_WLQ, OPT_REGW | OPT_EA))
125131 ALT(DEF_ASM_OP1(popw, 0x07, 0, OPC_WLQ, OPT_SEG))
126132
@@ -154,8 +160,8 @@ ALT(DEF_ASM_OP2(addb, 0x04, 0, OPC_ARITH | OPC_BWLQ, OPT_IMNO64, OPT_EAX)) · 27 unmodified lines
154160 ALT(DEF_ASM_OP2(addb, 0x80, 0, OPC_ARITH | OPC_MODRM | OPC_BWLQ, OPT_IMNO64, OPT_EA | OPT_REG))
155161 ALT(DEF_ASM_OP2(addw, 0x83, 0, OPC_ARITH | OPC_MODRM | OPC_WLQ, OPT_IM8S, OPT_EA | OPT_REG))
156162
157−ALT(DEF_ASM_OP2(testb, 0x84, 0, OPC_MODRM | OPC_BWLQ, OPT_EA | OPT_REG, OPT_REG))
158163 ALT(DEF_ASM_OP2(testb, 0x84, 0, OPC_MODRM | OPC_BWLQ, OPT_REG, OPT_EA | OPT_REG))
164+ALT(DEF_ASM_OP2(testb, 0x84, 0, OPC_MODRM | OPC_BWLQ, OPT_EA | OPT_REG, OPT_REG))
159165 ALT(DEF_ASM_OP2(testb, 0xa8, 0, OPC_BWLQ, OPT_IMNO64, OPT_EAX))
160166 ALT(DEF_ASM_OP2(testb, 0xf6, 0, OPC_MODRM | OPC_BWLQ, OPT_IMNO64, OPT_EA | OPT_REG))
161167
@@ -206,7 +212,9 @@ ALT(DEF_ASM_OP1(setob, 0x0f90, 0, OPC_MODRM | OPC_TEST, OPT_REG8 | OPT_EA)) · 44 unmodified lines
206212 DEF_ASM_OP2(enter, 0xc8, 0, 0, OPT_IM16, OPT_IM8)
207213 DEF_ASM_OP0(leave, 0xc9)
208214 DEF_ASM_OP0(ret, 0xc3)
215+ DEF_ASM_OP0(retq, 0xc3)
209216 ALT(DEF_ASM_OP1(ret, 0xc2, 0, 0, OPT_IM16))
217+ALT(DEF_ASM_OP1(retq, 0xc2, 0, 0, OPT_IM16))
210218 DEF_ASM_OP0(lret, 0xcb)
211219 ALT(DEF_ASM_OP1(lret, 0xca, 0, 0, OPT_IM16))
212220
@@ -216,7 +224,7 @@ ALT(DEF_ASM_OP1(jo, 0x70, 0, OPC_SHORTJMP | OPC_JMP | OPC_TEST, OPT_ADDR)) · 3 unmodified lines
216224 DEF_ASM_OP1(loope, 0xe1, 0, OPC_SHORTJMP, OPT_ADDR)
217225 DEF_ASM_OP1(loopz, 0xe1, 0, OPC_SHORTJMP, OPT_ADDR)
218226 DEF_ASM_OP1(loop, 0xe2, 0, OPC_SHORTJMP, OPT_ADDR)
219− DEF_ASM_OP1(jecxz, 0xe3, 0, OPC_SHORTJMP, OPT_ADDR)
227+ DEF_ASM_OP1(jecxz, 0x67e3, 0, OPC_SHORTJMP, OPT_ADDR)
220228
221229 /* float */
222230 /* specific fcomp handling */
@@ -224,6 +232,8 @@ ALT(DEF_ASM_OP0L(fcomp, 0xd8d9, 0, 0)) · 1 unmodified line
224232
225233 ALT(DEF_ASM_OP1(fadd, 0xd8c0, 0, OPC_FARITH | OPC_REG, OPT_ST))
226234 ALT(DEF_ASM_OP2(fadd, 0xd8c0, 0, OPC_FARITH | OPC_REG, OPT_ST, OPT_ST0))
235+ALT(DEF_ASM_OP2(fadd, 0xdcc0, 0, OPC_FARITH | OPC_REG, OPT_ST0, OPT_ST))
236+ALT(DEF_ASM_OP2(fmul, 0xdcc8, 0, OPC_FARITH | OPC_REG, OPT_ST0, OPT_ST))
227237 ALT(DEF_ASM_OP0L(fadd, 0xdec1, 0, OPC_FARITH))
228238 ALT(DEF_ASM_OP1(faddp, 0xdec0, 0, OPC_FARITH | OPC_REG, OPT_ST))
229239 ALT(DEF_ASM_OP2(faddp, 0xdec0, 0, OPC_FARITH | OPC_REG, OPT_ST, OPT_ST0))
@@ -334,7 +344,7 @@ ALT(DEF_ASM_OP1(fstsw, 0xdd, 7, OPC_MODRM | OPC_FWAIT, OPT_EA )) · 104 unmodified lines
334344 DEF_ASM_OP1(lidt, 0x0f01, 3, OPC_MODRM, OPT_EA)
335345 DEF_ASM_OP1(lldt, 0x0f00, 2, OPC_MODRM, OPT_EA | OPT_REG)
336346 DEF_ASM_OP1(lmsw, 0x0f01, 6, OPC_MODRM, OPT_EA | OPT_REG)
337−ALT(DEF_ASM_OP2(lslw, 0x0f03, 0, OPC_MODRM | OPC_WL, OPT_EA | OPT_REG, OPT_REG))
347+ALT(DEF_ASM_OP2(lslw, 0x0f03, 0, OPC_MODRM | OPC_WLQ, OPT_EA | OPT_REG, OPT_REG))
338348 DEF_ASM_OP1(ltr, 0x0f00, 3, OPC_MODRM, OPT_EA | OPT_REG)
339349 DEF_ASM_OP1(sgdt, 0x0f01, 0, OPC_MODRM, OPT_EA)
340350 DEF_ASM_OP1(sidt, 0x0f01, 1, OPC_MODRM, OPT_EA)
@@ -346,8 +356,8 @@ ALT(DEF_ASM_OP2(lslw, 0x0f03, 0, OPC_MODRM | OPC_WL, OPT_EA | OPT_REG, OPT_REG)) · 5 unmodified lines
346356
347357 /* 486 */
348358 DEF_ASM_OP1(bswap, 0x0fc8, 0, OPC_REG, OPT_REG32 )
349−ALT(DEF_ASM_OP2(xaddb, 0x0fc0, 0, OPC_MODRM | OPC_BWL, OPT_REG, OPT_REG | OPT_EA ))
350−ALT(DEF_ASM_OP2(cmpxchgb, 0x0fb0, 0, OPC_MODRM | OPC_BWL, OPT_REG, OPT_REG | OPT_EA ))
359+ALT(DEF_ASM_OP2(xaddb, 0x0fc0, 0, OPC_MODRM | OPC_BWLQ, OPT_REG, OPT_REG | OPT_EA ))
360+ALT(DEF_ASM_OP2(cmpxchgb, 0x0fb0, 0, OPC_MODRM | OPC_BWLQ, OPT_REG, OPT_REG | OPT_EA ))
351361 DEF_ASM_OP1(invlpg, 0x0f01, 7, OPC_MODRM, OPT_EA )
352362
353363 DEF_ASM_OP2(boundl, 0x62, 0, OPC_MODRM, OPT_REG32, OPT_EA)
@@ -383,6 +393,7 @@ ALT(DEF_ASM_OP2(cmova, 0x0f47, 0, OPC_MODRM | OPC_TEST, OPT_REG32 | OPT_EA, OPT_ · 29 unmodified lines
383393 /* mmx */
384394 DEF_ASM_OP0(emms, 0x0f77) /* must be last OP0 */
385395 DEF_ASM_OP2(movd, 0x0f6e, 0, OPC_MODRM, OPT_EA | OPT_REG32, OPT_MMX )
396+ALT(DEF_ASM_OP2(movd, 0x0f6e, 0, OPC_MODRM, OPT_EA | OPT_REG64, OPT_MMX ))
386397 ALT(DEF_ASM_OP2(movd, 0x0f7e, 0, OPC_MODRM, OPT_MMX, OPT_EA | OPT_REG32 ))
387398 ALT(DEF_ASM_OP2(movq, 0x0f6f, 0, OPC_MODRM, OPT_EA | OPT_MMX, OPT_MMX ))
388399 ALT(DEF_ASM_OP2(movq, 0x0f7f, 0, OPC_MODRM, OPT_MMX, OPT_EA | OPT_MMX ))

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t