August 10, 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.

August 10, 2011
Peter Alexander:

> Can you do that in LDC? (I'm not familiar with it).

They can't do that, I think:

> I will do if/when I find time.

Good. This enhancement request asks for just closures, but listing general heap allocations too is possible:

Regarding your problem of the "static array initialisations", it will be eventually fixed, I presume. Don has said it's not too much hard to fix, and I think it's worth fixing.

Next ›   Last »
1 2
Top | Discussion index | About this forum | D home