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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2020-08-17
             Status|UNCONFIRMED                 |NEW
           Keywords|                            |missed-optimization
                 CC|                            |marxin at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Nice trick!
Generally speaking about the optimization (for longer types), it can be tricky
as:

        shr    $6, %ecx
can be bigger than 64 and so
        shrq    %cl, %rax

can result in undefined behavior as 1 << X, where X > 64.

Reply via email to