diff options
author | David Green <david.green@arm.com> | 2022-10-14 18:49:25 +0100 |
---|---|---|
committer | Tobias Hieta <tobias@hieta.se> | 2022-10-18 08:29:45 +0200 |
commit | 4a2c05b05ed07f1f620e94f6524a8b4b2760a0b1 (patch) | |
tree | c766cca246514695b16ec167cd8f1e752879dc69 | |
parent | f6af95770615c2218084c82c62c10459feebbfbf (diff) | |
download | llvm-4a2c05b05ed07f1f620e94f6524a8b4b2760a0b1.tar.gz |
[ARM] Fix for MVE i128 vector icmp costs.llvmorg-15.0.3
We were hitting an assert as the legalied type needn't be a vector.
Fixes #58364
(cherry picked from commit de6dfbbb300e552efa1cd86a023063a39d408b06)
-rw-r--r-- | llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp | 2 | ||||
-rw-r--r-- | llvm/test/Analysis/CostModel/ARM/mve-cmp.ll | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp b/llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp index 3c102463ba08..cbfd2bc68f18 100644 --- a/llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp +++ b/llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp @@ -1036,7 +1036,7 @@ InstructionCost ARMTTIImpl::getCmpSelInstrCost(unsigned Opcode, Type *ValTy, // split, we may need an expensive shuffle to get two in sync. This has the // effect of making larger than legal compares (v8i32 for example) // expensive. - if (LT.second.getVectorNumElements() > 2) { + if (LT.second.isVector() && LT.second.getVectorNumElements() > 2) { if (LT.first > 1) return LT.first * BaseCost + BaseT::getScalarizationOverhead(VecCondTy, true, false); diff --git a/llvm/test/Analysis/CostModel/ARM/mve-cmp.ll b/llvm/test/Analysis/CostModel/ARM/mve-cmp.ll index 17dd26cdc6cc..bb517fa47d89 100644 --- a/llvm/test/Analysis/CostModel/ARM/mve-cmp.ll +++ b/llvm/test/Analysis/CostModel/ARM/mve-cmp.ll @@ -22,6 +22,8 @@ define void @icmp() { ; CHECK-NEXT: Cost Model: Found an estimated cost of 36 for instruction: %v2i64 = icmp slt <2 x i64> undef, undef ; CHECK-NEXT: Cost Model: Found an estimated cost of 72 for instruction: %v4i64 = icmp slt <4 x i64> undef, undef ; CHECK-NEXT: Cost Model: Found an estimated cost of 144 for instruction: %v8i64 = icmp slt <8 x i64> undef, undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 68 for instruction: %v2i128 = icmp slt <2 x i128> undef, undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 136 for instruction: %v4i128 = icmp slt <4 x i128> undef, undef ; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void ; %v2i8 = icmp slt <2 x i8> undef, undef @@ -44,6 +46,9 @@ define void @icmp() { %v4i64 = icmp slt <4 x i64> undef, undef %v8i64 = icmp slt <8 x i64> undef, undef + %v2i128 = icmp slt <2 x i128> undef, undef + %v4i128 = icmp slt <4 x i128> undef, undef + ret void } |