https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57492

--- Comment #7 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Soumya AR <soum...@gcc.gnu.org>:

https://gcc.gnu.org/g:5a674367c6da870184f3bdb7ec110b96aa91bb2b

commit r15-5201-g5a674367c6da870184f3bdb7ec110b96aa91bb2b
Author: Soumya AR <soum...@nvidia.com>
Date:   Wed Nov 13 15:41:15 2024 +0530

    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 <soum...@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.

Reply via email to