[llvm] r212795 - [X86] AVX512: Improve readability of isCDisp8
Adam Nemet
anemet at apple.com
Thu Jul 10 22:23:26 PDT 2014
Author: anemet
Date: Fri Jul 11 00:23:25 2014
New Revision: 212795
URL: http://llvm.org/viewvc/llvm-project?rev=212795&view=rev
Log:
[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.
Modified:
llvm/trunk/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp
Modified: llvm/trunk/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp?rev=212795&r1=212794&r2=212795&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp (original)
+++ llvm/trunk/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp Fri Jul 11 00:23:25 2014
@@ -197,14 +197,23 @@ static bool isCDisp8(uint64_t TSFlags, i
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 && "");
More information about the llvm-commits
mailing list