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

--- Comment #4 from Hongtao.liu <crazylht at gmail dot com> ---

> It seems to be be handled here.
>  
> cut from copy_value in regcprop.c:
> ----
>   /* If SRC had been assigned a mode narrower than the copy, we can't
>      link DEST into the chain, because not all of the pieces of the
>      copy came from oldest_regno.  */
>   else if (sn > hard_regno_nregs (sr, vd->e[sr].mode))
>     return;
> ----
> 
> here we have %edi set as HImode, but use as SImode and be copied to %xmm2,
> but the condition failed to check this beacuase both SImode and HImode has
> nregs as 1, since the upper part could be garbage, it can't link DEST into
> the chain.
> 
>         kmovw   %k0, %edi       # 69    [c=4 l=4]  *movhi_internal/6  <----HI
>         kmovd   %k0, %edx       # 487   [c=4 l=3]  *movsi_internal/16 
>         vmovd   %edi, %xmm2     # 489   [c=4 l=6]  *movsi_internal/13 <----SI
>         sall    $16, %edx       # 73    [c=4 l=3]  *ashlsi3_1/0
>         kmovw   %k0, %r8d       # 74    [c=4 l=5]  *zero_extendhisi2/1
>         vpshuflw        $0, %xmm2, %xmm0        # 78    [c=4 l=5] 
> *vec_dupv4hi/1
>         orl     %edx, %r8d      # 75    [c=4 l=3]  *iorsi_1/0
>         testw   %di, %di        # 82    [c=4 l=3]  *cmphi_ccno_1/0
>         jle     .L52    # 83    [c=12 l=6]  *jcc
>         kmovd   %k0, %r9d       # 85    [c=4 l=4]  *movsi_internal/16 <----SI
>         testl   %r9d, %r9d      # 88    [c=4 l=3]  *cmpsi_ccno_1/0

and it looks like a generic code bug.

Reply via email to