diff options
author | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-02-10 15:13:54 +0000 |
---|---|---|
committer | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-02-10 15:13:54 +0000 |
commit | 8cff878b277f9af6c2827a87581baac5f768e12a (patch) | |
tree | d4e178503efd243eed24ff3b753cd998370d75d4 /libgomp | |
parent | 9610b14f8599a9db94822d3f0923b58b2f1177dc (diff) | |
download | gcc-8cff878b277f9af6c2827a87581baac5f768e12a.tar.gz |
[./]
2016-02-10 Basile Starynkevitch <basile@starynkevitch.net>
{{merging with some of GCC 6, using
svn merge -r222130:226090 ^/trunk ; UNSTABLE}}
[gcc/]
2016-02-10 Basile Starynkevitch <basile@starynkevitch.net>
{{ merging with trunk 226090 ; UNSTABLE }}
* melt-run.proto.h: include tree-ssa-scopedtables.h
* tree-ssa-dom.c: skip second record_edge_info
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@233272 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgomp')
271 files changed, 3914 insertions, 636 deletions
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index 4b0a1c91be6..d8d37cf7329 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,3 +1,711 @@ +2015-07-22 Maxim Blumenthal <maxim.blumenthal@intel.com> + + PR libgomp/66950 + * testsuite/libgomp.c/examples-4/simd-7.c (N): Change to 30 from 45. + (fib_ref): New function. + (fib): Correct corner cases in the recursion. + (main): Replace the non-simd loop with fib_ref call. + * testsuite/libgomp.fortran/examples-4/simd-7.f90: (fib_ref): New + subroutine. + (fibonacci): Lower the parameter N to 30. Correct accordingly check + for the last array element value. Replace the non-simd loop with + fib_ref call. Remove redundant b_ref array. Remove the comparison + of the last array element with according Fibonacci sequence element. + (fib): Correct corner cases in the recursion. + +2015-07-21 Nathan Sidwell <nathan@codesourcery.com> + + * target.c (gomp_offload_image_to_device): Rename to ... + (gomp_load_image_to_device): ... here. + (GOMP_offload_register): Adjust call. + (gomp_init_device): Likewise. + (gomp_unload_image_from_device): New. Broken out of ... + (GOMP_offload_unregister): ... here. Call it. + (gomp_unload_device): New. + * libgomp.h (gomp_unload_device): Declare. + * oacc-init.c (acc_shutdown_1): Unload from device before deleting + mem maps. + +2015-07-20 Nathan Sidwell <nathan@codesourcery.com> + + * oacc-parallel.c (GOACC_parallel): Move variadic handling into + wait=-specific if. + (GOACC_enter_exit_data, GOACC_update): Use consistent num_waits + !=0 condition. + (goacc_waits): Move !num_waits handling to ... + (GOACC_wait): ... here, the only caller that might have zero waits. + + * plugin/plugin-nvptx.c (struct targ_fn_descriptor): Move later. + (struct ptx_image_data): Move earlier, add fns field. + (struct ptx_device): Add images and image_lock fields. + (ptx_images, ptx_image_lock): Delete. + (nvptx_open_device): Initialize images and image_lock fields. + (nvptx_close_device): Destroy image_lock. + (GOMP_OFFLOAD_load_image): Register image to device-specific fields. + (GOMP_OFFLOAD_unload_image): Unregister image from device-specific + fields. + +2015-07-17 Nathan Sidwell <nathan@codesourcery.com> + + * target.c (GOMP_offload_register): Use int for device type arg. + (GOMP_offload_unregister): Likewise. + + * target.c (struct_offload_image_descr): Constify host_table. + (gomp_offload_image_to_device): Likewise. + (GOMP_offload_register, GOMP_offload_unregister): Likewise. + + * libgomp.h (gomp_device_descr): Constify target data arguments. + * target.c (struct offload_image_descr): Constify target_data. + (gomp_offload_image_to_device): Likewise. + (GOMP_offload_register): Likewise. + (GOMP_offload_unrefister): Likewise. + * plugin/plugin-host.c (GOMP_OFFLOAD_load_image, + GOMP_OFFLOAD_unload_image): Constify target data. + * plugin/plugin-nvptx.c (struct ptx_image_data): Constify target data. + (GOMP_OFFLOAD_load_image, GOMP_OFFLOAD_unload_image): Likewise. + +2015-07-16 Nathan Sidwell <nathan@codesourcery.com> + + * plugin/plugin-nvptx.c (link_ptx): Constify string argument. + Workaround driver library const error. + (struct nvptx_tdata, nvptx_tdata_t): New. + (GOMP_OFFLOAD_load_image): Use struct for target_data's real + type. + +2015-07-15 Maxim Blumenthal <maxim.blumenthal@intel.com> + + * testsuite/libgomp.fortran/examples-4/simd-8.f90: (main): Change type + of EPS parameter from integer to real. + * testsuite/libgomp.fortran/examples-4/task_dep-5.f90: (check): Change + type of EPS parameter from integer to real. + +2015-07-15 Sebastian Huber <sebastian.huber@embedded-brains.de> + + * team.c (get_last_team): New. + (gomp_new_team): Recycle last non-nested team if possible. + (gomp_team_end): Move team work share list free lock destruction + to ... + (free_team): ... here. + +2015-07-14 Maxim Blumenthal <maxim.blumenthal@intel.com> + + * testsuite/libgomp.c/examples-4/simd-3.c: (main): Change type of res + and ref from int to double. Replaced their comparison with + an inequality of their difference and EPS. + * testsuite/libgomp.c/examples-4/simd-8.c: (main): Replace the + comparison of pri and a reference number with an inequality of their + difference and EPS. + * testsuite/libgomp.fortran/examples-4/simd-3.f90: (main): Replaced + the comparison of sum and sum_ref with an inequality of their + difference and EPS. + * testsuite/libgomp.fortran/examples-4/simd-8.f90: (main): Replace + the comparison of pri and a reference number with an inequality of + their difference and EPS. + +2015-07-13 Maxim Blumenthal <maxim.blumenthal@intel.com> + + * testsuite/libgomp.c++/examples-4/e.53.2.C: Renamed to... + * testsuite/libgomp.c++/examples-4/declare_target-2.C: ...this. + * testsuite/libgomp.c++/examples-4/e.51.5.C: Renamed to... + * testsuite/libgomp.c++/examples-4/target_data-5.C: ...this. + * testsuite/libgomp.c/examples-4/e.56.3.c: Renamed to... + * testsuite/libgomp.c/examples-4/array_sections-3.c: ...this. + * testsuite/libgomp.c/examples-4/e.56.4.c: Renamed to... + * testsuite/libgomp.c/examples-4/array_sections-4.c: ...this. + * testsuite/libgomp.c/examples-4/e.55.1.c: Renamed to... + * testsuite/libgomp.c/examples-4/async_target-1.c: ...this. + * testsuite/libgomp.c/examples-4/e.55.2.c: Renamed to... + * testsuite/libgomp.c/examples-4/async_target-2.c: ...this. + (vec_mult_ref): Remove v1 and v2 arguments, turn them into local + variables. + (vec_mult): Likewise. Add #pragma omp taskwait. + (main): Adjust caller. + * testsuite/libgomp.c/examples-4/e.53.1.c: Renamed to... + * testsuite/libgomp.c/examples-4/declare_target-1.c: ...this. + * testsuite/libgomp.c/examples-4/e.53.3.c: Renamed to... + * testsuite/libgomp.c/examples-4/declare_target-3.c: ...this. + * testsuite/libgomp.c/examples-4/e.53.4.c: Renamed to... + * testsuite/libgomp.c/examples-4/declare_target-4.c: ...this. + * testsuite/libgomp.c/examples-4/e.53.5.c: Renamed to... + * testsuite/libgomp.c/examples-4/declare_target-5.c: ...this. + * testsuite/libgomp.c/examples-4/e.57.1.c: Renamed to... + * testsuite/libgomp.c/examples-4/device-1.c: ...this. + * testsuite/libgomp.c/examples-4/e.57.2.c: Renamed to... + * testsuite/libgomp.c/examples-4/device-2.c: ...this. + * testsuite/libgomp.c/examples-4/e.57.3.c: Renamed to... + * testsuite/libgomp.c/examples-4/device-3.c: ...this. + * testsuite/libgomp.c/examples-4/simd-1.c: New file. + * testsuite/libgomp.c/examples-4/simd-2.c: New file. + * testsuite/libgomp.c/examples-4/simd-3.c: New file. + * testsuite/libgomp.c/examples-4/simd-4.c: New file. + * testsuite/libgomp.c/examples-4/simd-5.c: New file. + * testsuite/libgomp.c/examples-4/simd-6.c: New file. + * testsuite/libgomp.c/examples-4/simd-7.c: New file. + * testsuite/libgomp.c/examples-4/simd-8.c: New file. + * testsuite/libgomp.c/examples-4/e.50.1.c: Renamed to... + * testsuite/libgomp.c/examples-4/target-1.c: ...this. + * testsuite/libgomp.c/examples-4/e.50.2.c: Renamed to... + * testsuite/libgomp.c/examples-4/target-2.c: ...this. + * testsuite/libgomp.c/examples-4/e.50.3.c: Renamed to... + * testsuite/libgomp.c/examples-4/target-3.c: ...this. + * testsuite/libgomp.c/examples-4/e.50.4.c: Renamed to... + * testsuite/libgomp.c/examples-4/target-4.c: ...this. + * testsuite/libgomp.c/examples-4/e.50.5.c: Renamed to... + * testsuite/libgomp.c/examples-4/target-5.c: ...this. + * testsuite/libgomp.c/examples-4/e.51.1.c: Renamed to... + * testsuite/libgomp.c/examples-4/target_data-1.c: ...this. + * testsuite/libgomp.c/examples-4/e.51.2.c: Renamed to... + * testsuite/libgomp.c/examples-4/target_data-2.c: ...this. + * testsuite/libgomp.c/examples-4/e.51.3.c: Renamed to... + * testsuite/libgomp.c/examples-4/target_data-3.c: ...this. + * testsuite/libgomp.c/examples-4/e.51.4.c: Renamed to... + * testsuite/libgomp.c/examples-4/target_data-4.c: ...this. + * testsuite/libgomp.c/examples-4/e.51.6.c: Renamed to... + * testsuite/libgomp.c/examples-4/target_data-6.c: ...this. + * testsuite/libgomp.c/examples-4/e.51.7.c: Renamed to... + * testsuite/libgomp.c/examples-4/target_data-7.c: ...this. + * testsuite/libgomp.c/examples-4/e.52.1.c: Renamed to... + * testsuite/libgomp.c/examples-4/target_update-1.c: ...this. + * testsuite/libgomp.c/examples-4/e.52.2.c: Renamed to... + * testsuite/libgomp.c/examples-4/target_update-2.c: ...this. + * testsuite/libgomp.c/examples-4/task_dep-1.c: New file. + * testsuite/libgomp.c/examples-4/task_dep-2.c: New file. + * testsuite/libgomp.c/examples-4/task_dep-3.c: New file. + * testsuite/libgomp.c/examples-4/task_dep-4.c: New file. + * testsuite/libgomp.c/examples-4/task_dep-5.c: New file. + * testsuite/libgomp.c/examples-4/e.54.2.c: Renamed to... + * testsuite/libgomp.c/examples-4/teams-2.c: ...this. + * testsuite/libgomp.c/examples-4/e.54.3.c: Renamed to... + * testsuite/libgomp.c/examples-4/teams-3.c: ...this. + * testsuite/libgomp.c/examples-4/e.54.4.c: Renamed to... + * testsuite/libgomp.c/examples-4/teams-4.c: ...this. + * testsuite/libgomp.c/examples-4/e.54.5.c: Renamed to... + * testsuite/libgomp.c/examples-4/teams-5.c: ...this. + * testsuite/libgomp.c/examples-4/e.54.6.c: Renamed to... + * testsuite/libgomp.c/examples-4/teams-6.c: ...this. + * testsuite/libgomp.fortran/examples-4/e.56.3.f90: Renamed to... + * testsuite/libgomp.fortran/examples-4/array_sections-3.f90: ...this. + * testsuite/libgomp.fortran/examples-4/e.56.4.f90: Renamed to... + * testsuite/libgomp.fortran/examples-4/array_sections-4.f90: ...this. + * testsuite/libgomp.fortran/examples-4/e.55.1.f90: Renamed to... + * testsuite/libgomp.fortran/examples-4/async_target-1.f90: ...this. + * testsuite/libgomp.fortran/examples-4/e.55.2.f90: Renamed to... + * testsuite/libgomp.fortran/examples-4/async_target-2.f90: ...this. + (vec_mult): Add !$omp taskwait. + * testsuite/libgomp.fortran/examples-4/e.53.1.f90: Renamed to... + * testsuite/libgomp.fortran/examples-4/declare_target-1.f90: ...this. + * testsuite/libgomp.fortran/examples-4/e.53.2.f90: Renamed to... + * testsuite/libgomp.fortran/examples-4/declare_target-2.f90: ...this. + * testsuite/libgomp.fortran/examples-4/e.53.3.f90: Renamed to... + * testsuite/libgomp.fortran/examples-4/declare_target-3.f90: ...this. + * testsuite/libgomp.fortran/examples-4/e.53.4.f90: Renamed to... + * testsuite/libgomp.fortran/examples-4/declare_target-4.f90: ...this. + * testsuite/libgomp.fortran/examples-4/e.53.5.f90: Renamed to... + * testsuite/libgomp.fortran/examples-4/declare_target-5.f90: ...this. + * testsuite/libgomp.fortran/examples-4/e.57.1.f90: Renamed to... + * testsuite/libgomp.fortran/examples-4/device-1.f90: ...this. + * testsuite/libgomp.fortran/examples-4/e.57.2.f90: Renamed to... + * testsuite/libgomp.fortran/examples-4/device-2.f90: ...this. + * testsuite/libgomp.fortran/examples-4/e.57.3.f90: Renamed to... + * testsuite/libgomp.fortran/examples-4/device-3.f90: ...this. + * testsuite/libgomp.fortran/examples-4/simd-1.f90: New file. + * testsuite/libgomp.fortran/examples-4/simd-2.f90: New file. + * testsuite/libgomp.fortran/examples-4/simd-3.f90: New file. + * testsuite/libgomp.fortran/examples-4/simd-4.f90: New file. + * testsuite/libgomp.fortran/examples-4/simd-5.f90: New file. + * testsuite/libgomp.fortran/examples-4/simd-6.f90: New file. + * testsuite/libgomp.fortran/examples-4/simd-7.f90: New file. + * testsuite/libgomp.fortran/examples-4/simd-8.f90: New file. + * testsuite/libgomp.fortran/examples-4/e.50.1.f90: Renamed to... + * testsuite/libgomp.fortran/examples-4/target-1.f90: ...this. + * testsuite/libgomp.fortran/examples-4/e.50.2.f90: Renamed to... + * testsuite/libgomp.fortran/examples-4/target-2.f90: ...this. + * testsuite/libgomp.fortran/examples-4/e.50.3.f90: Renamed to... + * testsuite/libgomp.fortran/examples-4/target-3.f90: ...this. + * testsuite/libgomp.fortran/examples-4/e.50.4.f90: Renamed to... + * testsuite/libgomp.fortran/examples-4/target-4.f90: ...this. + * testsuite/libgomp.fortran/examples-4/e.50.5.f90: Renamed to... + * testsuite/libgomp.fortran/examples-4/target-5.f90: ...this. + * testsuite/libgomp.fortran/examples-4/e.51.1.f90: Renamed to... + * testsuite/libgomp.fortran/examples-4/target_data-1.f90: ...this. + * testsuite/libgomp.fortran/examples-4/e.51.2.f90: Renamed to... + * testsuite/libgomp.fortran/examples-4/target_data-2.f90: ...this. + * testsuite/libgomp.fortran/examples-4/e.51.3.f90: Renamed to... + * testsuite/libgomp.fortran/examples-4/target_data-3.f90: ...this. + * testsuite/libgomp.fortran/examples-4/e.51.4.f90: Renamed to... + * testsuite/libgomp.fortran/examples-4/target_data-4.f90: ...this. + * testsuite/libgomp.fortran/examples-4/e.51.5.f90: Renamed to... + * testsuite/libgomp.fortran/examples-4/target_data-5.f90: ...this. + * testsuite/libgomp.fortran/examples-4/e.51.6.f90: Renamed to... + * testsuite/libgomp.fortran/examples-4/target_data-6.f90: ...this. + * testsuite/libgomp.fortran/examples-4/e.51.7.f90: Renamed to... + * testsuite/libgomp.fortran/examples-4/target_data-7.f90: ...this. + * testsuite/libgomp.fortran/examples-4/e.52.1.f90: Renamed to... + * testsuite/libgomp.fortran/examples-4/target_update-1.f90: ...this. + * testsuite/libgomp.fortran/examples-4/e.52.2.f90: Renamed to... + * testsuite/libgomp.fortran/examples-4/target_update-2.f90: ...this. + * testsuite/libgomp.fortran/examples-4/task_dep-1.f90: New file. + * testsuite/libgomp.fortran/examples-4/task_dep-2.f90: New file. + * testsuite/libgomp.fortran/examples-4/task_dep-3.f90: New file. + * testsuite/libgomp.fortran/examples-4/task_dep-4.f90: New file. + * testsuite/libgomp.fortran/examples-4/task_dep-5.f90: New file. + * testsuite/libgomp.fortran/examples-4/e.54.2.f90: Renamed to... + * testsuite/libgomp.fortran/examples-4/teams-2.f90: ...this. + * testsuite/libgomp.fortran/examples-4/e.54.3.f90: Renamed to... + * testsuite/libgomp.fortran/examples-4/teams-3.f90: ...this. + * testsuite/libgomp.fortran/examples-4/e.54.4.f90: Renamed to... + * testsuite/libgomp.fortran/examples-4/teams-4.f90: ...this. + * testsuite/libgomp.fortran/examples-4/e.54.5.f90: Renamed to... + * testsuite/libgomp.fortran/examples-4/teams-5.f90: ...this. + * testsuite/libgomp.fortran/examples-4/e.54.6.f90: Renamed to... + * testsuite/libgomp.fortran/examples-4/teams-6.f90: ...this. + +2015-07-10 Tom de Vries <tom@codesourcery.com> + + * testsuite/libgomp.fortran/parloops-exit-first-loop-alt-2.f95: New test. + * testsuite/libgomp.fortran/parloops-exit-first-loop-alt.f95: New test. + +2015-07-08 Thomas Schwinge <thomas@codesourcery.com> + + PR libgomp/65099 + * plugin/plugin-nvptx.c (nvptx_get_num_devices): Return 0 if not + in a 64-bit configuration. + * testsuite/libgomp.oacc-c++/c++.exp: Don't attempt nvidia + offloading testing if no such device is available. + * testsuite/libgomp.oacc-c/c.exp: Likewise. + * testsuite/libgomp.oacc-fortran/fortran.exp: Likewise. + +2015-07-08 Tom de Vries <tom@codesourcery.com> + + * testsuite/libgomp.c/parloops-exit-first-loop-alt-3.c (main): Fix + second call to f. + * testsuite/libgomp.c/parloops-exit-first-loop-alt.c: Same. + +2015-07-07 Tom de Vries <tom@codesourcery.com> + + PR tree-optimization/66642 + * testsuite/libgomp.c/parloops-exit-first-loop-alt-3.c (main): Test low + iteration count case. + * testsuite/libgomp.c/parloops-exit-first-loop-alt.c (init): New + function, factor out of ... + (main): ... here. Test low iteration count case. + +2015-07-06 Sebastian Huber <sebastian.huber@embedded-brains.de> + + * libgomp.h (gomp_thread_pool): Comment last_team field. + +2015-07-02 Uros Bizjak <ubizjak@gmail.com> + + * testsuite/libgomp.c++/pr66702-1.C: Require + vect_simd_clones effective target. + * testsuite/libgomp.c++/pr66702-2.C: Ditto. + +2015-06-30 Tom de Vries <tom@codesourcery.com> + + * testsuite/libgomp.oacc-c++/c++.exp: Set DEFAULT_CFLAGS to -O2 if not + already set. Use DEFAULT_CFLAGS in dg-runtest. + * testsuite/libgomp.oacc-c-c++-common/collapse-3.c: Remove dg-options + "-O2". + +2015-06-30 Tom de Vries <tom@codesourcery.com> + + * testsuite/libgomp.c++/c++.exp: Set DEFAULT_CFLAGS to -O2 if not + already set. Use DEFAULT_CFLAGS in dg-runtest. + * testsuite/libgomp.c++/atomic-16.C: Remove dg-options "-O2 -fopenmp". + * testsuite/libgomp.c++/pr64824.C: Same. + * testsuite/libgomp.c++/pr64868.C: Same. + * testsuite/libgomp.c++/pr66199-1.C: Same. + * testsuite/libgomp.c++/pr66199-2.C: Same. + * testsuite/libgomp.c++/target-2.C: Same. + * testsuite/libgomp.c++/for-7.C: Use dg-additional-options for + -std=<standard> option. + * testsuite/libgomp.c++/udr-11.C: Same. + * testsuite/libgomp.c++/udr-12.C: Same. + * testsuite/libgomp.c++/udr-13.C: Same. + * testsuite/libgomp.c++/udr-14.C: Same. + * testsuite/libgomp.c++/udr-15.C: Same. + * testsuite/libgomp.c++/udr-16.C: Same. + * testsuite/libgomp.c++/udr-17.C: Same. + * testsuite/libgomp.c++/udr-18.C: Same. + * testsuite/libgomp.c++/udr-19.C: Same. + * testsuite/libgomp.c++/atomic-1.C: Remove dg-options "-O2". + * testsuite/libgomp.c++/simd-1.C: Same. + * testsuite/libgomp.c++/simd-2.C: Same. + * testsuite/libgomp.c++/simd-3.C: Same. + * testsuite/libgomp.c++/simd-4.C: Same. + * testsuite/libgomp.c++/simd-5.C: Same. + * testsuite/libgomp.c++/simd-6.C: Same. + * testsuite/libgomp.c++/simd-7.C: Same. + * testsuite/libgomp.c++/simd-8.C: Same. + * testsuite/libgomp.c++/simd-9.C: Same. + * testsuite/libgomp.c++/simd10.C: Same. + * testsuite/libgomp.c++/simd11.C: Same. + * testsuite/libgomp.c++/simd12.C: Same. + * testsuite/libgomp.c++/simd13.C: Same. + +2015-06-30 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/66702 + * testsuite/libgomp.c++/pr66702-1.C: New test. + * testsuite/libgomp.c++/pr66702-2.C: New test. + +2015-06-30 Tom de Vries <tom@codesourcery.com> + + * testsuite/libgomp.c/parloops-exit-first-loop-alt-5.c: New test. + * testsuite/libgomp.c/parloops-exit-first-loop-alt-6.c: New test. + * testsuite/libgomp.c/parloops-exit-first-loop-alt-7.c: New test. + * testsuite/libgomp.c/parloops-exit-first-loop-alt.c: Update comment. + +2015-06-30 Tom de Vries <tom@codesourcery.com> + + PR tree-optimization/66652 + * testsuite/libgomp.c/parloops-exit-first-loop-alt-3.c (f): Rewrite + using restrict pointers. + (main): Add arguments to calls to f. + * testsuite/libgomp.c/parloops-exit-first-loop-alt.c: Same. + +2015-06-23 Andreas Tobler <andreast@gcc.gnu.org> + + * configure.ac: Fix check for header <sys/sysctl.h>. + * configure: Regenerate. + * config.h.in: Likewise. + +2015-06-23 Tom de Vries <tom@codesourcery.com> + + * testsuite/libgomp.c/parloops-exit-first-loop-alt-3.c (main): Use + abort. + * testsuite/libgomp.c/parloops-exit-first-loop-alt-4.c (main): Same. + +2015-06-19 Thomas Schwinge <thomas@codesourcery.com> + + * testsuite/libgomp.oacc-c-c++-common/lib-62.c: Only consider for + acc_device_nvidia. + + PR libgomp/66518 + * testsuite/libgomp.oacc-c-c++-common/lib-3.c: XFAIL. + * testsuite/libgomp.oacc-c-c++-common/lib-42.c: Likewise. + +2015-06-15 Tom de Vries <tom@codesourcery.com> + + * testsuite/libgomp.c/atomic-1.c: Remove dg-options "-O2". Use + dg-additional-options for any remaining options. + * testsuite/libgomp.c/atomic-2.c: Same. + * testsuite/libgomp.c/atomic-4.c: Same. + * testsuite/libgomp.c/atomic-5.c: Same. + * testsuite/libgomp.c/atomic-6.c: Same. + * testsuite/libgomp.c/autopar-1.c: Same. + * testsuite/libgomp.c/copyin-1.c: Same. + * testsuite/libgomp.c/copyin-2.c: Same. + * testsuite/libgomp.c/copyin-3.c: Same. + * testsuite/libgomp.c/examples-4/e.53.5.c: Same. + * testsuite/libgomp.c/nestedfn-5.c: Same. + * testsuite/libgomp.c/parloops-exit-first-loop-alt-2.c: Same. + * testsuite/libgomp.c/parloops-exit-first-loop-alt-3.c: Same. + * testsuite/libgomp.c/parloops-exit-first-loop-alt-4.c: Same. + * testsuite/libgomp.c/parloops-exit-first-loop-alt.c: Same. + * testsuite/libgomp.c/pr32362-1.c: Same. + * testsuite/libgomp.c/pr32362-2.c: Same. + * testsuite/libgomp.c/pr32362-3.c: Same. + * testsuite/libgomp.c/pr39591-1.c: Same. + * testsuite/libgomp.c/pr39591-2.c: Same. + * testsuite/libgomp.c/pr39591-3.c: Same. + * testsuite/libgomp.c/pr58392.c: Same. + * testsuite/libgomp.c/pr58756.c: Same. + * testsuite/libgomp.c/simd-1.c: Same. + * testsuite/libgomp.c/simd-10.c: Same. + * testsuite/libgomp.c/simd-11.c: Same. + * testsuite/libgomp.c/simd-12.c: Same. + * testsuite/libgomp.c/simd-13.c: Same. + * testsuite/libgomp.c/simd-14.c: Same. + * testsuite/libgomp.c/simd-15.c: Same. + * testsuite/libgomp.c/simd-2.c: Same. + * testsuite/libgomp.c/simd-3.c: Same. + * testsuite/libgomp.c/simd-4.c: Same. + * testsuite/libgomp.c/simd-5.c: Same. + * testsuite/libgomp.c/simd-6.c: Same. + * testsuite/libgomp.c/simd-7.c: Same. + * testsuite/libgomp.c/simd-8.c: Same. + * testsuite/libgomp.c/simd-9.c: Same. + +2015-06-15 Tom de Vries <tom@codesourcery.com> + + * testsuite/libgomp.c/pr35625.c: Fix typo. + +2015-06-15 Tom de Vries <tom@codesourcery.com> + + * testsuite/libgomp.c/atomic-18.c: Remove superfluous -fopenmp setting + in dg-options. + * testsuite/libgomp.c/atomic-3.c: Same. + * testsuite/libgomp.c/debug-1.c: Same. + * testsuite/libgomp.c/nqueens-1.c: Same. + * testsuite/libgomp.c/pr26171.c: Same. + * testsuite/libgomp.c/pr48591.c: Same. + * testsuite/libgomp.c/pr64824.c: Same. + * testsuite/libgomp.c/pr64868.c: Same. + * testsuite/libgomp.c/pr66133.c: Same. + * testsuite/libgomp.c/pr66199-1.c: Same. + * testsuite/libgomp.c/pr66199-2.c: Same. + * testsuite/libgomp.c/target-8.c: Same. + +2015-06-15 Tom de Vries <tom@codesourcery.com> + + * testsuite/libgomp.c/collapse-3.c: Use dg-additional-options for + -std={gnu99,c99}. + * testsuite/libgomp.c/for-1.c: Same. + * testsuite/libgomp.c/for-2.c: Same. + * testsuite/libgomp.c/for-3.c: Same. + * testsuite/libgomp.c/pr35625.c: Same. + * testsuite/libgomp.c/pr39154.c: Same. + * testsuite/libgomp.c/simd-16.c: Same. + * testsuite/libgomp.c/simd-17.c: Same. + +2015-06-13 Tom de Vries <tom@codesourcery.com> + + * testsuite/libgomp.c/parloops-exit-first-loop-alt-4.c: New test. + +2015-06-13 Tom de Vries <tom@codesourcery.com> + + * testsuite/libgomp.c/parloops-exit-first-loop-alt-2.c: Add comment. + * testsuite/libgomp.c/parloops-exit-first-loop-alt.c: Same. + * testsuite/libgomp.c/parloops-exit-first-loop-alt-3.c: Add comment. + (N): Define. + (main): Use N instead of hardcoded constants. + +2015-06-05 Tom de Vries <tom@codesourcery.com> + + merge from gomp4 branch: + 2015-05-28 Tom de Vries <tom@codesourcery.com> + + PR tree-optimization/65443 + * testsuite/libgomp.c/parloops-exit-first-loop-alt-2.c: New test. + * testsuite/libgomp.c/parloops-exit-first-loop-alt-3.c: New test. + * testsuite/libgomp.c/parloops-exit-first-loop-alt.c: New test. + +2015-05-29 Bernhard Reutner-Fischer <aldot@gcc.gnu.org> + + * testsuite/libgomp.graphite/bounds.c: Adjust for + cleanup-tree-dump removal. + * testsuite/libgomp.graphite/force-parallel-1.c: Likewise. + * testsuite/libgomp.graphite/force-parallel-2.c: Likewise. + * testsuite/libgomp.graphite/force-parallel-3.c: Likewise. + * testsuite/libgomp.graphite/force-parallel-4.c: Likewise. + * testsuite/libgomp.graphite/force-parallel-5.c: Likewise. + * testsuite/libgomp.graphite/force-parallel-6.c: Likewise. + * testsuite/libgomp.graphite/force-parallel-7.c: Likewise. + * testsuite/libgomp.graphite/force-parallel-8.c: Likewise. + * testsuite/libgomp.graphite/force-parallel-9.c: Likewise. + * testsuite/libgomp.graphite/pr41118.c: Likewise. + +2015-05-28 Uros Bizjak <ubizjak@gmail.com> + + * config/linux/x86/futex.h (sys_futex0) [!__x86_64__]: Remove function. + (futex_wait) [!__x86_64__]: Use __asm operand instead of sys_futex0. + (futex_wake) [!__x86_64__]: Ditto. + +2015-05-28 Julian Brown <julian@codesourcery.com> + + * oacc-init.c (resolve_device): Add FAIL_IS_ERROR argument. Update + function comment. Only call gomp_fatal if new argument is true. + (acc_dev_num_out_of_range): New function. + (acc_init_1, acc_shutdown_1): Update call to resolve_device. Call + acc_dev_num_out_of_range as appropriate. + (acc_get_num_devices, acc_set_device_type, acc_get_device_type) + (acc_get_device_num, acc_set_device_num): Update calls to + resolve_device. + * testsuite/libgomp.oacc-c-c++-common/lib-4.c: Update expected test + output. + +2015-05-28 Julian Brown <julian@codesourcery.com> + + PR libgomp/65742 + * oacc-init.c (plugin/plugin-host.h): Include. + (acc_on_device): Check whether we're in an offloaded region for + host_nonshm + plugin. Don't use __builtin_acc_on_device. + * plugin/plugin-host.c (GOMP_OFFLOAD_openacc_parallel): Set + nonshm_exec flag in thread-local data. + (GOMP_OFFLOAD_openacc_create_thread_data): Allocate thread-local + data for host_nonshm plugin. + (GOMP_OFFLOAD_openacc_destroy_thread_data): Free thread-local data + for host_nonshm plugin. + * plugin/plugin-host.h: New. + +2015-05-27 Uros Bizjak <ubizjak@gmail.com> + + * config/linux/ia64/futex.h (sys_futex0) Change operand "op" to int. + +2015-05-27 Uros Bizjak <ubizjak@gmail.com> + + * config/linux/wait.h (gomp_futex_wait, gomp_futex_wake): + Declare as int. + (FUTEX_PRIVATE_FLAG): Remove L suffix. + * config/linux/mutex.c (gomp_futex_wait, gomp_futex_wake): + Declare as int. + +2015-05-27 Uros Bizjak <ubizjak@gmail.com> + + * config/linux/x86/futex.h (sys_futex0) [__PIC__]: Remove function. + +2015-05-27 Chung-Lin Tang <cltang@codesourcery.com> + + * target.c (gomp_map_pointer): New function abstracting out + GOMP_MAP_POINTER handling. + (gomp_map_vars): Remove GOMP_MAP_POINTER handling code and use + gomp_map_pointer(). + +2015-05-19 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/66199 + * testsuite/libgomp.c/pr66199-1.c: New test. + * testsuite/libgomp.c/pr66199-2.c: New test. + * testsuite/libgomp.c++/pr66199-1.C: New test. + * testsuite/libgomp.c++/pr66199-2.C: New test. + * testsuite/libgomp.fortran/pr66199-1.f90: New test. + * testsuite/libgomp.fortran/pr66199-2.f90: New test. + +2015-05-19 Julian Brown <julian@codesourcery.com> + + * plugin/plugin-nvptx.c (nvptx_get_num_devices): Return zero + on cuInit failure. + +2015-05-13 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/66133 + * testsuite/libgomp.c/pr66133.c: New test. + +2015-05-13 Michael Haubenwallner <michael.haubenwallner@ssi-schaefer.com> + + * Makefile.in: Regenerated with automake-1.11.6. + * aclocal.m4: Likewise. + * config.h.in: Likewise. + * configure: Likewise. + * testsuite/Makefile.in: Likewise. + +2015-05-08 Jason Merrill <jason@redhat.com> + + * testsuite/libgomp.oacc-c-c++-common/reduction-4.c (main): Use + _Complex. + + * openacc.h (__GOACC_NOTHROW): Fix noexcept syntax. + +2015-05-06 Julian Brown <julian@codesourcery.com> + + * oacc-init.c (acc_device_lock): Add explanatory comment. + (resolve_device): Add comment about locking requirement. + (acc_init_1, acc_shutdown_1): Likewise. Add locking around + gomp_init_device and gomp_fini_device calls. + (acc_get_num_devices, acc_set_device_type, acc_get_device_type) + (acc_get_device_num, acc_set_device_num): Add locking around + resolve_device and gomp_init_device calls. + +2015-05-06 Julian Brown <julian@codesourcery.com> + + * oacc-init.c (acc_shutdown_1): Call gomp_mutex_unlock for + goacc_thread_lock on error paths. + * oacc-mem.c (lookup_host): Remove locking from function. Note + locking requirement for caller in function comment. + (lookup_dev): Likewise. + (acc_free, acc_deviceptr, acc_hostptr, acc_is_present) + (acc_map_data, acc_unmap_data, present_create_copy, delete_copyout) + (update_dev_host, gomp_acc_insert_pointer, gomp_acc_remove_pointer): + Add locking. + +2015-05-05 Thomas Schwinge <thomas@codesourcery.com> + + PR testsuite/65205 + PR libgomp/65993 + * testsuite/libgomp.oacc-c-c++-common/clauses-2.c: In dg-output, + don't expect "0x" prefix for "%p" format specifier, don't expect + "(nil)" for NULL pointer. + * testsuite/libgomp.oacc-c-c++-common/lib-16.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/lib-17.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/lib-18.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/lib-20.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/lib-21.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/lib-22.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/lib-23.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/lib-25.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/lib-26.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/lib-27.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/lib-28.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/lib-29.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/lib-30.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/lib-34.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/lib-35.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/lib-36.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/lib-39.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/lib-40.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/lib-42.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/lib-43.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/lib-44.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/lib-47.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/lib-48.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/lib-52.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/lib-53.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/lib-54.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/lib-57.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/lib-58.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/data-already-1.c: More + accurately specify what we're looking for. + * testsuite/libgomp.oacc-c-c++-common/data-already-2.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/data-already-8.c: Likewise. + * testsuite/libgomp.oacc-fortran/data-already-1.f: Likewise. + * testsuite/libgomp.oacc-fortran/data-already-2.f: Likewise. + * testsuite/libgomp.oacc-fortran/data-already-8.f: Likewise. + +2015-04-30 James Norris <jnorris@codesourcery.com> + + PR testsuite/65205 + * testsuite/lib/libgomp.exp + (check_effective_target_openacc_host_selected) + (check_effective_target_openacc_host_nonshm_selected): New + procedures. + * testsuite/libgomp.oacc-c-c++-common/clauses-2.c: Fix misuse of + dg-shouldfail. + * testsuite/libgomp.oacc-c-c++-common/lib-1.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/lib-11.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/lib-16.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/lib-17.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/lib-18.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/lib-2.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/lib-20.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/lib-21.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/lib-22.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/lib-23.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/lib-25.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/lib-26.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/lib-27.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/lib-28.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/lib-29.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/lib-3.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/lib-30.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/lib-34.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/lib-35.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/lib-36.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/lib-39.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/lib-4.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/lib-40.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/lib-42.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/lib-43.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/lib-44.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/lib-47.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/lib-48.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/lib-52.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/lib-53.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/lib-54.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/lib-57.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/lib-58.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/lib-62.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/lib-63.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/lib-64.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/lib-65.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/lib-67.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/lib-68.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/lib-71.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/lib-77.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/lib-80.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/present-1.c: Likewise. + 2015-04-08 Julian Brown <julian@codesourcery.com> * libgomp.h (target_mem_desc: Remove mem_map field. diff --git a/libgomp/Makefile.in b/libgomp/Makefile.in index 8596054a4f1..9d07e8d4959 100644 --- a/libgomp/Makefile.in +++ b/libgomp/Makefile.in @@ -505,6 +505,7 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; +$(top_srcdir)/plugin/Makefrag.am: $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck @@ -571,11 +572,11 @@ clean-toolexeclibLTLIBRARIES: echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done -libgomp-plugin-host_nonshm.la: $(libgomp_plugin_host_nonshm_la_OBJECTS) $(libgomp_plugin_host_nonshm_la_DEPENDENCIES) +libgomp-plugin-host_nonshm.la: $(libgomp_plugin_host_nonshm_la_OBJECTS) $(libgomp_plugin_host_nonshm_la_DEPENDENCIES) $(EXTRA_libgomp_plugin_host_nonshm_la_DEPENDENCIES) $(libgomp_plugin_host_nonshm_la_LINK) -rpath $(toolexeclibdir) $(libgomp_plugin_host_nonshm_la_OBJECTS) $(libgomp_plugin_host_nonshm_la_LIBADD) $(LIBS) -libgomp-plugin-nvptx.la: $(libgomp_plugin_nvptx_la_OBJECTS) $(libgomp_plugin_nvptx_la_DEPENDENCIES) +libgomp-plugin-nvptx.la: $(libgomp_plugin_nvptx_la_OBJECTS) $(libgomp_plugin_nvptx_la_DEPENDENCIES) $(EXTRA_libgomp_plugin_nvptx_la_DEPENDENCIES) $(libgomp_plugin_nvptx_la_LINK) $(am_libgomp_plugin_nvptx_la_rpath) $(libgomp_plugin_nvptx_la_OBJECTS) $(libgomp_plugin_nvptx_la_LIBADD) $(LIBS) -libgomp.la: $(libgomp_la_OBJECTS) $(libgomp_la_DEPENDENCIES) +libgomp.la: $(libgomp_la_OBJECTS) $(libgomp_la_DEPENDENCIES) $(EXTRA_libgomp_la_DEPENDENCIES) $(libgomp_la_LINK) -rpath $(toolexeclibdir) $(libgomp_la_OBJECTS) $(libgomp_la_LIBADD) $(LIBS) mostlyclean-compile: diff --git a/libgomp/config.h.in b/libgomp/config.h.in index 02547b16341..8533f0345b7 100644 --- a/libgomp/config.h.in +++ b/libgomp/config.h.in @@ -39,6 +39,9 @@ /* Define if pthread_{,attr_}{g,s}etaffinity_np is supported. */ #undef HAVE_PTHREAD_AFFINITY_NP +/* Define to 1 if you have the <pthread.h> header file. */ +#undef HAVE_PTHREAD_H + /* Define to 1 if you have the <semaphore.h> header file. */ #undef HAVE_SEMAPHORE_H @@ -70,6 +73,9 @@ /* Define to 1 if you have the <sys/stat.h> header file. */ #undef HAVE_SYS_STAT_H +/* Define to 1 if you have the <sys/sysctl.h> header file. */ +#undef HAVE_SYS_SYSCTL_H + /* Define to 1 if you have the <sys/time.h> header file. */ #undef HAVE_SYS_TIME_H diff --git a/libgomp/config/linux/ia64/futex.h b/libgomp/config/linux/ia64/futex.h index b63cd206e1d..868059f5a01 100644 --- a/libgomp/config/linux/ia64/futex.h +++ b/libgomp/config/linux/ia64/futex.h @@ -30,7 +30,7 @@ static inline long -sys_futex0(int *addr, long op, int val) +sys_futex0(int *addr, int op, int val) { register long out0 asm ("out0") = (long) addr; register long out1 asm ("out1") = op; diff --git a/libgomp/config/linux/mutex.c b/libgomp/config/linux/mutex.c index 7ab05a7b3e1..24261bff0d2 100644 --- a/libgomp/config/linux/mutex.c +++ b/libgomp/config/linux/mutex.c @@ -29,8 +29,8 @@ #include "wait.h" -long int gomp_futex_wake = FUTEX_WAKE | FUTEX_PRIVATE_FLAG; -long int gomp_futex_wait = FUTEX_WAIT | FUTEX_PRIVATE_FLAG; +int gomp_futex_wake = FUTEX_WAKE | FUTEX_PRIVATE_FLAG; +int gomp_futex_wait = FUTEX_WAIT | FUTEX_PRIVATE_FLAG; void gomp_mutex_lock_slow (gomp_mutex_t *mutex, int oldval) diff --git a/libgomp/config/linux/wait.h b/libgomp/config/linux/wait.h index 96d2fbe5f8c..7f57454a510 100644 --- a/libgomp/config/linux/wait.h +++ b/libgomp/config/linux/wait.h @@ -35,13 +35,13 @@ #define FUTEX_WAIT 0 #define FUTEX_WAKE 1 -#define FUTEX_PRIVATE_FLAG 128L +#define FUTEX_PRIVATE_FLAG 128 #ifdef HAVE_ATTRIBUTE_VISIBILITY # pragma GCC visibility push(hidden) #endif -extern long int gomp_futex_wait, gomp_futex_wake; +extern int gomp_futex_wait, gomp_futex_wake; #include <futex.h> diff --git a/libgomp/config/linux/x86/futex.h b/libgomp/config/linux/x86/futex.h index 6c6d317e595..8f934c0c63d 100644 --- a/libgomp/config/linux/x86/futex.h +++ b/libgomp/config/linux/x86/futex.h @@ -33,10 +33,9 @@ static inline void futex_wait (int *addr, int val) { - register long r10 __asm__("%r10"); long res; - r10 = 0; + register long r10 __asm__("%r10") = 0; __asm volatile ("syscall" : "=a" (res) : "0" (SYS_futex), "D" (addr), "S" (gomp_futex_wait), @@ -46,7 +45,6 @@ futex_wait (int *addr, int val) { gomp_futex_wait &= ~FUTEX_PRIVATE_FLAG; gomp_futex_wake &= ~FUTEX_PRIVATE_FLAG; - r10 = 0; __asm volatile ("syscall" : "=a" (res) : "0" (SYS_futex), "D" (addr), "S" (gomp_futex_wait), @@ -81,64 +79,49 @@ futex_wake (int *addr, int count) # define SYS_futex 240 # endif -# ifdef __PIC__ - -static inline long -sys_futex0 (int *addr, int op, int val) -{ - long res; - - __asm volatile ("xchgl\t%%ebx, %2\n\t" - "int\t$0x80\n\t" - "xchgl\t%%ebx, %2" - : "=a" (res) - : "0"(SYS_futex), "r" (addr), "c"(op), - "d"(val), "S"(0) - : "memory"); - return res; -} - -# else - -static inline long -sys_futex0 (int *addr, int op, int val) +static inline void +futex_wait (int *addr, int val) { long res; __asm volatile ("int $0x80" : "=a" (res) - : "0"(SYS_futex), "b" (addr), "c"(op), - "d"(val), "S"(0) + : "0" (SYS_futex), "b" (addr), "c" (gomp_futex_wait), + "d" (val), "S" (0) : "memory"); - return res; -} - -# endif /* __PIC__ */ - -static inline void -futex_wait (int *addr, int val) -{ - long res = sys_futex0 (addr, gomp_futex_wait, val); if (__builtin_expect (res == -ENOSYS, 0)) { gomp_futex_wait &= ~FUTEX_PRIVATE_FLAG; gomp_futex_wake &= ~FUTEX_PRIVATE_FLAG; - sys_futex0 (addr, gomp_futex_wait, val); + __asm volatile ("int $0x80" + : "=a" (res) + : "0" (SYS_futex), "b" (addr), "c" (gomp_futex_wait), + "d" (val), "S" (0) + : "memory"); } } static inline void futex_wake (int *addr, int count) { - long res = sys_futex0 (addr, gomp_futex_wake, count); + long res; + + __asm volatile ("int $0x80" + : "=a" (res) + : "0" (SYS_futex), "b" (addr), "c" (gomp_futex_wake), + "d" (count) + : "memory"); if (__builtin_expect (res == -ENOSYS, 0)) { gomp_futex_wait &= ~FUTEX_PRIVATE_FLAG; gomp_futex_wake &= ~FUTEX_PRIVATE_FLAG; - sys_futex0 (addr, gomp_futex_wake, count); + __asm volatile ("int $0x80" + : "=a" (res) + : "0" (SYS_futex), "b" (addr), "c" (gomp_futex_wake), + "d" (count) + : "memory"); } } - #endif /* __x86_64__ */ static inline void diff --git a/libgomp/configure b/libgomp/configure index a961770948f..f1a92ba9de4 100755 --- a/libgomp/configure +++ b/libgomp/configure @@ -11121,7 +11121,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11121 "configure" +#line 11124 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11227,7 +11227,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11227 "configure" +#line 11230 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -14614,7 +14614,7 @@ $as_echo "#define STRING_WITH_STRINGS 1" >>confdefs.h fi -for ac_header in pthread.h unistd.h semaphore.h sys/loadavg.h sys/time.h sys/time.h +for ac_header in pthread.h unistd.h semaphore.h sys/loadavg.h sys/sysctl.h sys/time.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" diff --git a/libgomp/configure.ac b/libgomp/configure.ac index 51e646d4789..9cf02189665 100644 --- a/libgomp/configure.ac +++ b/libgomp/configure.ac @@ -170,7 +170,7 @@ AC_SUBST(libtool_VERSION) AC_STDC_HEADERS AC_HEADER_TIME ACX_HEADER_STRING -AC_CHECK_HEADERS(pthread.h unistd.h semaphore.h sys/loadavg.h sys/time.h sys/time.h) +AC_CHECK_HEADERS(pthread.h unistd.h semaphore.h sys/loadavg.h sys/sysctl.h sys/time.h) GCC_HEADER_STDINT(gstdint.h) diff --git a/libgomp/libgomp.h b/libgomp/libgomp.h index 5272f0154b7..ac40e2aa510 100644 --- a/libgomp/libgomp.h +++ b/libgomp/libgomp.h @@ -458,6 +458,9 @@ struct gomp_thread_pool struct gomp_thread **threads; unsigned threads_size; unsigned threads_used; + /* The last team is used for non-nested teams to delay their destruction to + make sure all the threads in the team move on to the pool's barrier before + the team's barrier is destroyed. */ struct gomp_team *last_team; /* Number of threads running in this contention group. */ unsigned long threads_busy; @@ -745,8 +748,8 @@ struct gomp_device_descr int (*get_num_devices_func) (void); void (*init_device_func) (int); void (*fini_device_func) (int); - int (*load_image_func) (int, void *, struct addr_pair **); - void (*unload_image_func) (int, void *); + int (*load_image_func) (int, const void *, struct addr_pair **); + void (*unload_image_func) (int, const void *); void *(*alloc_func) (int, size_t); void (*free_func) (int, void *); void *(*dev2host_func) (int, void *, const void *, size_t); @@ -779,6 +782,7 @@ extern void gomp_unmap_vars (struct target_mem_desc *, bool); extern void gomp_init_device (struct gomp_device_descr *); extern void gomp_free_memmap (struct splay_tree_s *); extern void gomp_fini_device (struct gomp_device_descr *); +extern void gomp_unload_device (struct gomp_device_descr *); /* work.c */ diff --git a/libgomp/oacc-init.c b/libgomp/oacc-init.c index dc40fb6ffe1..105d9dc45de 100644 --- a/libgomp/oacc-init.c +++ b/libgomp/oacc-init.c @@ -29,12 +29,16 @@ #include "libgomp.h" #include "oacc-int.h" #include "openacc.h" +#include "plugin/plugin-host.h" #include <assert.h> #include <stdlib.h> #include <strings.h> #include <stdbool.h> #include <string.h> +/* This lock is used to protect access to cached_base_dev, dispatchers and + the (abstract) initialisation state of attached offloading devices. */ + static gomp_mutex_t acc_device_lock; /* A cached version of the dispatcher for the global "current" accelerator type, @@ -105,8 +109,12 @@ name_of_acc_device_t (enum acc_device_t type) } } +/* ACC_DEVICE_LOCK must be held before calling this function. If FAIL_IS_ERROR + is true, this function raises an error if there are no devices of type D, + otherwise it returns NULL in that case. */ + static struct gomp_device_descr * -resolve_device (acc_device_t d) +resolve_device (acc_device_t d, bool fail_is_error) { acc_device_t d_arg = d; @@ -124,7 +132,13 @@ resolve_device (acc_device_t d) && dispatchers[d]->get_num_devices_func () > 0) goto found; - gomp_fatal ("device type %s not supported", goacc_device_type); + if (fail_is_error) + { + gomp_mutex_unlock (&acc_device_lock); + gomp_fatal ("device type %s not supported", goacc_device_type); + } + else + return NULL; } /* No default device specified, so start scanning for any non-host @@ -143,7 +157,13 @@ resolve_device (acc_device_t d) d = acc_device_host; goto found; } - gomp_fatal ("no device found"); + if (fail_is_error) + { + gomp_mutex_unlock (&acc_device_lock); + gomp_fatal ("no device found"); + } + else + return NULL; break; case acc_device_host: @@ -151,7 +171,12 @@ resolve_device (acc_device_t d) default: if (d > _ACC_device_hwm) - gomp_fatal ("device %u out of range", (unsigned)d); + { + if (fail_is_error) + goto unsupported_device; + else + return NULL; + } break; } found: @@ -160,12 +185,31 @@ resolve_device (acc_device_t d) && d != acc_device_default && d != acc_device_not_host); + if (dispatchers[d] == NULL && fail_is_error) + { + unsupported_device: + gomp_mutex_unlock (&acc_device_lock); + gomp_fatal ("device type %s not supported", name_of_acc_device_t (d)); + } + return dispatchers[d]; } +/* Emit a suitable error if no device of a particular type is available, or + the given device number is out-of-range. */ +static void +acc_dev_num_out_of_range (acc_device_t d, int ord, int ndevs) +{ + if (ndevs == 0) + gomp_fatal ("no devices of type %s available", name_of_acc_device_t (d)); + else + gomp_fatal ("device %u out of range", ord); +} + /* This is called when plugins have been initialized, and serves to call (indirectly) the target's device_init hook. Calling multiple times without - an intervening acc_shutdown_1 call is an error. */ + an intervening acc_shutdown_1 call is an error. ACC_DEVICE_LOCK must be + held before calling this function. */ static struct gomp_device_descr * acc_init_1 (acc_device_t d) @@ -173,23 +217,30 @@ acc_init_1 (acc_device_t d) struct gomp_device_descr *base_dev, *acc_dev; int ndevs; - base_dev = resolve_device (d); + base_dev = resolve_device (d, true); ndevs = base_dev->get_num_devices_func (); - if (!base_dev || ndevs <= 0 || goacc_device_num >= ndevs) - gomp_fatal ("device %s not supported", name_of_acc_device_t (d)); + if (ndevs <= 0 || goacc_device_num >= ndevs) + acc_dev_num_out_of_range (d, goacc_device_num, ndevs); acc_dev = &base_dev[goacc_device_num]; + gomp_mutex_lock (&acc_dev->lock); if (acc_dev->is_initialized) - gomp_fatal ("device already active"); + { + gomp_mutex_unlock (&acc_dev->lock); + gomp_fatal ("device already active"); + } gomp_init_device (acc_dev); + gomp_mutex_unlock (&acc_dev->lock); return base_dev; } +/* ACC_DEVICE_LOCK must be held before calling this function. */ + static void acc_shutdown_1 (acc_device_t d) { @@ -199,11 +250,20 @@ acc_shutdown_1 (acc_device_t d) bool devices_active = false; /* Get the base device for this device type. */ - base_dev = resolve_device (d); + base_dev = resolve_device (d, true); + + ndevs = base_dev->get_num_devices_func (); - if (!base_dev) - gomp_fatal ("device %s not supported", name_of_acc_device_t (d)); + /* Unload all the devices of this type that have been opened. */ + for (i = 0; i < ndevs; i++) + { + struct gomp_device_descr *acc_dev = &base_dev[i]; + gomp_mutex_lock (&acc_dev->lock); + gomp_unload_device (acc_dev); + gomp_mutex_unlock (&acc_dev->lock); + } + gomp_mutex_lock (&goacc_thread_lock); /* Free target-specific TLS data and close all devices. */ @@ -217,11 +277,17 @@ acc_shutdown_1 (acc_device_t d) /* This would mean the user is shutting down OpenACC in the middle of an "acc data" pragma. Likely not intentional. */ if (walk->mapped_data) - gomp_fatal ("shutdown in 'acc data' region"); + { + gomp_mutex_unlock (&goacc_thread_lock); + gomp_fatal ("shutdown in 'acc data' region"); + } /* Similarly, if this happens then user code has done something weird. */ if (walk->saved_bound_dev) - gomp_fatal ("shutdown during host fallback"); + { + gomp_mutex_unlock (&goacc_thread_lock); + gomp_fatal ("shutdown during host fallback"); + } if (walk->dev) { @@ -236,17 +302,18 @@ acc_shutdown_1 (acc_device_t d) gomp_mutex_unlock (&goacc_thread_lock); - ndevs = base_dev->get_num_devices_func (); /* Close all the devices of this type that have been opened. */ for (i = 0; i < ndevs; i++) { struct gomp_device_descr *acc_dev = &base_dev[i]; + gomp_mutex_lock (&acc_dev->lock); if (acc_dev->is_initialized) { devices_active = true; gomp_fini_device (acc_dev); } + gomp_mutex_unlock (&acc_dev->lock); } if (!devices_active) @@ -344,7 +411,8 @@ goacc_attach_host_thread_to_device (int ord) num_devices = base_dev->get_num_devices_func (); if (num_devices <= 0 || ord >= num_devices) - gomp_fatal ("device %u out of range", ord); + acc_dev_num_out_of_range (acc_device_type (base_dev->type), ord, + num_devices); if (!thr) thr = goacc_new_thread (); @@ -403,7 +471,10 @@ acc_get_num_devices (acc_device_t d) gomp_init_targets_once (); - acc_dev = resolve_device (d); + gomp_mutex_lock (&acc_device_lock); + acc_dev = resolve_device (d, false); + gomp_mutex_unlock (&acc_device_lock); + if (!acc_dev) return 0; @@ -431,11 +502,13 @@ acc_set_device_type (acc_device_t d) if (!cached_base_dev) gomp_init_targets_once (); - cached_base_dev = base_dev = resolve_device (d); + cached_base_dev = base_dev = resolve_device (d, true); acc_dev = &base_dev[goacc_device_num]; + gomp_mutex_lock (&acc_dev->lock); if (!acc_dev->is_initialized) gomp_init_device (acc_dev); + gomp_mutex_unlock (&acc_dev->lock); gomp_mutex_unlock (&acc_device_lock); @@ -466,7 +539,9 @@ acc_get_device_type (void) { gomp_init_targets_once (); - dev = resolve_device (acc_device_default); + gomp_mutex_lock (&acc_device_lock); + dev = resolve_device (acc_device_default, true); + gomp_mutex_unlock (&acc_device_lock); res = acc_device_type (dev->type); } @@ -485,14 +560,14 @@ acc_get_device_num (acc_device_t d) struct goacc_thread *thr = goacc_thread (); if (d >= _ACC_device_hwm) - gomp_fatal ("device %u out of range", (unsigned)d); + gomp_fatal ("unknown device type %u", (unsigned) d); if (!cached_base_dev) gomp_init_targets_once (); - dev = resolve_device (d); - if (!dev) - gomp_fatal ("device %s not supported", name_of_acc_device_t (d)); + gomp_mutex_lock (&acc_device_lock); + dev = resolve_device (d, true); + gomp_mutex_unlock (&acc_device_lock); if (thr && thr->base_dev == dev && thr->dev) return thr->dev->target_id; @@ -523,17 +598,19 @@ acc_set_device_num (int ord, acc_device_t d) { gomp_mutex_lock (&acc_device_lock); - cached_base_dev = base_dev = resolve_device (d); + cached_base_dev = base_dev = resolve_device (d, true); num_devices = base_dev->get_num_devices_func (); - if (ord >= num_devices) - gomp_fatal ("device %u out of range", ord); + if (num_devices <= 0 || ord >= num_devices) + acc_dev_num_out_of_range (d, ord, num_devices); acc_dev = &base_dev[ord]; + gomp_mutex_lock (&acc_dev->lock); if (!acc_dev->is_initialized) gomp_init_device (acc_dev); + gomp_mutex_unlock (&acc_dev->lock); gomp_mutex_unlock (&acc_device_lock); @@ -548,11 +625,18 @@ ialias (acc_set_device_num) int acc_on_device (acc_device_t dev) { - if (acc_get_device_type () == acc_device_host_nonshm) + struct goacc_thread *thr = goacc_thread (); + + /* We only want to appear to be the "host_nonshm" plugin from "offloaded" + code -- i.e. within a parallel region. Test a flag set by the + openacc_parallel hook of the host_nonshm plugin to determine that. */ + if (acc_get_device_type () == acc_device_host_nonshm + && thr && thr->target_tls + && ((struct nonshm_thread *)thr->target_tls)->nonshm_exec) return dev == acc_device_host_nonshm || dev == acc_device_not_host; - /* Just rely on the compiler builtin. */ - return __builtin_acc_on_device (dev); + /* For OpenACC, libgomp is only built for the host, so this is sufficient. */ + return dev == acc_device_host || dev == acc_device_none; } ialias (acc_on_device) diff --git a/libgomp/oacc-mem.c b/libgomp/oacc-mem.c index 89ef5fcd887..90d43eb2b8a 100644 --- a/libgomp/oacc-mem.c +++ b/libgomp/oacc-mem.c @@ -35,7 +35,8 @@ #include <stdint.h> #include <assert.h> -/* Return block containing [H->S), or NULL if not contained. */ +/* Return block containing [H->S), or NULL if not contained. The device lock + for DEV must be locked on entry, and remains locked on exit. */ static splay_tree_key lookup_host (struct gomp_device_descr *dev, void *h, size_t s) @@ -46,9 +47,7 @@ lookup_host (struct gomp_device_descr *dev, void *h, size_t s) node.host_start = (uintptr_t) h; node.host_end = (uintptr_t) h + s; - gomp_mutex_lock (&dev->lock); key = splay_tree_lookup (&dev->mem_map, &node); - gomp_mutex_unlock (&dev->lock); return key; } @@ -56,7 +55,8 @@ lookup_host (struct gomp_device_descr *dev, void *h, size_t s) /* Return block containing [D->S), or NULL if not contained. The list isn't ordered by device address, so we have to iterate over the whole array. This is not expected to be a common - operation. */ + operation. The device lock associated with TGT must be locked on entry, and + remains locked on exit. */ static splay_tree_key lookup_dev (struct target_mem_desc *tgt, void *d, size_t s) @@ -67,16 +67,12 @@ lookup_dev (struct target_mem_desc *tgt, void *d, size_t s) if (!tgt) return NULL; - gomp_mutex_lock (&tgt->device_descr->lock); - for (t = tgt; t != NULL; t = t->prev) { if (t->tgt_start <= (uintptr_t) d && t->tgt_end >= (uintptr_t) d + s) break; } - gomp_mutex_unlock (&tgt->device_descr->lock); - if (!t) return NULL; @@ -119,26 +115,35 @@ void acc_free (void *d) { splay_tree_key k; - struct goacc_thread *thr = goacc_thread (); if (!d) return; + struct goacc_thread *thr = goacc_thread (); + assert (thr && thr->dev); + struct gomp_device_descr *acc_dev = thr->dev; + + gomp_mutex_lock (&acc_dev->lock); + /* We don't have to call lazy open here, as the ptr value must have been returned by acc_malloc. It's not permitted to pass NULL in (unless you got that null from acc_malloc). */ - if ((k = lookup_dev (thr->dev->openacc.data_environ, d, 1))) - { - void *offset; + if ((k = lookup_dev (acc_dev->openacc.data_environ, d, 1))) + { + void *offset; - offset = d - k->tgt->tgt_start + k->tgt_offset; + offset = d - k->tgt->tgt_start + k->tgt_offset; - acc_unmap_data ((void *)(k->host_start + offset)); - } + gomp_mutex_unlock (&acc_dev->lock); - thr->dev->free_func (thr->dev->target_id, d); + acc_unmap_data ((void *)(k->host_start + offset)); + } + else + gomp_mutex_unlock (&acc_dev->lock); + + acc_dev->free_func (acc_dev->target_id, d); } void @@ -178,16 +183,24 @@ acc_deviceptr (void *h) goacc_lazy_initialize (); struct goacc_thread *thr = goacc_thread (); + struct gomp_device_descr *dev = thr->dev; + + gomp_mutex_lock (&dev->lock); - n = lookup_host (thr->dev, h, 1); + n = lookup_host (dev, h, 1); if (!n) - return NULL; + { + gomp_mutex_unlock (&dev->lock); + return NULL; + } offset = h - n->host_start; d = n->tgt->tgt_start + n->tgt_offset + offset; + gomp_mutex_unlock (&dev->lock); + return d; } @@ -204,16 +217,24 @@ acc_hostptr (void *d) goacc_lazy_initialize (); struct goacc_thread *thr = goacc_thread (); + struct gomp_device_descr *acc_dev = thr->dev; - n = lookup_dev (thr->dev->openacc.data_environ, d, 1); + gomp_mutex_lock (&acc_dev->lock); + + n = lookup_dev (acc_dev->openacc.data_environ, d, 1); if (!n) - return NULL; + { + gomp_mutex_unlock (&acc_dev->lock); + return NULL; + } offset = d - n->tgt->tgt_start + n->tgt_offset; h = n->host_start + offset; + gomp_mutex_unlock (&acc_dev->lock); + return h; } @@ -232,6 +253,8 @@ acc_is_present (void *h, size_t s) struct goacc_thread *thr = goacc_thread (); struct gomp_device_descr *acc_dev = thr->dev; + gomp_mutex_lock (&acc_dev->lock); + n = lookup_host (acc_dev, h, s); if (n && ((uintptr_t)h < n->host_start @@ -239,6 +262,8 @@ acc_is_present (void *h, size_t s) || s > n->host_end - n->host_start)) n = NULL; + gomp_mutex_unlock (&acc_dev->lock); + return n != NULL; } @@ -274,20 +299,32 @@ acc_map_data (void *h, void *d, size_t s) gomp_fatal ("[%p,+%d]->[%p,+%d] is a bad map", (void *)h, (int)s, (void *)d, (int)s); + gomp_mutex_lock (&acc_dev->lock); + if (lookup_host (acc_dev, h, s)) - gomp_fatal ("host address [%p, +%d] is already mapped", (void *)h, - (int)s); + { + gomp_mutex_unlock (&acc_dev->lock); + gomp_fatal ("host address [%p, +%d] is already mapped", (void *)h, + (int)s); + } if (lookup_dev (thr->dev->openacc.data_environ, d, s)) - gomp_fatal ("device address [%p, +%d] is already mapped", (void *)d, - (int)s); + { + gomp_mutex_unlock (&acc_dev->lock); + gomp_fatal ("device address [%p, +%d] is already mapped", (void *)d, + (int)s); + } + + gomp_mutex_unlock (&acc_dev->lock); tgt = gomp_map_vars (acc_dev, mapnum, &hostaddrs, &devaddrs, &sizes, &kinds, true, false); } + gomp_mutex_lock (&acc_dev->lock); tgt->prev = acc_dev->openacc.data_environ; acc_dev->openacc.data_environ = tgt; + gomp_mutex_unlock (&acc_dev->lock); } void @@ -299,17 +336,26 @@ acc_unmap_data (void *h) /* No need to call lazy open, as the address must have been mapped. */ size_t host_size; + + gomp_mutex_lock (&acc_dev->lock); + splay_tree_key n = lookup_host (acc_dev, h, 1); struct target_mem_desc *t; if (!n) - gomp_fatal ("%p is not a mapped block", (void *)h); + { + gomp_mutex_unlock (&acc_dev->lock); + gomp_fatal ("%p is not a mapped block", (void *)h); + } host_size = n->host_end - n->host_start; if (n->host_start != (uintptr_t) h) - gomp_fatal ("[%p,%d] surrounds1 %p", - (void *) n->host_start, (int) host_size, (void *) h); + { + gomp_mutex_unlock (&acc_dev->lock); + gomp_fatal ("[%p,%d] surrounds %p", + (void *) n->host_start, (int) host_size, (void *) h); + } t = n->tgt; @@ -323,8 +369,6 @@ acc_unmap_data (void *h) t->tgt_end = 0; t->to_free = 0; - gomp_mutex_lock (&acc_dev->lock); - for (tp = NULL, t = acc_dev->openacc.data_environ; t != NULL; tp = t, t = t->prev) if (n->tgt == t) @@ -336,10 +380,10 @@ acc_unmap_data (void *h) break; } - - gomp_mutex_unlock (&acc_dev->lock); } + gomp_mutex_unlock (&acc_dev->lock); + gomp_unmap_vars (t, true); } @@ -361,6 +405,8 @@ present_create_copy (unsigned f, void *h, size_t s) struct goacc_thread *thr = goacc_thread (); struct gomp_device_descr *acc_dev = thr->dev; + gomp_mutex_lock (&acc_dev->lock); + n = lookup_host (acc_dev, h, s); if (n) { @@ -368,13 +414,22 @@ present_create_copy (unsigned f, void *h, size_t s) d = (void *) (n->tgt->tgt_start + n->tgt_offset); if (!(f & FLAG_PRESENT)) - gomp_fatal ("[%p,+%d] already mapped to [%p,+%d]", - (void *)h, (int)s, (void *)d, (int)s); + { + gomp_mutex_unlock (&acc_dev->lock); + gomp_fatal ("[%p,+%d] already mapped to [%p,+%d]", + (void *)h, (int)s, (void *)d, (int)s); + } if ((h + s) > (void *)n->host_end) - gomp_fatal ("[%p,+%d] not mapped", (void *)h, (int)s); + { + gomp_mutex_unlock (&acc_dev->lock); + gomp_fatal ("[%p,+%d] not mapped", (void *)h, (int)s); + } + + gomp_mutex_unlock (&acc_dev->lock); } else if (!(f & FLAG_CREATE)) { + gomp_mutex_unlock (&acc_dev->lock); gomp_fatal ("[%p,+%d] not mapped", (void *)h, (int)s); } else @@ -389,6 +444,8 @@ present_create_copy (unsigned f, void *h, size_t s) else kinds = GOMP_MAP_ALLOC; + gomp_mutex_unlock (&acc_dev->lock); + tgt = gomp_map_vars (acc_dev, mapnum, &hostaddrs, NULL, &s, &kinds, true, false); @@ -439,21 +496,31 @@ delete_copyout (unsigned f, void *h, size_t s) struct goacc_thread *thr = goacc_thread (); struct gomp_device_descr *acc_dev = thr->dev; + gomp_mutex_lock (&acc_dev->lock); + n = lookup_host (acc_dev, h, s); /* No need to call lazy open, as the data must already have been mapped. */ if (!n) - gomp_fatal ("[%p,%d] is not mapped", (void *)h, (int)s); + { + gomp_mutex_unlock (&acc_dev->lock); + gomp_fatal ("[%p,%d] is not mapped", (void *)h, (int)s); + } d = (void *) (n->tgt->tgt_start + n->tgt_offset); host_size = n->host_end - n->host_start; if (n->host_start != (uintptr_t) h || host_size != s) - gomp_fatal ("[%p,%d] surrounds2 [%p,+%d]", - (void *) n->host_start, (int) host_size, (void *) h, (int) s); + { + gomp_mutex_unlock (&acc_dev->lock); + gomp_fatal ("[%p,%d] surrounds2 [%p,+%d]", + (void *) n->host_start, (int) host_size, (void *) h, (int) s); + } + + gomp_mutex_unlock (&acc_dev->lock); if (f & FLAG_COPYOUT) acc_dev->dev2host_func (acc_dev->target_id, h, d, s); @@ -482,16 +549,23 @@ update_dev_host (int is_dev, void *h, size_t s) struct goacc_thread *thr = goacc_thread (); struct gomp_device_descr *acc_dev = thr->dev; + gomp_mutex_lock (&acc_dev->lock); + n = lookup_host (acc_dev, h, s); /* No need to call lazy open, as the data must already have been mapped. */ if (!n) - gomp_fatal ("[%p,%d] is not mapped", h, (int)s); + { + gomp_mutex_unlock (&acc_dev->lock); + gomp_fatal ("[%p,%d] is not mapped", h, (int)s); + } d = (void *) (n->tgt->tgt_start + n->tgt_offset); + gomp_mutex_unlock (&acc_dev->lock); + if (is_dev) acc_dev->host2dev_func (acc_dev->target_id, d, h, s); else @@ -522,8 +596,11 @@ gomp_acc_insert_pointer (size_t mapnum, void **hostaddrs, size_t *sizes, tgt = gomp_map_vars (acc_dev, mapnum, hostaddrs, NULL, sizes, kinds, true, false); gomp_debug (0, " %s: mappings prepared\n", __FUNCTION__); + + gomp_mutex_lock (&acc_dev->lock); tgt->prev = acc_dev->openacc.data_environ; acc_dev->openacc.data_environ = tgt; + gomp_mutex_unlock (&acc_dev->lock); } void @@ -535,10 +612,15 @@ gomp_acc_remove_pointer (void *h, bool force_copyfrom, int async, int mapnum) struct target_mem_desc *t; int minrefs = (mapnum == 1) ? 2 : 3; + gomp_mutex_lock (&acc_dev->lock); + n = lookup_host (acc_dev, h, 1); if (!n) - gomp_fatal ("%p is not a mapped block", (void *)h); + { + gomp_mutex_unlock (&acc_dev->lock); + gomp_fatal ("%p is not a mapped block", (void *)h); + } gomp_debug (0, " %s: restore mappings\n", __FUNCTION__); @@ -546,8 +628,6 @@ gomp_acc_remove_pointer (void *h, bool force_copyfrom, int async, int mapnum) struct target_mem_desc *tp; - gomp_mutex_lock (&acc_dev->lock); - if (t->refcount == minrefs) { /* This is the last reference, so pull the descriptor off the diff --git a/libgomp/oacc-parallel.c b/libgomp/oacc-parallel.c index d8999463d6d..d0e5f949fb0 100644 --- a/libgomp/oacc-parallel.c +++ b/libgomp/oacc-parallel.c @@ -105,13 +105,13 @@ GOACC_parallel (int device, void (*fn) (void *), return; } - va_start (ap, num_waits); + if (num_waits) + { + va_start (ap, num_waits); + goacc_wait (async, num_waits, ap); + va_end (ap); + } - if (num_waits > 0) - goacc_wait (async, num_waits, ap); - - va_end (ap); - acc_dev->openacc.async_set_async_func (async); if (!(acc_dev->capabilities & GOMP_OFFLOAD_CAP_NATIVE_EXEC)) @@ -225,14 +225,12 @@ GOACC_enter_exit_data (int device, size_t mapnum, || host_fallback) return; - if (num_waits > 0) + if (num_waits) { va_list ap; va_start (ap, num_waits); - goacc_wait (async, num_waits, ap); - va_end (ap); } @@ -350,47 +348,21 @@ goacc_wait (int async, int num_waits, va_list ap) { struct goacc_thread *thr = goacc_thread (); struct gomp_device_descr *acc_dev = thr->dev; - int i; - assert (num_waits >= 0); - - if (async == acc_async_sync && num_waits == 0) - { - acc_wait_all (); - return; - } - - if (async == acc_async_sync && num_waits) - { - for (i = 0; i < num_waits; i++) - { - int qid = va_arg (ap, int); - - if (acc_async_test (qid)) - continue; - - acc_wait (qid); - } - return; - } - - if (async == acc_async_noval && num_waits == 0) - { - acc_dev->openacc.async_wait_all_async_func (acc_async_noval); - return; - } - - for (i = 0; i < num_waits; i++) + while (num_waits--) { int qid = va_arg (ap, int); if (acc_async_test (qid)) continue; - /* If we're waiting on the same asynchronous queue as we're launching on, - the queue itself will order work as required, so there's no need to - wait explicitly. */ - if (qid != async) + if (async == acc_async_sync) + acc_wait (qid); + else if (qid == async) + ;/* If we're waiting on the same asynchronous queue as we're + launching on, the queue itself will order work as + required, so there's no need to wait explicitly. */ + else acc_dev->openacc.async_wait_async_func (qid, async); } } @@ -412,14 +384,12 @@ GOACC_update (int device, size_t mapnum, || host_fallback) return; - if (num_waits > 0) + if (num_waits) { va_list ap; va_start (ap, num_waits); - goacc_wait (async, num_waits, ap); - va_end (ap); } @@ -455,13 +425,18 @@ GOACC_update (int device, size_t mapnum, void GOACC_wait (int async, int num_waits, ...) { - va_list ap; - - va_start (ap, num_waits); - - goacc_wait (async, num_waits, ap); + if (num_waits) + { + va_list ap; - va_end (ap); + va_start (ap, num_waits); + goacc_wait (async, num_waits, ap); + va_end (ap); + } + else if (async == acc_async_sync) + acc_wait_all (); + else if (async == acc_async_noval) + goacc_thread ()->dev->openacc.async_wait_all_async_func (acc_async_noval); } int diff --git a/libgomp/openacc.h b/libgomp/openacc.h index 334324114f1..44a1526597d 100644 --- a/libgomp/openacc.h +++ b/libgomp/openacc.h @@ -39,7 +39,7 @@ extern "C" { #endif #if __cplusplus >= 201103 -# define __GOACC_NOTHROW noexcept () +# define __GOACC_NOTHROW noexcept #elif __cplusplus # define __GOACC_NOTHROW throw () #else /* Not C++ */ diff --git a/libgomp/plugin/plugin-host.c b/libgomp/plugin/plugin-host.c index 1faf5bc194e..da3c5f4cdb7 100644 --- a/libgomp/plugin/plugin-host.c +++ b/libgomp/plugin/plugin-host.c @@ -44,6 +44,7 @@ #include <stdlib.h> #include <string.h> #include <stdio.h> +#include <stdbool.h> #ifdef HOST_NONSHM_PLUGIN #define STATIC @@ -55,6 +56,10 @@ #define SELF "host: " #endif +#ifdef HOST_NONSHM_PLUGIN +#include "plugin-host.h" +#endif + STATIC const char * GOMP_OFFLOAD_get_name (void) { @@ -106,7 +111,7 @@ GOMP_OFFLOAD_fini_device (int n __attribute__ ((unused))) STATIC int GOMP_OFFLOAD_load_image (int n __attribute__ ((unused)), - void *i __attribute__ ((unused)), + const void *t __attribute__ ((unused)), struct addr_pair **r __attribute__ ((unused))) { return 0; @@ -114,7 +119,7 @@ GOMP_OFFLOAD_load_image (int n __attribute__ ((unused)), STATIC void GOMP_OFFLOAD_unload_image (int n __attribute__ ((unused)), - void *i __attribute__ ((unused))) + const void *t __attribute__ ((unused))) { } @@ -174,7 +179,10 @@ GOMP_OFFLOAD_openacc_parallel (void (*fn) (void *), void *targ_mem_desc __attribute__ ((unused))) { #ifdef HOST_NONSHM_PLUGIN + struct nonshm_thread *thd = GOMP_PLUGIN_acc_thread (); + thd->nonshm_exec = true; fn (devaddrs); + thd->nonshm_exec = false; #else fn (hostaddrs); #endif @@ -232,11 +240,20 @@ STATIC void * GOMP_OFFLOAD_openacc_create_thread_data (int ord __attribute__ ((unused))) { +#ifdef HOST_NONSHM_PLUGIN + struct nonshm_thread *thd + = GOMP_PLUGIN_malloc (sizeof (struct nonshm_thread)); + thd->nonshm_exec = false; + return thd; +#else return NULL; +#endif } STATIC void -GOMP_OFFLOAD_openacc_destroy_thread_data (void *tls_data - __attribute__ ((unused))) +GOMP_OFFLOAD_openacc_destroy_thread_data (void *tls_data) { +#ifdef HOST_NONSHM_PLUGIN + free (tls_data); +#endif } diff --git a/libgomp/plugin/plugin-host.h b/libgomp/plugin/plugin-host.h new file mode 100644 index 00000000000..96955d19414 --- /dev/null +++ b/libgomp/plugin/plugin-host.h @@ -0,0 +1,37 @@ +/* OpenACC Runtime Library: acc_device_host, acc_device_host_nonshm. + + Copyright (C) 2015 Free Software Foundation, Inc. + + Contributed by Mentor Embedded. + + This file is part of the GNU Offloading and Multi Processing Library + (libgomp). + + Libgomp is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + Under Section 7 of GPL version 3, you are granted additional + permissions described in the GCC Runtime Library Exception, version + 3.1, as published by the Free Software Foundation. + + You should have received a copy of the GNU General Public License and + a copy of the GCC Runtime Library Exception along with this program; + see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + <http://www.gnu.org/licenses/>. */ + +#ifndef PLUGIN_HOST_H +#define PLUGIN_HOST_H + +struct nonshm_thread +{ + bool nonshm_exec; +}; + +#endif diff --git a/libgomp/plugin/plugin-nvptx.c b/libgomp/plugin/plugin-nvptx.c index 583ec87aeee..fc296321812 100644 --- a/libgomp/plugin/plugin-nvptx.c +++ b/libgomp/plugin/plugin-nvptx.c @@ -127,12 +127,6 @@ cuda_error (CUresult r) return &errmsg[0]; } -struct targ_fn_descriptor -{ - CUfunction fn; - const char *name; -}; - static unsigned int instantiated_devices = 0; static pthread_mutex_t ptx_dev_lock = PTHREAD_MUTEX_INITIALIZER; @@ -288,6 +282,25 @@ map_push (struct ptx_stream *s, int async, size_t size, void **h, void **d) return; } +/* Descriptor of a loaded function. */ + +struct targ_fn_descriptor +{ + CUfunction fn; + const char *name; +}; + +/* A loaded PTX image. */ +struct ptx_image_data +{ + const void *target_data; + CUmodule module; + + struct targ_fn_descriptor *fns; /* Array of functions. */ + + struct ptx_image_data *next; +}; + struct ptx_device { CUcontext ctx; @@ -311,6 +324,9 @@ struct ptx_device int mode; bool mkern; + struct ptx_image_data *images; /* Images loaded on device. */ + pthread_mutex_t image_lock; /* Lock for above list. */ + struct ptx_device *next; }; @@ -332,21 +348,11 @@ struct ptx_event struct ptx_event *next; }; -struct ptx_image_data -{ - void *target_data; - CUmodule module; - struct ptx_image_data *next; -}; - static pthread_mutex_t ptx_event_lock; static struct ptx_event *ptx_events; static struct ptx_device **ptx_devices; -static struct ptx_image_data *ptx_images = NULL; -static pthread_mutex_t ptx_image_lock = PTHREAD_MUTEX_INITIALIZER; - #define _XSTR(s) _STR(s) #define _STR(s) #s @@ -590,6 +596,7 @@ select_stream_for_async (int async, pthread_t thread, bool create, /* Initialize the device. Return TRUE on success, else FALSE. PTX_DEV_LOCK should be locked on entry and remains locked on exit. */ + static bool nvptx_init (void) { @@ -746,6 +753,9 @@ nvptx_open_device (int n) if (r != CUDA_SUCCESS) async_engines = 1; + ptx_dev->images = NULL; + pthread_mutex_init (&ptx_dev->image_lock, NULL); + init_streams_for_device (ptx_dev, async_engines); return ptx_dev; @@ -760,6 +770,8 @@ nvptx_close_device (struct ptx_device *ptx_dev) return; fini_streams_for_device (ptx_dev); + + pthread_mutex_destroy (&ptx_dev->image_lock); if (!ptx_dev->ctx_shared) { @@ -777,12 +789,23 @@ nvptx_get_num_devices (void) int n; CUresult r; + /* PR libgomp/65099: Currently, we only support offloading in 64-bit + configurations. */ + if (sizeof (void *) != 8) + return 0; + /* This function will be called before the plugin has been initialized in order to enumerate available devices, but CUDA API routines can't be used until cuInit has been called. Just call it now (but don't yet do any further initialization). */ if (instantiated_devices == 0) - cuInit (0); + { + r = cuInit (0); + /* This is not an error: e.g. we may have CUDA libraries installed but + no devices available. */ + if (r != CUDA_SUCCESS) + return 0; + } r = cuDeviceGetCount (&n); if (r!= CUDA_SUCCESS) @@ -793,7 +816,7 @@ nvptx_get_num_devices (void) static void -link_ptx (CUmodule *module, char *ptx_code) +link_ptx (CUmodule *module, const char *ptx_code) { CUjit_option opts[7]; void *optvals[7]; @@ -863,7 +886,8 @@ link_ptx (CUmodule *module, char *ptx_code) cuda_error (r)); } - r = cuLinkAddData (linkstate, CU_JIT_INPUT_PTX, ptx_code, + /* cuLinkAddData's 'data' argument erroneously omits the const qualifier. */ + r = cuLinkAddData (linkstate, CU_JIT_INPUT_PTX, (char *)ptx_code, strlen (ptx_code) + 1, 0, 0, 0, 0); if (r != CUDA_SUCCESS) { @@ -1607,55 +1631,71 @@ GOMP_OFFLOAD_fini_device (int n) pthread_mutex_unlock (&ptx_dev_lock); } +/* Data emitted by mkoffload. */ + +typedef struct nvptx_tdata +{ + const char *ptx_src; + + const char *const *var_names; + size_t var_num; + + const char *const *fn_names; + size_t fn_num; +} nvptx_tdata_t; + +/* Load the (partial) program described by TARGET_DATA to device + number ORD. Allocate and return TARGET_TABLE. */ + int -GOMP_OFFLOAD_load_image (int ord, void *target_data, +GOMP_OFFLOAD_load_image (int ord, const void *target_data, struct addr_pair **target_table) { CUmodule module; - char **fn_names, **var_names; + const char *const *fn_names, *const *var_names; unsigned int fn_entries, var_entries, i, j; CUresult r; struct targ_fn_descriptor *targ_fns; - void **img_header = (void **) target_data; + struct addr_pair *targ_tbl; + const nvptx_tdata_t *img_header = (const nvptx_tdata_t *) target_data; struct ptx_image_data *new_image; + struct ptx_device *dev; GOMP_OFFLOAD_init_device (ord); + dev = ptx_devices[ord]; + nvptx_attach_host_thread_to_device (ord); - link_ptx (&module, img_header[0]); + link_ptx (&module, img_header->ptx_src); - pthread_mutex_lock (&ptx_image_lock); - new_image = GOMP_PLUGIN_malloc (sizeof (struct ptx_image_data)); - new_image->target_data = target_data; - new_image->module = module; - new_image->next = ptx_images; - ptx_images = new_image; - pthread_mutex_unlock (&ptx_image_lock); + /* The mkoffload utility emits a struct of pointers/integers at the + start of each offload image. The array of kernel names and the + functions addresses form a one-to-one correspondence. */ - /* The mkoffload utility emits a table of pointers/integers at the start of - each offload image: + var_entries = img_header->var_num; + var_names = img_header->var_names; + fn_entries = img_header->fn_num; + fn_names = img_header->fn_names; - img_header[0] -> ptx code - img_header[1] -> number of variables - img_header[2] -> array of variable names (pointers to strings) - img_header[3] -> number of kernels - img_header[4] -> array of kernel names (pointers to strings) + targ_tbl = GOMP_PLUGIN_malloc (sizeof (struct addr_pair) + * (fn_entries + var_entries)); + targ_fns = GOMP_PLUGIN_malloc (sizeof (struct targ_fn_descriptor) + * fn_entries); - The array of kernel names and the functions addresses form a - one-to-one correspondence. */ + *target_table = targ_tbl; - var_entries = (uintptr_t) img_header[1]; - var_names = (char **) img_header[2]; - fn_entries = (uintptr_t) img_header[3]; - fn_names = (char **) img_header[4]; + new_image = GOMP_PLUGIN_malloc (sizeof (struct ptx_image_data)); + new_image->target_data = target_data; + new_image->module = module; + new_image->fns = targ_fns; - *target_table = GOMP_PLUGIN_malloc (sizeof (struct addr_pair) - * (fn_entries + var_entries)); - targ_fns = GOMP_PLUGIN_malloc (sizeof (struct targ_fn_descriptor) - * fn_entries); + pthread_mutex_lock (&dev->image_lock); + new_image->next = dev->images; + dev->images = new_image; + pthread_mutex_unlock (&dev->image_lock); - for (i = 0; i < fn_entries; i++) + for (i = 0; i < fn_entries; i++, targ_fns++, targ_tbl++) { CUfunction function; @@ -1663,14 +1703,14 @@ GOMP_OFFLOAD_load_image (int ord, void *target_data, if (r != CUDA_SUCCESS) GOMP_PLUGIN_fatal ("cuModuleGetFunction error: %s", cuda_error (r)); - targ_fns[i].fn = function; - targ_fns[i].name = (const char *) fn_names[i]; + targ_fns->fn = function; + targ_fns->name = (const char *) fn_names[i]; - (*target_table)[i].start = (uintptr_t) &targ_fns[i]; - (*target_table)[i].end = (*target_table)[i].start + 1; + targ_tbl->start = (uintptr_t) targ_fns; + targ_tbl->end = targ_tbl->start + 1; } - for (j = 0; j < var_entries; j++, i++) + for (j = 0; j < var_entries; j++, targ_tbl++) { CUdeviceptr var; size_t bytes; @@ -1679,46 +1719,33 @@ GOMP_OFFLOAD_load_image (int ord, void *target_data, if (r != CUDA_SUCCESS) GOMP_PLUGIN_fatal ("cuModuleGetGlobal error: %s", cuda_error (r)); - (*target_table)[i].start = (uintptr_t) var; - (*target_table)[i].end = (*target_table)[i].start + bytes; + targ_tbl->start = (uintptr_t) var; + targ_tbl->end = targ_tbl->start + bytes; } - return i; + return fn_entries + var_entries; } -void -GOMP_OFFLOAD_unload_image (int tid __attribute__((unused)), void *target_data) -{ - void **img_header = (void **) target_data; - struct targ_fn_descriptor *targ_fns - = (struct targ_fn_descriptor *) img_header[0]; - struct ptx_image_data *image, *prev = NULL, *newhd = NULL; - - free (targ_fns); - - pthread_mutex_lock (&ptx_image_lock); - for (image = ptx_images; image != NULL;) - { - struct ptx_image_data *next = image->next; - - if (image->target_data == target_data) - { - cuModuleUnload (image->module); - free (image); - if (prev) - prev->next = next; - } - else - { - prev = image; - if (!newhd) - newhd = image; - } +/* Unload the program described by TARGET_DATA. DEV_DATA is the + function descriptors allocated by G_O_load_image. */ - image = next; - } - ptx_images = newhd; - pthread_mutex_unlock (&ptx_image_lock); +void +GOMP_OFFLOAD_unload_image (int ord, const void *target_data) +{ + struct ptx_image_data *image, **prev_p; + struct ptx_device *dev = ptx_devices[ord]; + + pthread_mutex_lock (&dev->image_lock); + for (prev_p = &dev->images; (image = *prev_p) != 0; prev_p = &image->next) + if (image->target_data == target_data) + { + *prev_p = image->next; + cuModuleUnload (image->module); + free (image->fns); + free (image); + break; + } + pthread_mutex_unlock (&dev->image_lock); } void * diff --git a/libgomp/target.c b/libgomp/target.c index d8da7833aa9..7b3d0f9572d 100644 --- a/libgomp/target.c +++ b/libgomp/target.c @@ -57,8 +57,8 @@ static gomp_mutex_t register_lock; pointer to target data. */ struct offload_image_descr { enum offload_target_type type; - void *host_table; - void *target_data; + const void *host_table; + const void *target_data; }; /* Array of descriptors of offload images. */ @@ -163,6 +163,60 @@ get_kind (bool is_openacc, void *kinds, int idx) : ((unsigned char *) kinds)[idx]; } +static void +gomp_map_pointer (struct target_mem_desc *tgt, uintptr_t host_ptr, + uintptr_t target_offset, uintptr_t bias) +{ + struct gomp_device_descr *devicep = tgt->device_descr; + struct splay_tree_s *mem_map = &devicep->mem_map; + struct splay_tree_key_s cur_node; + + cur_node.host_start = host_ptr; + if (cur_node.host_start == (uintptr_t) NULL) + { + cur_node.tgt_offset = (uintptr_t) NULL; + /* FIXME: see comment about coalescing host/dev transfers below. */ + devicep->host2dev_func (devicep->target_id, + (void *) (tgt->tgt_start + target_offset), + (void *) &cur_node.tgt_offset, + sizeof (void *)); + return; + } + /* Add bias to the pointer value. */ + cur_node.host_start += bias; + cur_node.host_end = cur_node.host_start + 1; + splay_tree_key n = splay_tree_lookup (mem_map, &cur_node); + if (n == NULL) + { + /* Could be possibly zero size array section. */ + cur_node.host_end--; + n = splay_tree_lookup (mem_map, &cur_node); + if (n == NULL) + { + cur_node.host_start--; + n = splay_tree_lookup (mem_map, &cur_node); + cur_node.host_start++; + } + } + if (n == NULL) + { + gomp_mutex_unlock (&devicep->lock); + gomp_fatal ("Pointer target of array section wasn't mapped"); + } + cur_node.host_start -= n->host_start; + cur_node.tgt_offset + = n->tgt->tgt_start + n->tgt_offset + cur_node.host_start; + /* At this point tgt_offset is target address of the + array section. Now subtract bias to get what we want + to initialize the pointer with. */ + cur_node.tgt_offset -= bias; + /* FIXME: see comment about coalescing host/dev transfers below. */ + devicep->host2dev_func (devicep->target_id, + (void *) (tgt->tgt_start + target_offset), + (void *) &cur_node.tgt_offset, + sizeof (void *)); +} + attribute_hidden struct target_mem_desc * gomp_map_vars (struct gomp_device_descr *devicep, size_t mapnum, void **hostaddrs, void **devaddrs, size_t *sizes, void *kinds, @@ -336,54 +390,8 @@ gomp_map_vars (struct gomp_device_descr *devicep, size_t mapnum, k->host_end - k->host_start); break; case GOMP_MAP_POINTER: - cur_node.host_start - = (uintptr_t) *(void **) k->host_start; - if (cur_node.host_start == (uintptr_t) NULL) - { - cur_node.tgt_offset = (uintptr_t) NULL; - /* FIXME: see above FIXME comment. */ - devicep->host2dev_func (devicep->target_id, - (void *) (tgt->tgt_start - + k->tgt_offset), - (void *) &cur_node.tgt_offset, - sizeof (void *)); - break; - } - /* Add bias to the pointer value. */ - cur_node.host_start += sizes[i]; - cur_node.host_end = cur_node.host_start + 1; - n = splay_tree_lookup (mem_map, &cur_node); - if (n == NULL) - { - /* Could be possibly zero size array section. */ - cur_node.host_end--; - n = splay_tree_lookup (mem_map, &cur_node); - if (n == NULL) - { - cur_node.host_start--; - n = splay_tree_lookup (mem_map, &cur_node); - cur_node.host_start++; - } - } - if (n == NULL) - { - gomp_mutex_unlock (&devicep->lock); - gomp_fatal ("Pointer target of array section " - "wasn't mapped"); - } - cur_node.host_start -= n->host_start; - cur_node.tgt_offset = n->tgt->tgt_start + n->tgt_offset - + cur_node.host_start; - /* At this point tgt_offset is target address of the - array section. Now subtract bias to get what we want - to initialize the pointer with. */ - cur_node.tgt_offset -= sizes[i]; - /* FIXME: see above FIXME comment. */ - devicep->host2dev_func (devicep->target_id, - (void *) (tgt->tgt_start - + k->tgt_offset), - (void *) &cur_node.tgt_offset, - sizeof (void *)); + gomp_map_pointer (tgt, (uintptr_t) *(void **) k->host_start, + k->tgt_offset, sizes[i]); break; case GOMP_MAP_TO_PSET: /* FIXME: see above FIXME comment. */ @@ -405,58 +413,12 @@ gomp_map_vars (struct gomp_device_descr *devicep, size_t mapnum, { tgt->list[j] = k; k->refcount++; - cur_node.host_start - = (uintptr_t) *(void **) hostaddrs[j]; - if (cur_node.host_start == (uintptr_t) NULL) - { - cur_node.tgt_offset = (uintptr_t) NULL; - /* FIXME: see above FIXME comment. */ - devicep->host2dev_func (devicep->target_id, - (void *) (tgt->tgt_start + k->tgt_offset - + ((uintptr_t) hostaddrs[j] - - k->host_start)), - (void *) &cur_node.tgt_offset, - sizeof (void *)); - i++; - continue; - } - /* Add bias to the pointer value. */ - cur_node.host_start += sizes[j]; - cur_node.host_end = cur_node.host_start + 1; - n = splay_tree_lookup (mem_map, &cur_node); - if (n == NULL) - { - /* Could be possibly zero size array section. */ - cur_node.host_end--; - n = splay_tree_lookup (mem_map, &cur_node); - if (n == NULL) - { - cur_node.host_start--; - n = splay_tree_lookup (mem_map, &cur_node); - cur_node.host_start++; - } - } - if (n == NULL) - { - gomp_mutex_unlock (&devicep->lock); - gomp_fatal ("Pointer target of array section " - "wasn't mapped"); - } - cur_node.host_start -= n->host_start; - cur_node.tgt_offset = n->tgt->tgt_start - + n->tgt_offset - + cur_node.host_start; - /* At this point tgt_offset is target address of the - array section. Now subtract bias to get what we - want to initialize the pointer with. */ - cur_node.tgt_offset -= sizes[j]; - /* FIXME: see above FIXME comment. */ - devicep->host2dev_func (devicep->target_id, - (void *) (tgt->tgt_start + k->tgt_offset - + ((uintptr_t) hostaddrs[j] - - k->host_start)), - (void *) &cur_node.tgt_offset, - sizeof (void *)); + gomp_map_pointer (tgt, + (uintptr_t) *(void **) hostaddrs[j], + k->tgt_offset + + ((uintptr_t) hostaddrs[j] + - k->host_start), + sizes[j]); i++; } break; @@ -676,12 +638,13 @@ gomp_update (struct gomp_device_descr *devicep, size_t mapnum, void **hostaddrs, /* Load image pointed by TARGET_DATA to the device, specified by DEVICEP. And insert to splay tree the mapping between addresses from HOST_TABLE and - from loaded target image. */ + from loaded target image. We rely in the host and device compiler + emitting variable and functions in the same order. */ static void -gomp_offload_image_to_device (struct gomp_device_descr *devicep, - void *host_table, void *target_data, - bool is_register_lock) +gomp_load_image_to_device (struct gomp_device_descr *devicep, + const void *host_table, const void *target_data, + bool is_register_lock) { void **host_func_table = ((void ***) host_table)[0]; void **host_funcs_end = ((void ***) host_table)[1]; @@ -696,7 +659,8 @@ gomp_offload_image_to_device (struct gomp_device_descr *devicep, /* Load image to device and get target addresses for the image. */ struct addr_pair *target_table = NULL; int i, num_target_entries - = devicep->load_image_func (devicep->target_id, target_data, &target_table); + = devicep->load_image_func (devicep->target_id, target_data, + &target_table); if (num_target_entries != num_funcs + num_vars) { @@ -763,13 +727,67 @@ gomp_offload_image_to_device (struct gomp_device_descr *devicep, free (target_table); } +/* Unload the mappings described by target_data from device DEVICE_P. + The device must be locked. */ + +static void +gomp_unload_image_from_device (struct gomp_device_descr *devicep, + const void *host_table, const void *target_data) +{ + void **host_func_table = ((void ***) host_table)[0]; + void **host_funcs_end = ((void ***) host_table)[1]; + void **host_var_table = ((void ***) host_table)[2]; + void **host_vars_end = ((void ***) host_table)[3]; + + /* The func table contains only addresses, the var table contains addresses + and corresponding sizes. */ + int num_funcs = host_funcs_end - host_func_table; + int num_vars = (host_vars_end - host_var_table) / 2; + + unsigned j; + struct splay_tree_key_s k; + splay_tree_key node = NULL; + + /* Find mapping at start of node array */ + if (num_funcs || num_vars) + { + k.host_start = (num_funcs ? (uintptr_t) host_func_table[0] + : (uintptr_t) host_var_table[0]); + k.host_end = k.host_start + 1; + node = splay_tree_lookup (&devicep->mem_map, &k); + } + + devicep->unload_image_func (devicep->target_id, target_data); + + /* Remove mappings from splay tree. */ + for (j = 0; j < num_funcs; j++) + { + k.host_start = (uintptr_t) host_func_table[j]; + k.host_end = k.host_start + 1; + splay_tree_remove (&devicep->mem_map, &k); + } + + for (j = 0; j < num_vars; j++) + { + k.host_start = (uintptr_t) host_var_table[j * 2]; + k.host_end = k.host_start + (uintptr_t) host_var_table[j * 2 + 1]; + splay_tree_remove (&devicep->mem_map, &k); + } + + if (node) + { + free (node->tgt); + free (node); + } +} + /* This function should be called from every offload image while loading. It gets the descriptor of the host func and var tables HOST_TABLE, TYPE of the target, and TARGET_DATA needed by target plugin. */ void -GOMP_offload_register (void *host_table, enum offload_target_type target_type, - void *target_data) +GOMP_offload_register (const void *host_table, int target_type, + const void *target_data) { int i; gomp_mutex_lock (®ister_lock); @@ -780,7 +798,7 @@ GOMP_offload_register (void *host_table, enum offload_target_type target_type, struct gomp_device_descr *devicep = &devices[i]; gomp_mutex_lock (&devicep->lock); if (devicep->type == target_type && devicep->is_initialized) - gomp_offload_image_to_device (devicep, host_table, target_data, true); + gomp_load_image_to_device (devicep, host_table, target_data, true); gomp_mutex_unlock (&devicep->lock); } @@ -802,72 +820,20 @@ GOMP_offload_register (void *host_table, enum offload_target_type target_type, the target, and TARGET_DATA needed by target plugin. */ void -GOMP_offload_unregister (void *host_table, enum offload_target_type target_type, - void *target_data) +GOMP_offload_unregister (const void *host_table, int target_type, + const void *target_data) { - void **host_func_table = ((void ***) host_table)[0]; - void **host_funcs_end = ((void ***) host_table)[1]; - void **host_var_table = ((void ***) host_table)[2]; - void **host_vars_end = ((void ***) host_table)[3]; int i; - /* The func table contains only addresses, the var table contains addresses - and corresponding sizes. */ - int num_funcs = host_funcs_end - host_func_table; - int num_vars = (host_vars_end - host_var_table) / 2; - gomp_mutex_lock (®ister_lock); /* Unload image from all initialized devices. */ for (i = 0; i < num_devices; i++) { - int j; struct gomp_device_descr *devicep = &devices[i]; gomp_mutex_lock (&devicep->lock); - if (devicep->type != target_type || !devicep->is_initialized) - { - gomp_mutex_unlock (&devicep->lock); - continue; - } - - devicep->unload_image_func (devicep->target_id, target_data); - - /* Remove mapping from splay tree. */ - struct splay_tree_key_s k; - splay_tree_key node = NULL; - if (num_funcs > 0) - { - k.host_start = (uintptr_t) host_func_table[0]; - k.host_end = k.host_start + 1; - node = splay_tree_lookup (&devicep->mem_map, &k); - } - else if (num_vars > 0) - { - k.host_start = (uintptr_t) host_var_table[0]; - k.host_end = k.host_start + (uintptr_t) host_var_table[1]; - node = splay_tree_lookup (&devicep->mem_map, &k); - } - - for (j = 0; j < num_funcs; j++) - { - k.host_start = (uintptr_t) host_func_table[j]; - k.host_end = k.host_start + 1; - splay_tree_remove (&devicep->mem_map, &k); - } - - for (j = 0; j < num_vars; j++) - { - k.host_start = (uintptr_t) host_var_table[j * 2]; - k.host_end = k.host_start + (uintptr_t) host_var_table[j * 2 + 1]; - splay_tree_remove (&devicep->mem_map, &k); - } - - if (node) - { - free (node->tgt); - free (node); - } - + if (devicep->type == target_type && devicep->is_initialized) + gomp_unload_image_from_device (devicep, host_table, target_data); gomp_mutex_unlock (&devicep->lock); } @@ -896,13 +862,31 @@ gomp_init_device (struct gomp_device_descr *devicep) { struct offload_image_descr *image = &offload_images[i]; if (image->type == devicep->type) - gomp_offload_image_to_device (devicep, image->host_table, - image->target_data, false); + gomp_load_image_to_device (devicep, image->host_table, + image->target_data, false); } devicep->is_initialized = true; } +attribute_hidden void +gomp_unload_device (struct gomp_device_descr *devicep) +{ + if (devicep->is_initialized) + { + unsigned i; + + /* Unload from device all images registered at the moment. */ + for (i = 0; i < num_offload_images; i++) + { + struct offload_image_descr *image = &offload_images[i]; + if (image->type == devicep->type) + gomp_unload_image_from_device (devicep, image->host_table, + image->target_data); + } + } +} + /* Free address mapping tables. MM must be locked on entry, and remains locked on return. */ diff --git a/libgomp/team.c b/libgomp/team.c index b98b2337434..7671b05c5bd 100644 --- a/libgomp/team.c +++ b/libgomp/team.c @@ -134,6 +134,25 @@ gomp_thread_start (void *xdata) return NULL; } +static inline struct gomp_team * +get_last_team (unsigned nthreads) +{ + struct gomp_thread *thr = gomp_thread (); + if (thr->ts.team == NULL) + { + struct gomp_thread_pool *pool = thr->thread_pool; + if (pool != NULL) + { + struct gomp_team *last_team = pool->last_team; + if (last_team != NULL && last_team->nthreads == nthreads) + { + pool->last_team = NULL; + return last_team; + } + } + } + return NULL; +} /* Create a new team data structure. */ @@ -141,18 +160,27 @@ struct gomp_team * gomp_new_team (unsigned nthreads) { struct gomp_team *team; - size_t size; int i; - size = sizeof (*team) + nthreads * (sizeof (team->ordered_release[0]) - + sizeof (team->implicit_task[0])); - team = gomp_malloc (size); + team = get_last_team (nthreads); + if (team == NULL) + { + size_t extra = sizeof (team->ordered_release[0]) + + sizeof (team->implicit_task[0]); + team = gomp_malloc (sizeof (*team) + nthreads * extra); + +#ifndef HAVE_SYNC_BUILTINS + gomp_mutex_init (&team->work_share_list_free_lock); +#endif + gomp_barrier_init (&team->barrier, nthreads); + gomp_mutex_init (&team->task_lock); + + team->nthreads = nthreads; + } team->work_share_chunk = 8; #ifdef HAVE_SYNC_BUILTINS team->single_count = 0; -#else - gomp_mutex_init (&team->work_share_list_free_lock); #endif team->work_shares_to_free = &team->work_shares[0]; gomp_init_work_share (&team->work_shares[0], false, nthreads); @@ -163,14 +191,10 @@ gomp_new_team (unsigned nthreads) team->work_shares[i].next_free = &team->work_shares[i + 1]; team->work_shares[i].next_free = NULL; - team->nthreads = nthreads; - gomp_barrier_init (&team->barrier, nthreads); - gomp_sem_init (&team->master_release, 0); team->ordered_release = (void *) &team->implicit_task[nthreads]; team->ordered_release[0] = &team->master_release; - gomp_mutex_init (&team->task_lock); team->task_queue = NULL; team->task_count = 0; team->task_queued_count = 0; @@ -187,6 +211,9 @@ gomp_new_team (unsigned nthreads) static void free_team (struct gomp_team *team) { +#ifndef HAVE_SYNC_BUILTINS + gomp_mutex_destroy (&team->work_share_list_free_lock); +#endif gomp_barrier_destroy (&team->barrier); gomp_mutex_destroy (&team->task_lock); free (team); @@ -895,9 +922,6 @@ gomp_team_end (void) while (ws != NULL); } gomp_sem_destroy (&team->master_release); -#ifndef HAVE_SYNC_BUILTINS - gomp_mutex_destroy (&team->work_share_list_free_lock); -#endif if (__builtin_expect (thr->ts.team != NULL, 0) || __builtin_expect (team->nthreads == 1, 0)) diff --git a/libgomp/testsuite/lib/libgomp.exp b/libgomp/testsuite/lib/libgomp.exp index 5a6eec12352..438777f1fc4 100644 --- a/libgomp/testsuite/lib/libgomp.exp +++ b/libgomp/testsuite/lib/libgomp.exp @@ -345,3 +345,23 @@ proc check_effective_target_openacc_nvidia_accel_selected { } { } return 0; } + +# Return 1 if the host target is selected for offloaded + +proc check_effective_target_openacc_host_selected { } { + global offload_target_openacc + if { $offload_target_openacc == "host" } { + return 1; + } + return 0; +} + +# Return 1 if the host_nonshm target is selected for offloaded + +proc check_effective_target_openacc_host_nonshm_selected { } { + global offload_target_openacc + if { $offload_target_openacc == "host_nonshm" } { + return 1; + } + return 0; +} diff --git a/libgomp/testsuite/libgomp.c++/atomic-1.C b/libgomp/testsuite/libgomp.c++/atomic-1.C index 73f6e7c4059..9eecfbbe77d 100644 --- a/libgomp/testsuite/libgomp.c++/atomic-1.C +++ b/libgomp/testsuite/libgomp.c++/atomic-1.C @@ -1,6 +1,5 @@ // PR c++/33894 // { dg-do run } -// { dg-options "-O2" } extern "C" void abort (); diff --git a/libgomp/testsuite/libgomp.c++/atomic-16.C b/libgomp/testsuite/libgomp.c++/atomic-16.C index afccd52bb66..432d36dd7da 100644 --- a/libgomp/testsuite/libgomp.c++/atomic-16.C +++ b/libgomp/testsuite/libgomp.c++/atomic-16.C @@ -1,5 +1,4 @@ // PR c/64824 // { dg-do run } -// { dg-options "-O2 -fopenmp" } #include "../libgomp.c/atomic-18.c" diff --git a/libgomp/testsuite/libgomp.c++/c++.exp b/libgomp/testsuite/libgomp.c++/c++.exp index da42e6213b0..0454f95588e 100644 --- a/libgomp/testsuite/libgomp.c++/c++.exp +++ b/libgomp/testsuite/libgomp.c++/c++.exp @@ -11,6 +11,11 @@ if [info exists lang_include_flags] then { unset lang_include_flags } +# If a testcase doesn't have special options, use these. +if ![info exists DEFAULT_CFLAGS] then { + set DEFAULT_CFLAGS "-O2" +} + # Initialize dg. dg-init @@ -60,7 +65,7 @@ if { $lang_test_file_found } { } # Main loop. - dg-runtest $tests "" $libstdcxx_includes + dg-runtest $tests "" "$libstdcxx_includes $DEFAULT_CFLAGS" } # All done. diff --git a/libgomp/testsuite/libgomp.c++/examples-4/e.53.2.C b/libgomp/testsuite/libgomp.c++/examples-4/declare_target-2.C index 75276e7c5c6..75276e7c5c6 100644 --- a/libgomp/testsuite/libgomp.c++/examples-4/e.53.2.C +++ b/libgomp/testsuite/libgomp.c++/examples-4/declare_target-2.C diff --git a/libgomp/testsuite/libgomp.c++/examples-4/e.51.5.C b/libgomp/testsuite/libgomp.c++/examples-4/target_data-5.C index 4298e234217..4298e234217 100644 --- a/libgomp/testsuite/libgomp.c++/examples-4/e.51.5.C +++ b/libgomp/testsuite/libgomp.c++/examples-4/target_data-5.C diff --git a/libgomp/testsuite/libgomp.c++/for-7.C b/libgomp/testsuite/libgomp.c++/for-7.C index 9d626c028df..256a1312e4f 100644 --- a/libgomp/testsuite/libgomp.c++/for-7.C +++ b/libgomp/testsuite/libgomp.c++/for-7.C @@ -1,6 +1,6 @@ // PR c++/ // { dg-do run } -// { dg-options "-std=c++0x -fopenmp" } +// { dg-additional-options "-std=c++0x" } extern "C" void abort (); int cnt; diff --git a/libgomp/testsuite/libgomp.c++/pr64824.C b/libgomp/testsuite/libgomp.c++/pr64824.C index 348f6d6e0c2..00f23bb728c 100644 --- a/libgomp/testsuite/libgomp.c++/pr64824.C +++ b/libgomp/testsuite/libgomp.c++/pr64824.C @@ -1,5 +1,4 @@ // PR c/64824 // { dg-do run } -// { dg-options "-O2 -fopenmp" } #include "../libgomp.c/pr64824.c" diff --git a/libgomp/testsuite/libgomp.c++/pr64868.C b/libgomp/testsuite/libgomp.c++/pr64868.C index 2d730ac4924..661ec232dd3 100644 --- a/libgomp/testsuite/libgomp.c++/pr64868.C +++ b/libgomp/testsuite/libgomp.c++/pr64868.C @@ -1,5 +1,4 @@ // PR c/64868 // { dg-do run } -// { dg-options "-O2 -fopenmp" } #include "../libgomp.c/pr64868.c" diff --git a/libgomp/testsuite/libgomp.c++/pr66199-1.C b/libgomp/testsuite/libgomp.c++/pr66199-1.C new file mode 100644 index 00000000000..cb86a60fa26 --- /dev/null +++ b/libgomp/testsuite/libgomp.c++/pr66199-1.C @@ -0,0 +1,4 @@ +// PR middle-end/66199 +// { dg-do run } + +#include "../libgomp.c/pr66199-1.c" diff --git a/libgomp/testsuite/libgomp.c++/pr66199-2.C b/libgomp/testsuite/libgomp.c++/pr66199-2.C new file mode 100644 index 00000000000..1dbccb6c0e5 --- /dev/null +++ b/libgomp/testsuite/libgomp.c++/pr66199-2.C @@ -0,0 +1,4 @@ +// PR middle-end/66199 +// { dg-do run } + +#include "../libgomp.c/pr66199-2.c" diff --git a/libgomp/testsuite/libgomp.c++/pr66702-1.C b/libgomp/testsuite/libgomp.c++/pr66702-1.C new file mode 100644 index 00000000000..4d542599b34 --- /dev/null +++ b/libgomp/testsuite/libgomp.c++/pr66702-1.C @@ -0,0 +1,50 @@ +// PR middle-end/66702 +// { dg-do run { target vect_simd_clones } } +// { dg-options "-O2" } +// { dg-additional-options "-msse2" { target sse2_runtime } } +// { dg-additional-options "-mavx" { target avx_runtime } } + +void +bar (int &a, int &b, int *&c, int &d) +{ + volatile int x; + int *volatile y; + x = a; a = x; + x = b; b = x; + y = c; c = y; + x = d; d = x; +} + +void (*volatile barp) (int &, int &, int *&, int &) = bar; + +#pragma omp declare simd uniform(b, c) linear(d:2) aligned(c:32) notinbranch +int +foo (int a, int b, int *c, int d) +{ + a++; + b++; + c += 8; + d += 2; + barp (a, b, c, d); + return a + b + *c + d; +} + +volatile int e = 5; +int c[64] __attribute__((aligned (32))); + +int +main () +{ + int d = 7, r = 0; + int b = e; + for (int i = 0; i < 64; i++) + c[i] = i; + #pragma omp simd reduction(+:r) linear(d:2) + for (int i = 0; i < 64; i++) + { + r += foo (i, b, c, d); + d += 2; + } + if (r != 7584) + __builtin_abort (); +} diff --git a/libgomp/testsuite/libgomp.c++/pr66702-2.C b/libgomp/testsuite/libgomp.c++/pr66702-2.C new file mode 100644 index 00000000000..73298d85f00 --- /dev/null +++ b/libgomp/testsuite/libgomp.c++/pr66702-2.C @@ -0,0 +1,35 @@ +// PR middle-end/66702 +// { dg-do run { target vect_simd_clones } } +// { dg-options "-O2" } +// { dg-additional-options "-msse2" { target sse2_runtime } } +// { dg-additional-options "-mavx" { target avx_runtime } } + +struct S { int s1, s2; }; +struct T { T (); ~T (); int t; }; + +T::T () : t(0) {} +T::~T () {} + +#pragma omp declare simd uniform(b, c) notinbranch +__attribute__((noinline)) int +foo (int a, S b, T c) +{ + a++; + b.s1++; + b.s2++; + c.t++; + return a + b.s1 + b.s2 + c.t; +} + +int +main () +{ + int r = 0; + S s = { 2, 3 }; + T t; + #pragma omp simd reduction(+:r) + for (int i = 0; i < 64; i++) + r += foo (i, s, t); + if (r != 2592) + __builtin_abort (); +} diff --git a/libgomp/testsuite/libgomp.c++/simd-1.C b/libgomp/testsuite/libgomp.c++/simd-1.C index 16ef159b827..139386f085a 100644 --- a/libgomp/testsuite/libgomp.c++/simd-1.C +++ b/libgomp/testsuite/libgomp.c++/simd-1.C @@ -1,5 +1,4 @@ // { dg-do run } -// { dg-options "-O2" } // { dg-additional-options "-msse2" { target sse2_runtime } } // { dg-additional-options "-mavx" { target avx_runtime } } diff --git a/libgomp/testsuite/libgomp.c++/simd-2.C b/libgomp/testsuite/libgomp.c++/simd-2.C index 6b12415bdce..8205d6449c8 100644 --- a/libgomp/testsuite/libgomp.c++/simd-2.C +++ b/libgomp/testsuite/libgomp.c++/simd-2.C @@ -1,5 +1,4 @@ // { dg-do run } -// { dg-options "-O2" } // { dg-additional-options "-msse2" { target sse2_runtime } } // { dg-additional-options "-mavx" { target avx_runtime } } diff --git a/libgomp/testsuite/libgomp.c++/simd-3.C b/libgomp/testsuite/libgomp.c++/simd-3.C index 1c6d8e01af9..195261d820e 100644 --- a/libgomp/testsuite/libgomp.c++/simd-3.C +++ b/libgomp/testsuite/libgomp.c++/simd-3.C @@ -1,5 +1,4 @@ // { dg-do run } -// { dg-options "-O2" } // { dg-additional-options "-msse2" { target sse2_runtime } } // { dg-additional-options "-mavx" { target avx_runtime } } diff --git a/libgomp/testsuite/libgomp.c++/simd-4.C b/libgomp/testsuite/libgomp.c++/simd-4.C index bdfacc65264..b81f230b25d 100644 --- a/libgomp/testsuite/libgomp.c++/simd-4.C +++ b/libgomp/testsuite/libgomp.c++/simd-4.C @@ -1,5 +1,4 @@ // { dg-do run } -// { dg-options "-O2" } // { dg-additional-options "-msse2" { target sse2_runtime } } // { dg-additional-options "-mavx" { target avx_runtime } } diff --git a/libgomp/testsuite/libgomp.c++/simd-5.C b/libgomp/testsuite/libgomp.c++/simd-5.C index 6c4627e210a..e7cea84548c 100644 --- a/libgomp/testsuite/libgomp.c++/simd-5.C +++ b/libgomp/testsuite/libgomp.c++/simd-5.C @@ -1,5 +1,4 @@ // { dg-do run } -// { dg-options "-O2" } // { dg-additional-options "-msse2" { target sse2_runtime } } // { dg-additional-options "-mavx" { target avx_runtime } } diff --git a/libgomp/testsuite/libgomp.c++/simd-6.C b/libgomp/testsuite/libgomp.c++/simd-6.C index cfc13d0a0f9..fa93dfd5989 100644 --- a/libgomp/testsuite/libgomp.c++/simd-6.C +++ b/libgomp/testsuite/libgomp.c++/simd-6.C @@ -1,5 +1,4 @@ // { dg-do run } -// { dg-options "-O2" } // { dg-additional-options "-msse2" { target sse2_runtime } } // { dg-additional-options "-mavx" { target avx_runtime } } diff --git a/libgomp/testsuite/libgomp.c++/simd-7.C b/libgomp/testsuite/libgomp.c++/simd-7.C index 5a6f4cef7c1..a0bdac5e1b7 100644 --- a/libgomp/testsuite/libgomp.c++/simd-7.C +++ b/libgomp/testsuite/libgomp.c++/simd-7.C @@ -1,5 +1,4 @@ // { dg-do run } -// { dg-options "-O2" } // { dg-additional-options "-msse2" { target sse2_runtime } } // { dg-additional-options "-mavx" { target avx_runtime } } diff --git a/libgomp/testsuite/libgomp.c++/simd-8.C b/libgomp/testsuite/libgomp.c++/simd-8.C index 7c758328529..bc13254fdd3 100644 --- a/libgomp/testsuite/libgomp.c++/simd-8.C +++ b/libgomp/testsuite/libgomp.c++/simd-8.C @@ -1,6 +1,5 @@ // PR libgomp/58482 // { dg-do run } -// { dg-options "-O2" } // { dg-additional-options "-msse2" { target sse2_runtime } } // { dg-additional-options "-mavx" { target avx_runtime } } diff --git a/libgomp/testsuite/libgomp.c++/simd-9.C b/libgomp/testsuite/libgomp.c++/simd-9.C index 3c567b31c3e..8f21bf2209a 100644 --- a/libgomp/testsuite/libgomp.c++/simd-9.C +++ b/libgomp/testsuite/libgomp.c++/simd-9.C @@ -1,5 +1,4 @@ // { dg-do run } -// { dg-options "-O2" } // { dg-additional-options "-msse2" { target sse2_runtime } } // { dg-additional-options "-mavx" { target avx_runtime } } diff --git a/libgomp/testsuite/libgomp.c++/simd10.C b/libgomp/testsuite/libgomp.c++/simd10.C index 390e65ffea3..6fab68852a4 100644 --- a/libgomp/testsuite/libgomp.c++/simd10.C +++ b/libgomp/testsuite/libgomp.c++/simd10.C @@ -1,5 +1,4 @@ // { dg-do run } -// { dg-options "-O2" } // { dg-additional-options "-msse2" { target sse2_runtime } } // { dg-additional-options "-mavx" { target avx_runtime } } diff --git a/libgomp/testsuite/libgomp.c++/simd11.C b/libgomp/testsuite/libgomp.c++/simd11.C index b9668685601..fde22034a60 100644 --- a/libgomp/testsuite/libgomp.c++/simd11.C +++ b/libgomp/testsuite/libgomp.c++/simd11.C @@ -1,5 +1,4 @@ // { dg-do run } -// { dg-options "-O2" } // { dg-additional-options "-msse2" { target sse2_runtime } } // { dg-additional-options "-mavx" { target avx_runtime } } diff --git a/libgomp/testsuite/libgomp.c++/simd12.C b/libgomp/testsuite/libgomp.c++/simd12.C index ecfc912aeea..7596cad8571 100644 --- a/libgomp/testsuite/libgomp.c++/simd12.C +++ b/libgomp/testsuite/libgomp.c++/simd12.C @@ -1,5 +1,4 @@ // { dg-do run } -// { dg-options "-O2" } // { dg-additional-options "-msse2" { target sse2_runtime } } // { dg-additional-options "-mavx" { target avx_runtime } } diff --git a/libgomp/testsuite/libgomp.c++/simd13.C b/libgomp/testsuite/libgomp.c++/simd13.C index f7496209680..67a0f70ff16 100644 --- a/libgomp/testsuite/libgomp.c++/simd13.C +++ b/libgomp/testsuite/libgomp.c++/simd13.C @@ -1,5 +1,4 @@ // { dg-do run } -// { dg-options "-O2" } // { dg-additional-options "-msse2" { target sse2_runtime } } // { dg-additional-options "-mavx" { target avx_runtime } } diff --git a/libgomp/testsuite/libgomp.c++/target-2.C b/libgomp/testsuite/libgomp.c++/target-2.C index 83207cd51cd..35e910acc2e 100644 --- a/libgomp/testsuite/libgomp.c++/target-2.C +++ b/libgomp/testsuite/libgomp.c++/target-2.C @@ -1,4 +1,3 @@ -// { dg-options "-O2 -fopenmp" } // { dg-additional-sources "target-2-aux.cc" } extern "C" void abort (void); diff --git a/libgomp/testsuite/libgomp.c++/udr-11.C b/libgomp/testsuite/libgomp.c++/udr-11.C index 5d014467a9d..ee4bde319ad 100644 --- a/libgomp/testsuite/libgomp.c++/udr-11.C +++ b/libgomp/testsuite/libgomp.c++/udr-11.C @@ -1,4 +1,4 @@ // { dg-do run } -// { dg-options "-fopenmp -std=c++11" } +// { dg-additional-options "-std=c++11" } #include "udr-1.C" diff --git a/libgomp/testsuite/libgomp.c++/udr-12.C b/libgomp/testsuite/libgomp.c++/udr-12.C index 58112eb6995..1d661baba56 100644 --- a/libgomp/testsuite/libgomp.c++/udr-12.C +++ b/libgomp/testsuite/libgomp.c++/udr-12.C @@ -1,4 +1,4 @@ // { dg-do run } -// { dg-options "-fopenmp -std=c++11" } +// { dg-additional-options "-std=c++11" } #include "udr-2.C" diff --git a/libgomp/testsuite/libgomp.c++/udr-13.C b/libgomp/testsuite/libgomp.c++/udr-13.C index a9c8c600ca2..8e24ffd5007 100644 --- a/libgomp/testsuite/libgomp.c++/udr-13.C +++ b/libgomp/testsuite/libgomp.c++/udr-13.C @@ -1,4 +1,4 @@ // { dg-do run } -// { dg-options "-fopenmp -std=c++11" } +// { dg-additional-options "-std=c++11" } #include "udr-3.C" diff --git a/libgomp/testsuite/libgomp.c++/udr-14.C b/libgomp/testsuite/libgomp.c++/udr-14.C index 6cb48293286..49fabcbbdfc 100644 --- a/libgomp/testsuite/libgomp.c++/udr-14.C +++ b/libgomp/testsuite/libgomp.c++/udr-14.C @@ -1,4 +1,4 @@ // { dg-do run } -// { dg-options "-fopenmp -std=c++11" } +// { dg-additional-options "-std=c++11" } #include "udr-4.C" diff --git a/libgomp/testsuite/libgomp.c++/udr-15.C b/libgomp/testsuite/libgomp.c++/udr-15.C index d6aaf872029..e55101a0052 100644 --- a/libgomp/testsuite/libgomp.c++/udr-15.C +++ b/libgomp/testsuite/libgomp.c++/udr-15.C @@ -1,4 +1,4 @@ // { dg-do run } -// { dg-options "-fopenmp -std=c++11" } +// { dg-additional-options "-std=c++11" } #include "udr-5.C" diff --git a/libgomp/testsuite/libgomp.c++/udr-16.C b/libgomp/testsuite/libgomp.c++/udr-16.C index acf4ff2028d..50fe6724bb2 100644 --- a/libgomp/testsuite/libgomp.c++/udr-16.C +++ b/libgomp/testsuite/libgomp.c++/udr-16.C @@ -1,4 +1,4 @@ // { dg-do run } -// { dg-options "-fopenmp -std=c++11" } +// { dg-additional-options "-std=c++11" } #include "udr-6.C" diff --git a/libgomp/testsuite/libgomp.c++/udr-17.C b/libgomp/testsuite/libgomp.c++/udr-17.C index a5b62f8c67f..770b50d764d 100644 --- a/libgomp/testsuite/libgomp.c++/udr-17.C +++ b/libgomp/testsuite/libgomp.c++/udr-17.C @@ -1,4 +1,4 @@ // { dg-do run } -// { dg-options "-fopenmp -std=c++11" } +// { dg-additional-options "-std=c++11" } #include "udr-7.C" diff --git a/libgomp/testsuite/libgomp.c++/udr-18.C b/libgomp/testsuite/libgomp.c++/udr-18.C index 5911e8e9a82..fb1f10c7508 100644 --- a/libgomp/testsuite/libgomp.c++/udr-18.C +++ b/libgomp/testsuite/libgomp.c++/udr-18.C @@ -1,4 +1,4 @@ // { dg-do run } -// { dg-options "-fopenmp -std=c++11" } +// { dg-additional-options "-std=c++11" } #include "udr-8.C" diff --git a/libgomp/testsuite/libgomp.c++/udr-19.C b/libgomp/testsuite/libgomp.c++/udr-19.C index 801cab4342e..40d2eb9aeed 100644 --- a/libgomp/testsuite/libgomp.c++/udr-19.C +++ b/libgomp/testsuite/libgomp.c++/udr-19.C @@ -1,4 +1,4 @@ // { dg-do run } -// { dg-options "-fopenmp -std=c++11" } +// { dg-additional-options "-std=c++11" } #include "udr-9.C" diff --git a/libgomp/testsuite/libgomp.c/atomic-1.c b/libgomp/testsuite/libgomp.c/atomic-1.c index 4725b7de251..1cecd09b4ff 100644 --- a/libgomp/testsuite/libgomp.c/atomic-1.c +++ b/libgomp/testsuite/libgomp.c/atomic-1.c @@ -1,5 +1,5 @@ /* { dg-do run } */ -/* { dg-options "-O2 -march=pentium" { target { { i?86-*-* x86_64-*-* } && ia32 } } } */ +/* { dg-additional-options "-march=pentium" { target { { i?86-*-* x86_64-*-* } && ia32 } } } */ #ifdef __i386__ #include "cpuid.h" diff --git a/libgomp/testsuite/libgomp.c/atomic-18.c b/libgomp/testsuite/libgomp.c/atomic-18.c index bd048c1094c..4f7361e54e3 100644 --- a/libgomp/testsuite/libgomp.c/atomic-18.c +++ b/libgomp/testsuite/libgomp.c/atomic-18.c @@ -1,6 +1,5 @@ /* PR c/64824 */ /* { dg-do run } */ -/* { dg-options "-O2 -fopenmp" } */ void f1 (void) diff --git a/libgomp/testsuite/libgomp.c/atomic-2.c b/libgomp/testsuite/libgomp.c/atomic-2.c index c8779483b81..8a66da089b8 100644 --- a/libgomp/testsuite/libgomp.c/atomic-2.c +++ b/libgomp/testsuite/libgomp.c/atomic-2.c @@ -1,5 +1,5 @@ /* { dg-do run } */ -/* { dg-options "-O2 -mcx16" { target { { i?86-*-* x86_64-*-* } && lp64 } } } */ +/* { dg-additional-options "-mcx16" { target { { i?86-*-* x86_64-*-* } && lp64 } } } */ #ifdef __x86_64__ #include "cpuid.h" diff --git a/libgomp/testsuite/libgomp.c/atomic-3.c b/libgomp/testsuite/libgomp.c/atomic-3.c index 5b8fdc1a79e..818242d73c0 100644 --- a/libgomp/testsuite/libgomp.c/atomic-3.c +++ b/libgomp/testsuite/libgomp.c/atomic-3.c @@ -1,5 +1,5 @@ /* { dg-do run } */ -/* { dg-options "-fopenmp -O0" } */ +/* { dg-options "-O0" } */ #include <omp.h> #include <stdlib.h> diff --git a/libgomp/testsuite/libgomp.c/atomic-4.c b/libgomp/testsuite/libgomp.c/atomic-4.c index 10f8197b0b6..7157243e933 100644 --- a/libgomp/testsuite/libgomp.c/atomic-4.c +++ b/libgomp/testsuite/libgomp.c/atomic-4.c @@ -1,5 +1,4 @@ /* PR middle-end/35611 */ -/* { dg-options "-O2" } */ extern void abort (void); diff --git a/libgomp/testsuite/libgomp.c/atomic-5.c b/libgomp/testsuite/libgomp.c/atomic-5.c index 168f68dd6a7..e2235ebdb47 100644 --- a/libgomp/testsuite/libgomp.c/atomic-5.c +++ b/libgomp/testsuite/libgomp.c/atomic-5.c @@ -1,6 +1,5 @@ /* PR middle-end/36106 */ -/* { dg-options "-O2" } */ -/* { dg-options "-O2 -mcx16" { target { { i?86-*-* x86_64-*-* } && lp64 } } } */ +/* { dg-additional-options "-mcx16" { target { { i?86-*-* x86_64-*-* } && lp64 } } } */ #ifdef __x86_64__ # include "cpuid.h" diff --git a/libgomp/testsuite/libgomp.c/atomic-6.c b/libgomp/testsuite/libgomp.c/atomic-6.c index f8ab75e6a88..8f4849e59f8 100644 --- a/libgomp/testsuite/libgomp.c/atomic-6.c +++ b/libgomp/testsuite/libgomp.c/atomic-6.c @@ -1,7 +1,6 @@ /* PR middle-end/36106 */ -/* { dg-options "-O2" } */ -/* { dg-options "-O2 -mieee" { target alpha*-*-* } } */ -/* { dg-options "-O2 -march=i586" { target { { i?86-*-* x86_64-*-* } && ia32 } } } */ +/* { dg-additional-options "-mieee" { target alpha*-*-* } } */ +/* { dg-additional-options "-march=i586" { target { { i?86-*-* x86_64-*-* } && ia32 } } } */ #ifdef __i386__ # include "cpuid.h" diff --git a/libgomp/testsuite/libgomp.c/autopar-1.c b/libgomp/testsuite/libgomp.c/autopar-1.c index e56549b4845..718dda0d6e1 100644 --- a/libgomp/testsuite/libgomp.c/autopar-1.c +++ b/libgomp/testsuite/libgomp.c/autopar-1.c @@ -1,5 +1,5 @@ /* { dg-do run } */ -/* { dg-options "-ftree-parallelize-loops=4 -O2 -ffast-math" } */ +/* { dg-additional-options "-ftree-parallelize-loops=4 -ffast-math" } */ extern void abort (void); diff --git a/libgomp/testsuite/libgomp.c/collapse-3.c b/libgomp/testsuite/libgomp.c/collapse-3.c index 4674f83f4b6..53a4fafb577 100644 --- a/libgomp/testsuite/libgomp.c/collapse-3.c +++ b/libgomp/testsuite/libgomp.c/collapse-3.c @@ -1,5 +1,5 @@ /* { dg-do run } */ -/* { dg-options "-O2 -std=gnu99" } */ +/* { dg-additional-options "-std=gnu99" } */ #include <string.h> #include <stdlib.h> diff --git a/libgomp/testsuite/libgomp.c/copyin-1.c b/libgomp/testsuite/libgomp.c/copyin-1.c index 49c546004c8..90e08c7db12 100644 --- a/libgomp/testsuite/libgomp.c/copyin-1.c +++ b/libgomp/testsuite/libgomp.c/copyin-1.c @@ -1,5 +1,4 @@ /* { dg-do run } */ -/* { dg-options "-O2" } */ /* { dg-require-effective-target tls_runtime } */ #include <omp.h> diff --git a/libgomp/testsuite/libgomp.c/copyin-2.c b/libgomp/testsuite/libgomp.c/copyin-2.c index ae2451ef1d8..a7b05973482 100644 --- a/libgomp/testsuite/libgomp.c/copyin-2.c +++ b/libgomp/testsuite/libgomp.c/copyin-2.c @@ -1,5 +1,4 @@ /* { dg-do run } */ -/* { dg-options "-O2" } */ /* { dg-require-effective-target tls_runtime } */ #include <omp.h> diff --git a/libgomp/testsuite/libgomp.c/copyin-3.c b/libgomp/testsuite/libgomp.c/copyin-3.c index 86b0d691f3a..0a176c4a54e 100644 --- a/libgomp/testsuite/libgomp.c/copyin-3.c +++ b/libgomp/testsuite/libgomp.c/copyin-3.c @@ -1,5 +1,4 @@ /* { dg-do run } */ -/* { dg-options "-O2" } */ /* { dg-require-effective-target tls_runtime } */ #include <omp.h> diff --git a/libgomp/testsuite/libgomp.c/debug-1.c b/libgomp/testsuite/libgomp.c/debug-1.c index 09bcf7f3cc1..8fa9b548a14 100644 --- a/libgomp/testsuite/libgomp.c/debug-1.c +++ b/libgomp/testsuite/libgomp.c/debug-1.c @@ -1,6 +1,6 @@ /* PR debug/36617 */ /* { dg-do run } */ -/* { dg-options "-g -fopenmp -O0" } */ +/* { dg-options "-g -O0" } */ int f1 (void) diff --git a/libgomp/testsuite/libgomp.c/examples-4/e.56.3.c b/libgomp/testsuite/libgomp.c/examples-4/array_sections-3.c index 4f4649ae244..4f4649ae244 100644 --- a/libgomp/testsuite/libgomp.c/examples-4/e.56.3.c +++ b/libgomp/testsuite/libgomp.c/examples-4/array_sections-3.c diff --git a/libgomp/testsuite/libgomp.c/examples-4/e.56.4.c b/libgomp/testsuite/libgomp.c/examples-4/array_sections-4.c index 66234d76f7b..66234d76f7b 100644 --- a/libgomp/testsuite/libgomp.c/examples-4/e.56.4.c +++ b/libgomp/testsuite/libgomp.c/examples-4/array_sections-4.c diff --git a/libgomp/testsuite/libgomp.c/examples-4/e.55.1.c b/libgomp/testsuite/libgomp.c/examples-4/async_target-1.c index b2e1f1feef8..b2e1f1feef8 100644 --- a/libgomp/testsuite/libgomp.c/examples-4/e.55.1.c +++ b/libgomp/testsuite/libgomp.c/examples-4/async_target-1.c diff --git a/libgomp/testsuite/libgomp.c/examples-4/e.55.2.c b/libgomp/testsuite/libgomp.c/examples-4/async_target-2.c index f03cae372ff..ce63328a7b4 100644 --- a/libgomp/testsuite/libgomp.c/examples-4/e.55.2.c +++ b/libgomp/testsuite/libgomp.c/examples-4/async_target-2.c @@ -19,8 +19,9 @@ void init (float *a, float *b, int n) } #pragma omp end declare target -void vec_mult_ref (float *p, float *v1, float *v2, int n) +void vec_mult_ref(float *p, int n) { + float *v1, *v2; int i; v1 = (float *) malloc (n * sizeof (float)); @@ -35,8 +36,9 @@ void vec_mult_ref (float *p, float *v1, float *v2, int n) free (v2); } -void vec_mult (float *p, float *v1, float *v2, int n) +void vec_mult(float *p, int n) { + float *v1, *v2; int i; #pragma omp task shared(v1, v2) depend(out: v1, v2) @@ -64,6 +66,8 @@ void vec_mult (float *p, float *v1, float *v2, int n) free (v1); free (v2); } + + #pragma omp taskwait } void check (float *a, float *b, int n) @@ -81,10 +85,9 @@ int main () { float *p1 = (float *) malloc (N * sizeof (float)); float *p2 = (float *) malloc (N * sizeof (float)); - float *v1, *v2; - vec_mult_ref (p1, v1, v2, N); - vec_mult (p2, v1, v2, N); + vec_mult_ref (p1, N); + vec_mult (p2, N); check (p1, p2, N); diff --git a/libgomp/testsuite/libgomp.c/examples-4/e.53.1.c b/libgomp/testsuite/libgomp.c/examples-4/declare_target-1.c index beca8555780..beca8555780 100644 --- a/libgomp/testsuite/libgomp.c/examples-4/e.53.1.c +++ b/libgomp/testsuite/libgomp.c/examples-4/declare_target-1.c diff --git a/libgomp/testsuite/libgomp.c/examples-4/e.53.3.c b/libgomp/testsuite/libgomp.c/examples-4/declare_target-3.c index 8025335722a..8025335722a 100644 --- a/libgomp/testsuite/libgomp.c/examples-4/e.53.3.c +++ b/libgomp/testsuite/libgomp.c/examples-4/declare_target-3.c diff --git a/libgomp/testsuite/libgomp.c/examples-4/e.53.4.c b/libgomp/testsuite/libgomp.c/examples-4/declare_target-4.c index db70460b309..db70460b309 100644 --- a/libgomp/testsuite/libgomp.c/examples-4/e.53.4.c +++ b/libgomp/testsuite/libgomp.c/examples-4/declare_target-4.c diff --git a/libgomp/testsuite/libgomp.c/examples-4/e.53.5.c b/libgomp/testsuite/libgomp.c/examples-4/declare_target-5.c index 2b16dbed6b2..b550f1ff540 100644 --- a/libgomp/testsuite/libgomp.c/examples-4/e.53.5.c +++ b/libgomp/testsuite/libgomp.c/examples-4/declare_target-5.c @@ -1,5 +1,4 @@ /* { dg-do run { target vect_simd_clones } } */ -/* { dg-options "-O2" } */ /* { dg-additional-options "-msse2" { target sse2_runtime } } */ /* { dg-additional-options "-mavx" { target avx_runtime } } */ diff --git a/libgomp/testsuite/libgomp.c/examples-4/e.57.1.c b/libgomp/testsuite/libgomp.c/examples-4/device-1.c index f7c84fb4c14..f7c84fb4c14 100644 --- a/libgomp/testsuite/libgomp.c/examples-4/e.57.1.c +++ b/libgomp/testsuite/libgomp.c/examples-4/device-1.c diff --git a/libgomp/testsuite/libgomp.c/examples-4/e.57.2.c b/libgomp/testsuite/libgomp.c/examples-4/device-2.c index be204bd76f5..be204bd76f5 100644 --- a/libgomp/testsuite/libgomp.c/examples-4/e.57.2.c +++ b/libgomp/testsuite/libgomp.c/examples-4/device-2.c diff --git a/libgomp/testsuite/libgomp.c/examples-4/e.57.3.c b/libgomp/testsuite/libgomp.c/examples-4/device-3.c index 8a0cf7c200d..8a0cf7c200d 100644 --- a/libgomp/testsuite/libgomp.c/examples-4/e.57.3.c +++ b/libgomp/testsuite/libgomp.c/examples-4/device-3.c diff --git a/libgomp/testsuite/libgomp.c/examples-4/simd-1.c b/libgomp/testsuite/libgomp.c/examples-4/simd-1.c new file mode 100644 index 00000000000..5baaf307639 --- /dev/null +++ b/libgomp/testsuite/libgomp.c/examples-4/simd-1.c @@ -0,0 +1,65 @@ +/* { dg-do run } */ +/* { dg-additional-options "-msse2" { target sse2_runtime } } */ +/* { dg-additional-options "-mavx" { target avx_runtime } } */ + +#define N 100 +#define OFF 32 +#define EPS 0.0000000000000001 + +#include <stdlib.h> + +void init(double *a, double *a_ref, double *b, double *c, int n, int ioff) +{ + int i; + for ( i = 0; i < n; i++ ) + { + a[i] = i*i; + a_ref[i] = a[i]; + b[i] = i+i; + } + + int s = -1; + for ( i = 0; i < n+ioff; i++ ) + { + c[i] = s*3; + s = -s; + } +} + +void star( double *a, double *b, double *c, int n, int *ioff ) +{ + int i; + #pragma omp simd + for ( i = 0; i < n; i++ ) + a[i] *= b[i] * c[i+ *ioff]; +} + +void star_ref( double *a, double *b, double *c, int n, int *ioff ) +{ + int i; + for ( i = 0; i < n; i++ ) + a[i] *= b[i] * c[i+ *ioff]; +} + +void check (double *a, double *b) +{ + int i; + for (i = 0; i < N; i++) + if (a[i] - b[i] > EPS || b[i] - a[i] > EPS) + abort (); +} + +int main () +{ + double a[N], a_ref[N], b[N], c[N+OFF]; + int ioff = OFF; + + init(a, a_ref, b, c, N, ioff); + + star(a, b, c, N, &ioff); + star_ref(a_ref, b, c, N, &ioff); + + check(a, a_ref); + + return 0; +} diff --git a/libgomp/testsuite/libgomp.c/examples-4/simd-2.c b/libgomp/testsuite/libgomp.c/examples-4/simd-2.c new file mode 100644 index 00000000000..6527db9d279 --- /dev/null +++ b/libgomp/testsuite/libgomp.c/examples-4/simd-2.c @@ -0,0 +1,90 @@ +/* { dg-do run { target vect_simd_clones } } */ +/* { dg-additional-options "-msse2" { target sse2_runtime } } */ +/* { dg-additional-options "-mavx" { target avx_runtime } } */ + +#define N 100 +#define EPS 0.0000000000000001 + +#include <stdlib.h> + +void init(double *a, double *a_ref, double *b, int n) +{ + int i; + for ( i=0; i<N; i++ ) + { + a[i] = i; + a_ref[i] = i; + b[i] = N-i; + } +} + +#pragma omp declare simd uniform(fact) +double add1(double a, double b, double fact) +{ + double c; + c = a + b + fact; + return c; +} + +#pragma omp declare simd uniform(a,b,fact) linear(i:1) +double add2(double *a, double *b, int i, double fact) +{ + double c; + c = a[i] + b[i] + fact; + return c; +} + +#pragma omp declare simd uniform(fact) linear(a,b:1) +double add3(double *a, double *b, double fact) +{ + double c; + c = *a + *b + fact; + return c; +} + +void work( double *a, double *b, int n ) +{ + int i; + double tmp; + #pragma omp simd private(tmp) + for ( i = 0; i < n; i++ ) { + tmp = add1( a[i], b[i], 1.0); + a[i] = add2( a, b, i, 1.0) + tmp; + a[i] = add3(&a[i], &b[i], 1.0); + } +} + +void work_ref( double *a, double *b, int n ) +{ + int i; + double tmp; + for ( i = 0; i < n; i++ ) { + tmp = add1( a[i], b[i], 1.0); + a[i] = add2( a, b, i, 1.0) + tmp; + a[i] = add3(&a[i], &b[i], 1.0); + } +} + +void check (double *a, double *b) +{ + int i; + for (i = 0; i < N; i++) + if (a[i] - b[i] > EPS || b[i] - a[i] > EPS) + abort (); +} + + +int main () +{ + int i; + double a[N], a_ref[N], b[N]; + + init(a, a_ref, b, N); + + work(a, b, N ); + work_ref(a_ref, b, N ); + + check(a, a_ref); + + return 0; +} diff --git a/libgomp/testsuite/libgomp.c/examples-4/simd-3.c b/libgomp/testsuite/libgomp.c/examples-4/simd-3.c new file mode 100644 index 00000000000..9082e49ecc3 --- /dev/null +++ b/libgomp/testsuite/libgomp.c/examples-4/simd-3.c @@ -0,0 +1,62 @@ +/* { dg-do run } */ +/* { dg-additional-options "-msse2" { target sse2_runtime } } */ +/* { dg-additional-options "-mavx" { target avx_runtime } } */ + +#define N 100 +#define EPS 0.0000000000000001 + +#include <stdlib.h> + +void init(double *a, double *a_ref, double *b, int n) +{ + int i, s = -1; + for ( i = 0; i < n; i++ ) + { + a[i] = i*i*s; + a_ref[i] = a[i]; + b[i] = i+i; + s = -s; + } +} + +double work( double *a, double *b, int n ) +{ + int i; + double tmp, sum; + sum = 0.0; + #pragma omp simd private(tmp) reduction(+:sum) + for (i = 0; i < n; i++) { + tmp = a[i] + b[i]; + sum += tmp; + } + return sum; +} + +double work_ref( double *a, double *b, int n ) +{ + int i; + double tmp, sum; + sum = 0.0; + for (i = 0; i < n; i++) { + tmp = a[i] + b[i]; + sum += tmp; + } + return sum; +} + +int main () +{ + double a[N], a_ref[N], b[N], res, ref, diff; + + init(a, a_ref, b, N); + + res = work(a, b, N); + ref = work_ref(a_ref, b, N); + + diff = res - ref; + + if (diff > EPS || -diff > EPS) + abort (); + + return 0; +} diff --git a/libgomp/testsuite/libgomp.c/examples-4/simd-4.c b/libgomp/testsuite/libgomp.c/examples-4/simd-4.c new file mode 100644 index 00000000000..1aa0425010d --- /dev/null +++ b/libgomp/testsuite/libgomp.c/examples-4/simd-4.c @@ -0,0 +1,58 @@ +/* { dg-do run } */ +/* { dg-additional-options "-msse2" { target sse2_runtime } } */ +/* { dg-additional-options "-mavx" { target avx_runtime } } */ + +#define N 128 +#define M 16 +#define EPS 0.0000000000000001 +#define SAFELEN 16 + +#include <stdlib.h> + +void init(double *a, double *b, int n) +{ + int i, s = -1; + for ( i = 0; i < n; i++ ) + { + a[i] = i*i*s; + b[i] = a[i]; + s = -s; + } +} + +void work( double *b, int n, int m ) +{ + int i; + #pragma omp simd safelen(SAFELEN) + for (i = m; i < n; i++) + b[i] = b[i-m] - 1.0f; +} + +void work_ref( double *b, int n, int m ) +{ + int i; + for (i = m; i < n; i++) + b[i] = b[i-m] - 1.0f; +} + +void check (double *a, double *b) +{ + int i; + for (i = 0; i < N; i++) + if (a[i] - b[i] > EPS || b[i] - a[i] > EPS) + abort (); +} + +int main () +{ + double b[N], b_ref[N]; + + init(b, b_ref, N); + + work(b, N, M); + work(b_ref, N, M); + + check(b, b_ref); + + return 0; +} diff --git a/libgomp/testsuite/libgomp.c/examples-4/simd-5.c b/libgomp/testsuite/libgomp.c/examples-4/simd-5.c new file mode 100644 index 00000000000..ce037acdaee --- /dev/null +++ b/libgomp/testsuite/libgomp.c/examples-4/simd-5.c @@ -0,0 +1,76 @@ +/* { dg-do run } */ +/* { dg-additional-options "-msse2" { target sse2_runtime } } */ +/* { dg-additional-options "-mavx" { target avx_runtime } } */ + +#define N 128 +#define M 16 +#define EPS 0.0000000000000001 +#define SAFELEN 16 + +#include <stdlib.h> + +void init(double a[N][N], double b[N][N], int n) +{ + int i, j, s = -1; + for (i = 0; i < n; i++) + { + for (j = 0; j < n; j++) + { + a[i][j] = i * j * s; + b[i][j] = i + j + s; + s = -s; + } + } +} + +void work( double a[N][N], double b[N][N], double c[N][N], int n ) +{ + int i, j; + double tmp; + #pragma omp for simd collapse(2) private(tmp) + for (i = 0; i < n; i++) + { + for (j = 0; j < n; j++) + { + tmp = a[i][j] + b[i][j]; + c[i][j] = tmp; + } + } +} + +void work_ref( double a[N][N], double b[N][N], double c[N][N], int n ) +{ + int i, j; + double tmp; + for (i = 0; i < n; i++) + { + for (j = 0; j < n; j++) + { + tmp = a[i][j] + b[i][j]; + c[i][j] = tmp; + } + } +} + +void check (double a[N][N], double b[N][N]) +{ + int i, j; + for (i = 0; i < N; i++) + for (j = 0; j < N; j++) + if (a[i][j] - b[i][j] > EPS || b[i][j] - a[i][j] > EPS) + abort (); +} + +int main () +{ + double a[N][N], b[N][N], c[N][N], c_ref[N][N]; + + init(a, b, N); + + work(a, b, c, N); + work_ref(a, b, c_ref, N); + + check(c, c_ref); + + return 0; +} diff --git a/libgomp/testsuite/libgomp.c/examples-4/simd-6.c b/libgomp/testsuite/libgomp.c/examples-4/simd-6.c new file mode 100644 index 00000000000..a326b455b42 --- /dev/null +++ b/libgomp/testsuite/libgomp.c/examples-4/simd-6.c @@ -0,0 +1,105 @@ +/* { dg-do run { target vect_simd_clones } } */ +/* { dg-additional-options "-msse2" { target sse2_runtime } } */ +/* { dg-additional-options "-mavx" { target avx_runtime } } */ + +#define N 100 +#define EPS 0.000001 + +#include <stdlib.h> +#include <stdio.h> + +void init(int *b, float *y, int n) +{ + int i, s = -1; + for ( i=0; i<N; i++ ) + { + b[i] = i*i*s; + y[i] = b[i] * 0.1f; + s = -s; + } +} + +#pragma omp declare simd linear(p:1) notinbranch +int foo(int *p){ + *p = *p + 10; + return *p; +} + +int myaddint(int *a, int *b, int n) +{ +#pragma omp simd + for (int i=0; i<n; i++){ + a[i] = foo(&b[i]); /* foo is not called under a condition */ + } + return a[n-1]; +} + +int myaddint_ref(int *a, int *b, int n) +{ + for (int i=0; i<n; i++){ + a[i] = foo(&b[i]); + } + return a[n-1]; +} + +#pragma omp declare simd linear(p:1) inbranch +float goo(float *p){ + *p = *p + 18.5f; + return *p; +} + +int myaddfloat(float *x, float *y, int n) +{ +#pragma omp simd + for (int i=0; i<n; i++){ + x[i] = (x[i] > y[i]) ? goo(&y[i]) : y[i]; + /* goo is called under the condition (or within a branch) */ + } + return x[n-1]; +} + +int myaddfloat_ref(float *x, float *y, int n) +{ + for (int i=0; i<n; i++){ + x[i] = (x[i] > y[i]) ? goo(&y[i]) : y[i]; + } + return x[n-1]; +} + +void check_addint (int *a, int *b) +{ + int i; + for (i = 0; i < N; i++) + if (a[i] != b[i]) + abort (); +} + +void check_addfloat (float *a, float *b) +{ + int i; + for (i = 0; i < N; i++) + if (a[i] - b[i] > EPS || b[i] - a[i] > EPS) + abort (); +} + +int main () +{ + int i; + int a[N], a_ref[N], b[N]; + float x[N], x_ref[N], y[N]; + + init(a, x, N); + init(b, y, N); + myaddint(a, b, N); + myaddfloat(x, y, N); + + init(a_ref, x_ref, N); + init(b, y, N); + myaddint_ref(a_ref, b, N); + myaddfloat_ref(x_ref, y, N); + + check_addint(a, a_ref); + check_addfloat(x, x_ref); + + return 0; +} diff --git a/libgomp/testsuite/libgomp.c/examples-4/simd-7.c b/libgomp/testsuite/libgomp.c/examples-4/simd-7.c new file mode 100644 index 00000000000..732cd9179f6 --- /dev/null +++ b/libgomp/testsuite/libgomp.c/examples-4/simd-7.c @@ -0,0 +1,50 @@ +/* { dg-do run { target vect_simd_clones } } */ +/* { dg-additional-options "-msse2" { target sse2_runtime } } */ +/* { dg-additional-options "-mavx" { target avx_runtime } } */ + +#include <stdio.h> +#include <stdlib.h> + +#define N 30 +int a[N], a_ref[N], b[N]; + +#pragma omp declare simd inbranch +int fib( int n ) +{ + if (n <= 1) + return n; + else + return fib(n-1) + fib(n-2); +} + +void fib_ref() +{ + int i; + + a_ref[0] = 0; + a_ref[1] = 1; + + for (i=2; i < N; i++) + a_ref[i] = a_ref[i-2] + a_ref[i-1]; +} + +int main(void) +{ + int i; + +#pragma omp simd + for (i=0; i < N; i++) + b[i] = i; + +#pragma omp simd + for (i=0; i < N; i++) + a[i] = fib(b[i]); + + fib_ref (); + + for (i=0; i < N; i++) + if (a[i] != a_ref[i]) + abort (); + + return 0; +} diff --git a/libgomp/testsuite/libgomp.c/examples-4/simd-8.c b/libgomp/testsuite/libgomp.c/examples-4/simd-8.c new file mode 100644 index 00000000000..bbef778b776 --- /dev/null +++ b/libgomp/testsuite/libgomp.c/examples-4/simd-8.c @@ -0,0 +1,53 @@ +/* { dg-do run } */ +/* { dg-additional-options "-msse2" { target sse2_runtime } } */ +/* { dg-additional-options "-mavx" { target avx_runtime } } */ + +#include <stdlib.h> +#include <math.h> + +#define EPS 0.005 + +int P[1000]; +float A[1000]; + +float do_work(float *arr) +{ + float pri; + +#pragma omp simd lastprivate(pri) + for (int i = 0; i < 999; ++i) + { + int j = P[i]; + + pri = 0.5f; + if (j % 2 == 0) + { + pri = A[j+1] + arr[i]; + } + A[j] = pri * 1.5f; + pri = pri + A[j]; + } + + return pri; +} + +int main(void) +{ + float pri, arr[1000], diff; + + for (int i = 0; i < 1000; ++i) + { + P[i] = i; + A[i] = i * 1.5f; + arr[i] = i * 1.8f; + } + + pri = do_work(&arr[0]); + + diff = pri - 8237.25; + + if (diff > EPS || -diff > EPS) + abort (); + + return 0; +} diff --git a/libgomp/testsuite/libgomp.c/examples-4/e.50.1.c b/libgomp/testsuite/libgomp.c/examples-4/target-1.c index 45adbe00f3c..45adbe00f3c 100644 --- a/libgomp/testsuite/libgomp.c/examples-4/e.50.1.c +++ b/libgomp/testsuite/libgomp.c/examples-4/target-1.c diff --git a/libgomp/testsuite/libgomp.c/examples-4/e.50.2.c b/libgomp/testsuite/libgomp.c/examples-4/target-2.c index 55d667aa775..55d667aa775 100644 --- a/libgomp/testsuite/libgomp.c/examples-4/e.50.2.c +++ b/libgomp/testsuite/libgomp.c/examples-4/target-2.c diff --git a/libgomp/testsuite/libgomp.c/examples-4/e.50.3.c b/libgomp/testsuite/libgomp.c/examples-4/target-3.c index 8d5125f07ee..8d5125f07ee 100644 --- a/libgomp/testsuite/libgomp.c/examples-4/e.50.3.c +++ b/libgomp/testsuite/libgomp.c/examples-4/target-3.c diff --git a/libgomp/testsuite/libgomp.c/examples-4/e.50.4.c b/libgomp/testsuite/libgomp.c/examples-4/target-4.c index 545f02ae9e4..545f02ae9e4 100644 --- a/libgomp/testsuite/libgomp.c/examples-4/e.50.4.c +++ b/libgomp/testsuite/libgomp.c/examples-4/target-4.c diff --git a/libgomp/testsuite/libgomp.c/examples-4/e.50.5.c b/libgomp/testsuite/libgomp.c/examples-4/target-5.c index 1853fba684b..1853fba684b 100644 --- a/libgomp/testsuite/libgomp.c/examples-4/e.50.5.c +++ b/libgomp/testsuite/libgomp.c/examples-4/target-5.c diff --git a/libgomp/testsuite/libgomp.c/examples-4/e.51.1.c b/libgomp/testsuite/libgomp.c/examples-4/target_data-1.c index 6b0331bf04c..6b0331bf04c 100644 --- a/libgomp/testsuite/libgomp.c/examples-4/e.51.1.c +++ b/libgomp/testsuite/libgomp.c/examples-4/target_data-1.c diff --git a/libgomp/testsuite/libgomp.c/examples-4/e.51.2.c b/libgomp/testsuite/libgomp.c/examples-4/target_data-2.c index ee8f150c1a0..ee8f150c1a0 100644 --- a/libgomp/testsuite/libgomp.c/examples-4/e.51.2.c +++ b/libgomp/testsuite/libgomp.c/examples-4/target_data-2.c diff --git a/libgomp/testsuite/libgomp.c/examples-4/e.51.3.c b/libgomp/testsuite/libgomp.c/examples-4/target_data-3.c index abb283801f8..abb283801f8 100644 --- a/libgomp/testsuite/libgomp.c/examples-4/e.51.3.c +++ b/libgomp/testsuite/libgomp.c/examples-4/target_data-3.c diff --git a/libgomp/testsuite/libgomp.c/examples-4/e.51.4.c b/libgomp/testsuite/libgomp.c/examples-4/target_data-4.c index d2948ae1b54..d2948ae1b54 100644 --- a/libgomp/testsuite/libgomp.c/examples-4/e.51.4.c +++ b/libgomp/testsuite/libgomp.c/examples-4/target_data-4.c diff --git a/libgomp/testsuite/libgomp.c/examples-4/e.51.6.c b/libgomp/testsuite/libgomp.c/examples-4/target_data-6.c index affeb490021..affeb490021 100644 --- a/libgomp/testsuite/libgomp.c/examples-4/e.51.6.c +++ b/libgomp/testsuite/libgomp.c/examples-4/target_data-6.c diff --git a/libgomp/testsuite/libgomp.c/examples-4/e.51.7.c b/libgomp/testsuite/libgomp.c/examples-4/target_data-7.c index c18d4803cf3..c18d4803cf3 100644 --- a/libgomp/testsuite/libgomp.c/examples-4/e.51.7.c +++ b/libgomp/testsuite/libgomp.c/examples-4/target_data-7.c diff --git a/libgomp/testsuite/libgomp.c/examples-4/e.52.1.c b/libgomp/testsuite/libgomp.c/examples-4/target_update-1.c index 727d475f6c7..727d475f6c7 100644 --- a/libgomp/testsuite/libgomp.c/examples-4/e.52.1.c +++ b/libgomp/testsuite/libgomp.c/examples-4/target_update-1.c diff --git a/libgomp/testsuite/libgomp.c/examples-4/e.52.2.c b/libgomp/testsuite/libgomp.c/examples-4/target_update-2.c index 51262bb24a9..51262bb24a9 100644 --- a/libgomp/testsuite/libgomp.c/examples-4/e.52.2.c +++ b/libgomp/testsuite/libgomp.c/examples-4/target_update-2.c diff --git a/libgomp/testsuite/libgomp.c/examples-4/task_dep-1.c b/libgomp/testsuite/libgomp.c/examples-4/task_dep-1.c new file mode 100644 index 00000000000..8d397a55e7c --- /dev/null +++ b/libgomp/testsuite/libgomp.c/examples-4/task_dep-1.c @@ -0,0 +1,17 @@ +/* { dg-do run } */ + +#include <stdlib.h> +int main() +{ + int x = 1; + #pragma omp parallel + #pragma omp single + { + #pragma omp task shared(x) depend(out: x) + x = 2; + #pragma omp task shared(x) depend(in: x) + if (x != 2) + abort (); + } + return 0; +} diff --git a/libgomp/testsuite/libgomp.c/examples-4/task_dep-2.c b/libgomp/testsuite/libgomp.c/examples-4/task_dep-2.c new file mode 100644 index 00000000000..f583f0978e2 --- /dev/null +++ b/libgomp/testsuite/libgomp.c/examples-4/task_dep-2.c @@ -0,0 +1,17 @@ +/* { dg-do run } */ + +#include <stdlib.h> +int main() +{ + int x = 1; + #pragma omp parallel + #pragma omp single + { + #pragma omp task shared(x) depend(in: x) + if (x != 1) + abort (); + #pragma omp task shared(x) depend(out: x) + x = 2; + } + return 0; +} diff --git a/libgomp/testsuite/libgomp.c/examples-4/task_dep-3.c b/libgomp/testsuite/libgomp.c/examples-4/task_dep-3.c new file mode 100644 index 00000000000..189d5e0aa15 --- /dev/null +++ b/libgomp/testsuite/libgomp.c/examples-4/task_dep-3.c @@ -0,0 +1,20 @@ +/* { dg-do run } */ + +#include <stdlib.h> + +int main() +{ + int x = 0; + #pragma omp parallel + #pragma omp single + { + #pragma omp task shared(x) depend(out: x) + x = 1; + #pragma omp task shared(x) depend(out: x) + x = 2; + #pragma omp taskwait + if (x != 1 && x != 2) + abort (); + } + return 0; +} diff --git a/libgomp/testsuite/libgomp.c/examples-4/task_dep-4.c b/libgomp/testsuite/libgomp.c/examples-4/task_dep-4.c new file mode 100644 index 00000000000..77aa57a4c25 --- /dev/null +++ b/libgomp/testsuite/libgomp.c/examples-4/task_dep-4.c @@ -0,0 +1,20 @@ +/* { dg-do run } */ + +#include <stdlib.h> +int main() +{ + int x = 1; + #pragma omp parallel + #pragma omp single + { + #pragma omp task shared(x) depend(out: x) + x = 2; + #pragma omp task shared(x) depend(in: x) + if (x != 2) + abort (); + #pragma omp task shared(x) depend(in: x) + if (x != 2) + abort (); + } + return 0; +} diff --git a/libgomp/testsuite/libgomp.c/examples-4/task_dep-5.c b/libgomp/testsuite/libgomp.c/examples-4/task_dep-5.c new file mode 100644 index 00000000000..066edc723b3 --- /dev/null +++ b/libgomp/testsuite/libgomp.c/examples-4/task_dep-5.c @@ -0,0 +1,81 @@ +/* { dg-do run } */ + +#define N 128 +#define BS 16 +#define EPS 0.000001 + +#include <stdlib.h> + +void matmul_depend (float A[N][N], float B[N][N], float C[N][N]) +{ + int i, j, k, ii, jj, kk; + for (i = 0; i < N; i+=BS) + for (j = 0; j < N; j+=BS) + for (k = 0; k < N; k+=BS) +// Note 1: i, j, k, A, B, C are firstprivate by default +// Note 2: A, B and C are just pointers +#pragma omp task private(ii, jj, kk) \ + depend ( in: A[i:BS][k:BS], B[k:BS][j:BS] ) \ + depend ( inout: C[i:BS][j:BS] ) + for (ii = i; ii < i+BS; ii++ ) + for (jj = j; jj < j+BS; jj++ ) + for (kk = k; kk < k+BS; kk++ ) + C[ii][jj] = C[ii][jj] + A[ii][kk] * B[kk][jj]; +} + +void matmul_ref (float A[N][N], float B[N][N], float C[N][N]) +{ + int i, j, k; + + for (i = 0; i < N; i++) + for (j = 0; j < N; j++) + for (k = 0; k < N; k++) + C[i][j] += A[i][k] * B[k][j]; +} + +void init (float A[N][N], float B[N][N]) +{ + int i, j, s = -1; + for (i = 0; i < N; i++) + for (j = 0; j < N; j++) + { + A[i][j] = i * j * s; + B[i][j] = i + j; + s = -s; + } +} + +void init_zero (float A[N][N], float B[N][N]) +{ + int i, j, s = -1; + for (i = 0; i < N; i++) + for (j = 0; j < N; j++) + { + A[i][j] = 0; + B[i][j] = 0; + } +} + +void check (float A[N][N], float B[N][N]) +{ + int i, j; + for (i = 0; i < N; i++) + for (j = 0; j < N; j++) + if (A[i][j] - B[i][j] > EPS || B[i][j] - A[i][j] > EPS) + abort (); +} + +int main () +{ + float A[N][N], B[N][N], C[N][N], C_ref[N][N]; + + init (A, B); + init_zero (C, C_ref); + + matmul_depend (A, B, C); + matmul_ref (A, B, C_ref); + + check (C, C_ref); + + return 0; +} diff --git a/libgomp/testsuite/libgomp.c/examples-4/e.54.2.c b/libgomp/testsuite/libgomp.c/examples-4/teams-2.c index 8bbbc355b17..8bbbc355b17 100644 --- a/libgomp/testsuite/libgomp.c/examples-4/e.54.2.c +++ b/libgomp/testsuite/libgomp.c/examples-4/teams-2.c diff --git a/libgomp/testsuite/libgomp.c/examples-4/e.54.3.c b/libgomp/testsuite/libgomp.c/examples-4/teams-3.c index b6708785884..b6708785884 100644 --- a/libgomp/testsuite/libgomp.c/examples-4/e.54.3.c +++ b/libgomp/testsuite/libgomp.c/examples-4/teams-3.c diff --git a/libgomp/testsuite/libgomp.c/examples-4/e.54.4.c b/libgomp/testsuite/libgomp.c/examples-4/teams-4.c index 9aef78ecfba..9aef78ecfba 100644 --- a/libgomp/testsuite/libgomp.c/examples-4/e.54.4.c +++ b/libgomp/testsuite/libgomp.c/examples-4/teams-4.c diff --git a/libgomp/testsuite/libgomp.c/examples-4/e.54.5.c b/libgomp/testsuite/libgomp.c/examples-4/teams-5.c index ac99744ebe3..ac99744ebe3 100644 --- a/libgomp/testsuite/libgomp.c/examples-4/e.54.5.c +++ b/libgomp/testsuite/libgomp.c/examples-4/teams-5.c diff --git a/libgomp/testsuite/libgomp.c/examples-4/e.54.6.c b/libgomp/testsuite/libgomp.c/examples-4/teams-6.c index 388582b51cd..388582b51cd 100644 --- a/libgomp/testsuite/libgomp.c/examples-4/e.54.6.c +++ b/libgomp/testsuite/libgomp.c/examples-4/teams-6.c diff --git a/libgomp/testsuite/libgomp.c/for-1.c b/libgomp/testsuite/libgomp.c/for-1.c index e702453fb1a..942c8e7b821 100644 --- a/libgomp/testsuite/libgomp.c/for-1.c +++ b/libgomp/testsuite/libgomp.c/for-1.c @@ -1,4 +1,4 @@ -/* { dg-options "-std=gnu99 -fopenmp" } */ +/* { dg-additional-options "-std=gnu99" } */ extern void abort (void); diff --git a/libgomp/testsuite/libgomp.c/for-2.c b/libgomp/testsuite/libgomp.c/for-2.c index ae810087454..e43fdb3c800 100644 --- a/libgomp/testsuite/libgomp.c/for-2.c +++ b/libgomp/testsuite/libgomp.c/for-2.c @@ -1,4 +1,4 @@ -/* { dg-options "-std=gnu99 -fopenmp" } */ +/* { dg-additional-options "-std=gnu99" } */ extern void abort (void); diff --git a/libgomp/testsuite/libgomp.c/for-3.c b/libgomp/testsuite/libgomp.c/for-3.c index 06cbf4f9de1..f4cd115eefa 100644 --- a/libgomp/testsuite/libgomp.c/for-3.c +++ b/libgomp/testsuite/libgomp.c/for-3.c @@ -1,4 +1,4 @@ -/* { dg-options "-std=gnu99 -fopenmp" } */ +/* { dg-additional-options "-std=gnu99" } */ extern void abort (); diff --git a/libgomp/testsuite/libgomp.c/nestedfn-5.c b/libgomp/testsuite/libgomp.c/nestedfn-5.c index 6072b1fe369..651ce7cf576 100644 --- a/libgomp/testsuite/libgomp.c/nestedfn-5.c +++ b/libgomp/testsuite/libgomp.c/nestedfn-5.c @@ -1,5 +1,4 @@ /* { dg-do run } */ -/* { dg-options "-O2" } */ extern void abort (void); diff --git a/libgomp/testsuite/libgomp.c/nqueens-1.c b/libgomp/testsuite/libgomp.c/nqueens-1.c index 9742b7a18df..db5517f1233 100644 --- a/libgomp/testsuite/libgomp.c/nqueens-1.c +++ b/libgomp/testsuite/libgomp.c/nqueens-1.c @@ -1,5 +1,4 @@ /* { dg-do run } */ -/* { dg-options "-O2 -fopenmp" } */ /* { dg-require-effective-target tls_runtime } */ #include <omp.h> diff --git a/libgomp/testsuite/libgomp.c/parloops-exit-first-loop-alt-2.c b/libgomp/testsuite/libgomp.c/parloops-exit-first-loop-alt-2.c new file mode 100644 index 00000000000..a3ec7fe8ad0 --- /dev/null +++ b/libgomp/testsuite/libgomp.c/parloops-exit-first-loop-alt-2.c @@ -0,0 +1,50 @@ +/* { dg-do run } */ +/* { dg-additional-options "-ftree-parallelize-loops=2" } */ + +/* Constant bound, vector addition. */ + +#include <stdio.h> +#include <stdlib.h> + +#define N 1000 + +unsigned int a[N]; +unsigned int b[N]; +unsigned int c[N]; + +void __attribute__((noclone,noinline)) +f (void) +{ + int i; + + for (i = 0; i < N; ++i) + c[i] = a[i] + b[i]; +} + +int +main (void) +{ + int i, j; + + /* Complexify loop to inhibit parloops. */ + for (j = 0; j < 100; ++j) + for (i = 0; i < 10; i++) + { + int k = i + (10 * j); + a[k] = k; + b[k] = (k * 3) % 7; + c[k] = k * 2; + } + + f (); + + for (i = 0; i < N; i++) + { + unsigned int actual = c[i]; + unsigned int expected = i + ((i * 3) % 7); + if (actual != expected) + abort (); + } + + return 0; +} diff --git a/libgomp/testsuite/libgomp.c/parloops-exit-first-loop-alt-3.c b/libgomp/testsuite/libgomp.c/parloops-exit-first-loop-alt-3.c new file mode 100644 index 00000000000..78365e868c1 --- /dev/null +++ b/libgomp/testsuite/libgomp.c/parloops-exit-first-loop-alt-3.c @@ -0,0 +1,45 @@ +/* { dg-do run } */ +/* { dg-additional-options "-ftree-parallelize-loops=2" } */ + +/* Variable bound, reduction. */ + +#include <stdlib.h> + +#define N 4000 + +unsigned int *a; + +unsigned int __attribute__((noclone,noinline)) +f (unsigned int n, unsigned int *__restrict__ a) +{ + int i; + unsigned int sum = 1; + + for (i = 0; i < n; ++i) + sum += a[i]; + + return sum; +} + +int +main (void) +{ + unsigned int res; + unsigned int array[N]; + int i; + + for (i = 0; i < N; ++i) + array[i] = i % 7; + a = &array[0]; + + res = f (N, a); + if (res != 11995) + abort (); + + /* Test low iteration count case. */ + res = f (10, a); + if (res != 25) + abort (); + + return 0; +} diff --git a/libgomp/testsuite/libgomp.c/parloops-exit-first-loop-alt-4.c b/libgomp/testsuite/libgomp.c/parloops-exit-first-loop-alt-4.c new file mode 100644 index 00000000000..ac420fa3662 --- /dev/null +++ b/libgomp/testsuite/libgomp.c/parloops-exit-first-loop-alt-4.c @@ -0,0 +1,37 @@ +/* { dg-do run } */ +/* { dg-additional-options "-ftree-parallelize-loops=2" } */ + +/* Constant bound, reduction. */ + +#include <stdlib.h> + +#define N 4000 + +unsigned int *a; + +unsigned int +f (void) +{ + int i; + unsigned int sum = 1; + + for (i = 0; i < N; ++i) + sum += a[i]; + + return sum; +} + +int +main (void) +{ + unsigned int res; + unsigned int array[N]; + int i; + for (i = 0; i < N; ++i) + array[i] = i % 7; + a = &array[0]; + res = f (); + if (res != 11995) + abort (); + return 0; +} diff --git a/libgomp/testsuite/libgomp.c/parloops-exit-first-loop-alt-5.c b/libgomp/testsuite/libgomp.c/parloops-exit-first-loop-alt-5.c new file mode 100644 index 00000000000..d8d49b41aa5 --- /dev/null +++ b/libgomp/testsuite/libgomp.c/parloops-exit-first-loop-alt-5.c @@ -0,0 +1,75 @@ +/* { dg-do run } */ +/* { dg-additional-options "-ftree-parallelize-loops=2" } */ + +/* Variable bound, vector addition, unsigned loop counter, unsigned bound. */ + +#include <stdio.h> +#include <stdlib.h> + +#define N 1000 + +unsigned int a[N]; +unsigned int b[N]; +unsigned int c[N]; + +void __attribute__((noclone,noinline)) +f (unsigned int n, unsigned int *__restrict__ a, unsigned int *__restrict__ b, + unsigned int *__restrict__ c) +{ + unsigned int i; + + for (i = 0; i < n; ++i) + c[i] = a[i] + b[i]; +} + +static void __attribute__((noclone,noinline)) +init (void) +{ + int i, j; + + /* Complexify loop to inhibit parloops. */ + for (j = 0; j < 100; ++j) + for (i = 0; i < 10; i++) + { + int k = i + (10 * j); + a[k] = k; + b[k] = (k * 3) % 7; + c[k] = k * 2; + } +} + +int +main (void) +{ + int i; + + init (); + + f (N, a, b, c); + + for (i = 0; i < N; i++) + { + unsigned int actual = c[i]; + unsigned int expected = i + ((i * 3) % 7); + if (actual != expected) + abort (); + } + + /* Test low iteration count case. */ + + init (); + + f (10, a, b, c); + + for (i = 0; i < N; i++) + { + unsigned int actual = c[i]; + unsigned int expected = (i < 10 + ? i + ((i * 3) % 7) + : i * 2); + if (actual != expected) + abort (); + } + + return 0; +} diff --git a/libgomp/testsuite/libgomp.c/parloops-exit-first-loop-alt-6.c b/libgomp/testsuite/libgomp.c/parloops-exit-first-loop-alt-6.c new file mode 100644 index 00000000000..99c61c0c967 --- /dev/null +++ b/libgomp/testsuite/libgomp.c/parloops-exit-first-loop-alt-6.c @@ -0,0 +1,75 @@ +/* { dg-do run } */ +/* { dg-additional-options "-ftree-parallelize-loops=2" } */ + +/* Variable bound, vector addition, unsigned loop counter, signed bound. */ + +#include <stdio.h> +#include <stdlib.h> + +#define N 1000 + +unsigned int a[N]; +unsigned int b[N]; +unsigned int c[N]; + +void __attribute__((noclone,noinline)) +f (int n, unsigned int *__restrict__ a, unsigned int *__restrict__ b, + unsigned int *__restrict__ c) +{ + unsigned int i; + + for (i = 0; i < n; ++i) + c[i] = a[i] + b[i]; +} + +static void __attribute__((noclone,noinline)) +init (void) +{ + int i, j; + + /* Complexify loop to inhibit parloops. */ + for (j = 0; j < 100; ++j) + for (i = 0; i < 10; i++) + { + int k = i + (10 * j); + a[k] = k; + b[k] = (k * 3) % 7; + c[k] = k * 2; + } +} + +int +main (void) +{ + int i; + + init (); + + f (N, a, b, c); + + for (i = 0; i < N; i++) + { + unsigned int actual = c[i]; + unsigned int expected = i + ((i * 3) % 7); + if (actual != expected) + abort (); + } + + /* Test low iteration count case. */ + + init (); + + f (10, a, b, c); + + for (i = 0; i < N; i++) + { + unsigned int actual = c[i]; + unsigned int expected = (i < 10 + ? i + ((i * 3) % 7) + : i * 2); + if (actual != expected) + abort (); + } + + return 0; +} diff --git a/libgomp/testsuite/libgomp.c/parloops-exit-first-loop-alt-7.c b/libgomp/testsuite/libgomp.c/parloops-exit-first-loop-alt-7.c new file mode 100644 index 00000000000..1f6e5e42ea4 --- /dev/null +++ b/libgomp/testsuite/libgomp.c/parloops-exit-first-loop-alt-7.c @@ -0,0 +1,75 @@ +/* { dg-do run } */ +/* { dg-additional-options "-ftree-parallelize-loops=2" } */ + +/* Variable bound, vector addition, signed loop counter, signed bound. */ + +#include <stdio.h> +#include <stdlib.h> + +#define N 1000 + +unsigned int a[N]; +unsigned int b[N]; +unsigned int c[N]; + +void __attribute__((noclone,noinline)) +f (int n, unsigned int *__restrict__ a, unsigned int *__restrict__ b, + unsigned int *__restrict__ c) +{ + int i; + + for (i = 0; i < n; ++i) + c[i] = a[i] + b[i]; +} + +static void __attribute__((noclone,noinline)) +init (void) +{ + int i, j; + + /* Complexify loop to inhibit parloops. */ + for (j = 0; j < 100; ++j) + for (i = 0; i < 10; i++) + { + int k = i + (10 * j); + a[k] = k; + b[k] = (k * 3) % 7; + c[k] = k * 2; + } +} + +int +main (void) +{ + int i; + + init (); + + f (N, a, b, c); + + for (i = 0; i < N; i++) + { + unsigned int actual = c[i]; + unsigned int expected = i + ((i * 3) % 7); + if (actual != expected) + abort (); + } + + /* Test low iteration count case. */ + + init (); + + f (10, a, b, c); + + for (i = 0; i < N; i++) + { + unsigned int actual = c[i]; + unsigned int expected = (i < 10 + ? i + ((i * 3) % 7) + : i * 2); + if (actual != expected) + abort (); + } + + return 0; +} diff --git a/libgomp/testsuite/libgomp.c/parloops-exit-first-loop-alt.c b/libgomp/testsuite/libgomp.c/parloops-exit-first-loop-alt.c new file mode 100644 index 00000000000..9d94cf8c2bb --- /dev/null +++ b/libgomp/testsuite/libgomp.c/parloops-exit-first-loop-alt.c @@ -0,0 +1,75 @@ +/* { dg-do run } */ +/* { dg-additional-options "-ftree-parallelize-loops=2" } */ + +/* Variable bound, vector addition, signed loop counter, unsigned bound. */ + +#include <stdio.h> +#include <stdlib.h> + +#define N 1000 + +unsigned int a[N]; +unsigned int b[N]; +unsigned int c[N]; + +void __attribute__((noclone,noinline)) +f (unsigned int n, unsigned int *__restrict__ a, unsigned int *__restrict__ b, + unsigned int *__restrict__ c) +{ + int i; + + for (i = 0; i < n; ++i) + c[i] = a[i] + b[i]; +} + +static void __attribute__((noclone,noinline)) +init (void) +{ + int i, j; + + /* Complexify loop to inhibit parloops. */ + for (j = 0; j < 100; ++j) + for (i = 0; i < 10; i++) + { + int k = i + (10 * j); + a[k] = k; + b[k] = (k * 3) % 7; + c[k] = k * 2; + } +} + +int +main (void) +{ + int i; + + init (); + + f (N, a, b, c); + + for (i = 0; i < N; i++) + { + unsigned int actual = c[i]; + unsigned int expected = i + ((i * 3) % 7); + if (actual != expected) + abort (); + } + + /* Test low iteration count case. */ + + init (); + + f (10, a, b, c); + + for (i = 0; i < N; i++) + { + unsigned int actual = c[i]; + unsigned int expected = (i < 10 + ? i + ((i * 3) % 7) + : i * 2); + if (actual != expected) + abort (); + } + + return 0; +} diff --git a/libgomp/testsuite/libgomp.c/pr26171.c b/libgomp/testsuite/libgomp.c/pr26171.c index eacc9a71d3e..322a0c75689 100644 --- a/libgomp/testsuite/libgomp.c/pr26171.c +++ b/libgomp/testsuite/libgomp.c/pr26171.c @@ -1,6 +1,6 @@ /* PR c/26171 */ /* { dg-do run } */ -/* { dg-options "-fopenmp" } */ +/* { dg-options "-O0" } */ /* { dg-require-effective-target tls_runtime } */ int thrv = 0; diff --git a/libgomp/testsuite/libgomp.c/pr32362-1.c b/libgomp/testsuite/libgomp.c/pr32362-1.c index 3c62d4bdb26..55807e33a49 100644 --- a/libgomp/testsuite/libgomp.c/pr32362-1.c +++ b/libgomp/testsuite/libgomp.c/pr32362-1.c @@ -1,6 +1,5 @@ /* PR middle-end/32362 */ /* { dg-do run } */ -/* { dg-options "-O2" } */ #include <omp.h> #include <stdlib.h> diff --git a/libgomp/testsuite/libgomp.c/pr32362-2.c b/libgomp/testsuite/libgomp.c/pr32362-2.c index 43f36e0e98b..d4ce0918ef5 100644 --- a/libgomp/testsuite/libgomp.c/pr32362-2.c +++ b/libgomp/testsuite/libgomp.c/pr32362-2.c @@ -1,6 +1,5 @@ /* PR middle-end/32362 */ /* { dg-do run } */ -/* { dg-options "-O2" } */ #include <omp.h> #include <stdlib.h> diff --git a/libgomp/testsuite/libgomp.c/pr32362-3.c b/libgomp/testsuite/libgomp.c/pr32362-3.c index 09a88f52a3b..11a0a0a81dd 100644 --- a/libgomp/testsuite/libgomp.c/pr32362-3.c +++ b/libgomp/testsuite/libgomp.c/pr32362-3.c @@ -1,6 +1,5 @@ /* PR middle-end/32362 */ /* { dg-do run } */ -/* { dg-options "-O2" } */ #include <omp.h> #include <stdlib.h> diff --git a/libgomp/testsuite/libgomp.c/pr35625.c b/libgomp/testsuite/libgomp.c/pr35625.c index f2978f91164..eac9ce9111a 100644 --- a/libgomp/testsuite/libgomp.c/pr35625.c +++ b/libgomp/testsuite/libgomp.c/pr35625.c @@ -1,6 +1,6 @@ /* PR libgomp/35625 */ /* { dg-do run } */ -/* { dg-options "-std=c99" } */ +/* { dg-additional-options "-std=c99" } */ int main (void) diff --git a/libgomp/testsuite/libgomp.c/pr39154.c b/libgomp/testsuite/libgomp.c/pr39154.c index 5a4c89e13eb..6f7fccba254 100644 --- a/libgomp/testsuite/libgomp.c/pr39154.c +++ b/libgomp/testsuite/libgomp.c/pr39154.c @@ -1,6 +1,6 @@ /* PR middle-end/39154 */ /* { dg-do compile } */ -/* { dg-options "-O2 -std=gnu99" } */ +/* { dg-additional-options "-std=gnu99" } */ extern void abort (void); diff --git a/libgomp/testsuite/libgomp.c/pr39591-1.c b/libgomp/testsuite/libgomp.c/pr39591-1.c index dfd8d9e8aca..df326f85424 100644 --- a/libgomp/testsuite/libgomp.c/pr39591-1.c +++ b/libgomp/testsuite/libgomp.c/pr39591-1.c @@ -1,6 +1,5 @@ /* PR other/39591 */ /* { dg-do run } */ -/* { dg-options "-O2" } */ extern void abort (void); diff --git a/libgomp/testsuite/libgomp.c/pr39591-2.c b/libgomp/testsuite/libgomp.c/pr39591-2.c index b5f8f9cc7b2..37428296e53 100644 --- a/libgomp/testsuite/libgomp.c/pr39591-2.c +++ b/libgomp/testsuite/libgomp.c/pr39591-2.c @@ -1,6 +1,5 @@ /* PR other/39591 */ /* { dg-do run } */ -/* { dg-options "-O2" } */ extern void abort (void); diff --git a/libgomp/testsuite/libgomp.c/pr39591-3.c b/libgomp/testsuite/libgomp.c/pr39591-3.c index a9aeea7c83a..f09a3890f0d 100644 --- a/libgomp/testsuite/libgomp.c/pr39591-3.c +++ b/libgomp/testsuite/libgomp.c/pr39591-3.c @@ -1,6 +1,5 @@ /* PR other/39591 */ /* { dg-do run } */ -/* { dg-options "-O2" } */ extern void abort (void); diff --git a/libgomp/testsuite/libgomp.c/pr48591.c b/libgomp/testsuite/libgomp.c/pr48591.c index 8df97f1554b..2f617afcc81 100644 --- a/libgomp/testsuite/libgomp.c/pr48591.c +++ b/libgomp/testsuite/libgomp.c/pr48591.c @@ -1,6 +1,6 @@ /* PR middle-end/48591 */ /* { dg-do run { target i?86-*-linux* i?86-*-gnu* x86_64-*-linux* ia64-*-linux* x86_64-*-freebsd* } } */ -/* { dg-options "-fopenmp" } */ +/* { dg-options "-O0" } */ extern void abort (void); diff --git a/libgomp/testsuite/libgomp.c/pr58392.c b/libgomp/testsuite/libgomp.c/pr58392.c index 6ca97adc2d3..21ad2bf0bdb 100644 --- a/libgomp/testsuite/libgomp.c/pr58392.c +++ b/libgomp/testsuite/libgomp.c/pr58392.c @@ -1,6 +1,5 @@ /* PR tree-optimization/58392 */ /* { dg-do run } */ -/* { dg-options "-O2" } */ /* { dg-additional-options "-msse2" { target sse2_runtime } } */ /* { dg-additional-options "-mavx" { target avx_runtime } } */ diff --git a/libgomp/testsuite/libgomp.c/pr58756.c b/libgomp/testsuite/libgomp.c/pr58756.c index d35ea792e8d..34877accd3a 100644 --- a/libgomp/testsuite/libgomp.c/pr58756.c +++ b/libgomp/testsuite/libgomp.c/pr58756.c @@ -1,6 +1,5 @@ /* PR libgomp/58756 */ /* { dg-do run } */ -/* { dg-options "-O2" } */ /* { dg-additional-options "-msse2" { target sse2_runtime } } */ /* { dg-additional-options "-mavx" { target avx_runtime } } */ diff --git a/libgomp/testsuite/libgomp.c/pr64824.c b/libgomp/testsuite/libgomp.c/pr64824.c index 544d0b0fc1f..b39675b9524 100644 --- a/libgomp/testsuite/libgomp.c/pr64824.c +++ b/libgomp/testsuite/libgomp.c/pr64824.c @@ -1,6 +1,5 @@ /* PR c/64824 */ /* { dg-do run } */ -/* { dg-options "-O2 -fopenmp" } */ int main () diff --git a/libgomp/testsuite/libgomp.c/pr64868.c b/libgomp/testsuite/libgomp.c/pr64868.c index acdf9984108..f93caf2091c 100644 --- a/libgomp/testsuite/libgomp.c/pr64868.c +++ b/libgomp/testsuite/libgomp.c/pr64868.c @@ -1,6 +1,5 @@ /* PR c/64868 */ /* { dg-do run } */ -/* { dg-options "-O2 -fopenmp" } */ float f = 2.0f; double d = 4.0; diff --git a/libgomp/testsuite/libgomp.c/pr66133.c b/libgomp/testsuite/libgomp.c/pr66133.c new file mode 100644 index 00000000000..90685cd81b6 --- /dev/null +++ b/libgomp/testsuite/libgomp.c/pr66133.c @@ -0,0 +1,34 @@ +/* PR middle-end/66133 */ +/* { dg-do run } */ + +#include <stdlib.h> +#include <unistd.h> + +volatile int x; + +__attribute__((noinline)) void +foo (void) +{ + if (x == 0) + { + #pragma omp task + { + usleep (2000); + exit (0); + } + } + else + abort (); +} + +int +main () +{ + #pragma omp parallel num_threads (2) + { + #pragma omp barrier + #pragma omp single + foo (); + } + exit (0); +} diff --git a/libgomp/testsuite/libgomp.c/pr66199-1.c b/libgomp/testsuite/libgomp.c/pr66199-1.c new file mode 100644 index 00000000000..20482a4b43d --- /dev/null +++ b/libgomp/testsuite/libgomp.c/pr66199-1.c @@ -0,0 +1,61 @@ +/* PR middle-end/66199 */ +/* { dg-do run } */ + +int u[1024], v[1024], w[1024]; + +__attribute__((noinline, noclone)) long +f1 (long a, long b) +{ + long d; + #pragma omp parallel for simd default(none) firstprivate (a, b) shared(u, v, w) + for (d = a; d < b; d++) + u[d] = v[d] + w[d]; + return d; +} + +__attribute__((noinline, noclone)) long +f2 (long a, long b, long c) +{ + long d, e; + #pragma omp parallel for simd default(none) firstprivate (a, b) shared(u, v, w) linear(d) linear(c:5) lastprivate(e) + for (d = a; d < b; d++) + { + u[d] = v[d] + w[d]; + c += 5; + e = c; + } + return d + c + e; +} + +__attribute__((noinline, noclone)) long +f3 (long a1, long b1, long a2, long b2) +{ + long d1, d2; + #pragma omp parallel for simd default(none) firstprivate (a1, b1, a2, b2) shared(u, v, w) lastprivate(d1, d2) collapse(2) + for (d1 = a1; d1 < b1; d1++) + for (d2 = a2; d2 < b2; d2++) + u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2]; + return d1 + d2; +} + +__attribute__((noinline, noclone)) long +f4 (long a1, long b1, long a2, long b2) +{ + long d1, d2; + #pragma omp parallel for simd default(none) firstprivate (a1, b1, a2, b2) shared(u, v, w) collapse(2) + for (d1 = a1; d1 < b1; d1++) + for (d2 = a2; d2 < b2; d2++) + u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2]; + return d1 + d2; +} + +int +main () +{ + if (f1 (0, 1024) != 1024 + || f2 (0, 1024, 17) != 1024 + 2 * (17 + 5 * 1024) + || f3 (0, 32, 0, 32) != 64 + || f4 (0, 32, 0, 32) != 64) + __builtin_abort (); + return 0; +} diff --git a/libgomp/testsuite/libgomp.c/pr66199-2.c b/libgomp/testsuite/libgomp.c/pr66199-2.c new file mode 100644 index 00000000000..ddb79de8943 --- /dev/null +++ b/libgomp/testsuite/libgomp.c/pr66199-2.c @@ -0,0 +1,58 @@ +/* PR middle-end/66199 */ +/* { dg-do run } */ + +#pragma omp declare target +int u[1024], v[1024], w[1024]; +#pragma omp end declare target + +__attribute__((noinline, noclone)) void +f1 (long a, long b) +{ + long d; + #pragma omp target teams distribute parallel for simd default(none) firstprivate (a, b) shared(u, v, w) + for (d = a; d < b; d++) + u[d] = v[d] + w[d]; +} + +__attribute__((noinline, noclone)) void +f2 (long a, long b, long c) +{ + long d, e; + #pragma omp target teams distribute parallel for simd default(none) firstprivate (a, b) shared(u, v, w) linear(d) linear(c:5) lastprivate(e) + for (d = a; d < b; d++) + { + u[d] = v[d] + w[d]; + c += 5; + e = c; + } +} + +__attribute__((noinline, noclone)) void +f3 (long a1, long b1, long a2, long b2) +{ + long d1, d2; + #pragma omp target teams distribute parallel for simd default(none) firstprivate (a1, b1, a2, b2) shared(u, v, w) lastprivate(d1, d2) collapse(2) + for (d1 = a1; d1 < b1; d1++) + for (d2 = a2; d2 < b2; d2++) + u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2]; +} + +__attribute__((noinline, noclone)) void +f4 (long a1, long b1, long a2, long b2) +{ + long d1, d2; + #pragma omp target teams distribute parallel for simd default(none) firstprivate (a1, b1, a2, b2) shared(u, v, w) collapse(2) + for (d1 = a1; d1 < b1; d1++) + for (d2 = a2; d2 < b2; d2++) + u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2]; +} + +int +main () +{ + f1 (0, 1024); + f2 (0, 1024, 17); + f3 (0, 32, 0, 32); + f4 (0, 32, 0, 32); + return 0; +} diff --git a/libgomp/testsuite/libgomp.c/simd-1.c b/libgomp/testsuite/libgomp.c/simd-1.c index 352b3b7ddd4..68a409786a9 100644 --- a/libgomp/testsuite/libgomp.c/simd-1.c +++ b/libgomp/testsuite/libgomp.c/simd-1.c @@ -1,5 +1,4 @@ /* { dg-do run } */ -/* { dg-options "-O2" } */ /* { dg-additional-options "-msse2" { target sse2_runtime } } */ /* { dg-additional-options "-mavx" { target avx_runtime } } */ diff --git a/libgomp/testsuite/libgomp.c/simd-10.c b/libgomp/testsuite/libgomp.c/simd-10.c index 70cd9f0156d..3352e504e11 100644 --- a/libgomp/testsuite/libgomp.c/simd-10.c +++ b/libgomp/testsuite/libgomp.c/simd-10.c @@ -1,5 +1,4 @@ /* { dg-do run } */ -/* { dg-options "-O2" } */ /* { dg-additional-options "-msse2" { target sse2_runtime } } */ /* { dg-additional-options "-mavx" { target avx_runtime } } */ diff --git a/libgomp/testsuite/libgomp.c/simd-11.c b/libgomp/testsuite/libgomp.c/simd-11.c index b09f0dde8ed..618a8b3ca04 100644 --- a/libgomp/testsuite/libgomp.c/simd-11.c +++ b/libgomp/testsuite/libgomp.c/simd-11.c @@ -1,5 +1,4 @@ /* { dg-do run } */ -/* { dg-options "-O2" } */ /* { dg-additional-options "-msse2" { target sse2_runtime } } */ /* { dg-additional-options "-mavx" { target avx_runtime } } */ diff --git a/libgomp/testsuite/libgomp.c/simd-12.c b/libgomp/testsuite/libgomp.c/simd-12.c index 6685111a06e..8f15daf82ce 100644 --- a/libgomp/testsuite/libgomp.c/simd-12.c +++ b/libgomp/testsuite/libgomp.c/simd-12.c @@ -1,5 +1,4 @@ /* { dg-do run } */ -/* { dg-options "-O2" } */ /* { dg-additional-options "-msse2" { target sse2_runtime } } */ /* { dg-additional-options "-mavx" { target avx_runtime } } */ diff --git a/libgomp/testsuite/libgomp.c/simd-13.c b/libgomp/testsuite/libgomp.c/simd-13.c index 7c817b793db..df35d621835 100644 --- a/libgomp/testsuite/libgomp.c/simd-13.c +++ b/libgomp/testsuite/libgomp.c/simd-13.c @@ -1,5 +1,4 @@ /* { dg-do run } */ -/* { dg-options "-O2" } */ /* { dg-additional-options "-msse2" { target sse2_runtime } } */ /* { dg-additional-options "-mavx" { target avx_runtime } } */ diff --git a/libgomp/testsuite/libgomp.c/simd-14.c b/libgomp/testsuite/libgomp.c/simd-14.c index 50e8d5e9011..28bdc99d11b 100644 --- a/libgomp/testsuite/libgomp.c/simd-14.c +++ b/libgomp/testsuite/libgomp.c/simd-14.c @@ -1,5 +1,4 @@ /* { dg-do run } */ -/* { dg-options "-O2" } */ /* { dg-additional-options "-msse2" { target sse2_runtime } } */ /* { dg-additional-options "-mavx" { target avx_runtime } } */ diff --git a/libgomp/testsuite/libgomp.c/simd-15.c b/libgomp/testsuite/libgomp.c/simd-15.c index e474b81fa44..e75538d06e5 100644 --- a/libgomp/testsuite/libgomp.c/simd-15.c +++ b/libgomp/testsuite/libgomp.c/simd-15.c @@ -1,5 +1,4 @@ /* { dg-do run } */ -/* { dg-options "-O2" } */ /* { dg-additional-options "-msse2" { target sse2_runtime } } */ /* { dg-additional-options "-mavx" { target avx_runtime } } */ diff --git a/libgomp/testsuite/libgomp.c/simd-16.c b/libgomp/testsuite/libgomp.c/simd-16.c index c8c29c744d7..e1998e32733 100644 --- a/libgomp/testsuite/libgomp.c/simd-16.c +++ b/libgomp/testsuite/libgomp.c/simd-16.c @@ -1,7 +1,7 @@ /* { dg-do run } */ -/* { dg-options "-O2 -std=c99" } */ /* { dg-additional-options "-msse2" { target sse2_runtime } } */ /* { dg-additional-options "-mavx" { target avx_runtime } } */ +/* { dg-additional-options "-std=c99" } */ int main () diff --git a/libgomp/testsuite/libgomp.c/simd-17.c b/libgomp/testsuite/libgomp.c/simd-17.c index 136e6e64ade..b884340e419 100644 --- a/libgomp/testsuite/libgomp.c/simd-17.c +++ b/libgomp/testsuite/libgomp.c/simd-17.c @@ -1,7 +1,7 @@ /* { dg-do run } */ -/* { dg-options "-O2 -std=c99" } */ /* { dg-additional-options "-msse2" { target sse2_runtime } } */ /* { dg-additional-options "-mavx" { target avx_runtime } } */ +/* { dg-additional-options "-std=c99" } */ static inline void foo (int *b, int *i, int *j, int x) diff --git a/libgomp/testsuite/libgomp.c/simd-2.c b/libgomp/testsuite/libgomp.c/simd-2.c index b485fcb6f6f..0e3f17bae0b 100644 --- a/libgomp/testsuite/libgomp.c/simd-2.c +++ b/libgomp/testsuite/libgomp.c/simd-2.c @@ -1,5 +1,4 @@ /* { dg-do run } */ -/* { dg-options "-O2" } */ /* { dg-additional-options "-msse2" { target sse2_runtime } } */ /* { dg-additional-options "-mavx" { target avx_runtime } } */ diff --git a/libgomp/testsuite/libgomp.c/simd-3.c b/libgomp/testsuite/libgomp.c/simd-3.c index 34a38830143..7140f89ce70 100644 --- a/libgomp/testsuite/libgomp.c/simd-3.c +++ b/libgomp/testsuite/libgomp.c/simd-3.c @@ -1,5 +1,4 @@ /* { dg-do run } */ -/* { dg-options "-O2" } */ /* { dg-additional-options "-msse2" { target sse2_runtime } } */ /* { dg-additional-options "-mavx" { target avx_runtime } } */ diff --git a/libgomp/testsuite/libgomp.c/simd-4.c b/libgomp/testsuite/libgomp.c/simd-4.c index fd87c7e1fa7..7850cb7f371 100644 --- a/libgomp/testsuite/libgomp.c/simd-4.c +++ b/libgomp/testsuite/libgomp.c/simd-4.c @@ -1,5 +1,4 @@ /* { dg-do run } */ -/* { dg-options "-O2" } */ /* { dg-additional-options "-msse2" { target sse2_runtime } } */ /* { dg-additional-options "-mavx" { target avx_runtime } } */ diff --git a/libgomp/testsuite/libgomp.c/simd-5.c b/libgomp/testsuite/libgomp.c/simd-5.c index 0b6d41e6356..1205da3b93c 100644 --- a/libgomp/testsuite/libgomp.c/simd-5.c +++ b/libgomp/testsuite/libgomp.c/simd-5.c @@ -1,5 +1,4 @@ /* { dg-do run } */ -/* { dg-options "-O2" } */ /* { dg-additional-options "-msse2" { target sse2_runtime } } */ /* { dg-additional-options "-mavx" { target avx_runtime } } */ diff --git a/libgomp/testsuite/libgomp.c/simd-6.c b/libgomp/testsuite/libgomp.c/simd-6.c index 896f34784f2..6daa33ee312 100644 --- a/libgomp/testsuite/libgomp.c/simd-6.c +++ b/libgomp/testsuite/libgomp.c/simd-6.c @@ -1,6 +1,5 @@ /* PR libgomp/58482 */ /* { dg-do run } */ -/* { dg-options "-O2" } */ /* { dg-additional-options "-msse2" { target sse2_runtime } } */ /* { dg-additional-options "-mavx" { target avx_runtime } } */ diff --git a/libgomp/testsuite/libgomp.c/simd-7.c b/libgomp/testsuite/libgomp.c/simd-7.c index ab04fee82d7..8239af950e8 100644 --- a/libgomp/testsuite/libgomp.c/simd-7.c +++ b/libgomp/testsuite/libgomp.c/simd-7.c @@ -1,5 +1,4 @@ /* { dg-do run } */ -/* { dg-options "-O2" } */ /* { dg-additional-options "-msse2" { target sse2_runtime } } */ /* { dg-additional-options "-mavx" { target avx_runtime } } */ diff --git a/libgomp/testsuite/libgomp.c/simd-8.c b/libgomp/testsuite/libgomp.c/simd-8.c index 13f40d58362..dab3805f5a4 100644 --- a/libgomp/testsuite/libgomp.c/simd-8.c +++ b/libgomp/testsuite/libgomp.c/simd-8.c @@ -1,5 +1,4 @@ /* { dg-do run } */ -/* { dg-options "-O2" } */ /* { dg-additional-options "-msse2" { target sse2_runtime } } */ /* { dg-additional-options "-mavx" { target avx_runtime } } */ diff --git a/libgomp/testsuite/libgomp.c/simd-9.c b/libgomp/testsuite/libgomp.c/simd-9.c index b64dd252229..a7c48cbc308 100644 --- a/libgomp/testsuite/libgomp.c/simd-9.c +++ b/libgomp/testsuite/libgomp.c/simd-9.c @@ -1,5 +1,4 @@ /* { dg-do run } */ -/* { dg-options "-O2" } */ /* { dg-additional-options "-msse2" { target sse2_runtime } } */ /* { dg-additional-options "-mavx" { target avx_runtime } } */ diff --git a/libgomp/testsuite/libgomp.c/target-8.c b/libgomp/testsuite/libgomp.c/target-8.c index 35084575324..5fe0db95795 100644 --- a/libgomp/testsuite/libgomp.c/target-8.c +++ b/libgomp/testsuite/libgomp.c/target-8.c @@ -1,5 +1,4 @@ /* { dg-do run } */ -/* { dg-options "-fopenmp" } */ void foo (int *p) diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/e.56.3.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/array_sections-3.f90 index 94da51e4fc3..94da51e4fc3 100644 --- a/libgomp/testsuite/libgomp.fortran/examples-4/e.56.3.f90 +++ b/libgomp/testsuite/libgomp.fortran/examples-4/array_sections-3.f90 diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/e.56.4.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/array_sections-4.f90 index 6eb9bc1e5c3..6eb9bc1e5c3 100644 --- a/libgomp/testsuite/libgomp.fortran/examples-4/e.56.4.f90 +++ b/libgomp/testsuite/libgomp.fortran/examples-4/array_sections-4.f90 diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/e.55.1.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/async_target-1.f90 index c3849de335a..c3849de335a 100644 --- a/libgomp/testsuite/libgomp.fortran/examples-4/e.55.1.f90 +++ b/libgomp/testsuite/libgomp.fortran/examples-4/async_target-1.f90 diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/e.55.2.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/async_target-2.f90 index dfcb5f40ca9..b12b0eaa890 100644 --- a/libgomp/testsuite/libgomp.fortran/examples-4/e.55.2.f90 +++ b/libgomp/testsuite/libgomp.fortran/examples-4/async_target-2.f90 @@ -46,6 +46,8 @@ subroutine vec_mult (p, N) !$omp end target !$omp end task !$omp end target data + + !$omp taskwait call check (p, N) end subroutine diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/e.53.1.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/declare_target-1.f90 index a1885afa1b5..a1885afa1b5 100644 --- a/libgomp/testsuite/libgomp.fortran/examples-4/e.53.1.f90 +++ b/libgomp/testsuite/libgomp.fortran/examples-4/declare_target-1.f90 diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/e.53.2.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/declare_target-2.f90 index 5bc900cac80..5bc900cac80 100644 --- a/libgomp/testsuite/libgomp.fortran/examples-4/e.53.2.f90 +++ b/libgomp/testsuite/libgomp.fortran/examples-4/declare_target-2.f90 diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/e.53.3.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/declare_target-3.f90 index fffbb7ff17b..fffbb7ff17b 100644 --- a/libgomp/testsuite/libgomp.fortran/examples-4/e.53.3.f90 +++ b/libgomp/testsuite/libgomp.fortran/examples-4/declare_target-3.f90 diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/e.53.4.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/declare_target-4.f90 index 41d251aae37..41d251aae37 100644 --- a/libgomp/testsuite/libgomp.fortran/examples-4/e.53.4.f90 +++ b/libgomp/testsuite/libgomp.fortran/examples-4/declare_target-4.f90 diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/e.53.5.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/declare_target-5.f90 index 06eae0a6992..06eae0a6992 100644 --- a/libgomp/testsuite/libgomp.fortran/examples-4/e.53.5.f90 +++ b/libgomp/testsuite/libgomp.fortran/examples-4/declare_target-5.f90 diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/e.57.1.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/device-1.f90 index 291604bee7a..291604bee7a 100644 --- a/libgomp/testsuite/libgomp.fortran/examples-4/e.57.1.f90 +++ b/libgomp/testsuite/libgomp.fortran/examples-4/device-1.f90 diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/e.57.2.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/device-2.f90 index 4a304b5c799..4a304b5c799 100644 --- a/libgomp/testsuite/libgomp.fortran/examples-4/e.57.2.f90 +++ b/libgomp/testsuite/libgomp.fortran/examples-4/device-2.f90 diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/e.57.3.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/device-3.f90 index a29f1b59a26..a29f1b59a26 100644 --- a/libgomp/testsuite/libgomp.fortran/examples-4/e.57.3.f90 +++ b/libgomp/testsuite/libgomp.fortran/examples-4/device-3.f90 diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/simd-1.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/simd-1.f90 new file mode 100644 index 00000000000..b1af859dee4 --- /dev/null +++ b/libgomp/testsuite/libgomp.fortran/examples-4/simd-1.f90 @@ -0,0 +1,67 @@ +! { dg-do run } +! { dg-additional-options "-msse2" { target sse2_runtime } } +! { dg-additional-options "-mavx" { target avx_runtime } } + +module SIMD1_mod +contains + subroutine init (a, a_ref, b, c, n, ioff_ptr) + double precision :: a(*), a_ref(*), b(*), c(*) + integer :: n, i, s + integer, pointer :: ioff_ptr + + s = -1 + do i = 1, n + a(i) = i * i * s + a_ref(i) = a(i) + b(i) = i + i + end do + + do i = 1, n+ioff_ptr + c(i) = i * 3 + end do + + end subroutine + + subroutine check (a, b, n) + integer :: i, n + double precision, parameter :: EPS = 0.0000000000001 + double precision :: diff, a(*), b(*) + do i = 1, n + diff = a(i) - b(i) + if (diff > EPS .or. -diff > EPS) call abort + end do + end subroutine + + subroutine star(a, a_ref, b, c, n, ioff_ptr) + double precision :: a(*), a_ref(*), b(*), c(*) + integer :: n, i + integer, pointer :: ioff_ptr + + call init (a, a_ref, b, c, n, ioff_ptr) + + !$omp simd + do i = 1,n + a(i) = a(i) * b(i) * c(i+ioff_ptr) + end do + + do i = 1,n + a_ref(i) = a_ref(i) * b(i) * c(i+ioff_ptr) + end do + + call check (a, a_ref, n) + + end subroutine +end module + +program SIMD1 + use SIMD1_mod, only : star + double precision :: a(128), a_ref(128), b(128), c(144) + integer, pointer:: ioff_ptr + integer, target:: offset + + offset = 16 + ioff_ptr => offset + + call star (a, a_ref, b, c, 128, ioff_ptr) + +end program diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/simd-2.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/simd-2.f90 new file mode 100644 index 00000000000..74a0303fd79 --- /dev/null +++ b/libgomp/testsuite/libgomp.fortran/examples-4/simd-2.f90 @@ -0,0 +1,72 @@ +! { dg-do run { target vect_simd_clones } } +! { dg-additional-options "-msse2" { target sse2_runtime } } +! { dg-additional-options "-mavx" { target avx_runtime } } + +module SIMD2_mod +contains + function add1(a,b,fact) result(c) + !$omp declare simd(add1) uniform(fact) + double precision :: a,b,fact, c + c = a + b + fact + end function + + function add2(a,b,i, fact) result(c) + !$omp declare simd(add2) uniform(a,b,fact) linear(i:1) + integer, value :: i + double precision, dimension(:) :: a, b + double precision :: fact, c + c = a(i) + b(i) + fact + end function + + subroutine work(a, b, n ) + implicit none + double precision :: a(n),b(n), tmp + integer :: n, i + + !$omp simd private(tmp) + do i = 1,n + tmp = add1(a(i), b(i), 1.0d0) + a(i) = add2(a, b, i, 1.0d0) + tmp + a(i) = a(i) + b(i) + 1.0d0 + end do + end subroutine + + subroutine work_ref(a, b, n ) + implicit none + double precision :: a(n),b(n), tmp + integer :: n, i + + do i = 1,n + tmp = add1(a(i), b(i), 1.0d0) + a(i) = add2(a, b, i, 1.0d0) + tmp + a(i) = a(i) + b(i) + 1.0d0 + end do + end subroutine + + subroutine check (a, b, n) + integer :: i, n + double precision, parameter :: EPS = 0.0000000000001 + double precision :: diff, a(*), b(*) + do i = 1, n + diff = a(i) - b(i) + if (diff > EPS .or. -diff > EPS) call abort + end do + end subroutine +end module + +program main + use SIMD2_mod + integer, parameter :: N=32 + integer :: i + double precision :: a(N), b(N), a_ref(N) + do i = 1,N + a(i) = i-1 + a_ref(i) = a(i) + b(i) = N-(i-1) + end do + + call work(a, b, N ) + call work_ref(a_ref, b, N ) + + call check(a, a_ref, N ) +end program diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/simd-3.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/simd-3.f90 new file mode 100644 index 00000000000..2c02945de87 --- /dev/null +++ b/libgomp/testsuite/libgomp.fortran/examples-4/simd-3.f90 @@ -0,0 +1,62 @@ +! { dg-do run } +! { dg-additional-options "-msse2" { target sse2_runtime } } +! { dg-additional-options "-mavx" { target avx_runtime } } + +module SIMD3_mod +contains + subroutine work( a, b, n, sum ) + implicit none + integer :: i, n + double precision :: a(n), b(n), sum, tmp + + sum = 0.0d0 + call init(a, b, n) + !$omp simd private(tmp) reduction(+:sum) + do i = 1,n + tmp = a(i) + b(i) + sum = sum + tmp + end do + + end subroutine work + + subroutine work_ref( a, b, n, sum ) + implicit none + integer :: i, n + double precision :: a(n), b(n), sum, tmp + + sum = 0.0d0 + call init(a, b, n) + do i = 1,n + tmp = a(i) + b(i) + sum = sum + tmp + end do + + end subroutine work_ref + + subroutine init (a, b, n) + double precision :: a(*), b(*) + integer :: n, i, s + + s = -1 + do i = 1, n + a(i) = i * i * s + b(i) = i + i + s = -s + end do + + end subroutine +end module + +program SIMD3 + use SIMD3_mod + double precision :: a(128), b(128), sum, sum_ref, diff + double precision, parameter :: EPS = 0.0000000000000001 + + call work(a, b, 128, sum) + call work_ref(a, b, 128, sum_ref) + + diff = sum - sum_ref + + if (diff > EPS .or. -diff > EPS) call abort + +end program diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/simd-4.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/simd-4.f90 new file mode 100644 index 00000000000..414f8bc70a8 --- /dev/null +++ b/libgomp/testsuite/libgomp.fortran/examples-4/simd-4.f90 @@ -0,0 +1,64 @@ +! { dg-do run } +! { dg-additional-options "-msse2" { target sse2_runtime } } +! { dg-additional-options "-mavx" { target avx_runtime } } + +module SIMD4_mod +contains + subroutine work( b, n, m ) + implicit none + real :: b(n) + integer :: i,n,m + + call init(b, n) + + !$omp simd safelen(16) + do i = m+1, n + b(i) = b(i-m) - 1.0 + end do + end subroutine work + + subroutine work_ref( b, n, m ) + implicit none + real :: b(n) + integer :: i,n,m + + call init(b, n) + + do i = m+1, n + b(i) = b(i-m) - 1.0 + end do + end subroutine work_ref + + subroutine init (b, n) + real :: b(*) + integer :: n, i, s + + s = -1 + do i = 1, n + b(i) = i * i * s + s = -s + end do + + end subroutine + + subroutine check (a, b, n) + integer :: i, n + real, parameter :: EPS = 0.000001 + real :: diff, a(*), b(*) + do i = 1, n + diff = a(i) - b(i) + if (diff > EPS .or. -diff > EPS) call abort + end do + end subroutine + +end module + +program SIMD4 + use SIMD4_mod + real :: b(128), b_ref(128) + + call work(b, 128, 32) + call work_ref(b_ref, 128, 32) + + call check(b, b_ref, 128) +end program diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/simd-5.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/simd-5.f90 new file mode 100644 index 00000000000..e64e1d53e21 --- /dev/null +++ b/libgomp/testsuite/libgomp.fortran/examples-4/simd-5.f90 @@ -0,0 +1,76 @@ +! { dg-do run } +! { dg-additional-options "-msse2" { target sse2_runtime } } +! { dg-additional-options "-mavx" { target avx_runtime } } + +module SIMD5_mod +contains + subroutine work( a, b, c, n ) + implicit none + integer :: i,j,n + double precision :: a(n,n), b(n,n), c(n,n), tmp + + !$omp do simd collapse(2) private(tmp) + do j = 1,n + do i = 1,n + tmp = a(i,j) + b(i,j) + c(i,j) = tmp + end do + end do + + end subroutine work + + subroutine work_ref( a, b, c, n ) + implicit none + integer :: i,j,n + double precision :: a(n,n), b(n,n), c(n,n), tmp + + do j = 1,n + do i = 1,n + tmp = a(i,j) + b(i,j) + c(i,j) = tmp + end do + end do + + end subroutine work_ref + + subroutine init (a, b, n) + integer :: i,j,n,s + double precision :: a(n,n), b(n,n) + + s = -1 + + do j = 1,n + do i = 1,n + a(i,j) = i*j*s + b(i,j) = i+j + s = -s + end do + end do + + end subroutine + + subroutine check (a, b, n) + integer :: i, j, n + double precision, parameter :: EPS = 0.0000000000000001 + double precision :: diff, a(n,n), b(n,n) + do j = 1, n + do i = 1, n + diff = a(i,j) - b(i,j) + if (diff > EPS .or. -diff > EPS) call abort + end do + end do + end subroutine + +end module + +program SIMD5 + use SIMD5_mod + double precision, dimension(32, 32) :: a, b, c, c_ref + + call init(a, b, 32) + + call work(a, b, c, 32) + call work_ref(a, b, c_ref, 32) + + call check(c, c_ref, 32) +end program diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/simd-6.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/simd-6.f90 new file mode 100644 index 00000000000..5cb1e047cbd --- /dev/null +++ b/libgomp/testsuite/libgomp.fortran/examples-4/simd-6.f90 @@ -0,0 +1,151 @@ +! { dg-do run { target vect_simd_clones } } +! { dg-additional-options "-msse2" { target sse2_runtime } } +! { dg-additional-options "-mavx" { target avx_runtime } } + +module SIMD6_mod +contains + function foo(p) result(r) + !$omp declare simd(foo) notinbranch + integer :: p, r + p = p + 10 + r = p + end function foo + + function myaddint(a, b, n) result(r) + implicit none + integer :: a(*), b(*), n, r + integer :: i + + !$omp simd + do i=1, n + a(i) = foo(b(i)) ! foo is not called under a condition + end do + r = a(n) + + end function myaddint + + function myaddint_ref(a, b, n) result(r) + implicit none + integer :: a(*), b(*), n, r + integer :: i + + do i=1, n + a(i) = foo(b(i)) + end do + r = a(n) + + end function myaddint_ref + + function goo(p) result(r) + !$omp declare simd(goo) inbranch + real :: p, r + p = p + 18.5 + r = p + end function goo + + function myaddfloat(x, y, n) result(r) + implicit none + real :: x(*), y(*), r + integer :: n + integer :: i + + !$omp simd + do i=1, n + if (x(i) > y(i)) then + x(i) = goo(y(i)) + ! goo is called under the condition (or within a branch) + else + x(i) = y(i) + endif + end do + + r = x(n) + end function myaddfloat + + function myaddfloat_ref(x, y, n) result(r) + implicit none + real :: x(*), y(*), r + integer :: n + integer :: i + + do i=1, n + if (x(i) > y(i)) then + x(i) = goo(y(i)) + else + x(i) = y(i) + endif + end do + + r = x(n) + end function myaddfloat_ref + + subroutine init (b, y, n) + integer :: b(128) + real :: y(128) + + s = -1 + do i = 1, n + b(i) = i*i*s + y(i) = i*i*s + s = -s + end do + + end subroutine + + subroutine init2 (b, y, n) + integer :: b(128) + real :: y(128) + + do i = 1, n + b(i) = i + y(i) = i + end do + + end subroutine + + subroutine checkfloat (a, b, n) + integer :: i, n + real, parameter :: EPS = 0.000001 + real :: diff, a(*), b(*) + do i = 1, n + diff = a(i) - b(i) + if (diff > EPS .or. -diff > EPS) call abort + end do + end subroutine + + subroutine checkint (a, b, n) + integer :: i, n, a(*), b(*) + do i = 1, n + if (a(i) .ne. b(i)) call abort + end do + end subroutine + + subroutine test () + integer :: a(128), a_ref(128), b(128), ri, ri_ref + real :: x(128), x_ref(128), y(128), rf, rf_ref + + call init2(a, x, 128) + call init2(a_ref, x_ref, 128) + + call init(b, y, 128) + + ri = myaddint (a, b, 128) + rf = myaddfloat (x, y, 128) + + call init(b, y, 128) + + ri_ref = myaddint_ref (a_ref, b, 128) + rf_ref = myaddfloat_ref (x_ref, y, 128) + + call checkint (a, a_ref, 128) + call checkfloat (x, x_ref, 128) + end subroutine + +end module + +program SIMD6 + use SIMD6_mod, only: test + + call test () + +end program diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/simd-7.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/simd-7.f90 new file mode 100644 index 00000000000..75606570503 --- /dev/null +++ b/libgomp/testsuite/libgomp.fortran/examples-4/simd-7.f90 @@ -0,0 +1,53 @@ +! { dg-do run { target vect_simd_clones } } +! { dg-additional-options "-msse2" { target sse2_runtime } } +! { dg-additional-options "-mavx" { target avx_runtime } } + +program fibonacci + implicit none + integer,parameter :: N=30 + integer :: a(0:N-1), b(0:N-1) + integer :: a_ref(0:N-1) + integer :: i + integer, external :: fib + + !$omp simd + do i = 0,N-1 + b(i) = i + end do + + !$omp simd + do i=0,N-1 + a(i) = fib(b(i)) + end do + + call fib_ref (a_ref, N) + + do i = 0, N-1 + if (a(i) .ne. a_ref(i)) call abort () + end do + +end program + +recursive function fib(n) result(r) +!$omp declare simd(fib) inbranch + integer :: n, r + + if (n <= 1) then + r = n + else + r = fib(n-1) + fib(n-2) + endif + +end function fib + +subroutine fib_ref(a_ref, n) + integer :: n, a_ref(0:n-1) + + a_ref(0) = 0 + a_ref(1) = 1 + + do i = 2, n-1 + a_ref(i) = a_ref(i-1) + a_ref(i-2) + end do + +end subroutine fib_ref diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/simd-8.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/simd-8.f90 new file mode 100644 index 00000000000..3c7869d602e --- /dev/null +++ b/libgomp/testsuite/libgomp.fortran/examples-4/simd-8.f90 @@ -0,0 +1,52 @@ +! { dg-do run } +! { dg-additional-options "-msse2" { target sse2_runtime } } +! { dg-additional-options "-mavx" { target avx_runtime } } + +module work + +integer :: P(1000) +real :: A(1000) + +contains +function do_work(arr) result(pri) + implicit none + real, dimension(*) :: arr + + real :: pri + integer :: i, j + + !$omp simd private(j) lastprivate(pri) + do i = 1, 999 + j = P(i) + + pri = 0.5 + if (mod(j-1, 2) == 0) then + pri = A(j+1) + arr(i) + endif + A(j) = pri * 1.5 + pri = pri + A(j) + end do + +end function do_work + +end module work + +program simd_8f + use work + implicit none + real :: pri, arr(1000), diff + integer :: i + real, parameter :: EPS = 0.005 + + do i = 1, 1000 + P(i) = i + A(i) = (i-1) * 1.5 + arr(i) = (i-1) * 1.8 + end do + pri = do_work(arr) + + diff = pri - 8237.25 + + if (diff > EPS .or. -diff > EPS) call abort + +end program diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/e.50.1.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/target-1.f90 index 76e9068e30f..76e9068e30f 100644 --- a/libgomp/testsuite/libgomp.fortran/examples-4/e.50.1.f90 +++ b/libgomp/testsuite/libgomp.fortran/examples-4/target-1.f90 diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/e.50.2.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/target-2.f90 index af469f4d687..af469f4d687 100644 --- a/libgomp/testsuite/libgomp.fortran/examples-4/e.50.2.f90 +++ b/libgomp/testsuite/libgomp.fortran/examples-4/target-2.f90 diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/e.50.3.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/target-3.f90 index 975470411cb..975470411cb 100644 --- a/libgomp/testsuite/libgomp.fortran/examples-4/e.50.3.f90 +++ b/libgomp/testsuite/libgomp.fortran/examples-4/target-3.f90 diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/e.50.4.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/target-4.f90 index f94794e16aa..f94794e16aa 100644 --- a/libgomp/testsuite/libgomp.fortran/examples-4/e.50.4.f90 +++ b/libgomp/testsuite/libgomp.fortran/examples-4/target-4.f90 diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/e.50.5.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/target-5.f90 index 3f454d7d55e..3f454d7d55e 100644 --- a/libgomp/testsuite/libgomp.fortran/examples-4/e.50.5.f90 +++ b/libgomp/testsuite/libgomp.fortran/examples-4/target-5.f90 diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/e.51.1.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/target_data-1.f90 index 98e5c0b8f77..98e5c0b8f77 100644 --- a/libgomp/testsuite/libgomp.fortran/examples-4/e.51.1.f90 +++ b/libgomp/testsuite/libgomp.fortran/examples-4/target_data-1.f90 diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/e.51.2.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/target_data-2.f90 index 360cdeda7e1..360cdeda7e1 100644 --- a/libgomp/testsuite/libgomp.fortran/examples-4/e.51.2.f90 +++ b/libgomp/testsuite/libgomp.fortran/examples-4/target_data-2.f90 diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/e.51.3.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/target_data-3.f90 index a3d9c188f93..a3d9c188f93 100644 --- a/libgomp/testsuite/libgomp.fortran/examples-4/e.51.3.f90 +++ b/libgomp/testsuite/libgomp.fortran/examples-4/target_data-3.f90 diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/e.51.4.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/target_data-4.f90 index e9de6ae0015..e9de6ae0015 100644 --- a/libgomp/testsuite/libgomp.fortran/examples-4/e.51.4.f90 +++ b/libgomp/testsuite/libgomp.fortran/examples-4/target_data-4.f90 diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/e.51.5.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/target_data-5.f90 index 01a41adb0f4..01a41adb0f4 100644 --- a/libgomp/testsuite/libgomp.fortran/examples-4/e.51.5.f90 +++ b/libgomp/testsuite/libgomp.fortran/examples-4/target_data-5.f90 diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/e.51.6.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/target_data-6.f90 index 258da21e8f4..258da21e8f4 100644 --- a/libgomp/testsuite/libgomp.fortran/examples-4/e.51.6.f90 +++ b/libgomp/testsuite/libgomp.fortran/examples-4/target_data-6.f90 diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/e.51.7.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/target_data-7.f90 index 2ddac9e4665..2ddac9e4665 100644 --- a/libgomp/testsuite/libgomp.fortran/examples-4/e.51.7.f90 +++ b/libgomp/testsuite/libgomp.fortran/examples-4/target_data-7.f90 diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/e.52.1.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/target_update-1.f90 index e23c0bb7bca..e23c0bb7bca 100644 --- a/libgomp/testsuite/libgomp.fortran/examples-4/e.52.1.f90 +++ b/libgomp/testsuite/libgomp.fortran/examples-4/target_update-1.f90 diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/e.52.2.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/target_update-2.f90 index 3735e5342e4..3735e5342e4 100644 --- a/libgomp/testsuite/libgomp.fortran/examples-4/e.52.2.f90 +++ b/libgomp/testsuite/libgomp.fortran/examples-4/target_update-2.f90 diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/task_dep-1.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/task_dep-1.f90 new file mode 100644 index 00000000000..78201ea860e --- /dev/null +++ b/libgomp/testsuite/libgomp.fortran/examples-4/task_dep-1.f90 @@ -0,0 +1,16 @@ +! { dg-do run } + +program example + integer :: x + x = 1 + !$omp parallel + !$omp single + !$omp task shared(x) depend(out: x) + x = 2 + !$omp end task + !$omp task shared(x) depend(in: x) + if (x .ne. 2) call abort () + !$omp end task + !$omp end single + !$omp end parallel +end program diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/task_dep-2.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/task_dep-2.f90 new file mode 100644 index 00000000000..5afd76dbf43 --- /dev/null +++ b/libgomp/testsuite/libgomp.fortran/examples-4/task_dep-2.f90 @@ -0,0 +1,16 @@ +! { dg-do run } + +program example + integer :: x + x = 1 + !$omp parallel + !$omp single + !$omp task shared(x) depend(in: x) + if (x .ne. 1) call abort () + !$omp end task + !$omp task shared(x) depend(out: x) + x = 2 + !$omp end task + !$omp end single + !$omp end parallel +end program diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/task_dep-3.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/task_dep-3.f90 new file mode 100644 index 00000000000..c8d58205858 --- /dev/null +++ b/libgomp/testsuite/libgomp.fortran/examples-4/task_dep-3.f90 @@ -0,0 +1,18 @@ +! { dg-do run } + +program example + integer :: x + x = 0 + !$omp parallel + !$omp single + !$omp task shared(x) depend(out: x) + x = 1 + !$omp end task + !$omp task shared(x) depend(out: x) + x = 2 + !$omp end task + !$omp taskwait + if ((x .ne. 1) .and. (x .ne. 2)) call abort() + !$omp end single + !$omp end parallel +end program diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/task_dep-4.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/task_dep-4.f90 new file mode 100644 index 00000000000..7fe24c347df --- /dev/null +++ b/libgomp/testsuite/libgomp.fortran/examples-4/task_dep-4.f90 @@ -0,0 +1,19 @@ +! { dg-do run } + +program example + integer :: x + x = 1 + !$omp parallel + !$omp single + !$omp task shared(x) depend(out: x) + x = 2 + !$omp end task + !$omp task shared(x) depend(in: x) + if (x .ne. 2) call abort () + !$omp end task + !$omp task shared(x) depend(in: x) + if (x .ne. 2) call abort () + !$omp end task + !$omp end single + !$omp end parallel +end program diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/task_dep-5.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/task_dep-5.f90 new file mode 100644 index 00000000000..0746531728e --- /dev/null +++ b/libgomp/testsuite/libgomp.fortran/examples-4/task_dep-5.f90 @@ -0,0 +1,100 @@ +! { dg-do run } + +module task_dep5_mod +contains + subroutine matmul_depend (N, BS, A, B, C) + implicit none + integer :: N, BS, BM + real, dimension(N, N) :: A, B, C + integer :: i, j, k, ii, jj, kk + BM = BS - 1 + do i = 1, N, BS + do j = 1, N, BS + do k = 1, N, BS + !$omp task shared(A,B,C) private(ii,jj,kk) & ! I,J,K are firstprivate by default + !$omp depend ( in: A(i:i+BM, k:k+BM), B(k:k+BM, j:j+BM) ) & + !$omp depend ( inout: C(i:i+BM, j:j+BM) ) + do ii = i, i+BM + do jj = j, j+BM + do kk = k, k+BM + C(jj,ii) = C(jj,ii) + A(kk,ii) * B(jj,kk) + end do + end do + end do + !$omp end task + end do + end do + end do + end subroutine + + subroutine matmul_ref (N, A, B, C) + implicit none + integer :: N + real, dimension(N, N) :: A, B, C + integer :: i, j, k + do i = 1, N + do j = 1, N + do k = 1, N + C(j,i) = C(j,i) + A(k,i) * B(j,k) + end do + end do + end do + end subroutine + + subroutine check (N, A, B) + integer :: N + integer :: i, j + real, parameter :: EPS = 0.000001 + real, dimension(N,N) :: A, B + real :: diff + do i = 1, N + do j = 1, N + diff = A(i, j) - B(i, j) + if (diff > EPS .or. -diff > EPS) then + call abort () + end if + end do + end do + end subroutine + + subroutine init (N, A, B) + integer :: N + integer :: i, j, s + real, dimension(N,N) :: A, B + s = -1 + do i = 1, N + do j = 1, N + A(i, j) = i*j*s + B(i, j) = i+j + s = -s + end do + end do + end subroutine + + subroutine zero_init (N, A, B) + integer :: N + integer :: i, j + real, dimension(N,N) :: A, B + do i = 1, N + do j = 1, N + A(i, j) = 0 + B(i, j) = 0 + end do + end do + end subroutine + +end module + +program main + use task_dep5_mod + real, dimension(32, 32) :: A, B, C, C_ref + + call init (32, A, B) + call zero_init (32, C, C_ref) + + call matmul_depend(32, 4, A, B, C) + call matmul_ref(32, A, B, C_ref) + + call check (32, C, C_ref) + +end program diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/e.54.2.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/teams-2.f90 index 6a830184ded..6a830184ded 100644 --- a/libgomp/testsuite/libgomp.fortran/examples-4/e.54.2.f90 +++ b/libgomp/testsuite/libgomp.fortran/examples-4/teams-2.f90 diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/e.54.3.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/teams-3.f90 index 2588d8bb684..2588d8bb684 100644 --- a/libgomp/testsuite/libgomp.fortran/examples-4/e.54.3.f90 +++ b/libgomp/testsuite/libgomp.fortran/examples-4/teams-3.f90 diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/e.54.4.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/teams-4.f90 index efae3c3cc20..efae3c3cc20 100644 --- a/libgomp/testsuite/libgomp.fortran/examples-4/e.54.4.f90 +++ b/libgomp/testsuite/libgomp.fortran/examples-4/teams-4.f90 diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/e.54.5.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/teams-5.f90 index 9608d9a2c4e..9608d9a2c4e 100644 --- a/libgomp/testsuite/libgomp.fortran/examples-4/e.54.5.f90 +++ b/libgomp/testsuite/libgomp.fortran/examples-4/teams-5.f90 diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/e.54.6.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/teams-6.f90 index f79118816f2..f79118816f2 100644 --- a/libgomp/testsuite/libgomp.fortran/examples-4/e.54.6.f90 +++ b/libgomp/testsuite/libgomp.fortran/examples-4/teams-6.f90 diff --git a/libgomp/testsuite/libgomp.fortran/parloops-exit-first-loop-alt-2.f95 b/libgomp/testsuite/libgomp.fortran/parloops-exit-first-loop-alt-2.f95 new file mode 100644 index 00000000000..56add651026 --- /dev/null +++ b/libgomp/testsuite/libgomp.fortran/parloops-exit-first-loop-alt-2.f95 @@ -0,0 +1,40 @@ +! { dg-do run } +! { dg-additional-options "-O2" } +! { dg-additional-options "-ftree-parallelize-loops=2" } + +! Constant bound, vector addition. + +subroutine foo () + integer, parameter :: n = 1000 + integer, dimension (0:n-1) :: a, b, c + common a, b, c + integer :: ii + + do ii = 0, n - 1 + c(ii) = a(ii) + b(ii) + end do +end subroutine foo + +program main + integer, parameter :: n = 1000 + integer, parameter :: distrib = 10 + integer, dimension (0:n-1) :: a, b, c + common a, b, c + integer :: i, j, k + + do j = 0, ((n / distrib) -1) + do i = 0, distrib - 1 + k = i + (distrib * j) + a(k) = k + b(k) = MODULO ((k * 3), 7) + c(k) = k * 2; + end do + end do + + call foo () + + do i = 0, n - 1 + if (c(i) .ne. (i + MODULO ((i * 3), 7))) call abort + end do + +end program diff --git a/libgomp/testsuite/libgomp.fortran/parloops-exit-first-loop-alt.f95 b/libgomp/testsuite/libgomp.fortran/parloops-exit-first-loop-alt.f95 new file mode 100644 index 00000000000..72b3c8d6477 --- /dev/null +++ b/libgomp/testsuite/libgomp.fortran/parloops-exit-first-loop-alt.f95 @@ -0,0 +1,41 @@ +! { dg-do run } +! { dg-additional-options "-O2" } +! { dg-additional-options "-ftree-parallelize-loops=2" } + +! Variable bound, vector addition. + +subroutine foo (nr) + integer, intent(in) :: nr + integer, parameter :: n = 1000 + integer, dimension (0:n-1) :: a, b, c + common a, b, c + integer :: ii + + do ii = 0, nr - 1 + c(ii) = a(ii) + b(ii) + end do +end subroutine foo + +program main + integer, parameter :: n = 1000 + integer, parameter :: distrib = 10 + integer, dimension (0:n-1) :: a, b, c + common a, b, c + integer :: i, j, k + + do j = 0, ((n / distrib) -1) + do i = 0, distrib - 1 + k = i + (distrib * j) + a(k) = k + b(k) = MODULO ((k * 3), 7) + c(k) = k * 2; + end do + end do + + call foo (n) + + do i = 0, n - 1 + if (c(i) .ne. (i + MODULO ((i * 3), 7))) call abort + end do + +end program diff --git a/libgomp/testsuite/libgomp.fortran/pr66199-1.f90 b/libgomp/testsuite/libgomp.fortran/pr66199-1.f90 new file mode 100644 index 00000000000..0cd232f3e14 --- /dev/null +++ b/libgomp/testsuite/libgomp.fortran/pr66199-1.f90 @@ -0,0 +1,49 @@ +! PR middle-end/66199 +! { dg-do run } +! { dg-options "-O2 -fopenmp" } + + integer :: u(1024), v(1024), w(1024), a, b, c, d, e, a1, b1, a2, b2, d1, d2 + a = 1 + b = 1024 + d = 75 + !$omp parallel do simd default(none) firstprivate (a, b) shared(u, v, w) + do d = a, b + u(d) = v(d) + w(d) + end do + if (d .ne. 1025) call abort + c = 17 + d = 75 + !$omp parallel do simd default(none) firstprivate (a, b) shared(u, v, w) & + !$omp& linear(d) linear(c:5) lastprivate(e) + do d = a, b + u(d) = v(d) + w(d) + c = c + 5 + e = c + end do + if (d .ne. 1025 .or. c .ne. (17 + 5 * 1024)) call abort + if (e .ne. (17 + 5 * 1024)) call abort + a1 = 0 + a2 = 0 + b1 = 31 + b2 = 31 + d1 = 7 + d2 = 9 + !$omp parallel do simd default(none) firstprivate (a1, b1, a2, b2) & + !$omp& shared(u, v, w) lastprivate(d1, d2) collapse(2) + do d1 = a1, b1 + do d2 = a2, b2 + u(d1 * 32 + d2 + 1) = v(d1 * 32 + d2 + 1) + w(d1 * 32 + d2 + 1) + end do + end do + if (d1 .ne. 32 .or. d2 .ne. 32) call abort + d1 = 7 + d2 = 9 + !$omp parallel do simd default(none) firstprivate (a1, b1, a2, b2) & + !$omp& shared(u, v, w) collapse(2) + do d1 = a1, b1 + do d2 = a2, b2 + u(d1 * 32 + d2 + 1) = v(d1 * 32 + d2 + 1) + w(d1 * 32 + d2 + 1) + end do + end do + if (d1 .ne. 32 .or. d2 .ne. 32) call abort +end diff --git a/libgomp/testsuite/libgomp.fortran/pr66199-2.f90 b/libgomp/testsuite/libgomp.fortran/pr66199-2.f90 new file mode 100644 index 00000000000..ad11eade72c --- /dev/null +++ b/libgomp/testsuite/libgomp.fortran/pr66199-2.f90 @@ -0,0 +1,47 @@ +! PR middle-end/66199 +! { dg-do run } +! { dg-options "-O2 -fopenmp" } + + integer :: u(1024), v(1024), w(1024), a, b, c, d, e, a1, b1, a2, b2, d1, d2 + a = 1 + b = 1024 + d = 75 + !$omp target teams distribute parallel do simd default(none) & + !$omp& firstprivate (a, b) shared(u, v, w) + do d = a, b + u(d) = v(d) + w(d) + end do + c = 17 + d = 75 + !$omp target teams distribute parallel do simd default(none) & + !$omp& firstprivate (a, b) shared(u, v, w) & + !$omp& linear(d) linear(c:5) lastprivate(e) + do d = a, b + u(d) = v(d) + w(d) + c = c + 5 + e = c + end do + a1 = 0 + a2 = 0 + b1 = 31 + b2 = 31 + d1 = 7 + d2 = 9 + !$omp target teams distribute parallel do simd default(none) & + !$omp& firstprivate (a1, b1, a2, b2) & + !$omp& shared(u, v, w) lastprivate(d1, d2) collapse(2) + do d1 = a1, b1 + do d2 = a2, b2 + u(d1 * 32 + d2 + 1) = v(d1 * 32 + d2 + 1) + w(d1 * 32 + d2 + 1) + end do + end do + d1 = 7 + d2 = 9 + !$omp target teams distribute parallel do simd default(none) & + !$omp& firstprivate (a1, b1, a2, b2) shared(u, v, w) collapse(2) + do d1 = a1, b1 + do d2 = a2, b2 + u(d1 * 32 + d2 + 1) = v(d1 * 32 + d2 + 1) + w(d1 * 32 + d2 + 1) + end do + end do +end diff --git a/libgomp/testsuite/libgomp.graphite/bounds.c b/libgomp/testsuite/libgomp.graphite/bounds.c index bd36c0f8a22..822eb6a6f95 100644 --- a/libgomp/testsuite/libgomp.graphite/bounds.c +++ b/libgomp/testsuite/libgomp.graphite/bounds.c @@ -8,6 +8,3 @@ int foo(int *a, int n) /* Check that Graphite dependency checking notes the dependency. */ /* { dg-do compile } */ /* { dg-final { scan-tree-dump-times "0 loops carried no dependency" 1 "graphite" } } */ -/* { dg-final { cleanup-tree-dump "graphite" } } */ -/* { dg-final { cleanup-tree-dump "parloops" } } */ -/* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/libgomp/testsuite/libgomp.graphite/force-parallel-1.c b/libgomp/testsuite/libgomp.graphite/force-parallel-1.c index 008c9d76f0f..245e64c6271 100644 --- a/libgomp/testsuite/libgomp.graphite/force-parallel-1.c +++ b/libgomp/testsuite/libgomp.graphite/force-parallel-1.c @@ -25,7 +25,4 @@ int main(void) /* Check that parallel code generation part make the right answer. */ /* { dg-final { scan-tree-dump-times "1 loops carried no dependency" 1 "graphite" } } */ -/* { dg-final { cleanup-tree-dump "graphite" } } */ /* { dg-final { scan-tree-dump-times "loopfn" 4 "optimized" } } */ -/* { dg-final { cleanup-tree-dump "parloops" } } */ -/* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/libgomp/testsuite/libgomp.graphite/force-parallel-2.c b/libgomp/testsuite/libgomp.graphite/force-parallel-2.c index f80401b6a7b..c6a28bae36f 100644 --- a/libgomp/testsuite/libgomp.graphite/force-parallel-2.c +++ b/libgomp/testsuite/libgomp.graphite/force-parallel-2.c @@ -24,7 +24,4 @@ int main(void) /* Check that parallel code generation part make the right answer. */ /* { dg-final { scan-tree-dump-times "2 loops carried no dependency" 1 "graphite" } } */ -/* { dg-final { cleanup-tree-dump "graphite" } } */ /* { dg-final { scan-tree-dump-times "loopfn" 4 "optimized" } } */ -/* { dg-final { cleanup-tree-dump "parloops" } } */ -/* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/libgomp/testsuite/libgomp.graphite/force-parallel-3.c b/libgomp/testsuite/libgomp.graphite/force-parallel-3.c index 4a2d323e7b1..0373c6f7928 100644 --- a/libgomp/testsuite/libgomp.graphite/force-parallel-3.c +++ b/libgomp/testsuite/libgomp.graphite/force-parallel-3.c @@ -31,8 +31,5 @@ int main(void) /* Check that parallel code generation part make the right answer. */ /* { dg-final { scan-tree-dump-times "4 loops carried no dependency" 1 "graphite" } } */ -/* { dg-final { cleanup-tree-dump "graphite" } } */ /* { dg-final { scan-tree-dump-times "loopfn.0" 4 "optimized" } } */ /* { dg-final { scan-tree-dump-times "loopfn.1" 4 "optimized" } } */ -/* { dg-final { cleanup-tree-dump "parloops" } } */ -/* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/libgomp/testsuite/libgomp.graphite/force-parallel-4.c b/libgomp/testsuite/libgomp.graphite/force-parallel-4.c index 0bfb0d010ef..513d58d7391 100644 --- a/libgomp/testsuite/libgomp.graphite/force-parallel-4.c +++ b/libgomp/testsuite/libgomp.graphite/force-parallel-4.c @@ -49,8 +49,5 @@ int main(void) /* Check that parallel code generation part make the right answer. */ /* { dg-final { scan-tree-dump-times "1 loops carried no dependency" 1 "graphite" } } */ /* { dg-final { scan-tree-dump-times "2 loops carried no dependency" 1 "graphite" } } */ -/* { dg-final { cleanup-tree-dump "graphite" } } */ /* { dg-final { scan-tree-dump-times "loopfn.0" 4 "optimized" } } */ /* { dg-final { scan-tree-dump-times "loopfn.1" 4 "optimized" } } */ -/* { dg-final { cleanup-tree-dump "parloops" } } */ -/* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/libgomp/testsuite/libgomp.graphite/force-parallel-5.c b/libgomp/testsuite/libgomp.graphite/force-parallel-5.c index 4912d4743b8..d5994677253 100644 --- a/libgomp/testsuite/libgomp.graphite/force-parallel-5.c +++ b/libgomp/testsuite/libgomp.graphite/force-parallel-5.c @@ -32,8 +32,5 @@ int main(void) /* Check that parallel code generation part make the right answer. */ /* { dg-final { scan-tree-dump-times "1 loops carried no dependency" 1 "graphite" } } */ -/* { dg-final { cleanup-tree-dump "graphite" } } */ /* { dg-final { scan-tree-dump-times "loopfn.0" 4 "optimized" } } */ /* { dg-final { scan-tree-dump-times "loopfn.1" 4 "optimized" } } */ -/* { dg-final { cleanup-tree-dump "parloops" } } */ -/* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/libgomp/testsuite/libgomp.graphite/force-parallel-6.c b/libgomp/testsuite/libgomp.graphite/force-parallel-6.c index cbc57357b33..61ebc3a4873 100644 --- a/libgomp/testsuite/libgomp.graphite/force-parallel-6.c +++ b/libgomp/testsuite/libgomp.graphite/force-parallel-6.c @@ -80,7 +80,4 @@ int main(void) /* Check that parallel code generation part make the right answer. */ /* { dg-final { scan-tree-dump-times "1 loops carried no dependency" 1 "graphite" } } */ -/* { dg-final { cleanup-tree-dump "graphite" } } */ /* { dg-final { scan-tree-dump-times "loopfn.0" 4 "optimized" } } */ -/* { dg-final { cleanup-tree-dump "parloops" } } */ -/* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/libgomp/testsuite/libgomp.graphite/force-parallel-7.c b/libgomp/testsuite/libgomp.graphite/force-parallel-7.c index 04dd01d174b..5a54d474771 100644 --- a/libgomp/testsuite/libgomp.graphite/force-parallel-7.c +++ b/libgomp/testsuite/libgomp.graphite/force-parallel-7.c @@ -32,7 +32,4 @@ int main (void) /* Check that parallel code generation part make the right answer. */ /* { dg-final { scan-tree-dump-times "3 loops carried no dependency" 1 "graphite" } } */ -/* { dg-final { cleanup-tree-dump "graphite" } } */ /* { dg-final { scan-tree-dump-times "loopfn.0" 4 "optimized" } } */ -/* { dg-final { cleanup-tree-dump "parloops" } } */ -/* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/libgomp/testsuite/libgomp.graphite/force-parallel-8.c b/libgomp/testsuite/libgomp.graphite/force-parallel-8.c index e2ed0ecb868..dc60f2f32b4 100644 --- a/libgomp/testsuite/libgomp.graphite/force-parallel-8.c +++ b/libgomp/testsuite/libgomp.graphite/force-parallel-8.c @@ -46,8 +46,5 @@ int main(void) /* { dg-final { scan-tree-dump-times "1 loops carried no dependency" 1 "graphite" } } */ /* { dg-final { scan-tree-dump-times "3 loops carried no dependency" 1 "graphite" } } */ /* { dg-final { scan-tree-dump-times "5 loops carried no dependency" 1 "graphite" } } */ -/* { dg-final { cleanup-tree-dump "graphite" } } */ /* { dg-final { scan-tree-dump-times "loopfn.0" 4 "optimized" } } */ /* { dg-final { scan-tree-dump-times "loopfn.1" 4 "optimized" } } */ -/* { dg-final { cleanup-tree-dump "parloops" } } */ -/* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/libgomp/testsuite/libgomp.graphite/force-parallel-9.c b/libgomp/testsuite/libgomp.graphite/force-parallel-9.c index e0008801acc..a1854842eaf 100644 --- a/libgomp/testsuite/libgomp.graphite/force-parallel-9.c +++ b/libgomp/testsuite/libgomp.graphite/force-parallel-9.c @@ -30,8 +30,5 @@ int main(void) /* Check that parallel code generation part make the right answer. */ /* { dg-final { scan-tree-dump-times "4 loops carried no dependency" 1 "graphite" } } */ -/* { dg-final { cleanup-tree-dump "graphite" } } */ /* { dg-final { scan-tree-dump-times "loopfn.0" 4 "optimized" } } */ /* { dg-final { scan-tree-dump-times "loopfn.1" 4 "optimized" } } */ -/* { dg-final { cleanup-tree-dump "parloops" } } */ -/* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/libgomp/testsuite/libgomp.graphite/pr41118.c b/libgomp/testsuite/libgomp.graphite/pr41118.c index 18e95ed8b5b..4256f4aac3d 100644 --- a/libgomp/testsuite/libgomp.graphite/pr41118.c +++ b/libgomp/testsuite/libgomp.graphite/pr41118.c @@ -13,7 +13,4 @@ int main(void) } /* Check that parallel code generation part make the right answer. */ -/* { dg-final { cleanup-tree-dump "graphite" } } */ /* { dg-final { scan-tree-dump-times "loopfn" 0 "optimized" } } */ -/* { dg-final { cleanup-tree-dump "parloops" } } */ -/* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/libgomp/testsuite/libgomp.oacc-c++/c++.exp b/libgomp/testsuite/libgomp.oacc-c++/c++.exp index f486f9b97ba..3b97024492c 100644 --- a/libgomp/testsuite/libgomp.oacc-c++/c++.exp +++ b/libgomp/testsuite/libgomp.oacc-c++/c++.exp @@ -13,6 +13,11 @@ if [info exists lang_include_flags] then { unset lang_include_flags } +# If a testcase doesn't have special options, use these. +if ![info exists DEFAULT_CFLAGS] then { + set DEFAULT_CFLAGS "-O2" +} + # Initialize dg. dg-init @@ -80,6 +85,12 @@ if { $lang_test_file_found } { set acc_mem_shared 0 } nvidia { + if { ![check_effective_target_openacc_nvidia_accel_present] } { + # Don't bother; execution testing is going to FAIL. + untested "$subdir $offload_target_openacc offloading" + continue + } + # Copy ptx file (TEMPORARY) remote_download host $srcdir/libgomp.oacc-c-c++-common/subr.ptx @@ -96,7 +107,7 @@ if { $lang_test_file_found } { setenv ACC_DEVICE_TYPE $offload_target_openacc - dg-runtest $tests "$tagopt" $libstdcxx_includes + dg-runtest $tests "$tagopt" "$libstdcxx_includes $DEFAULT_CFLAGS" } } diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/clauses-2.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/clauses-2.c index 8dc45cb6287..c0a5d0055b6 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/clauses-2.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/clauses-2.c @@ -64,4 +64,5 @@ main (int argc, char **argv) return 0; } -/* { dg-shouldfail "libgomp: \[\h+,\d+\] is not mapped" } */ +/* { dg-output "Trying to map into device \\\[\[0-9a-fA-FxX\]+..\[0-9a-fA-FxX\]+\\\) object when \\\[\[0-9a-fA-FxX\]+..\[0-9a-fA-FxX\]+\\\) is already mapped" } */ +/* { dg-shouldfail "" } */ diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/collapse-3.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/collapse-3.c index a5be7287d22..680042892e4 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/collapse-3.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/collapse-3.c @@ -1,5 +1,4 @@ /* { dg-do run } */ -/* { dg-options "-O2" } */ #include <string.h> #include <stdlib.h> diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/data-already-1.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/data-already-1.c index 83c0a42c512..0c61a66a0dd 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/data-already-1.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/data-already-1.c @@ -15,5 +15,5 @@ main (int argc, char *argv[]) return 0; } -/* { dg-shouldfail "" } - { dg-output "Trying to map into device .* object when .* is already mapped" } */ +/* { dg-output "Trying to map into device \\\[\[0-9a-fA-FxX\]+..\[0-9a-fA-FxX\]+\\\) object when \\\[\[0-9a-fA-FxX\]+..\[0-9a-fA-FxX\]+\\\) is already mapped" } */ +/* { dg-shouldfail "" } */ diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/data-already-2.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/data-already-2.c index 137d8ce09da..cd9fea33886 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/data-already-2.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/data-already-2.c @@ -12,5 +12,5 @@ main (int argc, char *argv[]) return 0; } -/* { dg-shouldfail "" } - { dg-output "Trying to map into device .* object when .* is already mapped" } */ +/* { dg-output "Trying to map into device \\\[\[0-9a-fA-FxX\]+..\[0-9a-fA-FxX\]+\\\) object when \\\[\[0-9a-fA-FxX\]+..\[0-9a-fA-FxX\]+\\\) is already mapped" } */ +/* { dg-shouldfail "" } */ diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/data-already-8.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/data-already-8.c index a50f7de3a65..7472d7f4e05 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/data-already-8.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/data-already-8.c @@ -12,5 +12,5 @@ main (int argc, char *argv[]) return 0; } -/* { dg-shouldfail "" } - { dg-output "Trying to map into device .* object when .* is already mapped" } */ +/* { dg-output "Trying to map into device \\\[\[0-9a-fA-FxX\]+..\[0-9a-fA-FxX\]+\\\) object when \\\[\[0-9a-fA-FxX\]+..\[0-9a-fA-FxX\]+\\\) is already mapped" } */ +/* { dg-shouldfail "" } */ diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-1.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-1.c index 17129d8bebd..5ff23b24190 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-1.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-1.c @@ -21,4 +21,5 @@ main (int argc, char **argv) return 0; } -/* { dg-shouldfail "libgomp: device already active" } */ +/* { dg-output "device already active" } */ +/* { dg-shouldfail "" } */ diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-11.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-11.c index eccdb8cbacf..e34a876e0d0 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-11.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-11.c @@ -20,4 +20,5 @@ main (int argc, char **argv) return 0; } -/* { dg-shouldfail "libgomp: mem free failed 1" } */ +/* { dg-output "invalid device address" } */ +/* { dg-shouldfail "" } */ diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-16.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-16.c index 9d277ac39f7..d6f65595c3e 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-16.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-16.c @@ -26,4 +26,5 @@ main (int argc, char **argv) return 0; } -/* { dg-shouldfail "libgomp: \[\h+,\+256\] already mapped to \[\h+,\+256\]" } */ +/* { dg-output "\\\[\[0-9a-fA-FxX\]+,\\\+256\\\] already mapped to \\\[\[0-9a-fA-FxX\]+,\\\+256\\\]" } */ +/* { dg-shouldfail "" } */ diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-17.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-17.c index 5ff894cb33a..d20ad6ab641 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-17.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-17.c @@ -28,4 +28,5 @@ main (int argc, char **argv) return 0; } -/* { dg-shouldfail "libgomp: \[\h+,256\] is not mapped" } */ +/* { dg-output "\\\[\[0-9a-fA-FxX\]+,256\\\] is not mapped" } */ +/* { dg-shouldfail "" } */ diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-18.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-18.c index 2bc32637d36..a3cb59a0dab 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-18.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-18.c @@ -31,4 +31,5 @@ main (int argc, char **argv) return 0; } -/* { dg-shouldfail "libgomp: \[\h+,256\] is not mapped" } */ +/* { dg-output "\\\[\[0-9a-fA-FxX\]+,256\\\] is not mapped" } */ +/* { dg-shouldfail "" } */ diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-2.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-2.c index 9a4501f0e00..b16e9e6bdbc 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-2.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-2.c @@ -23,4 +23,5 @@ main (int argc, char **argv) return 0; } -/* { dg-shouldfail "libgomp: no device initialized" } */ +/* { dg-output "no device initialized" } */ +/* { dg-shouldfail "" } */ diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-20.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-20.c index b379a8f7add..3e86154958a 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-20.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-20.c @@ -26,4 +26,5 @@ main (int argc, char **argv) return 0; } -/* { dg-shouldfail "libgomp: \[\h+,256\] surounds2 \[\h+,\+257\]" } */ +/* { dg-output "\\\[\[0-9a-fA-FxX\]+,256\\\] surrounds2 \\\[\[0-9a-fA-FxX\]+,\\\+257\\\]" } */ +/* { dg-shouldfail "" } */ diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-21.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-21.c index 3a67400a620..7fb34e335b6 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-21.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-21.c @@ -26,4 +26,5 @@ main (int argc, char **argv) return 0; } -/* { dg-shouldfail "libgomp: \[\h+,0\] is not mapped" } */ +/* { dg-output "\\\[\[0-9a-fA-FxX\]+,0\\\] is not mapped" } */ +/* { dg-shouldfail "" } */ diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-22.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-22.c index 2b86da80580..b0d4df8a37f 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-22.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-22.c @@ -26,4 +26,5 @@ main (int argc, char **argv) return 0; } -/* { dg-shouldfail "libgomp: \[\h+,256\] surrounds2 \[\h+,\+255\]" } */ +/* { dg-output "\\\[\[0-9a-fA-FxX\]+,256\\\] surrounds2 \\\[\[0-9a-fA-FxX\]+,\\\+255\\\]" } */ +/* { dg-shouldfail "" } */ diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-23.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-23.c index 38f236dcea9..64334ecdfbc 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-23.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-23.c @@ -36,4 +36,5 @@ main (int argc, char **argv) return 0; } -/* { dg-shouldfail "libgomp: \[\h+,256\] surrounds2 \[\h+,\+512\]" } */ +/* { dg-output "\\\[\[0-9a-fA-FxX\]+,256\\\] surrounds2 \\\[\[0-9a-fA-FxX\]+,\\\+512\\\]" } */ +/* { dg-shouldfail "" } */ diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-25.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-25.c index 11458283b2c..17f4a19780c 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-25.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-25.c @@ -27,4 +27,5 @@ main (int argc, char **argv) return 0; } -/* { dg-shouldfail "libgomp: \[\h+,256\] already mapped to \[\h+,256\]" } */ +/* { dg-output "\\\[\[0-9a-fA-FxX\]+,\\\+256\\\] already mapped to \\\[\[0-9a-fA-FxX\]+,\\\+256\\\]" } */ +/* { dg-shouldfail "" } */ diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-26.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-26.c index a23f56e753f..41d560eeb1f 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-26.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-26.c @@ -23,4 +23,5 @@ main (int argc, char **argv) return 0; } -/* { dg-shouldfail "libgomp: \[\h+,\+0\] is a bad range" } */ +/* { dg-output "\\\[\[0-9a-fA-FxX\]+,\\\+0\\\] is a bad range" } */ +/* { dg-shouldfail "" } */ diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-27.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-27.c index 074fddb2ab7..9d9d73962d1 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-27.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-27.c @@ -23,4 +23,5 @@ main (int argc, char **argv) return 0; } -/* { dg-shouldfail "libgomp: \[\(nil\)\] is a bad range" } */ +/* { dg-output "\\\[\[^\n\r]*,\\\+256\\\] is a bad range" } */ +/* { dg-shouldfail "" } */ diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-28.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-28.c index 027f7cc6460..07d13d75f1b 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-28.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-28.c @@ -23,4 +23,5 @@ main (int argc, char **argv) return 0; } -/* { dg-shouldfail "libgomp: \[\(nil\),256\] is not mapped" } */ +/* { dg-output "\\\[\[^\n\r]*,256\\\] is not mapped" } */ +/* { dg-shouldfail "" } */ diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-29.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-29.c index a66de0f538d..da01194fa41 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-29.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-29.c @@ -23,4 +23,5 @@ main (int argc, char **argv) return 0; } -/* { dg-shouldfail "libgomp: \[\h+,0\] is not mapped" } */ +/* { dg-output "\\\[\[0-9a-fA-FxX\]+,0\\\] is not mapped" } */ +/* { dg-shouldfail "" } */ diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-3.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-3.c index e823a4153fa..d5f390d7f9d 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-3.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-3.c @@ -12,4 +12,6 @@ main (int argc, char **argv) return 0; } -/* { dg-shouldfail "libgomp: device 4(4) is initialized" } */ +/* TODO: currently prints: "libgomp: no device found". */ +/* { dg-output "device \[0-9\]+\\\(\[0-9\]+\\\) is initialized" { xfail *-*-* } } */ +/* { dg-shouldfail "" } */ diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-30.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-30.c index ce2bdb44739..9e340582e63 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-30.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-30.c @@ -23,4 +23,5 @@ main (int argc, char **argv) return 0; } -/* { dg-shouldfail "libgomp: \[\h+,256\] surrounds2 \[\h+,\+254\]" } */ +/* { dg-output "\\\[\[0-9a-fA-FxX\]+,256\\\] surrounds2 \\\[\[0-9a-fA-FxX\]+,\\\+254\\\]" } */ +/* { dg-shouldfail "" } */ diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-34.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-34.c index 32d5d5117e6..536e2aef653 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-34.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-34.c @@ -30,4 +30,5 @@ main (int argc, char **argv) return 0; } -/* { dg-shouldfail "libgomp: \[\h+,\+256\] not mapped" } */ +/* { dg-output "\\\[\[0-9a-fA-FxX\]+,\\\+256\\\] not mapped" } */ +/* { dg-shouldfail "" } */ diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-35.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-35.c index ca8edab52a2..fc9013630d5 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-35.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-35.c @@ -23,4 +23,5 @@ main (int argc, char **argv) return 0; } -/* { dg-shouldfail "libgomp: \[\(nil\),+256\] is a bad range" } */ +/* { dg-output "\\\[\[^\n\r]*,\\\+256\\\] is a bad range" } */ +/* { dg-shouldfail "" } */ diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-36.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-36.c index cb29397e14e..d0587ae4dc6 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-36.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-36.c @@ -23,4 +23,5 @@ main (int argc, char **argv) return 0; } -/* { dg-shouldfail "libgomp: \[\h+,\+0\] is a bad range" } */ +/* { dg-output "\\\[\[0-9a-fA-FxX\]+,\\\+0\\\] is a bad range" } */ +/* { dg-shouldfail "" } */ diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-39.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-39.c index db1e0b3ffd5..01fdd90ce4f 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-39.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-39.c @@ -38,4 +38,5 @@ main (int argc, char **argv) return 0; } -/* { dg-shouldfail "libgomp: \[\(nil\),+256\] is a bad range" } */ +/* { dg-output "\\\[\[^\n\r]*,\\\+256\\\] is a bad range" } */ +/* { dg-shouldfail "" } */ diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-4.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-4.c index 060275b999b..3bb9ea512b6 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-4.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-4.c @@ -10,4 +10,5 @@ main (int argc, char **argv) return 0; } -/* { dg-shouldfail "libgomp: device 99 is out of range" } */ +/* { dg-output "unknown device type \[0-9\]+" } */ +/* { dg-shouldfail "" } */ diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-40.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-40.c index cb6c422872e..5a198980a27 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-40.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-40.c @@ -39,4 +39,5 @@ main (int argc, char **argv) return 0; } -/* { dg-shouldfail "libgomp: \[\h+,\+0\] is a bad range" } */ +/* { dg-output "\\\[\[0-9a-fA-FxX\]+,\\\+0\\\] is a bad range" } */ +/* { dg-shouldfail "" } */ diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-42.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-42.c index d577fe37e53..b74adddccac 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-42.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-42.c @@ -32,4 +32,7 @@ main (int argc, char **argv) return 0; } -/* { dg-shouldfail "libgomp: \[\h+,256\] is not mapped" } */ +/* TODO: currently doesn't print anything; SIGSEGV. + <https://gcc.gnu.org/PR66518>. */ +/* { dg-output "\\\[\[0-9a-fA-FxX\]+,256\\\] is not mapped" { xfail *-*-* } } */ +/* { dg-shouldfail "" } */ diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-43.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-43.c index ceeb155fe44..45d4988b326 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-43.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-43.c @@ -42,4 +42,5 @@ main (int argc, char **argv) return 0; } -/* { dg-shouldfail "libgomp: \[\(nil\),256\] is not mapped" } */ +/* { dg-output "\\\[\[^\n\r]*,256\\\] is not mapped" } */ +/* { dg-shouldfail "" } */ diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-44.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-44.c index 0cabb0d31d9..abe2b9e17dc 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-44.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-44.c @@ -42,4 +42,5 @@ main (int argc, char **argv) return 0; } -/* { dg-shouldfail "libgomp: \[\h+,0\] is not mapped" } */ +/* { dg-output "\\\[\[0-9a-fA-FxX\]+,0\\\] is not mapped" } */ +/* { dg-shouldfail "" } */ diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-47.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-47.c index a7ff904c97c..2b3730b3289 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-47.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-47.c @@ -40,4 +40,5 @@ main (int argc, char **argv) return 0; } -/* { dg-shouldfail "libgomp: \[\(nil\),256\] is not mapped" } */ +/* { dg-output "\\\[\[^\n\r]*,256\\\] is not mapped" } */ +/* { dg-shouldfail "" } */ diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-48.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-48.c index 01d3c6c8280..febe022c75d 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-48.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-48.c @@ -40,4 +40,5 @@ main (int argc, char **argv) return 0; } -/* { dg-shouldfail "libgomp: \[\h+,0\] is not mapped" } */ +/* { dg-output "\\\[\[0-9a-fA-FxX\]+,0\\\] is not mapped" } */ +/* { dg-shouldfail "" } */ diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-52.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-52.c index 780db310fa1..39845e81171 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-52.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-52.c @@ -25,4 +25,6 @@ main (int argc, char **argv) return 0; } -/* { dg-shouldfail "libgomp: \[(nil),+256\]->\[\h+,\+256\] is a bad map" } */ +/* { dg-output "\\\[\[^\n\r]*,\\\+256\]->\[\[0-9a-fA-FxX\]+,\\\+256\\\] is a bad map" { target openacc_nvidia_accel_selected } } */ +/* { dg-output "cannot map data on shared-memory system" { target openacc_host_selected } } */ +/* { dg-shouldfail "" } */ diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-53.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-53.c index 657adde3b02..bed9323141f 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-53.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-53.c @@ -25,4 +25,6 @@ main (int argc, char **argv) return 0; } -/* { dg-shouldfail "libgomp: \[\h+,\+256\]->\[(nil),\+256\] is a bad map" } */ +/* { dg-output "\\\[\[0-9a-fA-FxX\]+,\\\+256\]->\\\[\[^\n\r]*,\\\+256\\\] is a bad map" { target openacc_nvidia_accel_selected } } */ +/* { dg-output "cannot map data on shared-memory system" { target openacc_host_selected } } */ +/* { dg-shouldfail "" } */ diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-54.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-54.c index 1f3df80bd41..20fd17501d5 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-54.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-54.c @@ -25,4 +25,6 @@ main (int argc, char **argv) return 0; } -/* { dg-shouldfail "libgomp: \[\h+,\+0\]->\[\h+,\+0\] is a bad map" } */ +/* { dg-output "\\\[\[0-9a-fA-FxX\]+,\\\+0\\\]->\\\[\[0-9a-fA-FxX\]+,\\\+0\\\] is a bad map" { target openacc_nvidia_accel_selected } } */ +/* { dg-output "cannot map data on shared-memory system" { target openacc_host_selected } } */ +/* { dg-shouldfail "" } */ diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-57.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-57.c index f9043a445df..69ab79ff4b1 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-57.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-57.c @@ -25,4 +25,6 @@ main (int argc, char **argv) return 0; } -/* { dg-shouldfail "libgomp: \h+ is not a mapped block" } */ +/* { dg-output "\[0-9a-fA-FxX\]+ is not a mapped block" { target openacc_nvidia_accel_selected } } */ +/* { dg-output "cannot map data on shared-memory system" { target openacc_host_selected } } */ +/* { dg-shouldfail "" } */ diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-58.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-58.c index 9d6e27d89e9..9b1ecd9bf2e 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-58.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-58.c @@ -25,4 +25,6 @@ main (int argc, char **argv) return 0; } -/* { dg-shouldfail "libgomp: \(nil\) is not a mapped block" } */ +/* { dg-output "\[^\n\r]* is not a mapped block" { target openacc_nvidia_accel_selected } } */ +/* { dg-output "cannot map data on shared-memory system" { target openacc_host_selected } } */ +/* { dg-shouldfail "" } */ diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-62.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-62.c index e6178e233ed..2988b5bcd0a 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-62.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-62.c @@ -1,4 +1,4 @@ -/* { dg-do run } */ +/* { dg-do run { target openacc_nvidia_accel_selected } } */ #include <string.h> #include <stdlib.h> @@ -12,8 +12,6 @@ main (int argc, char **argv) unsigned char *h; void *d; - acc_init (acc_device_nvidia); - h = (unsigned char *) malloc (N); for (i = 0; i < N; i++) @@ -41,9 +39,8 @@ main (int argc, char **argv) free (h); - acc_shutdown (acc_device_nvidia); - return 0; } -/* { dg-shouldfail "libgomp: invalid size" } */ +/* { dg-output "invalid size" } */ +/* { dg-shouldfail "" } */ diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-63.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-63.c index ca237ec1b60..69c061e3a90 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-63.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-63.c @@ -1,4 +1,4 @@ -/* { dg-do run } */ +/* { dg-do run { target openacc_nvidia_accel_selected } } */ #include <string.h> #include <stdlib.h> @@ -40,4 +40,5 @@ main (int argc, char **argv) return 0; } -/* { dg-shouldfail "libgomp: invalid device address" } */ +/* { dg-output "invalid device address" } */ +/* { dg-shouldfail "" } */ diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-64.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-64.c index 850fd2e3f91..6a785b03947 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-64.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-64.c @@ -1,4 +1,4 @@ -/* { dg-do run } */ +/* { dg-do run { target openacc_nvidia_accel_selected } } */ #include <string.h> #include <stdlib.h> @@ -40,4 +40,5 @@ main (int argc, char **argv) return 0; } -/* { dg-shouldfail "libgomp: invalid host address" } */ +/* { dg-output "invalid host address" } */ +/* { dg-shouldfail "" } */ diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-65.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-65.c index 26c8cefdc42..0f2f9ebe4fd 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-65.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-65.c @@ -1,4 +1,4 @@ -/* { dg-do run } */ +/* { dg-do run { target openacc_nvidia_accel_selected } } */ #include <string.h> #include <stdlib.h> @@ -40,4 +40,5 @@ main (int argc, char **argv) return 0; } -/* { dg-shouldfail "libgomp: invalid host or device address" } */ +/* { dg-output "invalid host or device address" } */ +/* { dg-shouldfail "" } */ diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-67.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-67.c index 01b8b2d89ae..31b8c1fe5e6 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-67.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-67.c @@ -1,4 +1,4 @@ -/* { dg-do run } */ +/* { dg-do run { target openacc_nvidia_accel_selected } } */ #include <string.h> #include <stdlib.h> @@ -40,4 +40,5 @@ main (int argc, char **argv) return 0; } -/* { dg-shouldfail "libgomp: invalid host address" } */ +/* { dg-output "invalid host address" } */ +/* { dg-shouldfail "" } */ diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-68.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-68.c index 3ff5bd7bcf7..dc39770aece 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-68.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-68.c @@ -1,4 +1,4 @@ -/* { dg-do run } */ +/* { dg-do run { target openacc_nvidia_accel_selected } } */ #include <string.h> #include <stdlib.h> @@ -40,4 +40,5 @@ main (int argc, char **argv) return 0; } -/* { dg-shouldfail "libgomp: invalid device address" } */ +/* { dg-output "invalid device address" } */ +/* { dg-shouldfail "" } */ diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-71.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-71.c index a04537916f6..e8584db27cf 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-71.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-71.c @@ -116,4 +116,5 @@ main (int argc, char **argv) return 0; } -/* { dg-shouldfail "libgomp: unknown async \d" } */ +/* { dg-output "unknown async \[0-9\]+" } */ +/* { dg-shouldfail "" } */ diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-77.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-77.c index e47212b2139..35a09801cbe 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-77.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-77.c @@ -132,4 +132,5 @@ main (int argc, char **argv) return 0; } -/* { dg-shouldfail "libgomp: unknown async \d" } */ +/* { dg-output "unknown async \[0-9\]+" } */ +/* { dg-shouldfail "" } */ diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-80.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-80.c index 0b5ec24b28e..d521331210d 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-80.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-80.c @@ -129,4 +129,5 @@ main (int argc, char **argv) return 0; } -/* { dg-shouldfail "libgomp: identical parameters" } */ +/* { dg-output "identical parameters" } */ +/* { dg-shouldfail "" } */ diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/present-1.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/present-1.c index f331f1f6370..d8fcb716b9b 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/present-1.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/present-1.c @@ -45,4 +45,5 @@ main (int argc, char **argv) return 0; } -/* { dg-shouldfail "libgomp: present clause: !acc_is_present" } */ +/* { dg-output "present clause: !acc_is_present" } */ +/* { dg-shouldfail "" } */ diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/reduction-4.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/reduction-4.c index d7da19e829b..eab24281514 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/reduction-4.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/reduction-4.c @@ -14,7 +14,7 @@ main(void) { const int n = 1000; int i; - double complex vresult, result, array[n]; + double _Complex vresult, result, array[n]; bool lvresult, lresult; for (i = 0; i < n; i++) diff --git a/libgomp/testsuite/libgomp.oacc-c/c.exp b/libgomp/testsuite/libgomp.oacc-c/c.exp index c0c70bbacad..326b988d99a 100644 --- a/libgomp/testsuite/libgomp.oacc-c/c.exp +++ b/libgomp/testsuite/libgomp.oacc-c/c.exp @@ -48,6 +48,12 @@ foreach offload_target_openacc $offload_targets_s_openacc { set acc_mem_shared 0 } nvidia { + if { ![check_effective_target_openacc_nvidia_accel_present] } { + # Don't bother; execution testing is going to FAIL. + untested "$subdir $offload_target_openacc offloading" + continue + } + # Copy ptx file (TEMPORARY) remote_download host $srcdir/libgomp.oacc-c-c++-common/subr.ptx diff --git a/libgomp/testsuite/libgomp.oacc-fortran/data-already-1.f b/libgomp/testsuite/libgomp.oacc-fortran/data-already-1.f index ac220ab4c7e..fc08fd5392d 100644 --- a/libgomp/testsuite/libgomp.oacc-fortran/data-already-1.f +++ b/libgomp/testsuite/libgomp.oacc-fortran/data-already-1.f @@ -13,5 +13,5 @@ END +! { dg-output "Trying to map into device \\\[\[0-9a-fA-FxX\]+..\[0-9a-fA-FxX\]+\\\) object when \\\[\[0-9a-fA-FxX\]+..\[0-9a-fA-FxX\]+\\\) is already mapped" } ! { dg-shouldfail "" } -! { dg-output "Trying to map into device .* object when .* is already mapped" } diff --git a/libgomp/testsuite/libgomp.oacc-fortran/data-already-2.f b/libgomp/testsuite/libgomp.oacc-fortran/data-already-2.f index 2c5254b8684..b8a82b59502 100644 --- a/libgomp/testsuite/libgomp.oacc-fortran/data-already-2.f +++ b/libgomp/testsuite/libgomp.oacc-fortran/data-already-2.f @@ -12,5 +12,5 @@ END +! { dg-output "Trying to map into device \\\[\[0-9a-fA-FxX\]+..\[0-9a-fA-FxX\]+\\\) object when \\\[\[0-9a-fA-FxX\]+..\[0-9a-fA-FxX\]+\\\) is already mapped" } ! { dg-shouldfail "" } -! { dg-output "Trying to map into device .* object when .* is already mapped" } diff --git a/libgomp/testsuite/libgomp.oacc-fortran/data-already-8.f b/libgomp/testsuite/libgomp.oacc-fortran/data-already-8.f index 16da048861a..2083809bac8 100644 --- a/libgomp/testsuite/libgomp.oacc-fortran/data-already-8.f +++ b/libgomp/testsuite/libgomp.oacc-fortran/data-already-8.f @@ -12,5 +12,5 @@ END +! { dg-output "Trying to map into device \\\[\[0-9a-fA-FxX\]+..\[0-9a-fA-FxX\]+\\\) object when \\\[\[0-9a-fA-FxX\]+..\[0-9a-fA-FxX\]+\\\) is already mapped" } ! { dg-shouldfail "" } -! { dg-output "Trying to map into device .* object when .* is already mapped" } diff --git a/libgomp/testsuite/libgomp.oacc-fortran/fortran.exp b/libgomp/testsuite/libgomp.oacc-fortran/fortran.exp index a8f62e84d67..a8aaff0e2b1 100644 --- a/libgomp/testsuite/libgomp.oacc-fortran/fortran.exp +++ b/libgomp/testsuite/libgomp.oacc-fortran/fortran.exp @@ -77,6 +77,12 @@ if { $lang_test_file_found } { set acc_mem_shared 0 } nvidia { + if { ![check_effective_target_openacc_nvidia_accel_present] } { + # Don't bother; execution testing is going to FAIL. + untested "$subdir $offload_target_openacc offloading" + continue + } + set acc_mem_shared 0 } default { |