diff options
author | Tamar Christina <tamar.christina@arm.com> | 2023-11-09 13:59:39 +0000 |
---|---|---|
committer | Tamar Christina <tamar.christina@arm.com> | 2023-11-09 14:06:06 +0000 |
commit | 3f176e1adc6bc9cc2c21222d776b51d9f43cb66b (patch) | |
tree | b29f87125d258d93421a09757f8c4802e4bc603f /libcpp/line-map.cc | |
parent | 2d44ab221f64f01fc676be0da1a6774740d713c6 (diff) | |
download | gcc-3f176e1adc6bc9cc2c21222d776b51d9f43cb66b.zip gcc-3f176e1adc6bc9cc2c21222d776b51d9f43cb66b.tar.gz gcc-3f176e1adc6bc9cc2c21222d776b51d9f43cb66b.tar.bz2 |
middle-end: optimize fneg (fabs (x)) to copysign (x, -1) [PR109154]
This patch transforms fneg (fabs (x)) into copysign (x, -1) which is more
canonical and allows a target to expand this sequence efficiently. Such
sequences are common in scientific code working with gradients.
There is an existing canonicalization of copysign (x, -1) to fneg (fabs (x))
which I remove since this is a less efficient form. The testsuite is also
updated in light of this.
gcc/ChangeLog:
PR tree-optimization/109154
* match.pd: Add new neg+abs rule, remove inverse copysign rule.
gcc/testsuite/ChangeLog:
PR tree-optimization/109154
* gcc.dg/fold-copysign-1.c: Updated.
* gcc.dg/pr55152-2.c: Updated.
* gcc.dg/tree-ssa/abs-4.c: Updated.
* gcc.dg/tree-ssa/backprop-6.c: Updated.
* gcc.dg/tree-ssa/copy-sign-2.c: Updated.
* gcc.dg/tree-ssa/mult-abs-2.c: Updated.
* gcc.target/aarch64/fneg-abs_1.c: New test.
* gcc.target/aarch64/fneg-abs_2.c: New test.
* gcc.target/aarch64/fneg-abs_3.c: New test.
* gcc.target/aarch64/fneg-abs_4.c: New test.
* gcc.target/aarch64/sve/fneg-abs_1.c: New test.
* gcc.target/aarch64/sve/fneg-abs_2.c: New test.
* gcc.target/aarch64/sve/fneg-abs_3.c: New test.
* gcc.target/aarch64/sve/fneg-abs_4.c: New test.
Diffstat (limited to 'libcpp/line-map.cc')
0 files changed, 0 insertions, 0 deletions