[clang] [llvm] Add support for flag output operand "=@cc" for SystemZ. (PR #125970)

Ulrich Weigand via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 11 01:46:37 PDT 2025


================
@@ -8702,61 +8738,264 @@ SDValue SystemZTargetLowering::combineSETCC(
   return SDValue();
 }
 
+static SmallSet<int, 4> convertCCMaskToCCValsSet(int Mask) {
+  SmallSet<int, 4> CCVals;
+  size_t Pos = 0;
+  while (Mask) {
+    if (Mask & 0x1)
+      CCVals.insert(3 - Pos);
+    Mask >>= 1;
+    ++Pos;
+  }
+  return CCVals;
+}
+
+static std::pair<SDValue, int> findCCUse(const SDValue &Val) {
+  auto *N = Val.getNode();
+  if (!N)
+    return {Val, SystemZ::CCMASK_NONE};
+  if (isa<ConstantSDNode>(Val))
+    return std::make_pair(SDValue(), SystemZ::CCMASK_NONE);
+  else if (N->getOpcode() == ISD::CopyFromReg && N->getNumOperands() > 1) {
+    if (auto *RN = cast<RegisterSDNode>(N->getOperand(1))) {
+      if (RN->getReg() == SystemZ::CC)
+        return {Val, SystemZ::CCMASK_ANY};
+    }
----------------
uweigand wrote:

I don't think we need this directly, we should never get here.   Recursion should terminate with IPM or SELECT_CCMASK.

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


More information about the cfe-commits mailing list