changelog shortlog tags branches changeset file revisions annotate raw help

Mercurial > hg > plan9front / sys/src/cmd/7l/span.c

revision 7145: 84d616f1d180
parent 7144: d0b9ab522e8b
child 7146: ffe417e0ec24
     1.1--- a/sys/src/cmd/7l/span.c
     1.2+++ b/sys/src/cmd/7l/span.c
     1.3@@ -7,7 +7,7 @@ static struct {
     1.4 	ulong	size;
     1.5 } pool;
     1.6 
     1.7-static void		checkpool(Prog*, int);
     1.8+static void	checkpool(Prog*, int);
     1.9 static void 	flushpool(Prog*, int);
    1.10 static int	ispcdisp(long);
    1.11 
    1.12@@ -330,10 +330,30 @@ isaddcon(vlong v)
    1.13 }
    1.14 
    1.15 static int
    1.16+isbitcon64(uvlong v)
    1.17+{
    1.18+	return findmask(v) != nil;
    1.19+}
    1.20+
    1.21+static int
    1.22+isbitcon32(uvlong v)
    1.23+{
    1.24+	return (v >> 32) == 0 && findmask(v | v<<32) != nil;
    1.25+}
    1.26+
    1.27+static int
    1.28 isbitcon(uvlong v)
    1.29 {
    1.30-	/*  fancy bimm32 or bimm64? */
    1.31-	return findmask(v) != nil || (v>>32) == 0 && findmask(v | (v<<32)) != nil;
    1.32+	Mask *m;
    1.33+
    1.34+	if((v >> 32) != 0)
    1.35+		return 0;
    1.36+	m = findmask(v);
    1.37+	if(m == nil)
    1.38+		return 0;
    1.39+	if(m->s >= 32)
    1.40+		return 0;
    1.41+	return 1;
    1.42 }
    1.43 
    1.44 static int
    1.45@@ -618,6 +638,10 @@ aclass(Adr *a)
    1.46 			}
    1.47 			if(isbitcon(v))
    1.48 				return C_BITCON;
    1.49+			if(isbitcon64(v))
    1.50+				return C_BITCON64;
    1.51+			if(isbitcon32(v))
    1.52+				return C_BITCON32;
    1.53 			return C_LCON;
    1.54 
    1.55 		case D_EXTERN:
    1.56@@ -716,6 +740,8 @@ oplook(Prog *p)
    1.57 		if(o->a2 == a2 || c2[o->a2])
    1.58 		if(c1[o->a1])
    1.59 		if(c3[o->a3]) {
    1.60+			if(0)
    1.61+				print("%P\t-> %d (%d %d %d)\n", p, o->type, o->a1, o->a2, o->a3);
    1.62 			p->optab = (o-optab)+1;
    1.63 			return o;
    1.64 		}
    1.65@@ -755,6 +781,11 @@ cmp(int a, int b)
    1.66 			return 1;
    1.67 		break;
    1.68 
    1.69+	case C_BITCON32:
    1.70+	case C_BITCON64:
    1.71+		if(b == C_BITCON)
    1.72+			return 1;
    1.73+		/* wet floor */
    1.74 	case C_BITCON:
    1.75 		if(b == C_ABCON || b == C_MBCON)
    1.76 			return 1;
    1.77@@ -766,7 +797,7 @@ cmp(int a, int b)
    1.78 		break;
    1.79 
    1.80 	case C_LCON:
    1.81-		if(b == C_ZCON || b == C_BITCON || b == C_ADDCON || b == C_ADDCON0 || b == C_ABCON || b == C_MBCON || b == C_MOVCON)
    1.82+		if(b == C_ZCON || b == C_BITCON || b == C_BITCON32 || b == C_BITCON64 || b == C_ADDCON || b == C_ADDCON0 || b == C_ABCON || b == C_MBCON || b == C_MOVCON)
    1.83 			return 1;
    1.84 		break;
    1.85 
    1.86@@ -934,20 +965,24 @@ buildop(void)
    1.87 			break;
    1.88 		case AAND:	/* logical immediate, logical shifted register */
    1.89 			oprange[AANDS] = t;
    1.90+			oprange[AEOR] = t;
    1.91+			oprange[AORR] = t;
    1.92+			break;
    1.93+		case AANDW:
    1.94 			oprange[AANDSW] = t;
    1.95 			oprange[AANDW] = t;
    1.96-			oprange[AEOR] = t;
    1.97 			oprange[AEORW] = t;
    1.98-			oprange[AORR] = t;
    1.99 			oprange[AORRW] = t;
   1.100 			break;
   1.101 		case ABIC:	/* only logical shifted register */
   1.102 			oprange[ABICS] = t;
   1.103+			oprange[AEON] = t;
   1.104+			oprange[AORN] = t;
   1.105+			break;
   1.106+		case ABICW:
   1.107 			oprange[ABICSW] = t;
   1.108 			oprange[ABICW] = t;
   1.109-			oprange[AEON] = t;
   1.110 			oprange[AEONW] = t;
   1.111-			oprange[AORN] = t;
   1.112 			oprange[AORNW] = t;
   1.113 			break;
   1.114 		case ANEG: