gcc/libgomp/testsuite/libgomp.c/atomic-1.c
Uros Bizjak 516f1ed8ca default.exp: New file.
* testsuite/config/default.exp: New file.
	* testsuite/lib/libgomp.exp: New file.
	* testsuite/lib/libgomp.dg (load_gcc_lib, libgomp_init,
	libgomp_target_compile, libgomp_option_help, libgomp_option_proc,
	load_lib *, load_gcc_lib *): Move to libgomp.exp.
	(libgomp_load): Remove.
	* testsuite/lib/libgomp.exp (libgomp_init): Compute
	always_ld_library_path, not ld_library_path.  Set additional_flags
	to -march=i486 for ilp32 x86_64-*-* and i386-*-* targets.
	(target_compile): Do not call libgomp_init.  Append lang_library_path
	and lang_link_flags to options.
	* testsuite/libgomp.c/c.exp: Set DEFAULT_FLAGS to -O2.  Set
	ld_library_path from always_ld_library_path.  Set LD_LIBRARY_PATH
	here.
	* testsuite/libgomp.c++/c++.exp: Set ld_library_path from
	always_ld_library_path.  Set LD_LIBRARY_PATH here.
	* testsuite/libgomp.fortran/fortran.exp: Ditto.
	* testsuite/libgomp.c/atomic-1.c: Set dg-options to
	"-O2 -march=pentium" for ilp32 x86 targets. Simplify check for
	CX8 flag.
	* testsuite/libgomp.c/atomic-2.c: Set dg-options to "-O2 -mcx16" for
	lp64 x86 targets. Do not check for SSE3 bit. Do not define bit_SSE3.
	* testsuite/libgomp.c/pr29947-1.c: Remove default dg-options.
	* testsuite/libgomp.c/pr29947-1.c: Ditto.
	* testsuite/libgomp.c/atomic-10.c: Ditto.

From-SVN: r123125
2007-03-22 08:00:08 +01:00

63 lines
857 B
C

/* { dg-do run } */
/* { dg-options "-O2 -march=pentium" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
#ifdef __i386__
#include "../../../gcc/testsuite/gcc.dg/i386-cpuid.h"
#define bit_CX8 (1 << 8)
#endif
extern void abort (void);
double d;
struct
{
int i;
double e;
int j;
} x;
void
f1 (void)
{
#pragma omp atomic
d += 7.5;
#pragma omp atomic
d *= 2.5;
#pragma omp atomic
d /= 0.25;
}
void
f2 (void)
{
#pragma omp atomic
x.e += 7.5;
#pragma omp atomic
x.e *= 2.5;
#pragma omp atomic
x.e /= 0.25;
}
int
main (void)
{
#ifdef __i386__
unsigned long cpu_facilities;
cpu_facilities = i386_cpuid ();
if (!(cpu_facilities & bit_CX8))
return 0;
#endif
d = 1.0;
f1 ();
if (d != 85.0)
abort ();
x.e = 1.0;
f2 ();
if (x.i != 0 || x.e != 85.0 || x.j != 0)
abort ();
return 0;
}