lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


They are supported in Vis. C++ 7/Intel C++ by an integral simd 128 bit data
type.

You can then use "built-ins" to manipulate those 128 bit data types.  With a
bit cleverness and some C++ templates you can set up a vector class that
compiles to highly optimal machine code.  The Pentium natively holds the
vectors in pairs of special 64-bit registers and instructions operate on
them as though they are 4 element vectors.

I'm not sure what the cycle times are for the Pentium/SIMD however the
playstation 2 has single cycle 4x32-bit bit floating point instructions
(albeit with a bit of latency so you have to interleave your code a bit).
Their compiler also supports a 128 bit type and builtins that can be wrapped
in the same way as above.

I'm not *that* worried about the pure assembly level optimization of this
stuff though (or I wouldn't be looking to use an interpreted language like
Lua), I just think that if they are implemented as a table with the
associated lookup and conversion-to-C++ costs it could end up being the
biggest overhead of them all, especially considering their overhead in C++
with the above-mentioned template class is only a little more than an int.

Just ironing out problems before I get 2 years down the road and have to
re-write a ton of code ;-)

---------------------------------
Q-Games, Dylan Cuthbert.
http://www.q-games.com


"Richard Ranft" <rranft@lvcablemodem.com> wrote in message
CCEHJHPLIEKHBPLPLJPCMEHNDCAA.rranft@lvcablemodem.com">news:CCEHJHPLIEKHBPLPLJPCMEHNDCAA.rranft@lvcablemodem.com...
>
> >Modern cpus now have ints, floats *and* vectors as integral types.
>
> Unless they've changed that since MSVC++7 and the P4, vectors still fall
> into the derived composed type category.  Vectors in the sense of 3D
> positional data are not directly supported on the processor, which is what
> integral types represent (data types handled natively by the processor).
If
> you look at the reference info, you'll see that all Intel/IBM compatible
> processors/coprocessors handle ints and fixed/floats natively.  SIMD stuff
> allows the appearance of processing a vector in one bite (not byte) but it
> (should) only work if you are using a scalar (as was used in an example
> earlier - vector vec * 10, where each member of the vector is multiplied
by
> the value 10) - hence the acronym SIMD (Single Instruction, Multiple
Data).
>
> I could be mistaken...it's happened before.  :)
>
> Rich
>
>