[PowerPC] Add feature for Power8 vector extensions
authorBill Schmidt <wschmidt@linux.vnet.ibm.com>
Fri, 10 Oct 2014 15:09:28 +0000 (15:09 +0000)
committerBill Schmidt <wschmidt@linux.vnet.ibm.com>
Fri, 10 Oct 2014 15:09:28 +0000 (15:09 +0000)
The current VSX feature for PowerPC specifies availability of the VSX
instructions added with the 2.06 architecture version.  With 2.07, the
architecture adds new instructions to both the Category:Vector and
Category:VSX instruction sets.  Additionally, unaligned vector storage
operations have improved performance.

This patch adds a feature to provide access to the new instructions
and performance capabilities of Power8.  For compatibility with GCC,
the feature is controlled via a new -mpower8-vector switch, and the
feature causes the __POWER8_VECTOR__ builtin define to be generated by
the preprocessor.

There is a companion patch for cfe being committed at the same time.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219501 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/PowerPC/PPC.td
lib/Target/PowerPC/PPCSubtarget.cpp
lib/Target/PowerPC/PPCSubtarget.h

index 8f4c1ee77a727bbd7279fb1fd81674105321a95a..f13be4ab9d047c69eaab419ad82a231f926988c3 100644 (file)
@@ -104,6 +104,10 @@ def FeatureQPX       : SubtargetFeature<"qpx","HasQPX", "true",
 def FeatureVSX       : SubtargetFeature<"vsx","HasVSX", "true",
                                         "Enable VSX instructions",
                                         [FeatureAltivec]>;
+def FeaturePower8Vector : SubtargetFeature<"power8-vector", "HasPower8Vector",
+                                           "true",
+                                           "Enable Power8 vector instructions",
+                                           [FeatureVSX, FeatureAltivec]>;
 
 def DeprecatedMFTB   : SubtargetFeature<"", "DeprecatedMFTB", "true",
                                         "Treat mftb as deprecated">;
@@ -116,7 +120,6 @@ def DeprecatedDST    : SubtargetFeature<"", "DeprecatedDST", "true",
 // CMPB         p6, p6x, p7        cmpb
 // DFP          p6, p6x, p7        decimal floating-point instructions
 // POPCNTB      p5 through p7      popcntb and related instructions
-// VSX          p7                 vector-scalar instruction set
 
 //===----------------------------------------------------------------------===//
 // ABI Selection                                                              //
index ba8bda9ec2ca34fdc945ad4bc1aff008cb38a8b7..8d00be829592ead9544037e98debc06f0efc0af9 100644 (file)
@@ -94,6 +94,7 @@ void PPCSubtarget::initializeEnvironment() {
   HasSPE = false;
   HasQPX = false;
   HasVSX = false;
+  HasPower8Vector = false;
   HasFCPSGN = false;
   HasFSQRT = false;
   HasFRE = false;
@@ -155,8 +156,10 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
 
   // FIXME: For now, we disable VSX in little-endian mode until endian
   // issues in those instructions can be addressed.
-  if (IsLittleEndian)
+  if (IsLittleEndian) {
     HasVSX = false;
+    HasPower8Vector = false;
+  }
 
   // Determine default ABI.
   if (TargetABI == PPC_ABI_UNKNOWN) {
index 9e4953f20d9edfbfdee2a82617e874a1eff8a84d..8c135379c7fd14bbd6e189193a9591504362ecb4 100644 (file)
@@ -91,6 +91,7 @@ protected:
   bool HasSPE;
   bool HasQPX;
   bool HasVSX;
+  bool HasPower8Vector;
   bool HasFCPSGN;
   bool HasFSQRT;
   bool HasFRE, HasFRES, HasFRSQRTE, HasFRSQRTES;
@@ -215,6 +216,7 @@ public:
   bool hasSPE() const { return HasSPE; }
   bool hasQPX() const { return HasQPX; }
   bool hasVSX() const { return HasVSX; }
+  bool hasPower8Vector() const { return HasPower8Vector; }
   bool hasMFOCRF() const { return HasMFOCRF; }
   bool hasISEL() const { return HasISEL; }
   bool hasPOPCNTD() const { return HasPOPCNTD; }