https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71336
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed|2021-07-19 00:00:00 |2023-4-9
--- Comment #9 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Take:
```
int test(int a) {
return a & 1 ? 7 : 3;
}
int test1(int a) {
int t = (a & 1) ? 4 : 0;
return t+3;
}
int test2(int a) {
int t = a & 1;
t *= 4;
return t+3;
}
```
these 3 all produce different code on x86_64. test2 produces the best though.
For aarch64, test1/test2 produce the same decent code; the and/shift has been
merged. for riscv, test1/test2 produce the same decent code too, 3 instructions
and no branches.