[llvm-commits] CVS: llvm/lib/VMCore/Instructions.cpp

Chris Lattner lattner at cs.uiuc.edu
Sat Mar 25 13:54:34 PST 2006



Changes in directory llvm/lib/VMCore:

Instructions.cpp updated: 1.31 -> 1.32
---
Log message:

Teach BinaryOperator::createNot to work with packed integer types


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

 Instructions.cpp |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)


Index: llvm/lib/VMCore/Instructions.cpp
diff -u llvm/lib/VMCore/Instructions.cpp:1.31 llvm/lib/VMCore/Instructions.cpp:1.32
--- llvm/lib/VMCore/Instructions.cpp:1.31	Tue Jan 17 14:07:22 2006
+++ llvm/lib/VMCore/Instructions.cpp	Sat Mar 25 15:54:21 2006
@@ -923,8 +923,15 @@
 
 BinaryOperator *BinaryOperator::createNot(Value *Op, const std::string &Name,
                                           Instruction *InsertBefore) {
-  return new BinaryOperator(Instruction::Xor, Op,
-                            ConstantIntegral::getAllOnesValue(Op->getType()),
+  Constant *C;
+  if (const PackedType *PTy = dyn_cast<PackedType>(Op->getType())) {
+    C = ConstantIntegral::getAllOnesValue(PTy->getElementType());
+    C = ConstantPacked::get(std::vector<Constant*>(PTy->getNumElements(), C));
+  } else {
+    C = ConstantIntegral::getAllOnesValue(Op->getType());
+  }
+  
+  return new BinaryOperator(Instruction::Xor, Op, C,
                             Op->getType(), Name, InsertBefore);
 }
 






More information about the llvm-commits mailing list