aboutsummaryrefslogtreecommitdiff
path: root/flang
diff options
context:
space:
mode:
authorMichael Klemm <michael.klemm@amd.com>2024-03-20 13:47:26 +0100
committerGitHub <noreply@github.com>2024-03-20 13:47:26 +0100
commitfb5fd2d82f9befba9cf5152d1a0c5e6f91ee48f0 (patch)
tree07d5d82cd9b75ac162f9ec80b9ecf245ce344075 /flang
parent254bfe955ac3deba08dbbe490ef3cf5004a3bd6e (diff)
downloadllvm-fb5fd2d82f9befba9cf5152d1a0c5e6f91ee48f0.zip
llvm-fb5fd2d82f9befba9cf5152d1a0c5e6f91ee48f0.tar.gz
llvm-fb5fd2d82f9befba9cf5152d1a0c5e6f91ee48f0.tar.bz2
[flang][OpenMP] Compile proper `omp_lib.mod` from the `openmp/src/include` sources (#80874)
This PR changes the build system to use use the sources for the module `omp_lib` and the `omp_lib.h` include file from the `openmp` runtime project and not from a separate copy of these files. This will greatly reduce potential for inconsistencies when adding features to the OpenMP runtime implementation. When the OpenMP subproject is not configured, this PR also disables the corresponding LIT tests with a "REQUIRES" directive at the beginning of the OpenMP test files. --------- Co-authored-by: Valentin Clement (バレンタイン クレメン) <clementval@gmail.com>
Diffstat (limited to 'flang')
-rw-r--r--flang/module/omp_lib.f9013
-rw-r--r--flang/module/omp_lib.h454
-rw-r--r--flang/test/Driver/include-omp-header.f906
-rw-r--r--flang/test/Lower/OpenMP/FIR/atomic-capture.f902
-rw-r--r--flang/test/Lower/OpenMP/FIR/atomic-read.f902
-rw-r--r--flang/test/Lower/OpenMP/FIR/atomic-update.f902
-rw-r--r--flang/test/Lower/OpenMP/FIR/atomic-write.f902
-rw-r--r--flang/test/Lower/OpenMP/FIR/critical.f902
-rw-r--r--flang/test/Lower/OpenMP/FIR/parallel-sections.f9018
-rw-r--r--flang/test/Lower/OpenMP/FIR/parallel.f9010
-rw-r--r--flang/test/Lower/OpenMP/FIR/sections.f906
-rw-r--r--flang/test/Lower/OpenMP/FIR/single.f904
-rw-r--r--flang/test/Lower/OpenMP/FIR/task.f906
-rw-r--r--flang/test/Lower/OpenMP/FIR/taskgroup.f906
-rw-r--r--flang/test/Lower/OpenMP/FIR/teams.f905
-rw-r--r--flang/test/Lower/OpenMP/atomic-capture.f902
-rw-r--r--flang/test/Lower/OpenMP/atomic-read.f902
-rw-r--r--flang/test/Lower/OpenMP/atomic-update.f902
-rw-r--r--flang/test/Lower/OpenMP/atomic-write.f906
-rw-r--r--flang/test/Lower/OpenMP/critical.f902
-rw-r--r--flang/test/Lower/OpenMP/omp-lib-num-threads.f902
-rw-r--r--flang/test/Lower/OpenMP/parallel-sections.f9010
-rw-r--r--flang/test/Lower/OpenMP/parallel.f906
-rw-r--r--flang/test/Lower/OpenMP/sections.f906
-rw-r--r--flang/test/Lower/OpenMP/single.f904
-rw-r--r--flang/test/Lower/OpenMP/task.f906
-rw-r--r--flang/test/Lower/OpenMP/taskgroup.f906
-rw-r--r--flang/test/Lower/OpenMP/teams.f904
-rw-r--r--flang/test/Lower/OpenMP/threadprivate-default-clause.f902
-rw-r--r--flang/test/Parser/OpenMP/allocate-tree-spec-part.f902
-rw-r--r--flang/test/Parser/OpenMP/allocate-tree.f908
-rw-r--r--flang/test/Parser/OpenMP/target_device_parse.f902
-rw-r--r--flang/test/Semantics/OpenMP/allocate-clause01.f902
-rw-r--r--flang/test/Semantics/OpenMP/allocate-directive.f902
-rw-r--r--flang/test/Semantics/OpenMP/allocate01.f902
-rw-r--r--flang/test/Semantics/OpenMP/allocate02.f902
-rw-r--r--flang/test/Semantics/OpenMP/allocate03.f902
-rw-r--r--flang/test/Semantics/OpenMP/allocate04.f902
-rw-r--r--flang/test/Semantics/OpenMP/allocate05.f902
-rw-r--r--flang/test/Semantics/OpenMP/allocate06.f902
-rw-r--r--flang/test/Semantics/OpenMP/allocate07.f902
-rw-r--r--flang/test/Semantics/OpenMP/allocate08.f902
-rw-r--r--flang/test/Semantics/OpenMP/allocate09.f902
-rw-r--r--flang/test/Semantics/OpenMP/allocators01.f902
-rw-r--r--flang/test/Semantics/OpenMP/allocators02.f902
-rw-r--r--flang/test/Semantics/OpenMP/allocators03.f902
-rw-r--r--flang/test/Semantics/OpenMP/allocators04.f902
-rw-r--r--flang/test/Semantics/OpenMP/allocators05.f902
-rw-r--r--flang/test/Semantics/OpenMP/allocators06.f902
-rw-r--r--flang/test/Semantics/OpenMP/atomic-hint-clause.f902
-rw-r--r--flang/test/Semantics/OpenMP/atomic01.f902
-rw-r--r--flang/test/Semantics/OpenMP/atomic02.f902
-rw-r--r--flang/test/Semantics/OpenMP/atomic03.f902
-rw-r--r--flang/test/Semantics/OpenMP/atomic04.f902
-rw-r--r--flang/test/Semantics/OpenMP/atomic05.f902
-rw-r--r--flang/test/Semantics/OpenMP/clause-validity01.f902
-rw-r--r--flang/test/Semantics/OpenMP/critical-hint-clause.f902
-rw-r--r--flang/test/Semantics/OpenMP/declare-target01.f902
-rw-r--r--flang/test/Semantics/OpenMP/flush02.f902
-rw-r--r--flang/test/Semantics/OpenMP/omp-atomic-assignment-stmt.f902
-rw-r--r--flang/test/Semantics/OpenMP/parallel-sections01.f902
-rw-r--r--flang/test/Semantics/OpenMP/resolve06.f902
-rw-r--r--flang/test/Semantics/OpenMP/sections02.f902
-rw-r--r--flang/test/Semantics/OpenMP/sync-critical02.f902
-rw-r--r--flang/test/Semantics/OpenMP/taskgroup01.f902
-rw-r--r--flang/test/Semantics/OpenMP/threadprivate01.f902
-rw-r--r--flang/test/lit.cfg.py4
-rw-r--r--flang/test/lit.site.cfg.py.in1
-rw-r--r--flang/tools/f18/CMakeLists.txt36
69 files changed, 208 insertions, 511 deletions
diff --git a/flang/module/omp_lib.f90 b/flang/module/omp_lib.f90
deleted file mode 100644
index 2ca15da..0000000
--- a/flang/module/omp_lib.f90
+++ /dev/null
@@ -1,13 +0,0 @@
-!===-- module/omp_lib.f90 --------------------------------------------------===!
-!
-! Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-! See https://llvm.org/LICENSE.txt for license information.
-! SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-!
-!===------------------------------------------------------------------------===!
-
-module omp_lib
-
-include "omp_lib.h"
-
-end module omp_lib
diff --git a/flang/module/omp_lib.h b/flang/module/omp_lib.h
deleted file mode 100644
index efc9ceb..0000000
--- a/flang/module/omp_lib.h
+++ /dev/null
@@ -1,454 +0,0 @@
-!===-- module/omp_lib.h ------------------------------------------*- F90 -*-===!
-!
-! Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-! See https://llvm.org/LICENSE.txt for license information.
-! SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-!
-!===------------------------------------------------------------------------===!
-
-!dir$ free
-
- integer, parameter :: omp_integer_kind = selected_int_kind(9) ! 32-bit int
- integer, parameter :: omp_logical_kind = 1 ! C_BOOL
-
- integer, parameter :: omp_sched_kind = omp_integer_kind
- integer, parameter :: omp_proc_bind_kind = omp_integer_kind
- integer, parameter :: omp_pause_resource_kind = omp_integer_kind
- integer, parameter :: omp_sync_hint_kind = omp_integer_kind
- integer, parameter :: omp_lock_hint_kind = omp_sync_hint_kind
- integer, parameter :: omp_event_handle_kind = omp_integer_kind
- integer, parameter :: omp_alloctrait_key_kind = omp_integer_kind
- integer, parameter :: omp_alloctrait_val_kind = omp_integer_kind
- integer, parameter :: omp_allocator_handle_kind = omp_integer_kind
- integer, parameter :: omp_memspace_handle_kind = omp_integer_kind
- integer, parameter :: omp_lock_kind = int_ptr_kind()
- integer, parameter :: omp_nest_lock_kind = int_ptr_kind()
- integer, parameter :: omp_depend_kind = omp_integer_kind
-
- integer(kind=omp_sched_kind), parameter :: &
- omp_sched_static = 1, &
- omp_sched_dynamic = 2, &
- omp_sched_guided = 3, &
- omp_sched_auto = 4
-
- integer(kind=omp_proc_bind_kind), parameter :: &
- omp_proc_bind_false = 0, &
- omp_proc_bind_true = 1, &
- omp_proc_bind_master = 2, &
- omp_proc_bind_close = 3, &
- omp_proc_bind_spread = 4
-
- integer(kind=omp_pause_resource_kind), parameter :: &
- omp_pause_soft = 1, &
- omp_pause_hard = 2
-
- integer(kind=omp_sync_hint_kind), parameter :: &
- omp_sync_hint_none = 0, &
- omp_sync_hint_uncontended = 1, &
- omp_sync_hint_contended = 2, &
- omp_sync_hint_nonspeculative = 4, &
- omp_sync_hint_speculative = 8
- integer(kind=omp_lock_hint_kind), parameter :: &
- omp_lock_hint_none = omp_sync_hint_none, &
- omp_lock_hint_uncontended = omp_sync_hint_uncontended, &
- omp_lock_hint_contended = omp_sync_hint_contended, &
- omp_lock_hint_nonspeculative = omp_sync_hint_nonspeculative, &
- omp_lock_hint_speculative = omp_sync_hint_speculative
-
- integer(kind=omp_event_handle_kind), parameter :: &
- omp_allow_completion_event = 0, &
- omp_task_fulfill_event = 1
-
- integer(kind=omp_alloctrait_key_kind), parameter :: &
- omp_atk_sync_hint = 1, &
- omp_atk_alignment = 2, &
- omp_atk_access = 3, &
- omp_atk_pool_size = 4, &
- omp_atk_fallback = 5, &
- omp_atk_fb_data = 6, &
- omp_atk_pinned = 7, &
- omp_atk_partition = 8
-
- integer(kind=omp_alloctrait_val_kind), parameter :: &
- omp_atv_false = 0, &
- omp_atv_true = 1, &
- omp_atv_default = 2, &
- omp_atv_contended = 3, &
- omp_atv_uncontended = 4, &
- omp_atv_sequential = 5, &
- omp_atv_private = 6, &
- omp_atv_all = 7, &
- omp_atv_thread = 8, &
- omp_atv_pteam = 9, &
- omp_atv_cgroup = 10, &
- omp_atv_default_mem_fb = 11, &
- omp_atv_null_fb = 12, &
- omp_atv_abort_fb = 13, &
- omp_atv_allocator_fb = 14, &
- omp_atv_environment = 15, &
- omp_atv_nearest = 16, &
- omp_atv_blocked = 17, &
- omp_atv_interleaved = 18
-
- type, bind(c) :: omp_alloctrait
- integer(kind=omp_alloctrait_key_kind) :: key, value
- end type omp_alloctrait
-
- integer(kind=omp_allocator_handle_kind), parameter :: omp_null_allocator = 0
-
- integer(kind=omp_memspace_handle_kind), parameter :: &
- omp_default_mem_space = 0, &
- omp_large_cap_mem_space = 0, &
- omp_const_mem_space = 0, &
- omp_high_bw_mem_space = 0, &
- omp_low_lat_mem_space = 0, &
- omp_default_mem_alloc = 1, &
- omp_large_cap_mem_alloc = omp_default_mem_alloc, &
- omp_const_mem_alloc = 1, &
- omp_high_bw_mem_alloc = 1, &
- omp_low_lat_mem_alloc = 1, &
- omp_thread_mem_alloc = omp_atv_thread, &
- omp_pteam_mem_alloc = omp_atv_pteam, &
- omp_cgroup_mem_alloc = omp_atv_cgroup
-
- integer(kind=omp_integer_kind), parameter :: openmp_version = 200805
-
- interface
-
- subroutine omp_set_num_threads(nthreads) bind(c)
- import
- integer(kind=omp_integer_kind), value :: nthreads
- end subroutine omp_set_num_threads
-
- function omp_get_num_threads() bind(c)
- import
- integer(kind=omp_integer_kind) :: omp_get_num_threads
- end function omp_get_num_threads
-
- function omp_get_max_threads() bind(c)
- import
- integer(kind=omp_integer_kind) :: omp_get_max_threads
- end function omp_get_max_threads
-
- function omp_get_thread_num() bind(c)
- import
- integer(kind=omp_integer_kind) :: omp_get_thread_num
- end function omp_get_thread_num
-
- function omp_get_num_procs() bind(c)
- import
- integer(kind=omp_integer_kind) :: omp_get_num_procs
- end function omp_get_num_procs
-
- function omp_in_parallel() bind(c)
- import
- logical(kind=omp_logical_kind) :: omp_in_parallel
- end function omp_in_parallel
-
- subroutine omp_set_dynamic(enable) bind(c)
- import
- logical(kind=omp_logical_kind), value :: enable
- end subroutine omp_set_dynamic
-
- function omp_get_dynamic() bind(c)
- import
- logical(kind=omp_logical_kind) :: omp_get_dynamic
- end function omp_get_dynamic
-
- function omp_get_cancelation() bind(c)
- import
- logical(kind=omp_logical_kind) :: omp_get_cancelation
- end function omp_get_cancelation
-
- subroutine omp_set_nested(enable) bind(c)
- import
- logical(kind=omp_logical_kind), value :: enable
- end subroutine omp_set_nested
-
- function omp_get_nested() bind(c)
- import
- logical(kind=omp_logical_kind) ::omp_get_nested
- end function omp_get_nested
-
- subroutine omp_set_schedule(kind, modifier) bind(c)
- import
- integer(kind=omp_integer_kind), value :: kind, modifier
- end subroutine omp_set_schedule
-
- subroutine omp_get_schedule(kind, modifier) bind(c)
- import
- integer(kind=omp_integer_kind), intent(out) :: kind, modifier
- end subroutine omp_get_schedule
-
- function omp_get_thread_limit() bind(c)
- import
- integer(kind=omp_integer_kind) :: omp_get_thread_limit
- end function omp_get_thread_limit
-
- function omp_get_supported_active_levels() bind(c)
- import
- integer(kind=omp_integer_kind) :: omp_get_supported_active_levels
- end function omp_get_supported_active_levels
-
- subroutine omp_set_max_active_levels(max_levels) bind(c)
- import
- integer(kind=omp_integer_kind), value :: max_levels
- end subroutine omp_set_max_active_levels
-
- function omp_get_max_active_levels() bind(c)
- import
- integer(kind=omp_integer_kind) :: omp_get_max_active_levels
- end function omp_get_max_active_levels
-
- function omp_get_level() bind(c)
- import
- integer(kind=omp_integer_kind) :: omp_get_level
- end function omp_get_level
-
- function omp_get_ancestor_thread_num(level) bind(c)
- import
- integer(kind=omp_integer_kind), value :: level
- integer(kind=omp_integer_kind) :: omp_get_ancestor_thread_num
- end function omp_get_ancestor_thread_num
-
- function omp_get_team_size(level) bind(c)
- import
- integer(kind=omp_integer_kind), value :: level
- integer(kind=omp_integer_kind) :: omp_get_team_size
- end function omp_get_team_size
-
- function omp_get_active_level() bind(c)
- import
- integer(kind=omp_integer_kind) :: omp_get_active_level
- end function omp_get_active_level
-
- function omp_in_final() bind(c)
- import
- logical(kind=omp_logical_kind) :: omp_in_final
- end function omp_in_final
-
- function omp_get_proc_bind() bind(c)
- import
- integer(kind=omp_proc_bind_kind) :: omp_get_proc_bind
- end function omp_get_proc_bind
-
- function omp_get_num_places() bind(c)
- import
- integer(kind=omp_integer_kind) :: omp_get_num_places
- end function omp_get_num_places
-
- function omp_get_place_num_procs(place_num) bind(c)
- import
- integer(kind=omp_integer_kind), value :: place_num
- integer(kind=omp_integer_kind) omp_get_place_num_procs
- end function omp_get_place_num_procs
-
- subroutine omp_get_place_proc_ids(place_num, ids) bind(c)
- import
- integer(kind=omp_integer_kind), value :: place_num
- integer(kind=omp_integer_kind), intent(out) :: ids(*)
- end subroutine omp_get_place_proc_ids
-
- function omp_get_place_num() bind(c)
- import
- integer(kind=omp_integer_kind) :: omp_get_place_num
- end function omp_get_place_num
-
- function omp_get_partition_num_places() bind(c)
- import
- integer(kind=omp_integer_kind) :: omp_get_partition_num_places
- end function omp_get_partition_num_places
-
- subroutine omp_get_partition_place_nums(place_nums) bind(c)
- import
- integer(kind=omp_integer_kind), intent(out) :: place_nums(*)
- end subroutine omp_get_partition_place_nums
-
- subroutine omp_set_affinity_format(format) bind(c)
- import
- character(len=*), intent(in) :: format
- end subroutine omp_set_affinity_format
-
- function omp_get_affinity_format(buffer) bind(c)
- import
- character(len=*), intent(out) :: buffer
- integer(kind=omp_integer_kind) :: omp_get_affinity_format
- end function omp_get_affinity_format
-
- subroutine omp_display_affinity(format) bind(c)
- import
- character(len=*), intent(in) :: format
- end subroutine omp_display_affinity
-
- function omp_capture_affinity(buffer, format) bind(c)
- import
- character(len=*), intent(out) :: buffer
- character(len=*), intent(in) :: format
- integer(kind=omp_integer_kind) omp_capture_affinity
- end function omp_capture_affinity
-
- subroutine omp_set_default_device(device_num) bind(c)
- import
- integer(kind=omp_integer_kind), value :: device_num
- end subroutine omp_set_default_device
-
- function omp_get_default_device() bind(c)
- import
- integer(kind=omp_integer_kind) :: omp_get_default_device
- end function omp_get_default_device
-
- function omp_get_num_devices() bind(c)
- import
- integer(kind=omp_integer_kind) :: omp_get_num_devices
- end function omp_get_num_devices
-
- function omp_get_device_num() bind(c)
- import
- integer(kind=omp_integer_kind) :: omp_get_device_num
- end function omp_get_device_num
-
- function omp_get_num_teams() bind(c)
- import
- integer(kind=omp_integer_kind) :: omp_get_num_teams
- end function omp_get_num_teams
-
- function omp_get_team_num() bind(c)
- import
- integer(kind=omp_integer_kind) :: omp_get_team_num
- end function omp_get_team_num
-
- function omp_is_initial_device() bind(c)
- import
- integer(kind=omp_logical_kind) :: omp_is_initial_device ! TODO: should this be LOGICAL?
- end function omp_is_initial_device
-
- function omp_get_initial_device() bind(c)
- import
- integer(kind=omp_integer_kind) :: omp_get_initial_device
- end function omp_get_initial_device
-
- function omp_get_max_task_priority() bind(c)
- import
- integer(kind=omp_integer_kind) :: omp_get_max_task_priority
- end function omp_get_max_task_priority
-
- function omp_pause_resource(kind, device_num) bind(c)
- import
- integer(kind=omp_pause_resource_kind), value :: kind
- integer(kind=omp_integer_kind), value :: device_num
- integer(kind=omp_integer_kind) :: omp_pause_resource
- end function omp_pause_resource
-
- function omp_pause_resource_all(kind) bind(c)
- import
- integer(kind=omp_pause_resource_kind), value :: kind
- integer(kind=omp_integer_kind) :: omp_pause_resource_all
- end function omp_pause_resource_all
-
-! Lock routines
- subroutine omp_init_lock(lockvar) bind(c, name="omp_init_lock_")
- import
- integer(kind=omp_lock_kind), intent(out) :: lockvar
- end subroutine omp_init_lock
-
- subroutine omp_init_lock_with_hint(lockvar, hint) bind(c, name="omp_init_lock_with_hint_")
- import
- integer(kind=omp_lock_kind), intent(out) :: lockvar
- integer(kind=omp_sync_hint_kind), value :: hint
- end subroutine omp_init_lock_with_hint
-
- subroutine omp_destroy_lock(lockvar) bind(c, name="omp_destroy_lock_")
- import
- integer(kind=omp_lock_kind), intent(inout) :: lockvar
- end subroutine omp_destroy_lock
-
- subroutine omp_set_lock(lockvar) bind(c, name="omp_set_lock_")
- import
- integer(kind=omp_lock_kind), intent(inout) :: lockvar
- end subroutine omp_set_lock
-
- subroutine omp_unset_lock(lockvar) bind(c, name="omp_unset_lock_")
- import
- integer(kind=omp_lock_kind), intent(inout) :: lockvar
- end subroutine omp_unset_lock
-
- function omp_test_lock(lockvar) bind(c, name="omp_test_lock_")
- import
- integer(kind=omp_lock_kind), intent(inout) :: lockvar
- logical(kind=omp_logical_kind) :: omp_test_lock
- end function omp_test_lock
-
- subroutine omp_init_nest_lock(lockvar) bind(c, name="omp_init_nest_lock_")
- import
- integer(kind=omp_nest_lock_kind), intent(out) :: lockvar
- end subroutine omp_init_nest_lock
-
- subroutine omp_init_nest_lock_with_hint(lockvar, hint) bind(c, name="omp_init_nest_lock_with_hint_")
- import
- integer(kind=omp_nest_lock_kind), intent(out) :: lockvar
- integer(kind=omp_sync_hint_kind), value :: hint
- end subroutine omp_init_nest_lock_with_hint
-
- subroutine omp_destroy_nest_lock(lockvar) bind(c, name="omp_destroy_nest_lock_")
- import
- integer(kind=omp_nest_lock_kind), intent(inout) :: lockvar
- end subroutine omp_destroy_nest_lock
-
- subroutine omp_set_nest_lock(lockvar) bind(c, name="omp_set_nest_lock_")
- import
- integer(kind=omp_nest_lock_kind), intent(inout) :: lockvar
- end subroutine omp_set_nest_lock
-
- subroutine omp_unset_nest_lock(lockvar) bind(c, name="omp_unset_nest_lock_")
- import
- integer(kind=omp_nest_lock_kind), intent(inout) :: lockvar
- end subroutine omp_unset_nest_lock
-
- function omp_test_nest_lock(lockvar) bind(c, name="omp_test_nest_lock_")
- import
- integer(kind=omp_integer_kind) :: omp_test_nest_lock
- integer(kind=omp_nest_lock_kind), intent(inout) :: lockvar
- end function omp_test_nest_lock
-
-! Timing routines
- function omp_get_wtime() bind(c)
- double precision omp_get_wtime
- end function omp_get_wtime
-
- function omp_get_wtick() bind(c)
- double precision omp_get_wtick
- end function omp_get_wtick
-
-! Event routine
- subroutine omp_fullfill_event(event) bind(c) ! TODO: is this the correct spelling?
- import
- integer(kind=omp_event_handle_kind) :: event
- end subroutine omp_fullfill_event
-
-! Device Memory Routines
-
-! Memory Management Routines
- function omp_init_allocator(memspace, ntraits, traits) bind(c)
- import
- integer(kind=omp_memspace_handle_kind), value :: memspace
- integer, value :: ntraits
- type(omp_alloctrait), intent(in) :: traits(*)
- integer(kind=omp_allocator_handle_kind) :: omp_init_allocator
- end function omp_init_allocator
-
- subroutine omp_destroy_allocator(allocator) bind(c)
- import
- integer(kind=omp_allocator_handle_kind), value :: allocator
- end subroutine omp_destroy_allocator
-
- subroutine omp_set_default_allocator(allocator) bind(c)
- import
- integer(kind=omp_allocator_handle_kind), value :: allocator
- end subroutine omp_set_default_allocator
-
- function omp_get_default_allocator() bind(c)
- import
- integer(kind=omp_allocator_handle_kind) :: omp_get_default_allocator
- end function omp_get_default_allocator
-
- end interface
diff --git a/flang/test/Driver/include-omp-header.f90 b/flang/test/Driver/include-omp-header.f90
index 4bf43bb..6ddc6f3 100644
--- a/flang/test/Driver/include-omp-header.f90
+++ b/flang/test/Driver/include-omp-header.f90
@@ -1,3 +1,5 @@
+! REQUIRES: openmp_runtime
+
! Verify that the omp_lib.h header is found and included correctly. This header file should be available at a path:
! * relative to the driver, that's
! * known the driver.
@@ -7,11 +9,11 @@
! This should just work
! RUN: not rm omp_lib.h
-! RUN: %flang -fsyntax-only -fopenmp %s 2>&1
+! RUN: %flang -cpp -fsyntax-only -fopenmp %s 2>&1
! Create an empty omp_lib.h header that _does not_ define omp_default_mem_alloc - this should lead to semantic errors
! RUN: touch omp_lib.h
-! RUN: not %flang -fsyntax-only -fopenmp %s 2>&1 | FileCheck %s
+! RUN: not %flang -cpp -fsyntax-only -fopenmp %s 2>&1 | FileCheck %s
! RUN: rm omp_lib.h
! CHECK: error: Must have INTEGER type, but is REAL(4)
diff --git a/flang/test/Lower/OpenMP/FIR/atomic-capture.f90 b/flang/test/Lower/OpenMP/FIR/atomic-capture.f90
index 024400a..9b94214 100644
--- a/flang/test/Lower/OpenMP/FIR/atomic-capture.f90
+++ b/flang/test/Lower/OpenMP/FIR/atomic-capture.f90
@@ -1,3 +1,5 @@
+! REQUIRES: openmp_runtime
+
! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | FileCheck %s
! This test checks the lowering of atomic capture
diff --git a/flang/test/Lower/OpenMP/FIR/atomic-read.f90 b/flang/test/Lower/OpenMP/FIR/atomic-read.f90
index 66be9e7..7698c3d 100644
--- a/flang/test/Lower/OpenMP/FIR/atomic-read.f90
+++ b/flang/test/Lower/OpenMP/FIR/atomic-read.f90
@@ -1,3 +1,5 @@
+! REQUIRES: openmp_runtime
+
! RUN: bbc --use-desc-for-alloc=false -fopenmp -emit-fir -hlfir=false %s -o - | FileCheck %s
! This test checks the lowering of atomic read
diff --git a/flang/test/Lower/OpenMP/FIR/atomic-update.f90 b/flang/test/Lower/OpenMP/FIR/atomic-update.f90
index bd3d4ac..ae20180 100644
--- a/flang/test/Lower/OpenMP/FIR/atomic-update.f90
+++ b/flang/test/Lower/OpenMP/FIR/atomic-update.f90
@@ -1,3 +1,5 @@
+! REQUIRES: openmp_runtime
+
! This test checks lowering of atomic and atomic update constructs
! RUN: bbc --use-desc-for-alloc=false -fopenmp -emit-fir -hlfir=false %s -o - | FileCheck %s
! RUN: %flang_fc1 -mllvm --use-desc-for-alloc=false -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | FileCheck %s
diff --git a/flang/test/Lower/OpenMP/FIR/atomic-write.f90 b/flang/test/Lower/OpenMP/FIR/atomic-write.f90
index 5d98176..142481b 100644
--- a/flang/test/Lower/OpenMP/FIR/atomic-write.f90
+++ b/flang/test/Lower/OpenMP/FIR/atomic-write.f90
@@ -1,3 +1,5 @@
+! REQUIRES: openmp_runtime
+
! RUN: bbc --use-desc-for-alloc=false -fopenmp -emit-fir -hlfir=false %s -o - | FileCheck %s
! This test checks the lowering of atomic write
diff --git a/flang/test/Lower/OpenMP/FIR/critical.f90 b/flang/test/Lower/OpenMP/FIR/critical.f90
index e881784..fa33fb0 100644
--- a/flang/test/Lower/OpenMP/FIR/critical.f90
+++ b/flang/test/Lower/OpenMP/FIR/critical.f90
@@ -1,3 +1,5 @@
+! REQUIRES: openmp_runtime
+
!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | FileCheck %s --check-prefixes="OMPDialect"
!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | fir-opt --fir-to-llvm-ir | FileCheck %s --check-prefix="OMPDialect"
!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | fir-opt --fir-to-llvm-ir | tco | FileCheck %s --check-prefix="LLVMIR"
diff --git a/flang/test/Lower/OpenMP/FIR/parallel-sections.f90 b/flang/test/Lower/OpenMP/FIR/parallel-sections.f90
index 78d73f0..0c0834c 100644
--- a/flang/test/Lower/OpenMP/FIR/parallel-sections.f90
+++ b/flang/test/Lower/OpenMP/FIR/parallel-sections.f90
@@ -1,3 +1,5 @@
+! REQUIRES: openmp_runtime
+
!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | FileCheck %s --check-prefixes="FIRDialect,OMPDialect"
!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | fir-opt --cfg-conversion-on-func-opt | fir-opt --fir-to-llvm-ir | FileCheck %s --check-prefixes="OMPDialect,LLVMDialect"
@@ -38,16 +40,16 @@ end subroutine omp_parallel_sections
subroutine omp_parallel_sections_allocate(x, y)
use omp_lib
integer, intent(inout) :: x, y
- !FIRDialect: %[[allocator_1:.*]] = arith.constant 1 : i32
- !FIRDialect: %[[allocator_2:.*]] = arith.constant 1 : i32
- !LLVMDialect: %[[allocator_1:.*]] = llvm.mlir.constant(1 : i32) : i32
- !LLVMDialect: %[[allocator_2:.*]] = llvm.mlir.constant(1 : i32) : i32
+ !FIRDialect: %[[allocator_1:.*]] = arith.constant 4 : i64
+ !FIRDialect: %[[allocator_2:.*]] = arith.constant 4 : i64
+ !LLVMDialect: %[[allocator_1:.*]] = llvm.mlir.constant(4 : i64) : i64
+ !LLVMDialect: %[[allocator_2:.*]] = llvm.mlir.constant(4 : i64) : i64
!OMPDialect: omp.parallel allocate(
- !FIRDialect: %[[allocator_2]] : i32 -> %{{.*}} : !fir.ref<i32>) {
- !LLVMDialect: %[[allocator_2]] : i32 -> %{{.*}} : !llvm.ptr) {
+ !FIRDialect: %[[allocator_2]] : i64 -> %{{.*}} : !fir.ref<i32>) {
+ !LLVMDialect: %[[allocator_2]] : i64 -> %{{.*}} : !llvm.ptr) {
!OMPDialect: omp.sections allocate(
- !FIRDialect: %[[allocator_1]] : i32 -> %{{.*}} : !fir.ref<i32>) {
- !LLVMDialect: %[[allocator_1]] : i32 -> %{{.*}} : !llvm.ptr) {
+ !FIRDialect: %[[allocator_1]] : i64 -> %{{.*}} : !fir.ref<i32>) {
+ !LLVMDialect: %[[allocator_1]] : i64 -> %{{.*}} : !llvm.ptr) {
!$omp parallel sections allocate(omp_high_bw_mem_alloc: x)
!OMPDialect: omp.section {
!$omp section
diff --git a/flang/test/Lower/OpenMP/FIR/parallel.f90 b/flang/test/Lower/OpenMP/FIR/parallel.f90
index b68551d..a2ceb2d 100644
--- a/flang/test/Lower/OpenMP/FIR/parallel.f90
+++ b/flang/test/Lower/OpenMP/FIR/parallel.f90
@@ -1,3 +1,5 @@
+! REQUIRES: openmp_runtime
+
!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | FileCheck %s --check-prefixes="FIRDialect,OMPDialect"
!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | fir-opt --fir-to-llvm-ir | FileCheck %s --check-prefixes="LLVMDialect,OMPDialect"
@@ -153,8 +155,8 @@ subroutine parallel_allocate()
use omp_lib
integer :: x
!OMPDialect: omp.parallel allocate(
- !FIRDialect: %{{.+}} : i32 -> %{{.+}} : !fir.ref<i32>
- !LLVMDialect: %{{.+}} : i32 -> %{{.+}} : !llvm.ptr
+ !FIRDialect: %{{.+}} : i64 -> %{{.+}} : !fir.ref<i32>
+ !LLVMDialect: %{{.+}} : i64 -> %{{.+}} : !llvm.ptr
!OMPDialect: ) {
!$omp parallel allocate(omp_high_bw_mem_alloc: x) private(x)
!FIRDialect: arith.addi
@@ -195,8 +197,8 @@ subroutine parallel_multiple_clauses(alpha, num_threads)
!$omp end parallel
!OMPDialect: omp.parallel if({{.*}} : i1) num_threads({{.*}} : i32) allocate(
- !FIRDialect: %{{.+}} : i32 -> %{{.+}} : !fir.ref<i32>
- !LLVMDialect: %{{.+}} : i32 -> %{{.+}} : !llvm.ptr
+ !FIRDialect: %{{.+}} : i64 -> %{{.+}} : !fir.ref<i32>
+ !LLVMDialect: %{{.+}} : i64 -> %{{.+}} : !llvm.ptr
!OMPDialect: ) {
!$omp parallel num_threads(num_threads) if(alpha .le. 0) allocate(omp_high_bw_mem_alloc: alpha) private(alpha)
!FIRDialect: fir.call
diff --git a/flang/test/Lower/OpenMP/FIR/sections.f90 b/flang/test/Lower/OpenMP/FIR/sections.f90
index 640ec34..7b313f3 100644
--- a/flang/test/Lower/OpenMP/FIR/sections.f90
+++ b/flang/test/Lower/OpenMP/FIR/sections.f90
@@ -1,3 +1,5 @@
+! REQUIRES: openmp_runtime
+
! This test checks the lowering of OpenMP sections construct with several clauses present
! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | FileCheck %s
@@ -5,8 +7,8 @@
!CHECK: func @_QQmain() attributes {fir.bindc_name = "sample"} {
!CHECK: %[[COUNT:.*]] = fir.address_of(@_QFEcount) : !fir.ref<i32>
!CHECK: %[[ETA:.*]] = fir.alloca f32 {bindc_name = "eta", uniq_name = "_QFEeta"}
-!CHECK: %[[CONST_1:.*]] = arith.constant 1 : i32
-!CHECK: omp.sections allocate(%[[CONST_1]] : i32 -> %0 : !fir.ref<i32>) {
+!CHECK: %[[CONST_1:.*]] = arith.constant 4 : i64
+!CHECK: omp.sections allocate(%[[CONST_1]] : i64 -> %0 : !fir.ref<i32>) {
!CHECK: omp.section {
!CHECK: %[[PRIVATE_ETA:.*]] = fir.alloca f32 {bindc_name = "eta", pinned, uniq_name = "_QFEeta"}
!CHECK: %[[PRIVATE_DOUBLE_COUNT:.*]] = fir.alloca i32 {bindc_name = "double_count", pinned, uniq_name = "_QFEdouble_count"}
diff --git a/flang/test/Lower/OpenMP/FIR/single.f90 b/flang/test/Lower/OpenMP/FIR/single.f90
index 266f6d9..65ae07c 100644
--- a/flang/test/Lower/OpenMP/FIR/single.f90
+++ b/flang/test/Lower/OpenMP/FIR/single.f90
@@ -1,3 +1,5 @@
+! REQUIRES: openmp_runtime
+
!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | FileCheck %s
!RUN: bbc -emit-fir -hlfir=false -fopenmp %s -o - | FileCheck %s
@@ -55,7 +57,7 @@ subroutine single_allocate()
integer :: x
!CHECK: omp.parallel {
!$omp parallel
- !CHECK: omp.single allocate(%{{.+}} : i32 -> %{{.+}} : !fir.ref<i32>) {
+ !CHECK: omp.single allocate(%{{.+}} : i64 -> %{{.+}} : !fir.ref<i32>) {
!$omp single allocate(omp_high_bw_mem_alloc: x) private(x)
!CHECK: arith.addi
x = x + 12
diff --git a/flang/test/Lower/OpenMP/FIR/task.f90 b/flang/test/Lower/OpenMP/FIR/task.f90
index 4e7e545..012ac75 100644
--- a/flang/test/Lower/OpenMP/FIR/task.f90
+++ b/flang/test/Lower/OpenMP/FIR/task.f90
@@ -1,3 +1,5 @@
+! REQUIRES: openmp_runtime
+
!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | FileCheck %s
!CHECK-LABEL: func @_QPomp_task_simple() {
@@ -63,7 +65,7 @@ end subroutine omp_task_priority
subroutine task_allocate()
use omp_lib
integer :: x
- !CHECK: omp.task allocate(%{{.+}} : i32 -> %{{.+}} : !fir.ref<i32>) {
+ !CHECK: omp.task allocate(%{{.+}} : i64 -> %{{.+}} : !fir.ref<i32>) {
!$omp task allocate(omp_high_bw_mem_alloc: x) private(x)
!CHECK: arith.addi
x = x + 12
@@ -217,7 +219,7 @@ subroutine task_multiple_clauses()
integer :: x, y, z
logical :: buzz
- !CHECK: omp.task if(%{{.+}}) final(%{{.+}}) priority(%{{.+}}) allocate(%{{.+}} : i32 -> %{{.+}} : !fir.ref<i32>) {
+ !CHECK: omp.task if(%{{.+}}) final(%{{.+}}) priority(%{{.+}}) allocate(%{{.+}} : i64 -> %{{.+}} : !fir.ref<i32>) {
!$omp task if(buzz) final(buzz) priority(z) allocate(omp_high_bw_mem_alloc: x) private(x) firstprivate(y)
!CHECK: %[[x_priv:.+]] = fir.alloca i32
diff --git a/flang/test/Lower/OpenMP/FIR/taskgroup.f90 b/flang/test/Lower/OpenMP/FIR/taskgroup.f90
index 55aba3d..78b9da8e 100644
--- a/flang/test/Lower/OpenMP/FIR/taskgroup.f90
+++ b/flang/test/Lower/OpenMP/FIR/taskgroup.f90
@@ -1,3 +1,5 @@
+! REQUIRES: openmp_runtime
+
!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | FileCheck %s
!CHECK-LABEL: @_QPomp_taskgroup
@@ -5,9 +7,9 @@ subroutine omp_taskgroup
use omp_lib
integer :: allocated_x
!CHECK-DAG: %{{.*}} = fir.alloca i32 {bindc_name = "allocated_x", uniq_name = "_QFomp_taskgroupEallocated_x"}
-!CHECK-DAG: %{{.*}} = arith.constant 1 : i32
+!CHECK-DAG: %{{.*}} = arith.constant 4 : i64
-!CHECK: omp.taskgroup allocate(%{{.*}} : i32 -> %0 : !fir.ref<i32>)
+!CHECK: omp.taskgroup allocate(%{{.*}} : i64 -> %0 : !fir.ref<i32>)
!$omp taskgroup allocate(omp_high_bw_mem_alloc: allocated_x)
!$omp task
!CHECK: fir.call @_QPwork() {{.*}}: () -> ()
diff --git a/flang/test/Lower/OpenMP/FIR/teams.f90 b/flang/test/Lower/OpenMP/FIR/teams.f90
index 51f9087..9c0593a 100644
--- a/flang/test/Lower/OpenMP/FIR/teams.f90
+++ b/flang/test/Lower/OpenMP/FIR/teams.f90
@@ -1,3 +1,5 @@
+! REQUIRES: openmp_runtime
+
! RUN: %flang_fc1 -emit-fir -fopenmp %s -o - | FileCheck %s
! CHECK-LABEL: func @_QPteams_simple
@@ -104,8 +106,9 @@ end subroutine teams_threadlimit
subroutine teams_allocate()
use omp_lib
integer :: x
+ integer :: y
! CHECK: omp.teams
- ! CHECK-SAME: allocate(%{{.+}} : i32 -> %{{.+}} : !fir.ref<i32>)
+ ! CHECK-SAME: allocate(%{{.+}} : i64 -> %{{.+}} : !fir.ref<i32>)
!$omp teams allocate(omp_high_bw_mem_alloc: x) private(x)
! CHECK: arith.addi
x = x + 12
diff --git a/flang/test/Lower/OpenMP/atomic-capture.f90 b/flang/test/Lower/OpenMP/atomic-capture.f90
index cde0281..2587c24 100644
--- a/flang/test/Lower/OpenMP/atomic-capture.f90
+++ b/flang/test/Lower/OpenMP/atomic-capture.f90
@@ -1,3 +1,5 @@
+! REQUIRES: openmp_runtime
+
! This test checks the lowering of atomic capture
! RUN: bbc -fopenmp -emit-hlfir %s -o - | FileCheck %s
diff --git a/flang/test/Lower/OpenMP/atomic-read.f90 b/flang/test/Lower/OpenMP/atomic-read.f90
index 97a3777..366da21 100644
--- a/flang/test/Lower/OpenMP/atomic-read.f90
+++ b/flang/test/Lower/OpenMP/atomic-read.f90
@@ -1,3 +1,5 @@
+! REQUIRES: openmp_runtime
+
! RUN: bbc -fopenmp -emit-hlfir %s -o - | FileCheck %s
! This test checks the lowering of atomic read
diff --git a/flang/test/Lower/OpenMP/atomic-update.f90 b/flang/test/Lower/OpenMP/atomic-update.f90
index 10da97c..051779e 100644
--- a/flang/test/Lower/OpenMP/atomic-update.f90
+++ b/flang/test/Lower/OpenMP/atomic-update.f90
@@ -1,3 +1,5 @@
+! REQUIRES: openmp_runtime
+
! This test checks lowering of atomic and atomic update constructs
! RUN: bbc -fopenmp -emit-hlfir %s -o - | FileCheck %s
! RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s
diff --git a/flang/test/Lower/OpenMP/atomic-write.f90 b/flang/test/Lower/OpenMP/atomic-write.f90
index 119f60c..85955af 100644
--- a/flang/test/Lower/OpenMP/atomic-write.f90
+++ b/flang/test/Lower/OpenMP/atomic-write.f90
@@ -1,3 +1,5 @@
+! REQUIRES: openmp_runtime
+
! RUN: bbc -fopenmp -emit-hlfir %s -o - | FileCheck %s
! This test checks the lowering of atomic write
@@ -21,8 +23,8 @@
!CHECK: %[[Z_VAL:.*]] = fir.load %[[Z_DECL]]#0 : !fir.ref<i32>
!CHECK: %[[C2:.*]] = arith.constant 2 : i32
!CHECK: %[[Z_DIV_2:.*]] = arith.divsi %[[Z_VAL]], %[[C2]] : i32
-!CHECK: %172 = arith.addi %[[TEN_X]], %[[Z_DIV_2]] : i32
-!CHECK: omp.atomic.write %163#1 = %172 hint(speculative) memory_order(release) : !fir.ref<i32>, i32
+!CHECK: %[[ADD_RES:.*]] = arith.addi %[[TEN_X]], %[[Z_DIV_2]] : i32
+!CHECK: omp.atomic.write %[[Y_DECL]]#1 = %[[ADD_RES]] hint(speculative) memory_order(release) : !fir.ref<i32>, i32
program OmpAtomicWrite
use omp_lib
diff --git a/flang/test/Lower/OpenMP/critical.f90 b/flang/test/Lower/OpenMP/critical.f90
index 5a4d2e4..38e6d0e 100644
--- a/flang/test/Lower/OpenMP/critical.f90
+++ b/flang/test/Lower/OpenMP/critical.f90
@@ -1,3 +1,5 @@
+! REQUIRES: openmp_runtime
+
!RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s
!CHECK: omp.critical.declare @help2
diff --git a/flang/test/Lower/OpenMP/omp-lib-num-threads.f90 b/flang/test/Lower/OpenMP/omp-lib-num-threads.f90
index e1af7d3..d2b558a 100644
--- a/flang/test/Lower/OpenMP/omp-lib-num-threads.f90
+++ b/flang/test/Lower/OpenMP/omp-lib-num-threads.f90
@@ -1,3 +1,5 @@
+! REQUIRES: openmp_runtime
+
! RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - 2>&1 | FileCheck %s
! RUN: bbc -fopenmp -emit-hlfir -o - %s 2>&1 | FileCheck %s
! RUN: %flang_fc1 -emit-fir -fopenmp %s -o - 2>&1 | FileCheck %s
diff --git a/flang/test/Lower/OpenMP/parallel-sections.f90 b/flang/test/Lower/OpenMP/parallel-sections.f90
index 77139e4..2f78dd4 100644
--- a/flang/test/Lower/OpenMP/parallel-sections.f90
+++ b/flang/test/Lower/OpenMP/parallel-sections.f90
@@ -1,3 +1,5 @@
+! REQUIRES: openmp_runtime
+
!RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s
!===============================================================================
@@ -37,12 +39,12 @@ end subroutine omp_parallel_sections
subroutine omp_parallel_sections_allocate(x, y)
use omp_lib
integer, intent(inout) :: x, y
- !CHECK: %[[allocator_1:.*]] = arith.constant 1 : i32
- !CHECK: %[[allocator_2:.*]] = arith.constant 1 : i32
+ !CHECK: %[[allocator_1:.*]] = arith.constant 4 : i64
+ !CHECK: %[[allocator_2:.*]] = arith.constant 4 : i64
!CHECK: omp.parallel allocate(
- !CHECK: %[[allocator_2]] : i32 -> %{{.*}} : !fir.ref<i32>) {
+ !CHECK: %[[allocator_2]] : i64 -> %{{.*}} : !fir.ref<i32>) {
!CHECK: omp.sections allocate(
- !CHECK: %[[allocator_1]] : i32 -> %{{.*}} : !fir.ref<i32>) {
+ !CHECK: %[[allocator_1]] : i64 -> %{{.*}} : !fir.ref<i32>) {
!$omp parallel sections allocate(omp_high_bw_mem_alloc: x)
!CHECK: omp.section {
!$omp section
diff --git a/flang/test/Lower/OpenMP/parallel.f90 b/flang/test/Lower/OpenMP/parallel.f90
index 0e43244..6c062b70 100644
--- a/flang/test/Lower/OpenMP/parallel.f90
+++ b/flang/test/Lower/OpenMP/parallel.f90
@@ -1,3 +1,5 @@
+! REQUIRES: openmp_runtime
+
!RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s
!CHECK-LABEL: func @_QPparallel_simple
@@ -152,7 +154,7 @@ subroutine parallel_allocate()
use omp_lib
integer :: x
!CHECK: omp.parallel allocate(
- !CHECK: %{{.+}} : i32 -> %{{.+}} : !fir.ref<i32>
+ !CHECK: %{{.+}} : i64 -> %{{.+}} : !fir.ref<i32>
!CHECK: ) {
!$omp parallel allocate(omp_high_bw_mem_alloc: x) private(x)
!CHECK: arith.addi
@@ -193,7 +195,7 @@ subroutine parallel_multiple_clauses(alpha, num_threads)
!$omp end parallel
!CHECK: omp.parallel if({{.*}} : i1) num_threads({{.*}} : i32) allocate(
- !CHECK: %{{.+}} : i32 -> %{{.+}} : !fir.ref<i32>
+ !CHECK: %{{.+}} : i64 -> %{{.+}} : !fir.ref<i32>
!CHECK: ) {
!$omp parallel num_threads(num_threads) if(alpha .le. 0) allocate(omp_high_bw_mem_alloc: alpha) private(alpha)
!CHECK: fir.call
diff --git a/flang/test/Lower/OpenMP/sections.f90 b/flang/test/Lower/OpenMP/sections.f90
index 6bad688..018848e 100644
--- a/flang/test/Lower/OpenMP/sections.f90
+++ b/flang/test/Lower/OpenMP/sections.f90
@@ -1,3 +1,5 @@
+! REQUIRES: openmp_runtime
+
! This test checks the lowering of OpenMP sections construct with several clauses present
! RUN: %flang_fc1 -flang-experimental-hlfir -emit-hlfir -fopenmp %s -o - | FileCheck %s
@@ -7,8 +9,8 @@
!CHECK: %[[COUNT:.*]] = fir.address_of(@_QFEcount) : !fir.ref<i32>
!CHECK: %[[COUNT_DECL:.*]]:2 = hlfir.declare %[[COUNT]] {uniq_name = "_QFEcount"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
!CHECK: %[[ETA:.*]] = fir.alloca f32 {bindc_name = "eta", uniq_name = "_QFEeta"}
-!CHECK: %[[CONST_1:.*]] = arith.constant 1 : i32
-!CHECK: omp.sections allocate(%[[CONST_1]] : i32 -> %[[COUNT_DECL]]#1 : !fir.ref<i32>) {
+!CHECK: %[[CONST_1:.*]] = arith.constant 4 : i64
+!CHECK: omp.sections allocate(%[[CONST_1]] : i64 -> %[[COUNT_DECL]]#1 : !fir.ref<i32>) {
!CHECK: omp.section {
!CHECK: %[[PRIVATE_ETA:.*]] = fir.alloca f32 {bindc_name = "eta", pinned, uniq_name = "_QFEeta"}
!CHECK: %[[PRIVATE_ETA_DECL:.*]]:2 = hlfir.declare %[[PRIVATE_ETA]] {uniq_name = "_QFEeta"} : (!fir.ref<f32>) -> (!fir.ref<f32>, !fir.ref<f32>)
diff --git a/flang/test/Lower/OpenMP/single.f90 b/flang/test/Lower/OpenMP/single.f90
index ffc41af..10d537a 100644
--- a/flang/test/Lower/OpenMP/single.f90
+++ b/flang/test/Lower/OpenMP/single.f90
@@ -1,3 +1,5 @@
+! REQUIRES: openmp_runtime
+
!RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s
!RUN: bbc -emit-hlfir -fopenmp %s -o - | FileCheck %s
@@ -57,7 +59,7 @@ subroutine single_allocate()
integer :: x
!CHECK: omp.parallel {
!$omp parallel
- !CHECK: omp.single allocate(%{{.+}} : i32 -> %{{.+}} : !fir.ref<i32>) {
+ !CHECK: omp.single allocate(%{{.+}} : i64 -> %{{.+}} : !fir.ref<i32>) {
!$omp single allocate(omp_high_bw_mem_alloc: x) private(x)
!CHECK: arith.addi
x = x + 12
diff --git a/flang/test/Lower/OpenMP/task.f90 b/flang/test/Lower/OpenMP/task.f90
index 7d7a79a..f3718b8 100644
--- a/flang/test/Lower/OpenMP/task.f90
+++ b/flang/test/Lower/OpenMP/task.f90
@@ -1,3 +1,5 @@
+! REQUIRES: openmp_runtime
+
!RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s
!CHECK-LABEL: func @_QPomp_task_simple() {
@@ -63,7 +65,7 @@ end subroutine omp_task_priority
subroutine task_allocate()
use omp_lib
integer :: x
- !CHECK: omp.task allocate(%{{.+}} : i32 -> %{{.+}} : !fir.ref<i32>) {
+ !CHECK: omp.task allocate(%{{.+}} : i64 -> %{{.+}} : !fir.ref<i32>) {
!$omp task allocate(omp_high_bw_mem_alloc: x) private(x)
!CHECK: arith.addi
x = x + 12
@@ -225,7 +227,7 @@ subroutine task_multiple_clauses()
integer :: x, y, z
logical :: buzz
- !CHECK: omp.task if(%{{.+}}) final(%{{.+}}) priority(%{{.+}}) allocate(%{{.+}} : i32 -> %{{.+}} : !fir.ref<i32>) {
+ !CHECK: omp.task if(%{{.+}}) final(%{{.+}}) priority(%{{.+}}) allocate(%{{.+}} : i64 -> %{{.+}} : !fir.ref<i32>) {
!$omp task if(buzz) final(buzz) priority(z) allocate(omp_high_bw_mem_alloc: x) private(x) firstprivate(y)
!CHECK: %[[X_PRIV_ALLOCA:.+]] = fir.alloca i32 {bindc_name = "x", pinned, uniq_name = "_QFtask_multiple_clausesEx"}
diff --git a/flang/test/Lower/OpenMP/taskgroup.f90 b/flang/test/Lower/OpenMP/taskgroup.f90
index 85dc253..76458f1 100644
--- a/flang/test/Lower/OpenMP/taskgroup.f90
+++ b/flang/test/Lower/OpenMP/taskgroup.f90
@@ -1,3 +1,5 @@
+! REQUIRES: openmp_runtime
+
!RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s
!CHECK-LABEL: @_QPomp_taskgroup
@@ -6,9 +8,9 @@ use omp_lib
integer :: allocated_x
!CHECK: %[[ALLOC_X_REF:.*]] = fir.alloca i32 {bindc_name = "allocated_x", uniq_name = "_QFomp_taskgroupEallocated_x"}
!CHECK-NEXT: %[[ALLOC_X_DECL:.*]]:2 = hlfir.declare %[[ALLOC_X_REF]] {uniq_name = "_QFomp_taskgroupEallocated_x"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
-!CHECK: %[[C1:.*]] = arith.constant 1 : i32
+!CHECK: %[[C4:.*]] = arith.constant 4 : i64
-!CHECK: omp.taskgroup allocate(%[[C1]] : i32 -> %[[ALLOC_X_DECL]]#1 : !fir.ref<i32>)
+!CHECK: omp.taskgroup allocate(%[[C4]] : i64 -> %[[ALLOC_X_DECL]]#1 : !fir.ref<i32>)
!$omp taskgroup allocate(omp_high_bw_mem_alloc: allocated_x)
!$omp task
!CHECK: fir.call @_QPwork() {{.*}}: () -> ()
diff --git a/flang/test/Lower/OpenMP/teams.f90 b/flang/test/Lower/OpenMP/teams.f90
index 2620d77..f122a57 100644
--- a/flang/test/Lower/OpenMP/teams.f90
+++ b/flang/test/Lower/OpenMP/teams.f90
@@ -1,3 +1,5 @@
+! REQUIRES: openmp_runtime
+
! RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s
! CHECK-LABEL: func @_QPteams_simple
@@ -105,7 +107,7 @@ subroutine teams_allocate()
use omp_lib
integer :: x
! CHECK: omp.teams
- ! CHECK-SAME: allocate(%{{.+}} : i32 -> %{{.+}} : !fir.ref<i32>)
+ ! CHECK-SAME: allocate(%{{.+}} : i64 -> %{{.+}} : !fir.ref<i32>)
!$omp teams allocate(omp_high_bw_mem_alloc: x) private(x)
! CHECK: arith.addi
x = x + 12
diff --git a/flang/test/Lower/OpenMP/threadprivate-default-clause.f90 b/flang/test/Lower/OpenMP/threadprivate-default-clause.f90
index be07aec..10beaf6 100644
--- a/flang/test/Lower/OpenMP/threadprivate-default-clause.f90
+++ b/flang/test/Lower/OpenMP/threadprivate-default-clause.f90
@@ -1,3 +1,5 @@
+! REQUIRES: openmp_runtime
+
! Simple test for lowering of OpenMP Threadprivate Directive with HLFIR.
!RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s
diff --git a/flang/test/Parser/OpenMP/allocate-tree-spec-part.f90 b/flang/test/Parser/OpenMP/allocate-tree-spec-part.f90
index 45a693d..ab56b98 100644
--- a/flang/test/Parser/OpenMP/allocate-tree-spec-part.f90
+++ b/flang/test/Parser/OpenMP/allocate-tree-spec-part.f90
@@ -1,3 +1,5 @@
+! REQUIRES: openmp_runtime
+
! RUN: %flang_fc1 -fopenmp -fdebug-dump-parse-tree %s | FileCheck %s
! Ensures associated declarative OMP allocations in the specification
! part are kept there
diff --git a/flang/test/Parser/OpenMP/allocate-tree.f90 b/flang/test/Parser/OpenMP/allocate-tree.f90
index f04e431..02393a5 100644
--- a/flang/test/Parser/OpenMP/allocate-tree.f90
+++ b/flang/test/Parser/OpenMP/allocate-tree.f90
@@ -1,3 +1,5 @@
+! REQUIRES: openmp_runtime
+
! RUN: %flang_fc1 -fopenmp -fdebug-dump-parse-tree %s | FileCheck %s
! RUN: %flang_fc1 -fopenmp -fdebug-unparse %s | FileCheck %s --check-prefix="UNPARSE"
! Ensures associated declarative OMP allocations are nested in their
@@ -36,8 +38,8 @@ end program allocate_tree
!CHECK-NEXT: | | | | | Designator -> DataRef -> Name =
!CHECK-NEXT: | | | AllocateStmt
-!UNPARSE: !$OMP ALLOCATE (w) ALLOCATOR(1_4)
-!UNPARSE-NEXT: !$OMP ALLOCATE (xarray) ALLOCATOR(1_4)
-!UNPARSE-NEXT: !$OMP ALLOCATE (zarray) ALLOCATOR(1_4)
+!UNPARSE: !$OMP ALLOCATE (w) ALLOCATOR(3_8)
+!UNPARSE-NEXT: !$OMP ALLOCATE (xarray) ALLOCATOR(2_8)
+!UNPARSE-NEXT: !$OMP ALLOCATE (zarray) ALLOCATOR(1_8)
!UNPARSE-NEXT: !$OMP ALLOCATE
!UNPARSE-NEXT: ALLOCATE(w, xarray(4_4), zarray(t,z))
diff --git a/flang/test/Parser/OpenMP/target_device_parse.f90 b/flang/test/Parser/OpenMP/target_device_parse.f90
index 1867c2f..dace34b 100644
--- a/flang/test/Parser/OpenMP/target_device_parse.f90
+++ b/flang/test/Parser/OpenMP/target_device_parse.f90
@@ -1,3 +1,5 @@
+! REQUIRES: openmp_runtime
+
! RUN: %flang_fc1 -fdebug-unparse-no-sema -fopenmp %s | FileCheck --ignore-case %s
! RUN: %flang_fc1 -fdebug-dump-parse-tree -fopenmp %s | FileCheck --check-prefix="PARSE-TREE" %s
! Checks the parsing of Openmp 5.0 Target Device constructs
diff --git a/flang/test/Semantics/OpenMP/allocate-clause01.f90 b/flang/test/Semantics/OpenMP/allocate-clause01.f90
index 7e2f643..e059a4a 100644
--- a/flang/test/Semantics/OpenMP/allocate-clause01.f90
+++ b/flang/test/Semantics/OpenMP/allocate-clause01.f90
@@ -1,3 +1,5 @@
+! REQUIRES: openmp_runtime
+
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
! OpenMP Version 5.2
! The allocate clause's allocator modifier must be of type allocator_handle
diff --git a/flang/test/Semantics/OpenMP/allocate-directive.f90 b/flang/test/Semantics/OpenMP/allocate-directive.f90
index 254e5b6..1db13df 100644
--- a/flang/test/Semantics/OpenMP/allocate-directive.f90
+++ b/flang/test/Semantics/OpenMP/allocate-directive.f90
@@ -1,3 +1,5 @@
+! REQUIRES: openmp_runtime
+
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
! Check OpenMP Allocate directive
use omp_lib
diff --git a/flang/test/Semantics/OpenMP/allocate01.f90 b/flang/test/Semantics/OpenMP/allocate01.f90
index 4b290a5..a91076c 100644
--- a/flang/test/Semantics/OpenMP/allocate01.f90
+++ b/flang/test/Semantics/OpenMP/allocate01.f90
@@ -1,3 +1,5 @@
+! REQUIRES: openmp_runtime
+
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
! OpenMP Version 5.0
! 2.11.3 allocate Directive
diff --git a/flang/test/Semantics/OpenMP/allocate02.f90 b/flang/test/Semantics/OpenMP/allocate02.f90
index d7da9ef..dc4194a 100644
--- a/flang/test/Semantics/OpenMP/allocate02.f90
+++ b/flang/test/Semantics/OpenMP/allocate02.f90
@@ -1,3 +1,5 @@
+! REQUIRES: openmp_runtime
+
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
! OpenMP Version 5.0
! 2.11.3 allocate Directive
diff --git a/flang/test/Semantics/OpenMP/allocate03.f90 b/flang/test/Semantics/OpenMP/allocate03.f90
index 320a9c9..30a015f 100644
--- a/flang/test/Semantics/OpenMP/allocate03.f90
+++ b/flang/test/Semantics/OpenMP/allocate03.f90
@@ -1,3 +1,5 @@
+! REQUIRES: openmp_runtime
+
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
! OpenMP Version 5.0
! 2.11.3 allocate Directive
diff --git a/flang/test/Semantics/OpenMP/allocate04.f90 b/flang/test/Semantics/OpenMP/allocate04.f90
index 405781b..b8a8709 100644
--- a/flang/test/Semantics/OpenMP/allocate04.f90
+++ b/flang/test/Semantics/OpenMP/allocate04.f90
@@ -1,3 +1,5 @@
+! REQUIRES: openmp_runtime
+
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
! OpenMP Version 5.0
! 2.11.3 allocate Directive
diff --git a/flang/test/Semantics/OpenMP/allocate05.f90 b/flang/test/Semantics/OpenMP/allocate05.f90
index 04bcf91..92eeaf4 100644
--- a/flang/test/Semantics/OpenMP/allocate05.f90
+++ b/flang/test/Semantics/OpenMP/allocate05.f90
@@ -1,3 +1,5 @@
+! REQUIRES: openmp_runtime
+
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
! OpenMP Version 5.0
! 2.11.3 allocate Directive
diff --git a/flang/test/Semantics/OpenMP/allocate06.f90 b/flang/test/Semantics/OpenMP/allocate06.f90
index 68a7e88..c447456 100644
--- a/flang/test/Semantics/OpenMP/allocate06.f90
+++ b/flang/test/Semantics/OpenMP/allocate06.f90
@@ -1,3 +1,5 @@
+! REQUIRES: openmp_runtime
+
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
! OpenMP Version 5.0
! 2.11.3 allocate Directive
diff --git a/flang/test/Semantics/OpenMP/allocate07.f90 b/flang/test/Semantics/OpenMP/allocate07.f90
index c01b35a..3211c0b 100644
--- a/flang/test/Semantics/OpenMP/allocate07.f90
+++ b/flang/test/Semantics/OpenMP/allocate07.f90
@@ -1,3 +1,5 @@
+! REQUIRES: openmp_runtime
+
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
! OpenMP Version 5.0
! 2.11.3 allocate Directive
diff --git a/flang/test/Semantics/OpenMP/allocate08.f90 b/flang/test/Semantics/OpenMP/allocate08.f90
index 65029d1..152ad07 100644
--- a/flang/test/Semantics/OpenMP/allocate08.f90
+++ b/flang/test/Semantics/OpenMP/allocate08.f90
@@ -1,3 +1,5 @@
+! REQUIRES: openmp_runtime
+
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
! OpenMP Version 5.0
! 2.11.3 allocate Directive
diff --git a/flang/test/Semantics/OpenMP/allocate09.f90 b/flang/test/Semantics/OpenMP/allocate09.f90
index 26d6ff9..639d23c 100644
--- a/flang/test/Semantics/OpenMP/allocate09.f90
+++ b/flang/test/Semantics/OpenMP/allocate09.f90
@@ -1,3 +1,5 @@
+! REQUIRES: openmp_runtime
+
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
! OpenMP Version 5.0
! 2.11.3 allocate Directive
diff --git a/flang/test/Semantics/OpenMP/allocators01.f90 b/flang/test/Semantics/OpenMP/allocators01.f90
index d674438..02d686b 100644
--- a/flang/test/Semantics/OpenMP/allocators01.f90
+++ b/flang/test/Semantics/OpenMP/allocators01.f90
@@ -1,3 +1,5 @@
+! REQUIRES: openmp_runtime
+
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
! OpenMP Version 5.2
! 6.7 allocators construct
diff --git a/flang/test/Semantics/OpenMP/allocators02.f90 b/flang/test/Semantics/OpenMP/allocators02.f90
index 32e7bc1..9d8644b 100644
--- a/flang/test/Semantics/OpenMP/allocators02.f90
+++ b/flang/test/Semantics/OpenMP/allocators02.f90
@@ -1,3 +1,5 @@
+! REQUIRES: openmp_runtime
+
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
! OpenMP Version 5.2
! 6.7 allocators construct
diff --git a/flang/test/Semantics/OpenMP/allocators03.f90 b/flang/test/Semantics/OpenMP/allocators03.f90
index 533434c..85ab91f 100644
--- a/flang/test/Semantics/OpenMP/allocators03.f90
+++ b/flang/test/Semantics/OpenMP/allocators03.f90
@@ -1,3 +1,5 @@
+! REQUIRES: openmp_runtime
+
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
! OpenMP Version 5.2
! 6.7 allocators construct
diff --git a/flang/test/Semantics/OpenMP/allocators04.f90 b/flang/test/Semantics/OpenMP/allocators04.f90
index d4467a2..0c6e994 100644
--- a/flang/test/Semantics/OpenMP/allocators04.f90
+++ b/flang/test/Semantics/OpenMP/allocators04.f90
@@ -1,3 +1,5 @@
+! REQUIRES: openmp_runtime
+
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
! OpenMP Version 5.2
! Inherited from 2.11.3 allocate Directive
diff --git a/flang/test/Semantics/OpenMP/allocators05.f90 b/flang/test/Semantics/OpenMP/allocators05.f90
index 684eef69..07f1357 100644
--- a/flang/test/Semantics/OpenMP/allocators05.f90
+++ b/flang/test/Semantics/OpenMP/allocators05.f90
@@ -1,3 +1,5 @@
+! REQUIRES: openmp_runtime
+
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
! OpenMP Version 5.2
! Inherited from 2.11.3 allocate directive
diff --git a/flang/test/Semantics/OpenMP/allocators06.f90 b/flang/test/Semantics/OpenMP/allocators06.f90
index 17e168d..d3773c0 100644
--- a/flang/test/Semantics/OpenMP/allocators06.f90
+++ b/flang/test/Semantics/OpenMP/allocators06.f90
@@ -1,3 +1,5 @@
+! REQUIRES: openmp_runtime
+
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
! OpenMP Version 5.2
! Inherited from 2.11.3 allocate directive
diff --git a/flang/test/Semantics/OpenMP/atomic-hint-clause.f90 b/flang/test/Semantics/OpenMP/atomic-hint-clause.f90
index 5341fb2..3cbde3ab 100644
--- a/flang/test/Semantics/OpenMP/atomic-hint-clause.f90
+++ b/flang/test/Semantics/OpenMP/atomic-hint-clause.f90
@@ -1,3 +1,5 @@
+! REQUIRES: openmp_runtime
+
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
! Semantic checks on hint clauses, as they appear on atomic constructs
diff --git a/flang/test/Semantics/OpenMP/atomic01.f90 b/flang/test/Semantics/OpenMP/atomic01.f90
index 5469f82..868c762 100644
--- a/flang/test/Semantics/OpenMP/atomic01.f90
+++ b/flang/test/Semantics/OpenMP/atomic01.f90
@@ -1,3 +1,5 @@
+! REQUIRES: openmp_runtime
+
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
! Semantic checks for OpenMP 5.0 standard 2.17.7 atomic Construct.
diff --git a/flang/test/Semantics/OpenMP/atomic02.f90 b/flang/test/Semantics/OpenMP/atomic02.f90
index c11622c..db67fa6 100644
--- a/flang/test/Semantics/OpenMP/atomic02.f90
+++ b/flang/test/Semantics/OpenMP/atomic02.f90
@@ -1,3 +1,5 @@
+! REQUIRES: openmp_runtime
+
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
! OpenMP Atomic construct
diff --git a/flang/test/Semantics/OpenMP/atomic03.f90 b/flang/test/Semantics/OpenMP/atomic03.f90
index 5fc6420..9bcbace 100644
--- a/flang/test/Semantics/OpenMP/atomic03.f90
+++ b/flang/test/Semantics/OpenMP/atomic03.f90
@@ -1,3 +1,5 @@
+! REQUIRES: openmp_runtime
+
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
! OpenMP Atomic construct
diff --git a/flang/test/Semantics/OpenMP/atomic04.f90 b/flang/test/Semantics/OpenMP/atomic04.f90
index ddf6b8b..c0419a6 100644
--- a/flang/test/Semantics/OpenMP/atomic04.f90
+++ b/flang/test/Semantics/OpenMP/atomic04.f90
@@ -1,3 +1,5 @@
+! REQUIRES: openmp_runtime
+
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
! OpenMP Atomic construct
diff --git a/flang/test/Semantics/OpenMP/atomic05.f90 b/flang/test/Semantics/OpenMP/atomic05.f90
index b3ff6e9..7b970db 100644
--- a/flang/test/Semantics/OpenMP/atomic05.f90
+++ b/flang/test/Semantics/OpenMP/atomic05.f90
@@ -1,3 +1,5 @@
+! REQUIRES: openmp_runtime
+
! RUN: %python %S/../test_errors.py %s %flang -fopenmp
! This tests the various semantics related to the clauses of various OpenMP atomic constructs
diff --git a/flang/test/Semantics/OpenMP/clause-validity01.f90 b/flang/test/Semantics/OpenMP/clause-validity01.f90
index d9573a8..977a529 100644
--- a/flang/test/Semantics/OpenMP/clause-validity01.f90
+++ b/flang/test/Semantics/OpenMP/clause-validity01.f90
@@ -1,3 +1,5 @@
+! REQUIRES: openmp_runtime
+
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
use omp_lib
! Check OpenMP clause validity for the following directives:
diff --git a/flang/test/Semantics/OpenMP/critical-hint-clause.f90 b/flang/test/Semantics/OpenMP/critical-hint-clause.f90
index 33088c6..f35eea1 100644
--- a/flang/test/Semantics/OpenMP/critical-hint-clause.f90
+++ b/flang/test/Semantics/OpenMP/critical-hint-clause.f90
@@ -1,3 +1,5 @@
+! REQUIRES: openmp_runtime
+
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
! Semantic checks on hint clauses, as they appear on critical construct
diff --git a/flang/test/Semantics/OpenMP/declare-target01.f90 b/flang/test/Semantics/OpenMP/declare-target01.f90
index 3168781..549f708 100644
--- a/flang/test/Semantics/OpenMP/declare-target01.f90
+++ b/flang/test/Semantics/OpenMP/declare-target01.f90
@@ -1,3 +1,5 @@
+! REQUIRES: openmp_runtime
+
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
! OpenMP Version 5.1
! Check OpenMP construct validity for the following directives:
diff --git a/flang/test/Semantics/OpenMP/flush02.f90 b/flang/test/Semantics/OpenMP/flush02.f90
index 7700954..dbb57ac 100644
--- a/flang/test/Semantics/OpenMP/flush02.f90
+++ b/flang/test/Semantics/OpenMP/flush02.f90
@@ -1,3 +1,5 @@
+! REQUIRES: openmp_runtime
+
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
! Check OpenMP 5.0 - 2.17.8 flush Construct
diff --git a/flang/test/Semantics/OpenMP/omp-atomic-assignment-stmt.f90 b/flang/test/Semantics/OpenMP/omp-atomic-assignment-stmt.f90
index 7e2d508..d9ced2c 100644
--- a/flang/test/Semantics/OpenMP/omp-atomic-assignment-stmt.f90
+++ b/flang/test/Semantics/OpenMP/omp-atomic-assignment-stmt.f90
@@ -1,3 +1,5 @@
+! REQUIRES: openmp_runtime
+
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
! Semantic checks for various assignments related to atomic constructs
diff --git a/flang/test/Semantics/OpenMP/parallel-sections01.f90 b/flang/test/Semantics/OpenMP/parallel-sections01.f90
index c5bfbdfc..2bf58ea 100644
--- a/flang/test/Semantics/OpenMP/parallel-sections01.f90
+++ b/flang/test/Semantics/OpenMP/parallel-sections01.f90
@@ -1,3 +1,5 @@
+! REQUIRES: openmp_runtime
+
! RUN: %python %S/../test_errors.py %s %flang -fopenmp
! OpenMP version 5.0.0
! 2.13.3 parallel sections Construct
diff --git a/flang/test/Semantics/OpenMP/resolve06.f90 b/flang/test/Semantics/OpenMP/resolve06.f90
index 1afc740..f972905 100644
--- a/flang/test/Semantics/OpenMP/resolve06.f90
+++ b/flang/test/Semantics/OpenMP/resolve06.f90
@@ -1,3 +1,5 @@
+! REQUIRES: openmp_runtime
+
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
use omp_lib
!2.11.4 Allocate Clause
diff --git a/flang/test/Semantics/OpenMP/sections02.f90 b/flang/test/Semantics/OpenMP/sections02.f90
index bcdeb05..b96455a 100644
--- a/flang/test/Semantics/OpenMP/sections02.f90
+++ b/flang/test/Semantics/OpenMP/sections02.f90
@@ -1,3 +1,5 @@
+! REQUIRES: openmp_runtime
+
! RUN: %python %S/../test_errors.py %s %flang -fopenmp
! OpenMP version 5.0.0
! 2.8.1 sections construct
diff --git a/flang/test/Semantics/OpenMP/sync-critical02.f90 b/flang/test/Semantics/OpenMP/sync-critical02.f90
index dac031f..fdd95fa 100644
--- a/flang/test/Semantics/OpenMP/sync-critical02.f90
+++ b/flang/test/Semantics/OpenMP/sync-critical02.f90
@@ -1,3 +1,5 @@
+! REQUIRES: openmp_runtime
+
! RUN: %python %S/../test_errors.py %s %flang -fopenmp
! OpenMP Version 5.0
diff --git a/flang/test/Semantics/OpenMP/taskgroup01.f90 b/flang/test/Semantics/OpenMP/taskgroup01.f90
index a249412..e318555 100644
--- a/flang/test/Semantics/OpenMP/taskgroup01.f90
+++ b/flang/test/Semantics/OpenMP/taskgroup01.f90
@@ -1,3 +1,5 @@
+! REQUIRES: openmp_runtime
+
! RUN: %python %S/../test_errors.py %s %flang -fopenmp
use omp_lib
diff --git a/flang/test/Semantics/OpenMP/threadprivate01.f90 b/flang/test/Semantics/OpenMP/threadprivate01.f90
index 309d209..5ba5f40 100644
--- a/flang/test/Semantics/OpenMP/threadprivate01.f90
+++ b/flang/test/Semantics/OpenMP/threadprivate01.f90
@@ -1,3 +1,5 @@
+! REQUIRES: openmp_runtime
+
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
! OpenMP Version 5.1
! Check OpenMP construct validity for the following directives:
diff --git a/flang/test/lit.cfg.py b/flang/test/lit.cfg.py
index 65467f2..5eeada0 100644
--- a/flang/test/lit.cfg.py
+++ b/flang/test/lit.cfg.py
@@ -200,6 +200,10 @@ result = lit_config.params.get("LIBPGMATH")
if result:
config.environment["LIBPGMATH"] = True
+# Determine if OpenMP runtime was built (enable OpenMP tests via REQUIRES in test file)
+if config.have_openmp_rtl:
+ config.available_features.add("openmp_runtime")
+
# Add features and substitutions to test F128 math support.
# %f128-lib substitution may be used to generate check prefixes
# for LIT tests checking for F128 library support.
diff --git a/flang/test/lit.site.cfg.py.in b/flang/test/lit.site.cfg.py.in
index e66f1af..b9b7a7c 100644
--- a/flang/test/lit.site.cfg.py.in
+++ b/flang/test/lit.site.cfg.py.in
@@ -25,6 +25,7 @@ config.cc = "@CMAKE_C_COMPILER@"
config.osx_sysroot = path(r"@CMAKE_OSX_SYSROOT@")
config.targets_to_build = "@TARGETS_TO_BUILD@"
config.default_sysroot = "@DEFAULT_SYSROOT@"
+config.have_openmp_rtl = ("@LLVM_TOOL_OPENMP_BUILD@" == "TRUE")
config.flang_runtime_f128_math_lib = "@FLANG_RUNTIME_F128_MATH_LIB@"
import lit.llvm
diff --git a/flang/tools/f18/CMakeLists.txt b/flang/tools/f18/CMakeLists.txt
index a249583..3a31f4d 100644
--- a/flang/tools/f18/CMakeLists.txt
+++ b/flang/tools/f18/CMakeLists.txt
@@ -17,7 +17,6 @@ set(MODULES
"ieee_features"
"iso_c_binding"
"iso_fortran_env"
- "omp_lib"
"__fortran_builtins"
"__fortran_type_info"
)
@@ -59,6 +58,7 @@ if (NOT CMAKE_CROSSCOMPILING)
endif()
endif()
+ # TODO: We may need to flag this with conditional, in case Flang is built w/o OpenMP support
add_custom_command(OUTPUT ${base}.mod
COMMAND ${CMAKE_COMMAND} -E make_directory ${FLANG_INTRINSIC_MODULES_DIR}
COMMAND flang-new -cpp -fsyntax-only ${opts} -module-dir ${FLANG_INTRINSIC_MODULES_DIR}
@@ -71,6 +71,30 @@ if (NOT CMAKE_CROSSCOMPILING)
list(APPEND MODULE_FILES ${base}.mod ${base}.f18.mod)
install(FILES ${base}.mod ${base}.f18.mod DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/flang")
endforeach()
+
+ # Special case for omp_lib.mod, because its source comes from openmp/runtime/src/include.
+ # It also produces two module files: omp_lib.mod and omp_lib_kinds.mod. Compile these
+ # files only if OpenMP support has been configured.
+ if (LLVM_TOOL_OPENMP_BUILD)
+ message(STATUS "OpenMP runtime support enabled via LLVM_ENABLED_PROJECTS, building omp_lib.mod")
+ set(base ${FLANG_INTRINSIC_MODULES_DIR}/omp_lib)
+ add_custom_command(OUTPUT ${base}.mod ${base}_kinds.mod
+ COMMAND ${CMAKE_COMMAND} -E make_directory ${FLANG_INTRINSIC_MODULES_DIR}
+ COMMAND flang-new -cpp -fsyntax-only ${opts} -module-dir ${FLANG_INTRINSIC_MODULES_DIR}
+ ${CMAKE_BINARY_DIR}/projects/openmp/runtime/src/omp_lib.F90
+ DEPENDS flang-new ${FLANG_INTRINSIC_MODULES_DIR}/iso_c_binding.mod ${CMAKE_BINARY_DIR}/projects/openmp/runtime/src/omp_lib.F90 ${depends}
+ )
+ add_custom_command(OUTPUT ${base}.f18.mod
+ DEPENDS ${base}.mod
+ COMMAND ${CMAKE_COMMAND} -E copy ${base}.mod ${base}.f18.mod)
+ add_custom_command(OUTPUT ${base}_kinds.f18.mod
+ DEPENDS ${base}.mod
+ COMMAND ${CMAKE_COMMAND} -E copy ${base}_kinds.mod ${base}_kinds.f18.mod)
+ list(APPEND MODULE_FILES ${base}.mod ${base}.f18.mod ${base}_kinds.mod ${base}_kinds.f18.mod)
+ install(FILES ${base}.mod ${base}.f18.mod ${base}_kinds.mod ${base}_kinds.f18.mod DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/flang")
+ else()
+ message(STATUS "Not building omp_lib.mod, no OpenMP runtime in LLVM_ENABLED_PROJECTS")
+ endif()
endif()
add_custom_target(module_files ALL DEPENDS ${MODULE_FILES})
@@ -87,5 +111,11 @@ if (NOT WIN32)
endif()
# TODO Move this to a more suitable location
-file(COPY ${FLANG_SOURCE_DIR}/module/omp_lib.h DESTINATION "${CMAKE_BINARY_DIR}/include/flang/OpenMP/" FILE_PERMISSIONS OWNER_READ OWNER_WRITE)
-install(FILES ${CMAKE_BINARY_DIR}/include/flang/OpenMP/omp_lib.h DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/flang/OpenMP")
+# Copy the generated omp_lib.h header file, if OpenMP support has been configured.
+if (LLVM_TOOL_OPENMP_BUILD)
+ message(STATUS "OpenMP runtime support enabled via LLVM_ENABLED_PROJECTS, building omp_lib.h")
+ file(COPY ${CMAKE_BINARY_DIR}/projects/openmp/runtime/src/omp_lib.h DESTINATION "${CMAKE_BINARY_DIR}/include/flang/OpenMP/" FILE_PERMISSIONS OWNER_READ OWNER_WRITE)
+ install(FILES ${CMAKE_BINARY_DIR}/include/flang/OpenMP/omp_lib.h DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/flang/OpenMP")
+else()
+ message(STATUS "Not copying omp_lib.h, no OpenMP runtime in LLVM_ENABLED_PROJECTS")
+endif()