15 #ifndef LLVM_LIB_TARGET_X86_UTILS_X86INSTRFMA3INFO_H
16 #define LLVM_LIB_TARGET_X86_UTILS_X86INSTRFMA3INFO_H
33 const uint16_t *RegOpcodes;
38 const uint16_t *MemOpcodes;
44 static const unsigned Form132 = 0;
45 static const unsigned Form213 = 1;
46 static const unsigned Form231 = 2;
72 : RegOpcodes(RegOpcodes), MemOpcodes(MemOpcodes), Attributes(Attr) {
73 assert((RegOpcodes || MemOpcodes) &&
74 "Cannot create a group not having any opcodes.");
81 if (!RegOpcodes || !MemOpcodes)
84 if (RegOpcodes[
Form] == RegOpcode)
85 return MemOpcodes[
Form];
91 assert(RegOpcodes &&
"The group does not have register opcodes.");
92 return RegOpcodes[Form132];
97 assert(RegOpcodes &&
"The group does not have register opcodes.");
98 return RegOpcodes[Form213];
103 assert(RegOpcodes &&
"The group does not have register opcodes.");
104 return RegOpcodes[Form231];
109 assert(MemOpcodes &&
"The group does not have memory opcodes.");
110 return MemOpcodes[Form132];
115 assert(MemOpcodes &&
"The group does not have memory opcodes.");
116 return MemOpcodes[Form213];
121 assert(MemOpcodes &&
"The group does not have memory opcodes.");
122 return MemOpcodes[Form231];
147 if (Opcode == RegOpcodes[
Form])
158 if (Opcode == MemOpcodes[
Form])
175 static void initGroupsOnce();
180 void initGroupsOnceImpl();
185 void initRMGroup(
const uint16_t *RegOpcodes,
186 const uint16_t *MemOpcodes,
unsigned Attr = 0);
191 void initRGroup(
const uint16_t *RegOpcodes,
unsigned Attr = 0);
196 void initMGroup(
const uint16_t *MemOpcodes,
unsigned Attr = 0);
208 std::set<const X86InstrFMA3Group *> DeletedGroups;
209 auto E = OpcodeToGroup.end();
210 for (
auto I = OpcodeToGroup.begin();
I !=
E;
I++) {
212 if (DeletedGroups.find(G) == DeletedGroups.end()) {
213 DeletedGroups.insert(G);
228 auto I = FMA3Info->OpcodeToGroup.find(Opcode);
229 if (
I == FMA3Info->OpcodeToGroup.end())
264 unsigned Opcode = I->first;
280 for (++I; I !=
E; ++I) {
281 unsigned RegOpcode = I->first;
295 auto I = FMA3Info->OpcodeToGroup.begin();
296 auto E = FMA3Info->OpcodeToGroup.end();
298 unsigned Opcode =
I->first;
bool isKMasked() const
Returns true iff the group of FMA opcodes holds any of k-masked opcodes.
static const unsigned X86FMA3KZeroMasked
This bit must be set in the 'Attributes' field of FMA group if such group of FMA opcodes consists of ...
This class provides information about all existing FMA3 opcodes.
static bool isFMA3(unsigned Opcode)
Returns true iff the given Opcode is recognized as FMA3 by this class.
bool operator==(const rm_iterator &OtherIt) const
const X86InstrFMA3Group * getGroup() const
Returns a reference to a group of FMA opcodes.
static const X86InstrFMA3Group * getFMA3Group(unsigned Opcode)
Returns a reference to a group of FMA3 opcodes to where the given Opcode is included.
rm_iterator & operator++()
Increment.
unsigned getReg132Opcode() const
Returns the 132 form of FMA register opcode.
~X86InstrFMA3Info()
Destructor. Deallocates the memory used for FMA3 Groups.
static GCRegistry::Add< CoreCLRGC > E("coreclr","CoreCLR-compatible GC")
unsigned getMem132Opcode() const
Returns the 132 form of FMA memory opcode.
unsigned getReg213Opcode() const
Returns the 213 form of FMA register opcode.
unsigned getMem231Opcode() const
Returns the 231 form of FMA memory opcode.
unsigned getRegOpcode() const
Returns the register form FMA opcode.
unsigned getReg231Opcode() const
Returns the 231 form of FMA register opcode.
This class is used to group {132, 213, 231} forms of FMA opcodes together.
unsigned getMemOpcode(unsigned RegOpcode) const
Returns a memory form opcode that is the equivalent of the given register form opcode RegOpcode...
bool isKMergeMasked() const
Returns true iff the group of FMA opcodes holds k-merge-masked opcodes.
bool isKZeroMasked() const
Returns true iff the group of FMA opcodes holds k-zero-masked opcodes.
bool isIntrinsic() const
Returns true iff the group of FMA opcodes holds intrinsic opcodes.
bool operator!=(const rm_iterator &OtherIt) const
X86InstrFMA3Group(const uint16_t *RegOpcodes, const uint16_t *MemOpcodes, unsigned Attr)
Constructor.
unsigned getMemOpcode() const
Returns the memory form equivalent opcode for FMA register opcode referenced by I->first.
static rm_iterator rm_end()
Returns the last rm_iterator.
bool isRegOpcodeFromGroup(unsigned Opcode) const
Returns true iff the given Opcode is a register opcode from the groups of FMA opcodes.
unsigned getMem213Opcode() const
Returns the 213 form of FMA memory opcode.
static const unsigned X86FMA3Intrinsic
This bit must be set in the 'Attributes' field of FMA group if such group of FMA opcodes consists of ...
bool isMemOpcodeFromGroup(unsigned Opcode) const
Returns true iff the given Opcode is a memory opcode from the groups of FMA opcodes.
static rm_iterator rm_begin()
Returns rm_iterator pointing to the first entry of OpcodeToGroup map with a register FMA opcode havin...
Iterator that is used to walk on FMA register opcodes having memory form equivalents.
static X86InstrFMA3Info * getX86InstrFMA3Info()
Returns the reference to an object of this class.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static const unsigned X86FMA3KMergeMasked
This bit must be set in the 'Attributes' field of FMA group if such group of FMA opcodes consists of ...
rm_iterator(DenseMap< unsigned, const X86InstrFMA3Group * >::const_iterator I)
Constructor.
X86InstrFMA3Info()
Constructor. Just creates an object of the class.