diff --git a/compiler/i386/i386nop.inc b/compiler/i386/i386nop.inc index b74a99a1bc..50643e77c9 100644 --- a/compiler/i386/i386nop.inc +++ b/compiler/i386/i386nop.inc @@ -1,2 +1,2 @@ { don't edit, this file is generated from x86ins.dat } -1976; +1977; diff --git a/compiler/i386/i386tab.inc b/compiler/i386/i386tab.inc index 4e7c85ec89..5cb3f17056 100644 --- a/compiler/i386/i386tab.inc +++ b/compiler/i386/i386tab.inc @@ -5810,6 +5810,13 @@ code : #1#215; flags : [if_8086] ), + ( + opcode : A_XLAT; + ops : 1; + optypes : (ot_memory or ot_bits8,ot_none,ot_none,ot_none); + code : #1#215; + flags : [if_8086] + ), ( opcode : A_XLATB; ops : 0; diff --git a/compiler/i8086/i8086nop.inc b/compiler/i8086/i8086nop.inc index 254b135706..75d6c5690b 100644 --- a/compiler/i8086/i8086nop.inc +++ b/compiler/i8086/i8086nop.inc @@ -1,2 +1,2 @@ { don't edit, this file is generated from x86ins.dat } -2008; +2009; diff --git a/compiler/i8086/i8086tab.inc b/compiler/i8086/i8086tab.inc index ced6dd98d3..c12eea48f3 100644 --- a/compiler/i8086/i8086tab.inc +++ b/compiler/i8086/i8086tab.inc @@ -5824,6 +5824,13 @@ code : #1#215; flags : [if_8086] ), + ( + opcode : A_XLAT; + ops : 1; + optypes : (ot_memory or ot_bits8,ot_none,ot_none,ot_none); + code : #1#215; + flags : [if_8086] + ), ( opcode : A_XLATB; ops : 0; diff --git a/compiler/x86/agx86nsm.pas b/compiler/x86/agx86nsm.pas index 978098c30e..670f9172ad 100644 --- a/compiler/x86/agx86nsm.pas +++ b/compiler/x86/agx86nsm.pas @@ -985,6 +985,23 @@ interface end; if fixed_opcode=A_FWAIT then writer.AsmWriteln(#9#9'DB'#9'09bh') + else if (fixed_opcode=A_XLAT) and (taicpu(hp).ops=1) and + (taicpu(hp).oper[0]^.typ=top_ref) then + begin + writer.AsmWrite(#9#9); + if (taicpu(hp).oper[0]^.ref^.segment<>NR_NO) and + (taicpu(hp).oper[0]^.ref^.segment<>NR_DS) then + writer.AsmWrite(std_regname(taicpu(hp).oper[0]^.ref^.segment)+' '); + case get_ref_address_size(taicpu(hp).oper[0]^.ref^) of + 16: + writer.AsmWrite('a16 '); + 32: + writer.AsmWrite('a32 '); + 64: + writer.AsmWrite('a64 '); + end; + writer.AsmWriteLn('xlatb'); + end else if is_x86_parameterized_string_op(fixed_opcode) then begin writer.AsmWrite(#9#9); diff --git a/compiler/x86/x86ins.dat b/compiler/x86/x86ins.dat index 7346e2f96f..e83c65716d 100644 --- a/compiler/x86/x86ins.dat +++ b/compiler/x86/x86ins.dat @@ -2074,6 +2074,7 @@ mem8,reg8 \1\x86\101 8086 [XLAT] (Ch_WEAX, Ch_REBX) void \1\xD7 8086 +mem8 \1\xD7 8086 [XLATB] (Ch_WEAX, Ch_REBX) diff --git a/compiler/x86_64/x8664nop.inc b/compiler/x86_64/x8664nop.inc index 4cb5a24340..d5cade0552 100644 --- a/compiler/x86_64/x8664nop.inc +++ b/compiler/x86_64/x8664nop.inc @@ -1,2 +1,2 @@ { don't edit, this file is generated from x86ins.dat } -2027; +2028; diff --git a/compiler/x86_64/x8664tab.inc b/compiler/x86_64/x8664tab.inc index 54b1b308b9..50b0f117df 100644 --- a/compiler/x86_64/x8664tab.inc +++ b/compiler/x86_64/x8664tab.inc @@ -5866,6 +5866,13 @@ code : #1#215; flags : [if_8086] ), + ( + opcode : A_XLAT; + ops : 1; + optypes : (ot_memory or ot_bits8,ot_none,ot_none,ot_none); + code : #1#215; + flags : [if_8086] + ), ( opcode : A_XLATB; ops : 0; diff --git a/tests/test/tasm12a.pp b/tests/test/tasm12a.pp index f1ed703b2e..4816cea42e 100644 --- a/tests/test/tasm12a.pp +++ b/tests/test/tasm12a.pp @@ -39,7 +39,13 @@ begin outsw outsd + xlat + xlatb + { no segment overrides } + xlat byte ptr [rbx] + xlat byte ptr [ebx] + movs byte ptr [rdi], byte ptr [rsi] movs byte ptr [edi], byte ptr [esi] movs word ptr [rdi], word ptr [rsi] @@ -100,6 +106,9 @@ begin outs dx, dword ptr [esi] { es:di } + xlat byte ptr ds:[rbx] + xlat byte ptr ds:[ebx] + movs byte ptr es:[rdi], byte ptr [rsi] movs byte ptr es:[edi], byte ptr [esi] movs word ptr es:[rdi], word ptr [rsi] @@ -160,6 +169,9 @@ begin outs dx, dword ptr [esi] { es:di, fs:si } + xlat byte ptr fs:[rbx] + xlat byte ptr fs:[ebx] + movs byte ptr es:[rdi], byte ptr fs:[rsi] movs byte ptr es:[edi], byte ptr fs:[esi] movs word ptr es:[rdi], word ptr fs:[rsi] diff --git a/tests/test/tasm12b.pp b/tests/test/tasm12b.pp index 5fafd0731c..6754f7760f 100644 --- a/tests/test/tasm12b.pp +++ b/tests/test/tasm12b.pp @@ -34,7 +34,13 @@ begin outsw outsd + xlat + xlatb + { no segment overrides } + xlat byte ptr [ebx] + xlat byte ptr [bx] + movs byte ptr [edi], byte ptr [esi] movs byte ptr [di], byte ptr [si] movs word ptr [edi], word ptr [esi] @@ -85,6 +91,9 @@ begin outs dx, dword ptr [si] { es:di } + xlat byte ptr ds:[ebx] + xlat byte ptr ds:[bx] + movs byte ptr es:[edi], byte ptr [esi] movs byte ptr es:[di], byte ptr [si] movs word ptr es:[edi], word ptr [esi] @@ -135,6 +144,9 @@ begin outs dx, dword ptr [si] { es:di, fs:si } + xlat byte ptr fs:[ebx] + xlat byte ptr fs:[bx] + movs byte ptr es:[edi], byte ptr fs:[esi] movs byte ptr es:[di], byte ptr fs:[si] movs word ptr es:[edi], word ptr fs:[esi] diff --git a/tests/test/tasm12c.pp b/tests/test/tasm12c.pp index 306b721526..914c6aa3c8 100644 --- a/tests/test/tasm12c.pp +++ b/tests/test/tasm12c.pp @@ -35,7 +35,13 @@ begin outsw outsd + xlat + xlatb + { no segment overrides } + xlat byte ptr [ebx] + xlat byte ptr [bx] + movs byte ptr [edi], byte ptr [esi] movs byte ptr [di], byte ptr [si] movs word ptr [edi], word ptr [esi] @@ -86,6 +92,9 @@ begin outs dx, dword ptr [si] { es:di } + xlat byte ptr ds:[ebx] + xlat byte ptr ds:[bx] + movs byte ptr es:[edi], byte ptr [esi] movs byte ptr es:[di], byte ptr [si] movs word ptr es:[edi], word ptr [esi] @@ -136,6 +145,9 @@ begin outs dx, dword ptr [si] { es:di, fs:si } + xlat byte ptr fs:[ebx] + xlat byte ptr fs:[bx] + movs byte ptr es:[edi], byte ptr fs:[esi] movs byte ptr es:[di], byte ptr fs:[si] movs word ptr es:[edi], word ptr fs:[esi]