[X86] AVX512: Improve readability of isCDisp8

No functional change.  As I was trying to understand this function, I found
that variables were reused with confusing names and the broadcast case was a
bit too implicit.  Hopefully, this is an improvement.

llvm-svn: 212795
This commit is contained in:
Adam Nemet 2014-07-11 05:23:25 +00:00
parent e311c3c836
commit 26f817497c
1 changed files with 12 additions and 3 deletions

View File

@ -197,14 +197,23 @@ static bool isCDisp8(uint64_t TSFlags, int Value, int& CValue) {
return isDisp8(Value);
}
unsigned MemObjSize = 1U << CD8E;
unsigned ElemSize = 1U << CD8E;
unsigned MemObjSize;
// The unit of displacement is either
// - the size of a power-of-two number of elements or
// - the size of a single element for broadcasts or
// - the total vector size divided by a power-of-two number.
if (CD8V & 4) {
// Fixed vector length
MemObjSize *= 1U << (CD8V & 0x3);
unsigned NumElems = 1U << (CD8V & 0x3);
MemObjSize = ElemSize * NumElems;
} else {
// Modified vector length
bool EVEX_b = (TSFlags >> X86II::VEXShift) & X86II::EVEX_B;
if (!EVEX_b) {
if (EVEX_b)
// Broadcast implies element size units.
MemObjSize = ElemSize;
else {
unsigned EVEX_LL = ((TSFlags >> X86II::VEXShift) & X86II::VEX_L) ? 1 : 0;
EVEX_LL += ((TSFlags >> X86II::VEXShift) & X86II::EVEX_L2) ? 2 : 0;
assert(EVEX_LL < 3 && "");