This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: Add x86 integer intrinsics


On Wed, Jun 10, 2009 at 8:38 AM, Paolo Bonzini<paolo.bonzini@gmail.com> wrote:
>
>> int
>> rol(int x, int y)
>> {
>> ?return (x << y) | (x >> (32 - y));
>> ?}
>
> Uhm, because it is not a rotate (the >> shift is arithmetic). ?But this
> works:
>
> ?return ((unsigned)x << y) + ((unsigned)x >> (32-y));
>
> and the dumps show that it is done before inlining.
>
> I could not get it to work for rolb/rolw due to int promotion, but I think
> we should treat this as a tree-level missed optimization.
>

I will update my patch to rewrite 32bit and 64bit rotate/shift.

-- 
H.J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]