I'm guessing No, but I want to here from the community because I'm not real experienced with this stuff. Is it possible to link with /etc/lib/libc.a (I'm on Linux x64) with DMD?
My reason is, I'm trying to get hardware SSE intrinsics to work (beyond simple addition/subtraction/etc), so it would be great if I could just write:
// simdTest.d
import core.simd;
extern (C) float4 _mm_hadd_ps(float4 a, float4 b); // example
void main()
{
float4 a = [1, 2, 3, 4];
float4 b = [1, 1, 1, 1];
float4 c = _mm_hadd_ps(a, b);
}
and compile with:
dmd /usr/lib/libc.a simdTest.d
but I get all kinds of linking errors I don't know how to make sense of. Again, I'm guess there's something preventing me from doing this, but if not I'd like to know how to go about it.
Really all I need is to get vectors working. The above C function does exist (sorta) in core.simd, but I can't get it to work (not sure if bug, or something i'm doing wrong). Here's my simple code:
import core.simd;
void main()
{
void16 a, b;
void16 c = __simd(XMM.HADDPS, a, b);
}
but the compiler gives me an:
Internal error: e2ir.c 3817
when compiling it. Any ideas?
_mm_hadd_ps
is not a function that you can link with, it is an intrinsic. It can only be used with compilers that support that intrinsic, and DMD does not.
The compiler error is not your fault. Any Internal error
is a bug in the compiler and should be reported to the D bug database.