Any usable SIMD implementation?
Johannes Pfau via Digitalmars-d
digitalmars-d at puremagic.com
Thu Apr 7 04:25:47 PDT 2016
Am Thu, 07 Apr 2016 10:52:42 +0000
schrieb Kai Nacke <kai at redstar.de>:
> On Thursday, 7 April 2016 at 03:27:31 UTC, Walter Bright wrote:
> > Then,
> >
> > void app(int simd)() { ... my fabulous app ... }
> >
> > int main() {
> > auto fpu = core.cpuid.getfpu();
> > switch (fpu) {
> > case SIMD: app!(SIMD)(); break;
> > case SIMD4: app!(SIMD4)(); break;
> > default: error("unsupported FPU"); exit(1);
> > }
> > }
> >
>
> glibc has a special mechanism for resolving the called function
> during loading. See the section on the GNU Indirect Function
> Mechanism here:
> https://www.ibm.com/developerworks/community/wikis/home?lang=en#!/wiki/W51a7ffcf4dfd_4b40_9d82_446ebc23c550/page/Optimized%20Libraries
>
> Would be awesome to have something similar in druntime/Phobos.
>
> Regards,
> Kai
Available in GCC as the 'ifunc' attribute:
https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#Common-Function-Attributes
What do you mean by 'something similar in druntime/phobos'? A platform
independent (slightly slower) variant?:
http://dpaste.dzfl.pl/0aa81325a26a
More information about the Digitalmars-d
mailing list