From 47ca8606ba2a18d538eed933be0d70d16a6325b8 Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Thu, 24 Jan 2019 13:36:45 +0000 Subject: [TTI] Add generic SADDO/SSUBO costs Added x86 scalar sadd_with_overflow/ssub_with_overflow costs. llvm-svn: 352045 --- llvm/lib/Target/X86/X86TargetTransformInfo.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'llvm/lib/Target') diff --git a/llvm/lib/Target/X86/X86TargetTransformInfo.cpp b/llvm/lib/Target/X86/X86TargetTransformInfo.cpp index e1d96e7fad8..8a20c9dd9c4 100644 --- a/llvm/lib/Target/X86/X86TargetTransformInfo.cpp +++ b/llvm/lib/Target/X86/X86TargetTransformInfo.cpp @@ -2038,12 +2038,16 @@ int X86TTIImpl::getIntrinsicInstrCost(Intrinsic::ID IID, Type *RetTy, }; static const CostTblEntry X64CostTbl[] = { // 64-bit targets { ISD::BITREVERSE, MVT::i64, 14 }, + { ISD::SADDO, MVT::i64, 1 }, { ISD::UADDO, MVT::i64, 1 }, }; static const CostTblEntry X86CostTbl[] = { // 32 or 64-bit targets { ISD::BITREVERSE, MVT::i32, 14 }, { ISD::BITREVERSE, MVT::i16, 14 }, { ISD::BITREVERSE, MVT::i8, 11 }, + { ISD::SADDO, MVT::i32, 1 }, + { ISD::SADDO, MVT::i16, 1 }, + { ISD::SADDO, MVT::i8, 1 }, { ISD::UADDO, MVT::i32, 1 }, { ISD::UADDO, MVT::i16, 1 }, { ISD::UADDO, MVT::i8, 1 }, @@ -2084,6 +2088,12 @@ int X86TTIImpl::getIntrinsicInstrCost(Intrinsic::ID IID, Type *RetTy, case Intrinsic::sqrt: ISD = ISD::FSQRT; break; + case Intrinsic::sadd_with_overflow: + case Intrinsic::ssub_with_overflow: + // SSUBO has same costs so don't duplicate. + ISD = ISD::SADDO; + OpTy = RetTy->getContainedType(0); + break; case Intrinsic::uadd_with_overflow: case Intrinsic::usub_with_overflow: // USUBO has same costs so don't duplicate. -- cgit v1.2.3