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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Mar 2 00:19:50 UTC 2021


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

          Issue ID: 21673
           Summary: [SIMD][Win64] Wrong codegen for _mm_move_ss
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: aliloko at gmail.com

Consider the following program:

--------------- repro.d ------------------


import core.simd;
import core.stdc.stdio;

float4 _mm_move_ss (float4 a, float4 b)
{
    a.ptr[0] = b.array[0];
    return a;
}

void main()
{
    float4 A = [1.0f, 2.0f, 3.0f, 4.0f];
    float4 B = [5.0f, 6.0f, 7.0f, 8.0f];
    float4 R = _mm_move_ss(A, B);
    _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);
}

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]);
}

------------------------------------------



# With LDC, it prints:

----
1.000000 2.000000 3.000000 4.000000
5.000000 6.000000 7.000000 8.000000
5.000000 0.000000 0.000000 0.000000
----

and the assertion pass.



# With DMD 2.096-b1 

With the following flags: dmd -m64 -O -inline repro.d the program displays:

----

1.000000 2.000000 3.000000 4.000000
5.000000 6.000000 7.000000 8.000000
5.000000 0.000000 0.000000 0.000000

core.exception.AssertError at repro.d(20): Assertion failure
----------------
0x00007FF6D6F612D2
0x00007FF6D6F611D2
0x00007FF6D6F62E43
0x00007FF6D6F62CBF
0x00007FF6D6F62DAB
0x00007FF6D6F62CBF
0x00007FF6D6F62BE6
0x00007FF6D6F61503
0x00007FF6D6F61202
0x00007FF6D6F8F438
0x00007FFDD8B07C24 in BaseThreadInitThunk
0x00007FFDDAA0D721 in RtlUserThreadStart
----


Also buggy back in dmd_2.088.1

--


More information about the Digitalmars-d-bugs mailing list