]> git.ipfire.org Git - thirdparty/gcc.git/commit
Use get_nonzero_bits to simplify trunc_div to exact_div
authorRichard Sandiford <richard.sandiford@arm.com>
Thu, 24 Oct 2024 13:22:31 +0000 (14:22 +0100)
committerRichard Sandiford <richard.sandiford@arm.com>
Thu, 24 Oct 2024 13:22:31 +0000 (14:22 +0100)
commite2e798b86074010a8d5da16ce0b199fcec70a50e
treef949a8fb5ca94812d1dded54ebbe591011ee9eb6
parent3e93828e601c62176ea2b4a1dd0b5a1db5657a8e
Use get_nonzero_bits to simplify trunc_div to exact_div

There are a limited number of existing rules that benefit from
knowing that a division is exact.  Later patches will add more.

gcc/
* match.pd: Simplify X / (1 << C) to X /[ex] (1 << C) if the
low C bits of X are clear

gcc/testsuite/
* gcc.dg/tree-ssa/cmpexactdiv-6.c: New test.
gcc/match.pd
gcc/testsuite/gcc.dg/tree-ssa/cmpexactdiv-6.c [new file with mode: 0644]