From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 660453858C2C; Tue, 4 Jul 2023 05:46:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 660453858C2C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1688449609; bh=fhaJm2rTKN11+BAB9Pmb6Hn+8JaOjgxKffU92Luewl8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Jjf39+mqVJO/S0PNk4FJ6F7Jwc9XYcIUjafBBlmvwqsmsmVr/cKix45AaKSrN+z+c y/aR8Bo7HRXYvGPdR21s0SLYPdhpKJflXTzGOZSKenGQeaIVsItrtoygPe7dOCEIut PUZ3eoiM4WHEAuVfKyCNY/3iKZrv5IvNvy60N9Jw= 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: Tue, 04 Jul 2023 05:46:48 +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 #10 from Hongtao.liu --- There're couple of other issues. 1. rtx_cost for and/ior/xor:SF/DF is not right, it actually generate vector instructions. 2. branch_cost is COSTS_N_INSN(1) instead of BRANCH_COST (). which make noce more conservative to eliminate condition. w/ sse2, backend tries (insn 34 0 36 (set (reg:DF 86 [ _1 ]) (reg:DF 82 [ _1 ])) 151 {*movdf_internal} (nil)) (insn 36 34 37 (set (reg:DF 92) (unspec:DF [ (reg:DF 83 [ _2 ]) (reg:DF 82 [ _1 ]) ] UNSPEC_IEEE_MAX)) -1 (nil)) (insn 37 36 38 (set (reg:DF 93) (lt:DF (reg:DF 82 [ _1 ]) (reg:DF 83 [ _2 ]))) -1 (nil)) (insn 38 37 39 (set (reg:DF 94) (and:DF (reg:DF 86 [ _1 ]) (reg:DF 93))) -1 (nil)) (insn 39 38 40 (set (reg:DF 95) (and:DF (not:DF (reg:DF 93)) (reg:DF 83 [ _2 ]))) -1 (nil)) (insn 40 39 41 (set (reg:DF 83 [ _2 ]) (ior:DF (reg:DF 95) (reg:DF 94))) -1 (nil)) (insn 41 40 0 (set (reg:DF 82 [ _1 ]) (reg:DF 92)) 151 {*movdf_internal} (nil)) which is cost is 28, and original cost is 12 (3 moves + 1 branch).(needs al= so conside comparison? since it's counted in cmov seq), if use ix86_branch_cos= t + count comparison cost in the orginal seq, then the cost should be 28 vs 28.) (insn 5 17 6 3 (set (reg:DF 86 [ _1 ]) (reg:DF 82 [ _1 ])) "/export/users/liuhongt/tools-build/build_intel-innersource_pr110170_debug/= test.c":5:23 151 {*movdf_internal} (expr_list:REG_DEAD (reg:DF 82 [ _1 ]) (nil))) (insn 6 5 7 3 (set (reg:DF 82 [ _1 ]) (reg:DF 83 [ _2 ])) "/export/users/liuhongt/tools-build/build_intel-innersource_pr110170_debug/= test.c":6:15 discrim 1 151 {*movdf_internal} (expr_list:REG_DEAD (reg:DF 83 [ _2 ]) (nil))) (insn 7 6 18 3 (set (reg:DF 83 [ _2 ]) (reg:DF 86 [ _1 ])) "/export/users/liuhongt/tools-build/build_intel-innersource_pr110170_debug/= test.c":5:23 discrim 1 151 {*movdf_internal} (expr_list:REG_DEAD (reg:DF 86 [ _1 ]) (nil)))=