Skip to content

Commit

Permalink
fixup! riscv: Implement large addend for global address
Browse files Browse the repository at this point in the history
Use `t1` instead of `t0` for the cases when `rr` is not set so `t0` is
used by default and this happens:

    lui t0, XXX
    add t0, t0, t0

Instead, now we do:

    lui t1, XXX
    add t0, t0, t1
  • Loading branch information
ekaitz-zarraga committed Apr 27, 2024
1 parent 34f21bb commit 45f152c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions riscv64-gen.c
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,8 @@ static int load_symofs(int r, SValue *sv, int forstore)
if (doload) {
EI(0x03, 3, rr, rr, 0); // ld RR, 0(RR)
if (large_addend) {
o(0x37 | (5 << 7) | ((0x800 + fc) & 0xfffff000)); //lui t0, high(fc)
ER(0x33, 0, rr, rr, 5, 0); // add RR, RR, t0
o(0x37 | (6 << 7) | ((0x800 + fc) & 0xfffff000)); //lui t1, high(fc)
ER(0x33, 0, rr, rr, 6, 0); // add RR, RR, t1
sv->c.i = fc << 20 >> 20;
}
}
Expand Down

0 comments on commit 45f152c

Please sign in to comment.