From owner-svn-src-all@freebsd.org Fri Jun 7 18:01:30 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5431815B3419; Fri, 7 Jun 2019 18:01:30 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EBD6C8438B; Fri, 7 Jun 2019 18:01:29 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C58CF7907; Fri, 7 Jun 2019 18:01:29 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x57I1TNf087374; Fri, 7 Jun 2019 18:01:29 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x57I1TVM087373; Fri, 7 Jun 2019 18:01:29 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201906071801.x57I1TVM087373@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Fri, 7 Jun 2019 18:01:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348784 - stable/12/lib/msun/tests X-SVN-Group: stable-12 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: stable/12/lib/msun/tests X-SVN-Commit-Revision: 348784 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: EBD6C8438B X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.94)[-0.943,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Jun 2019 18:01:30 -0000 Author: dim Date: Fri Jun 7 18:01:29 2019 New Revision: 348784 URL: https://svnweb.freebsd.org/changeset/base/348784 Log: MFC r348500: Partially revert r271349, which disabled the msun cexp test #4 on i386. Ensure the expected result is stored first in a volatile variable with the desired type. This makes all the tests succeed. Slightly changed from the original pull request, but functionally the same. Obtained from: https://github.com/freebsd/freebsd/pull/401 Submitted by: Moritz Buhl PR: 191676 Modified: stable/12/lib/msun/tests/cexp_test.c Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/msun/tests/cexp_test.c ============================================================================== --- stable/12/lib/msun/tests/cexp_test.c Fri Jun 7 17:58:59 2019 (r348783) +++ stable/12/lib/msun/tests/cexp_test.c Fri Jun 7 18:01:29 2019 (r348784) @@ -59,13 +59,21 @@ __FBSDID("$FreeBSD$"); * XXX The volatile here is to avoid gcc's bogus constant folding and work * around the lack of support for the FENV_ACCESS pragma. */ -#define test(func, z, result, exceptmask, excepts, checksign) do { \ +#define test_t(type, func, z, result, exceptmask, excepts, checksign) \ +do { \ volatile long double complex _d = z; \ + volatile type complex _r = result; \ assert(feclearexcept(FE_ALL_EXCEPT) == 0); \ - assert(cfpequal_cs((func)(_d), (result), (checksign))); \ + assert(cfpequal_cs((func)(_d), (_r), (checksign))); \ assert(((void)(func), fetestexcept(exceptmask) == (excepts))); \ } while (0) +#define test(func, z, result, exceptmask, excepts, checksign) \ + test_t(double, func, z, result, exceptmask, excepts, checksign) + +#define test_f(func, z, result, exceptmask, excepts, checksign) \ + test_t(float, func, z, result, exceptmask, excepts, checksign) + /* Test within a given tolerance. */ #define test_tol(func, z, result, tol) do { \ volatile long double complex _d = z; \ @@ -76,7 +84,7 @@ __FBSDID("$FreeBSD$"); /* Test all the functions that compute cexp(x). */ #define testall(x, result, exceptmask, excepts, checksign) do { \ test(cexp, x, result, exceptmask, excepts, checksign); \ - test(cexpf, x, result, exceptmask, excepts, checksign); \ + test_f(cexpf, x, result, exceptmask, excepts, checksign); \ } while (0) /* @@ -198,10 +206,10 @@ test_reals(void) test(cexp, CMPLXL(finites[i], -0.0), CMPLXL(exp(finites[i]), -0.0), FE_INVALID | FE_DIVBYZERO, 0, 1); - test(cexpf, CMPLXL(finites[i], 0.0), + test_f(cexpf, CMPLXL(finites[i], 0.0), CMPLXL(expf(finites[i]), 0.0), FE_INVALID | FE_DIVBYZERO, 0, 1); - test(cexpf, CMPLXL(finites[i], -0.0), + test_f(cexpf, CMPLXL(finites[i], -0.0), CMPLXL(expf(finites[i]), -0.0), FE_INVALID | FE_DIVBYZERO, 0, 1); } @@ -220,10 +228,10 @@ test_imaginaries(void) test(cexp, CMPLXL(-0.0, finites[i]), CMPLXL(cos(finites[i]), sin(finites[i])), ALL_STD_EXCEPT & ~FE_INEXACT, 0, 1); - test(cexpf, CMPLXL(0.0, finites[i]), + test_f(cexpf, CMPLXL(0.0, finites[i]), CMPLXL(cosf(finites[i]), sinf(finites[i])), ALL_STD_EXCEPT & ~FE_INEXACT, 0, 1); - test(cexpf, CMPLXL(-0.0, finites[i]), + test_f(cexpf, CMPLXL(-0.0, finites[i]), CMPLXL(cosf(finites[i]), sinf(finites[i])), ALL_STD_EXCEPT & ~FE_INEXACT, 0, 1); } @@ -302,12 +310,8 @@ main(void) test_inf(); printf("ok 3 - cexp inf\n"); -#if defined(__i386__) - printf("not ok 4 - cexp reals # TODO: PR # 191676 fails assertion on i386\n"); -#else test_reals(); printf("ok 4 - cexp reals\n"); -#endif test_imaginaries(); printf("ok 5 - cexp imaginaries\n");