How use ldc pragmas?

james.p.leblanc james.p.leblanc at
Fri Oct 1 19:23:06 UTC 2021


After experimenting with ldc's autovectorization of avx code, it 
appears there may
be counter-intuitiveness to the autovectorization (especially for 
complex numbers).
(My comment may be wrong, so any corrections are quite welcome).

Based on this, I wanted to investigate the use of ldc's pragma 
(as found in ldc2/import/gccbuiltins_x86.di).

However, getting the ball rolling is a bit difficult, as I have 
not found a
simple example showing the whole process.  What I have just now 

// my example.d
import std.stdio;
import ldc.intrinsics;

void main()

    float x;

    pragma(LDC_intrinsic, "llvm.sqrt.32")
    float sqrt(float);
I try to compile the above using:

ldc2 -mattr=+avx2 myexample.d -H 

But receive the following:
ldcint.d(11): Error: unrecognized `pragma(LDC_intrinsic)`

I get the feeling that I am really "lost in the woods" here, 
missing important aspects.

Are there any pointers this forum might have to help here?
(A very simple and complete example would be greatly appreciated!)


More information about the Digitalmars-d-learn mailing list