[llvm] [NVPTX] Fix lowering of i1 SETCC (PR #115035)

Alex MacLean via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 15 15:23:24 PST 2024


================
@@ -11874,6 +11874,47 @@ bool TargetLowering::LegalizeSetCCCondCode(SelectionDAG &DAG, EVT VT,
       return true;
     }
 
+    // Special case: expand i1 comparisons using logical operations.
+    if (OpVT == MVT::i1) {
+      SDValue Ret;
+      switch (CCCode) {
+      default:
+        llvm_unreachable("Unknown integer setcc!");
+      case ISD::SETEQ: // X == Y  -->  ~(X ^ Y)
+        Ret = DAG.getNOT(dl, DAG.getNode(ISD::XOR, dl, MVT::i1, LHS, RHS),
----------------
AlexMaclean wrote:

I'd prefer not to. NVPTX is the only target using these expansions and we don't have any way to expand if not. I don't see what the point of adding them would be.

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


More information about the llvm-commits mailing list