[PATCH] PowerPC - ilogb[f|l] optimization for POWER7
Richard Henderson
rth@twiddle.net
Thu May 10 15:56:00 GMT 2012
On 05/08/12 05:33, Adhemerval Zanella wrote:
> +#if defined(_ARCH_PWR7)
> +
> +/* Optimized double to word cast for POWER7: the 'ori 2,2,0'
> + instructions between the store double / load integer is
> + to force a new dispatch group. */
> +#undef DOUBLE_TO_WORDS
> +#define DOUBLE_TO_WORDS(d, i) \
> + do { \
> + double d__ = d; \
> + int32_t i__; \
> + ieee_double_shape_type iw_u; \
> + __asm ( \
> + "fctiwz %1,%1\n" \
> + "stfd %1,%2\n" \
> + "ori 2,2,0\n" \
> + "lwz %0,%3\n" \
> + : "=r" (i__) \
> + : "f" (d__), "m" (iw_u.value), "m" (iw_u.word)); \
> + i = i__; \
> + } while (0)
> +
> +#endif /* __ARCH_PWR7 */
Is this really so much better than what the compiler can generate?
If the dispatch group split is that critical, you ought to fix it
in the scheduler -- it's not like these are the only two double->int
conversions in the entire library.
The documentation for this macro is sorely lacking too. At first I
thought you meant EXTRACT_WORDS64 but hadn't known what the macro
was supposed to be called.
r~
More information about the Libc-alpha
mailing list