This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [RFC] How to add vector math functions to Glibc
- From: Andrew Senkevich <andrew dot n dot senkevich at gmail dot com>
- To: "Joseph S. Myers" <joseph at codesourcery dot com>
- Cc: libc-alpha <libc-alpha at sourceware dot org>
- Date: Tue, 21 Oct 2014 17:19:38 +0400
- Subject: Re: [RFC] How to add vector math functions to Glibc
- Authentication-results: sourceware.org; auth=none
- References: <CAMXFM3tjquzniXP1weqxSVFJyhXqsf2PHuyrrrmqp7K0ZzORqA at mail dot gmail dot com> <54246CB5 dot 7020908 at redhat dot com> <CAMe9rOoLmJ2jHWmERoB0M83WNKovJOgh0--Kquw9O86A1tPU0g at mail dot gmail dot com> <5424733D dot 6010305 at redhat dot com> <CAMe9rOpacze055qyBFzz3M-b-GNtXCqZzMmkScBL9a94zVj28g at mail dot gmail dot com> <54247FAB dot 6050002 at redhat dot com> <CAMXFM3v8narOLMHC5U=fvyTFWV6s4ZACN-UrAC4fAcUs9SOFfA at mail dot gmail dot com> <54257507 dot 9070508 at redhat dot com> <CAMXFM3vOLspQtHxgJfD_Emht480w2RMbiwnEH6A_LhoS-JZFag at mail dot gmail dot com> <Pine dot LNX dot 4 dot 64 dot 1409301620020 dot 15186 at digraph dot polyomino dot org dot uk> <542AF92E dot 8090708 at lip6 dot fr> <Pine dot LNX dot 4 dot 64 dot 1409302003410 dot 12188 at digraph dot polyomino dot org dot uk> <CAMXFM3tuM_p6Acp4hzoQ2xzR=4BZqtw8NbezqY6h8V4Xx=5hUA at mail dot gmail dot com> <Pine dot LNX dot 4 dot 64 dot 1410021411420 dot 24886 at digraph dot polyomino dot org dot uk> <CAMXFM3uPiuJvSpgmt+8d0B1qh3QSA=TVx0ZExfojDVHzrscL8A at mail dot gmail dot com> <Pine dot LNX dot 4 dot 64 dot 1410091724031 dot 23641 at digraph dot polyomino dot org dot uk> <CAMXFM3uGOKqEAvGYew+9K7bmhObVmnP2u4kUOSh8_Cpwyk8s5g at mail dot gmail dot com> <Pine dot LNX dot 4 dot 64 dot 1410162141290 dot 32736 at digraph dot polyomino dot org dot uk>
2014-10-17 1:51 GMT+04:00 Joseph S. Myers <joseph@codesourcery.com>:
>> + /* Vector trigonometric functions: */
>> +#ifdef TEST_MATHVEC
>> +
>> + cos_test ();
>> +
>> +#else
>
> There shouldn't be such conditionals. It should be arranged that if
> there isn't a relevant vector version of a particular function, running
> vector tests for that function does nothing - so there are no conditionals
> on which *_test functions to run, and none inside those functions, just
> conditionals affecting what the test macros do (by means of conditionals
> inside them such as if (HAVE_VECTOR_cos_double_vlen4), for example,
> resulting from appropriate concatenations).
With HAVE_VECTOR_cos_double_vlen4 we need to have such macros with
zero for all set of not vector functions which is huge.
May be more suitable way is to have determined name of vector function
wrapper and selection based on function name?
I mean to have something like this in test driver test-double-vlen4.c:
#define HAVE_VECTOR 1
#define VEC_PREFIX_STR "VECTOR_LEN_"
#define cos VECTOR_LEN_4_cos
#include "libm-test.c"
in test-double-vlen4-wrapper.c:
VECTOR_WRAPPER(VECTOR_LEN_4_cos,_ZGVdN4v_cos)
and in libm-test.inc:
#ifndef HAVE_VECTOR
# define HAVE_VECTOR 0
#endif
#ifndef VEC_PREFIX_STR
# define VEC_PREFIX_STR ""
#endif
static const char *vec_prefix = VEC_PREFIX_STR;
static int is_vector_name(const char *this_func)
{
if (strncmp(this_func, vec_prefix, strlen(vec_prefix))==0)
return 1;
return 0;
}
#define STR_CON(x,y) __STRING(x##y)
/* Start and end the tests for a given function. */
#define START(FUNC, SUFF, EXACT) \
const char *this_func = STR_CON (FUNC, SUFF); \
if (HAVE_VECTOR && !is_vector_name(this_func)) return; \
init_max_error (this_func, EXACT)
Is this way ok?
--
WBR,
Andrew