MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / SimdPrefix

Function SimdPrefix

common/emitter/simd.cpp:180–211  ·  view source on GitHub ↗

------------------------------------------------------------------------ SimdPrefix - If the lower byte of the opcode is 0x38 or 0x3a, then the opcode is treated as a 16 bit value (in SSE 0x38 and 0x3a denote prefixes for extended SSE3/4 instructions). Any other lower value assumes the upper value is 0 and ignored. Non-zero upper bytes, when the lower byte is not the 0x38 or 0x3a prefix, will gen

Source from the content-addressed store, hash-verified

178 // generate an assertion.
179 //
180 __emitinline void SimdPrefix(u8 prefix, u16 opcode)
181 {
182 pxAssertMsg(prefix == 0, "REX prefix must be just before the opcode");
183
184 const bool is16BitOpcode = ((opcode & 0xff) == 0x38) || ((opcode & 0xff) == 0x3a);
185
186 // If the lower byte is not a valid prefix and the upper byte is non-zero it
187 // means we made a mistake!
188 if (!is16BitOpcode)
189 pxAssert((opcode >> 8) == 0);
190
191 if (prefix != 0)
192 {
193 if (is16BitOpcode)
194 xWrite32((opcode << 16) | 0x0f00 | prefix);
195 else
196 {
197 xWrite16(0x0f00 | prefix);
198 xWrite8(opcode);
199 }
200 }
201 else
202 {
203 if (is16BitOpcode)
204 {
205 xWrite8(0x0f);
206 xWrite16(opcode);
207 }
208 else
209 xWrite16((opcode << 8) | 0x0f);
210 }
211 }
212
213 // clang-format off
214

Callers 1

xOpWrite0FFunction · 0.85

Calls 3

xWrite32Function · 0.85
xWrite16Function · 0.85
xWrite8Function · 0.85

Tested by

no test coverage detected