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
This commit is contained in:
parent
0378168c13
commit
b5d4b908c4
3 changed files with 23 additions and 0 deletions
|
@ -1010,6 +1010,10 @@ ST_FUNC void gfunc_call(int nb_args)
|
||||||
|
|
||||||
stack = (stack + 15) >> 4 << 4;
|
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
|
if (stack >= 0x1000000) // 16Mb
|
||||||
tcc_error("stack size too big %lu", stack);
|
tcc_error("stack size too big %lu", stack);
|
||||||
if (stack & 0xfff)
|
if (stack & 0xfff)
|
||||||
|
|
|
@ -621,6 +621,11 @@ ST_FUNC void gfunc_call(int nb_args)
|
||||||
stack_adj = (stack_adj + 15) & -16;
|
stack_adj = (stack_adj + 15) & -16;
|
||||||
tempspace = (tempspace + 15) & -16;
|
tempspace = (tempspace + 15) & -16;
|
||||||
stack_add = stack_adj + tempspace;
|
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) {
|
||||||
if (stack_add >= 0x1000) {
|
if (stack_add >= 0x1000) {
|
||||||
o(0x37 | (5 << 7) | (-stack_add & 0xfffff000)); //lui t0, upper(v)
|
o(0x37 | (5 << 7) | (-stack_add & 0xfffff000)); //lui t0, upper(v)
|
||||||
|
|
|
@ -4161,6 +4161,19 @@ void bounds_check1_test (void)
|
||||||
pv(y);
|
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 */
|
/* gcc 2.95.3 does not handle correctly CR in strings or after strays */
|
||||||
#define CORRECT_CR_HANDLING
|
#define CORRECT_CR_HANDLING
|
||||||
|
|
||||||
|
@ -4276,6 +4289,7 @@ int main(int argc, char **argv)
|
||||||
RUN(volatile_test);
|
RUN(volatile_test);
|
||||||
RUN(attrib_test);
|
RUN(attrib_test);
|
||||||
RUN(bounds_check1_test);
|
RUN(bounds_check1_test);
|
||||||
|
RUN(func_arg_test);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue