Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

fix Issue Internal error: ../ztc/cod1.c 3510 with SIMD on OSX 32 #1490

Merged
merged 1 commit into from

2 participants

@donc donc merged commit 9a307f4 into D-Programming-Language:master
@WalterBright WalterBright deleted the unknown repository branch
@ghost Unknown referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
@ghost Unknown referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
@ghost Unknown referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
@ghost Unknown referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 289 additions and 33 deletions.
  1. +17 −2 src/backend/cod1.c
  2. +21 −21 src/e2ir.c
  3. +251 −10 test/runnable/testxmm.d
View
19 src/backend/cod1.c
@@ -3507,9 +3507,24 @@ code *params(elem *e,unsigned stackalign)
break;
if (I32)
{
- assert(sz == REGSIZE * 2);
- ce = loadea(e,&cs,0xFF,6,REGSIZE,0,0); /* PUSH EA+4 */
+ assert(sz >= REGSIZE * 2);
+ ce = loadea(e,&cs,0xFF,6,sz - REGSIZE,0,0); /* PUSH EA+4 */
ce = genadjesp(ce,REGSIZE);
+ stackpush += REGSIZE;
+ sz -= REGSIZE;
+
+ if (sz > REGSIZE)
+ {
+ while (sz)
+ {
+ cs.IEVoffset1 -= REGSIZE;
+ ce = gen(ce,&cs); // PUSH EA+...
+ ce = genadjesp(ce,REGSIZE);
+ stackpush += REGSIZE;
+ sz -= REGSIZE;
+ }
+ goto L2;
+ }
}
else
{
View
42 src/e2ir.c
@@ -81,6 +81,22 @@ bool ISWIN64REF(Declaration *var)
#endif
}
+/******************************************
+ * If argument to a function should use OPstrpar,
+ * fix it so it does and return it.
+ */
+elem *useOPstrpar(elem *e)
+{
+ tym_t ty = tybasic(e->Ety);
+ if (ty == TYstruct || ty == TYarray)
+ {
+ e = el_una(OPstrpar, TYstruct, e);
+ e->ET = e->E1->ET;
+ assert(e->ET);
+ }
+ return e;
+}
+
/************************************
* Call a function.
*/
@@ -182,12 +198,7 @@ elem *callfunc(Loc loc,
ea->Ety = TYllong;
}
L1:
- if (tybasic(ea->Ety) == TYstruct || tybasic(ea->Ety) == TYarray)
- {
- ea = el_una(OPstrpar, TYstruct, ea);
- ea->ET = ea->E1->ET;
- assert(ea->ET);
- }
+ ea = useOPstrpar(ea);
if (reverse)
ep = el_param(ep,ea);
else
@@ -739,11 +750,7 @@ elem *setArray(elem *eptr, elem *edim, Type *tb, elem *evalue, IRState *irs, int
evalue = addressElem(evalue, tb);
}
- if (tybasic(evalue->Ety) == TYstruct || tybasic(evalue->Ety) == TYarray)
- {
- evalue = el_una(OPstrpar, TYstruct, evalue);
- evalue->ET = evalue->E1->ET;
- }
+ evalue = useOPstrpar(evalue);
// Be careful about parameter side effect ordering
if (r == RTLSYM_MEMSET8)
@@ -3100,11 +3107,8 @@ elem *CatAssignExp::toElem(IRState *irs)
e1 = el_una(OPaddr, TYnptr, e1);
if (config.exe == EX_WIN64)
e2 = addressElem(e2, tb2);
- else if (tybasic(e2->Ety) == TYstruct || tybasic(e2->Ety) == TYarray)
- {
- e2 = el_una(OPstrpar, TYstruct, e2);
- e2->ET = e2->E1->ET;
- }
+ else
+ e2 = useOPstrpar(e2);
elem *ep = el_params(e2, e1, this->e1->type->getTypeInfo(NULL)->toElem(irs), NULL);
e = el_bin(OPcall, TYdarray, el_var(rtlsym[RTLSYM_ARRAYAPPENDT]), ep);
}
@@ -3185,11 +3189,7 @@ elem *CatAssignExp::toElem(IRState *irs)
else
{ // Append element
e1 = el_una(OPaddr, TYnptr, e1);
- if (tybasic(e2->Ety) == TYstruct || tybasic(e2->Ety) == TYarray)
- {
- e2 = el_una(OPstrpar, TYstruct, e2);
- e2->ET = e2->E1->ET;
- }
+ e2 = useOPstrpar(e2);
elem *ep = el_params(e2, e1, this->e1->type->getTypeInfo(NULL)->toElem(irs), NULL);
e = el_bin(OPcall, TYdarray, el_var(rtlsym[RTLSYM_ARRAYAPPENDCT]), ep);
e->Eflags |= EFLAGS_variadic;
View
261 test/runnable/testxmm.d
@@ -868,17 +868,225 @@ float bug8060(float x) {
float4 test5(float4 a, float4 b)
{
+ a = __simd(XMM.ADDPD, a, b);
+ a = __simd(XMM.ADDSS, a, b);
+ a = __simd(XMM.ADDSD, a, b);
+ a = __simd(XMM.ADDPS, a, b);
+ a = __simd(XMM.PADDB, a, b);
+ a = __simd(XMM.PADDW, a, b);
+ a = __simd(XMM.PADDD, a, b);
+ a = __simd(XMM.PADDQ, a, b);
+
+ a = __simd(XMM.SUBPD, a, b);
+ a = __simd(XMM.SUBSS, a, b);
+ a = __simd(XMM.SUBSD, a, b);
+ a = __simd(XMM.SUBPS, a, b);
+ a = __simd(XMM.PSUBB, a, b);
+ a = __simd(XMM.PSUBW, a, b);
+ a = __simd(XMM.PSUBD, a, b);
+ a = __simd(XMM.PSUBQ, a, b);
+
+ a = __simd(XMM.MULPD, a, b);
+ a = __simd(XMM.MULSS, a, b);
+ a = __simd(XMM.MULSD, a, b);
+ a = __simd(XMM.MULPS, a, b);
+ a = __simd(XMM.PMULLW, a, b);
+
+ a = __simd(XMM.DIVPD, a, b);
+ a = __simd(XMM.DIVSS, a, b);
+ a = __simd(XMM.DIVSD, a, b);
+ a = __simd(XMM.DIVPS, a, b);
+
+ a = __simd(XMM.PAND, a, b);
+ a = __simd(XMM.POR, a, b);
+
+ a = __simd(XMM.UCOMISS, a, b);
+ a = __simd(XMM.UCOMISD, a, b);
+
+ a = __simd(XMM.XORPS, a, b);
+ a = __simd(XMM.XORPD, a, b);
+
+ a = __simd_sto(XMM.STOSS, a, b);
+ a = __simd_sto(XMM.STOSD, a, b);
+ a = __simd_sto(XMM.STOAPS, a, b);
+ a = __simd_sto(XMM.STOAPD, a, b);
+ a = __simd_sto(XMM.STODQA, a, b);
+ //a = __simd_sto(XMM.STOD, a, b);
+ a = __simd_sto(XMM.STOQ, a, b);
+
+ a = __simd(XMM.LODSS, a);
+ a = __simd(XMM.LODSD, a);
+ a = __simd(XMM.LODAPS, a);
+ a = __simd(XMM.LODAPD, a);
+ a = __simd(XMM.LODDQA, a);
+ //a = __simd(XMM.LODD, a);
+ a = __simd(XMM.LODQ, a);
+
+ a = __simd(XMM.LODDQU, a);
+ a = __simd_sto(XMM.STODQU, a, b);
+ //MOVDQ2Q = 0xF20FD6, // MOVDQ2Q mmx, xmm F2 0F D6 /r
+/+
+ LODHPD = 0x660F16, // MOVHPD xmm, mem64 66 0F 16 /r
+ STOHPD = 0x660F17, // MOVHPD mem64, xmm 66 0F 17 /r
+ LODHPS = 0x0F16, // MOVHPS xmm, mem64 0F 16 /r
+ STOHPS = 0x0F17, // MOVHPS mem64, xmm 0F 17 /r
+ MOVLHPS = 0x0F16, // MOVLHPS xmm1, xmm2 0F 16 /r
+ LODLPD = 0x660F12, // MOVLPD xmm, mem64 66 0F 12 /r
+ STOLPD = 0x660F13, // MOVLPD mem64, xmm 66 0F 13 /r
+ a = __simd(XMM.LODLPS, a, b);
+ STOLPS = 0x0F13, // MOVLPS mem64, xmm 0F 13 /r
+ MOVMSKPD = 0x660F50, // MOVMSKPD reg32, xmm 66 0F 50 /r
+ MOVMSKPS = 0x0F50, // MOVMSKPS reg32, xmm 0F 50 /r
+ MOVNTDQ = 0x660FE7, // MOVNTDQ mem128, xmm 66 0F E7 /r
+ MOVNTI = 0x0FC3, // MOVNTI m32,r32 0F C3 /r
+ // MOVNTI m64,r64 0F C3 /r
+ MOVNTPD = 0x660F2B, // MOVNTPD mem128, xmm 66 0F 2B /r
+ MOVNTPS = 0x0F2B, // MOVNTPS mem128, xmm 0F 2B /r
+ //MOVNTQ = 0x0FE7, // MOVNTQ m64, mmx 0F E7 /r
+ //MOVQ2DQ = 0xF30FD6, // MOVQ2DQ xmm, mmx F3 0F D6 /r
+ +/
+ a = __simd(XMM.LODUPD, a, b);
+ a = __simd_sto(XMM.STOUPD, a, b);
+ a = __simd(XMM.LODUPS, a, b);
+ a = __simd_sto(XMM.STOUPS, a, b);
+
+ a = __simd(XMM.PACKSSDW, a, b);
+ a = __simd(XMM.PACKSSWB, a, b);
+ a = __simd(XMM.PACKUSWB, a, b);
+ a = __simd(XMM.PADDSB, a, b);
+ a = __simd(XMM.PADDSW, a, b);
+ a = __simd(XMM.PADDUSB, a, b);
+ a = __simd(XMM.PADDUSW, a, b);
+ a = __simd(XMM.PANDN, a, b);
+ a = __simd(XMM.PCMPEQB, a, b);
+ a = __simd(XMM.PCMPEQD, a, b);
+ a = __simd(XMM.PCMPEQW, a, b);
+ a = __simd(XMM.PCMPGTB, a, b);
+ a = __simd(XMM.PCMPGTD, a, b);
+ a = __simd(XMM.PCMPGTW, a, b);
+ a = __simd(XMM.PMADDWD, a, b);
+ a = __simd(XMM.PSLLW, a, b);
+ a = __simd_ib(XMM.PSLLW, a, cast(ubyte)0x7A);
+ a = __simd(XMM.PSLLD, a, b);
+ a = __simd_ib(XMM.PSLLD, a, cast(ubyte)0x7A);
+ a = __simd(XMM.PSLLQ, a, b);
+ a = __simd_ib(XMM.PSLLQ, a, cast(ubyte)0x7A);
+ a = __simd(XMM.PSRAW, a, b);
+ a = __simd_ib(XMM.PSRAW, a, cast(ubyte)0x7A);
+ a = __simd(XMM.PSRAD, a, b);
+ a = __simd_ib(XMM.PSRAD, a, cast(ubyte)0x7A);
+ a = __simd(XMM.PSRLW, a, b);
+ a = __simd_ib(XMM.PSRLW, a, cast(ubyte)0x7A);
+ a = __simd(XMM.PSRLD, a, b);
+ a = __simd_ib(XMM.PSRLD, a, cast(ubyte)0x7A);
+ a = __simd(XMM.PSRLQ, a, b);
+ a = __simd_ib(XMM.PSRLQ, a, cast(ubyte)0x7A);
+
+ a = __simd(XMM.PSUBSB, a, b);
+ a = __simd(XMM.PSUBSW, a, b);
+ a = __simd(XMM.PSUBUSB, a, b);
+ a = __simd(XMM.PSUBUSW, a, b);
+
+ a = __simd(XMM.PUNPCKHBW, a, b);
+ a = __simd(XMM.PUNPCKHDQ, a, b);
+ a = __simd(XMM.PUNPCKHWD, a, b);
+ a = __simd(XMM.PUNPCKLBW, a, b);
+ a = __simd(XMM.PUNPCKLDQ, a, b);
+ a = __simd(XMM.PUNPCKLWD, a, b);
+
+ a = __simd(XMM.PXOR, a, b);
+ a = __simd(XMM.ANDPD, a, b);
+ a = __simd(XMM.ANDPS, a, b);
+ a = __simd(XMM.ANDNPD, a, b);
+ a = __simd(XMM.ANDNPS, a, b);
+
a = __simd(XMM.CMPPD, a, b, 0x7A);
a = __simd(XMM.CMPSS, a, b, 0x7A);
a = __simd(XMM.CMPSD, a, b, 0x7A);
a = __simd(XMM.CMPPS, a, b, 0x7A);
+ a = __simd(XMM.CVTDQ2PD, a, b);
+ a = __simd(XMM.CVTDQ2PS, a, b);
+ a = __simd(XMM.CVTPD2DQ, a, b);
+ //a = __simd(XMM.CVTPD2PI, a, b);
+ a = __simd(XMM.CVTPD2PS, a, b);
+ a = __simd(XMM.CVTPI2PD, a, b);
+ a = __simd(XMM.CVTPI2PS, a, b);
+ a = __simd(XMM.CVTPS2DQ, a, b);
+ a = __simd(XMM.CVTPS2PD, a, b);
+ //a = __simd(XMM.CVTPS2PI, a, b);
+ //a = __simd(XMM.CVTSD2SI, a, b);
+ //a = __simd(XMM.CVTSD2SI, a, b);
+
+ a = __simd(XMM.CVTSD2SS, a, b);
+ //a = __simd(XMM.CVTSI2SD, a, b);
+ //a = __simd(XMM.CVTSI2SD, a, b);
+ //a = __simd(XMM.CVTSI2SS, a, b);
+ //a = __simd(XMM.CVTSI2SS, a, b);
+ a = __simd(XMM.CVTSS2SD, a, b);
+ //a = __simd(XMM.CVTSS2SI, a, b);
+ //a = __simd(XMM.CVTSS2SI, a, b);
+ //a = __simd(XMM.CVTTPD2PI, a, b);
+ a = __simd(XMM.CVTTPD2DQ, a, b);
+ a = __simd(XMM.CVTTPS2DQ, a, b);
+ //a = __simd(XMM.CVTTPS2PI, a, b);
+ //a = __simd(XMM.CVTTSD2SI, a, b);
+ //a = __simd(XMM.CVTTSD2SI, a, b);
+ //a = __simd(XMM.CVTTSS2SI, a, b);
+ //a = __simd(XMM.CVTTSS2SI, a, b);
+
+ a = __simd(XMM.MASKMOVDQU, a, b);
+ //a = __simd(XMM.MASKMOVQ, a, b);
+
+ a = __simd(XMM.MAXPD, a, b);
+ a = __simd(XMM.MAXPS, a, b);
+ a = __simd(XMM.MAXSD, a, b);
+ a = __simd(XMM.MAXSS, a, b);
+
+ a = __simd(XMM.MINPD, a, b);
+ a = __simd(XMM.MINPS, a, b);
+ a = __simd(XMM.MINSD, a, b);
+ a = __simd(XMM.MINSS, a, b);
+
+ a = __simd(XMM.ORPD, a, b);
+ a = __simd(XMM.ORPS, a, b);
+ a = __simd(XMM.PAVGB, a, b);
+ a = __simd(XMM.PAVGW, a, b);
+ a = __simd(XMM.PMAXSW, a, b);
+ //a = __simd(XMM.PINSRW, a, b);
+ a = __simd(XMM.PMAXUB, a, b);
+ a = __simd(XMM.PMINSB, a, b);
+ a = __simd(XMM.PMINUB, a, b);
+ //a = __simd(XMM.PMOVMSKB, a, b);
+ a = __simd(XMM.PMULHUW, a, b);
+ a = __simd(XMM.PMULHW, a, b);
+ a = __simd(XMM.PMULUDQ, a, b);
+ a = __simd(XMM.PSADBW, a, b);
+ a = __simd(XMM.PUNPCKHQDQ, a, b);
+ a = __simd(XMM.PUNPCKLQDQ, a, b);
+ a = __simd(XMM.RCPPS, a, b);
+ a = __simd(XMM.RCPSS, a, b);
+ a = __simd(XMM.RSQRTPS, a, b);
+ a = __simd(XMM.RSQRTSS, a, b);
+ a = __simd(XMM.SQRTPD, a, b);
a = __simd(XMM.SHUFPD, a, b, 0xA7);
a = __simd(XMM.SHUFPS, a, b, 0x7A);
+ a = __simd(XMM.SQRTPS, a, b);
+ a = __simd(XMM.SQRTSD, a, b);
+ a = __simd(XMM.SQRTSS, a, b);
+ a = __simd(XMM.UNPCKHPD, a, b);
+ a = __simd(XMM.UNPCKHPS, a, b);
+ a = __simd(XMM.UNPCKLPD, a, b);
+ a = __simd(XMM.UNPCKLPS, a, b);
a = __simd(XMM.PSHUFD, a, b, 0x7A);
a = __simd(XMM.PSHUFHW, a, b, 0x7A);
a = __simd(XMM.PSHUFLW, a, b, 0x7A);
+ //a = __simd(XMM.PSHUFW, a, b, 0x7A);
+ a = __simd_ib(XMM.PSLLDQ, a, cast(ubyte)0x7A);
+ a = __simd_ib(XMM.PSRLDQ, a, cast(ubyte)0x7A);
+
+/**/
a = __simd(XMM.BLENDPD, a, b, 0x7A);
a = __simd(XMM.BLENDPS, a, b, 0x7A);
@@ -894,20 +1102,51 @@ float4 test5(float4 a, float4 b)
a = __simd(XMM.ROUNDSD, a, b, 0x7A);
a = __simd(XMM.ROUNDSS, a, b, 0x7A);
- a = __simd_ib(XMM.PSLLD, a, cast(ubyte)0x7A);
- a = __simd_ib(XMM.PSLLQ, a, cast(ubyte)0x7A);
- a = __simd_ib(XMM.PSLLW, a, cast(ubyte)0x7A);
- a = __simd_ib(XMM.PSRAD, a, cast(ubyte)0x7A);
- a = __simd_ib(XMM.PSRAW, a, cast(ubyte)0x7A);
- a = __simd_ib(XMM.PSRLD, a, cast(ubyte)0x7A);
- a = __simd_ib(XMM.PSRLQ, a, cast(ubyte)0x7A);
- a = __simd_ib(XMM.PSRLW, a, cast(ubyte)0x7A);
- a = __simd_ib(XMM.PSRLDQ, a, cast(ubyte)0x7A);
- a = __simd_ib(XMM.PSLLDQ, a, cast(ubyte)0x7A);
+ return a;
+}
+
+/*****************************************/
+/+
+// 9200
+
+void bar9200(double[2] a)
+{
+ assert(a[0] == 1);
+ assert(a[1] == 2);
+}
+double2 * v9200(double2* a)
+{
return a;
}
+void test9200()
+{
+ double2 a = [1, 2];
+
+ *v9200(&a) = a;
+
+ bar9200(a.array);
+}
++/
+
+/*****************************************/
+
+// 9304 and 9322
+
+float4 foo9304(float4 a)
+{
+ return -a;
+}
+
+
+void test9304()
+{
+ auto a = foo9304([0, 1, 2, 3]);
+ //writeln(a.array);
+ assert(a.array == [0,-1,-2,-3]);
+}
+
/*****************************************/
int main()
@@ -934,6 +1173,8 @@ int main()
test7414();
test7413();
test7413_2();
+// test9200();
+ test9304();
return 0;
}
Something went wrong with that request. Please try again.