From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) by sourceware.org (Postfix) with ESMTPS id A8C7039AD0EC for ; Thu, 6 Jun 2024 18:00:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A8C7039AD0EC Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A8C7039AD0EC Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::52d ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1717696851; cv=none; b=E3lysku8FuBnG5saEFX25vT8/7HksyGfOqBPYYMZOwEOE+ye4q6a85Epfx5DssDaodHoIh+R03xs2SkqL0CeT0KfsYFAY71zWVJNgPLlTADNYN3zgbKD64DI873TnzqbCcwM1LBuUqUKpy5EXceSI9SJC19VOVc1kkL6lT9km3A= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1717696851; c=relaxed/simple; bh=08qhWT1BqL+CIyRY1xOBRXo1O/RWuheHNdHbm8HQ5hY=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=Jrr+p7CsF6qpPFqAEm5AKmprsd5Iw4f8RDJeu9XLJK9CwTJkKntPCeWJ3PSdSb6XNpbkSCA1GyqKFAj6XJhFccsVAu9ftCARA3WxUk0B2UIPvJB093bxIL9EvSmZVNgPTVN4JDVv7YrvJprJvXbUT9acHLmayYr4Pe+qcPaJnh4= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-ed1-x52d.google.com with SMTP id 4fb4d7f45d1cf-57a31d63b6bso1732452a12.0 for ; Thu, 06 Jun 2024 11:00:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717696846; x=1718301646; darn=sourceware.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=N+YErGQbkTq/TSWiIqFlQgcV6JXfMGFXHYG1+TfqxeM=; b=Pp3uXYfhmQLIFuE/zNOfJ23b3KXeDHe053L1zMrGpuQCi1ws1+Es/6sJHV463MO6n9 bdQBRfWbSEE6aNGp3ZAc0uuoifMGwGkvYLBd0fZqBbAYnClOqhBKZ16fkhXQl+z/gv24 cTCiR17ZbVDw5pHlrDhDTQpe/Sopqsu6aLgK7474wQJ4OULOxsM/4O/m3Sys8LEm/6R4 KkUtA+gkdd98Aas3rv+gVkrSWDZ4AfdH0ymBQdrSuYX3ga2NANDYbAbp5KH9BR3U9qvZ szHhxMl/9+IgySP7nsicq8VcesyIiAwFGvVeJdpZ/KhVrn9ASfmgGRaKZ/gljZxxifsB 0XOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717696846; x=1718301646; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=N+YErGQbkTq/TSWiIqFlQgcV6JXfMGFXHYG1+TfqxeM=; b=JgqVD0RCKDm32a9tMy9mP9E4ofl7uG+viSP4JuBRgE4snwPpTSQtlmqYZnuvXj898A i1hEXlqxnqKVSe4/tFLNlUpAzOr1ocJ4vx9yFUSRyVSqwBZzW7qOEq/kkKJxquRe/Htj nNXkClTVG6PlBXkvgumYog3gaov3suHyPNiXsAMHLVIecMi+7oKo3adO3tLyxX71golj qM1XqXHFJZziZRxfpIv/m+TOGTfv1wKxzGoF2l/frM8/DSByStF+J5qPDhT3JLvRyogv XH3Ge7W0IIGLWg/cm7mHUxLW+EcaBtFuWJ3Lb6ZocRl/QyHpldNTdEzkUTHyCQx6nfkr OdwQ== X-Forwarded-Encrypted: i=1; AJvYcCU4llaGI/dysAT2NdCceNhfzWoggOel6fZgYQfroNTgC7eAtAcm+oOJSp9KFIMtFgO2kSnxHaR7e/RvgJQtb63ZQbcZJbc= X-Gm-Message-State: AOJu0Yx+r+PiMOomRAb7r61L96//57Aa4udD5XjfUUA2F0GeJgtSRMlz x0/Ews/mU2pglVb9R7beHPT8gK3Swz4VpfMSZdFpYWtBm26EfvPvBBo071bV1RPal7960c18ycy 03CVpk5J8q4dGaCKN9XxxGip9U+0= X-Google-Smtp-Source: AGHT+IFFJQxdHETORXq+YCv0jxlXEbBPZhb48vVVj5W23hf3CpA/hKBNqEQGloeufp1uncv5xLrd2McNgYLLgy4iyjs= X-Received: by 2002:a17:906:35d6:b0:a67:a963:8b3c with SMTP id a640c23a62f3a-a6cd78918d8mr19192466b.34.1717696845986; Thu, 06 Jun 2024 11:00:45 -0700 (PDT) MIME-Version: 1.0 References: <0ca79433-448c-469f-880a-6b228ade4b80@app.fastmail.com> In-Reply-To: From: Joel Sherrill Date: Thu, 6 Jun 2024 13:00:32 -0500 Message-ID: Subject: Re: [PATCH] newlib: libm: skip "long double" complex functions if long double != double To: Jeff Johnston Cc: Pietro Monteiro , newlib@sourceware.org Content-Type: multipart/alternative; boundary="0000000000005644be061a3c76d3" X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --0000000000005644be061a3c76d3 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Thanks Jeff and Pietro. RTEMS will be bumping the newlib has for forward looking tools at least. --joel On Thu, Jun 6, 2024 at 12:20=E2=80=AFPM Jeff Johnston = wrote: > Thanks Pietro for the patch and Joel for testing it. The patch has been > pushed. > > -- Jeff J. > > On Wed, Jun 5, 2024 at 1:01=E2=80=AFPM Joel Sherrill > wrote: > >> Thanks. I can confirm that the m68k, sh, and nios2 build with this patch >> applied. >> >> Hopefully Corinna or Jeff can confirm this patch can be committed. >> >> I don't know what would be the ideal solution since long double support >> can >> disappear within an architecture based on a multilib variable. The >> initial >> addition of support didn't address below the architecture level. >> >> --joel >> >> On Mon, Jun 3, 2024 at 8:36=E2=80=AFPM Pietro Monteiro >> wrote: >> >>> The rest of "long double" functions aren't compiled with long double >>> and double are not the same. Do the same for all complex functions. >>> >>> Signed-off-by: Pietro Monteiro >>> --- >>> newlib/libm/complex/cargl.c | 9 ++++----- >>> newlib/libm/complex/catanl.c | 4 +++- >>> newlib/libm/complex/ccoshl.c | 3 +++ >>> newlib/libm/complex/ccosl.c | 3 +++ >>> newlib/libm/complex/cephes_subrl.c | 6 ++++++ >>> newlib/libm/complex/cexpl.c | 3 +++ >>> newlib/libm/complex/clogl.c | 3 +++ >>> newlib/libm/complex/cpowl.c | 3 +++ >>> newlib/libm/complex/cprojl.c | 4 ++++ >>> newlib/libm/complex/csinhl.c | 3 +++ >>> newlib/libm/complex/csinl.c | 3 +++ >>> newlib/libm/complex/csqrtl.c | 3 +++ >>> newlib/libm/complex/ctanhl.c | 3 +++ >>> newlib/libm/complex/ctanl.c | 3 +++ >>> 14 files changed, 47 insertions(+), 6 deletions(-) >>> >>> diff --git a/newlib/libm/complex/cargl.c b/newlib/libm/complex/cargl.c >>> index 790cffe8f..9560cce6e 100644 >>> --- a/newlib/libm/complex/cargl.c >>> +++ b/newlib/libm/complex/cargl.c >>> @@ -7,12 +7,11 @@ >>> #include >>> #include >>> >>> +/* On platforms where long double is as wide as double. */ >>> +#ifdef _LDBL_EQ_DBL >>> long double >>> cargl(long double complex z) >>> -{ >>> - #ifdef _LDBL_EQ_DBL >>> +{ >>> return carg (z); >>> - #else >>> - return atan2l (cimagl (z), creall (z)); >>> - #endif >>> } >>> +#endif >>> diff --git a/newlib/libm/complex/catanl.c b/newlib/libm/complex/catanl.c >>> index 13839ac73..4575623c2 100644 >>> --- a/newlib/libm/complex/catanl.c >>> +++ b/newlib/libm/complex/catanl.c >>> @@ -33,6 +33,8 @@ >>> #include >>> #include "cephes_subrl.h" >>> >>> +/* On platforms where long double is as wide as double. */ >>> +#ifdef _LDBL_EQ_DBL >>> #ifdef __weak_alias >>> __weak_alias(catanl, _catanl) >>> #endif >>> @@ -72,4 +74,4 @@ ovrf: >>> w =3D HUGE_VALL + HUGE_VALL * I; >>> return w; >>> } >>> - >>> +#endif >>> diff --git a/newlib/libm/complex/ccoshl.c b/newlib/libm/complex/ccoshl.c >>> index f59fadf7a..0c54fd1b3 100644 >>> --- a/newlib/libm/complex/ccoshl.c >>> +++ b/newlib/libm/complex/ccoshl.c >>> @@ -32,6 +32,8 @@ >>> #include >>> #include >>> >>> +/* On platforms where long double is as wide as double. */ >>> +#ifdef _LDBL_EQ_DBL >>> long double complex >>> ccoshl(long double complex z) >>> { >>> @@ -43,3 +45,4 @@ ccoshl(long double complex z) >>> w =3D coshl(x) * cosl(y) + (sinhl(x) * sinl(y)) * I; >>> return w; >>> } >>> +#endif >>> diff --git a/newlib/libm/complex/ccosl.c b/newlib/libm/complex/ccosl.c >>> index c310f4024..a7619f3ec 100644 >>> --- a/newlib/libm/complex/ccosl.c >>> +++ b/newlib/libm/complex/ccosl.c >>> @@ -33,6 +33,8 @@ >>> #include >>> #include "cephes_subrl.h" >>> >>> +/* On platforms where long double is as wide as double. */ >>> +#ifdef _LDBL_EQ_DBL >>> long double complex >>> ccosl(long double complex z) >>> { >>> @@ -43,3 +45,4 @@ ccosl(long double complex z) >>> w =3D cosl(creall(z)) * ch - (sinl(creall(z)) * sh) * I; >>> return w; >>> } >>> +#endif >>> diff --git a/newlib/libm/complex/cephes_subrl.c >>> b/newlib/libm/complex/cephes_subrl.c >>> index 8af11df76..1d6d1b527 100644 >>> --- a/newlib/libm/complex/cephes_subrl.c >>> +++ b/newlib/libm/complex/cephes_subrl.c >>> @@ -35,6 +35,8 @@ >>> >>> /* calculate cosh and sinh */ >>> >>> +/* On platforms where long double is as wide as double. */ >>> +#ifdef _LDBL_EQ_DBL >>> void >>> _cchshl(long double x, long double *c, long double *s) >>> { >>> @@ -51,6 +53,7 @@ _cchshl(long double x, long double *c, long double *s) >>> *c =3D e + ei; >>> } >>> } >>> +#endif >>> >>> /* Program to subtract nearest integer multiple of PI */ >>> >>> @@ -85,6 +88,8 @@ _redupil(long double x) >>> >>> /* Taylor series expansion for cosh(2y) - cos(2x) */ >>> >>> +/* On platforms where long double is as wide as double. */ >>> +#ifdef _LDBL_EQ_DBL >>> long double >>> _ctansl(long double complex z) >>> { >>> @@ -126,3 +131,4 @@ _ctansl(long double complex z) >>> } while (fabsl(t/d) > MACHEPL); >>> return d; >>> } >>> +#endif >>> diff --git a/newlib/libm/complex/cexpl.c b/newlib/libm/complex/cexpl.c >>> index 8b56634ba..24fb40af0 100644 >>> --- a/newlib/libm/complex/cexpl.c >>> +++ b/newlib/libm/complex/cexpl.c >>> @@ -32,6 +32,8 @@ >>> #include >>> #include >>> >>> +/* On platforms where long double is as wide as double. */ >>> +#ifdef _LDBL_EQ_DBL >>> long double complex >>> cexpl(long double complex z) >>> { >>> @@ -44,3 +46,4 @@ cexpl(long double complex z) >>> w =3D r * cosl(y) + r * sinl(y) * I; >>> return w; >>> } >>> +#endif >>> diff --git a/newlib/libm/complex/clogl.c b/newlib/libm/complex/clogl.c >>> index 3644a44fc..9befec9ba 100644 >>> --- a/newlib/libm/complex/clogl.c >>> +++ b/newlib/libm/complex/clogl.c >>> @@ -32,6 +32,8 @@ >>> #include >>> #include >>> >>> +/* On platforms where long double is as wide as double. */ >>> +#ifdef _LDBL_EQ_DBL >>> long double complex >>> clogl(long double complex z) >>> { >>> @@ -44,3 +46,4 @@ clogl(long double complex z) >>> w =3D p + rr * I; >>> return w; >>> } >>> +#endif >>> diff --git a/newlib/libm/complex/cpowl.c b/newlib/libm/complex/cpowl.c >>> index 85c2c20f2..46dfd1386 100644 >>> --- a/newlib/libm/complex/cpowl.c >>> +++ b/newlib/libm/complex/cpowl.c >>> @@ -32,6 +32,8 @@ >>> #include >>> #include >>> >>> +/* On platforms where long double is as wide as double. */ >>> +#ifdef _LDBL_EQ_DBL >>> long double complex >>> cpowl(long double complex a, long double complex z) >>> { >>> @@ -54,3 +56,4 @@ cpowl(long double complex a, long double complex z) >>> w =3D r * cosl(theta) + (r * sinl(theta)) * I; >>> return w; >>> } >>> +#endif >>> diff --git a/newlib/libm/complex/cprojl.c b/newlib/libm/complex/cprojl.c >>> index e71c77353..28e43ed6d 100644 >>> --- a/newlib/libm/complex/cprojl.c >>> +++ b/newlib/libm/complex/cprojl.c >>> @@ -45,6 +45,9 @@ __RCSID("$NetBSD: cprojl.c,v 1.7 2014/10/10 00:48:18 >>> christos Exp $"); >>> * >>> * INFINITY + I * copysign(0.0, cimag(z)) >>> */ >>> + >>> +/* On platforms where long double is as wide as double. */ >>> +#ifdef _LDBL_EQ_DBL >>> long double complex >>> cprojl(long double complex z) >>> { >>> @@ -62,3 +65,4 @@ cprojl(long double complex z) >>> >>> return (w.z); >>> } >>> +#endif >>> diff --git a/newlib/libm/complex/csinhl.c b/newlib/libm/complex/csinhl.c >>> index 44ed05037..3187739a0 100644 >>> --- a/newlib/libm/complex/csinhl.c >>> +++ b/newlib/libm/complex/csinhl.c >>> @@ -32,6 +32,8 @@ >>> #include >>> #include >>> >>> +/* On platforms where long double is as wide as double. */ >>> +#ifdef _LDBL_EQ_DBL >>> long double complex >>> csinhl(long double complex z) >>> { >>> @@ -43,3 +45,4 @@ csinhl(long double complex z) >>> w =3D sinhl(x) * cosl(y) + (coshl(x) * sinl(y)) * I; >>> return w; >>> } >>> +#endif >>> diff --git a/newlib/libm/complex/csinl.c b/newlib/libm/complex/csinl.c >>> index 2b96c7225..2c087d5d3 100644 >>> --- a/newlib/libm/complex/csinl.c >>> +++ b/newlib/libm/complex/csinl.c >>> @@ -33,6 +33,8 @@ >>> #include >>> #include "cephes_subrl.h" >>> >>> +/* On platforms where long double is as wide as double. */ >>> +#ifdef _LDBL_EQ_DBL >>> long double complex >>> csinl(long double complex z) >>> { >>> @@ -43,3 +45,4 @@ csinl(long double complex z) >>> w =3D sinl(creall(z)) * ch + (cosl(creall(z)) * sh) * I; >>> return w; >>> } >>> +#endif >>> diff --git a/newlib/libm/complex/csqrtl.c b/newlib/libm/complex/csqrtl.c >>> index c10a1264a..cf9adf873 100644 >>> --- a/newlib/libm/complex/csqrtl.c >>> +++ b/newlib/libm/complex/csqrtl.c >>> @@ -49,6 +49,8 @@ __RCSID("$NetBSD: csqrtl.c,v 1.2 2014/10/11 00:43:51 >>> christos Exp $"); >>> >>> #define cpackl(r, i) ((r) + (i) * I) >>> >>> +/* On platforms where long double is as wide as double. */ >>> +#ifdef _LDBL_EQ_DBL >>> long double complex >>> csqrtl(long double complex z) >>> { >>> @@ -110,3 +112,4 @@ csqrtl(long double complex z) >>> else >>> return (result); >>> } >>> +#endif >>> diff --git a/newlib/libm/complex/ctanhl.c b/newlib/libm/complex/ctanhl.c >>> index 1db886f63..bbc47467b 100644 >>> --- a/newlib/libm/complex/ctanhl.c >>> +++ b/newlib/libm/complex/ctanhl.c >>> @@ -32,6 +32,8 @@ >>> #include >>> #include >>> >>> +/* On platforms where long double is as wide as double. */ >>> +#ifdef _LDBL_EQ_DBL >>> long double complex >>> ctanhl(long double complex z) >>> { >>> @@ -45,3 +47,4 @@ ctanhl(long double complex z) >>> >>> return w; >>> } >>> +#endif >>> diff --git a/newlib/libm/complex/ctanl.c b/newlib/libm/complex/ctanl.c >>> index c5c887c74..9c09ca3cd 100644 >>> --- a/newlib/libm/complex/ctanl.c >>> +++ b/newlib/libm/complex/ctanl.c >>> @@ -34,6 +34,8 @@ >>> #include >>> #include "cephes_subrl.h" >>> >>> +/* On platforms where long double is as wide as double. */ >>> +#ifdef _LDBL_EQ_DBL >>> long double complex >>> ctanl(long double complex z) >>> { >>> @@ -54,3 +56,4 @@ ctanl(long double complex z) >>> w =3D sinl(2.0L * creall(z)) / d + (sinhl(2.0L * cimagl(z)) / d= ) * >>> I; >>> return w; >>> } >>> +#endif >>> -- >>> 2.39.2 >>> >>> --0000000000005644be061a3c76d3--