[Bug tree-optimization/106245] New: Failure to optimize (u8)(a << 7) >> 7 pattern to a & 1
gabravier at gmail dot com
gcc-bugzilla@gcc.gnu.org
Sun Jul 10 09:30:02 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106245
Bug ID: 106245
Summary: Failure to optimize (u8)(a << 7) >> 7 pattern to a & 1
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: gabravier at gmail dot com
Target Milestone: ---
#include <stdint.h>
int8_t f(int8_t a)
{
return (uint8_t)(a << 7) >> 7;
}
This can be optimized to `return a & 1;`. This transformation is done by LLVM,
but not by GCC.
More information about the Gcc-bugs
mailing list