]> git.ipfire.org Git - thirdparty/gcc.git/commit
LoongArch: Optimize the loading of immediate numbers with the same high and low 32...
authorGuo Jie <guojie@loongson.cn>
Thu, 23 Nov 2023 03:04:17 +0000 (11:04 +0800)
committerLulu Cheng <chenglulu@loongson.cn>
Mon, 27 Nov 2023 02:47:36 +0000 (10:47 +0800)
commit96577dfae97e49a052c0b4d9843fb10f89632fd9
tree77ba052d5ad94a4bd471b931516b1b7c07742387
parentdf8dfd78379c33f788535a7813f07677d53966bf
LoongArch: Optimize the loading of immediate numbers with the same high and low 32-bit values

For the following immediate load operation in gcc/testsuite/gcc.target/loongarch/imm-load1.c:

long long r = 0x0101010101010101;

Before this patch:

lu12i.w     $r15,16842752>>12
ori     $r15,$r15,257
lu32i.d     $r15,0x1010100000000>>32
lu52i.d     $r15,$r15,0x100000000000000>>52

After this patch:

lu12i.w     $r15,16842752>>12
ori         $r15,$r15,257
bstrins.d   $r15,$r15,63,32

gcc/ChangeLog:

* config/loongarch/loongarch.cc
(enum loongarch_load_imm_method): Add new method.
(loongarch_build_integer): Add relevant implementations for
new method.
(loongarch_move_integer): Ditto.

gcc/testsuite/ChangeLog:

* gcc.target/loongarch/imm-load1.c: Change old check.
gcc/config/loongarch/loongarch.cc
gcc/testsuite/gcc.target/loongarch/imm-load1.c