llvm.org GIT mirror llvm / c69aaa1
Merging r202192: ------------------------------------------------------------------------ r202192 | hfinkel | 2014-02-25 15:51:50 -0500 (Tue, 25 Feb 2014) | 5 lines Account for 128-bit integer operations in PPCCTRLoops We need to abort the formation of counter-register-based loops where there are 128-bit integer operations that might become function calls. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_34@205822 91177308-0d34-0410-b5e6-96231b3b80d8 Tom Stellard 6 years ago
2 changed file(s) with 42 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
183183 }
184184
185185 return MadeChange;
186 }
187
188 static bool isLargeIntegerTy(bool Is32Bit, Type *Ty) {
189 if (IntegerType *ITy = dyn_cast(Ty))
190 return ITy->getBitWidth() > (Is32Bit ? 32 : 64);
191
192 return false;
186193 }
187194
188195 bool PPCCTRLoops::mightUseCTR(const Triple &TT, BasicBlock *BB) {
351358 CastInst *CI = cast(J);
352359 if (CI->getSrcTy()->getScalarType()->isPPC_FP128Ty() ||
353360 CI->getDestTy()->getScalarType()->isPPC_FP128Ty() ||
354 (TT.isArch32Bit() &&
355 (CI->getSrcTy()->getScalarType()->isIntegerTy(64) ||
356 CI->getDestTy()->getScalarType()->isIntegerTy(64))
357 ))
361 isLargeIntegerTy(TT.isArch32Bit(), CI->getSrcTy()->getScalarType()) ||
362 isLargeIntegerTy(TT.isArch32Bit(), CI->getDestTy()->getScalarType()))
358363 return true;
359 } else if (TT.isArch32Bit() &&
360 J->getType()->getScalarType()->isIntegerTy(64) &&
364 } else if (isLargeIntegerTy(TT.isArch32Bit(),
365 J->getType()->getScalarType()) &&
361366 (J->getOpcode() == Instruction::UDiv ||
362367 J->getOpcode() == Instruction::SDiv ||
363368 J->getOpcode() == Instruction::URem ||
0 ; RUN: llc < %s -march=ppc64 | FileCheck %s
1 target datalayout = "E-m:e-i64:64-n32:64"
2 target triple = "powerpc64-unknown-linux-gnu"
3
4 ; Function Attrs: nounwind
5 define hidden void @_mpd_shortdiv(i64 %n) #0 {
6 entry:
7 br i1 undef, label %for.end, label %for.body.lr.ph
8
9 for.body.lr.ph: ; preds = %entry
10 br label %for.body
11
12 for.body: ; preds = %for.body, %for.body.lr.ph
13 %i.018.in = phi i64 [ %n, %for.body.lr.ph ], [ %i.018, %for.body ]
14 %i.018 = add i64 %i.018.in, -1
15 %add.i = or i128 undef, undef
16 %div.i = udiv i128 %add.i, 0
17 %conv3.i11 = trunc i128 %div.i to i64
18 store i64 %conv3.i11, i64* undef, align 8
19 %cmp = icmp eq i64 %i.018, 0
20 br i1 %cmp, label %for.end, label %for.body
21
22 for.end: ; preds = %for.body, %entry
23 ret void
24 }
25
26 ; CHECK-LABEL: @_mpd_shortdiv
27 ; CHECK-NOT: mtctr
28
29 attributes #0 = { nounwind }
30