[llvm] r338203 - [X86] Use alignTo and divideCeil to make some code more readable. NFC
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Sat Jul 28 11:21:45 PDT 2018
Author: ctopper
Date: Sat Jul 28 11:21:45 2018
New Revision: 338203
URL: http://llvm.org/viewvc/llvm-project?rev=338203&view=rev
Log:
[X86] Use alignTo and divideCeil to make some code more readable. NFC
Modified:
llvm/trunk/lib/Target/X86/X86TargetTransformInfo.cpp
Modified: llvm/trunk/lib/Target/X86/X86TargetTransformInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetTransformInfo.cpp?rev=338203&r1=338202&r2=338203&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86TargetTransformInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86TargetTransformInfo.cpp Sat Jul 28 11:21:45 2018
@@ -2274,8 +2274,8 @@ int X86TTIImpl::getIntImmCost(const APIn
// Sign-extend all constants to a multiple of 64-bit.
APInt ImmVal = Imm;
- if (BitSize & 0x3f)
- ImmVal = Imm.sext((BitSize + 63) & ~0x3fU);
+ if (BitSize % 64 != 0)
+ ImmVal = Imm.sext(alignTo(BitSize, 64));
// Split the constant into 64-bit chunks and calculate the cost for each
// chunk.
@@ -2366,7 +2366,7 @@ int X86TTIImpl::getIntImmCost(unsigned O
}
if (Idx == ImmIdx) {
- int NumConstants = (BitSize + 63) / 64;
+ int NumConstants = divideCeil(BitSize, 64);
int Cost = X86TTIImpl::getIntImmCost(Imm, Ty);
return (Cost <= NumConstants * TTI::TCC_Basic)
? static_cast<int>(TTI::TCC_Free)
More information about the llvm-commits
mailing list