From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 657673853D3C; Fri, 18 Aug 2023 07:39:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 657673853D3C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1692344365; bh=mkKzkAHUjwUVuuCwCE3NTWaR6rSxqGsY0yJEC/lh2tA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Ndf0atte5R50cXkFTjl+OnP07x9WieToisG+VuVA1GTpa/fH0VlzQJ9PdkpyNS9xB i5I6kHneIOJ0nkA1hFliQART7h2oWVHNJJ4MXQLJI3j6NqogPO5/KSGqHCN0F8jkSP l924FaFdfSvB1hzmqKtzrK+LbD3XypmbQmds02V4= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/111048] [14 Regression] Wrong AVX2 code on highway-1.0.6 on -O2 and above Date: Fri, 18 Aug 2023 07:39:24 +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: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 14.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc 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=3D111048 Richard Biener changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |rsandifo at gcc dot gnu.org --- Comment #3 from Richard Biener --- We somehow compute res_nelts to 12, coming via /* (1) If SEL is a suitable mask as determined by valid_mask_for_fold_vec_perm_cst_p, then: res_npatterns =3D max of npatterns between ARG0, ARG1, and SEL res_nelts_per_pattern =3D max of nelts_per_pattern between ARG0, ARG1 and SEL. (2) If SEL is not a suitable mask, and TYPE is VLS then: res_npatterns =3D nelts in result vector. res_nelts_per_pattern =3D 1. This exception is made so that VLS ARG0, ARG1 and SEL work as before. = */ if (valid_mask_for_fold_vec_perm_cst_p (arg0, arg1, sel, reason)) { I suppose doing else if (TYPE_VECTOR_SUBPARTS (type).is_constant (&res_nelts)) first would fix this, but then the above looks wrong? I'm going to test & push the "obvious" to fix x86_64, but I suppose you sho= uld double-check your logic that goes wrong for non-VLA vectors.=