diff options
-rw-r--r-- | lib/Target/ARM/ARMMCCodeEmitter.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/Target/ARM/ARMMCCodeEmitter.cpp b/lib/Target/ARM/ARMMCCodeEmitter.cpp index 4b05919..d6926d9 100644 --- a/lib/Target/ARM/ARMMCCodeEmitter.cpp +++ b/lib/Target/ARM/ARMMCCodeEmitter.cpp @@ -642,8 +642,12 @@ static unsigned getAddrModeSOpValue(const MCInst &MI, unsigned OpIdx, const MCOperand &MO2 = MI.getOperand(OpIdx + 2); unsigned Rn = getARMRegisterNumbering(MO.getReg()); unsigned Imm5 = (MO1.getImm() / Scale) & 0x1f; - unsigned Rm = getARMRegisterNumbering(MO2.getReg()); - return (Rm << 3) | (Imm5 << 3) | Rn; + + if (MO2.getReg() != 0) + // Is an immediate. + Imm5 = getARMRegisterNumbering(MO2.getReg()); + + return (Imm5 << 3) | Rn; } /// getAddrModeS4OpValue - Return encoding for t_addrmode_s4 operands. |