This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH i386 AVX512] [63.1/n] Add vpshufb, perm autogen (except for v64qi).


On Fri, Oct 10, 2014 at 5:47 PM, Ilya Tocar <tocarip.intel@gmail.com> wrote:

>> My strong preference would be:
>>   enum machine_mode maskmode = mode;
>>   rtx (*gen) (rtx, rtx, rtx, rtx);
>> right below the enum machine_mode mode = GET_MODE (d ? d->op0 : op0);
>> line and then inside of the first switch just do:
>> ...
>>     case V16SImode:
>>       if (!TARGET_AVX512F)
>>       return false;
>>       gen = gen_avx512f_vpermi2varv16si3;
>>       break;
>>     case V4SFmode:
>>       if (!TARGET_AVX512VL)
>>       return false;
>>       gen = gen_avx512vl_vpermi2varv4sf3;
>>       maskmode = V4SImode;
>>       break;
>> ...
>> etc., then in the mask = line use:
>>     mask = gen_rtx_CONST_VECTOR (maskmode, gen_rtvec_v (d->nelt, vec));
>> and finally instead of the second switch do:
>>   emit_insn (gen (target, op0, force_reg (maskmode, mask), op1));
>>   return true;
>>
> Updated patch below.

Please recode that horrible first switch statement to:

--cut here--
  rtx (*gen) (rtx, rtx, rtx, rtx) = NULL;

  switch (mode)
    {
    case V8HImode:
      if (TARGET_AVX512VL && TARGET_AVX152BW)
    gen = gen_avx512vl_vpermi2varv8hi3;
      break;

    ...

    case V2DFmode:
      if (TARGET_AVX512VL)
    {
      gen = gen_avx512vl_vpermi2varv2df3;
      maskmode = V2DImode;
    }
      break;

    default:
      break;
    }

  if (gen == NULL)
    return false;
--cut here--

The patch is OK with the above improvement.

(Please also note that the patch has a bunch of i386.md changes that
will clash with followup patch series).

Thanks,
Uros.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]