[llvm] [RISCV][GISel] Add support for G_FCMP with F and D extensions. (PR #70624)

Michael Maitland via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 30 09:57:28 PDT 2023


================
@@ -366,6 +369,18 @@ bool RISCVInstructionSelector::select(MachineInstr &MI) {
   }
   case TargetOpcode::G_SELECT:
     return selectSelect(MI, MIB, MRI);
+  case TargetOpcode::G_FCMP: {
+    CmpInst::Predicate Pred =
+        static_cast<CmpInst::Predicate>(MI.getOperand(1).getPredicate());
+
+    if (!emitFPCompare(Pred, MI.getOperand(0).getReg(),
+                       MI.getOperand(2).getReg(), MI.getOperand(3).getReg(),
+                       MIB))
+      return false;
+
+    MI.eraseFromParent();
----------------
michaelmaitland wrote:

Should we move the `eraseFromParent` into `emitFPCompare` like the other select functions do?

https://github.com/llvm/llvm-project/pull/70624


More information about the llvm-commits mailing list