]> git.ipfire.org Git - thirdparty/gcc.git/commit
LoongArch: Add bit reverse operations
authorXi Ruoyao <xry111@xry111.site>
Mon, 2 Dec 2024 02:53:27 +0000 (10:53 +0800)
committerXi Ruoyao <xry111@xry111.site>
Wed, 18 Dec 2024 08:43:37 +0000 (16:43 +0800)
commit13ea50fdac104b674eb484936023e20dec0b62cf
treed858e8f6045c6d5fb686e31cc3c34926f5a86048
parent8e47615f24b9fdebf14e270e6131cea6a67f1b04
LoongArch: Add bit reverse operations

LoongArch supports native bit reverse operation for QI, SI, DI, and for
HI we can expand it into a shift and a bit reverse in word_mode.

I was reluctant to add them because until PR50481 is fixed these
operations will be just useless.  But now it turns out we can use them
to optimize the bit reversing CRC calculation if recognized by the
generic CRC pass.  So add them in prepare for the next patch adding CRC
expanders.

gcc/ChangeLog:

* config/loongarch/loongarch.md (@rbit<mode:GPR>): New
define_insn template.
(rbitsi_extended): New define_insn.
(rbitqi): New define_insn.
(rbithi): New define_expand.
gcc/config/loongarch/loongarch.md