1
0
mirror of https://github.com/golang/go synced 2024-10-04 02:21:21 -06:00

[dev.power64] liblink: fix handling of MOVD with large constants

LGTM=minux
R=golang-codereviews, minux
CC=golang-codereviews
https://golang.org/cl/122540043
This commit is contained in:
Russ Cox 2014-08-13 18:14:13 -04:00 committed by Shenghou Ma
parent b7a6fd28db
commit ba9a11e557
2 changed files with 9 additions and 15 deletions

View File

@ -488,12 +488,12 @@ span9(Link *ctxt, LSym *cursym)
p = cursym->text; p = cursym->text;
if(p == nil || p->link == nil) // handle external functions and ELF section symbols if(p == nil || p->link == nil) // handle external functions and ELF section symbols
return; return;
ctxt->cursym = cursym;
ctxt->autosize = (int32)(p->to.offset & 0xffffffffll) + 8;
if(oprange[AANDN].start == nil) if(oprange[AANDN].start == nil)
buildop(ctxt); buildop(ctxt);
ctxt->cursym = cursym;
bflag = 0; bflag = 0;
c = 0; c = 0;
p->pc = c; p->pc = c;
@ -571,12 +571,10 @@ span9(Link *ctxt, LSym *cursym)
if(ctxt->tlsg == nil) if(ctxt->tlsg == nil)
ctxt->tlsg = linklookup(ctxt, "runtime.tlsg", 0); ctxt->tlsg = linklookup(ctxt, "runtime.tlsg", 0);
p = cursym->text;
ctxt->autosize = (int32)(p->to.offset & 0xffffffffll) + 8;
symgrow(ctxt, cursym, cursym->size); symgrow(ctxt, cursym, cursym->size);
bp = cursym->p; bp = cursym->p;
for(p = p->link; p != nil; p = p->link) { for(p = cursym->text->link; p != nil; p = p->link) {
ctxt->pc = p->pc; ctxt->pc = p->pc;
ctxt->curp = p; ctxt->curp = p;
o = oplook(ctxt, p); o = oplook(ctxt, p);
@ -1464,12 +1462,17 @@ asmout(Link *ctxt, Prog *p, Optab *o, int32 *out)
ctxt->diag("literal operation on R0\n%P", p); ctxt->diag("literal operation on R0\n%P", p);
a = OP_ADDI; a = OP_ADDI;
if(o->a1 == C_UCON) { if(o->a1 == C_UCON) {
if((d&0xffff) != 0)
sysfatal("invalid handling of %P", p);
v >>= 16; v >>= 16;
if(r == REGZERO && isuint32(d)){ if(r == REGZERO && isuint32(d)){
o1 = LOP_IRR(OP_ORIS, p->to.reg, REGZERO, v); o1 = LOP_IRR(OP_ORIS, p->to.reg, REGZERO, v);
break; break;
} }
a = OP_ADDIS; a = OP_ADDIS;
} else {
if((int16)d != d)
sysfatal("invalid handling of %P", p);
} }
o1 = AOP_IRR(a, p->to.reg, r, v); o1 = AOP_IRR(a, p->to.reg, r, v);
break; break;

View File

@ -179,15 +179,6 @@ progedit(Link *ctxt, Prog *p)
} }
break; break;
} }
if(p->from.type == D_CONST && p->from.reg != NREG) {
if(p->as == AMOVD && p->to.type == D_REG) {
p->as = AADD;
p->reg = p->from.reg;
p->from.reg = NREG;
} else
ctxt->diag("invalid instruction: %P", p);
}
} }
static Prog* stacksplit(Link*, Prog*, int32, int); static Prog* stacksplit(Link*, Prog*, int32, int);