public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "slash.tmp at free dot fr" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/110104] gcc produces sub-optimal code for _addcarry_u64 chain Date: Fri, 07 Jul 2023 11:29:07 +0000 [thread overview] Message-ID: <bug-110104-4-nXmmg3PAAw@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-110104-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110104 --- Comment #5 from Mason <slash.tmp at free dot fr> --- FWIW, trunk (gcc14) translates testcase3 to the same code as the other testcases, while remaining portable across all architectures: $ gcc-trunk -O3 -march=bdver3 testcase3.c typedef unsigned long long u64; typedef unsigned __int128 u128; void testcase3(u64 *acc, u64 a, u64 b) { int c1, c2; u128 res = (u128)a * b; u64 lo = res, hi = res >> 64; c1 = __builtin_add_overflow(lo, acc[0], &acc[0]); c2 = __builtin_add_overflow(hi, acc[1], &acc[1]) | __builtin_add_overflow(c1, acc[1], &acc[1]); __builtin_add_overflow(c2, acc[2], &acc[2]); } testcase3: movq %rsi, %rax mulq %rdx addq %rax, (%rdi) adcq %rdx, 8(%rdi) adcq $0, 16(%rdi) ret Thanks again, Jakub.
prev parent reply other threads:[~2023-07-07 11:29 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-06-03 13:53 [Bug target/110104] New: " slash.tmp at free dot fr 2023-06-04 16:12 ` [Bug target/110104] " roger at nextmovesoftware dot com 2023-06-08 20:02 ` roger at nextmovesoftware dot com 2023-06-14 9:22 ` slash.tmp at free dot fr 2023-06-15 7:37 ` jakub at gcc dot gnu.org 2023-06-16 13:50 ` slash.tmp at free dot fr 2023-07-07 11:29 ` slash.tmp at free dot fr [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=bug-110104-4-nXmmg3PAAw@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).