llvm-runtime-resources-darwin 0.0.0 → 22.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/NOTICE +33 -0
- package/include/__clang_cuda_builtin_vars.h +121 -0
- package/include/__clang_cuda_cmath.h +512 -0
- package/include/__clang_cuda_complex_builtins.h +229 -0
- package/include/__clang_cuda_device_functions.h +1572 -0
- package/include/__clang_cuda_intrinsics.h +994 -0
- package/include/__clang_cuda_libdevice_declares.h +468 -0
- package/include/__clang_cuda_math.h +353 -0
- package/include/__clang_cuda_math_forward_declares.h +284 -0
- package/include/__clang_cuda_runtime_wrapper.h +522 -0
- package/include/__clang_cuda_texture_intrinsics.h +1177 -0
- package/include/__clang_hip_cmath.h +848 -0
- package/include/__clang_hip_libdevice_declares.h +340 -0
- package/include/__clang_hip_math.h +1405 -0
- package/include/__clang_hip_runtime_wrapper.h +165 -0
- package/include/__clang_hip_stdlib.h +43 -0
- package/include/__clang_spirv_builtins.h +217 -0
- package/include/__float_float.h +176 -0
- package/include/__float_header_macro.h +12 -0
- package/include/__float_infinity_nan.h +20 -0
- package/include/__stdarg___gnuc_va_list.h +13 -0
- package/include/__stdarg___va_copy.h +12 -0
- package/include/__stdarg_header_macro.h +12 -0
- package/include/__stdarg_va_arg.h +22 -0
- package/include/__stdarg_va_copy.h +12 -0
- package/include/__stdarg_va_list.h +13 -0
- package/include/__stddef_header_macro.h +12 -0
- package/include/__stddef_max_align_t.h +27 -0
- package/include/__stddef_null.h +29 -0
- package/include/__stddef_nullptr_t.h +29 -0
- package/include/__stddef_offsetof.h +17 -0
- package/include/__stddef_ptrdiff_t.h +20 -0
- package/include/__stddef_rsize_t.h +20 -0
- package/include/__stddef_size_t.h +20 -0
- package/include/__stddef_unreachable.h +21 -0
- package/include/__stddef_wchar_t.h +28 -0
- package/include/__stddef_wint_t.h +15 -0
- package/include/__wmmintrin_aes.h +140 -0
- package/include/__wmmintrin_pclmul.h +48 -0
- package/include/adcintrin.h +165 -0
- package/include/adxintrin.h +107 -0
- package/include/altivec.h +19364 -0
- package/include/amdgpuintrin.h +191 -0
- package/include/ammintrin.h +183 -0
- package/include/amo.h +131 -0
- package/include/amxavx512intrin.h +596 -0
- package/include/amxcomplexintrin.h +167 -0
- package/include/amxfp16intrin.h +93 -0
- package/include/amxfp8intrin.h +230 -0
- package/include/amxintrin.h +492 -0
- package/include/amxmovrsintrin.h +48 -0
- package/include/amxtf32intrin.h +108 -0
- package/include/andes_vector.h +16 -0
- package/include/arm64intr.h +35 -0
- package/include/arm_acle.h +865 -0
- package/include/arm_bf16.h +20 -0
- package/include/arm_cde.h +410 -0
- package/include/arm_cmse.h +217 -0
- package/include/arm_fp16.h +596 -0
- package/include/arm_mve.h +19187 -0
- package/include/arm_neon.h +74183 -0
- package/include/arm_neon_sve_bridge.h +182 -0
- package/include/arm_sme.h +3741 -0
- package/include/arm_sve.h +32278 -0
- package/include/arm_vector_types.h +432 -0
- package/include/armintr.h +31 -0
- package/include/avx10_2_512bf16intrin.h +568 -0
- package/include/avx10_2_512convertintrin.h +322 -0
- package/include/avx10_2_512minmaxintrin.h +127 -0
- package/include/avx10_2_512niintrin.h +314 -0
- package/include/avx10_2_512satcvtdsintrin.h +307 -0
- package/include/avx10_2_512satcvtintrin.h +301 -0
- package/include/avx10_2bf16intrin.h +1094 -0
- package/include/avx10_2convertintrin.h +3257 -0
- package/include/avx10_2copyintrin.h +66 -0
- package/include/avx10_2minmaxintrin.h +232 -0
- package/include/avx10_2niintrin.h +409 -0
- package/include/avx10_2satcvtdsintrin.h +376 -0
- package/include/avx10_2satcvtintrin.h +312 -0
- package/include/avx2intrin.h +5191 -0
- package/include/avx512bf16intrin.h +292 -0
- package/include/avx512bitalgintrin.h +75 -0
- package/include/avx512bwintrin.h +1895 -0
- package/include/avx512cdintrin.h +112 -0
- package/include/avx512dqintrin.h +1350 -0
- package/include/avx512fintrin.h +9378 -0
- package/include/avx512fp16intrin.h +3355 -0
- package/include/avx512ifmaintrin.h +68 -0
- package/include/avx512ifmavlintrin.h +138 -0
- package/include/avx512vbmi2intrin.h +368 -0
- package/include/avx512vbmiintrin.h +98 -0
- package/include/avx512vbmivlintrin.h +179 -0
- package/include/avx512vlbf16intrin.h +527 -0
- package/include/avx512vlbitalgintrin.h +135 -0
- package/include/avx512vlbwintrin.h +3064 -0
- package/include/avx512vlcdintrin.h +202 -0
- package/include/avx512vldqintrin.h +1156 -0
- package/include/avx512vlfp16intrin.h +2090 -0
- package/include/avx512vlintrin.h +8083 -0
- package/include/avx512vlvbmi2intrin.h +710 -0
- package/include/avx512vlvnniintrin.h +313 -0
- package/include/avx512vlvp2intersectintrin.h +123 -0
- package/include/avx512vnniintrin.h +116 -0
- package/include/avx512vp2intersectintrin.h +77 -0
- package/include/avx512vpopcntdqintrin.h +62 -0
- package/include/avx512vpopcntdqvlintrin.h +105 -0
- package/include/avxifmaintrin.h +193 -0
- package/include/avxintrin.h +5064 -0
- package/include/avxneconvertintrin.h +484 -0
- package/include/avxvnniint16intrin.h +451 -0
- package/include/avxvnniint8intrin.h +454 -0
- package/include/avxvnniintrin.h +233 -0
- package/include/bmi2intrin.h +253 -0
- package/include/bmiintrin.h +604 -0
- package/include/builtins.h +19 -0
- package/include/cet.h +66 -0
- package/include/cetintrin.h +115 -0
- package/include/cldemoteintrin.h +36 -0
- package/include/clflushoptintrin.h +36 -0
- package/include/clwbintrin.h +38 -0
- package/include/clzerointrin.h +38 -0
- package/include/cmpccxaddintrin.h +70 -0
- package/include/cpuid.h +451 -0
- package/include/crc32intrin.h +100 -0
- package/include/cuda_wrappers/__utility/declval.h +28 -0
- package/include/cuda_wrappers/algorithm +116 -0
- package/include/cuda_wrappers/bits/basic_string.h +9 -0
- package/include/cuda_wrappers/bits/basic_string.tcc +9 -0
- package/include/cuda_wrappers/bits/c++config.h +61 -0
- package/include/cuda_wrappers/bits/shared_ptr_base.h +9 -0
- package/include/cuda_wrappers/cmath +44 -0
- package/include/cuda_wrappers/complex +90 -0
- package/include/cuda_wrappers/new +108 -0
- package/include/emmintrin.h +4940 -0
- package/include/enqcmdintrin.h +63 -0
- package/include/f16cintrin.h +176 -0
- package/include/float.h +48 -0
- package/include/fma4intrin.h +220 -0
- package/include/fmaintrin.h +826 -0
- package/include/fuzzer/FuzzedDataProvider.h +397 -0
- package/include/fxsrintrin.h +91 -0
- package/include/gfniintrin.h +238 -0
- package/include/gpuintrin.h +330 -0
- package/include/hexagon_circ_brev_intrinsics.h +298 -0
- package/include/hexagon_protos.h +8439 -0
- package/include/hexagon_types.h +2628 -0
- package/include/hresetintrin.h +49 -0
- package/include/htmintrin.h +212 -0
- package/include/htmxlintrin.h +345 -0
- package/include/hvx_hexagon_protos.h +5399 -0
- package/include/ia32intrin.h +863 -0
- package/include/immintrin.h +595 -0
- package/include/intrin.h +491 -0
- package/include/intrin0.h +256 -0
- package/include/inttypes.h +101 -0
- package/include/invpcidintrin.h +23 -0
- package/include/iso646.h +31 -0
- package/include/keylockerintrin.h +518 -0
- package/include/larchintrin.h +260 -0
- package/include/lasxintrin.h +3999 -0
- package/include/limits.h +133 -0
- package/include/llvm_libc_wrappers/assert.h +32 -0
- package/include/llvm_libc_wrappers/ctype.h +28 -0
- package/include/llvm_libc_wrappers/inttypes.h +32 -0
- package/include/llvm_libc_wrappers/stdio.h +52 -0
- package/include/llvm_libc_wrappers/stdlib.h +32 -0
- package/include/llvm_libc_wrappers/string.h +28 -0
- package/include/llvm_libc_wrappers/time.h +28 -0
- package/include/llvm_offload_wrappers/__llvm_offload.h +31 -0
- package/include/llvm_offload_wrappers/__llvm_offload_device.h +10 -0
- package/include/llvm_offload_wrappers/__llvm_offload_host.h +15 -0
- package/include/lsxintrin.h +3752 -0
- package/include/lwpintrin.h +136 -0
- package/include/lzcntintrin.h +109 -0
- package/include/mm3dnow.h +22 -0
- package/include/mm_malloc.h +67 -0
- package/include/mmintrin.h +1541 -0
- package/include/module.modulemap +360 -0
- package/include/movdirintrin.h +49 -0
- package/include/movrs_avx10_2_512intrin.h +98 -0
- package/include/movrs_avx10_2intrin.h +174 -0
- package/include/movrsintrin.h +59 -0
- package/include/msa.h +573 -0
- package/include/mwaitxintrin.h +62 -0
- package/include/nmmintrin.h +20 -0
- package/include/nvptxintrin.h +219 -0
- package/include/opencl-c-base.h +758 -0
- package/include/opencl-c.h +18676 -0
- package/include/openmp_wrappers/__clang_openmp_device_functions.h +104 -0
- package/include/openmp_wrappers/cmath +132 -0
- package/include/openmp_wrappers/complex +55 -0
- package/include/openmp_wrappers/complex.h +35 -0
- package/include/openmp_wrappers/complex_cmath.h +393 -0
- package/include/openmp_wrappers/math.h +61 -0
- package/include/openmp_wrappers/new +48 -0
- package/include/pconfigintrin.h +40 -0
- package/include/pkuintrin.h +34 -0
- package/include/pmmintrin.h +302 -0
- package/include/popcntintrin.h +59 -0
- package/include/ppc_wrappers/bmi2intrin.h +134 -0
- package/include/ppc_wrappers/bmiintrin.h +165 -0
- package/include/ppc_wrappers/emmintrin.h +2269 -0
- package/include/ppc_wrappers/immintrin.h +27 -0
- package/include/ppc_wrappers/mm_malloc.h +45 -0
- package/include/ppc_wrappers/mmintrin.h +1453 -0
- package/include/ppc_wrappers/nmmintrin.h +26 -0
- package/include/ppc_wrappers/pmmintrin.h +145 -0
- package/include/ppc_wrappers/smmintrin.h +683 -0
- package/include/ppc_wrappers/tmmintrin.h +453 -0
- package/include/ppc_wrappers/x86gprintrin.h +17 -0
- package/include/ppc_wrappers/x86intrin.h +28 -0
- package/include/ppc_wrappers/xmmintrin.h +1827 -0
- package/include/prfchiintrin.h +61 -0
- package/include/prfchwintrin.h +57 -0
- package/include/profile/InstrProfData.inc +1001 -0
- package/include/profile/instr_prof_interface.h +88 -0
- package/include/ptrauth.h +407 -0
- package/include/ptwriteintrin.h +37 -0
- package/include/raointintrin.h +203 -0
- package/include/rdpruintrin.h +57 -0
- package/include/rdseedintrin.h +105 -0
- package/include/riscv_bitmanip.h +195 -0
- package/include/riscv_corev_alu.h +128 -0
- package/include/riscv_crypto.h +170 -0
- package/include/riscv_mips.h +34 -0
- package/include/riscv_nds.h +89 -0
- package/include/riscv_ntlh.h +26 -0
- package/include/riscv_vector.h +422 -0
- package/include/rtmintrin.h +45 -0
- package/include/s390intrin.h +25 -0
- package/include/sanitizer/allocator_interface.h +106 -0
- package/include/sanitizer/asan_interface.h +348 -0
- package/include/sanitizer/common_interface_defs.h +544 -0
- package/include/sanitizer/coverage_interface.h +36 -0
- package/include/sanitizer/dfsan_interface.h +220 -0
- package/include/sanitizer/hwasan_interface.h +109 -0
- package/include/sanitizer/linux_syscall_hooks.h +3112 -0
- package/include/sanitizer/lsan_interface.h +89 -0
- package/include/sanitizer/msan_interface.h +135 -0
- package/include/sanitizer/netbsd_syscall_hooks.h +5005 -0
- package/include/sanitizer/rtsan_interface.h +75 -0
- package/include/sanitizer/scudo_interface.h +38 -0
- package/include/sanitizer/tsan_interface.h +316 -0
- package/include/sanitizer/tsan_interface_atomic.h +223 -0
- package/include/sanitizer/ubsan_interface.h +34 -0
- package/include/serializeintrin.h +30 -0
- package/include/sgxintrin.h +60 -0
- package/include/sha512intrin.h +200 -0
- package/include/shaintrin.h +190 -0
- package/include/sifive_vector.h +174 -0
- package/include/sm3intrin.h +238 -0
- package/include/sm4evexintrin.h +32 -0
- package/include/sm4intrin.h +269 -0
- package/include/smmintrin.h +2352 -0
- package/include/spirvintrin.h +194 -0
- package/include/stdalign.h +24 -0
- package/include/stdarg.h +75 -0
- package/include/stdatomic.h +204 -0
- package/include/stdbool.h +39 -0
- package/include/stdckdint.h +42 -0
- package/include/stdcountof.h +15 -0
- package/include/stddef.h +139 -0
- package/include/stddefer.h +19 -0
- package/include/stdint.h +844 -0
- package/include/stdnoreturn.h +35 -0
- package/include/tbmintrin.h +128 -0
- package/include/tgmath.h +1368 -0
- package/include/tmmintrin.h +779 -0
- package/include/tsxldtrkintrin.h +56 -0
- package/include/uintrintrin.h +157 -0
- package/include/unwind.h +332 -0
- package/include/usermsrintrin.h +51 -0
- package/include/vadefs.h +51 -0
- package/include/vaesintrin.h +86 -0
- package/include/varargs.h +16 -0
- package/include/vecintrin.h +12868 -0
- package/include/velintrin.h +71 -0
- package/include/velintrin_approx.h +120 -0
- package/include/velintrin_gen.h +1257 -0
- package/include/vpclmulqdqintrin.h +30 -0
- package/include/waitpkgintrin.h +42 -0
- package/include/wasm_simd128.h +2143 -0
- package/include/wbnoinvdintrin.h +24 -0
- package/include/wmmintrin.h +23 -0
- package/include/x86gprintrin.h +49 -0
- package/include/x86intrin.h +35 -0
- package/include/xmmintrin.h +3175 -0
- package/include/xopintrin.h +780 -0
- package/include/xsavecintrin.h +84 -0
- package/include/xsaveintrin.h +63 -0
- package/include/xsaveoptintrin.h +34 -0
- package/include/xsavesintrin.h +44 -0
- package/include/xtestintrin.h +27 -0
- package/include/yvals_core.h +25 -0
- package/include/zos_wrappers/builtins.h +18 -0
- package/index.js +5 -0
- package/lib/darwin/libclang_rt.asan_abi_ios.a +0 -0
- package/lib/darwin/libclang_rt.asan_abi_iossim.a +0 -0
- package/lib/darwin/libclang_rt.asan_abi_osx.a +0 -0
- package/lib/darwin/libclang_rt.asan_ios_dynamic.dylib +0 -0
- package/lib/darwin/libclang_rt.asan_iossim_dynamic.dylib +0 -0
- package/lib/darwin/libclang_rt.asan_osx_dynamic.dylib +0 -0
- package/lib/darwin/libclang_rt.cc_kext.a +0 -0
- package/lib/darwin/libclang_rt.cc_kext_ios.a +0 -0
- package/lib/darwin/libclang_rt.fuzzer_interceptors_ios.a +0 -0
- package/lib/darwin/libclang_rt.fuzzer_interceptors_iossim.a +0 -0
- package/lib/darwin/libclang_rt.fuzzer_interceptors_osx.a +0 -0
- package/lib/darwin/libclang_rt.fuzzer_ios.a +0 -0
- package/lib/darwin/libclang_rt.fuzzer_iossim.a +0 -0
- package/lib/darwin/libclang_rt.fuzzer_no_main_ios.a +0 -0
- package/lib/darwin/libclang_rt.fuzzer_no_main_iossim.a +0 -0
- package/lib/darwin/libclang_rt.fuzzer_no_main_osx.a +0 -0
- package/lib/darwin/libclang_rt.fuzzer_osx.a +0 -0
- package/lib/darwin/libclang_rt.ios.a +0 -0
- package/lib/darwin/libclang_rt.iossim.a +0 -0
- package/lib/darwin/libclang_rt.lsan_ios_dynamic.dylib +0 -0
- package/lib/darwin/libclang_rt.lsan_iossim_dynamic.dylib +0 -0
- package/lib/darwin/libclang_rt.lsan_osx_dynamic.dylib +0 -0
- package/lib/darwin/libclang_rt.osx.a +0 -0
- package/lib/darwin/libclang_rt.profile_ios.a +0 -0
- package/lib/darwin/libclang_rt.profile_iossim.a +0 -0
- package/lib/darwin/libclang_rt.profile_osx.a +0 -0
- package/lib/darwin/libclang_rt.rtsan_ios_dynamic.dylib +0 -0
- package/lib/darwin/libclang_rt.rtsan_iossim_dynamic.dylib +0 -0
- package/lib/darwin/libclang_rt.rtsan_osx_dynamic.dylib +0 -0
- package/lib/darwin/libclang_rt.stats_client_ios.a +0 -0
- package/lib/darwin/libclang_rt.stats_client_iossim.a +0 -0
- package/lib/darwin/libclang_rt.stats_client_osx.a +0 -0
- package/lib/darwin/libclang_rt.stats_ios_dynamic.dylib +0 -0
- package/lib/darwin/libclang_rt.stats_iossim_dynamic.dylib +0 -0
- package/lib/darwin/libclang_rt.stats_osx_dynamic.dylib +0 -0
- package/lib/darwin/libclang_rt.tsan_ios_dynamic.dylib +0 -0
- package/lib/darwin/libclang_rt.tsan_iossim_dynamic.dylib +0 -0
- package/lib/darwin/libclang_rt.tsan_osx_dynamic.dylib +0 -0
- package/lib/darwin/libclang_rt.tysan_ios_dynamic.dylib +0 -0
- package/lib/darwin/libclang_rt.tysan_iossim_dynamic.dylib +0 -0
- package/lib/darwin/libclang_rt.tysan_osx_dynamic.dylib +0 -0
- package/lib/darwin/libclang_rt.ubsan_ios_dynamic.dylib +0 -0
- package/lib/darwin/libclang_rt.ubsan_iossim_dynamic.dylib +0 -0
- package/lib/darwin/libclang_rt.ubsan_minimal_ios.a +0 -0
- package/lib/darwin/libclang_rt.ubsan_minimal_ios_dynamic.dylib +0 -0
- package/lib/darwin/libclang_rt.ubsan_minimal_iossim.a +0 -0
- package/lib/darwin/libclang_rt.ubsan_minimal_iossim_dynamic.dylib +0 -0
- package/lib/darwin/libclang_rt.ubsan_minimal_osx.a +0 -0
- package/lib/darwin/libclang_rt.ubsan_minimal_osx_dynamic.dylib +0 -0
- package/lib/darwin/libclang_rt.ubsan_osx_dynamic.dylib +0 -0
- package/package.json +40 -1
- package/share/asan_ignorelist.txt +14 -0
- package/share/cfi_ignorelist.txt +17 -0
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
//===------------------------- __complex_cmath.h --------------------------===//
|
|
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-exception
|
|
6
|
+
//
|
|
7
|
+
//===----------------------------------------------------------------------===//
|
|
8
|
+
//
|
|
9
|
+
// std::complex header copied from the libcxx source and simplified for use in
|
|
10
|
+
// OpenMP target offload regions.
|
|
11
|
+
//
|
|
12
|
+
//===----------------------------------------------------------------------===//
|
|
13
|
+
|
|
14
|
+
#ifndef _OPENMP
|
|
15
|
+
#error "This file is for OpenMP compilation only."
|
|
16
|
+
#endif
|
|
17
|
+
|
|
18
|
+
#ifndef __cplusplus
|
|
19
|
+
#error "This file is for C++ compilation only."
|
|
20
|
+
#endif
|
|
21
|
+
|
|
22
|
+
#ifndef _LIBCPP_COMPLEX
|
|
23
|
+
#define _LIBCPP_COMPLEX
|
|
24
|
+
|
|
25
|
+
#include <cmath>
|
|
26
|
+
#include <type_traits>
|
|
27
|
+
|
|
28
|
+
#define __DEVICE__ static constexpr __attribute__((nothrow))
|
|
29
|
+
|
|
30
|
+
namespace std {
|
|
31
|
+
|
|
32
|
+
// abs
|
|
33
|
+
|
|
34
|
+
template <class _Tp> __DEVICE__ _Tp abs(const std::complex<_Tp> &__c) {
|
|
35
|
+
return hypot(__c.real(), __c.imag());
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// arg
|
|
39
|
+
|
|
40
|
+
template <class _Tp> __DEVICE__ _Tp arg(const std::complex<_Tp> &__c) {
|
|
41
|
+
return atan2(__c.imag(), __c.real());
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
template <class _Tp>
|
|
45
|
+
typename enable_if<is_integral<_Tp>::value || is_same<_Tp, double>::value,
|
|
46
|
+
double>::type
|
|
47
|
+
arg(_Tp __re) {
|
|
48
|
+
return atan2(0., __re);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
template <class _Tp>
|
|
52
|
+
typename enable_if<is_same<_Tp, float>::value, float>::type arg(_Tp __re) {
|
|
53
|
+
return atan2f(0.F, __re);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// norm
|
|
57
|
+
|
|
58
|
+
template <class _Tp> __DEVICE__ _Tp norm(const std::complex<_Tp> &__c) {
|
|
59
|
+
if (std::isinf(__c.real()))
|
|
60
|
+
return abs(__c.real());
|
|
61
|
+
if (std::isinf(__c.imag()))
|
|
62
|
+
return abs(__c.imag());
|
|
63
|
+
return __c.real() * __c.real() + __c.imag() * __c.imag();
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// conj
|
|
67
|
+
#ifdef _GLIBCXX20_CONSTEXPR
|
|
68
|
+
#define CXX20_CONSTEXPR_DEVICE __DEVICE__
|
|
69
|
+
#else
|
|
70
|
+
#define CXX20_CONSTEXPR_DEVICE
|
|
71
|
+
#endif
|
|
72
|
+
template <class _Tp>
|
|
73
|
+
CXX20_CONSTEXPR_DEVICE std::complex<_Tp> conj(const std::complex<_Tp> &__c) {
|
|
74
|
+
return std::complex<_Tp>(__c.real(), -__c.imag());
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// proj
|
|
78
|
+
|
|
79
|
+
template <class _Tp> std::complex<_Tp> proj(const std::complex<_Tp> &__c) {
|
|
80
|
+
std::complex<_Tp> __r = __c;
|
|
81
|
+
if (std::isinf(__c.real()) || std::isinf(__c.imag()))
|
|
82
|
+
__r = std::complex<_Tp>(INFINITY, copysign(_Tp(0), __c.imag()));
|
|
83
|
+
return __r;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// polar
|
|
87
|
+
|
|
88
|
+
template <class _Tp>
|
|
89
|
+
complex<_Tp> polar(const _Tp &__rho, const _Tp &__theta = _Tp()) {
|
|
90
|
+
if (std::isnan(__rho) || signbit(__rho))
|
|
91
|
+
return std::complex<_Tp>(_Tp(NAN), _Tp(NAN));
|
|
92
|
+
if (std::isnan(__theta)) {
|
|
93
|
+
if (std::isinf(__rho))
|
|
94
|
+
return std::complex<_Tp>(__rho, __theta);
|
|
95
|
+
return std::complex<_Tp>(__theta, __theta);
|
|
96
|
+
}
|
|
97
|
+
if (std::isinf(__theta)) {
|
|
98
|
+
if (std::isinf(__rho))
|
|
99
|
+
return std::complex<_Tp>(__rho, _Tp(NAN));
|
|
100
|
+
return std::complex<_Tp>(_Tp(NAN), _Tp(NAN));
|
|
101
|
+
}
|
|
102
|
+
_Tp __x = __rho * cos(__theta);
|
|
103
|
+
if (std::isnan(__x))
|
|
104
|
+
__x = 0;
|
|
105
|
+
_Tp __y = __rho * sin(__theta);
|
|
106
|
+
if (std::isnan(__y))
|
|
107
|
+
__y = 0;
|
|
108
|
+
return std::complex<_Tp>(__x, __y);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// log
|
|
112
|
+
|
|
113
|
+
template <class _Tp> std::complex<_Tp> log(const std::complex<_Tp> &__x) {
|
|
114
|
+
return std::complex<_Tp>(log(abs(__x)), arg(__x));
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// log10
|
|
118
|
+
|
|
119
|
+
template <class _Tp> std::complex<_Tp> log10(const std::complex<_Tp> &__x) {
|
|
120
|
+
return log(__x) / log(_Tp(10));
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// sqrt
|
|
124
|
+
|
|
125
|
+
template <class _Tp>
|
|
126
|
+
__DEVICE__ std::complex<_Tp> sqrt(const std::complex<_Tp> &__x) {
|
|
127
|
+
if (std::isinf(__x.imag()))
|
|
128
|
+
return std::complex<_Tp>(_Tp(INFINITY), __x.imag());
|
|
129
|
+
if (std::isinf(__x.real())) {
|
|
130
|
+
if (__x.real() > _Tp(0))
|
|
131
|
+
return std::complex<_Tp>(__x.real(), std::isnan(__x.imag())
|
|
132
|
+
? __x.imag()
|
|
133
|
+
: copysign(_Tp(0), __x.imag()));
|
|
134
|
+
return std::complex<_Tp>(std::isnan(__x.imag()) ? __x.imag() : _Tp(0),
|
|
135
|
+
copysign(__x.real(), __x.imag()));
|
|
136
|
+
}
|
|
137
|
+
return polar(sqrt(abs(__x)), arg(__x) / _Tp(2));
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// exp
|
|
141
|
+
|
|
142
|
+
template <class _Tp>
|
|
143
|
+
__DEVICE__ std::complex<_Tp> exp(const std::complex<_Tp> &__x) {
|
|
144
|
+
_Tp __i = __x.imag();
|
|
145
|
+
if (std::isinf(__x.real())) {
|
|
146
|
+
if (__x.real() < _Tp(0)) {
|
|
147
|
+
if (!std::isfinite(__i))
|
|
148
|
+
__i = _Tp(1);
|
|
149
|
+
} else if (__i == 0 || !std::isfinite(__i)) {
|
|
150
|
+
if (std::isinf(__i))
|
|
151
|
+
__i = _Tp(NAN);
|
|
152
|
+
return std::complex<_Tp>(__x.real(), __i);
|
|
153
|
+
}
|
|
154
|
+
} else if (std::isnan(__x.real()) && __x.imag() == 0)
|
|
155
|
+
return __x;
|
|
156
|
+
_Tp __e = exp(__x.real());
|
|
157
|
+
return std::complex<_Tp>(__e * cos(__i), __e * sin(__i));
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// pow
|
|
161
|
+
|
|
162
|
+
template <class _Tp>
|
|
163
|
+
std::complex<_Tp> pow(const std::complex<_Tp> &__x,
|
|
164
|
+
const std::complex<_Tp> &__y) {
|
|
165
|
+
return exp(__y * log(__x));
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// __sqr, computes pow(x, 2)
|
|
169
|
+
|
|
170
|
+
template <class _Tp> std::complex<_Tp> __sqr(const std::complex<_Tp> &__x) {
|
|
171
|
+
return std::complex<_Tp>((__x.real() - __x.imag()) *
|
|
172
|
+
(__x.real() + __x.imag()),
|
|
173
|
+
_Tp(2) * __x.real() * __x.imag());
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// asinh
|
|
177
|
+
|
|
178
|
+
template <class _Tp>
|
|
179
|
+
__DEVICE__ std::complex<_Tp> asinh(const std::complex<_Tp> &__x) {
|
|
180
|
+
const _Tp __pi(atan2(+0., -0.));
|
|
181
|
+
if (std::isinf(__x.real())) {
|
|
182
|
+
if (std::isnan(__x.imag()))
|
|
183
|
+
return __x;
|
|
184
|
+
if (std::isinf(__x.imag()))
|
|
185
|
+
return std::complex<_Tp>(__x.real(),
|
|
186
|
+
copysign(__pi * _Tp(0.25), __x.imag()));
|
|
187
|
+
return std::complex<_Tp>(__x.real(), copysign(_Tp(0), __x.imag()));
|
|
188
|
+
}
|
|
189
|
+
if (std::isnan(__x.real())) {
|
|
190
|
+
if (std::isinf(__x.imag()))
|
|
191
|
+
return std::complex<_Tp>(__x.imag(), __x.real());
|
|
192
|
+
if (__x.imag() == 0)
|
|
193
|
+
return __x;
|
|
194
|
+
return std::complex<_Tp>(__x.real(), __x.real());
|
|
195
|
+
}
|
|
196
|
+
if (std::isinf(__x.imag()))
|
|
197
|
+
return std::complex<_Tp>(copysign(__x.imag(), __x.real()),
|
|
198
|
+
copysign(__pi / _Tp(2), __x.imag()));
|
|
199
|
+
std::complex<_Tp> __z = log(__x + sqrt(__sqr(__x) + _Tp(1)));
|
|
200
|
+
return std::complex<_Tp>(copysign(__z.real(), __x.real()),
|
|
201
|
+
copysign(__z.imag(), __x.imag()));
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// acosh
|
|
205
|
+
|
|
206
|
+
template <class _Tp>
|
|
207
|
+
__DEVICE__ std::complex<_Tp> acosh(const std::complex<_Tp> &__x) {
|
|
208
|
+
const _Tp __pi(atan2(+0., -0.));
|
|
209
|
+
if (std::isinf(__x.real())) {
|
|
210
|
+
if (std::isnan(__x.imag()))
|
|
211
|
+
return std::complex<_Tp>(abs(__x.real()), __x.imag());
|
|
212
|
+
if (std::isinf(__x.imag())) {
|
|
213
|
+
if (__x.real() > 0)
|
|
214
|
+
return std::complex<_Tp>(__x.real(),
|
|
215
|
+
copysign(__pi * _Tp(0.25), __x.imag()));
|
|
216
|
+
else
|
|
217
|
+
return std::complex<_Tp>(-__x.real(),
|
|
218
|
+
copysign(__pi * _Tp(0.75), __x.imag()));
|
|
219
|
+
}
|
|
220
|
+
if (__x.real() < 0)
|
|
221
|
+
return std::complex<_Tp>(-__x.real(), copysign(__pi, __x.imag()));
|
|
222
|
+
return std::complex<_Tp>(__x.real(), copysign(_Tp(0), __x.imag()));
|
|
223
|
+
}
|
|
224
|
+
if (std::isnan(__x.real())) {
|
|
225
|
+
if (std::isinf(__x.imag()))
|
|
226
|
+
return std::complex<_Tp>(abs(__x.imag()), __x.real());
|
|
227
|
+
return std::complex<_Tp>(__x.real(), __x.real());
|
|
228
|
+
}
|
|
229
|
+
if (std::isinf(__x.imag()))
|
|
230
|
+
return std::complex<_Tp>(abs(__x.imag()),
|
|
231
|
+
copysign(__pi / _Tp(2), __x.imag()));
|
|
232
|
+
std::complex<_Tp> __z = log(__x + sqrt(__sqr(__x) - _Tp(1)));
|
|
233
|
+
return std::complex<_Tp>(copysign(__z.real(), _Tp(0)),
|
|
234
|
+
copysign(__z.imag(), __x.imag()));
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
// atanh
|
|
238
|
+
|
|
239
|
+
template <class _Tp>
|
|
240
|
+
__DEVICE__ std::complex<_Tp> atanh(const std::complex<_Tp> &__x) {
|
|
241
|
+
const _Tp __pi(atan2(+0., -0.));
|
|
242
|
+
if (std::isinf(__x.imag())) {
|
|
243
|
+
return std::complex<_Tp>(copysign(_Tp(0), __x.real()),
|
|
244
|
+
copysign(__pi / _Tp(2), __x.imag()));
|
|
245
|
+
}
|
|
246
|
+
if (std::isnan(__x.imag())) {
|
|
247
|
+
if (std::isinf(__x.real()) || __x.real() == 0)
|
|
248
|
+
return std::complex<_Tp>(copysign(_Tp(0), __x.real()), __x.imag());
|
|
249
|
+
return std::complex<_Tp>(__x.imag(), __x.imag());
|
|
250
|
+
}
|
|
251
|
+
if (std::isnan(__x.real())) {
|
|
252
|
+
return std::complex<_Tp>(__x.real(), __x.real());
|
|
253
|
+
}
|
|
254
|
+
if (std::isinf(__x.real())) {
|
|
255
|
+
return std::complex<_Tp>(copysign(_Tp(0), __x.real()),
|
|
256
|
+
copysign(__pi / _Tp(2), __x.imag()));
|
|
257
|
+
}
|
|
258
|
+
if (abs(__x.real()) == _Tp(1) && __x.imag() == _Tp(0)) {
|
|
259
|
+
return std::complex<_Tp>(copysign(_Tp(INFINITY), __x.real()),
|
|
260
|
+
copysign(_Tp(0), __x.imag()));
|
|
261
|
+
}
|
|
262
|
+
std::complex<_Tp> __z = log((_Tp(1) + __x) / (_Tp(1) - __x)) / _Tp(2);
|
|
263
|
+
return std::complex<_Tp>(copysign(__z.real(), __x.real()),
|
|
264
|
+
copysign(__z.imag(), __x.imag()));
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
// sinh
|
|
268
|
+
|
|
269
|
+
template <class _Tp>
|
|
270
|
+
__DEVICE__ std::complex<_Tp> sinh(const std::complex<_Tp> &__x) {
|
|
271
|
+
if (std::isinf(__x.real()) && !std::isfinite(__x.imag()))
|
|
272
|
+
return std::complex<_Tp>(__x.real(), _Tp(NAN));
|
|
273
|
+
if (__x.real() == 0 && !std::isfinite(__x.imag()))
|
|
274
|
+
return std::complex<_Tp>(__x.real(), _Tp(NAN));
|
|
275
|
+
if (__x.imag() == 0 && !std::isfinite(__x.real()))
|
|
276
|
+
return __x;
|
|
277
|
+
return std::complex<_Tp>(sinh(__x.real()) * cos(__x.imag()),
|
|
278
|
+
cosh(__x.real()) * sin(__x.imag()));
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
// cosh
|
|
282
|
+
|
|
283
|
+
template <class _Tp>
|
|
284
|
+
__DEVICE__ std::complex<_Tp> cosh(const std::complex<_Tp> &__x) {
|
|
285
|
+
if (std::isinf(__x.real()) && !std::isfinite(__x.imag()))
|
|
286
|
+
return std::complex<_Tp>(abs(__x.real()), _Tp(NAN));
|
|
287
|
+
if (__x.real() == 0 && !std::isfinite(__x.imag()))
|
|
288
|
+
return std::complex<_Tp>(_Tp(NAN), __x.real());
|
|
289
|
+
if (__x.real() == 0 && __x.imag() == 0)
|
|
290
|
+
return std::complex<_Tp>(_Tp(1), __x.imag());
|
|
291
|
+
if (__x.imag() == 0 && !std::isfinite(__x.real()))
|
|
292
|
+
return std::complex<_Tp>(abs(__x.real()), __x.imag());
|
|
293
|
+
return std::complex<_Tp>(cosh(__x.real()) * cos(__x.imag()),
|
|
294
|
+
sinh(__x.real()) * sin(__x.imag()));
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
// tanh
|
|
298
|
+
|
|
299
|
+
template <class _Tp>
|
|
300
|
+
__DEVICE__ std::complex<_Tp> tanh(const std::complex<_Tp> &__x) {
|
|
301
|
+
if (std::isinf(__x.real())) {
|
|
302
|
+
if (!std::isfinite(__x.imag()))
|
|
303
|
+
return std::complex<_Tp>(_Tp(1), _Tp(0));
|
|
304
|
+
return std::complex<_Tp>(_Tp(1),
|
|
305
|
+
copysign(_Tp(0), sin(_Tp(2) * __x.imag())));
|
|
306
|
+
}
|
|
307
|
+
if (std::isnan(__x.real()) && __x.imag() == 0)
|
|
308
|
+
return __x;
|
|
309
|
+
_Tp __2r(_Tp(2) * __x.real());
|
|
310
|
+
_Tp __2i(_Tp(2) * __x.imag());
|
|
311
|
+
_Tp __d(cosh(__2r) + cos(__2i));
|
|
312
|
+
_Tp __2rsh(sinh(__2r));
|
|
313
|
+
if (std::isinf(__2rsh) && std::isinf(__d))
|
|
314
|
+
return std::complex<_Tp>(__2rsh > _Tp(0) ? _Tp(1) : _Tp(-1),
|
|
315
|
+
__2i > _Tp(0) ? _Tp(0) : _Tp(-0.));
|
|
316
|
+
return std::complex<_Tp>(__2rsh / __d, sin(__2i) / __d);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
// asin
|
|
320
|
+
|
|
321
|
+
template <class _Tp>
|
|
322
|
+
__DEVICE__ std::complex<_Tp> asin(const std::complex<_Tp> &__x) {
|
|
323
|
+
std::complex<_Tp> __z = asinh(complex<_Tp>(-__x.imag(), __x.real()));
|
|
324
|
+
return std::complex<_Tp>(__z.imag(), -__z.real());
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
// acos
|
|
328
|
+
|
|
329
|
+
template <class _Tp>
|
|
330
|
+
__DEVICE__ std::complex<_Tp> acos(const std::complex<_Tp> &__x) {
|
|
331
|
+
const _Tp __pi(atan2(+0., -0.));
|
|
332
|
+
if (std::isinf(__x.real())) {
|
|
333
|
+
if (std::isnan(__x.imag()))
|
|
334
|
+
return std::complex<_Tp>(__x.imag(), __x.real());
|
|
335
|
+
if (std::isinf(__x.imag())) {
|
|
336
|
+
if (__x.real() < _Tp(0))
|
|
337
|
+
return std::complex<_Tp>(_Tp(0.75) * __pi, -__x.imag());
|
|
338
|
+
return std::complex<_Tp>(_Tp(0.25) * __pi, -__x.imag());
|
|
339
|
+
}
|
|
340
|
+
if (__x.real() < _Tp(0))
|
|
341
|
+
return std::complex<_Tp>(__pi,
|
|
342
|
+
signbit(__x.imag()) ? -__x.real() : __x.real());
|
|
343
|
+
return std::complex<_Tp>(_Tp(0),
|
|
344
|
+
signbit(__x.imag()) ? __x.real() : -__x.real());
|
|
345
|
+
}
|
|
346
|
+
if (std::isnan(__x.real())) {
|
|
347
|
+
if (std::isinf(__x.imag()))
|
|
348
|
+
return std::complex<_Tp>(__x.real(), -__x.imag());
|
|
349
|
+
return std::complex<_Tp>(__x.real(), __x.real());
|
|
350
|
+
}
|
|
351
|
+
if (std::isinf(__x.imag()))
|
|
352
|
+
return std::complex<_Tp>(__pi / _Tp(2), -__x.imag());
|
|
353
|
+
if (__x.real() == 0 && (__x.imag() == 0 || isnan(__x.imag())))
|
|
354
|
+
return std::complex<_Tp>(__pi / _Tp(2), -__x.imag());
|
|
355
|
+
std::complex<_Tp> __z = log(__x + sqrt(__sqr(__x) - _Tp(1)));
|
|
356
|
+
if (signbit(__x.imag()))
|
|
357
|
+
return std::complex<_Tp>(abs(__z.imag()), abs(__z.real()));
|
|
358
|
+
return std::complex<_Tp>(abs(__z.imag()), -abs(__z.real()));
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
// atan
|
|
362
|
+
|
|
363
|
+
template <class _Tp>
|
|
364
|
+
__DEVICE__ std::complex<_Tp> atan(const std::complex<_Tp> &__x) {
|
|
365
|
+
std::complex<_Tp> __z = atanh(complex<_Tp>(-__x.imag(), __x.real()));
|
|
366
|
+
return std::complex<_Tp>(__z.imag(), -__z.real());
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
// sin
|
|
370
|
+
|
|
371
|
+
template <class _Tp>
|
|
372
|
+
__DEVICE__ std::complex<_Tp> sin(const std::complex<_Tp> &__x) {
|
|
373
|
+
std::complex<_Tp> __z = sinh(complex<_Tp>(-__x.imag(), __x.real()));
|
|
374
|
+
return std::complex<_Tp>(__z.imag(), -__z.real());
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
// cos
|
|
378
|
+
|
|
379
|
+
template <class _Tp> std::complex<_Tp> cos(const std::complex<_Tp> &__x) {
|
|
380
|
+
return cosh(complex<_Tp>(-__x.imag(), __x.real()));
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
// tan
|
|
384
|
+
|
|
385
|
+
template <class _Tp>
|
|
386
|
+
__DEVICE__ std::complex<_Tp> tan(const std::complex<_Tp> &__x) {
|
|
387
|
+
std::complex<_Tp> __z = tanh(complex<_Tp>(-__x.imag(), __x.real()));
|
|
388
|
+
return std::complex<_Tp>(__z.imag(), -__z.real());
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
} // namespace std
|
|
392
|
+
|
|
393
|
+
#endif
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/*===---- openmp_wrapper/math.h -------- OpenMP math.h intercept ------ 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-exception
|
|
6
|
+
*
|
|
7
|
+
*===-----------------------------------------------------------------------===
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
// If we are in C++ mode and include <math.h> (not <cmath>) first, we still need
|
|
11
|
+
// to make sure <cmath> is read first. The problem otherwise is that we haven't
|
|
12
|
+
// seen the declarations of the math.h functions when the system math.h includes
|
|
13
|
+
// our cmath overlay. However, our cmath overlay, or better the underlying
|
|
14
|
+
// overlay, e.g. CUDA, uses the math.h functions. Since we haven't declared them
|
|
15
|
+
// yet we get errors. CUDA avoids this by eagerly declaring all math functions
|
|
16
|
+
// (in the __device__ space) but we cannot do this. Instead we break the
|
|
17
|
+
// dependence by forcing cmath to go first. While our cmath will in turn include
|
|
18
|
+
// this file, the cmath guards will prevent recursion.
|
|
19
|
+
#ifdef __cplusplus
|
|
20
|
+
#include <cmath>
|
|
21
|
+
#endif
|
|
22
|
+
|
|
23
|
+
#ifndef __CLANG_OPENMP_MATH_H__
|
|
24
|
+
#define __CLANG_OPENMP_MATH_H__
|
|
25
|
+
|
|
26
|
+
#ifndef _OPENMP
|
|
27
|
+
#error "This file is for OpenMP compilation only."
|
|
28
|
+
#endif
|
|
29
|
+
|
|
30
|
+
#include_next <math.h>
|
|
31
|
+
|
|
32
|
+
// We need limits.h for __clang_cuda_math.h below and because it should not hurt
|
|
33
|
+
// we include it eagerly here.
|
|
34
|
+
#include <limits.h>
|
|
35
|
+
|
|
36
|
+
// We need stdlib.h because (for now) __clang_cuda_math.h below declares `abs`
|
|
37
|
+
// which should live in stdlib.h.
|
|
38
|
+
#include <stdlib.h>
|
|
39
|
+
|
|
40
|
+
#pragma omp begin declare variant match( \
|
|
41
|
+
device = {arch(nvptx, nvptx64)}, implementation = {extension(match_any)})
|
|
42
|
+
|
|
43
|
+
#define __CUDA__
|
|
44
|
+
#define __OPENMP_NVPTX__
|
|
45
|
+
#include <__clang_cuda_math.h>
|
|
46
|
+
#undef __OPENMP_NVPTX__
|
|
47
|
+
#undef __CUDA__
|
|
48
|
+
|
|
49
|
+
#pragma omp end declare variant
|
|
50
|
+
|
|
51
|
+
#ifdef __AMDGCN__
|
|
52
|
+
#pragma omp begin declare variant match(device = {arch(amdgcn)})
|
|
53
|
+
|
|
54
|
+
#define __OPENMP_AMDGCN__
|
|
55
|
+
#include <__clang_hip_math.h>
|
|
56
|
+
#undef __OPENMP_AMDGCN__
|
|
57
|
+
|
|
58
|
+
#pragma omp end declare variant
|
|
59
|
+
#endif
|
|
60
|
+
|
|
61
|
+
#endif
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
//===--------- new - OPENMP wrapper for <new> ------------------------------===
|
|
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-exception
|
|
6
|
+
//
|
|
7
|
+
//===-----------------------------------------------------------------------===
|
|
8
|
+
|
|
9
|
+
#ifndef __CLANG_OPENMP_WRAPPERS_NEW
|
|
10
|
+
#define __CLANG_OPENMP_WRAPPERS_NEW
|
|
11
|
+
|
|
12
|
+
// We need the system <new> for the std::nothrow_t. The new/delete operators
|
|
13
|
+
// which do not use nothrow_t are provided without the <new> header.
|
|
14
|
+
#include_next <new>
|
|
15
|
+
|
|
16
|
+
#if (defined(__NVPTX__) || defined(__AMDGPU__)) && defined(_OPENMP)
|
|
17
|
+
|
|
18
|
+
#include <cstdlib>
|
|
19
|
+
|
|
20
|
+
#pragma push_macro("OPENMP_NOEXCEPT")
|
|
21
|
+
#if __cplusplus >= 201103L
|
|
22
|
+
#define OPENMP_NOEXCEPT noexcept
|
|
23
|
+
#else
|
|
24
|
+
#define OPENMP_NOEXCEPT
|
|
25
|
+
#endif
|
|
26
|
+
|
|
27
|
+
inline void *operator new(__SIZE_TYPE__ size,
|
|
28
|
+
const std::nothrow_t &) OPENMP_NOEXCEPT {
|
|
29
|
+
return ::operator new(size);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
inline void *operator new[](__SIZE_TYPE__ size, const std::nothrow_t &) {
|
|
33
|
+
return ::operator new(size);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
inline void operator delete(void *ptr, const std::nothrow_t &)OPENMP_NOEXCEPT {
|
|
37
|
+
::operator delete(ptr);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
inline void operator delete[](void *ptr,
|
|
41
|
+
const std::nothrow_t &) OPENMP_NOEXCEPT {
|
|
42
|
+
::operator delete(ptr);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
#pragma pop_macro("OPENMP_NOEXCEPT")
|
|
46
|
+
#endif
|
|
47
|
+
|
|
48
|
+
#endif // include guard
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/*===---- pconfigintrin.h - X86 platform configuration ---------------------===
|
|
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-exception
|
|
6
|
+
*
|
|
7
|
+
*===-----------------------------------------------------------------------===
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
#if !defined __X86INTRIN_H && !defined __IMMINTRIN_H
|
|
11
|
+
#error "Never use <pconfigintrin.h> directly; include <x86intrin.h> instead."
|
|
12
|
+
#endif
|
|
13
|
+
|
|
14
|
+
#ifndef __PCONFIGINTRIN_H
|
|
15
|
+
#define __PCONFIGINTRIN_H
|
|
16
|
+
|
|
17
|
+
#define __PCONFIG_KEY_PROGRAM 0x00000001
|
|
18
|
+
|
|
19
|
+
#if __has_extension(gnu_asm)
|
|
20
|
+
|
|
21
|
+
/* Define the default attributes for the functions in this file. */
|
|
22
|
+
#define __DEFAULT_FN_ATTRS \
|
|
23
|
+
__attribute__((__always_inline__, __nodebug__, __target__("pconfig")))
|
|
24
|
+
|
|
25
|
+
static __inline unsigned int __DEFAULT_FN_ATTRS
|
|
26
|
+
_pconfig_u32(unsigned int __leaf, __SIZE_TYPE__ __d[])
|
|
27
|
+
{
|
|
28
|
+
unsigned int __result;
|
|
29
|
+
__asm__ ("pconfig"
|
|
30
|
+
: "=a" (__result), "=b" (__d[0]), "=c" (__d[1]), "=d" (__d[2])
|
|
31
|
+
: "a" (__leaf), "b" (__d[0]), "c" (__d[1]), "d" (__d[2])
|
|
32
|
+
: "cc");
|
|
33
|
+
return __result;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
#undef __DEFAULT_FN_ATTRS
|
|
37
|
+
|
|
38
|
+
#endif /* __has_extension(gnu_asm) */
|
|
39
|
+
|
|
40
|
+
#endif
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/*===---- pkuintrin.h - PKU intrinsics -------------------------------------===
|
|
2
|
+
*
|
|
3
|
+
*
|
|
4
|
+
* Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
5
|
+
* See https://llvm.org/LICENSE.txt for license information.
|
|
6
|
+
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
7
|
+
*
|
|
8
|
+
*===-----------------------------------------------------------------------===
|
|
9
|
+
*/
|
|
10
|
+
#ifndef __IMMINTRIN_H
|
|
11
|
+
#error "Never use <pkuintrin.h> directly; include <immintrin.h> instead."
|
|
12
|
+
#endif
|
|
13
|
+
|
|
14
|
+
#ifndef __PKUINTRIN_H
|
|
15
|
+
#define __PKUINTRIN_H
|
|
16
|
+
|
|
17
|
+
/* Define the default attributes for the functions in this file. */
|
|
18
|
+
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("pku")))
|
|
19
|
+
|
|
20
|
+
static __inline__ unsigned int __DEFAULT_FN_ATTRS
|
|
21
|
+
_rdpkru_u32(void)
|
|
22
|
+
{
|
|
23
|
+
return __builtin_ia32_rdpkru();
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
static __inline__ void __DEFAULT_FN_ATTRS
|
|
27
|
+
_wrpkru(unsigned int __val)
|
|
28
|
+
{
|
|
29
|
+
__builtin_ia32_wrpkru(__val);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
#undef __DEFAULT_FN_ATTRS
|
|
33
|
+
|
|
34
|
+
#endif
|