aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/APInt.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Support/APInt.cpp')
-rw-r--r--llvm/lib/Support/APInt.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/llvm/lib/Support/APInt.cpp b/llvm/lib/Support/APInt.cpp
index 0c0e1d0..f6fd5f9 100644
--- a/llvm/lib/Support/APInt.cpp
+++ b/llvm/lib/Support/APInt.cpp
@@ -3169,3 +3169,21 @@ APInt APIntOps::pow(const APInt &X, int64_t N) {
}
return Acc;
}
+
+APInt llvm::APIntOps::fshl(const APInt &Hi, const APInt &Lo,
+ const APInt &Shift) {
+ assert(Hi.getBitWidth() == Lo.getBitWidth());
+ unsigned ShiftAmt = rotateModulo(Hi.getBitWidth(), Shift);
+ if (ShiftAmt == 0)
+ return Hi;
+ return Hi.shl(ShiftAmt) | Lo.lshr(Hi.getBitWidth() - ShiftAmt);
+}
+
+APInt llvm::APIntOps::fshr(const APInt &Hi, const APInt &Lo,
+ const APInt &Shift) {
+ assert(Hi.getBitWidth() == Lo.getBitWidth());
+ unsigned ShiftAmt = rotateModulo(Hi.getBitWidth(), Shift);
+ if (ShiftAmt == 0)
+ return Lo;
+ return Hi.shl(Hi.getBitWidth() - ShiftAmt) | Lo.lshr(ShiftAmt);
+}