在 2024/12/16 下午9:19, Xi Ruoyao 写道:
A generic CRC optimization pass has been implemented in r15-5850. But without target-specific code, it'll only optimize the CRC loop to a table lookup. With LoongArch-specific code we can do it better: for 64-bit LoongArch and the IEEE 802.3 polynomial or the Castagnoli polynomial, we can directly invoke the hardware instruction; even if a hardware instruction isn't available, we can still use LoongArch bit reversion instructions to optimize the bit reverse before looking up the table.
I think the implementation is neat and I have no problem with it. Thanks!
Xi Ruoyao (5): LoongArch: Remove QHSD and use QHWD instead LoongArch: Add bit reverse operations LoongArch: Add CRC expander to generate faster CRC LoongArch: Combine xor and crc instructions LoongArch: Add crc tests gcc/config/loongarch/loongarch.md | 138 +++++++++++++++++- gcc/testsuite/g++.target/loongarch/crc-scan.C | 13 ++ gcc/testsuite/g++.target/loongarch/crc.C | 113 ++++++++++++++ 3 files changed, 261 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/g++.target/loongarch/crc-scan.C create mode 100644 gcc/testsuite/g++.target/loongarch/crc.C