gcc/libgomp/testsuite/libgomp.c/atomic-10.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

140 lines
2.1 KiB
C

/* { dg-do run } */
extern void abort (void);
int x1, x2, x3, x4, x5;
volatile int y6 = 9, y2, y3, y4, y5;
volatile unsigned char z1, z2, z3, z4, z5;
float a1, a2, a3, a4;
void
f1 (void)
{
#pragma omp atomic
x1++;
#pragma omp atomic
x2--;
#pragma omp atomic
++x3;
#pragma omp atomic
--x4;
#pragma omp atomic
x5 += 1;
#pragma omp atomic
x1 -= y6;
#pragma omp atomic
x2 |= 1;
#pragma omp atomic
x3 &= 1;
#pragma omp atomic
x4 ^= 1;
#pragma omp atomic
x5 *= 3;
#pragma omp atomic
x1 /= 3;
#pragma omp atomic
x2 /= 3;
#pragma omp atomic
x3 <<= 3;
#pragma omp atomic
x4 >>= 3;
}
void
f2 (void)
{
#pragma omp atomic
y6++;
#pragma omp atomic
y2--;
#pragma omp atomic
++y3;
#pragma omp atomic
--y4;
#pragma omp atomic
y5 += 1;
#pragma omp atomic
y6 -= x1;
#pragma omp atomic
y2 |= 1;
#pragma omp atomic
y3 &= 1;
#pragma omp atomic
y4 ^= 1;
#pragma omp atomic
y5 *= 3;
#pragma omp atomic
y6 /= 3;
#pragma omp atomic
y2 /= 3;
#pragma omp atomic
y3 <<= 3;
#pragma omp atomic
y4 >>= 3;
}
void
f3 (void)
{
#pragma omp atomic
z1++;
#pragma omp atomic
z2--;
#pragma omp atomic
++z3;
#pragma omp atomic
--z4;
#pragma omp atomic
z5 += 1;
#pragma omp atomic
z1 |= 1;
#pragma omp atomic
z2 &= 1;
#pragma omp atomic
z3 ^= 1;
#pragma omp atomic
z4 *= 3;
#pragma omp atomic
z5 /= 3;
#pragma omp atomic
z1 /= 3;
#pragma omp atomic
z2 <<= 3;
#pragma omp atomic
z3 >>= 3;
}
void
f4 (void)
{
#pragma omp atomic
a1 += 8.0;
#pragma omp atomic
a2 *= 3.5;
#pragma omp atomic
a3 -= a1 + a2;
#pragma omp atomic
a4 /= 2.0;
}
int
main (void)
{
f1 ();
if (x1 != -2 || x2 != 0 || x3 != 8 || x4 != -1 || x5 != 3)
abort ();
f2 ();
if (y6 != 4 || y2 != 0 || y3 != 8 || y4 != -1 || y5 != 3)
abort ();
f3 ();
if (z1 != 0 || z2 != 8 || z3 != 0 || z4 != 253 || z5 != 0)
abort ();
a1 = 7;
a2 = 10;
a3 = 11;
a4 = 13;
f4 ();
if (a1 != 15.0 || a2 != 35.0 || a3 != -39.0 || a4 != 6.5)
abort ();
return 0;
}