diff options
author | Kit Barton <kbarton@ca.ibm.com> | 2015-03-25 19:41:41 +0000 |
---|---|---|
committer | Kit Barton <kbarton@ca.ibm.com> | 2015-03-25 19:41:41 +0000 |
commit | 8246f28237a56f51e3277116ea1df4dc18aa04db (patch) | |
tree | a7b1cfead79d2d78bb55c391876ff2c16813a8d4 /clang/lib/Basic/Targets.cpp | |
parent | 535e69de34835d0b299c273bf889db5434b36054 (diff) | |
download | bcm5719-llvm-8246f28237a56f51e3277116ea1df4dc18aa04db.tar.gz bcm5719-llvm-8246f28237a56f51e3277116ea1df4dc18aa04db.zip |
Add Hardware Transactional Memory (HTM) Support
This patch adds Hardware Transaction Memory (HTM) support supported by ISA 2.07
(POWER8). The intrinsic support is based on GCC one [1], with both 'PowerPC HTM
Low Level Built-in Functions' and 'PowerPC HTM High Level Inline Functions'
implemented.
Along with builtins a new driver switch is added to enable/disable HTM
instruction support (-mhtm) and a header with common definitions (mostly to
parse the TFHAR register value). The HTM switch also sets a preprocessor builtin
HTM.
The HTM usage requires a recently newer kernel with PPC HTM enabled. Tested on
powerpc64 and powerpc64le.
This is send along a llvm patch to enabled the builtins and option switch.
[1]
https://gcc.gnu.org/onlinedocs/gcc/PowerPC-Hardware-Transactional-Memory-Built-in-Functions.html
Phabricator Review: http://reviews.llvm.org/D8248
llvm-svn: 233205
Diffstat (limited to 'clang/lib/Basic/Targets.cpp')
-rw-r--r-- | clang/lib/Basic/Targets.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp index 25ce32e4664..b1a245e1b20 100644 --- a/clang/lib/Basic/Targets.cpp +++ b/clang/lib/Basic/Targets.cpp @@ -744,6 +744,7 @@ class PPCTargetInfo : public TargetInfo { bool HasP8Vector; bool HasP8Crypto; bool HasQPX; + bool HasHTM; protected: std::string ABI; @@ -751,7 +752,7 @@ protected: public: PPCTargetInfo(const llvm::Triple &Triple) : TargetInfo(Triple), HasVSX(false), HasP8Vector(false), - HasP8Crypto(false), HasQPX(false) { + HasP8Crypto(false), HasQPX(false), HasHTM(false) { BigEndian = (Triple.getArch() != llvm::Triple::ppc64le); LongDoubleWidth = LongDoubleAlign = 128; LongDoubleFormat = &llvm::APFloat::PPCDoubleDouble; @@ -1026,6 +1027,11 @@ bool PPCTargetInfo::handleTargetFeatures(std::vector<std::string> &Features, continue; } + if (Feature == "htm") { + HasHTM = true; + continue; + } + // TODO: Finish this list and add an assert that we've handled them // all. } @@ -1180,6 +1186,8 @@ void PPCTargetInfo::getTargetDefines(const LangOptions &Opts, Builder.defineMacro("__POWER8_VECTOR__"); if (HasP8Crypto) Builder.defineMacro("__CRYPTO__"); + if (HasHTM) + Builder.defineMacro("__HTM__"); // FIXME: The following are not yet generated here by Clang, but are // generated by GCC: @@ -1235,6 +1243,7 @@ bool PPCTargetInfo::hasFeature(StringRef Feature) const { .Case("power8-vector", HasP8Vector) .Case("crypto", HasP8Crypto) .Case("qpx", HasQPX) + .Case("htm", HasHTM) .Default(false); } |