From: bernhardheld Date: Sat, 10 Dec 2005 20:43:31 +0000 (+0000) Subject: * src/SDCCcse.c (findCheaperOp): fixed bug 1376320, copy signedness to replacing... X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=b9f177d96cbff206932dc4fc93a902cebb29b2af;p=fw%2Fsdcc * src/SDCCcse.c (findCheaperOp): fixed bug 1376320, copy signedness to replacing literals git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@4005 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/ChangeLog b/ChangeLog index 336adeb7..8ee78781 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-12-10 Bernhard Held + + * src/SDCCcse.c (findCheaperOp): fixed bug 1376320, copy signedness to + replacing literals + 2005-12-08 Raphael Neider * src/pic/device.c: renamed is_shared to pic14_is_shared diff --git a/src/SDCCcse.c b/src/SDCCcse.c index e56c84a5..35a5df94 100644 --- a/src/SDCCcse.c +++ b/src/SDCCcse.c @@ -144,9 +144,11 @@ pcseDef (void *item, va_list ap) void ReplaceOpWithCheaperOp(operand **op, operand *cop) { #ifdef RANGEHUNT - printf ("ReplaceOpWithCheaperOp %s with %s: ", - IS_SYMOP((*op)) ? OP_SYMBOL((*op))->name : "!SYM", - IS_SYMOP(cop) ? OP_SYMBOL(cop)->name : "!SYM"); + printf ("ReplaceOpWithCheaperOp\n\t"); + printOperand (*op, stdout); + printf ("\nwith\t"); + printOperand (cop, stdout); + // if op is a register equivalent if (IS_ITEMP(cop) && IS_SYMOP((*op)) && OP_SYMBOL((*op))->isreqv) { operand **rop = &OP_SYMBOL((*op))->usl.spillLoc->reqv; @@ -415,6 +417,15 @@ DEFSETFUNC (findCheaperOp) (*opp)->isaddr = cop->isaddr; } + /* copy signedness to literal operands */ + if (IS_SPEC(operandType (cop)) && IS_SPEC(operandType (*opp)) + && isOperandLiteral(*opp) + && SPEC_NOUN(operandType(*opp)) == SPEC_NOUN(operandType(cop)) + && SPEC_USIGN(operandType(*opp)) != SPEC_USIGN(operandType(cop))) + { + SPEC_USIGN(operandType(*opp)) = SPEC_USIGN(operandType(cop)); + } + if (IS_SPEC(operandType (cop)) && IS_SPEC(operandType (*opp)) && SPEC_NOUN(operandType(cop)) != SPEC_NOUN(operandType(*opp))) {