[PATCH] D133154: [CostModel][AArch64] Fix ctpop intrinsic cost when NEON is disabled.
Eli Friedman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 2 15:18:48 PDT 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rGb219a9c0a29e: [CostModel][AArch64] Fix ctpop intrinsic cost when NEON is disabled. (authored by efriedma).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D133154/new/
https://reviews.llvm.org/D133154
Files:
llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
llvm/test/Analysis/CostModel/AArch64/ctpop.ll
Index: llvm/test/Analysis/CostModel/AArch64/ctpop.ll
===================================================================
--- llvm/test/Analysis/CostModel/AArch64/ctpop.ll
+++ llvm/test/Analysis/CostModel/AArch64/ctpop.ll
@@ -156,6 +156,22 @@
ret <32 x i8> %ctpop
}
+define i64 @test_ctpop_noneon_i64(i64 %a) "target-features"="-fp-armv8,-neon" {
+; CHECK-LABEL: 'test_ctpop_noneon_i64'
+; CHECK-NEXT: Cost Model: Found an estimated cost of 12 for instruction: %ctpop = call i64 @llvm.ctpop.i64(i64 %a)
+; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i64 %ctpop
+ %ctpop = call i64 @llvm.ctpop.i64(i64 %a)
+ ret i64 %ctpop
+}
+
+define <2 x i64> @test_ctpop_noneon_v2i64(<2 x i64> %a) "target-features"="-fp-armv8,-neon" {
+; CHECK-LABEL: 'test_ctpop_noneon_v2i64'
+; CHECK-NEXT: Cost Model: Found an estimated cost of 24 for instruction: %ctpop = call <2 x i64> @llvm.ctpop.v2i64(<2 x i64> %a)
+; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <2 x i64> %ctpop
+ %ctpop = call <2 x i64> @llvm.ctpop.v2i64(<2 x i64> %a)
+ ret <2 x i64> %ctpop
+}
+
declare <2 x i64> @llvm.ctpop.v2i64(<2 x i64>)
declare <2 x i32> @llvm.ctpop.v2i32(<2 x i32>)
declare <4 x i32> @llvm.ctpop.v4i32(<4 x i32>)
Index: llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
===================================================================
--- llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
+++ llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
@@ -383,6 +383,10 @@
break;
}
case Intrinsic::ctpop: {
+ if (!ST->hasNEON()) {
+ // 32-bit or 64-bit ctpop without NEON is 12 instructions.
+ return getTypeLegalizationCost(RetTy).first * 12;
+ }
static const CostTblEntry CtpopCostTbl[] = {
{ISD::CTPOP, MVT::v2i64, 4},
{ISD::CTPOP, MVT::v4i32, 3},
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D133154.457714.patch
Type: text/x-patch
Size: 1858 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220902/ff2f85ff/attachment.bin>
More information about the llvm-commits
mailing list