From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 2F0003857432; Thu, 29 Jul 2021 06:55:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2F0003857432 From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/101668] BB vectorizer doesn't handle lowpart of existing vector Date: Thu, 29 Jul 2021 06:55:56 +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: 12.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: NEW 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: keywords cf_reconfirmed_on bug_status everconfirmed cc short_desc blocked 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jul 2021 06:55:57 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D101668 Richard Biener changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |missed-optimization Last reconfirmed| |2021-07-29 Status|UNCONFIRMED |NEW Ever confirmed|0 |1 CC| |rguenth at gcc dot gnu.org Summary|vectorizer doesn't |BB vectorizer doesn't |categorize vector construct |handle lowpart of existing |cost right. |vector Blocks| |53947 --- Comment #1 from Richard Biener --- The basic-block vectorizer is currently limited as to what "existing" vecto= rs it recognizes. In this testcase we're accessing only the lowpart of 'src', something we cannot yet model in vectorizable_slp_permutation. The specific case isn't hard to fix, we'd get [local count: 1073741824]: _31 =3D VIEW_CONVERT_EXPR(src_18(D)); vect__2.4_33 =3D [vec_unpack_lo_expr] _31; vect__2.4_34 =3D [vec_unpack_hi_expr] _31; MEM [(long long int *)&tem] =3D vect__2.4_33; MEM [(long long int *)&tem + 32B] =3D vect__2.4= _34; _17 =3D MEM[(v8di *)&tem]; *dst_28(D) =3D _17; tem =3D{v} {CLOBBER}; return; so we then fail to elide the temporary, producing bar_s32_s64: .LFB0: .cfi_startproc pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 vpmovsxdq %xmm0, %ymm1 vextracti128 $0x1, %ymm0, %xmm0 movq %rsp, %rbp .cfi_def_cfa_register 6 andq $-64, %rsp subq $8, %rsp vpmovsxdq %xmm0, %ymm0 vmovdqa %ymm1, -56(%rsp) vmovdqa %ymm0, -24(%rsp) vmovdqa64 -56(%rsp), %zmm2 vmovdqa64 %zmm2, (%rdi) leave .cfi_def_cfa 7, 8 ret it looks like there's no V8SI->V8DI conversion optab or we choose V4DI for some other reason as prefered vector mode. Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D53947 [Bug 53947] [meta-bug] vectorizer missed-optimizations=