[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 16:12:39 PDT 2011


On Fri, Sep 16, 2011 at 4:01 PM, Owen Anderson <resistor at mac.com> wrote:
>
> On Sep 16, 2011, at 3:49 PM, Eli Friedman wrote:
>>
>> 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;
>
> Doesn't this formulation get the case where LSB == 31 wrong?

Suppose lsb == 31, msb == 31 (the only legal case for lsb == 31).  The
output mask is supposed to be 0x80000000.  On trunk, it is
0x00000000...

If I'm not mistaken, the relevant encoding is "0x60 0xf3 0xdf 0x76".

-Eli



More information about the llvm-commits mailing list