public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Paul E Murphy <murphyp@linux.ibm.com>
To: Sachin Monga <smonga@linux.ibm.com>, libc-alpha@sourceware.org
Subject: Re: [PATCH v6] Added Redirects to longdouble error functions [BZ #29033]
Date: Tue, 18 Apr 2023 17:13:18 -0500	[thread overview]
Message-ID: <ce59802e-c5f8-3841-e003-f98154d834bc@linux.ibm.com> (raw)
In-Reply-To: <20230417110457.2894647-2-smonga@linux.ibm.com>



On 4/17/23 6:04 AM, Sachin Monga via Libc-alpha wrote:
> This patch redirects the error functions to the appropriate
> longdouble variants which enables the compiler to optimize
> for the abi ieeelongdouble.
> 
> Signed-off-by: Sachin Monga <smonga@linux.ibm.com>


> diff --git a/misc/tst-ldbl-errorfptr.c b/misc/tst-ldbl-errorfptr.c
> new file mode 100644
> index 0000000000..e11575b6a5
> --- /dev/null
> +++ b/misc/tst-ldbl-errorfptr.c
...
> +#define NLDBL_SYMBOL2(alias) __ASMNAME (#alias)
> +#define NLDBL_SYMBOL(alias) NLDBL_SYMBOL2 (__nldbl_##alias)
> +#define IEEE_LONG_DOUBLE(alias) __ASMNAME ("__" #alias "ieee128")
> +#define NO_LONG_DOUBLE(alias) NLDBL_SYMBOL (alias)
> +#define DEFAULT_SYMBOL(alias) NLDBL_SYMBOL2 (alias)

I think the above can be further simplified (see comment below).


> +#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
> +  error_sym = (char *) IEEE_LONG_DOUBLE(error);
> +  error_sym_at_line = (char *) IEEE_LONG_DOUBLE(error_at_line);
> +#elif defined __LONG_DOUBLE_MATH_OPTIONAL && defined __NO_LONG_DOUBLE_MATH
> +  error_sym = (char *) NO_LONG_DOUBLE(error);
> +  error_sym_at_line = (char *) NO_LONG_DOUBLE(error_at_line);
> +#else
> +  error_sym = (char *) DEFAULT_SYMBOL(error);
> +  error_sym_at_line = (char *) DEFAULT_SYMBOL(error_at_line);
> +#endif

Can the if/elif/else be consolidated into one? I think a more simple 
macro can be used to configure the expected names of the potentially 
redirected function. e.x

#if redirect_to_f128
# define LDBL_NAME(x) "__" #x "ieee128"
#else redirect_to_double
# define LDBL_NAME(x) "__nldbl_" #x
#else
# define LDBL_NAME(x) #x
#endif

Otherwise, this LGTM.

      reply	other threads:[~2023-04-18 22:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-17 11:04 [PATCH] " Sachin Monga
2023-04-17 11:04 ` [PATCH v6] " Sachin Monga
2023-04-18 22:13   ` Paul E Murphy [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ce59802e-c5f8-3841-e003-f98154d834bc@linux.ibm.com \
    --to=murphyp@linux.ibm.com \
    --cc=libc-alpha@sourceware.org \
    --cc=smonga@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).