From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C57C23858C2B; Wed, 25 Oct 2023 02:02:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C57C23858C2B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1698199358; bh=jqp1hYTytF9RVCjCAvfy89FnTPaGSmOvRIZwyXos0qo=; h=From:To:Subject:Date:From; b=GIXZGakYDOr3fEgAS5zUHu5exlOpoy0arkdFgYctVbXm7jTLDCd72L9iMeUkLF1FZ nXoCOmfj6AF343a02kcztYEYnDtEdMWjOciBmn6RVX0iLFlACS7PaYhGq2a2Y6KU23 PWlsSqNbFPpggcpBUnkXey2Hk8Q4dXH8VbR4wftE= From: "pan2.li at intel dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/111970] New: [tree-optimization] SLP for non-IFN gathers result in RISC-V test failure on gather Date: Wed, 25 Oct 2023 02:02:37 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: pan2.li at intel dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone attachments.created Message-ID: 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 Bug ID: 111970 Summary: [tree-optimization] SLP for non-IFN gathers result in RISC-V test failure on gather Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: pan2.li at intel dot com Target Milestone: --- Created attachment 56197 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D56197&action=3Dedit Within this commit Hi Richard Biener, Recently we found one regression of RISC-V backend for gather autovec, aka gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-1= 2.c. I narrow it down to a small piece of code like below: include #define TEST_LOOP(DATA_TYPE, INDEX_TYPE)=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20 \ void __attribute__ ((noinline, noclone))=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 \ f_##DATA_TYPE##_##INDEX_TYPE (DATA_TYPE *restrict y, DATA_TYPE *restrict = x,=20 \ INDEX_TYPE *restrict index)=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20 \ {=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20 \ for (int i =3D 0; i < 100; ++i)=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20 \ {=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 \ y[i * 2] =3D x[index[i * 2]] + 1;=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20 \ y[i * 2 + 1] =3D x[index[i * 2 + 1]] + 2;=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 \ }=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 \ } TEST_LOOP (float, uint8_t) The commit id beab5b95c581452adeb26efd59ae84a61fb3b429 (tree-optimization/111131 - SLP for non-IFN gathers) makes the tree generate the incorrect IR as the attachments. The data array and the index array should have the same step after vectorization. But we get incorrect offset for the second iteration. vector(32) float vect__11.11; _209 =3D BIT_FIELD_REF [(uint8_t *)_163], 8= , 16>; then update offset for the second iteration. ivtmp.35_613 =3D ivtmp.35_594 + 64; // should be ivtmp =3D ivtmp + 32 ivtmp.38_76 =3D ivtmp.38_620 + 256; I also upload the tree.optimized code before and after this commit, you can check more details about it. Any more information required please feel free= to let me know. Pan=