From 0d0a1a53e3870d1c816bec193841e9d2db1a1b68 Mon Sep 17 00:00:00 2001 From: Hal Finkel Date: Wed, 11 Mar 2015 19:14:15 +0000 Subject: [PowerPC] ABI support for the QPX vector instruction set Support for the QPX vector instruction set, used on the IBM BG/Q supercomputer, has recently been added to the LLVM PowerPC backend. This vector instruction set requires some ABI modifications because the ABI on the BG/Q expects <4 x double> vectors to be provided with 32-byte stack alignment, and to be handled as native vector types (similar to how Altivec vectors are handled on mainline PPC systems). I've named this ABI variant elfv1-qpx, have made this the default ABI when QPX is supported, and have updated the ABI handling code to provide QPX vectors with the correct stack alignment and associated register-assignment logic. llvm-svn: 231960 --- clang/lib/Basic/Targets.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'clang/lib/Basic/Targets.cpp') diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp index 15c35490ec0..3f6177eecd5 100644 --- a/clang/lib/Basic/Targets.cpp +++ b/clang/lib/Basic/Targets.cpp @@ -742,6 +742,7 @@ class PPCTargetInfo : public TargetInfo { bool HasVSX; bool HasP8Vector; bool HasP8Crypto; + bool HasQPX; protected: std::string ABI; @@ -749,7 +750,7 @@ protected: public: PPCTargetInfo(const llvm::Triple &Triple) : TargetInfo(Triple), HasVSX(false), HasP8Vector(false), - HasP8Crypto(false) { + HasP8Crypto(false), HasQPX(false) { BigEndian = (Triple.getArch() != llvm::Triple::ppc64le); LongDoubleWidth = LongDoubleAlign = 128; LongDoubleFormat = &llvm::APFloat::PPCDoubleDouble; @@ -1015,6 +1016,11 @@ bool PPCTargetInfo::handleTargetFeatures(std::vector &Features, continue; } + if (Feature == "qpx") { + HasQPX = true; + continue; + } + // TODO: Finish this list and add an assert that we've handled them // all. } @@ -1049,7 +1055,7 @@ void PPCTargetInfo::getTargetDefines(const LangOptions &Opts, } // ABI options. - if (ABI == "elfv1") + if (ABI == "elfv1" || ABI == "elfv1-qpx") Builder.defineMacro("_CALL_ELF", "1"); if (ABI == "elfv2") Builder.defineMacro("_CALL_ELF", "2"); @@ -1223,6 +1229,7 @@ bool PPCTargetInfo::hasFeature(StringRef Feature) const { .Case("vsx", HasVSX) .Case("power8-vector", HasP8Vector) .Case("crypto", HasP8Crypto) + .Case("qpx", HasQPX) .Default(false); } @@ -1403,7 +1410,7 @@ public: } // PPC64 Linux-specifc ABI options. bool setABI(const std::string &Name) override { - if (Name == "elfv1" || Name == "elfv2") { + if (Name == "elfv1" || Name == "elfv1-qpx" || Name == "elfv2") { ABI = Name; return true; } -- cgit v1.2.3