fadec: Store broadcast size in segment

This is a preparation for AVX512-FP16, where the broadcast size is not
just 32/64 bit depending solely on EVEX.W, but can also be 16 bit (with
EVEX.W=0). The broadcast size therefore needs two bits, but the evex
field only had one free bit left. Store broadcast size with the segment
for now. (This is not a good fit and is likely to change at some point.)
This commit is contained in:
Alexis Engelke
2022-12-26 16:57:22 +01:00
parent a3c8848005
commit 06832825ec
3 changed files with 13 additions and 11 deletions

View File

@@ -366,9 +366,7 @@ prefix_end:
} else {
if (UNLIKELY(vexl == 3)) // EVEX.L'L == 11b is UD
return FD_ERR_UD;
// Update V' to REX.W, s.t. broadcast size is exposed
unsigned rexw = prefix_rex & PREFIX_REXW ? 0x08 : 0x00;
instr->evex = (prefix_evex & 0x87) | rexw;
instr->evex = prefix_evex & 0x87; // clear RC, clear B
}
} else {
instr->evex = 0;
@@ -498,6 +496,7 @@ prefix_end:
if (UNLIKELY(!DESC_EVEX_BCST(desc)))
return FD_ERR_UD;
scale = prefix_rex & PREFIX_REXW ? 3 : 2;
instr->segment |= scale << 6; // Store broadcast size
op_modrm->type = FD_OT_MEMBCST;
} else {
op_modrm->type = FD_OT_MEM;