[Issue 24284] New: [SIMD][CODEGEN] Bad codegen with comparison operator of __vector(short[16])
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Dec 17 14:51:10 UTC 2023
https://issues.dlang.org/show_bug.cgi?id=24284
Issue ID: 24284
Summary: [SIMD][CODEGEN] Bad codegen with comparison operator
of __vector(short[16])
Product: D
Version: D2
Hardware: x86_64
OS: All
Status: NEW
Severity: major
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: aliloko at gmail.com
With DMD64 D Compiler v2.106.0-dirty on a computer with AVX2 instructions.
Consider the following program:
----------- repro.d ---------------
import core.simd;
import core.stdc.stdio;
void main()
{
short16 sa = [32767, 1, -4, -8, 9, 7, 0,-57, 1, 0, 0, 0, 1, 0,
0, 0];
short16 sb = [ -4,-8, 9, 7, 0,-32768, 0, 0, 0, 2, 0, 4, 2, 1,
2, -4];
short16 greater = sa > sb;
short16 R = (greater & sa) | (~greater & sb); // should return the maximum
of each int16
short[16] correct = [32767, 1, 9, 7, 9, 7, 0, 0, 1, 2, 0, 4, 2, 1,
2, 0];
printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d\n",
R[0], R[1], R[2], R[3],
R[4], R[5], R[6], R[7],
R[8], R[9], R[10], R[11],
R[12], R[13], R[14], R[15]);
assert(R.array == correct);
}
------------------------------------
Run with: dmd -m64 -mcpu=native repro.d
Second lane of R is wrong.
Looks similar to Issue 24283.
--
More information about the Digitalmars-d-bugs
mailing list