Fix: CMP instruction with small constant does not handle PC-relative
authorceriel <none@none>
Mon, 6 Dec 1993 10:14:43 +0000 (10:14 +0000)
committerceriel <none@none>
Mon, 6 Dec 1993 10:14:43 +0000 (10:14 +0000)
mach/m68k2/as/mach5.c

index dbe0e6c..646fe15 100644 (file)
@@ -221,6 +221,25 @@ cmp(sz)
                return;
        }
        if (mrg_1 == 074 && (mrg_2 & 070) != 010) {
+               if (mrg_2 == 072) {
+                       /* In this case, the ea707172 routine changed the
+                          addressing mode to PC-relative. However, this is
+                          not allowed for this instruction. Change it back
+                          to absolute, but also correct for the optimization
+                          that the ea707172 routine thought it made.
+                       */
+                       if (pass == PASS_1) {
+                               /* In this case, the user wrote it PC-relative.
+                                  Error.
+                               */
+                               badoperand();
+                       }
+                       mrg_2 = 071;
+                       exp_2.val += DOTVAL+2;
+                       if (pass == PASS_2) {
+                               DOTGAIN -= 2;
+                       }
+               }
                emit2(06000 | sz | mrg_2);
                ea_1(sz, 0);
                ea_2(sz, DTA|ALT);