[llvm] [NVPTX] Fix lowering of i1 SETCC (PR #115035)
Justin Fargnoli via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 15 16:41:17 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),
----------------
justinfargnoli wrote:
My question boils down to: will `xor` be legalized if it's generated for a target that doesn't support it? In other words, can `Expand` generate illegal code?
My assumption was no, but based on your answer, I'm gathering that `Expand` can generate illegal code and rely on the legalizer to legalize it. Is that correct?
https://github.com/llvm/llvm-project/pull/115035
More information about the llvm-commits
mailing list