[llvm-commits] [llvm] r139964 - in /llvm/trunk: lib/Target/ARM/Disassembler/ARMDisassembler.cpp test/MC/Disassembler/ARM/thumb2.txt
Eli Friedman
eli.friedman at gmail.com
Fri Sep 16 15:49:52 PDT 2011
On Fri, Sep 16, 2011 at 3:29 PM, Owen Anderson <resistor at mac.com> wrote:
> Author: resistor
> Date: Fri Sep 16 17:29:48 2011
> New Revision: 139964
>
> URL: http://llvm.org/viewvc/llvm-project?rev=139964&view=rev
> Log:
> Fix disassembly of Thumb2 BFI instructions with bit range of [0, 32).
>
> Modified:
> llvm/trunk/lib/Target/ARM/Disassembler/ARMDisassembler.cpp
> llvm/trunk/test/MC/Disassembler/ARM/thumb2.txt
>
> Modified: llvm/trunk/lib/Target/ARM/Disassembler/ARMDisassembler.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/Disassembler/ARMDisassembler.cpp?rev=139964&r1=139963&r2=139964&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Target/ARM/Disassembler/ARMDisassembler.cpp (original)
> +++ llvm/trunk/lib/Target/ARM/Disassembler/ARMDisassembler.cpp Fri Sep 16 17:29:48 2011
> @@ -1003,8 +1003,12 @@
> // create the final mask.
> unsigned msb = fieldFromInstruction32(Val, 5, 5);
> unsigned lsb = fieldFromInstruction32(Val, 0, 5);
> +
> uint32_t msb_mask = (1 << (msb+1)) - 1;
> + if (msb == 31) msb_mask = 0xFFFFFFFF;
> uint32_t lsb_mask = (1 << lsb) - 1;
> + if (lsb == 31) lsb_mask = 0xFFFFFFFF;
Err, this change for lsb_mask looks wrong...
Also, strictly speaking, 1 << 31 and 1 << 32 have undefined behavior;
I think the correct formulation is the following:
uint32_t msb_mask = 0xFFFFFFFF;
if (msb != 31) msb_mask = (1U << (msb+1)) - 1;
uint32_t lsb_mask = (1U << lsb) - 1;
-Eli
More information about the llvm-commits
mailing list