[llvm] a0869b1 - [CostModel][X86] Fix expanded CTPOP i8 costs
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 21 06:55:09 PST 2024
Author: Simon Pilgrim
Date: 2024-02-21T14:54:50Z
New Revision: a0869b14cde9ed71bb4323c8717f59ee1b1e79bf
URL: https://github.com/llvm/llvm-project/commit/a0869b14cde9ed71bb4323c8717f59ee1b1e79bf
DIFF: https://github.com/llvm/llvm-project/commit/a0869b14cde9ed71bb4323c8717f59ee1b1e79bf.diff
LOG: [CostModel][X86] Fix expanded CTPOP i8 costs
Updated to match #79989 / 9410019ac977141bc73aee19690b5896ded59219
Added:
Modified:
llvm/lib/Target/X86/X86TargetTransformInfo.cpp
llvm/test/Analysis/CostModel/X86/ctpop-codesize.ll
llvm/test/Analysis/CostModel/X86/ctpop-sizelatency.ll
Removed:
################################################################################
diff --git a/llvm/lib/Target/X86/X86TargetTransformInfo.cpp b/llvm/lib/Target/X86/X86TargetTransformInfo.cpp
index be1a0948308999..f91e13f997f788 100644
--- a/llvm/lib/Target/X86/X86TargetTransformInfo.cpp
+++ b/llvm/lib/Target/X86/X86TargetTransformInfo.cpp
@@ -4000,7 +4000,7 @@ X86TTIImpl::getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA,
{ ISD::CTTZ_ZERO_UNDEF, MVT::i8, { 2, 2, 1, 1 } }, // BSF
{ ISD::CTPOP, MVT::i32, { 8, 7, 15, 15 } },
{ ISD::CTPOP, MVT::i16, { 9, 8, 17, 17 } },
- { ISD::CTPOP, MVT::i8, { 7, 6, 13, 13 } },
+ { ISD::CTPOP, MVT::i8, { 7, 6, 6, 6 } },
{ ISD::ROTL, MVT::i32, { 2, 3, 1, 3 } },
{ ISD::ROTL, MVT::i16, { 2, 3, 1, 3 } },
{ ISD::ROTL, MVT::i8, { 2, 3, 1, 3 } },
diff --git a/llvm/test/Analysis/CostModel/X86/ctpop-codesize.ll b/llvm/test/Analysis/CostModel/X86/ctpop-codesize.ll
index 75adeee09197e8..2e417efd52d123 100644
--- a/llvm/test/Analysis/CostModel/X86/ctpop-codesize.ll
+++ b/llvm/test/Analysis/CostModel/X86/ctpop-codesize.ll
@@ -57,7 +57,7 @@ define i16 @var_ctpop_i16(i16 %a) {
define i8 @var_ctpop_i8(i8 %a) {
; NOPOPCNT-LABEL: 'var_ctpop_i8'
-; NOPOPCNT-NEXT: Cost Model: Found an estimated cost of 13 for instruction: %ctpop = call i8 @llvm.ctpop.i8(i8 %a)
+; NOPOPCNT-NEXT: Cost Model: Found an estimated cost of 6 for instruction: %ctpop = call i8 @llvm.ctpop.i8(i8 %a)
; NOPOPCNT-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i8 %ctpop
;
; POPCNT-LABEL: 'var_ctpop_i8'
diff --git a/llvm/test/Analysis/CostModel/X86/ctpop-sizelatency.ll b/llvm/test/Analysis/CostModel/X86/ctpop-sizelatency.ll
index b46cfe15569e66..0e629c23b71cad 100644
--- a/llvm/test/Analysis/CostModel/X86/ctpop-sizelatency.ll
+++ b/llvm/test/Analysis/CostModel/X86/ctpop-sizelatency.ll
@@ -57,7 +57,7 @@ define i16 @var_ctpop_i16(i16 %a) {
define i8 @var_ctpop_i8(i8 %a) {
; NOPOPCNT-LABEL: 'var_ctpop_i8'
-; NOPOPCNT-NEXT: Cost Model: Found an estimated cost of 13 for instruction: %ctpop = call i8 @llvm.ctpop.i8(i8 %a)
+; NOPOPCNT-NEXT: Cost Model: Found an estimated cost of 6 for instruction: %ctpop = call i8 @llvm.ctpop.i8(i8 %a)
; NOPOPCNT-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i8 %ctpop
;
; POPCNT-LABEL: 'var_ctpop_i8'
More information about the llvm-commits
mailing list