[llvm] [X86] Shrink width of masked loads/stores (PR #105451)

Phoebe Wang via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 20 18:21:53 PDT 2024


================
@@ -51536,20 +51536,111 @@ combineMaskedLoadConstantMask(MaskedLoadSDNode *ML, SelectionDAG &DAG,
   return DCI.CombineTo(ML, Blend, NewML.getValue(1), true);
 }
 
+static bool tryShrinkMaskedOperation(SelectionDAG &DAG, const SDLoc &DL,
+                                     SDValue Mask, EVT OrigVT,
+                                     SDValue *ValInOut, EVT *NewVTOut,
+                                     SDValue *NewMaskOut) {
+  // Ensure we have a reasonable input type.
+  // Also ensure ensure input bits is larger then xmm, otherwise its not
+  // profitable to try to shrink.
+  if (!OrigVT.isSimple() || !OrigVT.isVector() ||
+      OrigVT.getSizeInBits() <= 128 || !isPowerOf2_64(OrigVT.getSizeInBits()) ||
+      !isPowerOf2_64(OrigVT.getScalarSizeInBits()))
----------------
phoebewang wrote:

Can we just check if it's legal type and size is 256 or 512?

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


More information about the llvm-commits mailing list