From nobody Thu Aug 3 05:09:44 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4RGcN9424mz4ny94; Thu, 3 Aug 2023 05:09:45 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RGcN90scPz3tTR; Thu, 3 Aug 2023 05:09:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1691039385; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=cwblRsfmaLd4EQdOTy7yy5QDZ2+Pstlun1Tthgxwm78=; b=K7R+iBqgDF1QjSMGJKUsg4JvXEt2KNH460ievgYRMWxROi7LNNPRtXH4N3NRnBt7UUhN4Z D/njCVhMz29aDheBtLVSzu2q97LDWpj/g07jm7kXZNcuo2xKuJqDJY9Ny730M6aOqJLgSR AKjoZzz3Aivw+XVI3I/EU2a7+sp23pbBODWbYErpvL4Zd5Pty7Tl4TNG7QI94xMKt+tyKO 7IC326l4ErrED9jsS0H8rr1PgfPw26Y7fFj+7J9vVbJpW8raBpqI3K3rkH+phI8wGFZ1ZL +uCXhg76DKaI41S4DIDMpCCuqfup0r2i+j3dwsPr2EG4lrdv4zrhwLBTfQ7DWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1691039385; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=cwblRsfmaLd4EQdOTy7yy5QDZ2+Pstlun1Tthgxwm78=; b=hcAp57dEndhoXEU6QpYfnPeGayKBiaiRlRvnHpXR7q/GTsuHlnEInyC9py+X2AQ3VpPYNr UA+q2L/npS+ljgzQr/YLQLzIIWTkPYcMKISnCpQcF5Pz+oTWeMiGfaGJTw8qLUJkTMw/9K qQHoWw8SsDVHmku7XYfudjnoT3C+pmxLTGfX7cLyo6lL2m1Am+FrlVgMTuRl68F6bnRQOw DGYjOExPpK5gs/OAGXEo/wj0WRL5w9RKyAGl/oXgOcWjo8Q9Emu2xOA551LrLOI5S0wW5o /WGOxmmxtsSS9wHzez8zP7ZhYw5G991WmAauu3XvuYTYjdo6K6M/UsCPMuGGxg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1691039385; a=rsa-sha256; cv=none; b=jLNSa52738h0DKN7B961S3ppQHfuL7M5vcwrD3tPAjM6FZsPSAb1iQSZ3dgYFAaPexkgH7 CRQG8gpS0uUXLkKuhiJvK2CJGk5bnBZDBSz5c7Khgry+c3zHYuBabgnD/j95cLhmS/yeLE XLewMD3WK+SM8kVwplE3JndSsoZMm5hoXMpeNb9ceRmpAI0X1UWwk/A7TAdbujxj9j+Bdu N/h2sTUspva8PlYT0DZOnbL1YwtYOZr9/hIbSD83yrkJkXNyXdyPKCohFd8GBbJMvl7PeZ gyUekaiGpF1PySFRTb1ISy1/G/VwZ31unKEZ4gUIZaFX8/CIfY/6KUmKjbV86g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4RGcN8747DzGs8; Thu, 3 Aug 2023 05:09:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 37359iEm096603; Thu, 3 Aug 2023 05:09:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 37359iCP096602; Thu, 3 Aug 2023 05:09:44 GMT (envelope-from git) Date: Thu, 3 Aug 2023 05:09:44 GMT Message-Id: <202308030509.37359iCP096602@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: c66a499e037e - main - Cleanup debugging code in libm List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c66a499e037efd268a744e487e7d0c45a4944a9b Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=c66a499e037efd268a744e487e7d0c45a4944a9b commit c66a499e037efd268a744e487e7d0c45a4944a9b Author: Steve Kargl AuthorDate: 2023-07-31 22:32:54 +0000 Commit: Konstantin Belousov CommitDate: 2023-08-03 04:27:58 +0000 Cleanup debugging code in libm David Das (das@) committed Bruce Evan's (bde's) WIP code for expl() and logl() in git revision 25a4d6bfda29119. That code included instrumentation that allowed bde to generate pari scripts used in testing/debugging. This patch removes that instrumentation as it is unlikely that others will ever use it. * math/libm/msun/src/math_private.h: . Remove bde's macros for the generation of pari scripts. * math/libm/msun/ld128/s_expl.c: * math/libm/msun/ld128/s_logl.c: * math/libm/msun/ld80/s_expl.c: * math/libm/msun/ld80/s_logl.c: . Remove bde's DOPRINT_START macro. . Change RETURNP to RETURNF. . Change RETURN2P to RETURNF. Adjust arguments as needed. . Change RETURNPI to RETURNI. . Change RETURN2PI to RETURNI. Adjust arguments as needed. PR: 272765 MFC after: 1 week --- lib/msun/ld128/s_expl.c | 28 +++++------ lib/msun/ld128/s_logl.c | 24 ++++----- lib/msun/ld80/s_expl.c | 28 +++++------ lib/msun/ld80/s_logl.c | 26 +++++----- lib/msun/src/math_private.h | 115 ++------------------------------------------ 5 files changed, 49 insertions(+), 172 deletions(-) diff --git a/lib/msun/ld128/s_expl.c b/lib/msun/ld128/s_expl.c index 5fc43802b950..0274a8f302db 100644 --- a/lib/msun/ld128/s_expl.c +++ b/lib/msun/ld128/s_expl.c @@ -65,8 +65,6 @@ expl(long double x) int k; uint16_t hx, ix; - DOPRINT_START(&x); - /* Filter out exceptional cases. */ u.e = x; hx = u.xbits.expsign; @@ -74,15 +72,15 @@ expl(long double x) if (ix >= BIAS + 13) { /* |x| >= 8192 or x is NaN */ if (ix == BIAS + LDBL_MAX_EXP) { if (hx & 0x8000) /* x is -Inf or -NaN */ - RETURNP(-1 / x); - RETURNP(x + x); /* x is +Inf or +NaN */ + RETURNF(-1 / x); + RETURNF(x + x); /* x is +Inf or +NaN */ } if (x > o_threshold) - RETURNP(huge * huge); + RETURNF(huge * huge); if (x < u_threshold) - RETURNP(tiny * tiny); + RETURNF(tiny * tiny); } else if (ix < BIAS - 114) { /* |x| < 0x1p-114 */ - RETURN2P(1, x); /* 1 with inexact iff x != 0 */ + RETURNF(1 + x); /* 1 with inexact iff x != 0 */ } ENTERI(); @@ -210,8 +208,6 @@ expm1l(long double x) int k, n, n2; uint16_t hx, ix; - DOPRINT_START(&x); - /* Filter out exceptional cases. */ u.e = x; hx = u.xbits.expsign; @@ -219,11 +215,11 @@ expm1l(long double x) if (ix >= BIAS + 7) { /* |x| >= 128 or x is NaN */ if (ix == BIAS + LDBL_MAX_EXP) { if (hx & 0x8000) /* x is -Inf or -NaN */ - RETURNP(-1 / x - 1); - RETURNP(x + x); /* x is +Inf or +NaN */ + RETURNF(-1 / x - 1); + RETURNF(x + x); /* x is +Inf or +NaN */ } if (x > o_threshold) - RETURNP(huge * huge); + RETURNF(huge * huge); /* * expm1l() never underflows, but it must avoid * unrepresentable large negative exponents. We used a @@ -232,7 +228,7 @@ expm1l(long double x) * in the same way as large ones here. */ if (hx & 0x8000) /* x <= -128 */ - RETURN2P(tiny, -1); /* good for x < -114ln2 - eps */ + RETURNF(tiny - 1); /* good for x < -114ln2 - eps */ } ENTERI(); @@ -244,7 +240,7 @@ expm1l(long double x) if (x < T3) { if (ix < BIAS - 113) { /* |x| < 0x1p-113 */ /* x (rounded) with inexact if x != 0: */ - RETURNPI(x == 0 ? x : + RETURNI(x == 0 ? x : (0x1p200 * x + fabsl(x)) * 0x1p-200); } q = x * x2 * C3 + x2 * x2 * (C4 + x * (C5 + x * (C6 + @@ -265,9 +261,9 @@ expm1l(long double x) hx2_hi = x_hi * x_hi / 2; hx2_lo = x_lo * (x + x_hi) / 2; if (ix >= BIAS - 7) - RETURN2PI(hx2_hi + x_hi, hx2_lo + x_lo + q); + RETURNI((hx2_hi + x_hi) + (hx2_lo + x_lo + q)); else - RETURN2PI(x, hx2_lo + q + hx2_hi); + RETURNI(x + (hx2_lo + q + hx2_hi)); } /* Reduce x to (k*ln2 + endpoint[n2] + r1 + r2). */ diff --git a/lib/msun/ld128/s_logl.c b/lib/msun/ld128/s_logl.c index 40a22c0f1a8c..bc538840a760 100644 --- a/lib/msun/ld128/s_logl.c +++ b/lib/msun/ld128/s_logl.c @@ -573,24 +573,23 @@ log1pl(long double x) int i, k; int16_t ax, hx; - DOPRINT_START(&x); EXTRACT_LDBL128_WORDS(hx, lx, llx, x); if (hx < 0x3fff) { /* x < 1, or x neg NaN */ ax = hx & 0x7fff; if (ax >= 0x3fff) { /* x <= -1, or x neg NaN */ if (ax == 0x3fff && (lx | llx) == 0) - RETURNP(-1 / zero); /* log1p(-1) = -Inf */ + RETURNF(-1 / zero); /* log1p(-1) = -Inf */ /* log1p(x < 1, or x NaN) = qNaN: */ - RETURNP((x - x) / (x - x)); + RETURNF((x - x) / (x - x)); } if (ax <= 0x3f8d) { /* |x| < 2**-113 */ if ((int)x == 0) - RETURNP(x); /* x with inexact if x != 0 */ + RETURNF(x); /* x with inexact if x != 0 */ } f_hi = 1; f_lo = x; } else if (hx >= 0x7fff) { /* x +Inf or non-neg NaN */ - RETURNP(x + x); /* log1p(Inf or NaN) = Inf or qNaN */ + RETURNF(x + x); /* log1p(Inf or NaN) = Inf or qNaN */ } else if (hx < 0x40e1) { /* 1 <= x < 2**226 */ f_hi = x; f_lo = 1; @@ -669,7 +668,7 @@ log1pl(long double x) #endif _3sumF(val_hi, val_lo, F_hi(i) + dk * ln2_hi); - RETURN2PI(val_hi, val_lo); + RETURNI(val_hi + val_lo); } #ifdef STRUCT_RETURN @@ -680,7 +679,6 @@ logl(long double x) struct ld r; ENTERI(); - DOPRINT_START(&x); k_logl(x, &r); RETURNSPI(&r); } @@ -708,15 +706,13 @@ log10l(long double x) long double hi, lo; ENTERI(); - DOPRINT_START(&x); k_logl(x, &r); if (!r.lo_set) - RETURNPI(r.hi); + RETURNI(r.hi); _2sumF(r.hi, r.lo); hi = (float)r.hi; lo = r.lo + (r.hi - hi); - RETURN2PI(invln10_hi * hi, - invln10_lo_plus_hi * lo + invln10_lo * hi); + RETURNI(invln10_hi * hi + (invln10_lo_plus_hi * lo + invln10_lo * hi)); } long double @@ -726,15 +722,13 @@ log2l(long double x) long double hi, lo; ENTERI(); - DOPRINT_START(&x); k_logl(x, &r); if (!r.lo_set) - RETURNPI(r.hi); + RETURNI(r.hi); _2sumF(r.hi, r.lo); hi = (float)r.hi; lo = r.lo + (r.hi - hi); - RETURN2PI(invln2_hi * hi, - invln2_lo_plus_hi * lo + invln2_lo * hi); + RETURNI(invln2_hi * hi + (invln2_lo_plus_hi * lo + invln2_lo * hi)); } #endif /* STRUCT_RETURN */ diff --git a/lib/msun/ld80/s_expl.c b/lib/msun/ld80/s_expl.c index 0571377a3f8d..a41de4d6d1d8 100644 --- a/lib/msun/ld80/s_expl.c +++ b/lib/msun/ld80/s_expl.c @@ -77,8 +77,6 @@ expl(long double x) int k; uint16_t hx, ix; - DOPRINT_START(&x); - /* Filter out exceptional cases. */ u.e = x; hx = u.xbits.expsign; @@ -86,15 +84,15 @@ expl(long double x) if (ix >= BIAS + 13) { /* |x| >= 8192 or x is NaN */ if (ix == BIAS + LDBL_MAX_EXP) { if (hx & 0x8000) /* x is -Inf, -NaN or unsupported */ - RETURNP(-1 / x); - RETURNP(x + x); /* x is +Inf, +NaN or unsupported */ + RETURNF(-1 / x); + RETURNF(x + x); /* x is +Inf, +NaN or unsupported */ } if (x > o_threshold) - RETURNP(huge * huge); + RETURNF(huge * huge); if (x < u_threshold) - RETURNP(tiny * tiny); + RETURNF(tiny * tiny); } else if (ix < BIAS - 75) { /* |x| < 0x1p-75 (includes pseudos) */ - RETURN2P(1, x); /* 1 with inexact iff x != 0 */ + RETURNF(1 + x); /* 1 with inexact iff x != 0 */ } ENTERI(); @@ -168,8 +166,6 @@ expm1l(long double x) int k, n, n2; uint16_t hx, ix; - DOPRINT_START(&x); - /* Filter out exceptional cases. */ u.e = x; hx = u.xbits.expsign; @@ -177,11 +173,11 @@ expm1l(long double x) if (ix >= BIAS + 6) { /* |x| >= 64 or x is NaN */ if (ix == BIAS + LDBL_MAX_EXP) { if (hx & 0x8000) /* x is -Inf, -NaN or unsupported */ - RETURNP(-1 / x - 1); - RETURNP(x + x); /* x is +Inf, +NaN or unsupported */ + RETURNF(-1 / x - 1); + RETURNF(x + x); /* x is +Inf, +NaN or unsupported */ } if (x > o_threshold) - RETURNP(huge * huge); + RETURNF(huge * huge); /* * expm1l() never underflows, but it must avoid * unrepresentable large negative exponents. We used a @@ -190,7 +186,7 @@ expm1l(long double x) * in the same way as large ones here. */ if (hx & 0x8000) /* x <= -64 */ - RETURN2P(tiny, -1); /* good for x < -65ln2 - eps */ + RETURNF(tiny - 1); /* good for x < -65ln2 - eps */ } ENTERI(); @@ -198,7 +194,7 @@ expm1l(long double x) if (T1 < x && x < T2) { if (ix < BIAS - 74) { /* |x| < 0x1p-74 (includes pseudos) */ /* x (rounded) with inexact if x != 0: */ - RETURNPI(x == 0 ? x : + RETURNI(x == 0 ? x : (0x1p100 * x + fabsl(x)) * 0x1p-100); } @@ -219,9 +215,9 @@ expm1l(long double x) hx2_hi = x_hi * x_hi / 2; hx2_lo = x_lo * (x + x_hi) / 2; if (ix >= BIAS - 7) - RETURN2PI(hx2_hi + x_hi, hx2_lo + x_lo + q); + RETURNI((hx2_hi + x_hi) + (hx2_lo + x_lo + q)); else - RETURN2PI(x, hx2_lo + q + hx2_hi); + RETURNI(x + (hx2_lo + q + hx2_hi)); } /* Reduce x to (k*ln2 + endpoint[n2] + r1 + r2). */ diff --git a/lib/msun/ld80/s_logl.c b/lib/msun/ld80/s_logl.c index dac5bfb9e25e..abe778249549 100644 --- a/lib/msun/ld80/s_logl.c +++ b/lib/msun/ld80/s_logl.c @@ -560,24 +560,23 @@ log1pl(long double x) int i, k; int16_t ax, hx; - DOPRINT_START(&x); EXTRACT_LDBL80_WORDS(hx, lx, x); if (hx < 0x3fff) { /* x < 1, or x neg NaN */ ax = hx & 0x7fff; if (ax >= 0x3fff) { /* x <= -1, or x neg NaN */ if (ax == 0x3fff && lx == 0x8000000000000000ULL) - RETURNP(-1 / zero); /* log1p(-1) = -Inf */ + RETURNF(-1 / zero); /* log1p(-1) = -Inf */ /* log1p(x < 1, or x [pseudo-]NaN) = qNaN: */ - RETURNP((x - x) / (x - x)); + RETURNF((x - x) / (x - x)); } if (ax <= 0x3fbe) { /* |x| < 2**-64 */ if ((int)x == 0) - RETURNP(x); /* x with inexact if x != 0 */ + RETURNF(x); /* x with inexact if x != 0 */ } f_hi = 1; f_lo = x; } else if (hx >= 0x7fff) { /* x +Inf or non-neg NaN */ - RETURNP(x + x); /* log1p(Inf or NaN) = Inf or qNaN */ + RETURNF(x + x); /* log1p(Inf or NaN) = Inf or qNaN */ /* log1p(pseudo-Inf) = qNaN */ /* log1p(pseudo-NaN) = qNaN */ /* log1p(unnormal) = qNaN */ @@ -658,7 +657,7 @@ log1pl(long double x) #endif _3sumF(val_hi, val_lo, F_hi(i) + dk * ln2_hi); - RETURN2PI(val_hi, val_lo); + RETURNI(val_hi + val_lo); } #ifdef STRUCT_RETURN @@ -669,7 +668,6 @@ logl(long double x) struct ld r; ENTERI(); - DOPRINT_START(&x); k_logl(x, &r); RETURNSPI(&r); } @@ -690,15 +688,14 @@ log10l(long double x) long double hi, lo; ENTERI(); - DOPRINT_START(&x); k_logl(x, &r); if (!r.lo_set) - RETURNPI(r.hi); + RETURNI(r.hi); _2sumF(r.hi, r.lo); hi = (float)r.hi; lo = r.lo + (r.hi - hi); - RETURN2PI(invln10_hi * hi, - invln10_lo_plus_hi * lo + invln10_lo * hi); + RETURNI(invln10_hi * hi + + (invln10_lo_plus_hi * lo + invln10_lo * hi)); } long double @@ -708,15 +705,14 @@ log2l(long double x) long double hi, lo; ENTERI(); - DOPRINT_START(&x); k_logl(x, &r); if (!r.lo_set) - RETURNPI(r.hi); + RETURNI(r.hi); _2sumF(r.hi, r.lo); hi = (float)r.hi; lo = r.lo + (r.hi - hi); - RETURN2PI(invln2_hi * hi, - invln2_lo_plus_hi * lo + invln2_lo * hi); + RETURNI(invln2_hi * hi + + (invln2_lo_plus_hi * lo + invln2_lo * hi)); } #endif /* STRUCT_RETURN */ diff --git a/lib/msun/src/math_private.h b/lib/msun/src/math_private.h index ec2da21f955c..a853ad4f9b4c 100644 --- a/lib/msun/src/math_private.h +++ b/lib/msun/src/math_private.h @@ -698,127 +698,22 @@ irintl(long double x) #endif #endif -/* Write a pari script to test things externally. */ -#ifdef DOPRINT -#include - -#ifndef DOPRINT_SWIZZLE -#define DOPRINT_SWIZZLE 0 -#endif - -#ifdef DOPRINT_LD80 - -#define DOPRINT_START(xp) do { \ - uint64_t __lx; \ - uint16_t __hx; \ - \ - /* Hack to give more-problematic args. */ \ - EXTRACT_LDBL80_WORDS(__hx, __lx, *xp); \ - __lx ^= DOPRINT_SWIZZLE; \ - INSERT_LDBL80_WORDS(*xp, __hx, __lx); \ - printf("x = %.21Lg; ", (long double)*xp); \ -} while (0) -#define DOPRINT_END1(v) \ - printf("y = %.21Lg; z = 0; show(x, y, z);\n", (long double)(v)) -#define DOPRINT_END2(hi, lo) \ - printf("y = %.21Lg; z = %.21Lg; show(x, y, z);\n", \ - (long double)(hi), (long double)(lo)) - -#elif defined(DOPRINT_D64) - -#define DOPRINT_START(xp) do { \ - uint32_t __hx, __lx; \ - \ - EXTRACT_WORDS(__hx, __lx, *xp); \ - __lx ^= DOPRINT_SWIZZLE; \ - INSERT_WORDS(*xp, __hx, __lx); \ - printf("x = %.21Lg; ", (long double)*xp); \ -} while (0) -#define DOPRINT_END1(v) \ - printf("y = %.21Lg; z = 0; show(x, y, z);\n", (long double)(v)) -#define DOPRINT_END2(hi, lo) \ - printf("y = %.21Lg; z = %.21Lg; show(x, y, z);\n", \ - (long double)(hi), (long double)(lo)) - -#elif defined(DOPRINT_F32) - -#define DOPRINT_START(xp) do { \ - uint32_t __hx; \ - \ - GET_FLOAT_WORD(__hx, *xp); \ - __hx ^= DOPRINT_SWIZZLE; \ - SET_FLOAT_WORD(*xp, __hx); \ - printf("x = %.21Lg; ", (long double)*xp); \ -} while (0) -#define DOPRINT_END1(v) \ - printf("y = %.21Lg; z = 0; show(x, y, z);\n", (long double)(v)) -#define DOPRINT_END2(hi, lo) \ - printf("y = %.21Lg; z = %.21Lg; show(x, y, z);\n", \ - (long double)(hi), (long double)(lo)) - -#else /* !DOPRINT_LD80 && !DOPRINT_D64 (LD128 only) */ - -#ifndef DOPRINT_SWIZZLE_HIGH -#define DOPRINT_SWIZZLE_HIGH 0 -#endif - -#define DOPRINT_START(xp) do { \ - uint64_t __lx, __llx; \ - uint16_t __hx; \ - \ - EXTRACT_LDBL128_WORDS(__hx, __lx, __llx, *xp); \ - __llx ^= DOPRINT_SWIZZLE; \ - __lx ^= DOPRINT_SWIZZLE_HIGH; \ - INSERT_LDBL128_WORDS(*xp, __hx, __lx, __llx); \ - printf("x = %.36Lg; ", (long double)*xp); \ -} while (0) -#define DOPRINT_END1(v) \ - printf("y = %.36Lg; z = 0; show(x, y, z);\n", (long double)(v)) -#define DOPRINT_END2(hi, lo) \ - printf("y = %.36Lg; z = %.36Lg; show(x, y, z);\n", \ - (long double)(hi), (long double)(lo)) - -#endif /* DOPRINT_LD80 */ - -#else /* !DOPRINT */ -#define DOPRINT_START(xp) -#define DOPRINT_END1(v) -#define DOPRINT_END2(hi, lo) -#endif /* DOPRINT */ - -#define RETURNP(x) do { \ - DOPRINT_END1(x); \ - RETURNF(x); \ -} while (0) -#define RETURNPI(x) do { \ - DOPRINT_END1(x); \ - RETURNI(x); \ -} while (0) -#define RETURN2P(x, y) do { \ - DOPRINT_END2((x), (y)); \ - RETURNF((x) + (y)); \ -} while (0) -#define RETURN2PI(x, y) do { \ - DOPRINT_END2((x), (y)); \ - RETURNI((x) + (y)); \ -} while (0) #ifdef STRUCT_RETURN #define RETURNSP(rp) do { \ if (!(rp)->lo_set) \ - RETURNP((rp)->hi); \ - RETURN2P((rp)->hi, (rp)->lo); \ + RETURNF((rp)->hi); \ + RETURNF((rp)->hi + (rp)->lo); \ } while (0) #define RETURNSPI(rp) do { \ if (!(rp)->lo_set) \ - RETURNPI((rp)->hi); \ - RETURN2PI((rp)->hi, (rp)->lo); \ + RETURNI((rp)->hi); \ + RETURNI((rp)->hi + (rp)->lo); \ } while (0) #endif + #define SUM2P(x, y) ({ \ const __typeof (x) __x = (x); \ const __typeof (y) __y = (y); \ - \ - DOPRINT_END2(__x, __y); \ __x + __y; \ })