https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111252
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |pinskia at gcc dot gnu.org
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
Last reconfirmed| |2023-08-31
Keywords| |missed-optimization
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Interesting:
int test(int a, int b)
{
return (a & ~0x80000000) | (b & 0x80000000);
}
Produces better code:
lu12i.w $r12,-2147483648>>12 # 0xffffffff80000000
and $r12,$r12,$r5
bstrpick.w $r4,$r4,30,0
or $r4,$r4,$r12
slli.w $r4,$r4,0
jr $r1
But note the expansion of __builtin_copysignf128 should be using
extract_bit_field and friends to extract the bit and do the insertation. I have
not looked into that yet though.