summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-05-25 05:32:43 +0000
committerChris Lattner <sabre@nondot.org>2004-05-25 05:32:43 +0000
commitdb8bdba5938136e06a0537a3ba568a4a68850506 (patch)
treed18bb5d0d3d07a415a8c47b7d7ce6748c5fc5b68 /llvm
parentbbdd577a003f54aa625ac6cc655e71cb8a6a0bd9 (diff)
downloadbcm5719-llvm-db8bdba5938136e06a0537a3ba568a4a68850506.tar.gz
bcm5719-llvm-db8bdba5938136e06a0537a3ba568a4a68850506.zip
Implement some helpers
llvm-svn: 13738
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/VMCore/Constants.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/VMCore/Constants.cpp b/llvm/lib/VMCore/Constants.cpp
index 3ed70089c1a..a393be98ae3 100644
--- a/llvm/lib/VMCore/Constants.cpp
+++ b/llvm/lib/VMCore/Constants.cpp
@@ -372,7 +372,17 @@ Constant *ConstantExpr::getShr(Constant *C1, Constant *C2) {
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());
+}
//===----------------------------------------------------------------------===//
OpenPOWER on IntegriCloud