public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "gabravier at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/95784] Failure to optimize usage of __builtin_add_overflow with return statement properly
Date: Sat, 20 Jun 2020 14:33:23 +0000	[thread overview]
Message-ID: <bug-95784-4-sIuSlzunK4@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-95784-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95784

--- Comment #6 from Gabriel Ravier <gabravier at gmail dot com> ---
Created attachment 48761
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48761&action=edit
File for benchmarking this function but everything is aligned properly.

I've changed the source file slightly, it looks like the LLVM version was
faster than the "do nothing" version because the loop was misaligned. This is
the test results I get with the version with aligned loops (I've also adjusted
the amount of iterations) :

$ gcc test.S -O3 -ggdb3 -DGCC_VERSION && time ./a.out && gcc test.S -O3 -ggdb3
-DLLVM_VERSION && time ./a.out && gcc test.S -O3 -ggdb3 && time ./a.out

real    0m3.130s # GCC version
user    0m3.122s
sys     0m0.001s

real    0m2.599s # LLVM version
user    0m2.593s
sys     0m0.001s

real    0m2.597s # version that does nothing
user    0m2.591s
sys     0m0.000s

I can now note that the LLVM version is now almost as fast as literally doing
nothing, so now it looks really much better than the GCC version, at least to
me.

  parent reply	other threads:[~2020-06-20 14:33 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-20 10:13 [Bug tree-optimization/95784] New: " gabravier at gmail dot com
2020-06-20 12:09 ` [Bug target/95784] " pinskia at gcc dot gnu.org
2020-06-20 14:01 ` gabravier at gmail dot com
2020-06-20 14:02 ` gabravier at gmail dot com
2020-06-20 14:25 ` gabravier at gmail dot com
2020-06-20 14:27 ` gabravier at gmail dot com
2020-06-20 14:33 ` gabravier at gmail dot com [this message]
2020-06-20 15:51 ` jakub at gcc dot gnu.org
2020-06-20 19:05 ` gabravier at gmail dot com
2020-06-22  8:05 ` rguenth at gcc dot gnu.org
2021-08-03  3:44 ` [Bug rtl-optimization/95784] " pinskia at gcc dot gnu.org

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-95784-4-sIuSlzunK4@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: 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).