# VINSERTI128/VINSERTI32x4/VINSERTI64x2/VINSERTI32x8/VINSERTI64x4 5-314 PAGE 2138 LINE 109785
define pcodeop vinserti128 ;
:VINSERTI128 YmmReg1, vexVVVV_YmmReg, XmmReg2_m128, imm8 is $(VEX_NDS) & $(VEX_L256) & $(VEX_PRE_66) & $(VEX_0F3A) & $(VEX_W0) & vexVVVV_YmmReg; byte=0x38; YmmReg1 ... & XmmReg2_m128; imm8 & imm8_0 {
	local tmp:16 = XmmReg2_m128;

	# ignoring all but the least significant bit
	if (imm8_0:1 == 0) goto <case0>;
	if (imm8_0:1 == 1) goto <case1>;

 <case0>
	YmmReg1[0,128] = tmp;
	YmmReg1[128,128] = vexVVVV_YmmReg[128,128];
	goto <done>;

 <case1>
	YmmReg1[0,128] = vexVVVV_YmmReg[0,128];
	YmmReg1[128,128] = tmp;

 <done>
}

# VGATHERDPD/VGATHERQPD 5-251 PAGE 2075 LINE 106903
define pcodeop vgatherdpd ;
:VGATHERDPD XmmReg1, q_vm32x, vexVVVV_XmmReg is $(VEX_DDS) & $(VEX_L128) & $(VEX_PRE_66) & $(VEX_0F38) & $(VEX_W1) & vexVVVV_XmmReg; byte=0x92; (XmmReg1 & YmmReg1) ... & q_vm32x {
# TODO full semantics necessary for VSIB memory data access, leave out of data flow for now
#	XmmReg1 = vgatherdpd(XmmReg1, q_vm32x, vexVVVV_XmmReg);
	local tmp:16 = vgatherdpd(XmmReg1, vexVVVV_XmmReg);
	YmmReg1 = zext(tmp);
	# TODO ZmmReg1 = zext(XmmReg1)
	vexVVVV_XmmReg = 0;
}

# VGATHERDPD/VGATHERQPD 5-251 PAGE 2075 LINE 106908
@ifdef IA64
define pcodeop vgatherqpd ;
:VGATHERQPD XmmReg1, q_vm64x, vexVVVV_XmmReg is $(LONGMODE_ON) & $(VEX_DDS) & $(VEX_L128) & $(VEX_PRE_66) & $(VEX_0F38) & $(VEX_W1) & vexVVVV_XmmReg; byte=0x93; (XmmReg1 & YmmReg1) ... & q_vm64x {
# TODO full semantics necessary for VSIB memory data access, leave out of data flow for now
#	XmmReg1 = vgatherqpd(XmmReg1, q_vm64x, vexVVVV_XmmReg);
	local tmp:16 = vgatherqpd(XmmReg1, vexVVVV_XmmReg);
	YmmReg1 = zext(tmp);
	# TODO ZmmReg1 = zext(XmmReg1)
	vexVVVV_XmmReg = 0;
}
@endif

# VGATHERDPD/VGATHERQPD 5-251 PAGE 2075 LINE 106913
:VGATHERDPD YmmReg1, q_vm32x, vexVVVV_YmmReg is $(VEX_DDS) & $(VEX_L256) & $(VEX_PRE_66) & $(VEX_0F38) & $(VEX_W1) & vexVVVV_YmmReg; byte=0x92; YmmReg1 ... & q_vm32x {
# TODO full semantics necessary for VSIB memory data access, leave out of data flow for now
#	YmmReg1 = vgatherdpd(YmmReg1, q_vm32x, vexVVVV_YmmReg);
	YmmReg1 = vgatherdpd(YmmReg1, vexVVVV_YmmReg);
	# TODO ZmmReg1 = zext(YmmReg1)
	vexVVVV_YmmReg = 0;
}

