Added some patterns for floating point code
authorceriel <none@none>
Mon, 19 Jun 1989 11:24:10 +0000 (11:24 +0000)
committerceriel <none@none>
Mon, 19 Jun 1989 11:24:10 +0000 (11:24 +0000)
mach/m68020/top/table

index 4ee3ccf..3b3b9d2 100644 (file)
@@ -17,6 +17,7 @@ X,Y           {TRUE                           };
 DREG,DREG2     {is_dreg(VAL)                   };       /* data register */
 DSREG          {is_dsreg(VAL)                  };      /* data register */
 AREG           {is_areg(VAL)                   };      /* addressregister */
+FPREG,FPREG2   {is_fpreg(VAL)                  };      /* fp register */
 LAB,L1,L2      {VAL[0] == 'I'                  };      /* label */
 BITNO          {TRUE                           };
 
@@ -152,6 +153,14 @@ muls.l #NUM,DREG
 asl.l #0,DREG                          ->      ;
 asl.l #1,DREG                          ->      add.l DREG,DREG ;
 
+
+move.l A,-(sp) : move.l B,-(sp) : fmove.d (sp)+,FPREG
+       {combines_to_double(A,B)}       ->      fmove.d B,FPREG ;
+move.l A,-(sp) : move.l B,-(sp) : fmove.d X,FPREG : fmove.d (sp)+,FPREG2
+       {combines_to_double(A,B) &&
+        strcmp(FPREG,FPREG2) &&
+        no_part("sp",X) }              ->      fmove.d X,FPREG :
+                                               fmove.d B,FPREG2 ;
 %%;
 
 /* auxiliary routines: */
@@ -210,6 +219,13 @@ int is_dreg(s)
        return *s++ == 'd' && *s >= '0' && *s++ <= '7' && *s == '\0';
 }
 
+int is_fpreg(s)
+       register char *s;
+{
+       return *s++ == 'f' &&  *s++ == 'p' && 
+              *s >= '0' && *s++ <= '7' && *s == '\0';
+}
+
 int is_dsreg(s)
        register char *s;
 {
@@ -273,3 +289,36 @@ int bitno(s,no)
        }
        return FALSE;
 }
+
+int combines_to_double(a,b)
+       register char *a,*b;
+{
+       /*      recognize (_name+4) combined with (_name),
+               and (offset+4,...) combined with (offset,...)
+       */
+       if (*a++ == '(' && *b++ == '(') {
+               if (*a == '-' || *a >= '0' && *a <= '9') {
+                       int na = atoi(a);
+                       int nb = atoi(b);
+
+                       if (*a == '-') a++;
+                       if (*b == '-') b++;
+                       if (na == nb + 4) {
+                               while (*a >= '0' && *a <= '9') a++;
+                               while (*b >= '0' && *b <= '9') b++;
+                               return  !strcmp(a,b) && *a++ == ',' &&
+                                       *a++ == 'a' && *a++ && *a++ == ')' &&
+                                       !*a;
+                       }
+                       return FALSE;
+               }
+               while (*a && *a == *b) {
+                       a++;
+                       b++;
+               }
+               if (*b++ == ')' && ! *b && *a++ == '+' && *a++ == '4' &&
+                   *a++ == ')' && !*a)
+                       return TRUE;
+       }
+       return FALSE;
+}