changelog shortlog tags branches files raw gz bz2 help

Mercurial > hg > plan9front / changeset: 7l: implement MOVP instruction

changeset 7219: 029d634f0e18
parent 7218: 0e07d7fce9f3
child 7220: f49283fe4c5f
author: cinap_lenrek@felloff.net
date: Thu, 09 May 2019 10:23:23 +0200
files: sys/src/cmd/7l/asmout.c sys/src/cmd/7l/optab.c sys/src/cmd/7l/span.c
description: 7l: implement MOVP instruction
     1.1--- a/sys/src/cmd/7l/asmout.c
     1.2+++ b/sys/src/cmd/7l/asmout.c
     1.3@@ -847,6 +847,34 @@ asmout(Prog *p, Optab *o)
     1.4 		o1 = omovlit(AMOV, p, &p->from, REGTMP);
     1.5 		o2 = olsr12u(opldr12(p->as), 0, REGTMP, p->to.reg);
     1.6 		break;
     1.7+
     1.8+	case 66:	/* movpT (R)O!,R; movpT O(R)!, R -> ldrT */
     1.9+		o1 = opldrpp(p->as);
    1.10+		v = p->from.offset >> 2 + ((o1 & S64) != 0);
    1.11+		if(v < -128 || v > 127)
    1.12+			diag("offset out of range\n%P", p);
    1.13+		if(p->from.type == D_XPOST)
    1.14+			o1 |= 1<<23;
    1.15+		else if(p->from.type == D_XPRE)
    1.16+			o1 |= 3<<23;
    1.17+		else
    1.18+			o1 |= 2<<23;
    1.19+		o1 |= ((v&0x7F)<<15) | (p->from.reg<<5) | p->reg | (p->to.reg<<10);
    1.20+		break;
    1.21+
    1.22+	case 67:	/* movpT R,(R)O!; movpT O(R)!, R -> strT */
    1.23+		o1 = LD2STR(opldrpp(p->as));
    1.24+		v = p->to.offset >> 2 + ((o1 & S64) != 0);
    1.25+		if(v < -128 || v > 127)
    1.26+			diag("offset out of range\n%P", p);
    1.27+		if(p->to.type == D_XPOST)
    1.28+			o1 |= 1<<23;
    1.29+		else if(p->to.type == D_XPRE)
    1.30+			o1 |= 3<<23;
    1.31+		else
    1.32+			o1 |= 2<<23;
    1.33+		o1 |= ((v&0x7F)<<15) | (p->to.reg<<5) | p->from.reg | (p->reg<<10);
    1.34+		break;
    1.35 	}
    1.36 
    1.37 	if(debug['a'] > 1)
    1.38@@ -1552,6 +1580,9 @@ opldrpp(int a)
    1.39 	case AMOVHU:	return 1<<30 | 7<<27 | 0<<26 | 0<<24 | 1<<22;
    1.40 	case AMOVB:	return 0<<30 | 7<<27 | 0<<26 | 0<<24 | 2<<22;
    1.41 	case AMOVBU:	return 0<<30 | 7<<27 | 0<<26 | 0<<24 | 1<<22;
    1.42+	case AMOVPW:	return 0<<30 | 5<<27 | 0<<26 | 0<<23 | 1<<22;
    1.43+	case AMOVPSW:	return 1<<30 | 5<<27 | 0<<26 | 0<<23 | 1<<22;
    1.44+	case AMOVP:	return 2<<30 | 5<<27 | 0<<26 | 0<<23 | 1<<22;
    1.45 	}
    1.46 	diag("bad opldr %A\n%P", a, curp);
    1.47 	return 0;
     2.1--- a/sys/src/cmd/7l/optab.c
     2.2+++ b/sys/src/cmd/7l/optab.c
     2.3@@ -309,6 +309,20 @@ Optab	optab[] =
     2.4 	{ AFMOVS, 	C_FREG,	C_NONE,	C_XPRE,		23, 4, 0 },
     2.5 	{ AFMOVD, 	C_FREG,	C_NONE,	C_XPRE,		23, 4, 0 },
     2.6 
     2.7+	{ AMOVP, 	C_PPAUTO,	C_REG,	C_REG,		66, 4, 0 },
     2.8+	{ AMOVP, 	C_PPOREG,	C_REG,	C_REG,		66, 4, 0 },
     2.9+	{ AMOVP, 	C_NPAUTO,	C_REG,	C_REG,		66, 4, 0 },
    2.10+	{ AMOVP, 	C_NPOREG,	C_REG,	C_REG,		66, 4, 0 },
    2.11+	{ AMOVP, 	C_XPOST,	C_REG,	C_REG,		66, 4, 0 },
    2.12+	{ AMOVP, 	C_XPRE,		C_REG,	C_REG,		66, 4, 0 },
    2.13+
    2.14+	{ AMOVP, 	C_REG,		C_REG, C_PPAUTO,	67, 4, 0 },
    2.15+	{ AMOVP, 	C_REG,		C_REG, C_PPOREG,	67, 4, 0 },
    2.16+	{ AMOVP, 	C_REG,		C_REG, C_NPAUTO,	67, 4, 0 },
    2.17+	{ AMOVP, 	C_REG,		C_REG, C_NPOREG,	67, 4, 0 },
    2.18+	{ AMOVP, 	C_REG,		C_REG, C_XPOST,		67, 4, 0 },
    2.19+	{ AMOVP, 	C_REG,		C_REG, C_XPRE,		67, 4, 0 },
    2.20+
    2.21 	/* special */
    2.22 	{ AMOV,		C_SPR,	C_NONE,	C_REG,		35, 4, 0 },
    2.23 	{ AMRS,		C_SPR,	C_NONE,	C_REG,		35, 4, 0 },
     3.1--- a/sys/src/cmd/7l/span.c
     3.2+++ b/sys/src/cmd/7l/span.c
     3.3@@ -1347,6 +1347,11 @@ buildop(void)
     3.4 			oprange[ASHA256H2] = t;
     3.5 			oprange[ASHA256SU1] = t;
     3.6 			break;
     3.7+
     3.8+		case AMOVP:
     3.9+			oprange[AMOVPW] = t;
    3.10+			oprange[AMOVPSW] = t;
    3.11+			break;
    3.12 		}
    3.13 	}
    3.14 }