From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 78D8D3858409; Thu, 13 Jan 2022 09:50:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 78D8D3858409 From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/103771] [12 Regression] Missed vectorization under -mavx512f -mavx512vl after r12-5489 Date: Thu, 13 Jan 2022 09:50:32 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target 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: 12.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: 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, 13 Jan 2022 09:50:32 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103771 --- Comment #7 from Richard Biener --- Forcing the pattern to not trigger produces the expected t.c:8:6: missed: not vectorized: relevant stmt not supported: iftmp.0_21 = =3D x.1_14 > 255 ? iftmp.0_19 : iftmp.0_20; since condition vectorization itself doesn't know how to handle this, we end up at if (vectype1 && !useless_type_conversion_p (vectype, vectype1)) return false; with vectype V32QI and vectype1 V8SI. Splitting out the compare from the COND_EXPR in the pattern but leaving out the attempt to "widen" it reveals the same fact that vectorizable_condition doesn't support packing of multiple vector defs for the mask operand. I think that is what we need to add. We also don't have a good representat= ion for "packing" of masks. diff --git a/gcc/tree-vect-patterns.c b/gcc/tree-vect-patterns.c index 3ea905538e1..729a1d32612 100644 --- a/gcc/tree-vect-patterns.c +++ b/gcc/tree-vect-patterns.c @@ -4679,8 +4679,10 @@ vect_recog_mask_conversion_pattern (vec_info *vinfo, rhs1_type); } - if (maybe_ne (TYPE_VECTOR_SUBPARTS (vectype1), - TYPE_VECTOR_SUBPARTS (vectype2))) + /* AVX512 style masks cannot be packed/unpacked. */ + if (TYPE_PRECISION (TREE_TYPE (vectype2)) !=3D 1 + && maybe_ne (TYPE_VECTOR_SUBPARTS (vectype1), + TYPE_VECTOR_SUBPARTS (vectype2))) tmp =3D build_mask_conversion (vinfo, rhs1, vectype1, stmt_vinfo); else tmp =3D rhs1;=