Any usable SIMD implementation?

Marco Leise via Digitalmars-d digitalmars-d at puremagic.com
Wed Apr 13 05:47:27 PDT 2016


Am Wed, 13 Apr 2016 04:14:48 -0700
schrieb Walter Bright <newshound2 at digitalmars.com>:

> On 4/13/2016 3:58 AM, Marco Leise wrote:
> > How about this style as an alternative?:
> >
> > immutable bool mmx;
> > immutable bool hasPopcnt;
> >
> > shared static this()
> > {
> >      import gcc.builtins;
> >      mmx       = __builtin_cpu_supports("mmx"   ) > 0;
> >      hasPopcnt = __builtin_cpu_supports("popcnt") > 0;
> > }
> >  
> 
> Please do not invent an alternative interface, use the one in core.cpuid:
> 
>     http://dlang.org/phobos/core_cpuid.html#.mmx

Yes, they are all @property and a substitution with direct
access to the globals will work around GDC's lack of
cross-module inlining. Otherwise these feature checks which
might be used in hot code, are more costly than they should be.
I hate when things get in the way of efficiency. :)

-- 
Marco



More information about the Digitalmars-d mailing list