diff options
author | Tobias Burnus <tburnus@baylibre.com> | 2025-06-06 16:22:06 +0200 |
---|---|---|
committer | Tobias Burnus <tburnus@baylibre.com> | 2025-06-06 16:22:06 +0200 |
commit | 387209938d2c476a67966c6ddbdbf817626f24a2 (patch) | |
tree | 37ae3e2d4f37d7f6dc81b2a463538effca4766cb /libgfortran/generated/minval_i1.c | |
parent | 214b5d66c54613463a96aa2c7202bc32f628dad6 (diff) | |
download | gcc-387209938d2c476a67966c6ddbdbf817626f24a2.zip gcc-387209938d2c476a67966c6ddbdbf817626f24a2.tar.gz gcc-387209938d2c476a67966c6ddbdbf817626f24a2.tar.bz2 |
OpenMP: Add omp_get_initial_device/omp_get_num_devices builtins
By adding omp_get_initial_device and omp_get_num_devices builtins for
C, C++, and Fortran, the following can be achieved:
* By making them pure, multiple calls can be avoiding in some cases.
* Some comparisons can be optimized at compile time.
omp_get_initial_device will be converted to omp_get_num_devices for
consistency; note that OpenMP 6 also permits omp_initial_device (== -1)
as value.
If GCC has not been configure for offloading, either intrinsic will
leads to 0 - and on the offload side, -1 (= omp_initial_device) is
returned for omp_initial_device.
gcc/fortran/ChangeLog:
* f95-lang.cc (ATTR_PURE_NOTHROW_LIST): Define.
* trans-expr.cc (get_builtin_fn): Handle omp_get_num_devices
and omp_get_intrinsic_device.
* gfortran.h (gfc_option_t): Add disable_omp_... for them.
* options.cc (gfc_handle_option): Handle them with
-fno-builtin-.
gcc/ChangeLog:
* gimple-fold.cc (gimple_fold_builtin_omp_get_initial_device,
gimple_fold_builtin_omp_get_num_devices): New.
(gimple_fold_builtin): Call them.
* omp-builtins.def (BUILT_IN_OMP_GET_INITIAL_DEVICE): Add
(BUILT_IN_OMP_GET_NUM_DEVICES): Make uservisible + pure.
libgomp/ChangeLog:
* libgomp.texi (omp_get_num_devices, omp_get_intrinsic_device):
Document builtin handling.
gcc/testsuite/ChangeLog:
* c-c++-common/gomp/omp_get_num_devices_initial_device-2.c: New test.
* c-c++-common/gomp/omp_get_num_devices_initial_device.c: New test.
* gfortran.dg/gomp/omp_get_num_devices_initial_device-2.f90: New test.
* gfortran.dg/gomp/omp_get_num_devices_initial_device.f90: New test.
Co-authored-by: Sandra Loosemore <sloosemore@baylibre.com>
Diffstat (limited to 'libgfortran/generated/minval_i1.c')
0 files changed, 0 insertions, 0 deletions