Mercurial > projects > ldc
diff gen/llvmhelpers.cpp @ 359:926f65e39246 trunk
[svn r380] Improve complex number support.
author | ChristianK |
---|---|
date | Mon, 14 Jul 2008 17:22:43 +0200 |
parents | 051f5b550d9c |
children | 4d7495038ae8 |
line wrap: on
line diff
--- a/gen/llvmhelpers.cpp Mon Jul 14 12:39:23 2008 +0200 +++ b/gen/llvmhelpers.cpp Mon Jul 14 17:22:43 2008 +0200 @@ -671,6 +671,9 @@ rval = DtoBitCast(rval, tolltype); } } + else if (to->iscomplex()) { + return DtoComplex(to, val); + } else if (to->isfloating()) { if (from->isunsigned()) { rval = new llvm::UIToFPInst(rval, tolltype, "tmp", gIR->scopebb()); @@ -733,13 +736,15 @@ LLValue* rval; if (totype->iscomplex()) { - assert(0); - //return new DImValue(to, DtoComplex(to, val)); + return DtoComplex(to, val); } else if (totype->isfloating()) { if ((fromtype->ty == Tfloat80 || fromtype->ty == Tfloat64) && (totype->ty == Tfloat80 || totype->ty == Tfloat64)) { rval = val->getRVal(); } + else if ((fromtype->ty == Timaginary80 || fromtype->ty == Timaginary64) && (totype->ty == Timaginary80 || totype->ty == Timaginary64)) { + rval = val->getRVal(); + } else if (fromsz < tosz) { rval = new llvm::FPExtInst(val->getRVal(), tolltype, "tmp", gIR->scopebb()); }