[FFmpeg-devel] -fsingle-precision-constant
Uoti Urpala
uoti.urpala
Thu May 13 19:53:27 CEST 2010
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
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. Using "1.2f" for the constant makes it
a constant of type "float" instead. Using '-fsingle-precision-constant'
turns all floating point constants into floats as if they had an 'f'
suffix.
More information about the ffmpeg-devel
mailing list