https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103857
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #3)
> 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.
Oh it was swapping around the two values:
int f(int a, int b, int c)
{
if (a != b && a != c) __builtin_unreachable();
return a == b ? c : b;
}
int f1(int a, int b, int c)
{
if (a != b && a != c) __builtin_unreachable();
return a ^ b ^ c;
}
And then the ^ are needed.