On Fri, Aug 21, 2015 at 2:18 PM, Petr Murzin <petrmurz...@gmail.com> wrote:
> Hello,
> Please have a look at updated patch.
>
> On Tue, Aug 4, 2015 at 3:15 PM, Richard Biener <rguent...@suse.de> wrote:
>> On Fri, 31 Jul 2015, Petr Murzin wrote:
>> @@ -5586,8 +5770,6 @@ vectorizable_store (gimple stmt,
>> gimple_stmt_iterator *gsi, gimple *vec_stmt,
>>    prev_stmt_info = NULL;
>>    for (j = 0; j < ncopies; j++)
>>      {
>> -      gimple new_stmt;
>> -
>>        if (j == 0)
>>         {
>>            if (slp)
>>
>> spurious change?
>
> I have increased the scope of this variable to use it in checking for
> STMT_VINFO_SCATTER_P (stmt_info).

@@ -3763,32 +3776,46 @@ again:
       if (vf > *min_vf)
        *min_vf = vf;

-      if (gather)
+      if (gatherscatter != SG_NONE)
        {
          tree off;
+         if (vect_check_gather_scatter (stmt, loop_vinfo, NULL, &off,
NULL, true) != 0)
+           gatherscatter = GATHER;
+         else if (vect_check_gather_scatter (stmt, loop_vinfo, NULL,
&off, NULL, false)
+                                             != 0)
+           gatherscatter = SCATTER;
+         else
+           gatherscatter = SG_NONE;

as I said vect_check_gather_scatter already knows whether the DR is a read or
a write and thus whether it needs to check for gather or scatter.  Remove
the new argument.  And simply do

   if (!vect_check_gather_scatter (stmt....))
     gatherscatter = SG_NONE;

-         STMT_VINFO_GATHER_P (stmt_info) = true;
+         if (gatherscatter == GATHER)
+           STMT_VINFO_GATHER_P (stmt_info) = true;
+         else
+           STMT_VINFO_SCATTER_P (stmt_info) = true;
        }

and as suggested merge STMT_VINFO_GATHER_P and STMT_VINFO_SCATTER_P
using the enum so you can simply do

 STMT_VINFO_SCATTER_GATHER_P (smt_info) = gatherscatter;

I miss a few testcases that exercise scatter vectorization.  And as Uros
said, the i386 specific parts should be split out.

Otherwise the patch looks ok to me.

Thanks,
Richard.


> Thanks,
> Petr
>
> 2015-08-21  Andrey Turetskiy  <andrey.turets...@intel.com>
>             Petr Murzin  <petr.mur...@intel.com>
>
> gcc/
>
> * config/i386/i386-builtin-types.def
> (VOID_PFLOAT_HI_V8DI_V16SF_INT): New.
> (VOID_PDOUBLE_QI_V16SI_V8DF_INT): Ditto.
> (VOID_PINT_HI_V8DI_V16SI_INT): Ditto.
> (VOID_PLONGLONG_QI_V16SI_V8DI_INT): Ditto.
> * config/i386/i386.c
> (ix86_builtins): Add IX86_BUILTIN_SCATTERALTSIV8DF,
> IX86_BUILTIN_SCATTERALTDIV16SF, IX86_BUILTIN_SCATTERALTSIV8DI,
> IX86_BUILTIN_SCATTERALTDIV16SI.
> (ix86_init_mmx_sse_builtins): Define __builtin_ia32_scatteraltsiv8df,
> __builtin_ia32_scatteraltdiv8sf, __builtin_ia32_scatteraltsiv8di,
> __builtin_ia32_scatteraltdiv8si.
> (ix86_expand_builtin): Handle IX86_BUILTIN_SCATTERALTSIV8DF,
> IX86_BUILTIN_SCATTERALTDIV16SF, IX86_BUILTIN_SCATTERALTSIV8DI,
> IX86_BUILTIN_SCATTERALTDIV16SI.
> (ix86_vectorize_builtin_scatter): New.
> (TARGET_VECTORIZE_BUILTIN_SCATTER): Define as
> ix86_vectorize_builtin_scatter.
> * doc/tm.texi.in (TARGET_VECTORIZE_BUILTIN_SCATTER): New.
> * doc/tm.texi: Regenerate.
> * target.def: Add scatter builtin.
> * tree-vect-data-refs.c (vect_analyze_data_ref_dependence): Add new
> checkings for STMT_VINFO_SCATTER_P.
> (vect_check_gather): Rename to ...
> (vect_check_gather_scatter): this and enhance number of arguments.
> (vect_analyze_data_refs): Add gatherscatter enum and maybe_scatter variable
> and new checkings for it accordingly.
> * tree-vectorizer.h: Rename gather_p to gather_scatter_p and use it
> for loads/stores
>  in case of gather/scatter accordingly.
> (STMT_VINFO_SCATTER_P(S)): Define.
> (vect_check_gather): Rename to ...
> (vect_check_gather_scatter): this.
> * triee-vect-stmts.c (vectorizable_mask_load_store): Ditto.
> (vectorizable_store): Add checkings for STMT_VINFO_SCATTER_P.
> (vect_mark_stmts_to_be_vectorized): Ditto.

Reply via email to