56 lines · plain
1/*===-- complex --- OpenMP complex wrapper for target regions --------- c++ -===2 *3 * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4 * See https://llvm.org/LICENSE.txt for license information.5 * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6 *7 *===-----------------------------------------------------------------------===8 */9 10#ifndef __CLANG_OPENMP_COMPLEX__11#define __CLANG_OPENMP_COMPLEX__12 13#ifndef _OPENMP14#error "This file is for OpenMP compilation only."15#endif16 17// We require std::math functions in the complex builtins below.18#include <cmath>19 20#ifdef __NVPTX__21#define __OPENMP_NVPTX__22#include <__clang_cuda_complex_builtins.h>23#undef __OPENMP_NVPTX__24#endif // __NVPTX__25 26#ifdef __AMDGCN__27#define __OPENMP_AMDGCN__28#include <__clang_cuda_complex_builtins.h>29#undef __OPENMP_AMDGCN__30#endif // __AMDGCN__31 32#endif33 34// Grab the host header too.35#include_next <complex>36 37// If we are compiling against libc++, the macro _LIBCPP_STD_VER should be set38// after including <cmath> above. Since the complex header we use is a39// simplified version of the libc++, we don't need it in this case. If we40// compile against libstdc++, or any other standard library, we will overload41// the (hopefully template) functions in the <complex> header with the ones we42// got from libc++ which decomposes math functions, like `std::sin`, into43// arithmetic and calls to non-complex functions, all of which we can then44// handle.45#ifndef _LIBCPP_STD_VER46 47#pragma omp begin declare variant match( \48 device = {arch(amdgcn, nvptx, nvptx64)}, \49 implementation = {extension(match_any, allow_templates)})50 51#include <complex_cmath.h>52 53#pragma omp end declare variant54 55#endif // _LIBCPP_STD_VER56