D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 7951 - DMD: Internal error: backend/cgxmm.c 567
Summary: DMD: Internal error: backend/cgxmm.c 567
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-04-20 11:26 UTC by Zoadian
Modified: 2019-07-18 07:07 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Zoadian 2012-04-20 11:26:25 UTC
DMD 2.059 exits compilation with
tym = x1d
Internal error: backend/cgxmm.c 567

Code:


import std.stdio;
import std.math;
import core.simd;
import std.datetime;

T[D] simdAdd(T, int D)(T[D] a1, T[D] a2) {
    T[D] res;
    float4 v1;
    float4 v2;
    v1.array = a1;
    v2.array = a2;
    float4 r;
    
    string gen() {
        string s;
        foreach(i;0..D)
        {
            s ~= "";
        }
        return s;
    }
    //foreach(i;0..10)
        //r = v1+v2;//__simd(XMM.ADDPS, v1,v2);
    return cast(float[4])(v1+v2);
}

T[D] addV(T, int D)(T[D] a1, T[D] a2) {
    T[D] r;
    //foreach(x;0..10)
        foreach(i;0..D)
            r[i] = a1[i]+a2[i];
    return r;
}


void main()
{
    float[4] v1 = [1,2,3,4];
    float[4] v2 = [1,2,3,4];
    void test1(){addV(v1,v2);}
    void test2(){simdAdd(v1,v2);}
    
    
    //~ writeln("STD: ", benchmark!(addS!(int,4)([1,2,3,4],[1,2,3,4]))(10_000_000));
    writeln("_VEC: ", benchmark!(test1)(10_000_000));
    writeln("SIMD: ", benchmark!(test2)(10_000_000));
}
Comment 1 SomeDude 2012-04-21 13:41:03 UTC
I get a different error on 2.059 Win32:

PS E:\DigitalMars\dmd2\samples> rdmd bug.d
Internal error: ..\ztc\cg87.c 1699

A reduced test case:

import std.stdio;
import std.math;
import core.simd;

T[D] simdAdd(T, int D)(T[D] a1, T[D] a2) {
    T[D] res;
    float4 v1, v2;
    v1.array = a1;
    v2.array = a2;

    string gen() {
        string s;
        foreach(i;0..D){s ~= "";}
        return s;
    }
    return cast(float[4])(v1+v2);
}

void main()
{
    float[4] v1 = [1,2,3,4];
    float[4] v2 = [1,2,3,4];
    simdAdd(v1,v2);
}
Comment 2 SomeDude 2012-04-21 13:47:49 UTC
Even more reduced:

import std.stdio;
import std.math;
import core.simd;

void main()
{
    float[4] v1 = [1,2,3,4];
    float[4] v2 = [1,2,3,4];
    float4 f1, f2, f3;
    f1.array = v1;
    f2.array = v2;
    f3 = f1 + f2;
}
Comment 3 github-bugzilla 2012-04-21 18:37:04 UTC
Commit pushed to dmd-1.x at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/54749dd2bab17927acb752d844f6b6e84b9a65c5
fix Issue 7951 - DMD: Internal error: backend/cgxmm.c 567
Comment 4 github-bugzilla 2012-04-21 18:37:17 UTC
Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/bba8e8faa1ab09f2b87fad00e47f46ae6bb91c22
fix Issue 7951 - DMD: Internal error: backend/cgxmm.c 567
Comment 5 Dlang Bot 2019-07-18 07:07:10 UTC
dlang/dmd pull request #10076 "Better solution to issue 7951 - Solve the root problem" was merged into master:

- f0ab98b243bbfffb668cf0e63383538401da7c59 by سليمان السهمي  (Soolaïman Sahmi):
  issue 7951 - Solve the problem from the root
  Array operations require moving the SIMD vector out of the SIMD register.

https://github.com/dlang/dmd/pull/10076