comparison gen/complex.cpp @ 364:8014dbd24605 trunk

[svn r385] Fix lvalue cast problems with -= and friends. Fix complex DtoBoolean.
author ChristianK
date Mon, 14 Jul 2008 22:48:03 +0200
parents 926f65e39246
children 0e6b4d65d3f8
comparison
equal deleted inserted replaced
363:4d7495038ae8 364:8014dbd24605
318 if (op == TOKequal) 318 if (op == TOKequal)
319 cmpop = llvm::FCmpInst::FCMP_OEQ; 319 cmpop = llvm::FCmpInst::FCMP_OEQ;
320 else 320 else
321 cmpop = llvm::FCmpInst::FCMP_UNE; 321 cmpop = llvm::FCmpInst::FCMP_UNE;
322 322
323 // (l.re==r.re && l.im==r.im) 323 // (l.re==r.re && l.im==r.im) or (l.re!=r.re || l.im!=r.im)
324 LLValue* b1 = new llvm::FCmpInst(cmpop, a, c, "tmp", gIR->scopebb()); 324 LLValue* b1 = new llvm::FCmpInst(cmpop, a, c, "tmp", gIR->scopebb());
325 LLValue* b2 = new llvm::FCmpInst(cmpop, b, d, "tmp", gIR->scopebb()); 325 LLValue* b2 = new llvm::FCmpInst(cmpop, b, d, "tmp", gIR->scopebb());
326 return gIR->ir->CreateAnd(b1,b2,"tmp"); 326
327 if (op == TOKequal)
328 return gIR->ir->CreateAnd(b1,b2,"tmp");
329 else
330 return gIR->ir->CreateOr(b1,b2,"tmp");
327 } 331 }
328 332
329 ////////////////////////////////////////////////////////////////////////////////////////// 333 //////////////////////////////////////////////////////////////////////////////////////////
330 334
331 DValue* DtoCastComplex(DValue* val, Type* _to) 335 DValue* DtoCastComplex(DValue* val, Type* _to)