* pr103523: Check for PLUS/MINUS support
@ 2021-12-10 10:02 Joel Hutton
2021-12-10 10:22 ` Richard Sandiford
0 siblings, 1 reply; 11+ messages in thread
From: Joel Hutton @ 2021-12-10 10:02 UTC (permalink / raw)
To: GCC Patches; +Cc: Richard Sandiford, Richard Biener
[-- Attachment #1: Type: text/plain, Size: 634 bytes --]
Hi all,
This is to address pr103523.
bootstrapped and regression tested on aarch64.
Check for PLUS_EXPR/MINUS_EXPR support in vectorizable_induction.
PR103523 is an ICE on valid code:
void d(float *a, float b, int c) {
float e;
for (; c; c--, e += b)
a[c] = e;
}
This is due to not checking for PLUS_EXPR support, which is missing in
VNx2sf mode. This causes an ICE at expand time. This patch adds a check
for support in vectorizable_induction.
gcc/ChangeLog:
PR tree-optimization/PR103523
* tree-vect-loop.c (vectorizable_induction): Check for
PLUS_EXPR/MINUS_EXPR support.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: rb15140.patch --]
[-- Type: text/x-patch; name="rb15140.patch", Size: 1778 bytes --]
diff --git a/gcc/testsuite/gcc.target/aarch64/pr103523.c b/gcc/testsuite/gcc.target/aarch64/pr103523.c
new file mode 100644
index 0000000000000000000000000000000000000000..736e8936c5f6768bdf098ddc37b2c21ab74ee0df
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/pr103523.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-march=armv8-a+sve -mtune=neoverse-v1 -Ofast" } */
+
+void d(float *a, float b, int c) {
+ float e;
+ for (; c; c--, e += b)
+ a[c] = e;
+}
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index 7f544ba1fd5198dd32cda05e62382ab2e1e9bb50..f700d5e7ac2c05402407a46113320f79359906fa 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -8065,6 +8065,15 @@ vectorizable_induction (loop_vec_info loop_vinfo,
return false;
}
+ step_expr = STMT_VINFO_LOOP_PHI_EVOLUTION_PART (stmt_info);
+ gcc_assert (step_expr != NULL_TREE);
+ tree step_vectype = get_same_sized_vectype (TREE_TYPE (step_expr), vectype);
+
+ /* Check for backend support of PLUS/MINUS_EXPR. */
+ if (!directly_supported_p (PLUS_EXPR, step_vectype)
+ || !directly_supported_p (MINUS_EXPR, step_vectype))
+ return false;
+
if (!vec_stmt) /* transformation not required. */
{
unsigned inside_cost = 0, prologue_cost = 0;
@@ -8124,10 +8133,6 @@ vectorizable_induction (loop_vec_info loop_vinfo,
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location, "transform induction phi.\n");
- step_expr = STMT_VINFO_LOOP_PHI_EVOLUTION_PART (stmt_info);
- gcc_assert (step_expr != NULL_TREE);
- tree step_vectype = get_same_sized_vectype (TREE_TYPE (step_expr), vectype);
-
pe = loop_preheader_edge (iv_loop);
/* Find the first insertion point in the BB. */
basic_block bb = gimple_bb (phi);
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: pr103523: Check for PLUS/MINUS support
2021-12-10 10:02 pr103523: Check for PLUS/MINUS support Joel Hutton
@ 2021-12-10 10:22 ` Richard Sandiford
2021-12-10 13:24 ` Joel Hutton
0 siblings, 1 reply; 11+ messages in thread
From: Richard Sandiford @ 2021-12-10 10:22 UTC (permalink / raw)
To: Joel Hutton; +Cc: GCC Patches, Richard Biener
Joel Hutton <Joel.Hutton@arm.com> writes:
> Hi all,
>
> This is to address pr103523.
>
> bootstrapped and regression tested on aarch64.
>
> Check for PLUS_EXPR/MINUS_EXPR support in vectorizable_induction.
> PR103523 is an ICE on valid code:
>
> void d(float *a, float b, int c) {
> float e;
> for (; c; c--, e += b)
> a[c] = e;
> }
>
> This is due to not checking for PLUS_EXPR support, which is missing in
> VNx2sf mode. This causes an ICE at expand time. This patch adds a check
> for support in vectorizable_induction.
>
> gcc/ChangeLog:
>
> PR tree-optimization/PR103523
The bugzilla hook expects: PR tree-optimization/103523
> * tree-vect-loop.c (vectorizable_induction): Check for
> PLUS_EXPR/MINUS_EXPR support.
OK, thanks.
Richard
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: pr103523: Check for PLUS/MINUS support
2021-12-10 10:22 ` Richard Sandiford
@ 2021-12-10 13:24 ` Joel Hutton
2021-12-10 18:33 ` Richard Sandiford
2021-12-13 14:27 ` GCC 11 backport does not build (no "directly_supported_p") - was: " Tobias Burnus
0 siblings, 2 replies; 11+ messages in thread
From: Joel Hutton @ 2021-12-10 13:24 UTC (permalink / raw)
To: Richard Sandiford; +Cc: GCC Patches, Richard Biener
ok for backport to 11?
________________________________
From: Richard Sandiford <richard.sandiford@arm.com>
Sent: 10 December 2021 10:22
To: Joel Hutton <Joel.Hutton@arm.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>; Richard Biener <rguenther@suse.de>
Subject: Re: pr103523: Check for PLUS/MINUS support
Joel Hutton <Joel.Hutton@arm.com> writes:
> Hi all,
>
> This is to address pr103523.
>
> bootstrapped and regression tested on aarch64.
>
> Check for PLUS_EXPR/MINUS_EXPR support in vectorizable_induction.
> PR103523 is an ICE on valid code:
>
> void d(float *a, float b, int c) {
> float e;
> for (; c; c--, e += b)
> a[c] = e;
> }
>
> This is due to not checking for PLUS_EXPR support, which is missing in
> VNx2sf mode. This causes an ICE at expand time. This patch adds a check
> for support in vectorizable_induction.
>
> gcc/ChangeLog:
>
> PR tree-optimization/PR103523
The bugzilla hook expects: PR tree-optimization/103523
> * tree-vect-loop.c (vectorizable_induction): Check for
> PLUS_EXPR/MINUS_EXPR support.
OK, thanks.
Richard
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: pr103523: Check for PLUS/MINUS support
2021-12-10 13:24 ` Joel Hutton
@ 2021-12-10 18:33 ` Richard Sandiford
2021-12-13 14:27 ` GCC 11 backport does not build (no "directly_supported_p") - was: " Tobias Burnus
1 sibling, 0 replies; 11+ messages in thread
From: Richard Sandiford @ 2021-12-10 18:33 UTC (permalink / raw)
To: Joel Hutton; +Cc: GCC Patches, Richard Biener
Joel Hutton <Joel.Hutton@arm.com> writes:
> ok for backport to 11?
Yes, thanks.
Richard
^ permalink raw reply [flat|nested] 11+ messages in thread
* GCC 11 backport does not build (no "directly_supported_p") - was: Re: pr103523: Check for PLUS/MINUS support
2021-12-10 13:24 ` Joel Hutton
2021-12-10 18:33 ` Richard Sandiford
@ 2021-12-13 14:27 ` Tobias Burnus
2021-12-13 14:47 ` Richard Biener
1 sibling, 1 reply; 11+ messages in thread
From: Tobias Burnus @ 2021-12-13 14:27 UTC (permalink / raw)
To: Joel Hutton, Richard Sandiford; +Cc: Richard Biener, GCC Patches
Hi Joel,
your patch fails here with:
../../repos/gcc-11-commit/gcc/tree-vect-loop.c:8000:8: error:
‘directly_supported_p’ was not declared in this scope
8000 | if (!directly_supported_p (PLUS_EXPR, step_vectype)
| ^~~~~~~~~~~~~~~~~~~~
And "git grep" shows that this is only present in:
gcc/tree-vect-loop.c: if (!directly_supported_p (PLUS_EXPR, step_vectype)
gcc/tree-vect-loop.c: || !directly_supported_p (MINUS_EXPR,
step_vectype))
That's different on mainline, which offers that function.
Tobias
On 10.12.21 14:24, Joel Hutton via Gcc-patches wrote:
> ok for backport to 11?
> ________________________________
> From: Richard Sandiford <richard.sandiford@arm.com>
> Sent: 10 December 2021 10:22
> To: Joel Hutton <Joel.Hutton@arm.com>
> Cc: GCC Patches <gcc-patches@gcc.gnu.org>; Richard Biener <rguenther@suse.de>
> Subject: Re: pr103523: Check for PLUS/MINUS support
>
> Joel Hutton <Joel.Hutton@arm.com> writes:
>> Hi all,
>>
>> This is to address pr103523.
>>
>> bootstrapped and regression tested on aarch64.
>>
>> Check for PLUS_EXPR/MINUS_EXPR support in vectorizable_induction.
>> PR103523 is an ICE on valid code:
>>
>> void d(float *a, float b, int c) {
>> float e;
>> for (; c; c--, e += b)
>> a[c] = e;
>> }
>>
>> This is due to not checking for PLUS_EXPR support, which is missing in
>> VNx2sf mode. This causes an ICE at expand time. This patch adds a check
>> for support in vectorizable_induction.
>>
>> gcc/ChangeLog:
>>
>> PR tree-optimization/PR103523
> The bugzilla hook expects: PR tree-optimization/103523
>
>> * tree-vect-loop.c (vectorizable_induction): Check for
>> PLUS_EXPR/MINUS_EXPR support.
> OK, thanks.
>
> Richard
-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: GCC 11 backport does not build (no "directly_supported_p") - was: Re: pr103523: Check for PLUS/MINUS support
2021-12-13 14:27 ` GCC 11 backport does not build (no "directly_supported_p") - was: " Tobias Burnus
@ 2021-12-13 14:47 ` Richard Biener
2021-12-13 15:02 ` Joel Hutton
0 siblings, 1 reply; 11+ messages in thread
From: Richard Biener @ 2021-12-13 14:47 UTC (permalink / raw)
To: gcc-patches, Tobias Burnus, Joel Hutton, Richard Sandiford
Cc: GCC Patches, Richard Biener
On December 13, 2021 3:27:50 PM GMT+01:00, Tobias Burnus <tobias@codesourcery.com> wrote:
>Hi Joel,
>
>your patch fails here with:
>
>../../repos/gcc-11-commit/gcc/tree-vect-loop.c:8000:8: error:
>‘directly_supported_p’ was not declared in this scope
> 8000 | if (!directly_supported_p (PLUS_EXPR, step_vectype)
> | ^~~~~~~~~~~~~~~~~~~~
>
>And "git grep" shows that this is only present in:
>
>gcc/tree-vect-loop.c: if (!directly_supported_p (PLUS_EXPR, step_vectype)
>gcc/tree-vect-loop.c: || !directly_supported_p (MINUS_EXPR,
>step_vectype))
>
>That's different on mainline, which offers that function.
Just as a reminder, backports need regular bootstrap and regtest validation on the respective branches.
Richard.
>Tobias
>
>On 10.12.21 14:24, Joel Hutton via Gcc-patches wrote:
>> ok for backport to 11?
>> ________________________________
>> From: Richard Sandiford <richard.sandiford@arm.com>
>> Sent: 10 December 2021 10:22
>> To: Joel Hutton <Joel.Hutton@arm.com>
>> Cc: GCC Patches <gcc-patches@gcc.gnu.org>; Richard Biener <rguenther@suse.de>
>> Subject: Re: pr103523: Check for PLUS/MINUS support
>>
>> Joel Hutton <Joel.Hutton@arm.com> writes:
>>> Hi all,
>>>
>>> This is to address pr103523.
>>>
>>> bootstrapped and regression tested on aarch64.
>>>
>>> Check for PLUS_EXPR/MINUS_EXPR support in vectorizable_induction.
>>> PR103523 is an ICE on valid code:
>>>
>>> void d(float *a, float b, int c) {
>>> float e;
>>> for (; c; c--, e += b)
>>> a[c] = e;
>>> }
>>>
>>> This is due to not checking for PLUS_EXPR support, which is missing in
>>> VNx2sf mode. This causes an ICE at expand time. This patch adds a check
>>> for support in vectorizable_induction.
>>>
>>> gcc/ChangeLog:
>>>
>>> PR tree-optimization/PR103523
>> The bugzilla hook expects: PR tree-optimization/103523
>>
>>> * tree-vect-loop.c (vectorizable_induction): Check for
>>> PLUS_EXPR/MINUS_EXPR support.
>> OK, thanks.
>>
>> Richard
>-----------------
>Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: GCC 11 backport does not build (no "directly_supported_p") - was: Re: pr103523: Check for PLUS/MINUS support
2021-12-13 14:47 ` Richard Biener
@ 2021-12-13 15:02 ` Joel Hutton
2021-12-14 9:37 ` Joel Hutton
0 siblings, 1 reply; 11+ messages in thread
From: Joel Hutton @ 2021-12-13 15:02 UTC (permalink / raw)
To: Richard Biener, gcc-patches, Tobias Burnus, Richard Sandiford
Cc: Richard Biener
[-- Attachment #1: Type: text/plain, Size: 2864 bytes --]
My mistake, reworked patch. Tests are still running.
________________________________
From: Richard Biener <richard.guenther@gmail.com>
Sent: 13 December 2021 14:47
To: gcc-patches@gcc.gnu.org <gcc-patches@gcc.gnu.org>; Tobias Burnus <tobias@codesourcery.com>; Joel Hutton <Joel.Hutton@arm.com>; Richard Sandiford <Richard.Sandiford@arm.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>; Richard Biener <rguenther@suse.de>
Subject: Re: GCC 11 backport does not build (no "directly_supported_p") - was: Re: pr103523: Check for PLUS/MINUS support
On December 13, 2021 3:27:50 PM GMT+01:00, Tobias Burnus <tobias@codesourcery.com> wrote:
>Hi Joel,
>
>your patch fails here with:
>
>../../repos/gcc-11-commit/gcc/tree-vect-loop.c:8000:8: error:
>‘directly_supported_p’ was not declared in this scope
> 8000 | if (!directly_supported_p (PLUS_EXPR, step_vectype)
> | ^~~~~~~~~~~~~~~~~~~~
>
>And "git grep" shows that this is only present in:
>
>gcc/tree-vect-loop.c: if (!directly_supported_p (PLUS_EXPR, step_vectype)
>gcc/tree-vect-loop.c: || !directly_supported_p (MINUS_EXPR,
>step_vectype))
>
>That's different on mainline, which offers that function.
Just as a reminder, backports need regular bootstrap and regtest validation on the respective branches.
Richard.
>Tobias
>
>On 10.12.21 14:24, Joel Hutton via Gcc-patches wrote:
>> ok for backport to 11?
>> ________________________________
>> From: Richard Sandiford <richard.sandiford@arm.com>
>> Sent: 10 December 2021 10:22
>> To: Joel Hutton <Joel.Hutton@arm.com>
>> Cc: GCC Patches <gcc-patches@gcc.gnu.org>; Richard Biener <rguenther@suse.de>
>> Subject: Re: pr103523: Check for PLUS/MINUS support
>>
>> Joel Hutton <Joel.Hutton@arm.com> writes:
>>> Hi all,
>>>
>>> This is to address pr103523.
>>>
>>> bootstrapped and regression tested on aarch64.
>>>
>>> Check for PLUS_EXPR/MINUS_EXPR support in vectorizable_induction.
>>> PR103523 is an ICE on valid code:
>>>
>>> void d(float *a, float b, int c) {
>>> float e;
>>> for (; c; c--, e += b)
>>> a[c] = e;
>>> }
>>>
>>> This is due to not checking for PLUS_EXPR support, which is missing in
>>> VNx2sf mode. This causes an ICE at expand time. This patch adds a check
>>> for support in vectorizable_induction.
>>>
>>> gcc/ChangeLog:
>>>
>>> PR tree-optimization/PR103523
>> The bugzilla hook expects: PR tree-optimization/103523
>>
>>> * tree-vect-loop.c (vectorizable_induction): Check for
>>> PLUS_EXPR/MINUS_EXPR support.
>> OK, thanks.
>>
>> Richard
>-----------------
>Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-vect-loop-fix-build.patch --]
[-- Type: text/x-patch; name="0001-vect-loop-fix-build.patch", Size: 1587 bytes --]
From d6ac8751dfdf3520f90b2ad8d09ebc452cc42831 Mon Sep 17 00:00:00 2001
From: Joel Hutton <joel.hutton@arm.com>
Date: Mon, 13 Dec 2021 14:49:55 +0000
Subject: [PATCH] vect-loop: fix build
Previous commit broke build as it relied on directly_supported_p which
is not in 11. This reworks to avoid using directly_supported_p.
gcc/ChangeLog:
* tree-vect-loop.c (vectorizable_induction): Rework to avoid
directly_supported_p
---
gcc/tree-vect-loop.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index 54320681119d880ec2cbe641fe16ee73e552f57d..8f464e61780dbb2df5836022d77307c5c90a4b6f 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -7997,8 +7997,14 @@ vectorizable_induction (loop_vec_info loop_vinfo,
tree step_vectype = get_same_sized_vectype (TREE_TYPE (step_expr), vectype);
/* Check for backend support of PLUS/MINUS_EXPR. */
- if (!directly_supported_p (PLUS_EXPR, step_vectype)
- || !directly_supported_p (MINUS_EXPR, step_vectype))
+ direct_optab ot_plus = optab_for_tree_code (tree_code (PLUS_EXPR),
+ step_vectype, optab_default);
+ direct_optab ot_minus = optab_for_tree_code (tree_code (MINUS_EXPR),
+ step_vectype, optab_default);
+ if (ot_plus == unknown_optab
+ || ot_minus == unknown_optab
+ || optab_handler (ot_minus, TYPE_MODE (step_vectype)) == CODE_FOR_nothing
+ || optab_handler (ot_plus, TYPE_MODE (step_vectype)) == CODE_FOR_nothing);
return false;
if (!vec_stmt) /* transformation not required. */
--
2.17.1
^ permalink raw reply [flat|nested] 11+ messages in thread
* RE: GCC 11 backport does not build (no "directly_supported_p") - was: Re: pr103523: Check for PLUS/MINUS support
2021-12-13 15:02 ` Joel Hutton
@ 2021-12-14 9:37 ` Joel Hutton
2021-12-14 9:53 ` Jakub Jelinek
0 siblings, 1 reply; 11+ messages in thread
From: Joel Hutton @ 2021-12-14 9:37 UTC (permalink / raw)
To: Richard Biener, gcc-patches, Tobias Burnus, Richard Sandiford
Cc: Richard Biener
[-- Attachment #1: Type: text/plain, Size: 4070 bytes --]
Bootstrapped and regression tested on releases/gcc-11 on aarch64.
Ok for 11?
Previous commit broke build as it relied on directly_supported_p which
is not in 11. This reworks to avoid using directly_supported_p.
gcc/ChangeLog:
PR bootstrap/103688
* tree-vect-loop.c (vectorizable_induction): Rework to avoid
directly_supported_p
From: Joel Hutton <Joel.Hutton@arm.com>
Sent: 13 December 2021 15:02
To: Richard Biener <richard.guenther@gmail.com>; gcc-patches@gcc.gnu.org; Tobias Burnus <tobias@codesourcery.com>; Richard Sandiford <Richard.Sandiford@arm.com>
Cc: Richard Biener <rguenther@suse.de>
Subject: Re: GCC 11 backport does not build (no "directly_supported_p") - was: Re: pr103523: Check for PLUS/MINUS support
My mistake, reworked patch. Tests are still running.
________________________________
From: Richard Biener <richard.guenther@gmail.com<mailto:richard.guenther@gmail.com>>
Sent: 13 December 2021 14:47
To: gcc-patches@gcc.gnu.org<mailto:gcc-patches@gcc.gnu.org> <gcc-patches@gcc.gnu.org<mailto:gcc-patches@gcc.gnu.org>>; Tobias Burnus <tobias@codesourcery.com<mailto:tobias@codesourcery.com>>; Joel Hutton <Joel.Hutton@arm.com<mailto:Joel.Hutton@arm.com>>; Richard Sandiford <Richard.Sandiford@arm.com<mailto:Richard.Sandiford@arm.com>>
Cc: GCC Patches <gcc-patches@gcc.gnu.org<mailto:gcc-patches@gcc.gnu.org>>; Richard Biener <rguenther@suse.de<mailto:rguenther@suse.de>>
Subject: Re: GCC 11 backport does not build (no "directly_supported_p") - was: Re: pr103523: Check for PLUS/MINUS support
On December 13, 2021 3:27:50 PM GMT+01:00, Tobias Burnus <tobias@codesourcery.com<mailto:tobias@codesourcery.com>> wrote:
>Hi Joel,
>
>your patch fails here with:
>
>../../repos/gcc-11-commit/gcc/tree-vect-loop.c:8000:8: error:
>'directly_supported_p' was not declared in this scope
> 8000 | if (!directly_supported_p (PLUS_EXPR, step_vectype)
> | ^~~~~~~~~~~~~~~~~~~~
>
>And "git grep" shows that this is only present in:
>
>gcc/tree-vect-loop.c: if (!directly_supported_p (PLUS_EXPR, step_vectype)
>gcc/tree-vect-loop.c: || !directly_supported_p (MINUS_EXPR,
>step_vectype))
>
>That's different on mainline, which offers that function.
Just as a reminder, backports need regular bootstrap and regtest validation on the respective branches.
Richard.
>Tobias
>
>On 10.12.21 14:24, Joel Hutton via Gcc-patches wrote:
>> ok for backport to 11?
>> ________________________________
>> From: Richard Sandiford <richard.sandiford@arm.com<mailto:richard.sandiford@arm.com>>
>> Sent: 10 December 2021 10:22
>> To: Joel Hutton <Joel.Hutton@arm.com<mailto:Joel.Hutton@arm.com>>
>> Cc: GCC Patches <gcc-patches@gcc.gnu.org<mailto:gcc-patches@gcc.gnu.org>>; Richard Biener <rguenther@suse.de<mailto:rguenther@suse.de>>
>> Subject: Re: pr103523: Check for PLUS/MINUS support
>>
>> Joel Hutton <Joel.Hutton@arm.com<mailto:Joel.Hutton@arm.com>> writes:
>>> Hi all,
>>>
>>> This is to address pr103523.
>>>
>>> bootstrapped and regression tested on aarch64.
>>>
>>> Check for PLUS_EXPR/MINUS_EXPR support in vectorizable_induction.
>>> PR103523 is an ICE on valid code:
>>>
>>> void d(float *a, float b, int c) {
>>> float e;
>>> for (; c; c--, e += b)
>>> a[c] = e;
>>> }
>>>
>>> This is due to not checking for PLUS_EXPR support, which is missing in
>>> VNx2sf mode. This causes an ICE at expand time. This patch adds a check
>>> for support in vectorizable_induction.
>>>
>>> gcc/ChangeLog:
>>>
>>> PR tree-optimization/PR103523
>> The bugzilla hook expects: PR tree-optimization/103523
>>
>>> * tree-vect-loop.c (vectorizable_induction): Check for
>>> PLUS_EXPR/MINUS_EXPR support.
>> OK, thanks.
>>
>> Richard
>-----------------
>Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955
[-- Attachment #2: 0001-vect-loop-fix-build.patch --]
[-- Type: application/octet-stream, Size: 1607 bytes --]
From 369a07a6b5bc71c1f4d7756598860303cda7fa55 Mon Sep 17 00:00:00 2001
From: Joel Hutton <joel.hutton@arm.com>
Date: Mon, 13 Dec 2021 14:49:55 +0000
Subject: [PATCH] vect-loop: fix build
Previous commit broke build as it relied on directly_supported_p which
is not in 11. This reworks to avoid using directly_supported_p.
gcc/ChangeLog:
PR bootstrap/103688
* tree-vect-loop.c (vectorizable_induction): Rework to avoid
directly_supported_p
---
gcc/tree-vect-loop.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index 54320681119d880ec2cbe641fe16ee73e552f57d..3fb6e7d44420409aee930c8051f5a3c69039174b 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -7997,8 +7997,14 @@ vectorizable_induction (loop_vec_info loop_vinfo,
tree step_vectype = get_same_sized_vectype (TREE_TYPE (step_expr), vectype);
/* Check for backend support of PLUS/MINUS_EXPR. */
- if (!directly_supported_p (PLUS_EXPR, step_vectype)
- || !directly_supported_p (MINUS_EXPR, step_vectype))
+ direct_optab ot_plus = optab_for_tree_code (tree_code (PLUS_EXPR),
+ step_vectype, optab_default);
+ direct_optab ot_minus = optab_for_tree_code (tree_code (MINUS_EXPR),
+ step_vectype, optab_default);
+ if (ot_plus == unknown_optab
+ || ot_minus == unknown_optab
+ || optab_handler (ot_minus, TYPE_MODE (step_vectype)) == CODE_FOR_nothing
+ || optab_handler (ot_plus, TYPE_MODE (step_vectype)) == CODE_FOR_nothing)
return false;
if (!vec_stmt) /* transformation not required. */
--
2.17.1
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: GCC 11 backport does not build (no "directly_supported_p") - was: Re: pr103523: Check for PLUS/MINUS support
2021-12-14 9:37 ` Joel Hutton
@ 2021-12-14 9:53 ` Jakub Jelinek
2021-12-14 10:46 ` Joel Hutton
0 siblings, 1 reply; 11+ messages in thread
From: Jakub Jelinek @ 2021-12-14 9:53 UTC (permalink / raw)
To: Joel Hutton
Cc: Richard Biener, gcc-patches, Tobias Burnus, Richard Sandiford,
Richard Biener
On Tue, Dec 14, 2021 at 09:37:03AM +0000, Joel Hutton via Gcc-patches wrote:
> Bootstrapped and regression tested on releases/gcc-11 on aarch64.
>
> Ok for 11?
>
> Previous commit broke build as it relied on directly_supported_p which
> is not in 11. This reworks to avoid using directly_supported_p.
>
> gcc/ChangeLog:
>
> PR bootstrap/103688
> * tree-vect-loop.c (vectorizable_induction): Rework to avoid
> directly_supported_p
Missing . after directly_supported_p
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -7997,8 +7997,14 @@ vectorizable_induction (loop_vec_info loop_vinfo,
tree step_vectype = get_same_sized_vectype (TREE_TYPE (step_expr), vectype);
/* Check for backend support of PLUS/MINUS_EXPR. */
- if (!directly_supported_p (PLUS_EXPR, step_vectype)
- || !directly_supported_p (MINUS_EXPR, step_vectype))
+ direct_optab ot_plus = optab_for_tree_code (tree_code (PLUS_EXPR),
+ step_vectype, optab_default);
+ direct_optab ot_minus = optab_for_tree_code (tree_code (MINUS_EXPR),
+ step_vectype, optab_default);
Why tree_code (PLUS_EXPR) instead of just PLUS_EXPR (ditto MINUS_EXPR)?
The formatting is off, step_vectype isn't aligned below tree_code.
+ if (ot_plus == unknown_optab
+ || ot_minus == unknown_optab
+ || optab_handler (ot_minus, TYPE_MODE (step_vectype)) == CODE_FOR_nothing
+ || optab_handler (ot_plus, TYPE_MODE (step_vectype)) == CODE_FOR_nothing)
return false;
Won't optab_handler just return CODE_FOR_nothing for unknown_optab?
Anyway, I think best would be to write it as:
if (!target_supports_op_p (step_vectype, PLUS_EXPR, optab_default)
|| !target_supports_op_p (step_vectype, MINUS_EXPR, optab_default))
return false;
Jakub
^ permalink raw reply [flat|nested] 11+ messages in thread
* RE: GCC 11 backport does not build (no "directly_supported_p") - was: Re: pr103523: Check for PLUS/MINUS support
2021-12-14 9:53 ` Jakub Jelinek
@ 2021-12-14 10:46 ` Joel Hutton
2021-12-14 10:57 ` Jakub Jelinek
0 siblings, 1 reply; 11+ messages in thread
From: Joel Hutton @ 2021-12-14 10:46 UTC (permalink / raw)
To: Jakub Jelinek
Cc: Richard Biener, gcc-patches, Tobias Burnus, Richard Sandiford,
Richard Biener
[-- Attachment #1: Type: text/plain, Size: 840 bytes --]
> + if (ot_plus == unknown_optab
> + || ot_minus == unknown_optab
> + || optab_handler (ot_minus, TYPE_MODE (step_vectype)) ==
> CODE_FOR_nothing
> + || optab_handler (ot_plus, TYPE_MODE (step_vectype)) ==
> + CODE_FOR_nothing)
> return false;
>
> Won't optab_handler just return CODE_FOR_nothing for unknown_optab?
I was taking the check used in directly_supported_p
return (optab != unknown_optab$
&& optab_handler (optab, TYPE_MODE (type)) != CODE_FOR_nothing);$
> Anyway, I think best would be to write it as:
> if (!target_supports_op_p (step_vectype, PLUS_EXPR, optab_default)
> || !target_supports_op_p (step_vectype, MINUS_EXPR, optab_default))
> return false;
Looks good to me.
Patch attached.
Tests running on gcc-11 on aarch64.
Ok for 11 once tests come back?
[-- Attachment #2: 0001-vect-loop-fix-build.patch --]
[-- Type: application/octet-stream, Size: 1297 bytes --]
From 7d173111a2ac3c01d52093d41541447f6c1f6f0c Mon Sep 17 00:00:00 2001
From: Joel Hutton <joel.hutton@arm.com>
Date: Tue, 14 Dec 2021 10:16:59 +0000
Subject: [PATCH] vect-loop: fix build
Previous commit broke build as it relied on directly_supported_p which
is not in 11. This reworks to avoid using directly_supported_p.
gcc/ChangeLog:
PR bootstrap/103688
* tree-vect-loop.c (vectorizable_induction): Rework to avoid
directly_supported_p.
---
gcc/tree-vect-loop.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index 54320681119d880ec2cbe641fe16ee73e552f57d..b77b4f7f83f6fd6ce08e9e4b28d804013dd8ff92 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -7997,8 +7997,8 @@ vectorizable_induction (loop_vec_info loop_vinfo,
tree step_vectype = get_same_sized_vectype (TREE_TYPE (step_expr), vectype);
/* Check for backend support of PLUS/MINUS_EXPR. */
- if (!directly_supported_p (PLUS_EXPR, step_vectype)
- || !directly_supported_p (MINUS_EXPR, step_vectype))
+ if (!target_supports_op_p (step_vectype, PLUS_EXPR, optab_default)
+ || !target_supports_op_p (step_vectype, MINUS_EXPR, optab_default))
return false;
if (!vec_stmt) /* transformation not required. */
--
2.17.1
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: GCC 11 backport does not build (no "directly_supported_p") - was: Re: pr103523: Check for PLUS/MINUS support
2021-12-14 10:46 ` Joel Hutton
@ 2021-12-14 10:57 ` Jakub Jelinek
0 siblings, 0 replies; 11+ messages in thread
From: Jakub Jelinek @ 2021-12-14 10:57 UTC (permalink / raw)
To: Joel Hutton
Cc: Richard Biener, gcc-patches, Tobias Burnus, Richard Sandiford,
Richard Biener
On Tue, Dec 14, 2021 at 10:46:39AM +0000, Joel Hutton wrote:
> > + if (ot_plus == unknown_optab
> > + || ot_minus == unknown_optab
> > + || optab_handler (ot_minus, TYPE_MODE (step_vectype)) ==
> > CODE_FOR_nothing
> > + || optab_handler (ot_plus, TYPE_MODE (step_vectype)) ==
> > + CODE_FOR_nothing)
> > return false;
> >
> > Won't optab_handler just return CODE_FOR_nothing for unknown_optab?
>
> I was taking the check used in directly_supported_p
>
> return (optab != unknown_optab$
> && optab_handler (optab, TYPE_MODE (type)) != CODE_FOR_nothing);$
>
> > Anyway, I think best would be to write it as:
> > if (!target_supports_op_p (step_vectype, PLUS_EXPR, optab_default)
> > || !target_supports_op_p (step_vectype, MINUS_EXPR, optab_default))
> > return false;
> Looks good to me.
>
> Patch attached.
>
> Tests running on gcc-11 on aarch64.
>
> Ok for 11 once tests come back?
Yes, thanks.
Jakub
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2021-12-14 10:57 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-10 10:02 pr103523: Check for PLUS/MINUS support Joel Hutton
2021-12-10 10:22 ` Richard Sandiford
2021-12-10 13:24 ` Joel Hutton
2021-12-10 18:33 ` Richard Sandiford
2021-12-13 14:27 ` GCC 11 backport does not build (no "directly_supported_p") - was: " Tobias Burnus
2021-12-13 14:47 ` Richard Biener
2021-12-13 15:02 ` Joel Hutton
2021-12-14 9:37 ` Joel Hutton
2021-12-14 9:53 ` Jakub Jelinek
2021-12-14 10:46 ` Joel Hutton
2021-12-14 10:57 ` Jakub Jelinek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).