This is an archive of the discontinued LLVM Phabricator instance.

[X86] Prefer VEX encoding in X86 assembler.
AbandonedPublic

Authored by LuoYuanke on Oct 10 2021, 12:26 AM.

Diff Detail

Event Timeline

LuoYuanke created this revision.Oct 10 2021, 12:26 AM
LuoYuanke requested review of this revision.Oct 10 2021, 12:26 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 10 2021, 12:26 AM

Did you consider other patches like this which will sort everything X86InstrAVX512.td after X86InstrSSE.td? The current sorting is done by the instruction name I think so VCVTSD2SIZrm_Int sorts before VCVTSD2SIrm_Int.

diff --git a/llvm/utils/TableGen/AsmMatcherEmitter.cpp b/llvm/utils/TableGen/AsmMatcherEmitter.cpp
index 00bdd127e3c2..aaf90aa13272 100644
--- a/llvm/utils/TableGen/AsmMatcherEmitter.cpp
+++ b/llvm/utils/TableGen/AsmMatcherEmitter.cpp
@@ -636,7 +636,7 @@ struct MatchableInfo {
     if (RequiredFeatures.size() != RHS.RequiredFeatures.size())
       return RequiredFeatures.size() > RHS.RequiredFeatures.size();
 
-    return false;
+    return TheDef->getID() < RHS.TheDef->getID();
   }
 
   /// couldMatchAmbiguouslyWith - Check whether this matchable could

Did you consider other patches like this which will sort everything X86InstrAVX512.td after X86InstrSSE.td? The current sorting is done by the instruction name I think so VCVTSD2SIZrm_Int sorts before VCVTSD2SIrm_Int.

diff --git a/llvm/utils/TableGen/AsmMatcherEmitter.cpp b/llvm/utils/TableGen/AsmMatcherEmitter.cpp
index 00bdd127e3c2..aaf90aa13272 100644
--- a/llvm/utils/TableGen/AsmMatcherEmitter.cpp
+++ b/llvm/utils/TableGen/AsmMatcherEmitter.cpp
@@ -636,7 +636,7 @@ struct MatchableInfo {
     if (RequiredFeatures.size() != RHS.RequiredFeatures.size())
       return RequiredFeatures.size() > RHS.RequiredFeatures.size();
 
-    return false;
+    return TheDef->getID() < RHS.TheDef->getID();
   }
 
   /// couldMatchAmbiguouslyWith - Check whether this matchable could

Great. I once seek to reorder the matching table, but I didn't realize "TheDef->getID()" can achieve it.

Thanks, Craig. I created another patch at https://reviews.llvm.org/D111538.

Change back the order of checkAsmTiedOperandConstraints() and checkTargetMatchPredicate().

skan added a comment.Oct 12 2021, 1:30 AM

The Match_NotPerfect mechanism slows down the match process. I think D111576 is better.

LuoYuanke added a comment.EditedOct 12 2021, 6:59 AM

The Match_NotPerfect mechanism slows down the match process. I think D111576 is better.

I think https://reviews.llvm.org/D111538 is the best.

LuoYuanke abandoned this revision.Mar 16 2022, 1:28 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 16 2022, 1:28 AM