struct-layout-1_generate.c (vector_types): Add v32qi, v16hi, v8si, v4di, v8sf, v4df, u32qi, u16hi, u8si, u4di, u8sf and u4df.

2008-07-07  H.J. Lu  <hongjiu.lu@intel.com>

	* gcc.dg/compat/struct-layout-1_generate.c (vector_types): Add
	v32qi, v16hi, v8si, v4di, v8sf, v4df, u32qi, u16hi, u8si, u4di,
	u8sf and u4df.

	* gcc.dg/compat/union-m128-1_main.c: Run only on x86.  Remove
	__x86_64__ check.  Include "cpuid.h".
	(main): Check SSE2 at runtime.

	* gcc.dg/compat/union-m128-1_x.c: Compile with -msse2.  Remove
	__x86_64__ check.
	* gcc.dg/compat/union-m128-1_y.c: Likewise.

	* gcc.dg/compat/vector-1_x.c: Add 32byte vector tests.
	* gcc.dg/compat/vector-1_y.c: Likewise.
	* gcc.dg/compat/vector-2_x.c: Likewise.
	* gcc.dg/compat/vector-2_y.c: Likewise.

	* gcc.dg/compat/vector-1a_main.c: New.
	* gcc.dg/compat/vector-1a_x.c: Likewise.
	* gcc.dg/compat/vector-1a_y.c: Likewise.
	* gcc.dg/compat/vector-2a_main.c: Likewise.
	* gcc.dg/compat/vector-2a_x.c: Likewise.
	* gcc.dg/compat/vector-2a_y.c: Likewise.

	* gcc.dg/compat/vector-defs.h (v32qi): New.
	(v16hi): Likewise.
	(v8si): Likewise.
	(v4di): Likewise.
	(v8sf): Likewise.
	(v4df): Likewise.
	(u32qi): Likewise.
	(u16hi): Likewise.
	(u8si): Likewise.
	(u4di): Likewise.
	(u8sf): Likewise.
	(u4df): Likewise.

	* lib/compat.exp (compat-get-options-main): Support dg-skip-if.

From-SVN: r137611
This commit is contained in:
H.J. Lu 2008-07-08 00:56:45 +00:00 committed by H.J. Lu
parent 5510cef5b5
commit d508e6f85f
17 changed files with 166 additions and 21 deletions

View File

@ -1,3 +1,44 @@
2008-07-07 H.J. Lu <hongjiu.lu@intel.com>
* gcc.dg/compat/struct-layout-1_generate.c (vector_types): Add
v32qi, v16hi, v8si, v4di, v8sf, v4df, u32qi, u16hi, u8si, u4di,
u8sf and u4df.
* gcc.dg/compat/union-m128-1_main.c: Run only on x86. Remove
__x86_64__ check. Include "cpuid.h".
(main): Check SSE2 at runtime.
* gcc.dg/compat/union-m128-1_x.c: Compile with -msse2. Remove
__x86_64__ check.
* gcc.dg/compat/union-m128-1_y.c: Likewise.
* gcc.dg/compat/vector-1_x.c: Add 32byte vector tests.
* gcc.dg/compat/vector-1_y.c: Likewise.
* gcc.dg/compat/vector-2_x.c: Likewise.
* gcc.dg/compat/vector-2_y.c: Likewise.
* gcc.dg/compat/vector-1a_main.c: New.
* gcc.dg/compat/vector-1a_x.c: Likewise.
* gcc.dg/compat/vector-1a_y.c: Likewise.
* gcc.dg/compat/vector-2a_main.c: Likewise.
* gcc.dg/compat/vector-2a_x.c: Likewise.
* gcc.dg/compat/vector-2a_y.c: Likewise.
* gcc.dg/compat/vector-defs.h (v32qi): New.
(v16hi): Likewise.
(v8si): Likewise.
(v4di): Likewise.
(v8sf): Likewise.
(v4df): Likewise.
(u32qi): Likewise.
(u16hi): Likewise.
(u8si): Likewise.
(u4di): Likewise.
(u8sf): Likewise.
(u4df): Likewise.
* lib/compat.exp (compat-get-options-main): Support dg-skip-if.
2008-07-07 Andy Hutchinson <hutchinsonandy@aim.com>
* gcc.c-torture/compile/20080625-1.c: Skip for AVR target.

View File

