@cpp-linter/clang-tidy-win32-x64 12.0.1
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.TXT +279 -0
- package/README.md +7 -0
- package/bin/clang-tidy.exe +4 -0
- package/lib/clang/12.0.1/include/__clang_cuda_builtin_vars.h +121 -0
- package/lib/clang/12.0.1/include/__clang_cuda_cmath.h +512 -0
- package/lib/clang/12.0.1/include/__clang_cuda_complex_builtins.h +285 -0
- package/lib/clang/12.0.1/include/__clang_cuda_device_functions.h +1486 -0
- package/lib/clang/12.0.1/include/__clang_cuda_intrinsics.h +486 -0
- package/lib/clang/12.0.1/include/__clang_cuda_libdevice_declares.h +462 -0
- package/lib/clang/12.0.1/include/__clang_cuda_math.h +348 -0
- package/lib/clang/12.0.1/include/__clang_cuda_math_forward_declares.h +284 -0
- package/lib/clang/12.0.1/include/__clang_cuda_runtime_wrapper.h +443 -0
- package/lib/clang/12.0.1/include/__clang_hip_cmath.h +664 -0
- package/lib/clang/12.0.1/include/__clang_hip_libdevice_declares.h +334 -0
- package/lib/clang/12.0.1/include/__clang_hip_math.h +1275 -0
- package/lib/clang/12.0.1/include/__clang_hip_runtime_wrapper.h +69 -0
- package/lib/clang/12.0.1/include/__stddef_max_align_t.h +27 -0
- package/lib/clang/12.0.1/include/__wmmintrin_aes.h +140 -0
- package/lib/clang/12.0.1/include/__wmmintrin_pclmul.h +48 -0
- package/lib/clang/12.0.1/include/adxintrin.h +72 -0
- package/lib/clang/12.0.1/include/altivec.h +18239 -0
- package/lib/clang/12.0.1/include/ammintrin.h +179 -0
- package/lib/clang/12.0.1/include/amxintrin.h +278 -0
- package/lib/clang/12.0.1/include/arm64intr.h +35 -0
- package/lib/clang/12.0.1/include/arm_acle.h +716 -0
- package/lib/clang/12.0.1/include/arm_bf16.h +20 -0
- package/lib/clang/12.0.1/include/arm_cde.h +410 -0
- package/lib/clang/12.0.1/include/arm_cmse.h +217 -0
- package/lib/clang/12.0.1/include/arm_fp16.h +596 -0
- package/lib/clang/12.0.1/include/arm_mve.h +19187 -0
- package/lib/clang/12.0.1/include/arm_neon.h +68982 -0
- package/lib/clang/12.0.1/include/arm_sve.h +18148 -0
- package/lib/clang/12.0.1/include/armintr.h +31 -0
- package/lib/clang/12.0.1/include/avx2intrin.h +1148 -0
- package/lib/clang/12.0.1/include/avx512bf16intrin.h +279 -0
- package/lib/clang/12.0.1/include/avx512bitalgintrin.h +83 -0
- package/lib/clang/12.0.1/include/avx512bwintrin.h +2024 -0
- package/lib/clang/12.0.1/include/avx512cdintrin.h +123 -0
- package/lib/clang/12.0.1/include/avx512dqintrin.h +1377 -0
- package/lib/clang/12.0.1/include/avx512erintrin.h +271 -0
- package/lib/clang/12.0.1/include/avx512fintrin.h +9618 -0
- package/lib/clang/12.0.1/include/avx512ifmaintrin.h +68 -0
- package/lib/clang/12.0.1/include/avx512ifmavlintrin.h +119 -0
- package/lib/clang/12.0.1/include/avx512pfintrin.h +97 -0
- package/lib/clang/12.0.1/include/avx512vbmi2intrin.h +357 -0
- package/lib/clang/12.0.1/include/avx512vbmiintrin.h +105 -0
- package/lib/clang/12.0.1/include/avx512vbmivlintrin.h +188 -0
- package/lib/clang/12.0.1/include/avx512vlbf16intrin.h +474 -0
- package/lib/clang/12.0.1/include/avx512vlbitalgintrin.h +145 -0
- package/lib/clang/12.0.1/include/avx512vlbwintrin.h +2809 -0
- package/lib/clang/12.0.1/include/avx512vlcdintrin.h +225 -0
- package/lib/clang/12.0.1/include/avx512vldqintrin.h +1167 -0
- package/lib/clang/12.0.1/include/avx512vlintrin.h +8445 -0
- package/lib/clang/12.0.1/include/avx512vlvbmi2intrin.h +689 -0
- package/lib/clang/12.0.1/include/avx512vlvnniintrin.h +304 -0
- package/lib/clang/12.0.1/include/avx512vlvp2intersectintrin.h +121 -0
- package/lib/clang/12.0.1/include/avx512vnniintrin.h +115 -0
- package/lib/clang/12.0.1/include/avx512vp2intersectintrin.h +77 -0
- package/lib/clang/12.0.1/include/avx512vpopcntdqintrin.h +54 -0
- package/lib/clang/12.0.1/include/avx512vpopcntdqvlintrin.h +91 -0
- package/lib/clang/12.0.1/include/avxintrin.h +5053 -0
- package/lib/clang/12.0.1/include/avxvnniintrin.h +225 -0
- package/lib/clang/12.0.1/include/bmi2intrin.h +81 -0
- package/lib/clang/12.0.1/include/bmiintrin.h +427 -0
- package/lib/clang/12.0.1/include/cet.h +66 -0
- package/lib/clang/12.0.1/include/cetintrin.h +99 -0
- package/lib/clang/12.0.1/include/cldemoteintrin.h +36 -0
- package/lib/clang/12.0.1/include/clflushoptintrin.h +27 -0
- package/lib/clang/12.0.1/include/clwbintrin.h +38 -0
- package/lib/clang/12.0.1/include/clzerointrin.h +36 -0
- package/lib/clang/12.0.1/include/cpuid.h +319 -0
- package/lib/clang/12.0.1/include/cuda_wrappers/algorithm +116 -0
- package/lib/clang/12.0.1/include/cuda_wrappers/complex +82 -0
- package/lib/clang/12.0.1/include/cuda_wrappers/new +106 -0
- package/lib/clang/12.0.1/include/emmintrin.h +4981 -0
- package/lib/clang/12.0.1/include/enqcmdintrin.h +63 -0
- package/lib/clang/12.0.1/include/f16cintrin.h +162 -0
- package/lib/clang/12.0.1/include/float.h +152 -0
- package/lib/clang/12.0.1/include/fma4intrin.h +218 -0
- package/lib/clang/12.0.1/include/fmaintrin.h +216 -0
- package/lib/clang/12.0.1/include/fxsrintrin.h +91 -0
- package/lib/clang/12.0.1/include/gfniintrin.h +193 -0
- package/lib/clang/12.0.1/include/hresetintrin.h +49 -0
- package/lib/clang/12.0.1/include/htmintrin.h +212 -0
- package/lib/clang/12.0.1/include/htmxlintrin.h +345 -0
- package/lib/clang/12.0.1/include/ia32intrin.h +441 -0
- package/lib/clang/12.0.1/include/immintrin.h +600 -0
- package/lib/clang/12.0.1/include/intrin.h +585 -0
- package/lib/clang/12.0.1/include/inttypes.h +97 -0
- package/lib/clang/12.0.1/include/invpcidintrin.h +23 -0
- package/lib/clang/12.0.1/include/iso646.h +27 -0
- package/lib/clang/12.0.1/include/keylockerintrin.h +506 -0
- package/lib/clang/12.0.1/include/limits.h +102 -0
- package/lib/clang/12.0.1/include/lwpintrin.h +136 -0
- package/lib/clang/12.0.1/include/lzcntintrin.h +104 -0
- package/lib/clang/12.0.1/include/mm3dnow.h +157 -0
- package/lib/clang/12.0.1/include/mm_malloc.h +67 -0
- package/lib/clang/12.0.1/include/mmintrin.h +1558 -0
- package/lib/clang/12.0.1/include/module.modulemap +164 -0
- package/lib/clang/12.0.1/include/movdirintrin.h +49 -0
- package/lib/clang/12.0.1/include/msa.h +573 -0
- package/lib/clang/12.0.1/include/mwaitxintrin.h +33 -0
- package/lib/clang/12.0.1/include/nmmintrin.h +16 -0
- package/lib/clang/12.0.1/include/opencl-c-base.h +589 -0
- package/lib/clang/12.0.1/include/opencl-c.h +17162 -0
- package/lib/clang/12.0.1/include/openmp_wrappers/__clang_openmp_device_functions.h +42 -0
- package/lib/clang/12.0.1/include/openmp_wrappers/cmath +78 -0
- package/lib/clang/12.0.1/include/openmp_wrappers/complex +52 -0
- package/lib/clang/12.0.1/include/openmp_wrappers/complex.h +27 -0
- package/lib/clang/12.0.1/include/openmp_wrappers/complex_cmath.h +388 -0
- package/lib/clang/12.0.1/include/openmp_wrappers/math.h +51 -0
- package/lib/clang/12.0.1/include/openmp_wrappers/new +70 -0
- package/lib/clang/12.0.1/include/pconfigintrin.h +40 -0
- package/lib/clang/12.0.1/include/pkuintrin.h +34 -0
- package/lib/clang/12.0.1/include/pmmintrin.h +290 -0
- package/lib/clang/12.0.1/include/popcntintrin.h +59 -0
- package/lib/clang/12.0.1/include/ppc_wrappers/emmintrin.h +2324 -0
- package/lib/clang/12.0.1/include/ppc_wrappers/mm_malloc.h +50 -0
- package/lib/clang/12.0.1/include/ppc_wrappers/mmintrin.h +1450 -0
- package/lib/clang/12.0.1/include/ppc_wrappers/pmmintrin.h +150 -0
- package/lib/clang/12.0.1/include/ppc_wrappers/smmintrin.h +109 -0
- package/lib/clang/12.0.1/include/ppc_wrappers/tmmintrin.h +495 -0
- package/lib/clang/12.0.1/include/ppc_wrappers/xmmintrin.h +1843 -0
- package/lib/clang/12.0.1/include/prfchwintrin.h +55 -0
- package/lib/clang/12.0.1/include/ptwriteintrin.h +37 -0
- package/lib/clang/12.0.1/include/rdseedintrin.h +42 -0
- package/lib/clang/12.0.1/include/rtmintrin.h +45 -0
- package/lib/clang/12.0.1/include/s390intrin.h +25 -0
- package/lib/clang/12.0.1/include/serializeintrin.h +30 -0
- package/lib/clang/12.0.1/include/sgxintrin.h +60 -0
- package/lib/clang/12.0.1/include/shaintrin.h +61 -0
- package/lib/clang/12.0.1/include/smmintrin.h +2430 -0
- package/lib/clang/12.0.1/include/stdalign.h +21 -0
- package/lib/clang/12.0.1/include/stdarg.h +35 -0
- package/lib/clang/12.0.1/include/stdatomic.h +176 -0
- package/lib/clang/12.0.1/include/stdbool.h +31 -0
- package/lib/clang/12.0.1/include/stddef.h +121 -0
- package/lib/clang/12.0.1/include/stdint.h +693 -0
- package/lib/clang/12.0.1/include/stdnoreturn.h +16 -0
- package/lib/clang/12.0.1/include/tbmintrin.h +140 -0
- package/lib/clang/12.0.1/include/tgmath.h +1368 -0
- package/lib/clang/12.0.1/include/tmmintrin.h +771 -0
- package/lib/clang/12.0.1/include/tsxldtrkintrin.h +56 -0
- package/lib/clang/12.0.1/include/uintrintrin.h +150 -0
- package/lib/clang/12.0.1/include/unwind.h +327 -0
- package/lib/clang/12.0.1/include/vadefs.h +51 -0
- package/lib/clang/12.0.1/include/vaesintrin.h +84 -0
- package/lib/clang/12.0.1/include/varargs.h +12 -0
- package/lib/clang/12.0.1/include/vecintrin.h +10998 -0
- package/lib/clang/12.0.1/include/vpclmulqdqintrin.h +28 -0
- package/lib/clang/12.0.1/include/waitpkgintrin.h +42 -0
- package/lib/clang/12.0.1/include/wasm_simd128.h +1167 -0
- package/lib/clang/12.0.1/include/wbnoinvdintrin.h +24 -0
- package/lib/clang/12.0.1/include/wmmintrin.h +19 -0
- package/lib/clang/12.0.1/include/x86gprintrin.h +23 -0
- package/lib/clang/12.0.1/include/x86intrin.h +63 -0
- package/lib/clang/12.0.1/include/xmmintrin.h +3008 -0
- package/lib/clang/12.0.1/include/xopintrin.h +770 -0
- package/lib/clang/12.0.1/include/xsavecintrin.h +34 -0
- package/lib/clang/12.0.1/include/xsaveintrin.h +63 -0
- package/lib/clang/12.0.1/include/xsaveoptintrin.h +34 -0
- package/lib/clang/12.0.1/include/xsavesintrin.h +44 -0
- package/lib/clang/12.0.1/include/xtestintrin.h +27 -0
- package/package.json +32 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/*===----------------------- clzerointrin.h - CLZERO ----------------------===
|
|
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
|
+
#if !defined __X86INTRIN_H && !defined __IMMINTRIN_H
|
|
10
|
+
#error "Never use <clzerointrin.h> directly; include <x86intrin.h> instead."
|
|
11
|
+
#endif
|
|
12
|
+
|
|
13
|
+
#ifndef __CLZEROINTRIN_H
|
|
14
|
+
#define __CLZEROINTRIN_H
|
|
15
|
+
|
|
16
|
+
/* Define the default attributes for the functions in this file. */
|
|
17
|
+
#define __DEFAULT_FN_ATTRS \
|
|
18
|
+
__attribute__((__always_inline__, __nodebug__, __target__("clzero")))
|
|
19
|
+
|
|
20
|
+
/// Loads the cache line address and zero's out the cacheline
|
|
21
|
+
///
|
|
22
|
+
/// \headerfile <clzerointrin.h>
|
|
23
|
+
///
|
|
24
|
+
/// This intrinsic corresponds to the <c> CLZERO </c> instruction.
|
|
25
|
+
///
|
|
26
|
+
/// \param __line
|
|
27
|
+
/// A pointer to a cacheline which needs to be zeroed out.
|
|
28
|
+
static __inline__ void __DEFAULT_FN_ATTRS
|
|
29
|
+
_mm_clzero (void * __line)
|
|
30
|
+
{
|
|
31
|
+
__builtin_ia32_clzero ((void *)__line);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
#undef __DEFAULT_FN_ATTRS
|
|
35
|
+
|
|
36
|
+
#endif /* __CLZEROINTRIN_H */
|
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
/*===---- cpuid.h - X86 cpu model detection --------------------------------===
|
|
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
|
+
#ifndef __CPUID_H
|
|
11
|
+
#define __CPUID_H
|
|
12
|
+
|
|
13
|
+
#if !(__x86_64__ || __i386__)
|
|
14
|
+
#error this header is for x86 only
|
|
15
|
+
#endif
|
|
16
|
+
|
|
17
|
+
/* Responses identification request with %eax 0 */
|
|
18
|
+
/* AMD: "AuthenticAMD" */
|
|
19
|
+
#define signature_AMD_ebx 0x68747541
|
|
20
|
+
#define signature_AMD_edx 0x69746e65
|
|
21
|
+
#define signature_AMD_ecx 0x444d4163
|
|
22
|
+
/* CENTAUR: "CentaurHauls" */
|
|
23
|
+
#define signature_CENTAUR_ebx 0x746e6543
|
|
24
|
+
#define signature_CENTAUR_edx 0x48727561
|
|
25
|
+
#define signature_CENTAUR_ecx 0x736c7561
|
|
26
|
+
/* CYRIX: "CyrixInstead" */
|
|
27
|
+
#define signature_CYRIX_ebx 0x69727943
|
|
28
|
+
#define signature_CYRIX_edx 0x736e4978
|
|
29
|
+
#define signature_CYRIX_ecx 0x64616574
|
|
30
|
+
/* HYGON: "HygonGenuine" */
|
|
31
|
+
#define signature_HYGON_ebx 0x6f677948
|
|
32
|
+
#define signature_HYGON_edx 0x6e65476e
|
|
33
|
+
#define signature_HYGON_ecx 0x656e6975
|
|
34
|
+
/* INTEL: "GenuineIntel" */
|
|
35
|
+
#define signature_INTEL_ebx 0x756e6547
|
|
36
|
+
#define signature_INTEL_edx 0x49656e69
|
|
37
|
+
#define signature_INTEL_ecx 0x6c65746e
|
|
38
|
+
/* TM1: "TransmetaCPU" */
|
|
39
|
+
#define signature_TM1_ebx 0x6e617254
|
|
40
|
+
#define signature_TM1_edx 0x74656d73
|
|
41
|
+
#define signature_TM1_ecx 0x55504361
|
|
42
|
+
/* TM2: "GenuineTMx86" */
|
|
43
|
+
#define signature_TM2_ebx 0x756e6547
|
|
44
|
+
#define signature_TM2_edx 0x54656e69
|
|
45
|
+
#define signature_TM2_ecx 0x3638784d
|
|
46
|
+
/* NSC: "Geode by NSC" */
|
|
47
|
+
#define signature_NSC_ebx 0x646f6547
|
|
48
|
+
#define signature_NSC_edx 0x79622065
|
|
49
|
+
#define signature_NSC_ecx 0x43534e20
|
|
50
|
+
/* NEXGEN: "NexGenDriven" */
|
|
51
|
+
#define signature_NEXGEN_ebx 0x4778654e
|
|
52
|
+
#define signature_NEXGEN_edx 0x72446e65
|
|
53
|
+
#define signature_NEXGEN_ecx 0x6e657669
|
|
54
|
+
/* RISE: "RiseRiseRise" */
|
|
55
|
+
#define signature_RISE_ebx 0x65736952
|
|
56
|
+
#define signature_RISE_edx 0x65736952
|
|
57
|
+
#define signature_RISE_ecx 0x65736952
|
|
58
|
+
/* SIS: "SiS SiS SiS " */
|
|
59
|
+
#define signature_SIS_ebx 0x20536953
|
|
60
|
+
#define signature_SIS_edx 0x20536953
|
|
61
|
+
#define signature_SIS_ecx 0x20536953
|
|
62
|
+
/* UMC: "UMC UMC UMC " */
|
|
63
|
+
#define signature_UMC_ebx 0x20434d55
|
|
64
|
+
#define signature_UMC_edx 0x20434d55
|
|
65
|
+
#define signature_UMC_ecx 0x20434d55
|
|
66
|
+
/* VIA: "VIA VIA VIA " */
|
|
67
|
+
#define signature_VIA_ebx 0x20414956
|
|
68
|
+
#define signature_VIA_edx 0x20414956
|
|
69
|
+
#define signature_VIA_ecx 0x20414956
|
|
70
|
+
/* VORTEX: "Vortex86 SoC" */
|
|
71
|
+
#define signature_VORTEX_ebx 0x74726f56
|
|
72
|
+
#define signature_VORTEX_edx 0x36387865
|
|
73
|
+
#define signature_VORTEX_ecx 0x436f5320
|
|
74
|
+
|
|
75
|
+
/* Features in %ecx for leaf 1 */
|
|
76
|
+
#define bit_SSE3 0x00000001
|
|
77
|
+
#define bit_PCLMULQDQ 0x00000002
|
|
78
|
+
#define bit_PCLMUL bit_PCLMULQDQ /* for gcc compat */
|
|
79
|
+
#define bit_DTES64 0x00000004
|
|
80
|
+
#define bit_MONITOR 0x00000008
|
|
81
|
+
#define bit_DSCPL 0x00000010
|
|
82
|
+
#define bit_VMX 0x00000020
|
|
83
|
+
#define bit_SMX 0x00000040
|
|
84
|
+
#define bit_EIST 0x00000080
|
|
85
|
+
#define bit_TM2 0x00000100
|
|
86
|
+
#define bit_SSSE3 0x00000200
|
|
87
|
+
#define bit_CNXTID 0x00000400
|
|
88
|
+
#define bit_FMA 0x00001000
|
|
89
|
+
#define bit_CMPXCHG16B 0x00002000
|
|
90
|
+
#define bit_xTPR 0x00004000
|
|
91
|
+
#define bit_PDCM 0x00008000
|
|
92
|
+
#define bit_PCID 0x00020000
|
|
93
|
+
#define bit_DCA 0x00040000
|
|
94
|
+
#define bit_SSE41 0x00080000
|
|
95
|
+
#define bit_SSE4_1 bit_SSE41 /* for gcc compat */
|
|
96
|
+
#define bit_SSE42 0x00100000
|
|
97
|
+
#define bit_SSE4_2 bit_SSE42 /* for gcc compat */
|
|
98
|
+
#define bit_x2APIC 0x00200000
|
|
99
|
+
#define bit_MOVBE 0x00400000
|
|
100
|
+
#define bit_POPCNT 0x00800000
|
|
101
|
+
#define bit_TSCDeadline 0x01000000
|
|
102
|
+
#define bit_AESNI 0x02000000
|
|
103
|
+
#define bit_AES bit_AESNI /* for gcc compat */
|
|
104
|
+
#define bit_XSAVE 0x04000000
|
|
105
|
+
#define bit_OSXSAVE 0x08000000
|
|
106
|
+
#define bit_AVX 0x10000000
|
|
107
|
+
#define bit_F16C 0x20000000
|
|
108
|
+
#define bit_RDRND 0x40000000
|
|
109
|
+
|
|
110
|
+
/* Features in %edx for leaf 1 */
|
|
111
|
+
#define bit_FPU 0x00000001
|
|
112
|
+
#define bit_VME 0x00000002
|
|
113
|
+
#define bit_DE 0x00000004
|
|
114
|
+
#define bit_PSE 0x00000008
|
|
115
|
+
#define bit_TSC 0x00000010
|
|
116
|
+
#define bit_MSR 0x00000020
|
|
117
|
+
#define bit_PAE 0x00000040
|
|
118
|
+
#define bit_MCE 0x00000080
|
|
119
|
+
#define bit_CX8 0x00000100
|
|
120
|
+
#define bit_CMPXCHG8B bit_CX8 /* for gcc compat */
|
|
121
|
+
#define bit_APIC 0x00000200
|
|
122
|
+
#define bit_SEP 0x00000800
|
|
123
|
+
#define bit_MTRR 0x00001000
|
|
124
|
+
#define bit_PGE 0x00002000
|
|
125
|
+
#define bit_MCA 0x00004000
|
|
126
|
+
#define bit_CMOV 0x00008000
|
|
127
|
+
#define bit_PAT 0x00010000
|
|
128
|
+
#define bit_PSE36 0x00020000
|
|
129
|
+
#define bit_PSN 0x00040000
|
|
130
|
+
#define bit_CLFSH 0x00080000
|
|
131
|
+
#define bit_DS 0x00200000
|
|
132
|
+
#define bit_ACPI 0x00400000
|
|
133
|
+
#define bit_MMX 0x00800000
|
|
134
|
+
#define bit_FXSR 0x01000000
|
|
135
|
+
#define bit_FXSAVE bit_FXSR /* for gcc compat */
|
|
136
|
+
#define bit_SSE 0x02000000
|
|
137
|
+
#define bit_SSE2 0x04000000
|
|
138
|
+
#define bit_SS 0x08000000
|
|
139
|
+
#define bit_HTT 0x10000000
|
|
140
|
+
#define bit_TM 0x20000000
|
|
141
|
+
#define bit_PBE 0x80000000
|
|
142
|
+
|
|
143
|
+
/* Features in %ebx for leaf 7 sub-leaf 0 */
|
|
144
|
+
#define bit_FSGSBASE 0x00000001
|
|
145
|
+
#define bit_SGX 0x00000004
|
|
146
|
+
#define bit_BMI 0x00000008
|
|
147
|
+
#define bit_HLE 0x00000010
|
|
148
|
+
#define bit_AVX2 0x00000020
|
|
149
|
+
#define bit_SMEP 0x00000080
|
|
150
|
+
#define bit_BMI2 0x00000100
|
|
151
|
+
#define bit_ENH_MOVSB 0x00000200
|
|
152
|
+
#define bit_INVPCID 0x00000400
|
|
153
|
+
#define bit_RTM 0x00000800
|
|
154
|
+
#define bit_MPX 0x00004000
|
|
155
|
+
#define bit_AVX512F 0x00010000
|
|
156
|
+
#define bit_AVX512DQ 0x00020000
|
|
157
|
+
#define bit_RDSEED 0x00040000
|
|
158
|
+
#define bit_ADX 0x00080000
|
|
159
|
+
#define bit_AVX512IFMA 0x00200000
|
|
160
|
+
#define bit_CLFLUSHOPT 0x00800000
|
|
161
|
+
#define bit_CLWB 0x01000000
|
|
162
|
+
#define bit_AVX512PF 0x04000000
|
|
163
|
+
#define bit_AVX512ER 0x08000000
|
|
164
|
+
#define bit_AVX512CD 0x10000000
|
|
165
|
+
#define bit_SHA 0x20000000
|
|
166
|
+
#define bit_AVX512BW 0x40000000
|
|
167
|
+
#define bit_AVX512VL 0x80000000
|
|
168
|
+
|
|
169
|
+
/* Features in %ecx for leaf 7 sub-leaf 0 */
|
|
170
|
+
#define bit_PREFTCHWT1 0x00000001
|
|
171
|
+
#define bit_AVX512VBMI 0x00000002
|
|
172
|
+
#define bit_PKU 0x00000004
|
|
173
|
+
#define bit_OSPKE 0x00000010
|
|
174
|
+
#define bit_WAITPKG 0x00000020
|
|
175
|
+
#define bit_AVX512VBMI2 0x00000040
|
|
176
|
+
#define bit_SHSTK 0x00000080
|
|
177
|
+
#define bit_GFNI 0x00000100
|
|
178
|
+
#define bit_VAES 0x00000200
|
|
179
|
+
#define bit_VPCLMULQDQ 0x00000400
|
|
180
|
+
#define bit_AVX512VNNI 0x00000800
|
|
181
|
+
#define bit_AVX512BITALG 0x00001000
|
|
182
|
+
#define bit_AVX512VPOPCNTDQ 0x00004000
|
|
183
|
+
#define bit_RDPID 0x00400000
|
|
184
|
+
#define bit_CLDEMOTE 0x02000000
|
|
185
|
+
#define bit_MOVDIRI 0x08000000
|
|
186
|
+
#define bit_MOVDIR64B 0x10000000
|
|
187
|
+
#define bit_ENQCMD 0x20000000
|
|
188
|
+
|
|
189
|
+
/* Features in %edx for leaf 7 sub-leaf 0 */
|
|
190
|
+
#define bit_AVX5124VNNIW 0x00000004
|
|
191
|
+
#define bit_AVX5124FMAPS 0x00000008
|
|
192
|
+
#define bit_UINTR 0x00000020
|
|
193
|
+
#define bit_SERIALIZE 0x00004000
|
|
194
|
+
#define bit_TSXLDTRK 0x00010000
|
|
195
|
+
#define bit_PCONFIG 0x00040000
|
|
196
|
+
#define bit_IBT 0x00100000
|
|
197
|
+
#define bit_AMXBF16 0x00400000
|
|
198
|
+
#define bit_AMXTILE 0x01000000
|
|
199
|
+
#define bit_AMXINT8 0x02000000
|
|
200
|
+
|
|
201
|
+
/* Features in %eax for leaf 7 sub-leaf 1 */
|
|
202
|
+
#define bit_AVXVNNI 0x00000008
|
|
203
|
+
#define bit_AVX512BF16 0x00000020
|
|
204
|
+
#define bit_HRESET 0x00400000
|
|
205
|
+
|
|
206
|
+
/* Features in %eax for leaf 13 sub-leaf 1 */
|
|
207
|
+
#define bit_XSAVEOPT 0x00000001
|
|
208
|
+
#define bit_XSAVEC 0x00000002
|
|
209
|
+
#define bit_XSAVES 0x00000008
|
|
210
|
+
|
|
211
|
+
/* Features in %eax for leaf 0x14 sub-leaf 0 */
|
|
212
|
+
#define bit_PTWRITE 0x00000010
|
|
213
|
+
|
|
214
|
+
/* Features in %ecx for leaf 0x80000001 */
|
|
215
|
+
#define bit_LAHF_LM 0x00000001
|
|
216
|
+
#define bit_ABM 0x00000020
|
|
217
|
+
#define bit_LZCNT bit_ABM /* for gcc compat */
|
|
218
|
+
#define bit_SSE4a 0x00000040
|
|
219
|
+
#define bit_PRFCHW 0x00000100
|
|
220
|
+
#define bit_XOP 0x00000800
|
|
221
|
+
#define bit_LWP 0x00008000
|
|
222
|
+
#define bit_FMA4 0x00010000
|
|
223
|
+
#define bit_TBM 0x00200000
|
|
224
|
+
#define bit_MWAITX 0x20000000
|
|
225
|
+
|
|
226
|
+
/* Features in %edx for leaf 0x80000001 */
|
|
227
|
+
#define bit_MMXEXT 0x00400000
|
|
228
|
+
#define bit_LM 0x20000000
|
|
229
|
+
#define bit_3DNOWP 0x40000000
|
|
230
|
+
#define bit_3DNOW 0x80000000
|
|
231
|
+
|
|
232
|
+
/* Features in %ebx for leaf 0x80000008 */
|
|
233
|
+
#define bit_CLZERO 0x00000001
|
|
234
|
+
#define bit_WBNOINVD 0x00000200
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
#if __i386__
|
|
238
|
+
#define __cpuid(__leaf, __eax, __ebx, __ecx, __edx) \
|
|
239
|
+
__asm("cpuid" : "=a"(__eax), "=b" (__ebx), "=c"(__ecx), "=d"(__edx) \
|
|
240
|
+
: "0"(__leaf))
|
|
241
|
+
|
|
242
|
+
#define __cpuid_count(__leaf, __count, __eax, __ebx, __ecx, __edx) \
|
|
243
|
+
__asm("cpuid" : "=a"(__eax), "=b" (__ebx), "=c"(__ecx), "=d"(__edx) \
|
|
244
|
+
: "0"(__leaf), "2"(__count))
|
|
245
|
+
#else
|
|
246
|
+
/* x86-64 uses %rbx as the base register, so preserve it. */
|
|
247
|
+
#define __cpuid(__leaf, __eax, __ebx, __ecx, __edx) \
|
|
248
|
+
__asm(" xchgq %%rbx,%q1\n" \
|
|
249
|
+
" cpuid\n" \
|
|
250
|
+
" xchgq %%rbx,%q1" \
|
|
251
|
+
: "=a"(__eax), "=r" (__ebx), "=c"(__ecx), "=d"(__edx) \
|
|
252
|
+
: "0"(__leaf))
|
|
253
|
+
|
|
254
|
+
#define __cpuid_count(__leaf, __count, __eax, __ebx, __ecx, __edx) \
|
|
255
|
+
__asm(" xchgq %%rbx,%q1\n" \
|
|
256
|
+
" cpuid\n" \
|
|
257
|
+
" xchgq %%rbx,%q1" \
|
|
258
|
+
: "=a"(__eax), "=r" (__ebx), "=c"(__ecx), "=d"(__edx) \
|
|
259
|
+
: "0"(__leaf), "2"(__count))
|
|
260
|
+
#endif
|
|
261
|
+
|
|
262
|
+
static __inline int __get_cpuid_max (unsigned int __leaf, unsigned int *__sig)
|
|
263
|
+
{
|
|
264
|
+
unsigned int __eax, __ebx, __ecx, __edx;
|
|
265
|
+
#if __i386__
|
|
266
|
+
int __cpuid_supported;
|
|
267
|
+
|
|
268
|
+
__asm(" pushfl\n"
|
|
269
|
+
" popl %%eax\n"
|
|
270
|
+
" movl %%eax,%%ecx\n"
|
|
271
|
+
" xorl $0x00200000,%%eax\n"
|
|
272
|
+
" pushl %%eax\n"
|
|
273
|
+
" popfl\n"
|
|
274
|
+
" pushfl\n"
|
|
275
|
+
" popl %%eax\n"
|
|
276
|
+
" movl $0,%0\n"
|
|
277
|
+
" cmpl %%eax,%%ecx\n"
|
|
278
|
+
" je 1f\n"
|
|
279
|
+
" movl $1,%0\n"
|
|
280
|
+
"1:"
|
|
281
|
+
: "=r" (__cpuid_supported) : : "eax", "ecx");
|
|
282
|
+
if (!__cpuid_supported)
|
|
283
|
+
return 0;
|
|
284
|
+
#endif
|
|
285
|
+
|
|
286
|
+
__cpuid(__leaf, __eax, __ebx, __ecx, __edx);
|
|
287
|
+
if (__sig)
|
|
288
|
+
*__sig = __ebx;
|
|
289
|
+
return __eax;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
static __inline int __get_cpuid (unsigned int __leaf, unsigned int *__eax,
|
|
293
|
+
unsigned int *__ebx, unsigned int *__ecx,
|
|
294
|
+
unsigned int *__edx)
|
|
295
|
+
{
|
|
296
|
+
unsigned int __max_leaf = __get_cpuid_max(__leaf & 0x80000000, 0);
|
|
297
|
+
|
|
298
|
+
if (__max_leaf == 0 || __max_leaf < __leaf)
|
|
299
|
+
return 0;
|
|
300
|
+
|
|
301
|
+
__cpuid(__leaf, *__eax, *__ebx, *__ecx, *__edx);
|
|
302
|
+
return 1;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
static __inline int __get_cpuid_count (unsigned int __leaf,
|
|
306
|
+
unsigned int __subleaf,
|
|
307
|
+
unsigned int *__eax, unsigned int *__ebx,
|
|
308
|
+
unsigned int *__ecx, unsigned int *__edx)
|
|
309
|
+
{
|
|
310
|
+
unsigned int __max_leaf = __get_cpuid_max(__leaf & 0x80000000, 0);
|
|
311
|
+
|
|
312
|
+
if (__max_leaf == 0 || __max_leaf < __leaf)
|
|
313
|
+
return 0;
|
|
314
|
+
|
|
315
|
+
__cpuid_count(__leaf, __subleaf, *__eax, *__ebx, *__ecx, *__edx);
|
|
316
|
+
return 1;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
#endif /* __CPUID_H */
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/*===---- algorithm - CUDA wrapper for <algorithm> -------------------------===
|
|
2
|
+
*
|
|
3
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
5
|
+
* in the Software without restriction, including without limitation the rights
|
|
6
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
* furnished to do so, subject to the following conditions:
|
|
9
|
+
*
|
|
10
|
+
* The above copyright notice and this permission notice shall be included in
|
|
11
|
+
* all copies or substantial portions of the Software.
|
|
12
|
+
*
|
|
13
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
19
|
+
* THE SOFTWARE.
|
|
20
|
+
*
|
|
21
|
+
*===-----------------------------------------------------------------------===
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
#ifndef __CLANG_CUDA_WRAPPERS_ALGORITHM
|
|
25
|
+
#define __CLANG_CUDA_WRAPPERS_ALGORITHM
|
|
26
|
+
|
|
27
|
+
// This header defines __device__ overloads of std::min/max.
|
|
28
|
+
//
|
|
29
|
+
// Ideally we'd declare these functions only if we're <= C++11. In C++14,
|
|
30
|
+
// these functions are constexpr, and so are implicitly __host__ __device__.
|
|
31
|
+
//
|
|
32
|
+
// However, the compiler being in C++14 mode does not imply that the standard
|
|
33
|
+
// library supports C++14. There is no macro we can test to check that the
|
|
34
|
+
// stdlib has constexpr std::min/max. Thus we have to unconditionally define
|
|
35
|
+
// our device overloads.
|
|
36
|
+
//
|
|
37
|
+
// A host+device function cannot be overloaded, and a constexpr function
|
|
38
|
+
// implicitly become host device if there's no explicitly host or device
|
|
39
|
+
// overload preceding it. So the simple thing to do would be to declare our
|
|
40
|
+
// device min/max overloads, and then #include_next <algorithm>. This way our
|
|
41
|
+
// device overloads would come first, and so if we have a C++14 stdlib, its
|
|
42
|
+
// min/max won't become host+device and conflict with our device overloads.
|
|
43
|
+
//
|
|
44
|
+
// But that also doesn't work. libstdc++ is evil and declares std::min/max in
|
|
45
|
+
// an internal header that is included *before* <algorithm>. Thus by the time
|
|
46
|
+
// we're inside of this file, std::min/max may already have been declared, and
|
|
47
|
+
// thus we can't prevent them from becoming host+device if they're constexpr.
|
|
48
|
+
//
|
|
49
|
+
// Therefore we perpetrate the following hack: We mark our __device__ overloads
|
|
50
|
+
// with __attribute__((enable_if(true, ""))). This causes the signature of the
|
|
51
|
+
// function to change without changing anything else about it. (Except that
|
|
52
|
+
// overload resolution will prefer it over the __host__ __device__ version
|
|
53
|
+
// rather than considering them equally good).
|
|
54
|
+
|
|
55
|
+
#include_next <algorithm>
|
|
56
|
+
|
|
57
|
+
// We need to define these overloads in exactly the namespace our standard
|
|
58
|
+
// library uses (including the right inline namespace), otherwise they won't be
|
|
59
|
+
// picked up by other functions in the standard library (e.g. functions in
|
|
60
|
+
// <complex>). Thus the ugliness below.
|
|
61
|
+
#ifdef _LIBCPP_BEGIN_NAMESPACE_STD
|
|
62
|
+
_LIBCPP_BEGIN_NAMESPACE_STD
|
|
63
|
+
#else
|
|
64
|
+
namespace std {
|
|
65
|
+
#ifdef _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
|
66
|
+
_GLIBCXX_BEGIN_NAMESPACE_VERSION
|
|
67
|
+
#endif
|
|
68
|
+
#endif
|
|
69
|
+
|
|
70
|
+
#pragma push_macro("_CPP14_CONSTEXPR")
|
|
71
|
+
#if __cplusplus >= 201402L
|
|
72
|
+
#define _CPP14_CONSTEXPR constexpr
|
|
73
|
+
#else
|
|
74
|
+
#define _CPP14_CONSTEXPR
|
|
75
|
+
#endif
|
|
76
|
+
|
|
77
|
+
template <class __T, class __Cmp>
|
|
78
|
+
__attribute__((enable_if(true, "")))
|
|
79
|
+
inline _CPP14_CONSTEXPR __host__ __device__ const __T &
|
|
80
|
+
max(const __T &__a, const __T &__b, __Cmp __cmp) {
|
|
81
|
+
return __cmp(__a, __b) ? __b : __a;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
template <class __T>
|
|
85
|
+
__attribute__((enable_if(true, "")))
|
|
86
|
+
inline _CPP14_CONSTEXPR __host__ __device__ const __T &
|
|
87
|
+
max(const __T &__a, const __T &__b) {
|
|
88
|
+
return __a < __b ? __b : __a;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
template <class __T, class __Cmp>
|
|
92
|
+
__attribute__((enable_if(true, "")))
|
|
93
|
+
inline _CPP14_CONSTEXPR __host__ __device__ const __T &
|
|
94
|
+
min(const __T &__a, const __T &__b, __Cmp __cmp) {
|
|
95
|
+
return __cmp(__b, __a) ? __b : __a;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
template <class __T>
|
|
99
|
+
__attribute__((enable_if(true, "")))
|
|
100
|
+
inline _CPP14_CONSTEXPR __host__ __device__ const __T &
|
|
101
|
+
min(const __T &__a, const __T &__b) {
|
|
102
|
+
return __a < __b ? __a : __b;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
#pragma pop_macro("_CPP14_CONSTEXPR")
|
|
106
|
+
|
|
107
|
+
#ifdef _LIBCPP_END_NAMESPACE_STD
|
|
108
|
+
_LIBCPP_END_NAMESPACE_STD
|
|
109
|
+
#else
|
|
110
|
+
#ifdef _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
|
111
|
+
_GLIBCXX_END_NAMESPACE_VERSION
|
|
112
|
+
#endif
|
|
113
|
+
} // namespace std
|
|
114
|
+
#endif
|
|
115
|
+
|
|
116
|
+
#endif // __CLANG_CUDA_WRAPPERS_ALGORITHM
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/*===---- complex - CUDA wrapper for <complex> ------------------------------===
|
|
2
|
+
*
|
|
3
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
5
|
+
* in the Software without restriction, including without limitation the rights
|
|
6
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
* furnished to do so, subject to the following conditions:
|
|
9
|
+
*
|
|
10
|
+
* The above copyright notice and this permission notice shall be included in
|
|
11
|
+
* all copies or substantial portions of the Software.
|
|
12
|
+
*
|
|
13
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
19
|
+
* THE SOFTWARE.
|
|
20
|
+
*
|
|
21
|
+
*===-----------------------------------------------------------------------===
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
#ifndef __CLANG_CUDA_WRAPPERS_COMPLEX
|
|
25
|
+
#define __CLANG_CUDA_WRAPPERS_COMPLEX
|
|
26
|
+
|
|
27
|
+
// Wrapper around <complex> that forces its functions to be __host__
|
|
28
|
+
// __device__.
|
|
29
|
+
|
|
30
|
+
// First, include host-only headers we think are likely to be included by
|
|
31
|
+
// <complex>, so that the pragma below only applies to <complex> itself.
|
|
32
|
+
#if __cplusplus >= 201103L
|
|
33
|
+
#include <type_traits>
|
|
34
|
+
#endif
|
|
35
|
+
#include <stdexcept>
|
|
36
|
+
#include <cmath>
|
|
37
|
+
#include <sstream>
|
|
38
|
+
|
|
39
|
+
// Next, include our <algorithm> wrapper, to ensure that device overloads of
|
|
40
|
+
// std::min/max are available.
|
|
41
|
+
#include <algorithm>
|
|
42
|
+
|
|
43
|
+
#pragma clang force_cuda_host_device begin
|
|
44
|
+
|
|
45
|
+
// When compiling for device, ask libstdc++ to use its own implements of
|
|
46
|
+
// complex functions, rather than calling builtins (which resolve to library
|
|
47
|
+
// functions that don't exist when compiling CUDA device code).
|
|
48
|
+
//
|
|
49
|
+
// This is a little dicey, because it causes libstdc++ to define a different
|
|
50
|
+
// set of overloads on host and device.
|
|
51
|
+
//
|
|
52
|
+
// // Present only when compiling for host.
|
|
53
|
+
// __host__ __device__ void complex<float> sin(const complex<float>& x) {
|
|
54
|
+
// return __builtin_csinf(x);
|
|
55
|
+
// }
|
|
56
|
+
//
|
|
57
|
+
// // Present when compiling for host and for device.
|
|
58
|
+
// template <typename T>
|
|
59
|
+
// void __host__ __device__ complex<T> sin(const complex<T>& x) {
|
|
60
|
+
// return complex<T>(sin(x.real()) * cosh(x.imag()),
|
|
61
|
+
// cos(x.real()), sinh(x.imag()));
|
|
62
|
+
// }
|
|
63
|
+
//
|
|
64
|
+
// This is safe because when compiling for device, all function calls in
|
|
65
|
+
// __host__ code to sin() will still resolve to *something*, even if they don't
|
|
66
|
+
// resolve to the same function as they resolve to when compiling for host. We
|
|
67
|
+
// don't care that they don't resolve to the right function because we won't
|
|
68
|
+
// codegen this host code when compiling for device.
|
|
69
|
+
|
|
70
|
+
#pragma push_macro("_GLIBCXX_USE_C99_COMPLEX")
|
|
71
|
+
#pragma push_macro("_GLIBCXX_USE_C99_COMPLEX_TR1")
|
|
72
|
+
#define _GLIBCXX_USE_C99_COMPLEX 0
|
|
73
|
+
#define _GLIBCXX_USE_C99_COMPLEX_TR1 0
|
|
74
|
+
|
|
75
|
+
#include_next <complex>
|
|
76
|
+
|
|
77
|
+
#pragma pop_macro("_GLIBCXX_USE_C99_COMPLEX_TR1")
|
|
78
|
+
#pragma pop_macro("_GLIBCXX_USE_C99_COMPLEX")
|
|
79
|
+
|
|
80
|
+
#pragma clang force_cuda_host_device end
|
|
81
|
+
|
|
82
|
+
#endif // include guard
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/*===---- new - CUDA wrapper for <new> -------------------------------------===
|
|
2
|
+
*
|
|
3
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
5
|
+
* in the Software without restriction, including without limitation the rights
|
|
6
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
* furnished to do so, subject to the following conditions:
|
|
9
|
+
*
|
|
10
|
+
* The above copyright notice and this permission notice shall be included in
|
|
11
|
+
* all copies or substantial portions of the Software.
|
|
12
|
+
*
|
|
13
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
19
|
+
* THE SOFTWARE.
|
|
20
|
+
*
|
|
21
|
+
*===-----------------------------------------------------------------------===
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
#ifndef __CLANG_CUDA_WRAPPERS_NEW
|
|
25
|
+
#define __CLANG_CUDA_WRAPPERS_NEW
|
|
26
|
+
|
|
27
|
+
#include_next <new>
|
|
28
|
+
|
|
29
|
+
#if !defined(__device__)
|
|
30
|
+
// The header has been included too early from the standard C++ library
|
|
31
|
+
// and CUDA-specific macros are not available yet.
|
|
32
|
+
// Undo the include guard and try again later.
|
|
33
|
+
#undef __CLANG_CUDA_WRAPPERS_NEW
|
|
34
|
+
#else
|
|
35
|
+
|
|
36
|
+
#pragma push_macro("CUDA_NOEXCEPT")
|
|
37
|
+
#if __cplusplus >= 201103L
|
|
38
|
+
#define CUDA_NOEXCEPT noexcept
|
|
39
|
+
#else
|
|
40
|
+
#define CUDA_NOEXCEPT
|
|
41
|
+
#endif
|
|
42
|
+
|
|
43
|
+
// Device overrides for non-placement new and delete.
|
|
44
|
+
__device__ inline void *operator new(__SIZE_TYPE__ size) {
|
|
45
|
+
if (size == 0) {
|
|
46
|
+
size = 1;
|
|
47
|
+
}
|
|
48
|
+
return ::malloc(size);
|
|
49
|
+
}
|
|
50
|
+
__device__ inline void *operator new(__SIZE_TYPE__ size,
|
|
51
|
+
const std::nothrow_t &) CUDA_NOEXCEPT {
|
|
52
|
+
return ::operator new(size);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
__device__ inline void *operator new[](__SIZE_TYPE__ size) {
|
|
56
|
+
return ::operator new(size);
|
|
57
|
+
}
|
|
58
|
+
__device__ inline void *operator new[](__SIZE_TYPE__ size,
|
|
59
|
+
const std::nothrow_t &) {
|
|
60
|
+
return ::operator new(size);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
__device__ inline void operator delete(void* ptr) CUDA_NOEXCEPT {
|
|
64
|
+
if (ptr) {
|
|
65
|
+
::free(ptr);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
__device__ inline void operator delete(void *ptr,
|
|
69
|
+
const std::nothrow_t &) CUDA_NOEXCEPT {
|
|
70
|
+
::operator delete(ptr);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
__device__ inline void operator delete[](void* ptr) CUDA_NOEXCEPT {
|
|
74
|
+
::operator delete(ptr);
|
|
75
|
+
}
|
|
76
|
+
__device__ inline void operator delete[](void *ptr,
|
|
77
|
+
const std::nothrow_t &) CUDA_NOEXCEPT {
|
|
78
|
+
::operator delete(ptr);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Sized delete, C++14 only.
|
|
82
|
+
#if __cplusplus >= 201402L
|
|
83
|
+
__device__ inline void operator delete(void *ptr,
|
|
84
|
+
__SIZE_TYPE__ size) CUDA_NOEXCEPT {
|
|
85
|
+
::operator delete(ptr);
|
|
86
|
+
}
|
|
87
|
+
__device__ inline void operator delete[](void *ptr,
|
|
88
|
+
__SIZE_TYPE__ size) CUDA_NOEXCEPT {
|
|
89
|
+
::operator delete(ptr);
|
|
90
|
+
}
|
|
91
|
+
#endif
|
|
92
|
+
|
|
93
|
+
// Device overrides for placement new and delete.
|
|
94
|
+
__device__ inline void *operator new(__SIZE_TYPE__, void *__ptr) CUDA_NOEXCEPT {
|
|
95
|
+
return __ptr;
|
|
96
|
+
}
|
|
97
|
+
__device__ inline void *operator new[](__SIZE_TYPE__, void *__ptr) CUDA_NOEXCEPT {
|
|
98
|
+
return __ptr;
|
|
99
|
+
}
|
|
100
|
+
__device__ inline void operator delete(void *, void *) CUDA_NOEXCEPT {}
|
|
101
|
+
__device__ inline void operator delete[](void *, void *) CUDA_NOEXCEPT {}
|
|
102
|
+
|
|
103
|
+
#pragma pop_macro("CUDA_NOEXCEPT")
|
|
104
|
+
|
|
105
|
+
#endif // __device__
|
|
106
|
+
#endif // include guard
|