[llvm-branch-commits] [llvm-branch] r88721 - in /llvm/branches/Apple/Leela-M1: include/llvm/CodeGen/SelectionDAGNodes.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/Target/PowerPC/PPCISelLowering.cpp test/CodeGen/PowerPC/vec_splat_constant.ll

Bill Wendling isanbard at gmail.com
Fri Nov 13 15:41:05 PST 2009


Author: void
Date: Fri Nov 13 17:41:04 2009
New Revision: 88721

URL: http://llvm.org/viewvc/llvm-project?rev=88721&view=rev
Log:
$ svn merge -c 87060 https://llvm.org/svn/llvm-project/llvm/trunk
--- Merging r87060 into '.':
A    test/CodeGen/PowerPC/vec_splat_constant.ll
U    include/llvm/CodeGen/SelectionDAGNodes.h
U    lib/CodeGen/SelectionDAG/SelectionDAG.cpp
U    lib/Target/PowerPC/PPCISelLowering.cpp


Added:
    llvm/branches/Apple/Leela-M1/test/CodeGen/PowerPC/vec_splat_constant.ll
      - copied unchanged from r87060, llvm/trunk/test/CodeGen/PowerPC/vec_splat_constant.ll
Modified:
    llvm/branches/Apple/Leela-M1/include/llvm/CodeGen/SelectionDAGNodes.h
    llvm/branches/Apple/Leela-M1/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
    llvm/branches/Apple/Leela-M1/lib/Target/PowerPC/PPCISelLowering.cpp

Modified: llvm/branches/Apple/Leela-M1/include/llvm/CodeGen/SelectionDAGNodes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela-M1/include/llvm/CodeGen/SelectionDAGNodes.h?rev=88721&r1=88720&r2=88721&view=diff

==============================================================================
--- llvm/branches/Apple/Leela-M1/include/llvm/CodeGen/SelectionDAGNodes.h (original)
+++ llvm/branches/Apple/Leela-M1/include/llvm/CodeGen/SelectionDAGNodes.h Fri Nov 13 17:41:04 2009
@@ -1953,10 +1953,10 @@
   /// that value are zero, and the corresponding bits in the SplatUndef mask
   /// are set.  The SplatBitSize value is set to the splat element size in
   /// bits.  HasAnyUndefs is set to true if any bits in the vector are
-  /// undefined.
+  /// undefined.  isBigEndian describes the endianness of the target.
   bool isConstantSplat(APInt &SplatValue, APInt &SplatUndef,
                        unsigned &SplatBitSize, bool &HasAnyUndefs,
-                       unsigned MinSplatBits = 0);
+                       unsigned MinSplatBits = 0, bool isBigEndian = false);
 
   static inline bool classof(const BuildVectorSDNode *) { return true; }
   static inline bool classof(const SDNode *N) {

Modified: llvm/branches/Apple/Leela-M1/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela-M1/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=88721&r1=88720&r2=88721&view=diff

==============================================================================
--- llvm/branches/Apple/Leela-M1/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original)
+++ llvm/branches/Apple/Leela-M1/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Fri Nov 13 17:41:04 2009
@@ -5917,7 +5917,8 @@
                                         APInt &SplatUndef,
                                         unsigned &SplatBitSize,
                                         bool &HasAnyUndefs,
-                                        unsigned MinSplatBits) {
+                                        unsigned MinSplatBits,
+                                        bool isBigEndian) {
   EVT VT = getValueType(0);
   assert(VT.isVector() && "Expected a vector type");
   unsigned sz = VT.getSizeInBits();
@@ -5934,12 +5935,14 @@
   unsigned int nOps = getNumOperands();
   assert(nOps > 0 && "isConstantSplat has 0-size build vector");
   unsigned EltBitSize = VT.getVectorElementType().getSizeInBits();
-  for (unsigned i = 0; i < nOps; ++i) {
+
+  for (unsigned j = 0; j < nOps; ++j) {
+    unsigned i = isBigEndian ? nOps-1-j : j;
     SDValue OpVal = getOperand(i);
-    unsigned BitPos = i * EltBitSize;
+    unsigned BitPos = j * EltBitSize;
 
     if (OpVal.getOpcode() == ISD::UNDEF)
-      SplatUndef |= APInt::getBitsSet(sz, BitPos, BitPos +EltBitSize);
+      SplatUndef |= APInt::getBitsSet(sz, BitPos, BitPos + EltBitSize);
     else if (ConstantSDNode *CN = dyn_cast<ConstantSDNode>(OpVal))
       SplatValue |= (APInt(CN->getAPIntValue()).zextOrTrunc(EltBitSize).
                      zextOrTrunc(sz) << BitPos);

Modified: llvm/branches/Apple/Leela-M1/lib/Target/PowerPC/PPCISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela-M1/lib/Target/PowerPC/PPCISelLowering.cpp?rev=88721&r1=88720&r2=88721&view=diff

==============================================================================
--- llvm/branches/Apple/Leela-M1/lib/Target/PowerPC/PPCISelLowering.cpp (original)
+++ llvm/branches/Apple/Leela-M1/lib/Target/PowerPC/PPCISelLowering.cpp Fri Nov 13 17:41:04 2009
@@ -635,7 +635,7 @@
   unsigned BitSize;
   bool HasAnyUndefs;
   
-  if (BV->isConstantSplat(APVal, APUndef, BitSize, HasAnyUndefs, 32))
+  if (BV->isConstantSplat(APVal, APUndef, BitSize, HasAnyUndefs, 32, true))
     if (ConstantFPSDNode *CFP = dyn_cast<ConstantFPSDNode>(N->getOperand(0)))
       return CFP->getValueAPF().isNegZero();
 
@@ -3635,7 +3635,7 @@
   unsigned SplatBitSize;
   bool HasAnyUndefs;
   if (! BVN->isConstantSplat(APSplatBits, APSplatUndef, SplatBitSize,
-                             HasAnyUndefs) || SplatBitSize > 32)
+                             HasAnyUndefs, 0, true) || SplatBitSize > 32)
     return SDValue();
 
   unsigned SplatBits = APSplatBits.getZExtValue();





More information about the llvm-branch-commits mailing list