core.simd woes

F i L witte2008 at gmail.com
Tue Oct 9 11:54:34 PDT 2012


Manu wrote:
> std.simd already does have a mammoth mess of static if(arch & 
> compiler).
> The thing about std.simd is that it's designed to be portable, 
> so it
> doesn't make sense to expose the low-level sse intrinsics 
> directly there.

Well, that's not really what I was suggesting. I was saying maybe 
eventually matching the agnostic gdc builtins in a separate 
module:

     // core.builtins

     import core.simd;

     version (GNU)
       import gcc.builtins;

     void madd(ref float4 r, float4 a, float4 b)
     {
       version (X86_OR_X64)
       {
         version (DigitalMars)
         {
           r = __simd(XMM.PMADDWD, a, b);
         }
         else version (GNU)
         {
           __builtin_ia32_fmaddpd(r, a, b)
         }
       }
     }

then std.simd can just use a single function (madd) and forget 
about all the compiler-specific switches. This may be more work 
than it's worth and std.simd should just contain all the platform 
specific switches... idk, i'm just throwing out ideas.



More information about the Digitalmars-d mailing list