Index: clang/lib/Basic/Targets/PPC.cpp =================================================================== --- clang/lib/Basic/Targets/PPC.cpp +++ clang/lib/Basic/Targets/PPC.cpp @@ -318,8 +318,12 @@ .Case("pwr8", true) .Default(false); Features["float128"] = llvm::StringSwitch(CPU) - .Case("pwr9", true) - .Default(false); + .Case("ppc64le", true) + .Case("pwr9", true) + .Case("pwr8", true) + .Case("pwr7", true) + .Case("pwr6", true) + .Default(false); Features["spe"] = llvm::StringSwitch(CPU) .Case("8548", true) @@ -343,13 +347,6 @@ if (!ppcUserFeaturesCheck(Diags, FeaturesVec)) return false; - if (!(ArchDefs & ArchDefinePwr9) && (ArchDefs & ArchDefinePpcgr) && - llvm::find(FeaturesVec, "+float128") != FeaturesVec.end()) { - // We have __float128 on PPC but not power 9 and above. - Diags.Report(diag::err_opt_not_valid_with_opt) << "-mfloat128" << CPU; - return false; - } - if (!(ArchDefs & ArchDefinePwr10) && llvm::find(FeaturesVec, "+mma") != FeaturesVec.end()) { // We have MMA on PPC but not power 10 and above. @@ -415,6 +412,8 @@ .Default(false); if (FeatureHasVSX) Features["vsx"] = Features["altivec"] = true; + if (FeatureHasVSX || Name == "altivec") + Features["float128"] = true; if (Name == "power9-vector") Features["power8-vector"] = true; else if (Name == "power10-vector") @@ -426,11 +425,12 @@ } else { // If we're disabling altivec or vsx go ahead and disable all of the vsx // features. + if (Name == "altivec") + Features["float128"] = false; if ((Name == "altivec") || (Name == "vsx")) Features["vsx"] = Features["direct-move"] = Features["power8-vector"] = - Features["float128"] = Features["power9-vector"] = - Features["paired-vector-memops"] = Features["mma"] = - Features["power10-vector"] = false; + Features["power9-vector"] = Features["paired-vector-memops"] = + Features["mma"] = Features["power10-vector"] = false; if (Name == "power8-vector") Features["power9-vector"] = Features["paired-vector-memops"] = Features["mma"] = Features["power10-vector"] = false; Index: clang/test/Driver/ppc-f128-support-check.c =================================================================== --- clang/test/Driver/ppc-f128-support-check.c +++ clang/test/Driver/ppc-f128-support-check.c @@ -2,19 +2,22 @@ // RUN: -mcpu=pwr9 %s 2>&1 | FileCheck %s --check-prefix=HASF128 // RUN: not %clang -target powerpc64le-unknown-linux-gnu -fsyntax-only \ // RUN: -mcpu=power9 %s 2>&1 | FileCheck %s --check-prefix=HASF128 - // RUN: not %clang -target powerpc64le-unknown-linux-gnu -fsyntax-only \ -// RUN: -mcpu=pwr8 -mfloat128 %s 2>&1 | FileCheck %s --check-prefix=NOF128 +// RUN: -mcpu=pwr8 %s 2>&1 | FileCheck %s --check-prefix=HASF128 +// RUN: not %clang -target powerpc64le-unknown-linux-gnu -fsyntax-only \ +// RUN: -mcpu=power8 %s 2>&1 | FileCheck %s --check-prefix=HASF128 +// RUN: not %clang -target powerpc64le-unknown-linux-gnu -fsyntax-only \ +// RUN: %s 2>&1 | FileCheck %s --check-prefix=HASF128 // RUN: not %clang -target powerpc64le-unknown-linux-gnu -fsyntax-only \ -// RUN: -mcpu=pwr7 -mfloat128 %s 2>&1 | FileCheck %s --check-prefix=NOF128 +// RUN: -mcpu=pwr7 %s 2>&1 | FileCheck %s --check-prefix=HASF128 // RUN: not %clang -target powerpc64le-unknown-linux-gnu -fsyntax-only \ -// RUN: -mfloat128 %s 2>&1 | FileCheck %s --check-prefix=NOF128 +// RUN: -mcpu=pwr6 %s 2>&1 | FileCheck %s --check-prefix=HASF128 + +// RUN: %clang -target powerpc64le-unknown-linux-gnu -fsyntax-only \ +// RUN: -mno-altivec %s 2>&1 #ifdef __FLOAT128__ static_assert(false, "__float128 enabled"); #endif // HASF128: __float128 enabled -// HASF128-NOT: option '-mfloat128' cannot be specified with -// NOF128: option '-mfloat128' cannot be specified with -