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

--- Comment #2 from Hongtao Liu <liuhongt at gcc dot gnu.org> ---
(In reply to Uroš Bizjak from comment #1)
> (In reply to David Binderman from comment #0)
> > Static analyser cppcheck says:
> > 
> > gcc/config/i386/i386-expand.cc:24871:35: warning: Identical condition
> > '!TARGET_AVX512BW', second condition is always false
> > [identicalConditionAfterEarlyExit]
> > 
> > Source code is
> > 
> >   if (!TARGET_AVX512BW)
> >     return false;
> > 
> >   if ((qimode == V16QImode && !TARGET_AVX2)
> >       || (qimode == V32QImode && (!TARGET_AVX512BW || !TARGET_EVEX512))
> >       /* There are no V64HImode instructions.  */
> >       || qimode == V64QImode)
> >      return false;
> > 
> > Suggest remove second condition.
> 
> The comment before the first condition says:
> 
>   /* Without VPMOVWB (provided by AVX512BW ISA), the expansion uses the
>      generic permutation to merge the data back into the right place.  This
>      permutation results in VPERMQ, which is slow, so better fall back to
>      ix86_expand_vecop_qihi.  */
> 
> so the whole function should be rewritten with this in mind. Even with the
> above condition in place, V16QImode without AVX512VL will fallback to VPERMQ:
> 
>     case E_V16QImode:
>       himode = V16HImode;
>       if (TARGET_AVX512VL && TARGET_AVX512BW)
>       gen_truncate = gen_truncv16hiv16qi2;

Yes, I'll do a refactor.

Reply via email to