From 7855700e63045fcd807718625e1c45f561dc7085 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 4 Jun 2019 14:49:03 +0200 Subject: gimplify.c (gimplify_scan_omp_clauses): Don't sorry_at on lastprivate conditional on combined for simd. * gimplify.c (gimplify_scan_omp_clauses): Don't sorry_at on lastprivate conditional on combined for simd. * omp-low.c (struct omp_context): Add combined_into_simd_safelen0 member. (lower_rec_input_clauses): For gimple_omp_for_combined_into_p max_vf 1 constructs, don't remove lastprivate_conditional_map, but instead set ctx->combined_into_simd_safelen0 and adjust hash_map, so that it points to parent construct temporaries. (lower_lastprivate_clauses): Handle ctx->combined_into_simd_safelen0 like !ctx->lastprivate_conditional_map. (lower_omp_1) : If up->combined_into_simd_safelen0, use up->outer context instead of up. * omp-expand.c (expand_omp_for_generic): Perform cond_var bump even if gimple_omp_for_combined_p. (expand_omp_for_static_nochunk): Likewise. (expand_omp_for_static_chunk): Add forgotten cond_var bump that was probably moved over into expand_omp_for_generic rather than being copied there. gcc/cp/ * cp-tree.h (CP_OMP_CLAUSE_INFO): Allow for any clauses up to _condvar_ instead of only up to linear. gcc/testsuite/ * c-c++-common/gomp/lastprivate-conditional-2.c (foo): Don't expect a sorry_at on any of the clauses. libgomp/ * testsuite/libgomp.c-c++-common/lastprivate-conditional-7.c: New test. * testsuite/libgomp.c-c++-common/lastprivate-conditional-8.c: New test. * testsuite/libgomp.c-c++-common/lastprivate-conditional-9.c: New test. * testsuite/libgomp.c-c++-common/lastprivate-conditional-10.c: New test. From-SVN: r271907 --- .../lastprivate-conditional-10.c | 57 ++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 libgomp/testsuite/libgomp.c-c++-common/lastprivate-conditional-10.c (limited to 'libgomp/testsuite/libgomp.c-c++-common/lastprivate-conditional-10.c') diff --git a/libgomp/testsuite/libgomp.c-c++-common/lastprivate-conditional-10.c b/libgomp/testsuite/libgomp.c-c++-common/lastprivate-conditional-10.c new file mode 100644 index 0000000..2f75039 --- /dev/null +++ b/libgomp/testsuite/libgomp.c-c++-common/lastprivate-conditional-10.c @@ -0,0 +1,57 @@ +/* { dg-do run } */ + +int v, x; + +__attribute__((noipa)) int +foo (int *a) +{ + #pragma omp parallel for simd lastprivate (conditional: x) schedule(simd: static) if (simd: 0) + for (int i = 0; i < 128; i++) + if (a[i]) + x = a[i]; + return x; +} + +__attribute__((noipa)) int +bar (int *a, int *b) +{ + #pragma omp parallel + #pragma omp for simd lastprivate (conditional: x, v) schedule(static, 16) simdlen (1) + for (int i = 16; i < 128; ++i) + { + if (a[i]) + x = a[i]; + if (b[i]) + v = b[i] + 10; + } + return x; +} + +__attribute__((noipa)) int +baz (int *a) +{ + #pragma omp parallel for simd if (simd: 0) lastprivate (conditional: x) schedule(simd: dynamic, 16) + for (int i = 0; i < 128; i++) + if (a[i]) + x = a[i] + 5; + return x; +} + +int +main () +{ + int a[128], b[128], i; + for (i = 0; i < 128; i++) + { + a[i] = ((i % 11) == 2) ? i + 10 : 0; + asm volatile ("" : "+g" (i)); + b[i] = ((i % 13) == 5) ? i * 2 : 0; + } + if (foo (a) != 133) + __builtin_abort (); + if (bar (b, a) != 244 || v != 143) + __builtin_abort (); + if (baz (b) != 249) + __builtin_abort (); + return 0; +} -- cgit v1.1