forked from OSchip/llvm-project
[PowerPC] Disable the CTR optimization in the presence of {min,max}num
The minnum and maxnum intrinsics get lowered to libcalls which invalidates the CTR optimization. This fixes PR27083. llvm-svn: 264508
This commit is contained in:
parent
9a5f19f509
commit
b549ab02b4
|
@ -291,6 +291,8 @@ bool PPCCTRLoops::mightUseCTR(const Triple &TT, BasicBlock *BB) {
|
|||
case Intrinsic::pow:
|
||||
case Intrinsic::sin:
|
||||
case Intrinsic::cos:
|
||||
case Intrinsic::maxnum:
|
||||
case Intrinsic::minnum:
|
||||
return true;
|
||||
case Intrinsic::copysign:
|
||||
if (CI->getArgOperand(0)->getType()->getScalarType()->
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
; RUN: llc < %s | FileCheck %s
|
||||
target triple = "powerpc64le-unknown-linux-gnu"
|
||||
|
||||
define void @test1(float %f, float* %fp) {
|
||||
entry:
|
||||
br label %loop_body
|
||||
|
||||
loop_body:
|
||||
%invar_address.dim.0.01 = phi i64 [ 0, %entry ], [ %1, %loop_body ]
|
||||
%0 = call float @llvm.minnum.f32(float %f, float 1.0)
|
||||
store float %0, float* %fp, align 4
|
||||
%1 = add i64 %invar_address.dim.0.01, 1
|
||||
%2 = icmp eq i64 %1, 2
|
||||
br i1 %2, label %loop_exit, label %loop_body
|
||||
|
||||
loop_exit:
|
||||
ret void
|
||||
}
|
||||
|
||||
; CHECK-LABEL: test1:
|
||||
; CHECK: bl fminf
|
||||
|
||||
|
||||
define void @test2(float %f, float* %fp) {
|
||||
entry:
|
||||
br label %loop_body
|
||||
|
||||
loop_body:
|
||||
%invar_address.dim.0.01 = phi i64 [ 0, %entry ], [ %1, %loop_body ]
|
||||
%0 = call float @llvm.maxnum.f32(float %f, float 1.0)
|
||||
store float %0, float* %fp, align 4
|
||||
%1 = add i64 %invar_address.dim.0.01, 1
|
||||
%2 = icmp eq i64 %1, 2
|
||||
br i1 %2, label %loop_exit, label %loop_body
|
||||
|
||||
loop_exit:
|
||||
ret void
|
||||
}
|
||||
|
||||
; CHECK-LABEL: test2:
|
||||
; CHECK: bl fmaxf
|
||||
|
||||
declare float @llvm.minnum.f32(float, float)
|
||||
declare float @llvm.maxnum.f32(float, float)
|
Loading…
Reference in New Issue