From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8666B3882AC0; Tue, 18 Jun 2024 11:08:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8666B3882AC0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1718708926; bh=6IBtCazBka8nc9MsHIU0JxAZhWNqCqpAHD1nSDRzHm4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=lDEndcK8Z8H9gbCZ6VAIdNTai3cMP71ioHSNFkBh2b88c52LBXT52ynwB7iuRecpT VT5D69ARjF70Ag7vcGj1OHfxp97d/oSmwTQOcXsjFJcc2ziZrV4xUcbFzpQgTxU273 B1CnWA9U2BaxDgimbtKnUuUm0qyLOq3W+KLT9r+M= From: "liuhongt at gcc dot gnu.org" 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:08:46 +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: liuhongt at gcc dot gnu.org 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 #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 mi= tigation > > > should be from optimizing ISEL expansion to vcond_mask and I'd start = with > > > looking at some of the fallout from that side (note that might require > > > 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 compa= rison > > 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 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 un= der 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 t= he vcond{,u,eq}.i.e min/max. In the case of sse 4.1 and above, there is basically no regression anymore. the regression testcases w/o sse4.1 FAIL: g++.target/i386/pr100637-1b.C -std=3Dgnu++14 scan-assembler-times p= cmpeqb 2 FAIL: g++.target/i386/pr100637-1b.C -std=3Dgnu++17 scan-assembler-times p= cmpeqb 2 FAIL: g++.target/i386/pr100637-1b.C -std=3Dgnu++20 scan-assembler-times p= cmpeqb 2 FAIL: g++.target/i386/pr100637-1b.C -std=3Dgnu++98 scan-assembler-times p= cmpeqb 2 FAIL: g++.target/i386/pr100637-1w.C -std=3Dgnu++14 scan-assembler-times p= cmpeqw 2 FAIL: g++.target/i386/pr100637-1w.C -std=3Dgnu++17 scan-assembler-times p= cmpeqw 2 FAIL: g++.target/i386/pr100637-1w.C -std=3Dgnu++20 scan-assembler-times p= cmpeqw 2 FAIL: g++.target/i386/pr100637-1w.C -std=3Dgnu++98 scan-assembler-times p= cmpeqw 2 FAIL: g++.target/i386/pr103861-1.C -std=3Dgnu++14 scan-assembler-times pc= mpeqb 2 FAIL: g++.target/i386/pr103861-1.C -std=3Dgnu++17 scan-assembler-times pc= mpeqb 2 FAIL: g++.target/i386/pr103861-1.C -std=3Dgnu++20 scan-assembler-times pc= mpeqb 2 FAIL: g++.target/i386/pr103861-1.C -std=3Dgnu++98 scan-assembler-times pc= mpeqb 2 FAIL: gcc.target/i386/pr88540.c scan-assembler minpd=