PATCH: Add x86 integer intrinsics

H.J. Lu hjl.tools@gmail.com
Wed Jun 10 16:07:00 GMT 2009


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.



More information about the Gcc-patches mailing list