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 .