# VGATHERDPD/VGATHERQPD 5-251 PAGE 2075 LINE 106918
@ifdef IA64
:VGATHERQPD YmmReg1, q_vm64y, vexVVVV_YmmReg is $(LONGMODE_ON) & $(VEX_DDS) & $(VEX_L256) & $(VEX_PRE_66) & $(VEX_0F38) & $(VEX_W1) & vexVVVV_YmmReg; byte=0x93; YmmReg1 ... & q_vm64y {
# TODO full semantics necessary for VSIB memory data access, leave out of data flow for now
#	YmmReg1 = vgatherqpd(YmmReg1, q_vm64y, vexVVVV_YmmReg);
	YmmReg1 = vgatherqpd(YmmReg1, vexVVVV_YmmReg);
	# TODO ZmmReg1 = zext(YmmReg1)
	vexVVVV_YmmReg = 0;
}
@endif


# VGATHERDPS/VGATHERQPS 5-256 PAGE 2080 LINE 107130
define pcodeop vgatherdps ;
:VGATHERDPS XmmReg1, d_vm32x, vexVVVV_XmmReg is $(VEX_DDS) & $(VEX_L128) & $(VEX_PRE_66) & $(VEX_0F38) & $(VEX_W0) & vexVVVV_XmmReg; byte=0x92; (XmmReg1 & YmmReg1) ... & d_vm32x {
# TODO full semantics necessary for VSIB memory data access, leave out of data flow for now
#	XmmReg1 = vgatherdps(XmmReg1, d_vm32x, vexVVVV_XmmReg);
	local tmp:16 = vgatherdps(XmmReg1, vexVVVV_XmmReg);
	YmmReg1 = zext(tmp);
	# TODO ZmmReg1 = zext(XmmReg1)
	vexVVVV_XmmReg = 0;
}

# VGATHERDPS/VGATHERQPS 5-256 PAGE 2080 LINE 107135
@ifdef IA64
define pcodeop vgatherqps ;
:VGATHERQPS XmmReg1, d_vm64x, vexVVVV_XmmReg is $(LONGMODE_ON) & $(VEX_DDS) & $(VEX_L128) & $(VEX_PRE_66) & $(VEX_0F38) & $(VEX_W0) & vexVVVV_XmmReg; byte=0x93; (XmmReg1 & YmmReg1) ... & d_vm64x {
# TODO full semantics necessary for VSIB memory data access, leave out of data flow for now
#	XmmReg1 = vgatherqps(XmmReg1, d_vm64x, vexVVVV_XmmReg);
	local tmp:16 = vgatherqps(XmmReg1, vexVVVV_XmmReg);
	YmmReg1 = zext(tmp);
	# TODO ZmmReg1 = zext(XmmReg1)
	vexVVVV_XmmReg = 0;
}
@endif

# VGATHERDPS/VGATHERQPS 5-256 PAGE 2080 LINE 107140
:VGATHERDPS YmmReg1, d_vm32y, vexVVVV_YmmReg is $(VEX_DDS) & $(VEX_L256) & $(VEX_PRE_66) & $(VEX_0F38) & $(VEX_W0) & vexVVVV_YmmReg; byte=0x92; YmmReg1 ... & d_vm32y {
# TODO full semantics necessary for VSIB memory data access, leave out of data flow for now
#	YmmReg1 = vgatherdps(YmmReg1, d_vm32y, vexVVVV_YmmReg);
	YmmReg1 = vgatherdps(YmmReg1, vexVVVV_YmmReg);
	# TODO ZmmReg1 = zext(YmmReg1)
	vexVVVV_YmmReg = 0;
}

