decode: Group all EVEX-handling for ModRM operands
Most instructions aren't EVEX-encoded, so hide all uncommon paths behind a single branch.
This commit is contained in:
35
decode.c
35
decode.c
@@ -479,25 +479,28 @@ direct:
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
bool vsib = UNLIKELY(DESC_VSIB(desc));
|
bool vsib = UNLIKELY(DESC_VSIB(desc));
|
||||||
|
|
||||||
// EVEX.z for memory destination operand is UD.
|
|
||||||
if (UNLIKELY(prefix_evex & 0x80) && DESC_MODRM_IDX(desc) == 0)
|
|
||||||
return FD_ERR_UD;
|
|
||||||
|
|
||||||
// EVEX.b for memory-operand without broadcast support is UD.
|
|
||||||
unsigned dispscale = 0;
|
unsigned dispscale = 0;
|
||||||
if (UNLIKELY(prefix_evex & 0x10)) {
|
|
||||||
if (UNLIKELY(!DESC_EVEX_BCST(desc)))
|
if (UNLIKELY(prefix_evex)) {
|
||||||
|
// EVEX.z for memory destination operand is UD.
|
||||||
|
if (UNLIKELY(prefix_evex & 0x80) && DESC_MODRM_IDX(desc) == 0)
|
||||||
return FD_ERR_UD;
|
return FD_ERR_UD;
|
||||||
if (UNLIKELY(DESC_EVEX_BCST16(desc)))
|
|
||||||
dispscale = 1;
|
// EVEX.b for memory-operand without broadcast support is UD.
|
||||||
else
|
if (UNLIKELY(prefix_evex & 0x10)) {
|
||||||
dispscale = prefix_rex & PREFIX_REXW ? 3 : 2;
|
if (UNLIKELY(!DESC_EVEX_BCST(desc)))
|
||||||
instr->segment |= dispscale << 6; // Store broadcast size
|
return FD_ERR_UD;
|
||||||
op_modrm->type = FD_OT_MEMBCST;
|
if (UNLIKELY(DESC_EVEX_BCST16(desc)))
|
||||||
} else {
|
dispscale = 1;
|
||||||
if (UNLIKELY(prefix_evex))
|
else
|
||||||
|
dispscale = prefix_rex & PREFIX_REXW ? 3 : 2;
|
||||||
|
instr->segment |= dispscale << 6; // Store broadcast size
|
||||||
|
op_modrm->type = FD_OT_MEMBCST;
|
||||||
|
} else {
|
||||||
dispscale = op_modrm->size - 1;
|
dispscale = op_modrm->size - 1;
|
||||||
|
op_modrm->type = FD_OT_MEM;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
op_modrm->type = FD_OT_MEM;
|
op_modrm->type = FD_OT_MEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user