[llvm-commits] CVS: llvm/lib/ExecutionEngine/Interpreter/Execution.cpp
Reid Spencer
reid at x10sys.com
Wed Jan 17 17:33:02 PST 2007
Changes in directory llvm/lib/ExecutionEngine/Interpreter:
Execution.cpp updated: 1.160 -> 1.161
---
Log message:
Make shl instruction mask its result to the correct bitsize. This is
sufficient to get llvm-test/SingleSource/UnitTests/Integer/general-test.ll
working with lli in interpreter mode.
---
Diffs of the changes: (+10 -5)
Execution.cpp | 15 ++++++++++-----
1 files changed, 10 insertions(+), 5 deletions(-)
Index: llvm/lib/ExecutionEngine/Interpreter/Execution.cpp
diff -u llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.160 llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.161
--- llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.160 Wed Jan 17 19:25:42 2007
+++ llvm/lib/ExecutionEngine/Interpreter/Execution.cpp Wed Jan 17 19:32:46 2007
@@ -1187,15 +1187,20 @@
GenericValue Dest;
if (const IntegerType *ITy = cast<IntegerType>(Ty)) {
unsigned BitWidth = ITy->getBitWidth();
- if (BitWidth <= 8)
+ uint32_t BitMask = (1ull << BitWidth) - 1;
+ if (BitWidth <= 8) {
Dest.Int8Val = ((uint8_t)Src1.Int8Val) << ((uint32_t)Src2.Int8Val);
- else if (BitWidth <= 16)
+ Dest.Int8Val &= BitMask;
+ } else if (BitWidth <= 16) {
Dest.Int16Val = ((uint16_t)Src1.Int16Val) << ((uint32_t)Src2.Int8Val);
- else if (BitWidth <= 32)
+ Dest.Int16Val &= BitMask;
+ } else if (BitWidth <= 32) {
Dest.Int32Val = ((uint32_t)Src1.Int32Val) << ((uint32_t)Src2.Int8Val);
- else if (BitWidth <= 64)
+ Dest.Int32Val &= BitMask;
+ } else if (BitWidth <= 64) {
Dest.Int64Val = ((uint64_t)Src1.Int64Val) << ((uint32_t)Src2.Int8Val);
- else {
+ Dest.Int64Val &= BitMask;
+ } else {
cerr << "Integer types > 64 bits not supported: " << *Ty << "\n";
abort();
}
More information about the llvm-commits
mailing list