Probably very similar bug than https://issues.dlang.org/show_bug.cgi?id=21469
but this time it is wrong codegen rather than crashing DMD.
HOW TO REPRODUCE
Using DMD 2.094.0, build this file with: dmd -m64 test2.d -g
------------ test2.d -------------------
import core.simd;
int4 _mm_set1_epi8 (byte a) pure @trusted
{
return cast(int4)(byte16(a));
}
void main(string[] args)
{
byte16 b = cast(byte16) _mm_set1_epi8(31);
for (int i = 0; i < 16; ++i)
assert(b.array[i] == 31); // fails
}
----------------------------------------
OUTPUT
[email protected](13): Assertion failure
we can workaround this bug:
-----------------------------------------
int4 _mm_set1_epi8 (byte a) pure @trusted
{
byte16 b = a; // on a separate line
return cast(int4)(b);
}
-----------------------------------------
Comment #1 by aliloko — 2020-12-11T07:25:39Z
Also similarly:
int4 _mm_set1_epi64x (long a) pure @trusted
{
long2 b = a;
return cast(int4)(b);
}
works but:
int4 _mm_set1_epi64x (long a) pure @trusted
{
return cast(int4)(long2(a));
}
doesn't and is likely the same bug.
Both version work correctly in GDC and LDC.