# HG changeset patch # User Tomas Lindquist Olsen # Date 1221075213 25200 # Node ID 192b82878b78cede4705cda55d9593a8314610fa # Parent fbb1a366cfbcd85b0c94066d39569b3ce8e2932f Fixed most regressions from last commit. diff -r fbb1a366cfbc -r 192b82878b78 gen/arrays.cpp --- a/gen/arrays.cpp Tue Sep 09 16:49:47 2008 -0700 +++ b/gen/arrays.cpp Wed Sep 10 12:33:33 2008 -0700 @@ -194,6 +194,18 @@ funcname = "_d_array_init_real"; break; + case Tcomplex32: + funcname = "_d_array_init_cfloat"; + break; + + case Tcomplex64: + funcname = "_d_array_init_cdouble"; + break; + + case Tcomplex80: + funcname = "_d_array_init_creal"; + break; + case Tpointer: case Tclass: funcname = "_d_array_init_pointer"; @@ -207,9 +219,6 @@ case Tdelegate: case Tarray: case Tsarray: - case Tcomplex32: - case Tcomplex64: - case Tcomplex80: funcname = "_d_array_init_mem"; args[0] = DtoBitCast(args[0], getVoidPtrType()); args[2] = DtoBitCast(args[2], getVoidPtrType()); diff -r fbb1a366cfbc -r 192b82878b78 gen/complex.cpp --- a/gen/complex.cpp Tue Sep 09 16:49:47 2008 -0700 +++ b/gen/complex.cpp Wed Sep 10 12:33:33 2008 -0700 @@ -119,9 +119,12 @@ if (t->isimaginary()) { res = DtoAggrPair(complexTy, LLConstant::getNullValue(DtoType(baserety)), DtoCastFloat(loc, val, baseimty)->getRVal()); } - else if (t->isfloating() || t->isintegral()) { + else if (t->isfloating()) { res = DtoAggrPair(complexTy, DtoCastFloat(loc, val, baserety)->getRVal(), LLConstant::getNullValue(DtoType(baseimty))); } + else if (t->isintegral()) { + res = DtoAggrPair(complexTy, DtoCastInt(loc, val, baserety)->getRVal(), LLConstant::getNullValue(DtoType(baseimty))); + } else { assert(0); } diff -r fbb1a366cfbc -r 192b82878b78 gen/runtime.cpp --- a/gen/runtime.cpp Tue Sep 09 16:49:47 2008 -0700 +++ b/gen/runtime.cpp Wed Sep 10 12:33:33 2008 -0700 @@ -163,6 +163,8 @@ const LLType* shortTy = LLType::Int16Ty; const LLType* intTy = LLType::Int32Ty; const LLType* longTy = LLType::Int64Ty; + const LLType* sizeTy = DtoSize_t(); + const LLType* floatTy = LLType::FloatTy; const LLType* doubleTy = LLType::DoubleTy; const LLType* realTy; @@ -170,7 +172,11 @@ realTy = LLType::X86_FP80Ty; else realTy = LLType::DoubleTy; - const LLType* sizeTy = DtoSize_t(); + + const LLType* cfloatTy = llvm::StructType::get(floatTy, floatTy, 0); + const LLType* cdoubleTy = llvm::StructType::get(doubleTy, doubleTy, 0); + const LLType* crealTy = llvm::StructType::get(realTy, realTy, 0); + const LLType* voidPtrTy = rt_ptr(byteTy); const LLType* stringTy = rt_array(byteTy); const LLType* wstringTy = rt_array(shortTy); @@ -338,6 +344,9 @@ ARRAY_INIT(floatTy,"float") ARRAY_INIT(doubleTy,"double") ARRAY_INIT(realTy,"real") + ARRAY_INIT(cfloatTy,"cfloat") + ARRAY_INIT(cdoubleTy,"cdouble") + ARRAY_INIT(crealTy,"creal") ARRAY_INIT(voidPtrTy,"pointer") #undef ARRAY_INIT diff -r fbb1a366cfbc -r 192b82878b78 runtime/internal/arrayInit.d --- a/runtime/internal/arrayInit.d Tue Sep 09 16:49:47 2008 -0700 +++ b/runtime/internal/arrayInit.d Wed Sep 10 12:33:33 2008 -0700 @@ -76,6 +76,30 @@ *p++ = v; } +void _d_array_init_cfloat(cfloat* a, size_t n, cfloat v) +{ + auto p = a; + auto end = a+n; + while (p !is end) + *p++ = v; +} + +void _d_array_init_cdouble(cdouble* a, size_t n, cdouble v) +{ + auto p = a; + auto end = a+n; + while (p !is end) + *p++ = v; +} + +void _d_array_init_creal(creal* a, size_t n, creal v) +{ + auto p = a; + auto end = a+n; + while (p !is end) + *p++ = v; +} + void _d_array_init_pointer(void** a, size_t n, void* v) { auto p = a;