[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 21:09:34 PDT 2010
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