On Sun, Sep 23, 2012 at 6:02 PM, Andreas Jaeger <aj@suse.com> wrote:
On 09/23/2012 06:05 PM, H.J. Lu wrote:
Hi,
http://sourceware.org/bugzilla/show_bug.cgi?id=14602
shows that we need to test all IFUNC implementations as much as we can.
I created hjl/ifunc/test branch to automatically test IFUNC
implementations. Its goals are
1. Provide an infrastructure to tests all implementations supported
on build machine automatically.
Yes, this is something we really need.
2. No changes to IFUNC selectors.
3. Test the new IFUNC implementation by adding it to the list of
IFUNC functions.
Change IFUNC selector is not the goal of this branch. Any comments?
I haven't looked at the branch in detail - and don't understand what you
mean with 3.
Takes x86-64 memcpy as example, libc-func.c has
extern __typeof (memcpy) __memcpy_sse2;
extern __typeof (memcpy) __memcpy_ssse3;
extern __typeof (memcpy) __memcpy_ssse3_back;
static const struct libc_func_test memcpy_list[] =
{
LIBC_FUNC_INIT (__memcpy_ssse3_back),
LIBC_FUNC_INIT (__memcpy_ssse3),
LIBC_FUNC_INIT (__memcpy_sse2),
{ NULL, NULL },
};
static const struct libc_func_test *
find_memcpy (void)
{
return memcpy_list + (HAS_SSSE3 ? 0 : 2);
}
const struct libc_func_test *
__libc_func (const char *name)
{
...
if (strcmp (name, "memcpy") == 0)
return find_memcpy ();
__libc_func ("memcpy") returns a list of memcpy functions
supported in build machine. When we add an AVX optimized
memcpy, all what we have to do is
extern __typeof (memcpy) __memcpy_sse2;
extern __typeof (memcpy) __memcpy_ssse3;
extern __typeof (memcpy) __memcpy_ssse3_back;
extern __typeof (memcpy) __memcpy_avx;
static const struct libc_func_test memcpy_list[] =
{
LIBC_FUNC_INIT (__memcpy_avx),
LIBC_FUNC_INIT (__memcpy_ssse3_back),
LIBC_FUNC_INIT (__memcpy_ssse3),
LIBC_FUNC_INIT (__memcpy_sse2),
{ NULL, NULL },
};
static const struct libc_func_test *
find_memcpy (void)
{
return memcpy_list + (HAS_AVX ? 0 : (HAS_SSSE3 ? 1: 3));
}