From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1666) id 0FBC23858282; Fri, 23 Feb 2024 12:00:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0FBC23858282 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1708689658; bh=le1FkMQk1I65W4DfgQzKaZ1LsfsjIn17qvXxP9yoBLY=; h=From:To:Subject:Date:From; b=oeCMCCbXxZ74FB7VyXNnllcuhMR1ZHpDb2mIRlAGi+yG2YoLnxwxPUI8GUa7Xg5Lv BNzQl3CfdJaMZ9EQsKber1nf+TdeCGmLqJx8VW1KYxIY2xu8/q/jdC7fbFQn+3mNSH hlTdlH57Rp2BfDg1L1zl2oYbhBtdzpmq0OLslYw4= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Richard Biener To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/users/rguenth/heads/vect-force-slp)] Fix SLP reduction initial value for pointer reductions X-Act-Checkin: gcc X-Git-Author: Richard Biener X-Git-Refname: refs/users/rguenth/heads/vect-force-slp X-Git-Oldrev: 98f3724b20b1c28a460885536fab4c3415f203f2 X-Git-Newrev: 598e22d683e4c92eaa784238d9ef733b612b75fa Message-Id: <20240223120058.0FBC23858282@sourceware.org> Date: Fri, 23 Feb 2024 12:00:57 +0000 (GMT) List-Id: https://gcc.gnu.org/g:598e22d683e4c92eaa784238d9ef733b612b75fa commit 598e22d683e4c92eaa784238d9ef733b612b75fa Author: Richard Biener Date: Fri Feb 23 11:21:20 2024 +0100 Fix SLP reduction initial value for pointer reductions For pointer reductions we need to convert the initial value to the vector component integer type. * tree-vect-loop.cc (get_initial_defs_for_reduction): Convert initial value to the vector component type. Diff: --- gcc/tree-vect-loop.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc index 405c7fb16180..51ed64a85c16 100644 --- a/gcc/tree-vect-loop.cc +++ b/gcc/tree-vect-loop.cc @@ -5619,7 +5619,14 @@ get_initial_defs_for_reduction (loop_vec_info loop_vinfo, if (i >= initial_values.length () || (j > i && neutral_op)) op = neutral_op; else - op = initial_values[i]; + { + if (!useless_type_conversion_p (TREE_TYPE (vector_type), + TREE_TYPE (initial_values[i]))) + initial_values[i] = gimple_convert (&ctor_seq, + TREE_TYPE (vector_type), + initial_values[i]); + op = initial_values[i]; + } /* Create 'vect_ = {op0,op1,...,opn}'. */ number_of_places_left_in_vector--;