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



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.

Paolo


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