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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Very suboptimal AVX2 code   |shift not demotated when
                   |generation of simple shift  |shift amount range is known
                   |loop                        |

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
RTL handles &0xf but if the range is there we don't optimize it:
E.g. it can be shown by:
```
#include <stdint.h>

void lshift(uint16_t *x, uint8_t amount)
{
  x[0] = x[0] << (amount&0xF);
}
void lshift1(uint16_t *x, uint8_t amount)
{
  if (amount >= 16) 
    __builtin_unreachable();
  x[0] = x[0] << (amount&0xF);
}
```

Reply via email to