changelog shortlog tags branches files raw gz bz2 help

Mercurial > hg > plan9front / changeset: 6c: MOVL xxx, r; MOVLQZX r, r -> MOVL xxx, r

changeset 4351: 71022a4ed87a
parent 4350: 1f9d7811d546
child 4355: 6df9e5c21ab5
author: cinap_lenrek@felloff.net
date: Tue, 17 Mar 2015 16:12:01 +0100
files: sys/src/cmd/6c/peep.c
description: 6c: MOVL xxx, r; MOVLQZX r, r -> MOVL xxx, r

eleminate MOVLQXZ instructions after MOVL as MOVL implicitely
zero extends the result.
     1.1--- a/sys/src/cmd/6c/peep.c
     1.2+++ b/sys/src/cmd/6c/peep.c
     1.3@@ -100,15 +100,28 @@ loop1:
     1.4 		case AMOVQ:
     1.5 		case AMOVSS:
     1.6 		case AMOVSD:
     1.7-			if(regtyp(&p->to))
     1.8+			if(!regtyp(&p->to))
     1.9+				break;
    1.10 			if(regtyp(&p->from)) {
    1.11 				if(copyprop(r)) {
    1.12 					excise(r);
    1.13 					t++;
    1.14-				} else
    1.15+					break;
    1.16+				}
    1.17 				if(subprop(r) && copyprop(r)) {
    1.18 					excise(r);
    1.19 					t++;
    1.20+					break;
    1.21+				}
    1.22+			}
    1.23+			if(p->as != AMOVL)
    1.24+				break;
    1.25+			r1 = rnops(uniqs(r));
    1.26+			if(r1 != R){
    1.27+				p1 = r1->prog;
    1.28+				if(p1->as == AMOVLQZX && p1->from.type == p->to.type && p1->to.type == p->to.type){
    1.29+					excise(r1);
    1.30+					t++;
    1.31 				}
    1.32 			}
    1.33 			break;