[llvm] [NVPTX] Lower LLVM masked vector loads and stores to PTX (PR #159387)
Princeton Ferro via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 20 23:33:00 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())) {
----------------
Prince781 wrote:
Actually the check may be unnecessary as this function shouldn't be called when v2i32/v2f32 aren't legal.
https://github.com/llvm/llvm-project/pull/159387
More information about the llvm-commits
mailing list