Loading llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp +4 −5 Original line number Diff line number Diff line Loading @@ -886,15 +886,14 @@ Instruction *InstCombinerImpl::visitCallInst(CallInst &CI) { case Intrinsic::powi: if (ConstantInt *Power = dyn_cast<ConstantInt>(II->getArgOperand(1))) { // 0 and 1 are handled in instsimplify // powi(x, -1) -> 1/x if (Power->isMinusOne()) return BinaryOperator::CreateFDiv(ConstantFP::get(CI.getType(), 1.0), II->getArgOperand(0)); return BinaryOperator::CreateFDivFMF(ConstantFP::get(CI.getType(), 1.0), II->getArgOperand(0), II); // powi(x, 2) -> x*x if (Power->equalsInt(2)) return BinaryOperator::CreateFMul(II->getArgOperand(0), II->getArgOperand(0)); return BinaryOperator::CreateFMulFMF(II->getArgOperand(0), II->getArgOperand(0), II); } break; Loading llvm/test/Transforms/InstCombine/intrinsics.ll +2 −2 Original line number Diff line number Diff line Loading @@ -22,9 +22,9 @@ declare double @llvm.nearbyint.f64(double %Val) nounwind readonly define void @powi(double %V, double *%P) { ; CHECK-LABEL: @powi( ; CHECK-NEXT: [[A:%.*]] = fdiv double 1.000000e+00, [[V:%.*]] ; CHECK-NEXT: [[A:%.*]] = fdiv fast double 1.000000e+00, [[V:%.*]] ; CHECK-NEXT: store volatile double [[A]], double* [[P:%.*]], align 8 ; CHECK-NEXT: [[D:%.*]] = fmul double [[V]], [[V]] ; CHECK-NEXT: [[D:%.*]] = fmul nnan double [[V]], [[V]] ; CHECK-NEXT: store volatile double [[D]], double* [[P]], align 8 ; CHECK-NEXT: ret void ; Loading Loading
llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp +4 −5 Original line number Diff line number Diff line Loading @@ -886,15 +886,14 @@ Instruction *InstCombinerImpl::visitCallInst(CallInst &CI) { case Intrinsic::powi: if (ConstantInt *Power = dyn_cast<ConstantInt>(II->getArgOperand(1))) { // 0 and 1 are handled in instsimplify // powi(x, -1) -> 1/x if (Power->isMinusOne()) return BinaryOperator::CreateFDiv(ConstantFP::get(CI.getType(), 1.0), II->getArgOperand(0)); return BinaryOperator::CreateFDivFMF(ConstantFP::get(CI.getType(), 1.0), II->getArgOperand(0), II); // powi(x, 2) -> x*x if (Power->equalsInt(2)) return BinaryOperator::CreateFMul(II->getArgOperand(0), II->getArgOperand(0)); return BinaryOperator::CreateFMulFMF(II->getArgOperand(0), II->getArgOperand(0), II); } break; Loading
llvm/test/Transforms/InstCombine/intrinsics.ll +2 −2 Original line number Diff line number Diff line Loading @@ -22,9 +22,9 @@ declare double @llvm.nearbyint.f64(double %Val) nounwind readonly define void @powi(double %V, double *%P) { ; CHECK-LABEL: @powi( ; CHECK-NEXT: [[A:%.*]] = fdiv double 1.000000e+00, [[V:%.*]] ; CHECK-NEXT: [[A:%.*]] = fdiv fast double 1.000000e+00, [[V:%.*]] ; CHECK-NEXT: store volatile double [[A]], double* [[P:%.*]], align 8 ; CHECK-NEXT: [[D:%.*]] = fmul double [[V]], [[V]] ; CHECK-NEXT: [[D:%.*]] = fmul nnan double [[V]], [[V]] ; CHECK-NEXT: store volatile double [[D]], double* [[P]], align 8 ; CHECK-NEXT: ret void ; Loading