# VGATHERDPS/VGATHERQPS 5-256 PAGE 2080 LINE 107145
@ifdef IA64
:VGATHERQPS XmmReg1, d_vm64y, vexVVVV_XmmReg is $(LONGMODE_ON) & $(VEX_DDS) & $(VEX_L256) & $(VEX_PRE_66) & $(VEX_0F38) & $(VEX_W0) & vexVVVV_XmmReg; byte=0x93; (XmmReg1 & YmmReg1) ... & d_vm64y {
# TODO full semantics necessary for VSIB memory data access, leave out of data flow for now
#	XmmReg1 = vgatherqps(XmmReg1, d_vm64y, vexVVVV_XmmReg);
	XmmReg1 = vgatherqps(XmmReg1, vexVVVV_XmmReg);
	YmmReg1 = zext(XmmReg1);
	# TODO ZmmReg1 = zext(XmmReg1)
	vexVVVV_XmmReg = 0;
}
@endif

# PCMPEQQ 4-250 PAGE 1370 LINE 71171
:VPCMPEQQ YmmReg1, vexVVVV_YmmReg, YmmReg2_m256 is $(VEX_NDS) & $(VEX_L256) & $(VEX_PRE_66) & $(VEX_0F38) & $(VEX_WIG) & vexVVVV_YmmReg; byte=0x29; YmmReg1 ... & YmmReg2_m256
{
	YmmReg1[0,64] = zext(vexVVVV_YmmReg[0,64] == YmmReg2_m256[0,64]) * 0xffffffffffffffff:8;
	YmmReg1[64,64] = zext(vexVVVV_YmmReg[64,64] == YmmReg2_m256[64,64]) * 0xffffffffffffffff:8;
	YmmReg1[128,64] = zext(vexVVVV_YmmReg[128,64] == YmmReg2_m256[128,64]) * 0xffffffffffffffff:8;
	YmmReg1[192,64] = zext(vexVVVV_YmmReg[192,64] == YmmReg2_m256[192,64]) * 0xffffffffffffffff:8;
	# TODO ZmmReg1 = zext(YmmReg1)
}

# VPGATHERDD/VPGATHERQD 5-273 PAGE 2097 LINE 107884
define pcodeop vpgatherdd ;
:VPGATHERDD XmmReg1, d_vm32x, vexVVVV_XmmReg is $(VEX_DDS) & $(VEX_L128) & $(VEX_PRE_66) & $(VEX_0F38) & $(VEX_W0) & vexVVVV_XmmReg; byte=0x90; (XmmReg1 & YmmReg1) ... & d_vm32x {
# TODO full semantics necessary for VSIB memory data access, leave out of data flow for now
#	XmmReg1 = vpgatherdd(XmmReg1, d_vm32x, vexVVVV_XmmReg);
	local tmp:16 = vpgatherdd(XmmReg1, vexVVVV_XmmReg);
	YmmReg1 = zext(tmp);
	# TODO ZmmReg1 = zext(XmmReg1)
	vexVVVV_XmmReg = 0;
}

# VPGATHERDD/VPGATHERQD 5-273 PAGE 2097 LINE 107888
@ifdef IA64
define pcodeop vpgatherqd ;
:VPGATHERQD XmmReg1, d_vm64x, vexVVVV_XmmReg is $(LONGMODE_ON) & $(VEX_DDS) & $(VEX_L128) & $(VEX_PRE_66) & $(VEX_0F38) & $(VEX_W0) & vexVVVV_XmmReg; byte=0x91; (XmmReg1 & YmmReg1) ... & d_vm64x {
# TODO full semantics necessary for VSIB memory data access, leave out of data flow for now
#	XmmReg1 = vpgatherqd(XmmReg1, d_vm64x, vexVVVV_XmmReg);
	local tmp:16 = vpgatherqd(XmmReg1, vexVVVV_XmmReg);
	YmmReg1 = zext(tmp);
	# TODO ZmmReg1 = zext(XmmReg1)
	vexVVVV_XmmReg = 0;
}
@endif

