[llvm] [NVPTX] Lower LLVM masked vector loads and stores to PTX (PR #159387)
    Drew Kersnar via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Tue Oct 21 12:15:32 PDT 2025
    
    
  
================
@@ -3246,6 +3397,43 @@ SDValue NVPTXTargetLowering::LowerLOAD(SDValue Op, SelectionDAG &DAG) const {
   llvm_unreachable("Unexpected custom lowering for load");
 }
 
+SDValue NVPTXTargetLowering::LowerMLOAD(SDValue Op, SelectionDAG &DAG) const {
+  // v2f16/v2bf16/v2i16/v4i8 are legal, so we can't rely on legalizer to handle
+  // masked loads of these types and have to handle them here.
+  // v2f32 also needs to be handled here if the subtarget has f32x2
+  // instructions, making it legal.
+  //
+  // Note: misaligned masked loads should never reach this point
+  // because the override of isLegalMaskedLoad in NVPTXTargetTransformInfo.cpp
+  // will validate alignment. Therefore, we do not need to special case handle
+  // them here.
+  EVT VT = Op.getValueType();
+  if (NVPTX::isPackedVectorTy(VT) &&
+      (VT != MVT::v2f32 || STI.hasF32x2Instructions())) {
----------------
dakersnar wrote:
Removed the check.
https://github.com/llvm/llvm-project/pull/159387
    
    
More information about the llvm-commits
mailing list