From 35458c2fe9e700d9d548617a3c2a53b814cc39c6 Mon Sep 17 00:00:00 2001 From: Nemanja Ivanovic Date: Sat, 11 Apr 2015 10:43:36 +0000 Subject: [PATCH] Add Clang support for -mdirect-move on PPC This patch corresponds to review: http://reviews.llvm.org/D8930 This just adds a front end option to let the back end know the target has PPC direct move instructions. llvm-svn: 234683 --- clang/include/clang/Driver/Options.td | 4 ++++ clang/lib/Basic/Targets.cpp | 13 ++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index 50bfd315c5ae..0992e9e509fc 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -1269,6 +1269,10 @@ def mpower8_crypto : Flag<["-"], "mcrypto">, Group; def mnopower8_crypto : Flag<["-"], "mno-crypto">, Group; +def mdirect_move : Flag<["-"], "mdirect-move">, + Group; +def mnodirect_move : Flag<["-"], "mno-direct-move">, + Group; def mhtm : Flag<["-"], "mhtm">, Group; def mno_htm : Flag<["-"], "mno-htm">, Group; def mfprnd : Flag<["-"], "mfprnd">, Group; diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp index 082520583cce..9cd061aacff7 100644 --- a/clang/lib/Basic/Targets.cpp +++ b/clang/lib/Basic/Targets.cpp @@ -743,6 +743,7 @@ class PPCTargetInfo : public TargetInfo { bool HasVSX; bool HasP8Vector; bool HasP8Crypto; + bool HasDirectMove; bool HasQPX; bool HasHTM; bool HasBPERMD; @@ -754,7 +755,7 @@ protected: public: PPCTargetInfo(const llvm::Triple &Triple) : TargetInfo(Triple), HasVSX(false), HasP8Vector(false), - HasP8Crypto(false), HasQPX(false), HasHTM(false), + HasP8Crypto(false), HasDirectMove(false), HasQPX(false), HasHTM(false), HasBPERMD(false), HasExtDiv(false) { BigEndian = (Triple.getArch() != llvm::Triple::ppc64le); LongDoubleWidth = LongDoubleAlign = 128; @@ -1035,6 +1036,11 @@ bool PPCTargetInfo::handleTargetFeatures(std::vector &Features, continue; } + if (Feature == "direct-move") { + HasDirectMove = true; + continue; + } + if (Feature == "qpx") { HasQPX = true; continue; @@ -1257,6 +1263,10 @@ void PPCTargetInfo::getDefaultFeatures(llvm::StringMap &Features) const { .Case("pwr8", true) .Case("pwr7", true) .Default(false); + Features["direct-move"] = llvm::StringSwitch(CPU) + .Case("ppc64le", true) + .Case("pwr8", true) + .Default(false); } bool PPCTargetInfo::hasFeature(StringRef Feature) const { @@ -1265,6 +1275,7 @@ bool PPCTargetInfo::hasFeature(StringRef Feature) const { .Case("vsx", HasVSX) .Case("power8-vector", HasP8Vector) .Case("crypto", HasP8Crypto) + .Case("direct-move", HasDirectMove) .Case("qpx", HasQPX) .Case("htm", HasHTM) .Case("bpermd", HasBPERMD)