================
@@ -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};
+    }
+  } else if (N->getOpcode() == SystemZISD::IPM)
+    return std::make_pair(N->getOperand(0), SystemZ::CCMASK_ANY);
+  else if (N->getOpcode() == ISD::SRL)
+    return findCCUse(N->getOperand(0));
+  else if (N->getOpcode() == SystemZISD::ICMP)
+    return findCCUse(N->getOperand(0));
+  else if (N->getOpcode() == SystemZISD::TM)
+    return findCCUse(N->getOperand(0));
----------------
uweigand wrote:

ICMP and TM shouldn't be here, they don't have a GPR output.  If necessary, 
they can be handled within the SELECT_CCMASK case as direct operands only.

https://github.com/llvm/llvm-project/pull/125970
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to