match.pd: Enable bswap optimizations for bitreverse builtins.
Extends existing bswap optimizations in match.pd to also cover bitreverse builtins.
This commit expands the pattern matching rules to apply bswap optimizations to bitreverse builtins as well. This change enables the compiler to perform a wider range of optimizations on code using bit reversal operations, potentially improving performance on platforms where bit reversal can be implemented efficiently.
In Details
In GCC's match.pd, pattern matching rules define how certain code patterns are transformed into more efficient equivalents during compilation. This commit introduces a new define_operator_list called BITREVERSE, enabling a subset of existing BSWAP simplifications to be applied to __builtin_bitreverse* intrinsics. This impacts the target-independent optimization phases.
For Context
Compilers often recognize common code patterns and replace them with more efficient equivalents. This commit extends such pattern matching to bit-reversal operations, which are used in a variety of algorithms (e.g. FFTs, cryptographic hashing). By recognizing these operations, the compiler can generate faster code, especially on CPUs with dedicated bit-reversal instructions.