public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jvdelisle at gcc dot gnu dot org" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sources.redhat.com
Subject: [Bug math/5997] New: Very slow execution of sinf function
Date: Sat, 29 Mar 2008 21:18:00 -0000	[thread overview]
Message-ID: <20080329211738.5997.jvdelisle@gcc.gnu.org> (raw)

With this test case:

#include <stdio.h>
#include <math.h>

unsigned int ta;

main ()
{
  double result;
  for (ta = 1; ta <= 8000000; ta++)
    {
      result = sin(ta * 3.14159);
    }
  printf("result = \t%.13e\n", result);
}

Using sin vs sinf.

sin:

$ time ./a.out
result =        -6.9068092664138e-01

real    0m0.782s
user    0m0.778s
sys     0m0.004s

sinf:

$ time ./a.out
result =        -6.9068092107773e-01

real    0m8.622s
user    0m8.605s
sys     0m0.009s

The difference in assembly code (-S output):

44,47c44,47
< 	call	sin
< 	movsd	%xmm0, -40(%rbp)
< 	movq	-40(%rbp), %rax
< 	movq	%rax, -8(%rbp)
---
> 	cvtsd2ss	%xmm0, %xmm0
> 	call	sinf
> 	cvtss2sd	%xmm0, %xmm0
> 	movsd	%xmm0, -8(%rbp)

I don't think the conversion functions should account for this huge time
difference. Also with -m32 and sinf I get:

$ time ./a.out
result =        -6.9068092664141e-01

real    0m1.157s
user    0m0.765s
sys     0m0.002s

Which is more reasonable.

$ gcc -v
Using built-in specs.
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions
--enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk
--disable-dssi --enable-plugin
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre
--enable-libgcj-multifile --enable-java-maintainer-mode
--with-ecj-jar=/usr/share/java/eclipse-ecj.jar --with-cpu=generic
--host=x86_64-redhat-linux
Thread model: posix
gcc version 4.1.2 20070925 (Red Hat 4.1.2-33)

I am running latest Fedora 8

See also gfortran bug pr34128.

-- 
           Summary: Very slow execution of sinf function
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: math
        AssignedTo: aj at suse dot de
        ReportedBy: jvdelisle at gcc dot gnu dot org
                CC: glibc-bugs at sources dot redhat dot com
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-redhat-linux-gnu


http://sourceware.org/bugzilla/show_bug.cgi?id=5997

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


             reply	other threads:[~2008-03-29 21:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-29 21:18 jvdelisle at gcc dot gnu dot org [this message]
2008-03-29 22:13 ` [Bug math/5997] " fxcoudert at gcc dot gnu dot org
2008-03-30  0:10 ` jvdelisle at gcc dot gnu dot org
2008-07-14 13:45 ` grugh at centrum dot cz

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=20080329211738.5997.jvdelisle@gcc.gnu.org \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sources.redhat.com \
    /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).