From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B9FC63858035; Mon, 11 Jul 2022 23:25:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B9FC63858035 From: "vineet.gupta at linux dot dev" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/106265] RISC-V SPEC2017 507.cactu code bloat due to address generation Date: Mon, 11 Jul 2022 23:25:55 +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: 12.1.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: vineet.gupta at linux dot dev 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 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, 11 Jul 2022 23:25:55 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D106265 --- Comment #2 from Vineet Gupta --- I've experimented with riscv_rtx_costs() setting cost of const to 1 as discussed in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D98596. This does reduce the number of li 4096 instances to 10 (from 14), but the fragment pa= sted above generates the same code. # rhs-cred.cc:42: (*(double *)((char *)&ao)[k] + *(double *)((char *)0)[12]= + #(insn 2660 1703 76 (set (reg:DI 28 t3 [2817]) # (const_int 4096 [0x1000])) "rhs-cred.cc":42:47 139 {*movdi_64bit} # (nil)) li t3,4096 # tmp2817, # 2660 [c=3D1 l=3D4]=20 *movdi_64bit/1 # rhs-cred.cc:39: bg =3D (&ao[az])[0] * *(&ao)[av] + *(&ao)[2]; #(insn 76 2660 2661 (set (reg/f:DI 16 a6 [orig:193 _239 ] [193]) # (plus:DI (reg:DI 12 a2 [1860]) # (reg:DI 16 a6 [orig:181 _224 ] [181]))) "rhs-cred.cc":39:40 4 {adddi3} # (expr_list:REG_DEAD (reg:DI 12 a2 [1860]) # (nil))) add a6,a2,a6 # _224, _239, tmp1860 # 76 [c=3D4 l=3D= 4]=20 adddi3/0 # rhs-cred.cc:42: (*(double *)((char *)&ao)[k] + *(double *)((char *)0)[12]= + #(insn 2661 76 2658 (set (reg:DI 12 a2 [2816]) # (plus:DI (reg:DI 28 t3 [2817]) # (const_int -2040 [0xfffffffffffff808]))) "rhs-cred.cc":42:47 4 {adddi3} # (expr_list:REG_DEAD (reg:DI 28 t3 [2817]) # (expr_list:REG_EQUAL (const_int 2056 [0x808]) # (nil)))) addi a2,t3,-2040 #, tmp2816, tmp2817 # 2661 [c=3D4 l=3D= 4]=20 adddi3/1 # rhs-cred.cc:44: *(&ao)[av * 2] - *(&ao)[k] - (&ao[az])[2] + #(insn 2658 2661 1702 (set (reg:DI 28 t3 [2815]) # (const_int 4096 [0x1000])) "rhs-cred.cc":44:29 139 {*movdi_64bit} # (nil)) li t3,4096 # tmp2815, # 2658 [c=3D1 l=3D4]=20 *movdi_64bit/1=