LoongArch: Optimize vector constant extract-{even/odd} permutation.
commit6b226c2611f0ec01f2cc1319bc41af37518f2dfd
authorLi Wei <liwei@loongson.cn>
Tue, 28 Nov 2023 07:39:00 +0000 (28 15:39 +0800)
committerLulu Cheng <chenglulu@loongson.cn>
Sat, 2 Dec 2023 08:50:02 +0000 (2 16:50 +0800)
treee4b567d572ac474cf80c51581d9f0f2313d008cf
parenta68ae55883113c10320b164738eebadaf08df5b0
LoongArch: Optimize vector constant extract-{even/odd} permutation.

For vector constant extract-{even/odd} permutation replace the default
[x]vshuf instruction combination with [x]vilv{l/h} instruction, which
can reduce instructions and improves performance.

gcc/ChangeLog:

* config/loongarch/loongarch.cc (loongarch_is_odd_extraction):
Supplementary function prototype.
(loongarch_is_even_extraction): Adjust.
(loongarch_try_expand_lsx_vshuf_const): Adjust.
(loongarch_is_extraction_permutation): Adjust.
(loongarch_expand_vec_perm_const_2): Adjust.

gcc/testsuite/ChangeLog:

* gcc.target/loongarch/lasx-extract-even_odd-opt.c: New test.
gcc/config/loongarch/loongarch.cc
gcc/testsuite/gcc.target/loongarch/lasx-extract-even_odd-opt.c [new file with mode: 0644]