1 #include <cassert>
2 #include "X86Assembler.h"
3 
WriteVex(VEX_OPCODE_MAP opMap,XMMREGISTER & dst,XMMREGISTER src1,const CAddress & src2)4 void CX86Assembler::WriteVex(VEX_OPCODE_MAP opMap, XMMREGISTER& dst, XMMREGISTER src1, const CAddress& src2)
5 {
6 	assert(!src2.nIsExtendedSib);
7 
8 	uint8 prefix = (opMap >> 4) & 0x0F;
9 	uint8 map = (opMap & 0x0F);
10 
11 	assert(prefix < 4);
12 	assert(map < 4);
13 
14 	bool isExtendedR = (dst > xMM7);
15 	if(isExtendedR)
16 	{
17 		dst = static_cast<XMMREGISTER>(dst & 7);
18 	}
19 
20 	if(src2.nIsExtendedModRM || (map != 1))
21 	{
22 		//Three byte VEX
23 		uint8 b1 = 0;
24 		b1 |= map;
25 		b1 |= (src2.nIsExtendedModRM ? 0 : 1) << 5;
26 		b1 |= (src2.nIsExtendedSib ? 0 : 1) << 6;
27 		b1 |= (isExtendedR ? 0 : 1) << 7;
28 
29 		uint8 b2 = 0;
30 		b2 |= prefix;
31 		b2 |= (~static_cast<uint8>(src1) & 0xF) << 3;
32 
33 		WriteByte(0xC4);
34 		WriteByte(b1);
35 		WriteByte(b2);
36 	}
37 	else
38 	{
39 		//Two byte VEX
40 		uint8 b1 = 0;
41 		b1 |= prefix;
42 		b1 |= (~static_cast<uint8>(src1) & 0xF) << 3;
43 		b1 |= (isExtendedR ? 0 : 1) << 7;
44 
45 		WriteByte(0xC5);
46 		WriteByte(b1);
47 	}
48 }
49 
WriteVexVoOp(VEX_OPCODE_MAP opMap,uint8 op,XMMREGISTER dst,XMMREGISTER src1,const CAddress & src2)50 void CX86Assembler::WriteVexVoOp(VEX_OPCODE_MAP opMap, uint8 op, XMMREGISTER dst, XMMREGISTER src1, const CAddress& src2)
51 {
52 	WriteVex(opMap, dst, src1, src2);
53 	WriteByte(op);
54 	CAddress newAddress(src2);
55 	newAddress.ModRm.nFnReg = dst;
56 	newAddress.Write(&m_tmpStream);
57 	//Check for rIP relative addressing
58 	if(src2.ModRm.nByte == 0x05)
59 	{
60 		assert(m_currentLabel);
61 		auto literalIterator = m_currentLabel->literal128Refs.find(src2.literal128Id);
62 		assert(literalIterator != std::end(m_currentLabel->literal128Refs));
63 		auto& literal = literalIterator->second;
64 		assert(literal.offset == 0);
65 		literal.offset = static_cast<uint32>(m_tmpStream.Tell());
66 		//Write placeholder
67 		m_tmpStream.Write32(0);
68 	}
69 }
70 
WriteVexShiftVoOp(uint8 op,uint8 subOp,XMMREGISTER dst,XMMREGISTER src,uint8 amount)71 void CX86Assembler::WriteVexShiftVoOp(uint8 op, uint8 subOp, XMMREGISTER dst, XMMREGISTER src, uint8 amount)
72 {
73 	assert(subOp < 8);
74 	auto tmpReg = CX86Assembler::xMM0;
75 	auto address = MakeXmmRegisterAddress(src);
76 	address.ModRm.nFnReg = subOp;
77 	WriteVex(VEX_OPCODE_MAP_66, tmpReg, dst, address);
78 	WriteByte(op);
79 	address.Write(&m_tmpStream);
80 	WriteByte(amount);
81 }
82 
VmovdVo(XMMREGISTER dst,const CAddress & src)83 void CX86Assembler::VmovdVo(XMMREGISTER dst, const CAddress& src)
84 {
85 	WriteVexVoOp(VEX_OPCODE_MAP_66, 0x6E, dst, CX86Assembler::xMM0, src);
86 }
87 
VmovdVo(const CAddress & dst,XMMREGISTER src)88 void CX86Assembler::VmovdVo(const CAddress& dst, XMMREGISTER src)
89 {
90 	WriteVexVoOp(VEX_OPCODE_MAP_66, 0x7E, src, CX86Assembler::xMM0, dst);
91 }
92 
VmovssEd(XMMREGISTER dst,const CAddress & src)93 void CX86Assembler::VmovssEd(XMMREGISTER dst, const CAddress& src)
94 {
95 	WriteVexVoOp(VEX_OPCODE_MAP_F3, 0x10, dst, CX86Assembler::xMM0, src);
96 }
97 
VmovssEd(const CAddress & dst,XMMREGISTER src)98 void CX86Assembler::VmovssEd(const CAddress& dst, XMMREGISTER src)
99 {
100 	WriteVexVoOp(VEX_OPCODE_MAP_F3, 0x11, src, CX86Assembler::xMM0, dst);
101 }
102 
VaddssEd(XMMREGISTER dst,XMMREGISTER src1,const CAddress & src2)103 void CX86Assembler::VaddssEd(XMMREGISTER dst, XMMREGISTER src1, const CAddress& src2)
104 {
105 	WriteVexVoOp(VEX_OPCODE_MAP_F3, 0x58, dst, src1, src2);
106 }
107 
VsubssEd(XMMREGISTER dst,XMMREGISTER src1,const CAddress & src2)108 void CX86Assembler::VsubssEd(XMMREGISTER dst, XMMREGISTER src1, const CAddress& src2)
109 {
110 	WriteVexVoOp(VEX_OPCODE_MAP_F3, 0x5C, dst, src1, src2);
111 }
112 
VmulssEd(XMMREGISTER dst,XMMREGISTER src1,const CAddress & src2)113 void CX86Assembler::VmulssEd(XMMREGISTER dst, XMMREGISTER src1, const CAddress& src2)
114 {
115 	WriteVexVoOp(VEX_OPCODE_MAP_F3, 0x59, dst, src1, src2);
116 }
117 
VdivssEd(XMMREGISTER dst,XMMREGISTER src1,const CAddress & src2)118 void CX86Assembler::VdivssEd(XMMREGISTER dst, XMMREGISTER src1, const CAddress& src2)
119 {
120 	WriteVexVoOp(VEX_OPCODE_MAP_F3, 0x5E, dst, src1, src2);
121 }
122 
VmaxssEd(XMMREGISTER dst,XMMREGISTER src1,const CAddress & src2)123 void CX86Assembler::VmaxssEd(XMMREGISTER dst, XMMREGISTER src1, const CAddress& src2)
124 {
125 	WriteVexVoOp(VEX_OPCODE_MAP_F3, 0x5F, dst, src1, src2);
126 }
127 
VminssEd(XMMREGISTER dst,XMMREGISTER src1,const CAddress & src2)128 void CX86Assembler::VminssEd(XMMREGISTER dst, XMMREGISTER src1, const CAddress& src2)
129 {
130 	WriteVexVoOp(VEX_OPCODE_MAP_F3, 0x5D, dst, src1, src2);
131 }
132 
VcmpssEd(XMMREGISTER dst,XMMREGISTER src1,const CAddress & src2,SSE_CMP_TYPE condition)133 void CX86Assembler::VcmpssEd(XMMREGISTER dst, XMMREGISTER src1, const CAddress& src2, SSE_CMP_TYPE condition)
134 {
135 	WriteVexVoOp(VEX_OPCODE_MAP_F3, 0xC2, dst, src1, src2);
136 	WriteByte(static_cast<uint8>(condition));
137 }
138 
VsqrtssEd(XMMREGISTER dst,XMMREGISTER src1,const CAddress & src2)139 void CX86Assembler::VsqrtssEd(XMMREGISTER dst, XMMREGISTER src1, const CAddress& src2)
140 {
141 	WriteVexVoOp(VEX_OPCODE_MAP_F3, 0x51, dst, src1, src2);
142 }
143 
Vcvtsi2ssEd(XMMREGISTER dst,const CAddress & src)144 void CX86Assembler::Vcvtsi2ssEd(XMMREGISTER dst, const CAddress& src)
145 {
146 	WriteVexVoOp(VEX_OPCODE_MAP_F3, 0x2A, dst, CX86Assembler::xMM0, src);
147 }
148 
Vcvttss2siEd(REGISTER dst,const CAddress & src)149 void CX86Assembler::Vcvttss2siEd(REGISTER dst, const CAddress& src)
150 {
151 	WriteVexVoOp(VEX_OPCODE_MAP_F3, 0x2C, static_cast<XMMREGISTER>(dst), CX86Assembler::xMM0, src);
152 }
153 
VmovdqaVo(XMMREGISTER dst,const CAddress & src)154 void CX86Assembler::VmovdqaVo(XMMREGISTER dst, const CAddress& src)
155 {
156 	WriteVexVoOp(VEX_OPCODE_MAP_66, 0x6F, dst, CX86Assembler::xMM0, src);
157 }
158 
VmovdqaVo(const CAddress & dst,XMMREGISTER src)159 void CX86Assembler::VmovdqaVo(const CAddress& dst, XMMREGISTER src)
160 {
161 	WriteVexVoOp(VEX_OPCODE_MAP_66, 0x7F, src, CX86Assembler::xMM0, dst);
162 }
163 
VmovdquVo(XMMREGISTER dst,const CAddress & src)164 void CX86Assembler::VmovdquVo(XMMREGISTER dst, const CAddress& src)
165 {
166 	WriteVexVoOp(VEX_OPCODE_MAP_F3, 0x6F, dst, CX86Assembler::xMM0, src);
167 }
168 
VmovapsVo(XMMREGISTER dst,const CAddress & src)169 void CX86Assembler::VmovapsVo(XMMREGISTER dst, const CAddress& src)
170 {
171 	WriteVexVoOp(VEX_OPCODE_MAP_NONE, 0x28, dst, CX86Assembler::xMM0, src);
172 }
173 
VmovapsVo(const CAddress & dst,XMMREGISTER src)174 void CX86Assembler::VmovapsVo(const CAddress& dst, XMMREGISTER src)
175 {
176 	WriteVexVoOp(VEX_OPCODE_MAP_NONE, 0x29, src, CX86Assembler::xMM0, dst);
177 }
178 
VpaddbVo(XMMREGISTER dst,XMMREGISTER src1,const CAddress & src2)179 void CX86Assembler::VpaddbVo(XMMREGISTER dst, XMMREGISTER src1, const CAddress& src2)
180 {
181 	WriteVexVoOp(VEX_OPCODE_MAP_66, 0xFC, dst, src1, src2);
182 }
183 
VpaddwVo(XMMREGISTER dst,XMMREGISTER src1,const CAddress & src2)184 void CX86Assembler::VpaddwVo(XMMREGISTER dst, XMMREGISTER src1, const CAddress& src2)
185 {
186 	WriteVexVoOp(VEX_OPCODE_MAP_66, 0xFD, dst, src1, src2);
187 }
188 
VpadddVo(XMMREGISTER dst,XMMREGISTER src1,const CAddress & src2)189 void CX86Assembler::VpadddVo(XMMREGISTER dst, XMMREGISTER src1, const CAddress& src2)
190 {
191 	WriteVexVoOp(VEX_OPCODE_MAP_66, 0xFE, dst, src1, src2);
192 }
193 
VpaddsbVo(XMMREGISTER dst,XMMREGISTER src1,const CAddress & src2)194 void CX86Assembler::VpaddsbVo(XMMREGISTER dst, XMMREGISTER src1, const CAddress& src2)
195 {
196 	WriteVexVoOp(VEX_OPCODE_MAP_66, 0xEC, dst, src1, src2);
197 }
198 
VpaddswVo(XMMREGISTER dst,XMMREGISTER src1,const CAddress & src2)199 void CX86Assembler::VpaddswVo(XMMREGISTER dst, XMMREGISTER src1, const CAddress& src2)
200 {
201 	WriteVexVoOp(VEX_OPCODE_MAP_66, 0xED, dst, src1, src2);
202 }
203 
VpaddusbVo(XMMREGISTER dst,XMMREGISTER src1,const CAddress & src2)204 void CX86Assembler::VpaddusbVo(XMMREGISTER dst, XMMREGISTER src1, const CAddress& src2)
205 {
206 	WriteVexVoOp(VEX_OPCODE_MAP_66, 0xDC, dst, src1, src2);
207 }
208 
VpadduswVo(XMMREGISTER dst,XMMREGISTER src1,const CAddress & src2)209 void CX86Assembler::VpadduswVo(XMMREGISTER dst, XMMREGISTER src1, const CAddress& src2)
210 {
211 	WriteVexVoOp(VEX_OPCODE_MAP_66, 0xDD, dst, src1, src2);
212 }
213 
VpsubbVo(XMMREGISTER dst,XMMREGISTER src1,const CAddress & src2)214 void CX86Assembler::VpsubbVo(XMMREGISTER dst, XMMREGISTER src1, const CAddress& src2)
215 {
216 	WriteVexVoOp(VEX_OPCODE_MAP_66, 0xF8, dst, src1, src2);
217 }
218 
VpsubwVo(XMMREGISTER dst,XMMREGISTER src1,const CAddress & src2)219 void CX86Assembler::VpsubwVo(XMMREGISTER dst, XMMREGISTER src1, const CAddress& src2)
220 {
221 	WriteVexVoOp(VEX_OPCODE_MAP_66, 0xF9, dst, src1, src2);
222 }
223 
VpsubdVo(XMMREGISTER dst,XMMREGISTER src1,const CAddress & src2)224 void CX86Assembler::VpsubdVo(XMMREGISTER dst, XMMREGISTER src1, const CAddress& src2)
225 {
226 	WriteVexVoOp(VEX_OPCODE_MAP_66, 0xFA, dst, src1, src2);
227 }
228 
VpsubswVo(XMMREGISTER dst,XMMREGISTER src1,const CAddress & src2)229 void CX86Assembler::VpsubswVo(XMMREGISTER dst, XMMREGISTER src1, const CAddress& src2)
230 {
231 	WriteVexVoOp(VEX_OPCODE_MAP_66, 0xE9, dst, src1, src2);
232 }
233 
VpsubusbVo(XMMREGISTER dst,XMMREGISTER src1,const CAddress & src2)234 void CX86Assembler::VpsubusbVo(XMMREGISTER dst, XMMREGISTER src1, const CAddress& src2)
235 {
236 	WriteVexVoOp(VEX_OPCODE_MAP_66, 0xD8, dst, src1, src2);
237 }
238 
VpsubuswVo(XMMREGISTER dst,XMMREGISTER src1,const CAddress & src2)239 void CX86Assembler::VpsubuswVo(XMMREGISTER dst, XMMREGISTER src1, const CAddress& src2)
240 {
241 	WriteVexVoOp(VEX_OPCODE_MAP_66, 0xD9, dst, src1, src2);
242 }
243 
VpandVo(XMMREGISTER dst,XMMREGISTER src1,const CAddress & src2)244 void CX86Assembler::VpandVo(XMMREGISTER dst, XMMREGISTER src1, const CAddress& src2)
245 {
246 	WriteVexVoOp(VEX_OPCODE_MAP_66, 0xDB, dst, src1, src2);
247 }
248 
VporVo(XMMREGISTER dst,XMMREGISTER src1,const CAddress & src2)249 void CX86Assembler::VporVo(XMMREGISTER dst, XMMREGISTER src1, const CAddress& src2)
250 {
251 	WriteVexVoOp(VEX_OPCODE_MAP_66, 0xEB, dst, src1, src2);
252 }
253 
VpxorVo(XMMREGISTER dst,XMMREGISTER src1,const CAddress & src2)254 void CX86Assembler::VpxorVo(XMMREGISTER dst, XMMREGISTER src1, const CAddress& src2)
255 {
256 	WriteVexVoOp(VEX_OPCODE_MAP_66, 0xEF, dst, src1, src2);
257 }
258 
VpsllwVo(XMMREGISTER dst,XMMREGISTER src,uint8 amount)259 void CX86Assembler::VpsllwVo(XMMREGISTER dst, XMMREGISTER src, uint8 amount)
260 {
261 	WriteVexShiftVoOp(0x71, 0x06, dst, src, amount);
262 }
263 
VpsrlwVo(XMMREGISTER dst,XMMREGISTER src,uint8 amount)264 void CX86Assembler::VpsrlwVo(XMMREGISTER dst, XMMREGISTER src, uint8 amount)
265 {
266 	WriteVexShiftVoOp(0x71, 0x02, dst, src, amount);
267 }
268 
VpsrawVo(XMMREGISTER dst,XMMREGISTER src,uint8 amount)269 void CX86Assembler::VpsrawVo(XMMREGISTER dst, XMMREGISTER src, uint8 amount)
270 {
271 	WriteVexShiftVoOp(0x71, 0x04, dst, src, amount);
272 }
273 
VpslldVo(XMMREGISTER dst,XMMREGISTER src,uint8 amount)274 void CX86Assembler::VpslldVo(XMMREGISTER dst, XMMREGISTER src, uint8 amount)
275 {
276 	WriteVexShiftVoOp(0x72, 0x06, dst, src, amount);
277 }
278 
VpsrldVo(XMMREGISTER dst,XMMREGISTER src,uint8 amount)279 void CX86Assembler::VpsrldVo(XMMREGISTER dst, XMMREGISTER src, uint8 amount)
280 {
281 	WriteVexShiftVoOp(0x72, 0x02, dst, src, amount);
282 }
283 
VpsradVo(XMMREGISTER dst,XMMREGISTER src,uint8 amount)284 void CX86Assembler::VpsradVo(XMMREGISTER dst, XMMREGISTER src, uint8 amount)
285 {
286 	WriteVexShiftVoOp(0x72, 0x04, dst, src, amount);
287 }
288 
VpcmpeqbVo(XMMREGISTER dst,XMMREGISTER src1,const CAddress & src2)289 void CX86Assembler::VpcmpeqbVo(XMMREGISTER dst, XMMREGISTER src1, const CAddress& src2)
290 {
291 	WriteVexVoOp(VEX_OPCODE_MAP_66, 0x74, dst, src1, src2);
292 }
293 
VpcmpeqwVo(XMMREGISTER dst,XMMREGISTER src1,const CAddress & src2)294 void CX86Assembler::VpcmpeqwVo(XMMREGISTER dst, XMMREGISTER src1, const CAddress& src2)
295 {
296 	WriteVexVoOp(VEX_OPCODE_MAP_66, 0x75, dst, src1, src2);
297 }
298 
VpcmpeqdVo(XMMREGISTER dst,XMMREGISTER src1,const CAddress & src2)299 void CX86Assembler::VpcmpeqdVo(XMMREGISTER dst, XMMREGISTER src1, const CAddress& src2)
300 {
301 	WriteVexVoOp(VEX_OPCODE_MAP_66, 0x76, dst, src1, src2);
302 }
303 
VpcmpgtbVo(XMMREGISTER dst,XMMREGISTER src1,const CAddress & src2)304 void CX86Assembler::VpcmpgtbVo(XMMREGISTER dst, XMMREGISTER src1, const CAddress& src2)
305 {
306 	WriteVexVoOp(VEX_OPCODE_MAP_66, 0x64, dst, src1, src2);
307 }
308 
VpcmpgtwVo(XMMREGISTER dst,XMMREGISTER src1,const CAddress & src2)309 void CX86Assembler::VpcmpgtwVo(XMMREGISTER dst, XMMREGISTER src1, const CAddress& src2)
310 {
311 	WriteVexVoOp(VEX_OPCODE_MAP_66, 0x65, dst, src1, src2);
312 }
313 
VpcmpgtdVo(XMMREGISTER dst,XMMREGISTER src1,const CAddress & src2)314 void CX86Assembler::VpcmpgtdVo(XMMREGISTER dst, XMMREGISTER src1, const CAddress& src2)
315 {
316 	WriteVexVoOp(VEX_OPCODE_MAP_66, 0x66, dst, src1, src2);
317 }
318 
VpmaxswVo(XMMREGISTER dst,XMMREGISTER src1,const CAddress & src2)319 void CX86Assembler::VpmaxswVo(XMMREGISTER dst, XMMREGISTER src1, const CAddress& src2)
320 {
321 	WriteVexVoOp(VEX_OPCODE_MAP_66, 0xEE, dst, src1, src2);
322 }
323 
VpmaxsdVo(XMMREGISTER dst,XMMREGISTER src1,const CAddress & src2)324 void CX86Assembler::VpmaxsdVo(XMMREGISTER dst, XMMREGISTER src1, const CAddress& src2)
325 {
326 	WriteVexVoOp(VEX_OPCODE_MAP_66_38, 0x3D, dst, src1, src2);
327 }
328 
VpminswVo(XMMREGISTER dst,XMMREGISTER src1,const CAddress & src2)329 void CX86Assembler::VpminswVo(XMMREGISTER dst, XMMREGISTER src1, const CAddress& src2)
330 {
331 	WriteVexVoOp(VEX_OPCODE_MAP_66, 0xEA, dst, src1, src2);
332 }
333 
VpminsdVo(XMMREGISTER dst,XMMREGISTER src1,const CAddress & src2)334 void CX86Assembler::VpminsdVo(XMMREGISTER dst, XMMREGISTER src1, const CAddress& src2)
335 {
336 	WriteVexVoOp(VEX_OPCODE_MAP_66_38, 0x39, dst, src1, src2);
337 }
338 
VpackssdwVo(XMMREGISTER dst,XMMREGISTER src1,const CAddress & src2)339 void CX86Assembler::VpackssdwVo(XMMREGISTER dst, XMMREGISTER src1, const CAddress& src2)
340 {
341 	WriteVexVoOp(VEX_OPCODE_MAP_66, 0x6B, dst, src1, src2);
342 }
343 
VpackuswbVo(XMMREGISTER dst,XMMREGISTER src1,const CAddress & src2)344 void CX86Assembler::VpackuswbVo(XMMREGISTER dst, XMMREGISTER src1, const CAddress& src2)
345 {
346 	WriteVexVoOp(VEX_OPCODE_MAP_66, 0x67, dst, src1, src2);
347 }
348 
VpunpcklbwVo(XMMREGISTER dst,XMMREGISTER src1,const CAddress & src2)349 void CX86Assembler::VpunpcklbwVo(XMMREGISTER dst, XMMREGISTER src1, const CAddress& src2)
350 {
351 	WriteVexVoOp(VEX_OPCODE_MAP_66, 0x60, dst, src1, src2);
352 }
353 
VpunpcklwdVo(XMMREGISTER dst,XMMREGISTER src1,const CAddress & src2)354 void CX86Assembler::VpunpcklwdVo(XMMREGISTER dst, XMMREGISTER src1, const CAddress& src2)
355 {
356 	WriteVexVoOp(VEX_OPCODE_MAP_66, 0x61, dst, src1, src2);
357 }
358 
VpunpckldqVo(XMMREGISTER dst,XMMREGISTER src1,const CAddress & src2)359 void CX86Assembler::VpunpckldqVo(XMMREGISTER dst, XMMREGISTER src1, const CAddress& src2)
360 {
361 	WriteVexVoOp(VEX_OPCODE_MAP_66, 0x62, dst, src1, src2);
362 }
363 
VpunpckhbwVo(XMMREGISTER dst,XMMREGISTER src1,const CAddress & src2)364 void CX86Assembler::VpunpckhbwVo(XMMREGISTER dst, XMMREGISTER src1, const CAddress& src2)
365 {
366 	WriteVexVoOp(VEX_OPCODE_MAP_66, 0x68, dst, src1, src2);
367 }
368 
VpunpckhwdVo(XMMREGISTER dst,XMMREGISTER src1,const CAddress & src2)369 void CX86Assembler::VpunpckhwdVo(XMMREGISTER dst, XMMREGISTER src1, const CAddress& src2)
370 {
371 	WriteVexVoOp(VEX_OPCODE_MAP_66, 0x69, dst, src1, src2);
372 }
373 
VpunpckhdqVo(XMMREGISTER dst,XMMREGISTER src1,const CAddress & src2)374 void CX86Assembler::VpunpckhdqVo(XMMREGISTER dst, XMMREGISTER src1, const CAddress& src2)
375 {
376 	WriteVexVoOp(VEX_OPCODE_MAP_66, 0x6A, dst, src1, src2);
377 }
378 
VpshufbVo(XMMREGISTER dst,XMMREGISTER src1,const CAddress & src2)379 void CX86Assembler::VpshufbVo(XMMREGISTER dst, XMMREGISTER src1, const CAddress& src2)
380 {
381 	WriteVexVoOp(VEX_OPCODE_MAP_66_38, 0x00, dst, src1, src2);
382 }
383 
VpmovmskbVo(REGISTER dst,XMMREGISTER src)384 void CX86Assembler::VpmovmskbVo(REGISTER dst, XMMREGISTER src)
385 {
386 	WriteVexVoOp(VEX_OPCODE_MAP_66, 0xD7, static_cast<XMMREGISTER>(dst), CX86Assembler::xMM0, CX86Assembler::MakeXmmRegisterAddress(src));
387 }
388 
VaddpsVo(XMMREGISTER dst,XMMREGISTER src1,const CAddress & src2)389 void CX86Assembler::VaddpsVo(XMMREGISTER dst, XMMREGISTER src1, const CAddress& src2)
390 {
391 	WriteVexVoOp(VEX_OPCODE_MAP_NONE, 0x58, dst, src1, src2);
392 }
393 
VsubpsVo(XMMREGISTER dst,XMMREGISTER src1,const CAddress & src2)394 void CX86Assembler::VsubpsVo(XMMREGISTER dst, XMMREGISTER src1, const CAddress& src2)
395 {
396 	WriteVexVoOp(VEX_OPCODE_MAP_NONE, 0x5C, dst, src1, src2);
397 }
398 
VmulpsVo(XMMREGISTER dst,XMMREGISTER src1,const CAddress & src2)399 void CX86Assembler::VmulpsVo(XMMREGISTER dst, XMMREGISTER src1, const CAddress& src2)
400 {
401 	WriteVexVoOp(VEX_OPCODE_MAP_NONE, 0x59, dst, src1, src2);
402 }
403 
VdivpsVo(XMMREGISTER dst,XMMREGISTER src1,const CAddress & src2)404 void CX86Assembler::VdivpsVo(XMMREGISTER dst, XMMREGISTER src1, const CAddress& src2)
405 {
406 	WriteVexVoOp(VEX_OPCODE_MAP_NONE, 0x5E, dst, src1, src2);
407 }
408 
VcmpltpsVo(XMMREGISTER dst,XMMREGISTER src1,const CAddress & src2)409 void CX86Assembler::VcmpltpsVo(XMMREGISTER dst, XMMREGISTER src1, const CAddress& src2)
410 {
411 	VcmppsVo(dst, src1, src2, SSE_CMP_LT);
412 }
413 
VcmpgtpsVo(XMMREGISTER dst,XMMREGISTER src1,const CAddress & src2)414 void CX86Assembler::VcmpgtpsVo(XMMREGISTER dst, XMMREGISTER src1, const CAddress& src2)
415 {
416 	VcmppsVo(dst, src1, src2, SSE_CMP_NLE);
417 }
418 
VminpsVo(XMMREGISTER dst,XMMREGISTER src1,const CAddress & src2)419 void CX86Assembler::VminpsVo(XMMREGISTER dst, XMMREGISTER src1, const CAddress& src2)
420 {
421 	WriteVexVoOp(VEX_OPCODE_MAP_NONE, 0x5D, dst, src1, src2);
422 }
423 
VmaxpsVo(XMMREGISTER dst,XMMREGISTER src1,const CAddress & src2)424 void CX86Assembler::VmaxpsVo(XMMREGISTER dst, XMMREGISTER src1, const CAddress& src2)
425 {
426 	WriteVexVoOp(VEX_OPCODE_MAP_NONE, 0x5F, dst, src1, src2);
427 }
428 
Vcvtdq2psVo(XMMREGISTER dst,const CAddress & src)429 void CX86Assembler::Vcvtdq2psVo(XMMREGISTER dst, const CAddress& src)
430 {
431 	WriteVexVoOp(VEX_OPCODE_MAP_NONE, 0x5B, dst, CX86Assembler::xMM0, src);
432 }
433 
Vcvttps2dqVo(XMMREGISTER dst,const CAddress & src)434 void CX86Assembler::Vcvttps2dqVo(XMMREGISTER dst, const CAddress& src)
435 {
436 	WriteVexVoOp(VEX_OPCODE_MAP_F3, 0x5B, dst, CX86Assembler::xMM0, src);
437 }
438 
VcmppsVo(XMMREGISTER dst,XMMREGISTER src1,const CAddress & src2,SSE_CMP_TYPE condition)439 void CX86Assembler::VcmppsVo(XMMREGISTER dst, XMMREGISTER src1, const CAddress& src2, SSE_CMP_TYPE condition)
440 {
441 	WriteVexVoOp(VEX_OPCODE_MAP_NONE, 0xC2, dst, src1, src2);
442 	WriteByte(static_cast<uint8>(condition));
443 }
444 
VblendpsVo(XMMREGISTER dst,XMMREGISTER src1,const CAddress & src2,uint8 mask)445 void CX86Assembler::VblendpsVo(XMMREGISTER dst, XMMREGISTER src1, const CAddress& src2, uint8 mask)
446 {
447 	WriteVexVoOp(VEX_OPCODE_MAP_66_3A, 0x0C, dst, src1, src2);
448 	WriteByte(mask);
449 }
450 
VshufpsVo(XMMREGISTER dst,XMMREGISTER src1,const CAddress & src2,uint8 shuffleByte)451 void CX86Assembler::VshufpsVo(XMMREGISTER dst, XMMREGISTER src1, const CAddress& src2, uint8 shuffleByte)
452 {
453 	WriteVexVoOp(VEX_OPCODE_MAP_NONE, 0xC6, dst, src1, src2);
454 	WriteByte(shuffleByte);
455 }
456