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 /utils/ic/cgen.c | |
| parent | b2e326f2d4281f7380036516b62928f8c02850d4 (diff) | |
| parent | b745f52dcc336abf1d3c3679ef51c512440143a0 (diff) | |
Merged in utils-riscv (pull request #10)
RISC-V compiler and linker corrections
Approved-by: Charles Forsyth
Diffstat (limited to 'utils/ic/cgen.c')
| -rw-r--r-- | utils/ic/cgen.c | 20 |
1 files changed, 15 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); |
