[Mesa-dev] [PATCH 00/13] Avoid double promotion

Thomas Helland thomashelland90 at gmail.com
Tue Jul 14 04:32:40 PDT 2015

Hi Matt,

Just a small nitpick I noticed;
s/promition/promotion in the commit message.


2015-07-14 1:22 GMT+02:00 Matt Turner <mattst88 at gmail.com>:
> In the process of looking at the assembly generated from the OUT_BATCH
> series, I noticed a bunch of float <-> double round trips. Mostly this
> arises because unsuffixed floating-point literals are of type double,
> and (float op double) is a double operation in which the float is
> implicitly converted to double. This leads to some awful code for
> simple things like
>    float x;
>    ...
>    x += 1.0;
> x is converted to double, 1.0 is added, and then x is converted back to
> a float. :(
> Most of the series is just adding f/F to floating-point literals (I
> tried to use the suffix the surrounding code used) but there are also
> some changes like s/sin/sinf/.
> gcc has a warning flag (-Wdouble-promotion) that identifies places where
> floats are implicitly cast to doubles (that I only found after I found
> and fixed a bunch of things by looking at assembly) but it's not really
> useful in general because float arguments are always cast to double
> when passed as arguments to varargs functions like printf (why?), and
> it warns about that, generating a lot of noise.
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev

More information about the mesa-dev mailing list