PSP emulator written in D

Peter Alexander peter.alexander.au at gmail.com
Wed Aug 10 10:47:28 PDT 2011


On 10/08/11 12:21 PM, bearophile wrote:
> A 2D/3D/4D vector is good to have in Phobos. (Quaternion are optional).

Quaternions are important for fast 3D rotations, but yes, vectors are 
most important.


>> SIMD intrinsics are obviously essential for AAA development.<
>
> The problem is they change as time goes. So instead of adding a ton of those (ugly) intrinsics, I suggest to add a meta-feature to D: a syntax to write inlin-able asm expressions (as present in LDC). With this syntax, SIMD intrinsics become library (even Phobos) code to standardize.

The problem with that approach is that the compiler doesn't know about 
them and will likely have trouble optimising. GCC will optimise SIMD 
intrinsic math in the same way that it optimises scalar math.

Also, unless I'm mistaken, you can't use inline assembly to define a 
vector type whose storage is an xmm register. In GCC, you'd do

typedef __m128 Vec4;

or at least

struct Vec4 { __m128 m_xyzw; };

This ensures that when you return them or pass them into a function then 
they are passed in registers and don't have to go through memory. Can 
you do that in LDC? (I'm not familiar with it).


>> I had to modify my druntime to print out when allocations where happening to find them (most were those static array initialisations that I often talk about).<
>
> This is useful. Why don't you create a patch that (when a specific compiler switch is on) lists at compile-time all heap allocations and closure allocations of a compilation unit?

I will do if/when I find time.



More information about the Digitalmars-d mailing list