public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
To: Adhemerval Zanella <adhemerval.zanella@linaro.org>,
	"edison.von.myosotis@gmail.com" <edison.von.myosotis@gmail.com>
Cc: 'GNU C Library' <libc-alpha@sourceware.org>
Subject: Re: Improvement of fmod()
Date: Tue, 7 Mar 2023 22:13:40 +0000	[thread overview]
Message-ID: <PAWPR08MB898229A6859250597171531B83B79@PAWPR08MB8982.eurprd08.prod.outlook.com> (raw)

Hi,

Note the same code seems to be posted several times on Stackoverflow, eg.
[1], [2] - are they all the same author?

Also doing repeated division steps using CLZ is still essentially doing 1 bit at
a time. Previously we've had a patch doing 11+ bits per iteration using division.
In both cases you need hardware support or performance will be significantly
worse. The fastest solution is using a single division followed by multiply by
inverse - LLVM seems to have adopted that.

Cheers,
Wilco

[1] https://stackoverflow.com/questions/69222373/fastest-way-for-wrapping-a-value-in-an-interval
[2] https://stackoverflow.com/questions/41685039/is-fmod-faster-than-for-integer-modulus-calculation

             reply	other threads:[~2023-03-07 22:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-07 22:13 Wilco Dijkstra [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-03-07 15:46 Edison von Myositis
2023-03-07 17:01 ` Adhemerval Zanella Netto

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=PAWPR08MB898229A6859250597171531B83B79@PAWPR08MB8982.eurprd08.prod.outlook.com \
    --to=wilco.dijkstra@arm.com \
    --cc=adhemerval.zanella@linaro.org \
    --cc=edison.von.myosotis@gmail.com \
    --cc=libc-alpha@sourceware.org \
    /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).