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: [RFC][GCC][AArch64] Add minmax phi-reduction pattern


Forgot to CC maintainer.
On 15/11/2019 18:03, Joel wrote:
> Hi all,
>
> Just looking for some feedback on the approach.
>
> Currently the loop vectorizer can't vectorize the following typical 
> loop for getting max value and index from an array:
>
> void test_vec(int *data, int n) {
>         int best_i, best = 0;
>
>         for (int i = 0; i < n; i++) {
>                 if (data[i] > best) {
>                         best = data[i];
>                         best_i = i;
>                 }
>         }
>
>         data[best_i] = data[0];
>         data[0] = best;
> }
>
> This patch adds some support for this pattern.
>
> This patch addresses Bug 88259.
>
> Regression testing is still in progress,
> This patch does not work correctly with vect-epilogues-nomask, and the 
> reason for that is still being investigated.
>
> gcc/ChangeLog:
>
>
> 2019-11-15  Joel Hutton  <Joel.Hutton@arm.com>
>         Tamar Christina  <Tamar.Christina@arm.com>
>
>     PR tree-optimization/88259
>     * tree-vect-loop.c (vect_reassociating_reduction_simple_p): New 
> function.
>     (vect_recog_minmax_index_pattern): New function.
>     (vect_is_simple_reduction): Add check for minmax pattern.
>     (vect_model_reduction_cost): Add case for minmax pattern.
>     (vect_create_epilog_for_reduction): Add fixup for minmax epilog.
>     * tree-vectorizer.h (enum vect_reduction_type): Add 
> INDEX_MINMAX_REDUCTION reduction type.

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