llvm.org GIT mirror llvm / 15ac7df
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/trunk@202192 91177308-0d34-0410-b5e6-96231b3b80d8 Hal Finkel 6 years ago
2 changed file(s) with 42 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
184184 }
185185
186186 return MadeChange;
187 }
188
189 static bool isLargeIntegerTy(bool Is32Bit, Type *Ty) {
190 if (IntegerType *ITy = dyn_cast(Ty))
191 return ITy->getBitWidth() > (Is32Bit ? 32 : 64);
192
193 return false;
187194 }
188195
189196 bool PPCCTRLoops::mightUseCTR(const Triple &TT, BasicBlock *BB) {
352359 CastInst *CI = cast(J);
353360 if (CI->getSrcTy()->getScalarType()->isPPC_FP128Ty() ||
354361 CI->getDestTy()->getScalarType()->isPPC_FP128Ty() ||
355 (TT.isArch32Bit() &&
356 (CI->getSrcTy()->getScalarType()->isIntegerTy(64) ||
357 CI->getDestTy()->getScalarType()->isIntegerTy(64))
358 ))
362 isLargeIntegerTy(TT.isArch32Bit(), CI->getSrcTy()->getScalarType()) ||
363 isLargeIntegerTy(TT.isArch32Bit(), CI->getDestTy()->getScalarType()))
359364 return true;
360 } else if (TT.isArch32Bit() &&
361 J->getType()->getScalarType()->isIntegerTy(64) &&
365 } else if (isLargeIntegerTy(TT.isArch32Bit(),
366 J->getType()->getScalarType()) &&
362367 (J->getOpcode() == Instruction::UDiv ||
363368 J->getOpcode() == Instruction::SDiv ||
364369 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