arm64-gen.c: Implement gen_vla_sp_save, gen_vla_sp_restore, gen_vla_alloc. tests/Makefile: Run vla_test on arm64.
Unified · Split
| @@ -1820,15 +1820,23 @@ ST_FUNC void gen_clear_cache(void) · 1819 unmodified lines | |||
| 1820 | } | 1820 | } |
| 1821 | 1821 | ||
| 1822 | ST_FUNC void gen_vla_sp_save(int addr) { | 1822 | ST_FUNC void gen_vla_sp_save(int addr) { |
| 1823 | tcc_error("variable length arrays unsupported for this target"); | 1823 | uint32_t r = intr(get_reg(RC_INT)); |
| 1824 | o(0x910003e0 | r); // mov x(r),sp | ||
| 1825 | arm64_strx(3, r, 29, addr); | ||
| 1824 | } | 1826 | } |
| 1825 | 1827 | ||
| 1826 | ST_FUNC void gen_vla_sp_restore(int addr) { | 1828 | ST_FUNC void gen_vla_sp_restore(int addr) { |
| 1827 | tcc_error("variable length arrays unsupported for this target"); | 1829 | uint32_t r = intr(get_reg(RC_INT)); |
| 1830 | arm64_ldrx(0, 3, r, 29, addr); | ||
| 1831 | o(0x9100001f | r << 5); // mov sp,x(r) | ||
| 1828 | } | 1832 | } |
| 1829 | 1833 | ||
| 1830 | ST_FUNC void gen_vla_alloc(CType *type, int align) { | 1834 | ST_FUNC void gen_vla_alloc(CType *type, int align) { |
| 1831 | tcc_error("variable length arrays unsupported for this target"); | 1835 | uint32_t r = intr(gv(RC_INT)); |
| 1836 | o(0x91003c00 | r | r << 5); // add x(r),x(r),#15 | ||
| 1837 | o(0x927cec00 | r | r << 5); // bic x(r),x(r),#15 | ||
| 1838 | o(0xcb2063ff | r << 16); // sub sp,sp,x(r) | ||
| 1839 | vpop(); | ||
| 1832 | } | 1840 | } |
| 1833 | 1841 | ||
| 1834 | /* end of A64 code generator */ | 1842 | /* end of A64 code generator */ |
| @@ -41,8 +41,7 @@ endif · 40 unmodified lines | |||
| 41 | ifeq ($(TARGETOS),Darwin) | 41 | ifeq ($(TARGETOS),Darwin) |
| 42 | TESTS := $(filter-out hello-exe test3 $(BTESTS),$(TESTS)) | 42 | TESTS := $(filter-out hello-exe test3 $(BTESTS),$(TESTS)) |
| 43 | endif | 43 | endif |
| 44 | ifeq ($(ARCH),i386) | 44 | ifeq (,$(filter arm64 i386 x86-64,$(ARCH))) |
| 45 | else ifneq ($(ARCH),x86-64) | ||
| 46 | TESTS := $(filter-out vla_test-run,$(TESTS)) | 45 | TESTS := $(filter-out vla_test-run,$(TESTS)) |
| 47 | endif | 46 | endif |
| 48 | ifeq ($(CONFIG_arm_eabi),yes) | 47 | ifeq ($(CONFIG_arm_eabi),yes) |