[llvm] [Xtensa] Implement lowering SELECT_CC, SETCC. (PR #97017)

Andrei Safronov via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 9 06:11:12 PDT 2024


================
@@ -697,6 +718,126 @@ const char *XtensaTargetLowering::getTargetNodeName(unsigned Opcode) const {
     return "XtensaISD::PCREL_WRAPPER";
   case XtensaISD::RET:
     return "XtensaISD::RET";
+  case XtensaISD::SELECT_CC:
+    return "XtensaISD::SELECT_CC";
   }
   return nullptr;
 }
+
+//===----------------------------------------------------------------------===//
+// Custom insertion
+//===----------------------------------------------------------------------===//
+
+static int GetBranchKind(int Cond, bool &BrInv) {
+  switch (Cond) {
+  case ISD::SETEQ:
+    return Xtensa::BEQ;
+  case ISD::SETNE:
+    return Xtensa::BNE;
+  case ISD::SETLT:
+    return Xtensa::BLT;
+  case ISD::SETLE:
+    BrInv = true;
+    return Xtensa::BGE;
+  case ISD::SETGT:
+    BrInv = true;
+    return Xtensa::BLT;
+  case ISD::SETGE:
+    return Xtensa::BGE;
+  case ISD::SETULT:
+    return Xtensa::BLTU;
+  case ISD::SETULE:
+    BrInv = true;
----------------
andreisfr wrote:

I'm sorry, you mean to add setCondCodeAction() for codes which are not supported for i32 type natively by Xtensa? Currently all basic integer condition codes are supported, only codes like SETOLE which are used with FP types are not handled. Maybe I missed something.

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


More information about the llvm-commits mailing list