From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 276FA3858C55; Tue, 20 Sep 2022 23:05:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 276FA3858C55 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1663715137; bh=kVdr+sTwWQ7QWQ9EMX6MO1/HUHtTJdoDLF5CKuqR4mw=; h=From:To:Subject:Date:From; b=AOY4VAmZBfFglkzpK9NVdLOBDkiDX81n9C4DYXQ0UKO2WnmDLcUUHIq7rnJoueY0d O29zPZsFChHjLNhji3nTIbJNrFdvsKY+jV5UejWYZ38keCKBPDawit+hKAfxrwXf3y XE3nkRf47cCIOZcoYpDPkhNWD2sWhGEsot3Z6AM0= From: "juzhe.zhong at rivai dot ai" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/106989] New: GCC fail to vectorize and clang succeed Date: Tue, 20 Sep 2022 23:05:36 +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: 13.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: juzhe.zhong at rivai dot ai 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 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=3D106989 Bug ID: 106989 Summary: GCC fail to vectorize and clang succeed Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: juzhe.zhong at rivai dot ai Target Milestone: --- https://godbolt.org/z/v5arbjh3n This case ARM-clang can vectorize but ARM-GCC failed. Can anyone fix it? Or give me some guideline to fix it? code: typedef float real_t; #define iterations 100000 #define LEN_1D 32000 #define LEN_2D 256 real_t flat_2d_array[LEN_2D*LEN_2D]; real_t x[LEN_1D]; real_t a[LEN_1D],b[LEN_1D],c[LEN_1D],d[LEN_1D],e[LEN_1D], bb[LEN_2D][LEN_2D],cc[LEN_2D][LEN_2D],tt[LEN_2D][LEN_2D]; int indx[LEN_1D]; real_t* __restrict__ xx; real_t* yy; real_t s243(void) { for (int nl =3D 0; nl < iterations; nl++) { for (int i =3D 0; i < LEN_1D-1; i++) { a[i] =3D b[i] + c[i ] * d[i]; b[i] =3D a[i] + d[i ] * e[i]; a[i] =3D b[i] + a[i+1] * d[i]; } } }=