diff options
author | Richard Miller <millerresearch@gmail.com> | 2021-03-07 03:18:24 +0000 |
---|---|---|
committer | Charles Forsyth <charles.forsyth@gmail.com> | 2021-03-07 03:18:24 +0000 |
commit | 29b38a8cb898e73e6bb95476d5b705a2c79e8dcd (patch) | |
tree | c8eb3aec92a58bcb675886679893ed77fdf2d834 | |
parent | b2e326f2d4281f7380036516b62928f8c02850d4 (diff) | |
parent | b745f52dcc336abf1d3c3679ef51c512440143a0 (diff) |
Merged in utils-riscv (pull request #10)
RISC-V compiler and linker corrections
Approved-by: Charles Forsyth
-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; /* |