From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id DA8D83890438; Thu, 13 Jan 2022 12:40:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DA8D83890438 From: "crazylht at gmail dot com" 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 12:40:18 +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: crazylht at gmail dot com 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 12:40:19 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103771 --- Comment #15 from Hongtao.liu --- (In reply to rguenther@suse.de from comment #12) > On Thu, 13 Jan 2022, crazylht at gmail dot com wrote: >=20 > > 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= code, > > 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_UNI= T)) > > && SCALAR_INT_MODE_P (TYPE_MODE (vectype))) >=20 > I think we instead simply want >=20 > 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) >=20 > note the docs of vec_pack_sbool_trunc say >=20 > 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. >=20 > 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? >=20 > 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. >=20 > This all is with my pasted pattern patch or is this with the weird > inserted conversion still? It's w/o your patch, I'm try to handle the weird conversion with multi steps(first pack QI:4 -> QI:8 through vec_pack_sbool_trunc_qi, then pack QI= :8 -> HI:16 through vec_pack_sbool_trunc_hi). But on the othersize the weird inserted conversion shouldn't be existed.=