提交 b5d4b908 编辑于 作者: herman ten brugge's avatar herman ten brugge
浏览文件

Fix function call on arm64 and riscv

arm64-gen.c/riscv64-gen.c
- Copy code from x86_64-gen.c (fetch cpu flag before generating any code)

tests/tcctest.c:
- Add test code
上级 0378168c
......@@ -1010,6 +1010,10 @@ ST_FUNC void gfunc_call(int nb_args)
stack = (stack + 15) >> 4 << 4;
/* fetch cpu flag before generating any code */
if ((vtop->r & VT_VALMASK) == VT_CMP)
gv(RC_INT);
if (stack >= 0x1000000) // 16Mb
tcc_error("stack size too big %lu", stack);
if (stack & 0xfff)
......
......@@ -621,6 +621,11 @@ ST_FUNC void gfunc_call(int nb_args)
stack_adj = (stack_adj + 15) & -16;
tempspace = (tempspace + 15) & -16;
stack_add = stack_adj + tempspace;
/* fetch cpu flag before generating any code */
if ((vtop->r & VT_VALMASK) == VT_CMP)
gv(RC_INT);
if (stack_add) {
if (stack_add >= 0x1000) {
o(0x37 | (5 << 7) | (-stack_add & 0xfffff000)); //lui t0, upper(v)
......
......@@ -4161,6 +4161,19 @@ void bounds_check1_test (void)
pv(y);
}
/* This failed on arm64/riscv64 */
void map_add(int a, int b, int c, int d, int e, int f, int g, int h, int i)
{
printf ("%d %d %d %d %d %d %d %d %d\n", a, b, c, d, e, f, g, h, i);
}
void func_arg_test(void)
{
int a = 0;
int b = 1;
map_add(0, 1, 2, 3, 4, 5, 6, 7, a && b);
}
/* gcc 2.95.3 does not handle correctly CR in strings or after strays */
#define CORRECT_CR_HANDLING
......@@ -4276,6 +4289,7 @@ int main(int argc, char **argv)
RUN(volatile_test);
RUN(attrib_test);
RUN(bounds_check1_test);
RUN(func_arg_test);
return 0;
}
......
Supports Markdown
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册