[llvm-commits] [llvm] r100233 - in /llvm/trunk: ./ include/llvm/Support/ lib/Target/ARM/ lib/Target/ARM/Disassembler/ test/MC/Disassembler/ utils/TableGen/
Johnny Chen
johnny.chen at apple.com
Sun Apr 4 21:26:19 PDT 2010
Did you mean:
You can shift left an N bit number between 0 and (32-N) bits safely without overflow.
in the case of SignExtend32<N>(x)?
(N must be > 1 and < 32)
On Apr 4, 2010, at 9:09 PM, Chris Lattner wrote:
> On Apr 4, 2010, at 9:03 PM, Jakob Stoklund Olesen wrote:
>>>>> 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?
>>
>> If you left-shift a positive number until it goes negative, that's an
>> overflow. At least that's how I understand it.
>
> You can shift left an N bit number between 0 and N-1 bits safely without overflow.
>
> -Chris
More information about the llvm-commits
mailing list