mirror of
https://github.com/mirror/tinycc.git
synced 2025-01-01 04:20:09 +08:00
riscv: fix 72_long_long_constant
32bit signed constants larger than 0x7ffff800 were handled wrongly.
This commit is contained in:
parent
5fcb87138d
commit
f64d460d29
@ -189,7 +189,7 @@ ST_FUNC void load(int r, SValue *sv)
|
|||||||
tcc_error("unimp: load(non-local lval)");
|
tcc_error("unimp: load(non-local lval)");
|
||||||
}
|
}
|
||||||
} else if (v == VT_CONST) {
|
} else if (v == VT_CONST) {
|
||||||
int rb = 0;
|
int rb = 0, do32bit = 8;
|
||||||
assert(!is_float(sv->type.t) && is_ireg(r));
|
assert(!is_float(sv->type.t) && is_ireg(r));
|
||||||
if (fr & VT_SYM) {
|
if (fr & VT_SYM) {
|
||||||
static Sym label;
|
static Sym label;
|
||||||
@ -207,6 +207,7 @@ ST_FUNC void load(int r, SValue *sv)
|
|||||||
rb = rr;
|
rb = rr;
|
||||||
fc = 0;
|
fc = 0;
|
||||||
sv->c.i = 0;
|
sv->c.i = 0;
|
||||||
|
do32bit = 0;
|
||||||
}
|
}
|
||||||
if (is_float(sv->type.t))
|
if (is_float(sv->type.t))
|
||||||
tcc_error("unimp: load(float)");
|
tcc_error("unimp: load(float)");
|
||||||
@ -224,10 +225,11 @@ ST_FUNC void load(int r, SValue *sv)
|
|||||||
EI(0x13, 1, rr, rr, 8); // slli RR, RR, 8
|
EI(0x13, 1, rr, rr, 8); // slli RR, RR, 8
|
||||||
fc = (pi & 0x3ff) | (-((int)(pi & 0x200)));
|
fc = (pi & 0x3ff) | (-((int)(pi & 0x200)));
|
||||||
rb = rr;
|
rb = rr;
|
||||||
|
do32bit = 0;
|
||||||
}
|
}
|
||||||
if (((unsigned)fc + (1 << 11)) >> 12)
|
if (((unsigned)fc + (1 << 11)) >> 12)
|
||||||
o(0x37 | (rr << 7) | ((0x800 + fc) & 0xfffff000)), rb = rr; //lui RR, upper(fc)
|
o(0x37 | (rr << 7) | ((0x800 + fc) & 0xfffff000)), rb = rr; //lui RR, upper(fc)
|
||||||
EI(0x13, 0, rr, rb, fc << 20 >> 20); // addi R, x0|R, FC
|
EI(0x13 | do32bit, 0, rr, rb, fc << 20 >> 20); // addi[w] R, x0|R, FC
|
||||||
} else if (v == VT_LOCAL) {
|
} else if (v == VT_LOCAL) {
|
||||||
assert(is_ireg(r));
|
assert(is_ireg(r));
|
||||||
if (((unsigned)fc + (1 << 11)) >> 12)
|
if (((unsigned)fc + (1 << 11)) >> 12)
|
||||||
|
Loading…
Reference in New Issue
Block a user