From: Eric Christopher Date: Tue, 21 Mar 2017 22:06:18 +0000 (+0000) Subject: Remove the -faltivec alias option and replace it with -maltivec everywhere. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a776ed1122e48f9ade40c454678226303d8fab52;p=clang Remove the -faltivec alias option and replace it with -maltivec everywhere. The alias was only ever used on darwin and had some issues there, and isn't used in practice much. Also fixes a problem with -mno-altivec not turning off -maltivec. Also add a diagnostic for faltivec/fno-altivec that directs users to use maltivec options and include the altivec.h file explicitly. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298449 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/docs/ClangCommandLineReference.rst b/docs/ClangCommandLineReference.rst index c7aead921a..fb4c4a67bb 100644 --- a/docs/ClangCommandLineReference.rst +++ b/docs/ClangCommandLineReference.rst @@ -1053,7 +1053,7 @@ Enable C++17 aligned allocation functions .. option:: -fallow-unsupported -.. option:: -faltivec, -fno-altivec, -maltivec +.. option:: -maltivec, -mno-altivec Enable AltiVec vector initializer syntax diff --git a/docs/LanguageExtensions.rst b/docs/LanguageExtensions.rst index 164dfc585e..341359c25a 100644 --- a/docs/LanguageExtensions.rst +++ b/docs/LanguageExtensions.rst @@ -356,7 +356,7 @@ is: Query for this feature with ``__has_extension(attribute_ext_vector_type)``. -Giving ``-faltivec`` option to clang enables support for AltiVec vector syntax +Giving ``-maltivec`` option to clang enables support for AltiVec vector syntax and functions. For example: .. code-block:: c++ diff --git a/include/clang/Basic/DiagnosticDriverKinds.td b/include/clang/Basic/DiagnosticDriverKinds.td index ea597a8388..836b467740 100644 --- a/include/clang/Basic/DiagnosticDriverKinds.td +++ b/include/clang/Basic/DiagnosticDriverKinds.td @@ -85,6 +85,8 @@ def err_drv_clang_unsupported : Error< "the clang compiler does not support '%0'">; def err_drv_clang_unsupported_opt_cxx_darwin_i386 : Error< "the clang compiler does not support '%0' for C++ on Darwin/i386">; +def err_drv_clang_unsupported_opt_faltivec : Error< + "the clang compiler does not support '%0', %1">; def err_drv_command_failed : Error< "%0 command failed with exit code %1 (use -v to see invocation)">; def err_drv_compilationdatabase : Error< diff --git a/include/clang/Driver/Options.td b/include/clang/Driver/Options.td index 5eabfd278f..1660b3966d 100644 --- a/include/clang/Driver/Options.td +++ b/include/clang/Driver/Options.td @@ -1782,6 +1782,10 @@ def mamdgpu_debugger_abi : Joined<["-"], "mamdgpu-debugger-abi=">, HelpText<"Generate additional code for specified of debugger ABI (AMDGPU only)">, MetaVarName<"">; +def faltivec : Flag<["-"], "faltivec">, Group, Flags<[DriverOption]>; +def fno_altivec : Flag<["-"], "fno-altivec">, Group, Flags<[DriverOption]>; +def maltivec : Flag<["-"], "maltivec">, Group; +def mno_altivec : Flag<["-"], "mno-altivec">, Group; def mvsx : Flag<["-"], "mvsx">, Group; def mno_vsx : Flag<["-"], "mno-vsx">, Group; def mpower8_vector : Flag<["-"], "mpower8-vector">, @@ -1832,12 +1836,6 @@ def mlongcall: Flag<["-"], "mlongcall">, def mno_longcall : Flag<["-"], "mno-longcall">, Group; -def faltivec : Flag<["-"], "faltivec">, Group, Flags<[CC1Option]>, - HelpText<"Enable AltiVec vector initializer syntax">; -def fno_altivec : Flag<["-"], "fno-altivec">, Group, Flags<[CC1Option]>; -def maltivec : Flag<["-"], "maltivec">, Alias; -def mno_altivec : Flag<["-"], "mno-altivec">, Alias; - def mvx : Flag<["-"], "mvx">, Group; def mno_vx : Flag<["-"], "mno-vx">, Group; diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp index 5ae808836a..472a57b197 100644 --- a/lib/Basic/Targets.cpp +++ b/lib/Basic/Targets.cpp @@ -888,6 +888,7 @@ class PPCTargetInfo : public TargetInfo { std::string CPU; // Target cpu features. + bool HasAltivec; bool HasVSX; bool HasP8Vector; bool HasP8Crypto; @@ -903,7 +904,7 @@ protected: public: PPCTargetInfo(const llvm::Triple &Triple, const TargetOptions &) - : TargetInfo(Triple), HasVSX(false), HasP8Vector(false), + : TargetInfo(Triple), HasAltivec(false), HasVSX(false), HasP8Vector(false), HasP8Crypto(false), HasDirectMove(false), HasQPX(false), HasHTM(false), HasBPERMD(false), HasExtDiv(false), HasP9Vector(false) { SimdDefaultAlign = 128; @@ -1166,7 +1167,9 @@ const Builtin::Info PPCTargetInfo::BuiltinInfo[] = { bool PPCTargetInfo::handleTargetFeatures(std::vector &Features, DiagnosticsEngine &Diags) { for (const auto &Feature : Features) { - if (Feature == "+vsx") { + if (Feature == "+altivec") { + HasAltivec = true; + } else if (Feature == "+vsx") { HasVSX = true; } else if (Feature == "+bpermd") { HasBPERMD = true; @@ -1239,11 +1242,6 @@ void PPCTargetInfo::getTargetDefines(const LangOptions &Opts, (getTriple().getOS() == llvm::Triple::Darwin && PointerWidth == 64)) Builder.defineMacro("__STRUCT_PARM_ALIGN__", "16"); - if (Opts.AltiVec) { - Builder.defineMacro("__VEC__", "10206"); - Builder.defineMacro("__ALTIVEC__"); - } - // CPU identification. ArchDefineTypes defs = (ArchDefineTypes)llvm::StringSwitch(CPU) .Case("440", ArchDefineName) @@ -1350,6 +1348,10 @@ void PPCTargetInfo::getTargetDefines(const LangOptions &Opts, Builder.defineMacro("__TOS_BGQ__"); } + if (HasAltivec) { + Builder.defineMacro("__VEC__", "10206"); + Builder.defineMacro("__ALTIVEC__"); + } if (HasVSX) Builder.defineMacro("__VSX__"); if (HasP8Vector) @@ -1502,18 +1504,19 @@ bool PPCTargetInfo::initFeatureMap( bool PPCTargetInfo::hasFeature(StringRef Feature) const { return llvm::StringSwitch(Feature) - .Case("powerpc", true) - .Case("vsx", HasVSX) - .Case("power8-vector", HasP8Vector) - .Case("crypto", HasP8Crypto) - .Case("direct-move", HasDirectMove) - .Case("qpx", HasQPX) - .Case("htm", HasHTM) - .Case("bpermd", HasBPERMD) - .Case("extdiv", HasExtDiv) - .Case("float128", HasFloat128) - .Case("power9-vector", HasP9Vector) - .Default(false); + .Case("powerpc", true) + .Case("altivec", HasAltivec) + .Case("vsx", HasVSX) + .Case("power8-vector", HasP8Vector) + .Case("crypto", HasP8Crypto) + .Case("direct-move", HasDirectMove) + .Case("qpx", HasQPX) + .Case("htm", HasHTM) + .Case("bpermd", HasBPERMD) + .Case("extdiv", HasExtDiv) + .Case("float128", HasFloat128) + .Case("power9-vector", HasP9Vector) + .Default(false); } void PPCTargetInfo::setFeatureEnabled(llvm::StringMap &Features, diff --git a/lib/Driver/ToolChains/Arch/PPC.cpp b/lib/Driver/ToolChains/Arch/PPC.cpp index e83b4fe7f9..541323127f 100644 --- a/lib/Driver/ToolChains/Arch/PPC.cpp +++ b/lib/Driver/ToolChains/Arch/PPC.cpp @@ -94,10 +94,6 @@ void ppc::getPPCTargetFeatures(const Driver &D, const llvm::Triple &Triple, ppc::FloatABI FloatABI = ppc::getPPCFloatABI(D, Args); if (FloatABI == ppc::FloatABI::Soft) Features.push_back("-hard-float"); - - // Altivec is a bit weird, allow overriding of the Altivec feature here. - AddTargetFeature(Args, Features, options::OPT_faltivec, - options::OPT_fno_altivec, "altivec"); } ppc::FloatABI ppc::getPPCFloatABI(const Driver &D, const ArgList &Args) { diff --git a/lib/Driver/ToolChains/Clang.cpp b/lib/Driver/ToolChains/Clang.cpp index 06d782d296..17c860f88d 100644 --- a/lib/Driver/ToolChains/Clang.cpp +++ b/lib/Driver/ToolChains/Clang.cpp @@ -2644,6 +2644,14 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, D.Diag(diag::err_drv_clang_unsupported_opt_cxx_darwin_i386) << Unsupported->getOption().getName(); } + // The faltivec option has been superseded by the maltivec option. + if ((Unsupported = Args.getLastArg(options::OPT_faltivec))) + D.Diag(diag::err_drv_clang_unsupported_opt_faltivec) + << Unsupported->getOption().getName() + << "please use -maltivec and include altivec.h explicitly"; + if ((Unsupported = Args.getLastArg(options::OPT_fno_altivec))) + D.Diag(diag::err_drv_clang_unsupported_opt_faltivec) + << Unsupported->getOption().getName() << "please use -mno-altivec"; } Args.AddAllArgs(CmdArgs, options::OPT_v); @@ -3189,10 +3197,9 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, EmulatedTLSDefault)) CmdArgs.push_back("-femulated-tls"); // AltiVec-like language extensions aren't relevant for assembling. - if (!isa(JA) || Output.getType() != types::TY_PP_Asm) { - Args.AddLastArg(CmdArgs, options::OPT_faltivec); + if (!isa(JA) || Output.getType() != types::TY_PP_Asm) Args.AddLastArg(CmdArgs, options::OPT_fzvector); - } + Args.AddLastArg(CmdArgs, options::OPT_fdiagnostics_show_template_tree); Args.AddLastArg(CmdArgs, options::OPT_fno_elide_type); @@ -3230,21 +3237,6 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, const SanitizerArgs &Sanitize = getToolChain().getSanitizerArgs(); Sanitize.addArgs(getToolChain(), Args, CmdArgs, InputType); - // Report an error for -faltivec on anything other than PowerPC. - if (const Arg *A = Args.getLastArg(options::OPT_faltivec)) { - const llvm::Triple::ArchType Arch = getToolChain().getArch(); - if (!(Arch == llvm::Triple::ppc || Arch == llvm::Triple::ppc64 || - Arch == llvm::Triple::ppc64le)) - D.Diag(diag::err_drv_argument_only_allowed_with) << A->getAsString(Args) - << "ppc/ppc64/ppc64le"; - } - - // -fzvector is incompatible with -faltivec. - if (Arg *A = Args.getLastArg(options::OPT_fzvector)) - if (Args.hasArg(options::OPT_faltivec)) - D.Diag(diag::err_drv_argument_not_allowed_with) << A->getAsString(Args) - << "-faltivec"; - if (getToolChain().SupportsProfiling()) Args.AddLastArg(CmdArgs, options::OPT_pg); diff --git a/lib/Frontend/CompilerInstance.cpp b/lib/Frontend/CompilerInstance.cpp index f660429e49..e4a1be61fc 100644 --- a/lib/Frontend/CompilerInstance.cpp +++ b/lib/Frontend/CompilerInstance.cpp @@ -916,6 +916,12 @@ bool CompilerInstance::ExecuteAction(FrontendAction &Act) { if (!hasTarget()) return false; + // FIXME: Setting this here is less than ideal, but it is set based on a + // target option for compatibility and this is immediately after we construct + // a target. + if (getTarget().hasFeature("altivec")) + getLangOpts().AltiVec = 1; + // Create TargetInfo for the other side of CUDA compilation. if (getLangOpts().CUDA && !getFrontendOpts().AuxTriple.empty()) { auto TO = std::make_shared(); diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp index 4b6b17eb7e..01ac69efe4 100644 --- a/lib/Frontend/CompilerInvocation.cpp +++ b/lib/Frontend/CompilerInvocation.cpp @@ -1924,9 +1924,6 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK, if (Args.hasArg(OPT_fno_constant_cfstrings)) Opts.NoConstantCFStrings = 1; - if (Args.hasArg(OPT_faltivec)) - Opts.AltiVec = 1; - if (Args.hasArg(OPT_fzvector)) Opts.ZVector = 1; diff --git a/test/CodeGen/altivec.c b/test/CodeGen/altivec.c index 29823031b5..a4d38fa23b 100644 --- a/test/CodeGen/altivec.c +++ b/test/CodeGen/altivec.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -faltivec -triple powerpc-unknown-unknown -emit-llvm %s -o - | FileCheck %s +// RUN: %clang_cc1 -target-feature +altivec -triple powerpc-unknown-unknown -emit-llvm %s -o - | FileCheck %s // Check initialization diff --git a/test/CodeGen/builtins-ppc-altivec.c b/test/CodeGen/builtins-ppc-altivec.c index d54a69802f..99cf3c2538 100644 --- a/test/CodeGen/builtins-ppc-altivec.c +++ b/test/CodeGen/builtins-ppc-altivec.c @@ -1,9 +1,9 @@ // REQUIRES: powerpc-registered-target -// RUN: %clang_cc1 -faltivec -triple powerpc-unknown-unknown -emit-llvm %s \ +// RUN: %clang_cc1 -target-feature +altivec -triple powerpc-unknown-unknown -emit-llvm %s \ // RUN: -o - | FileCheck %s -// RUN: %clang_cc1 -faltivec -triple powerpc64-unknown-unknown -emit-llvm %s \ +// RUN: %clang_cc1 -target-feature +altivec -triple powerpc64-unknown-unknown -emit-llvm %s \ // RUN: -o - | FileCheck %s -// RUN: %clang_cc1 -faltivec -triple powerpc64le-unknown-unknown -emit-llvm %s \ +// RUN: %clang_cc1 -target-feature +altivec -triple powerpc64le-unknown-unknown -emit-llvm %s \ // RUN: -o - | FileCheck %s -check-prefix=CHECK-LE // RUN: not %clang_cc1 -triple powerpc64le-unknown-unknown -emit-llvm %s \ // RUN: -ferror-limit 0 -DNO_ALTIVEC -o - 2>&1 \ diff --git a/test/CodeGen/builtins-ppc-crypto-disabled.c b/test/CodeGen/builtins-ppc-crypto-disabled.c index e6a8a9337a..e0b9da0647 100644 --- a/test/CodeGen/builtins-ppc-crypto-disabled.c +++ b/test/CodeGen/builtins-ppc-crypto-disabled.c @@ -1,13 +1,13 @@ // REQUIRES: powerpc-registered-target -// RUN: not %clang_cc1 -faltivec -triple powerpc64le-unknown-unknown \ +// RUN: not %clang_cc1 -target-feature +altivec -triple powerpc64le-unknown-unknown \ // RUN: -target-cpu pwr8 -target-feature -crypto -emit-llvm %s -o - 2>&1 \ // RUN: | FileCheck %s -// RUN: not %clang_cc1 -faltivec -triple powerpc64-unknown-unknown \ +// RUN: not %clang_cc1 -target-feature +altivec -triple powerpc64-unknown-unknown \ // RUN: -target-cpu pwr8 -target-feature -crypto -emit-llvm %s -o - 2>&1 \ // RUN: | FileCheck %s -// RUN: not %clang_cc1 -faltivec -triple powerpc64-unknown-unknown \ +// RUN: not %clang_cc1 -target-feature +altivec -triple powerpc64-unknown-unknown \ // RUN: -target-cpu pwr8 -target-feature -power8-vector \ // RUN: -target-feature -crypto -emit-llvm %s -o - 2>&1 \ // RUN: | FileCheck %s -check-prefix=CHECK-P8V diff --git a/test/CodeGen/builtins-ppc-crypto.c b/test/CodeGen/builtins-ppc-crypto.c index eaf568b09f..04f06f4d67 100644 --- a/test/CodeGen/builtins-ppc-crypto.c +++ b/test/CodeGen/builtins-ppc-crypto.c @@ -1,9 +1,9 @@ // REQUIRES: powerpc-registered-target -// RUN: %clang_cc1 -faltivec -triple powerpc64le-unknown-unknown \ +// RUN: %clang_cc1 -target-feature +altivec -triple powerpc64le-unknown-unknown \ // RUN: -target-feature +crypto -target-feature +power8-vector \ // RUN: -emit-llvm %s -o - | FileCheck %s -// RUN: %clang_cc1 -faltivec -triple powerpc64-unknown-unknown \ +// RUN: %clang_cc1 -target-feature +altivec -triple powerpc64-unknown-unknown \ // RUN: -target-feature +crypto -target-feature +power8-vector \ // RUN: -emit-llvm %s -o - | FileCheck %s #include diff --git a/test/CodeGen/builtins-ppc-error.c b/test/CodeGen/builtins-ppc-error.c index 5860c4f9e7..e8d2a37a21 100644 --- a/test/CodeGen/builtins-ppc-error.c +++ b/test/CodeGen/builtins-ppc-error.c @@ -1,10 +1,10 @@ // REQUIRES: powerpc-registered-target -// RUN: %clang_cc1 -faltivec -target-feature +power9-vector \ +// RUN: %clang_cc1 -target-feature +altivec -target-feature +power9-vector \ // RUN: -triple powerpc64-unknown-unknown -fsyntax-only \ // RUN: -Wall -Werror -verify %s -// RUN: %clang_cc1 -faltivec -target-feature +power9-vector \ +// RUN: %clang_cc1 -target-feature +altivec -target-feature +power9-vector \ // RUN: -triple powerpc64le-unknown-unknown -fsyntax-only \ // RUN: -Wall -Werror -verify %s diff --git a/test/CodeGen/builtins-ppc-htm.c b/test/CodeGen/builtins-ppc-htm.c index 87baa77af8..d7e7a9148e 100644 --- a/test/CodeGen/builtins-ppc-htm.c +++ b/test/CodeGen/builtins-ppc-htm.c @@ -1,5 +1,5 @@ // REQUIRES: powerpc-registered-target -// RUN: %clang_cc1 -faltivec -target-feature +htm -triple powerpc64-unknown-unknown -emit-llvm %s -o - | FileCheck %s +// RUN: %clang_cc1 -target-feature +altivec -target-feature +htm -triple powerpc64-unknown-unknown -emit-llvm %s -o - | FileCheck %s void test1(long int *r, int code, long int *a, long int *b) { // CHECK-LABEL: define void @test1 diff --git a/test/CodeGen/builtins-ppc-p8vector.c b/test/CodeGen/builtins-ppc-p8vector.c index 97a663c2f2..9f2913847e 100644 --- a/test/CodeGen/builtins-ppc-p8vector.c +++ b/test/CodeGen/builtins-ppc-p8vector.c @@ -1,7 +1,7 @@ // REQUIRES: powerpc-registered-target -// RUN: %clang_cc1 -faltivec -target-feature +power8-vector -triple powerpc64-unknown-unknown -emit-llvm %s -o - | FileCheck %s -// RUN: %clang_cc1 -faltivec -target-feature +power8-vector -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s -check-prefix=CHECK-LE -// RUN: not %clang_cc1 -faltivec -target-feature +vsx -triple powerpc64-unknown-unknown -emit-llvm %s -o - 2>&1 | FileCheck %s -check-prefix=CHECK-PPC +// RUN: %clang_cc1 -target-feature +altivec -target-feature +power8-vector -triple powerpc64-unknown-unknown -emit-llvm %s -o - | FileCheck %s +// RUN: %clang_cc1 -target-feature +altivec -target-feature +power8-vector -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s -check-prefix=CHECK-LE +// RUN: not %clang_cc1 -target-feature +altivec -target-feature +vsx -triple powerpc64-unknown-unknown -emit-llvm %s -o - 2>&1 | FileCheck %s -check-prefix=CHECK-PPC // Added -target-feature +vsx above to avoid errors about "vector double" and to // generate the correct errors for functions that are only overloaded with VSX // (vec_cmpge, vec_cmple). Without this option, there is only one overload so diff --git a/test/CodeGen/builtins-ppc-p9vector.c b/test/CodeGen/builtins-ppc-p9vector.c index 42316970d8..f92df86561 100644 --- a/test/CodeGen/builtins-ppc-p9vector.c +++ b/test/CodeGen/builtins-ppc-p9vector.c @@ -1,9 +1,9 @@ // REQUIRES: powerpc-registered-target -// RUN: %clang_cc1 -faltivec -target-feature +power9-vector \ +// RUN: %clang_cc1 -target-feature +altivec -target-feature +power9-vector \ // RUN: -triple powerpc64-unknown-unknown -emit-llvm %s \ // RUN: -o - | FileCheck %s -check-prefix=CHECK-BE -// RUN: %clang_cc1 -faltivec -target-feature +power9-vector \ +// RUN: %clang_cc1 -target-feature +altivec -target-feature +power9-vector \ // RUN: -triple powerpc64le-unknown-unknown -emit-llvm %s \ // RUN: -o - | FileCheck %s diff --git a/test/CodeGen/builtins-ppc-quadword.c b/test/CodeGen/builtins-ppc-quadword.c index 3e168c8b1b..7d014db613 100644 --- a/test/CodeGen/builtins-ppc-quadword.c +++ b/test/CodeGen/builtins-ppc-quadword.c @@ -1,12 +1,12 @@ // REQUIRES: powerpc-registered-target -// RUN: %clang_cc1 -faltivec -target-feature +power8-vector \ +// RUN: %clang_cc1 -target-feature +altivec -target-feature +power8-vector \ // RUN: -triple powerpc64-unknown-unknown -emit-llvm %s -o - | FileCheck %s -// RUN: %clang_cc1 -faltivec -target-feature +power8-vector \ +// RUN: %clang_cc1 -target-feature +altivec -target-feature +power8-vector \ // RUN: -triple powerpc64le-unknown-unknown -emit-llvm %s -o - \ // RUN: | FileCheck %s -check-prefix=CHECK-LE -// RUN: not %clang_cc1 -faltivec -triple powerpc-unknown-unknown \ +// RUN: not %clang_cc1 -target-feature +altivec -triple powerpc-unknown-unknown \ // RUN: -emit-llvm %s -o - 2>&1 | FileCheck %s -check-prefix=CHECK-PPC #include diff --git a/test/CodeGen/builtins-ppc-vsx.c b/test/CodeGen/builtins-ppc-vsx.c index 16c72c404d..9e0052630e 100644 --- a/test/CodeGen/builtins-ppc-vsx.c +++ b/test/CodeGen/builtins-ppc-vsx.c @@ -1,6 +1,6 @@ // REQUIRES: powerpc-registered-target -// RUN: %clang_cc1 -faltivec -target-feature +vsx -triple powerpc64-unknown-unknown -emit-llvm %s -o - | FileCheck %s -// RUN: %clang_cc1 -faltivec -target-feature +vsx -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s -check-prefix=CHECK-LE +// RUN: %clang_cc1 -target-feature +altivec -target-feature +vsx -triple powerpc64-unknown-unknown -emit-llvm %s -o - | FileCheck %s +// RUN: %clang_cc1 -target-feature +altivec -target-feature +vsx -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s -check-prefix=CHECK-LE #include vector bool char vbc = { 0, 1, 0, 1, 0, 1, 0, 1, diff --git a/test/CodeGen/ppc64-align-struct.c b/test/CodeGen/ppc64-align-struct.c index 6a04d0cd84..5894a6aeb3 100644 --- a/test/CodeGen/ppc64-align-struct.c +++ b/test/CodeGen/ppc64-align-struct.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -faltivec -triple powerpc64-unknown-linux-gnu -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -target-feature +altivec -triple powerpc64-unknown-linux-gnu -emit-llvm -o - %s | FileCheck %s #include diff --git a/test/CodeGen/ppc64-vector.c b/test/CodeGen/ppc64-vector.c index f0211f0ec1..87deb0f585 100644 --- a/test/CodeGen/ppc64-vector.c +++ b/test/CodeGen/ppc64-vector.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -faltivec -triple powerpc64-unknown-linux-gnu -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -target-feature +altivec -triple powerpc64-unknown-linux-gnu -emit-llvm -o - %s | FileCheck %s typedef short v2i16 __attribute__((vector_size (4))); typedef short v3i16 __attribute__((vector_size (6))); diff --git a/test/CodeGen/ppc64le-aggregates.c b/test/CodeGen/ppc64le-aggregates.c index 04d2fb4766..f78f26a592 100644 --- a/test/CodeGen/ppc64le-aggregates.c +++ b/test/CodeGen/ppc64le-aggregates.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -faltivec -triple powerpc64le-unknown-linux-gnu -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -target-feature +altivec -triple powerpc64le-unknown-linux-gnu -emit-llvm -o - %s | FileCheck %s // Test homogeneous float aggregate passing and returning. diff --git a/test/Driver/ppc-features.cpp b/test/Driver/ppc-features.cpp index 73a784f132..f37af0918d 100644 --- a/test/Driver/ppc-features.cpp +++ b/test/Driver/ppc-features.cpp @@ -1,17 +1,3 @@ -// Check that we error when -faltivec is specified on non-ppc platforms. - -// RUN: %clang -target powerpc-unk-unk -faltivec -fsyntax-only %s -// RUN: %clang -target powerpc64-linux-gnu -faltivec -fsyntax-only %s -// RUN: %clang -target powerpc64-linux-gnu -maltivec -fsyntax-only %s - -// RUN: not %clang -target i386-pc-win32 -faltivec -fsyntax-only %s 2>&1 | FileCheck %s -// RUN: not %clang -target x86_64-unknown-freebsd -faltivec -fsyntax-only %s 2>&1 | FileCheck %s -// RUN: not %clang -target armv6-apple-darwin -faltivec -fsyntax-only %s 2>&1 | FileCheck %s -// RUN: not %clang -target armv7-apple-darwin -faltivec -fsyntax-only %s 2>&1 | FileCheck %s -// RUN: not %clang -target mips-linux-gnu -faltivec -fsyntax-only %s 2>&1 | FileCheck %s -// RUN: not %clang -target mips64-linux-gnu -faltivec -fsyntax-only %s 2>&1 | FileCheck %s -// RUN: not %clang -target sparc-unknown-solaris -faltivec -fsyntax-only %s 2>&1 | FileCheck %s - // check -msoft-float option for ppc32 // RUN: %clang -target powerpc-unknown-linux-gnu %s -msoft-float -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-SOFTFLOAT %s // CHECK-SOFTFLOAT: "-target-feature" "-hard-float" @@ -56,57 +42,54 @@ // RUN: %clang -target powerpc64le-unknown-linux-gnu %s -mfloat-abi=soft -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-FLOATABISOFT64le %s // CHECK-FLOATABISOFT64le: "-target-feature" "-hard-float" -// CHECK: invalid argument '-faltivec' only allowed with 'ppc/ppc64/ppc64le' - -// Check that -fno-altivec and -mno-altivec correctly disable the altivec -// target feature on powerpc. +// Check that -mno-altivec correctly disables the altivec target feature on powerpc. -// RUN: %clang -target powerpc64-unknown-linux-gnu %s -fno-altivec -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-1 %s +// RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-altivec -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-1 %s // CHECK-1: "-target-feature" "-altivec" // RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-altivec -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-2 %s // CHECK-2: "-target-feature" "-altivec" -// RUN: %clang -target powerpc64-unknown-linux-gnu %s -faltivec -mno-altivec -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-3 %s +// RUN: %clang -target powerpc64-unknown-linux-gnu %s -maltivec -mno-altivec -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-3 %s // CHECK-3: "-target-feature" "-altivec" -// RUN: %clang -target powerpc64-unknown-linux-gnu %s -maltivec -fno-altivec -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-4 %s +// RUN: %clang -target powerpc64-unknown-linux-gnu %s -maltivec -mno-altivec -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-4 %s // CHECK-4: "-target-feature" "-altivec" -// RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-altivec -faltivec -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-5 %s +// RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-altivec -maltivec -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-5 %s // CHECK-5-NOT: "-target-feature" "-altivec" -// RUN: %clang -target powerpc64-unknown-linux-gnu %s -fno-altivec -maltivec -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-6 %s +// RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-altivec -maltivec -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-6 %s // CHECK-6-NOT: "-target-feature" "-altivec" -// RUN: %clang -target powerpc64-unknown-linux-gnu %s -fno-altivec -mcpu=7400 -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-7 %s +// RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-altivec -mcpu=7400 -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-7 %s // CHECK-7: "-target-feature" "-altivec" -// RUN: %clang -target powerpc64-unknown-linux-gnu %s -fno-altivec -mcpu=g4 -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-8 %s +// RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-altivec -mcpu=g4 -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-8 %s // CHECK-8: "-target-feature" "-altivec" -// RUN: %clang -target powerpc64-unknown-linux-gnu %s -fno-altivec -mcpu=7450 -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-9 %s +// RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-altivec -mcpu=7450 -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-9 %s // CHECK-9: "-target-feature" "-altivec" -// RUN: %clang -target powerpc64-unknown-linux-gnu %s -fno-altivec -mcpu=g4+ -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-10 %s +// RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-altivec -mcpu=g4+ -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-10 %s // CHECK-10: "-target-feature" "-altivec" -// RUN: %clang -target powerpc64-unknown-linux-gnu %s -fno-altivec -mcpu=970 -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-11 %s +// RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-altivec -mcpu=970 -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-11 %s // CHECK-11: "-target-feature" "-altivec" -// RUN: %clang -target powerpc64-unknown-linux-gnu %s -fno-altivec -mcpu=g5 -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-12 %s +// RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-altivec -mcpu=g5 -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-12 %s // CHECK-12: "-target-feature" "-altivec" -// RUN: %clang -target powerpc64-unknown-linux-gnu %s -fno-altivec -mcpu=pwr6 -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-13 %s +// RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-altivec -mcpu=pwr6 -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-13 %s // CHECK-13: "-target-feature" "-altivec" -// RUN: %clang -target powerpc64-unknown-linux-gnu %s -fno-altivec -mcpu=pwr7 -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-14 %s +// RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-altivec -mcpu=pwr7 -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-14 %s // CHECK-14: "-target-feature" "-altivec" -// RUN: %clang -target powerpc64-unknown-linux-gnu %s -fno-altivec -mcpu=pwr8 -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-15 %s +// RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-altivec -mcpu=pwr8 -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-15 %s // CHECK-15: "-target-feature" "-altivec" -// RUN: %clang -target powerpc64-unknown-linux-gnu %s -fno-altivec -mcpu=ppc64 -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-16 %s +// RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-altivec -mcpu=ppc64 -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-16 %s // CHECK-16: "-target-feature" "-altivec" // RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-qpx -### -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-NOQPX %s diff --git a/test/Driver/unsupported-faltivec.c b/test/Driver/unsupported-faltivec.c new file mode 100644 index 0000000000..f6a55bcd39 --- /dev/null +++ b/test/Driver/unsupported-faltivec.c @@ -0,0 +1,10 @@ +// Tests that clang does not crash with invalid architectures in target triples. +// +// RUN: not %clang -target powerpc64le-linux-gnu -faltivec -o %t.o %s 2> %t.err +// RUN: FileCheck --input-file=%t.err --check-prefix=CHECK-NOFALTIVEC %s +// CHECK-NOFALTIVEC: error: the clang compiler does not support 'faltivec', please use -maltivec and include altivec.h explicitly +// +// RUN: not %clang -target powerpc64le-linux-gnu -fno-altivec -o %t.o %s 2> %t.err +// RUN: FileCheck --input-file=%t.err --check-prefix=CHECK-NOFNOALTIVEC %s +// CHECK-NOFNOALTIVEC: error: the clang compiler does not support 'fno-altivec', please use -mno-altivec + diff --git a/test/Headers/altivec-header.c b/test/Headers/altivec-header.c index 26f42e1400..733ab5002a 100644 --- a/test/Headers/altivec-header.c +++ b/test/Headers/altivec-header.c @@ -1,6 +1,6 @@ -// RUN: %clang_cc1 -triple powerpc64-unknown-unknown -faltivec -ffreestanding -emit-llvm -o - %s | FileCheck %s -// RUN: %clang_cc1 -triple powerpc64-unknown-unknown -faltivec -ffreestanding -emit-llvm -fno-lax-vector-conversions -o - %s | FileCheck %s -// RUN: %clang_cc1 -triple powerpc64-unknown-unknown -faltivec -ffreestanding -emit-llvm -x c++ -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple powerpc64-unknown-unknown -target-feature +altivec -ffreestanding -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple powerpc64-unknown-unknown -target-feature +altivec -ffreestanding -emit-llvm -fno-lax-vector-conversions -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple powerpc64-unknown-unknown -target-feature +altivec -ffreestanding -emit-llvm -x c++ -o - %s | FileCheck %s #include diff --git a/test/Headers/altivec-intrin.c b/test/Headers/altivec-intrin.c index 7e6ea00987..c71b48da04 100644 --- a/test/Headers/altivec-intrin.c +++ b/test/Headers/altivec-intrin.c @@ -1,5 +1,5 @@ // RUN: %clang_cc1 -triple powerpc64le-unknown-linux-gnu -target-cpu power8 \ -// RUN: -faltivec -verify %s +// RUN: -target-feature +altivec -verify %s // Test special behavior of Altivec intrinsics in this file. diff --git a/test/Parser/altivec-csk-bool.c b/test/Parser/altivec-csk-bool.c index c1c253958c..dc7fa1da39 100644 --- a/test/Parser/altivec-csk-bool.c +++ b/test/Parser/altivec-csk-bool.c @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple powerpc64-unknown-linux-gnu -faltivec -fsyntax-only %s -// RUN: %clang_cc1 -triple powerpc64le-unknown-linux-gnu -faltivec -fsyntax-only %s +// RUN: %clang_cc1 -triple powerpc64-unknown-linux-gnu -target-feature +altivec -fsyntax-only %s +// RUN: %clang_cc1 -triple powerpc64le-unknown-linux-gnu -target-feature +altivec -fsyntax-only %s // PR16456: Verify that bool, true, false are treated as context-sensitive // keywords (and therefore available for use as identifiers) when in diff --git a/test/Parser/altivec.c b/test/Parser/altivec.c index 4d3a7730c3..769b4dec98 100644 --- a/test/Parser/altivec.c +++ b/test/Parser/altivec.c @@ -1,6 +1,6 @@ -// RUN: %clang_cc1 -triple=powerpc-apple-darwin8 -faltivec -fsyntax-only -verify %s -// RUN: %clang_cc1 -triple=powerpc64-unknown-linux-gnu -faltivec -fsyntax-only -verify %s -// RUN: %clang_cc1 -triple=powerpc64le-unknown-linux-gnu -faltivec -fsyntax-only -verify %s +// RUN: %clang_cc1 -triple=powerpc-apple-darwin8 -target-feature +altivec -fsyntax-only -verify %s +// RUN: %clang_cc1 -triple=powerpc64-unknown-linux-gnu -target-feature +altivec -fsyntax-only -verify %s +// RUN: %clang_cc1 -triple=powerpc64le-unknown-linux-gnu -target-feature +altivec -fsyntax-only -verify %s __vector char vv_c; __vector signed char vv_sc; diff --git a/test/Parser/cxx-altivec.cpp b/test/Parser/cxx-altivec.cpp index 5b0da6c5e6..6395452010 100644 --- a/test/Parser/cxx-altivec.cpp +++ b/test/Parser/cxx-altivec.cpp @@ -1,6 +1,6 @@ -// RUN: %clang_cc1 -triple=powerpc-apple-darwin8 -faltivec -fsyntax-only -verify -std=c++11 %s -// RUN: %clang_cc1 -triple=powerpc64-unknown-linux-gnu -faltivec -fsyntax-only -verify -std=c++11 %s -// RUN: %clang_cc1 -triple=powerpc64le-unknown-linux-gnu -faltivec -fsyntax-only -verify -std=c++11 %s +// RUN: %clang_cc1 -triple=powerpc-apple-darwin8 -target-feature +altivec -fsyntax-only -verify -std=c++11 %s +// RUN: %clang_cc1 -triple=powerpc64-unknown-linux-gnu -target-feature +altivec -fsyntax-only -verify -std=c++11 %s +// RUN: %clang_cc1 -triple=powerpc64le-unknown-linux-gnu -target-feature +altivec -fsyntax-only -verify -std=c++11 %s #include __vector char vv_c; diff --git a/test/Parser/vsx.c b/test/Parser/vsx.c index ead09814c8..32bc934a7e 100644 --- a/test/Parser/vsx.c +++ b/test/Parser/vsx.c @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple=powerpc64-unknown-linux-gnu -faltivec -target-feature +vsx -fsyntax-only -verify %s -// RUN: %clang_cc1 -triple=powerpc64le-unknown-linux-gnu -faltivec -target-feature +vsx -fsyntax-only -verify %s +// RUN: %clang_cc1 -triple=powerpc64-unknown-linux-gnu -target-feature +altivec -target-feature +vsx -fsyntax-only -verify %s +// RUN: %clang_cc1 -triple=powerpc64le-unknown-linux-gnu -target-feature +altivec -target-feature +vsx -fsyntax-only -verify %s // Legitimate for VSX. __vector double vv_d1; diff --git a/test/Sema/altivec-init.c b/test/Sema/altivec-init.c index 973aab15d4..1c20450a6d 100644 --- a/test/Sema/altivec-init.c +++ b/test/Sema/altivec-init.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 %s -triple=powerpc-apple-darwin8 -faltivec -verify -pedantic -fsyntax-only +// RUN: %clang_cc1 %s -triple=powerpc-apple-darwin8 -target-feature +altivec -verify -pedantic -fsyntax-only typedef int v4 __attribute((vector_size(16))); typedef short v8 __attribute((vector_size(16))); @@ -23,8 +23,8 @@ v8 foo(void) { return (v8){0, 1, 2, 3, 1, 2, 3, 4}; - // FIXME: test that (type)(fn)(args) still works with -faltivec - // FIXME: test that c++ overloaded commas still work -faltivec + // FIXME: test that (type)(fn)(args) still works with -maltivec + // FIXME: test that c++ overloaded commas still work -maltivec } void __attribute__((__overloadable__)) f(v4 a) diff --git a/test/Sema/builtins-ppc.c b/test/Sema/builtins-ppc.c index 60872a614e..5c45d02b41 100644 --- a/test/Sema/builtins-ppc.c +++ b/test/Sema/builtins-ppc.c @@ -1,9 +1,9 @@ // REQUIRES: powerpc-registered-target -// RUN: %clang_cc1 -faltivec -target-feature +htm \ +// RUN: %clang_cc1 -target-feature +altivec -target-feature +htm \ // RUN: -triple powerpc64-unknown-unknown -DTEST_HTM -fsyntax-only \ // RUN: -verify %s -// RUN: %clang_cc1 -faltivec -target-feature +crypto \ +// RUN: %clang_cc1 -target-feature +altivec -target-feature +crypto \ // RUN: -triple powerpc64le-unknown-unknown -DTEST_CRYPTO -fsyntax-only \ // RUN: -verify %s diff --git a/test/SemaCXX/altivec.cpp b/test/SemaCXX/altivec.cpp index 3517466177..92f02838ad 100644 --- a/test/SemaCXX/altivec.cpp +++ b/test/SemaCXX/altivec.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -faltivec -fno-lax-vector-conversions -triple powerpc-unknown-unknown -fcxx-exceptions -verify %s +// RUN: %clang_cc1 -target-feature +altivec -fno-lax-vector-conversions -triple powerpc-unknown-unknown -fcxx-exceptions -verify %s typedef int V4i __attribute__((vector_size(16))); diff --git a/test/SemaCXX/cxx-altivec.cpp b/test/SemaCXX/cxx-altivec.cpp index baacbac7d0..50fb8ad014 100644 --- a/test/SemaCXX/cxx-altivec.cpp +++ b/test/SemaCXX/cxx-altivec.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple=powerpc-apple-darwin8 -faltivec -fsyntax-only -verify %s +// RUN: %clang_cc1 -triple=powerpc-apple-darwin8 -target-feature +altivec -fsyntax-only -verify %s struct Vector { __vector float xyzw;