comparison 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
comparison
equal deleted inserted replaced
358:051f5b550d9c 359:926f65e39246
669 } 669 }
670 else { 670 else {
671 rval = DtoBitCast(rval, tolltype); 671 rval = DtoBitCast(rval, tolltype);
672 } 672 }
673 } 673 }
674 else if (to->iscomplex()) {
675 return DtoComplex(to, val);
676 }
674 else if (to->isfloating()) { 677 else if (to->isfloating()) {
675 if (from->isunsigned()) { 678 if (from->isunsigned()) {
676 rval = new llvm::UIToFPInst(rval, tolltype, "tmp", gIR->scopebb()); 679 rval = new llvm::UIToFPInst(rval, tolltype, "tmp", gIR->scopebb());
677 } 680 }
678 else { 681 else {
731 size_t tosz = totype->size(); 734 size_t tosz = totype->size();
732 735
733 LLValue* rval; 736 LLValue* rval;
734 737
735 if (totype->iscomplex()) { 738 if (totype->iscomplex()) {
736 assert(0); 739 return DtoComplex(to, val);
737 //return new DImValue(to, DtoComplex(to, val));
738 } 740 }
739 else if (totype->isfloating()) { 741 else if (totype->isfloating()) {
740 if ((fromtype->ty == Tfloat80 || fromtype->ty == Tfloat64) && (totype->ty == Tfloat80 || totype->ty == Tfloat64)) { 742 if ((fromtype->ty == Tfloat80 || fromtype->ty == Tfloat64) && (totype->ty == Tfloat80 || totype->ty == Tfloat64)) {
743 rval = val->getRVal();
744 }
745 else if ((fromtype->ty == Timaginary80 || fromtype->ty == Timaginary64) && (totype->ty == Timaginary80 || totype->ty == Timaginary64)) {
741 rval = val->getRVal(); 746 rval = val->getRVal();
742 } 747 }
743 else if (fromsz < tosz) { 748 else if (fromsz < tosz) {
744 rval = new llvm::FPExtInst(val->getRVal(), tolltype, "tmp", gIR->scopebb()); 749 rval = new llvm::FPExtInst(val->getRVal(), tolltype, "tmp", gIR->scopebb());
745 } 750 }