summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJohnny Chen <johnny.chen@apple.com>2010-04-02 22:27:38 +0000
committerJohnny Chen <johnny.chen@apple.com>2010-04-02 22:27:38 +0000
commitb68a3ee82a8a34f7bae1d68d76f574e76a5535ef (patch)
treee2d497f6b8dc8c2f031afbc3d5dd3ff4c7649dd3 /include
parent762647673379dbcff6bbba6167b0b1b0d658ba9d (diff)
downloadllvm-b68a3ee82a8a34f7bae1d68d76f574e76a5535ef.tar.gz
llvm-b68a3ee82a8a34f7bae1d68d76f574e76a5535ef.tar.bz2
llvm-b68a3ee82a8a34f7bae1d68d76f574e76a5535ef.tar.xz
Second try of initial ARM/Thumb disassembler check-in. It consists of a tablgen
backend (ARMDecoderEmitter) which emits the decoder functions for ARM and Thumb, and the disassembler core which invokes the decoder function and builds up the MCInst based on the decoded Opcode. Reviewed by Chris Latter and Bob Wilson. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100233 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/Support/MathExtras.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/llvm/Support/MathExtras.h b/include/llvm/Support/MathExtras.h
index 9c5f32cd5f..f56241c579 100644
--- a/include/llvm/Support/MathExtras.h
+++ b/include/llvm/Support/MathExtras.h
@@ -457,6 +457,18 @@ inline int64_t abs64(int64_t x) {
return (x < 0) ? -x : x;
}
+/// SignExtend32 - Sign extend B-bit number x to 32-bit int.
+/// Usage int32_t r = SignExtend32<5>(x);
+template <unsigned B> inline int32_t SignExtend32(int32_t x) {
+ return (x << (32 - B)) >> (32 - B);
+}
+
+/// SignExtend64 - Sign extend B-bit number x to 64-bit int.
+/// Usage int64_t r = SignExtend64<5>(x);
+template <unsigned B> inline int64_t SignExtend64(int32_t x) {
+ return (x << (64 - B)) >> (64 - B);
+}
+
} // End llvm namespace
#endif