[Issue 23048] [SIMD][CODEGEN] Inline XMM.LODUPD leads to wrong SIMD content

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Apr 24 06:28:08 UTC 2022


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

--- Comment #2 from Walter Bright <bugzilla at digitalmars.com> ---
The problem is with the lines:

    double[2] A = [56.0, -75.0];
    double2 R = cast(double2) __simd(XMM.LODUPD, *A.ptr);

LODUPD (actually MOVUPD) reads two doubles. The code passes it a double lvalue.
The optimizer replaces the double with a reference to 56.0. The second double
the LODUPD reads is whatever is after the 56.0.

This problem can be fixed with a cast to double2 so the optimizer knows it's a
16 byte operation:

    double2 R = cast(double2) __simd(XMM.LODUPD, *cast(double2*)A.ptr);

I'm not really sure what to do about this as __simd does not do type checking
on its arguments, which is why it's @system code.

I'll leave it open for now.

--


More information about the Digitalmars-d-bugs mailing list