[Issue 23437] New: [CODEGEN][SIMD] Wrong codegen when inlining __simd(XMM.SQRTSS, a)

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Oct 25 21:47:49 UTC 2022


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

          Issue ID: 23437
           Summary: [CODEGEN][SIMD] Wrong codegen when inlining
                    __simd(XMM.SQRTSS, a)
           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

Please consider the following program:

------------ main.d ---------------

import std.stdio;
import core.simd;

version(D_SIMD){}
else static assert(false);

float4 _mm_sqrt_ss(float4 a)
{
    return cast(float4) __simd(XMM.SQRTSS, a);    
}

void main(string[] args)
{
    float4 A = [4.0f, 4.0f, 4.0f, 4.0f];
    float4 B = _mm_sqrt_ss(A);
    writeln(B); // Displays [2, 4, 4, 4] but [2, 0, 0, 0] with -inline
}

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

Built with:
    DMD -m64 main.d

Output is :
    [2, 4, 4, 4]

Built with:
    DMD -m64 -inline main.d
Output is :
    [2, 0, 0, 0]

--


More information about the Digitalmars-d-bugs mailing list