Re: [Qemu-devel] [PATCH 1/2] target-arm: Use sextract32() in branch decode

2013-08-24 Thread Peter Maydell
On 23 August 2013 19:09, Richard Henderson wrote: > On 08/23/2013 09:12 AM, Peter Maydell wrote: >> -offset = (((int32_t)insn << 8) >> 8); >> -val += (offset << 2) + 4; >> +offset = sextract32(insn << 2, 0, 26); >> +val += offset + 4;

Re: [Qemu-devel] [PATCH 1/2] target-arm: Use sextract32() in branch decode

2013-08-23 Thread Richard Henderson
On 08/23/2013 09:12 AM, Peter Maydell wrote: > -offset = (((int32_t)insn << 8) >> 8); > -val += (offset << 2) + 4; > +offset = sextract32(insn << 2, 0, 26); > +val += offset + 4; I read this incorrectly at first, considering the shift

[Qemu-devel] [PATCH 1/2] target-arm: Use sextract32() in branch decode

2013-08-23 Thread Peter Maydell
In the decode of ARM B and BL insns, swap the order of the "append 2 implicit zeros to imm24" and the sign extend, and use the new sextract32() utility function to do the latter. This avoids a direct dependency on the undefined C behaviour of shifting into the sign bit of an integer. Signed-off-by