public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/110748] New: optimize store of DF 0.0
@ 2023-07-20  6:13 vineetg at gcc dot gnu.org
  2023-07-20  6:15 ` [Bug target/110748] RISC-V: " vineetg at gcc dot gnu.org
                   ` (16 more replies)
  0 siblings, 17 replies; 18+ messages in thread
From: vineetg at gcc dot gnu.org @ 2023-07-20  6:13 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 110748
           Summary: optimize store of DF 0.0
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vineetg at gcc dot gnu.org
  Target Milestone: ---
            Target: RISC-V

Currently a store of int 0 is optimized by using reg x0.

void zi(int *i) {    *i = 0;    }

-O2 =march=rv64gc

  sw  zero,0(a0)
  ret

However a store of positive DF 0.0 generates 2 insns.

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

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

Since +0.0 is all zero bits, this could be generated as an int store
   sw zero, 0(a0) 

This is 1 less insn and avoids the FPU thus overall a win.

This came up when discussing an ICE in anewly proposed pass f-m-o by Manolis.
Turns out that it could be an independent optimization opportunity [1].

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

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2023-08-15 17:13 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-20  6:13 [Bug target/110748] New: optimize store of DF 0.0 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
2023-07-28 23:22 ` vineetg at gcc dot gnu.org
2023-08-15 17:13 ` vineetg at gcc dot gnu.org

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).