public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/109279] New: [13 Regression] RISC-V: complex constants synthesized vs. fetching from constant pool
@ 2023-03-24 22:04 vineet.gupta at linux dot dev
  2023-03-24 22:08 ` [Bug target/109279] " pinskia at gcc dot gnu.org
                   ` (18 more replies)
  0 siblings, 19 replies; 20+ messages in thread
From: vineet.gupta at linux dot dev @ 2023-03-24 22:04 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109279

            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 sq) {
    unsigned int o;
    unsigned int f = sq & 7;

    occ   =   0x0101010101010101ULL & (occ   >> f);
    o     = ( 0x0080402010080400ULL *  occ ) >> 58;
    return  ( aFileAttacks[o][sq>>3]    ) << f;
}

cc1 -O2 -march=rv64gc_zba_zbb_zbc_zbs -mabi=lp64d   # 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

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2023-10-06 19:38 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-24 22:04 [Bug target/109279] New: [13 Regression] RISC-V: complex constants synthesized vs. fetching from constant pool vineet.gupta at linux dot dev
2023-03-24 22:08 ` [Bug target/109279] " pinskia at gcc dot gnu.org
2023-03-24 22:08 ` pinskia at gcc dot gnu.org
2023-03-24 22:13 ` vineet.gupta at linux dot dev
2023-03-24 22:15 ` vineet.gupta at linux dot dev
2023-03-24 22:17 ` pinskia at gcc dot gnu.org
2023-03-24 22:29 ` [Bug target/109279] RISC-V: complex constants synthesized should be improved pinskia at gcc dot gnu.org
2023-03-24 22:33 ` pinskia at gcc dot gnu.org
2023-03-24 22:34 ` pinskia at gcc dot gnu.org
2023-03-24 23:33 ` pinskia at gcc dot gnu.org
2023-03-25  0:44 ` vineet.gupta at linux dot dev
2023-03-25  0:48 ` vineet.gupta at linux dot dev
2023-03-25  0:56 ` pinskia at gcc dot gnu.org
2023-03-25  1:12 ` vineet.gupta at linux dot dev
2023-03-30 18:40 ` vineet.gupta at linux dot dev
2023-05-19 17:31 ` vineetg at gcc dot gnu.org
2023-05-19 18:13 ` vineetg at gcc dot gnu.org
2023-08-15 17:37 ` vineetg at gcc dot gnu.org
2023-10-06 19:37 ` vineetg at gcc dot gnu.org
2023-10-06 19:38 ` vineetg at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).