diff options
author | Soumya AR <soumyaa@nvidia.com> | 2024-11-13 15:41:15 +0530 |
---|---|---|
committer | Soumya AR <soumyaa@nvidia.com> | 2024-11-13 15:42:16 +0530 |
commit | 5a674367c6da870184f3bdb7ec110b96aa91bb2b (patch) | |
tree | 3ee3e8897e1258031017435899025a44ed9237f7 /gcc/gimple.c | |
parent | f42f8dcf495e0a17df95a71c6a91093532cb9f3b (diff) | |
download | gcc-5a674367c6da870184f3bdb7ec110b96aa91bb2b.zip gcc-5a674367c6da870184f3bdb7ec110b96aa91bb2b.tar.gz gcc-5a674367c6da870184f3bdb7ec110b96aa91bb2b.tar.bz2 |
Match: Fold pow calls to ldexp when possible [PR57492]
This patch transforms the following POW calls to equivalent LDEXP calls, as
discussed in PR57492:
powi (powof2, i) -> ldexp (1.0, i * log2 (powof2))
powof2 * ldexp (x, i) -> ldexp (x, i + log2 (powof2))
a * ldexp(1., i) -> ldexp (a, i)
This is especially helpful for SVE architectures as LDEXP calls can be
implemented using the FSCALE instruction, as seen in the following patch:
https://gcc.gnu.org/g:9b2915d95d855333d4d8f66b71a75f653ee0d076
SPEC2017 was run with this patch, while there are no noticeable improvements,
there are no non-noise regressions either.
The patch was bootstrapped and regtested on aarch64-linux-gnu, no regression.
Signed-off-by: Soumya AR <soumyaa@nvidia.com>
gcc/ChangeLog:
PR target/57492
* match.pd: Added patterns to fold calls to pow to ldexp and optimize
specific ldexp calls.
gcc/testsuite/ChangeLog:
PR target/57492
* gcc.dg/tree-ssa/ldexp.c: New test.
* gcc.dg/tree-ssa/pow-to-ldexp.c: New test.
Diffstat (limited to 'gcc/gimple.c')
0 files changed, 0 insertions, 0 deletions