How can I use AVX instructions in D inline asm?

John via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Sep 11 10:17:15 PDT 2014


Hi.

Now I try to use SSE/AVX instructions in D inline asm.

I have a trouble about this.

In http://dlang.org/iasm.html ,
AVX seems to be supported according to SIMD section in the paeg.
But there is no AVX opcodes, like vaddps, in Opcodes section in
the page.

So I have assumed addps can be used as vaddps with AVX registers,
and I compile the following three code.

//1
asm
{
      addps XMM0, XMM1;
}

//2
asm
{
      addps YMM0, YMM1;
}

//3
asm
{
      vaddps YMM0, YMM1;
}

1 - OK
2 - undefined identifier YMMx (??? I expect OK or invalid
operands.)
3 - unkown opcode 'vaddps'(reasonable)

I have used ldc2 with llvm 3.5 and the compile following command.

ldc2 test.d -m64 -mcpu=core-avx2

My CPU supports AVX too.

Please point out what's wrong.

Thank you.


More information about the Digitalmars-d-learn mailing list