[Bug middle-end/115924] Failure to optimize back and forth shifts of several operands by the same amount with operations in the middle to ands
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sun Jul 14 21:30:13 GMT 2024
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115924
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|tree-optimization |middle-end
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note clang falls over when the order is swapped of the addition is swapped:
```
#include <stdint.h>
uint32_t f(uint32_t i2, uint32_t aa)
{
return ((i2 >> 17) + (aa >> 17)) << 17;
}
uint32_t f2(uint32_t i2, uint32_t aa)
{
return ((aa & -(1 << 17)) + i2) & -(1 << 17);
}
bool f3(uint32_t i2, uint32_t aa)
{
return f(i2, aa) == f2(i2, aa);
}
```
More information about the Gcc-bugs
mailing list