[llvm] [GISel] Add KnownFPClass Analysis to GISelValueTrackingPass (PR #134611)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 7 07:23:57 PDT 2025
================
@@ -762,6 +764,32 @@ struct CompareOp_match {
}
};
+template <typename LHS_P, typename Test_P, unsigned Opcode>
+struct ClassifyOp_match {
+ LHS_P L;
+ Test_P T;
+
+ ClassifyOp_match(const LHS_P &LHS, const Test_P &Tst) : L(LHS), T(Tst) {}
+
+ template <typename OpTy>
+ bool match(const MachineRegisterInfo &MRI, OpTy &&Op) {
+ MachineInstr *TmpMI;
+ if (!mi_match(Op, MRI, m_MInstr(TmpMI)) || TmpMI->getOpcode() != Opcode)
+ return false;
+
+ Register LHS = TmpMI->getOperand(1).getReg();
+ if (!L.match(MRI, LHS))
+ return false;
+
+ FPClassTest TmpClass =
+ static_cast<FPClassTest>(TmpMI->getOperand(2).getImm());
+ if (T.match(MRI, TmpClass))
+ return true;
+
+ return false;
----------------
arsenm wrote:
```suggestion
return T.match(MRI, TmpClass);
```
https://github.com/llvm/llvm-project/pull/134611
More information about the llvm-commits
mailing list