diff options
author | Janis Johnson <janis187@us.ibm.com> | 2003-07-03 20:37:42 +0000 |
---|---|---|
committer | Janis Johnson <janis@gcc.gnu.org> | 2003-07-03 20:37:42 +0000 |
commit | 7516d73631a96bcc28178f057bee4e713022b7d5 (patch) | |
tree | d583d919965c4a6d72f0e2f070ecb232bd6307eb /gcc/testsuite | |
parent | 0964c98c4c3e37652497515f187b29da47e3776b (diff) | |
download | gcc-7516d73631a96bcc28178f057bee4e713022b7d5.zip gcc-7516d73631a96bcc28178f057bee4e713022b7d5.tar.gz gcc-7516d73631a96bcc28178f057bee4e713022b7d5.tar.bz2 |
vector-defs.h: New file.
* gcc.dg/compat/vector-defs.h: New file.
* gcc.dg/compat/vector-setup.h: New file.
* gcc.dg/compat/vector-check.h: New file.
* gcc.dg/compat/vector-1_main.c: New file.
* gcc.dg/compat/vector-1_x.c: New file.
* gcc.dg/compat/vector-1_y.c: New file.
* gcc.dg/compat/vector-2_main.c: New file.
* gcc.dg/compat/vector-2_x.c: New file.
* gcc.dg/compat/vector-2_y.c: New file.
From-SVN: r68902
Diffstat (limited to 'gcc/testsuite')
-rw-r--r-- | gcc/testsuite/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/compat/vector-1_main.c | 14 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/compat/vector-1_x.c | 34 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/compat/vector-1_y.c | 13 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/compat/vector-2_main.c | 14 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/compat/vector-2_x.c | 24 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/compat/vector-2_y.c | 8 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/compat/vector-check.h | 64 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/compat/vector-defs.h | 46 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/compat/vector-setup.h | 28 |
10 files changed, 255 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 65fd1712..7e4c0e6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,15 @@ 2003-07-03 Janis Johnson <janis187@us.ibm.com> + * gcc.dg/compat/vector-defs.h: New file. + * gcc.dg/compat/vector-setup.h: New file. + * gcc.dg/compat/vector-check.h: New file. + * gcc.dg/compat/vector-1_main.c: New file. + * gcc.dg/compat/vector-1_x.c: New file. + * gcc.dg/compat/vector-1_y.c: New file. + * gcc.dg/compat/vector-2_main.c: New file. + * gcc.dg/compat/vector-2_x.c: New file. + * gcc.dg/compat/vector-2_y.c: New file. + * gcc.dg/compat/fnptr-by-value-1_main.c: New file. * gcc.dg/compat/fnptr-by-value-1_x.c: New file. * gcc.dg/compat/fnptr-by-value-1_y.c: New file. diff --git a/gcc/testsuite/gcc.dg/compat/vector-1_main.c b/gcc/testsuite/gcc.dg/compat/vector-1_main.c new file mode 100644 index 0000000..6c995e7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/compat/vector-1_main.c @@ -0,0 +1,14 @@ +/* Test compatibility of vector types: layout between separately-compiled + modules, parameter passing, and function return. This test uses + vectors of integer values. */ + +extern void vector_1_x (void); +extern void exit (int); +int fails; + +int +main () +{ + vector_1_x (); + exit (0); +} diff --git a/gcc/testsuite/gcc.dg/compat/vector-1_x.c b/gcc/testsuite/gcc.dg/compat/vector-1_x.c new file mode 100644 index 0000000..b32a075 --- /dev/null +++ b/gcc/testsuite/gcc.dg/compat/vector-1_x.c @@ -0,0 +1,34 @@ +#include "compat-common.h" +#include "vector-defs.h" +#include "vector-setup.h" + +SETUP (8, qi); +SETUP (16, qi); +SETUP (2, hi); +SETUP (4, hi); +SETUP (8, hi); +SETUP (2, si); +SETUP (4, si); +SETUP (1, di); +SETUP (2, di); + +void +vector_1_x (void) +{ + DEBUG_INIT + + CHECK (8, qi); + CHECK (16, qi); + CHECK (2, hi); + CHECK (4, hi); + CHECK (8, hi); + CHECK (2, si); + CHECK (4, si); + CHECK (1, di); + CHECK (2, di); + + DEBUG_FINI + + if (fails != 0) + abort (); +} diff --git a/gcc/testsuite/gcc.dg/compat/vector-1_y.c b/gcc/testsuite/gcc.dg/compat/vector-1_y.c new file mode 100644 index 0000000..5a8336f --- /dev/null +++ b/gcc/testsuite/gcc.dg/compat/vector-1_y.c @@ -0,0 +1,13 @@ +#include "compat-common.h" +#include "vector-defs.h" +#include "vector-check.h" + +TEST (8, qi, 101) +TEST (16, qi, 101) +TEST (2, hi, 201) +TEST (4, hi, 202) +TEST (8, hi, 203) +TEST (2, si, 301) +TEST (4, si, 302) +TEST (1, di, 401) +TEST (2, di, 402) diff --git a/gcc/testsuite/gcc.dg/compat/vector-2_main.c b/gcc/testsuite/gcc.dg/compat/vector-2_main.c new file mode 100644 index 0000000..37f36fe --- /dev/null +++ b/gcc/testsuite/gcc.dg/compat/vector-2_main.c @@ -0,0 +1,14 @@ +/* Test compatibility of vector types: layout between separately-compiled + modules, parameter passing, and function return. This test uses + vectors of floating points values. */ + +extern void vector_2_x (void); +extern void exit (int); +int fails; + +int +main () +{ + vector_2_x (); + exit (0); +} diff --git a/gcc/testsuite/gcc.dg/compat/vector-2_x.c b/gcc/testsuite/gcc.dg/compat/vector-2_x.c new file mode 100644 index 0000000..53fdded --- /dev/null +++ b/gcc/testsuite/gcc.dg/compat/vector-2_x.c @@ -0,0 +1,24 @@ +#include "compat-common.h" +#include "vector-defs.h" +#include "vector-setup.h" + +SETUP (2, sf); +SETUP (4, sf); +SETUP (16, sf); +SETUP (2, df); + +void +vector_2_x (void) +{ + DEBUG_INIT + + CHECK (2, sf); + CHECK (4, sf); + CHECK (16, sf); + CHECK (2, df); + + DEBUG_FINI + + if (fails != 0) + abort (); +} diff --git a/gcc/testsuite/gcc.dg/compat/vector-2_y.c b/gcc/testsuite/gcc.dg/compat/vector-2_y.c new file mode 100644 index 0000000..a15964d --- /dev/null +++ b/gcc/testsuite/gcc.dg/compat/vector-2_y.c @@ -0,0 +1,8 @@ +#include "compat-common.h" +#include "vector-defs.h" +#include "vector-check.h" + +TEST (2, sf, 301.0) +TEST (4, sf, 302.0) +TEST (16, sf, 304.0) +TEST (2, df, 402.0) diff --git a/gcc/testsuite/gcc.dg/compat/vector-check.h b/gcc/testsuite/gcc.dg/compat/vector-check.h new file mode 100644 index 0000000..f500bd4 --- /dev/null +++ b/gcc/testsuite/gcc.dg/compat/vector-check.h @@ -0,0 +1,64 @@ +#define TEST(NUM,TMODE,VAL) \ +extern v##NUM##TMODE g_v##NUM##TMODE; \ +extern int g_##TMODE; \ + \ +extern void pass_v##NUM##TMODE (v##NUM##TMODE); \ +extern v##NUM##TMODE return_v##NUM##TMODE (void); \ + \ +void \ +checkp_##NUM##TMODE (TMODE *p) \ +{ \ + int i; \ + for (i = 0; i < NUM; i++) \ + { \ + if (p[i] != g_##TMODE + i) \ + DEBUG_CHECK; \ + } \ +} \ + \ +void \ +checkg_##NUM##TMODE (void) \ +{ \ + u##NUM##TMODE u; \ + TMODE *p = u.a; \ + \ + u.v = g_v##NUM##TMODE; \ + checkp_##NUM##TMODE (p); \ +} \ + \ +void \ +init_##NUM##TMODE (void) \ +{ \ + int i; \ + u##NUM##TMODE u; \ + g_##TMODE = VAL; \ + for (i = 0; i < NUM; i++) \ + u.a[i] = VAL + i; \ + g_v##NUM##TMODE = u.v; \ +} \ + \ +void \ +test_v##NUM##TMODE (void) \ +{ \ + v##NUM##TMODE v; \ + u##NUM##TMODE u; \ + TMODE *p = u.a; \ + \ + DEBUG_FPUTS ("v" #NUM #TMODE); \ + DEBUG_NL; \ + DEBUG_FPUTS (" global variable:"); \ + init_##NUM##TMODE (); \ + checkg_##NUM##TMODE (); \ + DEBUG_NL; \ + DEBUG_FPUTS (" pass global variable:"); \ + pass_v##NUM##TMODE (g_v##NUM##TMODE); \ + DEBUG_NL; \ + DEBUG_FPUTS (" pass local variable:"); \ + v = g_v##NUM##TMODE; \ + pass_v##NUM##TMODE (v); \ + DEBUG_NL; \ + DEBUG_FPUTS (" function return:"); \ + u.v = return_v##NUM##TMODE (); \ + checkp_##NUM##TMODE (p); \ + DEBUG_NL; \ +} diff --git a/gcc/testsuite/gcc.dg/compat/vector-defs.h b/gcc/testsuite/gcc.dg/compat/vector-defs.h new file mode 100644 index 0000000..cef5d76 --- /dev/null +++ b/gcc/testsuite/gcc.dg/compat/vector-defs.h @@ -0,0 +1,46 @@ +/* This includes all of the vector modes that are recognized by + c_common_type_for_mode, grouped by base mode. */ + +typedef int __attribute__((mode(QI))) qi; +typedef int __attribute__((mode(V8QI))) v8qi; +typedef int __attribute__((mode(V16QI))) v16qi; + +typedef union U8QI { v8qi v; qi a[8]; } u8qi; +typedef union U16QI { v16qi v; qi a[16]; } u16qi; + +typedef int __attribute__((mode(HI))) hi; +typedef int __attribute__((mode(V2HI))) v2hi; +typedef int __attribute__((mode(V4HI))) v4hi; +typedef int __attribute__((mode(V8HI))) v8hi; + +typedef union U2HI { v2hi v; hi a[2]; } u2hi; +typedef union U4HI { v4hi v; hi a[4]; } u4hi; +typedef union U8HI { v8hi v; hi a[8]; } u8hi; + +typedef int __attribute__((mode(SI))) si; +typedef int __attribute__((mode(V2SI))) v2si; +typedef int __attribute__((mode(V4SI))) v4si; + +typedef union U2SI { v2si v; si a[2]; } u2si; +typedef union U4SI { v4si v; si a[4]; } u4si; + +typedef int __attribute__((mode(DI))) di; +typedef int __attribute__((mode(V1DI))) v1di; +typedef int __attribute__((mode(V2DI))) v2di; + +typedef union U1DI { v1di v; di a[1]; } u1di; +typedef union U2DI { v2di v; di a[2]; } u2di; + +typedef float __attribute__((mode(SF))) sf; +typedef float __attribute__((mode(V2SF))) v2sf; +typedef float __attribute__((mode(V4SF))) v4sf; +typedef float __attribute__((mode(V16SF))) v16sf; + +typedef union U2SF { v2sf v; sf a[2]; } u2sf; +typedef union U4SF { v4sf v; sf a[4]; } u4sf; +typedef union U16SF { v16sf v; sf a[16]; } u16sf; + +typedef float __attribute__((mode(DF))) df; +typedef float __attribute__((mode(V2DF))) v2df; + +typedef union U2DF { v2df v; df a[2]; } u2df; diff --git a/gcc/testsuite/gcc.dg/compat/vector-setup.h b/gcc/testsuite/gcc.dg/compat/vector-setup.h new file mode 100644 index 0000000..60419f8 --- /dev/null +++ b/gcc/testsuite/gcc.dg/compat/vector-setup.h @@ -0,0 +1,28 @@ +#define SETUP(NUM,TMODE) \ +v##NUM##TMODE g_v##NUM##TMODE; \ +TMODE g_##TMODE; \ + \ +extern void test_v##NUM##TMODE (void); \ +extern void checkp_##NUM##TMODE (TMODE *); \ + \ +void \ +pass_v##NUM##TMODE (v##NUM##TMODE v) \ +{ \ + u##NUM##TMODE u; \ + int j; \ + TMODE a[NUM]; \ + \ + u.v = v; \ + for (j = 0; j < NUM; j++) \ + a[j] = u.a[j]; \ + checkp_##NUM##TMODE (a); \ +} \ + \ +v##NUM##TMODE \ +return_v##NUM##TMODE (void) \ +{ \ + return g_v##NUM##TMODE; \ +} + +#define CHECK(NUM,TMODE) \ + test_v##NUM##TMODE() |