[PATCH 2/9] powerpc: Add macros to access floating point registers in thread_struct.
Andreas Schwab
schwab at suse.de
Thu Jun 26 03:08:00 EST 2008
Gabriel Paubert <paubert at iram.es> writes:
> 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
That's wrong. -1 % 2 == -1, 1 % 2 == 1.
Andreas.
--
Andreas Schwab, SuSE Labs, schwab at suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
More information about the Linuxppc-dev
mailing list