summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target
diff options
context:
space:
mode:
authorDylan McKay <me@dylanmckay.io>2017-12-11 11:01:19 +0000
committerDylan McKay <me@dylanmckay.io>2017-12-11 11:01:19 +0000
commitab6204b1e57aa99788f019b2653d0607fe44c1a5 (patch)
tree3ef9dbde1bad835143d0bbf0113817395393eb66 /llvm/lib/Target
parent07d6f881e7dee93771f8516e6e600abda29dac70 (diff)
downloadbcm5719-llvm-ab6204b1e57aa99788f019b2653d0607fe44c1a5.tar.gz
bcm5719-llvm-ab6204b1e57aa99788f019b2653d0607fe44c1a5.zip
[AVR] Fix incorrectly-calculated AVRMCExpr evaluations
This has been broken since r320009. llvm-svn: 320347
Diffstat (limited to 'llvm/lib/Target')
-rw-r--r--llvm/lib/Target/AVR/MCTargetDesc/AVRMCExpr.cpp21
1 files changed, 9 insertions, 12 deletions
diff --git a/llvm/lib/Target/AVR/MCTargetDesc/AVRMCExpr.cpp b/llvm/lib/Target/AVR/MCTargetDesc/AVRMCExpr.cpp
index fdd43dd5ee1..4e13e7adf39 100644
--- a/llvm/lib/Target/AVR/MCTargetDesc/AVRMCExpr.cpp
+++ b/llvm/lib/Target/AVR/MCTargetDesc/AVRMCExpr.cpp
@@ -102,6 +102,7 @@ int64_t AVRMCExpr::evaluateAsInt64(int64_t Value) const {
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_t Value) const {
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:
OpenPOWER on IntegriCloud