oacc-init.c 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /* OpenACC Runtime initialization routines
  2. Copyright (C) 2014-2022 Free Software Foundation, Inc.
  3. Contributed by Mentor Embedded.
  4. This file is part of the GNU Offloading and Multi Processing Library
  5. (libgomp).
  6. Libgomp is free software; you can redistribute it and/or modify it
  7. under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 3, or (at your option)
  9. any later version.
  10. Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY
  11. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  12. FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  13. more details.
  14. Under Section 7 of GPL version 3, you are granted additional
  15. permissions described in the GCC Runtime Library Exception, version
  16. 3.1, as published by the Free Software Foundation.
  17. You should have received a copy of the GNU General Public License and
  18. a copy of the GCC Runtime Library Exception along with this program;
  19. see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
  20. <http://www.gnu.org/licenses/>. */
  21. #include "openacc.h"
  22. /* For -O and higher, the compiler always attempts to expand acc_on_device, but
  23. if the user disables the builtin, or calls it via a pointer, we'll need this
  24. version.
  25. Compile this with optimization, so that the compiler expands
  26. this, rather than generating infinitely recursive code. */
  27. int __attribute__ ((__optimize__ ("O2")))
  28. acc_on_device (acc_device_t dev)
  29. {
  30. return __builtin_acc_on_device (dev);
  31. }