On Wed, Jun 25, 2008 at 10:34:32AM -0500, Scott Wood wrote: > Kumar Gala wrote: > >>+/* Macros to workout the correct index for the FPR in the thread > >>struct */ > >>+#define FPRNUMBER(i) (((i) - PT_FPR0) >> 1) > >>+#define FPRHALF(i) (((i) - PT_FPR0) % 2) > > > >Have you looked at what the compiler spits out here to make sure we > >aren't getting a divide? Seems like we could use '& 0x1'. > > GCC's not *that* dumb. However, you may get some unnecessary > sign-twiddling if "i" is signed.
Not for modulo 2, it's only an even/odd choice and GCC implements that efficiently IIRC. For other powers of 2, making the left hand side unsigned helps the compiler. The right shift OTOH might be faster if "i" is unsigned since right signed right shifts affect the carry on PPC (I really don't know if srawi is slower than srwi on some processors, srwi is a form of rlwinm which is always fast). Gabriel _______________________________________________ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev