public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pinskia at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/43892] PowerPC suboptimal "add with carry" optimization
Date: Thu, 03 Jun 2021 01:50:12 +0000	[thread overview]
Message-ID: <bug-43892-4-OybFVp5On4@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-43892-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #32 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #5)
> No.
> 
> Actually compilable testcase:
> 
> typedef unsigned int u32;
> 
> u32
> add32carry(u32 sum, u32 x)
> {
>   u32 z = sum + x;
>   if (sum + x < x)
>     z++;
>   return z;
> }
> 
> u32
> loop(u32 *buf, int len)
> {
>   u32 sum = 0;
>   for(; len; --len)
>     sum = add32carry(sum, *++buf);
>   return sum;
> }


Note on the trunk this code is recognized at least on the gimple level as add
with overflow and does:
  _7 = .ADD_OVERFLOW (sum_2(D), x_3(D));
  z_4 = REALPART_EXPR <_7>;
  _8 = IMAGPART_EXPR <_7>;
  if (_8 != 0)
    goto <bb 3>; [50.00%]
  else
    goto <bb 4>; [50.00%]

  <bb 3> [local count: 536870913]:
  z_5 = z_4 + 1;

  <bb 4> [local count: 1073741824]:
  # z_1 = PHI <z_4(2), z_5(3)>

---- CUT ---
So it is more about the back-end of PowerPC at this point.

  parent reply	other threads:[~2021-06-03  1:50 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-43892-4@http.gcc.gnu.org/bugzilla/>
2010-09-29 12:45 ` joakim.tjernlund at transmode dot se
2015-01-18 16:34 ` segher at gcc dot gnu.org
2015-01-18 17:00 ` joakim.tjernlund at transmode dot se
2015-01-18 20:31 ` segher at gcc dot gnu.org
2015-01-18 21:44 ` joakim.tjernlund at transmode dot se
2015-01-18 22:54 ` segher at gcc dot gnu.org
2015-01-19  0:05 ` joakim.tjernlund at transmode dot se
2020-10-20 18:37 ` christophe.leroy at csgroup dot eu
2020-10-20 18:59 ` segher at gcc dot gnu.org
2020-10-20 19:37 ` joakim.tjernlund at infinera dot com
2020-10-21  6:09 ` christophe.leroy at csgroup dot eu
2020-10-21 19:28 ` segher at gcc dot gnu.org
2020-10-21 21:01 ` jakub at gcc dot gnu.org
2020-10-21 21:31 ` segher at gcc dot gnu.org
2021-06-03  1:50 ` pinskia at gcc dot gnu.org [this message]
2021-06-03  4:33 ` segher at gcc dot gnu.org
2021-06-03  7:00 ` joakim.tjernlund at infinera dot com
2021-06-03 19:32 ` segher at gcc dot gnu.org
2021-12-03 19:44 ` roger at nextmovesoftware dot com
2023-06-06 20:14 ` jakub at gcc dot gnu.org
2023-08-29 16:41 ` bergner at gcc dot gnu.org
2023-08-29 17:43 ` roger at nextmovesoftware dot com
2010-04-26 13:33 [Bug rtl-optimization/43892] New: " gcc-bugzilla at gcc dot gnu dot org
2010-05-21 17:42 ` [Bug target/43892] " segher at gcc dot gnu dot org
2010-05-25 21:42 ` joakim dot tjernlund at transmode dot se
2010-05-26 16:46 ` segher at kernel dot crashing dot org
2010-05-26 20:47 ` joakim dot tjernlund at transmode dot se
2010-05-27  1:37 ` dje at gcc dot gnu dot org
2010-05-27  7:33 ` joakim dot tjernlund at transmode dot se

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-43892-4-OybFVp5On4@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).