Bug 24284 – [SIMD][CODEGEN] Bad codegen with comparison operator of __vector(short[16])

Status
RESOLVED
Resolution
DUPLICATE
Severity
major
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
All
Creation time
2023-12-17T14:51:10Z
Last change time
2023-12-18T07:15:02Z
Keywords
backend, SIMD
Assigned to
No Owner
Creator
ponce
See also
https://issues.dlang.org/show_bug.cgi?id=24283

Comments

Comment #0 by aliloko — 2023-12-17T14:51:10Z
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.
Comment #1 by bugzilla — 2023-12-18T07:15:02Z
*** This issue has been marked as a duplicate of issue 24283 ***