From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6EC2E3858D35; Fri, 24 Mar 2023 22:04:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6EC2E3858D35 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1679695451; bh=5LB3vYNn888oiw7gIjyqGgx8Rv3v79ZJKVfVTJzcJAk=; h=From:To:Subject:Date:From; b=VT6GW2g1/BOff1hhlsSt0hNsAOS16G0XpX+FFy8WG4Khbh2kxJOA5r6Rt4w3p7xBp GYhPElfryNdvyVqrP+ioTHFUuoF2QSRbfbjkv6KcodR+vo/L1H0kjDIw1F2yooZh8H BZo5olTfkn0SuP8LvftehUSuWgt1FWoo0Jkfi0pk= From: "vineet.gupta at linux dot dev" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/109279] New: [13 Regression] RISC-V: complex constants synthesized vs. fetching from constant pool Date: Fri, 24 Mar 2023 22:04:11 +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: unknown X-Bugzilla-Keywords: 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: 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D109279 Bug ID: 109279 Summary: [13 Regression] RISC-V: complex constants synthesized vs. fetching from constant pool Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: vineet.gupta at linux dot dev Target Milestone: --- This is code bloat regression since gcc 12.1, seen yet again in SPEC2017 deepsjeng. After 2e886eef7f2b5a ("RISC-V: Produce better code with complex constants [PR95632] [PR106602]"). unsigned long long FileAttacks(unsigned long long occ, const unsigned int s= q) { unsigned int o; unsigned int f =3D sq & 7; occ =3D 0x0101010101010101ULL & (occ >> f); o =3D ( 0x0080402010080400ULL * occ ) >> 58; return ( aFileAttacks[o][sq>>3] ) << f; } cc1 -O2 -march=3Drv64gc_zba_zbb_zbc_zbs -mabi=3Dlp64d # stage1 is enough Before above commit ------------------- lui a4,%hi(.LC0) ld a4,%lo(.LC0)(a4) andi a3,a1,7 srl a5,a0,a3 and a5,a5,a4 lui a4,%hi(.LC1) ld a4,%lo(.LC1)(a4) srliw a1,a1,3 mul a5,a5,a4 lui a4,%hi(aFileAttacks) addi a4,a4,%lo(aFileAttacks) srli a5,a5,58 sh3add a5,a5,a1 sh3add a5,a5,a4 ld a0,0(a5) sll a0,a0,a3 ret .section .srodata.cst8,"aM",@progbits,8 .align 3 .LC0: .dword 0x0101010101010101 .align 3 .LC1: .dword 0x0080402010080400 With commit ----------- li a5,16842752 addi a5,a5,257 slli a5,a5,16 addi a5,a5,257 andi a3,a1,7 slli a5,a5,16 srl a4,a0,a3 addi a5,a5,257 and a4,a4,a5 slli a5,a4,9 add a5,a5,a4 slli a5,a5,9 add a5,a5,a4 slli a4,a5,27 add a5,a5,a4 srli a5,a5,45 srliw a1,a1,3 andi a5,a5,504 lui a4,%hi(aFileAttacks) add a5,a5,a1 addi a4,a4,%lo(aFileAttacks) sh3add a5,a5,a4 ld a0,0(a5) sll a0,a0,a3 ret=