https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123322
Bug ID: 123322
Summary: [16 Regression] worse czero generation for GCC 16 vs
GCC 15
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: normal
Priority: P3
Component: rtl-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: pinskia at gcc dot gnu.org
Target Milestone: ---
Target: riscv
Take:
```
int f(int a, int b, int c)
{
if (c) a |= b;
return a;
}
```
Compile this with `-O2 -march=rv64gc_zicond -mabi=lp64d`.
GCC 15 was able to produce:
```
czero.eqz a2,a1,a2
or a0,a0,a2
ret
```
But GCC 16 produces:
```
or a1,a0,a1
czero.eqz a1,a1,a2
czero.nez a0,a0,a2
add a0,a0,a1
```
I think this was introduced by r16-3760-g9ff5cadac4579f (but I could be wrong).