From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-vk1-xa32.google.com (mail-vk1-xa32.google.com [IPv6:2607:f8b0:4864:20::a32]) by sourceware.org (Postfix) with ESMTPS id 5DC723841888 for ; Wed, 5 Jun 2024 17:00:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5DC723841888 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 5DC723841888 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::a32 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1717606845; cv=none; b=jvY/j/gyzXEVY3rUhMgddA5F/OYTs0SffaS83a4MNKOYEBMwivsQl+LZiAtntIlo045VknxOLCZgdayzum3XyKy8Ozie5fjDHu/3FMf632m9mMo6TohhFOgBmbeZ0bM0o280Y4un3fcxmxn5FDDPAFfXASc3Dgt+SO/UWQJf7wc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1717606845; c=relaxed/simple; bh=KCYGy5EyfNT4f0YoHiEIq1hzTY2H2ZbDnW9B+4ViPII=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=KDT0Ylo1ntXtiYlVCSAceePoU7nDKlf5QZ63Y0QdQcKzg0+58FL4EVzvHoLKi5MG5cXXwmuJWG2lbuQBzE6+0hZRonIZ/rdE29mt5emKqAl9xgq1GACobo2hCBJ/3LfFiWCn2YMyc39ET1I9+Ujwhheqb1xMJ0YYGuiSC0VnyGE= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-vk1-xa32.google.com with SMTP id 71dfb90a1353d-4eb05e29e69so17235e0c.3 for ; Wed, 05 Jun 2024 10:00:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717606841; x=1718211641; 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=4uhPuvoHMg5YHaerxXq4Pifdz5/lAylJBf/ZWXGVrP8=; b=k/fmZ7j6uIxAUBTEdkn17UrlEqhW5SaxOvZFpbZlONOGUXRGiw8RvGQhCKN9cl7mQL nlPm9hLsAdyQiNF1PJgkOkDJhjnfypH2t7zHUavZXqOVOgTT/l941A7vbUyd6D0hM9Zz TfLMZpo4Flm5MOD52/f94jxeMOD98KGDG9YrxaZ7cA74QK109E7WDTCfIehcdn393Eh7 ojUsUyLmMFRv19q1I/UCI3YZD90HPu9/eNnGV6KyBig0QLG+x9vq8UwsRj8bHuOoYfpi 1lmiXBQAYkilmpx8hW5BEXFz6w5riT4IHAMiBi08TjbukTE9XTV+zUwc0B8FCMmB4Z0l EC3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717606841; x=1718211641; 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=4uhPuvoHMg5YHaerxXq4Pifdz5/lAylJBf/ZWXGVrP8=; b=cqXAoygHXEcrPGYfjWuiVOoKpZkPRuMMmqe35KSblolSwQOmic/p8vy/87z1KF9uTe N7GiJ0t2UVdxexZ44q6IX4JBjxi2gBf56zKrCqoV6DTlJV7s24R3v2E1EijCH3O/gD25 1Q611pDEiynYe483qqnAL4SuBr5sriB1G5WFEBbyGlA7mKjMjb+jf0VFAef5DTb2EmSw sds+GaXlSS1jUoV98QI8Yx0ze1CVki7rx39vPNWlA2b0QJvsgD8iL1vRSEmfv69cr+vz lSK2qqdPhQ0tdaw0xxwftHWDNeN/6EoszpXHjIGF4jlNp7VQLieryJJ+7yEOYtvBVT2f eqEQ== X-Gm-Message-State: AOJu0YyEl5nn6uEG9mM0hPk0UJniwmvAc3Ed8Dg0lfVAvu1F6hzdr4FF c7ScG1MQGt9fvSbo4e8RsF7e3pSzajqf4sz9Zvg5en2phYFNBEFPqL9WhSJjgkZTftboCKJrSMJ T50bNBtHNlRbKb7Un+3QwKAiVR9E= X-Google-Smtp-Source: AGHT+IFnF27qNaSxZmljzHYfGX6qnT1kIi/wGnoIZN5o/38OCfS+t89YnYUeNd5/D1SPo0EQtb+423Szx3aB13DpZBA= X-Received: by 2002:a05:6122:4117:b0:4e4:e998:bf7f with SMTP id 71dfb90a1353d-4eb3a4c5127mr3890062e0c.11.1717606841260; Wed, 05 Jun 2024 10:00:41 -0700 (PDT) MIME-Version: 1.0 References: <0ca79433-448c-469f-880a-6b228ade4b80@app.fastmail.com> In-Reply-To: <0ca79433-448c-469f-880a-6b228ade4b80@app.fastmail.com> From: Joel Sherrill Date: Wed, 5 Jun 2024 12:00:29 -0500 Message-ID: Subject: Re: [PATCH] newlib: libm: skip "long double" complex functions if long double != double To: Pietro Monteiro Cc: newlib@sourceware.org Content-Type: multipart/alternative; boundary="000000000000a322f7061a2781b1" X-Spam-Status: No, score=-7.2 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: --000000000000a322f7061a2781b1 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 > > --000000000000a322f7061a2781b1--