[llvm] [SystemZ] Simplify f128 atomic load/store (PR #90977)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Fri May 3 10:34:20 PDT 2024


================
@@ -6829,47 +6803,79 @@ SDValue SystemZTargetLowering::combineMERGE(
   return SDValue();
 }
 
+static bool isI128MovedToParts(LoadSDNode *LD, SmallVector<std::pair<SDNode *, int>, 2> &Users) {
+  // Scan through all users.
+  for (SDNode::use_iterator UI = LD->use_begin(), UIEnd = LD->use_end();
+       UI != UIEnd; ++UI) {
+    // Skip the uses of the chain.
+    if (UI.getUse().getResNo() != 0)
+      continue;
+
+    // Verify every user is a TRUNCATE to i64 of the low or high half.
+    SDNode *User = *UI;
+    int Index = 1;
+    if (User->getOpcode() == ISD::SRL &&
+        User->getOperand(1).getOpcode() == ISD::Constant &&
+        User->getConstantOperandVal(1) == 64 && User->hasOneUse()) {
+      User = *User->use_begin();
+      Index = 0;
+    }
+    if (User->getOpcode() != ISD::TRUNCATE ||
+        User->getValueType(0) != MVT::i64)
+      return false;
+
+    Users.push_back(std::make_pair(User, Index));
+  }
+  return true;
+}
+
+static bool isF128MovedToParts(LoadSDNode *LD, SmallVector<std::pair<SDNode *, int>, 2> &Users) {
----------------
arsenm wrote:

clang-format will probably complain about the length 

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


More information about the llvm-commits mailing list