From 19e56697e4fab8cee82e87882a526835b5c2cb3e Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Wed, 18 Feb 2009 17:06:33 +0000 Subject: callabi.exp: Moved to ... 2009-02-18 H.J. Lu * gcc.dg/callabi/callabi.exp: Moved to ... * gcc.target/x86_64/abi/callabi/callabi.exp: Here. Only run in 64bit mode. * gcc.target/x86_64/abi/callabi/func-1.c: Don't check target. * gcc.target/x86_64/abi/callabi/func-indirect.c: Likewise. * gcc.target/x86_64/abi/callabi/func-indirect.c: Likewise. * gcc.target/x86_64/abi/callabi/pr38891.c: Likewise. * gcc.target/x86_64/abi/callabi/vaarg-1.c: Likewise. * gcc.target/x86_64/abi/callabi/vaarg-2.c: Likewise. * gcc.target/x86_64/abi/callabi/vaarg-3.c: Likewise. * gcc.dg/callabi/callabi.h: Moved to ... * gcc.target/x86_64/abi/callabi/callabi.h: Here. * gcc.dg/callabi/func-1.c: Moved to ... * gcc.target/x86_64/abi/callabi/func-1.c: Here. * gcc.dg/callabi/func-indirect.c: Moved to ... * gcc.target/x86_64/abi/callabi/func-indirect.c: Here. * gcc.dg/callabi/pr38891.c: Moved to ... * gcc.target/x86_64/abi/callabi/pr38891.c: Here. * gcc.dg/callabi/vaarg-1.c: Moved to ... * gcc.target/x86_64/abi/callabi/vaarg-1.c: Here. * gcc.dg/callabi/vaarg-2.c: Moved to ... * gcc.target/x86_64/abi/callabi/vaarg-2.c: Here. * gcc.dg/callabi/vaarg-3.c: Moved to ... * gcc.target/x86_64/abi/callabi/vaarg-3.c: Here. From-SVN: r144264 --- gcc/testsuite/ChangeLog | 35 +++++++++++++++ gcc/testsuite/gcc.dg/callabi/callabi.exp | 31 -------------- gcc/testsuite/gcc.dg/callabi/callabi.h | 50 ---------------------- gcc/testsuite/gcc.dg/callabi/func-1.c | 40 ----------------- gcc/testsuite/gcc.dg/callabi/func-indirect.c | 24 ----------- gcc/testsuite/gcc.dg/callabi/pr38891.c | 10 ----- gcc/testsuite/gcc.dg/callabi/vaarg-1.c | 47 -------------------- gcc/testsuite/gcc.dg/callabi/vaarg-2.c | 47 -------------------- gcc/testsuite/gcc.dg/callabi/vaarg-3.c | 47 -------------------- .../gcc.target/x86_64/abi/callabi/callabi.exp | 36 ++++++++++++++++ .../gcc.target/x86_64/abi/callabi/callabi.h | 50 ++++++++++++++++++++++ .../gcc.target/x86_64/abi/callabi/func-1.c | 40 +++++++++++++++++ .../gcc.target/x86_64/abi/callabi/func-indirect.c | 24 +++++++++++ .../gcc.target/x86_64/abi/callabi/pr38891.c | 10 +++++ .../gcc.target/x86_64/abi/callabi/vaarg-1.c | 47 ++++++++++++++++++++ .../gcc.target/x86_64/abi/callabi/vaarg-2.c | 47 ++++++++++++++++++++ .../gcc.target/x86_64/abi/callabi/vaarg-3.c | 47 ++++++++++++++++++++ 17 files changed, 336 insertions(+), 296 deletions(-) delete mode 100644 gcc/testsuite/gcc.dg/callabi/callabi.exp delete mode 100644 gcc/testsuite/gcc.dg/callabi/callabi.h delete mode 100644 gcc/testsuite/gcc.dg/callabi/func-1.c delete mode 100644 gcc/testsuite/gcc.dg/callabi/func-indirect.c delete mode 100644 gcc/testsuite/gcc.dg/callabi/pr38891.c delete mode 100644 gcc/testsuite/gcc.dg/callabi/vaarg-1.c delete mode 100644 gcc/testsuite/gcc.dg/callabi/vaarg-2.c delete mode 100644 gcc/testsuite/gcc.dg/callabi/vaarg-3.c create mode 100644 gcc/testsuite/gcc.target/x86_64/abi/callabi/callabi.exp create mode 100644 gcc/testsuite/gcc.target/x86_64/abi/callabi/callabi.h create mode 100644 gcc/testsuite/gcc.target/x86_64/abi/callabi/func-1.c create mode 100644 gcc/testsuite/gcc.target/x86_64/abi/callabi/func-indirect.c create mode 100644 gcc/testsuite/gcc.target/x86_64/abi/callabi/pr38891.c create mode 100644 gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-1.c create mode 100644 gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-2.c create mode 100644 gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-3.c diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9b8b8a9..60b17cd 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,38 @@ +2009-02-18 H.J. Lu + + * gcc.dg/callabi/callabi.exp: Moved to ... + * gcc.target/x86_64/abi/callabi/callabi.exp: Here. Only run + in 64bit mode. + + * gcc.target/x86_64/abi/callabi/func-1.c: Don't check target. + * gcc.target/x86_64/abi/callabi/func-indirect.c: Likewise. + * gcc.target/x86_64/abi/callabi/func-indirect.c: Likewise. + * gcc.target/x86_64/abi/callabi/pr38891.c: Likewise. + * gcc.target/x86_64/abi/callabi/vaarg-1.c: Likewise. + * gcc.target/x86_64/abi/callabi/vaarg-2.c: Likewise. + * gcc.target/x86_64/abi/callabi/vaarg-3.c: Likewise. + + * gcc.dg/callabi/callabi.h: Moved to ... + * gcc.target/x86_64/abi/callabi/callabi.h: Here. + + * gcc.dg/callabi/func-1.c: Moved to ... + * gcc.target/x86_64/abi/callabi/func-1.c: Here. + + * gcc.dg/callabi/func-indirect.c: Moved to ... + * gcc.target/x86_64/abi/callabi/func-indirect.c: Here. + + * gcc.dg/callabi/pr38891.c: Moved to ... + * gcc.target/x86_64/abi/callabi/pr38891.c: Here. + + * gcc.dg/callabi/vaarg-1.c: Moved to ... + * gcc.target/x86_64/abi/callabi/vaarg-1.c: Here. + + * gcc.dg/callabi/vaarg-2.c: Moved to ... + * gcc.target/x86_64/abi/callabi/vaarg-2.c: Here. + + * gcc.dg/callabi/vaarg-3.c: Moved to ... + * gcc.target/x86_64/abi/callabi/vaarg-3.c: Here. + 2009-02-17 Xuepeng Guo PR target/38891 diff --git a/gcc/testsuite/gcc.dg/callabi/callabi.exp b/gcc/testsuite/gcc.dg/callabi/callabi.exp deleted file mode 100644 index 1c11ecc..0000000 --- a/gcc/testsuite/gcc.dg/callabi/callabi.exp +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright (C) 2009 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GCC; see the file COPYING3. If not see -# . - -# GCC testsuite that uses the `dg.exp' driver. - -# Load support procs. -load_lib gcc-dg.exp - -# If a testcase doesn't have special options, use these. -global DEFAULT_CFLAGS -if ![info exists DEFAULT_CFLAGS] then { - set DEFAULT_CFLAGS " -ansi -pedantic-errors" -} - -dg-init -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] \ - "" $DEFAULT_CFLAGS -dg-finish diff --git a/gcc/testsuite/gcc.dg/callabi/callabi.h b/gcc/testsuite/gcc.dg/callabi/callabi.h deleted file mode 100644 index d008ad6..0000000 --- a/gcc/testsuite/gcc.dg/callabi/callabi.h +++ /dev/null @@ -1,50 +0,0 @@ -/* First the default target definition. */ -#ifndef __GNUC_VA_LIST -#define __GNUC_VA_LIST - typedef __builtin_va_list __gnuc_va_list; -#endif - -#ifndef _VA_LIST_DEFINED -#define _VA_LIST_DEFINED - typedef __gnuc_va_list va_list; -#endif - -#define __va_copy(d,s) __builtin_va_copy(d,s) -#define __va_start(v,l) __builtin_va_start(v,l) -#define __va_arg(v,l) __builtin_va_arg(v,l) -#define __va_end(v) __builtin_va_end(v) - -#define __ms_va_copy(d,s) __builtin_ms_va_copy(d,s) -#define __ms_va_start(v,l) __builtin_ms_va_start(v,l) -#define __ms_va_arg(v,l) __builtin_va_arg(v,l) -#define __ms_va_end(v) __builtin_ms_va_end(v) - -#define __sysv_va_copy(d,s) __builtin_sysv_va_copy(d,s) -#define __sysv_va_start(v,l) __builtin_sysv_va_start(v,l) -#define __sysv_va_arg(v,l) __builtin_va_arg(v,l) -#define __sysv_va_end(v) __builtin_sysv_va_end(v) - -#define CALLABI_NATIVE - -#ifdef _WIN64 -#define CALLABI_CROSS __attribute__ ((sysv_abi)) - -#define CROSS_VA_LIST __builtin_sysv_va_list - -#define CROSS_VA_COPY(d,s) __sysv_va_copy(d,s) -#define CROSS_VA_START(v,l) __sysv_va_start(v,l) -#define CROSS_VA_ARG(v,l) __sysv_va_arg(v,l) -#define CROSS_VA_END(v) __sysv_va_end(v) - -#else - -#define CALLABI_CROSS __attribute__ ((ms_abi)) - -#define CROSS_VA_LIST __builtin_ms_va_list - -#define CROSS_VA_COPY(d,s) __ms_va_copy(d,s) -#define CROSS_VA_START(v,l) __ms_va_start(v,l) -#define CROSS_VA_ARG(v,l) __ms_va_arg(v,l) -#define CROSS_VA_END(v) __ms_va_end(v) - -#endif \ No newline at end of file diff --git a/gcc/testsuite/gcc.dg/callabi/func-1.c b/gcc/testsuite/gcc.dg/callabi/func-1.c deleted file mode 100644 index c727dbe..0000000 --- a/gcc/testsuite/gcc.dg/callabi/func-1.c +++ /dev/null @@ -1,40 +0,0 @@ -/* Test for cross x86_64<->w64 abi standard calls. -*/ -/* Origin: Kai Tietz */ -/* { dg-do run { target { x86_64-*-* } } } */ -/* { dg-options "-std=gnu99 -ffast-math" } */ -#include "callabi.h" - -extern void abort (void); - -long double -CALLABI_CROSS func_cross (long double a, double b, float c, long d, int e, - char f) -{ - long double ret; - ret = a + (long double) b + (long double) c; - ret *= (long double) (d + (long) e); - if (f>0) - ret += func_cross (a,b,c,d,e,-f); - return ret; -} - -long double -CALLABI_NATIVE func_native (long double a, double b, float c, long d, int e, - char f) -{ - long double ret; - ret = a + (long double) b + (long double) c; - ret *= (long double) (d + (long) e); - if (f>0) - ret += func_native (a,b,c,d,e,-f); - return ret; -} - -int main () -{ - if (func_cross (1.0,2.0,3.0,1,2,3) - != func_native (1.0,2.0,3.0,1,2,3)) - abort (); - return 0; -} \ No newline at end of file diff --git a/gcc/testsuite/gcc.dg/callabi/func-indirect.c b/gcc/testsuite/gcc.dg/callabi/func-indirect.c deleted file mode 100644 index d7733bd..0000000 --- a/gcc/testsuite/gcc.dg/callabi/func-indirect.c +++ /dev/null @@ -1,24 +0,0 @@ -/* Test for cross x86_64<->w64 abi standard calls via variable. -*/ -/* Origin: Kai Tietz */ -/* { dg-do run { target { x86_64-*-* } } } */ -/* { dg-options "-std=gnu99 -ffast-math" } */ -#include "callabi.h" - -extern void abort (void); - -typedef int (CALLABI_CROSS *func)(void *, char *, char *, short, long long); - -int CALLABI_CROSS -callback(void * ptr, char *string1, char *string2, short number, long long rand) -{ - return (rand != 0x1234567890abcdefLL); -} - -int main() -{ - volatile func callme = callback; - if(callme(0, 0, 0, 0, 0x1234567890abcdefLL)) - abort(); -} - diff --git a/gcc/testsuite/gcc.dg/callabi/pr38891.c b/gcc/testsuite/gcc.dg/callabi/pr38891.c deleted file mode 100644 index 586e99f..0000000 --- a/gcc/testsuite/gcc.dg/callabi/pr38891.c +++ /dev/null @@ -1,10 +0,0 @@ -/* Test for cross x86_64<->w64 abi standard calls. -*/ -/* { dg-do compile { target { x86_64-*-* } } } */ -/* { dg-options "-mno-sse" } */ -#include "callabi.h" - -long double -CALLABI_CROSS func_cross () -{ -} diff --git a/gcc/testsuite/gcc.dg/callabi/vaarg-1.c b/gcc/testsuite/gcc.dg/callabi/vaarg-1.c deleted file mode 100644 index 1e745e5..0000000 --- a/gcc/testsuite/gcc.dg/callabi/vaarg-1.c +++ /dev/null @@ -1,47 +0,0 @@ -/* Test for cross x86_64<->w64 abi va_list calls. -*/ -/* Origin: Kai Tietz */ -/* { dg-do run { target { x86_64-*-* } } } */ -/* { dg-options "-std=gnu99" } */ -#include "callabi.h" - -extern __SIZE_TYPE__ strlen (const char *); -extern int sprintf (char *,const char *, ...); -extern void abort (void); - -static -void CALLABI_CROSS vdo_cpy (char *s, CROSS_VA_LIST argp) -{ - __SIZE_TYPE__ len; - char *r = s; - char *e; - *r = 0; - for (;;) { - e = CROSS_VA_ARG (argp,char *); - if (*e == 0) break; - sprintf (r,"%s", e); - r += strlen (r); - } -} - -static -void CALLABI_CROSS do_cpy (char *s, ...) -{ - CROSS_VA_LIST argp; - CROSS_VA_START (argp, s); - vdo_cpy (s, argp); - CROSS_VA_END (argp); -} - -int main () -{ - char s[256]; - - do_cpy (s, "1","2","3","4", "5", "6", "7", ""); - - if (s[0] != '1' || s[1] !='2' || s[2] != '3' || s[3] != '4' - || s[4] != '5' || s[5] != '6' || s[6] != '7' || s[7] != 0) - abort (); - - return 0; -} diff --git a/gcc/testsuite/gcc.dg/callabi/vaarg-2.c b/gcc/testsuite/gcc.dg/callabi/vaarg-2.c deleted file mode 100644 index c9b7161..0000000 --- a/gcc/testsuite/gcc.dg/callabi/vaarg-2.c +++ /dev/null @@ -1,47 +0,0 @@ -/* Test for cross x86_64<->w64 abi va_list calls. -*/ -/* Origin: Kai Tietz */ -/* { dg-do run { target { x86_64-*-* } } } */ -/* { dg-options "-std=gnu99" } */ -#include "callabi.h" - -extern void abort (void); - -#define SZ_ARGS 1ll,2ll,3ll,4ll,5ll,6ll,7ll,0ll - -static -int CALLABI_CROSS fct1 (va_list argp, ...) -{ - long long p1,p2; - int ret = 1; - CROSS_VA_LIST argp_2; - CROSS_VA_START (argp_2,argp); - - do { - p1 = CROSS_VA_ARG (argp_2, long long); - p2 = __va_arg (argp, long long); - if (p1 != p2) - ret = 0; - } while (ret && p1 != 0); - CROSS_VA_END (argp_2); - return ret; -} - -static -int fct2 (int dummy, ...) -{ - va_list argp; - int ret = dummy; - - __va_start (argp, dummy); - ret += fct1 (argp, SZ_ARGS); - __va_end (argp); - return ret; -} - -int main() -{ - if (fct2 (-1, SZ_ARGS) != 0) - abort (); - return 0; -} diff --git a/gcc/testsuite/gcc.dg/callabi/vaarg-3.c b/gcc/testsuite/gcc.dg/callabi/vaarg-3.c deleted file mode 100644 index d0d0687..0000000 --- a/gcc/testsuite/gcc.dg/callabi/vaarg-3.c +++ /dev/null @@ -1,47 +0,0 @@ -/* Test for cross x86_64<->w64 abi va_list calls. -*/ -/* Origin: Kai Tietz */ -/* { dg-do run { target { x86_64-*-* } } } */ -/* { dg-options "-std=gnu99" } */ -#include "callabi.h" - -extern void abort (void); - -#define SZ_ARGS 1ll,2ll,3ll,4ll,5ll,6ll,7ll,0ll - -static -int fct1 (CROSS_VA_LIST argp, ...) -{ - long long p1,p2; - int ret = 1; - va_list argp_2; - - __va_start (argp_2,argp); - do { - p1 = __va_arg (argp_2, long long); - p2 = CROSS_VA_ARG (argp, long long); - if (p1 != p2) - ret = 0; - } while (ret && p1 != 0); - __va_end (argp_2); - return ret; -} - -static -int CALLABI_CROSS fct2 (int dummy, ...) -{ - CROSS_VA_LIST argp; - int ret = dummy; - - CROSS_VA_START (argp, dummy); - ret += fct1 (argp, SZ_ARGS); - CROSS_VA_END (argp); - return ret; -} - -int main() -{ - if (fct2 (-1, SZ_ARGS) != 0) - abort (); - return 0; -} diff --git a/gcc/testsuite/gcc.target/x86_64/abi/callabi/callabi.exp b/gcc/testsuite/gcc.target/x86_64/abi/callabi/callabi.exp new file mode 100644 index 0000000..e76d0c1 --- /dev/null +++ b/gcc/testsuite/gcc.target/x86_64/abi/callabi/callabi.exp @@ -0,0 +1,36 @@ +# Copyright (C) 2009 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# . + +# GCC testsuite that uses the `dg.exp' driver. + +# Load support procs. +load_lib gcc-dg.exp + +if { (![istarget x86_64-*-*] && ![istarget i?86-*-*]) + || [is-effective-target ilp32] } then { + return +} + +# If a testcase doesn't have special options, use these. +global DEFAULT_CFLAGS +if ![info exists DEFAULT_CFLAGS] then { + set DEFAULT_CFLAGS " -ansi -pedantic-errors" +} + +dg-init +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] \ + "" $DEFAULT_CFLAGS +dg-finish diff --git a/gcc/testsuite/gcc.target/x86_64/abi/callabi/callabi.h b/gcc/testsuite/gcc.target/x86_64/abi/callabi/callabi.h new file mode 100644 index 0000000..d008ad6 --- /dev/null +++ b/gcc/testsuite/gcc.target/x86_64/abi/callabi/callabi.h @@ -0,0 +1,50 @@ +/* First the default target definition. */ +#ifndef __GNUC_VA_LIST +#define __GNUC_VA_LIST + typedef __builtin_va_list __gnuc_va_list; +#endif + +#ifndef _VA_LIST_DEFINED +#define _VA_LIST_DEFINED + typedef __gnuc_va_list va_list; +#endif + +#define __va_copy(d,s) __builtin_va_copy(d,s) +#define __va_start(v,l) __builtin_va_start(v,l) +#define __va_arg(v,l) __builtin_va_arg(v,l) +#define __va_end(v) __builtin_va_end(v) + +#define __ms_va_copy(d,s) __builtin_ms_va_copy(d,s) +#define __ms_va_start(v,l) __builtin_ms_va_start(v,l) +#define __ms_va_arg(v,l) __builtin_va_arg(v,l) +#define __ms_va_end(v) __builtin_ms_va_end(v) + +#define __sysv_va_copy(d,s) __builtin_sysv_va_copy(d,s) +#define __sysv_va_start(v,l) __builtin_sysv_va_start(v,l) +#define __sysv_va_arg(v,l) __builtin_va_arg(v,l) +#define __sysv_va_end(v) __builtin_sysv_va_end(v) + +#define CALLABI_NATIVE + +#ifdef _WIN64 +#define CALLABI_CROSS __attribute__ ((sysv_abi)) + +#define CROSS_VA_LIST __builtin_sysv_va_list + +#define CROSS_VA_COPY(d,s) __sysv_va_copy(d,s) +#define CROSS_VA_START(v,l) __sysv_va_start(v,l) +#define CROSS_VA_ARG(v,l) __sysv_va_arg(v,l) +#define CROSS_VA_END(v) __sysv_va_end(v) + +#else + +#define CALLABI_CROSS __attribute__ ((ms_abi)) + +#define CROSS_VA_LIST __builtin_ms_va_list + +#define CROSS_VA_COPY(d,s) __ms_va_copy(d,s) +#define CROSS_VA_START(v,l) __ms_va_start(v,l) +#define CROSS_VA_ARG(v,l) __ms_va_arg(v,l) +#define CROSS_VA_END(v) __ms_va_end(v) + +#endif \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/x86_64/abi/callabi/func-1.c b/gcc/testsuite/gcc.target/x86_64/abi/callabi/func-1.c new file mode 100644 index 0000000..7d0b506 --- /dev/null +++ b/gcc/testsuite/gcc.target/x86_64/abi/callabi/func-1.c @@ -0,0 +1,40 @@ +/* Test for cross x86_64<->w64 abi standard calls. +*/ +/* Origin: Kai Tietz */ +/* { dg-do run } */ +/* { dg-options "-std=gnu99 -ffast-math" } */ +#include "callabi.h" + +extern void abort (void); + +long double +CALLABI_CROSS func_cross (long double a, double b, float c, long d, int e, + char f) +{ + long double ret; + ret = a + (long double) b + (long double) c; + ret *= (long double) (d + (long) e); + if (f>0) + ret += func_cross (a,b,c,d,e,-f); + return ret; +} + +long double +CALLABI_NATIVE func_native (long double a, double b, float c, long d, int e, + char f) +{ + long double ret; + ret = a + (long double) b + (long double) c; + ret *= (long double) (d + (long) e); + if (f>0) + ret += func_native (a,b,c,d,e,-f); + return ret; +} + +int main () +{ + if (func_cross (1.0,2.0,3.0,1,2,3) + != func_native (1.0,2.0,3.0,1,2,3)) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.target/x86_64/abi/callabi/func-indirect.c b/gcc/testsuite/gcc.target/x86_64/abi/callabi/func-indirect.c new file mode 100644 index 0000000..8c1cac8 --- /dev/null +++ b/gcc/testsuite/gcc.target/x86_64/abi/callabi/func-indirect.c @@ -0,0 +1,24 @@ +/* Test for cross x86_64<->w64 abi standard calls via variable. +*/ +/* Origin: Kai Tietz */ +/* { dg-do run } */ +/* { dg-options "-std=gnu99 -ffast-math" } */ +#include "callabi.h" + +extern void abort (void); + +typedef int (CALLABI_CROSS *func)(void *, char *, char *, short, long long); + +int CALLABI_CROSS +callback(void * ptr, char *string1, char *string2, short number, long long rand) +{ + return (rand != 0x1234567890abcdefLL); +} + +int main() +{ + volatile func callme = callback; + if(callme(0, 0, 0, 0, 0x1234567890abcdefLL)) + abort(); +} + diff --git a/gcc/testsuite/gcc.target/x86_64/abi/callabi/pr38891.c b/gcc/testsuite/gcc.target/x86_64/abi/callabi/pr38891.c new file mode 100644 index 0000000..d31b8c3 --- /dev/null +++ b/gcc/testsuite/gcc.target/x86_64/abi/callabi/pr38891.c @@ -0,0 +1,10 @@ +/* Test for cross x86_64<->w64 abi standard calls. +*/ +/* { dg-do compile } */ +/* { dg-options "-mno-sse" } */ +#include "callabi.h" + +long double +CALLABI_CROSS func_cross () +{ +} diff --git a/gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-1.c b/gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-1.c new file mode 100644 index 0000000..a6d8463 --- /dev/null +++ b/gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-1.c @@ -0,0 +1,47 @@ +/* Test for cross x86_64<->w64 abi va_list calls. +*/ +/* Origin: Kai Tietz */ +/* { dg-do run } */ +/* { dg-options "-std=gnu99" } */ +#include "callabi.h" + +extern __SIZE_TYPE__ strlen (const char *); +extern int sprintf (char *,const char *, ...); +extern void abort (void); + +static +void CALLABI_CROSS vdo_cpy (char *s, CROSS_VA_LIST argp) +{ + __SIZE_TYPE__ len; + char *r = s; + char *e; + *r = 0; + for (;;) { + e = CROSS_VA_ARG (argp,char *); + if (*e == 0) break; + sprintf (r,"%s", e); + r += strlen (r); + } +} + +static +void CALLABI_CROSS do_cpy (char *s, ...) +{ + CROSS_VA_LIST argp; + CROSS_VA_START (argp, s); + vdo_cpy (s, argp); + CROSS_VA_END (argp); +} + +int main () +{ + char s[256]; + + do_cpy (s, "1","2","3","4", "5", "6", "7", ""); + + if (s[0] != '1' || s[1] !='2' || s[2] != '3' || s[3] != '4' + || s[4] != '5' || s[5] != '6' || s[6] != '7' || s[7] != 0) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-2.c b/gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-2.c new file mode 100644 index 0000000..e281e86 --- /dev/null +++ b/gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-2.c @@ -0,0 +1,47 @@ +/* Test for cross x86_64<->w64 abi va_list calls. +*/ +/* Origin: Kai Tietz */ +/* { dg-do run } */ +/* { dg-options "-std=gnu99" } */ +#include "callabi.h" + +extern void abort (void); + +#define SZ_ARGS 1ll,2ll,3ll,4ll,5ll,6ll,7ll,0ll + +static +int CALLABI_CROSS fct1 (va_list argp, ...) +{ + long long p1,p2; + int ret = 1; + CROSS_VA_LIST argp_2; + CROSS_VA_START (argp_2,argp); + + do { + p1 = CROSS_VA_ARG (argp_2, long long); + p2 = __va_arg (argp, long long); + if (p1 != p2) + ret = 0; + } while (ret && p1 != 0); + CROSS_VA_END (argp_2); + return ret; +} + +static +int fct2 (int dummy, ...) +{ + va_list argp; + int ret = dummy; + + __va_start (argp, dummy); + ret += fct1 (argp, SZ_ARGS); + __va_end (argp); + return ret; +} + +int main() +{ + if (fct2 (-1, SZ_ARGS) != 0) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-3.c b/gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-3.c new file mode 100644 index 0000000..7cca7ac --- /dev/null +++ b/gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-3.c @@ -0,0 +1,47 @@ +/* Test for cross x86_64<->w64 abi va_list calls. +*/ +/* Origin: Kai Tietz */ +/* { dg-do run } */ +/* { dg-options "-std=gnu99" } */ +#include "callabi.h" + +extern void abort (void); + +#define SZ_ARGS 1ll,2ll,3ll,4ll,5ll,6ll,7ll,0ll + +static +int fct1 (CROSS_VA_LIST argp, ...) +{ + long long p1,p2; + int ret = 1; + va_list argp_2; + + __va_start (argp_2,argp); + do { + p1 = __va_arg (argp_2, long long); + p2 = CROSS_VA_ARG (argp, long long); + if (p1 != p2) + ret = 0; + } while (ret && p1 != 0); + __va_end (argp_2); + return ret; +} + +static +int CALLABI_CROSS fct2 (int dummy, ...) +{ + CROSS_VA_LIST argp; + int ret = dummy; + + CROSS_VA_START (argp, dummy); + ret += fct1 (argp, SZ_ARGS); + CROSS_VA_END (argp); + return ret; +} + +int main() +{ + if (fct2 (-1, SZ_ARGS) != 0) + abort (); + return 0; +} -- cgit v1.1