This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/86829] New: Missing sin(atan(x)) and cos(atan(x)) optimizations


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86829

            Bug ID: 86829
           Summary: Missing sin(atan(x)) and cos(atan(x)) optimizations
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: giuliano.belinassi at usp dot br
  Target Milestone: ---

Created attachment 44486
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44486&action=edit
add sin(atan(x)) and cos(atan(x)) substitutions rules.

The file named 'match.pd' does not contain the following simplifications rules:
sin(atan(x)) -> x / sqrt(x*x + 1)  and  cos(atan(x)) -> 1 / sqrt(x*x + 1).
According to the simple brenchmark I made, these substitutions can provide  a
10x speedup in the code. I wrote a patch to add these optimizations.

link to the perf test: https://pastebin.com/5ujSRmhq

assembly dump of the perftest: https://pastebin.com/gLJeWHY8

The code I wrote add an instruction 'CVTSS2SD'. I don't know why it happens.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]