On Saturday, 21 September 2019 at 12:50:46 UTC, Bogdan wrote:
I'm trying to understand how to use the `core.simd` functionality, and I'm having trouble initializing a float4 vector.

Here's my example code:

```
import std.stdio;
import core.simd;

void main()
{
  float[4] values = [1.0f, 2.0f, 3.0f, 4.0f];
  float delta = 15.0f;

  writeln(doSimd(values, delta));

}

float[4] doSimd(float[4] values, float delta)
{
  float4 v_delta = delta;
  float4 v_values = values;

  // ... do SIMD ...

  return [v_delta[0], v_delta[0],v_delta[0],v_delta[0]];
}
```

Compilation is failing with the following error:

```
source/app.d(16,21): Error: cannot implicitly convert expression values of type float[4] to __vector(float[4])
dmd failed with exit code 1.
```
How do you initialize a float4 with some useful data?

You should probably have a look at this...

https://github.com/AuburnSounds/intel-intrinsics


Reply via email to