From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id AD4903858415; Mon, 17 Jan 2022 03:36:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AD4903858415 From: "crazylht at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/104059] New: cprop_hardreg propgates hard registers for mov instructions between different REG_CLASS without considering cost Date: Mon, 17 Jan 2022 03:36:51 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: crazylht at gmail dot com 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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: Mon, 17 Jan 2022 03:36:51 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D104059 Bug ID: 104059 Summary: cprop_hardreg propgates hard registers for mov instructions between different REG_CLASS without considering cost Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: crazylht at gmail dot com Target Milestone: --- int test (uint8_t *p, uint32_t t[1][1], int n) { int sum =3D 0; uint32_t a0; for (int i =3D 0; i < 4; i++, p++) t[i][0] =3D p[0]; for (int i =3D 0; i < 4; i++) { { int t0 =3D t[0][i] + t[0][i]; a0 =3D t0; }; sum +=3D a0; } return (((uint16_t)sum) + ((uint32_t)sum >> 16)) >> 1; } testcase is from PR104049, for x86 with -O3 -mavx2 ,before cprop_hardregs i= t's ----before cprop_hardreg------ (insn 100 79 81 2 (set (reg:SI 1 dx [orig:90 stmp__9.14 ] [90]) (reg:SI 20 xmm0 [114])) 81 {*movsi_internal} (expr_list:REG_DEAD (reg:SI 20 xmm0 [114]) (nil))) (debug_insn 81 100 96 2 (debug_marker) "/app/example.cpp":16:3 -1 (nil)) (insn 96 81 82 2 (set (reg:SI 0 ax [116]) (reg:SI 1 dx [orig:90 stmp__9.14 ] [90])) "/app/example.cpp":16:44 = 81 {*movsi_internal} (nil)) ---end------------ ------after cprop_hardreg-------- (insn 100 79 81 2 (set (reg:SI 1 dx [orig:90 stmp__9.14 ] [90]) (reg:SI 20 xmm0 [114])) 81 {*movsi_internal} (nil)) (debug_insn 81 100 96 2 (debug_marker) "/app/example.cpp":16:3 -1 (nil)) (insn 96 81 82 2 (set (reg:SI 0 ax [116]) (reg:SI 20 xmm0 [orig:90 stmp__9.14 ] [90])) "/app/example.cpp":16:= 44 81 {*movsi_internal} (expr_list:REG_DEAD (reg:SI 20 xmm0 [orig:90 stmp__9.14 ] [90]) (nil))) ------end-------------- it's vmovd edx, xmm0 movl eax, edx vs vmovd edx, xmm0 vmovd eax, xmm0 vmovd is expensive for many x86 targets.=