This is the mail archive of the 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: [RFC, vectorizer] Allow single element vector types for vector reduction operations

"Jon Beniston" <> writes:
> Hi Richard,
>> I think the issue is that with TARGET_VECTOR_MODE_SUPPORTED_P false 
>> for V1SI you'll get a SImode vector type and the
>>  if (VECTOR_BOOLEAN_TYPE_P (type_in)
>>      || VECTOR_MODE_P (TYPE_MODE (type_in)))
>>check fails.  Try changing that to || VECTOR_TYPE_P (type_in).
>>The else path should be hopefully dead ...
>>> It looks to me like the other call sites of optab_for_tree_code which 
>>> are passing optab_default are mostly places where GCC is sure it is 
>>> not a shift operation.
>>> Given TYPE_IN is returned from get_vectype_for_scalar_type, is it 
>>> safe to simply pass optab_vector in vect_pattern_recog_1?
>>I guess so.  Can you also try the above?
> Changing VECTOR_MODE_P check into VECTOR_TYPE_P check also works for me, I
> verified the following patch could vectorize my dot product case and there
> is no regression on gcc tests on my port.
> Meanwhile x86-64 bootstraps OK and no regression on gcc/g++ test.
>  Does this look OK?
> gcc/
> 2017-08-30  Jon Beniston  <>
>             Richard Biener  <>
> diff --git a/gcc/tree-vect-patterns.c b/gcc/tree-vect-patterns.c
> index cfdb72c..5ebeac2 100644
> --- a/gcc/tree-vect-patterns.c
> +++ b/gcc/tree-vect-patterns.c
> @@ -4150,7 +4150,7 @@ vect_pattern_recog_1 (vect_recog_func *recog_func,
>    loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_info);
>    if (VECTOR_BOOLEAN_TYPE_P (type_in)
> -      || VECTOR_MODE_P (TYPE_MODE (type_in)))
> +      || VECTOR_TYPE_P (type_in))
>      {
>        /* No need to check target support (already checked by the pattern
>           recognition function).  */

It looks like this makes the VECTOR_BOOLEAN_TYPE_P (type_in) check redundant.


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