public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "rsaxvc at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/106484] Failure to optimize uint64_t/constant division on ARM32 Date: Thu, 04 May 2023 12:55:25 +0000 [thread overview] Message-ID: <bug-106484-4-EQKTmADEFv@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-106484-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106484 --- Comment #4 from rsaxvc at gmail dot com --- Benchmarking shows the speedup to be highly variable depending on CPU core as well as __aeabi_uldivmod() implementation, and somewhat on numerator. The best __aeabi_uldivmod()s I've seen do use 32bit division instructions when available, and umulh() based approach is only 2-3x faster when division instructions are available. When umull(32x32 with 64bit result) is available and udiv is not available or libc doesn't use it, the umulh() based approach proposed here completes 28-38x faster, on Cortex-M4, measured via GPIO and oscilloscope. The wide variation in relative speed is due to variable execution time of __aeabi_uldivmod(). Similar on ARM11. There's a partial list of some contemporary cores have udiv here: https://community.arm.com/arm-community-blogs/b/architectures-and-processors-blog/posts/divide-and-conquer it does look like things are headed towards more cores having udiv available.
next prev parent reply other threads:[~2023-05-04 12:55 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-07-30 18:38 [Bug target/106484] New: " rsaxvc at gmail dot com 2022-07-30 18:39 ` [Bug target/106484] " rsaxvc at gmail dot com 2022-07-30 22:29 ` pinskia at gcc dot gnu.org 2022-08-01 10:50 ` rearnsha at gcc dot gnu.org 2022-08-01 12:12 ` rsaxvc at gmail dot com 2023-05-04 12:55 ` rsaxvc at gmail dot com [this message] 2023-07-08 18:10 ` rsaxvc at gmail dot com
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=bug-106484-4-EQKTmADEFv@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.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: linkBe 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).