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

Chris Lattner lattner at cs.uiuc.edu
Tue May 25 00:36:01 PDT 2004


Changes in directory llvm/lib/VMCore:

Constants.cpp updated: 1.87 -> 1.88

---
Log message:

Implement some helpers


---
Diffs of the changes:  (+10 -0)

Index: llvm/lib/VMCore/Constants.cpp
diff -u llvm/lib/VMCore/Constants.cpp:1.87 llvm/lib/VMCore/Constants.cpp:1.88
--- llvm/lib/VMCore/Constants.cpp:1.87	Sun Apr  4 18:20:30 2004
+++ llvm/lib/VMCore/Constants.cpp	Tue May 25 00:32:43 2004
@@ -372,7 +372,17 @@
   return get(Instruction::Shr, C1, C2);
 }
 
+Constant *ConstantExpr::getUShr(Constant *C1, Constant *C2) {
+  if (C1->getType()->isUnsigned()) return getShr(C1, C2);
+  return getCast(getShr(getCast(C1,
+                    C1->getType()->getUnsignedVersion()), C2), C1->getType());
+}
 
+Constant *ConstantExpr::getSShr(Constant *C1, Constant *C2) {
+  if (C1->getType()->isSigned()) return getShr(C1, C2);
+  return getCast(getShr(getCast(C1,
+                        C1->getType()->getSignedVersion()), C2), C1->getType());
+}
 
 
 //===----------------------------------------------------------------------===//





More information about the llvm-commits mailing list