[PATCH take #3] match.pd: Simplify popcount/parity of bswap/rotate.
Roger Sayle
roger@nextmovesoftware.com
Wed May 10 14:46:10 GMT 2023
This is the latest iteration of my patch from August 2020
https://gcc.gnu.org/pipermail/gcc-patches/2020-August/552391.html
incorporating feedback and suggestions from reviewers.
This patch to match.pd optimizes away bit permutation operations,
specifically bswap and rotate, in calls to popcount and parity.
This patch has been tested on x86_64-pc-linux-gnu with make bootstrap
and make -k check, both with and without --target_board=unix{-m32}
with no new failures. Ok for mainline?
2023-05-10 Roger Sayle <roger@nextmovesoftware.com>
gcc/ChangeLog
* match.pd <popcount optimizations>: Simplify popcount(bswap(x))
as popcount(x). Simplify popcount(rotate(x,y)) as popcount(x).
<parity optimizations>: Simplify parity(bswap(x)) as parity(x).
Simplify parity(rotate(x,y)) as parity(x).
gcc/testsuite/ChangeLog
* gcc.dg/fold-parity-6.c: New test.
* gcc.dg/fold-parity-7.c: New test.
* gcc.dg/fold-popcount-6.c: New test.
* gcc.dg/fold-popcount-7.c: New test.
Thanks again,
Roger
--
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patcha.txt
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20230510/c35ad513/attachment.txt>
More information about the Gcc-patches
mailing list