My mistake, reworked patch. Tests are still running.
________________________________
From: Richard Biener <richard.guent...@gmail.com>
Sent: 13 December 2021 14:47
To: gcc-patches@gcc.gnu.org <gcc-patches@gcc.gnu.org>; Tobias Burnus 
<tob...@codesourcery.com>; Joel Hutton <joel.hut...@arm.com>; Richard Sandiford 
<richard.sandif...@arm.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>; Richard Biener <rguent...@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 
<tob...@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.sandif...@arm.com>
>> Sent: 10 December 2021 10:22
>> To: Joel Hutton <joel.hut...@arm.com>
>> Cc: GCC Patches <gcc-patches@gcc.gnu.org>; Richard Biener <rguent...@suse.de>
>> Subject: Re: pr103523: Check for PLUS/MINUS support
>>
>> Joel Hutton <joel.hut...@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

From d6ac8751dfdf3520f90b2ad8d09ebc452cc42831 Mon Sep 17 00:00:00 2001
From: Joel Hutton <joel.hut...@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

Reply via email to