www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 24283] New: [SIMD][CODEGEN] Bad codegen with and not + AVX

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

          Issue ID: 24283
           Summary: [SIMD][CODEGEN] Bad codegen with and not + AVX
                    registers
           Product: D
           Version: D2
          Hardware: x86_64
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: aliloko gmail.com

With DMD64 D Compiler v2.106.0-dirty
On machine with AVX2 instructions.

Consider the following program:

--------------- repro.d ---------------

import core.simd;
import core.stdc.stdio;

void main()
{
    int8 A = [7,  -2,   9, 54654,  7, -2,   9, 54654];
    int8 B = [14, 78, 111,  -256, 14, 78, 111,  -256];
    int8 R = (~A) & B;
    int[8] correct = [8, 0, 102, -54784, 8, 0, 102, -54784];

    // Should be   [8, 0, 102, -54784, 8, 0, 102, -54784]
    // but return: [8, 0, 102, -54784, 6, 78, 9,   54528 instead when the issue
is here.
    printf("%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]);

    assert(R.array == correct);
}

-----------------------------------------

Build it with:
dmd -m64 -mcpu=native repro.d

Codegen is wrong.

--
Dec 17 2023