[PATCH 2/9] powerpc: Add macros to access floating point registers in thread_struct.

Scott Wood scottwood at freescale.com
Thu Jun 26 01:34:32 EST 2008


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.

-Scott



More information about the Linuxppc-dev mailing list