From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9011B3882668; Tue, 18 Jun 2024 11:17:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9011B3882668 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1718709447; bh=gzi9xArrrP+ayti/G0YlqndV2LZpTnEwvG424xAF0VI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=GmNWD84jHynUjHAUh38N1C8dVC9x9wCNeASxyMcM6VB3UPIrsRHBgF5PWcMEYk5cB wkgmnsyx3TicO7eC5tMPLHtBeseeJqzb4inx3nyJR5KrOhLxlZgIoicPfrLtQUl4QF FfoJUOvzuWSA7MLz/zQH4DrvMqvmJTlIDnUzMMWE= From: "rguenther at suse dot de" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/115517] Fix x86 regressions after dropping uses of vcond{,u,eq}_optab Date: Tue, 18 Jun 2024 11:17:27 +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: 15.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenther at suse dot de X-Bugzilla-Status: UNCONFIRMED 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: 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=3D115517 --- Comment #5 from rguenther at suse dot de --- On Tue, 18 Jun 2024, liuhongt at gcc dot gnu.org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D115517 >=20 > --- Comment #4 from Hongtao Liu --- > (In reply to rguenther@suse.de from comment #3) > > On Tue, 18 Jun 2024, liuhongt at gcc dot gnu.org wrote: > >=20 > > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D115517 > > >=20 > > > --- Comment #2 from Hongtao Liu --- > > > (In reply to Richard Biener from comment #1) > > > > Btw, I had opened PR115490 with my results for this already. Some = mitigation > > > > should be from optimizing ISEL expansion to vcond_mask and I'd star= t with > > > > looking at some of the fallout from that side (note that might requ= ire > > > > the backend reject not natively implemented vec_cmp via its operand= 1 > > > > predicate) > > >=20 > > > w/o AVX512, vector integer comparison only supports EQ/GT, others com= parison > > > rtx_cost is transformed to that. (.i.e GTU is emulated with us_minus = + eq + > > > negative the vector mask) > > > If we restrict the predicate of operand 1, would middle-end reject > > > vectorization (or lower it to scalar version)? > >=20 > > Richard suggests that we implement the "obvious" transforms like > > inversion in the middle-end but if for example unsigned compares > > are not supported the us_minus + eq + negative trick isn't on > > that list. > >=20 > > The main reason to restrict vec_cmp would be to avoid > > a <=3D b ? c : d going with an unsupported vec_cmp but instead > > do a > b ? d : c - the alternative is trying to fix this > > on the RTL side via combine. I understand the non-native >=20 > Yes, I have a patch which can fix most regressions via pattern match in > combine. > Still there is a situation that is difficult to deal with, mainly the > optimization w/o sse4.1 . Because pblendvb/blendvps/blendvpd only exists = under > sse4.1, w/o sse4.1, it takes 3 instructions (pand,pandn,por) to simulate = the > vcond_mask, and the combine matches up to 4 instructions, which makes it > currently impossible to use the combine to recover those optimizations in= the > vcond{,u,eq}.i.e min/max. > In the case of sse 4.1 and above, there is basically no regression anymor= e. Maybe it's possible to use a define_insn_and_split for blends w/o SSE 4.1? That would allow combine matching the high-level blend operation and we'd only lower it afterwards? The question is what we lose in combinations of/into the loweredn pand/pandn/por of course. Maybe it's possible to catch the higher-level optimization (min/max) on the GIMPLE level instead?=