# VPGATHERDD/VPGATHERQD 5-273 PAGE 2097 LINE 107892
:VPGATHERDD YmmReg1, d_vm32y, vexVVVV_YmmReg is $(VEX_DDS) & $(VEX_L256) & $(VEX_PRE_66) & $(VEX_0F38) & $(VEX_W0) & vexVVVV_YmmReg; byte=0x90; YmmReg1 ... & d_vm32y {
# TODO full semantics necessary for VSIB memory data access, leave out of data flow for now
#	YmmReg1 = vpgatherdd(YmmReg1, d_vm32y, vexVVVV_YmmReg);
	YmmReg1 = vpgatherdd(YmmReg1, vexVVVV_YmmReg);
	# TODO ZmmReg1 = zext(YmmReg1)
	vexVVVV_YmmReg = 0;
}

# VPGATHERDD/VPGATHERQD 5-273 PAGE 2097 LINE 107896
@ifdef IA64
:VPGATHERQD XmmReg1, d_vm64y, vexVVVV_XmmReg is $(LONGMODE_ON) & $(VEX_DDS) & $(VEX_L256) & $(VEX_PRE_66) & $(VEX_0F38) & $(VEX_W0) & vexVVVV_XmmReg; byte=0x91; (XmmReg1 & YmmReg1) ... & d_vm64y {
# TODO full semantics necessary for VSIB memory data access, leave out of data flow for now
#	XmmReg1 = vpgatherqd(XmmReg1, d_vm64y, vexVVVV_XmmReg);
	local tmp:16 = vpgatherqd(XmmReg1, vexVVVV_XmmReg);
	YmmReg1 = zext(tmp);
	# TODO ZmmReg1 = zext(XmmReg1)
	vexVVVV_XmmReg = 0;
}
@endif


# VPGATHERDQ/VPGATHERQQ 5-280 PAGE 2104 LINE 108234
define pcodeop vpgatherdq ;
:VPGATHERDQ XmmReg1, q_vm32x, vexVVVV_XmmReg is $(VEX_DDS) & $(VEX_L128) & $(VEX_PRE_66) & $(VEX_0F38) & $(VEX_W1) & vexVVVV_XmmReg; byte=0x90; (XmmReg1 & YmmReg1) ... & q_vm32x {
# TODO full semantics necessary for VSIB memory data access, leave out of data flow for now
#	XmmReg1 = vpgatherdq(XmmReg1, q_vm32x, vexVVVV_XmmReg);
	local tmp:16 = vpgatherdq(XmmReg1, vexVVVV_XmmReg);
	YmmReg1 = zext(tmp);
	# TODO ZmmReg1 = zext(XmmReg1)
	vexVVVV_XmmReg = 0;
}

# VPGATHERDQ/VPGATHERQQ 5-280 PAGE 2104 LINE 108238
@ifdef IA64
define pcodeop vpgatherqq ;
:VPGATHERQQ XmmReg1, q_vm64x, vexVVVV_XmmReg is $(LONGMODE_ON) & $(VEX_DDS) & $(VEX_L128) & $(VEX_PRE_66) & $(VEX_0F38) & $(VEX_W1) & vexVVVV_XmmReg; byte=0x91; (XmmReg1 & YmmReg1) ... & q_vm64x {
# TODO full semantics necessary for VSIB memory data access, leave out of data flow for now
#	XmmReg1 = vpgatherqq(XmmReg1, q_vm64x, vexVVVV_XmmReg);
	local tmp:16 = vpgatherqq(XmmReg1, vexVVVV_XmmReg);
	YmmReg1 = zext(tmp);
	# TODO ZmmReg1 = zext(XmmReg1)
	vexVVVV_XmmReg = 0;
}
@endif

