[llvm] r320347 - [AVR] Fix incorrectly-calculated AVRMCExpr evaluations
Dylan McKay via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 11 03:01:20 PST 2017
Author: dylanmckay
Date: Mon Dec 11 03:01:19 2017
New Revision: 320347
URL: http://llvm.org/viewvc/llvm-project?rev=320347&view=rev
Log:
[AVR] Fix incorrectly-calculated AVRMCExpr evaluations
This has been broken since r320009.
Modified:
llvm/trunk/lib/Target/AVR/MCTargetDesc/AVRMCExpr.cpp
Modified: llvm/trunk/lib/Target/AVR/MCTargetDesc/AVRMCExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AVR/MCTargetDesc/AVRMCExpr.cpp?rev=320347&r1=320346&r2=320347&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AVR/MCTargetDesc/AVRMCExpr.cpp (original)
+++ llvm/trunk/lib/Target/AVR/MCTargetDesc/AVRMCExpr.cpp Mon Dec 11 03:01:19 2017
@@ -102,6 +102,7 @@ int64_t AVRMCExpr::evaluateAsInt64(int64
switch (Kind) {
case AVRMCExpr::VK_AVR_LO8:
+ Value &= 0xff;
break;
case AVRMCExpr::VK_AVR_HI8:
Value &= 0xff00;
@@ -116,27 +117,23 @@ int64_t AVRMCExpr::evaluateAsInt64(int64
Value >>= 24;
break;
case AVRMCExpr::VK_AVR_PM_LO8:
+ case AVRMCExpr::VK_AVR_LO8_GS:
+ Value >>= 1; // Program memory addresses must always be shifted by one.
Value &= 0xff;
- Value >>= 1;
break;
case AVRMCExpr::VK_AVR_PM_HI8:
+ case AVRMCExpr::VK_AVR_HI8_GS:
+ Value >>= 1; // Program memory addresses must always be shifted by one.
Value &= 0xff00;
- Value >>= 9;
+ Value >>= 8;
break;
case AVRMCExpr::VK_AVR_PM_HH8:
+ Value >>= 1; // Program memory addresses must always be shifted by one.
Value &= 0xff0000;
- Value >>= 17;
- break;
- case AVRMCExpr::VK_AVR_LO8_GS:
- Value &= 0xff;
- Value >>= 1;
- break;
- case AVRMCExpr::VK_AVR_HI8_GS:
- Value &= 0xff00;
- Value >>= 9;
+ Value >>= 16;
break;
case AVRMCExpr::VK_AVR_GS:
- Value >>= 1;
+ Value >>= 1; // Program memory addresses must always be shifted by one.
break;
case AVRMCExpr::VK_AVR_None:
More information about the llvm-commits
mailing list