[Issue 23046] New: [REG][CODEGEN] __simd(XMM.LODLPS) bad codegen
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Apr 22 13:09:36 UTC 2022
https://issues.dlang.org/show_bug.cgi?id=23046
Issue ID: 23046
Summary: [REG][CODEGEN] __simd(XMM.LODLPS) bad codegen
Product: D
Version: D2
Hardware: x86_64
OS: All
Status: NEW
Severity: regression
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: aliloko at gmail.com
Created attachment 1847
--> https://issues.dlang.org/attachment.cgi?id=1847&action=edit
main source
Hello,
Here is a new shipment of DMD codegen bugs.
With latest DMD v2.100.0-beta.1-dirty
Consider the following program, and built it with
$ dmd -m64 main.d
------------------ main.d ------------------------
import core.simd;
import core.stdc.stdio;
alias __m128 = float4;
alias __m128i = int4;
alias __m64 = long1;
struct long1
{
long[1] array;
}
__m128 _mm_loadl_pi (__m128 a, const(__m64)* mem_addr) pure @trusted
{
return cast(__m128) __simd(XMM.LODLPS, a, *cast(const(__m128)*)mem_addr);
}
__m64 to_m64(__m128i a) pure @trusted
{
long2 la = cast(long2)a;
long1 r;
r.array[0] = la.array[0];
return r;
}
void _mm_print_ps(__m128 v) @trusted
{
float[4] C = (cast(float4)v).array;
printf("%f %f %f %f\n", C[0], C[1], C[2], C[3]);
}
void main()
{
float4 A = [1.0f, 2.0f, 3.0f, 4.0f];
float4 B = [5.0f, 6.0f, 7.0f, 8.0f];
__m64 M = to_m64(cast(__m128i)B);
__m128 R = _mm_loadl_pi(A, &M);
_mm_print_ps(R);
float[4] correct = [5.0f, 6.0f, 3.0f, 4.0f];
assert(R.array == correct);
}
-------------------------------------------------
Output with DMD 2.095.1:
5.000000 6.000000 3.000000 4.000000
Output with DMD 2.097.0 all the way to DMD v2.100.0-beta:
0.000000 0.000000 3.000000 4.000000
Notes:
- superficially looks related to
https://issues.dlang.org/show_bug.cgi?id=21673 ?
--
More information about the Digitalmars-d-bugs
mailing list