Commit 566690b0 authored by Jay Foad's avatar Jay Foad
Browse files

[APFloat] Remove BitWidth argument from getAllOnesValue

There's no need to pass this in explicitly because it is
trivially available from the semantics.
parent 45f97950
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -17208,8 +17208,7 @@ static bool actOnOMPReductionKindClause(
          Type = ComplexTy->getElementType();
        if (Type->isRealFloatingType()) {
          llvm::APFloat InitValue = llvm::APFloat::getAllOnesValue(
              Context.getFloatTypeSemantics(Type),
              Context.getTypeSize(Type));
              Context.getFloatTypeSemantics(Type));
          Init = FloatingLiteral::Create(Context, InitValue, /*isexact=*/true,
                                         Type, ELoc);
        } else if (Type->isScalarType()) {
+1 −3
Original line number Diff line number Diff line
@@ -961,9 +961,7 @@ public:
  /// Returns a float which is bitcasted from an all one value int.
  ///
  /// \param Semantics - type float semantics
  /// \param BitWidth - Select float type
  static APFloat getAllOnesValue(const fltSemantics &Semantics,
                                 unsigned BitWidth);
  static APFloat getAllOnesValue(const fltSemantics &Semantics);

  /// Used to insert APFloat objects, or objects that contain APFloat objects,
  /// into FoldingSets.
+1 −2
Original line number Diff line number Diff line
@@ -408,8 +408,7 @@ Constant *Constant::getAllOnesValue(Type *Ty) {
                            APInt::getAllOnes(ITy->getBitWidth()));

  if (Ty->isFloatingPointTy()) {
    APFloat FL = APFloat::getAllOnesValue(Ty->getFltSemantics(),
                                          Ty->getPrimitiveSizeInBits());
    APFloat FL = APFloat::getAllOnesValue(Ty->getFltSemantics());
    return ConstantFP::get(Ty->getContext(), FL);
  }

+2 −3
Original line number Diff line number Diff line
@@ -4864,9 +4864,8 @@ APFloat::opStatus APFloat::convert(const fltSemantics &ToSemantics,
  llvm_unreachable("Unexpected semantics");
}

APFloat APFloat::getAllOnesValue(const fltSemantics &Semantics,
                                 unsigned BitWidth) {
  return APFloat(Semantics, APInt::getAllOnes(BitWidth));
APFloat APFloat::getAllOnesValue(const fltSemantics &Semantics) {
  return APFloat(Semantics, APInt::getAllOnes(Semantics.sizeInBits));
}

void APFloat::print(raw_ostream &OS) const {
+2 −2
Original line number Diff line number Diff line
@@ -12204,8 +12204,8 @@ static SDValue lowerShuffleAsBitMask(const SDLoc &DL, MVT VT, SDValue V1,
  MVT LogicVT = VT;
  if (EltVT == MVT::f32 || EltVT == MVT::f64) {
    Zero = DAG.getConstantFP(0.0, DL, EltVT);
    APFloat AllOnesValue = APFloat::getAllOnesValue(
        SelectionDAG::EVTToAPFloatSemantics(EltVT), EltVT.getSizeInBits());
    APFloat AllOnesValue =
        APFloat::getAllOnesValue(SelectionDAG::EVTToAPFloatSemantics(EltVT));
    AllOnes = DAG.getConstantFP(AllOnesValue, DL, EltVT);
    LogicVT =
        MVT::getVectorVT(EltVT == MVT::f64 ? MVT::i64 : MVT::i32, Mask.size());