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