public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/98477] New: aarch64: Unnecessary GPR -> FPR moves for conditional select
@ 2020-12-30  9:35 ktkachov at gcc dot gnu.org
  2020-12-30  9:40 ` [Bug target/98477] " ktkachov at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: ktkachov at gcc dot gnu.org @ 2020-12-30  9:35 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 98477
           Summary: aarch64: Unnecessary GPR -> FPR moves for conditional
                    select
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ktkachov at gcc dot gnu.org
  Target Milestone: ---
            Target: aarch64

Code like
void
foo (int a, double *b)
{
  *b = a ? 10000.0 : 200.0;
}

generates:
foo:
        cmp     w0, 0
        mov     x2, 149533581377536
        movk    x2, 0x40c3, lsl 48
        mov     x0, 4641240890982006784
        fmov    d0, x2
        fmov    d1, x0
        fcsel   d0, d0, d1, ne
        str     d0, [x1]
        ret

We don't need to do the FCSEL on the FPR side if we're just storing it to
memory. We can just do a GPR CSEL and avoid the FMOVs.
I've seen this pattern in the disassembly of some math library routines.
Maybe we should add a =w,w,w alternative to the CSEL patterns in the backend?

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

end of thread, other threads:[~2024-05-06 18:29 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-30  9:35 [Bug target/98477] New: aarch64: Unnecessary GPR -> FPR moves for conditional select ktkachov at gcc dot gnu.org
2020-12-30  9:40 ` [Bug target/98477] " ktkachov at gcc dot gnu.org
2020-12-30  9:47 ` pinskia at gcc dot gnu.org
2020-12-30  9:50 ` pinskia at gcc dot gnu.org
2020-12-30  9:50 ` pinskia at gcc dot gnu.org
2023-11-18  6:59 ` pinskia at gcc dot gnu.org
2024-04-24  0:02 ` pinskia at gcc dot gnu.org
2024-04-24  6:05 ` pinskia at gcc dot gnu.org
2024-04-24  6:09 ` pinskia at gcc dot gnu.org
2024-04-24  6:22 ` pinskia at gcc dot gnu.org
2024-04-24  6:28 ` pinskia at gcc dot gnu.org
2024-05-06 18:29 ` pinskia 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).