mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-21 23:33:13 +01:00
Fix NegExp not to use substraction.
This commit is contained in:
12
gen/toir.cpp
12
gen/toir.cpp
@@ -2024,18 +2024,8 @@ DValue* NegExp::toElem(IRState* p)
|
||||
}
|
||||
|
||||
LLValue* val = l->getRVal();
|
||||
Type* t = type->toBasetype();
|
||||
|
||||
LLValue* zero = 0;
|
||||
if (t->isintegral())
|
||||
zero = llvm::ConstantInt::get(val->getType(), 0, true);
|
||||
else if (t->isfloating()) {
|
||||
zero = DtoConstFP(type, 0.0);
|
||||
}
|
||||
else
|
||||
assert(0);
|
||||
|
||||
val = llvm::BinaryOperator::createSub(zero,val,"tmp",p->scopebb());
|
||||
val = gIR->ir->CreateNeg(val,"negval");
|
||||
return new DImValue(type, val);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user