qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 5/6] Do constant folding for shift operations.


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH 5/6] Do constant folding for shift operations.
Date: Fri, 27 May 2011 09:09:38 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110428 Fedora/3.1.10-1.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.10

On 05/26/2011 09:14 PM, Blue Swirl wrote:
   x = (int32_t)x>>  (int32_t)y;
>>>
>>  This expression has an implementation-defined behavior accroding to
>>  C99 6.5.7 so we decided to emulate signed shifts by hand.
>
>  Technically, yes.  In practice, no.  GCC, ICC, LLVM, MSVC all know
>  what the user wants here and will implement it "properly".

Can't this be probed by configure? Then a wrapper could be introduced
for signed shifts.

The reason for implementation-defined behavior is basically to allow for non-two's-complement machine, which isn't really practical to support.

Paolo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]