Changes in directory llvm/lib/Target/PowerPC:

PPCISelLowering.cpp updated: 1.102 -> 1.103
---
Log message:

Implement PPC::isSplatShuffleMask and PPC::getVSPLTImmediate.


---
Diffs of the changes:  (+13 -2)

 PPCISelLowering.cpp |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)


Index: llvm/lib/Target/PowerPC/PPCISelLowering.cpp
diff -u llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.102 
llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.103
--- llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.102   Mon Mar 20 00:33:01 2006
+++ llvm/lib/Target/PowerPC/PPCISelLowering.cpp Mon Mar 20 00:37:44 2006
@@ -245,14 +245,25 @@
 /// VSPLTB/VSPLTH/VSPLTW.
 bool PPC::isSplatShuffleMask(SDNode *N) {
   assert(N->getOpcode() == ISD::BUILD_VECTOR);
-  return false;
+  // This is a splat operation if each element of the permute is the same, and
+  // if the value doesn't reference the second vector.
+  SDOperand Elt = N->getOperand(0);
+  assert(isa<ConstantSDNode>(Elt) && "Invalid VECTOR_SHUFFLE mask!");
+  for (unsigned i = 1, e = N->getNumOperands(); i != e; ++i) {
+    assert(isa<ConstantSDNode>(N->getOperand(i)) &&
+           "Invalid VECTOR_SHUFFLE mask!");
+    if (N->getOperand(i) != Elt) return false;
+  }
+
+  // Make sure it is a splat of the first vector operand.
+  return cast<ConstantSDNode>(Elt)->getValue() < N->getNumOperands();
 }
 
 /// getVSPLTImmediate - Return the appropriate VSPLT* immediate to splat the
 /// specified isSplatShuffleMask VECTOR_SHUFFLE mask.
 unsigned PPC::getVSPLTImmediate(SDNode *N) {
   assert(isSplatShuffleMask(N));
-  return 0;
+  return cast<ConstantSDNode>(N)->getValue();
 }
 
 



_______________________________________________
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

Reply via email to