[Issue 23009] New: [CODEGEN][SIMD] SIMD + optimizations + inlining + double

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Apr 10 13:48:00 UTC 2022


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

          Issue ID: 23009
           Summary: [CODEGEN][SIMD] SIMD + optimizations + inlining +
                    double
           Product: D
           Version: D2
          Hardware: x86_64
                OS: All
            Status: NEW
          Severity: critical
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: aliloko at gmail.com

Consider the following program:


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

import core.simd;

alias __m128d = double2;

__m128d _mm_setr_pd (double e1, double e0) pure @trusted
{
    double2 result;
    result[0] = e1;
    result[1] = e0;
    return result;
}

__m128d _mm_loadl_pd (__m128d a, const(double)* mem_addr) pure @trusted
{
    a[0] = *mem_addr;
    return a;
}

void main(string[] args)
{    
     double A = 7.0;
    __m128d B = _mm_setr_pd(4.0, -5.0);
    __m128d R = _mm_loadl_pd(B, &A);
    double[2] correct = [ 7.0, -5.0 ];
    assert(R.array == correct);
}

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


With DMD 2.099.1, build with:

  dmd -m64 -inline -O main.d

It doesn't pass the assert. But it does pass if you omit -inline, or -O, or use
another compiler.

--


More information about the Digitalmars-d-bugs mailing list