forked from OSchip/llvm-project
[InstCombine] use getFltSemantics() instead of duplicating it; NFC
llvm-svn: 345613
This commit is contained in:
parent
5a8fd65700
commit
68a61cb07c
|
@ -5368,33 +5368,17 @@ Instruction *InstCombiner::visitFCmpInst(FCmpInst &I) {
|
|||
if (!RHSF)
|
||||
break;
|
||||
|
||||
const fltSemantics *Sem;
|
||||
// FIXME: This shouldn't be here.
|
||||
if (LHSExt->getSrcTy()->isHalfTy())
|
||||
Sem = &APFloat::IEEEhalf();
|
||||
else if (LHSExt->getSrcTy()->isFloatTy())
|
||||
Sem = &APFloat::IEEEsingle();
|
||||
else if (LHSExt->getSrcTy()->isDoubleTy())
|
||||
Sem = &APFloat::IEEEdouble();
|
||||
else if (LHSExt->getSrcTy()->isFP128Ty())
|
||||
Sem = &APFloat::IEEEquad();
|
||||
else if (LHSExt->getSrcTy()->isX86_FP80Ty())
|
||||
Sem = &APFloat::x87DoubleExtended();
|
||||
else if (LHSExt->getSrcTy()->isPPC_FP128Ty())
|
||||
Sem = &APFloat::PPCDoubleDouble();
|
||||
else
|
||||
break;
|
||||
|
||||
const fltSemantics &FPSem = LHSExt->getSrcTy()->getFltSemantics();
|
||||
bool Lossy;
|
||||
APFloat F = RHSF->getValueAPF();
|
||||
F.convert(*Sem, APFloat::rmNearestTiesToEven, &Lossy);
|
||||
F.convert(FPSem, APFloat::rmNearestTiesToEven, &Lossy);
|
||||
|
||||
// Avoid lossy conversions and denormals. Zero is a special case
|
||||
// that's OK to convert.
|
||||
APFloat Fabs = F;
|
||||
Fabs.clearSign();
|
||||
if (!Lossy &&
|
||||
((Fabs.compare(APFloat::getSmallestNormalized(*Sem)) !=
|
||||
((Fabs.compare(APFloat::getSmallestNormalized(FPSem)) !=
|
||||
APFloat::cmpLessThan) || Fabs.isZero()))
|
||||
|
||||
return new FCmpInst(Pred, LHSExt->getOperand(0),
|
||||
|
|
Loading…
Reference in New Issue