Index: cfe/trunk/lib/Basic/Targets/Mips.h =================================================================== --- cfe/trunk/lib/Basic/Targets/Mips.h +++ cfe/trunk/lib/Basic/Targets/Mips.h @@ -77,7 +77,7 @@ Triple.getOS() == llvm::Triple::OpenBSD; } - bool isNaN2008Default() const { + bool isIEEE754_2008Default() const { return CPU == "mips32r6" || CPU == "mips64r6"; } @@ -299,7 +299,7 @@ DiagnosticsEngine &Diags) override { IsMips16 = false; IsMicromips = false; - IsNan2008 = isNaN2008Default(); + IsNan2008 = isIEEE754_2008Default(); IsSingleFloat = false; FloatABI = HardFloat; DspRev = NoDSP; Index: cfe/trunk/lib/Driver/ToolChains/Arch/Mips.h =================================================================== --- cfe/trunk/lib/Driver/ToolChains/Arch/Mips.h +++ cfe/trunk/lib/Driver/ToolChains/Arch/Mips.h @@ -24,7 +24,7 @@ bool isMipsArch(llvm::Triple::ArchType Arch); namespace mips { -typedef enum { NanLegacy = 1, Nan2008 = 2 } NanEncoding; +typedef enum { Legacy = 1, Std2008 = 2 } IEEE754Standard; enum class FloatABI { Invalid, @@ -32,7 +32,7 @@ Hard, }; -NanEncoding getSupportedNanEncoding(StringRef &CPU); +IEEE754Standard getIEEE754Standard(StringRef &CPU); bool hasCompactBranches(StringRef &CPU); void getMipsCPUAndABI(const llvm::opt::ArgList &Args, const llvm::Triple &Triple, StringRef &CPUName, Index: cfe/trunk/lib/Driver/ToolChains/Arch/Mips.cpp =================================================================== --- cfe/trunk/lib/Driver/ToolChains/Arch/Mips.cpp +++ cfe/trunk/lib/Driver/ToolChains/Arch/Mips.cpp @@ -265,14 +265,14 @@ if (Arg *A = Args.getLastArg(options::OPT_mnan_EQ)) { StringRef Val = StringRef(A->getValue()); if (Val == "2008") { - if (mips::getSupportedNanEncoding(CPUName) & mips::Nan2008) + if (mips::getIEEE754Standard(CPUName) & mips::Std2008) Features.push_back("+nan2008"); else { Features.push_back("-nan2008"); D.Diag(diag::warn_target_unsupported_nan2008) << CPUName; } } else if (Val == "legacy") { - if (mips::getSupportedNanEncoding(CPUName) & mips::NanLegacy) + if (mips::getIEEE754Standard(CPUName) & mips::Legacy) Features.push_back("-nan2008"); else { Features.push_back("+nan2008"); @@ -323,27 +323,28 @@ AddTargetFeature(Args, Features, options::OPT_mmt, options::OPT_mno_mt, "mt"); } -mips::NanEncoding mips::getSupportedNanEncoding(StringRef &CPU) { - // Strictly speaking, mips32r2 and mips64r2 are NanLegacy-only since Nan2008 - // was first introduced in Release 3. However, other compilers have - // traditionally allowed it for Release 2 so we should do the same. - return (NanEncoding)llvm::StringSwitch(CPU) - .Case("mips1", NanLegacy) - .Case("mips2", NanLegacy) - .Case("mips3", NanLegacy) - .Case("mips4", NanLegacy) - .Case("mips5", NanLegacy) - .Case("mips32", NanLegacy) - .Case("mips32r2", NanLegacy | Nan2008) - .Case("mips32r3", NanLegacy | Nan2008) - .Case("mips32r5", NanLegacy | Nan2008) - .Case("mips32r6", Nan2008) - .Case("mips64", NanLegacy) - .Case("mips64r2", NanLegacy | Nan2008) - .Case("mips64r3", NanLegacy | Nan2008) - .Case("mips64r5", NanLegacy | Nan2008) - .Case("mips64r6", Nan2008) - .Default(NanLegacy); +mips::IEEE754Standard mips::getIEEE754Standard(StringRef &CPU) { + // Strictly speaking, mips32r2 and mips64r2 do not conform to the + // IEEE754-2008 standard. Support for this standard was first introduced + // in Release 3. However, other compilers have traditionally allowed it + // for Release 2 so we should do the same. + return (IEEE754Standard)llvm::StringSwitch(CPU) + .Case("mips1", Legacy) + .Case("mips2", Legacy) + .Case("mips3", Legacy) + .Case("mips4", Legacy) + .Case("mips5", Legacy) + .Case("mips32", Legacy) + .Case("mips32r2", Legacy | Std2008) + .Case("mips32r3", Legacy | Std2008) + .Case("mips32r5", Legacy | Std2008) + .Case("mips32r6", Std2008) + .Case("mips64", Legacy) + .Case("mips64r2", Legacy | Std2008) + .Case("mips64r3", Legacy | Std2008) + .Case("mips64r5", Legacy | Std2008) + .Case("mips64r6", Std2008) + .Default(Std2008); } bool mips::hasCompactBranches(StringRef &CPU) {