# VPGATHERDQ/VPGATHERQQ 5-280 PAGE 2104 LINE 108242
:VPGATHERDQ YmmReg1, q_vm32x, vexVVVV_YmmReg is $(VEX_DDS) & $(VEX_L256) & $(VEX_PRE_66) & $(VEX_0F38) & $(VEX_W1) & vexVVVV_YmmReg; byte=0x90; YmmReg1 ... & q_vm32x {
# TODO full semantics necessary for VSIB memory data access, leave out of data flow for now
#	YmmReg1 = vpgatherdq(YmmReg1, q_vm32x, vexVVVV_YmmReg);
	YmmReg1 = vpgatherdq(YmmReg1, vexVVVV_YmmReg);
	# TODO ZmmReg1 = zext(YmmReg1)
	vexVVVV_YmmReg = 0;
}

# VPGATHERDQ/VPGATHERQQ 5-280 PAGE 2104 LINE 108246
@ifdef IA64
:VPGATHERQQ YmmReg1, q_vm64y, vexVVVV_YmmReg is $(LONGMODE_ON) & $(VEX_DDS) & $(VEX_L256) & $(VEX_PRE_66) & $(VEX_0F38) & $(VEX_W1) & vexVVVV_YmmReg; byte=0x91; YmmReg1 ... & q_vm64y {
# TODO full semantics necessary for VSIB memory data access, leave out of data flow for now
#	YmmReg1 = vpgatherqq(YmmReg1, q_vm64y, vexVVVV_YmmReg);
	YmmReg1 = vpgatherqq(YmmReg1, vexVVVV_YmmReg);
	# TODO ZmmReg1 = zext(YmmReg1)
	vexVVVV_YmmReg = 0;
}
@endif


# PMOVMSKB 4-338 PAGE 1458 LINE 75655
:VPMOVMSKB Reg32, YmmReg2 is $(VEX_NONE) & $(VEX_L256) & $(VEX_PRE_66) & $(VEX_0F) & $(VEX_WIG); byte=0xD7; Reg32 & (mod=0x3 & YmmReg2) & check_Reg32_dest
{
	local byte_mask:4 = 0:4;
	byte_mask[0,1] = YmmReg2[7,1];
	byte_mask[1,1] = YmmReg2[15,1];
	byte_mask[2,1] = YmmReg2[23,1];
	byte_mask[3,1] = YmmReg2[31,1];
	byte_mask[4,1] = YmmReg2[39,1];
	byte_mask[5,1] = YmmReg2[47,1];
	byte_mask[6,1] = YmmReg2[55,1];
	byte_mask[7,1] = YmmReg2[63,1];
	byte_mask[8,1] = YmmReg2[71,1];
	byte_mask[9,1] = YmmReg2[79,1];
	byte_mask[10,1] = YmmReg2[87,1];
	byte_mask[11,1] = YmmReg2[95,1];
	byte_mask[12,1] = YmmReg2[103,1];
	byte_mask[13,1] = YmmReg2[111,1];
	byte_mask[14,1] = YmmReg2[119,1];
	byte_mask[15,1] = YmmReg2[127,1];
	byte_mask[16,1] = YmmReg2[135,1];
	byte_mask[17,1] = YmmReg2[143,1];
	byte_mask[18,1] = YmmReg2[151,1];
	byte_mask[19,1] = YmmReg2[159,1];
	byte_mask[20,1] = YmmReg2[167,1];
	byte_mask[21,1] = YmmReg2[175,1];
	byte_mask[22,1] = YmmReg2[183,1];
	byte_mask[23,1] = YmmReg2[191,1];
	byte_mask[24,1] = YmmReg2[199,1];
	byte_mask[25,1] = YmmReg2[207,1];
	byte_mask[26,1] = YmmReg2[215,1];
	byte_mask[27,1] = YmmReg2[223,1];
	byte_mask[28,1] = YmmReg2[231,1];
	byte_mask[29,1] = YmmReg2[239,1];
	byte_mask[30,1] = YmmReg2[247,1];
	byte_mask[31,1] = YmmReg2[255,1];
	Reg32 = zext(byte_mask);
	build check_Reg32_dest;
}

