__restrict, architecture intrinsics vs asm, consoles, and other stuff
Benjamin Thaut
code at benjamin-thaut.de
Wed Sep 21 22:56:13 PDT 2011
Am 22.09.2011 02:38, schrieb Walter Bright:
>> nsightly vector classes in C++, but fortunately using vendor
>> specific compiler intrinsics usually leads to decent code
>> generation. I can currently imagine an equally ugly (possibly worse)
>> hardware vector library in D, if it's even possible. But perhaps
>> I've missed something here?
>
> Your C++ vector code should be amenable to translation to D, so that
> effort of yours isn't lost, except that it'd have to be in inline asm
> rather than intrinsics.
I recently tried that, and I couldn't do it because D has no way of
aligning structs on the stack. Manually allocating the neccessary
aligned memroy is also not always possible because it can not be done
for compiler temporary variables:
vec4 v1 = func1();
vec4 v2 = func2();
vec4 result = (v1 + v2) * 0.5f;
Even if I manually allocate v1,v2 and result, the temporary variable
that the compiler uses to compute the expression might be unaligned.
That is a total killer for SSE optimizations because you can not hide
them away.
Does DMC++ have __declspec(align(16)) support?
--
Kind Regards
Benjamin Thaut
More information about the Digitalmars-d
mailing list