aboutsummaryrefslogtreecommitdiff
path: root/libgcc/fixed-bit.c
diff options
context:
space:
mode:
authorXi Ruoyao <xry111@xry111.site>2024-12-05 14:19:02 +0800
committerXi Ruoyao <xry111@xry111.site>2024-12-18 16:43:37 +0800
commit80491b0493ac1e2b0cdbdfc3eab8c5c5a390d77c (patch)
tree8591c50d92b9ced8b9f3422a56813b2fe3809d95 /libgcc/fixed-bit.c
parent5b5b517e819837e1950cd4d809cdc6efb8e80302 (diff)
downloadgcc-80491b0493ac1e2b0cdbdfc3eab8c5c5a390d77c.zip
gcc-80491b0493ac1e2b0cdbdfc3eab8c5c5a390d77c.tar.gz
gcc-80491b0493ac1e2b0cdbdfc3eab8c5c5a390d77c.tar.bz2
LoongArch: Combine xor and crc instructions
For a textbook-style CRC implementation: uint32_t crc = 0xffffffffu; for (size_t k = 0; k < len; k++) { crc ^= data[k]; for (int i = 0; i < 8 * sizeof (T); i++) if (crc & 1) crc = (crc >> 1) ^ poly; else crc >>= 1; } return crc; The generic code reports: Data and CRC are xor-ed before for loop. Initializing data with 0. resulting in: ld.bu $t1, $a0, 0 xor $t0, $t0, $t1 crc.w.b.w $t0, $zero, $t0 But it's just better to use ld.bu $t1, $a0, 0 crc.w.b.w $t0, $t1, $t0 instead. Implement this optimization now. gcc/ChangeLog: * config/loongarch/loongarch.md (*crc_combine): New define_insn_and_split.
Diffstat (limited to 'libgcc/fixed-bit.c')
0 files changed, 0 insertions, 0 deletions