[llvm-branch-commits] [llvm] [LoongArch] Add shuffle and vector element cost hooks (PR #233033)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Fri Oct 16 23:47:02 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-loongarch
Author: hev (heiher)
<details>
<summary>Changes</summary>
The default BasicTTI costs a broadcast of <2 x double> as 3 and a single-source permutation of 32/64-bit elements as up to 4, although LSX/LASX need one [x]vreplvei/[x]vreplgr2vr/xvreplve0 or vshuf4i instruction. Extracting element 0 of an FP vector is free since it is the aliased FPR.
These overestimates made the SLP vectorizer reject the {x, y} lanes of the rustc-perf nbody force loop, which needs two scalar splats per iteration. With them the loop splits its divisions between the vector and scalar dividers: 21.5 -> 16.0 cycles per pair on LA664.
rustc-perf nbody on LA664: instructions -11.1%, cycles -13.5%.
---
Patch is 20.28 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/233033.diff
4 Files Affected:
- (modified) llvm/lib/Target/LoongArch/LoongArchTargetTransformInfo.cpp (+49)
- (modified) llvm/lib/Target/LoongArch/LoongArchTargetTransformInfo.h (+15)
- (modified) llvm/test/Analysis/CostModel/LoongArch/shuffle-extract.ll (+29-29)
- (modified) llvm/test/Transforms/SLPVectorizer/LoongArch/nbody-forces.ll (+13-17)
``````````diff
diff --git a/llvm/lib/Target/LoongArch/LoongArchTargetTransformInfo.cpp b/llvm/lib/Target/LoongArch/LoongArchTargetTransformInfo.cpp
index 6139a334a71962..6bd05ac6ba6d52 100644
--- a/llvm/lib/Target/LoongArch/LoongArchTargetTransformInfo.cpp
+++ b/llvm/lib/Target/LoongArch/LoongArchTargetTransformInfo.cpp
@@ -466,3 +466,52 @@ InstructionCost LoongArchTTIImpl::getArithmeticInstrCost(
return BaseT::getArithmeticInstrCost(Opcode, Ty, CostKind, Op1Info, Op2Info,
Args, CxtI);
}
+
+// Returns true if Ty is a fixed vector type held in a single LSX/LASX register.
+static bool isSingleVRegType(const LoongArchSubtarget *ST, Type *Ty) {
+ auto *VTy = dyn_cast<FixedVectorType>(Ty);
+ if (!VTy)
+ return false;
+ unsigned Bits = VTy->getPrimitiveSizeInBits().getFixedValue();
+ return (Bits == 128 && ST->hasExtLSX()) || (Bits == 256 && ST->hasExtLASX());
+}
+
+InstructionCost LoongArchTTIImpl::getVectorInstrCost(
+ unsigned Opcode, Type *Val, TTI::TargetCostKind CostKind, unsigned Index,
+ const Value *Op0, const Value *Op1, TTI::VectorInstrContext VIC) const {
+ // Element 0 of a floating-point vector is the aliased FPR, so extracting it
+ // is free.
+ if (Opcode == Instruction::ExtractElement && Index == 0 &&
+ Val->getScalarType()->isFloatingPointTy() && isSingleVRegType(ST, Val))
+ return 0;
+ return BaseT::getVectorInstrCost(Opcode, Val, CostKind, Index, Op0, Op1,
+ VIC);
+}
+
+InstructionCost LoongArchTTIImpl::getShuffleCost(
+ TTI::ShuffleKind Kind, VectorType *DstTy, VectorType *SrcTy,
+ TTI::TargetCostKind CostKind, ArrayRef<int> Mask, int Index,
+ VectorType *SubTp, ArrayRef<const Value *> Args, const Instruction *CxtI,
+ TTI::VectorInstrContext VIC) const {
+ if (isSingleVRegType(ST, SrcTy) && DstTy == SrcTy) {
+ Kind = improveShuffleKindFromMask(Kind, Mask, SrcTy, Index, SubTp);
+ unsigned EltBits = SrcTy->getScalarSizeInBits();
+ bool Is128 = SrcTy->getPrimitiveSizeInBits().getFixedValue() == 128;
+ switch (Kind) {
+ case TTI::SK_Broadcast:
+ // [x]vreplvei.{b/h/w/d}, xvreplve0.{b/h/w/d}, [x]vreplgr2vr.{b/h/w/d}.
+ return 1;
+ case TTI::SK_Reverse:
+ case TTI::SK_PermuteSingleSrc:
+ // vshuf4i.{w/d} handles any single-source permutation of 32/64-bit
+ // elements within a 128-bit register.
+ if (Is128 && EltBits >= 32)
+ return 1;
+ break;
+ default:
+ break;
+ }
+ }
+ return BaseT::getShuffleCost(Kind, DstTy, SrcTy, CostKind, Mask, Index,
+ SubTp, Args, CxtI, VIC);
+}
diff --git a/llvm/lib/Target/LoongArch/LoongArchTargetTransformInfo.h b/llvm/lib/Target/LoongArch/LoongArchTargetTransformInfo.h
index a7773b88bb1939..d9bf8421609155 100644
--- a/llvm/lib/Target/LoongArch/LoongArchTargetTransformInfo.h
+++ b/llvm/lib/Target/LoongArch/LoongArchTargetTransformInfo.h
@@ -63,6 +63,21 @@ class LoongArchTTIImpl : public BasicTTIImplBase<LoongArchTTIImpl> {
ArrayRef<const Value *> Args = {},
const Instruction *CxtI = nullptr) const override;
+ using BaseT::getVectorInstrCost;
+ InstructionCost
+ getVectorInstrCost(unsigned Opcode, Type *Val, TTI::TargetCostKind CostKind,
+ unsigned Index, const Value *Op0, const Value *Op1,
+ TTI::VectorInstrContext VIC =
+ TTI::VectorInstrContext::None) const override;
+
+ InstructionCost
+ getShuffleCost(TTI::ShuffleKind Kind, VectorType *DstTy, VectorType *SrcTy,
+ TTI::TargetCostKind CostKind, ArrayRef<int> Mask, int Index,
+ VectorType *SubTp, ArrayRef<const Value *> Args = {},
+ const Instruction *CxtI = nullptr,
+ TTI::VectorInstrContext VIC =
+ TTI::VectorInstrContext::None) const override;
+
TTI::MemCmpExpansionOptions
enableMemCmpExpansion(bool OptSize, bool IsZeroCmp) const override;
diff --git a/llvm/test/Analysis/CostModel/LoongArch/shuffle-extract.ll b/llvm/test/Analysis/CostModel/LoongArch/shuffle-extract.ll
index b084302e086714..997bc91021ffdd 100644
--- a/llvm/test/Analysis/CostModel/LoongArch/shuffle-extract.ll
+++ b/llvm/test/Analysis/CostModel/LoongArch/shuffle-extract.ll
@@ -4,9 +4,9 @@
define void @extract_fp(<4 x float> %a, <2 x double> %b, <8 x float> %c, <4 x double> %d) {
; LSX-LABEL: 'extract_fp'
-; LSX-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %a0 = extractelement <4 x float> %a, i32 0
+; LSX-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a0 = extractelement <4 x float> %a, i32 0
; LSX-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %a1 = extractelement <4 x float> %a, i32 1
-; LSX-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %b0 = extractelement <2 x double> %b, i32 0
+; LSX-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %b0 = extractelement <2 x double> %b, i32 0
; LSX-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %b1 = extractelement <2 x double> %b, i32 1
; LSX-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %c0 = extractelement <8 x float> %c, i32 0
; LSX-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %c1 = extractelement <8 x float> %c, i32 1
@@ -15,13 +15,13 @@ define void @extract_fp(<4 x float> %a, <2 x double> %b, <8 x float> %c, <4 x do
; LSX-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
;
; LASX-LABEL: 'extract_fp'
-; LASX-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %a0 = extractelement <4 x float> %a, i32 0
+; LASX-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a0 = extractelement <4 x float> %a, i32 0
; LASX-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %a1 = extractelement <4 x float> %a, i32 1
-; LASX-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %b0 = extractelement <2 x double> %b, i32 0
+; LASX-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %b0 = extractelement <2 x double> %b, i32 0
; LASX-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %b1 = extractelement <2 x double> %b, i32 1
-; LASX-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %c0 = extractelement <8 x float> %c, i32 0
+; LASX-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %c0 = extractelement <8 x float> %c, i32 0
; LASX-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %c1 = extractelement <8 x float> %c, i32 1
-; LASX-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %d0 = extractelement <4 x double> %d, i32 0
+; LASX-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %d0 = extractelement <4 x double> %d, i32 0
; LASX-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %d1 = extractelement <4 x double> %d, i32 1
; LASX-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
;
@@ -54,27 +54,27 @@ define void @extract_int(<4 x i32> %a, <2 x i64> %b) {
define void @broadcast(<16 x i8> %a, <8 x i16> %b, <4 x i32> %c, <2 x i64> %d, <4 x float> %e, <2 x double> %f,
; LSX-LABEL: 'broadcast'
-; LSX-NEXT: Cost Model: Found an estimated cost of 17 for instruction: %a1 = shufflevector <16 x i8> %a, <16 x i8> poison, <16 x i32> zeroinitializer
-; LSX-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %b1 = shufflevector <8 x i16> %b, <8 x i16> poison, <8 x i32> zeroinitializer
-; LSX-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %c1 = shufflevector <4 x i32> %c, <4 x i32> poison, <4 x i32> zeroinitializer
-; LSX-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %d1 = shufflevector <2 x i64> %d, <2 x i64> poison, <2 x i32> zeroinitializer
-; LSX-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %e1 = shufflevector <4 x float> %e, <4 x float> poison, <4 x i32> zeroinitializer
-; LSX-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %f1 = shufflevector <2 x double> %f, <2 x double> poison, <2 x i32> zeroinitializer
+; LSX-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %a1 = shufflevector <16 x i8> %a, <16 x i8> poison, <16 x i32> zeroinitializer
+; LSX-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %b1 = shufflevector <8 x i16> %b, <8 x i16> poison, <8 x i32> zeroinitializer
+; LSX-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %c1 = shufflevector <4 x i32> %c, <4 x i32> poison, <4 x i32> zeroinitializer
+; LSX-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %d1 = shufflevector <2 x i64> %d, <2 x i64> poison, <2 x i32> zeroinitializer
+; LSX-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %e1 = shufflevector <4 x float> %e, <4 x float> poison, <4 x i32> zeroinitializer
+; LSX-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %f1 = shufflevector <2 x double> %f, <2 x double> poison, <2 x i32> zeroinitializer
; LSX-NEXT: Cost Model: Found an estimated cost of 33 for instruction: %g1 = shufflevector <32 x i8> %g, <32 x i8> poison, <32 x i32> zeroinitializer
; LSX-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %h1 = shufflevector <8 x i32> %h, <8 x i32> poison, <8 x i32> zeroinitializer
; LSX-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %i1 = shufflevector <4 x double> %i, <4 x double> poison, <4 x i32> zeroinitializer
; LSX-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
;
; LASX-LABEL: 'broadcast'
-; LASX-NEXT: Cost Model: Found an estimated cost of 17 for instruction: %a1 = shufflevector <16 x i8> %a, <16 x i8> poison, <16 x i32> zeroinitializer
-; LASX-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %b1 = shufflevector <8 x i16> %b, <8 x i16> poison, <8 x i32> zeroinitializer
-; LASX-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %c1 = shufflevector <4 x i32> %c, <4 x i32> poison, <4 x i32> zeroinitializer
-; LASX-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %d1 = shufflevector <2 x i64> %d, <2 x i64> poison, <2 x i32> zeroinitializer
-; LASX-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %e1 = shufflevector <4 x float> %e, <4 x float> poison, <4 x i32> zeroinitializer
-; LASX-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %f1 = shufflevector <2 x double> %f, <2 x double> poison, <2 x i32> zeroinitializer
-; LASX-NEXT: Cost Model: Found an estimated cost of 33 for instruction: %g1 = shufflevector <32 x i8> %g, <32 x i8> poison, <32 x i32> zeroinitializer
-; LASX-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %h1 = shufflevector <8 x i32> %h, <8 x i32> poison, <8 x i32> zeroinitializer
-; LASX-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %i1 = shufflevector <4 x double> %i, <4 x double> poison, <4 x i32> zeroinitializer
+; LASX-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %a1 = shufflevector <16 x i8> %a, <16 x i8> poison, <16 x i32> zeroinitializer
+; LASX-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %b1 = shufflevector <8 x i16> %b, <8 x i16> poison, <8 x i32> zeroinitializer
+; LASX-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %c1 = shufflevector <4 x i32> %c, <4 x i32> poison, <4 x i32> zeroinitializer
+; LASX-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %d1 = shufflevector <2 x i64> %d, <2 x i64> poison, <2 x i32> zeroinitializer
+; LASX-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %e1 = shufflevector <4 x float> %e, <4 x float> poison, <4 x i32> zeroinitializer
+; LASX-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %f1 = shufflevector <2 x double> %f, <2 x double> poison, <2 x i32> zeroinitializer
+; LASX-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %g1 = shufflevector <32 x i8> %g, <32 x i8> poison, <32 x i32> zeroinitializer
+; LASX-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %h1 = shufflevector <8 x i32> %h, <8 x i32> poison, <8 x i32> zeroinitializer
+; LASX-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %i1 = shufflevector <4 x double> %i, <4 x double> poison, <4 x i32> zeroinitializer
; LASX-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
;
<32 x i8> %g, <8 x i32> %h, <4 x double> %i) {
@@ -92,19 +92,19 @@ define void @broadcast(<16 x i8> %a, <8 x i16> %b, <4 x i32> %c, <2 x i64> %d, <
define void @permute(<4 x i32> %a, <2 x double> %b, <4 x float> %c, <16 x i8> %d, <8 x i32> %e) {
; LSX-LABEL: 'permute'
-; LSX-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %a1 = shufflevector <4 x i32> %a, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
-; LSX-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %a2 = shufflevector <4 x i32> %a, <4 x i32> poison, <4 x i32> <i32 1, i32 0, i32 3, i32 3>
-; LSX-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %b1 = shufflevector <2 x double> %b, <2 x double> poison, <2 x i32> <i32 1, i32 0>
-; LSX-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %c1 = shufflevector <4 x float> %c, <4 x float> poison, <4 x i32> <i32 2, i32 3, i32 0, i32 1>
+; LSX-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %a1 = shufflevector <4 x i32> %a, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
+; LSX-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %a2 = shufflevector <4 x i32> %a, <4 x i32> poison, <4 x i32> <i32 1, i32 0, i32 3, i32 3>
+; LSX-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %b1 = shufflevector <2 x double> %b, <2 x double> poison, <2 x i32> <i32 1, i32 0>
+; LSX-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %c1 = shufflevector <4 x float> %c, <4 x float> poison, <4 x i32> <i32 2, i32 3, i32 0, i32 1>
; LSX-NEXT: Cost Model: Found an estimated cost of 32 for instruction: %d1 = shufflevector <16 x i8> %d, <16 x i8> poison, <16 x i32> <i32 15, i32 14, i32 13, i32 12, i32 11, i32 10, i32 9, i32 8, i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
; LSX-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %e1 = shufflevector <8 x i32> %e, <8 x i32> poison, <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
; LSX-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
;
; LASX-LABEL: 'permute'
-; LASX-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %a1 = shufflevector <4 x i32> %a, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
-; LASX-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %a2 = shufflevector <4 x i32> %a, <4 x i32> poison, <4 x i32> <i32 1, i32 0, i32 3, i32 3>
-; LASX-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %b1 = shufflevector <2 x double> %b, <2 x double> poison, <2 x i32> <i32 1, i32 0>
-; LASX-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %c1 = shufflevector <4 x float> %c, <4 x float> poison, <4 x i32> <i32 2, i32 3, i32 0, i32 1>
+; LASX-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %a1 = shufflevector <4 x i32> %a, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
+; LASX-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %a2 = shufflevector <4 x i32> %a, <4 x i32> poison, <4 x i32> <i32 1, i32 0, i32 3, i32 3>
+; LASX-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %b1 = shufflevector <2 x double> %b, <2 x double> poison, <2 x i32> <i32 1, i32 0>
+; LASX-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %c1 = shufflevector <4 x float> %c, <4 x float> poison, <4 x i32> <i32 2, i32 3, i32 0, i32 1>
; LASX-NEXT: Cost Model: Found an estimated cost of 32 for instruction: %d1 = shufflevector <16 x i8> %d, <16 x i8> poison, <16 x i32> <i32 15, i32 14, i32 13, i32 12, i32 11, i32 10, i32 9, i32 8, i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
; LASX-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %e1 = shufflevector <8 x i32> %e, <8 x i32> poison, <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
; LASX-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
diff --git a/llvm/test/Transforms/SLPVectorizer/LoongArch/nbody-forces.ll b/llvm/test/Transforms/SLPVectorizer/LoongArch/nbody-forces.ll
index 3d285345318029..faee7000e12520 100644
--- a/llvm/test/Transforms/SLPVectorizer/LoongArch/nbody-forces.ll
+++ b/llvm/test/Transforms/SLPVectorizer/LoongArch/nbody-forces.ll
@@ -17,44 +17,40 @@ define void @forces(ptr noalias %out, ptr noalias %p, double %gm, ptr noalias %p
; CHECK: [[LOOP]]:
; CHECK-NEXT: [[I:%.*]] = phi i64 [ 0, %[[ENTRY]] ], [ [[I_NEXT:%.*]], %[[LOOP]] ]
; CHECK-NEXT: [[FZ:%.*]] = phi double [ 0.000000e+00, %[[ENTRY]] ], [ [[FZ_NEXT:%.*]], %[[LOOP]] ]
-; CHECK-NEXT: [[FY:%.*]] = phi double [ 0.000000e+00, %[[ENTRY]] ], [ [[FY_NEXT:%.*]], %[[LOOP]] ]
-; CHECK-NEXT: [[FZ1:%.*]] = phi double [ 0.000000e+00, %[[ENTRY]] ], [ [[FZ_NEXT1:%.*]], %[[LOOP]] ]
+; CHECK-NEXT: [[TMP1:%.*]] = phi <2 x double> [ zeroinitializer, %[[ENTRY]] ], [ [[TMP13:%.*]], %[[LOOP]] ]
; CHECK-NEXT: [[Q:%.*]] = getelementptr inbounds nuw [24 x i8], ptr [[POS]], i64 [[I]]
; CHECK-NEXT: [[MP:%.*]] = getelementptr inbounds nuw [8 x i8], ptr [[MASS]], i64 [[I]]
; CHECK-NEXT: [[M:%.*]] = load double, ptr [[MP]], align 8
; CHECK-NEXT: [[Q_Z:%.*]] = getelementptr inbounds nuw i8, ptr [[Q]], i64 16
; CHECK-NEXT: [[QZ:%.*]] = load double, ptr [[Q_Z]], align 8
; CHECK-NEXT: [[DZ:%.*]] = fsub double [[PZ]], [[QZ]]
+; CHECK-NEXT: [[DZ2:%.*]] = fmul double [[DZ]], [[DZ]]
+; CHECK-NEXT: [[GMM:%.*]] = fmul double [[GM]], [[M]]
; CHECK-NEXT: [[TMP2:%.*]] = load <2 x double>, ptr [[Q]], align 8
; CHECK-NEXT: [[TMP3:%.*]] = fsub <2 x double> [[TMP0]], [[TMP2]]
; CHECK-NEXT: [[TMP4:%.*]] = fmul <2 x double> [[TMP3]], [[TMP3]]
; CHECK-NEXT: [[TMP5:%.*]] = extractelement <2 x double> [[TMP4]], i64 0
; CHECK-NEXT: [[TMP6:%.*]] = extractelement <2 x double> [[TMP4]], i64 1
; CHECK-NEXT: [[DXY:%.*]] = fadd double [[TMP5]], [[TMP6]]
-; CHECK-NEXT: [[DZ2:%.*]] = fmul double [[DZ]], [[DZ]]
; CHECK-NEXT: [[D:%.*]] = fadd double [[DXY]], [[DZ2]]
-; CHECK-NEXT: [[GMM:%.*]] = fmul double [[GM]], [[M]]
; CHECK-NEXT: [[F:%.*]] = fdiv double [[GMM]], [[D]]
-; CHECK-NEXT: [[TMP8:%.*]] = extractelement <2 x double> [[TMP3]], i64 0
-; CHECK-NEXT: [[TZ:%.*]] = fmul double [[TMP8]], [[F]]
+; CHECK-NEXT: [[TMP7:%.*]] = insertelement <2 x double> poison, double [[F]], i64 0
+; CHECK-NEXT: [[TMP8:%.*]] = shufflevector <2 x double> [[TMP7]], <2 x double> poison, <2 x i32> zeroinitializer
+; CHECK-NEXT: [[TMP9:%.*]] = fmul <2 x double> [[TMP3]], [[TMP8]]
+; CHECK-NEXT: [[TMP10:%.*]] = insertelement <2 x double> poison, double [[D]], i64 0
+; CHECK-NEXT: [[TMP11:%.*]] = shufflevector <2 x double> [[TMP10]], <2 x double> poison, <2 x i32> zeroinitializer
+; CHECK-NEXT: [[TMP12:%.*]] = fdiv <2 x double> [[TMP9]], [[TMP11]]
+; CHECK-NEXT: [[TZ:%.*]] = fmul double [[DZ]], [[F]]
; CHECK-NEXT: [[AZ:%.*]] = fdiv double [[TZ]], [[D]]
-; CHECK-NEXT: [[TMP7:%.*]] = extractelement <2 x double> [[TMP3]], i64 1
-; CHECK-NEXT: [[TY:%.*]] = fmul double [[TMP7]], [[F]]
-; CHECK-NEXT: [[AY:%.*]] = fdiv double [[TY]], [[D]]
-; CHECK-NEXT: [[TZ1:%.*]] = fmul double [[DZ]], [[F]]
-; CHECK-NEXT: [[AZ1:%.*]] = fdiv double [[TZ1]], [[D]]
+; CHECK-NEXT: [[TMP13]] = fadd <2 x double> [[TMP1]], [[TMP12]]
; CHECK-NEXT: [[FZ_NEXT]] = fadd double [[FZ]], [[AZ]]
-; CHECK-NEXT: [[FY_NEXT]] = fadd double [[FY]], [[AY]]
-; CHECK-NEXT: [[FZ_NEXT1]] = fadd double [[FZ1]], [[AZ1]]
; CHECK-NEXT: [[I_NEXT]] = add nuw i64 [[I]], 1
; CHECK-NEXT: [[DONE:%.*]] = icmp eq i64 [[I_NEXT]], [[N]]
; CHECK-NEXT: br i1 [[DONE]], label %[[EXIT:.*]], label %[[LOOP]]
; CHECK: [[EXIT]]:
-; CHECK-NEXT: store double [[FZ_NEXT]], ptr [[OUT]], align 8
-; CHECK-NEXT: [[OUT_Y:%.*]] = getelementptr inbounds nuw i8, ptr [[OUT]], i64 8
-; CHECK-NEXT: store double [[FY_NEXT]], ptr [[OUT_Y]], align 8
+; CHECK-NEXT: store <2 x double> [[...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/233033
More information about the llvm-branch-commits
mailing list