This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC][GCC][AArch64] Add minmax phi-reduction pattern
- From: Joel Hutton <Joel dot Hutton at arm dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: Tamar Christina <Tamar dot Christina at arm dot com>, nd <nd at arm dot com>, Richard Biener <rguenther at suse dot de>
- Date: Fri, 15 Nov 2019 18:07:07 +0000
- Subject: Re: [RFC][GCC][AArch64] Add minmax phi-reduction pattern
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VjeXcasF93OSpX1jTbFokJKZ5WvwsDxy0F8Aoag4j+k=; b=dpG+Gl1QT2nb/gWL3JGXhDM/OIb7w5/mBqS+eFKunDrCCL65Kpb1vYeu6X26S3mXGjESQySfPLJqdjx9R3bTIN6aej4kjTuccmK1bqQzFDZSvZfdVDYxUNngZoy3b7pjAT/bHk7HBibNcI4IjKlDHJlExDQu7pUnn/F89MwE25cU5/vbJ9xZ3dGHl3kbAPr02WD0qIodcgV50zRf29FjJ/ilX838LGtqFvz2RVgYNks64L6hEKX4d6Cd7vlGqFSNz4JTKq4YJp6J2ApEs9Ghnz6U4ZDdGb08LDJO4XKYr3ahbBfqIB8VMkHXFHG16zrOsFp/vs38U6psLQJpXCfROw==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FlLc1oiYUBxjx92/epXhukdDFv1jsq9KQE8DghFkq7gMhjbcjFaHzIQCuEsc4h1HCDrAxLImchaJ8/kYzAKR73iuSaFA7EBf0whsNuPzyU9HouT7xcL8SS75eSI0XXSEqreP+Sy6lkA1qM/EWMiiBgvEWZgVj3uYqdEUr0p9ARI2I5nJeE9ea0cMs306Z1HKejeilsNA1NSvoPU7W6X2GbtCTNblkbGsrT4czuKZHmigtjtYsxZY1z1Q5dKcmUlLfhtLbxN5DmqG/zoUjtpZaSfNBCyJ2HL1gWTcIAKOTPiAgVpQJV9zhJiHZuG75obOVo81oqsoZRln5Re6ojkYZg==
- Original-authentication-results: spf=none (sender IP is ) smtp.mailfrom=Joel dot Hutton at arm dot com;
- References: <c427eded-015e-3072-3bec-1911685f9a83@arm.com>
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.