From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 96BBB38582BB; Mon, 20 Nov 2023 14:20:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 96BBB38582BB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1700490004; bh=+/W8fimFHG8nbPDsDTJ+vQdiU18OxFY6xJy9c/dPiZE=; h=From:To:Subject:Date:In-Reply-To:References:From; b=u4quD/bi3MiioI4jIO92a2f7JXfr8qNRszEUrBd5S6+t4p0IPP4LntfCJZJMVEgY2 X41IiHL2CxKooHTbLpWASsAUyLgLvfvT30/4G1Z49dbokoy4Zmgv6uqTR5Gfspcv6u iiEPTltkVJItUU94u8Pw4q8QZ6IXGAYDvO01YgcY= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/111970] [14 regression] SLP for non-IFN gathers result in RISC-V test failure on gather since r14-4745-gbeab5b95c58145 Date: Mon, 20 Nov 2023 14:20:02 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org X-Bugzilla-Target-Milestone: 14.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D111970 --- Comment #17 from Richard Biener --- OK, so for RISC-V with the testcase from the description there's the following issue: _179 =3D &MEM [(uint8_t *)_618]; _225 =3D BIT_FIELD_REF [(uint8_t *)_179],= 8, 16>; ... vect__8.9_405 =3D {_218, _224, _230, _236, _242, _248, _254, _260, _266, = _272, _278, _284, _290, _296, _302, _308, _314, _320, _326, _332, _338, _344, _35= 0, _356, _362, _368, _374, _380, _386, _392, _398, _404}; vect__11.11_599 =3D vect__8.9_405 + { 1.0e+0, 2.0e+0, 1.0e+0, 2.0e+0, 1.0= e+0, 2.0e+0, 1.0e+0, 2.0e+0, 1.0e+0, 2.0e+0, 1.0e+0, 2.0e+0, 1.0e+0, 2.0e+0, 1.0= e+0, 2.0e+0, 1.0e+0, 2.0e+0, 1.0e+0, 2.0e+0, 1.0e+0, 2.0e+0, 1.0e+0, 2.0e+0, 1.0= e+0, 2.0e+0, 1.0e+0, 2.0e+0, 1.0e+0, 2.0e+0, 1.0e+0, 2.0e+0 }; _609 =3D (void *) ivtmp.31_622; MEM [(float *)_609] =3D vect__11.11_599; _1 =3D _609 + 128; MEM [(float *)_1] =3D vect__11.11_599; I think the following fixes it: diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc index 96e4a6cffad..bf8c99779ae 100644 --- a/gcc/tree-vect-stmts.cc +++ b/gcc/tree-vect-stmts.cc @@ -9188,7 +9188,8 @@ vectorizable_store (vec_info *vinfo, unsigned HOST_WIDE_INT factor =3D const_offset_nunits / const_nunits; vec_offset =3D vec_offsets[(vec_num * j + i) / factor]; - unsigned elt_offset =3D (j % factor) * const_nunits; + unsigned elt_offset + =3D ((vec_num * j + i) % factor) * const_nunits; tree idx_type =3D TREE_TYPE (TREE_TYPE (vec_offset)); tree scale =3D size_int (gs_info.scale); align =3D get_object_alignment (DR_REF (first_dr_info->dr= )); @@ -11150,7 +11151,8 @@ vectorizable_load (vec_info *vinfo, unsigned HOST_WIDE_INT factor =3D const_offset_nunits / const_nunits; vec_offset =3D vec_offsets[(vec_num * j + i) / factor]; - unsigned elt_offset =3D (j % factor) * const_nunits; + unsigned elt_offset + =3D ((vec_num * j + i) % factor) * const_nunits; tree idx_type =3D TREE_TYPE (TREE_TYPE (vec_offset)); tree scale =3D size_int (gs_info.scale); align =3D get_object_alignment (DR_REF (first_dr_info->dr= ));=