]> git.ipfire.org Git - thirdparty/gcc.git/commit
LoongArch: Remove unneeded sign extension after crc/crcc instructions
authorXi Ruoyao <xry111@xry111.site>
Sun, 25 Feb 2024 12:44:34 +0000 (20:44 +0800)
committerXi Ruoyao <xry111@xry111.site>
Thu, 29 Feb 2024 06:48:18 +0000 (14:48 +0800)
commitaab1c5dcd23f014f39b127f74aecd04913945a7f
tree947c8edc3cebee9760d227ecc9f00d36fd456af2
parentc556ea076dcbfe2a3059dd0ad2e06a0b1d1fa89b
LoongArch: Remove unneeded sign extension after crc/crcc instructions

The specification of crc/crcc instructions is clear that the output is
sign-extended to GRLEN.  Add a define_insn to tell the compiler this
fact and allow it to remove the unneeded sign extension on crc/crcc
output.  As crc/crcc instructions are usually used in a tight loop,
this should produce a significant performance gain.

gcc/ChangeLog:

* config/loongarch/loongarch.md
(loongarch_<crc>_w_<size>_w_extended): New define_insn.

gcc/testsuite/ChangeLog:

* gcc.target/loongarch/crc-sext.c: New test;
gcc/config/loongarch/loongarch.md
gcc/testsuite/gcc.target/loongarch/crc-sext.c [new file with mode: 0644]