ref: 4cffc0436451cb192fb041a4b2be6fa8db5eda8e
parent: 345714dd56f5da8dcb2193f9cdf041cfc005d82f
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Mon Jun 24 15:38:46 EDT 2019
8c, 6c: LEA x, R; MOV (R), R -> MOV x, R
--- a/sys/src/cmd/6c/peep.c
+++ b/sys/src/cmd/6c/peep.c
@@ -170,6 +170,24 @@
}
break;
+ case ALEAQ:
+ if(regtyp(&p->to)) {
+ r1 = rnops(uniqs(r));
+ if(r1 != R){
+ p1 = r1->prog;
+ if((p1->as == AMOVL || p1->as == AMOVQ)
+ && p1->to.type == p->to.type
+ && p1->from.type-D_INDIR == p->to.type
+ && p1->from.index == D_NONE
+ && p1->from.offset == 0){
+ p->as = p1->as;
+ excise(r1);
+ t++;
+ }
+ }
+ }
+ break;
+
case AADDL:
case AADDQ:
case AADDW:
--- a/sys/src/cmd/8c/peep.c
+++ b/sys/src/cmd/8c/peep.c
@@ -99,6 +99,25 @@
}
}
break;
+
+ case ALEAL:
+ if(regtyp(&p->to)) {
+ r1 = uniqs(r);
+ if(r1 != R){
+ p1 = r1->prog;
+ if(p1->as == AMOVL
+ && p1->to.type == p->to.type
+ && p1->from.type-D_INDIR == p->to.type
+ && p1->from.index == D_NONE
+ && p1->from.offset == 0){
+ p->as = p1->as;
+ excise(r1);
+ t++;
+ }
+ }
+ }
+ break;
+
case AADDL:
case AADDW:
if(p->from.type != D_CONST || needc(p->link))