[llvm-commits] [llvm] r100233 - in /llvm/trunk: ./ include/llvm/Support/ lib/Target/ARM/ lib/Target/ARM/Disassembler/ test/MC/Disassembler/ utils/TableGen/

Chris Lattner clattner at apple.com
Sun Apr 4 20:54:25 PDT 2010


On Apr 4, 2010, at 8:48 PM, Jakob Stoklund Olesen wrote:

> On Sun, 2010-04-04 at 20:32 -0700, Chris Lattner wrote:
>> On Apr 4, 2010, at 6:59 PM, Jakob Stoklund Olesen wrote:
>> 
>>> 
>>> On Apr 4, 2010, at 6:48 PM, Johnny Chen wrote:
>>> 
>>>> Hi Jakob,
>>>> 
>>>> Thanks.  You're welcome to modify the MathExtras.h stuff.
>>>> Right now, arm disassembler is the only client of SignExtend32<B>(int32_t x).
>>>> I originally use a bit-field hack but Chris thinks it is non-portable.
>>> 
>>> How about this?
>>> 
>>> return x | -(x & (1 << (B - 1)));
>> 
>> Shift left + shift right is more easily recognized by the code generator as a sext.
> 
> Sure, but if we're not building with -fwrapv, it overflows the int and
> causes undefined behaviour.

Huh?  In what case?

-chris



More information about the llvm-commits mailing list