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
This commit is contained in:
Nemanja Ivanovic 2015-04-11 10:43:36 +00:00
parent c38b5311cb
commit 35458c2fe9
2 changed files with 16 additions and 1 deletions

View File

@ -1269,6 +1269,10 @@ def mpower8_crypto : Flag<["-"], "mcrypto">,
Group<m_ppc_Features_Group>; Group<m_ppc_Features_Group>;
def mnopower8_crypto : Flag<["-"], "mno-crypto">, def mnopower8_crypto : Flag<["-"], "mno-crypto">,
Group<m_ppc_Features_Group>; Group<m_ppc_Features_Group>;
def mdirect_move : Flag<["-"], "mdirect-move">,
Group<m_ppc_Features_Group>;
def mnodirect_move : Flag<["-"], "mno-direct-move">,
Group<m_ppc_Features_Group>;
def mhtm : Flag<["-"], "mhtm">, Group<m_ppc_Features_Group>; def mhtm : Flag<["-"], "mhtm">, Group<m_ppc_Features_Group>;
def mno_htm : Flag<["-"], "mno-htm">, Group<m_ppc_Features_Group>; def mno_htm : Flag<["-"], "mno-htm">, Group<m_ppc_Features_Group>;
def mfprnd : Flag<["-"], "mfprnd">, Group<m_ppc_Features_Group>; def mfprnd : Flag<["-"], "mfprnd">, Group<m_ppc_Features_Group>;

View File

@ -743,6 +743,7 @@ class PPCTargetInfo : public TargetInfo {
bool HasVSX; bool HasVSX;
bool HasP8Vector; bool HasP8Vector;
bool HasP8Crypto; bool HasP8Crypto;
bool HasDirectMove;
bool HasQPX; bool HasQPX;
bool HasHTM; bool HasHTM;
bool HasBPERMD; bool HasBPERMD;
@ -754,7 +755,7 @@ protected:
public: public:
PPCTargetInfo(const llvm::Triple &Triple) PPCTargetInfo(const llvm::Triple &Triple)
: TargetInfo(Triple), HasVSX(false), HasP8Vector(false), : TargetInfo(Triple), HasVSX(false), HasP8Vector(false),
HasP8Crypto(false), HasQPX(false), HasHTM(false), HasP8Crypto(false), HasDirectMove(false), HasQPX(false), HasHTM(false),
HasBPERMD(false), HasExtDiv(false) { HasBPERMD(false), HasExtDiv(false) {
BigEndian = (Triple.getArch() != llvm::Triple::ppc64le); BigEndian = (Triple.getArch() != llvm::Triple::ppc64le);
LongDoubleWidth = LongDoubleAlign = 128; LongDoubleWidth = LongDoubleAlign = 128;
@ -1035,6 +1036,11 @@ bool PPCTargetInfo::handleTargetFeatures(std::vector<std::string> &Features,
continue; continue;
} }
if (Feature == "direct-move") {
HasDirectMove = true;
continue;
}
if (Feature == "qpx") { if (Feature == "qpx") {
HasQPX = true; HasQPX = true;
continue; continue;
@ -1257,6 +1263,10 @@ void PPCTargetInfo::getDefaultFeatures(llvm::StringMap<bool> &Features) const {
.Case("pwr8", true) .Case("pwr8", true)
.Case("pwr7", true) .Case("pwr7", true)
.Default(false); .Default(false);
Features["direct-move"] = llvm::StringSwitch<bool>(CPU)
.Case("ppc64le", true)
.Case("pwr8", true)
.Default(false);
} }
bool PPCTargetInfo::hasFeature(StringRef Feature) const { bool PPCTargetInfo::hasFeature(StringRef Feature) const {
@ -1265,6 +1275,7 @@ bool PPCTargetInfo::hasFeature(StringRef Feature) const {
.Case("vsx", HasVSX) .Case("vsx", HasVSX)
.Case("power8-vector", HasP8Vector) .Case("power8-vector", HasP8Vector)
.Case("crypto", HasP8Crypto) .Case("crypto", HasP8Crypto)
.Case("direct-move", HasDirectMove)
.Case("qpx", HasQPX) .Case("qpx", HasQPX)
.Case("htm", HasHTM) .Case("htm", HasHTM)
.Case("bpermd", HasBPERMD) .Case("bpermd", HasBPERMD)