History

riscv: fix 72_long_long_constant

32bit signed constants larger than 0x7ffff800 were handled wrongly.

Michael Matz committed 7 years ago

Commit f64d4601 parent 5fcb8711 file · +4 −2Browse files

Unified · Split

riscv64-gen.c+4−2
@@ -189,7 +189,7 @@ ST_FUNC void load(int r, SValue *sv) · 188 unmodified lines
189 tcc_error("unimp: load(non-local lval)");189 tcc_error("unimp: load(non-local lval)");
190 }190 }
191 } else if (v == VT_CONST) {191 } else if (v == VT_CONST) {
192 int rb = 0;192 int rb = 0, do32bit = 8;
193 assert(!is_float(sv->type.t) && is_ireg(r));193 assert(!is_float(sv->type.t) && is_ireg(r));
194 if (fr & VT_SYM) {194 if (fr & VT_SYM) {
195 static Sym label;195 static Sym label;
@@ -207,6 +207,7 @@ ST_FUNC void load(int r, SValue *sv) · 11 unmodified lines
207 rb = rr;207 rb = rr;
208 fc = 0;208 fc = 0;
209 sv->c.i = 0;209 sv->c.i = 0;
210 do32bit = 0;
210 }211 }
211 if (is_float(sv->type.t))212 if (is_float(sv->type.t))
212 tcc_error("unimp: load(float)");213 tcc_error("unimp: load(float)");
@@ -224,10 +225,11 @@ ST_FUNC void load(int r, SValue *sv) · 11 unmodified lines
224 EI(0x13, 1, rr, rr, 8); // slli RR, RR, 8225 EI(0x13, 1, rr, rr, 8); // slli RR, RR, 8
225 fc = (pi & 0x3ff) | (-((int)(pi & 0x200)));226 fc = (pi & 0x3ff) | (-((int)(pi & 0x200)));
226 rb = rr;227 rb = rr;
228 do32bit = 0;
227 }229 }
228 if (((unsigned)fc + (1 << 11)) >> 12)230 if (((unsigned)fc + (1 << 11)) >> 12)
229 o(0x37 | (rr << 7) | ((0x800 + fc) & 0xfffff000)), rb = rr; //lui RR, upper(fc)231 o(0x37 | (rr << 7) | ((0x800 + fc) & 0xfffff000)), rb = rr; //lui RR, upper(fc)
230 EI(0x13, 0, rr, rb, fc << 20 >> 20); // addi R, x0|R, FC232 EI(0x13 | do32bit, 0, rr, rb, fc << 20 >> 20); // addi[w] R, x0|R, FC
231 } else if (v == VT_LOCAL) {233 } else if (v == VT_LOCAL) {
232 assert(is_ireg(r));234 assert(is_ireg(r));
233 if (((unsigned)fc + (1 << 11)) >> 12)235 if (((unsigned)fc + (1 << 11)) >> 12)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t