mirror of
https://github.com/RPCS3/llvm.git
synced 2026-07-19 15:13:49 -04:00
[APFloat] Remove 'else' after return. NFC
Reviewers: kbarton, iteratee, hfinkel, echristo Subscribers: mehdi_amini, llvm-commits Differential Revision: https://reviews.llvm.org/D27934 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290232 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
+45
-51
@@ -671,41 +671,49 @@ class APFloat : public APFloatBase {
|
||||
Storage(const fltSemantics &Semantics, ArgTypes &&... Args) {
|
||||
if (usesLayout<IEEEFloat>(Semantics)) {
|
||||
new (&IEEE) IEEEFloat(Semantics, std::forward<ArgTypes>(Args)...);
|
||||
} else if (usesLayout<DoubleAPFloat>(Semantics)) {
|
||||
new (&Double) DoubleAPFloat(Semantics, std::forward<ArgTypes>(Args)...);
|
||||
} else {
|
||||
llvm_unreachable("Unexpected semantics");
|
||||
return;
|
||||
}
|
||||
if (usesLayout<DoubleAPFloat>(Semantics)) {
|
||||
new (&Double) DoubleAPFloat(Semantics, std::forward<ArgTypes>(Args)...);
|
||||
return;
|
||||
}
|
||||
llvm_unreachable("Unexpected semantics");
|
||||
}
|
||||
|
||||
~Storage() {
|
||||
if (usesLayout<IEEEFloat>(*semantics)) {
|
||||
IEEE.~IEEEFloat();
|
||||
} else if (usesLayout<DoubleAPFloat>(*semantics)) {
|
||||
Double.~DoubleAPFloat();
|
||||
} else {
|
||||
llvm_unreachable("Unexpected semantics");
|
||||
return;
|
||||
}
|
||||
if (usesLayout<DoubleAPFloat>(*semantics)) {
|
||||
Double.~DoubleAPFloat();
|
||||
return;
|
||||
}
|
||||
llvm_unreachable("Unexpected semantics");
|
||||
}
|
||||
|
||||
Storage(const Storage &RHS) {
|
||||
if (usesLayout<IEEEFloat>(*RHS.semantics)) {
|
||||
new (this) IEEEFloat(RHS.IEEE);
|
||||
} else if (usesLayout<DoubleAPFloat>(*RHS.semantics)) {
|
||||
new (this) DoubleAPFloat(RHS.Double);
|
||||
} else {
|
||||
llvm_unreachable("Unexpected semantics");
|
||||
return;
|
||||
}
|
||||
if (usesLayout<DoubleAPFloat>(*RHS.semantics)) {
|
||||
new (this) DoubleAPFloat(RHS.Double);
|
||||
return;
|
||||
}
|
||||
llvm_unreachable("Unexpected semantics");
|
||||
}
|
||||
|
||||
Storage(Storage &&RHS) {
|
||||
if (usesLayout<IEEEFloat>(*RHS.semantics)) {
|
||||
new (this) IEEEFloat(std::move(RHS.IEEE));
|
||||
} else if (usesLayout<DoubleAPFloat>(*RHS.semantics)) {
|
||||
new (this) DoubleAPFloat(std::move(RHS.Double));
|
||||
} else {
|
||||
llvm_unreachable("Unexpected semantics");
|
||||
return;
|
||||
}
|
||||
if (usesLayout<DoubleAPFloat>(*RHS.semantics)) {
|
||||
new (this) DoubleAPFloat(std::move(RHS.Double));
|
||||
return;
|
||||
}
|
||||
llvm_unreachable("Unexpected semantics");
|
||||
}
|
||||
|
||||
Storage &operator=(const Storage &RHS) {
|
||||
@@ -747,35 +755,29 @@ class APFloat : public APFloatBase {
|
||||
}
|
||||
|
||||
IEEEFloat &getIEEE() {
|
||||
if (usesLayout<IEEEFloat>(*U.semantics)) {
|
||||
if (usesLayout<IEEEFloat>(*U.semantics))
|
||||
return U.IEEE;
|
||||
} else if (usesLayout<DoubleAPFloat>(*U.semantics)) {
|
||||
if (usesLayout<DoubleAPFloat>(*U.semantics))
|
||||
return U.Double.getFirst().U.IEEE;
|
||||
} else {
|
||||
llvm_unreachable("Unexpected semantics");
|
||||
}
|
||||
llvm_unreachable("Unexpected semantics");
|
||||
}
|
||||
|
||||
const IEEEFloat &getIEEE() const {
|
||||
if (usesLayout<IEEEFloat>(*U.semantics)) {
|
||||
if (usesLayout<IEEEFloat>(*U.semantics))
|
||||
return U.IEEE;
|
||||
} else if (usesLayout<DoubleAPFloat>(*U.semantics)) {
|
||||
if (usesLayout<DoubleAPFloat>(*U.semantics))
|
||||
return U.Double.getFirst().U.IEEE;
|
||||
} else {
|
||||
llvm_unreachable("Unexpected semantics");
|
||||
}
|
||||
llvm_unreachable("Unexpected semantics");
|
||||
}
|
||||
|
||||
void makeZero(bool Neg) { getIEEE().makeZero(Neg); }
|
||||
|
||||
void makeInf(bool Neg) {
|
||||
if (usesLayout<IEEEFloat>(*U.semantics)) {
|
||||
if (usesLayout<IEEEFloat>(*U.semantics))
|
||||
return U.IEEE.makeInf(Neg);
|
||||
} else if (usesLayout<DoubleAPFloat>(*U.semantics)) {
|
||||
if (usesLayout<DoubleAPFloat>(*U.semantics))
|
||||
return U.Double.makeInf(Neg);
|
||||
} else {
|
||||
llvm_unreachable("Unexpected semantics");
|
||||
}
|
||||
llvm_unreachable("Unexpected semantics");
|
||||
}
|
||||
|
||||
void makeNaN(bool SNaN, bool Neg, const APInt *fill) {
|
||||
@@ -803,13 +805,11 @@ class APFloat : public APFloatBase {
|
||||
|
||||
cmpResult compareAbsoluteValue(const APFloat &RHS) const {
|
||||
assert(&getSemantics() == &RHS.getSemantics());
|
||||
if (usesLayout<IEEEFloat>(getSemantics())) {
|
||||
if (usesLayout<IEEEFloat>(getSemantics()))
|
||||
return U.IEEE.compareAbsoluteValue(RHS.U.IEEE);
|
||||
} else if (usesLayout<DoubleAPFloat>(getSemantics())) {
|
||||
if (usesLayout<DoubleAPFloat>(getSemantics()))
|
||||
return U.Double.compareAbsoluteValue(RHS.U.Double);
|
||||
} else {
|
||||
llvm_unreachable("Unexpected semantics");
|
||||
}
|
||||
llvm_unreachable("Unexpected semantics");
|
||||
}
|
||||
|
||||
public:
|
||||
@@ -828,13 +828,11 @@ public:
|
||||
~APFloat() = default;
|
||||
|
||||
bool needsCleanup() const {
|
||||
if (usesLayout<IEEEFloat>(getSemantics())) {
|
||||
if (usesLayout<IEEEFloat>(getSemantics()))
|
||||
return U.IEEE.needsCleanup();
|
||||
} else if (usesLayout<DoubleAPFloat>(getSemantics())) {
|
||||
if (usesLayout<DoubleAPFloat>(getSemantics()))
|
||||
return U.Double.needsCleanup();
|
||||
} else {
|
||||
llvm_unreachable("Unexpected semantics");
|
||||
}
|
||||
llvm_unreachable("Unexpected semantics");
|
||||
}
|
||||
|
||||
/// Factory for Positive and Negative Zero.
|
||||
@@ -925,22 +923,18 @@ public:
|
||||
void Profile(FoldingSetNodeID &NID) const { getIEEE().Profile(NID); }
|
||||
|
||||
opStatus add(const APFloat &RHS, roundingMode RM) {
|
||||
if (usesLayout<IEEEFloat>(getSemantics())) {
|
||||
if (usesLayout<IEEEFloat>(getSemantics()))
|
||||
return U.IEEE.add(RHS.U.IEEE, RM);
|
||||
} else if (usesLayout<DoubleAPFloat>(getSemantics())) {
|
||||
if (usesLayout<DoubleAPFloat>(getSemantics()))
|
||||
return U.Double.add(RHS.U.Double, RM);
|
||||
} else {
|
||||
llvm_unreachable("Unexpected semantics");
|
||||
}
|
||||
llvm_unreachable("Unexpected semantics");
|
||||
}
|
||||
opStatus subtract(const APFloat &RHS, roundingMode RM) {
|
||||
if (usesLayout<IEEEFloat>(getSemantics())) {
|
||||
if (usesLayout<IEEEFloat>(getSemantics()))
|
||||
return U.IEEE.subtract(RHS.U.IEEE, RM);
|
||||
} else if (usesLayout<DoubleAPFloat>(getSemantics())) {
|
||||
if (usesLayout<DoubleAPFloat>(getSemantics()))
|
||||
return U.Double.subtract(RHS.U.Double, RM);
|
||||
} else {
|
||||
llvm_unreachable("Unexpected semantics");
|
||||
}
|
||||
llvm_unreachable("Unexpected semantics");
|
||||
}
|
||||
opStatus multiply(const APFloat &RHS, roundingMode RM) {
|
||||
return getIEEE().multiply(RHS.getIEEE(), RM);
|
||||
|
||||
+15
-13
@@ -4110,13 +4110,15 @@ void DoubleAPFloat::makeNaN(bool SNaN, bool Neg, const APInt *fill) {
|
||||
APFloat::Storage::Storage(IEEEFloat F, const fltSemantics &Semantics) {
|
||||
if (usesLayout<IEEEFloat>(Semantics)) {
|
||||
new (&IEEE) IEEEFloat(std::move(F));
|
||||
} else if (usesLayout<DoubleAPFloat>(Semantics)) {
|
||||
return;
|
||||
}
|
||||
if (usesLayout<DoubleAPFloat>(Semantics)) {
|
||||
new (&Double)
|
||||
DoubleAPFloat(Semantics, APFloat(std::move(F), F.getSemantics()),
|
||||
APFloat(semIEEEdouble));
|
||||
} else {
|
||||
llvm_unreachable("Unexpected semantics");
|
||||
return;
|
||||
}
|
||||
llvm_unreachable("Unexpected semantics");
|
||||
}
|
||||
|
||||
APFloat::opStatus APFloat::convertFromString(StringRef Str, roundingMode RM) {
|
||||
@@ -4135,24 +4137,24 @@ APFloat::opStatus APFloat::convert(const fltSemantics &ToSemantics,
|
||||
if (&getSemantics() == &ToSemantics)
|
||||
return opOK;
|
||||
if (usesLayout<IEEEFloat>(getSemantics()) &&
|
||||
usesLayout<IEEEFloat>(ToSemantics)) {
|
||||
usesLayout<IEEEFloat>(ToSemantics))
|
||||
return U.IEEE.convert(ToSemantics, RM, losesInfo);
|
||||
} else if (usesLayout<IEEEFloat>(getSemantics()) &&
|
||||
usesLayout<DoubleAPFloat>(ToSemantics)) {
|
||||
if (usesLayout<IEEEFloat>(getSemantics()) &&
|
||||
usesLayout<DoubleAPFloat>(ToSemantics)) {
|
||||
assert(&ToSemantics == &semPPCDoubleDouble);
|
||||
auto Ret = U.IEEE.convert(semPPCDoubleDoubleImpl, RM, losesInfo);
|
||||
*this = APFloat(
|
||||
DoubleAPFloat(semPPCDoubleDouble, std::move(*this), APFloat(semIEEEdouble)),
|
||||
ToSemantics);
|
||||
*this = APFloat(DoubleAPFloat(semPPCDoubleDouble, std::move(*this),
|
||||
APFloat(semIEEEdouble)),
|
||||
ToSemantics);
|
||||
return Ret;
|
||||
} else if (usesLayout<DoubleAPFloat>(getSemantics()) &&
|
||||
usesLayout<IEEEFloat>(ToSemantics)) {
|
||||
}
|
||||
if (usesLayout<DoubleAPFloat>(getSemantics()) &&
|
||||
usesLayout<IEEEFloat>(ToSemantics)) {
|
||||
auto Ret = getIEEE().convert(ToSemantics, RM, losesInfo);
|
||||
*this = APFloat(std::move(getIEEE()), ToSemantics);
|
||||
return Ret;
|
||||
} else {
|
||||
llvm_unreachable("Unexpected semantics");
|
||||
}
|
||||
llvm_unreachable("Unexpected semantics");
|
||||
}
|
||||
|
||||
APFloat APFloat::getAllOnesValue(unsigned BitWidth, bool isIEEE) {
|
||||
|
||||
Reference in New Issue
Block a user