[Bug tree-optimization/103857] implement ternary without jump (and comparison)
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Dec 29 20:23:58 GMT 2021
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103857
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Keywords| |missed-optimization
Ever confirmed|0 |1
Severity|normal |enhancement
Last reconfirmed| |2021-12-29
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Reduced testcase:
int f(int a, int b, int c)
{
if (a != b && a != c) __builtin_unreachable();
return a == b ? b : c;
}
This should just translate into:
int f1(int a, int b, int c)
{
if (a != b && a != c) __builtin_unreachable();
return a;
}
The ^ part is not needed really if it is just selecting between two values.
More information about the Gcc-bugs
mailing list