summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorTim Northover <tnorthover@apple.com>2014-04-15 14:00:15 +0000
committerTim Northover <tnorthover@apple.com>2014-04-15 14:00:15 +0000
commitcbcb7a37f771673082e27de085158ca19c4a20ed (patch)
tree8422cad94abb151f6516b4ef34c0cb2e0a6a0789 /llvm/lib
parent6e27b8ded54d0388a242aca4a0d648aa55f9add9 (diff)
downloadbcm5719-llvm-cbcb7a37f771673082e27de085158ca19c4a20ed.tar.gz
bcm5719-llvm-cbcb7a37f771673082e27de085158ca19c4a20ed.zip
AArch64/ARM64: only mangle MOVZ/MOVN during encoding when needed
Sometimes we need emit the bits that would actually be a MOVN when producing a relocated MOVZ instruction (don't ask). But not always, a check which ARM64 got wrong until now. llvm-svn: 206289
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/ARM64/MCTargetDesc/ARM64MCCodeEmitter.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/llvm/lib/Target/ARM64/MCTargetDesc/ARM64MCCodeEmitter.cpp b/llvm/lib/Target/ARM64/MCTargetDesc/ARM64MCCodeEmitter.cpp
index 95020e4395e..f65099e85b0 100644
--- a/llvm/lib/Target/ARM64/MCTargetDesc/ARM64MCCodeEmitter.cpp
+++ b/llvm/lib/Target/ARM64/MCTargetDesc/ARM64MCCodeEmitter.cpp
@@ -550,6 +550,22 @@ unsigned ARM64MCCodeEmitter::fixMOVZ(const MCInst &MI, unsigned EncodedValue,
if (UImm16MO.isImm())
return EncodedValue;
+ const ARM64MCExpr *A64E = cast<ARM64MCExpr>(UImm16MO.getExpr());
+ switch (A64E->getKind()) {
+ case ARM64MCExpr::VK_DTPREL_G2:
+ case ARM64MCExpr::VK_DTPREL_G1:
+ case ARM64MCExpr::VK_DTPREL_G0:
+ case ARM64MCExpr::VK_GOTTPREL_G1:
+ case ARM64MCExpr::VK_TPREL_G2:
+ case ARM64MCExpr::VK_TPREL_G1:
+ case ARM64MCExpr::VK_TPREL_G0:
+ return EncodedValue & ~(1u << 30);
+ default:
+ // Nothing to do for an unsigned fixup.
+ return EncodedValue;
+ }
+
+
return EncodedValue & ~(1u << 30);
}
OpenPOWER on IntegriCloud