Bug 7951 – DMD: Internal error: backend/cgxmm.c 567

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-04-20T11:26:25Z
Last change time
2019-07-18T07:07:10Z
Assigned to
No Owner
Creator
Zoadian

Comments

Comment #0 by suicidenet — 2012-04-20T11:26:25Z
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 by lovelydear — 2012-04-21T13:41:03Z
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 by lovelydear — 2012-04-21T13:47:49Z
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 by github-bugzilla — 2012-04-21T18:37:04Z
Comment #4 by github-bugzilla — 2012-04-21T18:37:17Z
Comment #5 by dlang-bot — 2019-07-18T07:07:10Z
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