blob: 7c6f55c06bcef1f917adcddca27533b389179b5a [file] [log] [blame]
Chandler Carruth93dcdc42015-01-31 11:17:59 +00001//===-- AArch64TargetTransformInfo.cpp - AArch64 specific TTI -------------===//
Tim Northover3b0846e2014-05-24 12:50:23 +00002//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
Tim Northover3b0846e2014-05-24 12:50:23 +00009
Chandler Carruth93dcdc42015-01-31 11:17:59 +000010#include "AArch64TargetTransformInfo.h"
Tim Northover3b0846e2014-05-24 12:50:23 +000011#include "MCTargetDesc/AArch64AddressingModes.h"
12#include "llvm/Analysis/TargetTransformInfo.h"
Kevin Qinaef68412015-03-09 06:14:28 +000013#include "llvm/Analysis/LoopInfo.h"
Chandler Carruth705b1852015-01-31 03:43:40 +000014#include "llvm/CodeGen/BasicTTIImpl.h"
Tim Northover3b0846e2014-05-24 12:50:23 +000015#include "llvm/Support/Debug.h"
16#include "llvm/Target/CostTable.h"
17#include "llvm/Target/TargetLowering.h"
18#include <algorithm>
19using namespace llvm;
20
21#define DEBUG_TYPE "aarch64tti"
22
Tim Northover3b0846e2014-05-24 12:50:23 +000023/// \brief Calculate the cost of materializing a 64-bit value. This helper
24/// method might only calculate a fraction of a larger immediate. Therefore it
25/// is valid to return a cost of ZERO.
Chandler Carruth93205eb2015-08-05 18:08:10 +000026int AArch64TTIImpl::getIntImmCost(int64_t Val) {
Tim Northover3b0846e2014-05-24 12:50:23 +000027 // Check if the immediate can be encoded within an instruction.
28 if (Val == 0 || AArch64_AM::isLogicalImmediate(Val, 64))
29 return 0;
30
31 if (Val < 0)
32 Val = ~Val;
33
34 // Calculate how many moves we will need to materialize this constant.
35 unsigned LZ = countLeadingZeros((uint64_t)Val);
36 return (64 - LZ + 15) / 16;
37}
38
39/// \brief Calculate the cost of materializing the given constant.
Chandler Carruth93205eb2015-08-05 18:08:10 +000040int AArch64TTIImpl::getIntImmCost(const APInt &Imm, Type *Ty) {
Tim Northover3b0846e2014-05-24 12:50:23 +000041 assert(Ty->isIntegerTy());
42
43 unsigned BitSize = Ty->getPrimitiveSizeInBits();
44 if (BitSize == 0)
45 return ~0U;
46
47 // Sign-extend all constants to a multiple of 64-bit.
48 APInt ImmVal = Imm;
49 if (BitSize & 0x3f)
50 ImmVal = Imm.sext((BitSize + 63) & ~0x3fU);
51
52 // Split the constant into 64-bit chunks and calculate the cost for each
53 // chunk.
Chandler Carruth93205eb2015-08-05 18:08:10 +000054 int Cost = 0;
Tim Northover3b0846e2014-05-24 12:50:23 +000055 for (unsigned ShiftVal = 0; ShiftVal < BitSize; ShiftVal += 64) {
56 APInt Tmp = ImmVal.ashr(ShiftVal).sextOrTrunc(64);
57 int64_t Val = Tmp.getSExtValue();
58 Cost += getIntImmCost(Val);
59 }
60 // We need at least one instruction to materialze the constant.
Chandler Carruth93205eb2015-08-05 18:08:10 +000061 return std::max(1, Cost);
Tim Northover3b0846e2014-05-24 12:50:23 +000062}
63
Chandler Carruth93205eb2015-08-05 18:08:10 +000064int AArch64TTIImpl::getIntImmCost(unsigned Opcode, unsigned Idx,
65 const APInt &Imm, Type *Ty) {
Tim Northover3b0846e2014-05-24 12:50:23 +000066 assert(Ty->isIntegerTy());
67
68 unsigned BitSize = Ty->getPrimitiveSizeInBits();
69 // There is no cost model for constants with a bit size of 0. Return TCC_Free
70 // here, so that constant hoisting will ignore this constant.
71 if (BitSize == 0)
Chandler Carruth705b1852015-01-31 03:43:40 +000072 return TTI::TCC_Free;
Tim Northover3b0846e2014-05-24 12:50:23 +000073
74 unsigned ImmIdx = ~0U;
75 switch (Opcode) {
76 default:
Chandler Carruth705b1852015-01-31 03:43:40 +000077 return TTI::TCC_Free;
Tim Northover3b0846e2014-05-24 12:50:23 +000078 case Instruction::GetElementPtr:
79 // Always hoist the base address of a GetElementPtr.
80 if (Idx == 0)
Chandler Carruth705b1852015-01-31 03:43:40 +000081 return 2 * TTI::TCC_Basic;
82 return TTI::TCC_Free;
Tim Northover3b0846e2014-05-24 12:50:23 +000083 case Instruction::Store:
84 ImmIdx = 0;
85 break;
86 case Instruction::Add:
87 case Instruction::Sub:
88 case Instruction::Mul:
89 case Instruction::UDiv:
90 case Instruction::SDiv:
91 case Instruction::URem:
92 case Instruction::SRem:
93 case Instruction::And:
94 case Instruction::Or:
95 case Instruction::Xor:
96 case Instruction::ICmp:
97 ImmIdx = 1;
98 break;
99 // Always return TCC_Free for the shift value of a shift instruction.
100 case Instruction::Shl:
101 case Instruction::LShr:
102 case Instruction::AShr:
103 if (Idx == 1)
Chandler Carruth705b1852015-01-31 03:43:40 +0000104 return TTI::TCC_Free;
Tim Northover3b0846e2014-05-24 12:50:23 +0000105 break;
106 case Instruction::Trunc:
107 case Instruction::ZExt:
108 case Instruction::SExt:
109 case Instruction::IntToPtr:
110 case Instruction::PtrToInt:
111 case Instruction::BitCast:
112 case Instruction::PHI:
113 case Instruction::Call:
114 case Instruction::Select:
115 case Instruction::Ret:
116 case Instruction::Load:
117 break;
118 }
119
120 if (Idx == ImmIdx) {
Chandler Carruth93205eb2015-08-05 18:08:10 +0000121 int NumConstants = (BitSize + 63) / 64;
122 int Cost = AArch64TTIImpl::getIntImmCost(Imm, Ty);
Chandler Carruth705b1852015-01-31 03:43:40 +0000123 return (Cost <= NumConstants * TTI::TCC_Basic)
Chandler Carruth93205eb2015-08-05 18:08:10 +0000124 ? static_cast<int>(TTI::TCC_Free)
Chandler Carruth705b1852015-01-31 03:43:40 +0000125 : Cost;
Tim Northover3b0846e2014-05-24 12:50:23 +0000126 }
Chandler Carruth705b1852015-01-31 03:43:40 +0000127 return AArch64TTIImpl::getIntImmCost(Imm, Ty);
Tim Northover3b0846e2014-05-24 12:50:23 +0000128}
129
Chandler Carruth93205eb2015-08-05 18:08:10 +0000130int AArch64TTIImpl::getIntImmCost(Intrinsic::ID IID, unsigned Idx,
131 const APInt &Imm, Type *Ty) {
Tim Northover3b0846e2014-05-24 12:50:23 +0000132 assert(Ty->isIntegerTy());
133
134 unsigned BitSize = Ty->getPrimitiveSizeInBits();
135 // There is no cost model for constants with a bit size of 0. Return TCC_Free
136 // here, so that constant hoisting will ignore this constant.
137 if (BitSize == 0)
Chandler Carruth705b1852015-01-31 03:43:40 +0000138 return TTI::TCC_Free;
Tim Northover3b0846e2014-05-24 12:50:23 +0000139
140 switch (IID) {
141 default:
Chandler Carruth705b1852015-01-31 03:43:40 +0000142 return TTI::TCC_Free;
Tim Northover3b0846e2014-05-24 12:50:23 +0000143 case Intrinsic::sadd_with_overflow:
144 case Intrinsic::uadd_with_overflow:
145 case Intrinsic::ssub_with_overflow:
146 case Intrinsic::usub_with_overflow:
147 case Intrinsic::smul_with_overflow:
148 case Intrinsic::umul_with_overflow:
149 if (Idx == 1) {
Chandler Carruth93205eb2015-08-05 18:08:10 +0000150 int NumConstants = (BitSize + 63) / 64;
151 int Cost = AArch64TTIImpl::getIntImmCost(Imm, Ty);
Chandler Carruth705b1852015-01-31 03:43:40 +0000152 return (Cost <= NumConstants * TTI::TCC_Basic)
Chandler Carruth93205eb2015-08-05 18:08:10 +0000153 ? static_cast<int>(TTI::TCC_Free)
Chandler Carruth705b1852015-01-31 03:43:40 +0000154 : Cost;
Tim Northover3b0846e2014-05-24 12:50:23 +0000155 }
156 break;
157 case Intrinsic::experimental_stackmap:
158 if ((Idx < 2) || (Imm.getBitWidth() <= 64 && isInt<64>(Imm.getSExtValue())))
Chandler Carruth705b1852015-01-31 03:43:40 +0000159 return TTI::TCC_Free;
Tim Northover3b0846e2014-05-24 12:50:23 +0000160 break;
161 case Intrinsic::experimental_patchpoint_void:
162 case Intrinsic::experimental_patchpoint_i64:
163 if ((Idx < 4) || (Imm.getBitWidth() <= 64 && isInt<64>(Imm.getSExtValue())))
Chandler Carruth705b1852015-01-31 03:43:40 +0000164 return TTI::TCC_Free;
Tim Northover3b0846e2014-05-24 12:50:23 +0000165 break;
166 }
Chandler Carruth705b1852015-01-31 03:43:40 +0000167 return AArch64TTIImpl::getIntImmCost(Imm, Ty);
Tim Northover3b0846e2014-05-24 12:50:23 +0000168}
169
Chandler Carruth705b1852015-01-31 03:43:40 +0000170TargetTransformInfo::PopcntSupportKind
171AArch64TTIImpl::getPopcntSupport(unsigned TyWidth) {
Tim Northover3b0846e2014-05-24 12:50:23 +0000172 assert(isPowerOf2_32(TyWidth) && "Ty width must be power of 2");
173 if (TyWidth == 32 || TyWidth == 64)
Chandler Carruth705b1852015-01-31 03:43:40 +0000174 return TTI::PSK_FastHardware;
Tim Northover3b0846e2014-05-24 12:50:23 +0000175 // TODO: AArch64TargetLowering::LowerCTPOP() supports 128bit popcount.
Chandler Carruth705b1852015-01-31 03:43:40 +0000176 return TTI::PSK_Software;
Tim Northover3b0846e2014-05-24 12:50:23 +0000177}
178
Matthew Simpson78fd46b2017-05-09 20:18:12 +0000179bool AArch64TTIImpl::isWideningInstruction(Type *DstTy, unsigned Opcode,
180 ArrayRef<const Value *> Args) {
181
182 // A helper that returns a vector type from the given type. The number of
183 // elements in type Ty determine the vector width.
184 auto toVectorTy = [&](Type *ArgTy) {
185 return VectorType::get(ArgTy->getScalarType(),
186 DstTy->getVectorNumElements());
187 };
188
189 // Exit early if DstTy is not a vector type whose elements are at least
190 // 16-bits wide.
191 if (!DstTy->isVectorTy() || DstTy->getScalarSizeInBits() < 16)
192 return false;
193
194 // Determine if the operation has a widening variant. We consider both the
195 // "long" (e.g., usubl) and "wide" (e.g., usubw) versions of the
196 // instructions.
197 //
198 // TODO: Add additional widening operations (e.g., mul, shl, etc.) once we
199 // verify that their extending operands are eliminated during code
200 // generation.
201 switch (Opcode) {
202 case Instruction::Add: // UADDL(2), SADDL(2), UADDW(2), SADDW(2).
203 case Instruction::Sub: // USUBL(2), SSUBL(2), USUBW(2), SSUBW(2).
204 break;
205 default:
206 return false;
207 }
208
209 // To be a widening instruction (either the "wide" or "long" versions), the
210 // second operand must be a sign- or zero extend having a single user. We
211 // only consider extends having a single user because they may otherwise not
212 // be eliminated.
213 if (Args.size() != 2 ||
214 (!isa<SExtInst>(Args[1]) && !isa<ZExtInst>(Args[1])) ||
215 !Args[1]->hasOneUse())
216 return false;
217 auto *Extend = cast<CastInst>(Args[1]);
218
219 // Legalize the destination type and ensure it can be used in a widening
220 // operation.
221 auto DstTyL = TLI->getTypeLegalizationCost(DL, DstTy);
222 unsigned DstElTySize = DstTyL.second.getScalarSizeInBits();
223 if (!DstTyL.second.isVector() || DstElTySize != DstTy->getScalarSizeInBits())
224 return false;
225
226 // Legalize the source type and ensure it can be used in a widening
227 // operation.
228 Type *SrcTy = toVectorTy(Extend->getSrcTy());
229 auto SrcTyL = TLI->getTypeLegalizationCost(DL, SrcTy);
230 unsigned SrcElTySize = SrcTyL.second.getScalarSizeInBits();
231 if (!SrcTyL.second.isVector() || SrcElTySize != SrcTy->getScalarSizeInBits())
232 return false;
233
234 // Get the total number of vector elements in the legalized types.
235 unsigned NumDstEls = DstTyL.first * DstTyL.second.getVectorNumElements();
236 unsigned NumSrcEls = SrcTyL.first * SrcTyL.second.getVectorNumElements();
237
238 // Return true if the legalized types have the same number of vector elements
239 // and the destination element type size is twice that of the source type.
240 return NumDstEls == NumSrcEls && 2 * SrcElTySize == DstElTySize;
241}
242
Jonas Paulssonfccc7d62017-04-12 11:49:08 +0000243int AArch64TTIImpl::getCastInstrCost(unsigned Opcode, Type *Dst, Type *Src,
244 const Instruction *I) {
Tim Northover3b0846e2014-05-24 12:50:23 +0000245 int ISD = TLI->InstructionOpcodeToISD(Opcode);
246 assert(ISD && "Invalid opcode");
247
Matthew Simpson78fd46b2017-05-09 20:18:12 +0000248 // If the cast is observable, and it is used by a widening instruction (e.g.,
249 // uaddl, saddw, etc.), it may be free.
250 if (I && I->hasOneUse()) {
251 auto *SingleUser = cast<Instruction>(*I->user_begin());
252 SmallVector<const Value *, 4> Operands(SingleUser->operand_values());
253 if (isWideningInstruction(Dst, SingleUser->getOpcode(), Operands)) {
254 // If the cast is the second operand, it is free. We will generate either
255 // a "wide" or "long" version of the widening instruction.
256 if (I == SingleUser->getOperand(1))
257 return 0;
258 // If the cast is not the second operand, it will be free if it looks the
259 // same as the second operand. In this case, we will generate a "long"
260 // version of the widening instruction.
261 if (auto *Cast = dyn_cast<CastInst>(SingleUser->getOperand(1)))
262 if (I->getOpcode() == Cast->getOpcode() &&
263 cast<CastInst>(I)->getSrcTy() == Cast->getSrcTy())
264 return 0;
265 }
266 }
267
Mehdi Amini44ede332015-07-09 02:09:04 +0000268 EVT SrcTy = TLI->getValueType(DL, Src);
269 EVT DstTy = TLI->getValueType(DL, Dst);
Tim Northover3b0846e2014-05-24 12:50:23 +0000270
271 if (!SrcTy.isSimple() || !DstTy.isSimple())
Chandler Carruth705b1852015-01-31 03:43:40 +0000272 return BaseT::getCastInstrCost(Opcode, Dst, Src);
Tim Northover3b0846e2014-05-24 12:50:23 +0000273
Craig Topper4b275762015-10-28 04:02:12 +0000274 static const TypeConversionCostTblEntry
Craig Topper7bf52c92015-10-25 00:27:14 +0000275 ConversionTbl[] = {
Matthew Simpson343af072015-11-18 18:03:06 +0000276 { ISD::TRUNCATE, MVT::v4i16, MVT::v4i32, 1 },
277 { ISD::TRUNCATE, MVT::v4i32, MVT::v4i64, 0 },
278 { ISD::TRUNCATE, MVT::v8i8, MVT::v8i32, 3 },
279 { ISD::TRUNCATE, MVT::v16i8, MVT::v16i32, 6 },
Silviu Barangab322aa62015-08-17 16:05:09 +0000280
281 // The number of shll instructions for the extension.
Matthew Simpson343af072015-11-18 18:03:06 +0000282 { ISD::SIGN_EXTEND, MVT::v4i64, MVT::v4i16, 3 },
283 { ISD::ZERO_EXTEND, MVT::v4i64, MVT::v4i16, 3 },
284 { ISD::SIGN_EXTEND, MVT::v4i64, MVT::v4i32, 2 },
285 { ISD::ZERO_EXTEND, MVT::v4i64, MVT::v4i32, 2 },
286 { ISD::SIGN_EXTEND, MVT::v8i32, MVT::v8i8, 3 },
287 { ISD::ZERO_EXTEND, MVT::v8i32, MVT::v8i8, 3 },
288 { ISD::SIGN_EXTEND, MVT::v8i32, MVT::v8i16, 2 },
289 { ISD::ZERO_EXTEND, MVT::v8i32, MVT::v8i16, 2 },
290 { ISD::SIGN_EXTEND, MVT::v8i64, MVT::v8i8, 7 },
291 { ISD::ZERO_EXTEND, MVT::v8i64, MVT::v8i8, 7 },
292 { ISD::SIGN_EXTEND, MVT::v8i64, MVT::v8i16, 6 },
293 { ISD::ZERO_EXTEND, MVT::v8i64, MVT::v8i16, 6 },
294 { ISD::SIGN_EXTEND, MVT::v16i16, MVT::v16i8, 2 },
295 { ISD::ZERO_EXTEND, MVT::v16i16, MVT::v16i8, 2 },
Silviu Barangab322aa62015-08-17 16:05:09 +0000296 { ISD::SIGN_EXTEND, MVT::v16i32, MVT::v16i8, 6 },
297 { ISD::ZERO_EXTEND, MVT::v16i32, MVT::v16i8, 6 },
298
Tim Northover3b0846e2014-05-24 12:50:23 +0000299 // LowerVectorINT_TO_FP:
300 { ISD::SINT_TO_FP, MVT::v2f32, MVT::v2i32, 1 },
Tim Northoveref0d7602014-06-15 09:27:06 +0000301 { ISD::SINT_TO_FP, MVT::v4f32, MVT::v4i32, 1 },
Tim Northover3b0846e2014-05-24 12:50:23 +0000302 { ISD::SINT_TO_FP, MVT::v2f64, MVT::v2i64, 1 },
303 { ISD::UINT_TO_FP, MVT::v2f32, MVT::v2i32, 1 },
Tim Northoveref0d7602014-06-15 09:27:06 +0000304 { ISD::UINT_TO_FP, MVT::v4f32, MVT::v4i32, 1 },
Tim Northover3b0846e2014-05-24 12:50:23 +0000305 { ISD::UINT_TO_FP, MVT::v2f64, MVT::v2i64, 1 },
Tim Northoveref0d7602014-06-15 09:27:06 +0000306
307 // Complex: to v2f32
308 { ISD::SINT_TO_FP, MVT::v2f32, MVT::v2i8, 3 },
309 { ISD::SINT_TO_FP, MVT::v2f32, MVT::v2i16, 3 },
Tim Northoverdbecc3b2014-06-15 09:27:15 +0000310 { ISD::SINT_TO_FP, MVT::v2f32, MVT::v2i64, 2 },
Tim Northoveref0d7602014-06-15 09:27:06 +0000311 { ISD::UINT_TO_FP, MVT::v2f32, MVT::v2i8, 3 },
312 { ISD::UINT_TO_FP, MVT::v2f32, MVT::v2i16, 3 },
Tim Northoverdbecc3b2014-06-15 09:27:15 +0000313 { ISD::UINT_TO_FP, MVT::v2f32, MVT::v2i64, 2 },
Tim Northoveref0d7602014-06-15 09:27:06 +0000314
315 // Complex: to v4f32
316 { ISD::SINT_TO_FP, MVT::v4f32, MVT::v4i8, 4 },
317 { ISD::SINT_TO_FP, MVT::v4f32, MVT::v4i16, 2 },
318 { ISD::UINT_TO_FP, MVT::v4f32, MVT::v4i8, 3 },
319 { ISD::UINT_TO_FP, MVT::v4f32, MVT::v4i16, 2 },
320
Silviu Barangab322aa62015-08-17 16:05:09 +0000321 // Complex: to v8f32
322 { ISD::SINT_TO_FP, MVT::v8f32, MVT::v8i8, 10 },
323 { ISD::SINT_TO_FP, MVT::v8f32, MVT::v8i16, 4 },
324 { ISD::UINT_TO_FP, MVT::v8f32, MVT::v8i8, 10 },
325 { ISD::UINT_TO_FP, MVT::v8f32, MVT::v8i16, 4 },
326
327 // Complex: to v16f32
328 { ISD::SINT_TO_FP, MVT::v16f32, MVT::v16i8, 21 },
329 { ISD::UINT_TO_FP, MVT::v16f32, MVT::v16i8, 21 },
330
Tim Northoveref0d7602014-06-15 09:27:06 +0000331 // Complex: to v2f64
332 { ISD::SINT_TO_FP, MVT::v2f64, MVT::v2i8, 4 },
333 { ISD::SINT_TO_FP, MVT::v2f64, MVT::v2i16, 4 },
334 { ISD::SINT_TO_FP, MVT::v2f64, MVT::v2i32, 2 },
335 { ISD::UINT_TO_FP, MVT::v2f64, MVT::v2i8, 4 },
336 { ISD::UINT_TO_FP, MVT::v2f64, MVT::v2i16, 4 },
337 { ISD::UINT_TO_FP, MVT::v2f64, MVT::v2i32, 2 },
338
339
Tim Northover3b0846e2014-05-24 12:50:23 +0000340 // LowerVectorFP_TO_INT
Tim Northoveref0d7602014-06-15 09:27:06 +0000341 { ISD::FP_TO_SINT, MVT::v2i32, MVT::v2f32, 1 },
Tim Northover3b0846e2014-05-24 12:50:23 +0000342 { ISD::FP_TO_SINT, MVT::v4i32, MVT::v4f32, 1 },
343 { ISD::FP_TO_SINT, MVT::v2i64, MVT::v2f64, 1 },
Tim Northoveref0d7602014-06-15 09:27:06 +0000344 { ISD::FP_TO_UINT, MVT::v2i32, MVT::v2f32, 1 },
Tim Northover3b0846e2014-05-24 12:50:23 +0000345 { ISD::FP_TO_UINT, MVT::v4i32, MVT::v4f32, 1 },
346 { ISD::FP_TO_UINT, MVT::v2i64, MVT::v2f64, 1 },
Tim Northoveref0d7602014-06-15 09:27:06 +0000347
Tim Northoverdbecc3b2014-06-15 09:27:15 +0000348 // Complex, from v2f32: legal type is v2i32 (no cost) or v2i64 (1 ext).
Tim Northoveref0d7602014-06-15 09:27:06 +0000349 { ISD::FP_TO_SINT, MVT::v2i64, MVT::v2f32, 2 },
Tim Northoverdbecc3b2014-06-15 09:27:15 +0000350 { ISD::FP_TO_SINT, MVT::v2i16, MVT::v2f32, 1 },
351 { ISD::FP_TO_SINT, MVT::v2i8, MVT::v2f32, 1 },
Tim Northoveref0d7602014-06-15 09:27:06 +0000352 { ISD::FP_TO_UINT, MVT::v2i64, MVT::v2f32, 2 },
Tim Northoverdbecc3b2014-06-15 09:27:15 +0000353 { ISD::FP_TO_UINT, MVT::v2i16, MVT::v2f32, 1 },
354 { ISD::FP_TO_UINT, MVT::v2i8, MVT::v2f32, 1 },
355
356 // Complex, from v4f32: legal type is v4i16, 1 narrowing => ~2
357 { ISD::FP_TO_SINT, MVT::v4i16, MVT::v4f32, 2 },
358 { ISD::FP_TO_SINT, MVT::v4i8, MVT::v4f32, 2 },
Tim Northoveref0d7602014-06-15 09:27:06 +0000359 { ISD::FP_TO_UINT, MVT::v4i16, MVT::v4f32, 2 },
Tim Northoverdbecc3b2014-06-15 09:27:15 +0000360 { ISD::FP_TO_UINT, MVT::v4i8, MVT::v4f32, 2 },
361
362 // Complex, from v2f64: legal type is v2i32, 1 narrowing => ~2.
363 { ISD::FP_TO_SINT, MVT::v2i32, MVT::v2f64, 2 },
364 { ISD::FP_TO_SINT, MVT::v2i16, MVT::v2f64, 2 },
365 { ISD::FP_TO_SINT, MVT::v2i8, MVT::v2f64, 2 },
366 { ISD::FP_TO_UINT, MVT::v2i32, MVT::v2f64, 2 },
367 { ISD::FP_TO_UINT, MVT::v2i16, MVT::v2f64, 2 },
368 { ISD::FP_TO_UINT, MVT::v2i8, MVT::v2f64, 2 },
Tim Northover3b0846e2014-05-24 12:50:23 +0000369 };
370
Craig Topperee0c8592015-10-27 04:14:24 +0000371 if (const auto *Entry = ConvertCostTableLookup(ConversionTbl, ISD,
372 DstTy.getSimpleVT(),
373 SrcTy.getSimpleVT()))
374 return Entry->Cost;
Tim Northover3b0846e2014-05-24 12:50:23 +0000375
Chandler Carruth705b1852015-01-31 03:43:40 +0000376 return BaseT::getCastInstrCost(Opcode, Dst, Src);
Tim Northover3b0846e2014-05-24 12:50:23 +0000377}
378
Matthew Simpsone5dfb082016-04-27 15:20:21 +0000379int AArch64TTIImpl::getExtractWithExtendCost(unsigned Opcode, Type *Dst,
380 VectorType *VecTy,
381 unsigned Index) {
382
383 // Make sure we were given a valid extend opcode.
Matthew Simpson47bd3992016-04-27 16:25:04 +0000384 assert((Opcode == Instruction::SExt || Opcode == Instruction::ZExt) &&
385 "Invalid opcode");
Matthew Simpsone5dfb082016-04-27 15:20:21 +0000386
387 // We are extending an element we extract from a vector, so the source type
388 // of the extend is the element type of the vector.
389 auto *Src = VecTy->getElementType();
390
391 // Sign- and zero-extends are for integer types only.
392 assert(isa<IntegerType>(Dst) && isa<IntegerType>(Src) && "Invalid type");
393
394 // Get the cost for the extract. We compute the cost (if any) for the extend
395 // below.
396 auto Cost = getVectorInstrCost(Instruction::ExtractElement, VecTy, Index);
397
398 // Legalize the types.
399 auto VecLT = TLI->getTypeLegalizationCost(DL, VecTy);
400 auto DstVT = TLI->getValueType(DL, Dst);
401 auto SrcVT = TLI->getValueType(DL, Src);
402
403 // If the resulting type is still a vector and the destination type is legal,
404 // we may get the extension for free. If not, get the default cost for the
405 // extend.
406 if (!VecLT.second.isVector() || !TLI->isTypeLegal(DstVT))
407 return Cost + getCastInstrCost(Opcode, Dst, Src);
408
409 // The destination type should be larger than the element type. If not, get
410 // the default cost for the extend.
411 if (DstVT.getSizeInBits() < SrcVT.getSizeInBits())
412 return Cost + getCastInstrCost(Opcode, Dst, Src);
413
414 switch (Opcode) {
415 default:
416 llvm_unreachable("Opcode should be either SExt or ZExt");
417
418 // For sign-extends, we only need a smov, which performs the extension
419 // automatically.
420 case Instruction::SExt:
421 return Cost;
422
423 // For zero-extends, the extend is performed automatically by a umov unless
424 // the destination type is i64 and the element type is i8 or i16.
425 case Instruction::ZExt:
426 if (DstVT.getSizeInBits() != 64u || SrcVT.getSizeInBits() == 32u)
427 return Cost;
428 }
429
430 // If we are unable to perform the extend for free, get the default cost.
431 return Cost + getCastInstrCost(Opcode, Dst, Src);
432}
433
Chandler Carruth93205eb2015-08-05 18:08:10 +0000434int AArch64TTIImpl::getVectorInstrCost(unsigned Opcode, Type *Val,
435 unsigned Index) {
Tim Northover3b0846e2014-05-24 12:50:23 +0000436 assert(Val->isVectorTy() && "This must be a vector type");
437
438 if (Index != -1U) {
439 // Legalize the type.
Chandler Carruth93205eb2015-08-05 18:08:10 +0000440 std::pair<int, MVT> LT = TLI->getTypeLegalizationCost(DL, Val);
Tim Northover3b0846e2014-05-24 12:50:23 +0000441
442 // This type is legalized to a scalar type.
443 if (!LT.second.isVector())
444 return 0;
445
446 // The type may be split. Normalize the index to the new type.
447 unsigned Width = LT.second.getVectorNumElements();
448 Index = Index % Width;
449
450 // The element at index zero is already inside the vector.
451 if (Index == 0)
452 return 0;
453 }
454
455 // All other insert/extracts cost this much.
Matthias Braun651cff42016-06-02 18:03:53 +0000456 return ST->getVectorInsertExtractBaseCost();
Tim Northover3b0846e2014-05-24 12:50:23 +0000457}
458
Chandler Carruth93205eb2015-08-05 18:08:10 +0000459int AArch64TTIImpl::getArithmeticInstrCost(
Chandler Carruth705b1852015-01-31 03:43:40 +0000460 unsigned Opcode, Type *Ty, TTI::OperandValueKind Opd1Info,
461 TTI::OperandValueKind Opd2Info, TTI::OperandValueProperties Opd1PropInfo,
Mohammed Agabaria2c96c432017-01-11 08:23:37 +0000462 TTI::OperandValueProperties Opd2PropInfo, ArrayRef<const Value *> Args) {
Tim Northover3b0846e2014-05-24 12:50:23 +0000463 // Legalize the type.
Chandler Carruth93205eb2015-08-05 18:08:10 +0000464 std::pair<int, MVT> LT = TLI->getTypeLegalizationCost(DL, Ty);
Tim Northover3b0846e2014-05-24 12:50:23 +0000465
Matthew Simpson78fd46b2017-05-09 20:18:12 +0000466 // If the instruction is a widening instruction (e.g., uaddl, saddw, etc.),
467 // add in the widening overhead specified by the sub-target. Since the
468 // extends feeding widening instructions are performed automatically, they
469 // aren't present in the generated code and have a zero cost. By adding a
470 // widening overhead here, we attach the total cost of the combined operation
471 // to the widening instruction.
472 int Cost = 0;
473 if (isWideningInstruction(Ty, Opcode, Args))
474 Cost += ST->getWideningBaseCost();
475
Tim Northover3b0846e2014-05-24 12:50:23 +0000476 int ISD = TLI->InstructionOpcodeToISD(Opcode);
477
Chad Rosier70d54ac2014-09-29 13:59:31 +0000478 if (ISD == ISD::SDIV &&
479 Opd2Info == TargetTransformInfo::OK_UniformConstantValue &&
480 Opd2PropInfo == TargetTransformInfo::OP_PowerOf2) {
481 // On AArch64, scalar signed division by constants power-of-two are
482 // normally expanded to the sequence ADD + CMP + SELECT + SRA.
483 // The OperandValue properties many not be same as that of previous
484 // operation; conservatively assume OP_None.
Matthew Simpson78fd46b2017-05-09 20:18:12 +0000485 Cost += getArithmeticInstrCost(Instruction::Add, Ty, Opd1Info, Opd2Info,
486 TargetTransformInfo::OP_None,
487 TargetTransformInfo::OP_None);
Chad Rosier70d54ac2014-09-29 13:59:31 +0000488 Cost += getArithmeticInstrCost(Instruction::Sub, Ty, Opd1Info, Opd2Info,
489 TargetTransformInfo::OP_None,
490 TargetTransformInfo::OP_None);
491 Cost += getArithmeticInstrCost(Instruction::Select, Ty, Opd1Info, Opd2Info,
492 TargetTransformInfo::OP_None,
493 TargetTransformInfo::OP_None);
494 Cost += getArithmeticInstrCost(Instruction::AShr, Ty, Opd1Info, Opd2Info,
495 TargetTransformInfo::OP_None,
496 TargetTransformInfo::OP_None);
497 return Cost;
498 }
499
Tim Northover3b0846e2014-05-24 12:50:23 +0000500 switch (ISD) {
501 default:
Matthew Simpson78fd46b2017-05-09 20:18:12 +0000502 return Cost + BaseT::getArithmeticInstrCost(Opcode, Ty, Opd1Info, Opd2Info,
503 Opd1PropInfo, Opd2PropInfo);
Tim Northover3b0846e2014-05-24 12:50:23 +0000504 case ISD::ADD:
505 case ISD::MUL:
506 case ISD::XOR:
507 case ISD::OR:
508 case ISD::AND:
509 // These nodes are marked as 'custom' for combining purposes only.
510 // We know that they are legal. See LowerAdd in ISelLowering.
Matthew Simpson78fd46b2017-05-09 20:18:12 +0000511 return (Cost + 1) * LT.first;
Tim Northover3b0846e2014-05-24 12:50:23 +0000512 }
513}
514
Mohammed Agabaria23599ba2017-01-05 14:03:41 +0000515int AArch64TTIImpl::getAddressComputationCost(Type *Ty, ScalarEvolution *SE,
516 const SCEV *Ptr) {
Tim Northover3b0846e2014-05-24 12:50:23 +0000517 // Address computations in vectorized code with non-consecutive addresses will
518 // likely result in more instructions compared to scalar code where the
519 // computation can more often be merged into the index mode. The resulting
520 // extra micro-ops can significantly decrease throughput.
521 unsigned NumVectorInstToHideOverhead = 10;
Mohammed Agabaria23599ba2017-01-05 14:03:41 +0000522 int MaxMergeDistance = 64;
Tim Northover3b0846e2014-05-24 12:50:23 +0000523
Mohammed Agabaria23599ba2017-01-05 14:03:41 +0000524 if (Ty->isVectorTy() && SE &&
525 !BaseT::isConstantStridedAccessLessThan(SE, Ptr, MaxMergeDistance + 1))
Tim Northover3b0846e2014-05-24 12:50:23 +0000526 return NumVectorInstToHideOverhead;
527
528 // In many cases the address computation is not merged into the instruction
529 // addressing mode.
530 return 1;
531}
532
Chandler Carruth93205eb2015-08-05 18:08:10 +0000533int AArch64TTIImpl::getCmpSelInstrCost(unsigned Opcode, Type *ValTy,
Jonas Paulssonfccc7d62017-04-12 11:49:08 +0000534 Type *CondTy, const Instruction *I) {
Tim Northover3b0846e2014-05-24 12:50:23 +0000535
536 int ISD = TLI->InstructionOpcodeToISD(Opcode);
Silviu Barangaa3e27ed2015-09-09 15:35:02 +0000537 // We don't lower some vector selects well that are wider than the register
538 // width.
Tim Northover3b0846e2014-05-24 12:50:23 +0000539 if (ValTy->isVectorTy() && ISD == ISD::SELECT) {
540 // We would need this many instructions to hide the scalarization happening.
Chandler Carruth93205eb2015-08-05 18:08:10 +0000541 const int AmortizationCost = 20;
Craig Topper4b275762015-10-28 04:02:12 +0000542 static const TypeConversionCostTblEntry
Tim Northover3b0846e2014-05-24 12:50:23 +0000543 VectorSelectTbl[] = {
Silviu Barangaa3e27ed2015-09-09 15:35:02 +0000544 { ISD::SELECT, MVT::v16i1, MVT::v16i16, 16 },
545 { ISD::SELECT, MVT::v8i1, MVT::v8i32, 8 },
546 { ISD::SELECT, MVT::v16i1, MVT::v16i32, 16 },
Tim Northover3b0846e2014-05-24 12:50:23 +0000547 { ISD::SELECT, MVT::v4i1, MVT::v4i64, 4 * AmortizationCost },
548 { ISD::SELECT, MVT::v8i1, MVT::v8i64, 8 * AmortizationCost },
549 { ISD::SELECT, MVT::v16i1, MVT::v16i64, 16 * AmortizationCost }
550 };
551
Mehdi Amini44ede332015-07-09 02:09:04 +0000552 EVT SelCondTy = TLI->getValueType(DL, CondTy);
553 EVT SelValTy = TLI->getValueType(DL, ValTy);
Tim Northover3b0846e2014-05-24 12:50:23 +0000554 if (SelCondTy.isSimple() && SelValTy.isSimple()) {
Craig Topperee0c8592015-10-27 04:14:24 +0000555 if (const auto *Entry = ConvertCostTableLookup(VectorSelectTbl, ISD,
556 SelCondTy.getSimpleVT(),
557 SelValTy.getSimpleVT()))
558 return Entry->Cost;
Tim Northover3b0846e2014-05-24 12:50:23 +0000559 }
560 }
Jonas Paulssonfccc7d62017-04-12 11:49:08 +0000561 return BaseT::getCmpSelInstrCost(Opcode, ValTy, CondTy, I);
Tim Northover3b0846e2014-05-24 12:50:23 +0000562}
563
Evandro Menezes330e1b82017-01-10 23:42:21 +0000564int AArch64TTIImpl::getMemoryOpCost(unsigned Opcode, Type *Ty,
Jonas Paulssonfccc7d62017-04-12 11:49:08 +0000565 unsigned Alignment, unsigned AddressSpace,
566 const Instruction *I) {
Evandro Menezes330e1b82017-01-10 23:42:21 +0000567 auto LT = TLI->getTypeLegalizationCost(DL, Ty);
Tim Northover3b0846e2014-05-24 12:50:23 +0000568
Matthew Simpson2c8de192016-12-15 18:36:59 +0000569 if (ST->isMisaligned128StoreSlow() && Opcode == Instruction::Store &&
Evandro Menezes330e1b82017-01-10 23:42:21 +0000570 LT.second.is128BitVector() && Alignment < 16) {
571 // Unaligned stores are extremely inefficient. We don't split all
572 // unaligned 128-bit stores because the negative impact that has shown in
573 // practice on inlined block copy code.
574 // We make such stores expensive so that we will only vectorize if there
Tim Northover3b0846e2014-05-24 12:50:23 +0000575 // are 6 other instructions getting vectorized.
Evandro Menezes330e1b82017-01-10 23:42:21 +0000576 const int AmortizationCost = 6;
Tim Northover3b0846e2014-05-24 12:50:23 +0000577
578 return LT.first * 2 * AmortizationCost;
579 }
580
Evandro Menezes330e1b82017-01-10 23:42:21 +0000581 if (Ty->isVectorTy() && Ty->getVectorElementType()->isIntegerTy(8) &&
582 Ty->getVectorNumElements() < 8) {
Tim Northover3b0846e2014-05-24 12:50:23 +0000583 // We scalarize the loads/stores because there is not v.4b register and we
584 // have to promote the elements to v.4h.
Evandro Menezes330e1b82017-01-10 23:42:21 +0000585 unsigned NumVecElts = Ty->getVectorNumElements();
Tim Northover3b0846e2014-05-24 12:50:23 +0000586 unsigned NumVectorizableInstsToAmortize = NumVecElts * 2;
587 // We generate 2 instructions per vector element.
588 return NumVectorizableInstsToAmortize * NumVecElts * 2;
589 }
590
591 return LT.first;
592}
James Molloy2b8933c2014-08-05 12:30:34 +0000593
Chandler Carruth93205eb2015-08-05 18:08:10 +0000594int AArch64TTIImpl::getInterleavedMemoryOpCost(unsigned Opcode, Type *VecTy,
595 unsigned Factor,
596 ArrayRef<unsigned> Indices,
597 unsigned Alignment,
598 unsigned AddressSpace) {
Hao Liu7ec8ee32015-06-26 02:32:07 +0000599 assert(Factor >= 2 && "Invalid interleave factor");
600 assert(isa<VectorType>(VecTy) && "Expect a vector type");
601
602 if (Factor <= TLI->getMaxSupportedInterleaveFactor()) {
603 unsigned NumElts = VecTy->getVectorNumElements();
Matthew Simpson1468d3e2017-04-10 18:34:37 +0000604 auto *SubVecTy = VectorType::get(VecTy->getScalarType(), NumElts / Factor);
Hao Liu7ec8ee32015-06-26 02:32:07 +0000605
606 // ldN/stN only support legal vector types of size 64 or 128 in bits.
Matthew Simpsonaee97712017-03-02 15:15:35 +0000607 // Accesses having vector types that are a multiple of 128 bits can be
608 // matched to more than one ldN/stN instruction.
Matthew Simpson1468d3e2017-04-10 18:34:37 +0000609 if (NumElts % Factor == 0 &&
610 TLI->isLegalInterleavedAccessType(SubVecTy, DL))
611 return Factor * TLI->getNumInterleavedAccesses(SubVecTy, DL);
Hao Liu7ec8ee32015-06-26 02:32:07 +0000612 }
613
614 return BaseT::getInterleavedMemoryOpCost(Opcode, VecTy, Factor, Indices,
615 Alignment, AddressSpace);
616}
617
Chandler Carruth93205eb2015-08-05 18:08:10 +0000618int AArch64TTIImpl::getCostOfKeepingLiveOverCall(ArrayRef<Type *> Tys) {
619 int Cost = 0;
James Molloy2b8933c2014-08-05 12:30:34 +0000620 for (auto *I : Tys) {
621 if (!I->isVectorTy())
622 continue;
623 if (I->getScalarSizeInBits() * I->getVectorNumElements() == 128)
624 Cost += getMemoryOpCost(Instruction::Store, I, 128, 0) +
625 getMemoryOpCost(Instruction::Load, I, 128, 0);
626 }
627 return Cost;
628}
James Molloya88896b2014-08-21 00:02:51 +0000629
Wei Mi062c7442015-05-06 17:12:25 +0000630unsigned AArch64TTIImpl::getMaxInterleaveFactor(unsigned VF) {
Matthias Braun651cff42016-06-02 18:03:53 +0000631 return ST->getMaxInterleaveFactor();
James Molloya88896b2014-08-21 00:02:51 +0000632}
Kevin Qin72a799a2014-10-09 10:13:27 +0000633
Chandler Carruthab5cb362015-02-01 14:31:23 +0000634void AArch64TTIImpl::getUnrollingPreferences(Loop *L,
Chandler Carruth705b1852015-01-31 03:43:40 +0000635 TTI::UnrollingPreferences &UP) {
Kevin Qinaef68412015-03-09 06:14:28 +0000636 // Enable partial unrolling and runtime unrolling.
637 BaseT::getUnrollingPreferences(L, UP);
638
639 // For inner loop, it is more likely to be a hot one, and the runtime check
640 // can be promoted out from LICM pass, so the overhead is less, let's try
641 // a larger threshold to unroll more loops.
642 if (L->getLoopDepth() > 1)
643 UP.PartialThreshold *= 2;
644
Kevin Qin72a799a2014-10-09 10:13:27 +0000645 // Disable partial & runtime unrolling on -Os.
646 UP.PartialOptSizeThreshold = 0;
647}
Chad Rosierf9327d62015-01-26 22:51:15 +0000648
Chandler Carruth705b1852015-01-31 03:43:40 +0000649Value *AArch64TTIImpl::getOrCreateResultFromMemIntrinsic(IntrinsicInst *Inst,
650 Type *ExpectedType) {
Chad Rosierf9327d62015-01-26 22:51:15 +0000651 switch (Inst->getIntrinsicID()) {
652 default:
653 return nullptr;
654 case Intrinsic::aarch64_neon_st2:
655 case Intrinsic::aarch64_neon_st3:
656 case Intrinsic::aarch64_neon_st4: {
657 // Create a struct type
658 StructType *ST = dyn_cast<StructType>(ExpectedType);
659 if (!ST)
660 return nullptr;
661 unsigned NumElts = Inst->getNumArgOperands() - 1;
662 if (ST->getNumElements() != NumElts)
663 return nullptr;
664 for (unsigned i = 0, e = NumElts; i != e; ++i) {
665 if (Inst->getArgOperand(i)->getType() != ST->getElementType(i))
666 return nullptr;
667 }
668 Value *Res = UndefValue::get(ExpectedType);
669 IRBuilder<> Builder(Inst);
670 for (unsigned i = 0, e = NumElts; i != e; ++i) {
671 Value *L = Inst->getArgOperand(i);
672 Res = Builder.CreateInsertValue(Res, L, i);
673 }
674 return Res;
675 }
676 case Intrinsic::aarch64_neon_ld2:
677 case Intrinsic::aarch64_neon_ld3:
678 case Intrinsic::aarch64_neon_ld4:
679 if (Inst->getType() == ExpectedType)
680 return Inst;
681 return nullptr;
682 }
683}
684
Chandler Carruth705b1852015-01-31 03:43:40 +0000685bool AArch64TTIImpl::getTgtMemIntrinsic(IntrinsicInst *Inst,
686 MemIntrinsicInfo &Info) {
Chad Rosierf9327d62015-01-26 22:51:15 +0000687 switch (Inst->getIntrinsicID()) {
688 default:
689 break;
690 case Intrinsic::aarch64_neon_ld2:
691 case Intrinsic::aarch64_neon_ld3:
692 case Intrinsic::aarch64_neon_ld4:
693 Info.ReadMem = true;
694 Info.WriteMem = false;
Chad Rosierf9327d62015-01-26 22:51:15 +0000695 Info.PtrVal = Inst->getArgOperand(0);
696 break;
697 case Intrinsic::aarch64_neon_st2:
698 case Intrinsic::aarch64_neon_st3:
699 case Intrinsic::aarch64_neon_st4:
700 Info.ReadMem = false;
701 Info.WriteMem = true;
Chad Rosierf9327d62015-01-26 22:51:15 +0000702 Info.PtrVal = Inst->getArgOperand(Inst->getNumArgOperands() - 1);
703 break;
704 }
705
706 switch (Inst->getIntrinsicID()) {
707 default:
708 return false;
709 case Intrinsic::aarch64_neon_ld2:
710 case Intrinsic::aarch64_neon_st2:
711 Info.MatchingId = VECTOR_LDST_TWO_ELEMENTS;
712 break;
713 case Intrinsic::aarch64_neon_ld3:
714 case Intrinsic::aarch64_neon_st3:
715 Info.MatchingId = VECTOR_LDST_THREE_ELEMENTS;
716 break;
717 case Intrinsic::aarch64_neon_ld4:
718 case Intrinsic::aarch64_neon_st4:
719 Info.MatchingId = VECTOR_LDST_FOUR_ELEMENTS;
720 break;
721 }
722 return true;
723}
Adam Nemet53e758f2016-03-18 00:27:29 +0000724
Jun Bum Limdee55652017-04-03 19:20:07 +0000725/// See if \p I should be considered for address type promotion. We check if \p
726/// I is a sext with right type and used in memory accesses. If it used in a
727/// "complex" getelementptr, we allow it to be promoted without finding other
728/// sext instructions that sign extended the same initial value. A getelementptr
729/// is considered as "complex" if it has more than 2 operands.
730bool AArch64TTIImpl::shouldConsiderAddressTypePromotion(
731 const Instruction &I, bool &AllowPromotionWithoutCommonHeader) {
732 bool Considerable = false;
733 AllowPromotionWithoutCommonHeader = false;
734 if (!isa<SExtInst>(&I))
735 return false;
736 Type *ConsideredSExtType =
737 Type::getInt64Ty(I.getParent()->getParent()->getContext());
738 if (I.getType() != ConsideredSExtType)
739 return false;
740 // See if the sext is the one with the right type and used in at least one
741 // GetElementPtrInst.
742 for (const User *U : I.users()) {
743 if (const GetElementPtrInst *GEPInst = dyn_cast<GetElementPtrInst>(U)) {
744 Considerable = true;
745 // A getelementptr is considered as "complex" if it has more than 2
746 // operands. We will promote a SExt used in such complex GEP as we
747 // expect some computation to be merged if they are done on 64 bits.
748 if (GEPInst->getNumOperands() > 2) {
749 AllowPromotionWithoutCommonHeader = true;
750 break;
751 }
752 }
753 }
754 return Considerable;
755}
756
Adam Nemet53e758f2016-03-18 00:27:29 +0000757unsigned AArch64TTIImpl::getCacheLineSize() {
Matthias Braun651cff42016-06-02 18:03:53 +0000758 return ST->getCacheLineSize();
Adam Nemet53e758f2016-03-18 00:27:29 +0000759}
760
761unsigned AArch64TTIImpl::getPrefetchDistance() {
Matthias Braun651cff42016-06-02 18:03:53 +0000762 return ST->getPrefetchDistance();
Adam Nemet53e758f2016-03-18 00:27:29 +0000763}
Adam Nemet6d8beec2016-03-18 00:27:38 +0000764
765unsigned AArch64TTIImpl::getMinPrefetchStride() {
Matthias Braun651cff42016-06-02 18:03:53 +0000766 return ST->getMinPrefetchStride();
Adam Nemet6d8beec2016-03-18 00:27:38 +0000767}
Adam Nemet709e3042016-03-18 00:27:43 +0000768
769unsigned AArch64TTIImpl::getMaxPrefetchIterationsAhead() {
Matthias Braun651cff42016-06-02 18:03:53 +0000770 return ST->getMaxPrefetchIterationsAhead();
Adam Nemet709e3042016-03-18 00:27:43 +0000771}