1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 11:42:57 +01:00

Fix encoding of CBZ/CBNZ Thumb2 instructions with immediate offsets rather than labels.

llvm-svn: 138837
This commit is contained in:
Owen Anderson 2011-08-30 22:15:17 +00:00
parent 2ca7c2b2c7
commit a59d489162
2 changed files with 13 additions and 1 deletions

View File

@ -501,7 +501,10 @@ getThumbBCCTargetOpValue(const MCInst &MI, unsigned OpIdx,
uint32_t ARMMCCodeEmitter::
getThumbCBTargetOpValue(const MCInst &MI, unsigned OpIdx,
SmallVectorImpl<MCFixup> &Fixups) const {
return ::getBranchTargetOpValue(MI, OpIdx, ARM::fixup_arm_thumb_cb, Fixups);
const MCOperand MO = MI.getOperand(OpIdx);
if (MO.isExpr())
return ::getBranchTargetOpValue(MI, OpIdx, ARM::fixup_arm_thumb_cb, Fixups);
return (MO.getImm() >> 1);
}
/// Return true if this branch has a non-always predication

View File

@ -37,6 +37,15 @@ _func:
@ CHECK: adc r4, r2, #2139095040 @ encoding: [0x42,0xf1,0xff,0x44]
@ CHECK: adc r4, r2, #1664 @ encoding: [0x42,0xf5,0xd0,0x64]
@------------------------------------------------------------------------------
@ CBZ/CBNZ
@------------------------------------------------------------------------------
cbnz r7, #6
cbnz r7, #12
@ CHECK: cbnz r7, #6 @ encoding: [0x1f,0xb9]
@ CHECK: cbnz r7, #12 @ encoding: [0x37,0xb9]
@------------------------------------------------------------------------------
@ IT
@------------------------------------------------------------------------------