diff options
author | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-05-17 05:56:15 +0000 |
---|---|---|
committer | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-05-17 05:56:15 +0000 |
commit | f259ef2dde37cdc1994ab89de4202de11db1758d (patch) | |
tree | fa16d409fa166f36caaced4b9b18b5c11655a10f /libgomp/testsuite | |
parent | f901aa342fec3c1daf7be7c1f6258571542389b1 (diff) | |
download | gcc-f259ef2dde37cdc1994ab89de4202de11db1758d.tar.gz |
2008-05-17 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk r135459
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@135460 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgomp/testsuite')
-rw-r--r-- | libgomp/testsuite/lib/libgomp.exp | 1 | ||||
-rw-r--r-- | libgomp/testsuite/libgomp.c/atomic-5.c | 40 | ||||
-rw-r--r-- | libgomp/testsuite/libgomp.c/atomic-6.c | 36 | ||||
-rw-r--r-- | libgomp/testsuite/libgomp.c/autopar-1.c | 44 |
4 files changed, 121 insertions, 0 deletions
diff --git a/libgomp/testsuite/lib/libgomp.exp b/libgomp/testsuite/lib/libgomp.exp index 2e9f9d8a726..274ee17f0a7 100644 --- a/libgomp/testsuite/lib/libgomp.exp +++ b/libgomp/testsuite/lib/libgomp.exp @@ -21,6 +21,7 @@ load_gcc_lib prune.exp load_gcc_lib target-libpath.exp load_gcc_lib wrapper.exp load_gcc_lib gcc-defs.exp +load_gcc_lib torture-options.exp load_gcc_lib gcc-dg.exp load_gcc_lib gfortran-dg.exp diff --git a/libgomp/testsuite/libgomp.c/atomic-5.c b/libgomp/testsuite/libgomp.c/atomic-5.c new file mode 100644 index 00000000000..3b4b0f11d64 --- /dev/null +++ b/libgomp/testsuite/libgomp.c/atomic-5.c @@ -0,0 +1,40 @@ +/* PR middle-end/36106 */ +/* { dg-options "-O2" } */ +/* { dg-options "-O2 -mcx16" { target { { i?86-*-* x86_64-*-* } && lp64 } } } */ + +#ifdef __x86_64__ +# include "../../../gcc/config/i386/cpuid.h" +#endif + +extern void abort (void); + +int __attribute__((noinline)) +do_test (void) +{ + long double d = .0L; + int i; + #pragma omp parallel for shared (d) + for (i = 0; i < 10; i++) + #pragma omp atomic + d += 1.0L; + if (d != 10.0L) + abort (); + return 0; +} + +int +main (void) +{ +#ifdef __x86_64__ + unsigned int eax, ebx, ecx, edx; + + if (!__get_cpuid (1, &eax, &ebx, &ecx, &edx)) + return 0; + + if (ecx & bit_CMPXCHG16B) + do_test (); +#else + do_test (); +#endif + return 0; +} diff --git a/libgomp/testsuite/libgomp.c/atomic-6.c b/libgomp/testsuite/libgomp.c/atomic-6.c new file mode 100644 index 00000000000..949fc3d73da --- /dev/null +++ b/libgomp/testsuite/libgomp.c/atomic-6.c @@ -0,0 +1,36 @@ +/* PR middle-end/36106 */ +/* { dg-options "-O2" } */ +/* { dg-options "-O2 -march=i586" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */ + +#ifdef __i386__ +# include "../../../gcc/config/i386/cpuid.h" +#endif + +extern void abort (void); + +union { unsigned long long l; double d; } u = { .l = 0x7ff0000000072301ULL }; + +int __attribute__((noinline)) +do_test (void) +{ +#pragma omp atomic + u.d += 1.0L; + return 0; +} + +int +main (void) +{ +#ifdef __i386__ + unsigned int eax, ebx, ecx, edx; + + if (!__get_cpuid (1, &eax, &ebx, &ecx, &edx)) + return 0; + + if (edx & bit_CMPXCHG8B) + do_test (); +#else + do_test (); +#endif + return 0; +} diff --git a/libgomp/testsuite/libgomp.c/autopar-1.c b/libgomp/testsuite/libgomp.c/autopar-1.c new file mode 100644 index 00000000000..e56549b4845 --- /dev/null +++ b/libgomp/testsuite/libgomp.c/autopar-1.c @@ -0,0 +1,44 @@ +/* { dg-do run } */ +/* { dg-options "-ftree-parallelize-loops=4 -O2 -ffast-math" } */ + +extern void abort (void); + +double d[1024], e[1024]; +int f[1024], g[1024]; + +double __attribute__((noinline)) +foo (void) +{ + double s = 0.0; + int i; + for (i = 0; i < 1024; i++) + s += d[i] - e[i]; + return s; +} + +int __attribute__((noinline)) +bar (void) +{ + int s = 0, i; + for (i = 0; i < 1024; i++) + s += f[i] - g[i]; + return s; +} + +int +main (void) +{ + int i; + for (i = 0; i < 1024; i++) + { + d[i] = i * 2; + e[i] = i; + f[i] = i * 2; + g[i] = i; + } + if (foo () != 1023 * 1024 / 2) + abort (); + if (bar () != 1023 * 1024 / 2) + abort (); + return 0; +} |