[AD] sincos pessimization

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


It turns out that the "optimization" in rotate.c that calls libc's sincos() 
instead of sin() and cos() under DJGPP is a pessimization at -O2 -ffast-math 
because the latter two functions are turned into builtin functions and 
emitted as "fcos" and "fsin", while the former is kept as a libcall.

Applied to mainline and branch.

-- 
Eric Botcazou
Index: src/rotate.c
===================================================================
RCS file: /cvsroot/alleg/allegro/src/rotate.c,v
retrieving revision 1.16
diff -u -p -r1.16 rotate.c
--- src/rotate.c	23 Oct 2003 08:19:18 -0000	1.16
+++ src/rotate.c	14 Dec 2003 15:22:32 -0000
@@ -718,15 +718,8 @@ void _rotate_scale_flip_coordinates(fixe
    if (angle >= 0x800000)
       angle -= 0x1000000;
 
-   #if (defined ALLEGRO_DJGPP) && (DJGPP >= 2) && (DJGPP_MINOR >= 3)
-      /* Faster way to obtain both sin and cos with one call under djgpp.
-	 Todo: Do other platforms support this? (not watcom, mingw or msvc)
-      */
-      sincos(&cos_angle, &sin_angle, angle * (AL_PI / (double)0x800000));
-   #else
-      cos_angle = cos(angle * (AL_PI / (double)0x800000));
-      sin_angle = sin(angle * (AL_PI / (double)0x800000));
-   #endif
+   cos_angle = cos(angle * (AL_PI / (double)0x800000));
+   sin_angle = sin(angle * (AL_PI / (double)0x800000));
 
    if (cos_angle >= 0)
       fix_cos = (int)(cos_angle * 0x10000 + 0.5);


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/