From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 675C93858D32; Mon, 12 Jun 2023 09:09:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 675C93858D32 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1686560974; bh=UC9HYOiwboMmE5dbSmsWQAkIDaWpAL7Z04a4UTXTcZ0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=iw7jHgNQhTSGTDGzzkB6ajbk+mZqIfjzov1UI1FkRFqySMrG25rW9DTX47/yxze4/ IQ5dkFvsJ0JkKQScqLVLJ0s+COknrVtcD1Hx5LIWnE9ZztNO4RCD/t3I1ZWzk+5l9n 6k4kMfz7HwVHrmP0I7fL326s3fhNWR1OrKtlGTcs= From: "crazylht at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/110170] Sub-optimal conditional jumps in conditional-swap with floating point Date: Mon, 12 Jun 2023 09:09:31 +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: 14.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: --- 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=3D110170 --- Comment #9 from Hongtao.liu --- (In reply to Hongtao.liu from comment #8) > ix86_expand_sse_fp_minmax failed since rtx_equal_p (cmp_op0, if_true) is > false,=20 >=20 > 249(reg:DF 86 [ _1 ]) (if_true) > 250(reg:DF 83 [ _2 ]) (if_false) > 251(reg:DF 82 [ _1 ]) (cmp0_op0) > 252(reg:DF 83 [ _2 ]) (cmp1_op1) >=20 > but here if_true is just a copy from cmp_op0 but with different REGNO, > rtx_equal_p seems too conservative here. >=20 But if_convert didn't maintain DF_CHAIN info, and and backend can't get DF_REG_DEF_* info to figure out if_true is just a single_set of cmp_op0. With -march=3Dx86-64-v2, gcc generates=20 movsd (%rdi), %xmm2 movsd (%rsi), %xmm1 movapd %xmm2, %xmm0 movapd %xmm1, %xmm3 cmpltsd %xmm1, %xmm0 maxsd %xmm2, %xmm3 blendvpd %xmm0, %xmm2, %xmm1 movsd %xmm3, (%rsi) movsd %xmm1, (%rdi) ret Which can be further optimized: cmpltsd + blendvpd -> minsd=