@ -186,30 +186,42 @@ struct types vector_types[] = {
/* vector-defs.h typedefs */
{ "v8qi", TYPE_OTHER, 0, 0 },
{ "v16qi", TYPE_OTHER, 0, 0 },
{ "v32qi", TYPE_OTHER, 0, 0 },
{ "v2hi", TYPE_OTHER, 0, 0 },
{ "v4hi", TYPE_OTHER, 0, 0 },
{ "v8hi", TYPE_OTHER, 0, 0 },
{ "v16hi", TYPE_OTHER, 0, 0 },
{ "v2si", TYPE_OTHER, 0, 0 },
{ "v4si", TYPE_OTHER, 0, 0 },
{ "v8si", TYPE_OTHER, 0, 0 },
{ "v1di", TYPE_OTHER, 0, 0 },
{ "v2di", TYPE_OTHER, 0, 0 },
{ "v4di", TYPE_OTHER, 0, 0 },
{ "v2sf", TYPE_OTHER, 0, 0 },
{ "v4sf", TYPE_OTHER, 0, 0 },
{ "v8sf", TYPE_OTHER, 0, 0 },
{ "v16sf", TYPE_OTHER, 0, 0 },
{ "v2df", TYPE_OTHER, 0, 0 },
{ "v4df", TYPE_OTHER, 0, 0 },
{ "u8qi", TYPE_OTHER, 0, 0 },
{ "u16qi", TYPE_OTHER, 0, 0 },
{ "u32qi", TYPE_OTHER, 0, 0 },
{ "u2hi", TYPE_OTHER, 0, 0 },
{ "u4hi", TYPE_OTHER, 0, 0 },
{ "u8hi", TYPE_OTHER, 0, 0 },
{ "u16hi", TYPE_OTHER, 0, 0 },
{ "u2si", TYPE_OTHER, 0, 0 },
{ "u4si", TYPE_OTHER, 0, 0 },
{ "u8si", TYPE_OTHER, 0, 0 },
{ "u1di", TYPE_OTHER, 0, 0 },
{ "u2di", TYPE_OTHER, 0, 0 },
{ "u4di", TYPE_OTHER, 0, 0 },
{ "u2sf", TYPE_OTHER, 0, 0 },
{ "u4sf", TYPE_OTHER, 0, 0 },
{ "u8sf", TYPE_OTHER, 0, 0 },
{ "u16sf", TYPE_OTHER, 0, 0 },
{ "u2df", TYPE_OTHER, 0, 0 },
{ "u4df", TYPE_OTHER, 0, 0 },
{ "__m64", TYPE_OTHER, 0, 0 },
{ "__m128", TYPE_OTHER, 0, 0 }
#define NVTYPES2 (sizeof (vector_types) / sizeof (vector_types[0]))

View File

@ -1,6 +1,8 @@
/* { dg-skip-if "test SSE2 support" { ! { i?86-*-* x86_64-*-* } } } */
/* { dg-options "-O" } */
#ifdef __x86_64__
#include "cpuid.h"
/* Test function argument passing. PR target/15301. */
extern void union_m128_1_x (void);
@ -9,13 +11,14 @@ extern void exit (int);
int
main ()
{
union_m128_1_x ();
unsigned int eax, ebx, ecx, edx;
if (!__get_cpuid (1, &eax, &ebx, &ecx, &edx))
return 0;
/* Run SSE vector test only if host has SSE2 support. */
if (edx & bit_SSE2)
union_m128_1_x ();
exit (0);
}
#else
int
main ()
{
return 0;
}
#endif

View File

@ -1,6 +1,5 @@
/* { dg-options "-O" } */
/* { dg-options "-O -msse2" } */
#ifdef __x86_64__
#include "union-m128-1.h"
SS_union_mi128 un;
@ -23,7 +22,3 @@ union_m128_1_x ()
foo(un);
foo(st);
}
#else
int dummy_x;
#endif

View File

@ -1,6 +1,5 @@
/* { dg-options "-O" } */
/* { dg-options "-O -msse2" } */
#ifdef __x86_64__
#include <stdlib.h>
#include "union-m128-1.h"
@ -26,7 +25,3 @@ foo (SS_struct_mi128 st)
|| x.u [1] != 0xfedcba9876543210LL)
abort ();
}
#else
int dummy_y;
#endif

View File

@ -8,13 +8,17 @@
SETUP (8, qi);
SETUP (16, qi);
SETUP (32, qi);
SETUP (2, hi);
SETUP (4, hi);
SETUP (8, hi);
SETUP (16, hi);
SETUP (2, si);
SETUP (4, si);
SETUP (8, si);
SETUP (1, di);
SETUP (2, di);
SETUP (4, di);
#endif
@ -26,13 +30,17 @@ vector_1_x (void)
CHECK (8, qi);
CHECK (16, qi);
CHECK (32, qi);
CHECK (2, hi);
CHECK (4, hi);
CHECK (8, hi);
CHECK (16, hi);
CHECK (2, si);
CHECK (4, si);
CHECK (8, si);
CHECK (1, di);
CHECK (2, di);
CHECK (4, di);
DEBUG_FINI

View File

