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:
7
decode.c
7
decode.c
@@ -479,13 +479,14 @@ direct:
|
||||
else
|
||||
{
|
||||
bool vsib = UNLIKELY(DESC_VSIB(desc));
|
||||
unsigned dispscale = 0;
|
||||
|
||||
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;
|
||||
|
||||
// EVEX.b for memory-operand without broadcast support is UD.
|
||||
unsigned dispscale = 0;
|
||||
if (UNLIKELY(prefix_evex & 0x10)) {
|
||||
if (UNLIKELY(!DESC_EVEX_BCST(desc)))
|
||||
return FD_ERR_UD;
|
||||
@@ -496,10 +497,12 @@ direct:
|
||||
instr->segment |= dispscale << 6; // Store broadcast size
|
||||
op_modrm->type = FD_OT_MEMBCST;
|
||||
} else {
|
||||
if (UNLIKELY(prefix_evex))
|
||||
dispscale = op_modrm->size - 1;
|
||||
op_modrm->type = FD_OT_MEM;
|
||||
}
|
||||
} else {
|
||||
op_modrm->type = FD_OT_MEM;
|
||||
}
|
||||
|
||||
// 16-bit address size implies different ModRM encoding
|
||||
if (UNLIKELY(addr_size == 1)) {
|
||||
|
||||
Reference in New Issue
Block a user