From 0374c089c3fb0e9c59df8664e1c80804992cdbbb Mon Sep 17 00:00:00 2001 From: ceriel Date: Mon, 19 Jun 1989 11:24:10 +0000 Subject: [PATCH] Added some patterns for floating point code --- mach/m68020/top/table | 49 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/mach/m68020/top/table b/mach/m68020/top/table index 4ee3ccfc4..3b3b9d22e 100644 --- a/mach/m68020/top/table +++ b/mach/m68020/top/table @@ -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; +}