diff options
| -rw-r--r-- | utils/ic/cgen.c | 20 | ||||
| -rw-r--r-- | utils/ic/reg.c | 2 | ||||
| -rw-r--r-- | utils/il/pass.c | 2 |
3 files changed, 19 insertions, 5 deletions
diff --git a/utils/ic/cgen.c b/utils/ic/cgen.c index a8bf5ea1..7afe3290 100644 --- a/utils/ic/cgen.c +++ b/utils/ic/cgen.c @@ -179,11 +179,21 @@ cgen(Node *n, Node *nn) cgen(r, &nod1); gopcode(o, &nod1, Z, &nod); } else { - regalloc(&nod, r, nn); - cgen(r, &nod); - regalloc(&nod1, l, Z); - cgen(l, &nod1); - gopcode(o, &nod, &nod1, &nod); + if(typev[n->type->etype] && + (o == OLSHR || o == OASHL || o == OASHR)){ + /* vlong shifts: result has type of l, not type of r */ + regalloc(&nod1, r, Z); + cgen(r, &nod1); + regalloc(&nod, l, nn); + cgen(l, &nod); + gopcode(o, &nod1, Z, &nod); + }else{ + regalloc(&nod, r, nn); + cgen(r, &nod); + regalloc(&nod1, l, Z); + cgen(l, &nod1); + gopcode(o, &nod, &nod1, &nod); + } } gopcode(OAS, &nod, Z, nn); regfree(&nod); diff --git a/utils/ic/reg.c b/utils/ic/reg.c index 50df739a..66ab68fe 100644 --- a/utils/ic/reg.c +++ b/utils/ic/reg.c @@ -536,6 +536,8 @@ addmove(Reg *r, int bn, int rn, int f) p1->as = AMOVBU; if(v->etype == TUSHORT) p1->as = AMOVHU; + if(thechar == 'j' && v->etype == TUINT) + p1->as = AMOVWU; } if(debug['R']) print("%P\t.a%P\n", p, p1); diff --git a/utils/il/pass.c b/utils/il/pass.c index 8d3b435b..69aec247 100644 --- a/utils/il/pass.c +++ b/utils/il/pass.c @@ -68,6 +68,8 @@ dodata(void) orig += v; s->type = SDATA1; } + while(orig & 7) + orig++; orig1 = orig; /* |
