[cairo] Gradient mesh rasterizer

James Cloos cloos at jhcloos.com
Mon Jul 20 11:27:55 PDT 2009


>>>>> "Paolo" == Paolo Bonzini <paolo.bonzini at gmail.com> writes:

Paolo> On a new machine, however, they can use fisttp or cvttss2si.

Hmm.  Yes, the code generated by recent gcc's for recent march's does
look a lot better than what is seen at http://www.mega-nerd.com/FPcast/.
(Which is © 2001.)

Giving his fp_cast_test benchmark a run, I see that casting a double to
an integer is still slower on my laptop (-march=pentium3), but on my xens
(both are core2 Q6600; one with 32 bit kernels and the other with 64)
the casts are faster than all of the other code.

On an opteron 270 with gcc-4.2 the inline call to fistpl is still faster
than a cast.

So casting has definitely seen a radical speed improvement in the last
decade or so, at least for gcc on ia32/amd64 platforms.

And lrint(3) is slower than a cast on all gcc-3 and gcc-4 compiles
I just tested.

That said, the benchmark does not cover the technique cairo uses
in its _cairo_fixed_from_double macro.  It would probably be best
to use that macro rather than lrint(3) or casts.

-JimC
-- 
James Cloos <cloos at jhcloos.com>         OpenPGP: 1024D/ED7DAEA6


More information about the cairo mailing list