https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123514
Bug ID: 123514
Summary: bit manip to ABS detection
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: enhancement
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: pinskia at gcc dot gnu.org
Target Milestone: ---
Take:
```
int bit_trick(int dec_exp) {
int mask = -(dec_exp < 0);
dec_exp = ((dec_exp + mask) ^ mask); // absolute value
return dec_exp;
}
```
This should be optimized to ABS<dec_exp>.