https://issues.dlang.org/show_bug.cgi?id=15873
Walter Bright <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |[email protected] --- Comment #1 from Walter Bright <[email protected]> --- For DMD, the minimum SIMD level can be ascertained by: 1. the operating system - for example, OSX is only sold on certain CPUs and above. Also, Linux assumes SIMD in the default behavior of gcc. 2. 32 or 64 bit code being generated The DMD compiler assumes the existence of that minimum SIMD level, and generates SIMD code accordingly. The SIMD capabilities can be tested at runtime: http://dlang.org/phobos/core_cpuid.html This is used, for example, here: https://github.com/D-Programming-Language/druntime/blob/master/src/rt/arraydouble.d#L33 The idea is to use a template to statically generated code for each supported SIMD level. Then, test the capabilities at a high level, and select the right branch at the high level. Then each level's implementation runs at full speed with custom code for that level. --
