[llvm] [X86][tablgen] Auto-gen broadcast tables (PR #73654)
Shengchen Kan via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 30 06:23:44 PST 2023
================
@@ -606,11 +725,30 @@ void X86FoldTablesEmitter::run(raw_ostream &O) {
// opcode.
std::vector<const CodeGenInstruction *> &OpcRegInsts = RegInstsIt->second;
- auto Match = find_if(OpcRegInsts, IsMatch(MemInst, Variant));
+ // Memory fold tables
+ auto Match =
+ find_if(OpcRegInsts, IsMatch(MemInst, /*IsBroadcast=*/false, Variant));
if (Match != OpcRegInsts.end()) {
updateTables(FixUp(*Match), MemInst);
OpcRegInsts.erase(Match);
}
+
+ // Broadcast tables
+ StringRef MemInstName = MemInst->TheDef->getName();
+ if (!MemInstName.contains("mb") && !MemInstName.contains("mib"))
+ continue;
+ RegInstsIt = RegInstsForBroadcast.find(Opc);
+ assert(RegInstsIt != RegInstsForBroadcast.end() &&
+ "Unexpected control flow");
+ std::vector<const CodeGenInstruction *> &OpcRegInstsForBroadcast =
+ RegInstsIt->second;
+ Match = find_if(OpcRegInstsForBroadcast,
+ IsMatch(MemInst, /*IsBroadcast=*/true, Variant));
+ if (Match != OpcRegInstsForBroadcast.end()) {
+ updateTables(FixUp(*Match), MemInst, 0, /*IsMannual=*/false,
----------------
KanRobert wrote:
Done
https://github.com/llvm/llvm-project/pull/73654
More information about the llvm-commits
mailing list