public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "mkuvyrkov at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/113542] [14 Regression] gcc.target/arm/bics_3.c regression after change for pr111267
Date: Wed, 21 Feb 2024 12:47:54 +0000	[thread overview]
Message-ID: <bug-113542-4-jvRHxkjGnH@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-113542-4@http.gcc.gnu.org/bugzilla/>

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

Maxim Kuvyrkov <mkuvyrkov at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rearnsha at gcc dot gnu.org
           Assignee|mkuvyrkov at gcc dot gnu.org       |unassigned at gcc dot gnu.org

--- Comment #4 from Maxim Kuvyrkov <mkuvyrkov at gcc dot gnu.org> ---
Reply from Richard Earnshaw on gcc-patches@ to my patch to make the testcase
accept both "bic" and "bics" instructions:

The test was added (r6-823-g0454e698401a3e) specifically to check that a BICS
instruction was being generated.  Whether or not that is right is somewhat
debatable, but this change seems to be papering over a different issue.

Either we should generate BICS, making this change incorrect, or we should
disable the test for thumb code on the basis that this isn't really a win.

But really, we should fix the compiler to do better here.  We really want
something like

        BICS  r0, r0, r1  // r0 is 0 or non-zero
        MOVNE r0, #1      // convert all non-zero to 1

in Arm state (ie using the BICS instruction to set the result to zero); and in
thumb2, perhaps something like:

        BICS  r0, r0, r1
        IT    ne
        MOVNE r0, #1

or maybe even better:

        BIC  r0, r0, r1
        SUBS r1, r0, #1
        SBC  r0, r0, r1

which is slightly better than BICS because SUBS breaks a condition-code chain
(all the flag bits are set).

There are similar quality issues for other NE(arith-op, 0) cases; we just don't
have tests for those.

  parent reply	other threads:[~2024-02-21 12:47 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-22 15:46 [Bug rtl-optimization/113542] New: " roger at nextmovesoftware dot com
2024-01-24 12:48 ` [Bug rtl-optimization/113542] " rearnsha at gcc dot gnu.org
2024-01-24 16:42 ` [Bug target/113542] [14 Regression] " rearnsha at gcc dot gnu.org
2024-01-25  9:51 ` mkuvyrkov at gcc dot gnu.org
2024-01-31 14:33 ` rguenth at gcc dot gnu.org
2024-02-21 12:47 ` mkuvyrkov at gcc dot gnu.org [this message]
2024-03-07 20:47 ` law at gcc dot gnu.org
2024-03-08 17:08 ` cvs-commit at gcc dot gnu.org
2024-03-08 17:15 ` rearnsha 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-113542-4-jvRHxkjGnH@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).