From e85a55309824480667a36c231d99b3ae0113884c Mon Sep 17 00:00:00 2001 From: Pavel <68122101+red-prig@users.noreply.github.com> Date: Tue, 26 Sep 2023 21:30:04 +0300 Subject: [PATCH] + --- rtl/x86_fpdbgdisas.pp | 4 +- rtl/x86_jit.pas | 178 ++- sys/test/kern_jit2.pas | 7 +- sys/test/kern_jit2_ctx.pas | 30 +- sys/test/kern_jit2_ops.pas | 2364 ------------------------------- sys/test/kern_jit2_ops_avx.pas | 2418 ++++++++++++++++++++++++++++++++ sys/test/project1.lpi | 4 + 7 files changed, 2558 insertions(+), 2447 deletions(-) create mode 100644 sys/test/kern_jit2_ops_avx.pas diff --git a/rtl/x86_fpdbgdisas.pp b/rtl/x86_fpdbgdisas.pp index 3e9c696a..c19af89e 100644 --- a/rtl/x86_fpdbgdisas.pp +++ b/rtl/x86_fpdbgdisas.pp @@ -1794,12 +1794,12 @@ end; procedure TX86Disassembler.AddUpd; begin - AddModRM([modReg], os128, regXmm); + AddModRM([modReg], VectorSize, regXmm); end; procedure TX86Disassembler.AddUps; begin - AddModRM([modReg], os128, regXmm); + AddModRM([modReg], VectorSize, regXmm); end; procedure TX86Disassembler.AddUq; diff --git a/rtl/x86_jit.pas b/rtl/x86_jit.pas index 11a809e1..179b9536 100644 --- a/rtl/x86_jit.pas +++ b/rtl/x86_jit.pas @@ -341,8 +341,8 @@ type procedure _VVM (const desc:t_op_type;reg0,reg1:TRegValue;mem:t_jit_regs;size:TOperandSize); procedure _VVMI8 (const desc:t_op_type;reg0,reg1:TRegValue;mem:t_jit_regs;size:TOperandSize;imm8:Byte); procedure _VVMV (const desc:t_op_type;reg0,reg1:TRegValue;mem:t_jit_regs;size:TOperandSize;reg2:TRegValue); - procedure _VVV (const desc:t_op_type;reg0,reg1,reg2:TRegValue); - procedure _VVVI8 (const desc:t_op_type;reg0,reg1,reg2:TRegValue;imm8:Byte); + procedure _VVV (const desc:t_op_type;reg0,reg1,reg2:TRegValue;size:TOperandSize); + procedure _VVVI8 (const desc:t_op_type;reg0,reg1,reg2:TRegValue;size:TOperandSize;imm8:Byte); procedure _VVI8 (const desc:t_op_type;reg0,reg1:TRegValue;size:TOperandSize;imm8:Byte); procedure _VMI8 (const desc:t_op_type;reg:TRegValue;mem:t_jit_regs;size:TOperandSize;imm8:Byte); procedure vmovdqu (reg:TRegValue ;mem:t_jit_regs); @@ -3240,15 +3240,20 @@ begin ji:=default_jit_instruction; Vex.Length:=0; + Vex.rexW:=False; - if not (not_vex_len in desc.opt) then - case reg0.ASize of - os128:Vex.Length:=0; - os256:Vex.Length:=1; - else; + if (size=os0) then + begin + size:=reg0.ASize; end; - Vex.rexW:=False; + if not (not_vex_len in desc.opt) then + if (size=os256) then + begin + Vex.Length:=1; + end; + + if not (not_prefix in desc.opt) then if (size=os64) then begin Vex.rexW:=True; @@ -3312,15 +3317,20 @@ begin ji:=default_jit_instruction; Vex.Length:=0; + Vex.rexW:=False; - if not (not_vex_len in desc.opt) then - case reg.ASize of - os128:Vex.Length:=0; - os256:Vex.Length:=1; - else; + if (size=os0) then + begin + size:=reg.ASize; end; - Vex.rexW:=False; + if not (not_vex_len in desc.opt) then + if (size=os256) then + begin + Vex.Length:=1; + end; + + if not (not_prefix in desc.opt) then if (size=os64) then begin Vex.rexW:=True; @@ -3383,8 +3393,20 @@ begin ji:=default_jit_instruction; Vex.Length:=0; - Vex.rexW:=False; + + if (size=os0) then + begin + size:=reg0.ASize; + end; + + if not (not_vex_len in desc.opt) then + if (size=os256) then + begin + Vex.Length:=1; + end; + + if not (not_prefix in desc.opt) then if (size=os64) then begin Vex.rexW:=True; @@ -3442,29 +3464,27 @@ begin ji:=default_jit_instruction; Vex.Length:=0; - - if not (not_vex_len in desc.opt) then - case reg0.ASize of - os128:Vex.Length:=0; - os256:Vex.Length:=1; - else; - end; - - Vex.Index:=reg1.AIndex; + Vex.rexW:=False; if (size=os0) then begin size:=reg0.ASize; end; + if not (not_vex_len in desc.opt) then + if (size=os256) then + begin + Vex.Length:=1; + end; + + if not (not_prefix in desc.opt) then if (size=os64) then begin Vex.rexW:=True; - end else - begin - Vex.rexW:=False; end; + Vex.Index:=reg1.AIndex; + modrm_info:=Default(t_modrm_info); modrm_info.build_rm(reg0,mreg); @@ -3538,29 +3558,27 @@ begin ji:=default_jit_instruction; Vex.Length:=0; - - if not (not_vex_len in desc.opt) then - case reg0.ASize of - os128:Vex.Length:=0; - os256:Vex.Length:=1; - else; - end; - - Vex.Index:=reg1.AIndex; + Vex.rexW:=False; if (size=os0) then begin size:=reg0.ASize; end; + if not (not_vex_len in desc.opt) then + if (size=os256) then + begin + Vex.Length:=1; + end; + + if not (not_prefix in desc.opt) then if (size=os64) then begin Vex.rexW:=True; - end else - begin - Vex.rexW:=False; end; + Vex.Index:=reg1.AIndex; + modrm_info:=Default(t_modrm_info); modrm_info.build_rm(reg0,mreg); @@ -3607,7 +3625,7 @@ begin _VVMI8(desc,reg0,reg1,mem,size,reg2.AIndex shl 4); end; -procedure t_jit_builder._VVV(const desc:t_op_type;reg0,reg1,reg2:TRegValue); +procedure t_jit_builder._VVV(const desc:t_op_type;reg0,reg1,reg2:TRegValue;size:TOperandSize); var modrm_info:t_modrm_info; @@ -3637,22 +3655,27 @@ begin ji:=default_jit_instruction; Vex.Length:=0; + Vex.rexW:=False; - if not (not_vex_len in desc.opt) then - case reg0.ASize of - os128:Vex.Length:=0; - os256:Vex.Length:=1; - else; + if (size=os0) then + begin + size:=reg0.ASize; end; - Vex.Index:=reg1.AIndex; + if not (not_vex_len in desc.opt) then + if (size=os256) then + begin + Vex.Length:=1; + end; - Vex.rexW:=False; - if (reg0.ASize=os64) then + if not (not_prefix in desc.opt) then + if (size=os64) then begin Vex.rexW:=True; end; + Vex.Index:=reg1.AIndex; + modrm_info:=Default(t_modrm_info); modrm_info.build_rr(reg2,reg0); @@ -3680,7 +3703,7 @@ begin _add(ji); end; -procedure t_jit_builder._VVVI8(const desc:t_op_type;reg0,reg1,reg2:TRegValue;imm8:Byte); +procedure t_jit_builder._VVVI8(const desc:t_op_type;reg0,reg1,reg2:TRegValue;size:TOperandSize;imm8:Byte); var modrm_info:t_modrm_info; @@ -3710,22 +3733,27 @@ begin ji:=default_jit_instruction; Vex.Length:=0; + Vex.rexW:=False; - if not (not_vex_len in desc.opt) then - case reg0.ASize of - os128:Vex.Length:=0; - os256:Vex.Length:=1; - else; + if (size=os0) then + begin + size:=reg0.ASize; end; - Vex.Index:=reg1.AIndex; + if not (not_vex_len in desc.opt) then + if (size=os256) then + begin + Vex.Length:=1; + end; - Vex.rexW:=False; - if (reg0.ASize=os64) then + if not (not_prefix in desc.opt) then + if (size=os64) then begin Vex.rexW:=True; end; + Vex.Index:=reg1.AIndex; + modrm_info:=Default(t_modrm_info); modrm_info.build_rr(reg2,reg0); @@ -3780,25 +3808,23 @@ begin ji:=default_jit_instruction; Vex.Length:=0; - - if not (not_vex_len in desc.opt) then - case reg1.ASize of - os128:Vex.Length:=0; - os256:Vex.Length:=1; - else; - end; + Vex.rexW:=False; if (size=os0) then begin size:=reg0.ASize; end; + if not (not_vex_len in desc.opt) then + if (size=os256) then + begin + Vex.Length:=1; + end; + + if not (not_prefix in desc.opt) then if (size=os64) then begin Vex.rexW:=True; - end else - begin - Vex.rexW:=False; end; modrm_info:=Default(t_modrm_info); @@ -3848,25 +3874,23 @@ begin ji:=default_jit_instruction; Vex.Length:=0; - - if not (not_vex_len in desc.opt) then - case reg.ASize of - os128:Vex.Length:=0; - os256:Vex.Length:=1; - else; - end; + Vex.rexW:=False; if (size=os0) then begin size:=reg.ASize; end; + if not (not_vex_len in desc.opt) then + if (size=os256) then + begin + Vex.Length:=1; + end; + + if not (not_prefix in desc.opt) then if (size=os64) then begin Vex.rexW:=True; - end else - begin - Vex.rexW:=False; end; modrm_info:=Default(t_modrm_info); diff --git a/sys/test/kern_jit2.pas b/sys/test/kern_jit2.pas index 12dd2bde..8839f09c 100644 --- a/sys/test/kern_jit2.pas +++ b/sys/test/kern_jit2.pas @@ -16,7 +16,8 @@ uses x86_fpdbgdisas, x86_jit, kern_stub, - kern_jit2_ctx; + kern_jit2_ctx, + kern_jit2_ops_avx; procedure pick(var ctx:t_jit_context2); @@ -556,6 +557,9 @@ begin jit_cbs[OPPnone,OPnop,OPSnone]:=@op_nop; + kern_jit2_ops.init_cbs; + init_cbs_avx; + inited:=1; end; @@ -584,7 +588,6 @@ var begin init_cbs; - kern_jit2_ops.init_cbs; ctx.max:=QWORD(ctx.max_forward_point); Writeln(' ctx.text_start:0x',HexStr(ctx.text_start,16)); diff --git a/sys/test/kern_jit2_ctx.pas b/sys/test/kern_jit2_ctx.pas index 828349c2..db66ab2f 100644 --- a/sys/test/kern_jit2_ctx.pas +++ b/sys/test/kern_jit2_ctx.pas @@ -205,6 +205,7 @@ procedure op_save_rax(var ctx:t_jit_context2;reg:TRegValue); procedure op_emit1(var ctx:t_jit_context2;const desc:t_op_type;hint:t_op_hint); procedure op_emit2(var ctx:t_jit_context2;const desc:t_op_desc); procedure op_emit_shift(var ctx:t_jit_context2;const desc:t_op_shift); +procedure op_emit_avx2_rr(var ctx:t_jit_context2;const desc:t_op_type); procedure op_emit_avx2(var ctx:t_jit_context2;const desc:t_op_desc); procedure op_emit_avx3(var ctx:t_jit_context2;const desc:t_op_type); procedure op_emit_avx3_imm8(var ctx:t_jit_context2;const desc:t_op_avx3_imm); @@ -1996,6 +1997,31 @@ end; // +procedure op_emit_avx2_rr(var ctx:t_jit_context2;const desc:t_op_type); +var + i:Integer; + new1,new2:TRegValue; +begin + if is_preserved(ctx.din.Operand[1]) then + begin + with ctx.builder do + begin + new1:=r_tmp0; + new2:=new_reg(ctx.din.Operand[2]); + + _VV(desc,new1,new2,new2.ASize); + + i:=GetFrameOffset(ctx.din.Operand[1]); + movq([r_thrd+i],new1); + end; + end else + begin + Assert(False); + end; +end; + +// + procedure op_emit_avx2(var ctx:t_jit_context2;const desc:t_op_desc); var i:Integer; @@ -2639,7 +2665,7 @@ begin new3:=new_reg(ctx.din.Operand[3]); end; - _VVV(desc,new1,new3,new2); //1 3 2 + _VVV(desc,new1,new3,new2,new3.ASize); //1 3 2 if is_preserved(ctx.din.Operand[1]) then begin @@ -2705,7 +2731,7 @@ begin new3:=new_reg(ctx.din.Operand[3]); end; - _VVV(desc,new1,new2,new3); //1 2 3 + _VVV(desc,new1,new2,new3,new3.ASize); //1 2 3 if is_preserved(ctx.din.Operand[1]) then begin diff --git a/sys/test/kern_jit2_ops.pas b/sys/test/kern_jit2_ops.pas index 52804d35..cb130e84 100644 --- a/sys/test/kern_jit2_ops.pas +++ b/sys/test/kern_jit2_ops.pas @@ -528,484 +528,6 @@ begin end; end; -const - vmovups_desc:t_op_desc=( - mem_reg:(op:$11;index:0;mm:1); - reg_mem:(op:$10;index:0;mm:1); - reg_imm:(opt:[not_impl]); - reg_im8:(opt:[not_impl]); - hint:[his_mov,his_wo]; - ); - -procedure op_vmovups(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx2(ctx,vmovups_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vmovupd_desc:t_op_desc=( - mem_reg:(op:$11;index:1;mm:1); - reg_mem:(op:$10;index:1;mm:1); - reg_imm:(opt:[not_impl]); - reg_im8:(opt:[not_impl]); - hint:[his_mov,his_wo]; - ); - -procedure op_vmovupd(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx2(ctx,vmovupd_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vmovaps_desc:t_op_desc=( - mem_reg:(op:$29;index:0;mm:1); - reg_mem:(op:$28;index:0;mm:1); - reg_imm:(opt:[not_impl]); - reg_im8:(opt:[not_impl]); - hint:[his_mov,his_wo,his_align]; - ); - -procedure op_vmovaps(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx2(ctx,vmovaps_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vmovapd_desc:t_op_desc=( - mem_reg:(op:$29;index:1;mm:1); - reg_mem:(op:$28;index:1;mm:1); - reg_imm:(opt:[not_impl]); - reg_im8:(opt:[not_impl]); - hint:[his_mov,his_wo,his_align]; - ); - -procedure op_vmovapd(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx2(ctx,vmovapd_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vmovdqu_desc:t_op_desc=( - mem_reg:(op:$7F;index:2;mm:1); - reg_mem:(op:$6F;index:2;mm:1); - reg_imm:(opt:[not_impl]); - reg_im8:(opt:[not_impl]); - hint:[his_mov,his_wo]; - ); - -procedure op_vmovdqu(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx2(ctx,vmovdqu_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vmovdqa_desc:t_op_desc=( - mem_reg:(op:$7F;index:1;mm:1); - reg_mem:(op:$6F;index:1;mm:1); - reg_imm:(opt:[not_impl]); - reg_im8:(opt:[not_impl]); - hint:[his_mov,his_wo,his_align]; - ); - -procedure op_vmovdqa(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx2(ctx,vmovdqa_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vmovntdqa_desc:t_op_desc=( - mem_reg:(opt:[not_impl]); - reg_mem:(op:$2A;index:1;mm:2); - reg_imm:(opt:[not_impl]); - reg_im8:(opt:[not_impl]); - hint:[his_mov,his_wo,his_align]; - ); - -procedure op_vmovntdqa(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx2(ctx,vmovntdqa_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vmovntdq_desc:t_op_desc=( - mem_reg:(op:$E7;index:1;mm:1); - reg_mem:(opt:[not_impl]); - reg_imm:(opt:[not_impl]); - reg_im8:(opt:[not_impl]); - hint:[his_mov,his_wo]; - ); - -procedure op_vmovntdq(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx2(ctx,vmovntdq_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vmovddup_desc:t_op_desc=( - mem_reg:(opt:[not_impl]); - reg_mem:(op:$12;index:3;mm:1); - reg_imm:(opt:[not_impl]); - reg_im8:(opt:[not_impl]); - hint:[his_mov,his_wo]; - ); - -procedure op_vmovddup(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx2(ctx,vmovddup_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vmovq_desc:t_op_desc=( //vmovd_desc - mem_reg:(op:$7E;index:1;mm:1); - reg_mem:(op:$6E;index:1;mm:1); - reg_imm:(opt:[not_impl]); - reg_im8:(opt:[not_impl]); - hint:[his_mov,his_wo]; - ); - -procedure op_vmovq(var ctx:t_jit_context2); //op_vmovd -begin - if is_preserved(ctx.din) or is_memory(ctx.din) then - begin - op_emit_avx2(ctx,vmovq_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vmovss_mrr_desc:t_op_type=(op:$11;index:2;mm:1;opt:[not_vex_len]); - vmovss_rrm_desc:t_op_type=(op:$10;index:2;mm:1;opt:[not_vex_len]); - -procedure op_vmovss(var ctx:t_jit_context2); -begin - if is_preserved(ctx.din) or is_memory(ctx.din) then - begin - if is_memory(ctx.din.Operand[1]) then - begin - op_emit_avx3(ctx,vmovss_mrr_desc); - end else - if is_memory(ctx.din.Operand[3]) then - begin - op_emit_avx3(ctx,vmovss_rrm_desc); - end else - begin - Assert(False); - end; - end else - begin - add_orig(ctx); - end; -end; - -const - vmovsd_mrr_desc:t_op_type=(op:$11;index:3;mm:1;opt:[not_vex_len]); - vmovsd_rrm_desc:t_op_type=(op:$10;index:3;mm:1;opt:[not_vex_len]); - -procedure op_vmovsd(var ctx:t_jit_context2); -begin - if is_preserved(ctx.din) or is_memory(ctx.din) then - begin - if is_memory(ctx.din.Operand[1]) then - begin - op_emit_avx3(ctx,vmovsd_mrr_desc); - end else - if is_memory(ctx.din.Operand[3]) then - begin - op_emit_avx3(ctx,vmovsd_rrm_desc); - end else - begin - Assert(False); - end; - end else - begin - add_orig(ctx); - end; -end; - -const - vmovlpd_desc2:t_op_desc=( - mem_reg:(op:$13;index: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); - -procedure op_vmovlpd(var ctx:t_jit_context2); -begin - if is_preserved(ctx.din) or is_memory(ctx.din) then - begin - case ctx.din.OperCnt of - 2:op_emit_avx2(ctx,vmovlpd_desc2); - 3:op_emit_avx3(ctx,vmovlpd_rrm_desc); - else - Assert(False); - end; - end else - begin - add_orig(ctx); - end; -end; - -const - vmovhpd_desc2:t_op_desc=( - mem_reg:(op:$17;index: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); - -procedure op_vmovhpd(var ctx:t_jit_context2); -begin - if is_preserved(ctx.din) or is_memory(ctx.din) then - begin - case ctx.din.OperCnt of - 2:op_emit_avx2(ctx,vmovhpd_desc2); - 3:op_emit_avx3(ctx,vmovhpd_rrm_desc); - else - Assert(False); - end; - end else - begin - add_orig(ctx); - end; -end; - -const - vmovsldup_desc:t_op_desc=( - mem_reg:(opt:[not_impl]); - reg_mem:(op:$12;index:2;mm:1); - reg_imm:(opt:[not_impl]); - reg_im8:(opt:[not_impl]); - hint:[his_mov,his_wo]; - ); - -procedure op_vmovsldup(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx2(ctx,vmovsldup_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vmovshdup_desc:t_op_desc=( - mem_reg:(opt:[not_impl]); - reg_mem:(op:$16;index:2;mm:1); - reg_imm:(opt:[not_impl]); - reg_im8:(opt:[not_impl]); - hint:[his_mov,his_wo]; - ); - -procedure op_vmovshdup(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx2(ctx,vmovshdup_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vpmovsxbw_desc:t_op_desc=( - mem_reg:(opt:[not_impl]); - reg_mem:(op:$20;index:1;mm:2); - reg_imm:(opt:[not_impl]); - reg_im8:(opt:[not_impl]); - hint:[his_mov,his_wo]; - ); - -procedure op_vpmovsxbw(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx2(ctx,vpmovsxbw_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vpmovsxdq_desc:t_op_desc=( - mem_reg:(opt:[not_impl]); - reg_mem:(op:$25;index:1;mm:2); - reg_imm:(opt:[not_impl]); - reg_im8:(opt:[not_impl]); - hint:[his_mov,his_wo]; - ); - -procedure op_vpmovsxdq(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx2(ctx,vpmovsxdq_desc); - end else - begin - add_orig(ctx); - end; -end; - -// - -const - vucomiss_desc:t_op_desc=( - mem_reg:(opt:[not_impl]); - reg_mem:(op:$2E;index:0;mm:1); - reg_imm:(opt:[not_impl]); - reg_im8:(opt:[not_impl]); - hint:[]; - ); - -procedure op_vucomiss(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx2(ctx,vucomiss_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vucomisd_desc:t_op_desc=( - mem_reg:(opt:[not_impl]); - reg_mem:(op:$2E;index:1;mm:1); - reg_imm:(opt:[not_impl]); - reg_im8:(opt:[not_impl]); - hint:[]; - ); - -procedure op_vucomisd(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx2(ctx,vucomisd_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vptest_desc:t_op_desc=( - mem_reg:(opt:[not_impl]); - reg_mem:(op:$17;index:1;mm:2); - reg_imm:(opt:[not_impl]); - reg_im8:(opt:[not_impl]); - hint:[his_ro]; - ); - -procedure op_vptest(var ctx:t_jit_context2); -begin - if is_preserved(ctx.din) or is_memory(ctx.din) then - begin - op_emit_avx2(ctx,vptest_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - blsr_desc:t_op_type=( - op:$F3;index:1;mm:2 - ); - -procedure op_blsr(var ctx:t_jit_context2); -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); - end else - begin - add_orig(ctx); - end; -end; - const SETcc_8:array[OPSc_o..OPSc_nle] of Byte=( $90,$91,$92,$93,$94,$95,$96,$97, @@ -1395,1712 +917,8 @@ begin end; end; -const - vxorps_desc:t_op_type=( - op:$57;index:0;mm:1; - ); - -procedure op_vxorps(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vxorps_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vxorpd_desc:t_op_type=( - op:$57;index:1;mm:1; - ); - -procedure op_vxorpd(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vxorpd_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vpcmpeqb_desc:t_op_type=( - op:$74;index:1;mm:1; - ); - -procedure op_vpcmpeqb(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vpcmpeqb_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vpcmpeqw_desc:t_op_type=( - op:$75;index:1;mm:1; - ); - -procedure op_vpcmpeqw(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vpcmpeqw_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vpcmpeqd_desc:t_op_type=( - op:$76;index:1;mm:1; - ); - -procedure op_vpcmpeqd(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vpcmpeqd_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vpcmpgtd_desc:t_op_type=( - op:$66;index:1;mm:1; - ); - -procedure op_vpcmpgtd(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vpcmpgtd_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vpcmpestri_desc:t_op_avx3_imm=( - rmi:(op:$61;index:1;mm:3); - mri:(opt:[not_impl]); - ); - -procedure op_vpcmpestri(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3_imm8(ctx,vpcmpestri_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vpcmpistrm_desc:t_op_avx3_imm=( - rmi:(op:$62;index:1;mm:3); - mri:(opt:[not_impl]); - ); - -procedure op_vpcmpistrm(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3_imm8(ctx,vpcmpistrm_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vpcmpistri_desc:t_op_avx3_imm=( - rmi:(op:$63;index:1;mm:3); - mri:(opt:[not_impl]); - ); - -procedure op_vpcmpistri(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3_imm8(ctx,vpcmpistri_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vsubsd_desc:t_op_type=( - op:$5C;index:3;mm:1; - ); - -procedure op_vsubsd(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vsubsd_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vsubss_desc:t_op_type=( - op:$5C;index:2;mm:1; - ); - -procedure op_vsubss(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vsubss_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vsubps_desc:t_op_type=( - op:$5C;index:0;mm:1; - ); - -procedure op_vsubps(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vsubps_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vsubpd_desc:t_op_type=( - op:$5C;index:1;mm:1; - ); - -procedure op_vsubpd(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vsubpd_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vpsubw_desc:t_op_type=( - op:$F9;index:1;mm:1; - ); - -procedure op_vpsubw(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vpsubw_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vpsubd_desc:t_op_type=( - op:$FA;index:1;mm:1; - ); - -procedure op_vpsubd(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vpsubd_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vpsubq_desc:t_op_type=( - op:$FB;index:1;mm:1; - ); - -procedure op_vpsubq(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vpsubq_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vpaddb_desc:t_op_type=( - op:$FC;index:1;mm:1; - ); - -procedure op_vpaddb(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vpaddb_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vpaddw_desc:t_op_type=( - op:$FD;index:1;mm:1; - ); - -procedure op_vpaddw(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vpaddw_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vpaddd_desc:t_op_type=( - op:$FE;index:1;mm:1; - ); - -procedure op_vpaddd(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vpaddd_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vpaddq_desc:t_op_type=( - op:$D4;index:1;mm:1; - ); - -procedure op_vpaddq(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vpaddq_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vaddps_desc:t_op_type=( - op:$58;index:0;mm:1; - ); - -procedure op_vaddps(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vaddps_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vaddpd_desc:t_op_type=( - op:$58;index:1;mm:1; - ); - -procedure op_vaddpd(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vaddpd_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vaddss_desc:t_op_type=( - op:$58;index:2;mm:1; - ); - -procedure op_vaddss(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vaddss_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vaddsd_desc:t_op_type=( - op:$58;index:3;mm:1; - ); - -procedure op_vaddsd(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vaddsd_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vphaddw_desc:t_op_type=( - op:$01;index:1;mm:2; - ); - -procedure op_vphaddw(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vphaddw_desc); - end else - begin - add_orig(ctx); - end; -end; - - -const - vphaddd_desc:t_op_type=( - op:$02;index:1;mm:2; - ); - -procedure op_vphaddd(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vphaddd_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vdivps_desc:t_op_type=( - op:$5E;index:0;mm:1; - ); - -procedure op_vdivps(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vdivps_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vdivpd_desc:t_op_type=( - op:$5E;index:1;mm:1; - ); - -procedure op_vdivpd(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vdivpd_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vdivss_desc:t_op_type=( - op:$5E;index:2;mm:1; - ); - -procedure op_vdivss(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vdivss_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vdivsd_desc:t_op_type=( - op:$5E;index:3;mm:1; - ); - -procedure op_vdivsd(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vdivsd_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vmulps_desc:t_op_type=( - op:$59;index:0;mm:1; - ); - -procedure op_vmulps(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vmulps_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vmulpd_desc:t_op_type=( - op:$59;index:1;mm:1; - ); - -procedure op_vmulpd(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vmulpd_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vmulss_desc:t_op_type=( - op:$59;index:2;mm:1; - ); - -procedure op_vmulss(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vmulss_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vmulsd_desc:t_op_type=( - op:$59;index:3;mm:1; - ); - -procedure op_vmulsd(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vmulsd_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vpmullw_desc:t_op_type=( - op:$D5;index:1;mm:1; - ); - -procedure op_vpmullw(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vpmullw_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vpmulhuw_desc:t_op_type=( - op:$E4;index:1;mm:1; - ); - -procedure op_vpmulhuw(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vpmulhuw_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vpunpcklqdq_desc:t_op_type=( - op:$6C;index:1;mm:1; - ); - -procedure op_vpunpcklqdq(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vpunpcklqdq_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vpunpcklwd_desc:t_op_type=( - op:$61;index:1;mm:1; - ); - -procedure op_vpunpcklwd(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vpunpcklwd_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vpunpckldq_desc:t_op_type=( - op:$62;index:1;mm:1; - ); - -procedure op_vpunpckldq(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vpunpckldq_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vunpcklpd_desc:t_op_type=( - op:$14;index:1;mm:1; - ); - -procedure op_vunpcklpd(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vunpcklpd_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vcmpps_desc:t_op_type=( - op:$C2;index:0;mm:1; - ); - -procedure op_vcmpps(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vcmpps_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vcmppd_desc:t_op_type=( - op:$C2;index:1;mm:1; - ); - -procedure op_vcmppd(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vcmppd_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vcmpsd_desc:t_op_type=( - op:$C2;index:3;mm:1; - ); - -procedure op_vcmpsd(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vcmpsd_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vcmpss_desc:t_op_type=( - op:$C2;index:2;mm:1; - ); - -procedure op_vcmpss(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vcmpss_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vpshufd_desc:t_op_type=( - op:$70;index:1;mm:1; - ); - -procedure op_vpshufd(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vpshufd_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vpshufb_desc:t_op_type=( - op:$00;index:1;mm:2; - ); - -procedure op_vpshufb(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vpshufb_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vpermilps_rrm_desc:t_op_type=( - op:$0C;index:1;mm:2; - ); - - vpermilps_rmi_desc:t_op_avx3_imm=( - rmi:(op:$04;index:1;mm:3); - mri:(opt:[not_impl]); - ); - -procedure op_vpermilps(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - if is_memory(ctx.din.Operand[3]) then - begin - op_emit_avx3(ctx,vpermilps_rrm_desc); - end else - if (ctx.din.Operand[3].ByteCount<>0) then - begin - op_emit_avx3_imm8(ctx,vpermilps_rmi_desc); - end else - begin - Assert(False); - end; - end else - begin - add_orig(ctx); - end; -end; - -const - vpermilpd_rrm_desc:t_op_type=( - op:$0D;index:1;mm:2; - ); - - vpermilpd_rmi_desc:t_op_avx3_imm=( - rmi:(op:$05;index:1;mm:3); - mri:(opt:[not_impl]); - ); - -procedure op_vpermilpd(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - if is_memory(ctx.din.Operand[3]) then - begin - op_emit_avx3(ctx,vpermilpd_rrm_desc); - end else - if (ctx.din.Operand[3].ByteCount<>0) then - begin - op_emit_avx3_imm8(ctx,vpermilpd_rmi_desc); - end else - begin - Assert(False); - end; - end else - begin - add_orig(ctx); - end; -end; - -const - vperm2f128_desc:t_op_type=( - op:$06;index:1;mm:3;opt:[not_vex_len] - ); - -procedure op_vperm2f128(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vperm2f128_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vpsrlw_desc:t_op_type=( - op:$D1;index:1;mm:1; - ); - -procedure op_vpsrlw(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vpsrlw_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vpsrlq_desc:t_op_type=( - op:$D3;index:1;mm:1; - ); - -procedure op_vpsrlq(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vpsrlq_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vpminud_desc:t_op_type=( - op:$3B;index:1;mm:2; - ); - -procedure op_vpminud(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vpminud_desc); - end else - begin - add_orig(ctx); - end; -end; - - -const - vmaskmovps_rrm_desc:t_op_type=( - op:$2C;index:1;mm:2; - ); - - vmaskmovps_mrr_desc:t_op_type=( - op:$2E;index:1;mm:2; - ); - - -procedure op_vmaskmovps(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - if is_memory(ctx.din.Operand[3]) then - begin - op_emit_avx3(ctx,vmaskmovps_rrm_desc); - end else - begin - op_emit_avx3(ctx,vmaskmovps_mrr_desc); - end; - end else - begin - add_orig(ctx); - end; -end; - -const - vpxor_desc:t_op_type=( - op:$EF;index:1;mm:1; - ); - -procedure op_vpxor(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vpxor_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vorps_desc:t_op_type=( - op:$56;index:0;mm:1; - ); - -procedure op_vorps(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vorps_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vorpd_desc:t_op_type=( - op:$56;index:1;mm:1; - ); - -procedure op_vorpd(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vorpd_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vpor_desc:t_op_type=( - op:$EB;index:1;mm:1; - ); - -procedure op_vpor(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vpor_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vandps_desc:t_op_type=( - op:$54;index:0;mm:1; - ); - -procedure op_vandps(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vandps_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vandpd_desc:t_op_type=( - op:$54;index:1;mm:1; - ); - -procedure op_vandpd(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vandpd_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vandnps_desc:t_op_type=( - op:$55;index:0;mm:1; - ); - -procedure op_vandnps(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vandnps_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vandnpd_desc:t_op_type=( - op:$55;index:1;mm:1; - ); - -procedure op_vandnpd(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vandnpd_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vpand_desc:t_op_type=( - op:$DB;index:1;mm:1; - ); - -procedure op_vpand(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vpand_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vpandn_desc:t_op_type=( - op:$DF;index:1;mm:1; - ); - -procedure op_vpandn(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vpandn_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vblendps_desc:t_op_type=( - op:$0C;index:1;mm:3 - ); - -procedure op_vblendps(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vblendps_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vblendpd_desc:t_op_type=( - op:$0D;index:1;mm:3 - ); - -procedure op_vblendpd(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vblendpd_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vpblendw_desc:t_op_type=( - op:$0E;index:1;mm:3 - ); - -procedure op_vpblendw(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vpblendw_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vblendvps_desc:t_op_type=( - op:$4A;index:1;mm:3 - ); - -procedure op_vblendvps(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx4(ctx,vblendvps_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vblendvpd_desc:t_op_type=( - op:$4B;index:1;mm:3 - ); - -procedure op_vblendvpd(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx4(ctx,vblendvpd_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vcvtsi2ss_desc:t_op_type=( - op:$2A;index:2;mm:1; - ); - -procedure op_vcvtsi2ss(var ctx:t_jit_context2); -begin - if is_preserved(ctx.din) or is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vcvtsi2ss_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vcvtsi2sd_desc:t_op_type=( - op:$2A;index:3;mm:1; - ); - -procedure op_vcvtsi2sd(var ctx:t_jit_context2); -begin - if is_preserved(ctx.din) or is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vcvtsi2sd_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vcvtss2sd_desc:t_op_type=( - op:$5A;index:2;mm:1; - ); - -procedure op_vcvtss2sd(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vcvtss2sd_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vcvtsd2ss_desc:t_op_type=( - op:$5A;index:3;mm:1; - ); - -procedure op_vcvtsd2ss(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vcvtsd2ss_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vcvttps2dq_desc:t_op_desc=( - mem_reg:(opt:[not_impl]); - reg_mem:(op:$5B;index:2;mm:1); - reg_imm:(opt:[not_impl]); - reg_im8:(opt:[not_impl]); - hint:[]; - ); - -procedure op_vcvttps2dq(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx2(ctx,vcvttps2dq_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vcvttpd2dq_desc:t_op_desc=( - mem_reg:(opt:[not_impl]); - reg_mem:(op:$E6;index:1;mm:1); - reg_imm:(opt:[not_impl]); - reg_im8:(opt:[not_impl]); - hint:[]; - ); - -procedure op_vcvttpd2dq(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx2(ctx,vcvttpd2dq_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vcvtdq2ps_desc:t_op_desc=( - mem_reg:(opt:[not_impl]); - reg_mem:(op:$5B;index:0;mm:1); - reg_imm:(opt:[not_impl]); - reg_im8:(opt:[not_impl]); - hint:[]; - ); - -procedure op_vcvtdq2ps(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx2(ctx,vcvtdq2ps_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vcvtdq2pd_desc:t_op_desc=( - mem_reg:(opt:[not_impl]); - reg_mem:(op:$E6;index:2;mm:1); - reg_imm:(opt:[not_impl]); - reg_im8:(opt:[not_impl]); - hint:[]; - ); - -procedure op_vcvtdq2pd(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx2(ctx,vcvtdq2pd_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vcvttss2si_desc:t_op_desc=( - mem_reg:(opt:[not_impl]); - reg_mem:(op:$2C;index:2;mm:1); - reg_imm:(opt:[not_impl]); - reg_im8:(opt:[not_impl]); - hint:[]; - ); - -procedure op_vcvttss2si(var ctx:t_jit_context2); -begin - if is_preserved(ctx.din) or is_memory(ctx.din) then - begin - op_emit_avx2(ctx,vcvttss2si_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vcvttsd2si_desc:t_op_desc=( - mem_reg:(opt:[not_impl]); - reg_mem:(op:$2C;index:3;mm:1); - reg_imm:(opt:[not_impl]); - reg_im8:(opt:[not_impl]); - hint:[]; - ); - -procedure op_vcvttsd2si(var ctx:t_jit_context2); -begin - if is_preserved(ctx.din) or is_memory(ctx.din) then - begin - op_emit_avx2(ctx,vcvttsd2si_desc); - end else - begin - add_orig(ctx); - end; -end; - // -const - bextr_desc:t_op_type=( - op:$F7;index:0;mm:2; - ); - -procedure op_bextr(var ctx:t_jit_context2); -begin - if is_preserved(ctx.din) or is_memory(ctx.din) then - begin - op_emit_bmi_rmr(ctx,bextr_desc); //r64a, r/m64, r64b - end else - begin - add_orig(ctx); - end; -end; - -const - andn_desc:t_op_type=( - op:$F2;index:0;mm:2; - ); - -procedure op_andn(var ctx:t_jit_context2); -begin - if is_preserved(ctx.din) or is_memory(ctx.din) then - begin - op_emit_bmi_rrm(ctx,andn_desc); //r64a, r64b, r/m64 - end else - begin - add_orig(ctx); - end; -end; - -// - -const - vpextrq_desc:t_op_avx3_imm=( //vpextrd_desc - rmi:(opt:[not_impl]); - mri:(op:$16;index:1;mm:3); - ); - -procedure op_vpextrq(var ctx:t_jit_context2); -begin - if is_preserved(ctx.din) or is_memory(ctx.din) then - begin - op_emit_avx3_imm8(ctx,vpextrq_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vextractps_desc:t_op_avx3_imm=( - rmi:(opt:[not_impl]); - mri:(op:$17;index:1;mm:3); - ); - -procedure op_vextractps(var ctx:t_jit_context2); -begin - if is_preserved(ctx.din) or is_memory(ctx.din) then - begin - op_emit_avx3_imm8(ctx,vextractps_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vinsertf128_desc:t_op_type=( - op:$18;index:1;mm:3;opt:[not_vex_len] - ); - -procedure op_vinsertf128(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vinsertf128_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vinsertps_desc:t_op_type=( - op:$21;index:1;mm:3 - ); - -procedure op_vinsertps(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vinsertps_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vextractf128_desc:t_op_type=( - op:$19;index:1;mm:3;opt:[not_vex_len] - ); - -procedure op_vextractf128(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vextractf128_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vroundss_desc:t_op_type=( - op:$0A;index:1;mm:3 - ); - -procedure op_vroundss(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vroundss_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vroundsd_desc:t_op_type=( - op:$0B;index:1;mm:3 - ); - -procedure op_vroundsd(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vroundsd_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vsqrtss_desc:t_op_type=( - op:$51;index:2;mm:1 - ); - -procedure op_vsqrtss(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vsqrtss_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vsqrtsd_desc:t_op_type=( - op:$51;index:3;mm:1 - ); - -procedure op_vsqrtsd(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vsqrtsd_desc); - end else - begin - add_orig(ctx); - end; -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_imm:(opt:[not_impl]); - reg_im8:(opt:[not_impl]); - hint:[]; - ); - -procedure op_vbroadcastss(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx2(ctx,vbroadcastss_desc); - end else - begin - add_orig(ctx); - end; -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_imm:(opt:[not_impl]); - reg_im8:(opt:[not_impl]); - hint:[]; - ); - -procedure op_vbroadcastsd(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx2(ctx,vbroadcastsd_desc); - end else - begin - add_orig(ctx); - end; -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_imm:(opt:[not_impl]); - reg_im8:(opt:[not_impl]); - hint:[]; - ); - -procedure op_vbroadcastf128(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx2(ctx,vbroadcastf128_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vpinsrd_desc:t_op_type=( - op:$22;index:1;mm:3 - ); - -procedure op_vpinsrd(var ctx:t_jit_context2); //vpinsrq -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vpinsrd_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vpackusdw_desc:t_op_type=( - op:$2B;index:1;mm:2 - ); - -procedure op_vpackusdw(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vpackusdw_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vpackuswb_desc:t_op_type=( - op:$67;index:1;mm:1 - ); - -procedure op_vpackuswb(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vpackuswb_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vpsrad_desc:t_op_type=( - op:$E2;index:1;mm:1 - ); - -procedure op_vpsrad(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vpsrad_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vpslld_desc:t_op_type=( - op:$F2;index:1;mm:1 - ); - -procedure op_vpslld(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vpslld_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vpsllq_desc:t_op_type=( - op:$F3;index:1;mm:1 - ); - -procedure op_vpsllq(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vpsllq_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vmaxsd_desc:t_op_type=( - op:$5F;index:3;mm:1 - ); - -procedure op_vmaxsd(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vmaxsd_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vhaddpd_desc:t_op_type=( - op:$7C;index:1;mm:1 - ); - -procedure op_vhaddpd(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vhaddpd_desc); - end else - begin - add_orig(ctx); - end; -end; - -const - vhaddps_desc:t_op_type=( - op:$7C;index:3;mm:1 - ); - -procedure op_vhaddps(var ctx:t_jit_context2); -begin - if is_memory(ctx.din) then - begin - op_emit_avx3(ctx,vhaddps_desc); - end else - begin - add_orig(ctx); - end; -end; - -/// - const fldenv_desc:t_op_type=( op:$D9;index:4;opt:[not_prefix]; @@ -3631,13 +1449,8 @@ begin end; -var - inited:Integer=0; - procedure init_cbs; begin - if (inited<>0) then Exit; - jit_cbs[OPPnone,OPxor ,OPSnone]:=@op_xor; jit_cbs[OPPnone,OPor ,OPSnone]:=@op_or; jit_cbs[OPPnone,OPand ,OPSnone]:=@op_and; @@ -3658,41 +1471,6 @@ begin jit_cbs[OPPnone,OPmov ,OPSnone]:=@op_mov; - jit_cbs[OPPv,OPmovu,OPSx_ps ]:=@op_vmovups; - jit_cbs[OPPv,OPmovu,OPSx_pd ]:=@op_vmovupd; - jit_cbs[OPPv,OPmova,OPSx_ps ]:=@op_vmovaps; - jit_cbs[OPPv,OPmova,OPSx_pd ]:=@op_vmovapd; - jit_cbs[OPPv,OPmov ,OPSx_dqu]:=@op_vmovdqu; - jit_cbs[OPPv,OPmov ,OPSx_dqa]:=@op_vmovdqa; - - jit_cbs[OPPv,OPmovnt,OPSx_dqa]:=@op_vmovntdqa; - jit_cbs[OPPv,OPmovnt,OPSx_dq ]:=@op_vmovntdq; - - jit_cbs[OPPv,OPmovddup,OPSnone]:=@op_vmovddup; - - jit_cbs[OPPv,OPmov ,OPSx_d ]:=@op_vmovq; - jit_cbs[OPPv,OPmov ,OPSx_q ]:=@op_vmovq; - - jit_cbs[OPPv,OPmov ,OPSx_ss ]:=@op_vmovss; - jit_cbs[OPPv,OPmov ,OPSx_sd ]:=@op_vmovsd; - - jit_cbs[OPPv,OPmovl,OPSx_pd]:=@op_vmovlpd; - jit_cbs[OPPv,OPmovh,OPSx_pd]:=@op_vmovhpd; - - jit_cbs[OPPv,OPmovsldup,OPSnone]:=@op_vmovsldup; - jit_cbs[OPPv,OPmovshdup,OPSnone]:=@op_vmovshdup; - - jit_cbs[OPPv,OPpmovsx,OPSv_bw]:=@op_vpmovsxbw; - jit_cbs[OPPv,OPpmovsx,OPSv_dq]:=@op_vpmovsxdq; - - jit_cbs[OPPv,OPucomi,OPSx_ss]:=@op_vucomiss; - jit_cbs[OPPv,OPucomi,OPSx_sd]:=@op_vucomisd; - - jit_cbs[OPPv,OPptest,OPSnone]:=@op_vptest; - - jit_cbs[OPPnone,OPblsr,OPSnone ]:=@op_blsr; - jit_cbs[OPPnone,OPblsi,OPSnone ]:=@op_blsi; - jit_cbs[OPPnone,OPcmov__,OPSc_o ]:=@op_cmov; jit_cbs[OPPnone,OPcmov__,OPSc_no ]:=@op_cmov; jit_cbs[OPPnone,OPcmov__,OPSc_b ]:=@op_cmov; @@ -3801,147 +1579,6 @@ begin jit_cbs[OPPnone,OPcmc,OPSnone]:=@add_orig; - jit_cbs[OPPv,OPxor ,OPSx_ps]:=@op_vxorps; - jit_cbs[OPPv,OPxor ,OPSx_pd]:=@op_vxorpd; - - jit_cbs[OPPv,OPpcmpeq,OPSx_b ]:=@op_vpcmpeqb; - jit_cbs[OPPv,OPpcmpeq,OPSx_w ]:=@op_vpcmpeqw; - jit_cbs[OPPv,OPpcmpeq,OPSx_d ]:=@op_vpcmpeqd; - - jit_cbs[OPPv,OPpcmpgt,OPSx_d ]:=@op_vpcmpgtd; - - jit_cbs[OPPv,OPpcmpestri,OPSnone]:=@op_vpcmpestri; - jit_cbs[OPPv,OPpcmpistrm,OPSnone]:=@op_vpcmpistrm; - jit_cbs[OPPv,OPpcmpistri,OPSnone]:=@op_vpcmpistri; - - jit_cbs[OPPv,OPsub ,OPSx_sd]:=@op_vsubsd; - jit_cbs[OPPv,OPsub ,OPSx_ss]:=@op_vsubss; - jit_cbs[OPPv,OPsub ,OPSx_ps]:=@op_vsubps; - jit_cbs[OPPv,OPsub ,OPSx_pd]:=@op_vsubpd; - - jit_cbs[OPPv,OPpsub ,OPSx_w ]:=@op_vpsubw; - jit_cbs[OPPv,OPpsub ,OPSx_d ]:=@op_vpsubd; - jit_cbs[OPPv,OPpsub ,OPSx_q ]:=@op_vpsubq; - - jit_cbs[OPPv,OPpadd ,OPSx_b ]:=@op_vpaddb; - jit_cbs[OPPv,OPpadd ,OPSx_w ]:=@op_vpaddw; - jit_cbs[OPPv,OPpadd ,OPSx_d ]:=@op_vpaddd; - jit_cbs[OPPv,OPpadd ,OPSx_q ]:=@op_vpaddq; - - jit_cbs[OPPv,OPadd ,OPSx_ps]:=@op_vaddps; - jit_cbs[OPPv,OPadd ,OPSx_pd]:=@op_vaddpd; - jit_cbs[OPPv,OPadd ,OPSx_ss]:=@op_vaddss; - jit_cbs[OPPv,OPadd ,OPSx_sd]:=@op_vaddsd; - - jit_cbs[OPPv,OPphadd ,OPSx_w]:=@op_vphaddw; - jit_cbs[OPPv,OPphadd ,OPSx_d]:=@op_vphaddd; - - jit_cbs[OPPv,OPdiv ,OPSx_ps]:=@op_vdivps; - jit_cbs[OPPv,OPdiv ,OPSx_pd]:=@op_vdivpd; - jit_cbs[OPPv,OPdiv ,OPSx_ss]:=@op_vdivss; - jit_cbs[OPPv,OPdiv ,OPSx_sd]:=@op_vdivsd; - - jit_cbs[OPPv,OPmul ,OPSx_ps]:=@op_vmulps; - jit_cbs[OPPv,OPmul ,OPSx_pd]:=@op_vmulpd; - jit_cbs[OPPv,OPmul ,OPSx_ss]:=@op_vmulss; - jit_cbs[OPPv,OPmul ,OPSx_sd]:=@op_vmulsd; - - jit_cbs[OPPv,OPpmull ,OPSx_w]:=@op_vpmullw; - - jit_cbs[OPPv,OPpmulhuw,OPSnone]:=@op_vpmulhuw; - - jit_cbs[OPPv,OPpunpcklqdq,OPSnone]:=@op_vpunpcklqdq; - jit_cbs[OPPv,OPpunpcklwd ,OPSnone]:=@op_vpunpcklwd; - jit_cbs[OPPv,OPpunpckldq ,OPSnone]:=@op_vpunpckldq; - - jit_cbs[OPPv,OPunpckl ,OPSx_pd]:=@op_vunpcklpd; - - jit_cbs[OPPv,OPcmp ,OPSx_ps]:=@op_vcmpps; - jit_cbs[OPPv,OPcmp ,OPSx_pd]:=@op_vcmppd; - jit_cbs[OPPv,OPcmp ,OPSx_sd]:=@op_vcmpsd; - jit_cbs[OPPv,OPcmp ,OPSx_ss]:=@op_vcmpss; - - jit_cbs[OPPv,OPpshuf ,OPSx_d ]:=@op_vpshufd; - jit_cbs[OPPv,OPpshuf ,OPSx_b ]:=@op_vpshufb; - - jit_cbs[OPPnone,OPvpermil,OPSx_ps]:=@op_vpermilps; - jit_cbs[OPPnone,OPvpermil,OPSx_pd]:=@op_vpermilpd; - - jit_cbs[OPPnone,OPvperm2,OPSx_f128]:=@op_vperm2f128; - - jit_cbs[OPPv,OPpsrl,OPSx_w]:=@op_vpsrlw; - jit_cbs[OPPv,OPpsrl,OPSx_q]:=@op_vpsrlq; - - jit_cbs[OPPv,OPpminu ,OPSx_d ]:=@op_vpminud; - jit_cbs[OPPv,OPmaskmov,OPSx_ps]:=@op_vmaskmovps; - jit_cbs[OPPv,OPpxor ,OPSnone]:=@op_vpxor; - jit_cbs[OPPv,OPor ,OPSx_ps]:=@op_vorps; - jit_cbs[OPPv,OPor ,OPSx_pd]:=@op_vorpd; - jit_cbs[OPPv,OPpor ,OPSnone]:=@op_vpor; - jit_cbs[OPPv,OPand ,OPSx_ps]:=@op_vandps; - jit_cbs[OPPv,OPand ,OPSx_pd]:=@op_vandpd; - jit_cbs[OPPv,OPandn ,OPSx_ps]:=@op_vandnps; - jit_cbs[OPPv,OPandn ,OPSx_pd]:=@op_vandnpd; - jit_cbs[OPPv,OPpand ,OPSnone]:=@op_vpand; - jit_cbs[OPPv,OPpandn ,OPSnone]:=@op_vpandn; - - jit_cbs[OPPv,OPblend ,OPSx_ps]:=@op_vblendps; - jit_cbs[OPPv,OPblend ,OPSx_pd]:=@op_vblendpd; - jit_cbs[OPPv,OPpblend ,OPSx_w ]:=@op_vpblendw; - - jit_cbs[OPPv,OPblendv ,OPSx_ps]:=@op_vblendvps; - jit_cbs[OPPv,OPblendv ,OPSx_pd]:=@op_vblendvpd; - - jit_cbs[OPPv,OPcvtsi2 ,OPSx_ss]:=@op_vcvtsi2ss; - jit_cbs[OPPv,OPcvtsi2 ,OPSx_sd]:=@op_vcvtsi2sd; - jit_cbs[OPPv,OPcvtss2 ,OPSx_sd]:=@op_vcvtss2sd; - jit_cbs[OPPv,OPcvtsd2 ,OPSx_ss]:=@op_vcvtsd2ss; - jit_cbs[OPPv,OPcvttps2,OPSx_dq]:=@op_vcvttps2dq; - jit_cbs[OPPv,OPcvttpd2,OPSx_dq]:=@op_vcvttpd2dq; - jit_cbs[OPPv,OPcvtdq2 ,OPSx_ps]:=@op_vcvtdq2ps; - jit_cbs[OPPv,OPcvtdq2 ,OPSx_pd]:=@op_vcvtdq2pd; - - jit_cbs[OPPv,OPcvttss2,OPSx_si]:=@op_vcvttss2si; - jit_cbs[OPPv,OPcvttsd2,OPSx_si]:=@op_vcvttsd2si; - - jit_cbs[OPPnone,OPbextr,OPSnone]:=@op_bextr; - jit_cbs[OPPnone,OPandn ,OPSnone]:=@op_andn; - - jit_cbs[OPPv,OPpextr,OPSx_d]:=@op_vpextrq; - jit_cbs[OPPv,OPpextr,OPSx_q]:=@op_vpextrq; - - jit_cbs[OPPv,OPextract,OPSx_ps]:=@op_vextractps; - - jit_cbs[OPPv,OPinsert ,OPSx_f128]:=@op_vinsertf128; - jit_cbs[OPPv,OPinsert ,OPSx_ps ]:=@op_vinsertps; - - jit_cbs[OPPv,OPextract,OPSx_f128]:=@op_vextractf128; - - jit_cbs[OPPv,OPround,OPSx_ss]:=@op_vroundss; - jit_cbs[OPPv,OPround,OPSx_sd]:=@op_vroundsd; - - jit_cbs[OPPv,OPsqrt ,OPSx_sd]:=@op_vsqrtsd; - jit_cbs[OPPv,OPsqrt ,OPSx_ss]:=@op_vsqrtss; - - jit_cbs[OPPnone,OPvbroadcast,OPSx_ss ]:=@op_vbroadcastss; - jit_cbs[OPPnone,OPvbroadcast,OPSx_sd ]:=@op_vbroadcastsd; - jit_cbs[OPPnone,OPvbroadcast,OPSx_f128]:=@op_vbroadcastf128; - - jit_cbs[OPPv,OPpinsr,OPSx_d]:=@op_vpinsrd; - jit_cbs[OPPv,OPpinsr,OPSx_q]:=@op_vpinsrd; - - jit_cbs[OPPv,OPpackusdw,OPSnone]:=@op_vpackusdw; - jit_cbs[OPPv,OPpackuswb,OPSnone]:=@op_vpackuswb; - - jit_cbs[OPPv,OPpsra,OPSx_d]:=@op_vpsrad; - jit_cbs[OPPv,OPpsll,OPSx_d]:=@op_vpslld; - jit_cbs[OPPv,OPpsll,OPSx_q]:=@op_vpsllq; - - jit_cbs[OPPv,OPmax,OPSx_sd]:=@op_vmaxsd; - - jit_cbs[OPPv,OPhadd,OPSx_pd]:=@op_vhaddpd; - jit_cbs[OPPv,OPhadd,OPSx_ps]:=@op_vhaddps; - jit_cbs[OPPnone,OPcwd ,OPSnone]:=@op_cdq; jit_cbs[OPPnone,OPcdq ,OPSnone]:=@op_cdq; jit_cbs[OPPnone,OPcqo ,OPSnone]:=@op_cdq; @@ -3989,7 +1626,6 @@ begin jit_cbs[OPPnone,OPprefetch,OPSp_t1 ]:=@op_prefetch1; jit_cbs[OPPnone,OPprefetch,OPSp_t2 ]:=@op_prefetch2; - inited:=1; end; diff --git a/sys/test/kern_jit2_ops_avx.pas b/sys/test/kern_jit2_ops_avx.pas new file mode 100644 index 00000000..a6aacdda --- /dev/null +++ b/sys/test/kern_jit2_ops_avx.pas @@ -0,0 +1,2418 @@ +unit kern_jit2_ops_avx; + +{$mode ObjFPC}{$H+} +{$CALLING SysV_ABI_CDecl} + +interface + +uses + x86_fpdbgdisas, + x86_jit, + kern_jit2_ops, + kern_jit2_ctx; + +procedure init_cbs_avx; + +implementation + +const + vmovups_desc:t_op_desc=( + mem_reg:(op:$11;index:0;mm:1); + reg_mem:(op:$10;index:0;mm:1); + reg_imm:(opt:[not_impl]); + reg_im8:(opt:[not_impl]); + hint:[his_mov,his_wo]; + ); + +procedure op_vmovups(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx2(ctx,vmovups_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vmovupd_desc:t_op_desc=( + mem_reg:(op:$11;index:1;mm:1); + reg_mem:(op:$10;index:1;mm:1); + reg_imm:(opt:[not_impl]); + reg_im8:(opt:[not_impl]); + hint:[his_mov,his_wo]; + ); + +procedure op_vmovupd(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx2(ctx,vmovupd_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vmovaps_desc:t_op_desc=( + mem_reg:(op:$29;index:0;mm:1); + reg_mem:(op:$28;index:0;mm:1); + reg_imm:(opt:[not_impl]); + reg_im8:(opt:[not_impl]); + hint:[his_mov,his_wo,his_align]; + ); + +procedure op_vmovaps(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx2(ctx,vmovaps_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vmovapd_desc:t_op_desc=( + mem_reg:(op:$29;index:1;mm:1); + reg_mem:(op:$28;index:1;mm:1); + reg_imm:(opt:[not_impl]); + reg_im8:(opt:[not_impl]); + hint:[his_mov,his_wo,his_align]; + ); + +procedure op_vmovapd(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx2(ctx,vmovapd_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vmovdqu_desc:t_op_desc=( + mem_reg:(op:$7F;index:2;mm:1); + reg_mem:(op:$6F;index:2;mm:1); + reg_imm:(opt:[not_impl]); + reg_im8:(opt:[not_impl]); + hint:[his_mov,his_wo]; + ); + +procedure op_vmovdqu(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx2(ctx,vmovdqu_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vmovdqa_desc:t_op_desc=( + mem_reg:(op:$7F;index:1;mm:1); + reg_mem:(op:$6F;index:1;mm:1); + reg_imm:(opt:[not_impl]); + reg_im8:(opt:[not_impl]); + hint:[his_mov,his_wo,his_align]; + ); + +procedure op_vmovdqa(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx2(ctx,vmovdqa_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vmovntdqa_desc:t_op_desc=( + mem_reg:(opt:[not_impl]); + reg_mem:(op:$2A;index:1;mm:2); + reg_imm:(opt:[not_impl]); + reg_im8:(opt:[not_impl]); + hint:[his_mov,his_wo,his_align]; + ); + +procedure op_vmovntdqa(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx2(ctx,vmovntdqa_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vmovntdq_desc:t_op_desc=( + mem_reg:(op:$E7;index:1;mm:1); + reg_mem:(opt:[not_impl]); + reg_imm:(opt:[not_impl]); + reg_im8:(opt:[not_impl]); + hint:[his_mov,his_wo]; + ); + +procedure op_vmovntdq(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx2(ctx,vmovntdq_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vmovddup_desc:t_op_desc=( + mem_reg:(opt:[not_impl]); + reg_mem:(op:$12;index:3;mm:1); + reg_imm:(opt:[not_impl]); + reg_im8:(opt:[not_impl]); + hint:[his_mov,his_wo]; + ); + +procedure op_vmovddup(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx2(ctx,vmovddup_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vmovq_desc:t_op_desc=( //vmovd_desc + mem_reg:(op:$7E;index:1;mm:1); + reg_mem:(op:$6E;index:1;mm:1); + reg_imm:(opt:[not_impl]); + reg_im8:(opt:[not_impl]); + hint:[his_mov,his_wo]; + ); + +procedure op_vmovq(var ctx:t_jit_context2); //op_vmovd +begin + if is_preserved(ctx.din) or is_memory(ctx.din) then + begin + op_emit_avx2(ctx,vmovq_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vmovss_mrr_desc:t_op_type=(op:$11;index:2;mm:1;opt:[not_vex_len]); + vmovss_rrm_desc:t_op_type=(op:$10;index:2;mm:1;opt:[not_vex_len]); + +procedure op_vmovss(var ctx:t_jit_context2); +begin + if is_preserved(ctx.din) or is_memory(ctx.din) then + begin + if is_memory(ctx.din.Operand[1]) then + begin + op_emit_avx3(ctx,vmovss_mrr_desc); + end else + if is_memory(ctx.din.Operand[3]) then + begin + op_emit_avx3(ctx,vmovss_rrm_desc); + end else + begin + Assert(False); + end; + end else + begin + add_orig(ctx); + end; +end; + +const + vmovsd_mrr_desc:t_op_type=(op:$11;index:3;mm:1;opt:[not_vex_len]); + vmovsd_rrm_desc:t_op_type=(op:$10;index:3;mm:1;opt:[not_vex_len]); + +procedure op_vmovsd(var ctx:t_jit_context2); +begin + if is_preserved(ctx.din) or is_memory(ctx.din) then + begin + if is_memory(ctx.din.Operand[1]) then + begin + op_emit_avx3(ctx,vmovsd_mrr_desc); + end else + if is_memory(ctx.din.Operand[3]) then + begin + op_emit_avx3(ctx,vmovsd_rrm_desc); + end else + begin + Assert(False); + end; + end else + begin + add_orig(ctx); + end; +end; + +const + vmovlpd_desc2:t_op_desc=( + mem_reg:(op:$13;index: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); + +procedure op_vmovlpd(var ctx:t_jit_context2); +begin + if is_preserved(ctx.din) or is_memory(ctx.din) then + begin + case ctx.din.OperCnt of + 2:op_emit_avx2(ctx,vmovlpd_desc2); + 3:op_emit_avx3(ctx,vmovlpd_rrm_desc); + else + Assert(False); + end; + end else + begin + add_orig(ctx); + end; +end; + +const + vmovhpd_desc2:t_op_desc=( + mem_reg:(op:$17;index: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); + +procedure op_vmovhpd(var ctx:t_jit_context2); +begin + if is_preserved(ctx.din) or is_memory(ctx.din) then + begin + case ctx.din.OperCnt of + 2:op_emit_avx2(ctx,vmovhpd_desc2); + 3:op_emit_avx3(ctx,vmovhpd_rrm_desc); + else + Assert(False); + end; + end else + begin + add_orig(ctx); + end; +end; + +const + vmovsldup_desc:t_op_desc=( + mem_reg:(opt:[not_impl]); + reg_mem:(op:$12;index:2;mm:1); + reg_imm:(opt:[not_impl]); + reg_im8:(opt:[not_impl]); + hint:[his_mov,his_wo]; + ); + +procedure op_vmovsldup(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx2(ctx,vmovsldup_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vmovshdup_desc:t_op_desc=( + mem_reg:(opt:[not_impl]); + reg_mem:(op:$16;index:2;mm:1); + reg_imm:(opt:[not_impl]); + reg_im8:(opt:[not_impl]); + hint:[his_mov,his_wo]; + ); + +procedure op_vmovshdup(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx2(ctx,vmovshdup_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vpmovsxbw_desc:t_op_desc=( + mem_reg:(opt:[not_impl]); + reg_mem:(op:$20;index:1;mm:2); + reg_imm:(opt:[not_impl]); + reg_im8:(opt:[not_impl]); + hint:[his_mov,his_wo]; + ); + +procedure op_vpmovsxbw(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx2(ctx,vpmovsxbw_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vpmovsxdq_desc:t_op_desc=( + mem_reg:(opt:[not_impl]); + reg_mem:(op:$25;index:1;mm:2); + reg_imm:(opt:[not_impl]); + reg_im8:(opt:[not_impl]); + hint:[his_mov,his_wo]; + ); + +procedure op_vpmovsxdq(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx2(ctx,vpmovsxdq_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vmovmskps_desc:t_op_type=(op:$50;index:0;mm:1); + +procedure op_vmovmskps(var ctx:t_jit_context2); +begin + if is_preserved(ctx.din) then + begin + op_emit_avx2_rr(ctx,vmovmskps_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vmovmskpd_desc:t_op_type=(op:$50;index:1;mm:1); + +procedure op_vmovmskpd(var ctx:t_jit_context2); +begin + if is_preserved(ctx.din) then + begin + op_emit_avx2_rr(ctx,vmovmskpd_desc); + end else + begin + add_orig(ctx); + end; +end; + +// + +const + vucomiss_desc:t_op_desc=( + mem_reg:(opt:[not_impl]); + reg_mem:(op:$2E;index:0;mm:1); + reg_imm:(opt:[not_impl]); + reg_im8:(opt:[not_impl]); + hint:[]; + ); + +procedure op_vucomiss(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx2(ctx,vucomiss_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vucomisd_desc:t_op_desc=( + mem_reg:(opt:[not_impl]); + reg_mem:(op:$2E;index:1;mm:1); + reg_imm:(opt:[not_impl]); + reg_im8:(opt:[not_impl]); + hint:[]; + ); + +procedure op_vucomisd(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx2(ctx,vucomisd_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vptest_desc:t_op_desc=( + mem_reg:(opt:[not_impl]); + reg_mem:(op:$17;index:1;mm:2); + reg_imm:(opt:[not_impl]); + reg_im8:(opt:[not_impl]); + hint:[his_ro]; + ); + +procedure op_vptest(var ctx:t_jit_context2); +begin + if is_preserved(ctx.din) or is_memory(ctx.din) then + begin + op_emit_avx2(ctx,vptest_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + blsr_desc:t_op_type=( + op:$F3;index:1;mm:2 + ); + +procedure op_blsr(var ctx:t_jit_context2); +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); + end else + begin + add_orig(ctx); + end; +end; + +// + +const + vxorps_desc:t_op_type=( + op:$57;index:0;mm:1; + ); + +procedure op_vxorps(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vxorps_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vxorpd_desc:t_op_type=( + op:$57;index:1;mm:1; + ); + +procedure op_vxorpd(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vxorpd_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vpcmpeqb_desc:t_op_type=( + op:$74;index:1;mm:1; + ); + +procedure op_vpcmpeqb(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vpcmpeqb_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vpcmpeqw_desc:t_op_type=( + op:$75;index:1;mm:1; + ); + +procedure op_vpcmpeqw(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vpcmpeqw_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vpcmpeqd_desc:t_op_type=( + op:$76;index:1;mm:1; + ); + +procedure op_vpcmpeqd(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vpcmpeqd_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vpcmpgtd_desc:t_op_type=( + op:$66;index:1;mm:1; + ); + +procedure op_vpcmpgtd(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vpcmpgtd_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vpcmpestri_desc:t_op_avx3_imm=( + rmi:(op:$61;index:1;mm:3); + mri:(opt:[not_impl]); + ); + +procedure op_vpcmpestri(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3_imm8(ctx,vpcmpestri_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vpcmpistrm_desc:t_op_avx3_imm=( + rmi:(op:$62;index:1;mm:3); + mri:(opt:[not_impl]); + ); + +procedure op_vpcmpistrm(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3_imm8(ctx,vpcmpistrm_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vpcmpistri_desc:t_op_avx3_imm=( + rmi:(op:$63;index:1;mm:3); + mri:(opt:[not_impl]); + ); + +procedure op_vpcmpistri(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3_imm8(ctx,vpcmpistri_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vsubsd_desc:t_op_type=( + op:$5C;index:3;mm:1; + ); + +procedure op_vsubsd(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vsubsd_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vsubss_desc:t_op_type=( + op:$5C;index:2;mm:1; + ); + +procedure op_vsubss(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vsubss_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vsubps_desc:t_op_type=( + op:$5C;index:0;mm:1; + ); + +procedure op_vsubps(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vsubps_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vsubpd_desc:t_op_type=( + op:$5C;index:1;mm:1; + ); + +procedure op_vsubpd(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vsubpd_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vpsubw_desc:t_op_type=( + op:$F9;index:1;mm:1; + ); + +procedure op_vpsubw(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vpsubw_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vpsubd_desc:t_op_type=( + op:$FA;index:1;mm:1; + ); + +procedure op_vpsubd(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vpsubd_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vpsubq_desc:t_op_type=( + op:$FB;index:1;mm:1; + ); + +procedure op_vpsubq(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vpsubq_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vpaddb_desc:t_op_type=( + op:$FC;index:1;mm:1; + ); + +procedure op_vpaddb(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vpaddb_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vpaddw_desc:t_op_type=( + op:$FD;index:1;mm:1; + ); + +procedure op_vpaddw(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vpaddw_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vpaddd_desc:t_op_type=( + op:$FE;index:1;mm:1; + ); + +procedure op_vpaddd(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vpaddd_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vpaddq_desc:t_op_type=( + op:$D4;index:1;mm:1; + ); + +procedure op_vpaddq(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vpaddq_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vaddps_desc:t_op_type=( + op:$58;index:0;mm:1; + ); + +procedure op_vaddps(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vaddps_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vaddpd_desc:t_op_type=( + op:$58;index:1;mm:1; + ); + +procedure op_vaddpd(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vaddpd_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vaddss_desc:t_op_type=( + op:$58;index:2;mm:1; + ); + +procedure op_vaddss(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vaddss_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vaddsd_desc:t_op_type=( + op:$58;index:3;mm:1; + ); + +procedure op_vaddsd(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vaddsd_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vphaddw_desc:t_op_type=( + op:$01;index:1;mm:2; + ); + +procedure op_vphaddw(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vphaddw_desc); + end else + begin + add_orig(ctx); + end; +end; + + +const + vphaddd_desc:t_op_type=( + op:$02;index:1;mm:2; + ); + +procedure op_vphaddd(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vphaddd_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vdivps_desc:t_op_type=( + op:$5E;index:0;mm:1; + ); + +procedure op_vdivps(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vdivps_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vdivpd_desc:t_op_type=( + op:$5E;index:1;mm:1; + ); + +procedure op_vdivpd(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vdivpd_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vdivss_desc:t_op_type=( + op:$5E;index:2;mm:1; + ); + +procedure op_vdivss(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vdivss_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vdivsd_desc:t_op_type=( + op:$5E;index:3;mm:1; + ); + +procedure op_vdivsd(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vdivsd_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vmulps_desc:t_op_type=( + op:$59;index:0;mm:1; + ); + +procedure op_vmulps(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vmulps_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vmulpd_desc:t_op_type=( + op:$59;index:1;mm:1; + ); + +procedure op_vmulpd(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vmulpd_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vmulss_desc:t_op_type=( + op:$59;index:2;mm:1; + ); + +procedure op_vmulss(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vmulss_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vmulsd_desc:t_op_type=( + op:$59;index:3;mm:1; + ); + +procedure op_vmulsd(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vmulsd_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vpmullw_desc:t_op_type=( + op:$D5;index:1;mm:1; + ); + +procedure op_vpmullw(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vpmullw_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vpmulhuw_desc:t_op_type=( + op:$E4;index:1;mm:1; + ); + +procedure op_vpmulhuw(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vpmulhuw_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vpunpcklqdq_desc:t_op_type=( + op:$6C;index:1;mm:1; + ); + +procedure op_vpunpcklqdq(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vpunpcklqdq_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vpunpcklwd_desc:t_op_type=( + op:$61;index:1;mm:1; + ); + +procedure op_vpunpcklwd(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vpunpcklwd_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vpunpckldq_desc:t_op_type=( + op:$62;index:1;mm:1; + ); + +procedure op_vpunpckldq(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vpunpckldq_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vunpcklpd_desc:t_op_type=( + op:$14;index:1;mm:1; + ); + +procedure op_vunpcklpd(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vunpcklpd_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vcmpps_desc:t_op_type=( + op:$C2;index:0;mm:1; + ); + +procedure op_vcmpps(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vcmpps_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vcmppd_desc:t_op_type=( + op:$C2;index:1;mm:1; + ); + +procedure op_vcmppd(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vcmppd_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vcmpsd_desc:t_op_type=( + op:$C2;index:3;mm:1; + ); + +procedure op_vcmpsd(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vcmpsd_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vcmpss_desc:t_op_type=( + op:$C2;index:2;mm:1; + ); + +procedure op_vcmpss(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vcmpss_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vpshufd_desc:t_op_type=( + op:$70;index:1;mm:1; + ); + +procedure op_vpshufd(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vpshufd_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vpshufb_desc:t_op_type=( + op:$00;index:1;mm:2; + ); + +procedure op_vpshufb(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vpshufb_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vpermilps_rrm_desc:t_op_type=( + op:$0C;index:1;mm:2; + ); + + vpermilps_rmi_desc:t_op_avx3_imm=( + rmi:(op:$04;index:1;mm:3); + mri:(opt:[not_impl]); + ); + +procedure op_vpermilps(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + if is_memory(ctx.din.Operand[3]) then + begin + op_emit_avx3(ctx,vpermilps_rrm_desc); + end else + if (ctx.din.Operand[3].ByteCount<>0) then + begin + op_emit_avx3_imm8(ctx,vpermilps_rmi_desc); + end else + begin + Assert(False); + end; + end else + begin + add_orig(ctx); + end; +end; + +const + vpermilpd_rrm_desc:t_op_type=( + op:$0D;index:1;mm:2; + ); + + vpermilpd_rmi_desc:t_op_avx3_imm=( + rmi:(op:$05;index:1;mm:3); + mri:(opt:[not_impl]); + ); + +procedure op_vpermilpd(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + if is_memory(ctx.din.Operand[3]) then + begin + op_emit_avx3(ctx,vpermilpd_rrm_desc); + end else + if (ctx.din.Operand[3].ByteCount<>0) then + begin + op_emit_avx3_imm8(ctx,vpermilpd_rmi_desc); + end else + begin + Assert(False); + end; + end else + begin + add_orig(ctx); + end; +end; + +const + vperm2f128_desc:t_op_type=( + op:$06;index:1;mm:3;opt:[not_vex_len] + ); + +procedure op_vperm2f128(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vperm2f128_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vpsrlw_desc:t_op_type=( + op:$D1;index:1;mm:1; + ); + +procedure op_vpsrlw(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vpsrlw_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vpsrlq_desc:t_op_type=( + op:$D3;index:1;mm:1; + ); + +procedure op_vpsrlq(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vpsrlq_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vpminud_desc:t_op_type=( + op:$3B;index:1;mm:2; + ); + +procedure op_vpminud(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vpminud_desc); + end else + begin + add_orig(ctx); + end; +end; + + +const + vmaskmovps_rrm_desc:t_op_type=( + op:$2C;index:1;mm:2; + ); + + vmaskmovps_mrr_desc:t_op_type=( + op:$2E;index:1;mm:2; + ); + + +procedure op_vmaskmovps(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + if is_memory(ctx.din.Operand[3]) then + begin + op_emit_avx3(ctx,vmaskmovps_rrm_desc); + end else + begin + op_emit_avx3(ctx,vmaskmovps_mrr_desc); + end; + end else + begin + add_orig(ctx); + end; +end; + +const + vpxor_desc:t_op_type=( + op:$EF;index:1;mm:1; + ); + +procedure op_vpxor(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vpxor_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vorps_desc:t_op_type=( + op:$56;index:0;mm:1; + ); + +procedure op_vorps(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vorps_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vorpd_desc:t_op_type=( + op:$56;index:1;mm:1; + ); + +procedure op_vorpd(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vorpd_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vpor_desc:t_op_type=( + op:$EB;index:1;mm:1; + ); + +procedure op_vpor(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vpor_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vandps_desc:t_op_type=( + op:$54;index:0;mm:1; + ); + +procedure op_vandps(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vandps_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vandpd_desc:t_op_type=( + op:$54;index:1;mm:1; + ); + +procedure op_vandpd(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vandpd_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vandnps_desc:t_op_type=( + op:$55;index:0;mm:1; + ); + +procedure op_vandnps(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vandnps_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vandnpd_desc:t_op_type=( + op:$55;index:1;mm:1; + ); + +procedure op_vandnpd(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vandnpd_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vpand_desc:t_op_type=( + op:$DB;index:1;mm:1; + ); + +procedure op_vpand(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vpand_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vpandn_desc:t_op_type=( + op:$DF;index:1;mm:1; + ); + +procedure op_vpandn(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vpandn_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vblendps_desc:t_op_type=( + op:$0C;index:1;mm:3 + ); + +procedure op_vblendps(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vblendps_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vblendpd_desc:t_op_type=( + op:$0D;index:1;mm:3 + ); + +procedure op_vblendpd(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vblendpd_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vpblendw_desc:t_op_type=( + op:$0E;index:1;mm:3 + ); + +procedure op_vpblendw(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vpblendw_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vblendvps_desc:t_op_type=( + op:$4A;index:1;mm:3 + ); + +procedure op_vblendvps(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx4(ctx,vblendvps_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vblendvpd_desc:t_op_type=( + op:$4B;index:1;mm:3 + ); + +procedure op_vblendvpd(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx4(ctx,vblendvpd_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vcvtsi2ss_desc:t_op_type=( + op:$2A;index:2;mm:1; + ); + +procedure op_vcvtsi2ss(var ctx:t_jit_context2); +begin + if is_preserved(ctx.din) or is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vcvtsi2ss_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vcvtsi2sd_desc:t_op_type=( + op:$2A;index:3;mm:1; + ); + +procedure op_vcvtsi2sd(var ctx:t_jit_context2); +begin + if is_preserved(ctx.din) or is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vcvtsi2sd_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vcvtss2sd_desc:t_op_type=( + op:$5A;index:2;mm:1; + ); + +procedure op_vcvtss2sd(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vcvtss2sd_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vcvtsd2ss_desc:t_op_type=( + op:$5A;index:3;mm:1; + ); + +procedure op_vcvtsd2ss(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vcvtsd2ss_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vcvttps2dq_desc:t_op_desc=( + mem_reg:(opt:[not_impl]); + reg_mem:(op:$5B;index:2;mm:1); + reg_imm:(opt:[not_impl]); + reg_im8:(opt:[not_impl]); + hint:[]; + ); + +procedure op_vcvttps2dq(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx2(ctx,vcvttps2dq_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vcvttpd2dq_desc:t_op_desc=( + mem_reg:(opt:[not_impl]); + reg_mem:(op:$E6;index:1;mm:1); + reg_imm:(opt:[not_impl]); + reg_im8:(opt:[not_impl]); + hint:[]; + ); + +procedure op_vcvttpd2dq(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx2(ctx,vcvttpd2dq_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vcvtdq2ps_desc:t_op_desc=( + mem_reg:(opt:[not_impl]); + reg_mem:(op:$5B;index:0;mm:1); + reg_imm:(opt:[not_impl]); + reg_im8:(opt:[not_impl]); + hint:[]; + ); + +procedure op_vcvtdq2ps(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx2(ctx,vcvtdq2ps_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vcvtdq2pd_desc:t_op_desc=( + mem_reg:(opt:[not_impl]); + reg_mem:(op:$E6;index:2;mm:1); + reg_imm:(opt:[not_impl]); + reg_im8:(opt:[not_impl]); + hint:[]; + ); + +procedure op_vcvtdq2pd(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx2(ctx,vcvtdq2pd_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vcvttss2si_desc:t_op_desc=( + mem_reg:(opt:[not_impl]); + reg_mem:(op:$2C;index:2;mm:1); + reg_imm:(opt:[not_impl]); + reg_im8:(opt:[not_impl]); + hint:[]; + ); + +procedure op_vcvttss2si(var ctx:t_jit_context2); +begin + if is_preserved(ctx.din) or is_memory(ctx.din) then + begin + op_emit_avx2(ctx,vcvttss2si_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vcvttsd2si_desc:t_op_desc=( + mem_reg:(opt:[not_impl]); + reg_mem:(op:$2C;index:3;mm:1); + reg_imm:(opt:[not_impl]); + reg_im8:(opt:[not_impl]); + hint:[]; + ); + +procedure op_vcvttsd2si(var ctx:t_jit_context2); +begin + if is_preserved(ctx.din) or is_memory(ctx.din) then + begin + op_emit_avx2(ctx,vcvttsd2si_desc); + end else + begin + add_orig(ctx); + end; +end; + +// + +const + bextr_desc:t_op_type=( + op:$F7;index:0;mm:2; + ); + +procedure op_bextr(var ctx:t_jit_context2); +begin + if is_preserved(ctx.din) or is_memory(ctx.din) then + begin + op_emit_bmi_rmr(ctx,bextr_desc); //r64a, r/m64, r64b + end else + begin + add_orig(ctx); + end; +end; + +const + andn_desc:t_op_type=( + op:$F2;index:0;mm:2; + ); + +procedure op_andn(var ctx:t_jit_context2); +begin + if is_preserved(ctx.din) or is_memory(ctx.din) then + begin + op_emit_bmi_rrm(ctx,andn_desc); //r64a, r64b, r/m64 + end else + begin + add_orig(ctx); + end; +end; + +// + +const + vpextrq_desc:t_op_avx3_imm=( //vpextrd_desc + rmi:(opt:[not_impl]); + mri:(op:$16;index:1;mm:3); + ); + +procedure op_vpextrq(var ctx:t_jit_context2); +begin + if is_preserved(ctx.din) or is_memory(ctx.din) then + begin + op_emit_avx3_imm8(ctx,vpextrq_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vextractps_desc:t_op_avx3_imm=( + rmi:(opt:[not_impl]); + mri:(op:$17;index:1;mm:3); + ); + +procedure op_vextractps(var ctx:t_jit_context2); +begin + if is_preserved(ctx.din) or is_memory(ctx.din) then + begin + op_emit_avx3_imm8(ctx,vextractps_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vinsertf128_desc:t_op_type=( + op:$18;index:1;mm:3;opt:[not_vex_len] + ); + +procedure op_vinsertf128(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vinsertf128_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vinsertps_desc:t_op_type=( + op:$21;index:1;mm:3 + ); + +procedure op_vinsertps(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vinsertps_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vextractf128_desc:t_op_type=( + op:$19;index:1;mm:3;opt:[not_vex_len] + ); + +procedure op_vextractf128(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vextractf128_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vroundss_desc:t_op_type=( + op:$0A;index:1;mm:3 + ); + +procedure op_vroundss(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vroundss_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vroundsd_desc:t_op_type=( + op:$0B;index:1;mm:3 + ); + +procedure op_vroundsd(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vroundsd_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vsqrtss_desc:t_op_type=( + op:$51;index:2;mm:1 + ); + +procedure op_vsqrtss(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vsqrtss_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vsqrtsd_desc:t_op_type=( + op:$51;index:3;mm:1 + ); + +procedure op_vsqrtsd(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vsqrtsd_desc); + end else + begin + add_orig(ctx); + end; +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_imm:(opt:[not_impl]); + reg_im8:(opt:[not_impl]); + hint:[]; + ); + +procedure op_vbroadcastss(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx2(ctx,vbroadcastss_desc); + end else + begin + add_orig(ctx); + end; +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_imm:(opt:[not_impl]); + reg_im8:(opt:[not_impl]); + hint:[]; + ); + +procedure op_vbroadcastsd(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx2(ctx,vbroadcastsd_desc); + end else + begin + add_orig(ctx); + end; +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_imm:(opt:[not_impl]); + reg_im8:(opt:[not_impl]); + hint:[]; + ); + +procedure op_vbroadcastf128(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx2(ctx,vbroadcastf128_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vpinsrd_desc:t_op_type=( + op:$22;index:1;mm:3 + ); + +procedure op_vpinsrd(var ctx:t_jit_context2); //vpinsrq +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vpinsrd_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vpackusdw_desc:t_op_type=( + op:$2B;index:1;mm:2 + ); + +procedure op_vpackusdw(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vpackusdw_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vpackuswb_desc:t_op_type=( + op:$67;index:1;mm:1 + ); + +procedure op_vpackuswb(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vpackuswb_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vpsrad_desc:t_op_type=( + op:$E2;index:1;mm:1 + ); + +procedure op_vpsrad(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vpsrad_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vpslld_desc:t_op_type=( + op:$F2;index:1;mm:1 + ); + +procedure op_vpslld(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vpslld_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vpsllq_desc:t_op_type=( + op:$F3;index:1;mm:1 + ); + +procedure op_vpsllq(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vpsllq_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vmaxsd_desc:t_op_type=( + op:$5F;index:3;mm:1 + ); + +procedure op_vmaxsd(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vmaxsd_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vhaddpd_desc:t_op_type=( + op:$7C;index:1;mm:1 + ); + +procedure op_vhaddpd(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vhaddpd_desc); + end else + begin + add_orig(ctx); + end; +end; + +const + vhaddps_desc:t_op_type=( + op:$7C;index:3;mm:1 + ); + +procedure op_vhaddps(var ctx:t_jit_context2); +begin + if is_memory(ctx.din) then + begin + op_emit_avx3(ctx,vhaddps_desc); + end else + begin + add_orig(ctx); + end; +end; + +/// + +procedure init_cbs_avx; +begin + jit_cbs[OPPv,OPmovu,OPSx_ps ]:=@op_vmovups; + jit_cbs[OPPv,OPmovu,OPSx_pd ]:=@op_vmovupd; + jit_cbs[OPPv,OPmova,OPSx_ps ]:=@op_vmovaps; + jit_cbs[OPPv,OPmova,OPSx_pd ]:=@op_vmovapd; + jit_cbs[OPPv,OPmov ,OPSx_dqu]:=@op_vmovdqu; + jit_cbs[OPPv,OPmov ,OPSx_dqa]:=@op_vmovdqa; + + jit_cbs[OPPv,OPmovnt,OPSx_dqa]:=@op_vmovntdqa; + jit_cbs[OPPv,OPmovnt,OPSx_dq ]:=@op_vmovntdq; + + jit_cbs[OPPv,OPmovddup,OPSnone]:=@op_vmovddup; + + jit_cbs[OPPv,OPmov ,OPSx_d ]:=@op_vmovq; + jit_cbs[OPPv,OPmov ,OPSx_q ]:=@op_vmovq; + + jit_cbs[OPPv,OPmov ,OPSx_ss ]:=@op_vmovss; + jit_cbs[OPPv,OPmov ,OPSx_sd ]:=@op_vmovsd; + + jit_cbs[OPPv,OPmovl,OPSx_pd]:=@op_vmovlpd; + jit_cbs[OPPv,OPmovh,OPSx_pd]:=@op_vmovhpd; + + jit_cbs[OPPv,OPmovsldup,OPSnone]:=@op_vmovsldup; + jit_cbs[OPPv,OPmovshdup,OPSnone]:=@op_vmovshdup; + + jit_cbs[OPPv,OPpmovsx,OPSv_bw]:=@op_vpmovsxbw; + jit_cbs[OPPv,OPpmovsx,OPSv_dq]:=@op_vpmovsxdq; + + jit_cbs[OPPv,OPmovmsk,OPSx_ps]:=@op_vmovmskps; + jit_cbs[OPPv,OPmovmsk,OPSx_pd]:=@op_vmovmskpd; + + jit_cbs[OPPv,OPucomi,OPSx_ss]:=@op_vucomiss; + jit_cbs[OPPv,OPucomi,OPSx_sd]:=@op_vucomisd; + + jit_cbs[OPPv,OPptest,OPSnone]:=@op_vptest; + + jit_cbs[OPPnone,OPblsr,OPSnone ]:=@op_blsr; + jit_cbs[OPPnone,OPblsi,OPSnone ]:=@op_blsi; + + jit_cbs[OPPv,OPxor ,OPSx_ps]:=@op_vxorps; + jit_cbs[OPPv,OPxor ,OPSx_pd]:=@op_vxorpd; + + jit_cbs[OPPv,OPpcmpeq,OPSx_b ]:=@op_vpcmpeqb; + jit_cbs[OPPv,OPpcmpeq,OPSx_w ]:=@op_vpcmpeqw; + jit_cbs[OPPv,OPpcmpeq,OPSx_d ]:=@op_vpcmpeqd; + + jit_cbs[OPPv,OPpcmpgt,OPSx_d ]:=@op_vpcmpgtd; + + jit_cbs[OPPv,OPpcmpestri,OPSnone]:=@op_vpcmpestri; + jit_cbs[OPPv,OPpcmpistrm,OPSnone]:=@op_vpcmpistrm; + jit_cbs[OPPv,OPpcmpistri,OPSnone]:=@op_vpcmpistri; + + jit_cbs[OPPv,OPsub ,OPSx_sd]:=@op_vsubsd; + jit_cbs[OPPv,OPsub ,OPSx_ss]:=@op_vsubss; + jit_cbs[OPPv,OPsub ,OPSx_ps]:=@op_vsubps; + jit_cbs[OPPv,OPsub ,OPSx_pd]:=@op_vsubpd; + + jit_cbs[OPPv,OPpsub ,OPSx_w ]:=@op_vpsubw; + jit_cbs[OPPv,OPpsub ,OPSx_d ]:=@op_vpsubd; + jit_cbs[OPPv,OPpsub ,OPSx_q ]:=@op_vpsubq; + + jit_cbs[OPPv,OPpadd ,OPSx_b ]:=@op_vpaddb; + jit_cbs[OPPv,OPpadd ,OPSx_w ]:=@op_vpaddw; + jit_cbs[OPPv,OPpadd ,OPSx_d ]:=@op_vpaddd; + jit_cbs[OPPv,OPpadd ,OPSx_q ]:=@op_vpaddq; + + jit_cbs[OPPv,OPadd ,OPSx_ps]:=@op_vaddps; + jit_cbs[OPPv,OPadd ,OPSx_pd]:=@op_vaddpd; + jit_cbs[OPPv,OPadd ,OPSx_ss]:=@op_vaddss; + jit_cbs[OPPv,OPadd ,OPSx_sd]:=@op_vaddsd; + + jit_cbs[OPPv,OPphadd ,OPSx_w]:=@op_vphaddw; + jit_cbs[OPPv,OPphadd ,OPSx_d]:=@op_vphaddd; + + jit_cbs[OPPv,OPdiv ,OPSx_ps]:=@op_vdivps; + jit_cbs[OPPv,OPdiv ,OPSx_pd]:=@op_vdivpd; + jit_cbs[OPPv,OPdiv ,OPSx_ss]:=@op_vdivss; + jit_cbs[OPPv,OPdiv ,OPSx_sd]:=@op_vdivsd; + + jit_cbs[OPPv,OPmul ,OPSx_ps]:=@op_vmulps; + jit_cbs[OPPv,OPmul ,OPSx_pd]:=@op_vmulpd; + jit_cbs[OPPv,OPmul ,OPSx_ss]:=@op_vmulss; + jit_cbs[OPPv,OPmul ,OPSx_sd]:=@op_vmulsd; + + jit_cbs[OPPv,OPpmull ,OPSx_w]:=@op_vpmullw; + + jit_cbs[OPPv,OPpmulhuw,OPSnone]:=@op_vpmulhuw; + + jit_cbs[OPPv,OPpunpcklqdq,OPSnone]:=@op_vpunpcklqdq; + jit_cbs[OPPv,OPpunpcklwd ,OPSnone]:=@op_vpunpcklwd; + jit_cbs[OPPv,OPpunpckldq ,OPSnone]:=@op_vpunpckldq; + + jit_cbs[OPPv,OPunpckl ,OPSx_pd]:=@op_vunpcklpd; + + jit_cbs[OPPv,OPcmp ,OPSx_ps]:=@op_vcmpps; + jit_cbs[OPPv,OPcmp ,OPSx_pd]:=@op_vcmppd; + jit_cbs[OPPv,OPcmp ,OPSx_sd]:=@op_vcmpsd; + jit_cbs[OPPv,OPcmp ,OPSx_ss]:=@op_vcmpss; + + jit_cbs[OPPv,OPpshuf ,OPSx_d ]:=@op_vpshufd; + jit_cbs[OPPv,OPpshuf ,OPSx_b ]:=@op_vpshufb; + + jit_cbs[OPPnone,OPvpermil,OPSx_ps]:=@op_vpermilps; + jit_cbs[OPPnone,OPvpermil,OPSx_pd]:=@op_vpermilpd; + + jit_cbs[OPPnone,OPvperm2,OPSx_f128]:=@op_vperm2f128; + + jit_cbs[OPPv,OPpsrl,OPSx_w]:=@op_vpsrlw; + jit_cbs[OPPv,OPpsrl,OPSx_q]:=@op_vpsrlq; + + jit_cbs[OPPv,OPpminu ,OPSx_d ]:=@op_vpminud; + jit_cbs[OPPv,OPmaskmov,OPSx_ps]:=@op_vmaskmovps; + jit_cbs[OPPv,OPpxor ,OPSnone]:=@op_vpxor; + jit_cbs[OPPv,OPor ,OPSx_ps]:=@op_vorps; + jit_cbs[OPPv,OPor ,OPSx_pd]:=@op_vorpd; + jit_cbs[OPPv,OPpor ,OPSnone]:=@op_vpor; + jit_cbs[OPPv,OPand ,OPSx_ps]:=@op_vandps; + jit_cbs[OPPv,OPand ,OPSx_pd]:=@op_vandpd; + jit_cbs[OPPv,OPandn ,OPSx_ps]:=@op_vandnps; + jit_cbs[OPPv,OPandn ,OPSx_pd]:=@op_vandnpd; + jit_cbs[OPPv,OPpand ,OPSnone]:=@op_vpand; + jit_cbs[OPPv,OPpandn ,OPSnone]:=@op_vpandn; + + jit_cbs[OPPv,OPblend ,OPSx_ps]:=@op_vblendps; + jit_cbs[OPPv,OPblend ,OPSx_pd]:=@op_vblendpd; + jit_cbs[OPPv,OPpblend ,OPSx_w ]:=@op_vpblendw; + + jit_cbs[OPPv,OPblendv ,OPSx_ps]:=@op_vblendvps; + jit_cbs[OPPv,OPblendv ,OPSx_pd]:=@op_vblendvpd; + + jit_cbs[OPPv,OPcvtsi2 ,OPSx_ss]:=@op_vcvtsi2ss; + jit_cbs[OPPv,OPcvtsi2 ,OPSx_sd]:=@op_vcvtsi2sd; + jit_cbs[OPPv,OPcvtss2 ,OPSx_sd]:=@op_vcvtss2sd; + jit_cbs[OPPv,OPcvtsd2 ,OPSx_ss]:=@op_vcvtsd2ss; + jit_cbs[OPPv,OPcvttps2,OPSx_dq]:=@op_vcvttps2dq; + jit_cbs[OPPv,OPcvttpd2,OPSx_dq]:=@op_vcvttpd2dq; + jit_cbs[OPPv,OPcvtdq2 ,OPSx_ps]:=@op_vcvtdq2ps; + jit_cbs[OPPv,OPcvtdq2 ,OPSx_pd]:=@op_vcvtdq2pd; + + jit_cbs[OPPv,OPcvttss2,OPSx_si]:=@op_vcvttss2si; + jit_cbs[OPPv,OPcvttsd2,OPSx_si]:=@op_vcvttsd2si; + + jit_cbs[OPPnone,OPbextr,OPSnone]:=@op_bextr; + jit_cbs[OPPnone,OPandn ,OPSnone]:=@op_andn; + + jit_cbs[OPPv,OPpextr,OPSx_d]:=@op_vpextrq; + jit_cbs[OPPv,OPpextr,OPSx_q]:=@op_vpextrq; + + jit_cbs[OPPv,OPextract,OPSx_ps]:=@op_vextractps; + + jit_cbs[OPPv,OPinsert ,OPSx_f128]:=@op_vinsertf128; + jit_cbs[OPPv,OPinsert ,OPSx_ps ]:=@op_vinsertps; + + jit_cbs[OPPv,OPextract,OPSx_f128]:=@op_vextractf128; + + jit_cbs[OPPv,OPround,OPSx_ss]:=@op_vroundss; + jit_cbs[OPPv,OPround,OPSx_sd]:=@op_vroundsd; + + jit_cbs[OPPv,OPsqrt ,OPSx_sd]:=@op_vsqrtsd; + jit_cbs[OPPv,OPsqrt ,OPSx_ss]:=@op_vsqrtss; + + jit_cbs[OPPnone,OPvbroadcast,OPSx_ss ]:=@op_vbroadcastss; + jit_cbs[OPPnone,OPvbroadcast,OPSx_sd ]:=@op_vbroadcastsd; + jit_cbs[OPPnone,OPvbroadcast,OPSx_f128]:=@op_vbroadcastf128; + + jit_cbs[OPPv,OPpinsr,OPSx_d]:=@op_vpinsrd; + jit_cbs[OPPv,OPpinsr,OPSx_q]:=@op_vpinsrd; + + jit_cbs[OPPv,OPpackusdw,OPSnone]:=@op_vpackusdw; + jit_cbs[OPPv,OPpackuswb,OPSnone]:=@op_vpackuswb; + + jit_cbs[OPPv,OPpsra,OPSx_d]:=@op_vpsrad; + jit_cbs[OPPv,OPpsll,OPSx_d]:=@op_vpslld; + jit_cbs[OPPv,OPpsll,OPSx_q]:=@op_vpsllq; + + jit_cbs[OPPv,OPmax,OPSx_sd]:=@op_vmaxsd; + + jit_cbs[OPPv,OPhadd,OPSx_pd]:=@op_vhaddpd; + jit_cbs[OPPv,OPhadd,OPSx_ps]:=@op_vhaddps; + + + +end; + +end. + diff --git a/sys/test/project1.lpi b/sys/test/project1.lpi index b43b3bd6..ad98e21e 100644 --- a/sys/test/project1.lpi +++ b/sys/test/project1.lpi @@ -754,6 +754,10 @@ + + + +