aboutsummaryrefslogtreecommitdiff
path: root/gcc/doc
diff options
context:
space:
mode:
authorTamar Christina <tamar.christina@arm.com>2024-01-10 17:18:28 +0000
committerTamar Christina <tamar.christina@arm.com>2024-01-10 17:19:02 +0000
commit7cbe41d35e6a60776484e04e42e408de9fc82954 (patch)
tree6f1e9e741abf6ef8815b0405b30c8d24681d5e70 /gcc/doc
parent113475d03b0ab1ab18a509e8e5844c1a43983b24 (diff)
downloadgcc-7cbe41d35e6a60776484e04e42e408de9fc82954.zip
gcc-7cbe41d35e6a60776484e04e42e408de9fc82954.tar.gz
gcc-7cbe41d35e6a60776484e04e42e408de9fc82954.tar.bz2
middle-end: Don't apply copysign optimization if target does not implement optab [PR112468]
Currently GCC does not treat IFN_COPYSIGN the same as the copysign tree expr. The latter has a libcall fallback and the IFN can only do optabs. Because of this the change I made to optimize copysign only works if the target has impemented the optab, but it should work for those that have the libcall too. More annoyingly if a target has vector versions of ABS and NEG but not COPYSIGN then the change made them lose vectorization. The proper fix for this is to treat the IFN the same as the tree EXPR and to enhance expand_COPYSIGN to also support vector calls. I have such a patch for GCC 15 but it's quite big and too invasive for stage-4. As such this is a minimal fix, just don't apply the transformation and leave targets which don't have the optab unoptimized. Targets list for check_effective_target_ifn_copysign was gotten by grepping for copysign and looking at the optab. gcc/ChangeLog: PR tree-optimization/112468 * doc/sourcebuild.texi: Document ifn_copysign. * match.pd: Only apply transformation if target supports the IFN. gcc/testsuite/ChangeLog: PR tree-optimization/112468 * gcc.dg/fold-copysign-1.c: Modify tests based on if target supports IFN_COPYSIGN. * gcc.dg/pr55152-2.c: Likewise. * gcc.dg/tree-ssa/abs-4.c: Likewise. * gcc.dg/tree-ssa/backprop-6.c: Likewise. * gcc.dg/tree-ssa/copy-sign-2.c: Likewise. * gcc.dg/tree-ssa/mult-abs-2.c: Likewise. * lib/target-supports.exp (check_effective_target_ifn_copysign): New.
Diffstat (limited to 'gcc/doc')
-rw-r--r--gcc/doc/sourcebuild.texi4
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi
index 3a394e7..2a96927 100644
--- a/gcc/doc/sourcebuild.texi
+++ b/gcc/doc/sourcebuild.texi
@@ -2681,6 +2681,10 @@ Target requires a command line argument to enable a SIMD instruction set.
@item xorsign
Target supports the xorsign optab expansion.
+@item ifn_copysign
+Target supports the copysign optab expansion of float and double for
+both scalar and vector modes.
+
@end table
@subsubsection Environment attributes