Skip to content

Commit

Permalink
corrections in advanced x86 encoder
Browse files Browse the repository at this point in the history
  • Loading branch information
tgrysztar committed Jul 12, 2023
1 parent 884bc5e commit 8a9fd46
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 10 deletions.
43 changes: 35 additions & 8 deletions packages/x86-2/iset/avx.inc
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ EVEX_W1 = 1 shl 15
EVEX_REQUIRED = 1 shl 10
EVEX_FORBIDDEN = 1 shl 2
EVEX_VL = 1 shl 22
EVEX_VL_AVX2 = 1 shl 2
EVEX_VL_AVX2 = 1 shl 32
EVEX_BW = 1 shl 23
EVEX_DQ = 1 shl 24

Expand Down Expand Up @@ -1171,6 +1171,33 @@ macro vshufps? dest*,src*,src2*,aux*&
AVX_512.basic_instruction_bcst_imm8 VEX_0F_W0,EVEX_AS_VEX+EVEX_VL,0C6h,4,dest,src,src2,aux
end macro

iterate <instr,opcode>, blendps,0Ch, blendpd,0Dh

macro v#instr? dest*,src*,src2*,imm*
AVX_512.basic_instruction_imm8 VEX_66_0F3A_W0,EVEX_FORBIDDEN,opcode,0,dest,src,src2,imm
end macro

end iterate

iterate <instr,opcode>, blendvps,4Ah, blendvpd,4Bh

macro v#instr? dest*,src*,src2*,mask*
AVX_512.parse_operand@dest dest
AVX_512.parse_operand@src src
AVX_512.parse_operand@src2 src2
AVX_512.parse_operand@aux mask
if @dest.type = 'mmreg' & @src.type = 'mmreg' & (@src2.type = 'mem' | @src2.type = 'mmreg') & @aux.type = 'mmreg'
if @src.size <> @dest.size | @src2.size and not @dest.size | @aux.size <> @dest.size
err 'operand sizes do not match'
end if
AVX_512.store_instruction@src2 @dest.size,VEX_66_0F3A_W0,EVEX_FORBIDDEN,opcode,0,@dest.rm,@src.rm,1,(@aux.rm and 1111b) shl 4
else
err 'invalid combination of operands'
end if
end macro

end iterate

macro vbroadcastss? dest*,src*
require AVX2+
AVX_512.parse_k1z_operand@dest dest
Expand Down Expand Up @@ -2735,9 +2762,9 @@ iterate <instr,opcode,asize>, vpgatherdd,90h,4, vpgatherqd,91h,8, vgatherdps,92h
end if
else
require AVX2+
AVX.parse_operand@dest dest
AVX.parse_vsib_operand@src src
AVX.parse_operand@aux aux
AVX_512.parse_operand@dest dest
AVX_512.parse_vsib_operand@src src
AVX_512.parse_operand@aux aux
if @dest.type = 'mmreg' & @src.type = 'mem' & @aux.type = 'mmreg'
if @src.size and not 4 | (@dest.size > 16 & @dest.size * (asize shr 2) > @src.visize) | (@src.visize > 16 & @dest.size * (asize shr 2) < @src.visize)
err 'invalid operand size'
Expand Down Expand Up @@ -2774,9 +2801,9 @@ iterate <instr,opcode,asize>, vpgatherdq,90h,4, vpgatherqq,91h,8, vgatherdpd,92h
end if
else
require AVX2+
AVX.parse_operand@dest dest
AVX.parse_vsib_operand@src src
AVX.parse_operand@aux aux
AVX_512.parse_operand@dest dest
AVX_512.parse_vsib_operand@src src
AVX_512.parse_operand@aux aux
if @dest.type = 'mmreg' & @src.type = 'mem' & @aux.type = 'mmreg'
if @src.size and not 8 | (@dest.size > 16 & @dest.size * (asize shr 2) > @src.visize * 2) | (@src.visize > 16 & @dest.size * (asize shr 2) < @src.visize * 2)
err 'invalid operand size'
Expand Down Expand Up @@ -3899,7 +3926,7 @@ macro vdpps? dest*,src*,src2*,imm*
end macro

macro vlddqu? dest*,src*
AVX.parse_operand@dest dest
AVX_512.parse_operand@dest dest
x86.parse_operand@src src
if @dest.type = 'mmreg' & @src.type = 'mem'
if @src.size and not @dest.size
Expand Down
2 changes: 1 addition & 1 deletion packages/x86-2/iset/sse3.inc
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ macro palignr? dest*,src*,aux*
if @aux.size and not 1
err 'invalid operand size'
end if
MMX.select_operand_prefix @src,@dest.size
MMX.select_operand_prefix@src @dest.size
x86.store_instruction@src <0Fh,3Ah,0Fh>,@dest.rm,1,@aux.imm
else
err 'invalid combination of operands'
Expand Down
2 changes: 1 addition & 1 deletion packages/x86-2/iset/sse4.inc
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ macro pextrw? dest*,src*,sel*
if @dest.size <> 4 | @aux.size and not 1
err 'invalid operand size'
end if
MMX.select_operand_prefix @src,@src.size
MMX.select_operand_prefix@src @src.size
x86.store_instruction@src <0Fh,0C5h>,@dest.rm,1,@aux.imm
else if @dest.type = 'mem' & (@src.type = 'mmreg' & @src.size = 16) & @aux.type = 'imm'
if @dest.size and not 2 | @aux.size and not 1
Expand Down

0 comments on commit 8a9fd46

Please sign in to comment.