https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112629

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2023-11-19
         Resolution|INVALID                     |---
           Assignee|unassigned at gcc dot gnu.org      |pinskia at gcc dot 
gnu.org
             Status|RESOLVED                    |ASSIGNED

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Now if we know shift is known to be non-negative we should be able to this
optimization.

e.g.
```
int add_shift(signed shift) {
    if (shift < 0)  __builtin_unreachable();
    return 1 << (shift + 4);
}
int add_shift_1(signed shift) {
    shift &= 0xff;
    return 1 << (shift + 4);
}
```

Mine.

Reply via email to