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 middle-end/100942] New: ccmp is not used if the value is used later
Date: Mon, 07 Jun 2021 07:51:59 +0000	[thread overview]
Message-ID: <bug-100942-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 100942
           Summary: ccmp is not used if the value is used later
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---
            Target: aarch64-linux-gnu

Take:
void foo(void);
int f1(int a, int b)
{
  int c = a == 0 || b == 0;
  if (c) foo();
  return c;
}
------ CUT -----
Right now we produce at -O2:
        stp     x29, x30, [sp, -32]!
        cmp     w0, 0
        mov     x29, sp
        str     x19, [sp, 16]
        cset    w19, eq
        cmp     w1, 0
        cset    w0, eq
        orr     w19, w19, w0
        cbnz    w19, .L8
        mov     w0, w19
        ldr     x19, [sp, 16]
        ldp     x29, x30, [sp], 32
        ret

Notice how we have cmp/cset/cmp/cset/orr.
This is a (much) reduced testcase from Xalan in SPEC 2k6.

             reply	other threads:[~2021-06-07  7:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-07  7:51 pinskia at gcc dot gnu.org [this message]
2023-12-12  1:18 ` [Bug middle-end/100942] " pinskia at gcc dot gnu.org
2023-12-12  3:40 ` pinskia at gcc dot gnu.org
2023-12-12  8:23 ` pinskia at gcc dot gnu.org
2024-01-23 17:43 ` cvs-commit at gcc dot gnu.org
2024-01-24 18:29 ` 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-100942-4@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).