From patchwork Wed Oct 11 17:46:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Myers X-Patchwork-Id: 824496 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-85669-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="hILUiv4d"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yC1dc61wYz9sRq for ; Thu, 12 Oct 2017 04:47:16 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:mime-version :content-type; q=dns; s=default; b=oOGQEx1M8MJfdn0lfqoXiUuKf/c35 G8Ylg9al5VwEEEZXpiMmFgGLzWD3H+/bPcdJ4al5I9vCg9O6Bzz3QgKyw2wCpTon rBKLyJ41tXm0K34LMXmfUaURCWYe6AM2bPbA/57jMI3ozk+wisczaWiSLY2QjqZF 9viBm2h2kBh+Ms= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:mime-version :content-type; s=default; bh=kQTkf+/Fhz4E5o1dwEEvF+M47ac=; b=hIL Uiv4dWID9q0tqOsNzISyi+61mSsafj2/XfOkwrsqGWzxkcJJ/ysW5DM5//VexVnV Iw3rTtVx2BgEytbsxFj9BN4+Y8N8lyCI828n7hd1vf4no8yaM6H8W6qIIkN3UOO/ y31El4HjAmtf/OGBoknuymwS13uLC6Z1eKdYIRJg= Received: (qmail 22682 invoked by alias); 11 Oct 2017 17:47:09 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 22372 invoked by uid 89); 11 Oct 2017 17:47:08 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS, URIBL_RED autolearn=ham version=3.3.2 spammy= X-HELO: relay1.mentorg.com Date: Wed, 11 Oct 2017 17:46:58 +0000 From: Joseph Myers To: Subject: Run libm long double tests for long double = double [committed] Message-ID: User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 X-ClientProxiedBy: svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) To svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) All interfaces in the glibc API ought to be covered by the testsuite, even where they alias other interfaces. This patch arranges for libm tests to be run for long double when it aliases double; previously those tests were run only for the floating-point types with distinct formats. The long double tests are made to use the double ulps values in this case, as having a separate duplicate set of ulps for them seems unnecessary; to accommodate that, the test-.h headers now specify the macro indexing into the ulps array explicitly instead of having it computed from PREFIX. Nothing special is done about vector function tests. None are supported for any long double = double platforms, and supporting vector functions for a type alias such as _Float32 would not simply fall out of adding the scalar aliases for that type - it would require vector function wrappers like those for *_finite (or, better, a new GCC feature to allow specifying the asm name for vector functions independently of that for scalar ones, as previously discussed), so it seems reasonable to require the sysdeps makefile setting of libmvec-tests to be updated if any such tests are to be run for type aliases. Tested for x86_64 and arm. Committed. 2017-10-11 Joseph Myers * math/Makefile (test-types-basic): New variable. (test-types): Likewise. (libm-test-support): Use $(test-types) instead of $(types). (libm-tests-base-normal): Likewise. (libm-tests-base-finite): Likewise. (libm-tests-base-inline): Likewise. (generated): Likewise. ($(objpfx)libm-test-support-$(t).c): Likewise. (libm-tests-for-type iterator): Likewise. (libm-test-support iterator): Likewise. * math/libm-test-support.c (ulp_i_idx): Use ULP_I_IDX. (ulp_idx): Use ULP_IDX. * math/test-ldouble.h: Include . (TYPE_STR): Define conditional on [LDBL_MANT_DIG == DBL_MANT_DIG]. (ULP_IDX): New macro. (ULP_I_IDX): Likewise. * math/test-double.h (ULP_IDX): Likewise. (ULP_I_IDX): Likewise. * math/test-float.h (ULP_IDX): Likewise. (ULP_I_IDX): Likewise. * math/test-float128.h (ULP_IDX): Likewise. (ULP_I_IDX): Likewise. diff --git a/math/Makefile b/math/Makefile index d4f9e6b..4014471 100644 --- a/math/Makefile +++ b/math/Makefile @@ -102,6 +102,10 @@ libm-compat-calls = \ # after the Rules makefile has been parsed. types-basic = $(type-ldouble-$(long-double-fcts)) double float +# Like types, but includes types whose functions alias those for +# another type. +test-types-basic = ldouble double float + # long double support type-ldouble-suffix := l type-ldouble-routines := t_sincosl k_sincosl s_iscanonicall @@ -123,6 +127,7 @@ type-float128-suffix := f128 type-float128-routines := t_sincosf128 k_sincosf128 type-float128-yes := float128 types = $(types-basic) $(type-float128-$(float128-fcts)) +test-types = $(test-types-basic) $(type-float128-$(float128-fcts)) # For each of the basic types (float, double, long double), replace the # occurrences of 'F' in arg 1 with the appropriate suffix for the type. @@ -214,7 +219,7 @@ endif ifneq (no,$(PERL)) libm-vec-tests = $(addprefix test-,$(libmvec-tests)) -libm-test-support = $(foreach t,$(types),libm-test-support-$(t)) +libm-test-support = $(foreach t,$(test-types),libm-test-support-$(t)) test-extras += $(libm-test-support) extra-test-objs += $(addsuffix .o, $(libm-test-support)) libm-vec-test-wrappers = $(addsuffix -wrappers, $(libm-vec-tests)) @@ -250,9 +255,9 @@ libm-test-c-auto = $(foreach f,$(libm-test-funcs-auto),libm-test-$(f).c) libm-test-c-noauto = $(foreach f,$(libm-test-funcs-noauto),libm-test-$(f).c) generated += libm-test-ulps.h $(libm-test-c-auto) $(libm-test-c-noauto) -libm-tests-base-normal = $(foreach t,$(types),test-$(t)) -libm-tests-base-finite = $(foreach t,$(types),test-$(t)-finite) -libm-tests-base-inline = $(foreach t,$(types),test-i$(t)) +libm-tests-base-normal = $(foreach t,$(test-types),test-$(t)) +libm-tests-base-finite = $(foreach t,$(test-types),test-$(t)-finite) +libm-tests-base-inline = $(foreach t,$(test-types),test-i$(t)) libm-tests-base = $(libm-tests-base-normal) $(libm-tests-base-finite) \ $(libm-tests-base-inline) $(libm-vec-tests) libm-tests-normal = $(foreach t,$(libm-tests-base-normal),\ @@ -277,7 +282,7 @@ libm-tests.o = $(addsuffix .o,$(libm-tests)) tests += $(libm-tests) generated += $(addsuffix .c,$(libm-tests)) \ - $(foreach t,$(types),libm-test-support-$(t).c) + $(foreach t,$(test-types),libm-test-support-$(t).c) libm-test-c-auto-obj = $(addprefix $(objpfx),$(libm-test-c-auto)) libm-test-c-noauto-obj = $(addprefix $(objpfx),$(libm-test-c-noauto)) @@ -448,7 +453,7 @@ $(foreach t,$(libm-tests-vector),$(objpfx)$(t).c): $(objpfx)test-%.c: echo "#include "; \ ) > $@ -$(foreach t,$(types),\ +$(foreach t,$(test-types),\ $(objpfx)libm-test-support-$(t).c): $(objpfx)libm-test-support-%.c: ( \ echo "#include "; \ @@ -496,13 +501,13 @@ define o-iterator-doit $(addprefix $(objpfx),\ $(call libm-tests-for-type,$(o))): $(objpfx)libm-test-support-$(o).o endef -object-suffixes-left := $(types) +object-suffixes-left := $(test-types) include $(o-iterator) define o-iterator-doit $(objpfx)libm-test-support-$(o).o: CFLAGS += $(libm-test-no-inline-cflags) endef -object-suffixes-left := $(types) +object-suffixes-left := $(test-types) include $(o-iterator) # Run the math programs to automatically generate ULPs files. diff --git a/math/libm-test-support.c b/math/libm-test-support.c index 9ce3eb1..ede0d16 100644 --- a/math/libm-test-support.c +++ b/math/libm-test-support.c @@ -45,6 +45,9 @@ TYPE_STR: The name of the type as used in ulps files, as a string. + ULP_IDX, ULP_I_IDX: The array indexes for ulps values for this + function. + LIT: Append the correct suffix to a literal. LITM: Append the correct suffix to an M_* macro name. @@ -191,8 +194,8 @@ compare_ulp_data (const void *key, const void *ulp) return strcmp (keystr, ulpdat->name); } -static const int ulp_i_idx = __CONCATX (ULP_I_, PREFIX); -static const int ulp_idx = __CONCATX (ULP_, PREFIX); +static const int ulp_i_idx = ULP_I_IDX; +static const int ulp_idx = ULP_IDX; /* Return the ulps for NAME in array DATA with NMEMB elements, or 0 if no ulps listed. */ diff --git a/math/test-double.h b/math/test-double.h index 3c562e2..08138c4 100644 --- a/math/test-double.h +++ b/math/test-double.h @@ -23,6 +23,8 @@ #define PREFIX DBL #define LIT(x) (x) #define TYPE_STR "double" +#define ULP_IDX ULP_DBL +#define ULP_I_IDX ULP_I_DBL #define LITM(x) x #define FTOSTR strfromd #define snan_value_MACRO SNAN diff --git a/math/test-float.h b/math/test-float.h index 97e98c7..7382d37 100644 --- a/math/test-float.h +++ b/math/test-float.h @@ -22,6 +22,8 @@ #define BUILD_COMPLEX(real, imag) (CMPLXF ((real), (imag))) #define PREFIX FLT #define TYPE_STR "float" +#define ULP_IDX ULP_FLT +#define ULP_I_IDX ULP_I_FLT #define LIT(x) (x ## f) /* Use the double variants of macro constants. */ #define LITM(x) x diff --git a/math/test-float128.h b/math/test-float128.h index 17c5928..3132766 100644 --- a/math/test-float128.h +++ b/math/test-float128.h @@ -29,6 +29,8 @@ #define BUILD_COMPLEX(real, imag) (CMPLXF128 ((real), (imag))) #define PREFIX FLT128 #define TYPE_STR "float128" +#define ULP_IDX ULP_FLT128 +#define ULP_I_IDX ULP_I_FLT128 #define LIT(x) __f128 (x) #define LITM(x) x ## f128 #define FTOSTR strfromf128 diff --git a/math/test-ldouble.h b/math/test-ldouble.h index 89d4940..90a2933 100644 --- a/math/test-ldouble.h +++ b/math/test-ldouble.h @@ -16,12 +16,22 @@ License along with the GNU C Library; if not, see . */ +#include + #define FUNC(function) function##l #define FLOAT long double #define CFLOAT __complex__ long double #define BUILD_COMPLEX(real, imag) (CMPLXL ((real), (imag))) #define PREFIX LDBL -#define TYPE_STR "ldouble" +#if LDBL_MANT_DIG == DBL_MANT_DIG +# define TYPE_STR "double" +# define ULP_IDX ULP_DBL +# define ULP_I_IDX ULP_I_DBL +#else +# define TYPE_STR "ldouble" +# define ULP_IDX ULP_LDBL +# define ULP_I_IDX ULP_I_LDBL +#endif #define LIT(x) (x ## L) #define LITM(x) x ## l #define FTOSTR strfroml