2 /* Origin: <pierre.nguyen-tuong@asim.lip6.fr> */
4 /* Verify that __builtin_apply behaves correctly on targets
5 with pre-pushed arguments (e.g. SPARC). */
9 /* arm_hf_eabi: Variadic funcs use Base AAPCS. Normal funcs use VFP variant.
10 avr: Variadic funcs don't pass arguments in registers, while normal funcs
12 /* { dg-skip-if "Variadic funcs use different argument passing from normal funcs" { arm_hf_eabi || { avr-*-* riscv*-*-* } } "*" "" } */
13 /* { dg-skip-if "Variadic funcs have all args on stack. Normal funcs have args in registers." { nds32*-*-* } "*" "" } */
14 /* { dg-require-effective-target untyped_assembly } */
19 #if defined(__ARM_PCS) || defined(__epiphany__)
20 /* For Base AAPCS, NAME is passed in r0. D is passed in r2 and r3.
21 E, F and G are passed on stack. So the size of the stack argument
23 #define STACK_ARGUMENTS_SIZE 20
24 #elif defined __aarch64__ || defined __arc__ || defined __MMIX__
25 /* No parameters on stack for bar. */
26 #define STACK_ARGUMENTS_SIZE 0
28 #define STACK_ARGUMENTS_SIZE 64
31 extern void abort(void);
33 void foo(char *name
, double d
, double e
, double f
, int g
)
39 void bar(char *name
, ...)
41 __builtin_apply(foo
, __builtin_apply_args(), STACK_ARGUMENTS_SIZE
);
46 bar("eeee", 5.444567, 8.90765, 4.567789, INTEGER_ARG
);