Fix gen_vla_sp_save/gen_vla_sp_restore in riscv64-gen.c
Unified · Split
| @@ -1382,12 +1382,24 @@ ST_FUNC void ggoto(void) · 1381 unmodified lines | ||
| 1382 | 1382 | |
| 1383 | 1383 | ST_FUNC void gen_vla_sp_save(int addr) |
| 1384 | 1384 | { |
| 1385 | − ES(0x23, 3, 8, 2, addr); // sd sp, fc(s0) | |
| 1385 | + if (((unsigned)addr + (1 << 11)) >> 12) { | |
| 1386 | + o(0x37 | (5 << 7) | ((0x800 + addr) & 0xfffff000)); //lui t0,upper(addr) | |
| 1387 | + ER(0x33, 0, 5, 5, 8, 0); // add t0, t0, s0 | |
| 1388 | + ES(0x23, 3, 5, 2, (int)addr << 20 >> 20); // sd sp, fc(t0) | |
| 1389 | + } | |
| 1390 | + else | |
| 1391 | + ES(0x23, 3, 8, 2, addr); // sd sp, fc(s0) | |
| 1386 | 1392 | } |
| 1387 | 1393 | |
| 1388 | 1394 | ST_FUNC void gen_vla_sp_restore(int addr) |
| 1389 | 1395 | { |
| 1390 | − EI(0x03, 3, 2, 8, addr); // ld sp, fc(s0) | |
| 1396 | + if (((unsigned)addr + (1 << 11)) >> 12) { | |
| 1397 | + o(0x37 | (5 << 7) | ((0x800 + addr) & 0xfffff000)); //lui t0,upper(addr) | |
| 1398 | + ER(0x33, 0, 5, 5, 8, 0); // add t0, t0, s0 | |
| 1399 | + EI(0x03, 3, 2, 5, (int)addr << 20 >> 20); // ld sp, fc(t0) | |
| 1400 | + } | |
| 1401 | + else | |
| 1402 | + EI(0x03, 3, 2, 8, addr); // ld sp, fc(s0) | |
| 1391 | 1403 | } |
| 1392 | 1404 | |
| 1393 | 1405 | ST_FUNC void gen_vla_alloc(CType *type, int align) |
| @@ -32,9 +32,6 @@ endif · 31 unmodified lines | ||
| 32 | 32 | ifeq ($(CONFIG_dll),no) |
| 33 | 33 | TESTS := $(filter-out dlltest, $(TESTS)) |
| 34 | 34 | endif |
| 35 | −ifeq (,$(filter arm64 i386 x86_64,$(ARCH))) | |
| 36 | − TESTS := $(filter-out vla_test-run,$(TESTS)) | |
| 37 | −endif | |
| 38 | 35 | ifeq (-$(CONFIG_arm_eabi)-$(CONFIG_arm_vfp)-,-yes--) |
| 39 | 36 | TESTS := $(filter-out test3 test1b,$(TESTS)) |
| 40 | 37 | endif |