[llvm] r219501 - [PowerPC] Add feature for Power8 vector extensions

Bill Schmidt wschmidt at linux.vnet.ibm.com
Fri Oct 10 08:09:29 PDT 2014


Author: wschmidt
Date: Fri Oct 10 10:09:28 2014
New Revision: 219501

URL: http://llvm.org/viewvc/llvm-project?rev=219501&view=rev
Log:
[PowerPC] Add feature for Power8 vector extensions

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.

Modified:
    llvm/trunk/lib/Target/PowerPC/PPC.td
    llvm/trunk/lib/Target/PowerPC/PPCSubtarget.cpp
    llvm/trunk/lib/Target/PowerPC/PPCSubtarget.h

Modified: llvm/trunk/lib/Target/PowerPC/PPC.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPC.td?rev=219501&r1=219500&r2=219501&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPC.td (original)
+++ llvm/trunk/lib/Target/PowerPC/PPC.td Fri Oct 10 10:09:28 2014
@@ -104,6 +104,10 @@ def FeatureQPX       : SubtargetFeature<
 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<
 // 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                                                              //

Modified: llvm/trunk/lib/Target/PowerPC/PPCSubtarget.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCSubtarget.cpp?rev=219501&r1=219500&r2=219501&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCSubtarget.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCSubtarget.cpp Fri Oct 10 10:09:28 2014
@@ -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
 
   // 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) {

Modified: llvm/trunk/lib/Target/PowerPC/PPCSubtarget.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCSubtarget.h?rev=219501&r1=219500&r2=219501&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCSubtarget.h (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCSubtarget.h Fri Oct 10 10:09:28 2014
@@ -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; }





More information about the llvm-commits mailing list