Skip to content

Commit 543c670

Browse files
committed
Fix ADR instruction encoding
1 parent 1856935 commit 543c670

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCCodeEmitter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ AArch64MCCodeEmitter::getAdrLabelOpValue(const MCInst &MI, unsigned OpIdx,
219219

220220
// If the destination is an immediate, we have nothing to do.
221221
if (MO.isImm())
222-
return MO.getImm() - (MI.getAddress() >> 12);
222+
return MO.getImm() - (MI.getAddress() >> (MI.getOpcode() == AArch64::ADR ? 0 : 12));
223223
assert(MO.isExpr() && "Unexpected target type!");
224224
const MCExpr *Expr = MO.getExpr();
225225

0 commit comments

Comments
 (0)