public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/110748] RISC-V: optimize store of DF 0.0
Date: Sat, 22 Jul 2023 21:45:16 +0000	[thread overview]
Message-ID: <bug-110748-4-JaWUvVyez3@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-110748-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #14 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Vineet Gupta <vineetg@gcc.gnu.org>:

https://gcc.gnu.org/g:ecfa870ff29d979bd2c3d411643b551f2b6915b0

commit r14-2731-gecfa870ff29d979bd2c3d411643b551f2b6915b0
Author: Vineet Gupta <vineetg@rivosinc.com>
Date:   Thu Jul 20 11:15:37 2023 -0700

    RISC-V: optim const DF +0.0 store to mem [PR/110748]

    Fixes: ef85d150b5963 ("RISC-V: Enable TARGET_SUPPORTS_WIDE_INT")

    DF +0.0 is bitwise all zeros so int x0 store to mem can be used to optimize
it.

    void zd(double *) { *d = 0.0; }

    currently:

    | fmv.d.x fa5,zero
    | fsd     fa5,0(a0)
    | ret

    With patch

    | sd      zero,0(a0)
    | ret

    The fix updates predicate const_0_operand() so reg_or_0_operand () now
    includes const_double, enabling movdf expander -> riscv_legitimize_move ()
    to generate below vs. an intermediate set (reg:DF) const_double:DF

    | (insn 6 3 0 2 (set (mem:DF (reg/v/f:DI 134 [ d ])
    |        (const_double:DF 0.0 [0x0.0p+0]))

    This change also enables such insns to be recog() by later passes.
    The md pattern "*movdf_hardfloat_rv64" despite already supporting the
    needed constraints {"m","G"} mem/const 0.0 was failing to match because
    the additional condition check reg_or_0_operand() was failing due to
    missing const_double.

    This failure to recog() was triggering an ICE when testing the in-flight
    f-m-o patches and is how all of this started, but then was deemed to be
    an independent optimization of it's own [1].

    [1] https://gcc.gnu.org/pipermail/gcc-patches/2023-July/624857.html

    Its worthwhile to note all the set peices were already there and working
    up until my own commit mentioned at top regressed the whole thing.

    Ran thru full multilib testsuite and no surprises. There was 1 false
    failure due to random string "lw" appearing in lto build assembler output,
    which is also fixed here.

    gcc/ChangeLog:

            PR target/110748
            * config/riscv/predicates.md (const_0_operand): Add back
            const_double.

    gcc/testsuite/ChangeLog:

            * gcc.target/riscv/pr110748-1.c: New Test.
            * gcc.target/riscv/xtheadfmv-fmv.c: Add '\t' around test
            patterns to avoid random string matches.

    Signed-off-by: Vineet Gupta <vineetg@rivosinc.com>

  parent reply	other threads:[~2023-07-22 21:45 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-20  6:13 [Bug target/110748] New: " vineetg at gcc dot gnu.org
2023-07-20  6:15 ` [Bug target/110748] RISC-V: " vineetg at gcc dot gnu.org
2023-07-20  6:28 ` kito at gcc dot gnu.org
2023-07-20  6:33 ` kito at gcc dot gnu.org
2023-07-20  6:50 ` vineetg at gcc dot gnu.org
2023-07-20 16:07 ` pinskia at gcc dot gnu.org
2023-07-20 16:23 ` law at gcc dot gnu.org
2023-07-20 17:13 ` palmer at gcc dot gnu.org
2023-07-20 17:22 ` palmer at gcc dot gnu.org
2023-07-20 17:24 ` vineetg at gcc dot gnu.org
2023-07-20 17:38 ` vineetg at gcc dot gnu.org
2023-07-21 21:29 ` vineetg at gcc dot gnu.org
2023-07-21 21:40 ` vineetg at gcc dot gnu.org
2023-07-21 21:44 ` vineetg at gcc dot gnu.org
2023-07-21 22:51 ` pinskia at gcc dot gnu.org
2023-07-22 21:45 ` cvs-commit at gcc dot gnu.org [this message]
2023-07-28 23:22 ` vineetg at gcc dot gnu.org
2023-08-15 17:13 ` vineetg 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-110748-4-JaWUvVyez3@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).