public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "burnus at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/30038]  New: Call to sin(x), cos(x) should be transformed to sincos(x)
Date: Fri, 01 Dec 2006 10:06:00 -0000	[thread overview]
Message-ID: <bug-30038-13404@http.gcc.gnu.org/bugzilla/> (raw)

See also: http://gcc.gnu.org/ml/fortran/2006-12/msg00000.html

Tim Prince's analysis why ifort needs 8.77s and gfortran 12.16s for one
program:

"My copy of gfortran makes separate scalar calls to sin and cos, where ifort
makes a vector sincos call. 2 seconds to be gained there"

In the Fortran program below, a there is a call to the same argument with sin
and with cos. The resulting
  gfortran -msse3 -march=opteron -ffast-math -O3 -c -fdump-tree-optimized
shows
  pretmp.56 = __builtin_sinf (pretmp.80);
  pretmp.86 = __builtin_cosf (pretmp.80);
Using sincos should be faster.


Fortran program:

subroutine
test(number_of_sample_points,radius,coefficient,radius_of_curvature,spin_frequency,time,tmp)
  implicit none
  integer :: number_of_sample_points
  real, parameter   :: twopi = 6.28319
  integer :: n
  real :: radius(number_of_sample_points), coefficient, radius_of_curvature, &
          spin_frequency,time,tmp(2,number_of_sample_points)
  do n = 1, number_of_sample_points
    coefficient = (radius(n) / radius_of_curvature) * sin(twopi *            &
                                        spin_frequency * time)
    tmp(1,n) = coefficient
    coefficient = twopi * spin_frequency * (radius(n) /       &
                                     radius_of_curvature) * cos(twopi *      &
                                         spin_frequency * time)
    tmp(2,n) = coefficient
  end do
end subroutine


-- 
           Summary: Call to sin(x), cos(x) should be transformed to
                    sincos(x)
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30038


             reply	other threads:[~2006-12-01 10:06 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-01 10:06 burnus at gcc dot gnu dot org [this message]
2006-12-01 10:15 ` [Bug tree-optimization/30038] " ubizjak at gmail dot com
2006-12-01 10:57 ` bonzini at gnu dot org
2006-12-01 11:04 ` bonzini at gnu dot org
2006-12-01 16:01 ` rguenth at gcc dot gnu dot org
2006-12-01 16:03 ` rguenth at gcc dot gnu dot org
2006-12-01 18:05 ` burnus at gcc dot gnu dot org
2006-12-06  9:53 ` rguenth at gcc dot gnu dot org
2006-12-07 16:07 ` rguenth at gcc dot gnu dot org
2006-12-07 16:07 ` rguenth at gcc dot gnu dot org
2006-12-07 20:01 ` burnus at gcc dot gnu dot org
2006-12-07 20:19 ` dorit at il dot ibm dot com
2006-12-07 20:32 ` burnus at gcc dot gnu dot org
2006-12-07 20:36 ` burnus at gcc dot gnu dot org
2006-12-07 20:48 ` rguenth at gcc dot gnu dot org
2006-12-07 20:50 ` rguenth at gcc dot gnu dot org
2006-12-12 20:59 ` dorit at il dot ibm dot com
2006-12-17 23:19 ` burnus at gcc dot gnu dot org
2007-01-22 11:11 ` rguenth at gcc dot gnu dot org
2007-01-22 11:12 ` rguenth at gcc dot gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-30038-13404@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).