[llvm] [AMDGPU] Break v2i32 and/or/xor ops into i32 pairs when followed by t… (PR #191422)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 10 08:57:18 PDT 2026
================
@@ -13956,6 +13956,58 @@ static uint32_t getPermuteMask(SDValue V) {
return ~0;
}
+static SDValue performAndOrXorv2i32Combine(SDNode *N, SelectionDAG &DAG) {
+ EVT VT = N->getValueType(0);
+ const unsigned Opc = N->getOpcode();
+ assert(VT == MVT::v2i32);
+ if (!N->isDivergent())
+ return SDValue();
+
+ SDValue LHS = N->getOperand(0);
+ SDValue RHS = N->getOperand(1);
+
+ // Reject v2i32 ops that would be handled by v2i32-v2i32 patterns
+ auto matchV2I32Patterns = [](const unsigned Opc,
+ const unsigned userOpc) -> bool {
+ return (Opc == ISD::AND || Opc == ISD::OR) && userOpc == ISD::OR;
+ };
+ if (matchV2I32Patterns(LHS.getOpcode(), Opc) ||
+ matchV2I32Patterns(RHS.getOpcode(), Opc))
+ return SDValue();
+
+ for (SDUse &use : N->uses()) {
+ SDNode *user = use.getUser();
+ if (user->getValueType(0) == MVT::v2i32 &&
+ matchV2I32Patterns(Opc, user->getOpcode()))
+ return SDValue();
+ }
+
+ // If the v2i32 op has a following i32 operation, break v2i32 into two i32 ops
----------------
arsenm wrote:
I think it makes more sense to make the bitop3 matching handle the vector case
https://github.com/llvm/llvm-project/pull/191422
More information about the llvm-commits
mailing list