+static unsigned Opt_tosugtax (StackOpData* D)
+/* Optimize the tosugtax sequence */
+{
+ CodeEntry* X;
+
+
+ /* Inline the sbc */
+ D->IP = D->OpIndex+1;
+
+ /* 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_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++);
+
+ /* Remove the push and the call to the operator function */
+ RemoveRemainders (D);
+
+ /* We changed the sequence */
+ return 1;
+}
+
+
+
+static unsigned Opt_tosuleax (StackOpData* D)
+/* Optimize the tosuleax sequence */
+{
+ CodeEntry* X;
+
+
+ /* Inline the sbc */
+ D->IP = D->OpIndex+1;
+
+ /* 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_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++);
+
+ /* Remove the push and the call to the operator function */
+ RemoveRemainders (D);
+
+ /* We changed the sequence */
+ return 1;
+}
+
+
+
+static unsigned Opt_tosultax (StackOpData* D)
+/* Optimize the tosultax sequence */
+{
+ CodeEntry* X;
+
+
+ /* Inline the sbc */
+ D->IP = D->OpIndex+1;
+
+ /* Must be true because of OP_RHS_LOAD */
+ CHECK ((D->Rhs.A.Flags & D->Rhs.X.Flags & LI_DIRECT) != 0);
+
+ /* Add code for low operand */
+ AddOpLow (D, OP65_CMP, &D->Rhs);
+
+ /* Add code for high operand */
+ AddOpHigh (D, OP65_SBC, &D->Rhs, 0);
+
+ /* Transform to boolean */
+ X = NewCodeEntry (OP65_JSR, AM65_ABS, "boolult", 0, D->OpEntry->LI);
+ InsertEntry (D, X, D->IP++);
+
+ /* Remove the push and the call to the operator function */
+ RemoveRemainders (D);
+
+ /* We changed the sequence */
+ return 1;
+}
+
+
+