[llvm] 1f5b5a2 - [RISCV][TTI] Model broadcast loads as zero-stride loads (#198446)

via llvm-commits llvm-commits at lists.llvm.org
Fri May 22 03:51:54 PDT 2026


Author: Pengcheng Wang
Date: 2026-05-22T10:51:48Z
New Revision: 1f5b5a2aca31f84acf93c811f0d93eb46fe33e73

URL: https://github.com/llvm/llvm-project/commit/1f5b5a2aca31f84acf93c811f0d93eb46fe33e73
DIFF: https://github.com/llvm/llvm-project/commit/1f5b5a2aca31f84acf93c811f0d93eb46fe33e73.diff

LOG: [RISCV][TTI] Model broadcast loads as zero-stride loads (#198446)

We have done this optimization in ISel and this PR just models it
in TTI.

---------

Co-authored-by: Luke Lau <luke_lau at icloud.com>

Added: 
    llvm/test/Analysis/CostModel/RISCV/shuffle-load.ll

Modified: 
    llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
    llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
index 5b4a975cb95a4..49ee337d57116 100644
--- a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
+++ b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
@@ -873,6 +873,13 @@ RISCVTTIImpl::getShuffleCost(TTI::ShuffleKind Kind, VectorType *DstTy,
                                         LT.second, CostKind));
   }
   case TTI::SK_Broadcast: {
+    // Check for broadcast loads, which are synthesized by optimized zero-stride
+    // loads (this is checked in RISCVTTIImpl::isLegalBroadcastLoad).
+    bool IsLoad = !Args.empty() && isa<LoadInst>(Args[0]);
+    if (IsLoad && isLegalBroadcastLoad(SrcTy->getElementType(),
+                                       LT.second.getVectorElementCount()))
+      return 0;
+
     bool HasScalar = (Args.size() > 0) && (Operator::getOpcode(Args[0]) ==
                                            Instruction::InsertElement);
     if (LT.second.getScalarSizeInBits() == 1) {
@@ -3409,6 +3416,15 @@ bool RISCVTTIImpl::isLegalMaskedCompressStore(Type *DataTy,
   return true;
 }
 
+bool RISCVTTIImpl::isLegalBroadcastLoad(Type *ElementTy,
+                                        ElementCount NumElements) const {
+  // Optimized zero-stride loads can be treated as broadcasts.
+  if (!ST->hasVInstructions() || !ST->hasOptimizedZeroStrideLoad())
+    return false;
+
+  return TLI->isLegalElementTypeForRVV(TLI->getValueType(DL, ElementTy));
+}
+
 /// See if \p I should be considered for address type promotion. We check if \p
 /// I is a sext with right type and used in memory accesses. If it used in a
 /// "complex" getelementptr, we allow it to be promoted without finding other

diff  --git a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h
index 477c419228a6b..2b43b93daa6c7 100644
--- a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h
+++ b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h
@@ -364,6 +364,9 @@ class RISCVTTIImpl final : public BasicTTIImplBase<RISCVTTIImpl> {
 
   bool isLegalMaskedCompressStore(Type *DataTy, Align Alignment) const override;
 
+  bool isLegalBroadcastLoad(Type *ElementTy,
+                            ElementCount NumElements) const override;
+
   /// \returns How the target needs this vector-predicated operation to be
   /// transformed.
   TargetTransformInfo::VPLegalization

diff  --git a/llvm/test/Analysis/CostModel/RISCV/shuffle-load.ll b/llvm/test/Analysis/CostModel/RISCV/shuffle-load.ll
new file mode 100644
index 0000000000000..f21c5d414060d
--- /dev/null
+++ b/llvm/test/Analysis/CostModel/RISCV/shuffle-load.ll
@@ -0,0 +1,163 @@
+; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
+; RUN: opt < %s -mtriple=riscv64-linux-gnu -mattr=+v,+zvfhmin,+zvfbfmin \
+; RUN:   -passes="print<cost-model>" -cost-kind=all 2>&1 -disable-output \
+; RUN:   | FileCheck %s --check-prefix=NO-OPTIMIZED-ZERO-STRIDE-LOAD
+; RUN: opt < %s -mtriple=riscv64-linux-gnu -mattr=+v,+zvfhmin,+zvfbfmin,+optimized-zero-stride-load \
+; RUN:   -passes="print<cost-model>" -cost-kind=all 2>&1 -disable-output \
+; RUN:   | FileCheck %s --check-prefix=HAS-OPTIMIZED-ZERO-STRIDE-LOAD
+
+; These tests check the costs of broadcast instructions, through the
+; isLegalBroadcastLoad method.
+
+target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
+
+; The tests use vector loads and splats, as opposed to scalar loads, inserts
+; and splats as that is how getShuffleCost currently recognizes them.
+define void @shuffle() {
+; NO-OPTIMIZED-ZERO-STRIDE-LOAD-LABEL: 'shuffle'
+; NO-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:1 Lat:4 SizeLat:1 for: %lv2i8 = load <2 x i8>, ptr poison, align 2
+; NO-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of 1 for: %sv2i8 = shufflevector <2 x i8> %lv2i8, <2 x i8> poison, <2 x i32> zeroinitializer
+; NO-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:1 Lat:4 SizeLat:1 for: %lv4i8 = load <4 x i8>, ptr poison, align 4
+; NO-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of 1 for: %sv4i8 = shufflevector <4 x i8> %lv4i8, <4 x i8> poison, <4 x i32> zeroinitializer
+; NO-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:1 Lat:4 SizeLat:1 for: %lv8i8 = load <8 x i8>, ptr poison, align 8
+; NO-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of 1 for: %sv8i8 = shufflevector <8 x i8> %lv8i8, <8 x i8> poison, <8 x i32> zeroinitializer
+; NO-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:1 Lat:4 SizeLat:1 for: %lv16i8 = load <16 x i8>, ptr poison, align 16
+; NO-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of 1 for: %sv16i8 = shufflevector <16 x i8> %lv16i8, <16 x i8> poison, <16 x i32> zeroinitializer
+; NO-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:1 Lat:4 SizeLat:1 for: %lv2i16 = load <2 x i16>, ptr poison, align 4
+; NO-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of 1 for: %sv2i16 = shufflevector <2 x i16> %lv2i16, <2 x i16> poison, <2 x i32> zeroinitializer
+; NO-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:1 Lat:4 SizeLat:1 for: %lv4i16 = load <4 x i16>, ptr poison, align 8
+; NO-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of 1 for: %sv4i16 = shufflevector <4 x i16> %lv4i16, <4 x i16> poison, <4 x i32> zeroinitializer
+; NO-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:1 Lat:4 SizeLat:1 for: %lv8i16 = load <8 x i16>, ptr poison, align 16
+; NO-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of 1 for: %sv8i16 = shufflevector <8 x i16> %lv8i16, <8 x i16> poison, <8 x i32> zeroinitializer
+; NO-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:4 SizeLat:2 for: %lv16i16 = load <16 x i16>, ptr poison, align 32
+; NO-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:2 for: %sv16i16 = shufflevector <16 x i16> %lv16i16, <16 x i16> poison, <16 x i32> zeroinitializer
+; NO-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:1 Lat:4 SizeLat:1 for: %lv2i32 = load <2 x i32>, ptr poison, align 8
+; NO-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of 1 for: %sv2i32 = shufflevector <2 x i32> %lv2i32, <2 x i32> poison, <2 x i32> zeroinitializer
+; NO-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:1 Lat:4 SizeLat:1 for: %lv4i32 = load <4 x i32>, ptr poison, align 16
+; NO-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of 1 for: %sv4i32 = shufflevector <4 x i32> %lv4i32, <4 x i32> poison, <4 x i32> zeroinitializer
+; NO-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:4 SizeLat:2 for: %lv8i32 = load <8 x i32>, ptr poison, align 32
+; NO-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:2 for: %sv8i32 = shufflevector <8 x i32> %lv8i32, <8 x i32> poison, <8 x i32> zeroinitializer
+; NO-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:1 Lat:4 SizeLat:1 for: %lv2i64 = load <2 x i64>, ptr poison, align 16
+; NO-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of 1 for: %sv2i64 = shufflevector <2 x i64> %lv2i64, <2 x i64> poison, <2 x i32> zeroinitializer
+; NO-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:4 SizeLat:2 for: %lv4i64 = load <4 x i64>, ptr poison, align 32
+; NO-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:2 for: %sv4i64 = shufflevector <4 x i64> %lv4i64, <4 x i64> poison, <4 x i32> zeroinitializer
+; NO-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:1 Lat:4 SizeLat:1 for: %lv2f16 = load <2 x half>, ptr poison, align 4
+; NO-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of 1 for: %sv2f16 = shufflevector <2 x half> %lv2f16, <2 x half> poison, <2 x i32> zeroinitializer
+; NO-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:1 Lat:4 SizeLat:1 for: %lv4f16 = load <4 x half>, ptr poison, align 8
+; NO-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of 1 for: %sv4f16 = shufflevector <4 x half> %lv4f16, <4 x half> poison, <4 x i32> zeroinitializer
+; NO-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:1 Lat:4 SizeLat:1 for: %lv8f16 = load <8 x half>, ptr poison, align 16
+; NO-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of 1 for: %sv8f16 = shufflevector <8 x half> %lv8f16, <8 x half> poison, <8 x i32> zeroinitializer
+; NO-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:4 SizeLat:2 for: %lv16f16 = load <16 x half>, ptr poison, align 32
+; NO-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:2 for: %sv16f16 = shufflevector <16 x half> %lv16f16, <16 x half> poison, <16 x i32> zeroinitializer
+; NO-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:1 Lat:4 SizeLat:1 for: %lv2f32 = load <2 x float>, ptr poison, align 8
+; NO-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of 1 for: %sv2f32 = shufflevector <2 x float> %lv2f32, <2 x float> poison, <2 x i32> zeroinitializer
+; NO-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:1 Lat:4 SizeLat:1 for: %lv4f32 = load <4 x float>, ptr poison, align 16
+; NO-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of 1 for: %sv4f32 = shufflevector <4 x float> %lv4f32, <4 x float> poison, <4 x i32> zeroinitializer
+; NO-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:4 SizeLat:2 for: %lv8f32 = load <8 x float>, ptr poison, align 32
+; NO-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:2 for: %sv8f32 = shufflevector <8 x float> %lv8f32, <8 x float> poison, <8 x i32> zeroinitializer
+; NO-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:1 Lat:4 SizeLat:1 for: %lv2f64 = load <2 x double>, ptr poison, align 16
+; NO-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of 1 for: %sv2f64 = shufflevector <2 x double> %lv2f64, <2 x double> poison, <2 x i32> zeroinitializer
+; NO-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:4 SizeLat:2 for: %lv4f64 = load <4 x double>, ptr poison, align 32
+; NO-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:2 for: %sv4f64 = shufflevector <4 x double> %lv4f64, <4 x double> poison, <4 x i32> zeroinitializer
+; NO-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void
+;
+; HAS-OPTIMIZED-ZERO-STRIDE-LOAD-LABEL: 'shuffle'
+; HAS-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:1 Lat:4 SizeLat:1 for: %lv2i8 = load <2 x i8>, ptr poison, align 2
+; HAS-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of 0 for: %sv2i8 = shufflevector <2 x i8> %lv2i8, <2 x i8> poison, <2 x i32> zeroinitializer
+; HAS-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:1 Lat:4 SizeLat:1 for: %lv4i8 = load <4 x i8>, ptr poison, align 4
+; HAS-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of 0 for: %sv4i8 = shufflevector <4 x i8> %lv4i8, <4 x i8> poison, <4 x i32> zeroinitializer
+; HAS-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:1 Lat:4 SizeLat:1 for: %lv8i8 = load <8 x i8>, ptr poison, align 8
+; HAS-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of 0 for: %sv8i8 = shufflevector <8 x i8> %lv8i8, <8 x i8> poison, <8 x i32> zeroinitializer
+; HAS-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:1 Lat:4 SizeLat:1 for: %lv16i8 = load <16 x i8>, ptr poison, align 16
+; HAS-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of 0 for: %sv16i8 = shufflevector <16 x i8> %lv16i8, <16 x i8> poison, <16 x i32> zeroinitializer
+; HAS-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:1 Lat:4 SizeLat:1 for: %lv2i16 = load <2 x i16>, ptr poison, align 4
+; HAS-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of 0 for: %sv2i16 = shufflevector <2 x i16> %lv2i16, <2 x i16> poison, <2 x i32> zeroinitializer
+; HAS-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:1 Lat:4 SizeLat:1 for: %lv4i16 = load <4 x i16>, ptr poison, align 8
+; HAS-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of 0 for: %sv4i16 = shufflevector <4 x i16> %lv4i16, <4 x i16> poison, <4 x i32> zeroinitializer
+; HAS-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:1 Lat:4 SizeLat:1 for: %lv8i16 = load <8 x i16>, ptr poison, align 16
+; HAS-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of 0 for: %sv8i16 = shufflevector <8 x i16> %lv8i16, <8 x i16> poison, <8 x i32> zeroinitializer
+; HAS-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:4 SizeLat:2 for: %lv16i16 = load <16 x i16>, ptr poison, align 32
+; HAS-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of 0 for: %sv16i16 = shufflevector <16 x i16> %lv16i16, <16 x i16> poison, <16 x i32> zeroinitializer
+; HAS-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:1 Lat:4 SizeLat:1 for: %lv2i32 = load <2 x i32>, ptr poison, align 8
+; HAS-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of 0 for: %sv2i32 = shufflevector <2 x i32> %lv2i32, <2 x i32> poison, <2 x i32> zeroinitializer
+; HAS-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:1 Lat:4 SizeLat:1 for: %lv4i32 = load <4 x i32>, ptr poison, align 16
+; HAS-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of 0 for: %sv4i32 = shufflevector <4 x i32> %lv4i32, <4 x i32> poison, <4 x i32> zeroinitializer
+; HAS-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:4 SizeLat:2 for: %lv8i32 = load <8 x i32>, ptr poison, align 32
+; HAS-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of 0 for: %sv8i32 = shufflevector <8 x i32> %lv8i32, <8 x i32> poison, <8 x i32> zeroinitializer
+; HAS-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:1 Lat:4 SizeLat:1 for: %lv2i64 = load <2 x i64>, ptr poison, align 16
+; HAS-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of 0 for: %sv2i64 = shufflevector <2 x i64> %lv2i64, <2 x i64> poison, <2 x i32> zeroinitializer
+; HAS-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:4 SizeLat:2 for: %lv4i64 = load <4 x i64>, ptr poison, align 32
+; HAS-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of 0 for: %sv4i64 = shufflevector <4 x i64> %lv4i64, <4 x i64> poison, <4 x i32> zeroinitializer
+; HAS-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:1 Lat:4 SizeLat:1 for: %lv2f16 = load <2 x half>, ptr poison, align 4
+; HAS-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of 0 for: %sv2f16 = shufflevector <2 x half> %lv2f16, <2 x half> poison, <2 x i32> zeroinitializer
+; HAS-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:1 Lat:4 SizeLat:1 for: %lv4f16 = load <4 x half>, ptr poison, align 8
+; HAS-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of 0 for: %sv4f16 = shufflevector <4 x half> %lv4f16, <4 x half> poison, <4 x i32> zeroinitializer
+; HAS-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:1 Lat:4 SizeLat:1 for: %lv8f16 = load <8 x half>, ptr poison, align 16
+; HAS-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of 0 for: %sv8f16 = shufflevector <8 x half> %lv8f16, <8 x half> poison, <8 x i32> zeroinitializer
+; HAS-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:4 SizeLat:2 for: %lv16f16 = load <16 x half>, ptr poison, align 32
+; HAS-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of 0 for: %sv16f16 = shufflevector <16 x half> %lv16f16, <16 x half> poison, <16 x i32> zeroinitializer
+; HAS-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:1 Lat:4 SizeLat:1 for: %lv2f32 = load <2 x float>, ptr poison, align 8
+; HAS-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of 0 for: %sv2f32 = shufflevector <2 x float> %lv2f32, <2 x float> poison, <2 x i32> zeroinitializer
+; HAS-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:1 Lat:4 SizeLat:1 for: %lv4f32 = load <4 x float>, ptr poison, align 16
+; HAS-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of 0 for: %sv4f32 = shufflevector <4 x float> %lv4f32, <4 x float> poison, <4 x i32> zeroinitializer
+; HAS-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:4 SizeLat:2 for: %lv8f32 = load <8 x float>, ptr poison, align 32
+; HAS-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of 0 for: %sv8f32 = shufflevector <8 x float> %lv8f32, <8 x float> poison, <8 x i32> zeroinitializer
+; HAS-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:1 Lat:4 SizeLat:1 for: %lv2f64 = load <2 x double>, ptr poison, align 16
+; HAS-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of 0 for: %sv2f64 = shufflevector <2 x double> %lv2f64, <2 x double> poison, <2 x i32> zeroinitializer
+; HAS-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:4 SizeLat:2 for: %lv4f64 = load <4 x double>, ptr poison, align 32
+; HAS-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of 0 for: %sv4f64 = shufflevector <4 x double> %lv4f64, <4 x double> poison, <4 x i32> zeroinitializer
+; HAS-OPTIMIZED-ZERO-STRIDE-LOAD-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void
+;
+  %lv2i8 = load <2 x i8>, ptr poison
+  %sv2i8 = shufflevector <2 x i8> %lv2i8, <2 x i8> poison, <2 x i32> zeroinitializer
+  %lv4i8 = load <4 x i8>, ptr poison
+  %sv4i8 = shufflevector <4 x i8> %lv4i8, <4 x i8> poison, <4 x i32> zeroinitializer
+  %lv8i8 = load <8 x i8>, ptr poison
+  %sv8i8 = shufflevector <8 x i8> %lv8i8, <8 x i8> poison, <8 x i32> zeroinitializer
+  %lv16i8 = load <16 x i8>, ptr poison
+  %sv16i8 = shufflevector <16 x i8> %lv16i8, <16 x i8> poison, <16 x i32> zeroinitializer
+
+  %lv2i16 = load <2 x i16>, ptr poison
+  %sv2i16 = shufflevector <2 x i16> %lv2i16, <2 x i16> poison, <2 x i32> zeroinitializer
+  %lv4i16 = load <4 x i16>, ptr poison
+  %sv4i16 = shufflevector <4 x i16> %lv4i16, <4 x i16> poison, <4 x i32> zeroinitializer
+  %lv8i16 = load <8 x i16>, ptr poison
+  %sv8i16 = shufflevector <8 x i16> %lv8i16, <8 x i16> poison, <8 x i32> zeroinitializer
+  %lv16i16 = load <16 x i16>, ptr poison
+  %sv16i16 = shufflevector <16 x i16> %lv16i16, <16 x i16> poison, <16 x i32> zeroinitializer
+
+  %lv2i32 = load <2 x i32>, ptr poison
+  %sv2i32 = shufflevector <2 x i32> %lv2i32, <2 x i32> poison, <2 x i32> zeroinitializer
+  %lv4i32 = load <4 x i32>, ptr poison
+  %sv4i32 = shufflevector <4 x i32> %lv4i32, <4 x i32> poison, <4 x i32> zeroinitializer
+  %lv8i32 = load <8 x i32>, ptr poison
+  %sv8i32 = shufflevector <8 x i32> %lv8i32, <8 x i32> poison, <8 x i32> zeroinitializer
+
+  %lv2i64 = load <2 x i64>, ptr poison
+  %sv2i64 = shufflevector <2 x i64> %lv2i64, <2 x i64> poison, <2 x i32> zeroinitializer
+  %lv4i64 = load <4 x i64>, ptr poison
+  %sv4i64 = shufflevector <4 x i64> %lv4i64, <4 x i64> poison, <4 x i32> zeroinitializer
+
+  %lv2f16 = load <2 x half>, ptr poison
+  %sv2f16 = shufflevector <2 x half> %lv2f16, <2 x half> poison, <2 x i32> zeroinitializer
+  %lv4f16 = load <4 x half>, ptr poison
+  %sv4f16 = shufflevector <4 x half> %lv4f16, <4 x half> poison, <4 x i32> zeroinitializer
+  %lv8f16 = load <8 x half>, ptr poison
+  %sv8f16 = shufflevector <8 x half> %lv8f16, <8 x half> poison, <8 x i32> zeroinitializer
+  %lv16f16 = load <16 x half>, ptr poison
+  %sv16f16 = shufflevector <16 x half> %lv16f16, <16 x half> poison, <16 x i32> zeroinitializer
+
+  %lv2f32 = load <2 x float>, ptr poison
+  %sv2f32 = shufflevector <2 x float> %lv2f32, <2 x float> poison, <2 x i32> zeroinitializer
+  %lv4f32 = load <4 x float>, ptr poison
+  %sv4f32 = shufflevector <4 x float> %lv4f32, <4 x float> poison, <4 x i32> zeroinitializer
+  %lv8f32 = load <8 x float>, ptr poison
+  %sv8f32 = shufflevector <8 x float> %lv8f32, <8 x float> poison, <8 x i32> zeroinitializer
+
+  %lv2f64 = load <2 x double>, ptr poison
+  %sv2f64 = shufflevector <2 x double> %lv2f64, <2 x double> poison, <2 x i32> zeroinitializer
+  %lv4f64 = load <4 x double>, ptr poison
+  %sv4f64 = shufflevector <4 x double> %lv4f64, <4 x double> poison, <4 x i32> zeroinitializer
+
+  ret void
+}


        


More information about the llvm-commits mailing list