mirror of https://github.com/red-prig/fpPS4.git
This commit is contained in:
parent
fef439d9a1
commit
846e3f00b5
130
rtl/x86_jit.pas
130
rtl/x86_jit.pas
|
@ -25,10 +25,11 @@ type
|
|||
t_op_opt=Set of (not_impl,not_prefix,not_vex_len);
|
||||
|
||||
t_op_type=packed object
|
||||
op:DWORD;
|
||||
index:Byte;
|
||||
mm:Byte;
|
||||
opt:t_op_opt;
|
||||
op :DWORD;
|
||||
index :Byte;
|
||||
simdop:Byte;
|
||||
mm :Byte;
|
||||
opt :t_op_opt;
|
||||
end;
|
||||
|
||||
TOperandSizeSet =Set of TOperandSize;
|
||||
|
@ -369,6 +370,7 @@ type
|
|||
procedure pop (reg:TRegValue);
|
||||
procedure pushfq (size:TOperandSize);
|
||||
procedure popfq (size:TOperandSize);
|
||||
procedure _VM (const desc:t_op_type;mem:t_jit_leas);
|
||||
procedure _VM (const desc:t_op_type;reg:TRegValue;mem:t_jit_leas);
|
||||
procedure _VV (const desc:t_op_type;reg0,reg1:TRegValue;size:TOperandSize=os0);
|
||||
procedure _VM_F3 (const desc:t_op_type;reg:TRegValue;mem:t_jit_leas);
|
||||
|
@ -3501,6 +3503,84 @@ begin
|
|||
_add(ji);
|
||||
end;
|
||||
|
||||
procedure t_jit_builder._VM(const desc:t_op_type;mem:t_jit_leas);
|
||||
var
|
||||
mreg:t_jit_lea;
|
||||
|
||||
modrm_info:t_modrm_info;
|
||||
|
||||
Vex:record
|
||||
rexW :Boolean;
|
||||
Length:Byte;
|
||||
end;
|
||||
|
||||
ji:t_jit_instruction;
|
||||
begin
|
||||
Assert(not (not_impl in desc.opt));
|
||||
Assert(desc.mm<>0);
|
||||
|
||||
mreg:=Sums(mem);
|
||||
|
||||
Assert(is_reg_size(mreg,[os0,os32,os64]));
|
||||
Assert(is_reg_type(mreg,[regNone,regGeneral,regRip]));
|
||||
Assert(is_valid_scale(mreg));
|
||||
|
||||
ji:=default_jit_instruction;
|
||||
|
||||
Vex.Length:=0;
|
||||
|
||||
if not (not_vex_len in desc.opt) then
|
||||
case mreg.AMemSize of
|
||||
os128:Vex.Length:=0;
|
||||
os256:Vex.Length:=1;
|
||||
else;
|
||||
end;
|
||||
|
||||
Vex.rexW:=False;
|
||||
if (mreg.AMemSize=os64) then
|
||||
begin
|
||||
Vex.rexW:=True;
|
||||
end;
|
||||
|
||||
modrm_info:=Default(t_modrm_info);
|
||||
|
||||
modrm_info.build_im(desc.index,mreg);
|
||||
|
||||
if mreg.ALock then
|
||||
begin
|
||||
ji.EmitByte($F0);
|
||||
end;
|
||||
|
||||
ji.EmitSelector(mreg.ASegment);
|
||||
|
||||
if (mreg.ARegValue[0].ASize=os32) then
|
||||
begin
|
||||
ji.EmitByte($67); //Address-size override prefix (32)
|
||||
end;
|
||||
|
||||
if Vex.rexW or
|
||||
modrm_info.rexB or
|
||||
modrm_info.rexX or
|
||||
(desc.mm>1) then
|
||||
begin
|
||||
ji.EmitByte($C4); //VEX3
|
||||
|
||||
ji.EmitRXBm(modrm_info.rexB,modrm_info.rexX,modrm_info.rexR,desc.mm);
|
||||
ji.EmitWvvv(Vex.rexW,0,Vex.Length,desc.simdop);
|
||||
end else
|
||||
begin
|
||||
ji.EmitByte($C5); //VEX2
|
||||
|
||||
ji.EmitRvvv(modrm_info.rexR,0,Vex.Length,desc.simdop);
|
||||
end;
|
||||
|
||||
ji.EmitByte(desc.op);
|
||||
|
||||
modrm_info.emit_mrm(ji);
|
||||
|
||||
_add(ji);
|
||||
end;
|
||||
|
||||
procedure t_jit_builder._VM(const desc:t_op_type;reg:TRegValue;mem:t_jit_leas);
|
||||
var
|
||||
mreg:t_jit_lea;
|
||||
|
@ -3568,12 +3648,12 @@ begin
|
|||
ji.EmitByte($C4); //VEX3
|
||||
|
||||
ji.EmitRXBm(modrm_info.rexB,modrm_info.rexX,modrm_info.rexR,desc.mm);
|
||||
ji.EmitWvvv(Vex.rexW,0,Vex.Length,desc.index);
|
||||
ji.EmitWvvv(Vex.rexW,0,Vex.Length,desc.simdop);
|
||||
end else
|
||||
begin
|
||||
ji.EmitByte($C5); //VEX2
|
||||
|
||||
ji.EmitRvvv(modrm_info.rexR,0,Vex.Length,desc.index);
|
||||
ji.EmitRvvv(modrm_info.rexR,0,Vex.Length,desc.simdop);
|
||||
end;
|
||||
|
||||
ji.EmitByte(desc.op);
|
||||
|
@ -3639,12 +3719,12 @@ begin
|
|||
ji.EmitByte($C4); //VEX3
|
||||
|
||||
ji.EmitRXBm(modrm_info.rexB,modrm_info.rexX,modrm_info.rexR,desc.mm);
|
||||
ji.EmitWvvv(Vex.rexW,0,Vex.Length,desc.index);
|
||||
ji.EmitWvvv(Vex.rexW,0,Vex.Length,desc.simdop);
|
||||
end else
|
||||
begin
|
||||
ji.EmitByte($C5); //VEX2
|
||||
|
||||
ji.EmitRvvv(modrm_info.rexR,0,Vex.Length,desc.index);
|
||||
ji.EmitRvvv(modrm_info.rexR,0,Vex.Length,desc.simdop);
|
||||
end;
|
||||
|
||||
ji.EmitByte(desc.op);
|
||||
|
@ -3877,12 +3957,12 @@ begin
|
|||
ji.EmitByte($C4); //VEX3
|
||||
|
||||
ji.EmitRXBm(modrm_info.rexB,modrm_info.rexX,modrm_info.rexR,desc.mm);
|
||||
ji.EmitWvvv(Vex.rexW,Vex.Index,Vex.Length,desc.index);
|
||||
ji.EmitWvvv(Vex.rexW,Vex.Index,Vex.Length,desc.simdop);
|
||||
end else
|
||||
begin
|
||||
ji.EmitByte($C5); //VEX2
|
||||
|
||||
ji.EmitRvvv(modrm_info.rexR,Vex.Index,Vex.Length,desc.index);
|
||||
ji.EmitRvvv(modrm_info.rexR,Vex.Index,Vex.Length,desc.simdop);
|
||||
end;
|
||||
|
||||
ji.EmitByte(desc.op);
|
||||
|
@ -3971,12 +4051,12 @@ begin
|
|||
ji.EmitByte($C4); //VEX3
|
||||
|
||||
ji.EmitRXBm(modrm_info.rexB,modrm_info.rexX,modrm_info.rexR,desc.mm);
|
||||
ji.EmitWvvv(Vex.rexW,Vex.Index,Vex.Length,desc.index);
|
||||
ji.EmitWvvv(Vex.rexW,Vex.Index,Vex.Length,desc.simdop);
|
||||
end else
|
||||
begin
|
||||
ji.EmitByte($C5); //VEX2
|
||||
|
||||
ji.EmitRvvv(modrm_info.rexR,Vex.Index,Vex.Length,desc.index);
|
||||
ji.EmitRvvv(modrm_info.rexR,Vex.Index,Vex.Length,desc.simdop);
|
||||
end;
|
||||
|
||||
ji.EmitByte(desc.op);
|
||||
|
@ -4056,12 +4136,12 @@ begin
|
|||
ji.EmitByte($C4); //VEX3
|
||||
|
||||
ji.EmitRXBm(modrm_info.rexB,modrm_info.rexX,modrm_info.rexR,desc.mm);
|
||||
ji.EmitWvvv(Vex.rexW,Vex.Index,Vex.Length,desc.index);
|
||||
ji.EmitWvvv(Vex.rexW,Vex.Index,Vex.Length,desc.simdop);
|
||||
end else
|
||||
begin
|
||||
ji.EmitByte($C5); //VEX2
|
||||
|
||||
ji.EmitRvvv(modrm_info.rexR,Vex.Index,Vex.Length,desc.index);
|
||||
ji.EmitRvvv(modrm_info.rexR,Vex.Index,Vex.Length,desc.simdop);
|
||||
end;
|
||||
|
||||
ji.EmitByte(desc.op);
|
||||
|
@ -4134,12 +4214,12 @@ begin
|
|||
ji.EmitByte($C4); //VEX3
|
||||
|
||||
ji.EmitRXBm(modrm_info.rexB,modrm_info.rexX,modrm_info.rexR,desc.mm);
|
||||
ji.EmitWvvv(Vex.rexW,Vex.Index,Vex.Length,desc.index);
|
||||
ji.EmitWvvv(Vex.rexW,Vex.Index,Vex.Length,desc.simdop);
|
||||
end else
|
||||
begin
|
||||
ji.EmitByte($C5); //VEX2
|
||||
|
||||
ji.EmitRvvv(modrm_info.rexR,Vex.Index,Vex.Length,desc.index);
|
||||
ji.EmitRvvv(modrm_info.rexR,Vex.Index,Vex.Length,desc.simdop);
|
||||
end;
|
||||
|
||||
ji.EmitByte(desc.op);
|
||||
|
@ -4201,7 +4281,7 @@ begin
|
|||
ji.EmitByte($C4); //VEX3
|
||||
|
||||
ji.EmitRXBm(modrm_info.rexB,modrm_info.rexX,modrm_info.rexR,desc.mm);
|
||||
ji.EmitWvvv(Vex.rexW,0,Vex.Length,desc.index);
|
||||
ji.EmitWvvv(Vex.rexW,0,Vex.Length,desc.simdop);
|
||||
|
||||
ji.EmitByte(desc.op);
|
||||
|
||||
|
@ -4278,7 +4358,7 @@ begin
|
|||
ji.EmitByte($C4); //VEX3
|
||||
|
||||
ji.EmitRXBm(modrm_info.rexB,modrm_info.rexX,modrm_info.rexR,desc.mm);
|
||||
ji.EmitWvvv(Vex.rexW,0,Vex.Length,desc.index);
|
||||
ji.EmitWvvv(Vex.rexW,0,Vex.Length,desc.simdop);
|
||||
|
||||
ji.EmitByte(desc.op);
|
||||
|
||||
|
@ -4291,49 +4371,49 @@ end;
|
|||
|
||||
procedure t_jit_builder.vmovdqu(reg:TRegValue;mem:t_jit_leas);
|
||||
const
|
||||
desc:t_op_type=(op:$6F;index:2;mm:1);
|
||||
desc:t_op_type=(op:$6F;simdop:2;mm:1);
|
||||
begin
|
||||
_VM(desc,reg,mem);
|
||||
end;
|
||||
|
||||
procedure t_jit_builder.vmovdqu(mem:t_jit_leas;reg:TRegValue);
|
||||
const
|
||||
desc:t_op_type=(op:$7F;index:2;mm:1);
|
||||
desc:t_op_type=(op:$7F;simdop:2;mm:1);
|
||||
begin
|
||||
_VM(desc,reg,mem);
|
||||
end;
|
||||
|
||||
procedure t_jit_builder.vmovdqa(reg:TRegValue;mem:t_jit_leas);
|
||||
const
|
||||
desc:t_op_type=(op:$6F;index:1;mm:1);
|
||||
desc:t_op_type=(op:$6F;simdop:1;mm:1);
|
||||
begin
|
||||
_VM(desc,reg,mem);
|
||||
end;
|
||||
|
||||
procedure t_jit_builder.vmovdqa(mem:t_jit_leas;reg:TRegValue);
|
||||
const
|
||||
desc:t_op_type=(op:$7F;index:1;mm:1);
|
||||
desc:t_op_type=(op:$7F;simdop:1;mm:1);
|
||||
begin
|
||||
_VM(desc,reg,mem);
|
||||
end;
|
||||
|
||||
procedure t_jit_builder.vmovntdq(mem:t_jit_leas;reg:TRegValue);
|
||||
const
|
||||
desc:t_op_type=(op:$E7;index:1;mm:1);
|
||||
desc:t_op_type=(op:$E7;simdop:1;mm:1);
|
||||
begin
|
||||
_VM(desc,reg,mem);
|
||||
end;
|
||||
|
||||
procedure t_jit_builder.vmovups(reg:TRegValue;mem:t_jit_leas);
|
||||
const
|
||||
desc:t_op_type=(op:$10;index:0;mm:1);
|
||||
desc:t_op_type=(op:$10;simdop:0;mm:1);
|
||||
begin
|
||||
_VM(desc,reg,mem);
|
||||
end;
|
||||
|
||||
procedure t_jit_builder.vmovups(mem:t_jit_leas;reg:TRegValue);
|
||||
const
|
||||
desc:t_op_type=(op:$11;index:0;mm:1);
|
||||
desc:t_op_type=(op:$11;simdop:0;mm:1);
|
||||
begin
|
||||
_VM(desc,reg,mem);
|
||||
end;
|
||||
|
|
|
@ -1606,7 +1606,7 @@ begin
|
|||
ctx.din.Operand[2].Size);
|
||||
Writeln('opcode=$',HexStr(ctx.dis.opcode,2),' ',
|
||||
'MIndex=',ctx.dis.ModRM.Index,' ',
|
||||
'SOpcode=',ctx.dis.SimdOpcode,':',SCODES[ctx.dis.SimdOpcode],' ',
|
||||
'SimdOp=',ctx.dis.SimdOpcode,':',SCODES[ctx.dis.SimdOpcode],' ',
|
||||
'mm=',ctx.dis.mm,':',MCODES[ctx.dis.mm and 3]);
|
||||
Assert(false);
|
||||
end;
|
||||
|
|
|
@ -728,126 +728,24 @@ end;
|
|||
|
||||
//
|
||||
|
||||
procedure op_shift2_gen(var ctx:t_jit_context2);
|
||||
const
|
||||
rol_desc:t_op_shift=(
|
||||
desc:t_op_shift=(
|
||||
reg_im8:(op:$C1;index:0);
|
||||
mem__cl:(op:$D3;index:0);
|
||||
mem_one:(op:$D1;index:0);
|
||||
);
|
||||
|
||||
procedure op_rol(var ctx:t_jit_context2);
|
||||
var
|
||||
tmp:t_op_shift;
|
||||
begin
|
||||
if is_preserved(ctx.din) or is_memory(ctx.din) then
|
||||
begin
|
||||
op_emit_shift2(ctx,rol_desc);
|
||||
end else
|
||||
begin
|
||||
add_orig(ctx);
|
||||
end;
|
||||
end;
|
||||
|
||||
const
|
||||
ror_desc:t_op_shift=(
|
||||
reg_im8:(op:$C1;index:1);
|
||||
mem__cl:(op:$D3;index:1);
|
||||
mem_one:(op:$D1;index:1);
|
||||
);
|
||||
|
||||
procedure op_ror(var ctx:t_jit_context2);
|
||||
begin
|
||||
if is_preserved(ctx.din) or is_memory(ctx.din) then
|
||||
begin
|
||||
op_emit_shift2(ctx,ror_desc);
|
||||
end else
|
||||
begin
|
||||
add_orig(ctx);
|
||||
end;
|
||||
end;
|
||||
|
||||
const
|
||||
rcl_desc:t_op_shift=(
|
||||
reg_im8:(op:$C1;index:2);
|
||||
mem__cl:(op:$D3;index:2);
|
||||
mem_one:(op:$D1;index:2);
|
||||
);
|
||||
|
||||
procedure op_rcl(var ctx:t_jit_context2);
|
||||
begin
|
||||
if is_preserved(ctx.din) or is_memory(ctx.din) then
|
||||
begin
|
||||
op_emit_shift2(ctx,rcl_desc);
|
||||
end else
|
||||
begin
|
||||
add_orig(ctx);
|
||||
end;
|
||||
end;
|
||||
|
||||
const
|
||||
rcr_desc:t_op_shift=(
|
||||
reg_im8:(op:$C1;index:3);
|
||||
mem__cl:(op:$D3;index:3);
|
||||
mem_one:(op:$D1;index:3);
|
||||
);
|
||||
|
||||
procedure op_rcr(var ctx:t_jit_context2);
|
||||
begin
|
||||
if is_preserved(ctx.din) or is_memory(ctx.din) then
|
||||
begin
|
||||
op_emit_shift2(ctx,rcr_desc);
|
||||
end else
|
||||
begin
|
||||
add_orig(ctx);
|
||||
end;
|
||||
end;
|
||||
|
||||
const
|
||||
shl_desc:t_op_shift=(
|
||||
reg_im8:(op:$C1;index:4);
|
||||
mem__cl:(op:$D3;index:4);
|
||||
mem_one:(op:$D1;index:4);
|
||||
);
|
||||
|
||||
procedure op_shl(var ctx:t_jit_context2);
|
||||
begin
|
||||
if is_preserved(ctx.din) or is_memory(ctx.din) then
|
||||
begin
|
||||
op_emit_shift2(ctx,shl_desc);
|
||||
end else
|
||||
begin
|
||||
add_orig(ctx);
|
||||
end;
|
||||
end;
|
||||
|
||||
const
|
||||
shr_desc:t_op_shift=(
|
||||
reg_im8:(op:$C1;index:5);
|
||||
mem__cl:(op:$D3;index:5);
|
||||
mem_one:(op:$D1;index:5);
|
||||
);
|
||||
|
||||
procedure op_shr(var ctx:t_jit_context2);
|
||||
begin
|
||||
if is_preserved(ctx.din) or is_memory(ctx.din) then
|
||||
begin
|
||||
op_emit_shift2(ctx,shr_desc);
|
||||
end else
|
||||
begin
|
||||
add_orig(ctx);
|
||||
end;
|
||||
end;
|
||||
|
||||
const
|
||||
sar_desc:t_op_shift=(
|
||||
reg_im8:(op:$C1;index:7);
|
||||
mem__cl:(op:$D3;index:7);
|
||||
mem_one:(op:$D1;index:7);
|
||||
);
|
||||
|
||||
procedure op_sar(var ctx:t_jit_context2);
|
||||
begin
|
||||
if is_preserved(ctx.din) or is_memory(ctx.din) then
|
||||
begin
|
||||
op_emit_shift2(ctx,sar_desc);
|
||||
tmp:=desc;
|
||||
tmp.reg_im8.index:=ctx.dis.ModRM.Index;
|
||||
tmp.mem__cl.index:=ctx.dis.ModRM.Index;
|
||||
tmp.mem_one.index:=ctx.dis.ModRM.Index;
|
||||
//
|
||||
op_emit_shift2(ctx,tmp);
|
||||
end else
|
||||
begin
|
||||
add_orig(ctx);
|
||||
|
@ -1718,13 +1616,13 @@ begin
|
|||
jit_cbs[OPPnone,OPtzcnt ,OPSnone]:=@op_tzcnt;
|
||||
jit_cbs[OPPnone,OPpopcnt ,OPSnone]:=@op_popcnt;
|
||||
|
||||
jit_cbs[OPPnone,OProl ,OPSnone]:=@op_rol;
|
||||
jit_cbs[OPPnone,OPror ,OPSnone]:=@op_ror;
|
||||
jit_cbs[OPPnone,OPrcl ,OPSnone]:=@op_rcl;
|
||||
jit_cbs[OPPnone,OPrcr ,OPSnone]:=@op_rcr;
|
||||
jit_cbs[OPPnone,OPshl ,OPSnone]:=@op_shl;
|
||||
jit_cbs[OPPnone,OPshr ,OPSnone]:=@op_shr;
|
||||
jit_cbs[OPPnone,OPsar ,OPSnone]:=@op_sar;
|
||||
jit_cbs[OPPnone,OProl ,OPSnone]:=@op_shift2_gen;
|
||||
jit_cbs[OPPnone,OPror ,OPSnone]:=@op_shift2_gen;
|
||||
jit_cbs[OPPnone,OPrcl ,OPSnone]:=@op_shift2_gen;
|
||||
jit_cbs[OPPnone,OPrcr ,OPSnone]:=@op_shift2_gen;
|
||||
jit_cbs[OPPnone,OPshl ,OPSnone]:=@op_shift2_gen;
|
||||
jit_cbs[OPPnone,OPshr ,OPSnone]:=@op_shift2_gen;
|
||||
jit_cbs[OPPnone,OPsar ,OPSnone]:=@op_shift2_gen;
|
||||
|
||||
jit_cbs[OPPnone,OPshl ,OPSx_d ]:=@op_shld;
|
||||
jit_cbs[OPPnone,OPshr ,OPSx_d ]:=@op_shrd;
|
||||
|
|
|
@ -19,7 +19,7 @@ const
|
|||
procedure op_emit_avx2_mem_reg(var ctx:t_jit_context2;hint:t_op_hint);
|
||||
const
|
||||
desc:t_op_desc=(
|
||||
mem_reg:(op:0;index:0;mm:0);
|
||||
mem_reg:(op:0;index:0;simdop:0;mm:0);
|
||||
reg_mem:(opt:[not_impl]);
|
||||
reg_imm:(opt:[not_impl]);
|
||||
reg_im8:(opt:[not_impl]);
|
||||
|
@ -29,9 +29,9 @@ var
|
|||
tmp:t_op_desc;
|
||||
begin
|
||||
tmp:=desc;
|
||||
tmp.mem_reg.op :=ctx.dis.opcode;
|
||||
tmp.mem_reg.index:=SCODES[ctx.dis.SimdOpcode];
|
||||
tmp.mem_reg.mm :=ctx.dis.mm;
|
||||
tmp.mem_reg.op :=ctx.dis.opcode;
|
||||
tmp.mem_reg.simdop:=SCODES[ctx.dis.SimdOpcode];
|
||||
tmp.mem_reg.mm :=ctx.dis.mm;
|
||||
tmp.hint:=hint;
|
||||
|
||||
op_emit_avx2(ctx,tmp);
|
||||
|
@ -41,7 +41,7 @@ procedure op_emit_avx2_reg_mem(var ctx:t_jit_context2;hint:t_op_hint);
|
|||
const
|
||||
desc:t_op_desc=(
|
||||
mem_reg:(opt:[not_impl]);
|
||||
reg_mem:(op:0;index:0;mm:0);
|
||||
reg_mem:(op:0;index:0;simdop:0;mm:0);
|
||||
reg_imm:(opt:[not_impl]);
|
||||
reg_im8:(opt:[not_impl]);
|
||||
hint:[];
|
||||
|
@ -50,9 +50,9 @@ var
|
|||
tmp:t_op_desc;
|
||||
begin
|
||||
tmp:=desc;
|
||||
tmp.reg_mem.op :=ctx.dis.opcode;
|
||||
tmp.reg_mem.index:=SCODES[ctx.dis.SimdOpcode];
|
||||
tmp.reg_mem.mm :=ctx.dis.mm;
|
||||
tmp.reg_mem.op :=ctx.dis.opcode;
|
||||
tmp.reg_mem.simdop:=SCODES[ctx.dis.SimdOpcode];
|
||||
tmp.reg_mem.mm :=ctx.dis.mm;
|
||||
tmp.hint:=hint;
|
||||
|
||||
op_emit_avx2(ctx,tmp);
|
||||
|
@ -94,7 +94,7 @@ end;
|
|||
procedure op_emit_avx3_gen(var ctx:t_jit_context2);
|
||||
const
|
||||
desc:t_op_type=(
|
||||
op:0;index:0;mm:0;opt:[]
|
||||
op:0;index:0;simdop:0;mm:0;opt:[]
|
||||
);
|
||||
var
|
||||
tmp:t_op_type;
|
||||
|
@ -102,9 +102,9 @@ begin
|
|||
if is_preserved(ctx.din) or is_memory(ctx.din) then
|
||||
begin
|
||||
tmp:=desc;
|
||||
tmp.op :=ctx.dis.opcode;
|
||||
tmp.index:=SCODES[ctx.dis.SimdOpcode];
|
||||
tmp.mm :=ctx.dis.mm;
|
||||
tmp.op :=ctx.dis.opcode;
|
||||
tmp.simdop:=SCODES[ctx.dis.SimdOpcode];
|
||||
tmp.mm :=ctx.dis.mm;
|
||||
|
||||
op_emit_avx3(ctx,tmp);
|
||||
end else
|
||||
|
@ -116,7 +116,7 @@ end;
|
|||
procedure op_emit_avx3_not_vex_len(var ctx:t_jit_context2);
|
||||
const
|
||||
desc:t_op_type=(
|
||||
op:0;index:0;mm:0;opt:[not_vex_len];
|
||||
op:0;index:0;simdop:0;mm:0;opt:[not_vex_len];
|
||||
);
|
||||
var
|
||||
tmp:t_op_type;
|
||||
|
@ -124,9 +124,9 @@ begin
|
|||
if is_preserved(ctx.din) or is_memory(ctx.din) then
|
||||
begin
|
||||
tmp:=desc;
|
||||
tmp.op :=ctx.dis.opcode;
|
||||
tmp.index:=SCODES[ctx.dis.SimdOpcode];
|
||||
tmp.mm :=ctx.dis.mm;
|
||||
tmp.op :=ctx.dis.opcode;
|
||||
tmp.simdop:=SCODES[ctx.dis.SimdOpcode];
|
||||
tmp.mm :=ctx.dis.mm;
|
||||
|
||||
op_emit_avx3(ctx,tmp);
|
||||
end else
|
||||
|
@ -140,7 +140,7 @@ end;
|
|||
procedure op_emit_avx3_rmi(var ctx:t_jit_context2);
|
||||
const
|
||||
desc:t_op_avx3_imm=(
|
||||
rmi:(op:0;index:0;mm:0);
|
||||
rmi:(op:0;index:0;simdop:0;mm:0);
|
||||
mri:(opt:[not_impl]);
|
||||
);
|
||||
var
|
||||
|
@ -149,9 +149,9 @@ begin
|
|||
if is_preserved(ctx.din) or is_memory(ctx.din) then
|
||||
begin
|
||||
tmp:=desc;
|
||||
tmp.rmi.op :=ctx.dis.opcode;
|
||||
tmp.rmi.index:=SCODES[ctx.dis.SimdOpcode];
|
||||
tmp.rmi.mm :=ctx.dis.mm;
|
||||
tmp.rmi.op :=ctx.dis.opcode;
|
||||
tmp.rmi.simdop:=SCODES[ctx.dis.SimdOpcode];
|
||||
tmp.rmi.mm :=ctx.dis.mm;
|
||||
|
||||
op_emit_avx3_imm8(ctx,tmp);
|
||||
end else
|
||||
|
@ -164,7 +164,7 @@ procedure op_emit_avx3_mri(var ctx:t_jit_context2);
|
|||
const
|
||||
desc:t_op_avx3_imm=(
|
||||
rmi:(opt:[not_impl]);
|
||||
mri:(op:0;index:0;mm:0);
|
||||
mri:(op:0;index:0;simdop:0;mm:0);
|
||||
);
|
||||
var
|
||||
tmp:t_op_avx3_imm;
|
||||
|
@ -172,9 +172,9 @@ begin
|
|||
if is_preserved(ctx.din) or is_memory(ctx.din) then
|
||||
begin
|
||||
tmp:=desc;
|
||||
tmp.mri.op :=ctx.dis.opcode;
|
||||
tmp.mri.index:=SCODES[ctx.dis.SimdOpcode];
|
||||
tmp.mri.mm :=ctx.dis.mm;
|
||||
tmp.mri.op :=ctx.dis.opcode;
|
||||
tmp.mri.simdop:=SCODES[ctx.dis.SimdOpcode];
|
||||
tmp.mri.mm :=ctx.dis.mm;
|
||||
|
||||
op_emit_avx3_imm8(ctx,tmp);
|
||||
end else
|
||||
|
@ -187,8 +187,8 @@ end;
|
|||
|
||||
const
|
||||
vmovups_desc:t_op_desc=(
|
||||
mem_reg:(op:$11;index:0;mm:1);
|
||||
reg_mem:(op:$10;index:0;mm:1);
|
||||
mem_reg:(op:$11;simdop:0;mm:1);
|
||||
reg_mem:(op:$10;simdop:0;mm:1);
|
||||
reg_imm:(opt:[not_impl]);
|
||||
reg_im8:(opt:[not_impl]);
|
||||
hint:[his_mov,his_wo];
|
||||
|
@ -207,8 +207,8 @@ end;
|
|||
|
||||
const
|
||||
vmovupd_desc:t_op_desc=(
|
||||
mem_reg:(op:$11;index:1;mm:1);
|
||||
reg_mem:(op:$10;index:1;mm:1);
|
||||
mem_reg:(op:$11;simdop:1;mm:1);
|
||||
reg_mem:(op:$10;simdop:1;mm:1);
|
||||
reg_imm:(opt:[not_impl]);
|
||||
reg_im8:(opt:[not_impl]);
|
||||
hint:[his_mov,his_wo];
|
||||
|
@ -227,8 +227,8 @@ end;
|
|||
|
||||
const
|
||||
vmovaps_desc:t_op_desc=(
|
||||
mem_reg:(op:$29;index:0;mm:1);
|
||||
reg_mem:(op:$28;index:0;mm:1);
|
||||
mem_reg:(op:$29;simdop:0;mm:1);
|
||||
reg_mem:(op:$28;simdop:0;mm:1);
|
||||
reg_imm:(opt:[not_impl]);
|
||||
reg_im8:(opt:[not_impl]);
|
||||
hint:[his_mov,his_wo,his_align];
|
||||
|
@ -247,8 +247,8 @@ end;
|
|||
|
||||
const
|
||||
vmovapd_desc:t_op_desc=(
|
||||
mem_reg:(op:$29;index:1;mm:1);
|
||||
reg_mem:(op:$28;index:1;mm:1);
|
||||
mem_reg:(op:$29;simdop:1;mm:1);
|
||||
reg_mem:(op:$28;simdop:1;mm:1);
|
||||
reg_imm:(opt:[not_impl]);
|
||||
reg_im8:(opt:[not_impl]);
|
||||
hint:[his_mov,his_wo,his_align];
|
||||
|
@ -267,8 +267,8 @@ end;
|
|||
|
||||
const
|
||||
vmovdqu_desc:t_op_desc=(
|
||||
mem_reg:(op:$7F;index:2;mm:1);
|
||||
reg_mem:(op:$6F;index:2;mm:1);
|
||||
mem_reg:(op:$7F;simdop:2;mm:1);
|
||||
reg_mem:(op:$6F;simdop:2;mm:1);
|
||||
reg_imm:(opt:[not_impl]);
|
||||
reg_im8:(opt:[not_impl]);
|
||||
hint:[his_mov,his_wo];
|
||||
|
@ -287,8 +287,8 @@ end;
|
|||
|
||||
const
|
||||
vmovdqa_desc:t_op_desc=(
|
||||
mem_reg:(op:$7F;index:1;mm:1);
|
||||
reg_mem:(op:$6F;index:1;mm:1);
|
||||
mem_reg:(op:$7F;simdop:1;mm:1);
|
||||
reg_mem:(op:$6F;simdop:1;mm:1);
|
||||
reg_imm:(opt:[not_impl]);
|
||||
reg_im8:(opt:[not_impl]);
|
||||
hint:[his_mov,his_wo,his_align];
|
||||
|
@ -318,8 +318,8 @@ end;
|
|||
|
||||
const
|
||||
vmov_dq_desc:t_op_desc=(
|
||||
mem_reg:(op:$7E;index:1;mm:1);
|
||||
reg_mem:(op:$6E;index:1;mm:1);
|
||||
mem_reg:(op:$7E;simdop:1;mm:1);
|
||||
reg_mem:(op:$6E;simdop:1;mm:1);
|
||||
reg_imm:(opt:[not_impl]);
|
||||
reg_im8:(opt:[not_impl]);
|
||||
hint:[his_mov,his_wo];
|
||||
|
@ -338,8 +338,8 @@ end;
|
|||
|
||||
const
|
||||
vmovq_desc:t_op_desc=(
|
||||
mem_reg:(op:$D6;index:1;mm:1);
|
||||
reg_mem:(op:$7E;index:2;mm:1);
|
||||
mem_reg:(op:$D6;simdop:1;mm:1);
|
||||
reg_mem:(op:$7E;simdop:2;mm:1);
|
||||
reg_imm:(opt:[not_impl]);
|
||||
reg_im8:(opt:[not_impl]);
|
||||
hint:[his_mov,his_wo];
|
||||
|
@ -367,14 +367,14 @@ end;
|
|||
|
||||
const
|
||||
vmovlps_desc2:t_op_desc=(
|
||||
mem_reg:(op:$13;index:0;mm:1);
|
||||
mem_reg:(op:$13;simdop:0;mm:1);
|
||||
reg_mem:(opt:[not_impl]);
|
||||
reg_imm:(opt:[not_impl]);
|
||||
reg_im8:(opt:[not_impl]);
|
||||
hint:[his_mov,his_wo];
|
||||
);
|
||||
|
||||
vmovlps_rrm_desc:t_op_type=(op:$12;index:0;mm:1);
|
||||
vmovlps_rrm_desc:t_op_type=(op:$12;simdop:0;mm:1);
|
||||
|
||||
procedure op_vmovlps(var ctx:t_jit_context2);
|
||||
begin
|
||||
|
@ -396,14 +396,14 @@ end;
|
|||
|
||||
const
|
||||
vmovlpd_desc2:t_op_desc=(
|
||||
mem_reg:(op:$13;index:1;mm:1);
|
||||
mem_reg:(op:$13;simdop:1;mm:1);
|
||||
reg_mem:(opt:[not_impl]);
|
||||
reg_imm:(opt:[not_impl]);
|
||||
reg_im8:(opt:[not_impl]);
|
||||
hint:[his_mov,his_wo];
|
||||
);
|
||||
|
||||
vmovlpd_rrm_desc:t_op_type=(op:$12;index:1;mm:1);
|
||||
vmovlpd_rrm_desc:t_op_type=(op:$12;simdop:1;mm:1);
|
||||
|
||||
procedure op_vmovlpd(var ctx:t_jit_context2);
|
||||
begin
|
||||
|
@ -425,14 +425,14 @@ end;
|
|||
|
||||
const
|
||||
vmovhps_desc2:t_op_desc=(
|
||||
mem_reg:(op:$17;index:0;mm:1);
|
||||
mem_reg:(op:$17;simdop:0;mm:1);
|
||||
reg_mem:(opt:[not_impl]);
|
||||
reg_imm:(opt:[not_impl]);
|
||||
reg_im8:(opt:[not_impl]);
|
||||
hint:[his_mov,his_wo];
|
||||
);
|
||||
|
||||
vmovhps_rrm_desc:t_op_type=(op:$16;index:0;mm:1);
|
||||
vmovhps_rrm_desc:t_op_type=(op:$16;simdop:0;mm:1);
|
||||
|
||||
procedure op_vmovhps(var ctx:t_jit_context2);
|
||||
begin
|
||||
|
@ -454,14 +454,14 @@ end;
|
|||
|
||||
const
|
||||
vmovhpd_desc2:t_op_desc=(
|
||||
mem_reg:(op:$17;index:1;mm:1);
|
||||
mem_reg:(op:$17;simdop:1;mm:1);
|
||||
reg_mem:(opt:[not_impl]);
|
||||
reg_imm:(opt:[not_impl]);
|
||||
reg_im8:(opt:[not_impl]);
|
||||
hint:[his_mov,his_wo];
|
||||
);
|
||||
|
||||
vmovhpd_rrm_desc:t_op_type=(op:$16;index:1;mm:1);
|
||||
vmovhpd_rrm_desc:t_op_type=(op:$16;simdop:1;mm:1);
|
||||
|
||||
procedure op_vmovhpd(var ctx:t_jit_context2);
|
||||
begin
|
||||
|
@ -482,7 +482,7 @@ end;
|
|||
//
|
||||
|
||||
const
|
||||
vmovmskps_desc:t_op_type=(op:$50;index:0;mm:1);
|
||||
vmovmskps_desc:t_op_type=(op:$50;simdop:0;mm:1);
|
||||
|
||||
procedure op_vmovmskps(var ctx:t_jit_context2);
|
||||
begin
|
||||
|
@ -496,7 +496,7 @@ begin
|
|||
end;
|
||||
|
||||
const
|
||||
vmovmskpd_desc:t_op_type=(op:$50;index:1;mm:1);
|
||||
vmovmskpd_desc:t_op_type=(op:$50;simdop:1;mm:1);
|
||||
|
||||
procedure op_vmovmskpd(var ctx:t_jit_context2);
|
||||
begin
|
||||
|
@ -510,7 +510,7 @@ begin
|
|||
end;
|
||||
|
||||
const
|
||||
vpmovmskb_desc:t_op_type=(op:$D7;index:1;mm:1);
|
||||
vpmovmskb_desc:t_op_type=(op:$D7;simdop:1;mm:1);
|
||||
|
||||
procedure op_vpmovmskb(var ctx:t_jit_context2);
|
||||
begin
|
||||
|
@ -528,7 +528,7 @@ end;
|
|||
const
|
||||
vptest_desc:t_op_desc=(
|
||||
mem_reg:(opt:[not_impl]);
|
||||
reg_mem:(op:$17;index:1;mm:2);
|
||||
reg_mem:(op:$17;simdop:1;mm:2);
|
||||
reg_imm:(opt:[not_impl]);
|
||||
reg_im8:(opt:[not_impl]);
|
||||
hint:[his_ro];
|
||||
|
@ -545,32 +545,21 @@ begin
|
|||
end;
|
||||
end;
|
||||
|
||||
procedure op_bmi_gen(var ctx:t_jit_context2);
|
||||
const
|
||||
blsr_desc:t_op_type=(
|
||||
op:$F3;index:1;mm:2
|
||||
desc:t_op_type=(
|
||||
op:$F3;index:0;mm:0
|
||||
);
|
||||
|
||||
procedure op_blsr(var ctx:t_jit_context2);
|
||||
var
|
||||
tmp:t_op_type;
|
||||
begin
|
||||
if is_preserved(ctx.din) or is_memory(ctx.din) then
|
||||
begin
|
||||
op_emit_avx_F3(ctx,blsr_desc);
|
||||
end else
|
||||
begin
|
||||
add_orig(ctx);
|
||||
end;
|
||||
end;
|
||||
|
||||
const
|
||||
blsi_desc:t_op_type=(
|
||||
op:$F3;index:3;mm:2
|
||||
);
|
||||
|
||||
procedure op_blsi(var ctx:t_jit_context2);
|
||||
begin
|
||||
if is_preserved(ctx.din) or is_memory(ctx.din) then
|
||||
begin
|
||||
op_emit_avx_F3(ctx,blsi_desc);
|
||||
tmp:=desc;
|
||||
tmp.index:=ctx.dis.ModRM.Index;
|
||||
tmp.mm :=ctx.dis.mm;
|
||||
//
|
||||
op_emit_avx_F3(ctx,tmp);
|
||||
end else
|
||||
begin
|
||||
add_orig(ctx);
|
||||
|
@ -581,11 +570,11 @@ end;
|
|||
|
||||
const
|
||||
vpermilps_rrm_desc:t_op_type=(
|
||||
op:$0C;index:1;mm:2;
|
||||
op:$0C;simdop:1;mm:2;
|
||||
);
|
||||
|
||||
vpermilps_rmi_desc:t_op_avx3_imm=(
|
||||
rmi:(op:$04;index:1;mm:3);
|
||||
rmi:(op:$04;simdop:1;mm:3);
|
||||
mri:(opt:[not_impl]);
|
||||
);
|
||||
|
||||
|
@ -612,11 +601,11 @@ end;
|
|||
|
||||
const
|
||||
vpermilpd_rrm_desc:t_op_type=(
|
||||
op:$0D;index:1;mm:2;
|
||||
op:$0D;simdop:1;mm:2;
|
||||
);
|
||||
|
||||
vpermilpd_rmi_desc:t_op_avx3_imm=(
|
||||
rmi:(op:$05;index:1;mm:3);
|
||||
rmi:(op:$05;simdop:1;mm:3);
|
||||
mri:(opt:[not_impl]);
|
||||
);
|
||||
|
||||
|
@ -643,7 +632,7 @@ end;
|
|||
|
||||
const
|
||||
vpblendvb_desc:t_op_type=(
|
||||
op:$4C;index:1;mm:3
|
||||
op:$4C;simdop:1;mm:3
|
||||
);
|
||||
|
||||
procedure op_vpblendvb(var ctx:t_jit_context2);
|
||||
|
@ -659,7 +648,7 @@ end;
|
|||
|
||||
const
|
||||
vblendvps_desc:t_op_type=(
|
||||
op:$4A;index:1;mm:3
|
||||
op:$4A;simdop:1;mm:3
|
||||
);
|
||||
|
||||
procedure op_vblendvps(var ctx:t_jit_context2);
|
||||
|
@ -675,7 +664,7 @@ end;
|
|||
|
||||
const
|
||||
vblendvpd_desc:t_op_type=(
|
||||
op:$4B;index:1;mm:3
|
||||
op:$4B;simdop:1;mm:3
|
||||
);
|
||||
|
||||
procedure op_vblendvpd(var ctx:t_jit_context2);
|
||||
|
@ -693,7 +682,7 @@ end;
|
|||
|
||||
const
|
||||
bextr_desc:t_op_type=(
|
||||
op:$F7;index:0;mm:2;
|
||||
op:$F7;simdop:0;mm:2;
|
||||
);
|
||||
|
||||
procedure op_bextr(var ctx:t_jit_context2);
|
||||
|
@ -709,7 +698,7 @@ end;
|
|||
|
||||
const
|
||||
andn_desc:t_op_type=(
|
||||
op:$F2;index:0;mm:2;
|
||||
op:$F2;simdop:0;mm:2;
|
||||
);
|
||||
|
||||
procedure op_andn(var ctx:t_jit_context2);
|
||||
|
@ -728,7 +717,7 @@ end;
|
|||
const
|
||||
vbroadcastss_desc:t_op_desc=(
|
||||
mem_reg:(opt:[not_impl]);
|
||||
reg_mem:(op:$18;index:1;mm:2;opt:[not_vex_len]);
|
||||
reg_mem:(op:$18;simdop:1;mm:2;opt:[not_vex_len]);
|
||||
reg_imm:(opt:[not_impl]);
|
||||
reg_im8:(opt:[not_impl]);
|
||||
hint:[his_wo];
|
||||
|
@ -748,7 +737,7 @@ end;
|
|||
const
|
||||
vbroadcastsd_desc:t_op_desc=(
|
||||
mem_reg:(opt:[not_impl]);
|
||||
reg_mem:(op:$19;index:1;mm:2;opt:[not_vex_len]);
|
||||
reg_mem:(op:$19;simdop:1;mm:2;opt:[not_vex_len]);
|
||||
reg_imm:(opt:[not_impl]);
|
||||
reg_im8:(opt:[not_impl]);
|
||||
hint:[];
|
||||
|
@ -768,7 +757,7 @@ end;
|
|||
const
|
||||
vbroadcastf128_desc:t_op_desc=(
|
||||
mem_reg:(opt:[not_impl]);
|
||||
reg_mem:(op:$1A;index:1;mm:2;opt:[not_vex_len]);
|
||||
reg_mem:(op:$1A;simdop:1;mm:2;opt:[not_vex_len]);
|
||||
reg_imm:(opt:[not_impl]);
|
||||
reg_im8:(opt:[not_impl]);
|
||||
hint:[his_wo];
|
||||
|
@ -847,8 +836,9 @@ begin
|
|||
|
||||
jit_cbs[OPPv,OPptest,OPSnone]:=@op_vptest;
|
||||
|
||||
jit_cbs[OPPnone,OPblsr,OPSnone ]:=@op_blsr;
|
||||
jit_cbs[OPPnone,OPblsi,OPSnone ]:=@op_blsi;
|
||||
jit_cbs[OPPnone,OPblsr ,OPSnone]:=@op_bmi_gen;
|
||||
jit_cbs[OPPnone,OPblsmsk,OPSnone]:=@op_bmi_gen;
|
||||
jit_cbs[OPPnone,OPblsi ,OPSnone]:=@op_bmi_gen;
|
||||
|
||||
jit_cbs[OPPv,OPxor ,OPSx_ps]:=@op_emit_avx3_gen;
|
||||
jit_cbs[OPPv,OPxor ,OPSx_pd]:=@op_emit_avx3_gen;
|
||||
|
|
Loading…
Reference in New Issue