mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-21 02:24:22 +00:00
In InstCombine{AddSub,MulDivRem} convert APFloat.isFiniteNonZero() && !APFloat.isDenormal => APFloat.isNormal.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185037 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -488,7 +488,7 @@ Value *FAddCombine::performFactorization(Instruction *I) {
|
|||||||
createFSub(AddSub0, AddSub1);
|
createFSub(AddSub0, AddSub1);
|
||||||
if (ConstantFP *CFP = dyn_cast<ConstantFP>(NewAddSub)) {
|
if (ConstantFP *CFP = dyn_cast<ConstantFP>(NewAddSub)) {
|
||||||
const APFloat &F = CFP->getValueAPF();
|
const APFloat &F = CFP->getValueAPF();
|
||||||
if (!F.isFiniteNonZero() || F.isDenormal())
|
if (!F.isNormal())
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -344,7 +344,7 @@ static bool isFMulOrFDivWithConstant(Value *V) {
|
|||||||
|
|
||||||
static bool isNormalFp(const ConstantFP *C) {
|
static bool isNormalFp(const ConstantFP *C) {
|
||||||
const APFloat &Flt = C->getValueAPF();
|
const APFloat &Flt = C->getValueAPF();
|
||||||
return Flt.isFiniteNonZero() && !Flt.isDenormal();
|
return Flt.isNormal();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// foldFMulConst() is a helper routine of InstCombiner::visitFMul().
|
/// foldFMulConst() is a helper routine of InstCombiner::visitFMul().
|
||||||
@ -893,14 +893,14 @@ Instruction *InstCombiner::visitFDiv(BinaryOperator &I) {
|
|||||||
//
|
//
|
||||||
Constant *C = ConstantExpr::getFDiv(C1, C2);
|
Constant *C = ConstantExpr::getFDiv(C1, C2);
|
||||||
const APFloat &F = cast<ConstantFP>(C)->getValueAPF();
|
const APFloat &F = cast<ConstantFP>(C)->getValueAPF();
|
||||||
if (F.isFiniteNonZero() && !F.isDenormal())
|
if (F.isNormal())
|
||||||
Res = BinaryOperator::CreateFMul(X, C);
|
Res = BinaryOperator::CreateFMul(X, C);
|
||||||
} else if (match(Op0, m_FDiv(m_Value(X), m_ConstantFP(C1)))) {
|
} else if (match(Op0, m_FDiv(m_Value(X), m_ConstantFP(C1)))) {
|
||||||
// (X/C1)/C2 => X /(C2*C1) [=> X * 1/(C2*C1) if reciprocal is allowed]
|
// (X/C1)/C2 => X /(C2*C1) [=> X * 1/(C2*C1) if reciprocal is allowed]
|
||||||
//
|
//
|
||||||
Constant *C = ConstantExpr::getFMul(C1, C2);
|
Constant *C = ConstantExpr::getFMul(C1, C2);
|
||||||
const APFloat &F = cast<ConstantFP>(C)->getValueAPF();
|
const APFloat &F = cast<ConstantFP>(C)->getValueAPF();
|
||||||
if (F.isFiniteNonZero() && !F.isDenormal()) {
|
if (F.isNormal()) {
|
||||||
Res = CvtFDivConstToReciprocal(X, cast<ConstantFP>(C),
|
Res = CvtFDivConstToReciprocal(X, cast<ConstantFP>(C),
|
||||||
AllowReciprocal);
|
AllowReciprocal);
|
||||||
if (!Res)
|
if (!Res)
|
||||||
@ -941,7 +941,7 @@ Instruction *InstCombiner::visitFDiv(BinaryOperator &I) {
|
|||||||
|
|
||||||
if (Fold) {
|
if (Fold) {
|
||||||
const APFloat &FoldC = cast<ConstantFP>(Fold)->getValueAPF();
|
const APFloat &FoldC = cast<ConstantFP>(Fold)->getValueAPF();
|
||||||
if (FoldC.isFiniteNonZero() && !FoldC.isDenormal()) {
|
if (FoldC.isNormal()) {
|
||||||
Instruction *R = CreateDiv ?
|
Instruction *R = CreateDiv ?
|
||||||
BinaryOperator::CreateFDiv(Fold, X) :
|
BinaryOperator::CreateFDiv(Fold, X) :
|
||||||
BinaryOperator::CreateFMul(X, Fold);
|
BinaryOperator::CreateFMul(X, Fold);
|
||||||
|
Reference in New Issue
Block a user