Skip to content

Commit 25e18c6

Browse files
committed
Merge branch 'release_50' of github.com:llvm-mirror/clang into release_50
2 parents cecb379 + 334f080 commit 25e18c6

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

include/clang/Driver/Options.td

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2422,6 +2422,11 @@ def mhexagon_hvx_double : Flag<["-"], "mhvx-double">, Group<m_hexagon_Features_G
24222422
def mno_hexagon_hvx_double : Flag<["-"], "mno-hvx-double">, Group<m_hexagon_Features_Group>,
24232423
Flags<[CC1Option]>, HelpText<"Disable Hexagon Double Vector eXtensions">;
24242424

2425+
def mretpoline : Flag<["-"], "mretpoline">, Group<m_x86_Features_Group>;
2426+
def mno_retpoline : Flag<["-"], "mno-retpoline">, Group<m_x86_Features_Group>;
2427+
def mretpoline_external_thunk : Flag<["-"], "mretpoline-external-thunk">, Group<m_x86_Features_Group>;
2428+
def mno_retpoline_external_thunk : Flag<["-"], "mno-retpoline-external-thunk">, Group<m_x86_Features_Group>;
2429+
24252430
// These are legacy user-facing driver-level option spellings. They are always
24262431
// aliases for options that are spelled using the more common Unix / GNU flag
24272432
// style of double-dash and equals-joined flags.

lib/Basic/Targets.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2691,6 +2691,8 @@ class X86TargetInfo : public TargetInfo {
26912691
bool HasCLWB = false;
26922692
bool HasMOVBE = false;
26932693
bool HasPREFETCHWT1 = false;
2694+
bool HasRetpoline = false;
2695+
bool HasRetpolineExternalThunk = false;
26942696

26952697
/// \brief Enumeration of all of the X86 CPUs supported by Clang.
26962698
///
@@ -3821,6 +3823,10 @@ bool X86TargetInfo::handleTargetFeatures(std::vector<std::string> &Features,
38213823
HasPREFETCHWT1 = true;
38223824
} else if (Feature == "+clzero") {
38233825
HasCLZERO = true;
3826+
} else if (Feature == "+retpoline") {
3827+
HasRetpoline = true;
3828+
} else if (Feature == "+retpoline-external-thunk") {
3829+
HasRetpolineExternalThunk = true;
38243830
}
38253831

38263832
X86SSEEnum Level = llvm::StringSwitch<X86SSEEnum>(Feature)
@@ -4285,6 +4291,8 @@ bool X86TargetInfo::hasFeature(StringRef Feature) const {
42854291
.Case("rdrnd", HasRDRND)
42864292
.Case("rdseed", HasRDSEED)
42874293
.Case("rtm", HasRTM)
4294+
.Case("retpoline", HasRetpoline)
4295+
.Case("retpoline-external-thunk", HasRetpolineExternalThunk)
42884296
.Case("sgx", HasSGX)
42894297
.Case("sha", HasSHA)
42904298
.Case("sse", SSELevel >= SSE1)

test/Driver/x86-target-features.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,13 @@
8484
// RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mno-clzero %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-CLZERO %s
8585
// CLZERO: "-target-feature" "+clzero"
8686
// NO-CLZERO: "-target-feature" "-clzero"
87+
88+
// RUN: %clang -target i386-linux-gnu -mretpoline %s -### -o %t.o 2>&1 | FileCheck -check-prefix=RETPOLINE %s
89+
// RUN: %clang -target i386-linux-gnu -mno-retpoline %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-RETPOLINE %s
90+
// RETPOLINE: "-target-feature" "+retpoline"
91+
// NO-RETPOLINE: "-target-feature" "-retpoline"
92+
93+
// RUN: %clang -target i386-linux-gnu -mretpoline -mretpoline-external-thunk %s -### -o %t.o 2>&1 | FileCheck -check-prefix=RETPOLINE-EXTERNAL-THUNK %s
94+
// RUN: %clang -target i386-linux-gnu -mretpoline -mno-retpoline-external-thunk %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-RETPOLINE-EXTERNAL-THUNK %s
95+
// RETPOLINE-EXTERNAL-THUNK: "-target-feature" "+retpoline-external-thunk"
96+
// NO-RETPOLINE-EXTERNAL-THUNK: "-target-feature" "-retpoline-external-thunk"

0 commit comments

Comments
 (0)