[Issue 21673] [SIMD][Win64] Wrong codegen for _mm_move_ss

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Apr 11 09:14:02 UTC 2022


https://issues.dlang.org/show_bug.cgi?id=21673

Dennis <dkorpel at live.nl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dkorpel at live.nl
                 OS|Windows                     |All

--- Comment #2 from Dennis <dkorpel at live.nl> ---
The bug is in -O, not in -inline, because it persists when you manually inline:
```
void main()
{
    float4 A = [1.0f, 2.0f, 3.0f, 4.0f];
    float4 B = [5.0f, 6.0f, 7.0f, 8.0f];

    float4 a = A;
    float4 b = B;
    a.ptr[0] = b.array[0];
    float4 R = a;

    _mm_print_ps(A);
    _mm_print_ps(B);
    _mm_print_ps(R);
    float[4] correct = [5.0f, 2.0f, 3.0f, 4.0f];
    assert(R.array == correct);
}
```

Reduced a bit more:
```
import core.simd;
import core.stdc.stdio;

void main()
{
    float4 A = [1.0f, 2.0f, 3.0f, 4.0f];
    float4 B = [5.0f, 6.0f, 7.0f, 8.0f];

    A.ptr[0] = B.array[0];
    float4 R = A;
    _mm_print_ps(A);

    float[4] correct = [5.0f, 2.0f, 3.0f, 4.0f];
    assert(R.array == correct);
}

void _mm_print_ps(float4 v)
{
    float[4] C = (cast(float4)v).array;
    printf("%f %f %f %f\n", C[0], C[1], C[2], C[3]);
}
```
Prints
5.000000 0.000000 0.000000 0.000000
Instead of
5.000000 2.000000 3.000000 4.000000

I tested this on Linux, so it's not Windows specific.

--


More information about the Digitalmars-d-bugs mailing list