|
![](/i/fill.gif) |
Warp <war### [at] tag povray org> wrote:
> Unless I'm mistaken, the way SSE works, it's a bit difficult to use it
> from portable C/C++ directly.
Not really.
> Any decent C/C++ compiler will be directly able to use the FPU with any
> floating point arithmetic you have written in your code. (Of course there's
> a lot of optimization that can be done in order to use the FPU stack more
> efficiently, but in principle making C/C++ code use the FPU is a relatively
> trivial thing for a compiler to do.)
(I'm not sure whether it will be so easy for the compiler to make good use of
the FSINCOS command.)
> However, using SSE efficiently is a lot more complicated. Unless I'm
> mistaken, unlike with the FPU, there's no direct C/C++ FP -> SSE algorithm
> which would work well in all cases. Modern compilers do already have SSE
> optimization support, but AFAIK it's rather limited.
It doesn't seem to be very difficult with software like POV-ray: The Intel C++
compiler keeps spitting out lots of "code was VECTORIZED" at me every time I
compile the POV source code. Which is the compiler's way to say that it
inserted an SSE2 instruction.
I actually read the compiler doc about *that* stuff, and it seems to vectorize
quite a lot when allowed to. All you have to do is perform suitable math
operations on arrays of numbers.
Basically, it seems that all that *looks* like some vector or matrix math is
actually vectorized by the compiler. And guess what: POV-ray has a lot of such
stuff :)
Post a reply to this message
|
![](/i/fill.gif) |