aboutsummaryrefslogtreecommitdiff
path: root/gcc/data-streamer.cc
diff options
context:
space:
mode:
authorXi Ruoyao <xry111@xry111.site>2023-04-02 21:37:49 +0800
committerXi Ruoyao <xry111@xry111.site>2023-04-18 14:37:10 +0800
commit603fc926fee69ab3c7169af8a9c0918611a75d92 (patch)
tree4d5eb8c67cb21a5522a8cc3f130b3961fae0014a /gcc/data-streamer.cc
parente722a1f42b28092c9f709a3f758fc4fe57db32b0 (diff)
downloadgcc-603fc926fee69ab3c7169af8a9c0918611a75d92.zip
gcc-603fc926fee69ab3c7169af8a9c0918611a75d92.tar.gz
gcc-603fc926fee69ab3c7169af8a9c0918611a75d92.tar.bz2
LoongArch: Optimize additions with immediates
1. Use addu16i.d for TARGET_64BIT and suitable immediates. 2. Split one addition with immediate into two addu16i.d or addi.{d/w} instructions if possible. This can avoid using a temp register w/o increase the count of instructions. Inspired by https://reviews.llvm.org/D143710 and https://reviews.llvm.org/D147222. Bootstrapped and regtested on loongarch64-linux-gnu. Ok for GCC 14? gcc/ChangeLog: * config/loongarch/loongarch-protos.h (loongarch_addu16i_imm12_operand_p): New function prototype. (loongarch_split_plus_constant): Likewise. * config/loongarch/loongarch.cc (loongarch_addu16i_imm12_operand_p): New function. (loongarch_split_plus_constant): Likewise. * config/loongarch/loongarch.h (ADDU16I_OPERAND): New macro. (DUAL_IMM12_OPERAND): Likewise. (DUAL_ADDU16I_OPERAND): Likewise. * config/loongarch/constraints.md (La, Lb, Lc, Ld, Le): New constraint. * config/loongarch/predicates.md (const_dual_imm12_operand): New predicate. (const_addu16i_operand): Likewise. (const_addu16i_imm12_di_operand): Likewise. (const_addu16i_imm12_si_operand): Likewise. (plus_di_operand): Likewise. (plus_si_operand): Likewise. (plus_si_extend_operand): Likewise. * config/loongarch/loongarch.md (add<mode>3): Convert to define_insn_and_split. Use plus_<mode>_operand predicate instead of arith_operand. Add alternatives for La, Lb, Lc, Ld, and Le constraints. (*addsi3_extended): Convert to define_insn_and_split. Use plus_si_extend_operand instead of arith_operand. Add alternatives for La and Le alternatives. gcc/testsuite/ChangeLog: * gcc.target/loongarch/add-const.c: New test. * gcc.target/loongarch/stack-check-cfa-1.c: Adjust for stack frame size change. * gcc.target/loongarch/stack-check-cfa-2.c: Likewise.
Diffstat (limited to 'gcc/data-streamer.cc')
0 files changed, 0 insertions, 0 deletions