public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/112454] New: csinc (csel is though) is not being used when there is matches twice
@ 2023-11-09  6:54 pinskia at gcc dot gnu.org
  2023-11-09 17:57 ` [Bug target/112454] " pinskia at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-11-09  6:54 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 112454
           Summary: csinc (csel is though) is not being used when there is
                    matches twice
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---
            Target: aarch64

Take:
```
int f(int a, int b, int c, int d)
{
  return (a == 2 ? 1 : b) + (c == 3 ? 1 : d);
}
```

GCC produces:
```
        cmp     w0, 2
        mov     w4, 1
        csel    w0, w1, w4, ne
        cmp     w2, 3
        csel    w3, w3, w4, ne
        add     w0, w0, w3
```


But that `mov w4, 1` is useless if we use csinc .

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

end of thread, other threads:[~2023-11-27 23:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-09  6:54 [Bug target/112454] New: csinc (csel is though) is not being used when there is matches twice pinskia at gcc dot gnu.org
2023-11-09 17:57 ` [Bug target/112454] " pinskia at gcc dot gnu.org
2023-11-18  6:48 ` pinskia at gcc dot gnu.org
2023-11-18  6:56 ` pinskia at gcc dot gnu.org
2023-11-26 23:52 ` pinskia at gcc dot gnu.org
2023-11-27 23:09 ` cvs-commit 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).