Commit 231fcea7 authored by Russ Cox's avatar Russ Cox

5l: two stack split bugs in one day

An ARM expert could probably phrase the
comparison in fewer instructions, but this works.

R=ken2
CC=golang-dev
https://golang.org/cl/2620041
parent 10b53867
......@@ -37,6 +37,7 @@
enum
{
StackBig = 4096,
StackSmall = 128,
};
static Sym* sym_div;
......@@ -305,13 +306,30 @@ noops(void)
p->to.type = D_REG;
p->to.reg = 1;
// CMP R1, $-autosize(SP)
if(autosize < StackSmall) {
// CMP R1, SP
p = appendp(p);
p->as = ACMP;
p->from.type = D_REG;
p->from.reg = 1;
p->from.offset = -autosize;
p->reg = REGSP;
} else {
// MOVW $-autosize(SP), R2
// CMP R1, R2
p = appendp(p);
p->as = AMOVW;
p->from.type = D_CONST;
p->from.reg = REGSP;
p->from.offset = -autosize;
p->to.type = D_REG;
p->to.reg = 2;
p = appendp(p);
p->as = ACMP;
p->from.type = D_REG;
p->from.reg = 1;
p->reg = 2;
}
// MOVW.LO $autosize, R1
p = appendp(p);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment