Fix encoding for tBcc with immediate offset operand.

llvm-svn: 138889
This commit is contained in:
Owen Anderson 2011-08-31 20:26:14 +00:00
parent ae1acddb95
commit a455a0b1e7
2 changed files with 9 additions and 1 deletions

View File

@ -522,7 +522,11 @@ getThumbBRTargetOpValue(const MCInst &MI, unsigned OpIdx,
uint32_t ARMMCCodeEmitter::
getThumbBCCTargetOpValue(const MCInst &MI, unsigned OpIdx,
SmallVectorImpl<MCFixup> &Fixups) const {
return ::getBranchTargetOpValue(MI, OpIdx, ARM::fixup_arm_thumb_bcc, Fixups);
const MCOperand MO = MI.getOperand(OpIdx);
if (MO.isExpr())
return ::getBranchTargetOpValue(MI, OpIdx, ARM::fixup_arm_thumb_bcc,
Fixups);
return (MO.getImm() >> 1);
}
/// getThumbCBTargetOpValue - Return encoding info for Thumb branch target.

View File

@ -114,6 +114,8 @@ _func:
beq _bar
b #1838
b #-420
beq #336
beq #160
@ CHECK: b _baz @ encoding: [A,0xe0'A']
@ fixup A - offset: 0, value: _baz, kind: fixup_arm_thumb_br
@ -121,6 +123,8 @@ _func:
@ fixup A - offset: 0, value: _bar, kind: fixup_arm_thumb_bcc
@ CHECK: b #1838 @ encoding: [0x97,0xe3]
@ CHECK: b #-420 @ encoding: [0x2e,0xe7]
@ CHECK: beq #336 @ encoding: [0xa8,0xd0]
@ CHECK: beq #160 @ encoding: [0x50,0xd0]
@------------------------------------------------------------------------------
@ BL/BLX