On Fri, Oct 30, 2020 at 3:38 AM Eugene Rozenfeld via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> This patch adds a pattern for folding
>
>                 x >> x
>
> to
>
>               0
>
> as described in PR96701.
>
>
> Without this patch the x86_64-pc-linux-gnu code generated for this function
>
>
>
> int
>
> foo (int i)
>
> {
>
>   return i >> i;
>
> }
>
>
>
> is
>
>
>
> mov    ecx,edi
>
> sar    edi,cl
>
> test   edi,edi
>
> setne  al
>
> ret
>
>
>
> With the patch the code is
>
>
> xor    eax,eax
> ret
>
>
> Tested on x86_64-pc-linux-gnu.

OK.

Thanks,
Richard.

> Eugene

Reply via email to