]> git.ipfire.org Git - thirdparty/gcc.git/commit
LoongArch: Eliminate unnecessary dependencies introduced by xvpermi.q
authorGuo Jie <guojie@loongson.cn>
Sun, 2 Nov 2025 03:31:32 +0000 (11:31 +0800)
committerLulu Cheng <chenglulu@loongson.cn>
Mon, 3 Nov 2025 08:09:39 +0000 (16:09 +0800)
commitdddb16c8170d2a92f105817eb00cf04bfaf54bd5
tree6ea6f604fb440bb8a0731a9bfc9a5004f7331801
parent2ae8cb4201c2e1f7bd0d03a5ffe4fcc371ddc882
LoongArch: Eliminate unnecessary dependencies introduced by xvpermi.q

1. When the selector is 0x0, 0x1, 0x10, or 0x11, the result of
xvpermi.q does not depend on the output operand, thus eliminating
the dependency chain of the output operand as input, which can
reduce the number of instructions.

2. When the selector is 0x22, 0x23, 0x32, or 0x33, the result of
xvpermi.q does not depend on the second input operand, thus
eliminating the dependency chain of the second input operand,
which can also reduce the number of instructions.

gcc/ChangeLog:

* config/loongarch/lasx.md (lasx_xvpermi_q_<LASX:mode>):
Add new splitter for optimization.

gcc/testsuite/ChangeLog:

* gcc.target/loongarch/vec_pack_unpack_256.c: Adjust to changed
lasx_xvpermi_q_<LASX:mode> template.
* gcc.target/loongarch/vector/lasx/lasx-builtin.c: Ditto.
* gcc.target/loongarch/lasx-xvpermi_q-opt.c: New test.
gcc/config/loongarch/lasx.md
gcc/testsuite/gcc.target/loongarch/lasx-xvpermi_q-opt.c [new file with mode: 0644]
gcc/testsuite/gcc.target/loongarch/vec_pack_unpack_256.c
gcc/testsuite/gcc.target/loongarch/vector/lasx/lasx-builtin.c