summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorSimon Pilgrim <llvm-dev@redking.me.uk>2018-11-14 12:24:50 +0000
committerSimon Pilgrim <llvm-dev@redking.me.uk>2018-11-14 12:24:50 +0000
commitcdb170794be637bb278cda421e37c5f71bd3cf1a (patch)
tree5284ea18f2c189bd16a0d248d090d277550ff63a /llvm/lib
parent7cdb22b1efff78076189f81480fb700fa840cce9 (diff)
downloadbcm5719-llvm-cdb170794be637bb278cda421e37c5f71bd3cf1a.tar.gz
bcm5719-llvm-cdb170794be637bb278cda421e37c5f71bd3cf1a.zip
[CostModel] Add generic expansion funnel shift cost support
Add support for the expansion of funnelshift/rotates to getIntrinsicInstrCost. This also required us to move the X86 fshl/fshr costs to the same place as the rotates to avoid expansion and get correct scalarization vs vectorization costs. llvm-svn: 346854
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/X86/X86TargetTransformInfo.cpp24
1 files changed, 11 insertions, 13 deletions
diff --git a/llvm/lib/Target/X86/X86TargetTransformInfo.cpp b/llvm/lib/Target/X86/X86TargetTransformInfo.cpp
index 0010423bc76..43931ccf034 100644
--- a/llvm/lib/Target/X86/X86TargetTransformInfo.cpp
+++ b/llvm/lib/Target/X86/X86TargetTransformInfo.cpp
@@ -1857,16 +1857,12 @@ int X86TTIImpl::getIntrinsicInstrCost(Intrinsic::ID IID, Type *RetTy,
{ ISD::FSQRT, MVT::v4f32, 56 }, // Pentium III from http://www.agner.org/
};
static const CostTblEntry X64CostTbl[] = { // 64-bit targets
- { ISD::BITREVERSE, MVT::i64, 14 },
- { X86ISD::SHLD, MVT::i64, 4 }
+ { ISD::BITREVERSE, MVT::i64, 14 }
};
static const CostTblEntry X86CostTbl[] = { // 32 or 64-bit targets
{ ISD::BITREVERSE, MVT::i32, 14 },
{ ISD::BITREVERSE, MVT::i16, 14 },
- { ISD::BITREVERSE, MVT::i8, 11 },
- { X86ISD::SHLD, MVT::i32, 4 },
- { X86ISD::SHLD, MVT::i16, 4 },
- { X86ISD::SHLD, MVT::i8, 4 }
+ { ISD::BITREVERSE, MVT::i8, 11 }
};
unsigned ISD = ISD::DELETED_NODE;
@@ -1888,11 +1884,6 @@ int X86TTIImpl::getIntrinsicInstrCost(Intrinsic::ID IID, Type *RetTy,
case Intrinsic::cttz:
ISD = ISD::CTTZ;
break;
- case Intrinsic::fshl:
- case Intrinsic::fshr:
- // SHRD has same costs so don't duplicate.
- ISD = X86ISD::SHLD;
- break;
case Intrinsic::sqrt:
ISD = ISD::FSQRT;
break;
@@ -1999,7 +1990,8 @@ int X86TTIImpl::getIntrinsicInstrCost(Intrinsic::ID IID, Type *RetTy,
};
static const CostTblEntry X64CostTbl[] = { // 64-bit targets
{ ISD::ROTL, MVT::i64, 1 },
- { ISD::ROTR, MVT::i64, 1 }
+ { ISD::ROTR, MVT::i64, 1 },
+ { X86ISD::SHLD, MVT::i64, 4 }
};
static const CostTblEntry X86CostTbl[] = { // 32 or 64-bit targets
{ ISD::ROTL, MVT::i32, 1 },
@@ -2007,7 +1999,10 @@ int X86TTIImpl::getIntrinsicInstrCost(Intrinsic::ID IID, Type *RetTy,
{ ISD::ROTL, MVT::i8, 1 },
{ ISD::ROTR, MVT::i32, 1 },
{ ISD::ROTR, MVT::i16, 1 },
- { ISD::ROTR, MVT::i8, 1 }
+ { ISD::ROTR, MVT::i8, 1 },
+ { X86ISD::SHLD, MVT::i32, 4 },
+ { X86ISD::SHLD, MVT::i16, 4 },
+ { X86ISD::SHLD, MVT::i8, 4 }
};
unsigned ISD = ISD::DELETED_NODE;
@@ -2015,10 +2010,13 @@ int X86TTIImpl::getIntrinsicInstrCost(Intrinsic::ID IID, Type *RetTy,
default:
break;
case Intrinsic::fshl:
+ ISD = X86ISD::SHLD;
if (Args[0] == Args[1])
ISD = ISD::ROTL;
break;
case Intrinsic::fshr:
+ // SHRD has same costs so don't duplicate.
+ ISD = X86ISD::SHLD;
if (Args[0] == Args[1])
ISD = ISD::ROTR;
break;
OpenPOWER on IntegriCloud