This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: RFC: Automatically test IFUNC implementations
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Andreas Jaeger <aj at suse dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Mon, 24 Sep 2012 08:55:13 -0700
- Subject: Re: RFC: Automatically test IFUNC implementations
- References: <20120923220531.GA9021@gmail.com><505FB111.7090407@suse.com>
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));
}
Now AVX memcpy will be tested automatically on AVX
build machine. This commit:
http://sourceware.org/git/?p=glibc.git;a=patch;h=9728fd2ccffac52c3ab3212158646b2e170c76a1
is an example to test new IFUNC implementations.
Thanks.
--
H.J.