[llvm] r370600 - [X86] Compress the flag bits in the folding tables to make room for more bits in an upcoming patch.
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Sat Aug 31 16:52:21 PDT 2019
Author: ctopper
Date: Sat Aug 31 16:52:21 2019
New Revision: 370600
URL: http://llvm.org/viewvc/llvm-project?rev=370600&view=rev
Log:
[X86] Compress the flag bits in the folding tables to make room for more bits in an upcoming patch.
Modified:
llvm/trunk/lib/Target/X86/X86InstrFoldTables.h
llvm/trunk/lib/Target/X86/X86InstrInfo.cpp
Modified: llvm/trunk/lib/Target/X86/X86InstrFoldTables.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrFoldTables.h?rev=370600&r1=370599&r2=370600&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86InstrFoldTables.h (original)
+++ llvm/trunk/lib/Target/X86/X86InstrFoldTables.h Sat Aug 31 16:52:21 2019
@@ -19,35 +19,39 @@ namespace llvm {
enum {
// Select which memory operand is being unfolded.
- // (stored in bits 0 - 3)
+ // (stored in bits 0 - 2)
TB_INDEX_0 = 0,
TB_INDEX_1 = 1,
TB_INDEX_2 = 2,
TB_INDEX_3 = 3,
TB_INDEX_4 = 4,
- TB_INDEX_MASK = 0xf,
+ TB_INDEX_MASK = 0x7,
// Do not insert the reverse map (MemOp -> RegOp) into the table.
// This may be needed because there is a many -> one mapping.
- TB_NO_REVERSE = 1 << 4,
+ TB_NO_REVERSE = 1 << 3,
// Do not insert the forward map (RegOp -> MemOp) into the table.
// This is needed for Native Client, which prohibits branch
// instructions from using a memory operand.
- TB_NO_FORWARD = 1 << 5,
+ TB_NO_FORWARD = 1 << 4,
- TB_FOLDED_LOAD = 1 << 6,
- TB_FOLDED_STORE = 1 << 7,
+ TB_FOLDED_LOAD = 1 << 5,
+ TB_FOLDED_STORE = 1 << 6,
+ // Unused bit 7
// Minimum alignment required for load/store.
- // Used for RegOp->MemOp conversion.
- // (stored in bits 8 - 15)
+ // Used for RegOp->MemOp conversion. Encoded as Log2(Align) + 1 to allow 0
+ // to mean align of 0.
+ // (stored in bits 8 - 11)
TB_ALIGN_SHIFT = 8,
- TB_ALIGN_NONE = 0 << TB_ALIGN_SHIFT,
- TB_ALIGN_16 = 16 << TB_ALIGN_SHIFT,
- TB_ALIGN_32 = 32 << TB_ALIGN_SHIFT,
- TB_ALIGN_64 = 64 << TB_ALIGN_SHIFT,
- TB_ALIGN_MASK = 0xff << TB_ALIGN_SHIFT
+ TB_ALIGN_NONE = 0 << TB_ALIGN_SHIFT,
+ TB_ALIGN_16 = 5 << TB_ALIGN_SHIFT,
+ TB_ALIGN_32 = 6 << TB_ALIGN_SHIFT,
+ TB_ALIGN_64 = 7 << TB_ALIGN_SHIFT,
+ TB_ALIGN_MASK = 0xf << TB_ALIGN_SHIFT,
+
+ // Unused bits 12-15
};
// This struct is used for both the folding and unfold tables. They KeyOp
Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.cpp?rev=370600&r1=370599&r2=370600&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86InstrInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86InstrInfo.cpp Sat Aug 31 16:52:21 2019
@@ -4805,6 +4805,7 @@ MachineInstr *X86InstrInfo::foldMemoryOp
if (I != nullptr) {
unsigned Opcode = I->DstOp;
unsigned MinAlign = (I->Flags & TB_ALIGN_MASK) >> TB_ALIGN_SHIFT;
+ MinAlign = MinAlign ? 1 << (MinAlign - 1) : 0;
if (Align < MinAlign)
return nullptr;
bool NarrowToMOV32rm = false;
More information about the llvm-commits
mailing list