View source code
Display the source code in core/simd.d from which this page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using local clone.

core.simd.simd - multiple declarations

Function simd

Generate two operand instruction with XMM 128 bit operands.

V1 simd(XMM opcode, V1, V2) (
  V1 op1,
  V2 op2
) pure @safe
if (is(V1 == __vector) && is(V2 == __vector));

This is a compiler magic function - it doesn't behave like regular D functions.

Parameters

opcode = any of the XMM opcodes; it must be a compile time constant op1 = first operand op2 = second operand

Returns

result of opcode

Example

float4 a;
a = simd!(XMM.PXOR)(a, a);

Function simd

Unary SIMD instructions.

V1 simd(XMM opcode, V1) (
  V1 op1
) pure @safe
if (is(V1 == __vector));

Function simd

V1 simd(XMM opcode, V1) (
  double d
) pure @safe
if (is(V1 == __vector));

Function simd

V1 simd(XMM opcode, V1) (
  float f
) pure @safe
if (is(V1 == __vector));

Example

float4 a;
a = simd!(XMM.LODSS)(a);

Function simd

For instructions: CMPPD, CMPSS, CMPSD, CMPPS, PSHUFD, PSHUFHW, PSHUFLW, BLENDPD, BLENDPS, DPPD, DPPS, MPSADBW, PBLENDW, ROUNDPD, ROUNDPS, ROUNDSD, ROUNDSS

V1 simd(XMM opcode, ubyte imm8, V1, V2) (
  V1 op1,
  V2 op2
) pure @safe
if (is(V1 == __vector) && is(V2 == __vector));

Parameters

opcode = any of the above XMM opcodes; it must be a compile time constant op1 = first operand op2 = second operand imm8 = third operand; must be a compile time constant

Returns

result of opcode

Example

float4 a;
a = simd!(XMM.CMPPD, 0x7A)(a, a);

Function simd

For instructions with the imm8 version: PSLLD, PSLLQ, PSLLW, PSRAD, PSRAW, PSRLD, PSRLQ, PSRLW, PSRLDQ, PSLLDQ

V1 simd(XMM opcode, ubyte imm8, V1) (
  V1 op1
) pure @safe
if (is(V1 == __vector));

Parameters

opcode = any of the XMM opcodes; it must be a compile time constant op1 = first operand imm8 = second operand; must be a compile time constant

Returns

result of opcode

Example

float4 a;
a = simd!(XMM.PSRLQ, 0x7A)(a);

Function simd

Generate two operand instruction with XMM 128 bit operands.

V1 simd(XMM opcode, V1, V2) (
  V1 op1,
  V2 op2
) pure @safe
if (is(V1 == __vector) && is(V2 == __vector));

This is a compiler magic function - it doesn't behave like regular D functions.

Parameters

opcode = any of the XMM opcodes; it must be a compile time constant op1 = first operand op2 = second operand

Returns

result of opcode

Example

float4 a;
a = simd!(XMM.PXOR)(a, a);

Function simd

Unary SIMD instructions.

V1 simd(XMM opcode, V1) (
  V1 op1
) pure @safe
if (is(V1 == __vector));

Function simd

V1 simd(XMM opcode, V1) (
  double d
) pure @safe
if (is(V1 == __vector));

Function simd

V1 simd(XMM opcode, V1) (
  float f
) pure @safe
if (is(V1 == __vector));

Example

float4 a;
a = simd!(XMM.LODSS)(a);

Function simd

For instructions: CMPPD, CMPSS, CMPSD, CMPPS, PSHUFD, PSHUFHW, PSHUFLW, BLENDPD, BLENDPS, DPPD, DPPS, MPSADBW, PBLENDW, ROUNDPD, ROUNDPS, ROUNDSD, ROUNDSS

V1 simd(XMM opcode, ubyte imm8, V1, V2) (
  V1 op1,
  V2 op2
) pure @safe
if (is(V1 == __vector) && is(V2 == __vector));

Parameters

opcode = any of the above XMM opcodes; it must be a compile time constant op1 = first operand op2 = second operand imm8 = third operand; must be a compile time constant

Returns

result of opcode

Example

float4 a;
a = simd!(XMM.CMPPD, 0x7A)(a, a);

Function simd

For instructions with the imm8 version: PSLLD, PSLLQ, PSLLW, PSRAD, PSRAW, PSRLD, PSRLQ, PSRLW, PSRLDQ, PSLLDQ

V1 simd(XMM opcode, ubyte imm8, V1) (
  V1 op1
) pure @safe
if (is(V1 == __vector));

Parameters

opcode = any of the XMM opcodes; it must be a compile time constant op1 = first operand imm8 = second operand; must be a compile time constant

Returns

result of opcode

Example

float4 a;
a = simd!(XMM.PSRLQ, 0x7A)(a);

Authors

Walter Bright,

License

Boost License 1.0.