https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125399
Bug ID: 125399
Summary: Missed optimization of __builtin_bitreverse*() when
comparing to 0
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: kaelfandrew at gmail dot com
Target Milestone: ---
https://godbolt.org/z/Knoq64bTT
GCC trunk with -O3 does not optimized src () to tgt () from this simple
EQ_EXPR/NE_EXPR 0 while Clang 19+ does:
C code
```
unsigned char src(unsigned char x) {
unsigned char y = __builtin_bitreverse8 (x);
if (y == 0)
return 0;
return 1;
}
unsigned char tgt(unsigned char x) {
if (x == 0)
return 0;
return 1;
}
```