]> gcc.gnu.org Git - gcc.git/commit
RISC-V: improve codegen for large constants with same 32-bit lo and hi parts [2]
authorVineet Gupta <vineetg@rivosinc.com>
Tue, 9 May 2023 23:22:08 +0000 (16:22 -0700)
committerVineet Gupta <vineetg@rivosinc.com>
Fri, 19 May 2023 17:18:58 +0000 (10:18 -0700)
commitc104ef4b5eb1f781bbef953e3c282ef1ca94c4f1
tree800268e826c95063bad1c56b435b83d28eaddee8
parentc5709fc87131bea0013cb67cf80bdea6e238c918
RISC-V: improve codegen for large constants with same 32-bit lo and hi parts [2]

[part #2 of PR/109279]

SPEC2017 deepsjeng uses large constants which currently generates less than
ideal code. This fix improves codegen for large constants which have
same low and hi parts: e.g.

long long f(void) { return 0x0101010101010101ull; }

Before
        li      a5,0x1010000
        addi    a5,a5,0x101
        mv      a0,a5
        slli    a5,a5,32
        add     a0,a5,a0
        ret

With patch
li a5,0x1010000
addi a5,a5,0x101
slli a0,a5,32
add a0,a0,a5
ret

This is testsuite clean.

gcc/ChangeLog:

* config/riscv/riscv.cc (riscv_split_integer): if loval is equal
to hival, ASHIFT the corresponding regs.

Signed-off-by: Vineet Gupta <vineetg@rivosinc.com>
gcc/config/riscv/riscv.cc
This page took 0.052028 seconds and 5 git commands to generate.