[FFmpeg-devel] -fsingle-precision-constant
Michael Niedermayer
michaelni
Thu May 13 20:21:35 CEST 2010
On Thu, May 13, 2010 at 08:53:27PM +0300, Uoti Urpala wrote:
> On Thu, 2010-05-13 at 19:44 +0200, Michael Niedermayer wrote:
> > On Thu, May 13, 2010 at 01:31:07PM -0400, Ronald S. Bultje wrote:
> > > On Thu, May 13, 2010 at 1:13 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
> > > > when i looked at the asm gcc generates for mp3float i noticed it converts
> > > > floats to doubles all over the place.
> > > > Adding -fsingle-precision-constant makes the code a whole 10% faster overall
> > > > on core2
> > >
> > > What if you add "f" as a postfix to relevant constants? Or can you
> > > give examples of functions where this is an issue so we can be more
> > > helpful?
> >
> > all functions i guess
> >
> > like
> > float func(float f){
> > return f*1.2;
> > }
>
> Here "1.2" is a constant of type "double", and since one operand is a
sure
what pisses me off is that the compiler acts very unreasonable in practical
terms for an optimizing compiler.
floating point calculations are not exact theres no point to
convert every float that is multiplied by a constant to double before the
multiply and back to float afterwards. This just doesnt gain much, its
unreasonable and unexpected behavior.
> double the multiplication is also a multiplication at double precision.
> As 1.2 is not exactly representable it is not possible to optimize it to
> a float without losing precision.
floating point is inherently approximate, thus limiting optimizations to
being binary identical to some arbitrarily picked approximation is quite
silly besides gcc doesnt do this in other cases and i seriously doubt that
other compilers optimize floating point code so narrowly
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Thouse who are best at talking, realize last or never when they are wrong.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100513/d67d5cf9/attachment.pgp>
More information about the ffmpeg-devel
mailing list