mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-19 19:12:56 +02:00
[instcombine] add powi(x, 2) -> x * x
llvm-svn: 321468
This commit is contained in:
parent
b32349127e
commit
85bd15a2b1
@ -1934,6 +1934,10 @@ Instruction *InstCombiner::visitCallInst(CallInst &CI) {
|
||||
if (Power->isMinusOne())
|
||||
return BinaryOperator::CreateFDiv(ConstantFP::get(CI.getType(), 1.0),
|
||||
II->getArgOperand(0));
|
||||
// powi(x, 2) -> x*x
|
||||
if (Power->equalsInt(2))
|
||||
return BinaryOperator::CreateFMul(II->getArgOperand(0),
|
||||
II->getArgOperand(0));
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -267,12 +267,17 @@ define void @powi(double %V, double *%P) {
|
||||
|
||||
%C = tail call double @llvm.powi.f64(double %V, i32 1) nounwind
|
||||
store volatile double %C, double* %P
|
||||
|
||||
%D = tail call double @llvm.powi.f64(double %V, i32 2) nounwind
|
||||
store volatile double %D, double* %P
|
||||
ret void
|
||||
; CHECK-LABEL: @powi(
|
||||
; CHECK: %A = fdiv double 1.0{{.*}}, %V
|
||||
; CHECK: store volatile double %A,
|
||||
; CHECK: store volatile double 1.0
|
||||
; CHECK: store volatile double %V
|
||||
; CHECK: %D = fmul double %V, %V
|
||||
; CHECK: store volatile double %D
|
||||
}
|
||||
|
||||
define i32 @cttz(i32 %a) {
|
||||
|
Loading…
Reference in New Issue
Block a user