From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 734353891C3D; Thu, 13 Jan 2022 10:44:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 734353891C3D From: "rguenther at suse dot de" 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 10:44:12 +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: rguenther at suse dot de 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 10:44:12 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103771 --- Comment #12 from rguenther at suse dot de --- On Thu, 13 Jan 2022, crazylht at gmail dot com wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103771 >=20 > --- Comment #10 from Hongtao.liu --- > with > @@ -12120,7 +12120,8 @@ supportable_narrowing_operation (enum tree_code c= ode, > c1 =3D VEC_PACK_TRUNC_EXPR; > if (VECTOR_BOOLEAN_TYPE_P (narrow_vectype) > && VECTOR_BOOLEAN_TYPE_P (vectype) > - && TYPE_MODE (narrow_vectype) =3D=3D TYPE_MODE (vectype) > + && (TYPE_MODE (narrow_vectype) =3D=3D TYPE_MODE (vectype) > + || known_lt (TYPE_VECTOR_SUBPARTS (vectype), BITS_PER_UNIT)) > && SCALAR_INT_MODE_P (TYPE_MODE (vectype))) I think we instead simply want if (VECTOR_BOOLEAN_TYPE_P (narrow_vectype) && TYPE_PRECISION (TREE_TYPE (narrow_vectype)) =3D=3D 1 && VECTOR_BOOLEAN_TYPE_P (vectype) && TYPE_PRECISION (TREE_TYPE (vectype)) =3D=3D 1) note the docs of vec_pack_sbool_trunc say This instruction pattern is used when all the vector input and output operands have the same scalar mode @var{m} and thus using @code{vec_pack_trunc_@var{m}} would be ambiguous. It also says "_Narrow_ and merge the elements of two vectors.", I think "narrow" is misleading here, _trunc in the optab name as well. So with the above it suggests we could have used vect_pack_trunc_hi here? To avoid breaking things for the VnBImode using targets we probably want to retain the SCALAR_INT_MODE_P (prev_mode) check. And we probably want to adjust the documentation a bit. This all is with my pasted pattern patch or is this with the weird inserted conversion still?=