public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Joseph Myers <joseph@codesourcery.com>
To: Patrick McGehearty <patrick.mcgehearty@oracle.com>
Cc: <libc-alpha@sourceware.org>
Subject: Re: [PATCH] improves exp() and expf() performance on Sparc.
Date: Wed, 06 Sep 2017 21:01:00 -0000	[thread overview]
Message-ID: <alpine.DEB.2.20.1709062045570.29155@digraph.polyomino.org.uk> (raw)
In-Reply-To: <ef59f618-90ee-f0c0-460f-38c427c01643@oracle.com>

[-- Attachment #1: Type: text/plain, Size: 1921 bytes --]

On Wed, 6 Sep 2017, Patrick McGehearty wrote:

> The sysdeps/ieee754/dbl-64/w_exp_compat.c
> declares __exp (double x)
> and then adds:
> hidden_def (__exp)
> weak_alias (__exp, exp)
> 
> I believe the weak_alias in w_exp_compat.c is overriden by the
> sparc_libm_ifunc in e_exp-generic.c.  At least, I am not seeing any
> link time errors about double exp declarations and I am seeing the new
> code being executed (as proved by the speed and accuracy changes).

Then you should avoid any object code from w_exp_compat.c being linked 
into libm.so at all, by overriding it with a dummy file, rather than just 
letting certain symbols be overridden at link time.

> As for error handling, I believe the extra level of indirection on
> return from exp provided by the sysdeps/ieee754/dbl-64/w_exp_compat.c
> routine is an anti-performance design. Every normal return from e_exp

It's fairly clearly a design optimized for consistency of error handling 
in the presence of several architecture-specific implementations of the 
main function, without needing to e.g. deal with TLS in assembly code for 
accessing errno or make multiple implementations handle matherr the same 
way.  When you avoid architecture-specific implementations (especially .S 
ones) as far as possible, integrated error handling is more practical, 
especially if you also use new symbol versions to avoid needing to deal 
with matherr.

For expf performance obviously needs to be compared with Szabolcs's 
implementation (compiled with whatever options and configured 
appropriately regarding conversions to integer etc. to be optimal for 
SPARC).  For exp, I'm inclined to say performance should be compared with 
the existing exp *with the slow paths calling __slowexp removed along with 
the associated checks for whether to use those slow paths* since those 
slow paths are completely unnecessary.

-- 
Joseph S. Myers
joseph@codesourcery.com

  reply	other threads:[~2017-09-06 21:01 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-01 22:59 Patrick McGehearty
2017-09-01 23:14 ` Joseph Myers
2017-09-06 20:34   ` Patrick McGehearty
2017-09-06 21:01     ` Joseph Myers [this message]
2017-09-07 20:42       ` Patrick McGehearty
2017-09-07 21:05         ` Joseph Myers
2017-09-07 23:53           ` Patrick McGehearty
2017-09-04 11:43 ` Szabolcs Nagy
2017-09-06 20:31   ` Patrick McGehearty
2017-09-11 18:50 Wilco Dijkstra

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=alpine.DEB.2.20.1709062045570.29155@digraph.polyomino.org.uk \
    --to=joseph@codesourcery.com \
    --cc=libc-alpha@sourceware.org \
    --cc=patrick.mcgehearty@oracle.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).