[MPlayer-dev-eng] lrintf detection patch

Joerg Sonnenberger joerg at britannica.bec.de
Fri May 20 22:54:53 CEST 2005


On Fri, May 20, 2005 at 04:42:32PM -0400, Rich Felker wrote:
> On Fri, May 20, 2005 at 09:50:15PM +0200, Joerg Sonnenberger wrote:
> > Hi all,
> > the default CFLAGS settings include -ffast-math and GCC 3.4.3 therefore
> > optimizes the lrintf call in the test away, effectively turning it into
> > a NOP. The attached patch forces -ffast-math of for this test.
> 
> IMO a compiler could still optimize it away with intrinsics. :(

Yeah, even if it's not supposed to.

> Try something like:
> 
> int main(void) { long (*foo)(double); foo = lrintf; (void)foo(); return 0; }

Slightly better version attached.

Joerg
-------------- next part --------------
--- configure.orig	2005-04-13 13:46:35.000000000 +0200
+++ configure	2005-05-20 22:53:27.000000000 +0200
@@ -2382,7 +2383,7 @@
 echocheck "lrintf"
 cat > $TMPC << EOF
 #include <math.h>
-int main(void) { (void) lrintf(0.0); return 0; }
+int main(void) { long (*foo)(double); foo = lrintf; (void)(*foo)(0.0); return 0; }
 EOF
 _lrintf=no
 cc_check $_ld_lm && _lrintf=yes


More information about the MPlayer-dev-eng mailing list