From: Craig Topper Date: Thu, 29 Aug 2019 18:09:02 +0000 (+0000) Subject: [X86] Remove what little support we had for MPX X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d2fea3400f5ca1e43311661b788eb4e0b7f15b71;p=clang [X86] Remove what little support we had for MPX -Deprecate -mmpx and -mno-mpx command line options -Remove CPUID detection of mpx for -march=native -Remove MPX from all CPUs -Remove MPX preprocessor define I've left the "mpx" string in the backend so we don't fail on old IR, but its not connected to anything. gcc has also deprecated these command line options. https://www.phoronix.com/scan.php?page=news_item&px=GCC-Patch-To-Drop-MPX Differential Revision: https://reviews.llvm.org/D66669 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@370393 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/docs/ReleaseNotes.rst b/docs/ReleaseNotes.rst index f3291137bc..403b3fbc8a 100644 --- a/docs/ReleaseNotes.rst +++ b/docs/ReleaseNotes.rst @@ -70,6 +70,10 @@ Deprecated Compiler Flags The following options are deprecated and ignored. They will be removed in future versions of Clang. +- -mmpx used to enable the __MPX__ preprocessor define for the Intel MPX + instructions. There were no MPX intrinsics. +- -mno-mpx used to disable -mmpx and is the default behavior. + - ... Modified Compiler Flags diff --git a/include/clang/Driver/Options.td b/include/clang/Driver/Options.td index 7cc0038488..6aba6744e0 100644 --- a/include/clang/Driver/Options.td +++ b/include/clang/Driver/Options.td @@ -211,6 +211,10 @@ def clang_ignored_legacy_options_Group : OptionGroup<"">, def : Flag<["-"], "fslp-vectorize-aggressive">, Group; def : Flag<["-"], "fno-slp-vectorize-aggressive">, Group; +// Retired with clang-10.0. Previously controlled X86 MPX ISA. +def mmpx : Flag<["-"], "mmpx">, Group; +def mno_mpx : Flag<["-"], "mno-mpx">, Group; + // Group that ignores all gcc optimizations that won't be implemented def clang_ignored_gcc_optimization_f_Group : OptionGroup< "">, Group, Flags<[Ignored]>; @@ -3000,8 +3004,6 @@ def mmovdiri : Flag<["-"], "mmovdiri">, Group; def mno_movdiri : Flag<["-"], "mno-movdiri">, Group; def mmovdir64b : Flag<["-"], "mmovdir64b">, Group; def mno_movdir64b : Flag<["-"], "mno-movdir64b">, Group; -def mmpx : Flag<["-"], "mmpx">, Group; -def mno_mpx : Flag<["-"], "mno-mpx">, Group; def mmwaitx : Flag<["-"], "mmwaitx">, Group; def mno_mwaitx : Flag<["-"], "mno-mwaitx">, Group; def mpku : Flag<["-"], "mpku">, Group; diff --git a/lib/Basic/Targets/X86.cpp b/lib/Basic/Targets/X86.cpp index a010b5a36f..311ae6e170 100644 --- a/lib/Basic/Targets/X86.cpp +++ b/lib/Basic/Targets/X86.cpp @@ -198,7 +198,6 @@ IcelakeCommon: SkylakeCommon: setFeatureEnabledImpl(Features, "xsavec", true); setFeatureEnabledImpl(Features, "xsaves", true); - setFeatureEnabledImpl(Features, "mpx", true); setFeatureEnabledImpl(Features, "clflushopt", true); setFeatureEnabledImpl(Features, "aes", true); LLVM_FALLTHROUGH; @@ -277,7 +276,6 @@ SkylakeCommon: setFeatureEnabledImpl(Features, "xsavec", true); setFeatureEnabledImpl(Features, "xsaves", true); setFeatureEnabledImpl(Features, "clflushopt", true); - setFeatureEnabledImpl(Features, "mpx", true); setFeatureEnabledImpl(Features, "fsgsbase", true); setFeatureEnabledImpl(Features, "aes", true); LLVM_FALLTHROUGH; @@ -798,8 +796,6 @@ bool X86TargetInfo::handleTargetFeatures(std::vector &Features, HasAVX512VP2INTERSECT = true; } else if (Feature == "+sha") { HasSHA = true; - } else if (Feature == "+mpx") { - HasMPX = true; } else if (Feature == "+shstk") { HasSHSTK = true; } else if (Feature == "+movbe") { @@ -1220,8 +1216,6 @@ void X86TargetInfo::getTargetDefines(const LangOptions &Opts, Builder.defineMacro("__CLWB__"); if (HasWBNOINVD) Builder.defineMacro("__WBNOINVD__"); - if (HasMPX) - Builder.defineMacro("__MPX__"); if (HasSHSTK) Builder.defineMacro("__SHSTK__"); if (HasSGX) @@ -1378,7 +1372,6 @@ bool X86TargetInfo::isValidFeatureName(StringRef Name) const { .Case("movbe", true) .Case("movdiri", true) .Case("movdir64b", true) - .Case("mpx", true) .Case("mwaitx", true) .Case("pclmul", true) .Case("pconfig", true) @@ -1462,7 +1455,6 @@ bool X86TargetInfo::hasFeature(StringRef Feature) const { .Case("movbe", HasMOVBE) .Case("movdiri", HasMOVDIRI) .Case("movdir64b", HasMOVDIR64B) - .Case("mpx", HasMPX) .Case("mwaitx", HasMWAITX) .Case("pclmul", HasPCLMUL) .Case("pconfig", HasPCONFIG) diff --git a/lib/Basic/Targets/X86.h b/lib/Basic/Targets/X86.h index dd1e7db6c8..6f6cf47d65 100644 --- a/lib/Basic/Targets/X86.h +++ b/lib/Basic/Targets/X86.h @@ -80,7 +80,6 @@ class LLVM_LIBRARY_VISIBILITY X86TargetInfo : public TargetInfo { bool HasAVX512IFMA = false; bool HasAVX512VP2INTERSECT = false; bool HasSHA = false; - bool HasMPX = false; bool HasSHSTK = false; bool HasSGX = false; bool HasCX8 = false; diff --git a/test/Driver/x86-target-features.c b/test/Driver/x86-target-features.c index ed9c0af1f9..29d8f59ab8 100644 --- a/test/Driver/x86-target-features.c +++ b/test/Driver/x86-target-features.c @@ -72,8 +72,8 @@ // RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mmpx %s -### -o %t.o 2>&1 | FileCheck -check-prefix=MPX %s // RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mno-mpx %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-MPX %s -// MPX: "-target-feature" "+mpx" -// NO-MPX: "-target-feature" "-mpx" +// MPX: the flag '-mmpx' has been deprecated and will be ignored +// NO-MPX: the flag '-mno-mpx' has been deprecated and will be ignored // RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mshstk %s -### -o %t.o 2>&1 | FileCheck -check-prefix=CETSS %s // RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mno-shstk %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-CETSS %s diff --git a/test/Preprocessor/predefined-arch-macros.c b/test/Preprocessor/predefined-arch-macros.c index b21d6f5ead..5981c80ae3 100644 --- a/test/Preprocessor/predefined-arch-macros.c +++ b/test/Preprocessor/predefined-arch-macros.c @@ -682,7 +682,6 @@ // CHECK_SKL_M32: #define __LZCNT__ 1 // CHECK_SKL_M32: #define __MMX__ 1 // CHECK_SKL_M32: #define __MOVBE__ 1 -// CHECK_SKL_M32: #define __MPX__ 1 // CHECK_SKL_M32: #define __PCLMUL__ 1 // CHECK_SKL_M32: #define __POPCNT__ 1 // CHECK_SKL_M32: #define __PRFCHW__ 1 @@ -717,7 +716,6 @@ // CHECK_SKL_M64: #define __LZCNT__ 1 // CHECK_SKL_M64: #define __MMX__ 1 // CHECK_SKL_M64: #define __MOVBE__ 1 -// CHECK_SKL_M64: #define __MPX__ 1 // CHECK_SKL_M64: #define __PCLMUL__ 1 // CHECK_SKL_M64: #define __POPCNT__ 1 // CHECK_SKL_M64: #define __PRFCHW__ 1 @@ -912,7 +910,6 @@ // CHECK_SKX_M32: #define __LZCNT__ 1 // CHECK_SKX_M32: #define __MMX__ 1 // CHECK_SKX_M32: #define __MOVBE__ 1 -// CHECK_SKX_M32: #define __MPX__ 1 // CHECK_SKX_M32: #define __PCLMUL__ 1 // CHECK_SKX_M32: #define __PKU__ 1 // CHECK_SKX_M32: #define __POPCNT__ 1 @@ -958,7 +955,6 @@ // CHECK_SKX_M64: #define __LZCNT__ 1 // CHECK_SKX_M64: #define __MMX__ 1 // CHECK_SKX_M64: #define __MOVBE__ 1 -// CHECK_SKX_M64: #define __MPX__ 1 // CHECK_SKX_M64: #define __PCLMUL__ 1 // CHECK_SKX_M64: #define __PKU__ 1 // CHECK_SKX_M64: #define __POPCNT__ 1 @@ -1008,7 +1004,6 @@ // CHECK_CLX_M32: #define __LZCNT__ 1 // CHECK_CLX_M32: #define __MMX__ 1 // CHECK_CLX_M32: #define __MOVBE__ 1 -// CHECK_CLX_M32: #define __MPX__ 1 // CHECK_CLX_M32: #define __PCLMUL__ 1 // CHECK_CLX_M32: #define __PKU__ 1 // CHECK_CLX_M32: #define __POPCNT__ 1 @@ -1055,7 +1050,6 @@ // CHECK_CLX_M64: #define __LZCNT__ 1 // CHECK_CLX_M64: #define __MMX__ 1 // CHECK_CLX_M64: #define __MOVBE__ 1 -// CHECK_CLX_M64: #define __MPX__ 1 // CHECK_CLX_M64: #define __PCLMUL__ 1 // CHECK_CLX_M64: #define __PKU__ 1 // CHECK_CLX_M64: #define __POPCNT__ 1 @@ -1106,7 +1100,6 @@ // CHECK_CPX_M32: #define __LZCNT__ 1 // CHECK_CPX_M32: #define __MMX__ 1 // CHECK_CPX_M32: #define __MOVBE__ 1 -// CHECK_CPX_M32: #define __MPX__ 1 // CHECK_CPX_M32: #define __PCLMUL__ 1 // CHECK_CPX_M32: #define __PKU__ 1 // CHECK_CPX_M32: #define __POPCNT__ 1 @@ -1154,7 +1147,6 @@ // CHECK_CPX_M64: #define __LZCNT__ 1 // CHECK_CPX_M64: #define __MMX__ 1 // CHECK_CPX_M64: #define __MOVBE__ 1 -// CHECK_CPX_M64: #define __MPX__ 1 // CHECK_CPX_M64: #define __PCLMUL__ 1 // CHECK_CPX_M64: #define __PKU__ 1 // CHECK_CPX_M64: #define __POPCNT__ 1 @@ -1205,7 +1197,6 @@ // CHECK_CNL_M32: #define __LZCNT__ 1 // CHECK_CNL_M32: #define __MMX__ 1 // CHECK_CNL_M32: #define __MOVBE__ 1 -// CHECK_CNL_M32: #define __MPX__ 1 // CHECK_CNL_M32: #define __PCLMUL__ 1 // CHECK_CNL_M32: #define __PKU__ 1 // CHECK_CNL_M32: #define __POPCNT__ 1 @@ -1254,7 +1245,6 @@ // CHECK_CNL_M64: #define __LZCNT__ 1 // CHECK_CNL_M64: #define __MMX__ 1 // CHECK_CNL_M64: #define __MOVBE__ 1 -// CHECK_CNL_M64: #define __MPX__ 1 // CHECK_CNL_M64: #define __PCLMUL__ 1 // CHECK_CNL_M64: #define __PKU__ 1 // CHECK_CNL_M64: #define __POPCNT__ 1 @@ -1309,7 +1299,6 @@ // CHECK_ICL_M32: #define __LZCNT__ 1 // CHECK_ICL_M32: #define __MMX__ 1 // CHECK_ICL_M32: #define __MOVBE__ 1 -// CHECK_ICL_M32: #define __MPX__ 1 // CHECK_ICL_M32: #define __PCLMUL__ 1 // CHECK_ICL_M32: #define __PKU__ 1 // CHECK_ICL_M32: #define __POPCNT__ 1 @@ -1367,7 +1356,6 @@ // CHECK_ICL_M64: #define __LZCNT__ 1 // CHECK_ICL_M64: #define __MMX__ 1 // CHECK_ICL_M64: #define __MOVBE__ 1 -// CHECK_ICL_M64: #define __MPX__ 1 // CHECK_ICL_M64: #define __PCLMUL__ 1 // CHECK_ICL_M64: #define __PKU__ 1 // CHECK_ICL_M64: #define __POPCNT__ 1 @@ -1426,7 +1414,6 @@ // CHECK_ICX_M32: #define __LZCNT__ 1 // CHECK_ICX_M32: #define __MMX__ 1 // CHECK_ICX_M32: #define __MOVBE__ 1 -// CHECK_ICX_M32: #define __MPX__ 1 // CHECK_ICX_M32: #define __PCLMUL__ 1 // CHECK_ICX_M32: #define __PCONFIG__ 1 // CHECK_ICX_M32: #define __PKU__ 1 @@ -1485,7 +1472,6 @@ // CHECK_ICX_M64: #define __LZCNT__ 1 // CHECK_ICX_M64: #define __MMX__ 1 // CHECK_ICX_M64: #define __MOVBE__ 1 -// CHECK_ICX_M64: #define __MPX__ 1 // CHECK_ICX_M64: #define __PCLMUL__ 1 // CHECK_ICX_M64: #define __PCONFIG__ 1 // CHECK_ICX_M64: #define __PKU__ 1 @@ -1548,7 +1534,6 @@ // CHECK_TGL_M32: #define __MOVBE__ 1 // CHECK_TGL_M32: #define __MOVDIR64B__ 1 // CHECK_TGL_M32: #define __MOVDIRI__ 1 -// CHECK_TGL_M32: #define __MPX__ 1 // CHECK_TGL_M32: #define __PCLMUL__ 1 // CHECK_TGL_M32-NOT: #define __PCONFIG__ 1 // CHECK_TGL_M32: #define __PKU__ 1 @@ -1611,7 +1596,6 @@ // CHECK_TGL_M64: #define __MOVBE__ 1 // CHECK_TGL_M64: #define __MOVDIR64B__ 1 // CHECK_TGL_M64: #define __MOVDIRI__ 1 -// CHECK_TGL_M64: #define __MPX__ 1 // CHECK_TGL_M64: #define __PCLMUL__ 1 // CHECK_TGL_M64-NOT: #define __PCONFIG__ 1 // CHECK_TGL_M64: #define __PKU__ 1 @@ -1688,7 +1672,6 @@ // CHECK_GLM_M32: #define __FXSR__ 1 // CHECK_GLM_M32: #define __MMX__ 1 // CHECK_GLM_M32: #define __MOVBE__ 1 -// CHECK_GLM_M32: #define __MPX__ 1 // CHECK_GLM_M32: #define __PCLMUL__ 1 // CHECK_GLM_M32: #define __POPCNT__ 1 // CHECK_GLM_M32: #define __PRFCHW__ 1 @@ -1722,7 +1705,6 @@ // CHECK_GLM_M64: #define __FXSR__ 1 // CHECK_GLM_M64: #define __MMX__ 1 // CHECK_GLM_M64: #define __MOVBE__ 1 -// CHECK_GLM_M64: #define __MPX__ 1 // CHECK_GLM_M64: #define __PCLMUL__ 1 // CHECK_GLM_M64: #define __POPCNT__ 1 // CHECK_GLM_M64: #define __PRFCHW__ 1 @@ -1754,7 +1736,6 @@ // CHECK_GLMP_M32: #define __FXSR__ 1 // CHECK_GLMP_M32: #define __MMX__ 1 // CHECK_GLMP_M32: #define __MOVBE__ 1 -// CHECK_GLMP_M32: #define __MPX__ 1 // CHECK_GLMP_M32: #define __PCLMUL__ 1 // CHECK_GLMP_M32: #define __POPCNT__ 1 // CHECK_GLMP_M32: #define __PRFCHW__ 1 @@ -1791,7 +1772,6 @@ // CHECK_GLMP_M64: #define __FXSR__ 1 // CHECK_GLMP_M64: #define __MMX__ 1 // CHECK_GLMP_M64: #define __MOVBE__ 1 -// CHECK_GLMP_M64: #define __MPX__ 1 // CHECK_GLMP_M64: #define __PCLMUL__ 1 // CHECK_GLMP_M64: #define __POPCNT__ 1 // CHECK_GLMP_M64: #define __PRFCHW__ 1 @@ -1830,7 +1810,6 @@ // CHECK_TRM_M32: #define __MOVBE__ 1 // CHECK_TRM_M32: #define __MOVDIR64B__ 1 // CHECK_TRM_M32: #define __MOVDIRI__ 1 -// CHECK_TRM_M32: #define __MPX__ 1 // CHECK_TRM_M32: #define __PCLMUL__ 1 // CHECK_TRM_M32: #define __POPCNT__ 1 // CHECK_TRM_M32: #define __PRFCHW__ 1 @@ -1872,7 +1851,6 @@ // CHECK_TRM_M64: #define __MOVBE__ 1 // CHECK_TRM_M64: #define __MOVDIR64B__ 1 // CHECK_TRM_M64: #define __MOVDIRI__ 1 -// CHECK_TRM_M64: #define __MPX__ 1 // CHECK_TRM_M64: #define __PCLMUL__ 1 // CHECK_TRM_M64: #define __POPCNT__ 1 // CHECK_TRM_M64: #define __PRFCHW__ 1