This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] PowerPC - ilogb[f|l] optimization for POWER7
- From: Richard Henderson <rth at twiddle dot net>
- To: Adhemerval Zanella <azanella at linux dot vnet dot ibm dot com>
- Cc: "GNU C. Library" <libc-alpha at sourceware dot org>
- Date: Thu, 10 May 2012 08:55:57 -0700
- Subject: Re: [PATCH] PowerPC - ilogb[f|l] optimization for POWER7
- References: <4FA91281.8090109@linux.vnet.ibm.com>
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~