public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug math/5997] New: Very slow execution of sinf function
@ 2008-03-29 21:18 jvdelisle at gcc dot gnu dot org
  2008-03-29 22:13 ` [Bug math/5997] " fxcoudert at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2008-03-29 21:18 UTC (permalink / raw)
  To: glibc-bugs

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.


^ permalink raw reply	[flat|nested] 10+ messages in thread
[parent not found: <bug-5997-131@http.sourceware.org/bugzilla/>]

end of thread, other threads:[~2014-02-05 16:05 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-29 21:18 [Bug math/5997] New: Very slow execution of sinf function jvdelisle at gcc dot gnu dot org
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
     [not found] <bug-5997-131@http.sourceware.org/bugzilla/>
2012-02-29 20:23 ` jsm28 at gcc dot gnu.org
2012-06-22 17:30 ` liubov.dmitrieva at gmail dot com
2013-04-01 12:53 ` siddhesh at redhat dot com
2013-04-01 12:54 ` siddhesh at redhat dot com
2013-12-03 18:41 ` jsm28 at gcc dot gnu.org
2014-02-05 16:05 ` neleai at seznam dot cz

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).