diff options
author | Jennifer Schmitz <jschmitz@nvidia.com> | 2024-10-17 08:40:34 -0700 |
---|---|---|
committer | Jennifer Schmitz <jschmitz@nvidia.com> | 2024-10-25 15:56:41 +0200 |
commit | 07a8538d90763f0ae640dea822bdeb63ea17ec44 (patch) | |
tree | d145b1a67d709f6d2935e6b4eb808444929223b1 /libatomic | |
parent | df4af89bc3eabbeaccb16539aa1082cb9863e187 (diff) | |
download | gcc-07a8538d90763f0ae640dea822bdeb63ea17ec44.zip gcc-07a8538d90763f0ae640dea822bdeb63ea17ec44.tar.gz gcc-07a8538d90763f0ae640dea822bdeb63ea17ec44.tar.bz2 |
match.pd: Add std::pow folding optimizations.
This patch adds the following two simplifications in match.pd for
POW_ALL and POWI:
- pow (1.0/x, y) to pow (x, -y), avoiding the division
- pow (0.0, x) to 0.0, avoiding the call to pow.
The patterns are guarded by flag_unsafe_math_optimizations,
!flag_trapping_math, and !HONOR_INFINITIES.
The POW_ALL patterns are also gated under !flag_errno_math.
The second pattern is also guarded by !HONOR_NANS and
!HONOR_SIGNED_ZEROS.
Tests were added to confirm the application of the transform for
builtins pow, powf, powl, powi, powif, powil, and powf16.
The patch was bootstrapped and regtested on aarch64-linux-gnu and
x86_64-linux-gnu, no regression.
OK for mainline?
Signed-off-by: Jennifer Schmitz <jschmitz@nvidia.com>
gcc/
* match.pd: Fold pow (1.0/x, y) -> pow (x, -y) and
pow (0.0, x) -> 0.0.
gcc/testsuite/
* gcc.dg/tree-ssa/pow_fold_1.c: New test.
Diffstat (limited to 'libatomic')
0 files changed, 0 insertions, 0 deletions