mirror of
https://github.com/cc65/cc65.git
synced 2025-02-05 04:37:23 +00:00
Replacement code for ule and ugt was wrong and did not cover values that were
equal. git-svn-id: svn://svn.cc65.org/cc65/trunk@4112 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
7cd92c82fa
commit
d85e6f9124
@ -1406,12 +1406,24 @@ static unsigned Opt_tosugtax (StackOpData* D)
|
||||
/* Must be true because of OP_RHS_LOAD */
|
||||
CHECK ((D->Rhs.A.Flags & D->Rhs.X.Flags & LI_DIRECT) != 0);
|
||||
|
||||
/* sec */
|
||||
X = NewCodeEntry (OP65_SEC, AM65_IMP, 0, 0, D->OpEntry->LI);
|
||||
InsertEntry (D, X, D->IP++);
|
||||
|
||||
/* Add code for low operand */
|
||||
AddOpLow (D, OP65_CMP, &D->Rhs);
|
||||
AddOpLow (D, OP65_SBC, &D->Rhs);
|
||||
|
||||
/* We need the zero flag, so remember the immediate result */
|
||||
X = NewCodeEntry (OP65_STA, AM65_ZP, "tmp1", 0, D->OpEntry->LI);
|
||||
InsertEntry (D, X, D->IP++);
|
||||
|
||||
/* Add code for high operand */
|
||||
AddOpHigh (D, OP65_SBC, &D->Rhs, 0);
|
||||
|
||||
/* Set Z flag */
|
||||
X = NewCodeEntry (OP65_ORA, AM65_ZP, "tmp1", 0, D->OpEntry->LI);
|
||||
InsertEntry (D, X, D->IP++);
|
||||
|
||||
/* Transform to boolean */
|
||||
X = NewCodeEntry (OP65_JSR, AM65_ABS, "boolugt", 0, D->OpEntry->LI);
|
||||
InsertEntry (D, X, D->IP++);
|
||||
@ -1437,12 +1449,24 @@ static unsigned Opt_tosuleax (StackOpData* D)
|
||||
/* Must be true because of OP_RHS_LOAD */
|
||||
CHECK ((D->Rhs.A.Flags & D->Rhs.X.Flags & LI_DIRECT) != 0);
|
||||
|
||||
/* sec */
|
||||
X = NewCodeEntry (OP65_SEC, AM65_IMP, 0, 0, D->OpEntry->LI);
|
||||
InsertEntry (D, X, D->IP++);
|
||||
|
||||
/* Add code for low operand */
|
||||
AddOpLow (D, OP65_CMP, &D->Rhs);
|
||||
AddOpLow (D, OP65_SBC, &D->Rhs);
|
||||
|
||||
/* We need the zero flag, so remember the immediate result */
|
||||
X = NewCodeEntry (OP65_STA, AM65_ZP, "tmp1", 0, D->OpEntry->LI);
|
||||
InsertEntry (D, X, D->IP++);
|
||||
|
||||
/* Add code for high operand */
|
||||
AddOpHigh (D, OP65_SBC, &D->Rhs, 0);
|
||||
|
||||
/* Set Z flag */
|
||||
X = NewCodeEntry (OP65_ORA, AM65_ZP, "tmp1", 0, D->OpEntry->LI);
|
||||
InsertEntry (D, X, D->IP++);
|
||||
|
||||
/* Transform to boolean */
|
||||
X = NewCodeEntry (OP65_JSR, AM65_ABS, "boolule", 0, D->OpEntry->LI);
|
||||
InsertEntry (D, X, D->IP++);
|
||||
|
Loading…
x
Reference in New Issue
Block a user