mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-08-10 08:20:05 +02:00
[svn r289] Fixed: right shift >> was broken for unsigned types.
Fixed: debug info for classes now started.
This commit is contained in:
36
gen/toir.cpp
36
gen/toir.cpp
@@ -2191,9 +2191,43 @@ BinBitExp(And,And);
|
||||
BinBitExp(Or,Or);
|
||||
BinBitExp(Xor,Xor);
|
||||
BinBitExp(Shl,Shl);
|
||||
BinBitExp(Shr,AShr);
|
||||
//BinBitExp(Shr,AShr);
|
||||
BinBitExp(Ushr,LShr);
|
||||
|
||||
DValue* ShrExp::toElem(IRState* p)
|
||||
{
|
||||
Logger::print("ShrExp::toElem: %s | %s\n", toChars(), type->toChars());
|
||||
LOG_SCOPE;
|
||||
DValue* u = e1->toElem(p);
|
||||
DValue* v = e2->toElem(p);
|
||||
LLValue* x;
|
||||
if (e1->type->isunsigned())
|
||||
x = p->ir->CreateLShr(u->getRVal(), v->getRVal(), "tmp");
|
||||
else
|
||||
x = p->ir->CreateAShr(u->getRVal(), v->getRVal(), "tmp");
|
||||
return new DImValue(type, x);
|
||||
}
|
||||
|
||||
DValue* ShrAssignExp::toElem(IRState* p)
|
||||
{
|
||||
Logger::print("ShrAssignExp::toElem: %s | %s\n", toChars(), type->toChars());
|
||||
LOG_SCOPE;
|
||||
p->exps.push_back(IRExp(e1,e2,NULL));
|
||||
DValue* u = e1->toElem(p);
|
||||
p->topexp()->v = u;
|
||||
DValue* v = e2->toElem(p);
|
||||
p->exps.pop_back();
|
||||
LLValue* uval = u->getRVal();
|
||||
LLValue* vval = v->getRVal();
|
||||
LLValue* tmp;
|
||||
if (e1->type->isunsigned())
|
||||
tmp = p->ir->CreateLShr(uval, vval, "tmp");
|
||||
else
|
||||
tmp = p->ir->CreateAShr(uval, vval, "tmp");
|
||||
DtoStore(DtoPointedType(u->getLVal(), tmp), u->getLVal());
|
||||
return u;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
DValue* HaltExp::toElem(IRState* p)
|
||||
|
||||
Reference in New Issue
Block a user