diff options
author | Soumya AR <soumyaa@nvidia.com> | 2024-11-12 09:26:24 +0530 |
---|---|---|
committer | Soumya AR <soumyaa@nvidia.com> | 2024-11-12 09:30:33 +0530 |
commit | e232dc3bb5c3e8f8a3749239135b7b859a204fc7 (patch) | |
tree | ecc252b98a270feeb90b1f19aee01497e1c39789 /gcc/tree-vectorizer.h | |
parent | 4b9bb1d687e77469b5926e89db3a34b32ed3194a (diff) | |
download | gcc-e232dc3bb5c3e8f8a3749239135b7b859a204fc7.zip gcc-e232dc3bb5c3e8f8a3749239135b7b859a204fc7.tar.gz gcc-e232dc3bb5c3e8f8a3749239135b7b859a204fc7.tar.bz2 |
Match: Optimize log (x) CMP CST and exp (x) CMP CST operations
This patch implements transformations for the following optimizations.
logN(x) CMP CST -> x CMP expN(CST)
expN(x) CMP CST -> x CMP logN(CST)
Where CMP expands to ge and le operations.
For example:
int
foo (float x)
{
return __builtin_logf (x) <= 0.0f;
}
can just be:
int
foo (float x)
{
return x <= 1.0f;
}
The patch was bootstrapped and regtested on aarch64-linux-gnu, no regression.
OK for mainline?
Signed-off-by: Soumya AR <soumyaa@nvidia.com>
gcc/ChangeLog:
* match.pd: Fold logN(x) CMP CST -> x CMP expN(CST)
and expN(x) CMP CST -> x CMP logN(CST)
gcc/testsuite/ChangeLog:
* gcc.dg/tree-ssa/log_exp.c: New test.
Diffstat (limited to 'gcc/tree-vectorizer.h')
0 files changed, 0 insertions, 0 deletions