mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-04-17 17:29:02 +02:00
[svn r380] Improve complex number support.
This commit is contained in:
@@ -671,6 +671,9 @@ DValue* DtoCastInt(DValue* val, Type* _to)
|
||||
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 @@ DValue* DtoCastFloat(DValue* val, Type* to)
|
||||
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());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user