diff options
author | Jakub Jelinek <jakub@gcc.gnu.org> | 2008-05-07 09:28:14 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2008-05-07 09:28:14 +0200 |
commit | c18c98c0ade56bc46ce65bbf5cdff26a2577c990 (patch) | |
tree | 8a49369b064d64c16fa89af2d0a836f7966d2e98 /libgomp/testsuite/libgomp.c/atomic-5.c | |
parent | 537d4fa684f272ea72c1c8db58e4f1dcd3b7cda4 (diff) | |
download | gcc-c18c98c0ade56bc46ce65bbf5cdff26a2577c990.zip gcc-c18c98c0ade56bc46ce65bbf5cdff26a2577c990.tar.gz gcc-c18c98c0ade56bc46ce65bbf5cdff26a2577c990.tar.bz2 |
re PR middle-end/36106 (#pragma omp atomic issues with floating point types)
PR middle-end/36106
* omp-low.c (expand_omp_atomic_pipeline): Load value using the
integral type rather than floating point, then VIEW_CONVERT_EXPR
to the floating point type.
* testsuite/libgomp.c/atomic-5.c: New test.
* testsuite/libgomp.c/atomic-6.c: New test.
* testsuite/libgomp.c/autopar-1.c: New test.
From-SVN: r135027
Diffstat (limited to 'libgomp/testsuite/libgomp.c/atomic-5.c')
-rw-r--r-- | libgomp/testsuite/libgomp.c/atomic-5.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/libgomp/testsuite/libgomp.c/atomic-5.c b/libgomp/testsuite/libgomp.c/atomic-5.c new file mode 100644 index 0000000..3b4b0f1 --- /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; +} |