@ -8,12 +8,16 @@
TEST (8, qi, 101)
TEST (16, qi, 101)
TEST (32, qi, 90)
TEST (2, hi, 201)
TEST (4, hi, 202)
TEST (8, hi, 203)
TEST (16, hi, 203)
TEST (2, si, 301)
TEST (4, si, 302)
TEST (8, si, 303)
TEST (1, di, 401)
TEST (2, di, 402)
TEST (4, di, 403)
#endif

View File

@ -0,0 +1,26 @@
/* { dg-skip-if "test SSE2 vector" { ! { i?86-*-* x86_64-*-* } } } */
/* Test compatibility of vector types: layout between separately-compiled
modules, parameter passing, and function return. This test uses
vectors of integer values. */
#include "cpuid.h"
extern void vector_1_x (void);
extern void exit (int);
int fails;
int
main ()
{
unsigned int eax, ebx, ecx, edx;
if (!__get_cpuid (1, &eax, &ebx, &ecx, &edx))
return 0;
/* Run SSE vector test only if host has SSE2 support. */
if (edx & bit_SSE2)
vector_1_x ();
exit (0);
}

View File

@ -0,0 +1,3 @@
/* { dg-options "-w -mno-mmx -msse2" } */
#include "vector-1_x.c"

View File

@ -0,0 +1,3 @@
/* { dg-options "-w -mno-mmx -msse2" } */
#include "vector-1_y.c"

View File

@ -10,7 +10,9 @@
SETUP (2, sf);
SETUP (4, sf);
SETUP (16, sf);
SETUP (8, sf);
SETUP (2, df);
SETUP (4, df);
#endif
@ -22,7 +24,9 @@ vector_2_x (void)
CHECK (2, sf);
CHECK (4, sf);
CHECK (8, sf);
CHECK (16, sf);
CHECK (4, df);
CHECK (2, df);
DEBUG_FINI

View File

@ -9,7 +9,9 @@
TEST (2, sf, 301.0)
TEST (4, sf, 302.0)
TEST (8, sf, 303.0)
TEST (16, sf, 304.0)
TEST (2, df, 402.0)
TEST (4, df, 402.0)
#endif

View File

@ -0,0 +1,26 @@
/* { dg-skip-if "test SSE2 support" { ! { i?86-*-* x86_64-*-* } } } */
/* Test compatibility of vector types: layout between separately-compiled
modules, parameter passing, and function return. This test uses
vectors of floating points values. */
#include "cpuid.h"
extern void vector_2_x (void);
extern void exit (int);
int fails;
int
main ()
{
unsigned int eax, ebx, ecx, edx;
if (!__get_cpuid (1, &eax, &ebx, &ecx, &edx))
return 0;
/* Run SSE vector test only if host has SSE2 support. */
if (edx & bit_SSE2)
vector_2_x ();
exit (0);
}

View File

@ -0,0 +1,3 @@
/* { dg-options "-w -mno-mmx -msse2" } */
#include "vector-2_x.c"

View File

@ -0,0 +1,3 @@
/* { dg-options "-w -mno-mmx -msse2" } */
#include "vector-2_y.c"

View File

@ -56,6 +56,20 @@ typedef float __attribute__((mode(V2DF))) v2df;
#endif
typedef qi __attribute__((vector_size (32))) v32qi;
typedef hi __attribute__((vector_size (32))) v16hi;
typedef si __attribute__((vector_size (32))) v8si;
typedef di __attribute__((vector_size (32))) v4di;
typedef sf __attribute__((vector_size (32))) v8sf;
typedef df __attribute__((vector_size (32))) v4df;
typedef union U32QI { v32qi v; qi a[32]; } u32qi;
typedef union U16HI { v16hi v; hi a[16]; } u16hi;
typedef union U8SI { v8si v; si a[8]; } u8si;
typedef union U4DI { v4di v; di a[4]; } u4di;
typedef union U8SF { v8sf v; sf a[8]; } u8sf;
typedef union U4DF { v4df v; df a[4]; } u4df;
typedef union U8QI { v8qi v; qi a[8]; } u8qi;
typedef union U16QI { v16qi v; qi a[16]; } u16qi;

View File

@ -156,6 +156,8 @@ proc compat-run { testname objlist dest optall optfile optstr } {
proc compat-get-options-main { src } {
# dg-options sets a variable called dg-extra-tool-flags.
set dg-extra-tool-flags ""
# dg-options sets a variable called tool_flags.
set tool_flags ""
# dg-require-* sets dg-do-what.
upvar dg-do-what dg-do-what
@ -164,6 +166,7 @@ proc compat-get-options-main { src } {
foreach op $tmp {
set cmd [lindex $op 0]
if { ![string compare "dg-options" $cmd] \
|| [string match "dg-skip-if" $cmd] \
|| [string match "dg-require-*" $cmd] } {
set status [catch "$op" errmsg]
if { $status != 0 } {