aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-if-conv.cc
diff options
context:
space:
mode:
authorSinan <sinan.lin@linux.alibaba.com>2022-11-28 12:41:17 -0700
committerJeff Law <jlaw@ventanamicro.com>2022-11-28 12:43:20 -0700
commit940d5b56990fdf171f49517ae102673817b9c869 (patch)
tree07b9435ef1f585358c1e8f4574ec2cd0c8757aaf /gcc/tree-if-conv.cc
parent868fc62791b6b0f10484cc6fa15f81911418e605 (diff)
downloadgcc-940d5b56990fdf171f49517ae102673817b9c869.zip
gcc-940d5b56990fdf171f49517ae102673817b9c869.tar.gz
gcc-940d5b56990fdf171f49517ae102673817b9c869.tar.bz2
riscv: improve cost model for loading 64bit constant in rv32
The motivation of this patch is to correct the wrong estimation of the number of instructions needed for loading a 64bit constant in rv32 in the current cost model(riscv_interger_cost). According to the current implementation, if a constant requires more than 3 instructions(riscv_const_insn and riscv_legitimate_constant_p), then the constant will be put into constant pool when expanding gimple to rtl(legitimate_constant_p hook and emit_move_insn). So the inaccurate cost model leads to the suboptimal codegen in rv32 and the wrong estimation part could be corrected through this fix. e.g. the current codegen for loading 0x839290001 in rv32 lui a5,%hi(.LC0) lw a0,%lo(.LC0)(a5) lw a1,%lo(.LC0+4)(a5) .LC0: .word 958988289 .word 8 output after this patch li a0,958988288 addi a0,a0,1 li a1,8 gcc/ChangeLog: * config/riscv/riscv.cc (riscv_build_integer): Improve some cases of loading 64bit constants for rv32. gcc/testsuite/ChangeLog: * gcc.target/riscv/rv32-load-64bit-constant.c: New test.
Diffstat (limited to 'gcc/tree-if-conv.cc')
0 files changed, 0 insertions, 0 deletions