[Bug tree-optimization/86829] Missing sin(atan(x)) and cos(atan(x)) optimizations
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86829 Wilco changed: What|Removed |Added CC||wilco at gcc dot gnu.org --- Comment #8 from Wilco --- This has caused a regression, see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89437 and https://gcc.gnu.org/ml/gcc-patches/2019-02/msg01739.html
[Bug tree-optimization/86829] Missing sin(atan(x)) and cos(atan(x)) optimizations
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86829 Jeffrey A. Law changed: What|Removed |Added Status|NEW |RESOLVED CC||law at redhat dot com Resolution|--- |FIXED --- Comment #7 from Jeffrey A. Law --- Fixed by Giuliano's patch I've installed on the trunk.
[Bug tree-optimization/86829] Missing sin(atan(x)) and cos(atan(x)) optimizations
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86829 --- Comment #6 from Jeffrey A. Law --- Author: law Date: Thu Oct 11 21:06:12 2018 New Revision: 265064 URL: https://gcc.gnu.org/viewcvs?rev=265064&root=gcc&view=rev Log: PR tree-optimization/86829 * match.pd (sin (atan (x))): New simplification rules. (cos (atan (x))): Likewise. * real.c (build_sinatan_real): New function. * real.h (build_sinatan_real): Prototype. PR tree-optimization/86829 * gcc.dg/sinatan-1.c: New test. * gcc.dg/sinatan-2.c: New test. * gcc.dg/sinatan-3.c: New test. Added: trunk/gcc/testsuite/gcc.dg/sinatan-1.c trunk/gcc/testsuite/gcc.dg/sinatan-2.c trunk/gcc/testsuite/gcc.dg/sinatan-3.c Modified: trunk/gcc/ChangeLog trunk/gcc/match.pd trunk/gcc/real.c trunk/gcc/real.h trunk/gcc/testsuite/ChangeLog
[Bug tree-optimization/86829] Missing sin(atan(x)) and cos(atan(x)) optimizations
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86829 --- Comment #5 from Giuliano Belinassi --- I filed the copyright assignment request and sent it to the assign at gnu dot org. The patch itself I sent to the patch e-mail listing with the subject "patch to bug #86829".
[Bug tree-optimization/86829] Missing sin(atan(x)) and cos(atan(x)) optimizations
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86829 Manuel López-Ibáñez changed: What|Removed |Added CC||manu at gcc dot gnu.org --- Comment #4 from Manuel López-Ibáñez --- (In reply to Giuliano Belinassi from comment #3) > (In reply to Marc Glisse from comment #1) > > > > Do you have a copyright assignment (https://gcc.gnu.org/contribute.html) ? > > No. Sorry, but I think I may need help getting this right. Are there any > tips? https://gcc.gnu.org/wiki/GettingStarted#Basics:_Contributing_to_GCC_in_10_easy_steps
[Bug tree-optimization/86829] Missing sin(atan(x)) and cos(atan(x)) optimizations
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86829 --- Comment #3 from Giuliano Belinassi --- (In reply to Marc Glisse from comment #1) > > Do you have a copyright assignment (https://gcc.gnu.org/contribute.html) ? No. Sorry, but I think I may need help getting this right. Are there any tips? (In reply to Richard Biener from comment #2) > likely happens because you use float_type_node instead of 'type' for > build_one_cst. I think that if the atan intermediate result has additional > uses then the substitution may not be beneficial? Thus you should > write (atans:s @0) in both places. > > Otherwise this looks OK. Can you please post the patch to gcc-patches > and add testcases? I will fix these issues and add some test cases. I appreciate your help!
[Bug tree-optimization/86829] Missing sin(atan(x)) and cos(atan(x)) optimizations
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86829 Richard Biener changed: What|Removed |Added Keywords||missed-optimization, patch Status|UNCONFIRMED |NEW Last reconfirmed||2018-08-02 CC||rguenth at gcc dot gnu.org Version|unknown |9.0 Ever confirmed|0 |1 --- Comment #2 from Richard Biener --- + /* Simplify sin(atan(x)) -> x / sqrt(x*x + 1). */ + (for sins (SIN) + atans (ATAN) + sqrts (SQRT) + (simplify + (sins (atans @0)) + (rdiv @0 ( sqrts (plus (mult @0 @0) + { build_one_cst (float_type_node);}) + + + /* Simplify cos(atan(x)) -> 1 / sqrt(x*x + 1). */ + (for coss (COS) + atans (ATAN) + sqrts (SQRT) + (simplify + (coss (atans @0)) + (rdiv { build_one_cst (float_type_node);} + ( sqrts (plus (mult @0 @0) { build_one_cst (float_type_node);}) likely happens because you use float_type_node instead of 'type' for build_one_cst. I think that if the atan intermediate result has additional uses then the substitution may not be beneficial? Thus you should write (atans:s @0) in both places. Otherwise this looks OK. Can you please post the patch to gcc-patches and add testcases?
[Bug tree-optimization/86829] Missing sin(atan(x)) and cos(atan(x)) optimizations
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86829 --- Comment #1 from Marc Glisse --- You shouldn't use float_type_node directly, since the operations might be on double or long double. Do you have a copyright assignment (https://gcc.gnu.org/contribute.html) ?