From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id F21133858C52; Thu, 12 Oct 2023 07:31:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F21133858C52 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1697095899; bh=x1u4fmtm+0DGI1w0RBen9hmbkzrC7+bvt8WavHDtCmE=; h=From:To:Subject:Date:From; b=kSXdl0uySK2VbsCsPDt7FI7LjQRF/0n3kGN4ELr/0qUbj/R12jD/ZPmK5A+ZIY29F V/EKhx99nDFNUfco+gGEtcq6k+JuYKhmy52UaxiBoug1gdAHTYCKn+fMqb774WRfph cLHXyPhEw4PJQWOn35m9sWhfY7sEBS9QZrn7aMy0= From: "juzhe.zhong at rivai dot ai" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/111779] New: Fail to vectorize the struct include struct Date: Thu, 12 Oct 2023 07:31:39 +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: 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=3D111779 Bug ID: 111779 Summary: Fail to vectorize the struct include struct Product: gcc Version: 14.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: --- #include #include struct C { int c; int d; bool f :1; float e; }; struct A { unsigned int a; unsigned char c1, c2; bool b1 : 1; bool b2 : 1; bool b3 : 1; struct C b4; }; void foo (const struct A * __restrict x, int y) { int s =3D 0, i =3D 0; for (i =3D 0; i < y; ++i) { const struct A a =3D x[i]; s +=3D a.b4.f ? 1 : 0; } assert (s =3D=3D 0); //__builtin_abort (); } int main () { struct A x[100]; int i; __builtin_memset (x, -1, sizeof (x)); for (i =3D 0; i < 100; i++) { x[i].b1 =3D false; x[i].b2 =3D false; x[i].b3 =3D false; x[i].b4.f =3D false; } foo (x, 100); return 0; } https://godbolt.org/z/KWb7c1n5h Both SVE GCC and RVV GCC failed to vectorize it. But Clang succeed on vectorization.=