代码初始化
This commit is contained in:
@@ -0,0 +1,128 @@
|
||||
set(files
|
||||
adxintrin.h
|
||||
altivec.h
|
||||
ammintrin.h
|
||||
arm_acle.h
|
||||
avx2intrin.h
|
||||
avx512bwintrin.h
|
||||
avx512cdintrin.h
|
||||
avx512dqintrin.h
|
||||
avx512erintrin.h
|
||||
avx512fintrin.h
|
||||
avx512ifmaintrin.h
|
||||
avx512ifmavlintrin.h
|
||||
avx512pfintrin.h
|
||||
avx512vbmiintrin.h
|
||||
avx512vbmivlintrin.h
|
||||
avx512vlbwintrin.h
|
||||
avx512vlcdintrin.h
|
||||
avx512vldqintrin.h
|
||||
avx512vlintrin.h
|
||||
avxintrin.h
|
||||
bmi2intrin.h
|
||||
bmiintrin.h
|
||||
__clang_cuda_cmath.h
|
||||
__clang_cuda_intrinsics.h
|
||||
__clang_cuda_math_forward_declares.h
|
||||
__clang_cuda_runtime_wrapper.h
|
||||
cpuid.h
|
||||
cuda_builtin_vars.h
|
||||
clflushoptintrin.h
|
||||
emmintrin.h
|
||||
f16cintrin.h
|
||||
float.h
|
||||
fma4intrin.h
|
||||
fmaintrin.h
|
||||
fxsrintrin.h
|
||||
htmintrin.h
|
||||
htmxlintrin.h
|
||||
ia32intrin.h
|
||||
immintrin.h
|
||||
intrin.h
|
||||
inttypes.h
|
||||
iso646.h
|
||||
limits.h
|
||||
lzcntintrin.h
|
||||
mm3dnow.h
|
||||
mmintrin.h
|
||||
mm_malloc.h
|
||||
module.modulemap
|
||||
mwaitxintrin.h
|
||||
nmmintrin.h
|
||||
opencl-c.h
|
||||
pkuintrin.h
|
||||
pmmintrin.h
|
||||
popcntintrin.h
|
||||
prfchwintrin.h
|
||||
rdseedintrin.h
|
||||
rtmintrin.h
|
||||
s390intrin.h
|
||||
shaintrin.h
|
||||
smmintrin.h
|
||||
stdalign.h
|
||||
stdarg.h
|
||||
stdatomic.h
|
||||
stdbool.h
|
||||
stddef.h
|
||||
__stddef_max_align_t.h
|
||||
stdint.h
|
||||
stdnoreturn.h
|
||||
tbmintrin.h
|
||||
tgmath.h
|
||||
tmmintrin.h
|
||||
unwind.h
|
||||
vadefs.h
|
||||
varargs.h
|
||||
vecintrin.h
|
||||
wmmintrin.h
|
||||
__wmmintrin_aes.h
|
||||
__wmmintrin_pclmul.h
|
||||
x86intrin.h
|
||||
xmmintrin.h
|
||||
xopintrin.h
|
||||
xsavecintrin.h
|
||||
xsaveintrin.h
|
||||
xsaveoptintrin.h
|
||||
xsavesintrin.h
|
||||
xtestintrin.h
|
||||
)
|
||||
|
||||
set(output_dir ${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION}/include)
|
||||
|
||||
# Generate arm_neon.h
|
||||
clang_tablegen(arm_neon.h -gen-arm-neon
|
||||
SOURCE ${CLANG_SOURCE_DIR}/include/clang/Basic/arm_neon.td)
|
||||
|
||||
set(out_files)
|
||||
foreach( f ${files} )
|
||||
set( src ${CMAKE_CURRENT_SOURCE_DIR}/${f} )
|
||||
set( dst ${output_dir}/${f} )
|
||||
add_custom_command(OUTPUT ${dst}
|
||||
DEPENDS ${src}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst}
|
||||
COMMENT "Copying clang's ${f}...")
|
||||
list(APPEND out_files ${dst})
|
||||
endforeach( f )
|
||||
|
||||
add_custom_command(OUTPUT ${output_dir}/arm_neon.h
|
||||
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/arm_neon.h
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_BINARY_DIR}/arm_neon.h ${output_dir}/arm_neon.h
|
||||
COMMENT "Copying clang's arm_neon.h...")
|
||||
list(APPEND out_files ${output_dir}/arm_neon.h)
|
||||
|
||||
add_custom_target(clang-headers ALL DEPENDS ${out_files})
|
||||
set_target_properties(clang-headers PROPERTIES FOLDER "Misc")
|
||||
|
||||
install(
|
||||
FILES ${files} ${CMAKE_CURRENT_BINARY_DIR}/arm_neon.h
|
||||
COMPONENT clang-headers
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
|
||||
DESTINATION lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include)
|
||||
|
||||
if (NOT CMAKE_CONFIGURATION_TYPES) # don't add this for IDE's.
|
||||
add_custom_target(install-clang-headers
|
||||
DEPENDS clang-headers
|
||||
COMMAND "${CMAKE_COMMAND}"
|
||||
-DCMAKE_INSTALL_COMPONENT=clang-headers
|
||||
-P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
|
||||
endif()
|
||||
@@ -0,0 +1,63 @@
|
||||
==============================================================================
|
||||
LLVM Release License
|
||||
==============================================================================
|
||||
University of Illinois/NCSA
|
||||
Open Source License
|
||||
|
||||
Copyright (c) 2007-2016 University of Illinois at Urbana-Champaign.
|
||||
All rights reserved.
|
||||
|
||||
Developed by:
|
||||
|
||||
LLVM Team
|
||||
|
||||
University of Illinois at Urbana-Champaign
|
||||
|
||||
http://llvm.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal with
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimers.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimers in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the names of the LLVM Team, University of Illinois at
|
||||
Urbana-Champaign, nor the names of its contributors may be used to
|
||||
endorse or promote products derived from this Software without specific
|
||||
prior written permission.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
|
||||
SOFTWARE.
|
||||
|
||||
==============================================================================
|
||||
The LLVM software contains code written by third parties. Such software will
|
||||
have its own individual LICENSE.TXT file in the directory in which it appears.
|
||||
This file will describe the copyrights, license, and restrictions which apply
|
||||
to that code.
|
||||
|
||||
The disclaimer of warranty in the University of Illinois Open Source License
|
||||
applies to all code in the LLVM Distribution, and nothing in any of the
|
||||
other licenses gives permission to use the names of the LLVM Team or the
|
||||
University of Illinois to endorse or promote products derived from this
|
||||
Software.
|
||||
|
||||
The following pieces of software have additional or alternate copyrights,
|
||||
licenses, and/or restrictions:
|
||||
|
||||
Program Directory
|
||||
------- ---------
|
||||
<none yet>
|
||||
|
||||
@@ -0,0 +1,148 @@
|
||||
/*===---- __clang_cuda_cmath.h - Device-side CUDA cmath support ------------===
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
#ifndef __CLANG_CUDA_CMATH_H__
|
||||
#define __CLANG_CUDA_CMATH_H__
|
||||
#ifndef __CUDA__
|
||||
#error "This file is for CUDA compilation only."
|
||||
#endif
|
||||
|
||||
// CUDA lets us use various std math functions on the device side. This file
|
||||
// works in concert with __clang_cuda_math_forward_declares.h to make this work.
|
||||
//
|
||||
// Specifically, the forward-declares header declares __device__ overloads for
|
||||
// these functions in the global namespace, then pulls them into namespace std
|
||||
// with 'using' statements. Then this file implements those functions, after
|
||||
// the implementations have been pulled in.
|
||||
//
|
||||
// It's important that we declare the functions in the global namespace and pull
|
||||
// them into namespace std with using statements, as opposed to simply declaring
|
||||
// these functions in namespace std, because our device functions need to
|
||||
// overload the standard library functions, which may be declared in the global
|
||||
// namespace or in std, depending on the degree of conformance of the stdlib
|
||||
// implementation. Declaring in the global namespace and pulling into namespace
|
||||
// std covers all of the known knowns.
|
||||
|
||||
#define __DEVICE__ static __device__ __inline__ __attribute__((always_inline))
|
||||
|
||||
__DEVICE__ long long abs(long long __n) { return ::llabs(__n); }
|
||||
__DEVICE__ long abs(long __n) { return ::labs(__n); }
|
||||
__DEVICE__ float abs(float __x) { return ::fabsf(__x); }
|
||||
__DEVICE__ double abs(double __x) { return ::fabs(__x); }
|
||||
__DEVICE__ float acos(float __x) { return ::acosf(__x); }
|
||||
__DEVICE__ float asin(float __x) { return ::asinf(__x); }
|
||||
__DEVICE__ float atan(float __x) { return ::atanf(__x); }
|
||||
__DEVICE__ float atan2(float __x, float __y) { return ::atan2f(__x, __y); }
|
||||
__DEVICE__ float ceil(float __x) { return ::ceilf(__x); }
|
||||
__DEVICE__ float cos(float __x) { return ::cosf(__x); }
|
||||
__DEVICE__ float cosh(float __x) { return ::coshf(__x); }
|
||||
__DEVICE__ float exp(float __x) { return ::expf(__x); }
|
||||
__DEVICE__ float fabs(float __x) { return ::fabsf(__x); }
|
||||
__DEVICE__ float floor(float __x) { return ::floorf(__x); }
|
||||
__DEVICE__ float fmod(float __x, float __y) { return ::fmodf(__x, __y); }
|
||||
__DEVICE__ int fpclassify(float __x) {
|
||||
return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL,
|
||||
FP_ZERO, __x);
|
||||
}
|
||||
__DEVICE__ int fpclassify(double __x) {
|
||||
return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL,
|
||||
FP_ZERO, __x);
|
||||
}
|
||||
__DEVICE__ float frexp(float __arg, int *__exp) {
|
||||
return ::frexpf(__arg, __exp);
|
||||
}
|
||||
__DEVICE__ bool isinf(float __x) { return ::__isinff(__x); }
|
||||
__DEVICE__ bool isinf(double __x) { return ::__isinf(__x); }
|
||||
__DEVICE__ bool isfinite(float __x) { return ::__finitef(__x); }
|
||||
__DEVICE__ bool isfinite(double __x) { return ::__finite(__x); }
|
||||
__DEVICE__ bool isgreater(float __x, float __y) {
|
||||
return __builtin_isgreater(__x, __y);
|
||||
}
|
||||
__DEVICE__ bool isgreater(double __x, double __y) {
|
||||
return __builtin_isgreater(__x, __y);
|
||||
}
|
||||
__DEVICE__ bool isgreaterequal(float __x, float __y) {
|
||||
return __builtin_isgreaterequal(__x, __y);
|
||||
}
|
||||
__DEVICE__ bool isgreaterequal(double __x, double __y) {
|
||||
return __builtin_isgreaterequal(__x, __y);
|
||||
}
|
||||
__DEVICE__ bool isless(float __x, float __y) {
|
||||
return __builtin_isless(__x, __y);
|
||||
}
|
||||
__DEVICE__ bool isless(double __x, double __y) {
|
||||
return __builtin_isless(__x, __y);
|
||||
}
|
||||
__DEVICE__ bool islessequal(float __x, float __y) {
|
||||
return __builtin_islessequal(__x, __y);
|
||||
}
|
||||
__DEVICE__ bool islessequal(double __x, double __y) {
|
||||
return __builtin_islessequal(__x, __y);
|
||||
}
|
||||
__DEVICE__ bool islessgreater(float __x, float __y) {
|
||||
return __builtin_islessgreater(__x, __y);
|
||||
}
|
||||
__DEVICE__ bool islessgreater(double __x, double __y) {
|
||||
return __builtin_islessgreater(__x, __y);
|
||||
}
|
||||
__DEVICE__ bool isnan(float __x) { return ::__isnanf(__x); }
|
||||
__DEVICE__ bool isnan(double __x) { return ::__isnan(__x); }
|
||||
__DEVICE__ bool isnormal(float __x) { return __builtin_isnormal(__x); }
|
||||
__DEVICE__ bool isnormal(double __x) { return __builtin_isnormal(__x); }
|
||||
__DEVICE__ bool isunordered(float __x, float __y) {
|
||||
return __builtin_isunordered(__x, __y);
|
||||
}
|
||||
__DEVICE__ bool isunordered(double __x, double __y) {
|
||||
return __builtin_isunordered(__x, __y);
|
||||
}
|
||||
__DEVICE__ float ldexp(float __arg, int __exp) {
|
||||
return ::ldexpf(__arg, __exp);
|
||||
}
|
||||
__DEVICE__ float log(float __x) { return ::logf(__x); }
|
||||
__DEVICE__ float log10(float __x) { return ::log10f(__x); }
|
||||
__DEVICE__ float modf(float __x, float *__iptr) { return ::modff(__x, __iptr); }
|
||||
__DEVICE__ float nexttoward(float __from, float __to) {
|
||||
return __builtin_nexttowardf(__from, __to);
|
||||
}
|
||||
__DEVICE__ double nexttoward(double __from, double __to) {
|
||||
return __builtin_nexttoward(__from, __to);
|
||||
}
|
||||
__DEVICE__ float pow(float __base, float __exp) {
|
||||
return ::powf(__base, __exp);
|
||||
}
|
||||
__DEVICE__ float pow(float __base, int __iexp) {
|
||||
return ::powif(__base, __iexp);
|
||||
}
|
||||
__DEVICE__ double pow(double __base, int __iexp) {
|
||||
return ::powi(__base, __iexp);
|
||||
}
|
||||
__DEVICE__ bool signbit(float __x) { return ::__signbitf(__x); }
|
||||
__DEVICE__ bool signbit(double __x) { return ::__signbit(__x); }
|
||||
__DEVICE__ float sin(float __x) { return ::sinf(__x); }
|
||||
__DEVICE__ float sinh(float __x) { return ::sinhf(__x); }
|
||||
__DEVICE__ float sqrt(float __x) { return ::sqrtf(__x); }
|
||||
__DEVICE__ float tan(float __x) { return ::tanf(__x); }
|
||||
__DEVICE__ float tanh(float __x) { return ::tanhf(__x); }
|
||||
|
||||
#undef __DEVICE__
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,322 @@
|
||||
/*===--- __clang_cuda_intrinsics.h - Device-side CUDA intrinsic wrappers ---===
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
#ifndef __CLANG_CUDA_INTRINSICS_H__
|
||||
#define __CLANG_CUDA_INTRINSICS_H__
|
||||
#ifndef __CUDA__
|
||||
#error "This file is for CUDA compilation only."
|
||||
#endif
|
||||
|
||||
// sm_30 intrinsics: __shfl_{up,down,xor}.
|
||||
|
||||
#define __SM_30_INTRINSICS_H__
|
||||
#define __SM_30_INTRINSICS_HPP__
|
||||
|
||||
#if !defined(__CUDA_ARCH__) || __CUDA_ARCH__ >= 300
|
||||
|
||||
#pragma push_macro("__MAKE_SHUFFLES")
|
||||
#define __MAKE_SHUFFLES(__FnName, __IntIntrinsic, __FloatIntrinsic, __Mask) \
|
||||
inline __device__ int __FnName(int __in, int __offset, \
|
||||
int __width = warpSize) { \
|
||||
return __IntIntrinsic(__in, __offset, \
|
||||
((warpSize - __width) << 8) | (__Mask)); \
|
||||
} \
|
||||
inline __device__ float __FnName(float __in, int __offset, \
|
||||
int __width = warpSize) { \
|
||||
return __FloatIntrinsic(__in, __offset, \
|
||||
((warpSize - __width) << 8) | (__Mask)); \
|
||||
} \
|
||||
inline __device__ unsigned int __FnName(unsigned int __in, int __offset, \
|
||||
int __width = warpSize) { \
|
||||
return static_cast<unsigned int>( \
|
||||
::__FnName(static_cast<int>(__in), __offset, __width)); \
|
||||
} \
|
||||
inline __device__ long long __FnName(long long __in, int __offset, \
|
||||
int __width = warpSize) { \
|
||||
struct __Bits { \
|
||||
int __a, __b; \
|
||||
}; \
|
||||
_Static_assert(sizeof(__in) == sizeof(__Bits)); \
|
||||
_Static_assert(sizeof(__Bits) == 2 * sizeof(int)); \
|
||||
__Bits __tmp; \
|
||||
memcpy(&__in, &__tmp, sizeof(__in)); \
|
||||
__tmp.__a = ::__FnName(__tmp.__a, __offset, __width); \
|
||||
__tmp.__b = ::__FnName(__tmp.__b, __offset, __width); \
|
||||
long long __out; \
|
||||
memcpy(&__out, &__tmp, sizeof(__tmp)); \
|
||||
return __out; \
|
||||
} \
|
||||
inline __device__ unsigned long long __FnName( \
|
||||
unsigned long long __in, int __offset, int __width = warpSize) { \
|
||||
return static_cast<unsigned long long>( \
|
||||
::__FnName(static_cast<unsigned long long>(__in), __offset, __width)); \
|
||||
} \
|
||||
inline __device__ double __FnName(double __in, int __offset, \
|
||||
int __width = warpSize) { \
|
||||
long long __tmp; \
|
||||
_Static_assert(sizeof(__tmp) == sizeof(__in)); \
|
||||
memcpy(&__tmp, &__in, sizeof(__in)); \
|
||||
__tmp = ::__FnName(__tmp, __offset, __width); \
|
||||
double __out; \
|
||||
memcpy(&__out, &__tmp, sizeof(__out)); \
|
||||
return __out; \
|
||||
}
|
||||
|
||||
__MAKE_SHUFFLES(__shfl, __nvvm_shfl_idx_i32, __nvvm_shfl_idx_f32, 0x1f);
|
||||
// We use 0 rather than 31 as our mask, because shfl.up applies to lanes >=
|
||||
// maxLane.
|
||||
__MAKE_SHUFFLES(__shfl_up, __nvvm_shfl_up_i32, __nvvm_shfl_up_f32, 0);
|
||||
__MAKE_SHUFFLES(__shfl_down, __nvvm_shfl_down_i32, __nvvm_shfl_down_f32, 0x1f);
|
||||
__MAKE_SHUFFLES(__shfl_xor, __nvvm_shfl_bfly_i32, __nvvm_shfl_bfly_f32, 0x1f);
|
||||
|
||||
#pragma pop_macro("__MAKE_SHUFFLES")
|
||||
|
||||
#endif // !defined(__CUDA_ARCH__) || __CUDA_ARCH__ >= 300
|
||||
|
||||
// sm_32 intrinsics: __ldg and __funnelshift_{l,lc,r,rc}.
|
||||
|
||||
// Prevent the vanilla sm_32 intrinsics header from being included.
|
||||
#define __SM_32_INTRINSICS_H__
|
||||
#define __SM_32_INTRINSICS_HPP__
|
||||
|
||||
#if !defined(__CUDA_ARCH__) || __CUDA_ARCH__ >= 320
|
||||
|
||||
inline __device__ char __ldg(const char *ptr) { return __nvvm_ldg_c(ptr); }
|
||||
inline __device__ short __ldg(const short *ptr) { return __nvvm_ldg_s(ptr); }
|
||||
inline __device__ int __ldg(const int *ptr) { return __nvvm_ldg_i(ptr); }
|
||||
inline __device__ long __ldg(const long *ptr) { return __nvvm_ldg_l(ptr); }
|
||||
inline __device__ long long __ldg(const long long *ptr) {
|
||||
return __nvvm_ldg_ll(ptr);
|
||||
}
|
||||
inline __device__ unsigned char __ldg(const unsigned char *ptr) {
|
||||
return __nvvm_ldg_uc(ptr);
|
||||
}
|
||||
inline __device__ unsigned short __ldg(const unsigned short *ptr) {
|
||||
return __nvvm_ldg_us(ptr);
|
||||
}
|
||||
inline __device__ unsigned int __ldg(const unsigned int *ptr) {
|
||||
return __nvvm_ldg_ui(ptr);
|
||||
}
|
||||
inline __device__ unsigned long __ldg(const unsigned long *ptr) {
|
||||
return __nvvm_ldg_ul(ptr);
|
||||
}
|
||||
inline __device__ unsigned long long __ldg(const unsigned long long *ptr) {
|
||||
return __nvvm_ldg_ull(ptr);
|
||||
}
|
||||
inline __device__ float __ldg(const float *ptr) { return __nvvm_ldg_f(ptr); }
|
||||
inline __device__ double __ldg(const double *ptr) { return __nvvm_ldg_d(ptr); }
|
||||
|
||||
inline __device__ char2 __ldg(const char2 *ptr) {
|
||||
typedef char c2 __attribute__((ext_vector_type(2)));
|
||||
// We can assume that ptr is aligned at least to char2's alignment, but the
|
||||
// load will assume that ptr is aligned to char2's alignment. This is only
|
||||
// safe if alignof(c2) <= alignof(char2).
|
||||
c2 rv = __nvvm_ldg_c2(reinterpret_cast<const c2 *>(ptr));
|
||||
char2 ret;
|
||||
ret.x = rv[0];
|
||||
ret.y = rv[1];
|
||||
return ret;
|
||||
}
|
||||
inline __device__ char4 __ldg(const char4 *ptr) {
|
||||
typedef char c4 __attribute__((ext_vector_type(4)));
|
||||
c4 rv = __nvvm_ldg_c4(reinterpret_cast<const c4 *>(ptr));
|
||||
char4 ret;
|
||||
ret.x = rv[0];
|
||||
ret.y = rv[1];
|
||||
ret.z = rv[2];
|
||||
ret.w = rv[3];
|
||||
return ret;
|
||||
}
|
||||
inline __device__ short2 __ldg(const short2 *ptr) {
|
||||
typedef short s2 __attribute__((ext_vector_type(2)));
|
||||
s2 rv = __nvvm_ldg_s2(reinterpret_cast<const s2 *>(ptr));
|
||||
short2 ret;
|
||||
ret.x = rv[0];
|
||||
ret.y = rv[1];
|
||||
return ret;
|
||||
}
|
||||
inline __device__ short4 __ldg(const short4 *ptr) {
|
||||
typedef short s4 __attribute__((ext_vector_type(4)));
|
||||
s4 rv = __nvvm_ldg_s4(reinterpret_cast<const s4 *>(ptr));
|
||||
short4 ret;
|
||||
ret.x = rv[0];
|
||||
ret.y = rv[1];
|
||||
ret.z = rv[2];
|
||||
ret.w = rv[3];
|
||||
return ret;
|
||||
}
|
||||
inline __device__ int2 __ldg(const int2 *ptr) {
|
||||
typedef int i2 __attribute__((ext_vector_type(2)));
|
||||
i2 rv = __nvvm_ldg_i2(reinterpret_cast<const i2 *>(ptr));
|
||||
int2 ret;
|
||||
ret.x = rv[0];
|
||||
ret.y = rv[1];
|
||||
return ret;
|
||||
}
|
||||
inline __device__ int4 __ldg(const int4 *ptr) {
|
||||
typedef int i4 __attribute__((ext_vector_type(4)));
|
||||
i4 rv = __nvvm_ldg_i4(reinterpret_cast<const i4 *>(ptr));
|
||||
int4 ret;
|
||||
ret.x = rv[0];
|
||||
ret.y = rv[1];
|
||||
ret.z = rv[2];
|
||||
ret.w = rv[3];
|
||||
return ret;
|
||||
}
|
||||
inline __device__ longlong2 __ldg(const longlong2 *ptr) {
|
||||
typedef long long ll2 __attribute__((ext_vector_type(2)));
|
||||
ll2 rv = __nvvm_ldg_ll2(reinterpret_cast<const ll2 *>(ptr));
|
||||
longlong2 ret;
|
||||
ret.x = rv[0];
|
||||
ret.y = rv[1];
|
||||
return ret;
|
||||
}
|
||||
|
||||
inline __device__ uchar2 __ldg(const uchar2 *ptr) {
|
||||
typedef unsigned char uc2 __attribute__((ext_vector_type(2)));
|
||||
uc2 rv = __nvvm_ldg_uc2(reinterpret_cast<const uc2 *>(ptr));
|
||||
uchar2 ret;
|
||||
ret.x = rv[0];
|
||||
ret.y = rv[1];
|
||||
return ret;
|
||||
}
|
||||
inline __device__ uchar4 __ldg(const uchar4 *ptr) {
|
||||
typedef unsigned char uc4 __attribute__((ext_vector_type(4)));
|
||||
uc4 rv = __nvvm_ldg_uc4(reinterpret_cast<const uc4 *>(ptr));
|
||||
uchar4 ret;
|
||||
ret.x = rv[0];
|
||||
ret.y = rv[1];
|
||||
ret.z = rv[2];
|
||||
ret.w = rv[3];
|
||||
return ret;
|
||||
}
|
||||
inline __device__ ushort2 __ldg(const ushort2 *ptr) {
|
||||
typedef unsigned short us2 __attribute__((ext_vector_type(2)));
|
||||
us2 rv = __nvvm_ldg_us2(reinterpret_cast<const us2 *>(ptr));
|
||||
ushort2 ret;
|
||||
ret.x = rv[0];
|
||||
ret.y = rv[1];
|
||||
return ret;
|
||||
}
|
||||
inline __device__ ushort4 __ldg(const ushort4 *ptr) {
|
||||
typedef unsigned short us4 __attribute__((ext_vector_type(4)));
|
||||
us4 rv = __nvvm_ldg_us4(reinterpret_cast<const us4 *>(ptr));
|
||||
ushort4 ret;
|
||||
ret.x = rv[0];
|
||||
ret.y = rv[1];
|
||||
ret.z = rv[2];
|
||||
ret.w = rv[3];
|
||||
return ret;
|
||||
}
|
||||
inline __device__ uint2 __ldg(const uint2 *ptr) {
|
||||
typedef unsigned int ui2 __attribute__((ext_vector_type(2)));
|
||||
ui2 rv = __nvvm_ldg_ui2(reinterpret_cast<const ui2 *>(ptr));
|
||||
uint2 ret;
|
||||
ret.x = rv[0];
|
||||
ret.y = rv[1];
|
||||
return ret;
|
||||
}
|
||||
inline __device__ uint4 __ldg(const uint4 *ptr) {
|
||||
typedef unsigned int ui4 __attribute__((ext_vector_type(4)));
|
||||
ui4 rv = __nvvm_ldg_ui4(reinterpret_cast<const ui4 *>(ptr));
|
||||
uint4 ret;
|
||||
ret.x = rv[0];
|
||||
ret.y = rv[1];
|
||||
ret.z = rv[2];
|
||||
ret.w = rv[3];
|
||||
return ret;
|
||||
}
|
||||
inline __device__ ulonglong2 __ldg(const ulonglong2 *ptr) {
|
||||
typedef unsigned long long ull2 __attribute__((ext_vector_type(2)));
|
||||
ull2 rv = __nvvm_ldg_ull2(reinterpret_cast<const ull2 *>(ptr));
|
||||
ulonglong2 ret;
|
||||
ret.x = rv[0];
|
||||
ret.y = rv[1];
|
||||
return ret;
|
||||
}
|
||||
|
||||
inline __device__ float2 __ldg(const float2 *ptr) {
|
||||
typedef float f2 __attribute__((ext_vector_type(2)));
|
||||
f2 rv = __nvvm_ldg_f2(reinterpret_cast<const f2 *>(ptr));
|
||||
float2 ret;
|
||||
ret.x = rv[0];
|
||||
ret.y = rv[1];
|
||||
return ret;
|
||||
}
|
||||
inline __device__ float4 __ldg(const float4 *ptr) {
|
||||
typedef float f4 __attribute__((ext_vector_type(4)));
|
||||
f4 rv = __nvvm_ldg_f4(reinterpret_cast<const f4 *>(ptr));
|
||||
float4 ret;
|
||||
ret.x = rv[0];
|
||||
ret.y = rv[1];
|
||||
ret.z = rv[2];
|
||||
ret.w = rv[3];
|
||||
return ret;
|
||||
}
|
||||
inline __device__ double2 __ldg(const double2 *ptr) {
|
||||
typedef double d2 __attribute__((ext_vector_type(2)));
|
||||
d2 rv = __nvvm_ldg_d2(reinterpret_cast<const d2 *>(ptr));
|
||||
double2 ret;
|
||||
ret.x = rv[0];
|
||||
ret.y = rv[1];
|
||||
return ret;
|
||||
}
|
||||
|
||||
// TODO: Implement these as intrinsics, so the backend can work its magic on
|
||||
// these. Alternatively, we could implement these as plain C and try to get
|
||||
// llvm to recognize the relevant patterns.
|
||||
inline __device__ unsigned __funnelshift_l(unsigned low32, unsigned high32,
|
||||
unsigned shiftWidth) {
|
||||
unsigned result;
|
||||
asm("shf.l.wrap.b32 %0, %1, %2, %3;"
|
||||
: "=r"(result)
|
||||
: "r"(low32), "r"(high32), "r"(shiftWidth));
|
||||
return result;
|
||||
}
|
||||
inline __device__ unsigned __funnelshift_lc(unsigned low32, unsigned high32,
|
||||
unsigned shiftWidth) {
|
||||
unsigned result;
|
||||
asm("shf.l.clamp.b32 %0, %1, %2, %3;"
|
||||
: "=r"(result)
|
||||
: "r"(low32), "r"(high32), "r"(shiftWidth));
|
||||
return result;
|
||||
}
|
||||
inline __device__ unsigned __funnelshift_r(unsigned low32, unsigned high32,
|
||||
unsigned shiftWidth) {
|
||||
unsigned result;
|
||||
asm("shf.r.wrap.b32 %0, %1, %2, %3;"
|
||||
: "=r"(result)
|
||||
: "r"(low32), "r"(high32), "r"(shiftWidth));
|
||||
return result;
|
||||
}
|
||||
inline __device__ unsigned __funnelshift_rc(unsigned low32, unsigned high32,
|
||||
unsigned shiftWidth) {
|
||||
unsigned ret;
|
||||
asm("shf.r.clamp.b32 %0, %1, %2, %3;"
|
||||
: "=r"(ret)
|
||||
: "r"(low32), "r"(high32), "r"(shiftWidth));
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif // !defined(__CUDA_ARCH__) || __CUDA_ARCH__ >= 320
|
||||
|
||||
#endif // defined(__CLANG_CUDA_INTRINSICS_H__)
|
||||
+263
@@ -0,0 +1,263 @@
|
||||
/*===- __clang_math_forward_declares.h - Prototypes of __device__ math fns --===
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
#ifndef __CLANG__CUDA_MATH_FORWARD_DECLARES_H__
|
||||
#define __CLANG__CUDA_MATH_FORWARD_DECLARES_H__
|
||||
#ifndef __CUDA__
|
||||
#error "This file is for CUDA compilation only."
|
||||
#endif
|
||||
|
||||
// This file forward-declares of some math functions we (or the CUDA headers)
|
||||
// will define later. We need to do this, and do it before cmath is included,
|
||||
// because the standard library may have constexpr math functions. In the
|
||||
// absence of a prior __device__ decl, those constexpr functions may become
|
||||
// implicitly host+device. host+device functions can't be overloaded, so that
|
||||
// would preclude the use of our own __device__ overloads for these functions.
|
||||
|
||||
#pragma push_macro("__DEVICE__")
|
||||
#define __DEVICE__ \
|
||||
static __inline__ __attribute__((always_inline)) __attribute__((device))
|
||||
|
||||
__DEVICE__ double abs(double);
|
||||
__DEVICE__ float abs(float);
|
||||
__DEVICE__ int abs(int);
|
||||
__DEVICE__ long abs(long);
|
||||
__DEVICE__ long long abs(long long);
|
||||
__DEVICE__ double acos(double);
|
||||
__DEVICE__ float acos(float);
|
||||
__DEVICE__ double acosh(double);
|
||||
__DEVICE__ float acosh(float);
|
||||
__DEVICE__ double asin(double);
|
||||
__DEVICE__ float asin(float);
|
||||
__DEVICE__ double asinh(double);
|
||||
__DEVICE__ float asinh(float);
|
||||
__DEVICE__ double atan2(double, double);
|
||||
__DEVICE__ float atan2(float, float);
|
||||
__DEVICE__ double atan(double);
|
||||
__DEVICE__ float atan(float);
|
||||
__DEVICE__ double atanh(double);
|
||||
__DEVICE__ float atanh(float);
|
||||
__DEVICE__ double cbrt(double);
|
||||
__DEVICE__ float cbrt(float);
|
||||
__DEVICE__ double ceil(double);
|
||||
__DEVICE__ float ceil(float);
|
||||
__DEVICE__ double copysign(double, double);
|
||||
__DEVICE__ float copysign(float, float);
|
||||
__DEVICE__ double cos(double);
|
||||
__DEVICE__ float cos(float);
|
||||
__DEVICE__ double cosh(double);
|
||||
__DEVICE__ float cosh(float);
|
||||
__DEVICE__ double erfc(double);
|
||||
__DEVICE__ float erfc(float);
|
||||
__DEVICE__ double erf(double);
|
||||
__DEVICE__ float erf(float);
|
||||
__DEVICE__ double exp2(double);
|
||||
__DEVICE__ float exp2(float);
|
||||
__DEVICE__ double exp(double);
|
||||
__DEVICE__ float exp(float);
|
||||
__DEVICE__ double expm1(double);
|
||||
__DEVICE__ float expm1(float);
|
||||
__DEVICE__ double fabs(double);
|
||||
__DEVICE__ float fabs(float);
|
||||
__DEVICE__ double fdim(double, double);
|
||||
__DEVICE__ float fdim(float, float);
|
||||
__DEVICE__ double floor(double);
|
||||
__DEVICE__ float floor(float);
|
||||
__DEVICE__ double fma(double, double, double);
|
||||
__DEVICE__ float fma(float, float, float);
|
||||
__DEVICE__ double fmax(double, double);
|
||||
__DEVICE__ float fmax(float, float);
|
||||
__DEVICE__ double fmin(double, double);
|
||||
__DEVICE__ float fmin(float, float);
|
||||
__DEVICE__ double fmod(double, double);
|
||||
__DEVICE__ float fmod(float, float);
|
||||
__DEVICE__ int fpclassify(double);
|
||||
__DEVICE__ int fpclassify(float);
|
||||
__DEVICE__ double frexp(double, int *);
|
||||
__DEVICE__ float frexp(float, int *);
|
||||
__DEVICE__ double hypot(double, double);
|
||||
__DEVICE__ float hypot(float, float);
|
||||
__DEVICE__ int ilogb(double);
|
||||
__DEVICE__ int ilogb(float);
|
||||
__DEVICE__ bool isfinite(double);
|
||||
__DEVICE__ bool isfinite(float);
|
||||
__DEVICE__ bool isgreater(double, double);
|
||||
__DEVICE__ bool isgreaterequal(double, double);
|
||||
__DEVICE__ bool isgreaterequal(float, float);
|
||||
__DEVICE__ bool isgreater(float, float);
|
||||
__DEVICE__ bool isinf(double);
|
||||
__DEVICE__ bool isinf(float);
|
||||
__DEVICE__ bool isless(double, double);
|
||||
__DEVICE__ bool islessequal(double, double);
|
||||
__DEVICE__ bool islessequal(float, float);
|
||||
__DEVICE__ bool isless(float, float);
|
||||
__DEVICE__ bool islessgreater(double, double);
|
||||
__DEVICE__ bool islessgreater(float, float);
|
||||
__DEVICE__ bool isnan(double);
|
||||
__DEVICE__ bool isnan(float);
|
||||
__DEVICE__ bool isnormal(double);
|
||||
__DEVICE__ bool isnormal(float);
|
||||
__DEVICE__ bool isunordered(double, double);
|
||||
__DEVICE__ bool isunordered(float, float);
|
||||
__DEVICE__ long labs(long);
|
||||
__DEVICE__ double ldexp(double, int);
|
||||
__DEVICE__ float ldexp(float, int);
|
||||
__DEVICE__ double lgamma(double);
|
||||
__DEVICE__ float lgamma(float);
|
||||
__DEVICE__ long long llabs(long long);
|
||||
__DEVICE__ long long llrint(double);
|
||||
__DEVICE__ long long llrint(float);
|
||||
__DEVICE__ double log10(double);
|
||||
__DEVICE__ float log10(float);
|
||||
__DEVICE__ double log1p(double);
|
||||
__DEVICE__ float log1p(float);
|
||||
__DEVICE__ double log2(double);
|
||||
__DEVICE__ float log2(float);
|
||||
__DEVICE__ double logb(double);
|
||||
__DEVICE__ float logb(float);
|
||||
__DEVICE__ double log(double);
|
||||
__DEVICE__ float log(float);
|
||||
__DEVICE__ long lrint(double);
|
||||
__DEVICE__ long lrint(float);
|
||||
__DEVICE__ long lround(double);
|
||||
__DEVICE__ long lround(float);
|
||||
__DEVICE__ double modf(double, double *);
|
||||
__DEVICE__ float modf(float, float *);
|
||||
__DEVICE__ double nan(const char *);
|
||||
__DEVICE__ float nanf(const char *);
|
||||
__DEVICE__ double nearbyint(double);
|
||||
__DEVICE__ float nearbyint(float);
|
||||
__DEVICE__ double nextafter(double, double);
|
||||
__DEVICE__ float nextafter(float, float);
|
||||
__DEVICE__ double nexttoward(double, double);
|
||||
__DEVICE__ float nexttoward(float, float);
|
||||
__DEVICE__ double pow(double, double);
|
||||
__DEVICE__ double pow(double, int);
|
||||
__DEVICE__ float pow(float, float);
|
||||
__DEVICE__ float pow(float, int);
|
||||
__DEVICE__ double remainder(double, double);
|
||||
__DEVICE__ float remainder(float, float);
|
||||
__DEVICE__ double remquo(double, double, int *);
|
||||
__DEVICE__ float remquo(float, float, int *);
|
||||
__DEVICE__ double rint(double);
|
||||
__DEVICE__ float rint(float);
|
||||
__DEVICE__ double round(double);
|
||||
__DEVICE__ float round(float);
|
||||
__DEVICE__ double scalbln(double, long);
|
||||
__DEVICE__ float scalbln(float, long);
|
||||
__DEVICE__ double scalbn(double, int);
|
||||
__DEVICE__ float scalbn(float, int);
|
||||
__DEVICE__ bool signbit(double);
|
||||
__DEVICE__ bool signbit(float);
|
||||
__DEVICE__ double sin(double);
|
||||
__DEVICE__ float sin(float);
|
||||
__DEVICE__ double sinh(double);
|
||||
__DEVICE__ float sinh(float);
|
||||
__DEVICE__ double sqrt(double);
|
||||
__DEVICE__ float sqrt(float);
|
||||
__DEVICE__ double tan(double);
|
||||
__DEVICE__ float tan(float);
|
||||
__DEVICE__ double tanh(double);
|
||||
__DEVICE__ float tanh(float);
|
||||
__DEVICE__ double tgamma(double);
|
||||
__DEVICE__ float tgamma(float);
|
||||
__DEVICE__ double trunc(double);
|
||||
__DEVICE__ float trunc(float);
|
||||
|
||||
namespace std {
|
||||
using ::abs;
|
||||
using ::acos;
|
||||
using ::acosh;
|
||||
using ::asin;
|
||||
using ::asinh;
|
||||
using ::atan;
|
||||
using ::atan2;
|
||||
using ::atanh;
|
||||
using ::cbrt;
|
||||
using ::ceil;
|
||||
using ::copysign;
|
||||
using ::cos;
|
||||
using ::cosh;
|
||||
using ::erf;
|
||||
using ::erfc;
|
||||
using ::exp;
|
||||
using ::exp2;
|
||||
using ::expm1;
|
||||
using ::fabs;
|
||||
using ::fdim;
|
||||
using ::floor;
|
||||
using ::fma;
|
||||
using ::fmax;
|
||||
using ::fmin;
|
||||
using ::fmod;
|
||||
using ::fpclassify;
|
||||
using ::frexp;
|
||||
using ::hypot;
|
||||
using ::ilogb;
|
||||
using ::isfinite;
|
||||
using ::isgreater;
|
||||
using ::isgreaterequal;
|
||||
using ::isinf;
|
||||
using ::isless;
|
||||
using ::islessequal;
|
||||
using ::islessgreater;
|
||||
using ::isnan;
|
||||
using ::isnormal;
|
||||
using ::isunordered;
|
||||
using ::labs;
|
||||
using ::ldexp;
|
||||
using ::lgamma;
|
||||
using ::llabs;
|
||||
using ::llrint;
|
||||
using ::log;
|
||||
using ::log10;
|
||||
using ::log1p;
|
||||
using ::log2;
|
||||
using ::logb;
|
||||
using ::lrint;
|
||||
using ::lround;
|
||||
using ::modf;
|
||||
using ::nan;
|
||||
using ::nanf;
|
||||
using ::nearbyint;
|
||||
using ::nextafter;
|
||||
using ::nexttoward;
|
||||
using ::pow;
|
||||
using ::remainder;
|
||||
using ::remquo;
|
||||
using ::rint;
|
||||
using ::round;
|
||||
using ::scalbln;
|
||||
using ::scalbn;
|
||||
using ::signbit;
|
||||
using ::sin;
|
||||
using ::sinh;
|
||||
using ::sqrt;
|
||||
using ::tan;
|
||||
using ::tanh;
|
||||
using ::tgamma;
|
||||
using ::trunc;
|
||||
} // namespace std
|
||||
|
||||
#pragma pop_macro("__DEVICE__")
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,316 @@
|
||||
/*===---- __clang_cuda_runtime_wrapper.h - CUDA runtime support -------------===
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
|
||||
/*
|
||||
* WARNING: This header is intended to be directly -include'd by
|
||||
* the compiler and is not supposed to be included by users.
|
||||
*
|
||||
* CUDA headers are implemented in a way that currently makes it
|
||||
* impossible for user code to #include directly when compiling with
|
||||
* Clang. They present different view of CUDA-supplied functions
|
||||
* depending on where in NVCC's compilation pipeline the headers are
|
||||
* included. Neither of these modes provides function definitions with
|
||||
* correct attributes, so we use preprocessor to force the headers
|
||||
* into a form that Clang can use.
|
||||
*
|
||||
* Similarly to NVCC which -include's cuda_runtime.h, Clang -include's
|
||||
* this file during every CUDA compilation.
|
||||
*/
|
||||
|
||||
#ifndef __CLANG_CUDA_RUNTIME_WRAPPER_H__
|
||||
#define __CLANG_CUDA_RUNTIME_WRAPPER_H__
|
||||
|
||||
#if defined(__CUDA__) && defined(__clang__)
|
||||
|
||||
// Include some forward declares that must come before cmath.
|
||||
#include <__clang_cuda_math_forward_declares.h>
|
||||
|
||||
// Include some standard headers to avoid CUDA headers including them
|
||||
// while some required macros (like __THROW) are in a weird state.
|
||||
#include <cmath>
|
||||
#include <cstdlib>
|
||||
#include <stdlib.h>
|
||||
|
||||
// Preserve common macros that will be changed below by us or by CUDA
|
||||
// headers.
|
||||
#pragma push_macro("__THROW")
|
||||
#pragma push_macro("__CUDA_ARCH__")
|
||||
|
||||
// WARNING: Preprocessor hacks below are based on specific details of
|
||||
// CUDA-7.x headers and are not expected to work with any other
|
||||
// version of CUDA headers.
|
||||
#include "cuda.h"
|
||||
#if !defined(CUDA_VERSION)
|
||||
#error "cuda.h did not define CUDA_VERSION"
|
||||
#elif CUDA_VERSION < 7000 || CUDA_VERSION > 7050
|
||||
#error "Unsupported CUDA version!"
|
||||
#endif
|
||||
|
||||
// Make largest subset of device functions available during host
|
||||
// compilation -- SM_35 for the time being.
|
||||
#ifndef __CUDA_ARCH__
|
||||
#define __CUDA_ARCH__ 350
|
||||
#endif
|
||||
|
||||
#include "cuda_builtin_vars.h"
|
||||
|
||||
// No need for device_launch_parameters.h as cuda_builtin_vars.h above
|
||||
// has taken care of builtin variables declared in the file.
|
||||
#define __DEVICE_LAUNCH_PARAMETERS_H__
|
||||
|
||||
// {math,device}_functions.h only have declarations of the
|
||||
// functions. We don't need them as we're going to pull in their
|
||||
// definitions from .hpp files.
|
||||
#define __DEVICE_FUNCTIONS_H__
|
||||
#define __MATH_FUNCTIONS_H__
|
||||
#define __COMMON_FUNCTIONS_H__
|
||||
|
||||
#undef __CUDACC__
|
||||
#define __CUDABE__
|
||||
// Disables definitions of device-side runtime support stubs in
|
||||
// cuda_device_runtime_api.h
|
||||
#include "driver_types.h"
|
||||
#include "host_config.h"
|
||||
#include "host_defines.h"
|
||||
|
||||
#undef __CUDABE__
|
||||
#define __CUDACC__
|
||||
#include "cuda_runtime.h"
|
||||
|
||||
#undef __CUDACC__
|
||||
#define __CUDABE__
|
||||
|
||||
// CUDA headers use __nvvm_memcpy and __nvvm_memset which Clang does
|
||||
// not have at the moment. Emulate them with a builtin memcpy/memset.
|
||||
#define __nvvm_memcpy(s, d, n, a) __builtin_memcpy(s, d, n)
|
||||
#define __nvvm_memset(d, c, n, a) __builtin_memset(d, c, n)
|
||||
|
||||
#include "crt/device_runtime.h"
|
||||
#include "crt/host_runtime.h"
|
||||
// device_runtime.h defines __cxa_* macros that will conflict with
|
||||
// cxxabi.h.
|
||||
// FIXME: redefine these as __device__ functions.
|
||||
#undef __cxa_vec_ctor
|
||||
#undef __cxa_vec_cctor
|
||||
#undef __cxa_vec_dtor
|
||||
#undef __cxa_vec_new2
|
||||
#undef __cxa_vec_new3
|
||||
#undef __cxa_vec_delete2
|
||||
#undef __cxa_vec_delete
|
||||
#undef __cxa_vec_delete3
|
||||
#undef __cxa_pure_virtual
|
||||
|
||||
// We need decls for functions in CUDA's libdevice with __device__
|
||||
// attribute only. Alas they come either as __host__ __device__ or
|
||||
// with no attributes at all. To work around that, define __CUDA_RTC__
|
||||
// which produces HD variant and undef __host__ which gives us desided
|
||||
// decls with __device__ attribute.
|
||||
#pragma push_macro("__host__")
|
||||
#define __host__
|
||||
#define __CUDACC_RTC__
|
||||
#include "device_functions_decls.h"
|
||||
#undef __CUDACC_RTC__
|
||||
|
||||
// Temporarily poison __host__ macro to ensure it's not used by any of
|
||||
// the headers we're about to include.
|
||||
#define __host__ UNEXPECTED_HOST_ATTRIBUTE
|
||||
|
||||
// device_functions.hpp and math_functions*.hpp use 'static
|
||||
// __forceinline__' (with no __device__) for definitions of device
|
||||
// functions. Temporarily redefine __forceinline__ to include
|
||||
// __device__.
|
||||
#pragma push_macro("__forceinline__")
|
||||
#define __forceinline__ __device__ __inline__ __attribute__((always_inline))
|
||||
#include "device_functions.hpp"
|
||||
|
||||
// math_function.hpp uses the __USE_FAST_MATH__ macro to determine whether we
|
||||
// get the slow-but-accurate or fast-but-inaccurate versions of functions like
|
||||
// sin and exp. This is controlled in clang by -fcuda-approx-transcendentals.
|
||||
//
|
||||
// device_functions.hpp uses __USE_FAST_MATH__ for a different purpose (fast vs.
|
||||
// slow divides), so we need to scope our define carefully here.
|
||||
#pragma push_macro("__USE_FAST_MATH__")
|
||||
#if defined(__CLANG_CUDA_APPROX_TRANSCENDENTALS__)
|
||||
#define __USE_FAST_MATH__
|
||||
#endif
|
||||
#include "math_functions.hpp"
|
||||
#pragma pop_macro("__USE_FAST_MATH__")
|
||||
|
||||
#include "math_functions_dbl_ptx3.hpp"
|
||||
#pragma pop_macro("__forceinline__")
|
||||
|
||||
// Pull in host-only functions that are only available when neither
|
||||
// __CUDACC__ nor __CUDABE__ are defined.
|
||||
#undef __MATH_FUNCTIONS_HPP__
|
||||
#undef __CUDABE__
|
||||
#include "math_functions.hpp"
|
||||
// Alas, additional overloads for these functions are hard to get to.
|
||||
// Considering that we only need these overloads for a few functions,
|
||||
// we can provide them here.
|
||||
static inline float rsqrt(float __a) { return rsqrtf(__a); }
|
||||
static inline float rcbrt(float __a) { return rcbrtf(__a); }
|
||||
static inline float sinpi(float __a) { return sinpif(__a); }
|
||||
static inline float cospi(float __a) { return cospif(__a); }
|
||||
static inline void sincospi(float __a, float *__b, float *__c) {
|
||||
return sincospif(__a, __b, __c);
|
||||
}
|
||||
static inline float erfcinv(float __a) { return erfcinvf(__a); }
|
||||
static inline float normcdfinv(float __a) { return normcdfinvf(__a); }
|
||||
static inline float normcdf(float __a) { return normcdff(__a); }
|
||||
static inline float erfcx(float __a) { return erfcxf(__a); }
|
||||
|
||||
// For some reason single-argument variant is not always declared by
|
||||
// CUDA headers. Alas, device_functions.hpp included below needs it.
|
||||
static inline __device__ void __brkpt(int __c) { __brkpt(); }
|
||||
|
||||
// Now include *.hpp with definitions of various GPU functions. Alas,
|
||||
// a lot of thins get declared/defined with __host__ attribute which
|
||||
// we don't want and we have to define it out. We also have to include
|
||||
// {device,math}_functions.hpp again in order to extract the other
|
||||
// branch of #if/else inside.
|
||||
|
||||
#define __host__
|
||||
#undef __CUDABE__
|
||||
#define __CUDACC__
|
||||
#undef __DEVICE_FUNCTIONS_HPP__
|
||||
#include "device_atomic_functions.hpp"
|
||||
#include "device_functions.hpp"
|
||||
#include "sm_20_atomic_functions.hpp"
|
||||
#include "sm_20_intrinsics.hpp"
|
||||
#include "sm_32_atomic_functions.hpp"
|
||||
|
||||
// Don't include sm_30_intrinsics.h and sm_32_intrinsics.h. These define the
|
||||
// __shfl and __ldg intrinsics using inline (volatile) asm, but we want to
|
||||
// define them using builtins so that the optimizer can reason about and across
|
||||
// these instructions. In particular, using intrinsics for ldg gets us the
|
||||
// [addr+imm] addressing mode, which, although it doesn't actually exist in the
|
||||
// hardware, seems to generate faster machine code because ptxas can more easily
|
||||
// reason about our code.
|
||||
|
||||
#undef __MATH_FUNCTIONS_HPP__
|
||||
|
||||
// math_functions.hpp defines ::signbit as a __host__ __device__ function. This
|
||||
// conflicts with libstdc++'s constexpr ::signbit, so we have to rename
|
||||
// math_function.hpp's ::signbit. It's guarded by #undef signbit, but that's
|
||||
// conditional on __GNUC__. :)
|
||||
#pragma push_macro("signbit")
|
||||
#pragma push_macro("__GNUC__")
|
||||
#undef __GNUC__
|
||||
#define signbit __ignored_cuda_signbit
|
||||
#include "math_functions.hpp"
|
||||
#pragma pop_macro("__GNUC__")
|
||||
#pragma pop_macro("signbit")
|
||||
|
||||
#pragma pop_macro("__host__")
|
||||
|
||||
#include "texture_indirect_functions.h"
|
||||
|
||||
// Restore state of __CUDA_ARCH__ and __THROW we had on entry.
|
||||
#pragma pop_macro("__CUDA_ARCH__")
|
||||
#pragma pop_macro("__THROW")
|
||||
|
||||
// Set up compiler macros expected to be seen during compilation.
|
||||
#undef __CUDABE__
|
||||
#define __CUDACC__
|
||||
|
||||
extern "C" {
|
||||
// Device-side CUDA system calls.
|
||||
// http://docs.nvidia.com/cuda/ptx-writers-guide-to-interoperability/index.html#system-calls
|
||||
// We need these declarations and wrappers for device-side
|
||||
// malloc/free/printf calls to work without relying on
|
||||
// -fcuda-disable-target-call-checks option.
|
||||
__device__ int vprintf(const char *, const char *);
|
||||
__device__ void free(void *) __attribute((nothrow));
|
||||
__device__ void *malloc(size_t) __attribute((nothrow)) __attribute__((malloc));
|
||||
__device__ void __assertfail(const char *__message, const char *__file,
|
||||
unsigned __line, const char *__function,
|
||||
size_t __charSize) __attribute__((noreturn));
|
||||
|
||||
// In order for standard assert() macro on linux to work we need to
|
||||
// provide device-side __assert_fail()
|
||||
__device__ static inline void __assert_fail(const char *__message,
|
||||
const char *__file, unsigned __line,
|
||||
const char *__function) {
|
||||
__assertfail(__message, __file, __line, __function, sizeof(char));
|
||||
}
|
||||
|
||||
// Clang will convert printf into vprintf, but we still need
|
||||
// device-side declaration for it.
|
||||
__device__ int printf(const char *, ...);
|
||||
} // extern "C"
|
||||
|
||||
// We also need device-side std::malloc and std::free.
|
||||
namespace std {
|
||||
__device__ static inline void free(void *__ptr) { ::free(__ptr); }
|
||||
__device__ static inline void *malloc(size_t __size) {
|
||||
return ::malloc(__size);
|
||||
}
|
||||
} // namespace std
|
||||
|
||||
// Out-of-line implementations from cuda_builtin_vars.h. These need to come
|
||||
// after we've pulled in the definition of uint3 and dim3.
|
||||
|
||||
__device__ inline __cuda_builtin_threadIdx_t::operator uint3() const {
|
||||
uint3 ret;
|
||||
ret.x = x;
|
||||
ret.y = y;
|
||||
ret.z = z;
|
||||
return ret;
|
||||
}
|
||||
|
||||
__device__ inline __cuda_builtin_blockIdx_t::operator uint3() const {
|
||||
uint3 ret;
|
||||
ret.x = x;
|
||||
ret.y = y;
|
||||
ret.z = z;
|
||||
return ret;
|
||||
}
|
||||
|
||||
__device__ inline __cuda_builtin_blockDim_t::operator dim3() const {
|
||||
return dim3(x, y, z);
|
||||
}
|
||||
|
||||
__device__ inline __cuda_builtin_gridDim_t::operator dim3() const {
|
||||
return dim3(x, y, z);
|
||||
}
|
||||
|
||||
#include <__clang_cuda_cmath.h>
|
||||
#include <__clang_cuda_intrinsics.h>
|
||||
|
||||
// curand_mtgp32_kernel helpfully redeclares blockDim and threadIdx in host
|
||||
// mode, giving them their "proper" types of dim3 and uint3. This is
|
||||
// incompatible with the types we give in cuda_builtin_vars.h. As as hack,
|
||||
// force-include the header (nvcc doesn't include it by default) but redefine
|
||||
// dim3 and uint3 to our builtin types. (Thankfully dim3 and uint3 are only
|
||||
// used here for the redeclarations of blockDim and threadIdx.)
|
||||
#pragma push_macro("dim3")
|
||||
#pragma push_macro("uint3")
|
||||
#define dim3 __cuda_builtin_blockDim_t
|
||||
#define uint3 __cuda_builtin_threadIdx_t
|
||||
#include "curand_mtgp32_kernel.h"
|
||||
#pragma pop_macro("dim3")
|
||||
#pragma pop_macro("uint3")
|
||||
#pragma pop_macro("__USE_FAST_MATH__")
|
||||
|
||||
#endif // __CUDA__
|
||||
#endif // __CLANG_CUDA_RUNTIME_WRAPPER_H__
|
||||
@@ -0,0 +1,43 @@
|
||||
/*===---- __stddef_max_align_t.h - Definition of max_align_t for modules ---===
|
||||
*
|
||||
* Copyright (c) 2014 Chandler Carruth
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
|
||||
#ifndef __CLANG_MAX_ALIGN_T_DEFINED
|
||||
#define __CLANG_MAX_ALIGN_T_DEFINED
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
typedef double max_align_t;
|
||||
#elif defined(__APPLE__)
|
||||
typedef long double max_align_t;
|
||||
#else
|
||||
// Define 'max_align_t' to match the GCC definition.
|
||||
typedef struct {
|
||||
long long __clang_max_align_nonce1
|
||||
__attribute__((__aligned__(__alignof__(long long))));
|
||||
long double __clang_max_align_nonce2
|
||||
__attribute__((__aligned__(__alignof__(long double))));
|
||||
} max_align_t;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,151 @@
|
||||
/*===---- __wmmintrin_aes.h - AES intrinsics -------------------------------===
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
#ifndef _WMMINTRIN_AES_H
|
||||
#define _WMMINTRIN_AES_H
|
||||
|
||||
#include <emmintrin.h>
|
||||
|
||||
/* Define the default attributes for the functions in this file. */
|
||||
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("aes")))
|
||||
|
||||
/// \brief Performs a single round of AES encryption using the Equivalent
|
||||
/// Inverse Cipher, transforming the state value from the first source
|
||||
/// operand using a 128-bit round key value contained in the second source
|
||||
/// operand, and writes the result to the destination.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c VAESENC instruction.
|
||||
///
|
||||
/// \param __V
|
||||
/// A 128-bit integer vector containing the state value.
|
||||
/// \param __R
|
||||
/// A 128-bit integer vector containing the round key value.
|
||||
/// \returns A 128-bit integer vector containing the encrypted value.
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_aesenc_si128(__m128i __V, __m128i __R)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_aesenc128((__v2di)__V, (__v2di)__R);
|
||||
}
|
||||
|
||||
/// \brief Performs the final round of AES encryption using the Equivalent
|
||||
/// Inverse Cipher, transforming the state value from the first source
|
||||
/// operand using a 128-bit round key value contained in the second source
|
||||
/// operand, and writes the result to the destination.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c VAESENCLAST instruction.
|
||||
///
|
||||
/// \param __V
|
||||
/// A 128-bit integer vector containing the state value.
|
||||
/// \param __R
|
||||
/// A 128-bit integer vector containing the round key value.
|
||||
/// \returns A 128-bit integer vector containing the encrypted value.
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_aesenclast_si128(__m128i __V, __m128i __R)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_aesenclast128((__v2di)__V, (__v2di)__R);
|
||||
}
|
||||
|
||||
/// \brief Performs a single round of AES decryption using the Equivalent
|
||||
/// Inverse Cipher, transforming the state value from the first source
|
||||
/// operand using a 128-bit round key value contained in the second source
|
||||
/// operand, and writes the result to the destination.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c VAESDEC instruction.
|
||||
///
|
||||
/// \param __V
|
||||
/// A 128-bit integer vector containing the state value.
|
||||
/// \param __R
|
||||
/// A 128-bit integer vector containing the round key value.
|
||||
/// \returns A 128-bit integer vector containing the decrypted value.
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_aesdec_si128(__m128i __V, __m128i __R)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_aesdec128((__v2di)__V, (__v2di)__R);
|
||||
}
|
||||
|
||||
/// \brief Performs the final round of AES decryption using the Equivalent
|
||||
/// Inverse Cipher, transforming the state value from the first source
|
||||
/// operand using a 128-bit round key value contained in the second source
|
||||
/// operand, and writes the result to the destination.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c VAESDECLAST instruction.
|
||||
///
|
||||
/// \param __V
|
||||
/// A 128-bit integer vector containing the state value.
|
||||
/// \param __R
|
||||
/// A 128-bit integer vector containing the round key value.
|
||||
/// \returns A 128-bit integer vector containing the decrypted value.
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_aesdeclast_si128(__m128i __V, __m128i __R)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_aesdeclast128((__v2di)__V, (__v2di)__R);
|
||||
}
|
||||
|
||||
/// \brief Applies the AES InvMixColumns() transformation to an expanded key
|
||||
/// contained in the source operand, and writes the result to the
|
||||
/// destination.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c VAESIMC instruction.
|
||||
///
|
||||
/// \param __V
|
||||
/// A 128-bit integer vector containing the expanded key.
|
||||
/// \returns A 128-bit integer vector containing the transformed value.
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_aesimc_si128(__m128i __V)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_aesimc128((__v2di)__V);
|
||||
}
|
||||
|
||||
/// \brief Generates a round key for AES encyption, operating on 128-bit data
|
||||
/// specified in the first source operand and using an 8-bit round constant
|
||||
/// specified by the second source operand, and writes the result to the
|
||||
/// destination.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// \code
|
||||
/// __m128i _mm_aeskeygenassist_si128(__m128i C, const int R);
|
||||
/// \endcode
|
||||
///
|
||||
/// This intrinsic corresponds to the \c AESKEYGENASSIST instruction.
|
||||
///
|
||||
/// \param C
|
||||
/// A 128-bit integer vector that is used to generate the AES encryption key.
|
||||
/// \param R
|
||||
/// An 8-bit round constant used to generate the AES encryption key.
|
||||
/// \returns A 128-bit round key for AES encryption.
|
||||
#define _mm_aeskeygenassist_si128(C, R) \
|
||||
(__m128i)__builtin_ia32_aeskeygenassist128((__v2di)(__m128i)(C), (int)(R))
|
||||
|
||||
#undef __DEFAULT_FN_ATTRS
|
||||
|
||||
#endif /* _WMMINTRIN_AES_H */
|
||||
@@ -0,0 +1,58 @@
|
||||
/*===---- __wmmintrin_pclmul.h - PCMUL intrinsics ---------------------------===
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
#ifndef _WMMINTRIN_PCLMUL_H
|
||||
#define _WMMINTRIN_PCLMUL_H
|
||||
|
||||
/// \brief Multiplies two 64-bit integer values, which are selected from source
|
||||
/// operands using the immediate-value operand. The multiplication is a
|
||||
/// carry-less multiplication, and the 128-bit integer product is stored in
|
||||
/// the destination.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// \code
|
||||
/// __m128i _mm_clmulepi64_si128(__m128i __X, __m128i __Y, const int __I);
|
||||
/// \endcode
|
||||
///
|
||||
/// This intrinsic corresponds to the \c VPCLMULQDQ instruction.
|
||||
///
|
||||
/// \param __X
|
||||
/// A 128-bit vector of [2 x i64] containing one of the source operands.
|
||||
/// \param __Y
|
||||
/// A 128-bit vector of [2 x i64] containing one of the source operands.
|
||||
/// \param __I
|
||||
/// An immediate value specifying which 64-bit values to select from the
|
||||
/// operands.
|
||||
/// Bit 0 is used to select a value from operand __X,
|
||||
/// and bit 4 is used to select a value from operand __Y:
|
||||
/// Bit[0]=0 indicates that bits[63:0] of operand __X are used.
|
||||
/// Bit[0]=1 indicates that bits[127:64] of operand __X are used.
|
||||
/// Bit[4]=0 indicates that bits[63:0] of operand __Y are used.
|
||||
/// Bit[4]=1 indicates that bits[127:64] of operand __Y are used.
|
||||
/// \returns The 128-bit integer vector containing the result of the carry-less
|
||||
/// multiplication of the selected 64-bit values.
|
||||
#define _mm_clmulepi64_si128(__X, __Y, __I) \
|
||||
((__m128i)__builtin_ia32_pclmulqdq128((__v2di)(__m128i)(__X), \
|
||||
(__v2di)(__m128i)(__Y), (char)(__I)))
|
||||
|
||||
#endif /* _WMMINTRIN_PCLMUL_H */
|
||||
@@ -0,0 +1,86 @@
|
||||
/*===---- adxintrin.h - ADX intrinsics -------------------------------------===
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
|
||||
#ifndef __IMMINTRIN_H
|
||||
#error "Never use <adxintrin.h> directly; include <immintrin.h> instead."
|
||||
#endif
|
||||
|
||||
#ifndef __ADXINTRIN_H
|
||||
#define __ADXINTRIN_H
|
||||
|
||||
/* Define the default attributes for the functions in this file. */
|
||||
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
|
||||
|
||||
/* Intrinsics that are available only if __ADX__ defined */
|
||||
static __inline unsigned char __attribute__((__always_inline__, __nodebug__, __target__("adx")))
|
||||
_addcarryx_u32(unsigned char __cf, unsigned int __x, unsigned int __y,
|
||||
unsigned int *__p)
|
||||
{
|
||||
return __builtin_ia32_addcarryx_u32(__cf, __x, __y, __p);
|
||||
}
|
||||
|
||||
#ifdef __x86_64__
|
||||
static __inline unsigned char __attribute__((__always_inline__, __nodebug__, __target__("adx")))
|
||||
_addcarryx_u64(unsigned char __cf, unsigned long long __x,
|
||||
unsigned long long __y, unsigned long long *__p)
|
||||
{
|
||||
return __builtin_ia32_addcarryx_u64(__cf, __x, __y, __p);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Intrinsics that are also available if __ADX__ undefined */
|
||||
static __inline unsigned char __DEFAULT_FN_ATTRS
|
||||
_addcarry_u32(unsigned char __cf, unsigned int __x, unsigned int __y,
|
||||
unsigned int *__p)
|
||||
{
|
||||
return __builtin_ia32_addcarry_u32(__cf, __x, __y, __p);
|
||||
}
|
||||
|
||||
#ifdef __x86_64__
|
||||
static __inline unsigned char __DEFAULT_FN_ATTRS
|
||||
_addcarry_u64(unsigned char __cf, unsigned long long __x,
|
||||
unsigned long long __y, unsigned long long *__p)
|
||||
{
|
||||
return __builtin_ia32_addcarry_u64(__cf, __x, __y, __p);
|
||||
}
|
||||
#endif
|
||||
|
||||
static __inline unsigned char __DEFAULT_FN_ATTRS
|
||||
_subborrow_u32(unsigned char __cf, unsigned int __x, unsigned int __y,
|
||||
unsigned int *__p)
|
||||
{
|
||||
return __builtin_ia32_subborrow_u32(__cf, __x, __y, __p);
|
||||
}
|
||||
|
||||
#ifdef __x86_64__
|
||||
static __inline unsigned char __DEFAULT_FN_ATTRS
|
||||
_subborrow_u64(unsigned char __cf, unsigned long long __x,
|
||||
unsigned long long __y, unsigned long long *__p)
|
||||
{
|
||||
return __builtin_ia32_subborrow_u64(__cf, __x, __y, __p);
|
||||
}
|
||||
#endif
|
||||
|
||||
#undef __DEFAULT_FN_ATTRS
|
||||
|
||||
#endif /* __ADXINTRIN_H */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,194 @@
|
||||
/*===---- ammintrin.h - SSE4a intrinsics -----------------------------------===
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
|
||||
#ifndef __AMMINTRIN_H
|
||||
#define __AMMINTRIN_H
|
||||
|
||||
#include <pmmintrin.h>
|
||||
|
||||
/* Define the default attributes for the functions in this file. */
|
||||
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("sse4a")))
|
||||
|
||||
/// \brief Extracts the specified bits from the lower 64 bits of the 128-bit
|
||||
/// integer vector operand at the index idx and of the length len.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// \code
|
||||
/// __m128i _mm_extracti_si64(__m128i x, const int len, const int idx);
|
||||
/// \endcode
|
||||
///
|
||||
/// This intrinsic corresponds to the \c EXTRQ instruction.
|
||||
///
|
||||
/// \param x
|
||||
/// The value from which bits are extracted.
|
||||
/// \param len
|
||||
/// Bits [5:0] specify the length; the other bits are ignored. If bits [5:0]
|
||||
/// are zero, the length is interpreted as 64.
|
||||
/// \param idx
|
||||
/// Bits [5:0] specify the index of the least significant bit; the other
|
||||
/// bits are ignored. If the sum of the index and length is greater than 64,
|
||||
/// the result is undefined. If the length and index are both zero, bits
|
||||
/// [63:0] of parameter x are extracted. If the length is zero but the index
|
||||
/// is non-zero, the result is undefined.
|
||||
/// \returns A 128-bit integer vector whose lower 64 bits contain the bits
|
||||
/// extracted from the source operand.
|
||||
#define _mm_extracti_si64(x, len, idx) \
|
||||
((__m128i)__builtin_ia32_extrqi((__v2di)(__m128i)(x), \
|
||||
(char)(len), (char)(idx)))
|
||||
|
||||
/// \brief Extracts the specified bits from the lower 64 bits of the 128-bit
|
||||
/// integer vector operand at the index and of the length specified by __y.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c EXTRQ instruction.
|
||||
///
|
||||
/// \param __x
|
||||
/// The value from which bits are extracted.
|
||||
/// \param __y
|
||||
/// Specifies the index of the least significant bit at [13:8] and the
|
||||
/// length at [5:0]; all other bits are ignored. If bits [5:0] are zero, the
|
||||
/// length is interpreted as 64. If the sum of the index and length is
|
||||
/// greater than 64, the result is undefined. If the length and index are
|
||||
/// both zero, bits [63:0] of parameter __x are extracted. If the length is
|
||||
/// zero but the index is non-zero, the result is undefined.
|
||||
/// \returns A 128-bit vector whose lower 64 bits contain the bits extracted
|
||||
/// from the source operand.
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_extract_si64(__m128i __x, __m128i __y)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_extrq((__v2di)__x, (__v16qi)__y);
|
||||
}
|
||||
|
||||
/// \brief Inserts bits of a specified length from the source integer vector y
|
||||
/// into the lower 64 bits of the destination integer vector x at the index
|
||||
/// idx and of the length len.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// \code
|
||||
/// __m128i _mm_inserti_si64(__m128i x, __m128i y, const int len,
|
||||
/// const int idx);
|
||||
/// \endcode
|
||||
///
|
||||
/// This intrinsic corresponds to the \c INSERTQ instruction.
|
||||
///
|
||||
/// \param x
|
||||
/// The destination operand where bits will be inserted. The inserted bits
|
||||
/// are defined by the length len and by the index idx specifying the least
|
||||
/// significant bit.
|
||||
/// \param y
|
||||
/// The source operand containing the bits to be extracted. The extracted
|
||||
/// bits are the least significant bits of operand y of length len.
|
||||
/// \param len
|
||||
/// Bits [5:0] specify the length; the other bits are ignored. If bits [5:0]
|
||||
/// are zero, the length is interpreted as 64.
|
||||
/// \param idx
|
||||
/// Bits [5:0] specify the index of the least significant bit; the other
|
||||
/// bits are ignored. If the sum of the index and length is greater than 64,
|
||||
/// the result is undefined. If the length and index are both zero, bits
|
||||
/// [63:0] of parameter y are inserted into parameter x. If the length is
|
||||
/// zero but the index is non-zero, the result is undefined.
|
||||
/// \returns A 128-bit integer vector containing the original lower 64-bits of
|
||||
/// destination operand x with the specified bitfields replaced by the lower
|
||||
/// bits of source operand y. The upper 64 bits of the return value are
|
||||
/// undefined.
|
||||
|
||||
#define _mm_inserti_si64(x, y, len, idx) \
|
||||
((__m128i)__builtin_ia32_insertqi((__v2di)(__m128i)(x), \
|
||||
(__v2di)(__m128i)(y), \
|
||||
(char)(len), (char)(idx)))
|
||||
|
||||
/// \brief Inserts bits of a specified length from the source integer vector
|
||||
/// __y into the lower 64 bits of the destination integer vector __x at the
|
||||
/// index and of the length specified by __y.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c INSERTQ instruction.
|
||||
///
|
||||
/// \param __x
|
||||
/// The destination operand where bits will be inserted. The inserted bits
|
||||
/// are defined by the length and by the index of the least significant bit
|
||||
/// specified by operand __y.
|
||||
/// \param __y
|
||||
/// The source operand containing the bits to be extracted. The extracted
|
||||
/// bits are the least significant bits of operand __y with length specified
|
||||
/// by bits [69:64]. These are inserted into the destination at the index
|
||||
/// specified by bits [77:72]; all other bits are ignored. If bits [69:64]
|
||||
/// are zero, the length is interpreted as 64. If the sum of the index and
|
||||
/// length is greater than 64, the result is undefined. If the length and
|
||||
/// index are both zero, bits [63:0] of parameter __y are inserted into
|
||||
/// parameter __x. If the length is zero but the index is non-zero, the
|
||||
/// result is undefined.
|
||||
/// \returns A 128-bit integer vector containing the original lower 64-bits of
|
||||
/// destination operand __x with the specified bitfields replaced by the
|
||||
/// lower bits of source operand __y. The upper 64 bits of the return value
|
||||
/// are undefined.
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_insert_si64(__m128i __x, __m128i __y)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_insertq((__v2di)__x, (__v2di)__y);
|
||||
}
|
||||
|
||||
/// \brief Stores a 64-bit double-precision value in a 64-bit memory location.
|
||||
/// To minimize caching, the data is flagged as non-temporal (unlikely to be
|
||||
/// used again soon).
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c MOVNTSD instruction.
|
||||
///
|
||||
/// \param __p
|
||||
/// The 64-bit memory location used to store the register value.
|
||||
/// \param __a
|
||||
/// The 64-bit double-precision floating-point register value to be stored.
|
||||
static __inline__ void __DEFAULT_FN_ATTRS
|
||||
_mm_stream_sd(double *__p, __m128d __a)
|
||||
{
|
||||
__builtin_ia32_movntsd(__p, (__v2df)__a);
|
||||
}
|
||||
|
||||
/// \brief Stores a 32-bit single-precision floating-point value in a 32-bit
|
||||
/// memory location. To minimize caching, the data is flagged as
|
||||
/// non-temporal (unlikely to be used again soon).
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c MOVNTSS instruction.
|
||||
///
|
||||
/// \param __p
|
||||
/// The 32-bit memory location used to store the register value.
|
||||
/// \param __a
|
||||
/// The 32-bit single-precision floating-point register value to be stored.
|
||||
static __inline__ void __DEFAULT_FN_ATTRS
|
||||
_mm_stream_ss(float *__p, __m128 __a)
|
||||
{
|
||||
__builtin_ia32_movntss(__p, (__v4sf)__a);
|
||||
}
|
||||
|
||||
#undef __DEFAULT_FN_ATTRS
|
||||
|
||||
#endif /* __AMMINTRIN_H */
|
||||
@@ -0,0 +1,312 @@
|
||||
/*===---- arm_acle.h - ARM Non-Neon intrinsics -----------------------------===
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
|
||||
#ifndef __ARM_ACLE_H
|
||||
#define __ARM_ACLE_H
|
||||
|
||||
#ifndef __ARM_ACLE
|
||||
#error "ACLE intrinsics support not enabled."
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* 8 SYNCHRONIZATION, BARRIER AND HINT INTRINSICS */
|
||||
/* 8.3 Memory barriers */
|
||||
#if !defined(_MSC_VER)
|
||||
#define __dmb(i) __builtin_arm_dmb(i)
|
||||
#define __dsb(i) __builtin_arm_dsb(i)
|
||||
#define __isb(i) __builtin_arm_isb(i)
|
||||
#endif
|
||||
|
||||
/* 8.4 Hints */
|
||||
|
||||
#if !defined(_MSC_VER)
|
||||
static __inline__ void __attribute__((__always_inline__, __nodebug__)) __wfi(void) {
|
||||
__builtin_arm_wfi();
|
||||
}
|
||||
|
||||
static __inline__ void __attribute__((__always_inline__, __nodebug__)) __wfe(void) {
|
||||
__builtin_arm_wfe();
|
||||
}
|
||||
|
||||
static __inline__ void __attribute__((__always_inline__, __nodebug__)) __sev(void) {
|
||||
__builtin_arm_sev();
|
||||
}
|
||||
|
||||
static __inline__ void __attribute__((__always_inline__, __nodebug__)) __sevl(void) {
|
||||
__builtin_arm_sevl();
|
||||
}
|
||||
|
||||
static __inline__ void __attribute__((__always_inline__, __nodebug__)) __yield(void) {
|
||||
__builtin_arm_yield();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if __ARM_32BIT_STATE
|
||||
#define __dbg(t) __builtin_arm_dbg(t)
|
||||
#endif
|
||||
|
||||
/* 8.5 Swap */
|
||||
static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__))
|
||||
__swp(uint32_t __x, volatile uint32_t *__p) {
|
||||
uint32_t v;
|
||||
do
|
||||
v = __builtin_arm_ldrex(__p);
|
||||
while (__builtin_arm_strex(__x, __p));
|
||||
return v;
|
||||
}
|
||||
|
||||
/* 8.6 Memory prefetch intrinsics */
|
||||
/* 8.6.1 Data prefetch */
|
||||
#define __pld(addr) __pldx(0, 0, 0, addr)
|
||||
|
||||
#if __ARM_32BIT_STATE
|
||||
#define __pldx(access_kind, cache_level, retention_policy, addr) \
|
||||
__builtin_arm_prefetch(addr, access_kind, 1)
|
||||
#else
|
||||
#define __pldx(access_kind, cache_level, retention_policy, addr) \
|
||||
__builtin_arm_prefetch(addr, access_kind, cache_level, retention_policy, 1)
|
||||
#endif
|
||||
|
||||
/* 8.6.2 Instruction prefetch */
|
||||
#define __pli(addr) __plix(0, 0, addr)
|
||||
|
||||
#if __ARM_32BIT_STATE
|
||||
#define __plix(cache_level, retention_policy, addr) \
|
||||
__builtin_arm_prefetch(addr, 0, 0)
|
||||
#else
|
||||
#define __plix(cache_level, retention_policy, addr) \
|
||||
__builtin_arm_prefetch(addr, 0, cache_level, retention_policy, 0)
|
||||
#endif
|
||||
|
||||
/* 8.7 NOP */
|
||||
static __inline__ void __attribute__((__always_inline__, __nodebug__)) __nop(void) {
|
||||
__builtin_arm_nop();
|
||||
}
|
||||
|
||||
/* 9 DATA-PROCESSING INTRINSICS */
|
||||
/* 9.2 Miscellaneous data-processing intrinsics */
|
||||
/* ROR */
|
||||
static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__))
|
||||
__ror(uint32_t __x, uint32_t __y) {
|
||||
__y %= 32;
|
||||
if (__y == 0)
|
||||
return __x;
|
||||
return (__x >> __y) | (__x << (32 - __y));
|
||||
}
|
||||
|
||||
static __inline__ uint64_t __attribute__((__always_inline__, __nodebug__))
|
||||
__rorll(uint64_t __x, uint32_t __y) {
|
||||
__y %= 64;
|
||||
if (__y == 0)
|
||||
return __x;
|
||||
return (__x >> __y) | (__x << (64 - __y));
|
||||
}
|
||||
|
||||
static __inline__ unsigned long __attribute__((__always_inline__, __nodebug__))
|
||||
__rorl(unsigned long __x, uint32_t __y) {
|
||||
#if __SIZEOF_LONG__ == 4
|
||||
return __ror(__x, __y);
|
||||
#else
|
||||
return __rorll(__x, __y);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* CLZ */
|
||||
static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__))
|
||||
__clz(uint32_t __t) {
|
||||
return __builtin_clz(__t);
|
||||
}
|
||||
|
||||
static __inline__ unsigned long __attribute__((__always_inline__, __nodebug__))
|
||||
__clzl(unsigned long __t) {
|
||||
return __builtin_clzl(__t);
|
||||
}
|
||||
|
||||
static __inline__ uint64_t __attribute__((__always_inline__, __nodebug__))
|
||||
__clzll(uint64_t __t) {
|
||||
return __builtin_clzll(__t);
|
||||
}
|
||||
|
||||
/* REV */
|
||||
static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__))
|
||||
__rev(uint32_t __t) {
|
||||
return __builtin_bswap32(__t);
|
||||
}
|
||||
|
||||
static __inline__ unsigned long __attribute__((__always_inline__, __nodebug__))
|
||||
__revl(unsigned long __t) {
|
||||
#if __SIZEOF_LONG__ == 4
|
||||
return __builtin_bswap32(__t);
|
||||
#else
|
||||
return __builtin_bswap64(__t);
|
||||
#endif
|
||||
}
|
||||
|
||||
static __inline__ uint64_t __attribute__((__always_inline__, __nodebug__))
|
||||
__revll(uint64_t __t) {
|
||||
return __builtin_bswap64(__t);
|
||||
}
|
||||
|
||||
/* REV16 */
|
||||
static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__))
|
||||
__rev16(uint32_t __t) {
|
||||
return __ror(__rev(__t), 16);
|
||||
}
|
||||
|
||||
static __inline__ uint64_t __attribute__((__always_inline__, __nodebug__))
|
||||
__rev16ll(uint64_t __t) {
|
||||
return (((uint64_t)__rev16(__t >> 32)) << 32) | __rev16(__t);
|
||||
}
|
||||
|
||||
static __inline__ unsigned long __attribute__((__always_inline__, __nodebug__))
|
||||
__rev16l(unsigned long __t) {
|
||||
#if __SIZEOF_LONG__ == 4
|
||||
return __rev16(__t);
|
||||
#else
|
||||
return __rev16ll(__t);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* REVSH */
|
||||
static __inline__ int16_t __attribute__((__always_inline__, __nodebug__))
|
||||
__revsh(int16_t __t) {
|
||||
return __builtin_bswap16(__t);
|
||||
}
|
||||
|
||||
/* RBIT */
|
||||
static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__))
|
||||
__rbit(uint32_t __t) {
|
||||
return __builtin_arm_rbit(__t);
|
||||
}
|
||||
|
||||
static __inline__ uint64_t __attribute__((__always_inline__, __nodebug__))
|
||||
__rbitll(uint64_t __t) {
|
||||
#if __ARM_32BIT_STATE
|
||||
return (((uint64_t)__builtin_arm_rbit(__t)) << 32) |
|
||||
__builtin_arm_rbit(__t >> 32);
|
||||
#else
|
||||
return __builtin_arm_rbit64(__t);
|
||||
#endif
|
||||
}
|
||||
|
||||
static __inline__ unsigned long __attribute__((__always_inline__, __nodebug__))
|
||||
__rbitl(unsigned long __t) {
|
||||
#if __SIZEOF_LONG__ == 4
|
||||
return __rbit(__t);
|
||||
#else
|
||||
return __rbitll(__t);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* 9.4 Saturating intrinsics
|
||||
*
|
||||
* FIXME: Change guard to their corrosponding __ARM_FEATURE flag when Q flag
|
||||
* intrinsics are implemented and the flag is enabled.
|
||||
*/
|
||||
/* 9.4.1 Width-specified saturation intrinsics */
|
||||
#if __ARM_32BIT_STATE
|
||||
#define __ssat(x, y) __builtin_arm_ssat(x, y)
|
||||
#define __usat(x, y) __builtin_arm_usat(x, y)
|
||||
#endif
|
||||
|
||||
/* 9.4.2 Saturating addition and subtraction intrinsics */
|
||||
#if __ARM_32BIT_STATE
|
||||
static __inline__ int32_t __attribute__((__always_inline__, __nodebug__))
|
||||
__qadd(int32_t __t, int32_t __v) {
|
||||
return __builtin_arm_qadd(__t, __v);
|
||||
}
|
||||
|
||||
static __inline__ int32_t __attribute__((__always_inline__, __nodebug__))
|
||||
__qsub(int32_t __t, int32_t __v) {
|
||||
return __builtin_arm_qsub(__t, __v);
|
||||
}
|
||||
|
||||
static __inline__ int32_t __attribute__((__always_inline__, __nodebug__))
|
||||
__qdbl(int32_t __t) {
|
||||
return __builtin_arm_qadd(__t, __t);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* 9.7 CRC32 intrinsics */
|
||||
#if __ARM_FEATURE_CRC32
|
||||
static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__))
|
||||
__crc32b(uint32_t __a, uint8_t __b) {
|
||||
return __builtin_arm_crc32b(__a, __b);
|
||||
}
|
||||
|
||||
static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__))
|
||||
__crc32h(uint32_t __a, uint16_t __b) {
|
||||
return __builtin_arm_crc32h(__a, __b);
|
||||
}
|
||||
|
||||
static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__))
|
||||
__crc32w(uint32_t __a, uint32_t __b) {
|
||||
return __builtin_arm_crc32w(__a, __b);
|
||||
}
|
||||
|
||||
static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__))
|
||||
__crc32d(uint32_t __a, uint64_t __b) {
|
||||
return __builtin_arm_crc32d(__a, __b);
|
||||
}
|
||||
|
||||
static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__))
|
||||
__crc32cb(uint32_t __a, uint8_t __b) {
|
||||
return __builtin_arm_crc32cb(__a, __b);
|
||||
}
|
||||
|
||||
static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__))
|
||||
__crc32ch(uint32_t __a, uint16_t __b) {
|
||||
return __builtin_arm_crc32ch(__a, __b);
|
||||
}
|
||||
|
||||
static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__))
|
||||
__crc32cw(uint32_t __a, uint32_t __b) {
|
||||
return __builtin_arm_crc32cw(__a, __b);
|
||||
}
|
||||
|
||||
static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__))
|
||||
__crc32cd(uint32_t __a, uint64_t __b) {
|
||||
return __builtin_arm_crc32cd(__a, __b);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* 10.1 Special register intrinsics */
|
||||
#define __arm_rsr(sysreg) __builtin_arm_rsr(sysreg)
|
||||
#define __arm_rsr64(sysreg) __builtin_arm_rsr64(sysreg)
|
||||
#define __arm_rsrp(sysreg) __builtin_arm_rsrp(sysreg)
|
||||
#define __arm_wsr(sysreg, v) __builtin_arm_wsr(sysreg, v)
|
||||
#define __arm_wsr64(sysreg, v) __builtin_arm_wsr64(sysreg, v)
|
||||
#define __arm_wsrp(sysreg, v) __builtin_arm_wsrp(sysreg, v)
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ARM_ACLE_H */
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,144 @@
|
||||
/*===------------- avx512cdintrin.h - AVX512CD intrinsics ------------------===
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
#ifndef __IMMINTRIN_H
|
||||
#error "Never use <avx512cdintrin.h> directly; include <immintrin.h> instead."
|
||||
#endif
|
||||
|
||||
#ifndef __AVX512CDINTRIN_H
|
||||
#define __AVX512CDINTRIN_H
|
||||
|
||||
/* Define the default attributes for the functions in this file. */
|
||||
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("avx512cd")))
|
||||
|
||||
static __inline__ __m512i __DEFAULT_FN_ATTRS
|
||||
_mm512_conflict_epi64 (__m512i __A)
|
||||
{
|
||||
return (__m512i) __builtin_ia32_vpconflictdi_512_mask ((__v8di) __A,
|
||||
(__v8di) _mm512_setzero_si512 (),
|
||||
(__mmask8) -1);
|
||||
}
|
||||
|
||||
static __inline__ __m512i __DEFAULT_FN_ATTRS
|
||||
_mm512_mask_conflict_epi64 (__m512i __W, __mmask8 __U, __m512i __A)
|
||||
{
|
||||
return (__m512i) __builtin_ia32_vpconflictdi_512_mask ((__v8di) __A,
|
||||
(__v8di) __W,
|
||||
(__mmask8) __U);
|
||||
}
|
||||
|
||||
static __inline__ __m512i __DEFAULT_FN_ATTRS
|
||||
_mm512_maskz_conflict_epi64 (__mmask8 __U, __m512i __A)
|
||||
{
|
||||
return (__m512i) __builtin_ia32_vpconflictdi_512_mask ((__v8di) __A,
|
||||
(__v8di) _mm512_setzero_si512 (),
|
||||
(__mmask8) __U);
|
||||
}
|
||||
|
||||
static __inline__ __m512i __DEFAULT_FN_ATTRS
|
||||
_mm512_conflict_epi32 (__m512i __A)
|
||||
{
|
||||
return (__m512i) __builtin_ia32_vpconflictsi_512_mask ((__v16si) __A,
|
||||
(__v16si) _mm512_setzero_si512 (),
|
||||
(__mmask16) -1);
|
||||
}
|
||||
|
||||
static __inline__ __m512i __DEFAULT_FN_ATTRS
|
||||
_mm512_mask_conflict_epi32 (__m512i __W, __mmask16 __U, __m512i __A)
|
||||
{
|
||||
return (__m512i) __builtin_ia32_vpconflictsi_512_mask ((__v16si) __A,
|
||||
(__v16si) __W,
|
||||
(__mmask16) __U);
|
||||
}
|
||||
|
||||
static __inline__ __m512i __DEFAULT_FN_ATTRS
|
||||
_mm512_maskz_conflict_epi32 (__mmask16 __U, __m512i __A)
|
||||
{
|
||||
return (__m512i) __builtin_ia32_vpconflictsi_512_mask ((__v16si) __A,
|
||||
(__v16si) _mm512_setzero_si512 (),
|
||||
(__mmask16) __U);
|
||||
}
|
||||
|
||||
static __inline__ __m512i __DEFAULT_FN_ATTRS
|
||||
_mm512_lzcnt_epi32 (__m512i __A)
|
||||
{
|
||||
return (__m512i) __builtin_ia32_vplzcntd_512_mask ((__v16si) __A,
|
||||
(__v16si) _mm512_setzero_si512 (),
|
||||
(__mmask16) -1);
|
||||
}
|
||||
|
||||
static __inline__ __m512i __DEFAULT_FN_ATTRS
|
||||
_mm512_mask_lzcnt_epi32 (__m512i __W, __mmask16 __U, __m512i __A)
|
||||
{
|
||||
return (__m512i) __builtin_ia32_vplzcntd_512_mask ((__v16si) __A,
|
||||
(__v16si) __W,
|
||||
(__mmask16) __U);
|
||||
}
|
||||
|
||||
static __inline__ __m512i __DEFAULT_FN_ATTRS
|
||||
_mm512_maskz_lzcnt_epi32 (__mmask16 __U, __m512i __A)
|
||||
{
|
||||
return (__m512i) __builtin_ia32_vplzcntd_512_mask ((__v16si) __A,
|
||||
(__v16si) _mm512_setzero_si512 (),
|
||||
(__mmask16) __U);
|
||||
}
|
||||
|
||||
static __inline__ __m512i __DEFAULT_FN_ATTRS
|
||||
_mm512_lzcnt_epi64 (__m512i __A)
|
||||
{
|
||||
return (__m512i) __builtin_ia32_vplzcntq_512_mask ((__v8di) __A,
|
||||
(__v8di) _mm512_setzero_si512 (),
|
||||
(__mmask8) -1);
|
||||
}
|
||||
|
||||
static __inline__ __m512i __DEFAULT_FN_ATTRS
|
||||
_mm512_mask_lzcnt_epi64 (__m512i __W, __mmask8 __U, __m512i __A)
|
||||
{
|
||||
return (__m512i) __builtin_ia32_vplzcntq_512_mask ((__v8di) __A,
|
||||
(__v8di) __W,
|
||||
(__mmask8) __U);
|
||||
}
|
||||
|
||||
static __inline__ __m512i __DEFAULT_FN_ATTRS
|
||||
_mm512_maskz_lzcnt_epi64 (__mmask8 __U, __m512i __A)
|
||||
{
|
||||
return (__m512i) __builtin_ia32_vplzcntq_512_mask ((__v8di) __A,
|
||||
(__v8di) _mm512_setzero_si512 (),
|
||||
(__mmask8) __U);
|
||||
}
|
||||
|
||||
static __inline__ __m512i __DEFAULT_FN_ATTRS
|
||||
_mm512_broadcastmb_epi64 (__mmask8 __A)
|
||||
{
|
||||
return (__m512i) __builtin_ia32_broadcastmb512 (__A);
|
||||
}
|
||||
|
||||
static __inline__ __m512i __DEFAULT_FN_ATTRS
|
||||
_mm512_broadcastmw_epi32 (__mmask16 __A)
|
||||
{
|
||||
return (__m512i) __builtin_ia32_broadcastmw512 (__A);
|
||||
}
|
||||
|
||||
#undef __DEFAULT_FN_ATTRS
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,285 @@
|
||||
/*===---- avx512erintrin.h - AVX512ER intrinsics ---------------------------===
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
#ifndef __IMMINTRIN_H
|
||||
#error "Never use <avx512erintrin.h> directly; include <immintrin.h> instead."
|
||||
#endif
|
||||
|
||||
#ifndef __AVX512ERINTRIN_H
|
||||
#define __AVX512ERINTRIN_H
|
||||
|
||||
// exp2a23
|
||||
#define _mm512_exp2a23_round_pd(A, R) __extension__ ({ \
|
||||
(__m512d)__builtin_ia32_exp2pd_mask((__v8df)(__m512d)(A), \
|
||||
(__v8df)_mm512_setzero_pd(), \
|
||||
(__mmask8)-1, (int)(R)); })
|
||||
|
||||
#define _mm512_mask_exp2a23_round_pd(S, M, A, R) __extension__ ({ \
|
||||
(__m512d)__builtin_ia32_exp2pd_mask((__v8df)(__m512d)(A), \
|
||||
(__v8df)(__m512d)(S), (__mmask8)(M), \
|
||||
(int)(R)); })
|
||||
|
||||
#define _mm512_maskz_exp2a23_round_pd(M, A, R) __extension__ ({ \
|
||||
(__m512d)__builtin_ia32_exp2pd_mask((__v8df)(__m512d)(A), \
|
||||
(__v8df)_mm512_setzero_pd(), \
|
||||
(__mmask8)(M), (int)(R)); })
|
||||
|
||||
#define _mm512_exp2a23_pd(A) \
|
||||
_mm512_exp2a23_round_pd((A), _MM_FROUND_CUR_DIRECTION)
|
||||
|
||||
#define _mm512_mask_exp2a23_pd(S, M, A) \
|
||||
_mm512_mask_exp2a23_round_pd((S), (M), (A), _MM_FROUND_CUR_DIRECTION)
|
||||
|
||||
#define _mm512_maskz_exp2a23_pd(M, A) \
|
||||
_mm512_maskz_exp2a23_round_pd((M), (A), _MM_FROUND_CUR_DIRECTION)
|
||||
|
||||
#define _mm512_exp2a23_round_ps(A, R) __extension__ ({ \
|
||||
(__m512)__builtin_ia32_exp2ps_mask((__v16sf)(__m512)(A), \
|
||||
(__v16sf)_mm512_setzero_ps(), \
|
||||
(__mmask16)-1, (int)(R)); })
|
||||
|
||||
#define _mm512_mask_exp2a23_round_ps(S, M, A, R) __extension__ ({ \
|
||||
(__m512)__builtin_ia32_exp2ps_mask((__v16sf)(__m512)(A), \
|
||||
(__v16sf)(__m512)(S), (__mmask16)(M), \
|
||||
(int)(R)); })
|
||||
|
||||
#define _mm512_maskz_exp2a23_round_ps(M, A, R) __extension__ ({ \
|
||||
(__m512)__builtin_ia32_exp2ps_mask((__v16sf)(__m512)(A), \
|
||||
(__v16sf)_mm512_setzero_ps(), \
|
||||
(__mmask16)(M), (int)(R)); })
|
||||
|
||||
#define _mm512_exp2a23_ps(A) \
|
||||
_mm512_exp2a23_round_ps((A), _MM_FROUND_CUR_DIRECTION)
|
||||
|
||||
#define _mm512_mask_exp2a23_ps(S, M, A) \
|
||||
_mm512_mask_exp2a23_round_ps((S), (M), (A), _MM_FROUND_CUR_DIRECTION)
|
||||
|
||||
#define _mm512_maskz_exp2a23_ps(M, A) \
|
||||
_mm512_maskz_exp2a23_round_ps((M), (A), _MM_FROUND_CUR_DIRECTION)
|
||||
|
||||
// rsqrt28
|
||||
#define _mm512_rsqrt28_round_pd(A, R) __extension__ ({ \
|
||||
(__m512d)__builtin_ia32_rsqrt28pd_mask((__v8df)(__m512d)(A), \
|
||||
(__v8df)_mm512_setzero_pd(), \
|
||||
(__mmask8)-1, (int)(R)); })
|
||||
|
||||
#define _mm512_mask_rsqrt28_round_pd(S, M, A, R) __extension__ ({ \
|
||||
(__m512d)__builtin_ia32_rsqrt28pd_mask((__v8df)(__m512d)(A), \
|
||||
(__v8df)(__m512d)(S), (__mmask8)(M), \
|
||||
(int)(R)); })
|
||||
|
||||
#define _mm512_maskz_rsqrt28_round_pd(M, A, R) __extension__ ({ \
|
||||
(__m512d)__builtin_ia32_rsqrt28pd_mask((__v8df)(__m512d)(A), \
|
||||
(__v8df)_mm512_setzero_pd(), \
|
||||
(__mmask8)(M), (int)(R)); })
|
||||
|
||||
#define _mm512_rsqrt28_pd(A) \
|
||||
_mm512_rsqrt28_round_pd((A), _MM_FROUND_CUR_DIRECTION)
|
||||
|
||||
#define _mm512_mask_rsqrt28_pd(S, M, A) \
|
||||
_mm512_mask_rsqrt28_round_pd((S), (M), (A), _MM_FROUND_CUR_DIRECTION)
|
||||
|
||||
#define _mm512_maskz_rsqrt28_pd(M, A) \
|
||||
_mm512_maskz_rsqrt28_round_pd((M), (A), _MM_FROUND_CUR_DIRECTION)
|
||||
|
||||
#define _mm512_rsqrt28_round_ps(A, R) __extension__ ({ \
|
||||
(__m512)__builtin_ia32_rsqrt28ps_mask((__v16sf)(__m512)(A), \
|
||||
(__v16sf)_mm512_setzero_ps(), \
|
||||
(__mmask16)-1, (int)(R)); })
|
||||
|
||||
#define _mm512_mask_rsqrt28_round_ps(S, M, A, R) __extension__ ({ \
|
||||
(__m512)__builtin_ia32_rsqrt28ps_mask((__v16sf)(__m512)(A), \
|
||||
(__v16sf)(__m512)(S), (__mmask16)(M), \
|
||||
(int)(R)); })
|
||||
|
||||
#define _mm512_maskz_rsqrt28_round_ps(M, A, R) __extension__ ({ \
|
||||
(__m512)__builtin_ia32_rsqrt28ps_mask((__v16sf)(__m512)(A), \
|
||||
(__v16sf)_mm512_setzero_ps(), \
|
||||
(__mmask16)(M), (int)(R)); })
|
||||
|
||||
#define _mm512_rsqrt28_ps(A) \
|
||||
_mm512_rsqrt28_round_ps((A), _MM_FROUND_CUR_DIRECTION)
|
||||
|
||||
#define _mm512_mask_rsqrt28_ps(S, M, A) \
|
||||
_mm512_mask_rsqrt28_round_ps((S), (M), A, _MM_FROUND_CUR_DIRECTION)
|
||||
|
||||
#define _mm512_maskz_rsqrt28_ps(M, A) \
|
||||
_mm512_maskz_rsqrt28_round_ps((M), (A), _MM_FROUND_CUR_DIRECTION)
|
||||
|
||||
#define _mm_rsqrt28_round_ss(A, B, R) __extension__ ({ \
|
||||
(__m128)__builtin_ia32_rsqrt28ss_round_mask((__v4sf)(__m128)(A), \
|
||||
(__v4sf)(__m128)(B), \
|
||||
(__v4sf)_mm_setzero_ps(), \
|
||||
(__mmask8)-1, (int)(R)); })
|
||||
|
||||
#define _mm_mask_rsqrt28_round_ss(S, M, A, B, R) __extension__ ({ \
|
||||
(__m128)__builtin_ia32_rsqrt28ss_round_mask((__v4sf)(__m128)(A), \
|
||||
(__v4sf)(__m128)(B), \
|
||||
(__v4sf)(__m128)(S), \
|
||||
(__mmask8)(M), (int)(R)); })
|
||||
|
||||
#define _mm_maskz_rsqrt28_round_ss(M, A, B, R) __extension__ ({ \
|
||||
(__m128)__builtin_ia32_rsqrt28ss_round_mask((__v4sf)(__m128)(A), \
|
||||
(__v4sf)(__m128)(B), \
|
||||
(__v4sf)_mm_setzero_ps(), \
|
||||
(__mmask8)(M), (int)(R)); })
|
||||
|
||||
#define _mm_rsqrt28_ss(A, B) \
|
||||
_mm_rsqrt28_round_ss((A), (B), _MM_FROUND_CUR_DIRECTION)
|
||||
|
||||
#define _mm_mask_rsqrt28_ss(S, M, A, B) \
|
||||
_mm_mask_rsqrt28_round_ss((S), (M), (A), (B), _MM_FROUND_CUR_DIRECTION)
|
||||
|
||||
#define _mm_maskz_rsqrt28_ss(M, A, B) \
|
||||
_mm_maskz_rsqrt28_round_ss((M), (A), (B), _MM_FROUND_CUR_DIRECTION)
|
||||
|
||||
#define _mm_rsqrt28_round_sd(A, B, R) __extension__ ({ \
|
||||
(__m128d)__builtin_ia32_rsqrt28sd_round_mask((__v2df)(__m128d)(A), \
|
||||
(__v2df)(__m128d)(B), \
|
||||
(__v2df)_mm_setzero_pd(), \
|
||||
(__mmask8)-1, (int)(R)); })
|
||||
|
||||
#define _mm_mask_rsqrt28_round_sd(S, M, A, B, R) __extension__ ({ \
|
||||
(__m128d)__builtin_ia32_rsqrt28sd_round_mask((__v2df)(__m128d)(A), \
|
||||
(__v2df)(__m128d)(B), \
|
||||
(__v2df)(__m128d)(S), \
|
||||
(__mmask8)(M), (int)(R)); })
|
||||
|
||||
#define _mm_maskz_rsqrt28_round_sd(M, A, B, R) __extension__ ({ \
|
||||
(__m128d)__builtin_ia32_rsqrt28sd_round_mask((__v2df)(__m128d)(A), \
|
||||
(__v2df)(__m128d)(B), \
|
||||
(__v2df)_mm_setzero_pd(), \
|
||||
(__mmask8)(M), (int)(R)); })
|
||||
|
||||
#define _mm_rsqrt28_sd(A, B) \
|
||||
_mm_rsqrt28_round_sd((A), (B), _MM_FROUND_CUR_DIRECTION)
|
||||
|
||||
#define _mm_mask_rsqrt28_sd(S, M, A, B) \
|
||||
_mm_mask_rsqrt28_round_sd((S), (M), (A), (B), _MM_FROUND_CUR_DIRECTION)
|
||||
|
||||
#define _mm_maskz_rsqrt28_sd(M, A, B) \
|
||||
_mm_maskz_rsqrt28_round_sd((M), (A), (B), _MM_FROUND_CUR_DIRECTION)
|
||||
|
||||
// rcp28
|
||||
#define _mm512_rcp28_round_pd(A, R) __extension__ ({ \
|
||||
(__m512d)__builtin_ia32_rcp28pd_mask((__v8df)(__m512d)(A), \
|
||||
(__v8df)_mm512_setzero_pd(), \
|
||||
(__mmask8)-1, (int)(R)); })
|
||||
|
||||
#define _mm512_mask_rcp28_round_pd(S, M, A, R) __extension__ ({ \
|
||||
(__m512d)__builtin_ia32_rcp28pd_mask((__v8df)(__m512d)(A), \
|
||||
(__v8df)(__m512d)(S), (__mmask8)(M), \
|
||||
(int)(R)); })
|
||||
|
||||
#define _mm512_maskz_rcp28_round_pd(M, A, R) __extension__ ({ \
|
||||
(__m512d)__builtin_ia32_rcp28pd_mask((__v8df)(__m512d)(A), \
|
||||
(__v8df)_mm512_setzero_pd(), \
|
||||
(__mmask8)(M), (int)(R)); })
|
||||
|
||||
#define _mm512_rcp28_pd(A) \
|
||||
_mm512_rcp28_round_pd((A), _MM_FROUND_CUR_DIRECTION)
|
||||
|
||||
#define _mm512_mask_rcp28_pd(S, M, A) \
|
||||
_mm512_mask_rcp28_round_pd((S), (M), (A), _MM_FROUND_CUR_DIRECTION)
|
||||
|
||||
#define _mm512_maskz_rcp28_pd(M, A) \
|
||||
_mm512_maskz_rcp28_round_pd((M), (A), _MM_FROUND_CUR_DIRECTION)
|
||||
|
||||
#define _mm512_rcp28_round_ps(A, R) __extension__ ({ \
|
||||
(__m512)__builtin_ia32_rcp28ps_mask((__v16sf)(__m512)(A), \
|
||||
(__v16sf)_mm512_setzero_ps(), \
|
||||
(__mmask16)-1, (int)(R)); })
|
||||
|
||||
#define _mm512_mask_rcp28_round_ps(S, M, A, R) __extension__ ({ \
|
||||
(__m512)__builtin_ia32_rcp28ps_mask((__v16sf)(__m512)(A), \
|
||||
(__v16sf)(__m512)(S), (__mmask16)(M), \
|
||||
(int)(R)); })
|
||||
|
||||
#define _mm512_maskz_rcp28_round_ps(M, A, R) __extension__ ({ \
|
||||
(__m512)__builtin_ia32_rcp28ps_mask((__v16sf)(__m512)(A), \
|
||||
(__v16sf)_mm512_setzero_ps(), \
|
||||
(__mmask16)(M), (int)(R)); })
|
||||
|
||||
#define _mm512_rcp28_ps(A) \
|
||||
_mm512_rcp28_round_ps((A), _MM_FROUND_CUR_DIRECTION)
|
||||
|
||||
#define _mm512_mask_rcp28_ps(S, M, A) \
|
||||
_mm512_mask_rcp28_round_ps((S), (M), (A), _MM_FROUND_CUR_DIRECTION)
|
||||
|
||||
#define _mm512_maskz_rcp28_ps(M, A) \
|
||||
_mm512_maskz_rcp28_round_ps((M), (A), _MM_FROUND_CUR_DIRECTION)
|
||||
|
||||
#define _mm_rcp28_round_ss(A, B, R) __extension__ ({ \
|
||||
(__m128)__builtin_ia32_rcp28ss_round_mask((__v4sf)(__m128)(A), \
|
||||
(__v4sf)(__m128)(B), \
|
||||
(__v4sf)_mm_setzero_ps(), \
|
||||
(__mmask8)-1, (int)(R)); })
|
||||
|
||||
#define _mm_mask_rcp28_round_ss(S, M, A, B, R) __extension__ ({ \
|
||||
(__m128)__builtin_ia32_rcp28ss_round_mask((__v4sf)(__m128)(A), \
|
||||
(__v4sf)(__m128)(B), \
|
||||
(__v4sf)(__m128)(S), \
|
||||
(__mmask8)(M), (int)(R)); })
|
||||
|
||||
#define _mm_maskz_rcp28_round_ss(M, A, B, R) __extension__ ({ \
|
||||
(__m128)__builtin_ia32_rcp28ss_round_mask((__v4sf)(__m128)(A), \
|
||||
(__v4sf)(__m128)(B), \
|
||||
(__v4sf)_mm_setzero_ps(), \
|
||||
(__mmask8)(M), (int)(R)); })
|
||||
|
||||
#define _mm_rcp28_ss(A, B) \
|
||||
_mm_rcp28_round_ss((A), (B), _MM_FROUND_CUR_DIRECTION)
|
||||
|
||||
#define _mm_mask_rcp28_ss(S, M, A, B) \
|
||||
_mm_mask_rcp28_round_ss((S), (M), (A), (B), _MM_FROUND_CUR_DIRECTION)
|
||||
|
||||
#define _mm_maskz_rcp28_ss(M, A, B) \
|
||||
_mm_maskz_rcp28_round_ss((M), (A), (B), _MM_FROUND_CUR_DIRECTION)
|
||||
|
||||
#define _mm_rcp28_round_sd(A, B, R) __extension__ ({ \
|
||||
(__m128d)__builtin_ia32_rcp28sd_round_mask((__v2df)(__m128d)(A), \
|
||||
(__v2df)(__m128d)(B), \
|
||||
(__v2df)_mm_setzero_pd(), \
|
||||
(__mmask8)-1, (int)(R)); })
|
||||
|
||||
#define _mm_mask_rcp28_round_sd(S, M, A, B, R) __extension__ ({ \
|
||||
(__m128d)__builtin_ia32_rcp28sd_round_mask((__v2df)(__m128d)(A), \
|
||||
(__v2df)(__m128d)(B), \
|
||||
(__v2df)(__m128d)(S), \
|
||||
(__mmask8)(M), (int)(R)); })
|
||||
|
||||
#define _mm_maskz_rcp28_round_sd(M, A, B, R) __extension__ ({ \
|
||||
(__m128d)__builtin_ia32_rcp28sd_round_mask((__v2df)(__m128d)(A), \
|
||||
(__v2df)(__m128d)(B), \
|
||||
(__v2df)_mm_setzero_pd(), \
|
||||
(__mmask8)(M), (int)(R)); })
|
||||
|
||||
#define _mm_rcp28_sd(A, B) \
|
||||
_mm_rcp28_round_sd((A), (B), _MM_FROUND_CUR_DIRECTION)
|
||||
|
||||
#define _mm_mask_rcp28_sd(S, M, A, B) \
|
||||
_mm_mask_rcp28_round_sd((S), (M), (A), (B), _MM_FROUND_CUR_DIRECTION)
|
||||
|
||||
#define _mm_maskz_rcp28_sd(M, A, B) \
|
||||
_mm_maskz_rcp28_round_sd((M), (A), (B), _MM_FROUND_CUR_DIRECTION)
|
||||
|
||||
#endif // __AVX512ERINTRIN_H
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,92 @@
|
||||
/*===------------- avx512ifmaintrin.h - IFMA intrinsics ------------------===
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
#ifndef __IMMINTRIN_H
|
||||
#error "Never use <avx512ifmaintrin.h> directly; include <immintrin.h> instead."
|
||||
#endif
|
||||
|
||||
#ifndef __IFMAINTRIN_H
|
||||
#define __IFMAINTRIN_H
|
||||
|
||||
/* Define the default attributes for the functions in this file. */
|
||||
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("avx512ifma")))
|
||||
|
||||
static __inline__ __m512i __DEFAULT_FN_ATTRS
|
||||
_mm512_madd52hi_epu64 (__m512i __X, __m512i __Y, __m512i __Z)
|
||||
{
|
||||
return (__m512i) __builtin_ia32_vpmadd52huq512_mask ((__v8di) __X,
|
||||
(__v8di) __Y,
|
||||
(__v8di) __Z,
|
||||
(__mmask8) -1);
|
||||
}
|
||||
|
||||
static __inline__ __m512i __DEFAULT_FN_ATTRS
|
||||
_mm512_mask_madd52hi_epu64 (__m512i __W, __mmask8 __M, __m512i __X,
|
||||
__m512i __Y)
|
||||
{
|
||||
return (__m512i) __builtin_ia32_vpmadd52huq512_mask ((__v8di) __W,
|
||||
(__v8di) __X,
|
||||
(__v8di) __Y,
|
||||
(__mmask8) __M);
|
||||
}
|
||||
|
||||
static __inline__ __m512i __DEFAULT_FN_ATTRS
|
||||
_mm512_maskz_madd52hi_epu64 (__mmask8 __M, __m512i __X, __m512i __Y, __m512i __Z)
|
||||
{
|
||||
return (__m512i) __builtin_ia32_vpmadd52huq512_maskz ((__v8di) __X,
|
||||
(__v8di) __Y,
|
||||
(__v8di) __Z,
|
||||
(__mmask8) __M);
|
||||
}
|
||||
|
||||
static __inline__ __m512i __DEFAULT_FN_ATTRS
|
||||
_mm512_madd52lo_epu64 (__m512i __X, __m512i __Y, __m512i __Z)
|
||||
{
|
||||
return (__m512i) __builtin_ia32_vpmadd52luq512_mask ((__v8di) __X,
|
||||
(__v8di) __Y,
|
||||
(__v8di) __Z,
|
||||
(__mmask8) -1);
|
||||
}
|
||||
|
||||
static __inline__ __m512i __DEFAULT_FN_ATTRS
|
||||
_mm512_mask_madd52lo_epu64 (__m512i __W, __mmask8 __M, __m512i __X,
|
||||
__m512i __Y)
|
||||
{
|
||||
return (__m512i) __builtin_ia32_vpmadd52luq512_mask ((__v8di) __W,
|
||||
(__v8di) __X,
|
||||
(__v8di) __Y,
|
||||
(__mmask8) __M);
|
||||
}
|
||||
|
||||
static __inline__ __m512i __DEFAULT_FN_ATTRS
|
||||
_mm512_maskz_madd52lo_epu64 (__mmask8 __M, __m512i __X, __m512i __Y, __m512i __Z)
|
||||
{
|
||||
return (__m512i) __builtin_ia32_vpmadd52luq512_maskz ((__v8di) __X,
|
||||
(__v8di) __Y,
|
||||
(__v8di) __Z,
|
||||
(__mmask8) __M);
|
||||
}
|
||||
|
||||
#undef __DEFAULT_FN_ATTRS
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,149 @@
|
||||
/*===------------- avx512ifmavlintrin.h - IFMA intrinsics ------------------===
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
#ifndef __IMMINTRIN_H
|
||||
#error "Never use <avx512ifmavlintrin.h> directly; include <immintrin.h> instead."
|
||||
#endif
|
||||
|
||||
#ifndef __IFMAVLINTRIN_H
|
||||
#define __IFMAVLINTRIN_H
|
||||
|
||||
/* Define the default attributes for the functions in this file. */
|
||||
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("avx512ifma,avx512vl")))
|
||||
|
||||
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_madd52hi_epu64 (__m128i __X, __m128i __Y, __m128i __Z)
|
||||
{
|
||||
return (__m128i) __builtin_ia32_vpmadd52huq128_mask ((__v2di) __X,
|
||||
(__v2di) __Y,
|
||||
(__v2di) __Z,
|
||||
(__mmask8) -1);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_mask_madd52hi_epu64 (__m128i __W, __mmask8 __M, __m128i __X, __m128i __Y)
|
||||
{
|
||||
return (__m128i) __builtin_ia32_vpmadd52huq128_mask ((__v2di) __W,
|
||||
(__v2di) __X,
|
||||
(__v2di) __Y,
|
||||
(__mmask8) __M);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_maskz_madd52hi_epu64 (__mmask8 __M, __m128i __X, __m128i __Y, __m128i __Z)
|
||||
{
|
||||
return (__m128i) __builtin_ia32_vpmadd52huq128_maskz ((__v2di) __X,
|
||||
(__v2di) __Y,
|
||||
(__v2di) __Z,
|
||||
(__mmask8) __M);
|
||||
}
|
||||
|
||||
static __inline__ __m256i __DEFAULT_FN_ATTRS
|
||||
_mm256_madd52hi_epu64 (__m256i __X, __m256i __Y, __m256i __Z)
|
||||
{
|
||||
return (__m256i) __builtin_ia32_vpmadd52huq256_mask ((__v4di) __X,
|
||||
(__v4di) __Y,
|
||||
(__v4di) __Z,
|
||||
(__mmask8) -1);
|
||||
}
|
||||
|
||||
static __inline__ __m256i __DEFAULT_FN_ATTRS
|
||||
_mm256_mask_madd52hi_epu64 (__m256i __W, __mmask8 __M, __m256i __X,
|
||||
__m256i __Y)
|
||||
{
|
||||
return (__m256i) __builtin_ia32_vpmadd52huq256_mask ((__v4di) __W,
|
||||
(__v4di) __X,
|
||||
(__v4di) __Y,
|
||||
(__mmask8) __M);
|
||||
}
|
||||
|
||||
static __inline__ __m256i __DEFAULT_FN_ATTRS
|
||||
_mm256_maskz_madd52hi_epu64 (__mmask8 __M, __m256i __X, __m256i __Y, __m256i __Z)
|
||||
{
|
||||
return (__m256i) __builtin_ia32_vpmadd52huq256_maskz ((__v4di) __X,
|
||||
(__v4di) __Y,
|
||||
(__v4di) __Z,
|
||||
(__mmask8) __M);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_madd52lo_epu64 (__m128i __X, __m128i __Y, __m128i __Z)
|
||||
{
|
||||
return (__m128i) __builtin_ia32_vpmadd52luq128_mask ((__v2di) __X,
|
||||
(__v2di) __Y,
|
||||
(__v2di) __Z,
|
||||
(__mmask8) -1);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_mask_madd52lo_epu64 (__m128i __W, __mmask8 __M, __m128i __X, __m128i __Y)
|
||||
{
|
||||
return (__m128i) __builtin_ia32_vpmadd52luq128_mask ((__v2di) __W,
|
||||
(__v2di) __X,
|
||||
(__v2di) __Y,
|
||||
(__mmask8) __M);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_maskz_madd52lo_epu64 (__mmask8 __M, __m128i __X, __m128i __Y, __m128i __Z)
|
||||
{
|
||||
return (__m128i) __builtin_ia32_vpmadd52luq128_maskz ((__v2di) __X,
|
||||
(__v2di) __Y,
|
||||
(__v2di) __Z,
|
||||
(__mmask8) __M);
|
||||
}
|
||||
|
||||
static __inline__ __m256i __DEFAULT_FN_ATTRS
|
||||
_mm256_madd52lo_epu64 (__m256i __X, __m256i __Y, __m256i __Z)
|
||||
{
|
||||
return (__m256i) __builtin_ia32_vpmadd52luq256_mask ((__v4di) __X,
|
||||
(__v4di) __Y,
|
||||
(__v4di) __Z,
|
||||
(__mmask8) -1);
|
||||
}
|
||||
|
||||
static __inline__ __m256i __DEFAULT_FN_ATTRS
|
||||
_mm256_mask_madd52lo_epu64 (__m256i __W, __mmask8 __M, __m256i __X,
|
||||
__m256i __Y)
|
||||
{
|
||||
return (__m256i) __builtin_ia32_vpmadd52luq256_mask ((__v4di) __W,
|
||||
(__v4di) __X,
|
||||
(__v4di) __Y,
|
||||
(__mmask8) __M);
|
||||
}
|
||||
|
||||
static __inline__ __m256i __DEFAULT_FN_ATTRS
|
||||
_mm256_maskz_madd52lo_epu64 (__mmask8 __M, __m256i __X, __m256i __Y, __m256i __Z)
|
||||
{
|
||||
return (__m256i) __builtin_ia32_vpmadd52luq256_maskz ((__v4di) __X,
|
||||
(__v4di) __Y,
|
||||
(__v4di) __Z,
|
||||
(__mmask8) __M);
|
||||
}
|
||||
|
||||
|
||||
#undef __DEFAULT_FN_ATTRS
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,111 @@
|
||||
/*===------------- avx512pfintrin.h - PF intrinsics ------------------===
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
#ifndef __IMMINTRIN_H
|
||||
#error "Never use <avx512pfintrin.h> directly; include <immintrin.h> instead."
|
||||
#endif
|
||||
|
||||
#ifndef __AVX512PFINTRIN_H
|
||||
#define __AVX512PFINTRIN_H
|
||||
|
||||
/* Define the default attributes for the functions in this file. */
|
||||
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("avx512pf")))
|
||||
|
||||
#define _mm512_mask_prefetch_i32gather_pd(index, mask, addr, scale, hint) __extension__ ({\
|
||||
__builtin_ia32_gatherpfdpd((__mmask8)(mask), (__v8si)(__m256i)(index), \
|
||||
(long long const *)(addr), (int)(scale), \
|
||||
(int)(hint)); })
|
||||
|
||||
#define _mm512_prefetch_i32gather_pd(index, addr, scale, hint) __extension__ ({\
|
||||
__builtin_ia32_gatherpfdpd((__mmask8) -1, (__v8si)(__m256i)(index), \
|
||||
(long long const *)(addr), (int)(scale), \
|
||||
(int)(hint)); })
|
||||
|
||||
#define _mm512_mask_prefetch_i32gather_ps(index, mask, addr, scale, hint) ({\
|
||||
__builtin_ia32_gatherpfdps((__mmask16)(mask), \
|
||||
(__v16si)(__m512i)(index), (int const *)(addr), \
|
||||
(int)(scale), (int)(hint)); })
|
||||
|
||||
#define _mm512_prefetch_i32gather_ps(index, addr, scale, hint) ({\
|
||||
__builtin_ia32_gatherpfdps((__mmask16) -1, \
|
||||
(__v16si)(__m512i)(index), (int const *)(addr), \
|
||||
(int)(scale), (int)(hint)); })
|
||||
|
||||
#define _mm512_mask_prefetch_i64gather_pd(index, mask, addr, scale, hint) __extension__ ({\
|
||||
__builtin_ia32_gatherpfqpd((__mmask8)(mask), (__v8di)(__m512i)(index), \
|
||||
(long long const *)(addr), (int)(scale), \
|
||||
(int)(hint)); })
|
||||
|
||||
#define _mm512_prefetch_i64gather_pd(index, addr, scale, hint) __extension__ ({\
|
||||
__builtin_ia32_gatherpfqpd((__mmask8) -1, (__v8di)(__m512i)(index), \
|
||||
(long long const *)(addr), (int)(scale), \
|
||||
(int)(hint)); })
|
||||
|
||||
#define _mm512_mask_prefetch_i64gather_ps(index, mask, addr, scale, hint) ({\
|
||||
__builtin_ia32_gatherpfqps((__mmask8)(mask), (__v8di)(__m512i)(index), \
|
||||
(int const *)(addr), (int)(scale), (int)(hint)); })
|
||||
|
||||
#define _mm512_prefetch_i64gather_ps(index, addr, scale, hint) ({\
|
||||
__builtin_ia32_gatherpfqps((__mmask8) -1, (__v8di)(__m512i)(index), \
|
||||
(int const *)(addr), (int)(scale), (int)(hint)); })
|
||||
|
||||
#define _mm512_prefetch_i32scatter_pd(addr, index, scale, hint) __extension__ ({\
|
||||
__builtin_ia32_scatterpfdpd((__mmask8)-1, (__v8si)(__m256i)(index), \
|
||||
(long long *)(addr), (int)(scale), \
|
||||
(int)(hint)); })
|
||||
|
||||
#define _mm512_mask_prefetch_i32scatter_pd(addr, mask, index, scale, hint) __extension__ ({\
|
||||
__builtin_ia32_scatterpfdpd((__mmask8)(mask), (__v8si)(__m256i)(index), \
|
||||
(long long *)(addr), (int)(scale), \
|
||||
(int)(hint)); })
|
||||
|
||||
#define _mm512_prefetch_i32scatter_ps(addr, index, scale, hint) __extension__ ({\
|
||||
__builtin_ia32_scatterpfdps((__mmask16)-1, (__v16si)(__m512i)(index), \
|
||||
(int *)(addr), (int)(scale), (int)(hint)); })
|
||||
|
||||
#define _mm512_mask_prefetch_i32scatter_ps(addr, mask, index, scale, hint) __extension__ ({\
|
||||
__builtin_ia32_scatterpfdps((__mmask16)(mask), \
|
||||
(__v16si)(__m512i)(index), (int *)(addr), \
|
||||
(int)(scale), (int)(hint)); })
|
||||
|
||||
#define _mm512_prefetch_i64scatter_pd(addr, index, scale, hint) __extension__ ({\
|
||||
__builtin_ia32_scatterpfqpd((__mmask8)-1, (__v8di)(__m512i)(index), \
|
||||
(long long *)(addr), (int)(scale), \
|
||||
(int)(hint)); })
|
||||
|
||||
#define _mm512_mask_prefetch_i64scatter_pd(addr, mask, index, scale, hint) __extension__ ({\
|
||||
__builtin_ia32_scatterpfqpd((__mmask8)(mask), (__v8di)(__m512i)(index), \
|
||||
(long long *)(addr), (int)(scale), \
|
||||
(int)(hint)); })
|
||||
|
||||
#define _mm512_prefetch_i64scatter_ps(addr, index, scale, hint) __extension__ ({\
|
||||
__builtin_ia32_scatterpfqps((__mmask8)-1, (__v8di)(__m512i)(index), \
|
||||
(int *)(addr), (int)(scale), (int)(hint)); })
|
||||
|
||||
#define _mm512_mask_prefetch_i64scatter_ps(addr, mask, index, scale, hint) __extension__ ({\
|
||||
__builtin_ia32_scatterpfqps((__mmask8)(mask), (__v8di)(__m512i)(index), \
|
||||
(int *)(addr), (int)(scale), (int)(hint)); })
|
||||
|
||||
#undef __DEFAULT_FN_ATTRS
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,137 @@
|
||||
/*===------------- avx512vbmiintrin.h - VBMI intrinsics ------------------===
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
#ifndef __IMMINTRIN_H
|
||||
#error "Never use <avx512vbmiintrin.h> directly; include <immintrin.h> instead."
|
||||
#endif
|
||||
|
||||
#ifndef __VBMIINTRIN_H
|
||||
#define __VBMIINTRIN_H
|
||||
|
||||
/* Define the default attributes for the functions in this file. */
|
||||
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("avx512vbmi")))
|
||||
|
||||
|
||||
static __inline__ __m512i __DEFAULT_FN_ATTRS
|
||||
_mm512_mask2_permutex2var_epi8 (__m512i __A, __m512i __I,
|
||||
__mmask64 __U, __m512i __B)
|
||||
{
|
||||
return (__m512i) __builtin_ia32_vpermi2varqi512_mask ((__v64qi) __A,
|
||||
(__v64qi) __I
|
||||
/* idx */ ,
|
||||
(__v64qi) __B,
|
||||
(__mmask64) __U);
|
||||
}
|
||||
|
||||
static __inline__ __m512i __DEFAULT_FN_ATTRS
|
||||
_mm512_permutex2var_epi8 (__m512i __A, __m512i __I, __m512i __B)
|
||||
{
|
||||
return (__m512i) __builtin_ia32_vpermt2varqi512_mask ((__v64qi) __I
|
||||
/* idx */ ,
|
||||
(__v64qi) __A,
|
||||
(__v64qi) __B,
|
||||
(__mmask64) -1);
|
||||
}
|
||||
|
||||
static __inline__ __m512i __DEFAULT_FN_ATTRS
|
||||
_mm512_mask_permutex2var_epi8 (__m512i __A, __mmask64 __U,
|
||||
__m512i __I, __m512i __B)
|
||||
{
|
||||
return (__m512i) __builtin_ia32_vpermt2varqi512_mask ((__v64qi) __I
|
||||
/* idx */ ,
|
||||
(__v64qi) __A,
|
||||
(__v64qi) __B,
|
||||
(__mmask64) __U);
|
||||
}
|
||||
|
||||
static __inline__ __m512i __DEFAULT_FN_ATTRS
|
||||
_mm512_maskz_permutex2var_epi8 (__mmask64 __U, __m512i __A,
|
||||
__m512i __I, __m512i __B)
|
||||
{
|
||||
return (__m512i) __builtin_ia32_vpermt2varqi512_maskz ((__v64qi) __I
|
||||
/* idx */ ,
|
||||
(__v64qi) __A,
|
||||
(__v64qi) __B,
|
||||
(__mmask64) __U);
|
||||
}
|
||||
|
||||
static __inline__ __m512i __DEFAULT_FN_ATTRS
|
||||
_mm512_permutexvar_epi8 (__m512i __A, __m512i __B)
|
||||
{
|
||||
return (__m512i) __builtin_ia32_permvarqi512_mask ((__v64qi) __B,
|
||||
(__v64qi) __A,
|
||||
(__v64qi) _mm512_undefined_epi32 (),
|
||||
(__mmask64) -1);
|
||||
}
|
||||
|
||||
static __inline__ __m512i __DEFAULT_FN_ATTRS
|
||||
_mm512_maskz_permutexvar_epi8 (__mmask64 __M, __m512i __A,
|
||||
__m512i __B)
|
||||
{
|
||||
return (__m512i) __builtin_ia32_permvarqi512_mask ((__v64qi) __B,
|
||||
(__v64qi) __A,
|
||||
(__v64qi) _mm512_setzero_si512(),
|
||||
(__mmask64) __M);
|
||||
}
|
||||
|
||||
static __inline__ __m512i __DEFAULT_FN_ATTRS
|
||||
_mm512_mask_permutexvar_epi8 (__m512i __W, __mmask64 __M, __m512i __A,
|
||||
__m512i __B)
|
||||
{
|
||||
return (__m512i) __builtin_ia32_permvarqi512_mask ((__v64qi) __B,
|
||||
(__v64qi) __A,
|
||||
(__v64qi) __W,
|
||||
(__mmask64) __M);
|
||||
}
|
||||
|
||||
static __inline__ __m512i __DEFAULT_FN_ATTRS
|
||||
_mm512_mask_multishift_epi64_epi8 (__m512i __W, __mmask64 __M, __m512i __X, __m512i __Y)
|
||||
{
|
||||
return (__m512i) __builtin_ia32_vpmultishiftqb512_mask ((__v64qi) __X,
|
||||
(__v64qi) __Y,
|
||||
(__v64qi) __W,
|
||||
(__mmask64) __M);
|
||||
}
|
||||
|
||||
static __inline__ __m512i __DEFAULT_FN_ATTRS
|
||||
_mm512_maskz_multishift_epi64_epi8 (__mmask64 __M, __m512i __X, __m512i __Y)
|
||||
{
|
||||
return (__m512i) __builtin_ia32_vpmultishiftqb512_mask ((__v64qi) __X,
|
||||
(__v64qi) __Y,
|
||||
(__v64qi) _mm512_setzero_si512 (),
|
||||
(__mmask64) __M);
|
||||
}
|
||||
|
||||
static __inline__ __m512i __DEFAULT_FN_ATTRS
|
||||
_mm512_multishift_epi64_epi8 (__m512i __X, __m512i __Y)
|
||||
{
|
||||
return (__m512i) __builtin_ia32_vpmultishiftqb512_mask ((__v64qi) __X,
|
||||
(__v64qi) __Y,
|
||||
(__v64qi) _mm512_undefined_epi32 (),
|
||||
(__mmask64) -1);
|
||||
}
|
||||
|
||||
|
||||
#undef __DEFAULT_FN_ATTRS
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,247 @@
|
||||
/*===------------- avx512vbmivlintrin.h - VBMI intrinsics ------------------===
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
#ifndef __IMMINTRIN_H
|
||||
#error "Never use <avx512vbmivlintrin.h> directly; include <immintrin.h> instead."
|
||||
#endif
|
||||
|
||||
#ifndef __VBMIVLINTRIN_H
|
||||
#define __VBMIVLINTRIN_H
|
||||
|
||||
/* Define the default attributes for the functions in this file. */
|
||||
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("avx512vbmi,avx512vl")))
|
||||
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_mask2_permutex2var_epi8 (__m128i __A, __m128i __I, __mmask16 __U,
|
||||
__m128i __B)
|
||||
{
|
||||
return (__m128i) __builtin_ia32_vpermi2varqi128_mask ((__v16qi) __A,
|
||||
(__v16qi) __I
|
||||
/* idx */ ,
|
||||
(__v16qi) __B,
|
||||
(__mmask16)
|
||||
__U);
|
||||
}
|
||||
|
||||
static __inline__ __m256i __DEFAULT_FN_ATTRS
|
||||
_mm256_mask2_permutex2var_epi8 (__m256i __A, __m256i __I,
|
||||
__mmask32 __U, __m256i __B)
|
||||
{
|
||||
return (__m256i) __builtin_ia32_vpermi2varqi256_mask ((__v32qi) __A,
|
||||
(__v32qi) __I
|
||||
/* idx */ ,
|
||||
(__v32qi) __B,
|
||||
(__mmask32)
|
||||
__U);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_permutex2var_epi8 (__m128i __A, __m128i __I, __m128i __B)
|
||||
{
|
||||
return (__m128i) __builtin_ia32_vpermt2varqi128_mask ((__v16qi) __I
|
||||
/* idx */ ,
|
||||
(__v16qi) __A,
|
||||
(__v16qi) __B,
|
||||
(__mmask16) -
|
||||
1);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_mask_permutex2var_epi8 (__m128i __A, __mmask16 __U, __m128i __I,
|
||||
__m128i __B)
|
||||
{
|
||||
return (__m128i) __builtin_ia32_vpermt2varqi128_mask ((__v16qi) __I
|
||||
/* idx */ ,
|
||||
(__v16qi) __A,
|
||||
(__v16qi) __B,
|
||||
(__mmask16)
|
||||
__U);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_maskz_permutex2var_epi8 (__mmask16 __U, __m128i __A, __m128i __I,
|
||||
__m128i __B)
|
||||
{
|
||||
return (__m128i) __builtin_ia32_vpermt2varqi128_maskz ((__v16qi) __I
|
||||
/* idx */ ,
|
||||
(__v16qi) __A,
|
||||
(__v16qi) __B,
|
||||
(__mmask16)
|
||||
__U);
|
||||
}
|
||||
|
||||
static __inline__ __m256i __DEFAULT_FN_ATTRS
|
||||
_mm256_permutex2var_epi8 (__m256i __A, __m256i __I, __m256i __B)
|
||||
{
|
||||
return (__m256i) __builtin_ia32_vpermt2varqi256_mask ((__v32qi) __I
|
||||
/* idx */ ,
|
||||
(__v32qi) __A,
|
||||
(__v32qi) __B,
|
||||
(__mmask32) -
|
||||
1);
|
||||
}
|
||||
|
||||
static __inline__ __m256i __DEFAULT_FN_ATTRS
|
||||
_mm256_mask_permutex2var_epi8 (__m256i __A, __mmask32 __U,
|
||||
__m256i __I, __m256i __B)
|
||||
{
|
||||
return (__m256i) __builtin_ia32_vpermt2varqi256_mask ((__v32qi) __I
|
||||
/* idx */ ,
|
||||
(__v32qi) __A,
|
||||
(__v32qi) __B,
|
||||
(__mmask32)
|
||||
__U);
|
||||
}
|
||||
|
||||
static __inline__ __m256i __DEFAULT_FN_ATTRS
|
||||
_mm256_maskz_permutex2var_epi8 (__mmask32 __U, __m256i __A,
|
||||
__m256i __I, __m256i __B)
|
||||
{
|
||||
return (__m256i) __builtin_ia32_vpermt2varqi256_maskz ((__v32qi) __I
|
||||
/* idx */ ,
|
||||
(__v32qi) __A,
|
||||
(__v32qi) __B,
|
||||
(__mmask32)
|
||||
__U);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_permutexvar_epi8 (__m128i __A, __m128i __B)
|
||||
{
|
||||
return (__m128i) __builtin_ia32_permvarqi128_mask ((__v16qi) __B,
|
||||
(__v16qi) __A,
|
||||
(__v16qi) _mm_undefined_si128 (),
|
||||
(__mmask16) -1);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_maskz_permutexvar_epi8 (__mmask16 __M, __m128i __A, __m128i __B)
|
||||
{
|
||||
return (__m128i) __builtin_ia32_permvarqi128_mask ((__v16qi) __B,
|
||||
(__v16qi) __A,
|
||||
(__v16qi) _mm_setzero_si128 (),
|
||||
(__mmask16) __M);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_mask_permutexvar_epi8 (__m128i __W, __mmask16 __M, __m128i __A,
|
||||
__m128i __B)
|
||||
{
|
||||
return (__m128i) __builtin_ia32_permvarqi128_mask ((__v16qi) __B,
|
||||
(__v16qi) __A,
|
||||
(__v16qi) __W,
|
||||
(__mmask16) __M);
|
||||
}
|
||||
|
||||
static __inline__ __m256i __DEFAULT_FN_ATTRS
|
||||
_mm256_permutexvar_epi8 (__m256i __A, __m256i __B)
|
||||
{
|
||||
return (__m256i) __builtin_ia32_permvarqi256_mask ((__v32qi) __B,
|
||||
(__v32qi) __A,
|
||||
(__v32qi) _mm256_undefined_si256 (),
|
||||
(__mmask32) -1);
|
||||
}
|
||||
|
||||
static __inline__ __m256i __DEFAULT_FN_ATTRS
|
||||
_mm256_maskz_permutexvar_epi8 (__mmask32 __M, __m256i __A,
|
||||
__m256i __B)
|
||||
{
|
||||
return (__m256i) __builtin_ia32_permvarqi256_mask ((__v32qi) __B,
|
||||
(__v32qi) __A,
|
||||
(__v32qi) _mm256_setzero_si256 (),
|
||||
(__mmask32) __M);
|
||||
}
|
||||
|
||||
static __inline__ __m256i __DEFAULT_FN_ATTRS
|
||||
_mm256_mask_permutexvar_epi8 (__m256i __W, __mmask32 __M, __m256i __A,
|
||||
__m256i __B)
|
||||
{
|
||||
return (__m256i) __builtin_ia32_permvarqi256_mask ((__v32qi) __B,
|
||||
(__v32qi) __A,
|
||||
(__v32qi) __W,
|
||||
(__mmask32) __M);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_mask_multishift_epi64_epi8 (__m128i __W, __mmask16 __M, __m128i __X, __m128i __Y)
|
||||
{
|
||||
return (__m128i) __builtin_ia32_vpmultishiftqb128_mask ((__v16qi) __X,
|
||||
(__v16qi) __Y,
|
||||
(__v16qi) __W,
|
||||
(__mmask16) __M);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_maskz_multishift_epi64_epi8 (__mmask16 __M, __m128i __X, __m128i __Y)
|
||||
{
|
||||
return (__m128i) __builtin_ia32_vpmultishiftqb128_mask ((__v16qi) __X,
|
||||
(__v16qi) __Y,
|
||||
(__v16qi)
|
||||
_mm_setzero_si128 (),
|
||||
(__mmask16) __M);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_multishift_epi64_epi8 (__m128i __X, __m128i __Y)
|
||||
{
|
||||
return (__m128i) __builtin_ia32_vpmultishiftqb128_mask ((__v16qi) __X,
|
||||
(__v16qi) __Y,
|
||||
(__v16qi)
|
||||
_mm_undefined_si128 (),
|
||||
(__mmask16) -1);
|
||||
}
|
||||
|
||||
static __inline__ __m256i __DEFAULT_FN_ATTRS
|
||||
_mm256_mask_multishift_epi64_epi8 (__m256i __W, __mmask32 __M, __m256i __X, __m256i __Y)
|
||||
{
|
||||
return (__m256i) __builtin_ia32_vpmultishiftqb256_mask ((__v32qi) __X,
|
||||
(__v32qi) __Y,
|
||||
(__v32qi) __W,
|
||||
(__mmask32) __M);
|
||||
}
|
||||
|
||||
static __inline__ __m256i __DEFAULT_FN_ATTRS
|
||||
_mm256_maskz_multishift_epi64_epi8 (__mmask32 __M, __m256i __X, __m256i __Y)
|
||||
{
|
||||
return (__m256i) __builtin_ia32_vpmultishiftqb256_mask ((__v32qi) __X,
|
||||
(__v32qi) __Y,
|
||||
(__v32qi)
|
||||
_mm256_setzero_si256 (),
|
||||
(__mmask32) __M);
|
||||
}
|
||||
|
||||
static __inline__ __m256i __DEFAULT_FN_ATTRS
|
||||
_mm256_multishift_epi64_epi8 (__m256i __X, __m256i __Y)
|
||||
{
|
||||
return (__m256i) __builtin_ia32_vpmultishiftqb256_mask ((__v32qi) __X,
|
||||
(__v32qi) __Y,
|
||||
(__v32qi)
|
||||
_mm256_undefined_si256 (),
|
||||
(__mmask32) -1);
|
||||
}
|
||||
|
||||
|
||||
#undef __DEFAULT_FN_ATTRS
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,263 @@
|
||||
/*===---- avx512vlcdintrin.h - AVX512VL and AVX512CD intrinsics ---------------------------===
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
#ifndef __IMMINTRIN_H
|
||||
#error "Never use <avx512vlcdintrin.h> directly; include <immintrin.h> instead."
|
||||
#endif
|
||||
|
||||
#ifndef __AVX512VLCDINTRIN_H
|
||||
#define __AVX512VLCDINTRIN_H
|
||||
|
||||
/* Define the default attributes for the functions in this file. */
|
||||
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("avx512vl,avx512cd")))
|
||||
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_broadcastmb_epi64 (__mmask8 __A)
|
||||
{
|
||||
return (__m128i) __builtin_ia32_broadcastmb128 (__A);
|
||||
}
|
||||
|
||||
static __inline__ __m256i __DEFAULT_FN_ATTRS
|
||||
_mm256_broadcastmb_epi64 (__mmask8 __A)
|
||||
{
|
||||
return (__m256i) __builtin_ia32_broadcastmb256 (__A);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_broadcastmw_epi32 (__mmask16 __A)
|
||||
{
|
||||
return (__m128i) __builtin_ia32_broadcastmw128 (__A);
|
||||
}
|
||||
|
||||
static __inline__ __m256i __DEFAULT_FN_ATTRS
|
||||
_mm256_broadcastmw_epi32 (__mmask16 __A)
|
||||
{
|
||||
return (__m256i) __builtin_ia32_broadcastmw256 (__A);
|
||||
}
|
||||
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_conflict_epi64 (__m128i __A)
|
||||
{
|
||||
return (__m128i) __builtin_ia32_vpconflictdi_128_mask ((__v2di) __A,
|
||||
(__v2di) _mm_undefined_si128 (),
|
||||
(__mmask8) -1);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_mask_conflict_epi64 (__m128i __W, __mmask8 __U, __m128i __A)
|
||||
{
|
||||
return (__m128i) __builtin_ia32_vpconflictdi_128_mask ((__v2di) __A,
|
||||
(__v2di) __W,
|
||||
(__mmask8) __U);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_maskz_conflict_epi64 (__mmask8 __U, __m128i __A)
|
||||
{
|
||||
return (__m128i) __builtin_ia32_vpconflictdi_128_mask ((__v2di) __A,
|
||||
(__v2di)
|
||||
_mm_setzero_di (),
|
||||
(__mmask8) __U);
|
||||
}
|
||||
|
||||
static __inline__ __m256i __DEFAULT_FN_ATTRS
|
||||
_mm256_conflict_epi64 (__m256i __A)
|
||||
{
|
||||
return (__m256i) __builtin_ia32_vpconflictdi_256_mask ((__v4di) __A,
|
||||
(__v4di) _mm256_undefined_si256 (),
|
||||
(__mmask8) -1);
|
||||
}
|
||||
|
||||
static __inline__ __m256i __DEFAULT_FN_ATTRS
|
||||
_mm256_mask_conflict_epi64 (__m256i __W, __mmask8 __U, __m256i __A)
|
||||
{
|
||||
return (__m256i) __builtin_ia32_vpconflictdi_256_mask ((__v4di) __A,
|
||||
(__v4di) __W,
|
||||
(__mmask8) __U);
|
||||
}
|
||||
|
||||
static __inline__ __m256i __DEFAULT_FN_ATTRS
|
||||
_mm256_maskz_conflict_epi64 (__mmask8 __U, __m256i __A)
|
||||
{
|
||||
return (__m256i) __builtin_ia32_vpconflictdi_256_mask ((__v4di) __A,
|
||||
(__v4di) _mm256_setzero_si256 (),
|
||||
(__mmask8) __U);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_conflict_epi32 (__m128i __A)
|
||||
{
|
||||
return (__m128i) __builtin_ia32_vpconflictsi_128_mask ((__v4si) __A,
|
||||
(__v4si) _mm_undefined_si128 (),
|
||||
(__mmask8) -1);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_mask_conflict_epi32 (__m128i __W, __mmask8 __U, __m128i __A)
|
||||
{
|
||||
return (__m128i) __builtin_ia32_vpconflictsi_128_mask ((__v4si) __A,
|
||||
(__v4si) __W,
|
||||
(__mmask8) __U);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_maskz_conflict_epi32 (__mmask8 __U, __m128i __A)
|
||||
{
|
||||
return (__m128i) __builtin_ia32_vpconflictsi_128_mask ((__v4si) __A,
|
||||
(__v4si) _mm_setzero_si128 (),
|
||||
(__mmask8) __U);
|
||||
}
|
||||
|
||||
static __inline__ __m256i __DEFAULT_FN_ATTRS
|
||||
_mm256_conflict_epi32 (__m256i __A)
|
||||
{
|
||||
return (__m256i) __builtin_ia32_vpconflictsi_256_mask ((__v8si) __A,
|
||||
(__v8si) _mm256_undefined_si256 (),
|
||||
(__mmask8) -1);
|
||||
}
|
||||
|
||||
static __inline__ __m256i __DEFAULT_FN_ATTRS
|
||||
_mm256_mask_conflict_epi32 (__m256i __W, __mmask8 __U, __m256i __A)
|
||||
{
|
||||
return (__m256i) __builtin_ia32_vpconflictsi_256_mask ((__v8si) __A,
|
||||
(__v8si) __W,
|
||||
(__mmask8) __U);
|
||||
}
|
||||
|
||||
static __inline__ __m256i __DEFAULT_FN_ATTRS
|
||||
_mm256_maskz_conflict_epi32 (__mmask8 __U, __m256i __A)
|
||||
{
|
||||
return (__m256i) __builtin_ia32_vpconflictsi_256_mask ((__v8si) __A,
|
||||
(__v8si)
|
||||
_mm256_setzero_si256 (),
|
||||
(__mmask8) __U);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_lzcnt_epi32 (__m128i __A)
|
||||
{
|
||||
return (__m128i) __builtin_ia32_vplzcntd_128_mask ((__v4si) __A,
|
||||
(__v4si)
|
||||
_mm_setzero_si128 (),
|
||||
(__mmask8) -1);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_mask_lzcnt_epi32 (__m128i __W, __mmask8 __U, __m128i __A)
|
||||
{
|
||||
return (__m128i) __builtin_ia32_vplzcntd_128_mask ((__v4si) __A,
|
||||
(__v4si) __W,
|
||||
(__mmask8) __U);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_maskz_lzcnt_epi32 (__mmask8 __U, __m128i __A)
|
||||
{
|
||||
return (__m128i) __builtin_ia32_vplzcntd_128_mask ((__v4si) __A,
|
||||
(__v4si)
|
||||
_mm_setzero_si128 (),
|
||||
(__mmask8) __U);
|
||||
}
|
||||
|
||||
static __inline__ __m256i __DEFAULT_FN_ATTRS
|
||||
_mm256_lzcnt_epi32 (__m256i __A)
|
||||
{
|
||||
return (__m256i) __builtin_ia32_vplzcntd_256_mask ((__v8si) __A,
|
||||
(__v8si)
|
||||
_mm256_setzero_si256 (),
|
||||
(__mmask8) -1);
|
||||
}
|
||||
|
||||
static __inline__ __m256i __DEFAULT_FN_ATTRS
|
||||
_mm256_mask_lzcnt_epi32 (__m256i __W, __mmask8 __U, __m256i __A)
|
||||
{
|
||||
return (__m256i) __builtin_ia32_vplzcntd_256_mask ((__v8si) __A,
|
||||
(__v8si) __W,
|
||||
(__mmask8) __U);
|
||||
}
|
||||
|
||||
static __inline__ __m256i __DEFAULT_FN_ATTRS
|
||||
_mm256_maskz_lzcnt_epi32 (__mmask8 __U, __m256i __A)
|
||||
{
|
||||
return (__m256i) __builtin_ia32_vplzcntd_256_mask ((__v8si) __A,
|
||||
(__v8si)
|
||||
_mm256_setzero_si256 (),
|
||||
(__mmask8) __U);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_lzcnt_epi64 (__m128i __A)
|
||||
{
|
||||
return (__m128i) __builtin_ia32_vplzcntq_128_mask ((__v2di) __A,
|
||||
(__v2di)
|
||||
_mm_setzero_di (),
|
||||
(__mmask8) -1);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_mask_lzcnt_epi64 (__m128i __W, __mmask8 __U, __m128i __A)
|
||||
{
|
||||
return (__m128i) __builtin_ia32_vplzcntq_128_mask ((__v2di) __A,
|
||||
(__v2di) __W,
|
||||
(__mmask8) __U);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_maskz_lzcnt_epi64 (__mmask8 __U, __m128i __A)
|
||||
{
|
||||
return (__m128i) __builtin_ia32_vplzcntq_128_mask ((__v2di) __A,
|
||||
(__v2di)
|
||||
_mm_setzero_di (),
|
||||
(__mmask8) __U);
|
||||
}
|
||||
|
||||
static __inline__ __m256i __DEFAULT_FN_ATTRS
|
||||
_mm256_lzcnt_epi64 (__m256i __A)
|
||||
{
|
||||
return (__m256i) __builtin_ia32_vplzcntq_256_mask ((__v4di) __A,
|
||||
(__v4di)
|
||||
_mm256_setzero_si256 (),
|
||||
(__mmask8) -1);
|
||||
}
|
||||
|
||||
static __inline__ __m256i __DEFAULT_FN_ATTRS
|
||||
_mm256_mask_lzcnt_epi64 (__m256i __W, __mmask8 __U, __m256i __A)
|
||||
{
|
||||
return (__m256i) __builtin_ia32_vplzcntq_256_mask ((__v4di) __A,
|
||||
(__v4di) __W,
|
||||
(__mmask8) __U);
|
||||
}
|
||||
|
||||
static __inline__ __m256i __DEFAULT_FN_ATTRS
|
||||
_mm256_maskz_lzcnt_epi64 (__mmask8 __U, __m256i __A)
|
||||
{
|
||||
return (__m256i) __builtin_ia32_vplzcntq_256_mask ((__v4di) __A,
|
||||
(__v4di)
|
||||
_mm256_setzero_si256 (),
|
||||
(__mmask8) __U);
|
||||
}
|
||||
|
||||
#undef __DEFAULT_FN_ATTRS
|
||||
|
||||
#endif /* __AVX512VLCDINTRIN_H */
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,95 @@
|
||||
/*===---- bmi2intrin.h - BMI2 intrinsics -----------------------------------===
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
|
||||
#if !defined __X86INTRIN_H && !defined __IMMINTRIN_H
|
||||
#error "Never use <bmi2intrin.h> directly; include <x86intrin.h> instead."
|
||||
#endif
|
||||
|
||||
#ifndef __BMI2INTRIN_H
|
||||
#define __BMI2INTRIN_H
|
||||
|
||||
/* Define the default attributes for the functions in this file. */
|
||||
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("bmi2")))
|
||||
|
||||
static __inline__ unsigned int __DEFAULT_FN_ATTRS
|
||||
_bzhi_u32(unsigned int __X, unsigned int __Y)
|
||||
{
|
||||
return __builtin_ia32_bzhi_si(__X, __Y);
|
||||
}
|
||||
|
||||
static __inline__ unsigned int __DEFAULT_FN_ATTRS
|
||||
_pdep_u32(unsigned int __X, unsigned int __Y)
|
||||
{
|
||||
return __builtin_ia32_pdep_si(__X, __Y);
|
||||
}
|
||||
|
||||
static __inline__ unsigned int __DEFAULT_FN_ATTRS
|
||||
_pext_u32(unsigned int __X, unsigned int __Y)
|
||||
{
|
||||
return __builtin_ia32_pext_si(__X, __Y);
|
||||
}
|
||||
|
||||
#ifdef __x86_64__
|
||||
|
||||
static __inline__ unsigned long long __DEFAULT_FN_ATTRS
|
||||
_bzhi_u64(unsigned long long __X, unsigned long long __Y)
|
||||
{
|
||||
return __builtin_ia32_bzhi_di(__X, __Y);
|
||||
}
|
||||
|
||||
static __inline__ unsigned long long __DEFAULT_FN_ATTRS
|
||||
_pdep_u64(unsigned long long __X, unsigned long long __Y)
|
||||
{
|
||||
return __builtin_ia32_pdep_di(__X, __Y);
|
||||
}
|
||||
|
||||
static __inline__ unsigned long long __DEFAULT_FN_ATTRS
|
||||
_pext_u64(unsigned long long __X, unsigned long long __Y)
|
||||
{
|
||||
return __builtin_ia32_pext_di(__X, __Y);
|
||||
}
|
||||
|
||||
static __inline__ unsigned long long __DEFAULT_FN_ATTRS
|
||||
_mulx_u64 (unsigned long long __X, unsigned long long __Y,
|
||||
unsigned long long *__P)
|
||||
{
|
||||
unsigned __int128 __res = (unsigned __int128) __X * __Y;
|
||||
*__P = (unsigned long long) (__res >> 64);
|
||||
return (unsigned long long) __res;
|
||||
}
|
||||
|
||||
#else /* !__x86_64__ */
|
||||
|
||||
static __inline__ unsigned int __DEFAULT_FN_ATTRS
|
||||
_mulx_u32 (unsigned int __X, unsigned int __Y, unsigned int *__P)
|
||||
{
|
||||
unsigned long long __res = (unsigned long long) __X * __Y;
|
||||
*__P = (unsigned int) (__res >> 32);
|
||||
return (unsigned int) __res;
|
||||
}
|
||||
|
||||
#endif /* !__x86_64__ */
|
||||
|
||||
#undef __DEFAULT_FN_ATTRS
|
||||
|
||||
#endif /* __BMI2INTRIN_H */
|
||||
@@ -0,0 +1,548 @@
|
||||
/*===---- bmiintrin.h - BMI intrinsics -------------------------------------===
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
|
||||
#if !defined __X86INTRIN_H && !defined __IMMINTRIN_H
|
||||
#error "Never use <bmiintrin.h> directly; include <x86intrin.h> instead."
|
||||
#endif
|
||||
|
||||
#ifndef __BMIINTRIN_H
|
||||
#define __BMIINTRIN_H
|
||||
|
||||
/// \brief Counts the number of trailing zero bits in the operand.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// \code
|
||||
/// unsigned short _tzcnt_u16(unsigned short a);
|
||||
/// \endcode
|
||||
///
|
||||
/// This intrinsic corresponds to the \c TZCNT instruction.
|
||||
///
|
||||
/// \param a
|
||||
/// An unsigned 16-bit integer whose trailing zeros are to be counted.
|
||||
/// \returns An unsigned 16-bit integer containing the number of trailing zero
|
||||
/// bits in the operand.
|
||||
#define _tzcnt_u16(a) (__tzcnt_u16((a)))
|
||||
|
||||
/// \brief Performs a bitwise AND of the second operand with the one's
|
||||
/// complement of the first operand.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// \code
|
||||
/// unsigned int _andn_u32(unsigned int a, unsigned int b);
|
||||
/// \endcode
|
||||
///
|
||||
/// This intrinsic corresponds to the \c ANDN instruction.
|
||||
///
|
||||
/// \param a
|
||||
/// An unsigned integer containing one of the operands.
|
||||
/// \param b
|
||||
/// An unsigned integer containing one of the operands.
|
||||
/// \returns An unsigned integer containing the bitwise AND of the second
|
||||
/// operand with the one's complement of the first operand.
|
||||
#define _andn_u32(a, b) (__andn_u32((a), (b)))
|
||||
|
||||
/* _bextr_u32 != __bextr_u32 */
|
||||
/// \brief Clears all bits in the source except for the least significant bit
|
||||
/// containing a value of 1 and returns the result.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// \code
|
||||
/// unsigned int _blsi_u32(unsigned int a);
|
||||
/// \endcode
|
||||
///
|
||||
/// This intrinsic corresponds to the \c BLSI instruction.
|
||||
///
|
||||
/// \param a
|
||||
/// An unsigned integer whose bits are to be cleared.
|
||||
/// \returns An unsigned integer containing the result of clearing the bits from
|
||||
/// the source operand.
|
||||
#define _blsi_u32(a) (__blsi_u32((a)))
|
||||
|
||||
/// \brief Creates a mask whose bits are set to 1, using bit 0 up to and
|
||||
/// including the least siginificant bit that is set to 1 in the source
|
||||
/// operand and returns the result.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// \code
|
||||
/// unsigned int _blsmsk_u32(unsigned int a);
|
||||
/// \endcode
|
||||
///
|
||||
/// This intrinsic corresponds to the \c BLSMSK instruction.
|
||||
///
|
||||
/// \param a
|
||||
/// An unsigned integer used to create the mask.
|
||||
/// \returns An unsigned integer containing the newly created mask.
|
||||
#define _blsmsk_u32(a) (__blsmsk_u32((a)))
|
||||
|
||||
/// \brief Clears the least siginificant bit that is set to 1 in the source
|
||||
/// operand and returns the result.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// \code
|
||||
/// unsigned int _blsr_u32(unsigned int a);
|
||||
/// \endcode
|
||||
///
|
||||
/// This intrinsic corresponds to the \c BLSR instruction.
|
||||
///
|
||||
/// \param a
|
||||
/// An unsigned integer containing the operand to be cleared.
|
||||
/// \returns An unsigned integer containing the result of clearing the source
|
||||
/// operand.
|
||||
#define _blsr_u32(a) (__blsr_u32((a)))
|
||||
|
||||
/// \brief Counts the number of trailing zero bits in the operand.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// \code
|
||||
/// unsigned int _tzcnt_u32(unsigned int a);
|
||||
/// \endcode
|
||||
///
|
||||
/// This intrinsic corresponds to the \c TZCNT instruction.
|
||||
///
|
||||
/// \param a
|
||||
/// An unsigned 32-bit integer whose trailing zeros are to be counted.
|
||||
/// \returns An unsigned 32-bit integer containing the number of trailing zero
|
||||
/// bits in the operand.
|
||||
#define _tzcnt_u32(a) (__tzcnt_u32((a)))
|
||||
|
||||
/* Define the default attributes for the functions in this file. */
|
||||
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("bmi")))
|
||||
|
||||
/* Allow using the tzcnt intrinsics even for non-BMI targets. Since the TZCNT
|
||||
instruction behaves as BSF on non-BMI targets, there is code that expects
|
||||
to use it as a potentially faster version of BSF. */
|
||||
#define __RELAXED_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
|
||||
|
||||
/// \brief Counts the number of trailing zero bits in the operand.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c TZCNT instruction.
|
||||
///
|
||||
/// \param __X
|
||||
/// An unsigned 16-bit integer whose trailing zeros are to be counted.
|
||||
/// \returns An unsigned 16-bit integer containing the number of trailing zero
|
||||
/// bits in the operand.
|
||||
static __inline__ unsigned short __RELAXED_FN_ATTRS
|
||||
__tzcnt_u16(unsigned short __X)
|
||||
{
|
||||
return __X ? __builtin_ctzs(__X) : 16;
|
||||
}
|
||||
|
||||
/// \brief Performs a bitwise AND of the second operand with the one's
|
||||
/// complement of the first operand.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c ANDN instruction.
|
||||
///
|
||||
/// \param __X
|
||||
/// An unsigned integer containing one of the operands.
|
||||
/// \param __Y
|
||||
/// An unsigned integer containing one of the operands.
|
||||
/// \returns An unsigned integer containing the bitwise AND of the second
|
||||
/// operand with the one's complement of the first operand.
|
||||
static __inline__ unsigned int __DEFAULT_FN_ATTRS
|
||||
__andn_u32(unsigned int __X, unsigned int __Y)
|
||||
{
|
||||
return ~__X & __Y;
|
||||
}
|
||||
|
||||
/* AMD-specified, double-leading-underscore version of BEXTR */
|
||||
/// \brief Extracts the specified bits from the first operand and returns them
|
||||
/// in the least significant bits of the result.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c BEXTR instruction.
|
||||
///
|
||||
/// \param __X
|
||||
/// An unsigned integer whose bits are to be extracted.
|
||||
/// \param __Y
|
||||
/// An unsigned integer used to specify which bits are extracted. Bits [7:0]
|
||||
/// specify the index of the least significant bit. Bits [15:8] specify the
|
||||
/// number of bits to be extracted.
|
||||
/// \returns An unsigned integer whose least significant bits contain the
|
||||
/// extracted bits.
|
||||
static __inline__ unsigned int __DEFAULT_FN_ATTRS
|
||||
__bextr_u32(unsigned int __X, unsigned int __Y)
|
||||
{
|
||||
return __builtin_ia32_bextr_u32(__X, __Y);
|
||||
}
|
||||
|
||||
/* Intel-specified, single-leading-underscore version of BEXTR */
|
||||
/// \brief Extracts the specified bits from the first operand and returns them
|
||||
/// in the least significant bits of the result.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c BEXTR instruction.
|
||||
///
|
||||
/// \param __X
|
||||
/// An unsigned integer whose bits are to be extracted.
|
||||
/// \param __Y
|
||||
/// An unsigned integer used to specify the index of the least significant
|
||||
/// bit for the bits to be extracted. Bits [7:0] specify the index.
|
||||
/// \param __Z
|
||||
/// An unsigned integer used to specify the number of bits to be extracted.
|
||||
/// Bits [7:0] specify the number of bits.
|
||||
/// \returns An unsigned integer whose least significant bits contain the
|
||||
/// extracted bits.
|
||||
static __inline__ unsigned int __DEFAULT_FN_ATTRS
|
||||
_bextr_u32(unsigned int __X, unsigned int __Y, unsigned int __Z)
|
||||
{
|
||||
return __builtin_ia32_bextr_u32 (__X, ((__Y & 0xff) | ((__Z & 0xff) << 8)));
|
||||
}
|
||||
|
||||
/// \brief Clears all bits in the source except for the least significant bit
|
||||
/// containing a value of 1 and returns the result.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c BLSI instruction.
|
||||
///
|
||||
/// \param __X
|
||||
/// An unsigned integer whose bits are to be cleared.
|
||||
/// \returns An unsigned integer containing the result of clearing the bits from
|
||||
/// the source operand.
|
||||
static __inline__ unsigned int __DEFAULT_FN_ATTRS
|
||||
__blsi_u32(unsigned int __X)
|
||||
{
|
||||
return __X & -__X;
|
||||
}
|
||||
|
||||
/// \brief Creates a mask whose bits are set to 1, using bit 0 up to and
|
||||
/// including the least siginificant bit that is set to 1 in the source
|
||||
/// operand and returns the result.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c BLSMSK instruction.
|
||||
///
|
||||
/// \param __X
|
||||
/// An unsigned integer used to create the mask.
|
||||
/// \returns An unsigned integer containing the newly created mask.
|
||||
static __inline__ unsigned int __DEFAULT_FN_ATTRS
|
||||
__blsmsk_u32(unsigned int __X)
|
||||
{
|
||||
return __X ^ (__X - 1);
|
||||
}
|
||||
|
||||
/// \brief Clears the least siginificant bit that is set to 1 in the source
|
||||
/// operand and returns the result.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c BLSR instruction.
|
||||
///
|
||||
/// \param __X
|
||||
/// An unsigned integer containing the operand to be cleared.
|
||||
/// \returns An unsigned integer containing the result of clearing the source
|
||||
/// operand.
|
||||
static __inline__ unsigned int __DEFAULT_FN_ATTRS
|
||||
__blsr_u32(unsigned int __X)
|
||||
{
|
||||
return __X & (__X - 1);
|
||||
}
|
||||
|
||||
/// \brief Counts the number of trailing zero bits in the operand.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c TZCNT instruction.
|
||||
///
|
||||
/// \param __X
|
||||
/// An unsigned 32-bit integer whose trailing zeros are to be counted.
|
||||
/// \returns An unsigned 32-bit integer containing the number of trailing zero
|
||||
/// bits in the operand.
|
||||
static __inline__ unsigned int __RELAXED_FN_ATTRS
|
||||
__tzcnt_u32(unsigned int __X)
|
||||
{
|
||||
return __X ? __builtin_ctz(__X) : 32;
|
||||
}
|
||||
|
||||
/// \brief Counts the number of trailing zero bits in the operand.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c TZCNT instruction.
|
||||
///
|
||||
/// \param __X
|
||||
/// An unsigned 32-bit integer whose trailing zeros are to be counted.
|
||||
/// \returns An 32-bit integer containing the number of trailing zero
|
||||
/// bits in the operand.
|
||||
static __inline__ int __RELAXED_FN_ATTRS
|
||||
_mm_tzcnt_32(unsigned int __X)
|
||||
{
|
||||
return __X ? __builtin_ctz(__X) : 32;
|
||||
}
|
||||
|
||||
#ifdef __x86_64__
|
||||
|
||||
/// \brief Performs a bitwise AND of the second operand with the one's
|
||||
/// complement of the first operand.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// \code
|
||||
/// unsigned long long _andn_u64 (unsigned long long a, unsigned long long b);
|
||||
/// \endcode
|
||||
///
|
||||
/// This intrinsic corresponds to the \c ANDN instruction.
|
||||
///
|
||||
/// \param a
|
||||
/// An unsigned 64-bit integer containing one of the operands.
|
||||
/// \param b
|
||||
/// An unsigned 64-bit integer containing one of the operands.
|
||||
/// \returns An unsigned 64-bit integer containing the bitwise AND of the second
|
||||
/// operand with the one's complement of the first operand.
|
||||
#define _andn_u64(a, b) (__andn_u64((a), (b)))
|
||||
|
||||
/* _bextr_u64 != __bextr_u64 */
|
||||
/// \brief Clears all bits in the source except for the least significant bit
|
||||
/// containing a value of 1 and returns the result.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// \code
|
||||
/// unsigned long long _blsi_u64(unsigned long long a);
|
||||
/// \endcode
|
||||
///
|
||||
/// This intrinsic corresponds to the \c BLSI instruction.
|
||||
///
|
||||
/// \param a
|
||||
/// An unsigned 64-bit integer whose bits are to be cleared.
|
||||
/// \returns An unsigned 64-bit integer containing the result of clearing the
|
||||
/// bits from the source operand.
|
||||
#define _blsi_u64(a) (__blsi_u64((a)))
|
||||
|
||||
/// \brief Creates a mask whose bits are set to 1, using bit 0 up to and
|
||||
/// including the least siginificant bit that is set to 1 in the source
|
||||
/// operand and returns the result.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// \code
|
||||
/// unsigned long long _blsmsk_u64(unsigned long long a);
|
||||
/// \endcode
|
||||
///
|
||||
/// This intrinsic corresponds to the \c BLSMSK instruction.
|
||||
///
|
||||
/// \param a
|
||||
/// An unsigned 64-bit integer used to create the mask.
|
||||
/// \returns A unsigned 64-bit integer containing the newly created mask.
|
||||
#define _blsmsk_u64(a) (__blsmsk_u64((a)))
|
||||
|
||||
/// \brief Clears the least siginificant bit that is set to 1 in the source
|
||||
/// operand and returns the result.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// \code
|
||||
/// unsigned long long _blsr_u64(unsigned long long a);
|
||||
/// \endcode
|
||||
///
|
||||
/// This intrinsic corresponds to the \c BLSR instruction.
|
||||
///
|
||||
/// \param a
|
||||
/// An unsigned 64-bit integer containing the operand to be cleared.
|
||||
/// \returns An unsigned 64-bit integer containing the result of clearing the
|
||||
/// source operand.
|
||||
#define _blsr_u64(a) (__blsr_u64((a)))
|
||||
|
||||
/// \brief Counts the number of trailing zero bits in the operand.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// \code
|
||||
/// unsigned long long _tzcnt_u64(unsigned long long a);
|
||||
/// \endcode
|
||||
///
|
||||
/// This intrinsic corresponds to the \c TZCNT instruction.
|
||||
///
|
||||
/// \param a
|
||||
/// An unsigned 64-bit integer whose trailing zeros are to be counted.
|
||||
/// \returns An unsigned 64-bit integer containing the number of trailing zero
|
||||
/// bits in the operand.
|
||||
#define _tzcnt_u64(a) (__tzcnt_u64((a)))
|
||||
|
||||
/// \brief Performs a bitwise AND of the second operand with the one's
|
||||
/// complement of the first operand.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c ANDN instruction.
|
||||
///
|
||||
/// \param __X
|
||||
/// An unsigned 64-bit integer containing one of the operands.
|
||||
/// \param __Y
|
||||
/// An unsigned 64-bit integer containing one of the operands.
|
||||
/// \returns An unsigned 64-bit integer containing the bitwise AND of the second
|
||||
/// operand with the one's complement of the first operand.
|
||||
static __inline__ unsigned long long __DEFAULT_FN_ATTRS
|
||||
__andn_u64 (unsigned long long __X, unsigned long long __Y)
|
||||
{
|
||||
return ~__X & __Y;
|
||||
}
|
||||
|
||||
/* AMD-specified, double-leading-underscore version of BEXTR */
|
||||
/// \brief Extracts the specified bits from the first operand and returns them
|
||||
/// in the least significant bits of the result.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c BEXTR instruction.
|
||||
///
|
||||
/// \param __X
|
||||
/// An unsigned 64-bit integer whose bits are to be extracted.
|
||||
/// \param __Y
|
||||
/// An unsigned 64-bit integer used to specify which bits are extracted. Bits
|
||||
/// [7:0] specify the index of the least significant bit. Bits [15:8] specify
|
||||
/// the number of bits to be extracted.
|
||||
/// \returns An unsigned 64-bit integer whose least significant bits contain the
|
||||
/// extracted bits.
|
||||
static __inline__ unsigned long long __DEFAULT_FN_ATTRS
|
||||
__bextr_u64(unsigned long long __X, unsigned long long __Y)
|
||||
{
|
||||
return __builtin_ia32_bextr_u64(__X, __Y);
|
||||
}
|
||||
|
||||
/* Intel-specified, single-leading-underscore version of BEXTR */
|
||||
/// \brief Extracts the specified bits from the first operand and returns them
|
||||
/// in the least significant bits of the result.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c BEXTR instruction.
|
||||
///
|
||||
/// \param __X
|
||||
/// An unsigned 64-bit integer whose bits are to be extracted.
|
||||
/// \param __Y
|
||||
/// An unsigned integer used to specify the index of the least significant
|
||||
/// bit for the bits to be extracted. Bits [7:0] specify the index.
|
||||
/// \param __Z
|
||||
/// An unsigned integer used to specify the number of bits to be extracted.
|
||||
/// Bits [7:0] specify the number of bits.
|
||||
/// \returns An unsigned 64-bit integer whose least significant bits contain the
|
||||
/// extracted bits.
|
||||
static __inline__ unsigned long long __DEFAULT_FN_ATTRS
|
||||
_bextr_u64(unsigned long long __X, unsigned int __Y, unsigned int __Z)
|
||||
{
|
||||
return __builtin_ia32_bextr_u64 (__X, ((__Y & 0xff) | ((__Z & 0xff) << 8)));
|
||||
}
|
||||
|
||||
/// \brief Clears all bits in the source except for the least significant bit
|
||||
/// containing a value of 1 and returns the result.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c BLSI instruction.
|
||||
///
|
||||
/// \param __X
|
||||
/// An unsigned 64-bit integer whose bits are to be cleared.
|
||||
/// \returns An unsigned 64-bit integer containing the result of clearing the
|
||||
/// bits from the source operand.
|
||||
static __inline__ unsigned long long __DEFAULT_FN_ATTRS
|
||||
__blsi_u64(unsigned long long __X)
|
||||
{
|
||||
return __X & -__X;
|
||||
}
|
||||
|
||||
/// \brief Creates a mask whose bits are set to 1, using bit 0 up to and
|
||||
/// including the least siginificant bit that is set to 1 in the source
|
||||
/// operand and returns the result.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c BLSMSK instruction.
|
||||
///
|
||||
/// \param __X
|
||||
/// An unsigned 64-bit integer used to create the mask.
|
||||
/// \returns A unsigned 64-bit integer containing the newly created mask.
|
||||
static __inline__ unsigned long long __DEFAULT_FN_ATTRS
|
||||
__blsmsk_u64(unsigned long long __X)
|
||||
{
|
||||
return __X ^ (__X - 1);
|
||||
}
|
||||
|
||||
/// \brief Clears the least siginificant bit that is set to 1 in the source
|
||||
/// operand and returns the result.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c BLSR instruction.
|
||||
///
|
||||
/// \param __X
|
||||
/// An unsigned 64-bit integer containing the operand to be cleared.
|
||||
/// \returns An unsigned 64-bit integer containing the result of clearing the
|
||||
/// source operand.
|
||||
static __inline__ unsigned long long __DEFAULT_FN_ATTRS
|
||||
__blsr_u64(unsigned long long __X)
|
||||
{
|
||||
return __X & (__X - 1);
|
||||
}
|
||||
|
||||
/// \brief Counts the number of trailing zero bits in the operand.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c TZCNT instruction.
|
||||
///
|
||||
/// \param __X
|
||||
/// An unsigned 64-bit integer whose trailing zeros are to be counted.
|
||||
/// \returns An unsigned 64-bit integer containing the number of trailing zero
|
||||
/// bits in the operand.
|
||||
static __inline__ unsigned long long __RELAXED_FN_ATTRS
|
||||
__tzcnt_u64(unsigned long long __X)
|
||||
{
|
||||
return __X ? __builtin_ctzll(__X) : 64;
|
||||
}
|
||||
|
||||
/// \brief Counts the number of trailing zero bits in the operand.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c TZCNT instruction.
|
||||
///
|
||||
/// \param __X
|
||||
/// An unsigned 64-bit integer whose trailing zeros are to be counted.
|
||||
/// \returns An 64-bit integer containing the number of trailing zero
|
||||
/// bits in the operand.
|
||||
static __inline__ long long __RELAXED_FN_ATTRS
|
||||
_mm_tzcnt_64(unsigned long long __X)
|
||||
{
|
||||
return __X ? __builtin_ctzll(__X) : 64;
|
||||
}
|
||||
|
||||
#endif /* __x86_64__ */
|
||||
|
||||
#undef __DEFAULT_FN_ATTRS
|
||||
#undef __RELAXED_FN_ATTRS
|
||||
|
||||
#endif /* __BMIINTRIN_H */
|
||||
@@ -0,0 +1,41 @@
|
||||
/*===---- clflushoptintrin.h - CLFLUSHOPT intrinsic ------------------------------------===
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
|
||||
#ifndef __IMMINTRIN_H
|
||||
#error "Never use <clflushoptintrin.h> directly; include <immintrin.h> instead."
|
||||
#endif
|
||||
|
||||
#ifndef __CLFLUSHOPTINTRIN_H
|
||||
#define __CLFLUSHOPTINTRIN_H
|
||||
|
||||
/* Define the default attributes for the functions in this file. */
|
||||
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("clflushopt")))
|
||||
|
||||
static __inline__ void __DEFAULT_FN_ATTRS
|
||||
_mm_clflushopt(char * __m) {
|
||||
__builtin_ia32_clflushopt(__m);
|
||||
}
|
||||
|
||||
#undef __DEFAULT_FN_ATTRS
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,209 @@
|
||||
/*===---- cpuid.h - X86 cpu model detection --------------------------------===
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
|
||||
#if !(__x86_64__ || __i386__)
|
||||
#error this header is for x86 only
|
||||
#endif
|
||||
|
||||
/* Responses identification request with %eax 0 */
|
||||
/* AMD: "AuthenticAMD" */
|
||||
#define signature_AMD_ebx 0x68747541
|
||||
#define signature_AMD_edx 0x69746e65
|
||||
#define signature_AMD_ecx 0x444d4163
|
||||
/* CENTAUR: "CentaurHauls" */
|
||||
#define signature_CENTAUR_ebx 0x746e6543
|
||||
#define signature_CENTAUR_edx 0x48727561
|
||||
#define signature_CENTAUR_ecx 0x736c7561
|
||||
/* CYRIX: "CyrixInstead" */
|
||||
#define signature_CYRIX_ebx 0x69727943
|
||||
#define signature_CYRIX_edx 0x736e4978
|
||||
#define signature_CYRIX_ecx 0x64616574
|
||||
/* INTEL: "GenuineIntel" */
|
||||
#define signature_INTEL_ebx 0x756e6547
|
||||
#define signature_INTEL_edx 0x49656e69
|
||||
#define signature_INTEL_ecx 0x6c65746e
|
||||
/* TM1: "TransmetaCPU" */
|
||||
#define signature_TM1_ebx 0x6e617254
|
||||
#define signature_TM1_edx 0x74656d73
|
||||
#define signature_TM1_ecx 0x55504361
|
||||
/* TM2: "GenuineTMx86" */
|
||||
#define signature_TM2_ebx 0x756e6547
|
||||
#define signature_TM2_edx 0x54656e69
|
||||
#define signature_TM2_ecx 0x3638784d
|
||||
/* NSC: "Geode by NSC" */
|
||||
#define signature_NSC_ebx 0x646f6547
|
||||
#define signature_NSC_edx 0x43534e20
|
||||
#define signature_NSC_ecx 0x79622065
|
||||
/* NEXGEN: "NexGenDriven" */
|
||||
#define signature_NEXGEN_ebx 0x4778654e
|
||||
#define signature_NEXGEN_edx 0x72446e65
|
||||
#define signature_NEXGEN_ecx 0x6e657669
|
||||
/* RISE: "RiseRiseRise" */
|
||||
#define signature_RISE_ebx 0x65736952
|
||||
#define signature_RISE_edx 0x65736952
|
||||
#define signature_RISE_ecx 0x65736952
|
||||
/* SIS: "SiS SiS SiS " */
|
||||
#define signature_SIS_ebx 0x20536953
|
||||
#define signature_SIS_edx 0x20536953
|
||||
#define signature_SIS_ecx 0x20536953
|
||||
/* UMC: "UMC UMC UMC " */
|
||||
#define signature_UMC_ebx 0x20434d55
|
||||
#define signature_UMC_edx 0x20434d55
|
||||
#define signature_UMC_ecx 0x20434d55
|
||||
/* VIA: "VIA VIA VIA " */
|
||||
#define signature_VIA_ebx 0x20414956
|
||||
#define signature_VIA_edx 0x20414956
|
||||
#define signature_VIA_ecx 0x20414956
|
||||
/* VORTEX: "Vortex86 SoC" */
|
||||
#define signature_VORTEX_ebx 0x74726f56
|
||||
#define signature_VORTEX_edx 0x36387865
|
||||
#define signature_VORTEX_ecx 0x436f5320
|
||||
|
||||
/* Features in %ecx for level 1 */
|
||||
#define bit_SSE3 0x00000001
|
||||
#define bit_PCLMULQDQ 0x00000002
|
||||
#define bit_DTES64 0x00000004
|
||||
#define bit_MONITOR 0x00000008
|
||||
#define bit_DSCPL 0x00000010
|
||||
#define bit_VMX 0x00000020
|
||||
#define bit_SMX 0x00000040
|
||||
#define bit_EIST 0x00000080
|
||||
#define bit_TM2 0x00000100
|
||||
#define bit_SSSE3 0x00000200
|
||||
#define bit_CNXTID 0x00000400
|
||||
#define bit_FMA 0x00001000
|
||||
#define bit_CMPXCHG16B 0x00002000
|
||||
#define bit_xTPR 0x00004000
|
||||
#define bit_PDCM 0x00008000
|
||||
#define bit_PCID 0x00020000
|
||||
#define bit_DCA 0x00040000
|
||||
#define bit_SSE41 0x00080000
|
||||
#define bit_SSE42 0x00100000
|
||||
#define bit_x2APIC 0x00200000
|
||||
#define bit_MOVBE 0x00400000
|
||||
#define bit_POPCNT 0x00800000
|
||||
#define bit_TSCDeadline 0x01000000
|
||||
#define bit_AESNI 0x02000000
|
||||
#define bit_XSAVE 0x04000000
|
||||
#define bit_OSXSAVE 0x08000000
|
||||
#define bit_AVX 0x10000000
|
||||
#define bit_RDRND 0x40000000
|
||||
|
||||
/* Features in %edx for level 1 */
|
||||
#define bit_FPU 0x00000001
|
||||
#define bit_VME 0x00000002
|
||||
#define bit_DE 0x00000004
|
||||
#define bit_PSE 0x00000008
|
||||
#define bit_TSC 0x00000010
|
||||
#define bit_MSR 0x00000020
|
||||
#define bit_PAE 0x00000040
|
||||
#define bit_MCE 0x00000080
|
||||
#define bit_CX8 0x00000100
|
||||
#define bit_APIC 0x00000200
|
||||
#define bit_SEP 0x00000800
|
||||
#define bit_MTRR 0x00001000
|
||||
#define bit_PGE 0x00002000
|
||||
#define bit_MCA 0x00004000
|
||||
#define bit_CMOV 0x00008000
|
||||
#define bit_PAT 0x00010000
|
||||
#define bit_PSE36 0x00020000
|
||||
#define bit_PSN 0x00040000
|
||||
#define bit_CLFSH 0x00080000
|
||||
#define bit_DS 0x00200000
|
||||
#define bit_ACPI 0x00400000
|
||||
#define bit_MMX 0x00800000
|
||||
#define bit_FXSR 0x01000000
|
||||
#define bit_FXSAVE bit_FXSR /* for gcc compat */
|
||||
#define bit_SSE 0x02000000
|
||||
#define bit_SSE2 0x04000000
|
||||
#define bit_SS 0x08000000
|
||||
#define bit_HTT 0x10000000
|
||||
#define bit_TM 0x20000000
|
||||
#define bit_PBE 0x80000000
|
||||
|
||||
/* Features in %ebx for level 7 sub-leaf 0 */
|
||||
#define bit_FSGSBASE 0x00000001
|
||||
#define bit_SMEP 0x00000080
|
||||
#define bit_ENH_MOVSB 0x00000200
|
||||
|
||||
#if __i386__
|
||||
#define __cpuid(__level, __eax, __ebx, __ecx, __edx) \
|
||||
__asm("cpuid" : "=a"(__eax), "=b" (__ebx), "=c"(__ecx), "=d"(__edx) \
|
||||
: "0"(__level))
|
||||
|
||||
#define __cpuid_count(__level, __count, __eax, __ebx, __ecx, __edx) \
|
||||
__asm("cpuid" : "=a"(__eax), "=b" (__ebx), "=c"(__ecx), "=d"(__edx) \
|
||||
: "0"(__level), "2"(__count))
|
||||
#else
|
||||
/* x86-64 uses %rbx as the base register, so preserve it. */
|
||||
#define __cpuid(__level, __eax, __ebx, __ecx, __edx) \
|
||||
__asm(" xchgq %%rbx,%q1\n" \
|
||||
" cpuid\n" \
|
||||
" xchgq %%rbx,%q1" \
|
||||
: "=a"(__eax), "=r" (__ebx), "=c"(__ecx), "=d"(__edx) \
|
||||
: "0"(__level))
|
||||
|
||||
#define __cpuid_count(__level, __count, __eax, __ebx, __ecx, __edx) \
|
||||
__asm(" xchgq %%rbx,%q1\n" \
|
||||
" cpuid\n" \
|
||||
" xchgq %%rbx,%q1" \
|
||||
: "=a"(__eax), "=r" (__ebx), "=c"(__ecx), "=d"(__edx) \
|
||||
: "0"(__level), "2"(__count))
|
||||
#endif
|
||||
|
||||
static __inline int __get_cpuid (unsigned int __level, unsigned int *__eax,
|
||||
unsigned int *__ebx, unsigned int *__ecx,
|
||||
unsigned int *__edx) {
|
||||
__cpuid(__level, *__eax, *__ebx, *__ecx, *__edx);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static __inline int __get_cpuid_max (unsigned int __level, unsigned int *__sig)
|
||||
{
|
||||
unsigned int __eax, __ebx, __ecx, __edx;
|
||||
#if __i386__
|
||||
int __cpuid_supported;
|
||||
|
||||
__asm(" pushfl\n"
|
||||
" popl %%eax\n"
|
||||
" movl %%eax,%%ecx\n"
|
||||
" xorl $0x00200000,%%eax\n"
|
||||
" pushl %%eax\n"
|
||||
" popfl\n"
|
||||
" pushfl\n"
|
||||
" popl %%eax\n"
|
||||
" movl $0,%0\n"
|
||||
" cmpl %%eax,%%ecx\n"
|
||||
" je 1f\n"
|
||||
" movl $1,%0\n"
|
||||
"1:"
|
||||
: "=r" (__cpuid_supported) : : "eax", "ecx");
|
||||
if (!__cpuid_supported)
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
__cpuid(__level, __eax, __ebx, __ecx, __edx);
|
||||
if (__sig)
|
||||
*__sig = __ebx;
|
||||
return __eax;
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
/*===---- cuda_builtin_vars.h - CUDA built-in variables ---------------------===
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
|
||||
#ifndef __CUDA_BUILTIN_VARS_H
|
||||
#define __CUDA_BUILTIN_VARS_H
|
||||
|
||||
// Forward declares from vector_types.h.
|
||||
struct uint3;
|
||||
struct dim3;
|
||||
|
||||
// The file implements built-in CUDA variables using __declspec(property).
|
||||
// https://msdn.microsoft.com/en-us/library/yhfk0thd.aspx
|
||||
// All read accesses of built-in variable fields get converted into calls to a
|
||||
// getter function which in turn calls the appropriate builtin to fetch the
|
||||
// value.
|
||||
//
|
||||
// Example:
|
||||
// int x = threadIdx.x;
|
||||
// IR output:
|
||||
// %0 = call i32 @llvm.nvvm.read.ptx.sreg.tid.x() #3
|
||||
// PTX output:
|
||||
// mov.u32 %r2, %tid.x;
|
||||
|
||||
#define __CUDA_DEVICE_BUILTIN(FIELD, INTRINSIC) \
|
||||
__declspec(property(get = __fetch_builtin_##FIELD)) unsigned int FIELD; \
|
||||
static inline __attribute__((always_inline)) \
|
||||
__attribute__((device)) unsigned int __fetch_builtin_##FIELD(void) { \
|
||||
return INTRINSIC; \
|
||||
}
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
#define __DELETE =delete
|
||||
#else
|
||||
#define __DELETE
|
||||
#endif
|
||||
|
||||
// Make sure nobody can create instances of the special varible types. nvcc
|
||||
// also disallows taking address of special variables, so we disable address-of
|
||||
// operator as well.
|
||||
#define __CUDA_DISALLOW_BUILTINVAR_ACCESS(TypeName) \
|
||||
__attribute__((device)) TypeName() __DELETE; \
|
||||
__attribute__((device)) TypeName(const TypeName &) __DELETE; \
|
||||
__attribute__((device)) void operator=(const TypeName &) const __DELETE; \
|
||||
__attribute__((device)) TypeName *operator&() const __DELETE
|
||||
|
||||
struct __cuda_builtin_threadIdx_t {
|
||||
__CUDA_DEVICE_BUILTIN(x,__nvvm_read_ptx_sreg_tid_x());
|
||||
__CUDA_DEVICE_BUILTIN(y,__nvvm_read_ptx_sreg_tid_y());
|
||||
__CUDA_DEVICE_BUILTIN(z,__nvvm_read_ptx_sreg_tid_z());
|
||||
// threadIdx should be convertible to uint3 (in fact in nvcc, it *is* a
|
||||
// uint3). This function is defined after we pull in vector_types.h.
|
||||
__attribute__((device)) operator uint3() const;
|
||||
private:
|
||||
__CUDA_DISALLOW_BUILTINVAR_ACCESS(__cuda_builtin_threadIdx_t);
|
||||
};
|
||||
|
||||
struct __cuda_builtin_blockIdx_t {
|
||||
__CUDA_DEVICE_BUILTIN(x,__nvvm_read_ptx_sreg_ctaid_x());
|
||||
__CUDA_DEVICE_BUILTIN(y,__nvvm_read_ptx_sreg_ctaid_y());
|
||||
__CUDA_DEVICE_BUILTIN(z,__nvvm_read_ptx_sreg_ctaid_z());
|
||||
// blockIdx should be convertible to uint3 (in fact in nvcc, it *is* a
|
||||
// uint3). This function is defined after we pull in vector_types.h.
|
||||
__attribute__((device)) operator uint3() const;
|
||||
private:
|
||||
__CUDA_DISALLOW_BUILTINVAR_ACCESS(__cuda_builtin_blockIdx_t);
|
||||
};
|
||||
|
||||
struct __cuda_builtin_blockDim_t {
|
||||
__CUDA_DEVICE_BUILTIN(x,__nvvm_read_ptx_sreg_ntid_x());
|
||||
__CUDA_DEVICE_BUILTIN(y,__nvvm_read_ptx_sreg_ntid_y());
|
||||
__CUDA_DEVICE_BUILTIN(z,__nvvm_read_ptx_sreg_ntid_z());
|
||||
// blockDim should be convertible to dim3 (in fact in nvcc, it *is* a
|
||||
// dim3). This function is defined after we pull in vector_types.h.
|
||||
__attribute__((device)) operator dim3() const;
|
||||
private:
|
||||
__CUDA_DISALLOW_BUILTINVAR_ACCESS(__cuda_builtin_blockDim_t);
|
||||
};
|
||||
|
||||
struct __cuda_builtin_gridDim_t {
|
||||
__CUDA_DEVICE_BUILTIN(x,__nvvm_read_ptx_sreg_nctaid_x());
|
||||
__CUDA_DEVICE_BUILTIN(y,__nvvm_read_ptx_sreg_nctaid_y());
|
||||
__CUDA_DEVICE_BUILTIN(z,__nvvm_read_ptx_sreg_nctaid_z());
|
||||
// gridDim should be convertible to dim3 (in fact in nvcc, it *is* a
|
||||
// dim3). This function is defined after we pull in vector_types.h.
|
||||
__attribute__((device)) operator dim3() const;
|
||||
private:
|
||||
__CUDA_DISALLOW_BUILTINVAR_ACCESS(__cuda_builtin_gridDim_t);
|
||||
};
|
||||
|
||||
#define __CUDA_BUILTIN_VAR \
|
||||
extern const __attribute__((device)) __attribute__((weak))
|
||||
__CUDA_BUILTIN_VAR __cuda_builtin_threadIdx_t threadIdx;
|
||||
__CUDA_BUILTIN_VAR __cuda_builtin_blockIdx_t blockIdx;
|
||||
__CUDA_BUILTIN_VAR __cuda_builtin_blockDim_t blockDim;
|
||||
__CUDA_BUILTIN_VAR __cuda_builtin_gridDim_t gridDim;
|
||||
|
||||
// warpSize should translate to read of %WARP_SZ but there's currently no
|
||||
// builtin to do so. According to PTX v4.2 docs 'to date, all target
|
||||
// architectures have a WARP_SZ value of 32'.
|
||||
__attribute__((device)) const int warpSize = 32;
|
||||
|
||||
#undef __CUDA_DEVICE_BUILTIN
|
||||
#undef __CUDA_BUILTIN_VAR
|
||||
#undef __CUDA_DISALLOW_BUILTINVAR_ACCESS
|
||||
|
||||
#endif /* __CUDA_BUILTIN_VARS_H */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,124 @@
|
||||
/*===---- f16cintrin.h - F16C intrinsics -----------------------------------===
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
|
||||
#if !defined __X86INTRIN_H && !defined __EMMINTRIN_H && !defined __IMMINTRIN_H
|
||||
#error "Never use <f16cintrin.h> directly; include <emmintrin.h> instead."
|
||||
#endif
|
||||
|
||||
#ifndef __F16CINTRIN_H
|
||||
#define __F16CINTRIN_H
|
||||
|
||||
/* Define the default attributes for the functions in this file. */
|
||||
#define __DEFAULT_FN_ATTRS \
|
||||
__attribute__((__always_inline__, __nodebug__, __target__("f16c")))
|
||||
|
||||
/// \brief Converts a 16-bit half-precision float value into a 32-bit float
|
||||
/// value.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c VCVTPH2PS instruction.
|
||||
///
|
||||
/// \param __a
|
||||
/// A 16-bit half-precision float value.
|
||||
/// \returns The converted 32-bit float value.
|
||||
static __inline float __DEFAULT_FN_ATTRS
|
||||
_cvtsh_ss(unsigned short __a)
|
||||
{
|
||||
__v8hi v = {(short)__a, 0, 0, 0, 0, 0, 0, 0};
|
||||
__v4sf r = __builtin_ia32_vcvtph2ps(v);
|
||||
return r[0];
|
||||
}
|
||||
|
||||
/// \brief Converts a 32-bit single-precision float value to a 16-bit
|
||||
/// half-precision float value.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// \code
|
||||
/// unsigned short _cvtss_sh(float a, const int imm);
|
||||
/// \endcode
|
||||
///
|
||||
/// This intrinsic corresponds to the \c VCVTPS2PH instruction.
|
||||
///
|
||||
/// \param a
|
||||
/// A 32-bit single-precision float value to be converted to a 16-bit
|
||||
/// half-precision float value.
|
||||
/// \param imm
|
||||
/// An immediate value controlling rounding using bits [2:0]:
|
||||
/// 000: Nearest
|
||||
/// 001: Down
|
||||
/// 010: Up
|
||||
/// 011: Truncate
|
||||
/// 1XX: Use MXCSR.RC for rounding
|
||||
/// \returns The converted 16-bit half-precision float value.
|
||||
#define _cvtss_sh(a, imm) \
|
||||
((unsigned short)(((__v8hi)__builtin_ia32_vcvtps2ph((__v4sf){a, 0, 0, 0}, \
|
||||
(imm)))[0]))
|
||||
|
||||
/// \brief Converts a 128-bit vector containing 32-bit float values into a
|
||||
/// 128-bit vector containing 16-bit half-precision float values.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// \code
|
||||
/// __m128i _mm_cvtps_ph(__m128 a, const int imm);
|
||||
/// \endcode
|
||||
///
|
||||
/// This intrinsic corresponds to the \c VCVTPS2PH instruction.
|
||||
///
|
||||
/// \param a
|
||||
/// A 128-bit vector containing 32-bit float values.
|
||||
/// \param imm
|
||||
/// An immediate value controlling rounding using bits [2:0]:
|
||||
/// 000: Nearest
|
||||
/// 001: Down
|
||||
/// 010: Up
|
||||
/// 011: Truncate
|
||||
/// 1XX: Use MXCSR.RC for rounding
|
||||
/// \returns A 128-bit vector containing converted 16-bit half-precision float
|
||||
/// values. The lower 64 bits are used to store the converted 16-bit
|
||||
/// half-precision floating-point values.
|
||||
#define _mm_cvtps_ph(a, imm) \
|
||||
((__m128i)__builtin_ia32_vcvtps2ph((__v4sf)(__m128)(a), (imm)))
|
||||
|
||||
/// \brief Converts a 128-bit vector containing 16-bit half-precision float
|
||||
/// values into a 128-bit vector containing 32-bit float values.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c VCVTPH2PS instruction.
|
||||
///
|
||||
/// \param __a
|
||||
/// A 128-bit vector containing 16-bit half-precision float values. The lower
|
||||
/// 64 bits are used in the conversion.
|
||||
/// \returns A 128-bit vector of [4 x float] containing converted float values.
|
||||
static __inline __m128 __DEFAULT_FN_ATTRS
|
||||
_mm_cvtph_ps(__m128i __a)
|
||||
{
|
||||
return (__m128)__builtin_ia32_vcvtph2ps((__v8hi)__a);
|
||||
}
|
||||
|
||||
#undef __DEFAULT_FN_ATTRS
|
||||
|
||||
#endif /* __F16CINTRIN_H */
|
||||
@@ -0,0 +1,134 @@
|
||||
/*===---- float.h - Characteristics of floating point types ----------------===
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
|
||||
#ifndef __FLOAT_H
|
||||
#define __FLOAT_H
|
||||
|
||||
/* If we're on MinGW, fall back to the system's float.h, which might have
|
||||
* additional definitions provided for Windows.
|
||||
* For more details see http://msdn.microsoft.com/en-us/library/y0ybw9fy.aspx
|
||||
*/
|
||||
#if (defined(__MINGW32__) || defined(_MSC_VER)) && __STDC_HOSTED__ && \
|
||||
__has_include_next(<float.h>)
|
||||
# include_next <float.h>
|
||||
|
||||
/* Undefine anything that we'll be redefining below. */
|
||||
# undef FLT_EVAL_METHOD
|
||||
# undef FLT_ROUNDS
|
||||
# undef FLT_RADIX
|
||||
# undef FLT_MANT_DIG
|
||||
# undef DBL_MANT_DIG
|
||||
# undef LDBL_MANT_DIG
|
||||
# if __STDC_VERSION__ >= 199901L || !defined(__STRICT_ANSI__)
|
||||
# undef DECIMAL_DIG
|
||||
# endif
|
||||
# undef FLT_DIG
|
||||
# undef DBL_DIG
|
||||
# undef LDBL_DIG
|
||||
# undef FLT_MIN_EXP
|
||||
# undef DBL_MIN_EXP
|
||||
# undef LDBL_MIN_EXP
|
||||
# undef FLT_MIN_10_EXP
|
||||
# undef DBL_MIN_10_EXP
|
||||
# undef LDBL_MIN_10_EXP
|
||||
# undef FLT_MAX_EXP
|
||||
# undef DBL_MAX_EXP
|
||||
# undef LDBL_MAX_EXP
|
||||
# undef FLT_MAX_10_EXP
|
||||
# undef DBL_MAX_10_EXP
|
||||
# undef LDBL_MAX_10_EXP
|
||||
# undef FLT_MAX
|
||||
# undef DBL_MAX
|
||||
# undef LDBL_MAX
|
||||
# undef FLT_EPSILON
|
||||
# undef DBL_EPSILON
|
||||
# undef LDBL_EPSILON
|
||||
# undef FLT_MIN
|
||||
# undef DBL_MIN
|
||||
# undef LDBL_MIN
|
||||
# if __STDC_VERSION__ >= 201112L || !defined(__STRICT_ANSI__)
|
||||
# undef FLT_TRUE_MIN
|
||||
# undef DBL_TRUE_MIN
|
||||
# undef LDBL_TRUE_MIN
|
||||
# undef FLT_DECIMAL_DIG
|
||||
# undef DBL_DECIMAL_DIG
|
||||
# undef LDBL_DECIMAL_DIG
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Characteristics of floating point types, C99 5.2.4.2.2 */
|
||||
|
||||
#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
|
||||
#define FLT_ROUNDS (__builtin_flt_rounds())
|
||||
#define FLT_RADIX __FLT_RADIX__
|
||||
|
||||
#define FLT_MANT_DIG __FLT_MANT_DIG__
|
||||
#define DBL_MANT_DIG __DBL_MANT_DIG__
|
||||
#define LDBL_MANT_DIG __LDBL_MANT_DIG__
|
||||
|
||||
#if __STDC_VERSION__ >= 199901L || !defined(__STRICT_ANSI__)
|
||||
# define DECIMAL_DIG __DECIMAL_DIG__
|
||||
#endif
|
||||
|
||||
#define FLT_DIG __FLT_DIG__
|
||||
#define DBL_DIG __DBL_DIG__
|
||||
#define LDBL_DIG __LDBL_DIG__
|
||||
|
||||
#define FLT_MIN_EXP __FLT_MIN_EXP__
|
||||
#define DBL_MIN_EXP __DBL_MIN_EXP__
|
||||
#define LDBL_MIN_EXP __LDBL_MIN_EXP__
|
||||
|
||||
#define FLT_MIN_10_EXP __FLT_MIN_10_EXP__
|
||||
#define DBL_MIN_10_EXP __DBL_MIN_10_EXP__
|
||||
#define LDBL_MIN_10_EXP __LDBL_MIN_10_EXP__
|
||||
|
||||
#define FLT_MAX_EXP __FLT_MAX_EXP__
|
||||
#define DBL_MAX_EXP __DBL_MAX_EXP__
|
||||
#define LDBL_MAX_EXP __LDBL_MAX_EXP__
|
||||
|
||||
#define FLT_MAX_10_EXP __FLT_MAX_10_EXP__
|
||||
#define DBL_MAX_10_EXP __DBL_MAX_10_EXP__
|
||||
#define LDBL_MAX_10_EXP __LDBL_MAX_10_EXP__
|
||||
|
||||
#define FLT_MAX __FLT_MAX__
|
||||
#define DBL_MAX __DBL_MAX__
|
||||
#define LDBL_MAX __LDBL_MAX__
|
||||
|
||||
#define FLT_EPSILON __FLT_EPSILON__
|
||||
#define DBL_EPSILON __DBL_EPSILON__
|
||||
#define LDBL_EPSILON __LDBL_EPSILON__
|
||||
|
||||
#define FLT_MIN __FLT_MIN__
|
||||
#define DBL_MIN __DBL_MIN__
|
||||
#define LDBL_MIN __LDBL_MIN__
|
||||
|
||||
#if __STDC_VERSION__ >= 201112L || !defined(__STRICT_ANSI__)
|
||||
# define FLT_TRUE_MIN __FLT_DENORM_MIN__
|
||||
# define DBL_TRUE_MIN __DBL_DENORM_MIN__
|
||||
# define LDBL_TRUE_MIN __LDBL_DENORM_MIN__
|
||||
# define FLT_DECIMAL_DIG __FLT_DECIMAL_DIG__
|
||||
# define DBL_DECIMAL_DIG __DBL_DECIMAL_DIG__
|
||||
# define LDBL_DECIMAL_DIG __LDBL_DECIMAL_DIG__
|
||||
#endif
|
||||
|
||||
#endif /* __FLOAT_H */
|
||||
@@ -0,0 +1,230 @@
|
||||
/*===---- fma4intrin.h - FMA4 intrinsics -----------------------------------===
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
|
||||
#ifndef __X86INTRIN_H
|
||||
#error "Never use <fma4intrin.h> directly; include <x86intrin.h> instead."
|
||||
#endif
|
||||
|
||||
#ifndef __FMA4INTRIN_H
|
||||
#define __FMA4INTRIN_H
|
||||
|
||||
#include <pmmintrin.h>
|
||||
|
||||
/* Define the default attributes for the functions in this file. */
|
||||
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("fma4")))
|
||||
|
||||
static __inline__ __m128 __DEFAULT_FN_ATTRS
|
||||
_mm_macc_ps(__m128 __A, __m128 __B, __m128 __C)
|
||||
{
|
||||
return (__m128)__builtin_ia32_vfmaddps((__v4sf)__A, (__v4sf)__B, (__v4sf)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m128d __DEFAULT_FN_ATTRS
|
||||
_mm_macc_pd(__m128d __A, __m128d __B, __m128d __C)
|
||||
{
|
||||
return (__m128d)__builtin_ia32_vfmaddpd((__v2df)__A, (__v2df)__B, (__v2df)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m128 __DEFAULT_FN_ATTRS
|
||||
_mm_macc_ss(__m128 __A, __m128 __B, __m128 __C)
|
||||
{
|
||||
return (__m128)__builtin_ia32_vfmaddss((__v4sf)__A, (__v4sf)__B, (__v4sf)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m128d __DEFAULT_FN_ATTRS
|
||||
_mm_macc_sd(__m128d __A, __m128d __B, __m128d __C)
|
||||
{
|
||||
return (__m128d)__builtin_ia32_vfmaddsd((__v2df)__A, (__v2df)__B, (__v2df)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m128 __DEFAULT_FN_ATTRS
|
||||
_mm_msub_ps(__m128 __A, __m128 __B, __m128 __C)
|
||||
{
|
||||
return (__m128)__builtin_ia32_vfmsubps((__v4sf)__A, (__v4sf)__B, (__v4sf)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m128d __DEFAULT_FN_ATTRS
|
||||
_mm_msub_pd(__m128d __A, __m128d __B, __m128d __C)
|
||||
{
|
||||
return (__m128d)__builtin_ia32_vfmsubpd((__v2df)__A, (__v2df)__B, (__v2df)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m128 __DEFAULT_FN_ATTRS
|
||||
_mm_msub_ss(__m128 __A, __m128 __B, __m128 __C)
|
||||
{
|
||||
return (__m128)__builtin_ia32_vfmsubss((__v4sf)__A, (__v4sf)__B, (__v4sf)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m128d __DEFAULT_FN_ATTRS
|
||||
_mm_msub_sd(__m128d __A, __m128d __B, __m128d __C)
|
||||
{
|
||||
return (__m128d)__builtin_ia32_vfmsubsd((__v2df)__A, (__v2df)__B, (__v2df)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m128 __DEFAULT_FN_ATTRS
|
||||
_mm_nmacc_ps(__m128 __A, __m128 __B, __m128 __C)
|
||||
{
|
||||
return (__m128)__builtin_ia32_vfnmaddps((__v4sf)__A, (__v4sf)__B, (__v4sf)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m128d __DEFAULT_FN_ATTRS
|
||||
_mm_nmacc_pd(__m128d __A, __m128d __B, __m128d __C)
|
||||
{
|
||||
return (__m128d)__builtin_ia32_vfnmaddpd((__v2df)__A, (__v2df)__B, (__v2df)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m128 __DEFAULT_FN_ATTRS
|
||||
_mm_nmacc_ss(__m128 __A, __m128 __B, __m128 __C)
|
||||
{
|
||||
return (__m128)__builtin_ia32_vfnmaddss((__v4sf)__A, (__v4sf)__B, (__v4sf)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m128d __DEFAULT_FN_ATTRS
|
||||
_mm_nmacc_sd(__m128d __A, __m128d __B, __m128d __C)
|
||||
{
|
||||
return (__m128d)__builtin_ia32_vfnmaddsd((__v2df)__A, (__v2df)__B, (__v2df)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m128 __DEFAULT_FN_ATTRS
|
||||
_mm_nmsub_ps(__m128 __A, __m128 __B, __m128 __C)
|
||||
{
|
||||
return (__m128)__builtin_ia32_vfnmsubps((__v4sf)__A, (__v4sf)__B, (__v4sf)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m128d __DEFAULT_FN_ATTRS
|
||||
_mm_nmsub_pd(__m128d __A, __m128d __B, __m128d __C)
|
||||
{
|
||||
return (__m128d)__builtin_ia32_vfnmsubpd((__v2df)__A, (__v2df)__B, (__v2df)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m128 __DEFAULT_FN_ATTRS
|
||||
_mm_nmsub_ss(__m128 __A, __m128 __B, __m128 __C)
|
||||
{
|
||||
return (__m128)__builtin_ia32_vfnmsubss((__v4sf)__A, (__v4sf)__B, (__v4sf)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m128d __DEFAULT_FN_ATTRS
|
||||
_mm_nmsub_sd(__m128d __A, __m128d __B, __m128d __C)
|
||||
{
|
||||
return (__m128d)__builtin_ia32_vfnmsubsd((__v2df)__A, (__v2df)__B, (__v2df)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m128 __DEFAULT_FN_ATTRS
|
||||
_mm_maddsub_ps(__m128 __A, __m128 __B, __m128 __C)
|
||||
{
|
||||
return (__m128)__builtin_ia32_vfmaddsubps((__v4sf)__A, (__v4sf)__B, (__v4sf)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m128d __DEFAULT_FN_ATTRS
|
||||
_mm_maddsub_pd(__m128d __A, __m128d __B, __m128d __C)
|
||||
{
|
||||
return (__m128d)__builtin_ia32_vfmaddsubpd((__v2df)__A, (__v2df)__B, (__v2df)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m128 __DEFAULT_FN_ATTRS
|
||||
_mm_msubadd_ps(__m128 __A, __m128 __B, __m128 __C)
|
||||
{
|
||||
return (__m128)__builtin_ia32_vfmsubaddps((__v4sf)__A, (__v4sf)__B, (__v4sf)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m128d __DEFAULT_FN_ATTRS
|
||||
_mm_msubadd_pd(__m128d __A, __m128d __B, __m128d __C)
|
||||
{
|
||||
return (__m128d)__builtin_ia32_vfmsubaddpd((__v2df)__A, (__v2df)__B, (__v2df)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m256 __DEFAULT_FN_ATTRS
|
||||
_mm256_macc_ps(__m256 __A, __m256 __B, __m256 __C)
|
||||
{
|
||||
return (__m256)__builtin_ia32_vfmaddps256((__v8sf)__A, (__v8sf)__B, (__v8sf)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m256d __DEFAULT_FN_ATTRS
|
||||
_mm256_macc_pd(__m256d __A, __m256d __B, __m256d __C)
|
||||
{
|
||||
return (__m256d)__builtin_ia32_vfmaddpd256((__v4df)__A, (__v4df)__B, (__v4df)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m256 __DEFAULT_FN_ATTRS
|
||||
_mm256_msub_ps(__m256 __A, __m256 __B, __m256 __C)
|
||||
{
|
||||
return (__m256)__builtin_ia32_vfmsubps256((__v8sf)__A, (__v8sf)__B, (__v8sf)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m256d __DEFAULT_FN_ATTRS
|
||||
_mm256_msub_pd(__m256d __A, __m256d __B, __m256d __C)
|
||||
{
|
||||
return (__m256d)__builtin_ia32_vfmsubpd256((__v4df)__A, (__v4df)__B, (__v4df)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m256 __DEFAULT_FN_ATTRS
|
||||
_mm256_nmacc_ps(__m256 __A, __m256 __B, __m256 __C)
|
||||
{
|
||||
return (__m256)__builtin_ia32_vfnmaddps256((__v8sf)__A, (__v8sf)__B, (__v8sf)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m256d __DEFAULT_FN_ATTRS
|
||||
_mm256_nmacc_pd(__m256d __A, __m256d __B, __m256d __C)
|
||||
{
|
||||
return (__m256d)__builtin_ia32_vfnmaddpd256((__v4df)__A, (__v4df)__B, (__v4df)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m256 __DEFAULT_FN_ATTRS
|
||||
_mm256_nmsub_ps(__m256 __A, __m256 __B, __m256 __C)
|
||||
{
|
||||
return (__m256)__builtin_ia32_vfnmsubps256((__v8sf)__A, (__v8sf)__B, (__v8sf)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m256d __DEFAULT_FN_ATTRS
|
||||
_mm256_nmsub_pd(__m256d __A, __m256d __B, __m256d __C)
|
||||
{
|
||||
return (__m256d)__builtin_ia32_vfnmsubpd256((__v4df)__A, (__v4df)__B, (__v4df)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m256 __DEFAULT_FN_ATTRS
|
||||
_mm256_maddsub_ps(__m256 __A, __m256 __B, __m256 __C)
|
||||
{
|
||||
return (__m256)__builtin_ia32_vfmaddsubps256((__v8sf)__A, (__v8sf)__B, (__v8sf)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m256d __DEFAULT_FN_ATTRS
|
||||
_mm256_maddsub_pd(__m256d __A, __m256d __B, __m256d __C)
|
||||
{
|
||||
return (__m256d)__builtin_ia32_vfmaddsubpd256((__v4df)__A, (__v4df)__B, (__v4df)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m256 __DEFAULT_FN_ATTRS
|
||||
_mm256_msubadd_ps(__m256 __A, __m256 __B, __m256 __C)
|
||||
{
|
||||
return (__m256)__builtin_ia32_vfmsubaddps256((__v8sf)__A, (__v8sf)__B, (__v8sf)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m256d __DEFAULT_FN_ATTRS
|
||||
_mm256_msubadd_pd(__m256d __A, __m256d __B, __m256d __C)
|
||||
{
|
||||
return (__m256d)__builtin_ia32_vfmsubaddpd256((__v4df)__A, (__v4df)__B, (__v4df)__C);
|
||||
}
|
||||
|
||||
#undef __DEFAULT_FN_ATTRS
|
||||
|
||||
#endif /* __FMA4INTRIN_H */
|
||||
@@ -0,0 +1,228 @@
|
||||
/*===---- fma4intrin.h - FMA4 intrinsics -----------------------------------===
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
|
||||
#ifndef __IMMINTRIN_H
|
||||
#error "Never use <fmaintrin.h> directly; include <immintrin.h> instead."
|
||||
#endif
|
||||
|
||||
#ifndef __FMAINTRIN_H
|
||||
#define __FMAINTRIN_H
|
||||
|
||||
/* Define the default attributes for the functions in this file. */
|
||||
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("fma")))
|
||||
|
||||
static __inline__ __m128 __DEFAULT_FN_ATTRS
|
||||
_mm_fmadd_ps(__m128 __A, __m128 __B, __m128 __C)
|
||||
{
|
||||
return (__m128)__builtin_ia32_vfmaddps((__v4sf)__A, (__v4sf)__B, (__v4sf)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m128d __DEFAULT_FN_ATTRS
|
||||
_mm_fmadd_pd(__m128d __A, __m128d __B, __m128d __C)
|
||||
{
|
||||
return (__m128d)__builtin_ia32_vfmaddpd((__v2df)__A, (__v2df)__B, (__v2df)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m128 __DEFAULT_FN_ATTRS
|
||||
_mm_fmadd_ss(__m128 __A, __m128 __B, __m128 __C)
|
||||
{
|
||||
return (__m128)__builtin_ia32_vfmaddss((__v4sf)__A, (__v4sf)__B, (__v4sf)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m128d __DEFAULT_FN_ATTRS
|
||||
_mm_fmadd_sd(__m128d __A, __m128d __B, __m128d __C)
|
||||
{
|
||||
return (__m128d)__builtin_ia32_vfmaddsd((__v2df)__A, (__v2df)__B, (__v2df)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m128 __DEFAULT_FN_ATTRS
|
||||
_mm_fmsub_ps(__m128 __A, __m128 __B, __m128 __C)
|
||||
{
|
||||
return (__m128)__builtin_ia32_vfmsubps((__v4sf)__A, (__v4sf)__B, (__v4sf)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m128d __DEFAULT_FN_ATTRS
|
||||
_mm_fmsub_pd(__m128d __A, __m128d __B, __m128d __C)
|
||||
{
|
||||
return (__m128d)__builtin_ia32_vfmsubpd((__v2df)__A, (__v2df)__B, (__v2df)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m128 __DEFAULT_FN_ATTRS
|
||||
_mm_fmsub_ss(__m128 __A, __m128 __B, __m128 __C)
|
||||
{
|
||||
return (__m128)__builtin_ia32_vfmsubss((__v4sf)__A, (__v4sf)__B, (__v4sf)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m128d __DEFAULT_FN_ATTRS
|
||||
_mm_fmsub_sd(__m128d __A, __m128d __B, __m128d __C)
|
||||
{
|
||||
return (__m128d)__builtin_ia32_vfmsubsd((__v2df)__A, (__v2df)__B, (__v2df)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m128 __DEFAULT_FN_ATTRS
|
||||
_mm_fnmadd_ps(__m128 __A, __m128 __B, __m128 __C)
|
||||
{
|
||||
return (__m128)__builtin_ia32_vfnmaddps((__v4sf)__A, (__v4sf)__B, (__v4sf)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m128d __DEFAULT_FN_ATTRS
|
||||
_mm_fnmadd_pd(__m128d __A, __m128d __B, __m128d __C)
|
||||
{
|
||||
return (__m128d)__builtin_ia32_vfnmaddpd((__v2df)__A, (__v2df)__B, (__v2df)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m128 __DEFAULT_FN_ATTRS
|
||||
_mm_fnmadd_ss(__m128 __A, __m128 __B, __m128 __C)
|
||||
{
|
||||
return (__m128)__builtin_ia32_vfnmaddss((__v4sf)__A, (__v4sf)__B, (__v4sf)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m128d __DEFAULT_FN_ATTRS
|
||||
_mm_fnmadd_sd(__m128d __A, __m128d __B, __m128d __C)
|
||||
{
|
||||
return (__m128d)__builtin_ia32_vfnmaddsd((__v2df)__A, (__v2df)__B, (__v2df)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m128 __DEFAULT_FN_ATTRS
|
||||
_mm_fnmsub_ps(__m128 __A, __m128 __B, __m128 __C)
|
||||
{
|
||||
return (__m128)__builtin_ia32_vfnmsubps((__v4sf)__A, (__v4sf)__B, (__v4sf)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m128d __DEFAULT_FN_ATTRS
|
||||
_mm_fnmsub_pd(__m128d __A, __m128d __B, __m128d __C)
|
||||
{
|
||||
return (__m128d)__builtin_ia32_vfnmsubpd((__v2df)__A, (__v2df)__B, (__v2df)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m128 __DEFAULT_FN_ATTRS
|
||||
_mm_fnmsub_ss(__m128 __A, __m128 __B, __m128 __C)
|
||||
{
|
||||
return (__m128)__builtin_ia32_vfnmsubss((__v4sf)__A, (__v4sf)__B, (__v4sf)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m128d __DEFAULT_FN_ATTRS
|
||||
_mm_fnmsub_sd(__m128d __A, __m128d __B, __m128d __C)
|
||||
{
|
||||
return (__m128d)__builtin_ia32_vfnmsubsd((__v2df)__A, (__v2df)__B, (__v2df)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m128 __DEFAULT_FN_ATTRS
|
||||
_mm_fmaddsub_ps(__m128 __A, __m128 __B, __m128 __C)
|
||||
{
|
||||
return (__m128)__builtin_ia32_vfmaddsubps((__v4sf)__A, (__v4sf)__B, (__v4sf)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m128d __DEFAULT_FN_ATTRS
|
||||
_mm_fmaddsub_pd(__m128d __A, __m128d __B, __m128d __C)
|
||||
{
|
||||
return (__m128d)__builtin_ia32_vfmaddsubpd((__v2df)__A, (__v2df)__B, (__v2df)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m128 __DEFAULT_FN_ATTRS
|
||||
_mm_fmsubadd_ps(__m128 __A, __m128 __B, __m128 __C)
|
||||
{
|
||||
return (__m128)__builtin_ia32_vfmsubaddps((__v4sf)__A, (__v4sf)__B, (__v4sf)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m128d __DEFAULT_FN_ATTRS
|
||||
_mm_fmsubadd_pd(__m128d __A, __m128d __B, __m128d __C)
|
||||
{
|
||||
return (__m128d)__builtin_ia32_vfmsubaddpd((__v2df)__A, (__v2df)__B, (__v2df)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m256 __DEFAULT_FN_ATTRS
|
||||
_mm256_fmadd_ps(__m256 __A, __m256 __B, __m256 __C)
|
||||
{
|
||||
return (__m256)__builtin_ia32_vfmaddps256((__v8sf)__A, (__v8sf)__B, (__v8sf)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m256d __DEFAULT_FN_ATTRS
|
||||
_mm256_fmadd_pd(__m256d __A, __m256d __B, __m256d __C)
|
||||
{
|
||||
return (__m256d)__builtin_ia32_vfmaddpd256((__v4df)__A, (__v4df)__B, (__v4df)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m256 __DEFAULT_FN_ATTRS
|
||||
_mm256_fmsub_ps(__m256 __A, __m256 __B, __m256 __C)
|
||||
{
|
||||
return (__m256)__builtin_ia32_vfmsubps256((__v8sf)__A, (__v8sf)__B, (__v8sf)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m256d __DEFAULT_FN_ATTRS
|
||||
_mm256_fmsub_pd(__m256d __A, __m256d __B, __m256d __C)
|
||||
{
|
||||
return (__m256d)__builtin_ia32_vfmsubpd256((__v4df)__A, (__v4df)__B, (__v4df)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m256 __DEFAULT_FN_ATTRS
|
||||
_mm256_fnmadd_ps(__m256 __A, __m256 __B, __m256 __C)
|
||||
{
|
||||
return (__m256)__builtin_ia32_vfnmaddps256((__v8sf)__A, (__v8sf)__B, (__v8sf)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m256d __DEFAULT_FN_ATTRS
|
||||
_mm256_fnmadd_pd(__m256d __A, __m256d __B, __m256d __C)
|
||||
{
|
||||
return (__m256d)__builtin_ia32_vfnmaddpd256((__v4df)__A, (__v4df)__B, (__v4df)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m256 __DEFAULT_FN_ATTRS
|
||||
_mm256_fnmsub_ps(__m256 __A, __m256 __B, __m256 __C)
|
||||
{
|
||||
return (__m256)__builtin_ia32_vfnmsubps256((__v8sf)__A, (__v8sf)__B, (__v8sf)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m256d __DEFAULT_FN_ATTRS
|
||||
_mm256_fnmsub_pd(__m256d __A, __m256d __B, __m256d __C)
|
||||
{
|
||||
return (__m256d)__builtin_ia32_vfnmsubpd256((__v4df)__A, (__v4df)__B, (__v4df)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m256 __DEFAULT_FN_ATTRS
|
||||
_mm256_fmaddsub_ps(__m256 __A, __m256 __B, __m256 __C)
|
||||
{
|
||||
return (__m256)__builtin_ia32_vfmaddsubps256((__v8sf)__A, (__v8sf)__B, (__v8sf)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m256d __DEFAULT_FN_ATTRS
|
||||
_mm256_fmaddsub_pd(__m256d __A, __m256d __B, __m256d __C)
|
||||
{
|
||||
return (__m256d)__builtin_ia32_vfmaddsubpd256((__v4df)__A, (__v4df)__B, (__v4df)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m256 __DEFAULT_FN_ATTRS
|
||||
_mm256_fmsubadd_ps(__m256 __A, __m256 __B, __m256 __C)
|
||||
{
|
||||
return (__m256)__builtin_ia32_vfmsubaddps256((__v8sf)__A, (__v8sf)__B, (__v8sf)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m256d __DEFAULT_FN_ATTRS
|
||||
_mm256_fmsubadd_pd(__m256d __A, __m256d __B, __m256d __C)
|
||||
{
|
||||
return (__m256d)__builtin_ia32_vfmsubaddpd256((__v4df)__A, (__v4df)__B, (__v4df)__C);
|
||||
}
|
||||
|
||||
#undef __DEFAULT_FN_ATTRS
|
||||
|
||||
#endif /* __FMAINTRIN_H */
|
||||
@@ -0,0 +1,55 @@
|
||||
/*===---- fxsrintrin.h - FXSR intrinsic ------------------------------------===
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
|
||||
#ifndef __IMMINTRIN_H
|
||||
#error "Never use <fxsrintrin.h> directly; include <immintrin.h> instead."
|
||||
#endif
|
||||
|
||||
#ifndef __FXSRINTRIN_H
|
||||
#define __FXSRINTRIN_H
|
||||
|
||||
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("fxsr")))
|
||||
|
||||
static __inline__ void __DEFAULT_FN_ATTRS
|
||||
_fxsave(void *__p) {
|
||||
return __builtin_ia32_fxsave(__p);
|
||||
}
|
||||
|
||||
static __inline__ void __DEFAULT_FN_ATTRS
|
||||
_fxsave64(void *__p) {
|
||||
return __builtin_ia32_fxsave64(__p);
|
||||
}
|
||||
|
||||
static __inline__ void __DEFAULT_FN_ATTRS
|
||||
_fxrstor(void *__p) {
|
||||
return __builtin_ia32_fxrstor(__p);
|
||||
}
|
||||
|
||||
static __inline__ void __DEFAULT_FN_ATTRS
|
||||
_fxrstor64(void *__p) {
|
||||
return __builtin_ia32_fxrstor64(__p);
|
||||
}
|
||||
|
||||
#undef __DEFAULT_FN_ATTRS
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,226 @@
|
||||
/*===---- htmintrin.h - Standard header for PowerPC HTM ---------------===*\
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
\*===----------------------------------------------------------------------===*/
|
||||
|
||||
#ifndef __HTMINTRIN_H
|
||||
#define __HTMINTRIN_H
|
||||
|
||||
#ifndef __HTM__
|
||||
#error "HTM instruction set not enabled"
|
||||
#endif
|
||||
|
||||
#ifdef __powerpc__
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
typedef uint64_t texasr_t;
|
||||
typedef uint32_t texasru_t;
|
||||
typedef uint32_t texasrl_t;
|
||||
typedef uintptr_t tfiar_t;
|
||||
typedef uintptr_t tfhar_t;
|
||||
|
||||
#define _HTM_STATE(CR0) ((CR0 >> 1) & 0x3)
|
||||
#define _HTM_NONTRANSACTIONAL 0x0
|
||||
#define _HTM_SUSPENDED 0x1
|
||||
#define _HTM_TRANSACTIONAL 0x2
|
||||
|
||||
#define _TEXASR_EXTRACT_BITS(TEXASR,BITNUM,SIZE) \
|
||||
(((TEXASR) >> (63-(BITNUM))) & ((1<<(SIZE))-1))
|
||||
#define _TEXASRU_EXTRACT_BITS(TEXASR,BITNUM,SIZE) \
|
||||
(((TEXASR) >> (31-(BITNUM))) & ((1<<(SIZE))-1))
|
||||
|
||||
#define _TEXASR_FAILURE_CODE(TEXASR) \
|
||||
_TEXASR_EXTRACT_BITS(TEXASR, 7, 8)
|
||||
#define _TEXASRU_FAILURE_CODE(TEXASRU) \
|
||||
_TEXASRU_EXTRACT_BITS(TEXASRU, 7, 8)
|
||||
|
||||
#define _TEXASR_FAILURE_PERSISTENT(TEXASR) \
|
||||
_TEXASR_EXTRACT_BITS(TEXASR, 7, 1)
|
||||
#define _TEXASRU_FAILURE_PERSISTENT(TEXASRU) \
|
||||
_TEXASRU_EXTRACT_BITS(TEXASRU, 7, 1)
|
||||
|
||||
#define _TEXASR_DISALLOWED(TEXASR) \
|
||||
_TEXASR_EXTRACT_BITS(TEXASR, 8, 1)
|
||||
#define _TEXASRU_DISALLOWED(TEXASRU) \
|
||||
_TEXASRU_EXTRACT_BITS(TEXASRU, 8, 1)
|
||||
|
||||
#define _TEXASR_NESTING_OVERFLOW(TEXASR) \
|
||||
_TEXASR_EXTRACT_BITS(TEXASR, 9, 1)
|
||||
#define _TEXASRU_NESTING_OVERFLOW(TEXASRU) \
|
||||
_TEXASRU_EXTRACT_BITS(TEXASRU, 9, 1)
|
||||
|
||||
#define _TEXASR_FOOTPRINT_OVERFLOW(TEXASR) \
|
||||
_TEXASR_EXTRACT_BITS(TEXASR, 10, 1)
|
||||
#define _TEXASRU_FOOTPRINT_OVERFLOW(TEXASRU) \
|
||||
_TEXASRU_EXTRACT_BITS(TEXASRU, 10, 1)
|
||||
|
||||
#define _TEXASR_SELF_INDUCED_CONFLICT(TEXASR) \
|
||||
_TEXASR_EXTRACT_BITS(TEXASR, 11, 1)
|
||||
#define _TEXASRU_SELF_INDUCED_CONFLICT(TEXASRU) \
|
||||
_TEXASRU_EXTRACT_BITS(TEXASRU, 11, 1)
|
||||
|
||||
#define _TEXASR_NON_TRANSACTIONAL_CONFLICT(TEXASR) \
|
||||
_TEXASR_EXTRACT_BITS(TEXASR, 12, 1)
|
||||
#define _TEXASRU_NON_TRANSACTIONAL_CONFLICT(TEXASRU) \
|
||||
_TEXASRU_EXTRACT_BITS(TEXASRU, 12, 1)
|
||||
|
||||
#define _TEXASR_TRANSACTION_CONFLICT(TEXASR) \
|
||||
_TEXASR_EXTRACT_BITS(TEXASR, 13, 1)
|
||||
#define _TEXASRU_TRANSACTION_CONFLICT(TEXASRU) \
|
||||
_TEXASRU_EXTRACT_BITS(TEXASRU, 13, 1)
|
||||
|
||||
#define _TEXASR_TRANSLATION_INVALIDATION_CONFLICT(TEXASR) \
|
||||
_TEXASR_EXTRACT_BITS(TEXASR, 14, 1)
|
||||
#define _TEXASRU_TRANSLATION_INVALIDATION_CONFLICT(TEXASRU) \
|
||||
_TEXASRU_EXTRACT_BITS(TEXASRU, 14, 1)
|
||||
|
||||
#define _TEXASR_IMPLEMENTAION_SPECIFIC(TEXASR) \
|
||||
_TEXASR_EXTRACT_BITS(TEXASR, 15, 1)
|
||||
#define _TEXASRU_IMPLEMENTAION_SPECIFIC(TEXASRU) \
|
||||
_TEXASRU_EXTRACT_BITS(TEXASRU, 15, 1)
|
||||
|
||||
#define _TEXASR_INSTRUCTION_FETCH_CONFLICT(TEXASR) \
|
||||
_TEXASR_EXTRACT_BITS(TEXASR, 16, 1)
|
||||
#define _TEXASRU_INSTRUCTION_FETCH_CONFLICT(TEXASRU) \
|
||||
_TEXASRU_EXTRACT_BITS(TEXASRU, 16, 1)
|
||||
|
||||
#define _TEXASR_ABORT(TEXASR) \
|
||||
_TEXASR_EXTRACT_BITS(TEXASR, 31, 1)
|
||||
#define _TEXASRU_ABORT(TEXASRU) \
|
||||
_TEXASRU_EXTRACT_BITS(TEXASRU, 31, 1)
|
||||
|
||||
|
||||
#define _TEXASR_SUSPENDED(TEXASR) \
|
||||
_TEXASR_EXTRACT_BITS(TEXASR, 32, 1)
|
||||
|
||||
#define _TEXASR_PRIVILEGE(TEXASR) \
|
||||
_TEXASR_EXTRACT_BITS(TEXASR, 35, 2)
|
||||
|
||||
#define _TEXASR_FAILURE_SUMMARY(TEXASR) \
|
||||
_TEXASR_EXTRACT_BITS(TEXASR, 36, 1)
|
||||
|
||||
#define _TEXASR_TFIAR_EXACT(TEXASR) \
|
||||
_TEXASR_EXTRACT_BITS(TEXASR, 37, 1)
|
||||
|
||||
#define _TEXASR_ROT(TEXASR) \
|
||||
_TEXASR_EXTRACT_BITS(TEXASR, 38, 1)
|
||||
|
||||
#define _TEXASR_TRANSACTION_LEVEL(TEXASR) \
|
||||
_TEXASR_EXTRACT_BITS(TEXASR, 63, 12)
|
||||
|
||||
#endif /* __powerpc */
|
||||
|
||||
#ifdef __s390__
|
||||
|
||||
/* Condition codes generated by tbegin */
|
||||
#define _HTM_TBEGIN_STARTED 0
|
||||
#define _HTM_TBEGIN_INDETERMINATE 1
|
||||
#define _HTM_TBEGIN_TRANSIENT 2
|
||||
#define _HTM_TBEGIN_PERSISTENT 3
|
||||
|
||||
/* The abort codes below this threshold are reserved for machine use. */
|
||||
#define _HTM_FIRST_USER_ABORT_CODE 256
|
||||
|
||||
/* The transaction diagnostic block is it is defined in the Principles
|
||||
of Operation chapter 5-91. */
|
||||
|
||||
struct __htm_tdb {
|
||||
unsigned char format; /* 0 */
|
||||
unsigned char flags;
|
||||
unsigned char reserved1[4];
|
||||
unsigned short nesting_depth;
|
||||
unsigned long long abort_code; /* 8 */
|
||||
unsigned long long conflict_token; /* 16 */
|
||||
unsigned long long atia; /* 24 */
|
||||
unsigned char eaid; /* 32 */
|
||||
unsigned char dxc;
|
||||
unsigned char reserved2[2];
|
||||
unsigned int program_int_id;
|
||||
unsigned long long exception_id; /* 40 */
|
||||
unsigned long long bea; /* 48 */
|
||||
unsigned char reserved3[72]; /* 56 */
|
||||
unsigned long long gprs[16]; /* 128 */
|
||||
} __attribute__((__packed__, __aligned__ (8)));
|
||||
|
||||
|
||||
/* Helper intrinsics to retry tbegin in case of transient failure. */
|
||||
|
||||
static __inline int __attribute__((__always_inline__, __nodebug__))
|
||||
__builtin_tbegin_retry_null (int __retry)
|
||||
{
|
||||
int cc, i = 0;
|
||||
|
||||
while ((cc = __builtin_tbegin(0)) == _HTM_TBEGIN_TRANSIENT
|
||||
&& i++ < __retry)
|
||||
__builtin_tx_assist(i);
|
||||
|
||||
return cc;
|
||||
}
|
||||
|
||||
static __inline int __attribute__((__always_inline__, __nodebug__))
|
||||
__builtin_tbegin_retry_tdb (void *__tdb, int __retry)
|
||||
{
|
||||
int cc, i = 0;
|
||||
|
||||
while ((cc = __builtin_tbegin(__tdb)) == _HTM_TBEGIN_TRANSIENT
|
||||
&& i++ < __retry)
|
||||
__builtin_tx_assist(i);
|
||||
|
||||
return cc;
|
||||
}
|
||||
|
||||
#define __builtin_tbegin_retry(tdb, retry) \
|
||||
(__builtin_constant_p(tdb == 0) && tdb == 0 ? \
|
||||
__builtin_tbegin_retry_null(retry) : \
|
||||
__builtin_tbegin_retry_tdb(tdb, retry))
|
||||
|
||||
static __inline int __attribute__((__always_inline__, __nodebug__))
|
||||
__builtin_tbegin_retry_nofloat_null (int __retry)
|
||||
{
|
||||
int cc, i = 0;
|
||||
|
||||
while ((cc = __builtin_tbegin_nofloat(0)) == _HTM_TBEGIN_TRANSIENT
|
||||
&& i++ < __retry)
|
||||
__builtin_tx_assist(i);
|
||||
|
||||
return cc;
|
||||
}
|
||||
|
||||
static __inline int __attribute__((__always_inline__, __nodebug__))
|
||||
__builtin_tbegin_retry_nofloat_tdb (void *__tdb, int __retry)
|
||||
{
|
||||
int cc, i = 0;
|
||||
|
||||
while ((cc = __builtin_tbegin_nofloat(__tdb)) == _HTM_TBEGIN_TRANSIENT
|
||||
&& i++ < __retry)
|
||||
__builtin_tx_assist(i);
|
||||
|
||||
return cc;
|
||||
}
|
||||
|
||||
#define __builtin_tbegin_retry_nofloat(tdb, retry) \
|
||||
(__builtin_constant_p(tdb == 0) && tdb == 0 ? \
|
||||
__builtin_tbegin_retry_nofloat_null(retry) : \
|
||||
__builtin_tbegin_retry_nofloat_tdb(tdb, retry))
|
||||
|
||||
#endif /* __s390__ */
|
||||
|
||||
#endif /* __HTMINTRIN_H */
|
||||
@@ -0,0 +1,363 @@
|
||||
/*===---- htmxlintrin.h - XL compiler HTM execution intrinsics-------------===*\
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
\*===----------------------------------------------------------------------===*/
|
||||
|
||||
#ifndef __HTMXLINTRIN_H
|
||||
#define __HTMXLINTRIN_H
|
||||
|
||||
#ifndef __HTM__
|
||||
#error "HTM instruction set not enabled"
|
||||
#endif
|
||||
|
||||
#include <htmintrin.h>
|
||||
|
||||
#ifdef __powerpc__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define _TEXASR_PTR(TM_BUF) \
|
||||
((texasr_t *)((TM_BUF)+0))
|
||||
#define _TEXASRU_PTR(TM_BUF) \
|
||||
((texasru_t *)((TM_BUF)+0))
|
||||
#define _TEXASRL_PTR(TM_BUF) \
|
||||
((texasrl_t *)((TM_BUF)+4))
|
||||
#define _TFIAR_PTR(TM_BUF) \
|
||||
((tfiar_t *)((TM_BUF)+8))
|
||||
|
||||
typedef char TM_buff_type[16];
|
||||
|
||||
/* This macro can be used to determine whether a transaction was successfully
|
||||
started from the __TM_begin() and __TM_simple_begin() intrinsic functions
|
||||
below. */
|
||||
#define _HTM_TBEGIN_STARTED 1
|
||||
|
||||
extern __inline long
|
||||
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
|
||||
__TM_simple_begin (void)
|
||||
{
|
||||
if (__builtin_expect (__builtin_tbegin (0), 1))
|
||||
return _HTM_TBEGIN_STARTED;
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern __inline long
|
||||
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
|
||||
__TM_begin (void* const __TM_buff)
|
||||
{
|
||||
*_TEXASRL_PTR (__TM_buff) = 0;
|
||||
if (__builtin_expect (__builtin_tbegin (0), 1))
|
||||
return _HTM_TBEGIN_STARTED;
|
||||
#ifdef __powerpc64__
|
||||
*_TEXASR_PTR (__TM_buff) = __builtin_get_texasr ();
|
||||
#else
|
||||
*_TEXASRU_PTR (__TM_buff) = __builtin_get_texasru ();
|
||||
*_TEXASRL_PTR (__TM_buff) = __builtin_get_texasr ();
|
||||
#endif
|
||||
*_TFIAR_PTR (__TM_buff) = __builtin_get_tfiar ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern __inline long
|
||||
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
|
||||
__TM_end (void)
|
||||
{
|
||||
if (__builtin_expect (__builtin_tend (0), 1))
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern __inline void
|
||||
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
|
||||
__TM_abort (void)
|
||||
{
|
||||
__builtin_tabort (0);
|
||||
}
|
||||
|
||||
extern __inline void
|
||||
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
|
||||
__TM_named_abort (unsigned char const __code)
|
||||
{
|
||||
__builtin_tabort (__code);
|
||||
}
|
||||
|
||||
extern __inline void
|
||||
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
|
||||
__TM_resume (void)
|
||||
{
|
||||
__builtin_tresume ();
|
||||
}
|
||||
|
||||
extern __inline void
|
||||
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
|
||||
__TM_suspend (void)
|
||||
{
|
||||
__builtin_tsuspend ();
|
||||
}
|
||||
|
||||
extern __inline long
|
||||
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
|
||||
__TM_is_user_abort (void* const __TM_buff)
|
||||
{
|
||||
texasru_t texasru = *_TEXASRU_PTR (__TM_buff);
|
||||
return _TEXASRU_ABORT (texasru);
|
||||
}
|
||||
|
||||
extern __inline long
|
||||
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
|
||||
__TM_is_named_user_abort (void* const __TM_buff, unsigned char *__code)
|
||||
{
|
||||
texasru_t texasru = *_TEXASRU_PTR (__TM_buff);
|
||||
|
||||
*__code = _TEXASRU_FAILURE_CODE (texasru);
|
||||
return _TEXASRU_ABORT (texasru);
|
||||
}
|
||||
|
||||
extern __inline long
|
||||
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
|
||||
__TM_is_illegal (void* const __TM_buff)
|
||||
{
|
||||
texasru_t texasru = *_TEXASRU_PTR (__TM_buff);
|
||||
return _TEXASRU_DISALLOWED (texasru);
|
||||
}
|
||||
|
||||
extern __inline long
|
||||
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
|
||||
__TM_is_footprint_exceeded (void* const __TM_buff)
|
||||
{
|
||||
texasru_t texasru = *_TEXASRU_PTR (__TM_buff);
|
||||
return _TEXASRU_FOOTPRINT_OVERFLOW (texasru);
|
||||
}
|
||||
|
||||
extern __inline long
|
||||
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
|
||||
__TM_nesting_depth (void* const __TM_buff)
|
||||
{
|
||||
texasrl_t texasrl;
|
||||
|
||||
if (_HTM_STATE (__builtin_ttest ()) == _HTM_NONTRANSACTIONAL)
|
||||
{
|
||||
texasrl = *_TEXASRL_PTR (__TM_buff);
|
||||
if (!_TEXASR_FAILURE_SUMMARY (texasrl))
|
||||
texasrl = 0;
|
||||
}
|
||||
else
|
||||
texasrl = (texasrl_t) __builtin_get_texasr ();
|
||||
|
||||
return _TEXASR_TRANSACTION_LEVEL (texasrl);
|
||||
}
|
||||
|
||||
extern __inline long
|
||||
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
|
||||
__TM_is_nested_too_deep(void* const __TM_buff)
|
||||
{
|
||||
texasru_t texasru = *_TEXASRU_PTR (__TM_buff);
|
||||
return _TEXASRU_NESTING_OVERFLOW (texasru);
|
||||
}
|
||||
|
||||
extern __inline long
|
||||
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
|
||||
__TM_is_conflict(void* const __TM_buff)
|
||||
{
|
||||
texasru_t texasru = *_TEXASRU_PTR (TM_buff);
|
||||
/* Return TEXASR bits 11 (Self-Induced Conflict) through
|
||||
14 (Translation Invalidation Conflict). */
|
||||
return (_TEXASRU_EXTRACT_BITS (texasru, 14, 4)) ? 1 : 0;
|
||||
}
|
||||
|
||||
extern __inline long
|
||||
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
|
||||
__TM_is_failure_persistent(void* const __TM_buff)
|
||||
{
|
||||
texasru_t texasru = *_TEXASRU_PTR (__TM_buff);
|
||||
return _TEXASRU_FAILURE_PERSISTENT (texasru);
|
||||
}
|
||||
|
||||
extern __inline long
|
||||
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
|
||||
__TM_failure_address(void* const __TM_buff)
|
||||
{
|
||||
return *_TFIAR_PTR (__TM_buff);
|
||||
}
|
||||
|
||||
extern __inline long long
|
||||
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
|
||||
__TM_failure_code(void* const __TM_buff)
|
||||
{
|
||||
return *_TEXASR_PTR (__TM_buff);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __powerpc__ */
|
||||
|
||||
#ifdef __s390__
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/* These intrinsics are being made available for compatibility with
|
||||
the IBM XL compiler. For documentation please see the "z/OS XL
|
||||
C/C++ Programming Guide" publically available on the web. */
|
||||
|
||||
static __inline long __attribute__((__always_inline__, __nodebug__))
|
||||
__TM_simple_begin ()
|
||||
{
|
||||
return __builtin_tbegin_nofloat (0);
|
||||
}
|
||||
|
||||
static __inline long __attribute__((__always_inline__, __nodebug__))
|
||||
__TM_begin (void* const __tdb)
|
||||
{
|
||||
return __builtin_tbegin_nofloat (__tdb);
|
||||
}
|
||||
|
||||
static __inline long __attribute__((__always_inline__, __nodebug__))
|
||||
__TM_end ()
|
||||
{
|
||||
return __builtin_tend ();
|
||||
}
|
||||
|
||||
static __inline void __attribute__((__always_inline__))
|
||||
__TM_abort ()
|
||||
{
|
||||
return __builtin_tabort (_HTM_FIRST_USER_ABORT_CODE);
|
||||
}
|
||||
|
||||
static __inline void __attribute__((__always_inline__, __nodebug__))
|
||||
__TM_named_abort (unsigned char const __code)
|
||||
{
|
||||
return __builtin_tabort ((int)_HTM_FIRST_USER_ABORT_CODE + __code);
|
||||
}
|
||||
|
||||
static __inline void __attribute__((__always_inline__, __nodebug__))
|
||||
__TM_non_transactional_store (void* const __addr, long long const __value)
|
||||
{
|
||||
__builtin_non_tx_store ((uint64_t*)__addr, (uint64_t)__value);
|
||||
}
|
||||
|
||||
static __inline long __attribute__((__always_inline__, __nodebug__))
|
||||
__TM_nesting_depth (void* const __tdb_ptr)
|
||||
{
|
||||
int depth = __builtin_tx_nesting_depth ();
|
||||
struct __htm_tdb *tdb = (struct __htm_tdb*)__tdb_ptr;
|
||||
|
||||
if (depth != 0)
|
||||
return depth;
|
||||
|
||||
if (tdb->format != 1)
|
||||
return 0;
|
||||
return tdb->nesting_depth;
|
||||
}
|
||||
|
||||
/* Transaction failure diagnostics */
|
||||
|
||||
static __inline long __attribute__((__always_inline__, __nodebug__))
|
||||
__TM_is_user_abort (void* const __tdb_ptr)
|
||||
{
|
||||
struct __htm_tdb *tdb = (struct __htm_tdb*)__tdb_ptr;
|
||||
|
||||
if (tdb->format != 1)
|
||||
return 0;
|
||||
|
||||
return !!(tdb->abort_code >= _HTM_FIRST_USER_ABORT_CODE);
|
||||
}
|
||||
|
||||
static __inline long __attribute__((__always_inline__, __nodebug__))
|
||||
__TM_is_named_user_abort (void* const __tdb_ptr, unsigned char* __code)
|
||||
{
|
||||
struct __htm_tdb *tdb = (struct __htm_tdb*)__tdb_ptr;
|
||||
|
||||
if (tdb->format != 1)
|
||||
return 0;
|
||||
|
||||
if (tdb->abort_code >= _HTM_FIRST_USER_ABORT_CODE)
|
||||
{
|
||||
*__code = tdb->abort_code - _HTM_FIRST_USER_ABORT_CODE;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static __inline long __attribute__((__always_inline__, __nodebug__))
|
||||
__TM_is_illegal (void* const __tdb_ptr)
|
||||
{
|
||||
struct __htm_tdb *tdb = (struct __htm_tdb*)__tdb_ptr;
|
||||
|
||||
return (tdb->format == 1
|
||||
&& (tdb->abort_code == 4 /* unfiltered program interruption */
|
||||
|| tdb->abort_code == 11 /* restricted instruction */));
|
||||
}
|
||||
|
||||
static __inline long __attribute__((__always_inline__, __nodebug__))
|
||||
__TM_is_footprint_exceeded (void* const __tdb_ptr)
|
||||
{
|
||||
struct __htm_tdb *tdb = (struct __htm_tdb*)__tdb_ptr;
|
||||
|
||||
return (tdb->format == 1
|
||||
&& (tdb->abort_code == 7 /* fetch overflow */
|
||||
|| tdb->abort_code == 8 /* store overflow */));
|
||||
}
|
||||
|
||||
static __inline long __attribute__((__always_inline__, __nodebug__))
|
||||
__TM_is_nested_too_deep (void* const __tdb_ptr)
|
||||
{
|
||||
struct __htm_tdb *tdb = (struct __htm_tdb*)__tdb_ptr;
|
||||
|
||||
return tdb->format == 1 && tdb->abort_code == 13; /* depth exceeded */
|
||||
}
|
||||
|
||||
static __inline long __attribute__((__always_inline__, __nodebug__))
|
||||
__TM_is_conflict (void* const __tdb_ptr)
|
||||
{
|
||||
struct __htm_tdb *tdb = (struct __htm_tdb*)__tdb_ptr;
|
||||
|
||||
return (tdb->format == 1
|
||||
&& (tdb->abort_code == 9 /* fetch conflict */
|
||||
|| tdb->abort_code == 10 /* store conflict */));
|
||||
}
|
||||
|
||||
static __inline long __attribute__((__always_inline__, __nodebug__))
|
||||
__TM_is_failure_persistent (long const __result)
|
||||
{
|
||||
return __result == _HTM_TBEGIN_PERSISTENT;
|
||||
}
|
||||
|
||||
static __inline long __attribute__((__always_inline__, __nodebug__))
|
||||
__TM_failure_address (void* const __tdb_ptr)
|
||||
{
|
||||
struct __htm_tdb *tdb = (struct __htm_tdb*)__tdb_ptr;
|
||||
return tdb->atia;
|
||||
}
|
||||
|
||||
static __inline long __attribute__((__always_inline__, __nodebug__))
|
||||
__TM_failure_code (void* const __tdb_ptr)
|
||||
{
|
||||
struct __htm_tdb *tdb = (struct __htm_tdb*)__tdb_ptr;
|
||||
|
||||
return tdb->abort_code;
|
||||
}
|
||||
|
||||
#endif /* __s390__ */
|
||||
|
||||
#endif /* __HTMXLINTRIN_H */
|
||||
@@ -0,0 +1,79 @@
|
||||
/* ===-------- ia32intrin.h ---------------------------------------------------===
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
|
||||
#ifndef __X86INTRIN_H
|
||||
#error "Never use <ia32intrin.h> directly; include <x86intrin.h> instead."
|
||||
#endif
|
||||
|
||||
#ifndef __IA32INTRIN_H
|
||||
#define __IA32INTRIN_H
|
||||
|
||||
#ifdef __x86_64__
|
||||
static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__))
|
||||
__readeflags(void)
|
||||
{
|
||||
return __builtin_ia32_readeflags_u64();
|
||||
}
|
||||
|
||||
static __inline__ void __attribute__((__always_inline__, __nodebug__))
|
||||
__writeeflags(unsigned long long __f)
|
||||
{
|
||||
__builtin_ia32_writeeflags_u64(__f);
|
||||
}
|
||||
|
||||
#else /* !__x86_64__ */
|
||||
static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__))
|
||||
__readeflags(void)
|
||||
{
|
||||
return __builtin_ia32_readeflags_u32();
|
||||
}
|
||||
|
||||
static __inline__ void __attribute__((__always_inline__, __nodebug__))
|
||||
__writeeflags(unsigned int __f)
|
||||
{
|
||||
__builtin_ia32_writeeflags_u32(__f);
|
||||
}
|
||||
#endif /* !__x86_64__ */
|
||||
|
||||
static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__))
|
||||
__rdpmc(int __A) {
|
||||
return __builtin_ia32_rdpmc(__A);
|
||||
}
|
||||
|
||||
/* __rdtsc */
|
||||
static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__))
|
||||
__rdtsc(void) {
|
||||
return __builtin_ia32_rdtsc();
|
||||
}
|
||||
|
||||
/* __rdtscp */
|
||||
static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__))
|
||||
__rdtscp(unsigned int *__A) {
|
||||
return __builtin_ia32_rdtscp(__A);
|
||||
}
|
||||
|
||||
#define _rdtsc() __rdtsc()
|
||||
|
||||
#define _rdpmc(A) __rdpmc(A)
|
||||
|
||||
#endif /* __IA32INTRIN_H */
|
||||
@@ -0,0 +1,283 @@
|
||||
/*===---- immintrin.h - Intel intrinsics -----------------------------------===
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
|
||||
#ifndef __IMMINTRIN_H
|
||||
#define __IMMINTRIN_H
|
||||
|
||||
#if !defined(_MSC_VER) || __has_feature(modules) || defined(__MMX__)
|
||||
#include <mmintrin.h>
|
||||
#endif
|
||||
|
||||
#if !defined(_MSC_VER) || __has_feature(modules) || defined(__SSE__)
|
||||
#include <xmmintrin.h>
|
||||
#endif
|
||||
|
||||
#if !defined(_MSC_VER) || __has_feature(modules) || defined(__SSE2__)
|
||||
#include <emmintrin.h>
|
||||
#endif
|
||||
|
||||
#if !defined(_MSC_VER) || __has_feature(modules) || defined(__SSE3__)
|
||||
#include <pmmintrin.h>
|
||||
#endif
|
||||
|
||||
#if !defined(_MSC_VER) || __has_feature(modules) || defined(__SSSE3__)
|
||||
#include <tmmintrin.h>
|
||||
#endif
|
||||
|
||||
#if !defined(_MSC_VER) || __has_feature(modules) || \
|
||||
(defined(__SSE4_2__) || defined(__SSE4_1__))
|
||||
#include <smmintrin.h>
|
||||
#endif
|
||||
|
||||
#if !defined(_MSC_VER) || __has_feature(modules) || \
|
||||
(defined(__AES__) || defined(__PCLMUL__))
|
||||
#include <wmmintrin.h>
|
||||
#endif
|
||||
|
||||
#if !defined(_MSC_VER) || __has_feature(modules) || defined(__CLFLUSHOPT__)
|
||||
#include <clflushoptintrin.h>
|
||||
#endif
|
||||
|
||||
#if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX__)
|
||||
#include <avxintrin.h>
|
||||
#endif
|
||||
|
||||
#if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX2__)
|
||||
#include <avx2intrin.h>
|
||||
|
||||
/* The 256-bit versions of functions in f16cintrin.h.
|
||||
Intel documents these as being in immintrin.h, and
|
||||
they depend on typedefs from avxintrin.h. */
|
||||
|
||||
#define _mm256_cvtps_ph(a, imm) __extension__ ({ \
|
||||
(__m128i)__builtin_ia32_vcvtps2ph256((__v8sf)(__m256)(a), (imm)); })
|
||||
|
||||
static __inline __m256 __attribute__((__always_inline__, __nodebug__, __target__("f16c")))
|
||||
_mm256_cvtph_ps(__m128i __a)
|
||||
{
|
||||
return (__m256)__builtin_ia32_vcvtph2ps256((__v8hi)__a);
|
||||
}
|
||||
#endif /* __AVX2__ */
|
||||
|
||||
#if !defined(_MSC_VER) || __has_feature(modules) || defined(__BMI__)
|
||||
#include <bmiintrin.h>
|
||||
#endif
|
||||
|
||||
#if !defined(_MSC_VER) || __has_feature(modules) || defined(__BMI2__)
|
||||
#include <bmi2intrin.h>
|
||||
#endif
|
||||
|
||||
#if !defined(_MSC_VER) || __has_feature(modules) || defined(__LZCNT__)
|
||||
#include <lzcntintrin.h>
|
||||
#endif
|
||||
|
||||
#if !defined(_MSC_VER) || __has_feature(modules) || defined(__FMA__)
|
||||
#include <fmaintrin.h>
|
||||
#endif
|
||||
|
||||
#if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512F__)
|
||||
#include <avx512fintrin.h>
|
||||
#endif
|
||||
|
||||
#if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512VL__)
|
||||
#include <avx512vlintrin.h>
|
||||
#endif
|
||||
|
||||
#if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512BW__)
|
||||
#include <avx512bwintrin.h>
|
||||
#endif
|
||||
|
||||
#if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512CD__)
|
||||
#include <avx512cdintrin.h>
|
||||
#endif
|
||||
|
||||
#if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512DQ__)
|
||||
#include <avx512dqintrin.h>
|
||||
#endif
|
||||
|
||||
#if !defined(_MSC_VER) || __has_feature(modules) || \
|
||||
(defined(__AVX512VL__) && defined(__AVX512BW__))
|
||||
#include <avx512vlbwintrin.h>
|
||||
#endif
|
||||
|
||||
#if !defined(_MSC_VER) || __has_feature(modules) || \
|
||||
(defined(__AVX512VL__) && defined(__AVX512CD__))
|
||||
#include <avx512vlcdintrin.h>
|
||||
#endif
|
||||
|
||||
#if !defined(_MSC_VER) || __has_feature(modules) || \
|
||||
(defined(__AVX512VL__) && defined(__AVX512DQ__))
|
||||
#include <avx512vldqintrin.h>
|
||||
#endif
|
||||
|
||||
#if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512ER__)
|
||||
#include <avx512erintrin.h>
|
||||
#endif
|
||||
|
||||
#if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512IFMA__)
|
||||
#include <avx512ifmaintrin.h>
|
||||
#endif
|
||||
|
||||
#if !defined(_MSC_VER) || __has_feature(modules) || \
|
||||
(defined(__AVX512IFMA__) && defined(__AVX512VL__))
|
||||
#include <avx512ifmavlintrin.h>
|
||||
#endif
|
||||
|
||||
#if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512VBMI__)
|
||||
#include <avx512vbmiintrin.h>
|
||||
#endif
|
||||
|
||||
#if !defined(_MSC_VER) || __has_feature(modules) || \
|
||||
(defined(__AVX512VBMI__) && defined(__AVX512VL__))
|
||||
#include <avx512vbmivlintrin.h>
|
||||
#endif
|
||||
|
||||
#if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512PF__)
|
||||
#include <avx512pfintrin.h>
|
||||
#endif
|
||||
|
||||
#if !defined(_MSC_VER) || __has_feature(modules) || defined(__PKU__)
|
||||
#include <pkuintrin.h>
|
||||
#endif
|
||||
|
||||
#if !defined(_MSC_VER) || __has_feature(modules) || defined(__RDRND__)
|
||||
static __inline__ int __attribute__((__always_inline__, __nodebug__, __target__("rdrnd")))
|
||||
_rdrand16_step(unsigned short *__p)
|
||||
{
|
||||
return __builtin_ia32_rdrand16_step(__p);
|
||||
}
|
||||
|
||||
static __inline__ int __attribute__((__always_inline__, __nodebug__, __target__("rdrnd")))
|
||||
_rdrand32_step(unsigned int *__p)
|
||||
{
|
||||
return __builtin_ia32_rdrand32_step(__p);
|
||||
}
|
||||
|
||||
/* __bit_scan_forward */
|
||||
static __inline__ int __attribute__((__always_inline__, __nodebug__))
|
||||
_bit_scan_forward(int __A) {
|
||||
return __builtin_ctz(__A);
|
||||
}
|
||||
|
||||
/* __bit_scan_reverse */
|
||||
static __inline__ int __attribute__((__always_inline__, __nodebug__))
|
||||
_bit_scan_reverse(int __A) {
|
||||
return 31 - __builtin_clz(__A);
|
||||
}
|
||||
|
||||
#ifdef __x86_64__
|
||||
static __inline__ int __attribute__((__always_inline__, __nodebug__, __target__("rdrnd")))
|
||||
_rdrand64_step(unsigned long long *__p)
|
||||
{
|
||||
return __builtin_ia32_rdrand64_step(__p);
|
||||
}
|
||||
#endif
|
||||
#endif /* __RDRND__ */
|
||||
|
||||
#if !defined(_MSC_VER) || __has_feature(modules) || defined(__FSGSBASE__)
|
||||
#ifdef __x86_64__
|
||||
static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase")))
|
||||
_readfsbase_u32(void)
|
||||
{
|
||||
return __builtin_ia32_rdfsbase32();
|
||||
}
|
||||
|
||||
static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase")))
|
||||
_readfsbase_u64(void)
|
||||
{
|
||||
return __builtin_ia32_rdfsbase64();
|
||||
}
|
||||
|
||||
static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase")))
|
||||
_readgsbase_u32(void)
|
||||
{
|
||||
return __builtin_ia32_rdgsbase32();
|
||||
}
|
||||
|
||||
static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase")))
|
||||
_readgsbase_u64(void)
|
||||
{
|
||||
return __builtin_ia32_rdgsbase64();
|
||||
}
|
||||
|
||||
static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase")))
|
||||
_writefsbase_u32(unsigned int __V)
|
||||
{
|
||||
return __builtin_ia32_wrfsbase32(__V);
|
||||
}
|
||||
|
||||
static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase")))
|
||||
_writefsbase_u64(unsigned long long __V)
|
||||
{
|
||||
return __builtin_ia32_wrfsbase64(__V);
|
||||
}
|
||||
|
||||
static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase")))
|
||||
_writegsbase_u32(unsigned int __V)
|
||||
{
|
||||
return __builtin_ia32_wrgsbase32(__V);
|
||||
}
|
||||
|
||||
static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase")))
|
||||
_writegsbase_u64(unsigned long long __V)
|
||||
{
|
||||
return __builtin_ia32_wrgsbase64(__V);
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif /* __FSGSBASE__ */
|
||||
|
||||
#if !defined(_MSC_VER) || __has_feature(modules) || defined(__RTM__)
|
||||
#include <rtmintrin.h>
|
||||
#include <xtestintrin.h>
|
||||
#endif
|
||||
|
||||
#if !defined(_MSC_VER) || __has_feature(modules) || defined(__SHA__)
|
||||
#include <shaintrin.h>
|
||||
#endif
|
||||
|
||||
#if !defined(_MSC_VER) || __has_feature(modules) || defined(__FXSR__)
|
||||
#include <fxsrintrin.h>
|
||||
#endif
|
||||
|
||||
#if !defined(_MSC_VER) || __has_feature(modules) || defined(__XSAVE__)
|
||||
#include <xsaveintrin.h>
|
||||
#endif
|
||||
|
||||
#if !defined(_MSC_VER) || __has_feature(modules) || defined(__XSAVEOPT__)
|
||||
#include <xsaveoptintrin.h>
|
||||
#endif
|
||||
|
||||
#if !defined(_MSC_VER) || __has_feature(modules) || defined(__XSAVEC__)
|
||||
#include <xsavecintrin.h>
|
||||
#endif
|
||||
|
||||
#if !defined(_MSC_VER) || __has_feature(modules) || defined(__XSAVES__)
|
||||
#include <xsavesintrin.h>
|
||||
#endif
|
||||
|
||||
/* Some intrinsics inside adxintrin.h are available only on processors with ADX,
|
||||
* whereas others are also available at all times. */
|
||||
#include <adxintrin.h>
|
||||
|
||||
#endif /* __IMMINTRIN_H */
|
||||
@@ -0,0 +1,957 @@
|
||||
/* ===-------- intrin.h ---------------------------------------------------===
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
|
||||
/* Only include this if we're compiling for the windows platform. */
|
||||
#ifndef _MSC_VER
|
||||
#include_next <intrin.h>
|
||||
#else
|
||||
|
||||
#ifndef __INTRIN_H
|
||||
#define __INTRIN_H
|
||||
|
||||
/* First include the standard intrinsics. */
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#include <x86intrin.h>
|
||||
#endif
|
||||
|
||||
/* For the definition of jmp_buf. */
|
||||
#if __STDC_HOSTED__
|
||||
#include <setjmp.h>
|
||||
#endif
|
||||
|
||||
/* Define the default attributes for the functions in this file. */
|
||||
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(__MMX__)
|
||||
/* And the random ones that aren't in those files. */
|
||||
__m64 _m_from_float(float);
|
||||
float _m_to_float(__m64);
|
||||
#endif
|
||||
|
||||
/* Other assorted instruction intrinsics. */
|
||||
void __addfsbyte(unsigned long, unsigned char);
|
||||
void __addfsdword(unsigned long, unsigned long);
|
||||
void __addfsword(unsigned long, unsigned short);
|
||||
void __code_seg(const char *);
|
||||
static __inline__
|
||||
void __cpuid(int[4], int);
|
||||
static __inline__
|
||||
void __cpuidex(int[4], int, int);
|
||||
void __debugbreak(void);
|
||||
__int64 __emul(int, int);
|
||||
unsigned __int64 __emulu(unsigned int, unsigned int);
|
||||
void __cdecl __fastfail(unsigned int);
|
||||
unsigned int __getcallerseflags(void);
|
||||
static __inline__
|
||||
void __halt(void);
|
||||
unsigned char __inbyte(unsigned short);
|
||||
void __inbytestring(unsigned short, unsigned char *, unsigned long);
|
||||
void __incfsbyte(unsigned long);
|
||||
void __incfsdword(unsigned long);
|
||||
void __incfsword(unsigned long);
|
||||
unsigned long __indword(unsigned short);
|
||||
void __indwordstring(unsigned short, unsigned long *, unsigned long);
|
||||
void __int2c(void);
|
||||
void __invlpg(void *);
|
||||
unsigned short __inword(unsigned short);
|
||||
void __inwordstring(unsigned short, unsigned short *, unsigned long);
|
||||
void __lidt(void *);
|
||||
unsigned __int64 __ll_lshift(unsigned __int64, int);
|
||||
__int64 __ll_rshift(__int64, int);
|
||||
void __llwpcb(void *);
|
||||
unsigned char __lwpins32(unsigned int, unsigned int, unsigned int);
|
||||
void __lwpval32(unsigned int, unsigned int, unsigned int);
|
||||
unsigned int __lzcnt(unsigned int);
|
||||
unsigned short __lzcnt16(unsigned short);
|
||||
static __inline__
|
||||
void __movsb(unsigned char *, unsigned char const *, size_t);
|
||||
static __inline__
|
||||
void __movsd(unsigned long *, unsigned long const *, size_t);
|
||||
static __inline__
|
||||
void __movsw(unsigned short *, unsigned short const *, size_t);
|
||||
void __nop(void);
|
||||
void __nvreg_restore_fence(void);
|
||||
void __nvreg_save_fence(void);
|
||||
void __outbyte(unsigned short, unsigned char);
|
||||
void __outbytestring(unsigned short, unsigned char *, unsigned long);
|
||||
void __outdword(unsigned short, unsigned long);
|
||||
void __outdwordstring(unsigned short, unsigned long *, unsigned long);
|
||||
void __outword(unsigned short, unsigned short);
|
||||
void __outwordstring(unsigned short, unsigned short *, unsigned long);
|
||||
static __inline__
|
||||
unsigned int __popcnt(unsigned int);
|
||||
static __inline__
|
||||
unsigned short __popcnt16(unsigned short);
|
||||
unsigned long __readcr0(void);
|
||||
unsigned long __readcr2(void);
|
||||
static __inline__
|
||||
unsigned long __readcr3(void);
|
||||
unsigned long __readcr4(void);
|
||||
unsigned long __readcr8(void);
|
||||
unsigned int __readdr(unsigned int);
|
||||
#ifdef __i386__
|
||||
static __inline__
|
||||
unsigned char __readfsbyte(unsigned long);
|
||||
static __inline__
|
||||
unsigned long __readfsdword(unsigned long);
|
||||
static __inline__
|
||||
unsigned __int64 __readfsqword(unsigned long);
|
||||
static __inline__
|
||||
unsigned short __readfsword(unsigned long);
|
||||
#endif
|
||||
static __inline__
|
||||
unsigned __int64 __readmsr(unsigned long);
|
||||
unsigned __int64 __readpmc(unsigned long);
|
||||
unsigned long __segmentlimit(unsigned long);
|
||||
void __sidt(void *);
|
||||
void *__slwpcb(void);
|
||||
static __inline__
|
||||
void __stosb(unsigned char *, unsigned char, size_t);
|
||||
static __inline__
|
||||
void __stosd(unsigned long *, unsigned long, size_t);
|
||||
static __inline__
|
||||
void __stosw(unsigned short *, unsigned short, size_t);
|
||||
void __svm_clgi(void);
|
||||
void __svm_invlpga(void *, int);
|
||||
void __svm_skinit(int);
|
||||
void __svm_stgi(void);
|
||||
void __svm_vmload(size_t);
|
||||
void __svm_vmrun(size_t);
|
||||
void __svm_vmsave(size_t);
|
||||
void __ud2(void);
|
||||
unsigned __int64 __ull_rshift(unsigned __int64, int);
|
||||
void __vmx_off(void);
|
||||
void __vmx_vmptrst(unsigned __int64 *);
|
||||
void __wbinvd(void);
|
||||
void __writecr0(unsigned int);
|
||||
static __inline__
|
||||
void __writecr3(unsigned int);
|
||||
void __writecr4(unsigned int);
|
||||
void __writecr8(unsigned int);
|
||||
void __writedr(unsigned int, unsigned int);
|
||||
void __writefsbyte(unsigned long, unsigned char);
|
||||
void __writefsdword(unsigned long, unsigned long);
|
||||
void __writefsqword(unsigned long, unsigned __int64);
|
||||
void __writefsword(unsigned long, unsigned short);
|
||||
void __writemsr(unsigned long, unsigned __int64);
|
||||
static __inline__
|
||||
void *_AddressOfReturnAddress(void);
|
||||
static __inline__
|
||||
unsigned char _BitScanForward(unsigned long *_Index, unsigned long _Mask);
|
||||
static __inline__
|
||||
unsigned char _BitScanReverse(unsigned long *_Index, unsigned long _Mask);
|
||||
static __inline__
|
||||
unsigned char _bittest(long const *, long);
|
||||
static __inline__
|
||||
unsigned char _bittestandcomplement(long *, long);
|
||||
static __inline__
|
||||
unsigned char _bittestandreset(long *, long);
|
||||
static __inline__
|
||||
unsigned char _bittestandset(long *, long);
|
||||
unsigned __int64 __cdecl _byteswap_uint64(unsigned __int64);
|
||||
unsigned long __cdecl _byteswap_ulong(unsigned long);
|
||||
unsigned short __cdecl _byteswap_ushort(unsigned short);
|
||||
void __cdecl _disable(void);
|
||||
void __cdecl _enable(void);
|
||||
long _InterlockedAddLargeStatistic(__int64 volatile *_Addend, long _Value);
|
||||
static __inline__
|
||||
long _InterlockedAnd(long volatile *_Value, long _Mask);
|
||||
static __inline__
|
||||
short _InterlockedAnd16(short volatile *_Value, short _Mask);
|
||||
static __inline__
|
||||
char _InterlockedAnd8(char volatile *_Value, char _Mask);
|
||||
unsigned char _interlockedbittestandreset(long volatile *, long);
|
||||
static __inline__
|
||||
unsigned char _interlockedbittestandset(long volatile *, long);
|
||||
static __inline__
|
||||
long __cdecl _InterlockedCompareExchange(long volatile *_Destination,
|
||||
long _Exchange, long _Comparand);
|
||||
long _InterlockedCompareExchange_HLEAcquire(long volatile *, long, long);
|
||||
long _InterlockedCompareExchange_HLERelease(long volatile *, long, long);
|
||||
static __inline__
|
||||
short _InterlockedCompareExchange16(short volatile *_Destination,
|
||||
short _Exchange, short _Comparand);
|
||||
static __inline__
|
||||
__int64 _InterlockedCompareExchange64(__int64 volatile *_Destination,
|
||||
__int64 _Exchange, __int64 _Comparand);
|
||||
__int64 _InterlockedcompareExchange64_HLEAcquire(__int64 volatile *, __int64,
|
||||
__int64);
|
||||
__int64 _InterlockedCompareExchange64_HLERelease(__int64 volatile *, __int64,
|
||||
__int64);
|
||||
static __inline__
|
||||
char _InterlockedCompareExchange8(char volatile *_Destination, char _Exchange,
|
||||
char _Comparand);
|
||||
void *_InterlockedCompareExchangePointer_HLEAcquire(void *volatile *, void *,
|
||||
void *);
|
||||
void *_InterlockedCompareExchangePointer_HLERelease(void *volatile *, void *,
|
||||
void *);
|
||||
static __inline__
|
||||
long __cdecl _InterlockedDecrement(long volatile *_Addend);
|
||||
static __inline__
|
||||
short _InterlockedDecrement16(short volatile *_Addend);
|
||||
long _InterlockedExchange(long volatile *_Target, long _Value);
|
||||
static __inline__
|
||||
short _InterlockedExchange16(short volatile *_Target, short _Value);
|
||||
static __inline__
|
||||
char _InterlockedExchange8(char volatile *_Target, char _Value);
|
||||
static __inline__
|
||||
long __cdecl _InterlockedExchangeAdd(long volatile *_Addend, long _Value);
|
||||
long _InterlockedExchangeAdd_HLEAcquire(long volatile *, long);
|
||||
long _InterlockedExchangeAdd_HLERelease(long volatile *, long);
|
||||
static __inline__
|
||||
short _InterlockedExchangeAdd16(short volatile *_Addend, short _Value);
|
||||
__int64 _InterlockedExchangeAdd64_HLEAcquire(__int64 volatile *, __int64);
|
||||
__int64 _InterlockedExchangeAdd64_HLERelease(__int64 volatile *, __int64);
|
||||
static __inline__
|
||||
char _InterlockedExchangeAdd8(char volatile *_Addend, char _Value);
|
||||
static __inline__
|
||||
long __cdecl _InterlockedIncrement(long volatile *_Addend);
|
||||
static __inline__
|
||||
short _InterlockedIncrement16(short volatile *_Addend);
|
||||
static __inline__
|
||||
long _InterlockedOr(long volatile *_Value, long _Mask);
|
||||
static __inline__
|
||||
short _InterlockedOr16(short volatile *_Value, short _Mask);
|
||||
static __inline__
|
||||
char _InterlockedOr8(char volatile *_Value, char _Mask);
|
||||
static __inline__
|
||||
long _InterlockedXor(long volatile *_Value, long _Mask);
|
||||
static __inline__
|
||||
short _InterlockedXor16(short volatile *_Value, short _Mask);
|
||||
static __inline__
|
||||
char _InterlockedXor8(char volatile *_Value, char _Mask);
|
||||
void __cdecl _invpcid(unsigned int, void *);
|
||||
static __inline__
|
||||
unsigned long __cdecl _lrotl(unsigned long, int);
|
||||
static __inline__
|
||||
unsigned long __cdecl _lrotr(unsigned long, int);
|
||||
static __inline__
|
||||
void _ReadBarrier(void);
|
||||
static __inline__
|
||||
void _ReadWriteBarrier(void);
|
||||
static __inline__
|
||||
void *_ReturnAddress(void);
|
||||
unsigned int _rorx_u32(unsigned int, const unsigned int);
|
||||
static __inline__
|
||||
unsigned int __cdecl _rotl(unsigned int _Value, int _Shift);
|
||||
static __inline__
|
||||
unsigned short _rotl16(unsigned short _Value, unsigned char _Shift);
|
||||
static __inline__
|
||||
unsigned __int64 __cdecl _rotl64(unsigned __int64 _Value, int _Shift);
|
||||
static __inline__
|
||||
unsigned char _rotl8(unsigned char _Value, unsigned char _Shift);
|
||||
static __inline__
|
||||
unsigned int __cdecl _rotr(unsigned int _Value, int _Shift);
|
||||
static __inline__
|
||||
unsigned short _rotr16(unsigned short _Value, unsigned char _Shift);
|
||||
static __inline__
|
||||
unsigned __int64 __cdecl _rotr64(unsigned __int64 _Value, int _Shift);
|
||||
static __inline__
|
||||
unsigned char _rotr8(unsigned char _Value, unsigned char _Shift);
|
||||
int _sarx_i32(int, unsigned int);
|
||||
#if __STDC_HOSTED__
|
||||
int __cdecl _setjmp(jmp_buf);
|
||||
#endif
|
||||
unsigned int _shlx_u32(unsigned int, unsigned int);
|
||||
unsigned int _shrx_u32(unsigned int, unsigned int);
|
||||
void _Store_HLERelease(long volatile *, long);
|
||||
void _Store64_HLERelease(__int64 volatile *, __int64);
|
||||
void _StorePointer_HLERelease(void *volatile *, void *);
|
||||
static __inline__
|
||||
void _WriteBarrier(void);
|
||||
unsigned __int32 xbegin(void);
|
||||
void _xend(void);
|
||||
static __inline__
|
||||
#define _XCR_XFEATURE_ENABLED_MASK 0
|
||||
unsigned __int64 __cdecl _xgetbv(unsigned int);
|
||||
void __cdecl _xsetbv(unsigned int, unsigned __int64);
|
||||
|
||||
/* These additional intrinsics are turned on in x64/amd64/x86_64 mode. */
|
||||
#ifdef __x86_64__
|
||||
void __addgsbyte(unsigned long, unsigned char);
|
||||
void __addgsdword(unsigned long, unsigned long);
|
||||
void __addgsqword(unsigned long, unsigned __int64);
|
||||
void __addgsword(unsigned long, unsigned short);
|
||||
static __inline__
|
||||
void __faststorefence(void);
|
||||
void __incgsbyte(unsigned long);
|
||||
void __incgsdword(unsigned long);
|
||||
void __incgsqword(unsigned long);
|
||||
void __incgsword(unsigned long);
|
||||
unsigned char __lwpins64(unsigned __int64, unsigned int, unsigned int);
|
||||
void __lwpval64(unsigned __int64, unsigned int, unsigned int);
|
||||
unsigned __int64 __lzcnt64(unsigned __int64);
|
||||
static __inline__
|
||||
void __movsq(unsigned long long *, unsigned long long const *, size_t);
|
||||
__int64 __mulh(__int64, __int64);
|
||||
static __inline__
|
||||
unsigned __int64 __popcnt64(unsigned __int64);
|
||||
static __inline__
|
||||
unsigned char __readgsbyte(unsigned long);
|
||||
static __inline__
|
||||
unsigned long __readgsdword(unsigned long);
|
||||
static __inline__
|
||||
unsigned __int64 __readgsqword(unsigned long);
|
||||
unsigned short __readgsword(unsigned long);
|
||||
unsigned __int64 __shiftleft128(unsigned __int64 _LowPart,
|
||||
unsigned __int64 _HighPart,
|
||||
unsigned char _Shift);
|
||||
unsigned __int64 __shiftright128(unsigned __int64 _LowPart,
|
||||
unsigned __int64 _HighPart,
|
||||
unsigned char _Shift);
|
||||
static __inline__
|
||||
void __stosq(unsigned __int64 *, unsigned __int64, size_t);
|
||||
unsigned char __vmx_on(unsigned __int64 *);
|
||||
unsigned char __vmx_vmclear(unsigned __int64 *);
|
||||
unsigned char __vmx_vmlaunch(void);
|
||||
unsigned char __vmx_vmptrld(unsigned __int64 *);
|
||||
unsigned char __vmx_vmread(size_t, size_t *);
|
||||
unsigned char __vmx_vmresume(void);
|
||||
unsigned char __vmx_vmwrite(size_t, size_t);
|
||||
void __writegsbyte(unsigned long, unsigned char);
|
||||
void __writegsdword(unsigned long, unsigned long);
|
||||
void __writegsqword(unsigned long, unsigned __int64);
|
||||
void __writegsword(unsigned long, unsigned short);
|
||||
static __inline__
|
||||
unsigned char _BitScanForward64(unsigned long *_Index, unsigned __int64 _Mask);
|
||||
static __inline__
|
||||
unsigned char _BitScanReverse64(unsigned long *_Index, unsigned __int64 _Mask);
|
||||
static __inline__
|
||||
unsigned char _bittest64(__int64 const *, __int64);
|
||||
static __inline__
|
||||
unsigned char _bittestandcomplement64(__int64 *, __int64);
|
||||
static __inline__
|
||||
unsigned char _bittestandreset64(__int64 *, __int64);
|
||||
static __inline__
|
||||
unsigned char _bittestandset64(__int64 *, __int64);
|
||||
unsigned __int64 __cdecl _byteswap_uint64(unsigned __int64);
|
||||
long _InterlockedAnd_np(long volatile *_Value, long _Mask);
|
||||
short _InterlockedAnd16_np(short volatile *_Value, short _Mask);
|
||||
__int64 _InterlockedAnd64_np(__int64 volatile *_Value, __int64 _Mask);
|
||||
char _InterlockedAnd8_np(char volatile *_Value, char _Mask);
|
||||
unsigned char _interlockedbittestandreset64(__int64 volatile *, __int64);
|
||||
static __inline__
|
||||
unsigned char _interlockedbittestandset64(__int64 volatile *, __int64);
|
||||
long _InterlockedCompareExchange_np(long volatile *_Destination, long _Exchange,
|
||||
long _Comparand);
|
||||
unsigned char _InterlockedCompareExchange128(__int64 volatile *_Destination,
|
||||
__int64 _ExchangeHigh,
|
||||
__int64 _ExchangeLow,
|
||||
__int64 *_CompareandResult);
|
||||
unsigned char _InterlockedCompareExchange128_np(__int64 volatile *_Destination,
|
||||
__int64 _ExchangeHigh,
|
||||
__int64 _ExchangeLow,
|
||||
__int64 *_ComparandResult);
|
||||
short _InterlockedCompareExchange16_np(short volatile *_Destination,
|
||||
short _Exchange, short _Comparand);
|
||||
__int64 _InterlockedCompareExchange64_HLEAcquire(__int64 volatile *, __int64,
|
||||
__int64);
|
||||
__int64 _InterlockedCompareExchange64_HLERelease(__int64 volatile *, __int64,
|
||||
__int64);
|
||||
__int64 _InterlockedCompareExchange64_np(__int64 volatile *_Destination,
|
||||
__int64 _Exchange, __int64 _Comparand);
|
||||
void *_InterlockedCompareExchangePointer(void *volatile *_Destination,
|
||||
void *_Exchange, void *_Comparand);
|
||||
void *_InterlockedCompareExchangePointer_np(void *volatile *_Destination,
|
||||
void *_Exchange, void *_Comparand);
|
||||
static __inline__
|
||||
__int64 _InterlockedDecrement64(__int64 volatile *_Addend);
|
||||
static __inline__
|
||||
__int64 _InterlockedExchange64(__int64 volatile *_Target, __int64 _Value);
|
||||
static __inline__
|
||||
__int64 _InterlockedExchangeAdd64(__int64 volatile *_Addend, __int64 _Value);
|
||||
void *_InterlockedExchangePointer(void *volatile *_Target, void *_Value);
|
||||
static __inline__
|
||||
__int64 _InterlockedIncrement64(__int64 volatile *_Addend);
|
||||
long _InterlockedOr_np(long volatile *_Value, long _Mask);
|
||||
short _InterlockedOr16_np(short volatile *_Value, short _Mask);
|
||||
static __inline__
|
||||
__int64 _InterlockedOr64(__int64 volatile *_Value, __int64 _Mask);
|
||||
__int64 _InterlockedOr64_np(__int64 volatile *_Value, __int64 _Mask);
|
||||
char _InterlockedOr8_np(char volatile *_Value, char _Mask);
|
||||
long _InterlockedXor_np(long volatile *_Value, long _Mask);
|
||||
short _InterlockedXor16_np(short volatile *_Value, short _Mask);
|
||||
static __inline__
|
||||
__int64 _InterlockedXor64(__int64 volatile *_Value, __int64 _Mask);
|
||||
__int64 _InterlockedXor64_np(__int64 volatile *_Value, __int64 _Mask);
|
||||
char _InterlockedXor8_np(char volatile *_Value, char _Mask);
|
||||
static __inline__
|
||||
__int64 _mul128(__int64 _Multiplier, __int64 _Multiplicand,
|
||||
__int64 *_HighProduct);
|
||||
unsigned __int64 _rorx_u64(unsigned __int64, const unsigned int);
|
||||
__int64 _sarx_i64(__int64, unsigned int);
|
||||
#if __STDC_HOSTED__
|
||||
int __cdecl _setjmpex(jmp_buf);
|
||||
#endif
|
||||
unsigned __int64 _shlx_u64(unsigned __int64, unsigned int);
|
||||
unsigned __int64 _shrx_u64(unsigned __int64, unsigned int);
|
||||
/*
|
||||
* Multiply two 64-bit integers and obtain a 64-bit result.
|
||||
* The low-half is returned directly and the high half is in an out parameter.
|
||||
*/
|
||||
static __inline__ unsigned __int64 __DEFAULT_FN_ATTRS
|
||||
_umul128(unsigned __int64 _Multiplier, unsigned __int64 _Multiplicand,
|
||||
unsigned __int64 *_HighProduct) {
|
||||
unsigned __int128 _FullProduct =
|
||||
(unsigned __int128)_Multiplier * (unsigned __int128)_Multiplicand;
|
||||
*_HighProduct = _FullProduct >> 64;
|
||||
return _FullProduct;
|
||||
}
|
||||
static __inline__ unsigned __int64 __DEFAULT_FN_ATTRS
|
||||
__umulh(unsigned __int64 _Multiplier, unsigned __int64 _Multiplicand) {
|
||||
unsigned __int128 _FullProduct =
|
||||
(unsigned __int128)_Multiplier * (unsigned __int128)_Multiplicand;
|
||||
return _FullProduct >> 64;
|
||||
}
|
||||
|
||||
#endif /* __x86_64__ */
|
||||
|
||||
/*----------------------------------------------------------------------------*\
|
||||
|* Multiplication
|
||||
\*----------------------------------------------------------------------------*/
|
||||
static __inline__ __int64 __DEFAULT_FN_ATTRS
|
||||
__emul(int __in1, int __in2) {
|
||||
return (__int64)__in1 * (__int64)__in2;
|
||||
}
|
||||
static __inline__ unsigned __int64 __DEFAULT_FN_ATTRS
|
||||
__emulu(unsigned int __in1, unsigned int __in2) {
|
||||
return (unsigned __int64)__in1 * (unsigned __int64)__in2;
|
||||
}
|
||||
/*----------------------------------------------------------------------------*\
|
||||
|* Bit Twiddling
|
||||
\*----------------------------------------------------------------------------*/
|
||||
static __inline__ unsigned char __DEFAULT_FN_ATTRS
|
||||
_rotl8(unsigned char _Value, unsigned char _Shift) {
|
||||
_Shift &= 0x7;
|
||||
return _Shift ? (_Value << _Shift) | (_Value >> (8 - _Shift)) : _Value;
|
||||
}
|
||||
static __inline__ unsigned char __DEFAULT_FN_ATTRS
|
||||
_rotr8(unsigned char _Value, unsigned char _Shift) {
|
||||
_Shift &= 0x7;
|
||||
return _Shift ? (_Value >> _Shift) | (_Value << (8 - _Shift)) : _Value;
|
||||
}
|
||||
static __inline__ unsigned short __DEFAULT_FN_ATTRS
|
||||
_rotl16(unsigned short _Value, unsigned char _Shift) {
|
||||
_Shift &= 0xf;
|
||||
return _Shift ? (_Value << _Shift) | (_Value >> (16 - _Shift)) : _Value;
|
||||
}
|
||||
static __inline__ unsigned short __DEFAULT_FN_ATTRS
|
||||
_rotr16(unsigned short _Value, unsigned char _Shift) {
|
||||
_Shift &= 0xf;
|
||||
return _Shift ? (_Value >> _Shift) | (_Value << (16 - _Shift)) : _Value;
|
||||
}
|
||||
static __inline__ unsigned int __DEFAULT_FN_ATTRS
|
||||
_rotl(unsigned int _Value, int _Shift) {
|
||||
_Shift &= 0x1f;
|
||||
return _Shift ? (_Value << _Shift) | (_Value >> (32 - _Shift)) : _Value;
|
||||
}
|
||||
static __inline__ unsigned int __DEFAULT_FN_ATTRS
|
||||
_rotr(unsigned int _Value, int _Shift) {
|
||||
_Shift &= 0x1f;
|
||||
return _Shift ? (_Value >> _Shift) | (_Value << (32 - _Shift)) : _Value;
|
||||
}
|
||||
static __inline__ unsigned long __DEFAULT_FN_ATTRS
|
||||
_lrotl(unsigned long _Value, int _Shift) {
|
||||
_Shift &= 0x1f;
|
||||
return _Shift ? (_Value << _Shift) | (_Value >> (32 - _Shift)) : _Value;
|
||||
}
|
||||
static __inline__ unsigned long __DEFAULT_FN_ATTRS
|
||||
_lrotr(unsigned long _Value, int _Shift) {
|
||||
_Shift &= 0x1f;
|
||||
return _Shift ? (_Value >> _Shift) | (_Value << (32 - _Shift)) : _Value;
|
||||
}
|
||||
static
|
||||
__inline__ unsigned __int64 __DEFAULT_FN_ATTRS
|
||||
_rotl64(unsigned __int64 _Value, int _Shift) {
|
||||
_Shift &= 0x3f;
|
||||
return _Shift ? (_Value << _Shift) | (_Value >> (64 - _Shift)) : _Value;
|
||||
}
|
||||
static
|
||||
__inline__ unsigned __int64 __DEFAULT_FN_ATTRS
|
||||
_rotr64(unsigned __int64 _Value, int _Shift) {
|
||||
_Shift &= 0x3f;
|
||||
return _Shift ? (_Value >> _Shift) | (_Value << (64 - _Shift)) : _Value;
|
||||
}
|
||||
/*----------------------------------------------------------------------------*\
|
||||
|* Bit Counting and Testing
|
||||
\*----------------------------------------------------------------------------*/
|
||||
static __inline__ unsigned char __DEFAULT_FN_ATTRS
|
||||
_BitScanForward(unsigned long *_Index, unsigned long _Mask) {
|
||||
if (!_Mask)
|
||||
return 0;
|
||||
*_Index = __builtin_ctzl(_Mask);
|
||||
return 1;
|
||||
}
|
||||
static __inline__ unsigned char __DEFAULT_FN_ATTRS
|
||||
_BitScanReverse(unsigned long *_Index, unsigned long _Mask) {
|
||||
if (!_Mask)
|
||||
return 0;
|
||||
*_Index = 31 - __builtin_clzl(_Mask);
|
||||
return 1;
|
||||
}
|
||||
static __inline__ unsigned short __DEFAULT_FN_ATTRS
|
||||
__popcnt16(unsigned short _Value) {
|
||||
return __builtin_popcount((int)_Value);
|
||||
}
|
||||
static __inline__ unsigned int __DEFAULT_FN_ATTRS
|
||||
__popcnt(unsigned int _Value) {
|
||||
return __builtin_popcount(_Value);
|
||||
}
|
||||
static __inline__ unsigned char __DEFAULT_FN_ATTRS
|
||||
_bittest(long const *_BitBase, long _BitPos) {
|
||||
return (*_BitBase >> _BitPos) & 1;
|
||||
}
|
||||
static __inline__ unsigned char __DEFAULT_FN_ATTRS
|
||||
_bittestandcomplement(long *_BitBase, long _BitPos) {
|
||||
unsigned char _Res = (*_BitBase >> _BitPos) & 1;
|
||||
*_BitBase = *_BitBase ^ (1 << _BitPos);
|
||||
return _Res;
|
||||
}
|
||||
static __inline__ unsigned char __DEFAULT_FN_ATTRS
|
||||
_bittestandreset(long *_BitBase, long _BitPos) {
|
||||
unsigned char _Res = (*_BitBase >> _BitPos) & 1;
|
||||
*_BitBase = *_BitBase & ~(1 << _BitPos);
|
||||
return _Res;
|
||||
}
|
||||
static __inline__ unsigned char __DEFAULT_FN_ATTRS
|
||||
_bittestandset(long *_BitBase, long _BitPos) {
|
||||
unsigned char _Res = (*_BitBase >> _BitPos) & 1;
|
||||
*_BitBase = *_BitBase | (1 << _BitPos);
|
||||
return _Res;
|
||||
}
|
||||
static __inline__ unsigned char __DEFAULT_FN_ATTRS
|
||||
_interlockedbittestandset(long volatile *_BitBase, long _BitPos) {
|
||||
long _PrevVal = __atomic_fetch_or(_BitBase, 1l << _BitPos, __ATOMIC_SEQ_CST);
|
||||
return (_PrevVal >> _BitPos) & 1;
|
||||
}
|
||||
#ifdef __x86_64__
|
||||
static __inline__ unsigned char __DEFAULT_FN_ATTRS
|
||||
_BitScanForward64(unsigned long *_Index, unsigned __int64 _Mask) {
|
||||
if (!_Mask)
|
||||
return 0;
|
||||
*_Index = __builtin_ctzll(_Mask);
|
||||
return 1;
|
||||
}
|
||||
static __inline__ unsigned char __DEFAULT_FN_ATTRS
|
||||
_BitScanReverse64(unsigned long *_Index, unsigned __int64 _Mask) {
|
||||
if (!_Mask)
|
||||
return 0;
|
||||
*_Index = 63 - __builtin_clzll(_Mask);
|
||||
return 1;
|
||||
}
|
||||
static __inline__
|
||||
unsigned __int64 __DEFAULT_FN_ATTRS
|
||||
__popcnt64(unsigned __int64 _Value) {
|
||||
return __builtin_popcountll(_Value);
|
||||
}
|
||||
static __inline__ unsigned char __DEFAULT_FN_ATTRS
|
||||
_bittest64(__int64 const *_BitBase, __int64 _BitPos) {
|
||||
return (*_BitBase >> _BitPos) & 1;
|
||||
}
|
||||
static __inline__ unsigned char __DEFAULT_FN_ATTRS
|
||||
_bittestandcomplement64(__int64 *_BitBase, __int64 _BitPos) {
|
||||
unsigned char _Res = (*_BitBase >> _BitPos) & 1;
|
||||
*_BitBase = *_BitBase ^ (1ll << _BitPos);
|
||||
return _Res;
|
||||
}
|
||||
static __inline__ unsigned char __DEFAULT_FN_ATTRS
|
||||
_bittestandreset64(__int64 *_BitBase, __int64 _BitPos) {
|
||||
unsigned char _Res = (*_BitBase >> _BitPos) & 1;
|
||||
*_BitBase = *_BitBase & ~(1ll << _BitPos);
|
||||
return _Res;
|
||||
}
|
||||
static __inline__ unsigned char __DEFAULT_FN_ATTRS
|
||||
_bittestandset64(__int64 *_BitBase, __int64 _BitPos) {
|
||||
unsigned char _Res = (*_BitBase >> _BitPos) & 1;
|
||||
*_BitBase = *_BitBase | (1ll << _BitPos);
|
||||
return _Res;
|
||||
}
|
||||
static __inline__ unsigned char __DEFAULT_FN_ATTRS
|
||||
_interlockedbittestandset64(__int64 volatile *_BitBase, __int64 _BitPos) {
|
||||
long long _PrevVal =
|
||||
__atomic_fetch_or(_BitBase, 1ll << _BitPos, __ATOMIC_SEQ_CST);
|
||||
return (_PrevVal >> _BitPos) & 1;
|
||||
}
|
||||
#endif
|
||||
/*----------------------------------------------------------------------------*\
|
||||
|* Interlocked Exchange Add
|
||||
\*----------------------------------------------------------------------------*/
|
||||
static __inline__ char __DEFAULT_FN_ATTRS
|
||||
_InterlockedExchangeAdd8(char volatile *_Addend, char _Value) {
|
||||
return __atomic_fetch_add(_Addend, _Value, __ATOMIC_SEQ_CST);
|
||||
}
|
||||
static __inline__ short __DEFAULT_FN_ATTRS
|
||||
_InterlockedExchangeAdd16(short volatile *_Addend, short _Value) {
|
||||
return __atomic_fetch_add(_Addend, _Value, __ATOMIC_SEQ_CST);
|
||||
}
|
||||
#ifdef __x86_64__
|
||||
static __inline__ __int64 __DEFAULT_FN_ATTRS
|
||||
_InterlockedExchangeAdd64(__int64 volatile *_Addend, __int64 _Value) {
|
||||
return __atomic_fetch_add(_Addend, _Value, __ATOMIC_SEQ_CST);
|
||||
}
|
||||
#endif
|
||||
/*----------------------------------------------------------------------------*\
|
||||
|* Interlocked Exchange Sub
|
||||
\*----------------------------------------------------------------------------*/
|
||||
static __inline__ char __DEFAULT_FN_ATTRS
|
||||
_InterlockedExchangeSub8(char volatile *_Subend, char _Value) {
|
||||
return __atomic_fetch_sub(_Subend, _Value, __ATOMIC_SEQ_CST);
|
||||
}
|
||||
static __inline__ short __DEFAULT_FN_ATTRS
|
||||
_InterlockedExchangeSub16(short volatile *_Subend, short _Value) {
|
||||
return __atomic_fetch_sub(_Subend, _Value, __ATOMIC_SEQ_CST);
|
||||
}
|
||||
static __inline__ long __DEFAULT_FN_ATTRS
|
||||
_InterlockedExchangeSub(long volatile *_Subend, long _Value) {
|
||||
return __atomic_fetch_sub(_Subend, _Value, __ATOMIC_SEQ_CST);
|
||||
}
|
||||
#ifdef __x86_64__
|
||||
static __inline__ __int64 __DEFAULT_FN_ATTRS
|
||||
_InterlockedExchangeSub64(__int64 volatile *_Subend, __int64 _Value) {
|
||||
return __atomic_fetch_sub(_Subend, _Value, __ATOMIC_SEQ_CST);
|
||||
}
|
||||
#endif
|
||||
/*----------------------------------------------------------------------------*\
|
||||
|* Interlocked Increment
|
||||
\*----------------------------------------------------------------------------*/
|
||||
static __inline__ short __DEFAULT_FN_ATTRS
|
||||
_InterlockedIncrement16(short volatile *_Value) {
|
||||
return __atomic_add_fetch(_Value, 1, __ATOMIC_SEQ_CST);
|
||||
}
|
||||
#ifdef __x86_64__
|
||||
static __inline__ __int64 __DEFAULT_FN_ATTRS
|
||||
_InterlockedIncrement64(__int64 volatile *_Value) {
|
||||
return __atomic_add_fetch(_Value, 1, __ATOMIC_SEQ_CST);
|
||||
}
|
||||
#endif
|
||||
/*----------------------------------------------------------------------------*\
|
||||
|* Interlocked Decrement
|
||||
\*----------------------------------------------------------------------------*/
|
||||
static __inline__ short __DEFAULT_FN_ATTRS
|
||||
_InterlockedDecrement16(short volatile *_Value) {
|
||||
return __atomic_sub_fetch(_Value, 1, __ATOMIC_SEQ_CST);
|
||||
}
|
||||
#ifdef __x86_64__
|
||||
static __inline__ __int64 __DEFAULT_FN_ATTRS
|
||||
_InterlockedDecrement64(__int64 volatile *_Value) {
|
||||
return __atomic_sub_fetch(_Value, 1, __ATOMIC_SEQ_CST);
|
||||
}
|
||||
#endif
|
||||
/*----------------------------------------------------------------------------*\
|
||||
|* Interlocked And
|
||||
\*----------------------------------------------------------------------------*/
|
||||
static __inline__ char __DEFAULT_FN_ATTRS
|
||||
_InterlockedAnd8(char volatile *_Value, char _Mask) {
|
||||
return __atomic_fetch_and(_Value, _Mask, __ATOMIC_SEQ_CST);
|
||||
}
|
||||
static __inline__ short __DEFAULT_FN_ATTRS
|
||||
_InterlockedAnd16(short volatile *_Value, short _Mask) {
|
||||
return __atomic_fetch_and(_Value, _Mask, __ATOMIC_SEQ_CST);
|
||||
}
|
||||
static __inline__ long __DEFAULT_FN_ATTRS
|
||||
_InterlockedAnd(long volatile *_Value, long _Mask) {
|
||||
return __atomic_fetch_and(_Value, _Mask, __ATOMIC_SEQ_CST);
|
||||
}
|
||||
#ifdef __x86_64__
|
||||
static __inline__ __int64 __DEFAULT_FN_ATTRS
|
||||
_InterlockedAnd64(__int64 volatile *_Value, __int64 _Mask) {
|
||||
return __atomic_fetch_and(_Value, _Mask, __ATOMIC_SEQ_CST);
|
||||
}
|
||||
#endif
|
||||
/*----------------------------------------------------------------------------*\
|
||||
|* Interlocked Or
|
||||
\*----------------------------------------------------------------------------*/
|
||||
static __inline__ char __DEFAULT_FN_ATTRS
|
||||
_InterlockedOr8(char volatile *_Value, char _Mask) {
|
||||
return __atomic_fetch_or(_Value, _Mask, __ATOMIC_SEQ_CST);
|
||||
}
|
||||
static __inline__ short __DEFAULT_FN_ATTRS
|
||||
_InterlockedOr16(short volatile *_Value, short _Mask) {
|
||||
return __atomic_fetch_or(_Value, _Mask, __ATOMIC_SEQ_CST);
|
||||
}
|
||||
static __inline__ long __DEFAULT_FN_ATTRS
|
||||
_InterlockedOr(long volatile *_Value, long _Mask) {
|
||||
return __atomic_fetch_or(_Value, _Mask, __ATOMIC_SEQ_CST);
|
||||
}
|
||||
#ifdef __x86_64__
|
||||
static __inline__ __int64 __DEFAULT_FN_ATTRS
|
||||
_InterlockedOr64(__int64 volatile *_Value, __int64 _Mask) {
|
||||
return __atomic_fetch_or(_Value, _Mask, __ATOMIC_SEQ_CST);
|
||||
}
|
||||
#endif
|
||||
/*----------------------------------------------------------------------------*\
|
||||
|* Interlocked Xor
|
||||
\*----------------------------------------------------------------------------*/
|
||||
static __inline__ char __DEFAULT_FN_ATTRS
|
||||
_InterlockedXor8(char volatile *_Value, char _Mask) {
|
||||
return __atomic_fetch_xor(_Value, _Mask, __ATOMIC_SEQ_CST);
|
||||
}
|
||||
static __inline__ short __DEFAULT_FN_ATTRS
|
||||
_InterlockedXor16(short volatile *_Value, short _Mask) {
|
||||
return __atomic_fetch_xor(_Value, _Mask, __ATOMIC_SEQ_CST);
|
||||
}
|
||||
static __inline__ long __DEFAULT_FN_ATTRS
|
||||
_InterlockedXor(long volatile *_Value, long _Mask) {
|
||||
return __atomic_fetch_xor(_Value, _Mask, __ATOMIC_SEQ_CST);
|
||||
}
|
||||
#ifdef __x86_64__
|
||||
static __inline__ __int64 __DEFAULT_FN_ATTRS
|
||||
_InterlockedXor64(__int64 volatile *_Value, __int64 _Mask) {
|
||||
return __atomic_fetch_xor(_Value, _Mask, __ATOMIC_SEQ_CST);
|
||||
}
|
||||
#endif
|
||||
/*----------------------------------------------------------------------------*\
|
||||
|* Interlocked Exchange
|
||||
\*----------------------------------------------------------------------------*/
|
||||
static __inline__ char __DEFAULT_FN_ATTRS
|
||||
_InterlockedExchange8(char volatile *_Target, char _Value) {
|
||||
__atomic_exchange(_Target, &_Value, &_Value, __ATOMIC_SEQ_CST);
|
||||
return _Value;
|
||||
}
|
||||
static __inline__ short __DEFAULT_FN_ATTRS
|
||||
_InterlockedExchange16(short volatile *_Target, short _Value) {
|
||||
__atomic_exchange(_Target, &_Value, &_Value, __ATOMIC_SEQ_CST);
|
||||
return _Value;
|
||||
}
|
||||
#ifdef __x86_64__
|
||||
static __inline__ __int64 __DEFAULT_FN_ATTRS
|
||||
_InterlockedExchange64(__int64 volatile *_Target, __int64 _Value) {
|
||||
__atomic_exchange(_Target, &_Value, &_Value, __ATOMIC_SEQ_CST);
|
||||
return _Value;
|
||||
}
|
||||
#endif
|
||||
/*----------------------------------------------------------------------------*\
|
||||
|* Interlocked Compare Exchange
|
||||
\*----------------------------------------------------------------------------*/
|
||||
static __inline__ char __DEFAULT_FN_ATTRS
|
||||
_InterlockedCompareExchange8(char volatile *_Destination,
|
||||
char _Exchange, char _Comparand) {
|
||||
__atomic_compare_exchange(_Destination, &_Comparand, &_Exchange, 0,
|
||||
__ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
|
||||
return _Comparand;
|
||||
}
|
||||
static __inline__ short __DEFAULT_FN_ATTRS
|
||||
_InterlockedCompareExchange16(short volatile *_Destination,
|
||||
short _Exchange, short _Comparand) {
|
||||
__atomic_compare_exchange(_Destination, &_Comparand, &_Exchange, 0,
|
||||
__ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
|
||||
return _Comparand;
|
||||
}
|
||||
static __inline__ __int64 __DEFAULT_FN_ATTRS
|
||||
_InterlockedCompareExchange64(__int64 volatile *_Destination,
|
||||
__int64 _Exchange, __int64 _Comparand) {
|
||||
__atomic_compare_exchange(_Destination, &_Comparand, &_Exchange, 0,
|
||||
__ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
|
||||
return _Comparand;
|
||||
}
|
||||
/*----------------------------------------------------------------------------*\
|
||||
|* Barriers
|
||||
\*----------------------------------------------------------------------------*/
|
||||
static __inline__ void __DEFAULT_FN_ATTRS
|
||||
__attribute__((__deprecated__("use other intrinsics or C++11 atomics instead")))
|
||||
_ReadWriteBarrier(void) {
|
||||
__atomic_signal_fence(__ATOMIC_SEQ_CST);
|
||||
}
|
||||
static __inline__ void __DEFAULT_FN_ATTRS
|
||||
__attribute__((__deprecated__("use other intrinsics or C++11 atomics instead")))
|
||||
_ReadBarrier(void) {
|
||||
__atomic_signal_fence(__ATOMIC_SEQ_CST);
|
||||
}
|
||||
static __inline__ void __DEFAULT_FN_ATTRS
|
||||
__attribute__((__deprecated__("use other intrinsics or C++11 atomics instead")))
|
||||
_WriteBarrier(void) {
|
||||
__atomic_signal_fence(__ATOMIC_SEQ_CST);
|
||||
}
|
||||
#ifdef __x86_64__
|
||||
static __inline__ void __DEFAULT_FN_ATTRS
|
||||
__faststorefence(void) {
|
||||
__atomic_thread_fence(__ATOMIC_SEQ_CST);
|
||||
}
|
||||
#endif
|
||||
/*----------------------------------------------------------------------------*\
|
||||
|* readfs, readgs
|
||||
|* (Pointers in address space #256 and #257 are relative to the GS and FS
|
||||
|* segment registers, respectively.)
|
||||
\*----------------------------------------------------------------------------*/
|
||||
#define __ptr_to_addr_space(__addr_space_nbr, __type, __offset) \
|
||||
((volatile __type __attribute__((__address_space__(__addr_space_nbr)))*) \
|
||||
(__offset))
|
||||
|
||||
#ifdef __i386__
|
||||
static __inline__ unsigned char __DEFAULT_FN_ATTRS
|
||||
__readfsbyte(unsigned long __offset) {
|
||||
return *__ptr_to_addr_space(257, unsigned char, __offset);
|
||||
}
|
||||
static __inline__ unsigned short __DEFAULT_FN_ATTRS
|
||||
__readfsword(unsigned long __offset) {
|
||||
return *__ptr_to_addr_space(257, unsigned short, __offset);
|
||||
}
|
||||
static __inline__ unsigned __int64 __DEFAULT_FN_ATTRS
|
||||
__readfsqword(unsigned long __offset) {
|
||||
return *__ptr_to_addr_space(257, unsigned __int64, __offset);
|
||||
}
|
||||
#endif
|
||||
#ifdef __x86_64__
|
||||
static __inline__ unsigned char __DEFAULT_FN_ATTRS
|
||||
__readgsbyte(unsigned long __offset) {
|
||||
return *__ptr_to_addr_space(256, unsigned char, __offset);
|
||||
}
|
||||
static __inline__ unsigned short __DEFAULT_FN_ATTRS
|
||||
__readgsword(unsigned long __offset) {
|
||||
return *__ptr_to_addr_space(256, unsigned short, __offset);
|
||||
}
|
||||
static __inline__ unsigned long __DEFAULT_FN_ATTRS
|
||||
__readgsdword(unsigned long __offset) {
|
||||
return *__ptr_to_addr_space(256, unsigned long, __offset);
|
||||
}
|
||||
static __inline__ unsigned __int64 __DEFAULT_FN_ATTRS
|
||||
__readgsqword(unsigned long __offset) {
|
||||
return *__ptr_to_addr_space(256, unsigned __int64, __offset);
|
||||
}
|
||||
#endif
|
||||
#undef __ptr_to_addr_space
|
||||
/*----------------------------------------------------------------------------*\
|
||||
|* movs, stos
|
||||
\*----------------------------------------------------------------------------*/
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
static __inline__ void __DEFAULT_FN_ATTRS
|
||||
__movsb(unsigned char *__dst, unsigned char const *__src, size_t __n) {
|
||||
__asm__("rep movsb" : : "D"(__dst), "S"(__src), "c"(__n)
|
||||
: "%edi", "%esi", "%ecx");
|
||||
}
|
||||
static __inline__ void __DEFAULT_FN_ATTRS
|
||||
__movsd(unsigned long *__dst, unsigned long const *__src, size_t __n) {
|
||||
__asm__("rep movsl" : : "D"(__dst), "S"(__src), "c"(__n)
|
||||
: "%edi", "%esi", "%ecx");
|
||||
}
|
||||
static __inline__ void __DEFAULT_FN_ATTRS
|
||||
__movsw(unsigned short *__dst, unsigned short const *__src, size_t __n) {
|
||||
__asm__("rep movsw" : : "D"(__dst), "S"(__src), "c"(__n)
|
||||
: "%edi", "%esi", "%ecx");
|
||||
}
|
||||
static __inline__ void __DEFAULT_FN_ATTRS
|
||||
__stosb(unsigned char *__dst, unsigned char __x, size_t __n) {
|
||||
__asm__("rep stosb" : : "D"(__dst), "a"(__x), "c"(__n)
|
||||
: "%edi", "%ecx");
|
||||
}
|
||||
static __inline__ void __DEFAULT_FN_ATTRS
|
||||
__stosd(unsigned long *__dst, unsigned long __x, size_t __n) {
|
||||
__asm__("rep stosl" : : "D"(__dst), "a"(__x), "c"(__n)
|
||||
: "%edi", "%ecx");
|
||||
}
|
||||
static __inline__ void __DEFAULT_FN_ATTRS
|
||||
__stosw(unsigned short *__dst, unsigned short __x, size_t __n) {
|
||||
__asm__("rep stosw" : : "D"(__dst), "a"(__x), "c"(__n)
|
||||
: "%edi", "%ecx");
|
||||
}
|
||||
#endif
|
||||
#ifdef __x86_64__
|
||||
static __inline__ void __DEFAULT_FN_ATTRS
|
||||
__movsq(unsigned long long *__dst, unsigned long long const *__src, size_t __n) {
|
||||
__asm__("rep movsq" : : "D"(__dst), "S"(__src), "c"(__n)
|
||||
: "%edi", "%esi", "%ecx");
|
||||
}
|
||||
static __inline__ void __DEFAULT_FN_ATTRS
|
||||
__stosq(unsigned __int64 *__dst, unsigned __int64 __x, size_t __n) {
|
||||
__asm__("rep stosq" : : "D"(__dst), "a"(__x), "c"(__n)
|
||||
: "%edi", "%ecx");
|
||||
}
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------*\
|
||||
|* Misc
|
||||
\*----------------------------------------------------------------------------*/
|
||||
static __inline__ void * __DEFAULT_FN_ATTRS
|
||||
_AddressOfReturnAddress(void) {
|
||||
return (void*)((char*)__builtin_frame_address(0) + sizeof(void*));
|
||||
}
|
||||
static __inline__ void * __DEFAULT_FN_ATTRS
|
||||
_ReturnAddress(void) {
|
||||
return __builtin_return_address(0);
|
||||
}
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
static __inline__ void __DEFAULT_FN_ATTRS
|
||||
__cpuid(int __info[4], int __level) {
|
||||
__asm__ ("cpuid" : "=a"(__info[0]), "=b" (__info[1]), "=c"(__info[2]), "=d"(__info[3])
|
||||
: "a"(__level));
|
||||
}
|
||||
static __inline__ void __DEFAULT_FN_ATTRS
|
||||
__cpuidex(int __info[4], int __level, int __ecx) {
|
||||
__asm__ ("cpuid" : "=a"(__info[0]), "=b" (__info[1]), "=c"(__info[2]), "=d"(__info[3])
|
||||
: "a"(__level), "c"(__ecx));
|
||||
}
|
||||
static __inline__ unsigned __int64 __cdecl __DEFAULT_FN_ATTRS
|
||||
_xgetbv(unsigned int __xcr_no) {
|
||||
unsigned int __eax, __edx;
|
||||
__asm__ ("xgetbv" : "=a" (__eax), "=d" (__edx) : "c" (__xcr_no));
|
||||
return ((unsigned __int64)__edx << 32) | __eax;
|
||||
}
|
||||
static __inline__ void __DEFAULT_FN_ATTRS
|
||||
__halt(void) {
|
||||
__asm__ volatile ("hlt");
|
||||
}
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------*\
|
||||
|* Privileged intrinsics
|
||||
\*----------------------------------------------------------------------------*/
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
static __inline__ unsigned __int64 __DEFAULT_FN_ATTRS
|
||||
__readmsr(unsigned long __register) {
|
||||
// Loads the contents of a 64-bit model specific register (MSR) specified in
|
||||
// the ECX register into registers EDX:EAX. The EDX register is loaded with
|
||||
// the high-order 32 bits of the MSR and the EAX register is loaded with the
|
||||
// low-order 32 bits. If less than 64 bits are implemented in the MSR being
|
||||
// read, the values returned to EDX:EAX in unimplemented bit locations are
|
||||
// undefined.
|
||||
unsigned long __edx;
|
||||
unsigned long __eax;
|
||||
__asm__ ("rdmsr" : "=d"(__edx), "=a"(__eax) : "c"(__register));
|
||||
return (((unsigned __int64)__edx) << 32) | (unsigned __int64)__eax;
|
||||
}
|
||||
|
||||
static __inline__ unsigned long __DEFAULT_FN_ATTRS
|
||||
__readcr3(void) {
|
||||
unsigned long __cr3_val;
|
||||
__asm__ __volatile__ ("mov %%cr3, %0" : "=q"(__cr3_val) : : "memory");
|
||||
return __cr3_val;
|
||||
}
|
||||
|
||||
static __inline__ void __DEFAULT_FN_ATTRS
|
||||
__writecr3(unsigned int __cr3_val) {
|
||||
__asm__ ("mov %0, %%cr3" : : "q"(__cr3_val) : "memory");
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#undef __DEFAULT_FN_ATTRS
|
||||
|
||||
#endif /* __INTRIN_H */
|
||||
#endif /* _MSC_VER */
|
||||
@@ -0,0 +1,106 @@
|
||||
/*===---- inttypes.h - Standard header for integer printf macros ----------===*\
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
\*===----------------------------------------------------------------------===*/
|
||||
|
||||
#ifndef __CLANG_INTTYPES_H
|
||||
#define __CLANG_INTTYPES_H
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1800
|
||||
#error MSVC does not have inttypes.h prior to Visual Studio 2013
|
||||
#endif
|
||||
|
||||
#include_next <inttypes.h>
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1900
|
||||
/* MSVC headers define int32_t as int, but PRIx32 as "lx" instead of "x".
|
||||
* This triggers format warnings, so fix it up here. */
|
||||
#undef PRId32
|
||||
#undef PRIdLEAST32
|
||||
#undef PRIdFAST32
|
||||
#undef PRIi32
|
||||
#undef PRIiLEAST32
|
||||
#undef PRIiFAST32
|
||||
#undef PRIo32
|
||||
#undef PRIoLEAST32
|
||||
#undef PRIoFAST32
|
||||
#undef PRIu32
|
||||
#undef PRIuLEAST32
|
||||
#undef PRIuFAST32
|
||||
#undef PRIx32
|
||||
#undef PRIxLEAST32
|
||||
#undef PRIxFAST32
|
||||
#undef PRIX32
|
||||
#undef PRIXLEAST32
|
||||
#undef PRIXFAST32
|
||||
|
||||
#undef SCNd32
|
||||
#undef SCNdLEAST32
|
||||
#undef SCNdFAST32
|
||||
#undef SCNi32
|
||||
#undef SCNiLEAST32
|
||||
#undef SCNiFAST32
|
||||
#undef SCNo32
|
||||
#undef SCNoLEAST32
|
||||
#undef SCNoFAST32
|
||||
#undef SCNu32
|
||||
#undef SCNuLEAST32
|
||||
#undef SCNuFAST32
|
||||
#undef SCNx32
|
||||
#undef SCNxLEAST32
|
||||
#undef SCNxFAST32
|
||||
|
||||
#define PRId32 "d"
|
||||
#define PRIdLEAST32 "d"
|
||||
#define PRIdFAST32 "d"
|
||||
#define PRIi32 "i"
|
||||
#define PRIiLEAST32 "i"
|
||||
#define PRIiFAST32 "i"
|
||||
#define PRIo32 "o"
|
||||
#define PRIoLEAST32 "o"
|
||||
#define PRIoFAST32 "o"
|
||||
#define PRIu32 "u"
|
||||
#define PRIuLEAST32 "u"
|
||||
#define PRIuFAST32 "u"
|
||||
#define PRIx32 "x"
|
||||
#define PRIxLEAST32 "x"
|
||||
#define PRIxFAST32 "x"
|
||||
#define PRIX32 "X"
|
||||
#define PRIXLEAST32 "X"
|
||||
#define PRIXFAST32 "X"
|
||||
|
||||
#define SCNd32 "d"
|
||||
#define SCNdLEAST32 "d"
|
||||
#define SCNdFAST32 "d"
|
||||
#define SCNi32 "i"
|
||||
#define SCNiLEAST32 "i"
|
||||
#define SCNiFAST32 "i"
|
||||
#define SCNo32 "o"
|
||||
#define SCNoLEAST32 "o"
|
||||
#define SCNoFAST32 "o"
|
||||
#define SCNu32 "u"
|
||||
#define SCNuLEAST32 "u"
|
||||
#define SCNuFAST32 "u"
|
||||
#define SCNx32 "x"
|
||||
#define SCNxLEAST32 "x"
|
||||
#define SCNxFAST32 "x"
|
||||
#endif
|
||||
|
||||
#endif /* __CLANG_INTTYPES_H */
|
||||
@@ -0,0 +1,43 @@
|
||||
/*===---- iso646.h - Standard header for alternate spellings of operators---===
|
||||
*
|
||||
* Copyright (c) 2008 Eli Friedman
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
|
||||
#ifndef __ISO646_H
|
||||
#define __ISO646_H
|
||||
|
||||
#ifndef __cplusplus
|
||||
#define and &&
|
||||
#define and_eq &=
|
||||
#define bitand &
|
||||
#define bitor |
|
||||
#define compl ~
|
||||
#define not !
|
||||
#define not_eq !=
|
||||
#define or ||
|
||||
#define or_eq |=
|
||||
#define xor ^
|
||||
#define xor_eq ^=
|
||||
#endif
|
||||
|
||||
#endif /* __ISO646_H */
|
||||
@@ -0,0 +1,118 @@
|
||||
/*===---- limits.h - Standard header for integer sizes --------------------===*\
|
||||
*
|
||||
* Copyright (c) 2009 Chris Lattner
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
\*===----------------------------------------------------------------------===*/
|
||||
|
||||
#ifndef __CLANG_LIMITS_H
|
||||
#define __CLANG_LIMITS_H
|
||||
|
||||
/* The system's limits.h may, in turn, try to #include_next GCC's limits.h.
|
||||
Avert this #include_next madness. */
|
||||
#if defined __GNUC__ && !defined _GCC_LIMITS_H_
|
||||
#define _GCC_LIMITS_H_
|
||||
#endif
|
||||
|
||||
/* System headers include a number of constants from POSIX in <limits.h>.
|
||||
Include it if we're hosted. */
|
||||
#if __STDC_HOSTED__ && __has_include_next(<limits.h>)
|
||||
#include_next <limits.h>
|
||||
#endif
|
||||
|
||||
/* Many system headers try to "help us out" by defining these. No really, we
|
||||
know how big each datatype is. */
|
||||
#undef SCHAR_MIN
|
||||
#undef SCHAR_MAX
|
||||
#undef UCHAR_MAX
|
||||
#undef SHRT_MIN
|
||||
#undef SHRT_MAX
|
||||
#undef USHRT_MAX
|
||||
#undef INT_MIN
|
||||
#undef INT_MAX
|
||||
#undef UINT_MAX
|
||||
#undef LONG_MIN
|
||||
#undef LONG_MAX
|
||||
#undef ULONG_MAX
|
||||
|
||||
#undef CHAR_BIT
|
||||
#undef CHAR_MIN
|
||||
#undef CHAR_MAX
|
||||
|
||||
/* C90/99 5.2.4.2.1 */
|
||||
#define SCHAR_MAX __SCHAR_MAX__
|
||||
#define SHRT_MAX __SHRT_MAX__
|
||||
#define INT_MAX __INT_MAX__
|
||||
#define LONG_MAX __LONG_MAX__
|
||||
|
||||
#define SCHAR_MIN (-__SCHAR_MAX__-1)
|
||||
#define SHRT_MIN (-__SHRT_MAX__ -1)
|
||||
#define INT_MIN (-__INT_MAX__ -1)
|
||||
#define LONG_MIN (-__LONG_MAX__ -1L)
|
||||
|
||||
#define UCHAR_MAX (__SCHAR_MAX__*2 +1)
|
||||
#define USHRT_MAX (__SHRT_MAX__ *2 +1)
|
||||
#define UINT_MAX (__INT_MAX__ *2U +1U)
|
||||
#define ULONG_MAX (__LONG_MAX__ *2UL+1UL)
|
||||
|
||||
#ifndef MB_LEN_MAX
|
||||
#define MB_LEN_MAX 1
|
||||
#endif
|
||||
|
||||
#define CHAR_BIT __CHAR_BIT__
|
||||
|
||||
#ifdef __CHAR_UNSIGNED__ /* -funsigned-char */
|
||||
#define CHAR_MIN 0
|
||||
#define CHAR_MAX UCHAR_MAX
|
||||
#else
|
||||
#define CHAR_MIN SCHAR_MIN
|
||||
#define CHAR_MAX __SCHAR_MAX__
|
||||
#endif
|
||||
|
||||
/* C99 5.2.4.2.1: Added long long.
|
||||
C++11 18.3.3.2: same contents as the Standard C Library header <limits.h>.
|
||||
*/
|
||||
#if __STDC_VERSION__ >= 199901L || __cplusplus >= 201103L
|
||||
|
||||
#undef LLONG_MIN
|
||||
#undef LLONG_MAX
|
||||
#undef ULLONG_MAX
|
||||
|
||||
#define LLONG_MAX __LONG_LONG_MAX__
|
||||
#define LLONG_MIN (-__LONG_LONG_MAX__-1LL)
|
||||
#define ULLONG_MAX (__LONG_LONG_MAX__*2ULL+1ULL)
|
||||
#endif
|
||||
|
||||
/* LONG_LONG_MIN/LONG_LONG_MAX/ULONG_LONG_MAX are a GNU extension. It's too bad
|
||||
that we don't have something like #pragma poison that could be used to
|
||||
deprecate a macro - the code should just use LLONG_MAX and friends.
|
||||
*/
|
||||
#if defined(__GNU_LIBRARY__) ? defined(__USE_GNU) : !defined(__STRICT_ANSI__)
|
||||
|
||||
#undef LONG_LONG_MIN
|
||||
#undef LONG_LONG_MAX
|
||||
#undef ULONG_LONG_MAX
|
||||
|
||||
#define LONG_LONG_MAX __LONG_LONG_MAX__
|
||||
#define LONG_LONG_MIN (-__LONG_LONG_MAX__-1LL)
|
||||
#define ULONG_LONG_MAX (__LONG_LONG_MAX__*2ULL+1ULL)
|
||||
#endif
|
||||
|
||||
#endif /* __CLANG_LIMITS_H */
|
||||
@@ -0,0 +1,68 @@
|
||||
/*===---- lzcntintrin.h - LZCNT intrinsics ---------------------------------===
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
|
||||
#if !defined __X86INTRIN_H && !defined __IMMINTRIN_H
|
||||
#error "Never use <lzcntintrin.h> directly; include <x86intrin.h> instead."
|
||||
#endif
|
||||
|
||||
#ifndef __LZCNTINTRIN_H
|
||||
#define __LZCNTINTRIN_H
|
||||
|
||||
/* Define the default attributes for the functions in this file. */
|
||||
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("lzcnt")))
|
||||
|
||||
static __inline__ unsigned short __DEFAULT_FN_ATTRS
|
||||
__lzcnt16(unsigned short __X)
|
||||
{
|
||||
return __X ? __builtin_clzs(__X) : 16;
|
||||
}
|
||||
|
||||
static __inline__ unsigned int __DEFAULT_FN_ATTRS
|
||||
__lzcnt32(unsigned int __X)
|
||||
{
|
||||
return __X ? __builtin_clz(__X) : 32;
|
||||
}
|
||||
|
||||
static __inline__ unsigned int __DEFAULT_FN_ATTRS
|
||||
_lzcnt_u32(unsigned int __X)
|
||||
{
|
||||
return __X ? __builtin_clz(__X) : 32;
|
||||
}
|
||||
|
||||
#ifdef __x86_64__
|
||||
static __inline__ unsigned long long __DEFAULT_FN_ATTRS
|
||||
__lzcnt64(unsigned long long __X)
|
||||
{
|
||||
return __X ? __builtin_clzll(__X) : 64;
|
||||
}
|
||||
|
||||
static __inline__ unsigned long long __DEFAULT_FN_ATTRS
|
||||
_lzcnt_u64(unsigned long long __X)
|
||||
{
|
||||
return __X ? __builtin_clzll(__X) : 64;
|
||||
}
|
||||
#endif
|
||||
|
||||
#undef __DEFAULT_FN_ATTRS
|
||||
|
||||
#endif /* __LZCNTINTRIN_H */
|
||||
@@ -0,0 +1,171 @@
|
||||
/*===---- mm3dnow.h - 3DNow! intrinsics ------------------------------------===
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
|
||||
#ifndef _MM3DNOW_H_INCLUDED
|
||||
#define _MM3DNOW_H_INCLUDED
|
||||
|
||||
#include <mmintrin.h>
|
||||
#include <prfchwintrin.h>
|
||||
|
||||
typedef float __v2sf __attribute__((__vector_size__(8)));
|
||||
|
||||
/* Define the default attributes for the functions in this file. */
|
||||
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("3dnow")))
|
||||
|
||||
static __inline__ void __DEFAULT_FN_ATTRS
|
||||
_m_femms(void) {
|
||||
__builtin_ia32_femms();
|
||||
}
|
||||
|
||||
static __inline__ __m64 __DEFAULT_FN_ATTRS
|
||||
_m_pavgusb(__m64 __m1, __m64 __m2) {
|
||||
return (__m64)__builtin_ia32_pavgusb((__v8qi)__m1, (__v8qi)__m2);
|
||||
}
|
||||
|
||||
static __inline__ __m64 __DEFAULT_FN_ATTRS
|
||||
_m_pf2id(__m64 __m) {
|
||||
return (__m64)__builtin_ia32_pf2id((__v2sf)__m);
|
||||
}
|
||||
|
||||
static __inline__ __m64 __DEFAULT_FN_ATTRS
|
||||
_m_pfacc(__m64 __m1, __m64 __m2) {
|
||||
return (__m64)__builtin_ia32_pfacc((__v2sf)__m1, (__v2sf)__m2);
|
||||
}
|
||||
|
||||
static __inline__ __m64 __DEFAULT_FN_ATTRS
|
||||
_m_pfadd(__m64 __m1, __m64 __m2) {
|
||||
return (__m64)__builtin_ia32_pfadd((__v2sf)__m1, (__v2sf)__m2);
|
||||
}
|
||||
|
||||
static __inline__ __m64 __DEFAULT_FN_ATTRS
|
||||
_m_pfcmpeq(__m64 __m1, __m64 __m2) {
|
||||
return (__m64)__builtin_ia32_pfcmpeq((__v2sf)__m1, (__v2sf)__m2);
|
||||
}
|
||||
|
||||
static __inline__ __m64 __DEFAULT_FN_ATTRS
|
||||
_m_pfcmpge(__m64 __m1, __m64 __m2) {
|
||||
return (__m64)__builtin_ia32_pfcmpge((__v2sf)__m1, (__v2sf)__m2);
|
||||
}
|
||||
|
||||
static __inline__ __m64 __DEFAULT_FN_ATTRS
|
||||
_m_pfcmpgt(__m64 __m1, __m64 __m2) {
|
||||
return (__m64)__builtin_ia32_pfcmpgt((__v2sf)__m1, (__v2sf)__m2);
|
||||
}
|
||||
|
||||
static __inline__ __m64 __DEFAULT_FN_ATTRS
|
||||
_m_pfmax(__m64 __m1, __m64 __m2) {
|
||||
return (__m64)__builtin_ia32_pfmax((__v2sf)__m1, (__v2sf)__m2);
|
||||
}
|
||||
|
||||
static __inline__ __m64 __DEFAULT_FN_ATTRS
|
||||
_m_pfmin(__m64 __m1, __m64 __m2) {
|
||||
return (__m64)__builtin_ia32_pfmin((__v2sf)__m1, (__v2sf)__m2);
|
||||
}
|
||||
|
||||
static __inline__ __m64 __DEFAULT_FN_ATTRS
|
||||
_m_pfmul(__m64 __m1, __m64 __m2) {
|
||||
return (__m64)__builtin_ia32_pfmul((__v2sf)__m1, (__v2sf)__m2);
|
||||
}
|
||||
|
||||
static __inline__ __m64 __DEFAULT_FN_ATTRS
|
||||
_m_pfrcp(__m64 __m) {
|
||||
return (__m64)__builtin_ia32_pfrcp((__v2sf)__m);
|
||||
}
|
||||
|
||||
static __inline__ __m64 __DEFAULT_FN_ATTRS
|
||||
_m_pfrcpit1(__m64 __m1, __m64 __m2) {
|
||||
return (__m64)__builtin_ia32_pfrcpit1((__v2sf)__m1, (__v2sf)__m2);
|
||||
}
|
||||
|
||||
static __inline__ __m64 __DEFAULT_FN_ATTRS
|
||||
_m_pfrcpit2(__m64 __m1, __m64 __m2) {
|
||||
return (__m64)__builtin_ia32_pfrcpit2((__v2sf)__m1, (__v2sf)__m2);
|
||||
}
|
||||
|
||||
static __inline__ __m64 __DEFAULT_FN_ATTRS
|
||||
_m_pfrsqrt(__m64 __m) {
|
||||
return (__m64)__builtin_ia32_pfrsqrt((__v2sf)__m);
|
||||
}
|
||||
|
||||
static __inline__ __m64 __DEFAULT_FN_ATTRS
|
||||
_m_pfrsqrtit1(__m64 __m1, __m64 __m2) {
|
||||
return (__m64)__builtin_ia32_pfrsqit1((__v2sf)__m1, (__v2sf)__m2);
|
||||
}
|
||||
|
||||
static __inline__ __m64 __DEFAULT_FN_ATTRS
|
||||
_m_pfsub(__m64 __m1, __m64 __m2) {
|
||||
return (__m64)__builtin_ia32_pfsub((__v2sf)__m1, (__v2sf)__m2);
|
||||
}
|
||||
|
||||
static __inline__ __m64 __DEFAULT_FN_ATTRS
|
||||
_m_pfsubr(__m64 __m1, __m64 __m2) {
|
||||
return (__m64)__builtin_ia32_pfsubr((__v2sf)__m1, (__v2sf)__m2);
|
||||
}
|
||||
|
||||
static __inline__ __m64 __DEFAULT_FN_ATTRS
|
||||
_m_pi2fd(__m64 __m) {
|
||||
return (__m64)__builtin_ia32_pi2fd((__v2si)__m);
|
||||
}
|
||||
|
||||
static __inline__ __m64 __DEFAULT_FN_ATTRS
|
||||
_m_pmulhrw(__m64 __m1, __m64 __m2) {
|
||||
return (__m64)__builtin_ia32_pmulhrw((__v4hi)__m1, (__v4hi)__m2);
|
||||
}
|
||||
|
||||
/* Handle the 3dnowa instructions here. */
|
||||
#undef __DEFAULT_FN_ATTRS
|
||||
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("3dnowa")))
|
||||
|
||||
static __inline__ __m64 __DEFAULT_FN_ATTRS
|
||||
_m_pf2iw(__m64 __m) {
|
||||
return (__m64)__builtin_ia32_pf2iw((__v2sf)__m);
|
||||
}
|
||||
|
||||
static __inline__ __m64 __DEFAULT_FN_ATTRS
|
||||
_m_pfnacc(__m64 __m1, __m64 __m2) {
|
||||
return (__m64)__builtin_ia32_pfnacc((__v2sf)__m1, (__v2sf)__m2);
|
||||
}
|
||||
|
||||
static __inline__ __m64 __DEFAULT_FN_ATTRS
|
||||
_m_pfpnacc(__m64 __m1, __m64 __m2) {
|
||||
return (__m64)__builtin_ia32_pfpnacc((__v2sf)__m1, (__v2sf)__m2);
|
||||
}
|
||||
|
||||
static __inline__ __m64 __DEFAULT_FN_ATTRS
|
||||
_m_pi2fw(__m64 __m) {
|
||||
return (__m64)__builtin_ia32_pi2fw((__v2si)__m);
|
||||
}
|
||||
|
||||
static __inline__ __m64 __DEFAULT_FN_ATTRS
|
||||
_m_pswapdsf(__m64 __m) {
|
||||
return (__m64)__builtin_ia32_pswapdsf((__v2sf)__m);
|
||||
}
|
||||
|
||||
static __inline__ __m64 __DEFAULT_FN_ATTRS
|
||||
_m_pswapdsi(__m64 __m) {
|
||||
return (__m64)__builtin_ia32_pswapdsi((__v2si)__m);
|
||||
}
|
||||
|
||||
#undef __DEFAULT_FN_ATTRS
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,75 @@
|
||||
/*===---- mm_malloc.h - Allocating and Freeing Aligned Memory Blocks -------===
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
|
||||
#ifndef __MM_MALLOC_H
|
||||
#define __MM_MALLOC_H
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <malloc.h>
|
||||
#else
|
||||
#ifndef __cplusplus
|
||||
extern int posix_memalign(void **__memptr, size_t __alignment, size_t __size);
|
||||
#else
|
||||
// Some systems (e.g. those with GNU libc) declare posix_memalign with an
|
||||
// exception specifier. Via an "egregious workaround" in
|
||||
// Sema::CheckEquivalentExceptionSpec, Clang accepts the following as a valid
|
||||
// redeclaration of glibc's declaration.
|
||||
extern "C" int posix_memalign(void **__memptr, size_t __alignment, size_t __size);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !(defined(_WIN32) && defined(_mm_malloc))
|
||||
static __inline__ void *__attribute__((__always_inline__, __nodebug__,
|
||||
__malloc__))
|
||||
_mm_malloc(size_t __size, size_t __align)
|
||||
{
|
||||
if (__align == 1) {
|
||||
return malloc(__size);
|
||||
}
|
||||
|
||||
if (!(__align & (__align - 1)) && __align < sizeof(void *))
|
||||
__align = sizeof(void *);
|
||||
|
||||
void *__mallocedMemory;
|
||||
#if defined(__MINGW32__)
|
||||
__mallocedMemory = __mingw_aligned_malloc(__size, __align);
|
||||
#elif defined(_WIN32)
|
||||
__mallocedMemory = _aligned_malloc(__size, __align);
|
||||
#else
|
||||
if (posix_memalign(&__mallocedMemory, __align, __size))
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
return __mallocedMemory;
|
||||
}
|
||||
|
||||
static __inline__ void __attribute__((__always_inline__, __nodebug__))
|
||||
_mm_free(void *__p)
|
||||
{
|
||||
free(__p);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __MM_MALLOC_H */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,164 @@
|
||||
/*===---- module.modulemap - intrinsics module map -------------------------===
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
|
||||
module _Builtin_intrinsics [system] [extern_c] {
|
||||
explicit module altivec {
|
||||
requires altivec
|
||||
header "altivec.h"
|
||||
}
|
||||
|
||||
explicit module arm {
|
||||
requires arm
|
||||
|
||||
explicit module acle {
|
||||
header "arm_acle.h"
|
||||
export *
|
||||
}
|
||||
|
||||
explicit module neon {
|
||||
requires neon
|
||||
header "arm_neon.h"
|
||||
export *
|
||||
}
|
||||
}
|
||||
|
||||
explicit module intel {
|
||||
requires x86
|
||||
export *
|
||||
|
||||
header "immintrin.h"
|
||||
textual header "f16cintrin.h"
|
||||
textual header "avxintrin.h"
|
||||
textual header "avx2intrin.h"
|
||||
textual header "avx512fintrin.h"
|
||||
textual header "avx512erintrin.h"
|
||||
textual header "fmaintrin.h"
|
||||
|
||||
header "x86intrin.h"
|
||||
textual header "bmiintrin.h"
|
||||
textual header "bmi2intrin.h"
|
||||
textual header "lzcntintrin.h"
|
||||
textual header "xopintrin.h"
|
||||
textual header "fma4intrin.h"
|
||||
textual header "mwaitxintrin.h"
|
||||
|
||||
explicit module mm_malloc {
|
||||
header "mm_malloc.h"
|
||||
export * // note: for <stdlib.h> dependency
|
||||
}
|
||||
|
||||
explicit module cpuid {
|
||||
header "cpuid.h"
|
||||
}
|
||||
|
||||
explicit module mmx {
|
||||
header "mmintrin.h"
|
||||
}
|
||||
|
||||
explicit module sse {
|
||||
export mm_malloc
|
||||
export mmx
|
||||
export sse2 // note: for hackish <emmintrin.h> dependency
|
||||
header "xmmintrin.h"
|
||||
}
|
||||
|
||||
explicit module sse2 {
|
||||
export sse
|
||||
header "emmintrin.h"
|
||||
}
|
||||
|
||||
explicit module sse3 {
|
||||
export sse2
|
||||
header "pmmintrin.h"
|
||||
}
|
||||
|
||||
explicit module ssse3 {
|
||||
export sse3
|
||||
header "tmmintrin.h"
|
||||
}
|
||||
|
||||
explicit module sse4_1 {
|
||||
export ssse3
|
||||
header "smmintrin.h"
|
||||
}
|
||||
|
||||
explicit module sse4_2 {
|
||||
export sse4_1
|
||||
header "nmmintrin.h"
|
||||
}
|
||||
|
||||
explicit module sse4a {
|
||||
export sse3
|
||||
header "ammintrin.h"
|
||||
}
|
||||
|
||||
explicit module popcnt {
|
||||
header "popcntintrin.h"
|
||||
}
|
||||
|
||||
explicit module mm3dnow {
|
||||
header "mm3dnow.h"
|
||||
}
|
||||
|
||||
explicit module aes_pclmul {
|
||||
header "wmmintrin.h"
|
||||
export aes
|
||||
export pclmul
|
||||
}
|
||||
|
||||
explicit module aes {
|
||||
header "__wmmintrin_aes.h"
|
||||
}
|
||||
|
||||
explicit module pclmul {
|
||||
header "__wmmintrin_pclmul.h"
|
||||
}
|
||||
}
|
||||
|
||||
explicit module systemz {
|
||||
requires systemz
|
||||
export *
|
||||
|
||||
header "s390intrin.h"
|
||||
|
||||
explicit module htm {
|
||||
requires htm
|
||||
header "htmintrin.h"
|
||||
header "htmxlintrin.h"
|
||||
}
|
||||
|
||||
explicit module zvector {
|
||||
requires zvector, vx
|
||||
header "vecintrin.h"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module _Builtin_stddef_max_align_t [system] [extern_c] {
|
||||
header "__stddef_max_align_t.h"
|
||||
}
|
||||
|
||||
module opencl_c {
|
||||
requires opencl
|
||||
header "opencl-c.h"
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
/*===---- mwaitxintrin.h - MONITORX/MWAITX intrinsics ----------------------===
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
|
||||
#ifndef __X86INTRIN_H
|
||||
#error "Never use <mwaitxintrin.h> directly; include <x86intrin.h> instead."
|
||||
#endif
|
||||
|
||||
#ifndef _MWAITXINTRIN_H
|
||||
#define _MWAITXINTRIN_H
|
||||
|
||||
/* Define the default attributes for the functions in this file. */
|
||||
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("mwaitx")))
|
||||
static __inline__ void __DEFAULT_FN_ATTRS
|
||||
_mm_monitorx(void const * __p, unsigned __extensions, unsigned __hints)
|
||||
{
|
||||
__builtin_ia32_monitorx((void *)__p, __extensions, __hints);
|
||||
}
|
||||
|
||||
static __inline__ void __DEFAULT_FN_ATTRS
|
||||
_mm_mwaitx(unsigned __extensions, unsigned __hints, unsigned __clock)
|
||||
{
|
||||
__builtin_ia32_mwaitx(__extensions, __hints, __clock);
|
||||
}
|
||||
|
||||
#undef __DEFAULT_FN_ATTRS
|
||||
|
||||
#endif /* _MWAITXINTRIN_H */
|
||||
@@ -0,0 +1,30 @@
|
||||
/*===---- nmmintrin.h - SSE4 intrinsics ------------------------------------===
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
|
||||
#ifndef _NMMINTRIN_H
|
||||
#define _NMMINTRIN_H
|
||||
|
||||
/* To match expectations of gcc we put the sse4.2 definitions into smmintrin.h,
|
||||
just include it now then. */
|
||||
#include <smmintrin.h>
|
||||
#endif /* _NMMINTRIN_H */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,48 @@
|
||||
/*===------------- pkuintrin.h - PKU intrinsics ------------------===
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
#ifndef __IMMINTRIN_H
|
||||
#error "Never use <pkuintrin.h> directly; include <immintrin.h> instead."
|
||||
#endif
|
||||
|
||||
#ifndef __PKUINTRIN_H
|
||||
#define __PKUINTRIN_H
|
||||
|
||||
/* Define the default attributes for the functions in this file. */
|
||||
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("pku")))
|
||||
|
||||
static __inline__ unsigned int __DEFAULT_FN_ATTRS
|
||||
_rdpkru_u32(void)
|
||||
{
|
||||
return __builtin_ia32_rdpkru();
|
||||
}
|
||||
|
||||
static __inline__ void __DEFAULT_FN_ATTRS
|
||||
_wrpkru(unsigned int __val)
|
||||
{
|
||||
return __builtin_ia32_wrpkru(__val);
|
||||
}
|
||||
|
||||
#undef __DEFAULT_FN_ATTRS
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,311 @@
|
||||
/*===---- pmmintrin.h - SSE3 intrinsics ------------------------------------===
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
|
||||
#ifndef __PMMINTRIN_H
|
||||
#define __PMMINTRIN_H
|
||||
|
||||
#include <emmintrin.h>
|
||||
|
||||
/* Define the default attributes for the functions in this file. */
|
||||
#define __DEFAULT_FN_ATTRS \
|
||||
__attribute__((__always_inline__, __nodebug__, __target__("sse3")))
|
||||
|
||||
/// \brief Loads data from an unaligned memory location to elements in a 128-bit
|
||||
/// vector. If the address of the data is not 16-byte aligned, the
|
||||
/// instruction may read two adjacent aligned blocks of memory to retrieve
|
||||
/// the requested data.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c VLDDQU instruction.
|
||||
///
|
||||
/// \param __p
|
||||
/// A pointer to a 128-bit integer vector containing integer values.
|
||||
/// \returns A 128-bit vector containing the moved values.
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_lddqu_si128(__m128i const *__p)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_lddqu((char const *)__p);
|
||||
}
|
||||
|
||||
/// \brief Adds the even-indexed values and subtracts the odd-indexed values of
|
||||
/// two 128-bit vectors of [4 x float].
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c VADDSUBPS instruction.
|
||||
///
|
||||
/// \param __a
|
||||
/// A 128-bit vector of [4 x float] containing the left source operand.
|
||||
/// \param __b
|
||||
/// A 128-bit vector of [4 x float] containing the right source operand.
|
||||
/// \returns A 128-bit vector of [4 x float] containing the alternating sums and
|
||||
/// differences of both operands.
|
||||
static __inline__ __m128 __DEFAULT_FN_ATTRS
|
||||
_mm_addsub_ps(__m128 __a, __m128 __b)
|
||||
{
|
||||
return __builtin_ia32_addsubps((__v4sf)__a, (__v4sf)__b);
|
||||
}
|
||||
|
||||
/// \brief Horizontally adds the adjacent pairs of values contained in two
|
||||
/// 128-bit vectors of [4 x float].
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c VHADDPS instruction.
|
||||
///
|
||||
/// \param __a
|
||||
/// A 128-bit vector of [4 x float] containing one of the source operands.
|
||||
/// The horizontal sums of the values are stored in the lower bits of the
|
||||
/// destination.
|
||||
/// \param __b
|
||||
/// A 128-bit vector of [4 x float] containing one of the source operands.
|
||||
/// The horizontal sums of the values are stored in the upper bits of the
|
||||
/// destination.
|
||||
/// \returns A 128-bit vector of [4 x float] containing the horizontal sums of
|
||||
/// both operands.
|
||||
static __inline__ __m128 __DEFAULT_FN_ATTRS
|
||||
_mm_hadd_ps(__m128 __a, __m128 __b)
|
||||
{
|
||||
return __builtin_ia32_haddps((__v4sf)__a, (__v4sf)__b);
|
||||
}
|
||||
|
||||
/// \brief Horizontally subtracts the adjacent pairs of values contained in two
|
||||
/// 128-bit vectors of [4 x float].
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c VHSUBPS instruction.
|
||||
///
|
||||
/// \param __a
|
||||
/// A 128-bit vector of [4 x float] containing one of the source operands.
|
||||
/// The horizontal differences between the values are stored in the lower
|
||||
/// bits of the destination.
|
||||
/// \param __b
|
||||
/// A 128-bit vector of [4 x float] containing one of the source operands.
|
||||
/// The horizontal differences between the values are stored in the upper
|
||||
/// bits of the destination.
|
||||
/// \returns A 128-bit vector of [4 x float] containing the horizontal
|
||||
/// differences of both operands.
|
||||
static __inline__ __m128 __DEFAULT_FN_ATTRS
|
||||
_mm_hsub_ps(__m128 __a, __m128 __b)
|
||||
{
|
||||
return __builtin_ia32_hsubps((__v4sf)__a, (__v4sf)__b);
|
||||
}
|
||||
|
||||
/// \brief Moves and duplicates high-order (odd-indexed) values from a 128-bit
|
||||
/// vector of [4 x float] to float values stored in a 128-bit vector of
|
||||
/// [4 x float].
|
||||
/// Bits [127:96] of the source are written to bits [127:96] and [95:64] of
|
||||
/// the destination.
|
||||
/// Bits [63:32] of the source are written to bits [63:32] and [31:0] of the
|
||||
/// destination.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c VMOVSHDUP instruction.
|
||||
///
|
||||
/// \param __a
|
||||
/// A 128-bit vector of [4 x float].
|
||||
/// \returns A 128-bit vector of [4 x float] containing the moved and duplicated
|
||||
/// values.
|
||||
static __inline__ __m128 __DEFAULT_FN_ATTRS
|
||||
_mm_movehdup_ps(__m128 __a)
|
||||
{
|
||||
return __builtin_shufflevector((__v4sf)__a, (__v4sf)__a, 1, 1, 3, 3);
|
||||
}
|
||||
|
||||
/// \brief Duplicates low-order (even-indexed) values from a 128-bit
|
||||
/// vector of [4 x float] to float values stored in a 128-bit vector of
|
||||
/// [4 x float].
|
||||
/// Bits [95:64] of the source are written to bits [127:96] and [95:64] of
|
||||
/// the destination.
|
||||
/// Bits [31:0] of the source are written to bits [63:32] and [31:0] of the
|
||||
/// destination.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c VMOVSLDUP instruction.
|
||||
///
|
||||
/// \param __a
|
||||
/// A 128-bit vector of [4 x float].
|
||||
/// \returns A 128-bit vector of [4 x float] containing the moved and duplicated
|
||||
/// values.
|
||||
static __inline__ __m128 __DEFAULT_FN_ATTRS
|
||||
_mm_moveldup_ps(__m128 __a)
|
||||
{
|
||||
return __builtin_shufflevector((__v4sf)__a, (__v4sf)__a, 0, 0, 2, 2);
|
||||
}
|
||||
|
||||
/// \brief Adds the even-indexed values and subtracts the odd-indexed values of
|
||||
/// two 128-bit vectors of [2 x double].
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c VADDSUBPD instruction.
|
||||
///
|
||||
/// \param __a
|
||||
/// A 128-bit vector of [2 x double] containing the left source operand.
|
||||
/// \param __b
|
||||
/// A 128-bit vector of [2 x double] containing the right source operand.
|
||||
/// \returns A 128-bit vector of [2 x double] containing the alternating sums
|
||||
/// and differences of both operands.
|
||||
static __inline__ __m128d __DEFAULT_FN_ATTRS
|
||||
_mm_addsub_pd(__m128d __a, __m128d __b)
|
||||
{
|
||||
return __builtin_ia32_addsubpd((__v2df)__a, (__v2df)__b);
|
||||
}
|
||||
|
||||
/// \brief Horizontally adds the pairs of values contained in two 128-bit
|
||||
/// vectors of [2 x double].
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c VHADDPD instruction.
|
||||
///
|
||||
/// \param __a
|
||||
/// A 128-bit vector of [2 x double] containing one of the source operands.
|
||||
/// The horizontal sum of the values is stored in the lower bits of the
|
||||
/// destination.
|
||||
/// \param __b
|
||||
/// A 128-bit vector of [2 x double] containing one of the source operands.
|
||||
/// The horizontal sum of the values is stored in the upper bits of the
|
||||
/// destination.
|
||||
/// \returns A 128-bit vector of [2 x double] containing the horizontal sums of
|
||||
/// both operands.
|
||||
static __inline__ __m128d __DEFAULT_FN_ATTRS
|
||||
_mm_hadd_pd(__m128d __a, __m128d __b)
|
||||
{
|
||||
return __builtin_ia32_haddpd((__v2df)__a, (__v2df)__b);
|
||||
}
|
||||
|
||||
/// \brief Horizontally subtracts the pairs of values contained in two 128-bit
|
||||
/// vectors of [2 x double].
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c VHSUBPD instruction.
|
||||
///
|
||||
/// \param __a
|
||||
/// A 128-bit vector of [2 x double] containing one of the source operands.
|
||||
/// The horizontal difference of the values is stored in the lower bits of
|
||||
/// the destination.
|
||||
/// \param __b
|
||||
/// A 128-bit vector of [2 x double] containing one of the source operands.
|
||||
/// The horizontal difference of the values is stored in the upper bits of
|
||||
/// the destination.
|
||||
/// \returns A 128-bit vector of [2 x double] containing the horizontal
|
||||
/// differences of both operands.
|
||||
static __inline__ __m128d __DEFAULT_FN_ATTRS
|
||||
_mm_hsub_pd(__m128d __a, __m128d __b)
|
||||
{
|
||||
return __builtin_ia32_hsubpd((__v2df)__a, (__v2df)__b);
|
||||
}
|
||||
|
||||
/// \brief Moves and duplicates one double-precision value to double-precision
|
||||
/// values stored in a 128-bit vector of [2 x double].
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// \code
|
||||
/// __m128d _mm_loaddup_pd(double const * dp);
|
||||
/// \endcode
|
||||
///
|
||||
/// This intrinsic corresponds to the \c VMOVDDUP instruction.
|
||||
///
|
||||
/// \param dp
|
||||
/// A pointer to a double-precision value to be moved and duplicated.
|
||||
/// \returns A 128-bit vector of [2 x double] containing the moved and
|
||||
/// duplicated values.
|
||||
#define _mm_loaddup_pd(dp) _mm_load1_pd(dp)
|
||||
|
||||
/// \brief Moves and duplicates the double-precision value in the lower bits of
|
||||
/// a 128-bit vector of [2 x double] to double-precision values stored in a
|
||||
/// 128-bit vector of [2 x double].
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c VMOVDDUP instruction.
|
||||
///
|
||||
/// \param __a
|
||||
/// A 128-bit vector of [2 x double]. Bits [63:0] are written to bits
|
||||
/// [127:64] and [63:0] of the destination.
|
||||
/// \returns A 128-bit vector of [2 x double] containing the moved and
|
||||
/// duplicated values.
|
||||
static __inline__ __m128d __DEFAULT_FN_ATTRS
|
||||
_mm_movedup_pd(__m128d __a)
|
||||
{
|
||||
return __builtin_shufflevector((__v2df)__a, (__v2df)__a, 0, 0);
|
||||
}
|
||||
|
||||
#define _MM_DENORMALS_ZERO_ON (0x0040)
|
||||
#define _MM_DENORMALS_ZERO_OFF (0x0000)
|
||||
|
||||
#define _MM_DENORMALS_ZERO_MASK (0x0040)
|
||||
|
||||
#define _MM_GET_DENORMALS_ZERO_MODE() (_mm_getcsr() & _MM_DENORMALS_ZERO_MASK)
|
||||
#define _MM_SET_DENORMALS_ZERO_MODE(x) (_mm_setcsr((_mm_getcsr() & ~_MM_DENORMALS_ZERO_MASK) | (x)))
|
||||
|
||||
/// \brief Establishes a linear address memory range to be monitored and puts
|
||||
/// the processor in the monitor event pending state. Data stored in the
|
||||
/// monitored address range causes the processor to exit the pending state.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c MONITOR instruction.
|
||||
///
|
||||
/// \param __p
|
||||
/// The memory range to be monitored. The size of the range is determined by
|
||||
/// CPUID function 0000_0005h.
|
||||
/// \param __extensions
|
||||
/// Optional extensions for the monitoring state.
|
||||
/// \param __hints
|
||||
/// Optional hints for the monitoring state.
|
||||
static __inline__ void __DEFAULT_FN_ATTRS
|
||||
_mm_monitor(void const *__p, unsigned __extensions, unsigned __hints)
|
||||
{
|
||||
__builtin_ia32_monitor((void *)__p, __extensions, __hints);
|
||||
}
|
||||
|
||||
/// \brief Used with the MONITOR instruction to wait while the processor is in
|
||||
/// the monitor event pending state. Data stored in the monitored address
|
||||
/// range causes the processor to exit the pending state.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c MWAIT instruction.
|
||||
///
|
||||
/// \param __extensions
|
||||
/// Optional extensions for the monitoring state, which may vary by
|
||||
/// processor.
|
||||
/// \param __hints
|
||||
/// Optional hints for the monitoring state, which may vary by processor.
|
||||
static __inline__ void __DEFAULT_FN_ATTRS
|
||||
_mm_mwait(unsigned __extensions, unsigned __hints)
|
||||
{
|
||||
__builtin_ia32_mwait(__extensions, __hints);
|
||||
}
|
||||
|
||||
#undef __DEFAULT_FN_ATTRS
|
||||
|
||||
#endif /* __PMMINTRIN_H */
|
||||
@@ -0,0 +1,98 @@
|
||||
/*===---- popcntintrin.h - POPCNT intrinsics -------------------------------===
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
|
||||
#ifndef _POPCNTINTRIN_H
|
||||
#define _POPCNTINTRIN_H
|
||||
|
||||
/* Define the default attributes for the functions in this file. */
|
||||
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("popcnt")))
|
||||
|
||||
/// \brief Counts the number of bits in the source operand having a value of 1.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c POPCNT instruction.
|
||||
///
|
||||
/// \param __A
|
||||
/// An unsigned 32-bit integer operand.
|
||||
/// \returns A 32-bit integer containing the number of bits with value 1 in the
|
||||
/// source operand.
|
||||
static __inline__ int __DEFAULT_FN_ATTRS
|
||||
_mm_popcnt_u32(unsigned int __A)
|
||||
{
|
||||
return __builtin_popcount(__A);
|
||||
}
|
||||
|
||||
/// \brief Counts the number of bits in the source operand having a value of 1.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c POPCNT instruction.
|
||||
///
|
||||
/// \param __A
|
||||
/// A signed 32-bit integer operand.
|
||||
/// \returns A 32-bit integer containing the number of bits with value 1 in the
|
||||
/// source operand.
|
||||
static __inline__ int __DEFAULT_FN_ATTRS
|
||||
_popcnt32(int __A)
|
||||
{
|
||||
return __builtin_popcount(__A);
|
||||
}
|
||||
|
||||
#ifdef __x86_64__
|
||||
/// \brief Counts the number of bits in the source operand having a value of 1.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c POPCNT instruction.
|
||||
///
|
||||
/// \param __A
|
||||
/// An unsigned 64-bit integer operand.
|
||||
/// \returns A 64-bit integer containing the number of bits with value 1 in the
|
||||
/// source operand.
|
||||
static __inline__ long long __DEFAULT_FN_ATTRS
|
||||
_mm_popcnt_u64(unsigned long long __A)
|
||||
{
|
||||
return __builtin_popcountll(__A);
|
||||
}
|
||||
|
||||
/// \brief Counts the number of bits in the source operand having a value of 1.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c POPCNT instruction.
|
||||
///
|
||||
/// \param __A
|
||||
/// A signed 64-bit integer operand.
|
||||
/// \returns A 64-bit integer containing the number of bits with value 1 in the
|
||||
/// source operand.
|
||||
static __inline__ long long __DEFAULT_FN_ATTRS
|
||||
_popcnt64(long long __A)
|
||||
{
|
||||
return __builtin_popcountll(__A);
|
||||
}
|
||||
#endif /* __x86_64__ */
|
||||
|
||||
#undef __DEFAULT_FN_ATTRS
|
||||
|
||||
#endif /* _POPCNTINTRIN_H */
|
||||
@@ -0,0 +1,45 @@
|
||||
/*===---- prfchwintrin.h - PREFETCHW intrinsic -----------------------------===
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
|
||||
#if !defined(__X86INTRIN_H) && !defined(_MM3DNOW_H_INCLUDED)
|
||||
#error "Never use <prfchwintrin.h> directly; include <x86intrin.h> or <mm3dnow.h> instead."
|
||||
#endif
|
||||
|
||||
#ifndef __PRFCHWINTRIN_H
|
||||
#define __PRFCHWINTRIN_H
|
||||
|
||||
#if defined(__PRFCHW__) || defined(__3dNOW__)
|
||||
static __inline__ void __attribute__((__always_inline__, __nodebug__))
|
||||
_m_prefetch(void *__P)
|
||||
{
|
||||
__builtin_prefetch (__P, 0, 3 /* _MM_HINT_T0 */);
|
||||
}
|
||||
|
||||
static __inline__ void __attribute__((__always_inline__, __nodebug__))
|
||||
_m_prefetchw(void *__P)
|
||||
{
|
||||
__builtin_prefetch (__P, 1, 3 /* _MM_HINT_T0 */);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __PRFCHWINTRIN_H */
|
||||
@@ -0,0 +1,56 @@
|
||||
/*===---- rdseedintrin.h - RDSEED intrinsics -------------------------------===
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
|
||||
#ifndef __X86INTRIN_H
|
||||
#error "Never use <rdseedintrin.h> directly; include <x86intrin.h> instead."
|
||||
#endif
|
||||
|
||||
#ifndef __RDSEEDINTRIN_H
|
||||
#define __RDSEEDINTRIN_H
|
||||
|
||||
/* Define the default attributes for the functions in this file. */
|
||||
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("rdseed")))
|
||||
|
||||
static __inline__ int __DEFAULT_FN_ATTRS
|
||||
_rdseed16_step(unsigned short *__p)
|
||||
{
|
||||
return __builtin_ia32_rdseed16_step(__p);
|
||||
}
|
||||
|
||||
static __inline__ int __DEFAULT_FN_ATTRS
|
||||
_rdseed32_step(unsigned int *__p)
|
||||
{
|
||||
return __builtin_ia32_rdseed32_step(__p);
|
||||
}
|
||||
|
||||
#ifdef __x86_64__
|
||||
static __inline__ int __DEFAULT_FN_ATTRS
|
||||
_rdseed64_step(unsigned long long *__p)
|
||||
{
|
||||
return __builtin_ia32_rdseed64_step(__p);
|
||||
}
|
||||
#endif
|
||||
|
||||
#undef __DEFAULT_FN_ATTRS
|
||||
|
||||
#endif /* __RDSEEDINTRIN_H */
|
||||
@@ -0,0 +1,59 @@
|
||||
/*===---- rtmintrin.h - RTM intrinsics -------------------------------------===
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
|
||||
#ifndef __IMMINTRIN_H
|
||||
#error "Never use <rtmintrin.h> directly; include <immintrin.h> instead."
|
||||
#endif
|
||||
|
||||
#ifndef __RTMINTRIN_H
|
||||
#define __RTMINTRIN_H
|
||||
|
||||
#define _XBEGIN_STARTED (~0u)
|
||||
#define _XABORT_EXPLICIT (1 << 0)
|
||||
#define _XABORT_RETRY (1 << 1)
|
||||
#define _XABORT_CONFLICT (1 << 2)
|
||||
#define _XABORT_CAPACITY (1 << 3)
|
||||
#define _XABORT_DEBUG (1 << 4)
|
||||
#define _XABORT_NESTED (1 << 5)
|
||||
#define _XABORT_CODE(x) (((x) >> 24) & 0xFF)
|
||||
|
||||
/* Define the default attributes for the functions in this file. */
|
||||
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("rtm")))
|
||||
|
||||
static __inline__ unsigned int __DEFAULT_FN_ATTRS
|
||||
_xbegin(void)
|
||||
{
|
||||
return __builtin_ia32_xbegin();
|
||||
}
|
||||
|
||||
static __inline__ void __DEFAULT_FN_ATTRS
|
||||
_xend(void)
|
||||
{
|
||||
__builtin_ia32_xend();
|
||||
}
|
||||
|
||||
#define _xabort(imm) __builtin_ia32_xabort((imm))
|
||||
|
||||
#undef __DEFAULT_FN_ATTRS
|
||||
|
||||
#endif /* __RTMINTRIN_H */
|
||||
@@ -0,0 +1,39 @@
|
||||
/*===---- s390intrin.h - SystemZ intrinsics --------------------------------===
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
|
||||
#ifndef __S390INTRIN_H
|
||||
#define __S390INTRIN_H
|
||||
|
||||
#ifndef __s390__
|
||||
#error "<s390intrin.h> is for s390 only"
|
||||
#endif
|
||||
|
||||
#ifdef __HTM__
|
||||
#include <htmintrin.h>
|
||||
#endif
|
||||
|
||||
#ifdef __VEC__
|
||||
#include <vecintrin.h>
|
||||
#endif
|
||||
|
||||
#endif /* __S390INTRIN_H*/
|
||||
@@ -0,0 +1,75 @@
|
||||
/*===---- shaintrin.h - SHA intrinsics -------------------------------------===
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
|
||||
#ifndef __IMMINTRIN_H
|
||||
#error "Never use <shaintrin.h> directly; include <immintrin.h> instead."
|
||||
#endif
|
||||
|
||||
#ifndef __SHAINTRIN_H
|
||||
#define __SHAINTRIN_H
|
||||
|
||||
/* Define the default attributes for the functions in this file. */
|
||||
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("sha")))
|
||||
|
||||
#define _mm_sha1rnds4_epu32(V1, V2, M) __extension__ ({ \
|
||||
__builtin_ia32_sha1rnds4((__v4si)(__m128i)(V1), (__v4si)(__m128i)(V2), (M)); })
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_sha1nexte_epu32(__m128i __X, __m128i __Y)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_sha1nexte((__v4si)__X, (__v4si)__Y);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_sha1msg1_epu32(__m128i __X, __m128i __Y)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_sha1msg1((__v4si)__X, (__v4si)__Y);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_sha1msg2_epu32(__m128i __X, __m128i __Y)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_sha1msg2((__v4si)__X, (__v4si)__Y);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_sha256rnds2_epu32(__m128i __X, __m128i __Y, __m128i __Z)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_sha256rnds2((__v4si)__X, (__v4si)__Y, (__v4si)__Z);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_sha256msg1_epu32(__m128i __X, __m128i __Y)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_sha256msg1((__v4si)__X, (__v4si)__Y);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_sha256msg2_epu32(__m128i __X, __m128i __Y)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_sha256msg2((__v4si)__X, (__v4si)__Y);
|
||||
}
|
||||
|
||||
#undef __DEFAULT_FN_ATTRS
|
||||
|
||||
#endif /* __SHAINTRIN_H */
|
||||
@@ -0,0 +1,507 @@
|
||||
/*===---- smmintrin.h - SSE4 intrinsics ------------------------------------===
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
|
||||
#ifndef _SMMINTRIN_H
|
||||
#define _SMMINTRIN_H
|
||||
|
||||
#include <tmmintrin.h>
|
||||
|
||||
/* Define the default attributes for the functions in this file. */
|
||||
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("sse4.1")))
|
||||
|
||||
/* SSE4 Rounding macros. */
|
||||
#define _MM_FROUND_TO_NEAREST_INT 0x00
|
||||
#define _MM_FROUND_TO_NEG_INF 0x01
|
||||
#define _MM_FROUND_TO_POS_INF 0x02
|
||||
#define _MM_FROUND_TO_ZERO 0x03
|
||||
#define _MM_FROUND_CUR_DIRECTION 0x04
|
||||
|
||||
#define _MM_FROUND_RAISE_EXC 0x00
|
||||
#define _MM_FROUND_NO_EXC 0x08
|
||||
|
||||
#define _MM_FROUND_NINT (_MM_FROUND_RAISE_EXC | _MM_FROUND_TO_NEAREST_INT)
|
||||
#define _MM_FROUND_FLOOR (_MM_FROUND_RAISE_EXC | _MM_FROUND_TO_NEG_INF)
|
||||
#define _MM_FROUND_CEIL (_MM_FROUND_RAISE_EXC | _MM_FROUND_TO_POS_INF)
|
||||
#define _MM_FROUND_TRUNC (_MM_FROUND_RAISE_EXC | _MM_FROUND_TO_ZERO)
|
||||
#define _MM_FROUND_RINT (_MM_FROUND_RAISE_EXC | _MM_FROUND_CUR_DIRECTION)
|
||||
#define _MM_FROUND_NEARBYINT (_MM_FROUND_NO_EXC | _MM_FROUND_CUR_DIRECTION)
|
||||
|
||||
#define _mm_ceil_ps(X) _mm_round_ps((X), _MM_FROUND_CEIL)
|
||||
#define _mm_ceil_pd(X) _mm_round_pd((X), _MM_FROUND_CEIL)
|
||||
#define _mm_ceil_ss(X, Y) _mm_round_ss((X), (Y), _MM_FROUND_CEIL)
|
||||
#define _mm_ceil_sd(X, Y) _mm_round_sd((X), (Y), _MM_FROUND_CEIL)
|
||||
|
||||
#define _mm_floor_ps(X) _mm_round_ps((X), _MM_FROUND_FLOOR)
|
||||
#define _mm_floor_pd(X) _mm_round_pd((X), _MM_FROUND_FLOOR)
|
||||
#define _mm_floor_ss(X, Y) _mm_round_ss((X), (Y), _MM_FROUND_FLOOR)
|
||||
#define _mm_floor_sd(X, Y) _mm_round_sd((X), (Y), _MM_FROUND_FLOOR)
|
||||
|
||||
#define _mm_round_ps(X, M) __extension__ ({ \
|
||||
(__m128)__builtin_ia32_roundps((__v4sf)(__m128)(X), (M)); })
|
||||
|
||||
#define _mm_round_ss(X, Y, M) __extension__ ({ \
|
||||
(__m128)__builtin_ia32_roundss((__v4sf)(__m128)(X), \
|
||||
(__v4sf)(__m128)(Y), (M)); })
|
||||
|
||||
#define _mm_round_pd(X, M) __extension__ ({ \
|
||||
(__m128d)__builtin_ia32_roundpd((__v2df)(__m128d)(X), (M)); })
|
||||
|
||||
#define _mm_round_sd(X, Y, M) __extension__ ({ \
|
||||
(__m128d)__builtin_ia32_roundsd((__v2df)(__m128d)(X), \
|
||||
(__v2df)(__m128d)(Y), (M)); })
|
||||
|
||||
/* SSE4 Packed Blending Intrinsics. */
|
||||
#define _mm_blend_pd(V1, V2, M) __extension__ ({ \
|
||||
(__m128d)__builtin_shufflevector((__v2df)(__m128d)(V1), \
|
||||
(__v2df)(__m128d)(V2), \
|
||||
(((M) & 0x01) ? 2 : 0), \
|
||||
(((M) & 0x02) ? 3 : 1)); })
|
||||
|
||||
#define _mm_blend_ps(V1, V2, M) __extension__ ({ \
|
||||
(__m128)__builtin_shufflevector((__v4sf)(__m128)(V1), (__v4sf)(__m128)(V2), \
|
||||
(((M) & 0x01) ? 4 : 0), \
|
||||
(((M) & 0x02) ? 5 : 1), \
|
||||
(((M) & 0x04) ? 6 : 2), \
|
||||
(((M) & 0x08) ? 7 : 3)); })
|
||||
|
||||
static __inline__ __m128d __DEFAULT_FN_ATTRS
|
||||
_mm_blendv_pd (__m128d __V1, __m128d __V2, __m128d __M)
|
||||
{
|
||||
return (__m128d) __builtin_ia32_blendvpd ((__v2df)__V1, (__v2df)__V2,
|
||||
(__v2df)__M);
|
||||
}
|
||||
|
||||
static __inline__ __m128 __DEFAULT_FN_ATTRS
|
||||
_mm_blendv_ps (__m128 __V1, __m128 __V2, __m128 __M)
|
||||
{
|
||||
return (__m128) __builtin_ia32_blendvps ((__v4sf)__V1, (__v4sf)__V2,
|
||||
(__v4sf)__M);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_blendv_epi8 (__m128i __V1, __m128i __V2, __m128i __M)
|
||||
{
|
||||
return (__m128i) __builtin_ia32_pblendvb128 ((__v16qi)__V1, (__v16qi)__V2,
|
||||
(__v16qi)__M);
|
||||
}
|
||||
|
||||
#define _mm_blend_epi16(V1, V2, M) __extension__ ({ \
|
||||
(__m128i)__builtin_shufflevector((__v8hi)(__m128i)(V1), \
|
||||
(__v8hi)(__m128i)(V2), \
|
||||
(((M) & 0x01) ? 8 : 0), \
|
||||
(((M) & 0x02) ? 9 : 1), \
|
||||
(((M) & 0x04) ? 10 : 2), \
|
||||
(((M) & 0x08) ? 11 : 3), \
|
||||
(((M) & 0x10) ? 12 : 4), \
|
||||
(((M) & 0x20) ? 13 : 5), \
|
||||
(((M) & 0x40) ? 14 : 6), \
|
||||
(((M) & 0x80) ? 15 : 7)); })
|
||||
|
||||
/* SSE4 Dword Multiply Instructions. */
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_mullo_epi32 (__m128i __V1, __m128i __V2)
|
||||
{
|
||||
return (__m128i) ((__v4su)__V1 * (__v4su)__V2);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_mul_epi32 (__m128i __V1, __m128i __V2)
|
||||
{
|
||||
return (__m128i) __builtin_ia32_pmuldq128 ((__v4si)__V1, (__v4si)__V2);
|
||||
}
|
||||
|
||||
/* SSE4 Floating Point Dot Product Instructions. */
|
||||
#define _mm_dp_ps(X, Y, M) __extension__ ({ \
|
||||
(__m128) __builtin_ia32_dpps((__v4sf)(__m128)(X), \
|
||||
(__v4sf)(__m128)(Y), (M)); })
|
||||
|
||||
#define _mm_dp_pd(X, Y, M) __extension__ ({\
|
||||
(__m128d) __builtin_ia32_dppd((__v2df)(__m128d)(X), \
|
||||
(__v2df)(__m128d)(Y), (M)); })
|
||||
|
||||
/* SSE4 Streaming Load Hint Instruction. */
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_stream_load_si128 (__m128i const *__V)
|
||||
{
|
||||
return (__m128i) __builtin_ia32_movntdqa ((const __v2di *) __V);
|
||||
}
|
||||
|
||||
/* SSE4 Packed Integer Min/Max Instructions. */
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_min_epi8 (__m128i __V1, __m128i __V2)
|
||||
{
|
||||
return (__m128i) __builtin_ia32_pminsb128 ((__v16qi) __V1, (__v16qi) __V2);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_max_epi8 (__m128i __V1, __m128i __V2)
|
||||
{
|
||||
return (__m128i) __builtin_ia32_pmaxsb128 ((__v16qi) __V1, (__v16qi) __V2);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_min_epu16 (__m128i __V1, __m128i __V2)
|
||||
{
|
||||
return (__m128i) __builtin_ia32_pminuw128 ((__v8hi) __V1, (__v8hi) __V2);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_max_epu16 (__m128i __V1, __m128i __V2)
|
||||
{
|
||||
return (__m128i) __builtin_ia32_pmaxuw128 ((__v8hi) __V1, (__v8hi) __V2);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_min_epi32 (__m128i __V1, __m128i __V2)
|
||||
{
|
||||
return (__m128i) __builtin_ia32_pminsd128 ((__v4si) __V1, (__v4si) __V2);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_max_epi32 (__m128i __V1, __m128i __V2)
|
||||
{
|
||||
return (__m128i) __builtin_ia32_pmaxsd128 ((__v4si) __V1, (__v4si) __V2);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_min_epu32 (__m128i __V1, __m128i __V2)
|
||||
{
|
||||
return (__m128i) __builtin_ia32_pminud128((__v4si) __V1, (__v4si) __V2);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_max_epu32 (__m128i __V1, __m128i __V2)
|
||||
{
|
||||
return (__m128i) __builtin_ia32_pmaxud128((__v4si) __V1, (__v4si) __V2);
|
||||
}
|
||||
|
||||
/* SSE4 Insertion and Extraction from XMM Register Instructions. */
|
||||
#define _mm_insert_ps(X, Y, N) __builtin_ia32_insertps128((X), (Y), (N))
|
||||
#define _mm_extract_ps(X, N) (__extension__ \
|
||||
({ union { int __i; float __f; } __t; \
|
||||
__v4sf __a = (__v4sf)(__m128)(X); \
|
||||
__t.__f = __a[(N) & 3]; \
|
||||
__t.__i;}))
|
||||
|
||||
/* Miscellaneous insert and extract macros. */
|
||||
/* Extract a single-precision float from X at index N into D. */
|
||||
#define _MM_EXTRACT_FLOAT(D, X, N) (__extension__ ({ __v4sf __a = (__v4sf)(X); \
|
||||
(D) = __a[N]; }))
|
||||
|
||||
/* Or together 2 sets of indexes (X and Y) with the zeroing bits (Z) to create
|
||||
an index suitable for _mm_insert_ps. */
|
||||
#define _MM_MK_INSERTPS_NDX(X, Y, Z) (((X) << 6) | ((Y) << 4) | (Z))
|
||||
|
||||
/* Extract a float from X at index N into the first index of the return. */
|
||||
#define _MM_PICK_OUT_PS(X, N) _mm_insert_ps (_mm_setzero_ps(), (X), \
|
||||
_MM_MK_INSERTPS_NDX((N), 0, 0x0e))
|
||||
|
||||
/* Insert int into packed integer array at index. */
|
||||
#define _mm_insert_epi8(X, I, N) (__extension__ \
|
||||
({ __v16qi __a = (__v16qi)(__m128i)(X); \
|
||||
__a[(N) & 15] = (I); \
|
||||
(__m128i)__a;}))
|
||||
#define _mm_insert_epi32(X, I, N) (__extension__ \
|
||||
({ __v4si __a = (__v4si)(__m128i)(X); \
|
||||
__a[(N) & 3] = (I); \
|
||||
(__m128i)__a;}))
|
||||
#ifdef __x86_64__
|
||||
#define _mm_insert_epi64(X, I, N) (__extension__ \
|
||||
({ __v2di __a = (__v2di)(__m128i)(X); \
|
||||
__a[(N) & 1] = (I); \
|
||||
(__m128i)__a;}))
|
||||
#endif /* __x86_64__ */
|
||||
|
||||
/* Extract int from packed integer array at index. This returns the element
|
||||
* as a zero extended value, so it is unsigned.
|
||||
*/
|
||||
#define _mm_extract_epi8(X, N) (__extension__ \
|
||||
({ __v16qi __a = (__v16qi)(__m128i)(X); \
|
||||
(int)(unsigned char) __a[(N) & 15];}))
|
||||
#define _mm_extract_epi32(X, N) (__extension__ \
|
||||
({ __v4si __a = (__v4si)(__m128i)(X); \
|
||||
(int)__a[(N) & 3];}))
|
||||
#ifdef __x86_64__
|
||||
#define _mm_extract_epi64(X, N) (__extension__ \
|
||||
({ __v2di __a = (__v2di)(__m128i)(X); \
|
||||
(long long)__a[(N) & 1];}))
|
||||
#endif /* __x86_64 */
|
||||
|
||||
/* SSE4 128-bit Packed Integer Comparisons. */
|
||||
static __inline__ int __DEFAULT_FN_ATTRS
|
||||
_mm_testz_si128(__m128i __M, __m128i __V)
|
||||
{
|
||||
return __builtin_ia32_ptestz128((__v2di)__M, (__v2di)__V);
|
||||
}
|
||||
|
||||
static __inline__ int __DEFAULT_FN_ATTRS
|
||||
_mm_testc_si128(__m128i __M, __m128i __V)
|
||||
{
|
||||
return __builtin_ia32_ptestc128((__v2di)__M, (__v2di)__V);
|
||||
}
|
||||
|
||||
static __inline__ int __DEFAULT_FN_ATTRS
|
||||
_mm_testnzc_si128(__m128i __M, __m128i __V)
|
||||
{
|
||||
return __builtin_ia32_ptestnzc128((__v2di)__M, (__v2di)__V);
|
||||
}
|
||||
|
||||
#define _mm_test_all_ones(V) _mm_testc_si128((V), _mm_cmpeq_epi32((V), (V)))
|
||||
#define _mm_test_mix_ones_zeros(M, V) _mm_testnzc_si128((M), (V))
|
||||
#define _mm_test_all_zeros(M, V) _mm_testz_si128 ((M), (V))
|
||||
|
||||
/* SSE4 64-bit Packed Integer Comparisons. */
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_cmpeq_epi64(__m128i __V1, __m128i __V2)
|
||||
{
|
||||
return (__m128i)((__v2di)__V1 == (__v2di)__V2);
|
||||
}
|
||||
|
||||
/* SSE4 Packed Integer Sign-Extension. */
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_cvtepi8_epi16(__m128i __V)
|
||||
{
|
||||
/* This function always performs a signed extension, but __v16qi is a char
|
||||
which may be signed or unsigned, so use __v16qs. */
|
||||
return (__m128i)__builtin_convertvector(__builtin_shufflevector((__v16qs)__V, (__v16qs)__V, 0, 1, 2, 3, 4, 5, 6, 7), __v8hi);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_cvtepi8_epi32(__m128i __V)
|
||||
{
|
||||
/* This function always performs a signed extension, but __v16qi is a char
|
||||
which may be signed or unsigned, so use __v16qs. */
|
||||
return (__m128i)__builtin_convertvector(__builtin_shufflevector((__v16qs)__V, (__v16qs)__V, 0, 1, 2, 3), __v4si);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_cvtepi8_epi64(__m128i __V)
|
||||
{
|
||||
/* This function always performs a signed extension, but __v16qi is a char
|
||||
which may be signed or unsigned, so use __v16qs. */
|
||||
return (__m128i)__builtin_convertvector(__builtin_shufflevector((__v16qs)__V, (__v16qs)__V, 0, 1), __v2di);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_cvtepi16_epi32(__m128i __V)
|
||||
{
|
||||
return (__m128i)__builtin_convertvector(__builtin_shufflevector((__v8hi)__V, (__v8hi)__V, 0, 1, 2, 3), __v4si);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_cvtepi16_epi64(__m128i __V)
|
||||
{
|
||||
return (__m128i)__builtin_convertvector(__builtin_shufflevector((__v8hi)__V, (__v8hi)__V, 0, 1), __v2di);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_cvtepi32_epi64(__m128i __V)
|
||||
{
|
||||
return (__m128i)__builtin_convertvector(__builtin_shufflevector((__v4si)__V, (__v4si)__V, 0, 1), __v2di);
|
||||
}
|
||||
|
||||
/* SSE4 Packed Integer Zero-Extension. */
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_cvtepu8_epi16(__m128i __V)
|
||||
{
|
||||
return (__m128i)__builtin_convertvector(__builtin_shufflevector((__v16qu)__V, (__v16qu)__V, 0, 1, 2, 3, 4, 5, 6, 7), __v8hi);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_cvtepu8_epi32(__m128i __V)
|
||||
{
|
||||
return (__m128i)__builtin_convertvector(__builtin_shufflevector((__v16qu)__V, (__v16qu)__V, 0, 1, 2, 3), __v4si);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_cvtepu8_epi64(__m128i __V)
|
||||
{
|
||||
return (__m128i)__builtin_convertvector(__builtin_shufflevector((__v16qu)__V, (__v16qu)__V, 0, 1), __v2di);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_cvtepu16_epi32(__m128i __V)
|
||||
{
|
||||
return (__m128i)__builtin_convertvector(__builtin_shufflevector((__v8hu)__V, (__v8hu)__V, 0, 1, 2, 3), __v4si);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_cvtepu16_epi64(__m128i __V)
|
||||
{
|
||||
return (__m128i)__builtin_convertvector(__builtin_shufflevector((__v8hu)__V, (__v8hu)__V, 0, 1), __v2di);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_cvtepu32_epi64(__m128i __V)
|
||||
{
|
||||
return (__m128i)__builtin_convertvector(__builtin_shufflevector((__v4su)__V, (__v4su)__V, 0, 1), __v2di);
|
||||
}
|
||||
|
||||
/* SSE4 Pack with Unsigned Saturation. */
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_packus_epi32(__m128i __V1, __m128i __V2)
|
||||
{
|
||||
return (__m128i) __builtin_ia32_packusdw128((__v4si)__V1, (__v4si)__V2);
|
||||
}
|
||||
|
||||
/* SSE4 Multiple Packed Sums of Absolute Difference. */
|
||||
#define _mm_mpsadbw_epu8(X, Y, M) __extension__ ({ \
|
||||
(__m128i) __builtin_ia32_mpsadbw128((__v16qi)(__m128i)(X), \
|
||||
(__v16qi)(__m128i)(Y), (M)); })
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_minpos_epu16(__m128i __V)
|
||||
{
|
||||
return (__m128i) __builtin_ia32_phminposuw128((__v8hi)__V);
|
||||
}
|
||||
|
||||
/* Handle the sse4.2 definitions here. */
|
||||
|
||||
/* These definitions are normally in nmmintrin.h, but gcc puts them in here
|
||||
so we'll do the same. */
|
||||
|
||||
#undef __DEFAULT_FN_ATTRS
|
||||
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("sse4.2")))
|
||||
|
||||
/* These specify the type of data that we're comparing. */
|
||||
#define _SIDD_UBYTE_OPS 0x00
|
||||
#define _SIDD_UWORD_OPS 0x01
|
||||
#define _SIDD_SBYTE_OPS 0x02
|
||||
#define _SIDD_SWORD_OPS 0x03
|
||||
|
||||
/* These specify the type of comparison operation. */
|
||||
#define _SIDD_CMP_EQUAL_ANY 0x00
|
||||
#define _SIDD_CMP_RANGES 0x04
|
||||
#define _SIDD_CMP_EQUAL_EACH 0x08
|
||||
#define _SIDD_CMP_EQUAL_ORDERED 0x0c
|
||||
|
||||
/* These macros specify the polarity of the operation. */
|
||||
#define _SIDD_POSITIVE_POLARITY 0x00
|
||||
#define _SIDD_NEGATIVE_POLARITY 0x10
|
||||
#define _SIDD_MASKED_POSITIVE_POLARITY 0x20
|
||||
#define _SIDD_MASKED_NEGATIVE_POLARITY 0x30
|
||||
|
||||
/* These macros are used in _mm_cmpXstri() to specify the return. */
|
||||
#define _SIDD_LEAST_SIGNIFICANT 0x00
|
||||
#define _SIDD_MOST_SIGNIFICANT 0x40
|
||||
|
||||
/* These macros are used in _mm_cmpXstri() to specify the return. */
|
||||
#define _SIDD_BIT_MASK 0x00
|
||||
#define _SIDD_UNIT_MASK 0x40
|
||||
|
||||
/* SSE4.2 Packed Comparison Intrinsics. */
|
||||
#define _mm_cmpistrm(A, B, M) \
|
||||
(__m128i)__builtin_ia32_pcmpistrm128((__v16qi)(__m128i)(A), \
|
||||
(__v16qi)(__m128i)(B), (int)(M))
|
||||
#define _mm_cmpistri(A, B, M) \
|
||||
(int)__builtin_ia32_pcmpistri128((__v16qi)(__m128i)(A), \
|
||||
(__v16qi)(__m128i)(B), (int)(M))
|
||||
|
||||
#define _mm_cmpestrm(A, LA, B, LB, M) \
|
||||
(__m128i)__builtin_ia32_pcmpestrm128((__v16qi)(__m128i)(A), (int)(LA), \
|
||||
(__v16qi)(__m128i)(B), (int)(LB), \
|
||||
(int)(M))
|
||||
#define _mm_cmpestri(A, LA, B, LB, M) \
|
||||
(int)__builtin_ia32_pcmpestri128((__v16qi)(__m128i)(A), (int)(LA), \
|
||||
(__v16qi)(__m128i)(B), (int)(LB), \
|
||||
(int)(M))
|
||||
|
||||
/* SSE4.2 Packed Comparison Intrinsics and EFlag Reading. */
|
||||
#define _mm_cmpistra(A, B, M) \
|
||||
(int)__builtin_ia32_pcmpistria128((__v16qi)(__m128i)(A), \
|
||||
(__v16qi)(__m128i)(B), (int)(M))
|
||||
#define _mm_cmpistrc(A, B, M) \
|
||||
(int)__builtin_ia32_pcmpistric128((__v16qi)(__m128i)(A), \
|
||||
(__v16qi)(__m128i)(B), (int)(M))
|
||||
#define _mm_cmpistro(A, B, M) \
|
||||
(int)__builtin_ia32_pcmpistrio128((__v16qi)(__m128i)(A), \
|
||||
(__v16qi)(__m128i)(B), (int)(M))
|
||||
#define _mm_cmpistrs(A, B, M) \
|
||||
(int)__builtin_ia32_pcmpistris128((__v16qi)(__m128i)(A), \
|
||||
(__v16qi)(__m128i)(B), (int)(M))
|
||||
#define _mm_cmpistrz(A, B, M) \
|
||||
(int)__builtin_ia32_pcmpistriz128((__v16qi)(__m128i)(A), \
|
||||
(__v16qi)(__m128i)(B), (int)(M))
|
||||
|
||||
#define _mm_cmpestra(A, LA, B, LB, M) \
|
||||
(int)__builtin_ia32_pcmpestria128((__v16qi)(__m128i)(A), (int)(LA), \
|
||||
(__v16qi)(__m128i)(B), (int)(LB), \
|
||||
(int)(M))
|
||||
#define _mm_cmpestrc(A, LA, B, LB, M) \
|
||||
(int)__builtin_ia32_pcmpestric128((__v16qi)(__m128i)(A), (int)(LA), \
|
||||
(__v16qi)(__m128i)(B), (int)(LB), \
|
||||
(int)(M))
|
||||
#define _mm_cmpestro(A, LA, B, LB, M) \
|
||||
(int)__builtin_ia32_pcmpestrio128((__v16qi)(__m128i)(A), (int)(LA), \
|
||||
(__v16qi)(__m128i)(B), (int)(LB), \
|
||||
(int)(M))
|
||||
#define _mm_cmpestrs(A, LA, B, LB, M) \
|
||||
(int)__builtin_ia32_pcmpestris128((__v16qi)(__m128i)(A), (int)(LA), \
|
||||
(__v16qi)(__m128i)(B), (int)(LB), \
|
||||
(int)(M))
|
||||
#define _mm_cmpestrz(A, LA, B, LB, M) \
|
||||
(int)__builtin_ia32_pcmpestriz128((__v16qi)(__m128i)(A), (int)(LA), \
|
||||
(__v16qi)(__m128i)(B), (int)(LB), \
|
||||
(int)(M))
|
||||
|
||||
/* SSE4.2 Compare Packed Data -- Greater Than. */
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_cmpgt_epi64(__m128i __V1, __m128i __V2)
|
||||
{
|
||||
return (__m128i)((__v2di)__V1 > (__v2di)__V2);
|
||||
}
|
||||
|
||||
/* SSE4.2 Accumulate CRC32. */
|
||||
static __inline__ unsigned int __DEFAULT_FN_ATTRS
|
||||
_mm_crc32_u8(unsigned int __C, unsigned char __D)
|
||||
{
|
||||
return __builtin_ia32_crc32qi(__C, __D);
|
||||
}
|
||||
|
||||
static __inline__ unsigned int __DEFAULT_FN_ATTRS
|
||||
_mm_crc32_u16(unsigned int __C, unsigned short __D)
|
||||
{
|
||||
return __builtin_ia32_crc32hi(__C, __D);
|
||||
}
|
||||
|
||||
static __inline__ unsigned int __DEFAULT_FN_ATTRS
|
||||
_mm_crc32_u32(unsigned int __C, unsigned int __D)
|
||||
{
|
||||
return __builtin_ia32_crc32si(__C, __D);
|
||||
}
|
||||
|
||||
#ifdef __x86_64__
|
||||
static __inline__ unsigned long long __DEFAULT_FN_ATTRS
|
||||
_mm_crc32_u64(unsigned long long __C, unsigned long long __D)
|
||||
{
|
||||
return __builtin_ia32_crc32di(__C, __D);
|
||||
}
|
||||
#endif /* __x86_64__ */
|
||||
|
||||
#undef __DEFAULT_FN_ATTRS
|
||||
|
||||
#ifdef __POPCNT__
|
||||
#include <popcntintrin.h>
|
||||
#endif
|
||||
|
||||
#endif /* _SMMINTRIN_H */
|
||||
@@ -0,0 +1,35 @@
|
||||
/*===---- stdalign.h - Standard header for alignment ------------------------===
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
|
||||
#ifndef __STDALIGN_H
|
||||
#define __STDALIGN_H
|
||||
|
||||
#ifndef __cplusplus
|
||||
#define alignas _Alignas
|
||||
#define alignof _Alignof
|
||||
#endif
|
||||
|
||||
#define __alignas_is_defined 1
|
||||
#define __alignof_is_defined 1
|
||||
|
||||
#endif /* __STDALIGN_H */
|
||||
@@ -0,0 +1,52 @@
|
||||
/*===---- stdarg.h - Variable argument handling ----------------------------===
|
||||
*
|
||||
* Copyright (c) 2008 Eli Friedman
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
|
||||
#ifndef __STDARG_H
|
||||
#define __STDARG_H
|
||||
|
||||
#ifndef _VA_LIST
|
||||
typedef __builtin_va_list va_list;
|
||||
#define _VA_LIST
|
||||
#endif
|
||||
#define va_start(ap, param) __builtin_va_start(ap, param)
|
||||
#define va_end(ap) __builtin_va_end(ap)
|
||||
#define va_arg(ap, type) __builtin_va_arg(ap, type)
|
||||
|
||||
/* GCC always defines __va_copy, but does not define va_copy unless in c99 mode
|
||||
* or -ansi is not specified, since it was not part of C90.
|
||||
*/
|
||||
#define __va_copy(d,s) __builtin_va_copy(d,s)
|
||||
|
||||
#if __STDC_VERSION__ >= 199901L || __cplusplus >= 201103L || !defined(__STRICT_ANSI__)
|
||||
#define va_copy(dest, src) __builtin_va_copy(dest, src)
|
||||
#endif
|
||||
|
||||
/* Hack required to make standard headers work, at least on Ubuntu */
|
||||
#ifndef __GNUC_VA_LIST
|
||||
#define __GNUC_VA_LIST 1
|
||||
#endif
|
||||
typedef __builtin_va_list __gnuc_va_list;
|
||||
|
||||
#endif /* __STDARG_H */
|
||||
@@ -0,0 +1,190 @@
|
||||
/*===---- stdatomic.h - Standard header for atomic types and operations -----===
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
|
||||
#ifndef __CLANG_STDATOMIC_H
|
||||
#define __CLANG_STDATOMIC_H
|
||||
|
||||
/* If we're hosted, fall back to the system's stdatomic.h. FreeBSD, for
|
||||
* example, already has a Clang-compatible stdatomic.h header.
|
||||
*/
|
||||
#if __STDC_HOSTED__ && __has_include_next(<stdatomic.h>)
|
||||
# include_next <stdatomic.h>
|
||||
#else
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* 7.17.1 Introduction */
|
||||
|
||||
#define ATOMIC_BOOL_LOCK_FREE __GCC_ATOMIC_BOOL_LOCK_FREE
|
||||
#define ATOMIC_CHAR_LOCK_FREE __GCC_ATOMIC_CHAR_LOCK_FREE
|
||||
#define ATOMIC_CHAR16_T_LOCK_FREE __GCC_ATOMIC_CHAR16_T_LOCK_FREE
|
||||
#define ATOMIC_CHAR32_T_LOCK_FREE __GCC_ATOMIC_CHAR32_T_LOCK_FREE
|
||||
#define ATOMIC_WCHAR_T_LOCK_FREE __GCC_ATOMIC_WCHAR_T_LOCK_FREE
|
||||
#define ATOMIC_SHORT_T_LOCK_FREE __GCC_ATOMIC_SHORT_T_LOCK_FREE
|
||||
#define ATOMIC_INT_T_LOCK_FREE __GCC_ATOMIC_INT_T_LOCK_FREE
|
||||
#define ATOMIC_LONG_T_LOCK_FREE __GCC_ATOMIC_LONG_T_LOCK_FREE
|
||||
#define ATOMIC_LLONG_T_LOCK_FREE __GCC_ATOMIC_LLONG_T_LOCK_FREE
|
||||
#define ATOMIC_POINTER_T_LOCK_FREE __GCC_ATOMIC_POINTER_T_LOCK_FREE
|
||||
|
||||
/* 7.17.2 Initialization */
|
||||
|
||||
#define ATOMIC_VAR_INIT(value) (value)
|
||||
#define atomic_init __c11_atomic_init
|
||||
|
||||
/* 7.17.3 Order and consistency */
|
||||
|
||||
typedef enum memory_order {
|
||||
memory_order_relaxed = __ATOMIC_RELAXED,
|
||||
memory_order_consume = __ATOMIC_CONSUME,
|
||||
memory_order_acquire = __ATOMIC_ACQUIRE,
|
||||
memory_order_release = __ATOMIC_RELEASE,
|
||||
memory_order_acq_rel = __ATOMIC_ACQ_REL,
|
||||
memory_order_seq_cst = __ATOMIC_SEQ_CST
|
||||
} memory_order;
|
||||
|
||||
#define kill_dependency(y) (y)
|
||||
|
||||
/* 7.17.4 Fences */
|
||||
|
||||
/* These should be provided by the libc implementation. */
|
||||
void atomic_thread_fence(memory_order);
|
||||
void atomic_signal_fence(memory_order);
|
||||
|
||||
#define atomic_thread_fence(order) __c11_atomic_thread_fence(order)
|
||||
#define atomic_signal_fence(order) __c11_atomic_signal_fence(order)
|
||||
|
||||
/* 7.17.5 Lock-free property */
|
||||
|
||||
#define atomic_is_lock_free(obj) __c11_atomic_is_lock_free(sizeof(*(obj)))
|
||||
|
||||
/* 7.17.6 Atomic integer types */
|
||||
|
||||
#ifdef __cplusplus
|
||||
typedef _Atomic(bool) atomic_bool;
|
||||
#else
|
||||
typedef _Atomic(_Bool) atomic_bool;
|
||||
#endif
|
||||
typedef _Atomic(char) atomic_char;
|
||||
typedef _Atomic(signed char) atomic_schar;
|
||||
typedef _Atomic(unsigned char) atomic_uchar;
|
||||
typedef _Atomic(short) atomic_short;
|
||||
typedef _Atomic(unsigned short) atomic_ushort;
|
||||
typedef _Atomic(int) atomic_int;
|
||||
typedef _Atomic(unsigned int) atomic_uint;
|
||||
typedef _Atomic(long) atomic_long;
|
||||
typedef _Atomic(unsigned long) atomic_ulong;
|
||||
typedef _Atomic(long long) atomic_llong;
|
||||
typedef _Atomic(unsigned long long) atomic_ullong;
|
||||
typedef _Atomic(uint_least16_t) atomic_char16_t;
|
||||
typedef _Atomic(uint_least32_t) atomic_char32_t;
|
||||
typedef _Atomic(wchar_t) atomic_wchar_t;
|
||||
typedef _Atomic(int_least8_t) atomic_int_least8_t;
|
||||
typedef _Atomic(uint_least8_t) atomic_uint_least8_t;
|
||||
typedef _Atomic(int_least16_t) atomic_int_least16_t;
|
||||
typedef _Atomic(uint_least16_t) atomic_uint_least16_t;
|
||||
typedef _Atomic(int_least32_t) atomic_int_least32_t;
|
||||
typedef _Atomic(uint_least32_t) atomic_uint_least32_t;
|
||||
typedef _Atomic(int_least64_t) atomic_int_least64_t;
|
||||
typedef _Atomic(uint_least64_t) atomic_uint_least64_t;
|
||||
typedef _Atomic(int_fast8_t) atomic_int_fast8_t;
|
||||
typedef _Atomic(uint_fast8_t) atomic_uint_fast8_t;
|
||||
typedef _Atomic(int_fast16_t) atomic_int_fast16_t;
|
||||
typedef _Atomic(uint_fast16_t) atomic_uint_fast16_t;
|
||||
typedef _Atomic(int_fast32_t) atomic_int_fast32_t;
|
||||
typedef _Atomic(uint_fast32_t) atomic_uint_fast32_t;
|
||||
typedef _Atomic(int_fast64_t) atomic_int_fast64_t;
|
||||
typedef _Atomic(uint_fast64_t) atomic_uint_fast64_t;
|
||||
typedef _Atomic(intptr_t) atomic_intptr_t;
|
||||
typedef _Atomic(uintptr_t) atomic_uintptr_t;
|
||||
typedef _Atomic(size_t) atomic_size_t;
|
||||
typedef _Atomic(ptrdiff_t) atomic_ptrdiff_t;
|
||||
typedef _Atomic(intmax_t) atomic_intmax_t;
|
||||
typedef _Atomic(uintmax_t) atomic_uintmax_t;
|
||||
|
||||
/* 7.17.7 Operations on atomic types */
|
||||
|
||||
#define atomic_store(object, desired) __c11_atomic_store(object, desired, __ATOMIC_SEQ_CST)
|
||||
#define atomic_store_explicit __c11_atomic_store
|
||||
|
||||
#define atomic_load(object) __c11_atomic_load(object, __ATOMIC_SEQ_CST)
|
||||
#define atomic_load_explicit __c11_atomic_load
|
||||
|
||||
#define atomic_exchange(object, desired) __c11_atomic_exchange(object, desired, __ATOMIC_SEQ_CST)
|
||||
#define atomic_exchange_explicit __c11_atomic_exchange
|
||||
|
||||
#define atomic_compare_exchange_strong(object, expected, desired) __c11_atomic_compare_exchange_strong(object, expected, desired, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)
|
||||
#define atomic_compare_exchange_strong_explicit __c11_atomic_compare_exchange_strong
|
||||
|
||||
#define atomic_compare_exchange_weak(object, expected, desired) __c11_atomic_compare_exchange_weak(object, expected, desired, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)
|
||||
#define atomic_compare_exchange_weak_explicit __c11_atomic_compare_exchange_weak
|
||||
|
||||
#define atomic_fetch_add(object, operand) __c11_atomic_fetch_add(object, operand, __ATOMIC_SEQ_CST)
|
||||
#define atomic_fetch_add_explicit __c11_atomic_fetch_add
|
||||
|
||||
#define atomic_fetch_sub(object, operand) __c11_atomic_fetch_sub(object, operand, __ATOMIC_SEQ_CST)
|
||||
#define atomic_fetch_sub_explicit __c11_atomic_fetch_sub
|
||||
|
||||
#define atomic_fetch_or(object, operand) __c11_atomic_fetch_or(object, operand, __ATOMIC_SEQ_CST)
|
||||
#define atomic_fetch_or_explicit __c11_atomic_fetch_or
|
||||
|
||||
#define atomic_fetch_xor(object, operand) __c11_atomic_fetch_xor(object, operand, __ATOMIC_SEQ_CST)
|
||||
#define atomic_fetch_xor_explicit __c11_atomic_fetch_xor
|
||||
|
||||
#define atomic_fetch_and(object, operand) __c11_atomic_fetch_and(object, operand, __ATOMIC_SEQ_CST)
|
||||
#define atomic_fetch_and_explicit __c11_atomic_fetch_and
|
||||
|
||||
/* 7.17.8 Atomic flag type and operations */
|
||||
|
||||
typedef struct atomic_flag { atomic_bool _Value; } atomic_flag;
|
||||
|
||||
#define ATOMIC_FLAG_INIT { 0 }
|
||||
|
||||
/* These should be provided by the libc implementation. */
|
||||
#ifdef __cplusplus
|
||||
bool atomic_flag_test_and_set(volatile atomic_flag *);
|
||||
bool atomic_flag_test_and_set_explicit(volatile atomic_flag *, memory_order);
|
||||
#else
|
||||
_Bool atomic_flag_test_and_set(volatile atomic_flag *);
|
||||
_Bool atomic_flag_test_and_set_explicit(volatile atomic_flag *, memory_order);
|
||||
#endif
|
||||
void atomic_flag_clear(volatile atomic_flag *);
|
||||
void atomic_flag_clear_explicit(volatile atomic_flag *, memory_order);
|
||||
|
||||
#define atomic_flag_test_and_set(object) __c11_atomic_exchange(&(object)->_Value, 1, __ATOMIC_SEQ_CST)
|
||||
#define atomic_flag_test_and_set_explicit(object, order) __c11_atomic_exchange(&(object)->_Value, 1, order)
|
||||
|
||||
#define atomic_flag_clear(object) __c11_atomic_store(&(object)->_Value, 0, __ATOMIC_SEQ_CST)
|
||||
#define atomic_flag_clear_explicit(object, order) __c11_atomic_store(&(object)->_Value, 0, order)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __STDC_HOSTED__ */
|
||||
#endif /* __CLANG_STDATOMIC_H */
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
/*===---- stdbool.h - Standard header for booleans -------------------------===
|
||||
*
|
||||
* Copyright (c) 2008 Eli Friedman
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
|
||||
#ifndef __STDBOOL_H
|
||||
#define __STDBOOL_H
|
||||
|
||||
/* Don't define bool, true, and false in C++, except as a GNU extension. */
|
||||
#ifndef __cplusplus
|
||||
#define bool _Bool
|
||||
#define true 1
|
||||
#define false 0
|
||||
#elif defined(__GNUC__) && !defined(__STRICT_ANSI__)
|
||||
/* Define _Bool, bool, false, true as a GNU extension. */
|
||||
#define _Bool bool
|
||||
#define bool bool
|
||||
#define false false
|
||||
#define true true
|
||||
#endif
|
||||
|
||||
#define __bool_true_false_are_defined 1
|
||||
|
||||
#endif /* __STDBOOL_H */
|
||||
@@ -0,0 +1,137 @@
|
||||
/*===---- stddef.h - Basic type definitions --------------------------------===
|
||||
*
|
||||
* Copyright (c) 2008 Eli Friedman
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
|
||||
#if !defined(__STDDEF_H) || defined(__need_ptrdiff_t) || \
|
||||
defined(__need_size_t) || defined(__need_wchar_t) || \
|
||||
defined(__need_NULL) || defined(__need_wint_t)
|
||||
|
||||
#if !defined(__need_ptrdiff_t) && !defined(__need_size_t) && \
|
||||
!defined(__need_wchar_t) && !defined(__need_NULL) && \
|
||||
!defined(__need_wint_t)
|
||||
/* Always define miscellaneous pieces when modules are available. */
|
||||
#if !__has_feature(modules)
|
||||
#define __STDDEF_H
|
||||
#endif
|
||||
#define __need_ptrdiff_t
|
||||
#define __need_size_t
|
||||
#define __need_wchar_t
|
||||
#define __need_NULL
|
||||
#define __need_STDDEF_H_misc
|
||||
/* __need_wint_t is intentionally not defined here. */
|
||||
#endif
|
||||
|
||||
#if defined(__need_ptrdiff_t)
|
||||
#if !defined(_PTRDIFF_T) || __has_feature(modules)
|
||||
/* Always define ptrdiff_t when modules are available. */
|
||||
#if !__has_feature(modules)
|
||||
#define _PTRDIFF_T
|
||||
#endif
|
||||
typedef __PTRDIFF_TYPE__ ptrdiff_t;
|
||||
#endif
|
||||
#undef __need_ptrdiff_t
|
||||
#endif /* defined(__need_ptrdiff_t) */
|
||||
|
||||
#if defined(__need_size_t)
|
||||
#if !defined(_SIZE_T) || __has_feature(modules)
|
||||
/* Always define size_t when modules are available. */
|
||||
#if !__has_feature(modules)
|
||||
#define _SIZE_T
|
||||
#endif
|
||||
typedef __SIZE_TYPE__ size_t;
|
||||
#endif
|
||||
#undef __need_size_t
|
||||
#endif /*defined(__need_size_t) */
|
||||
|
||||
#if defined(__need_STDDEF_H_misc)
|
||||
/* ISO9899:2011 7.20 (C11 Annex K): Define rsize_t if __STDC_WANT_LIB_EXT1__ is
|
||||
* enabled. */
|
||||
#if (defined(__STDC_WANT_LIB_EXT1__) && __STDC_WANT_LIB_EXT1__ >= 1 && \
|
||||
!defined(_RSIZE_T)) || __has_feature(modules)
|
||||
/* Always define rsize_t when modules are available. */
|
||||
#if !__has_feature(modules)
|
||||
#define _RSIZE_T
|
||||
#endif
|
||||
typedef __SIZE_TYPE__ rsize_t;
|
||||
#endif
|
||||
#endif /* defined(__need_STDDEF_H_misc) */
|
||||
|
||||
#if defined(__need_wchar_t)
|
||||
#ifndef __cplusplus
|
||||
/* Always define wchar_t when modules are available. */
|
||||
#if !defined(_WCHAR_T) || __has_feature(modules)
|
||||
#if !__has_feature(modules)
|
||||
#define _WCHAR_T
|
||||
#if defined(_MSC_EXTENSIONS)
|
||||
#define _WCHAR_T_DEFINED
|
||||
#endif
|
||||
#endif
|
||||
typedef __WCHAR_TYPE__ wchar_t;
|
||||
#endif
|
||||
#endif
|
||||
#undef __need_wchar_t
|
||||
#endif /* defined(__need_wchar_t) */
|
||||
|
||||
#if defined(__need_NULL)
|
||||
#undef NULL
|
||||
#ifdef __cplusplus
|
||||
# if !defined(__MINGW32__) && !defined(_MSC_VER)
|
||||
# define NULL __null
|
||||
# else
|
||||
# define NULL 0
|
||||
# endif
|
||||
#else
|
||||
# define NULL ((void*)0)
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
#if defined(_MSC_EXTENSIONS) && defined(_NATIVE_NULLPTR_SUPPORTED)
|
||||
namespace std { typedef decltype(nullptr) nullptr_t; }
|
||||
using ::std::nullptr_t;
|
||||
#endif
|
||||
#endif
|
||||
#undef __need_NULL
|
||||
#endif /* defined(__need_NULL) */
|
||||
|
||||
#if defined(__need_STDDEF_H_misc)
|
||||
#if __STDC_VERSION__ >= 201112L || __cplusplus >= 201103L
|
||||
#include "__stddef_max_align_t.h"
|
||||
#endif
|
||||
#define offsetof(t, d) __builtin_offsetof(t, d)
|
||||
#undef __need_STDDEF_H_misc
|
||||
#endif /* defined(__need_STDDEF_H_misc) */
|
||||
|
||||
/* Some C libraries expect to see a wint_t here. Others (notably MinGW) will use
|
||||
__WINT_TYPE__ directly; accommodate both by requiring __need_wint_t */
|
||||
#if defined(__need_wint_t)
|
||||
/* Always define wint_t when modules are available. */
|
||||
#if !defined(_WINT_T) || __has_feature(modules)
|
||||
#if !__has_feature(modules)
|
||||
#define _WINT_T
|
||||
#endif
|
||||
typedef __WINT_TYPE__ wint_t;
|
||||
#endif
|
||||
#undef __need_wint_t
|
||||
#endif /* __need_wint_t */
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,707 @@
|
||||
/*===---- stdint.h - Standard header for sized integer types --------------===*\
|
||||
*
|
||||
* Copyright (c) 2009 Chris Lattner
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
\*===----------------------------------------------------------------------===*/
|
||||
|
||||
#ifndef __CLANG_STDINT_H
|
||||
#define __CLANG_STDINT_H
|
||||
|
||||
/* If we're hosted, fall back to the system's stdint.h, which might have
|
||||
* additional definitions.
|
||||
*/
|
||||
#if __STDC_HOSTED__ && __has_include_next(<stdint.h>)
|
||||
|
||||
// C99 7.18.3 Limits of other integer types
|
||||
//
|
||||
// Footnote 219, 220: C++ implementations should define these macros only when
|
||||
// __STDC_LIMIT_MACROS is defined before <stdint.h> is included.
|
||||
//
|
||||
// Footnote 222: C++ implementations should define these macros only when
|
||||
// __STDC_CONSTANT_MACROS is defined before <stdint.h> is included.
|
||||
//
|
||||
// C++11 [cstdint.syn]p2:
|
||||
//
|
||||
// The macros defined by <cstdint> are provided unconditionally. In particular,
|
||||
// the symbols __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS (mentioned in
|
||||
// footnotes 219, 220, and 222 in the C standard) play no role in C++.
|
||||
//
|
||||
// C11 removed the problematic footnotes.
|
||||
//
|
||||
// Work around this inconsistency by always defining those macros in C++ mode,
|
||||
// so that a C library implementation which follows the C99 standard can be
|
||||
// used in C++.
|
||||
# ifdef __cplusplus
|
||||
# if !defined(__STDC_LIMIT_MACROS)
|
||||
# define __STDC_LIMIT_MACROS
|
||||
# define __STDC_LIMIT_MACROS_DEFINED_BY_CLANG
|
||||
# endif
|
||||
# if !defined(__STDC_CONSTANT_MACROS)
|
||||
# define __STDC_CONSTANT_MACROS
|
||||
# define __STDC_CONSTANT_MACROS_DEFINED_BY_CLANG
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# include_next <stdint.h>
|
||||
|
||||
# ifdef __STDC_LIMIT_MACROS_DEFINED_BY_CLANG
|
||||
# undef __STDC_LIMIT_MACROS
|
||||
# undef __STDC_LIMIT_MACROS_DEFINED_BY_CLANG
|
||||
# endif
|
||||
# ifdef __STDC_CONSTANT_MACROS_DEFINED_BY_CLANG
|
||||
# undef __STDC_CONSTANT_MACROS
|
||||
# undef __STDC_CONSTANT_MACROS_DEFINED_BY_CLANG
|
||||
# endif
|
||||
|
||||
#else
|
||||
|
||||
/* C99 7.18.1.1 Exact-width integer types.
|
||||
* C99 7.18.1.2 Minimum-width integer types.
|
||||
* C99 7.18.1.3 Fastest minimum-width integer types.
|
||||
*
|
||||
* The standard requires that exact-width type be defined for 8-, 16-, 32-, and
|
||||
* 64-bit types if they are implemented. Other exact width types are optional.
|
||||
* This implementation defines an exact-width types for every integer width
|
||||
* that is represented in the standard integer types.
|
||||
*
|
||||
* The standard also requires minimum-width types be defined for 8-, 16-, 32-,
|
||||
* and 64-bit widths regardless of whether there are corresponding exact-width
|
||||
* types.
|
||||
*
|
||||
* To accommodate targets that are missing types that are exactly 8, 16, 32, or
|
||||
* 64 bits wide, this implementation takes an approach of cascading
|
||||
* redefintions, redefining __int_leastN_t to successively smaller exact-width
|
||||
* types. It is therefore important that the types are defined in order of
|
||||
* descending widths.
|
||||
*
|
||||
* We currently assume that the minimum-width types and the fastest
|
||||
* minimum-width types are the same. This is allowed by the standard, but is
|
||||
* suboptimal.
|
||||
*
|
||||
* In violation of the standard, some targets do not implement a type that is
|
||||
* wide enough to represent all of the required widths (8-, 16-, 32-, 64-bit).
|
||||
* To accommodate these targets, a required minimum-width type is only
|
||||
* defined if there exists an exact-width type of equal or greater width.
|
||||
*/
|
||||
|
||||
#ifdef __INT64_TYPE__
|
||||
# ifndef __int8_t_defined /* glibc sys/types.h also defines int64_t*/
|
||||
typedef __INT64_TYPE__ int64_t;
|
||||
# endif /* __int8_t_defined */
|
||||
typedef __UINT64_TYPE__ uint64_t;
|
||||
# define __int_least64_t int64_t
|
||||
# define __uint_least64_t uint64_t
|
||||
# define __int_least32_t int64_t
|
||||
# define __uint_least32_t uint64_t
|
||||
# define __int_least16_t int64_t
|
||||
# define __uint_least16_t uint64_t
|
||||
# define __int_least8_t int64_t
|
||||
# define __uint_least8_t uint64_t
|
||||
#endif /* __INT64_TYPE__ */
|
||||
|
||||
#ifdef __int_least64_t
|
||||
typedef __int_least64_t int_least64_t;
|
||||
typedef __uint_least64_t uint_least64_t;
|
||||
typedef __int_least64_t int_fast64_t;
|
||||
typedef __uint_least64_t uint_fast64_t;
|
||||
#endif /* __int_least64_t */
|
||||
|
||||
#ifdef __INT56_TYPE__
|
||||
typedef __INT56_TYPE__ int56_t;
|
||||
typedef __UINT56_TYPE__ uint56_t;
|
||||
typedef int56_t int_least56_t;
|
||||
typedef uint56_t uint_least56_t;
|
||||
typedef int56_t int_fast56_t;
|
||||
typedef uint56_t uint_fast56_t;
|
||||
# define __int_least32_t int56_t
|
||||
# define __uint_least32_t uint56_t
|
||||
# define __int_least16_t int56_t
|
||||
# define __uint_least16_t uint56_t
|
||||
# define __int_least8_t int56_t
|
||||
# define __uint_least8_t uint56_t
|
||||
#endif /* __INT56_TYPE__ */
|
||||
|
||||
|
||||
#ifdef __INT48_TYPE__
|
||||
typedef __INT48_TYPE__ int48_t;
|
||||
typedef __UINT48_TYPE__ uint48_t;
|
||||
typedef int48_t int_least48_t;
|
||||
typedef uint48_t uint_least48_t;
|
||||
typedef int48_t int_fast48_t;
|
||||
typedef uint48_t uint_fast48_t;
|
||||
# define __int_least32_t int48_t
|
||||
# define __uint_least32_t uint48_t
|
||||
# define __int_least16_t int48_t
|
||||
# define __uint_least16_t uint48_t
|
||||
# define __int_least8_t int48_t
|
||||
# define __uint_least8_t uint48_t
|
||||
#endif /* __INT48_TYPE__ */
|
||||
|
||||
|
||||
#ifdef __INT40_TYPE__
|
||||
typedef __INT40_TYPE__ int40_t;
|
||||
typedef __UINT40_TYPE__ uint40_t;
|
||||
typedef int40_t int_least40_t;
|
||||
typedef uint40_t uint_least40_t;
|
||||
typedef int40_t int_fast40_t;
|
||||
typedef uint40_t uint_fast40_t;
|
||||
# define __int_least32_t int40_t
|
||||
# define __uint_least32_t uint40_t
|
||||
# define __int_least16_t int40_t
|
||||
# define __uint_least16_t uint40_t
|
||||
# define __int_least8_t int40_t
|
||||
# define __uint_least8_t uint40_t
|
||||
#endif /* __INT40_TYPE__ */
|
||||
|
||||
|
||||
#ifdef __INT32_TYPE__
|
||||
|
||||
# ifndef __int8_t_defined /* glibc sys/types.h also defines int32_t*/
|
||||
typedef __INT32_TYPE__ int32_t;
|
||||
# endif /* __int8_t_defined */
|
||||
|
||||
# ifndef __uint32_t_defined /* more glibc compatibility */
|
||||
# define __uint32_t_defined
|
||||
typedef __UINT32_TYPE__ uint32_t;
|
||||
# endif /* __uint32_t_defined */
|
||||
|
||||
# define __int_least32_t int32_t
|
||||
# define __uint_least32_t uint32_t
|
||||
# define __int_least16_t int32_t
|
||||
# define __uint_least16_t uint32_t
|
||||
# define __int_least8_t int32_t
|
||||
# define __uint_least8_t uint32_t
|
||||
#endif /* __INT32_TYPE__ */
|
||||
|
||||
#ifdef __int_least32_t
|
||||
typedef __int_least32_t int_least32_t;
|
||||
typedef __uint_least32_t uint_least32_t;
|
||||
typedef __int_least32_t int_fast32_t;
|
||||
typedef __uint_least32_t uint_fast32_t;
|
||||
#endif /* __int_least32_t */
|
||||
|
||||
#ifdef __INT24_TYPE__
|
||||
typedef __INT24_TYPE__ int24_t;
|
||||
typedef __UINT24_TYPE__ uint24_t;
|
||||
typedef int24_t int_least24_t;
|
||||
typedef uint24_t uint_least24_t;
|
||||
typedef int24_t int_fast24_t;
|
||||
typedef uint24_t uint_fast24_t;
|
||||
# define __int_least16_t int24_t
|
||||
# define __uint_least16_t uint24_t
|
||||
# define __int_least8_t int24_t
|
||||
# define __uint_least8_t uint24_t
|
||||
#endif /* __INT24_TYPE__ */
|
||||
|
||||
#ifdef __INT16_TYPE__
|
||||
#ifndef __int8_t_defined /* glibc sys/types.h also defines int16_t*/
|
||||
typedef __INT16_TYPE__ int16_t;
|
||||
#endif /* __int8_t_defined */
|
||||
typedef __UINT16_TYPE__ uint16_t;
|
||||
# define __int_least16_t int16_t
|
||||
# define __uint_least16_t uint16_t
|
||||
# define __int_least8_t int16_t
|
||||
# define __uint_least8_t uint16_t
|
||||
#endif /* __INT16_TYPE__ */
|
||||
|
||||
#ifdef __int_least16_t
|
||||
typedef __int_least16_t int_least16_t;
|
||||
typedef __uint_least16_t uint_least16_t;
|
||||
typedef __int_least16_t int_fast16_t;
|
||||
typedef __uint_least16_t uint_fast16_t;
|
||||
#endif /* __int_least16_t */
|
||||
|
||||
|
||||
#ifdef __INT8_TYPE__
|
||||
#ifndef __int8_t_defined /* glibc sys/types.h also defines int8_t*/
|
||||
typedef __INT8_TYPE__ int8_t;
|
||||
#endif /* __int8_t_defined */
|
||||
typedef __UINT8_TYPE__ uint8_t;
|
||||
# define __int_least8_t int8_t
|
||||
# define __uint_least8_t uint8_t
|
||||
#endif /* __INT8_TYPE__ */
|
||||
|
||||
#ifdef __int_least8_t
|
||||
typedef __int_least8_t int_least8_t;
|
||||
typedef __uint_least8_t uint_least8_t;
|
||||
typedef __int_least8_t int_fast8_t;
|
||||
typedef __uint_least8_t uint_fast8_t;
|
||||
#endif /* __int_least8_t */
|
||||
|
||||
/* prevent glibc sys/types.h from defining conflicting types */
|
||||
#ifndef __int8_t_defined
|
||||
# define __int8_t_defined
|
||||
#endif /* __int8_t_defined */
|
||||
|
||||
/* C99 7.18.1.4 Integer types capable of holding object pointers.
|
||||
*/
|
||||
#define __stdint_join3(a,b,c) a ## b ## c
|
||||
|
||||
#define __intn_t(n) __stdint_join3( int, n, _t)
|
||||
#define __uintn_t(n) __stdint_join3(uint, n, _t)
|
||||
|
||||
#ifndef _INTPTR_T
|
||||
#ifndef __intptr_t_defined
|
||||
typedef __intn_t(__INTPTR_WIDTH__) intptr_t;
|
||||
#define __intptr_t_defined
|
||||
#define _INTPTR_T
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef _UINTPTR_T
|
||||
typedef __uintn_t(__INTPTR_WIDTH__) uintptr_t;
|
||||
#define _UINTPTR_T
|
||||
#endif
|
||||
|
||||
/* C99 7.18.1.5 Greatest-width integer types.
|
||||
*/
|
||||
typedef __INTMAX_TYPE__ intmax_t;
|
||||
typedef __UINTMAX_TYPE__ uintmax_t;
|
||||
|
||||
/* C99 7.18.4 Macros for minimum-width integer constants.
|
||||
*
|
||||
* The standard requires that integer constant macros be defined for all the
|
||||
* minimum-width types defined above. As 8-, 16-, 32-, and 64-bit minimum-width
|
||||
* types are required, the corresponding integer constant macros are defined
|
||||
* here. This implementation also defines minimum-width types for every other
|
||||
* integer width that the target implements, so corresponding macros are
|
||||
* defined below, too.
|
||||
*
|
||||
* These macros are defined using the same successive-shrinking approach as
|
||||
* the type definitions above. It is likewise important that macros are defined
|
||||
* in order of decending width.
|
||||
*
|
||||
* Note that C++ should not check __STDC_CONSTANT_MACROS here, contrary to the
|
||||
* claims of the C standard (see C++ 18.3.1p2, [cstdint.syn]).
|
||||
*/
|
||||
|
||||
#define __int_c_join(a, b) a ## b
|
||||
#define __int_c(v, suffix) __int_c_join(v, suffix)
|
||||
#define __uint_c(v, suffix) __int_c_join(v##U, suffix)
|
||||
|
||||
|
||||
#ifdef __INT64_TYPE__
|
||||
# ifdef __INT64_C_SUFFIX__
|
||||
# define __int64_c_suffix __INT64_C_SUFFIX__
|
||||
# define __int32_c_suffix __INT64_C_SUFFIX__
|
||||
# define __int16_c_suffix __INT64_C_SUFFIX__
|
||||
# define __int8_c_suffix __INT64_C_SUFFIX__
|
||||
# else
|
||||
# undef __int64_c_suffix
|
||||
# undef __int32_c_suffix
|
||||
# undef __int16_c_suffix
|
||||
# undef __int8_c_suffix
|
||||
# endif /* __INT64_C_SUFFIX__ */
|
||||
#endif /* __INT64_TYPE__ */
|
||||
|
||||
#ifdef __int_least64_t
|
||||
# ifdef __int64_c_suffix
|
||||
# define INT64_C(v) __int_c(v, __int64_c_suffix)
|
||||
# define UINT64_C(v) __uint_c(v, __int64_c_suffix)
|
||||
# else
|
||||
# define INT64_C(v) v
|
||||
# define UINT64_C(v) v ## U
|
||||
# endif /* __int64_c_suffix */
|
||||
#endif /* __int_least64_t */
|
||||
|
||||
|
||||
#ifdef __INT56_TYPE__
|
||||
# ifdef __INT56_C_SUFFIX__
|
||||
# define INT56_C(v) __int_c(v, __INT56_C_SUFFIX__)
|
||||
# define UINT56_C(v) __uint_c(v, __INT56_C_SUFFIX__)
|
||||
# define __int32_c_suffix __INT56_C_SUFFIX__
|
||||
# define __int16_c_suffix __INT56_C_SUFFIX__
|
||||
# define __int8_c_suffix __INT56_C_SUFFIX__
|
||||
# else
|
||||
# define INT56_C(v) v
|
||||
# define UINT56_C(v) v ## U
|
||||
# undef __int32_c_suffix
|
||||
# undef __int16_c_suffix
|
||||
# undef __int8_c_suffix
|
||||
# endif /* __INT56_C_SUFFIX__ */
|
||||
#endif /* __INT56_TYPE__ */
|
||||
|
||||
|
||||
#ifdef __INT48_TYPE__
|
||||
# ifdef __INT48_C_SUFFIX__
|
||||
# define INT48_C(v) __int_c(v, __INT48_C_SUFFIX__)
|
||||
# define UINT48_C(v) __uint_c(v, __INT48_C_SUFFIX__)
|
||||
# define __int32_c_suffix __INT48_C_SUFFIX__
|
||||
# define __int16_c_suffix __INT48_C_SUFFIX__
|
||||
# define __int8_c_suffix __INT48_C_SUFFIX__
|
||||
# else
|
||||
# define INT48_C(v) v
|
||||
# define UINT48_C(v) v ## U
|
||||
# undef __int32_c_suffix
|
||||
# undef __int16_c_suffix
|
||||
# undef __int8_c_suffix
|
||||
# endif /* __INT48_C_SUFFIX__ */
|
||||
#endif /* __INT48_TYPE__ */
|
||||
|
||||
|
||||
#ifdef __INT40_TYPE__
|
||||
# ifdef __INT40_C_SUFFIX__
|
||||
# define INT40_C(v) __int_c(v, __INT40_C_SUFFIX__)
|
||||
# define UINT40_C(v) __uint_c(v, __INT40_C_SUFFIX__)
|
||||
# define __int32_c_suffix __INT40_C_SUFFIX__
|
||||
# define __int16_c_suffix __INT40_C_SUFFIX__
|
||||
# define __int8_c_suffix __INT40_C_SUFFIX__
|
||||
# else
|
||||
# define INT40_C(v) v
|
||||
# define UINT40_C(v) v ## U
|
||||
# undef __int32_c_suffix
|
||||
# undef __int16_c_suffix
|
||||
# undef __int8_c_suffix
|
||||
# endif /* __INT40_C_SUFFIX__ */
|
||||
#endif /* __INT40_TYPE__ */
|
||||
|
||||
|
||||
#ifdef __INT32_TYPE__
|
||||
# ifdef __INT32_C_SUFFIX__
|
||||
# define __int32_c_suffix __INT32_C_SUFFIX__
|
||||
# define __int16_c_suffix __INT32_C_SUFFIX__
|
||||
# define __int8_c_suffix __INT32_C_SUFFIX__
|
||||
#else
|
||||
# undef __int32_c_suffix
|
||||
# undef __int16_c_suffix
|
||||
# undef __int8_c_suffix
|
||||
# endif /* __INT32_C_SUFFIX__ */
|
||||
#endif /* __INT32_TYPE__ */
|
||||
|
||||
#ifdef __int_least32_t
|
||||
# ifdef __int32_c_suffix
|
||||
# define INT32_C(v) __int_c(v, __int32_c_suffix)
|
||||
# define UINT32_C(v) __uint_c(v, __int32_c_suffix)
|
||||
# else
|
||||
# define INT32_C(v) v
|
||||
# define UINT32_C(v) v ## U
|
||||
# endif /* __int32_c_suffix */
|
||||
#endif /* __int_least32_t */
|
||||
|
||||
|
||||
#ifdef __INT24_TYPE__
|
||||
# ifdef __INT24_C_SUFFIX__
|
||||
# define INT24_C(v) __int_c(v, __INT24_C_SUFFIX__)
|
||||
# define UINT24_C(v) __uint_c(v, __INT24_C_SUFFIX__)
|
||||
# define __int16_c_suffix __INT24_C_SUFFIX__
|
||||
# define __int8_c_suffix __INT24_C_SUFFIX__
|
||||
# else
|
||||
# define INT24_C(v) v
|
||||
# define UINT24_C(v) v ## U
|
||||
# undef __int16_c_suffix
|
||||
# undef __int8_c_suffix
|
||||
# endif /* __INT24_C_SUFFIX__ */
|
||||
#endif /* __INT24_TYPE__ */
|
||||
|
||||
|
||||
#ifdef __INT16_TYPE__
|
||||
# ifdef __INT16_C_SUFFIX__
|
||||
# define __int16_c_suffix __INT16_C_SUFFIX__
|
||||
# define __int8_c_suffix __INT16_C_SUFFIX__
|
||||
#else
|
||||
# undef __int16_c_suffix
|
||||
# undef __int8_c_suffix
|
||||
# endif /* __INT16_C_SUFFIX__ */
|
||||
#endif /* __INT16_TYPE__ */
|
||||
|
||||
#ifdef __int_least16_t
|
||||
# ifdef __int16_c_suffix
|
||||
# define INT16_C(v) __int_c(v, __int16_c_suffix)
|
||||
# define UINT16_C(v) __uint_c(v, __int16_c_suffix)
|
||||
# else
|
||||
# define INT16_C(v) v
|
||||
# define UINT16_C(v) v ## U
|
||||
# endif /* __int16_c_suffix */
|
||||
#endif /* __int_least16_t */
|
||||
|
||||
|
||||
#ifdef __INT8_TYPE__
|
||||
# ifdef __INT8_C_SUFFIX__
|
||||
# define __int8_c_suffix __INT8_C_SUFFIX__
|
||||
#else
|
||||
# undef __int8_c_suffix
|
||||
# endif /* __INT8_C_SUFFIX__ */
|
||||
#endif /* __INT8_TYPE__ */
|
||||
|
||||
#ifdef __int_least8_t
|
||||
# ifdef __int8_c_suffix
|
||||
# define INT8_C(v) __int_c(v, __int8_c_suffix)
|
||||
# define UINT8_C(v) __uint_c(v, __int8_c_suffix)
|
||||
# else
|
||||
# define INT8_C(v) v
|
||||
# define UINT8_C(v) v ## U
|
||||
# endif /* __int8_c_suffix */
|
||||
#endif /* __int_least8_t */
|
||||
|
||||
|
||||
/* C99 7.18.2.1 Limits of exact-width integer types.
|
||||
* C99 7.18.2.2 Limits of minimum-width integer types.
|
||||
* C99 7.18.2.3 Limits of fastest minimum-width integer types.
|
||||
*
|
||||
* The presence of limit macros are completely optional in C99. This
|
||||
* implementation defines limits for all of the types (exact- and
|
||||
* minimum-width) that it defines above, using the limits of the minimum-width
|
||||
* type for any types that do not have exact-width representations.
|
||||
*
|
||||
* As in the type definitions, this section takes an approach of
|
||||
* successive-shrinking to determine which limits to use for the standard (8,
|
||||
* 16, 32, 64) bit widths when they don't have exact representations. It is
|
||||
* therefore important that the defintions be kept in order of decending
|
||||
* widths.
|
||||
*
|
||||
* Note that C++ should not check __STDC_LIMIT_MACROS here, contrary to the
|
||||
* claims of the C standard (see C++ 18.3.1p2, [cstdint.syn]).
|
||||
*/
|
||||
|
||||
#ifdef __INT64_TYPE__
|
||||
# define INT64_MAX INT64_C( 9223372036854775807)
|
||||
# define INT64_MIN (-INT64_C( 9223372036854775807)-1)
|
||||
# define UINT64_MAX UINT64_C(18446744073709551615)
|
||||
# define __INT_LEAST64_MIN INT64_MIN
|
||||
# define __INT_LEAST64_MAX INT64_MAX
|
||||
# define __UINT_LEAST64_MAX UINT64_MAX
|
||||
# define __INT_LEAST32_MIN INT64_MIN
|
||||
# define __INT_LEAST32_MAX INT64_MAX
|
||||
# define __UINT_LEAST32_MAX UINT64_MAX
|
||||
# define __INT_LEAST16_MIN INT64_MIN
|
||||
# define __INT_LEAST16_MAX INT64_MAX
|
||||
# define __UINT_LEAST16_MAX UINT64_MAX
|
||||
# define __INT_LEAST8_MIN INT64_MIN
|
||||
# define __INT_LEAST8_MAX INT64_MAX
|
||||
# define __UINT_LEAST8_MAX UINT64_MAX
|
||||
#endif /* __INT64_TYPE__ */
|
||||
|
||||
#ifdef __INT_LEAST64_MIN
|
||||
# define INT_LEAST64_MIN __INT_LEAST64_MIN
|
||||
# define INT_LEAST64_MAX __INT_LEAST64_MAX
|
||||
# define UINT_LEAST64_MAX __UINT_LEAST64_MAX
|
||||
# define INT_FAST64_MIN __INT_LEAST64_MIN
|
||||
# define INT_FAST64_MAX __INT_LEAST64_MAX
|
||||
# define UINT_FAST64_MAX __UINT_LEAST64_MAX
|
||||
#endif /* __INT_LEAST64_MIN */
|
||||
|
||||
|
||||
#ifdef __INT56_TYPE__
|
||||
# define INT56_MAX INT56_C(36028797018963967)
|
||||
# define INT56_MIN (-INT56_C(36028797018963967)-1)
|
||||
# define UINT56_MAX UINT56_C(72057594037927935)
|
||||
# define INT_LEAST56_MIN INT56_MIN
|
||||
# define INT_LEAST56_MAX INT56_MAX
|
||||
# define UINT_LEAST56_MAX UINT56_MAX
|
||||
# define INT_FAST56_MIN INT56_MIN
|
||||
# define INT_FAST56_MAX INT56_MAX
|
||||
# define UINT_FAST56_MAX UINT56_MAX
|
||||
# define __INT_LEAST32_MIN INT56_MIN
|
||||
# define __INT_LEAST32_MAX INT56_MAX
|
||||
# define __UINT_LEAST32_MAX UINT56_MAX
|
||||
# define __INT_LEAST16_MIN INT56_MIN
|
||||
# define __INT_LEAST16_MAX INT56_MAX
|
||||
# define __UINT_LEAST16_MAX UINT56_MAX
|
||||
# define __INT_LEAST8_MIN INT56_MIN
|
||||
# define __INT_LEAST8_MAX INT56_MAX
|
||||
# define __UINT_LEAST8_MAX UINT56_MAX
|
||||
#endif /* __INT56_TYPE__ */
|
||||
|
||||
|
||||
#ifdef __INT48_TYPE__
|
||||
# define INT48_MAX INT48_C(140737488355327)
|
||||
# define INT48_MIN (-INT48_C(140737488355327)-1)
|
||||
# define UINT48_MAX UINT48_C(281474976710655)
|
||||
# define INT_LEAST48_MIN INT48_MIN
|
||||
# define INT_LEAST48_MAX INT48_MAX
|
||||
# define UINT_LEAST48_MAX UINT48_MAX
|
||||
# define INT_FAST48_MIN INT48_MIN
|
||||
# define INT_FAST48_MAX INT48_MAX
|
||||
# define UINT_FAST48_MAX UINT48_MAX
|
||||
# define __INT_LEAST32_MIN INT48_MIN
|
||||
# define __INT_LEAST32_MAX INT48_MAX
|
||||
# define __UINT_LEAST32_MAX UINT48_MAX
|
||||
# define __INT_LEAST16_MIN INT48_MIN
|
||||
# define __INT_LEAST16_MAX INT48_MAX
|
||||
# define __UINT_LEAST16_MAX UINT48_MAX
|
||||
# define __INT_LEAST8_MIN INT48_MIN
|
||||
# define __INT_LEAST8_MAX INT48_MAX
|
||||
# define __UINT_LEAST8_MAX UINT48_MAX
|
||||
#endif /* __INT48_TYPE__ */
|
||||
|
||||
|
||||
#ifdef __INT40_TYPE__
|
||||
# define INT40_MAX INT40_C(549755813887)
|
||||
# define INT40_MIN (-INT40_C(549755813887)-1)
|
||||
# define UINT40_MAX UINT40_C(1099511627775)
|
||||
# define INT_LEAST40_MIN INT40_MIN
|
||||
# define INT_LEAST40_MAX INT40_MAX
|
||||
# define UINT_LEAST40_MAX UINT40_MAX
|
||||
# define INT_FAST40_MIN INT40_MIN
|
||||
# define INT_FAST40_MAX INT40_MAX
|
||||
# define UINT_FAST40_MAX UINT40_MAX
|
||||
# define __INT_LEAST32_MIN INT40_MIN
|
||||
# define __INT_LEAST32_MAX INT40_MAX
|
||||
# define __UINT_LEAST32_MAX UINT40_MAX
|
||||
# define __INT_LEAST16_MIN INT40_MIN
|
||||
# define __INT_LEAST16_MAX INT40_MAX
|
||||
# define __UINT_LEAST16_MAX UINT40_MAX
|
||||
# define __INT_LEAST8_MIN INT40_MIN
|
||||
# define __INT_LEAST8_MAX INT40_MAX
|
||||
# define __UINT_LEAST8_MAX UINT40_MAX
|
||||
#endif /* __INT40_TYPE__ */
|
||||
|
||||
|
||||
#ifdef __INT32_TYPE__
|
||||
# define INT32_MAX INT32_C(2147483647)
|
||||
# define INT32_MIN (-INT32_C(2147483647)-1)
|
||||
# define UINT32_MAX UINT32_C(4294967295)
|
||||
# define __INT_LEAST32_MIN INT32_MIN
|
||||
# define __INT_LEAST32_MAX INT32_MAX
|
||||
# define __UINT_LEAST32_MAX UINT32_MAX
|
||||
# define __INT_LEAST16_MIN INT32_MIN
|
||||
# define __INT_LEAST16_MAX INT32_MAX
|
||||
# define __UINT_LEAST16_MAX UINT32_MAX
|
||||
# define __INT_LEAST8_MIN INT32_MIN
|
||||
# define __INT_LEAST8_MAX INT32_MAX
|
||||
# define __UINT_LEAST8_MAX UINT32_MAX
|
||||
#endif /* __INT32_TYPE__ */
|
||||
|
||||
#ifdef __INT_LEAST32_MIN
|
||||
# define INT_LEAST32_MIN __INT_LEAST32_MIN
|
||||
# define INT_LEAST32_MAX __INT_LEAST32_MAX
|
||||
# define UINT_LEAST32_MAX __UINT_LEAST32_MAX
|
||||
# define INT_FAST32_MIN __INT_LEAST32_MIN
|
||||
# define INT_FAST32_MAX __INT_LEAST32_MAX
|
||||
# define UINT_FAST32_MAX __UINT_LEAST32_MAX
|
||||
#endif /* __INT_LEAST32_MIN */
|
||||
|
||||
|
||||
#ifdef __INT24_TYPE__
|
||||
# define INT24_MAX INT24_C(8388607)
|
||||
# define INT24_MIN (-INT24_C(8388607)-1)
|
||||
# define UINT24_MAX UINT24_C(16777215)
|
||||
# define INT_LEAST24_MIN INT24_MIN
|
||||
# define INT_LEAST24_MAX INT24_MAX
|
||||
# define UINT_LEAST24_MAX UINT24_MAX
|
||||
# define INT_FAST24_MIN INT24_MIN
|
||||
# define INT_FAST24_MAX INT24_MAX
|
||||
# define UINT_FAST24_MAX UINT24_MAX
|
||||
# define __INT_LEAST16_MIN INT24_MIN
|
||||
# define __INT_LEAST16_MAX INT24_MAX
|
||||
# define __UINT_LEAST16_MAX UINT24_MAX
|
||||
# define __INT_LEAST8_MIN INT24_MIN
|
||||
# define __INT_LEAST8_MAX INT24_MAX
|
||||
# define __UINT_LEAST8_MAX UINT24_MAX
|
||||
#endif /* __INT24_TYPE__ */
|
||||
|
||||
|
||||
#ifdef __INT16_TYPE__
|
||||
#define INT16_MAX INT16_C(32767)
|
||||
#define INT16_MIN (-INT16_C(32767)-1)
|
||||
#define UINT16_MAX UINT16_C(65535)
|
||||
# define __INT_LEAST16_MIN INT16_MIN
|
||||
# define __INT_LEAST16_MAX INT16_MAX
|
||||
# define __UINT_LEAST16_MAX UINT16_MAX
|
||||
# define __INT_LEAST8_MIN INT16_MIN
|
||||
# define __INT_LEAST8_MAX INT16_MAX
|
||||
# define __UINT_LEAST8_MAX UINT16_MAX
|
||||
#endif /* __INT16_TYPE__ */
|
||||
|
||||
#ifdef __INT_LEAST16_MIN
|
||||
# define INT_LEAST16_MIN __INT_LEAST16_MIN
|
||||
# define INT_LEAST16_MAX __INT_LEAST16_MAX
|
||||
# define UINT_LEAST16_MAX __UINT_LEAST16_MAX
|
||||
# define INT_FAST16_MIN __INT_LEAST16_MIN
|
||||
# define INT_FAST16_MAX __INT_LEAST16_MAX
|
||||
# define UINT_FAST16_MAX __UINT_LEAST16_MAX
|
||||
#endif /* __INT_LEAST16_MIN */
|
||||
|
||||
|
||||
#ifdef __INT8_TYPE__
|
||||
# define INT8_MAX INT8_C(127)
|
||||
# define INT8_MIN (-INT8_C(127)-1)
|
||||
# define UINT8_MAX UINT8_C(255)
|
||||
# define __INT_LEAST8_MIN INT8_MIN
|
||||
# define __INT_LEAST8_MAX INT8_MAX
|
||||
# define __UINT_LEAST8_MAX UINT8_MAX
|
||||
#endif /* __INT8_TYPE__ */
|
||||
|
||||
#ifdef __INT_LEAST8_MIN
|
||||
# define INT_LEAST8_MIN __INT_LEAST8_MIN
|
||||
# define INT_LEAST8_MAX __INT_LEAST8_MAX
|
||||
# define UINT_LEAST8_MAX __UINT_LEAST8_MAX
|
||||
# define INT_FAST8_MIN __INT_LEAST8_MIN
|
||||
# define INT_FAST8_MAX __INT_LEAST8_MAX
|
||||
# define UINT_FAST8_MAX __UINT_LEAST8_MAX
|
||||
#endif /* __INT_LEAST8_MIN */
|
||||
|
||||
/* Some utility macros */
|
||||
#define __INTN_MIN(n) __stdint_join3( INT, n, _MIN)
|
||||
#define __INTN_MAX(n) __stdint_join3( INT, n, _MAX)
|
||||
#define __UINTN_MAX(n) __stdint_join3(UINT, n, _MAX)
|
||||
#define __INTN_C(n, v) __stdint_join3( INT, n, _C(v))
|
||||
#define __UINTN_C(n, v) __stdint_join3(UINT, n, _C(v))
|
||||
|
||||
/* C99 7.18.2.4 Limits of integer types capable of holding object pointers. */
|
||||
/* C99 7.18.3 Limits of other integer types. */
|
||||
|
||||
#define INTPTR_MIN __INTN_MIN(__INTPTR_WIDTH__)
|
||||
#define INTPTR_MAX __INTN_MAX(__INTPTR_WIDTH__)
|
||||
#define UINTPTR_MAX __UINTN_MAX(__INTPTR_WIDTH__)
|
||||
#define PTRDIFF_MIN __INTN_MIN(__PTRDIFF_WIDTH__)
|
||||
#define PTRDIFF_MAX __INTN_MAX(__PTRDIFF_WIDTH__)
|
||||
#define SIZE_MAX __UINTN_MAX(__SIZE_WIDTH__)
|
||||
|
||||
/* ISO9899:2011 7.20 (C11 Annex K): Define RSIZE_MAX if __STDC_WANT_LIB_EXT1__
|
||||
* is enabled. */
|
||||
#if defined(__STDC_WANT_LIB_EXT1__) && __STDC_WANT_LIB_EXT1__ >= 1
|
||||
#define RSIZE_MAX (SIZE_MAX >> 1)
|
||||
#endif
|
||||
|
||||
/* C99 7.18.2.5 Limits of greatest-width integer types. */
|
||||
#define INTMAX_MIN __INTN_MIN(__INTMAX_WIDTH__)
|
||||
#define INTMAX_MAX __INTN_MAX(__INTMAX_WIDTH__)
|
||||
#define UINTMAX_MAX __UINTN_MAX(__INTMAX_WIDTH__)
|
||||
|
||||
/* C99 7.18.3 Limits of other integer types. */
|
||||
#define SIG_ATOMIC_MIN __INTN_MIN(__SIG_ATOMIC_WIDTH__)
|
||||
#define SIG_ATOMIC_MAX __INTN_MAX(__SIG_ATOMIC_WIDTH__)
|
||||
#ifdef __WINT_UNSIGNED__
|
||||
# define WINT_MIN __UINTN_C(__WINT_WIDTH__, 0)
|
||||
# define WINT_MAX __UINTN_MAX(__WINT_WIDTH__)
|
||||
#else
|
||||
# define WINT_MIN __INTN_MIN(__WINT_WIDTH__)
|
||||
# define WINT_MAX __INTN_MAX(__WINT_WIDTH__)
|
||||
#endif
|
||||
|
||||
#ifndef WCHAR_MAX
|
||||
# define WCHAR_MAX __WCHAR_MAX__
|
||||
#endif
|
||||
#ifndef WCHAR_MIN
|
||||
# if __WCHAR_MAX__ == __INTN_MAX(__WCHAR_WIDTH__)
|
||||
# define WCHAR_MIN __INTN_MIN(__WCHAR_WIDTH__)
|
||||
# else
|
||||
# define WCHAR_MIN __UINTN_C(__WCHAR_WIDTH__, 0)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* 7.18.4.2 Macros for greatest-width integer constants. */
|
||||
#define INTMAX_C(v) __INTN_C(__INTMAX_WIDTH__, v)
|
||||
#define UINTMAX_C(v) __UINTN_C(__INTMAX_WIDTH__, v)
|
||||
|
||||
#endif /* __STDC_HOSTED__ */
|
||||
#endif /* __CLANG_STDINT_H */
|
||||
@@ -0,0 +1,30 @@
|
||||
/*===---- stdnoreturn.h - Standard header for noreturn macro ---------------===
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
|
||||
#ifndef __STDNORETURN_H
|
||||
#define __STDNORETURN_H
|
||||
|
||||
#define noreturn _Noreturn
|
||||
#define __noreturn_is_defined 1
|
||||
|
||||
#endif /* __STDNORETURN_H */
|
||||
@@ -0,0 +1,154 @@
|
||||
/*===---- tbmintrin.h - TBM intrinsics -------------------------------------===
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
|
||||
#ifndef __X86INTRIN_H
|
||||
#error "Never use <tbmintrin.h> directly; include <x86intrin.h> instead."
|
||||
#endif
|
||||
|
||||
#ifndef __TBMINTRIN_H
|
||||
#define __TBMINTRIN_H
|
||||
|
||||
/* Define the default attributes for the functions in this file. */
|
||||
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("tbm")))
|
||||
|
||||
#define __bextri_u32(a, b) \
|
||||
((unsigned int)__builtin_ia32_bextri_u32((unsigned int)(a), \
|
||||
(unsigned int)(b)))
|
||||
|
||||
static __inline__ unsigned int __DEFAULT_FN_ATTRS
|
||||
__blcfill_u32(unsigned int __a)
|
||||
{
|
||||
return __a & (__a + 1);
|
||||
}
|
||||
|
||||
static __inline__ unsigned int __DEFAULT_FN_ATTRS
|
||||
__blci_u32(unsigned int __a)
|
||||
{
|
||||
return __a | ~(__a + 1);
|
||||
}
|
||||
|
||||
static __inline__ unsigned int __DEFAULT_FN_ATTRS
|
||||
__blcic_u32(unsigned int __a)
|
||||
{
|
||||
return ~__a & (__a + 1);
|
||||
}
|
||||
|
||||
static __inline__ unsigned int __DEFAULT_FN_ATTRS
|
||||
__blcmsk_u32(unsigned int __a)
|
||||
{
|
||||
return __a ^ (__a + 1);
|
||||
}
|
||||
|
||||
static __inline__ unsigned int __DEFAULT_FN_ATTRS
|
||||
__blcs_u32(unsigned int __a)
|
||||
{
|
||||
return __a | (__a + 1);
|
||||
}
|
||||
|
||||
static __inline__ unsigned int __DEFAULT_FN_ATTRS
|
||||
__blsfill_u32(unsigned int __a)
|
||||
{
|
||||
return __a | (__a - 1);
|
||||
}
|
||||
|
||||
static __inline__ unsigned int __DEFAULT_FN_ATTRS
|
||||
__blsic_u32(unsigned int __a)
|
||||
{
|
||||
return ~__a | (__a - 1);
|
||||
}
|
||||
|
||||
static __inline__ unsigned int __DEFAULT_FN_ATTRS
|
||||
__t1mskc_u32(unsigned int __a)
|
||||
{
|
||||
return ~__a | (__a + 1);
|
||||
}
|
||||
|
||||
static __inline__ unsigned int __DEFAULT_FN_ATTRS
|
||||
__tzmsk_u32(unsigned int __a)
|
||||
{
|
||||
return ~__a & (__a - 1);
|
||||
}
|
||||
|
||||
#ifdef __x86_64__
|
||||
#define __bextri_u64(a, b) \
|
||||
((unsigned long long)__builtin_ia32_bextri_u64((unsigned long long)(a), \
|
||||
(unsigned long long)(b)))
|
||||
|
||||
static __inline__ unsigned long long __DEFAULT_FN_ATTRS
|
||||
__blcfill_u64(unsigned long long __a)
|
||||
{
|
||||
return __a & (__a + 1);
|
||||
}
|
||||
|
||||
static __inline__ unsigned long long __DEFAULT_FN_ATTRS
|
||||
__blci_u64(unsigned long long __a)
|
||||
{
|
||||
return __a | ~(__a + 1);
|
||||
}
|
||||
|
||||
static __inline__ unsigned long long __DEFAULT_FN_ATTRS
|
||||
__blcic_u64(unsigned long long __a)
|
||||
{
|
||||
return ~__a & (__a + 1);
|
||||
}
|
||||
|
||||
static __inline__ unsigned long long __DEFAULT_FN_ATTRS
|
||||
__blcmsk_u64(unsigned long long __a)
|
||||
{
|
||||
return __a ^ (__a + 1);
|
||||
}
|
||||
|
||||
static __inline__ unsigned long long __DEFAULT_FN_ATTRS
|
||||
__blcs_u64(unsigned long long __a)
|
||||
{
|
||||
return __a | (__a + 1);
|
||||
}
|
||||
|
||||
static __inline__ unsigned long long __DEFAULT_FN_ATTRS
|
||||
__blsfill_u64(unsigned long long __a)
|
||||
{
|
||||
return __a | (__a - 1);
|
||||
}
|
||||
|
||||
static __inline__ unsigned long long __DEFAULT_FN_ATTRS
|
||||
__blsic_u64(unsigned long long __a)
|
||||
{
|
||||
return ~__a | (__a - 1);
|
||||
}
|
||||
|
||||
static __inline__ unsigned long long __DEFAULT_FN_ATTRS
|
||||
__t1mskc_u64(unsigned long long __a)
|
||||
{
|
||||
return ~__a | (__a + 1);
|
||||
}
|
||||
|
||||
static __inline__ unsigned long long __DEFAULT_FN_ATTRS
|
||||
__tzmsk_u64(unsigned long long __a)
|
||||
{
|
||||
return ~__a & (__a - 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
#undef __DEFAULT_FN_ATTRS
|
||||
|
||||
#endif /* __TBMINTRIN_H */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,773 @@
|
||||
/*===---- tmmintrin.h - SSSE3 intrinsics -----------------------------------===
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
|
||||
#ifndef __TMMINTRIN_H
|
||||
#define __TMMINTRIN_H
|
||||
|
||||
#include <pmmintrin.h>
|
||||
|
||||
/* Define the default attributes for the functions in this file. */
|
||||
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("ssse3")))
|
||||
|
||||
/// \brief Computes the absolute value of each of the packed 8-bit signed
|
||||
/// integers in the source operand and stores the 8-bit unsigned integer
|
||||
/// results in the destination.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c PABSB instruction.
|
||||
///
|
||||
/// \param __a
|
||||
/// A 64-bit vector of [8 x i8].
|
||||
/// \returns A 64-bit integer vector containing the absolute values of the
|
||||
/// elements in the operand.
|
||||
static __inline__ __m64 __DEFAULT_FN_ATTRS
|
||||
_mm_abs_pi8(__m64 __a)
|
||||
{
|
||||
return (__m64)__builtin_ia32_pabsb((__v8qi)__a);
|
||||
}
|
||||
|
||||
/// \brief Computes the absolute value of each of the packed 8-bit signed
|
||||
/// integers in the source operand and stores the 8-bit unsigned integer
|
||||
/// results in the destination.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c VPABSB instruction.
|
||||
///
|
||||
/// \param __a
|
||||
/// A 128-bit vector of [16 x i8].
|
||||
/// \returns A 128-bit integer vector containing the absolute values of the
|
||||
/// elements in the operand.
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_abs_epi8(__m128i __a)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_pabsb128((__v16qi)__a);
|
||||
}
|
||||
|
||||
/// \brief Computes the absolute value of each of the packed 16-bit signed
|
||||
/// integers in the source operand and stores the 16-bit unsigned integer
|
||||
/// results in the destination.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c PABSW instruction.
|
||||
///
|
||||
/// \param __a
|
||||
/// A 64-bit vector of [4 x i16].
|
||||
/// \returns A 64-bit integer vector containing the absolute values of the
|
||||
/// elements in the operand.
|
||||
static __inline__ __m64 __DEFAULT_FN_ATTRS
|
||||
_mm_abs_pi16(__m64 __a)
|
||||
{
|
||||
return (__m64)__builtin_ia32_pabsw((__v4hi)__a);
|
||||
}
|
||||
|
||||
/// \brief Computes the absolute value of each of the packed 16-bit signed
|
||||
/// integers in the source operand and stores the 16-bit unsigned integer
|
||||
/// results in the destination.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c VPABSW instruction.
|
||||
///
|
||||
/// \param __a
|
||||
/// A 128-bit vector of [8 x i16].
|
||||
/// \returns A 128-bit integer vector containing the absolute values of the
|
||||
/// elements in the operand.
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_abs_epi16(__m128i __a)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_pabsw128((__v8hi)__a);
|
||||
}
|
||||
|
||||
/// \brief Computes the absolute value of each of the packed 32-bit signed
|
||||
/// integers in the source operand and stores the 32-bit unsigned integer
|
||||
/// results in the destination.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c PABSD instruction.
|
||||
///
|
||||
/// \param __a
|
||||
/// A 64-bit vector of [2 x i32].
|
||||
/// \returns A 64-bit integer vector containing the absolute values of the
|
||||
/// elements in the operand.
|
||||
static __inline__ __m64 __DEFAULT_FN_ATTRS
|
||||
_mm_abs_pi32(__m64 __a)
|
||||
{
|
||||
return (__m64)__builtin_ia32_pabsd((__v2si)__a);
|
||||
}
|
||||
|
||||
/// \brief Computes the absolute value of each of the packed 32-bit signed
|
||||
/// integers in the source operand and stores the 32-bit unsigned integer
|
||||
/// results in the destination.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c VPABSD instruction.
|
||||
///
|
||||
/// \param __a
|
||||
/// A 128-bit vector of [4 x i32].
|
||||
/// \returns A 128-bit integer vector containing the absolute values of the
|
||||
/// elements in the operand.
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_abs_epi32(__m128i __a)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_pabsd128((__v4si)__a);
|
||||
}
|
||||
|
||||
/// \brief Concatenates the two 128-bit integer vector operands, and
|
||||
/// right-shifts the result by the number of bytes specified in the immediate
|
||||
/// operand.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// \code
|
||||
/// __m128i _mm_alignr_epi8(__m128i a, __m128i b, const int n);
|
||||
/// \endcode
|
||||
///
|
||||
/// This intrinsic corresponds to the \c PALIGNR instruction.
|
||||
///
|
||||
/// \param a
|
||||
/// A 128-bit vector of [16 x i8] containing one of the source operands.
|
||||
/// \param b
|
||||
/// A 128-bit vector of [16 x i8] containing one of the source operands.
|
||||
/// \param n
|
||||
/// An immediate operand specifying how many bytes to right-shift the result.
|
||||
/// \returns A 128-bit integer vector containing the concatenated right-shifted
|
||||
/// value.
|
||||
#define _mm_alignr_epi8(a, b, n) __extension__ ({ \
|
||||
(__m128i)__builtin_ia32_palignr128((__v16qi)(__m128i)(a), \
|
||||
(__v16qi)(__m128i)(b), (n)); })
|
||||
|
||||
/// \brief Concatenates the two 64-bit integer vector operands, and right-shifts
|
||||
/// the result by the number of bytes specified in the immediate operand.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// \code
|
||||
/// __m64 _mm_alignr_pi8(__m64 a, __m64 b, const int n);
|
||||
/// \endcode
|
||||
///
|
||||
/// This intrinsic corresponds to the \c PALIGNR instruction.
|
||||
///
|
||||
/// \param a
|
||||
/// A 64-bit vector of [8 x i8] containing one of the source operands.
|
||||
/// \param b
|
||||
/// A 64-bit vector of [8 x i8] containing one of the source operands.
|
||||
/// \param n
|
||||
/// An immediate operand specifying how many bytes to right-shift the result.
|
||||
/// \returns A 64-bit integer vector containing the concatenated right-shifted
|
||||
/// value.
|
||||
#define _mm_alignr_pi8(a, b, n) __extension__ ({ \
|
||||
(__m64)__builtin_ia32_palignr((__v8qi)(__m64)(a), (__v8qi)(__m64)(b), (n)); })
|
||||
|
||||
/// \brief Horizontally adds the adjacent pairs of values contained in 2 packed
|
||||
/// 128-bit vectors of [8 x i16].
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c VPHADDW instruction.
|
||||
///
|
||||
/// \param __a
|
||||
/// A 128-bit vector of [8 x i16] containing one of the source operands. The
|
||||
/// horizontal sums of the values are stored in the lower bits of the
|
||||
/// destination.
|
||||
/// \param __b
|
||||
/// A 128-bit vector of [8 x i16] containing one of the source operands. The
|
||||
/// horizontal sums of the values are stored in the upper bits of the
|
||||
/// destination.
|
||||
/// \returns A 128-bit vector of [8 x i16] containing the horizontal sums of
|
||||
/// both operands.
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_hadd_epi16(__m128i __a, __m128i __b)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_phaddw128((__v8hi)__a, (__v8hi)__b);
|
||||
}
|
||||
|
||||
/// \brief Horizontally adds the adjacent pairs of values contained in 2 packed
|
||||
/// 128-bit vectors of [4 x i32].
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c VPHADDD instruction.
|
||||
///
|
||||
/// \param __a
|
||||
/// A 128-bit vector of [4 x i32] containing one of the source operands. The
|
||||
/// horizontal sums of the values are stored in the lower bits of the
|
||||
/// destination.
|
||||
/// \param __b
|
||||
/// A 128-bit vector of [4 x i32] containing one of the source operands. The
|
||||
/// horizontal sums of the values are stored in the upper bits of the
|
||||
/// destination.
|
||||
/// \returns A 128-bit vector of [4 x i32] containing the horizontal sums of
|
||||
/// both operands.
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_hadd_epi32(__m128i __a, __m128i __b)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_phaddd128((__v4si)__a, (__v4si)__b);
|
||||
}
|
||||
|
||||
/// \brief Horizontally adds the adjacent pairs of values contained in 2 packed
|
||||
/// 64-bit vectors of [4 x i16].
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c PHADDW instruction.
|
||||
///
|
||||
/// \param __a
|
||||
/// A 64-bit vector of [4 x i16] containing one of the source operands. The
|
||||
/// horizontal sums of the values are stored in the lower bits of the
|
||||
/// destination.
|
||||
/// \param __b
|
||||
/// A 64-bit vector of [4 x i16] containing one of the source operands. The
|
||||
/// horizontal sums of the values are stored in the upper bits of the
|
||||
/// destination.
|
||||
/// \returns A 64-bit vector of [4 x i16] containing the horizontal sums of both
|
||||
/// operands.
|
||||
static __inline__ __m64 __DEFAULT_FN_ATTRS
|
||||
_mm_hadd_pi16(__m64 __a, __m64 __b)
|
||||
{
|
||||
return (__m64)__builtin_ia32_phaddw((__v4hi)__a, (__v4hi)__b);
|
||||
}
|
||||
|
||||
/// \brief Horizontally adds the adjacent pairs of values contained in 2 packed
|
||||
/// 64-bit vectors of [2 x i32].
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c PHADDD instruction.
|
||||
///
|
||||
/// \param __a
|
||||
/// A 64-bit vector of [2 x i32] containing one of the source operands. The
|
||||
/// horizontal sums of the values are stored in the lower bits of the
|
||||
/// destination.
|
||||
/// \param __b
|
||||
/// A 64-bit vector of [2 x i32] containing one of the source operands. The
|
||||
/// horizontal sums of the values are stored in the upper bits of the
|
||||
/// destination.
|
||||
/// \returns A 64-bit vector of [2 x i32] containing the horizontal sums of both
|
||||
/// operands.
|
||||
static __inline__ __m64 __DEFAULT_FN_ATTRS
|
||||
_mm_hadd_pi32(__m64 __a, __m64 __b)
|
||||
{
|
||||
return (__m64)__builtin_ia32_phaddd((__v2si)__a, (__v2si)__b);
|
||||
}
|
||||
|
||||
/// \brief Horizontally adds the adjacent pairs of values contained in 2 packed
|
||||
/// 128-bit vectors of [8 x i16]. Positive sums greater than 7FFFh are
|
||||
/// saturated to 7FFFh. Negative sums less than 8000h are saturated to 8000h.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c VPHADDSW instruction.
|
||||
///
|
||||
/// \param __a
|
||||
/// A 128-bit vector of [8 x i16] containing one of the source operands. The
|
||||
/// horizontal sums of the values are stored in the lower bits of the
|
||||
/// destination.
|
||||
/// \param __b
|
||||
/// A 128-bit vector of [8 x i16] containing one of the source operands. The
|
||||
/// horizontal sums of the values are stored in the upper bits of the
|
||||
/// destination.
|
||||
/// \returns A 128-bit vector of [8 x i16] containing the horizontal saturated
|
||||
/// sums of both operands.
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_hadds_epi16(__m128i __a, __m128i __b)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_phaddsw128((__v8hi)__a, (__v8hi)__b);
|
||||
}
|
||||
|
||||
/// \brief Horizontally adds the adjacent pairs of values contained in 2 packed
|
||||
/// 64-bit vectors of [4 x i16]. Positive sums greater than 7FFFh are
|
||||
/// saturated to 7FFFh. Negative sums less than 8000h are saturated to 8000h.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c PHADDSW instruction.
|
||||
///
|
||||
/// \param __a
|
||||
/// A 64-bit vector of [4 x i16] containing one of the source operands. The
|
||||
/// horizontal sums of the values are stored in the lower bits of the
|
||||
/// destination.
|
||||
/// \param __b
|
||||
/// A 64-bit vector of [4 x i16] containing one of the source operands. The
|
||||
/// horizontal sums of the values are stored in the upper bits of the
|
||||
/// destination.
|
||||
/// \returns A 64-bit vector of [4 x i16] containing the horizontal saturated
|
||||
/// sums of both operands.
|
||||
static __inline__ __m64 __DEFAULT_FN_ATTRS
|
||||
_mm_hadds_pi16(__m64 __a, __m64 __b)
|
||||
{
|
||||
return (__m64)__builtin_ia32_phaddsw((__v4hi)__a, (__v4hi)__b);
|
||||
}
|
||||
|
||||
/// \brief Horizontally subtracts the adjacent pairs of values contained in 2
|
||||
/// packed 128-bit vectors of [8 x i16].
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c VPHSUBW instruction.
|
||||
///
|
||||
/// \param __a
|
||||
/// A 128-bit vector of [8 x i16] containing one of the source operands. The
|
||||
/// horizontal differences between the values are stored in the lower bits of
|
||||
/// the destination.
|
||||
/// \param __b
|
||||
/// A 128-bit vector of [8 x i16] containing one of the source operands. The
|
||||
/// horizontal differences between the values are stored in the upper bits of
|
||||
/// the destination.
|
||||
/// \returns A 128-bit vector of [8 x i16] containing the horizontal differences
|
||||
/// of both operands.
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_hsub_epi16(__m128i __a, __m128i __b)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_phsubw128((__v8hi)__a, (__v8hi)__b);
|
||||
}
|
||||
|
||||
/// \brief Horizontally subtracts the adjacent pairs of values contained in 2
|
||||
/// packed 128-bit vectors of [4 x i32].
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c VPHSUBD instruction.
|
||||
///
|
||||
/// \param __a
|
||||
/// A 128-bit vector of [4 x i32] containing one of the source operands. The
|
||||
/// horizontal differences between the values are stored in the lower bits of
|
||||
/// the destination.
|
||||
/// \param __b
|
||||
/// A 128-bit vector of [4 x i32] containing one of the source operands. The
|
||||
/// horizontal differences between the values are stored in the upper bits of
|
||||
/// the destination.
|
||||
/// \returns A 128-bit vector of [4 x i32] containing the horizontal differences
|
||||
/// of both operands.
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_hsub_epi32(__m128i __a, __m128i __b)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_phsubd128((__v4si)__a, (__v4si)__b);
|
||||
}
|
||||
|
||||
/// \brief Horizontally subtracts the adjacent pairs of values contained in 2
|
||||
/// packed 64-bit vectors of [4 x i16].
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c PHSUBW instruction.
|
||||
///
|
||||
/// \param __a
|
||||
/// A 64-bit vector of [4 x i16] containing one of the source operands. The
|
||||
/// horizontal differences between the values are stored in the lower bits of
|
||||
/// the destination.
|
||||
/// \param __b
|
||||
/// A 64-bit vector of [4 x i16] containing one of the source operands. The
|
||||
/// horizontal differences between the values are stored in the upper bits of
|
||||
/// the destination.
|
||||
/// \returns A 64-bit vector of [4 x i16] containing the horizontal differences
|
||||
/// of both operands.
|
||||
static __inline__ __m64 __DEFAULT_FN_ATTRS
|
||||
_mm_hsub_pi16(__m64 __a, __m64 __b)
|
||||
{
|
||||
return (__m64)__builtin_ia32_phsubw((__v4hi)__a, (__v4hi)__b);
|
||||
}
|
||||
|
||||
/// \brief Horizontally subtracts the adjacent pairs of values contained in 2
|
||||
/// packed 64-bit vectors of [2 x i32].
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c PHSUBD instruction.
|
||||
///
|
||||
/// \param __a
|
||||
/// A 64-bit vector of [2 x i32] containing one of the source operands. The
|
||||
/// horizontal differences between the values are stored in the lower bits of
|
||||
/// the destination.
|
||||
/// \param __b
|
||||
/// A 64-bit vector of [2 x i32] containing one of the source operands. The
|
||||
/// horizontal differences between the values are stored in the upper bits of
|
||||
/// the destination.
|
||||
/// \returns A 64-bit vector of [2 x i32] containing the horizontal differences
|
||||
/// of both operands.
|
||||
static __inline__ __m64 __DEFAULT_FN_ATTRS
|
||||
_mm_hsub_pi32(__m64 __a, __m64 __b)
|
||||
{
|
||||
return (__m64)__builtin_ia32_phsubd((__v2si)__a, (__v2si)__b);
|
||||
}
|
||||
|
||||
/// \brief Horizontally subtracts the adjacent pairs of values contained in 2
|
||||
/// packed 128-bit vectors of [8 x i16]. Positive differences greater than
|
||||
/// 7FFFh are saturated to 7FFFh. Negative differences less than 8000h are
|
||||
/// saturated to 8000h.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c VPHSUBSW instruction.
|
||||
///
|
||||
/// \param __a
|
||||
/// A 128-bit vector of [8 x i16] containing one of the source operands. The
|
||||
/// horizontal differences between the values are stored in the lower bits of
|
||||
/// the destination.
|
||||
/// \param __b
|
||||
/// A 128-bit vector of [8 x i16] containing one of the source operands. The
|
||||
/// horizontal differences between the values are stored in the upper bits of
|
||||
/// the destination.
|
||||
/// \returns A 128-bit vector of [8 x i16] containing the horizontal saturated
|
||||
/// differences of both operands.
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_hsubs_epi16(__m128i __a, __m128i __b)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_phsubsw128((__v8hi)__a, (__v8hi)__b);
|
||||
}
|
||||
|
||||
/// \brief Horizontally subtracts the adjacent pairs of values contained in 2
|
||||
/// packed 64-bit vectors of [4 x i16]. Positive differences greater than
|
||||
/// 7FFFh are saturated to 7FFFh. Negative differences less than 8000h are
|
||||
/// saturated to 8000h.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c PHSUBSW instruction.
|
||||
///
|
||||
/// \param __a
|
||||
/// A 64-bit vector of [4 x i16] containing one of the source operands. The
|
||||
/// horizontal differences between the values are stored in the lower bits of
|
||||
/// the destination.
|
||||
/// \param __b
|
||||
/// A 64-bit vector of [4 x i16] containing one of the source operands. The
|
||||
/// horizontal differences between the values are stored in the upper bits of
|
||||
/// the destination.
|
||||
/// \returns A 64-bit vector of [4 x i16] containing the horizontal saturated
|
||||
/// differences of both operands.
|
||||
static __inline__ __m64 __DEFAULT_FN_ATTRS
|
||||
_mm_hsubs_pi16(__m64 __a, __m64 __b)
|
||||
{
|
||||
return (__m64)__builtin_ia32_phsubsw((__v4hi)__a, (__v4hi)__b);
|
||||
}
|
||||
|
||||
/// \brief Multiplies corresponding pairs of packed 8-bit unsigned integer
|
||||
/// values contained in the first source operand and packed 8-bit signed
|
||||
/// integer values contained in the second source operand, adds pairs of
|
||||
/// contiguous products with signed saturation, and writes the 16-bit sums to
|
||||
/// the corresponding bits in the destination. For example, bits [7:0] of
|
||||
/// both operands are multiplied, bits [15:8] of both operands are
|
||||
/// multiplied, and the sum of both results is written to bits [15:0] of the
|
||||
/// destination.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c VPMADDUBSW instruction.
|
||||
///
|
||||
/// \param __a
|
||||
/// A 128-bit integer vector containing the first source operand.
|
||||
/// \param __b
|
||||
/// A 128-bit integer vector containing the second source operand.
|
||||
/// \returns A 128-bit integer vector containing the sums of products of both
|
||||
/// operands:
|
||||
/// R0 := (__a0 * __b0) + (__a1 * __b1)
|
||||
/// R1 := (__a2 * __b2) + (__a3 * __b3)
|
||||
/// R2 := (__a4 * __b4) + (__a5 * __b5)
|
||||
/// R3 := (__a6 * __b6) + (__a7 * __b7)
|
||||
/// R4 := (__a8 * __b8) + (__a9 * __b9)
|
||||
/// R5 := (__a10 * __b10) + (__a11 * __b11)
|
||||
/// R6 := (__a12 * __b12) + (__a13 * __b13)
|
||||
/// R7 := (__a14 * __b14) + (__a15 * __b15)
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_maddubs_epi16(__m128i __a, __m128i __b)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_pmaddubsw128((__v16qi)__a, (__v16qi)__b);
|
||||
}
|
||||
|
||||
/// \brief Multiplies corresponding pairs of packed 8-bit unsigned integer
|
||||
/// values contained in the first source operand and packed 8-bit signed
|
||||
/// integer values contained in the second source operand, adds pairs of
|
||||
/// contiguous products with signed saturation, and writes the 16-bit sums to
|
||||
/// the corresponding bits in the destination. For example, bits [7:0] of
|
||||
/// both operands are multiplied, bits [15:8] of both operands are
|
||||
/// multiplied, and the sum of both results is written to bits [15:0] of the
|
||||
/// destination.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c PMADDUBSW instruction.
|
||||
///
|
||||
/// \param __a
|
||||
/// A 64-bit integer vector containing the first source operand.
|
||||
/// \param __b
|
||||
/// A 64-bit integer vector containing the second source operand.
|
||||
/// \returns A 64-bit integer vector containing the sums of products of both
|
||||
/// operands:
|
||||
/// R0 := (__a0 * __b0) + (__a1 * __b1)
|
||||
/// R1 := (__a2 * __b2) + (__a3 * __b3)
|
||||
/// R2 := (__a4 * __b4) + (__a5 * __b5)
|
||||
/// R3 := (__a6 * __b6) + (__a7 * __b7)
|
||||
static __inline__ __m64 __DEFAULT_FN_ATTRS
|
||||
_mm_maddubs_pi16(__m64 __a, __m64 __b)
|
||||
{
|
||||
return (__m64)__builtin_ia32_pmaddubsw((__v8qi)__a, (__v8qi)__b);
|
||||
}
|
||||
|
||||
/// \brief Multiplies packed 16-bit signed integer values, truncates the 32-bit
|
||||
/// products to the 18 most significant bits by right-shifting, rounds the
|
||||
/// truncated value by adding 1, and writes bits [16:1] to the destination.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c VPMULHRSW instruction.
|
||||
///
|
||||
/// \param __a
|
||||
/// A 128-bit vector of [8 x i16] containing one of the source operands.
|
||||
/// \param __b
|
||||
/// A 128-bit vector of [8 x i16] containing one of the source operands.
|
||||
/// \returns A 128-bit vector of [8 x i16] containing the rounded and scaled
|
||||
/// products of both operands.
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_mulhrs_epi16(__m128i __a, __m128i __b)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_pmulhrsw128((__v8hi)__a, (__v8hi)__b);
|
||||
}
|
||||
|
||||
/// \brief Multiplies packed 16-bit signed integer values, truncates the 32-bit
|
||||
/// products to the 18 most significant bits by right-shifting, rounds the
|
||||
/// truncated value by adding 1, and writes bits [16:1] to the destination.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c PMULHRSW instruction.
|
||||
///
|
||||
/// \param __a
|
||||
/// A 64-bit vector of [4 x i16] containing one of the source operands.
|
||||
/// \param __b
|
||||
/// A 64-bit vector of [4 x i16] containing one of the source operands.
|
||||
/// \returns A 64-bit vector of [4 x i16] containing the rounded and scaled
|
||||
/// products of both operands.
|
||||
static __inline__ __m64 __DEFAULT_FN_ATTRS
|
||||
_mm_mulhrs_pi16(__m64 __a, __m64 __b)
|
||||
{
|
||||
return (__m64)__builtin_ia32_pmulhrsw((__v4hi)__a, (__v4hi)__b);
|
||||
}
|
||||
|
||||
/// \brief Copies the 8-bit integers from a 128-bit integer vector to the
|
||||
/// destination or clears 8-bit values in the destination, as specified by
|
||||
/// the second source operand.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c VPSHUFB instruction.
|
||||
///
|
||||
/// \param __a
|
||||
/// A 128-bit integer vector containing the values to be copied.
|
||||
/// \param __b
|
||||
/// A 128-bit integer vector containing control bytes corresponding to
|
||||
/// positions in the destination:
|
||||
/// Bit 7:
|
||||
/// 1: Clear the corresponding byte in the destination.
|
||||
/// 0: Copy the selected source byte to the corresponding byte in the
|
||||
/// destination.
|
||||
/// Bits [6:4] Reserved.
|
||||
/// Bits [3:0] select the source byte to be copied.
|
||||
/// \returns A 128-bit integer vector containing the copied or cleared values.
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_shuffle_epi8(__m128i __a, __m128i __b)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_pshufb128((__v16qi)__a, (__v16qi)__b);
|
||||
}
|
||||
|
||||
/// \brief Copies the 8-bit integers from a 64-bit integer vector to the
|
||||
/// destination or clears 8-bit values in the destination, as specified by
|
||||
/// the second source operand.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c PSHUFB instruction.
|
||||
///
|
||||
/// \param __a
|
||||
/// A 64-bit integer vector containing the values to be copied.
|
||||
/// \param __b
|
||||
/// A 64-bit integer vector containing control bytes corresponding to
|
||||
/// positions in the destination:
|
||||
/// Bit 7:
|
||||
/// 1: Clear the corresponding byte in the destination.
|
||||
/// 0: Copy the selected source byte to the corresponding byte in the
|
||||
/// destination.
|
||||
/// Bits [3:0] select the source byte to be copied.
|
||||
/// \returns A 64-bit integer vector containing the copied or cleared values.
|
||||
static __inline__ __m64 __DEFAULT_FN_ATTRS
|
||||
_mm_shuffle_pi8(__m64 __a, __m64 __b)
|
||||
{
|
||||
return (__m64)__builtin_ia32_pshufb((__v8qi)__a, (__v8qi)__b);
|
||||
}
|
||||
|
||||
/// \brief For each 8-bit integer in the first source operand, perform one of
|
||||
/// the following actions as specified by the second source operand: If the
|
||||
/// byte in the second source is negative, calculate the two's complement of
|
||||
/// the corresponding byte in the first source, and write that value to the
|
||||
/// destination. If the byte in the second source is positive, copy the
|
||||
/// corresponding byte from the first source to the destination. If the byte
|
||||
/// in the second source is zero, clear the corresponding byte in the
|
||||
/// destination.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c VPSIGNB instruction.
|
||||
///
|
||||
/// \param __a
|
||||
/// A 128-bit integer vector containing the values to be copied.
|
||||
/// \param __b
|
||||
/// A 128-bit integer vector containing control bytes corresponding to
|
||||
/// positions in the destination.
|
||||
/// \returns A 128-bit integer vector containing the resultant values.
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_sign_epi8(__m128i __a, __m128i __b)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_psignb128((__v16qi)__a, (__v16qi)__b);
|
||||
}
|
||||
|
||||
/// \brief For each 16-bit integer in the first source operand, perform one of
|
||||
/// the following actions as specified by the second source operand: If the
|
||||
/// word in the second source is negative, calculate the two's complement of
|
||||
/// the corresponding word in the first source, and write that value to the
|
||||
/// destination. If the word in the second source is positive, copy the
|
||||
/// corresponding word from the first source to the destination. If the word
|
||||
/// in the second source is zero, clear the corresponding word in the
|
||||
/// destination.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c VPSIGNW instruction.
|
||||
///
|
||||
/// \param __a
|
||||
/// A 128-bit integer vector containing the values to be copied.
|
||||
/// \param __b
|
||||
/// A 128-bit integer vector containing control words corresponding to
|
||||
/// positions in the destination.
|
||||
/// \returns A 128-bit integer vector containing the resultant values.
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_sign_epi16(__m128i __a, __m128i __b)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_psignw128((__v8hi)__a, (__v8hi)__b);
|
||||
}
|
||||
|
||||
/// \brief For each 32-bit integer in the first source operand, perform one of
|
||||
/// the following actions as specified by the second source operand: If the
|
||||
/// doubleword in the second source is negative, calculate the two's
|
||||
/// complement of the corresponding word in the first source, and write that
|
||||
/// value to the destination. If the doubleword in the second source is
|
||||
/// positive, copy the corresponding word from the first source to the
|
||||
/// destination. If the doubleword in the second source is zero, clear the
|
||||
/// corresponding word in the destination.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c VPSIGND instruction.
|
||||
///
|
||||
/// \param __a
|
||||
/// A 128-bit integer vector containing the values to be copied.
|
||||
/// \param __b
|
||||
/// A 128-bit integer vector containing control doublewords corresponding to
|
||||
/// positions in the destination.
|
||||
/// \returns A 128-bit integer vector containing the resultant values.
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_sign_epi32(__m128i __a, __m128i __b)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_psignd128((__v4si)__a, (__v4si)__b);
|
||||
}
|
||||
|
||||
/// \brief For each 8-bit integer in the first source operand, perform one of
|
||||
/// the following actions as specified by the second source operand: If the
|
||||
/// byte in the second source is negative, calculate the two's complement of
|
||||
/// the corresponding byte in the first source, and write that value to the
|
||||
/// destination. If the byte in the second source is positive, copy the
|
||||
/// corresponding byte from the first source to the destination. If the byte
|
||||
/// in the second source is zero, clear the corresponding byte in the
|
||||
/// destination.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c PSIGNB instruction.
|
||||
///
|
||||
/// \param __a
|
||||
/// A 64-bit integer vector containing the values to be copied.
|
||||
/// \param __b
|
||||
/// A 64-bit integer vector containing control bytes corresponding to
|
||||
/// positions in the destination.
|
||||
/// \returns A 64-bit integer vector containing the resultant values.
|
||||
static __inline__ __m64 __DEFAULT_FN_ATTRS
|
||||
_mm_sign_pi8(__m64 __a, __m64 __b)
|
||||
{
|
||||
return (__m64)__builtin_ia32_psignb((__v8qi)__a, (__v8qi)__b);
|
||||
}
|
||||
|
||||
/// \brief For each 16-bit integer in the first source operand, perform one of
|
||||
/// the following actions as specified by the second source operand: If the
|
||||
/// word in the second source is negative, calculate the two's complement of
|
||||
/// the corresponding word in the first source, and write that value to the
|
||||
/// destination. If the word in the second source is positive, copy the
|
||||
/// corresponding word from the first source to the destination. If the word
|
||||
/// in the second source is zero, clear the corresponding word in the
|
||||
/// destination.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c PSIGNW instruction.
|
||||
///
|
||||
/// \param __a
|
||||
/// A 64-bit integer vector containing the values to be copied.
|
||||
/// \param __b
|
||||
/// A 64-bit integer vector containing control words corresponding to
|
||||
/// positions in the destination.
|
||||
/// \returns A 64-bit integer vector containing the resultant values.
|
||||
static __inline__ __m64 __DEFAULT_FN_ATTRS
|
||||
_mm_sign_pi16(__m64 __a, __m64 __b)
|
||||
{
|
||||
return (__m64)__builtin_ia32_psignw((__v4hi)__a, (__v4hi)__b);
|
||||
}
|
||||
|
||||
/// \brief For each 32-bit integer in the first source operand, perform one of
|
||||
/// the following actions as specified by the second source operand: If the
|
||||
/// doubleword in the second source is negative, calculate the two's
|
||||
/// complement of the corresponding doubleword in the first source, and
|
||||
/// write that value to the destination. If the doubleword in the second
|
||||
/// source is positive, copy the corresponding doubleword from the first
|
||||
/// source to the destination. If the doubleword in the second source is
|
||||
/// zero, clear the corresponding doubleword in the destination.
|
||||
///
|
||||
/// \headerfile <x86intrin.h>
|
||||
///
|
||||
/// This intrinsic corresponds to the \c PSIGND instruction.
|
||||
///
|
||||
/// \param __a
|
||||
/// A 64-bit integer vector containing the values to be copied.
|
||||
/// \param __b
|
||||
/// A 64-bit integer vector containing two control doublewords corresponding
|
||||
/// to positions in the destination.
|
||||
/// \returns A 64-bit integer vector containing the resultant values.
|
||||
static __inline__ __m64 __DEFAULT_FN_ATTRS
|
||||
_mm_sign_pi32(__m64 __a, __m64 __b)
|
||||
{
|
||||
return (__m64)__builtin_ia32_psignd((__v2si)__a, (__v2si)__b);
|
||||
}
|
||||
|
||||
#undef __DEFAULT_FN_ATTRS
|
||||
|
||||
#endif /* __TMMINTRIN_H */
|
||||
@@ -0,0 +1,299 @@
|
||||
/*===---- unwind.h - Stack unwinding ----------------------------------------===
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
|
||||
/* See "Data Definitions for libgcc_s" in the Linux Standard Base.*/
|
||||
|
||||
#ifndef __CLANG_UNWIND_H
|
||||
#define __CLANG_UNWIND_H
|
||||
|
||||
#if defined(__APPLE__) && __has_include_next(<unwind.h>)
|
||||
/* Darwin (from 11.x on) provide an unwind.h. If that's available,
|
||||
* use it. libunwind wraps some of its definitions in #ifdef _GNU_SOURCE,
|
||||
* so define that around the include.*/
|
||||
# ifndef _GNU_SOURCE
|
||||
# define _SHOULD_UNDEFINE_GNU_SOURCE
|
||||
# define _GNU_SOURCE
|
||||
# endif
|
||||
// libunwind's unwind.h reflects the current visibility. However, Mozilla
|
||||
// builds with -fvisibility=hidden and relies on gcc's unwind.h to reset the
|
||||
// visibility to default and export its contents. gcc also allows users to
|
||||
// override its override by #defining HIDE_EXPORTS (but note, this only obeys
|
||||
// the user's -fvisibility setting; it doesn't hide any exports on its own). We
|
||||
// imitate gcc's header here:
|
||||
# ifdef HIDE_EXPORTS
|
||||
# include_next <unwind.h>
|
||||
# else
|
||||
# pragma GCC visibility push(default)
|
||||
# include_next <unwind.h>
|
||||
# pragma GCC visibility pop
|
||||
# endif
|
||||
# ifdef _SHOULD_UNDEFINE_GNU_SOURCE
|
||||
# undef _GNU_SOURCE
|
||||
# undef _SHOULD_UNDEFINE_GNU_SOURCE
|
||||
# endif
|
||||
#else
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* It is a bit strange for a header to play with the visibility of the
|
||||
symbols it declares, but this matches gcc's behavior and some programs
|
||||
depend on it */
|
||||
#ifndef HIDE_EXPORTS
|
||||
#pragma GCC visibility push(default)
|
||||
#endif
|
||||
|
||||
typedef uintptr_t _Unwind_Word;
|
||||
typedef intptr_t _Unwind_Sword;
|
||||
typedef uintptr_t _Unwind_Ptr;
|
||||
typedef uintptr_t _Unwind_Internal_Ptr;
|
||||
typedef uint64_t _Unwind_Exception_Class;
|
||||
|
||||
typedef intptr_t _sleb128_t;
|
||||
typedef uintptr_t _uleb128_t;
|
||||
|
||||
struct _Unwind_Context;
|
||||
struct _Unwind_Exception;
|
||||
typedef enum {
|
||||
_URC_NO_REASON = 0,
|
||||
#if defined(__arm__) && !defined(__USING_SJLJ_EXCEPTIONS__) && \
|
||||
!defined(__ARM_DWARF_EH__)
|
||||
_URC_OK = 0, /* used by ARM EHABI */
|
||||
#endif
|
||||
_URC_FOREIGN_EXCEPTION_CAUGHT = 1,
|
||||
|
||||
_URC_FATAL_PHASE2_ERROR = 2,
|
||||
_URC_FATAL_PHASE1_ERROR = 3,
|
||||
_URC_NORMAL_STOP = 4,
|
||||
|
||||
_URC_END_OF_STACK = 5,
|
||||
_URC_HANDLER_FOUND = 6,
|
||||
_URC_INSTALL_CONTEXT = 7,
|
||||
_URC_CONTINUE_UNWIND = 8,
|
||||
#if defined(__arm__) && !defined(__USING_SJLJ_EXCEPTIONS__) && \
|
||||
!defined(__ARM_DWARF_EH__)
|
||||
_URC_FAILURE = 9 /* used by ARM EHABI */
|
||||
#endif
|
||||
} _Unwind_Reason_Code;
|
||||
|
||||
typedef enum {
|
||||
_UA_SEARCH_PHASE = 1,
|
||||
_UA_CLEANUP_PHASE = 2,
|
||||
|
||||
_UA_HANDLER_FRAME = 4,
|
||||
_UA_FORCE_UNWIND = 8,
|
||||
_UA_END_OF_STACK = 16 /* gcc extension to C++ ABI */
|
||||
} _Unwind_Action;
|
||||
|
||||
typedef void (*_Unwind_Exception_Cleanup_Fn)(_Unwind_Reason_Code,
|
||||
struct _Unwind_Exception *);
|
||||
|
||||
struct _Unwind_Exception {
|
||||
_Unwind_Exception_Class exception_class;
|
||||
_Unwind_Exception_Cleanup_Fn exception_cleanup;
|
||||
_Unwind_Word private_1;
|
||||
_Unwind_Word private_2;
|
||||
/* The Itanium ABI requires that _Unwind_Exception objects are "double-word
|
||||
* aligned". GCC has interpreted this to mean "use the maximum useful
|
||||
* alignment for the target"; so do we. */
|
||||
} __attribute__((__aligned__));
|
||||
|
||||
typedef _Unwind_Reason_Code (*_Unwind_Stop_Fn)(int, _Unwind_Action,
|
||||
_Unwind_Exception_Class,
|
||||
struct _Unwind_Exception *,
|
||||
struct _Unwind_Context *,
|
||||
void *);
|
||||
|
||||
typedef _Unwind_Reason_Code (*_Unwind_Personality_Fn)(
|
||||
int, _Unwind_Action, _Unwind_Exception_Class, struct _Unwind_Exception *,
|
||||
struct _Unwind_Context *);
|
||||
typedef _Unwind_Personality_Fn __personality_routine;
|
||||
|
||||
typedef _Unwind_Reason_Code (*_Unwind_Trace_Fn)(struct _Unwind_Context *,
|
||||
void *);
|
||||
|
||||
#if defined(__arm__) && !defined(__APPLE__)
|
||||
|
||||
typedef enum {
|
||||
_UVRSC_CORE = 0, /* integer register */
|
||||
_UVRSC_VFP = 1, /* vfp */
|
||||
_UVRSC_WMMXD = 3, /* Intel WMMX data register */
|
||||
_UVRSC_WMMXC = 4 /* Intel WMMX control register */
|
||||
} _Unwind_VRS_RegClass;
|
||||
|
||||
typedef enum {
|
||||
_UVRSD_UINT32 = 0,
|
||||
_UVRSD_VFPX = 1,
|
||||
_UVRSD_UINT64 = 3,
|
||||
_UVRSD_FLOAT = 4,
|
||||
_UVRSD_DOUBLE = 5
|
||||
} _Unwind_VRS_DataRepresentation;
|
||||
|
||||
typedef enum {
|
||||
_UVRSR_OK = 0,
|
||||
_UVRSR_NOT_IMPLEMENTED = 1,
|
||||
_UVRSR_FAILED = 2
|
||||
} _Unwind_VRS_Result;
|
||||
|
||||
#if !defined(__USING_SJLJ_EXCEPTIONS__) && !defined(__ARM_DWARF_EH__)
|
||||
typedef uint32_t _Unwind_State;
|
||||
#define _US_VIRTUAL_UNWIND_FRAME ((_Unwind_State)0)
|
||||
#define _US_UNWIND_FRAME_STARTING ((_Unwind_State)1)
|
||||
#define _US_UNWIND_FRAME_RESUME ((_Unwind_State)2)
|
||||
#define _US_ACTION_MASK ((_Unwind_State)3)
|
||||
#define _US_FORCE_UNWIND ((_Unwind_State)8)
|
||||
#endif
|
||||
|
||||
_Unwind_VRS_Result _Unwind_VRS_Get(struct _Unwind_Context *__context,
|
||||
_Unwind_VRS_RegClass __regclass,
|
||||
uint32_t __regno,
|
||||
_Unwind_VRS_DataRepresentation __representation,
|
||||
void *__valuep);
|
||||
|
||||
_Unwind_VRS_Result _Unwind_VRS_Set(struct _Unwind_Context *__context,
|
||||
_Unwind_VRS_RegClass __regclass,
|
||||
uint32_t __regno,
|
||||
_Unwind_VRS_DataRepresentation __representation,
|
||||
void *__valuep);
|
||||
|
||||
static __inline__
|
||||
_Unwind_Word _Unwind_GetGR(struct _Unwind_Context *__context, int __index) {
|
||||
_Unwind_Word __value;
|
||||
_Unwind_VRS_Get(__context, _UVRSC_CORE, __index, _UVRSD_UINT32, &__value);
|
||||
return __value;
|
||||
}
|
||||
|
||||
static __inline__
|
||||
void _Unwind_SetGR(struct _Unwind_Context *__context, int __index,
|
||||
_Unwind_Word __value) {
|
||||
_Unwind_VRS_Set(__context, _UVRSC_CORE, __index, _UVRSD_UINT32, &__value);
|
||||
}
|
||||
|
||||
static __inline__
|
||||
_Unwind_Word _Unwind_GetIP(struct _Unwind_Context *__context) {
|
||||
_Unwind_Word __ip = _Unwind_GetGR(__context, 15);
|
||||
return __ip & ~(_Unwind_Word)(0x1); /* Remove thumb mode bit. */
|
||||
}
|
||||
|
||||
static __inline__
|
||||
void _Unwind_SetIP(struct _Unwind_Context *__context, _Unwind_Word __value) {
|
||||
_Unwind_Word __thumb_mode_bit = _Unwind_GetGR(__context, 15) & 0x1;
|
||||
_Unwind_SetGR(__context, 15, __value | __thumb_mode_bit);
|
||||
}
|
||||
#else
|
||||
_Unwind_Word _Unwind_GetGR(struct _Unwind_Context *, int);
|
||||
void _Unwind_SetGR(struct _Unwind_Context *, int, _Unwind_Word);
|
||||
|
||||
_Unwind_Word _Unwind_GetIP(struct _Unwind_Context *);
|
||||
void _Unwind_SetIP(struct _Unwind_Context *, _Unwind_Word);
|
||||
#endif
|
||||
|
||||
|
||||
_Unwind_Word _Unwind_GetIPInfo(struct _Unwind_Context *, int *);
|
||||
|
||||
_Unwind_Word _Unwind_GetCFA(struct _Unwind_Context *);
|
||||
|
||||
_Unwind_Word _Unwind_GetBSP(struct _Unwind_Context *);
|
||||
|
||||
void *_Unwind_GetLanguageSpecificData(struct _Unwind_Context *);
|
||||
|
||||
_Unwind_Ptr _Unwind_GetRegionStart(struct _Unwind_Context *);
|
||||
|
||||
/* DWARF EH functions; currently not available on Darwin/ARM */
|
||||
#if !defined(__APPLE__) || !defined(__arm__)
|
||||
|
||||
_Unwind_Reason_Code _Unwind_RaiseException(struct _Unwind_Exception *);
|
||||
_Unwind_Reason_Code _Unwind_ForcedUnwind(struct _Unwind_Exception *,
|
||||
_Unwind_Stop_Fn, void *);
|
||||
void _Unwind_DeleteException(struct _Unwind_Exception *);
|
||||
void _Unwind_Resume(struct _Unwind_Exception *);
|
||||
_Unwind_Reason_Code _Unwind_Resume_or_Rethrow(struct _Unwind_Exception *);
|
||||
|
||||
#endif
|
||||
|
||||
_Unwind_Reason_Code _Unwind_Backtrace(_Unwind_Trace_Fn, void *);
|
||||
|
||||
/* setjmp(3)/longjmp(3) stuff */
|
||||
typedef struct SjLj_Function_Context *_Unwind_FunctionContext_t;
|
||||
|
||||
void _Unwind_SjLj_Register(_Unwind_FunctionContext_t);
|
||||
void _Unwind_SjLj_Unregister(_Unwind_FunctionContext_t);
|
||||
_Unwind_Reason_Code _Unwind_SjLj_RaiseException(struct _Unwind_Exception *);
|
||||
_Unwind_Reason_Code _Unwind_SjLj_ForcedUnwind(struct _Unwind_Exception *,
|
||||
_Unwind_Stop_Fn, void *);
|
||||
void _Unwind_SjLj_Resume(struct _Unwind_Exception *);
|
||||
_Unwind_Reason_Code _Unwind_SjLj_Resume_or_Rethrow(struct _Unwind_Exception *);
|
||||
|
||||
void *_Unwind_FindEnclosingFunction(void *);
|
||||
|
||||
#ifdef __APPLE__
|
||||
|
||||
_Unwind_Ptr _Unwind_GetDataRelBase(struct _Unwind_Context *)
|
||||
__attribute__((__unavailable__));
|
||||
_Unwind_Ptr _Unwind_GetTextRelBase(struct _Unwind_Context *)
|
||||
__attribute__((__unavailable__));
|
||||
|
||||
/* Darwin-specific functions */
|
||||
void __register_frame(const void *);
|
||||
void __deregister_frame(const void *);
|
||||
|
||||
struct dwarf_eh_bases {
|
||||
uintptr_t tbase;
|
||||
uintptr_t dbase;
|
||||
uintptr_t func;
|
||||
};
|
||||
void *_Unwind_Find_FDE(const void *, struct dwarf_eh_bases *);
|
||||
|
||||
void __register_frame_info_bases(const void *, void *, void *, void *)
|
||||
__attribute__((__unavailable__));
|
||||
void __register_frame_info(const void *, void *) __attribute__((__unavailable__));
|
||||
void __register_frame_info_table_bases(const void *, void*, void *, void *)
|
||||
__attribute__((__unavailable__));
|
||||
void __register_frame_info_table(const void *, void *)
|
||||
__attribute__((__unavailable__));
|
||||
void __register_frame_table(const void *) __attribute__((__unavailable__));
|
||||
void __deregister_frame_info(const void *) __attribute__((__unavailable__));
|
||||
void __deregister_frame_info_bases(const void *)__attribute__((__unavailable__));
|
||||
|
||||
#else
|
||||
|
||||
_Unwind_Ptr _Unwind_GetDataRelBase(struct _Unwind_Context *);
|
||||
_Unwind_Ptr _Unwind_GetTextRelBase(struct _Unwind_Context *);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef HIDE_EXPORTS
|
||||
#pragma GCC visibility pop
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* __CLANG_UNWIND_H */
|
||||
@@ -0,0 +1,65 @@
|
||||
/* ===-------- vadefs.h ---------------------------------------------------===
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
|
||||
/* Only include this if we are aiming for MSVC compatibility. */
|
||||
#ifndef _MSC_VER
|
||||
#include_next <vadefs.h>
|
||||
#else
|
||||
|
||||
#ifndef __clang_vadefs_h
|
||||
#define __clang_vadefs_h
|
||||
|
||||
#include_next <vadefs.h>
|
||||
|
||||
/* Override macros from vadefs.h with definitions that work with Clang. */
|
||||
#ifdef _crt_va_start
|
||||
#undef _crt_va_start
|
||||
#define _crt_va_start(ap, param) __builtin_va_start(ap, param)
|
||||
#endif
|
||||
#ifdef _crt_va_end
|
||||
#undef _crt_va_end
|
||||
#define _crt_va_end(ap) __builtin_va_end(ap)
|
||||
#endif
|
||||
#ifdef _crt_va_arg
|
||||
#undef _crt_va_arg
|
||||
#define _crt_va_arg(ap, type) __builtin_va_arg(ap, type)
|
||||
#endif
|
||||
|
||||
/* VS 2015 switched to double underscore names, which is an improvement, but now
|
||||
* we have to intercept those names too.
|
||||
*/
|
||||
#ifdef __crt_va_start
|
||||
#undef __crt_va_start
|
||||
#define __crt_va_start(ap, param) __builtin_va_start(ap, param)
|
||||
#endif
|
||||
#ifdef __crt_va_end
|
||||
#undef __crt_va_end
|
||||
#define __crt_va_end(ap) __builtin_va_end(ap)
|
||||
#endif
|
||||
#ifdef __crt_va_arg
|
||||
#undef __crt_va_arg
|
||||
#define __crt_va_arg(ap, type) __builtin_va_arg(ap, type)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif
|
||||
@@ -0,0 +1,26 @@
|
||||
/*===---- varargs.h - Variable argument handling -------------------------------------===
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
#ifndef __VARARGS_H
|
||||
#define __VARARGS_H
|
||||
#error "Please use <stdarg.h> instead of <varargs.h>"
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,33 @@
|
||||
/*===---- wmmintrin.h - AES intrinsics ------------------------------------===
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
|
||||
#ifndef _WMMINTRIN_H
|
||||
#define _WMMINTRIN_H
|
||||
|
||||
#include <emmintrin.h>
|
||||
|
||||
#include <__wmmintrin_aes.h>
|
||||
|
||||
#include <__wmmintrin_pclmul.h>
|
||||
|
||||
#endif /* _WMMINTRIN_H */
|
||||
@@ -0,0 +1,85 @@
|
||||
/*===---- x86intrin.h - X86 intrinsics -------------------------------------===
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
|
||||
#ifndef __X86INTRIN_H
|
||||
#define __X86INTRIN_H
|
||||
|
||||
#include <ia32intrin.h>
|
||||
|
||||
#include <immintrin.h>
|
||||
|
||||
#if !defined(_MSC_VER) || __has_feature(modules) || defined(__3dNOW__)
|
||||
#include <mm3dnow.h>
|
||||
#endif
|
||||
|
||||
#if !defined(_MSC_VER) || __has_feature(modules) || defined(__BMI__)
|
||||
#include <bmiintrin.h>
|
||||
#endif
|
||||
|
||||
#if !defined(_MSC_VER) || __has_feature(modules) || defined(__BMI2__)
|
||||
#include <bmi2intrin.h>
|
||||
#endif
|
||||
|
||||
#if !defined(_MSC_VER) || __has_feature(modules) || defined(__LZCNT__)
|
||||
#include <lzcntintrin.h>
|
||||
#endif
|
||||
|
||||
#if !defined(_MSC_VER) || __has_feature(modules) || defined(__POPCNT__)
|
||||
#include <popcntintrin.h>
|
||||
#endif
|
||||
|
||||
#if !defined(_MSC_VER) || __has_feature(modules) || defined(__RDSEED__)
|
||||
#include <rdseedintrin.h>
|
||||
#endif
|
||||
|
||||
#if !defined(_MSC_VER) || __has_feature(modules) || defined(__PRFCHW__)
|
||||
#include <prfchwintrin.h>
|
||||
#endif
|
||||
|
||||
#if !defined(_MSC_VER) || __has_feature(modules) || defined(__SSE4A__)
|
||||
#include <ammintrin.h>
|
||||
#endif
|
||||
|
||||
#if !defined(_MSC_VER) || __has_feature(modules) || defined(__FMA4__)
|
||||
#include <fma4intrin.h>
|
||||
#endif
|
||||
|
||||
#if !defined(_MSC_VER) || __has_feature(modules) || defined(__XOP__)
|
||||
#include <xopintrin.h>
|
||||
#endif
|
||||
|
||||
#if !defined(_MSC_VER) || __has_feature(modules) || defined(__TBM__)
|
||||
#include <tbmintrin.h>
|
||||
#endif
|
||||
|
||||
#if !defined(_MSC_VER) || __has_feature(modules) || defined(__F16C__)
|
||||
#include <f16cintrin.h>
|
||||
#endif
|
||||
|
||||
#if !defined(_MSC_VER) || __has_feature(modules) || defined(__MWAITX__)
|
||||
#include <mwaitxintrin.h>
|
||||
#endif
|
||||
|
||||
/* FIXME: LWP */
|
||||
|
||||
#endif /* __X86INTRIN_H */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,782 @@
|
||||
/*===---- xopintrin.h - XOP intrinsics -------------------------------------===
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
|
||||
#ifndef __X86INTRIN_H
|
||||
#error "Never use <xopintrin.h> directly; include <x86intrin.h> instead."
|
||||
#endif
|
||||
|
||||
#ifndef __XOPINTRIN_H
|
||||
#define __XOPINTRIN_H
|
||||
|
||||
#include <fma4intrin.h>
|
||||
|
||||
/* Define the default attributes for the functions in this file. */
|
||||
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("xop")))
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_maccs_epi16(__m128i __A, __m128i __B, __m128i __C)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_vpmacssww((__v8hi)__A, (__v8hi)__B, (__v8hi)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_macc_epi16(__m128i __A, __m128i __B, __m128i __C)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_vpmacsww((__v8hi)__A, (__v8hi)__B, (__v8hi)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_maccsd_epi16(__m128i __A, __m128i __B, __m128i __C)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_vpmacsswd((__v8hi)__A, (__v8hi)__B, (__v4si)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_maccd_epi16(__m128i __A, __m128i __B, __m128i __C)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_vpmacswd((__v8hi)__A, (__v8hi)__B, (__v4si)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_maccs_epi32(__m128i __A, __m128i __B, __m128i __C)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_vpmacssdd((__v4si)__A, (__v4si)__B, (__v4si)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_macc_epi32(__m128i __A, __m128i __B, __m128i __C)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_vpmacsdd((__v4si)__A, (__v4si)__B, (__v4si)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_maccslo_epi32(__m128i __A, __m128i __B, __m128i __C)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_vpmacssdql((__v4si)__A, (__v4si)__B, (__v2di)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_macclo_epi32(__m128i __A, __m128i __B, __m128i __C)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_vpmacsdql((__v4si)__A, (__v4si)__B, (__v2di)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_maccshi_epi32(__m128i __A, __m128i __B, __m128i __C)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_vpmacssdqh((__v4si)__A, (__v4si)__B, (__v2di)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_macchi_epi32(__m128i __A, __m128i __B, __m128i __C)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_vpmacsdqh((__v4si)__A, (__v4si)__B, (__v2di)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_maddsd_epi16(__m128i __A, __m128i __B, __m128i __C)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_vpmadcsswd((__v8hi)__A, (__v8hi)__B, (__v4si)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_maddd_epi16(__m128i __A, __m128i __B, __m128i __C)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_vpmadcswd((__v8hi)__A, (__v8hi)__B, (__v4si)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_haddw_epi8(__m128i __A)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_vphaddbw((__v16qi)__A);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_haddd_epi8(__m128i __A)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_vphaddbd((__v16qi)__A);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_haddq_epi8(__m128i __A)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_vphaddbq((__v16qi)__A);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_haddd_epi16(__m128i __A)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_vphaddwd((__v8hi)__A);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_haddq_epi16(__m128i __A)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_vphaddwq((__v8hi)__A);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_haddq_epi32(__m128i __A)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_vphadddq((__v4si)__A);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_haddw_epu8(__m128i __A)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_vphaddubw((__v16qi)__A);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_haddd_epu8(__m128i __A)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_vphaddubd((__v16qi)__A);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_haddq_epu8(__m128i __A)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_vphaddubq((__v16qi)__A);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_haddd_epu16(__m128i __A)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_vphadduwd((__v8hi)__A);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_haddq_epu16(__m128i __A)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_vphadduwq((__v8hi)__A);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_haddq_epu32(__m128i __A)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_vphaddudq((__v4si)__A);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_hsubw_epi8(__m128i __A)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_vphsubbw((__v16qi)__A);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_hsubd_epi16(__m128i __A)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_vphsubwd((__v8hi)__A);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_hsubq_epi32(__m128i __A)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_vphsubdq((__v4si)__A);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_cmov_si128(__m128i __A, __m128i __B, __m128i __C)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_vpcmov((__v2di)__A, (__v2di)__B, (__v2di)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m256i __DEFAULT_FN_ATTRS
|
||||
_mm256_cmov_si256(__m256i __A, __m256i __B, __m256i __C)
|
||||
{
|
||||
return (__m256i)__builtin_ia32_vpcmov_256((__v4di)__A, (__v4di)__B, (__v4di)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_perm_epi8(__m128i __A, __m128i __B, __m128i __C)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_vpperm((__v16qi)__A, (__v16qi)__B, (__v16qi)__C);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_rot_epi8(__m128i __A, __m128i __B)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_vprotb((__v16qi)__A, (__v16qi)__B);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_rot_epi16(__m128i __A, __m128i __B)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_vprotw((__v8hi)__A, (__v8hi)__B);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_rot_epi32(__m128i __A, __m128i __B)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_vprotd((__v4si)__A, (__v4si)__B);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_rot_epi64(__m128i __A, __m128i __B)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_vprotq((__v2di)__A, (__v2di)__B);
|
||||
}
|
||||
|
||||
#define _mm_roti_epi8(A, N) __extension__ ({ \
|
||||
(__m128i)__builtin_ia32_vprotbi((__v16qi)(__m128i)(A), (N)); })
|
||||
|
||||
#define _mm_roti_epi16(A, N) __extension__ ({ \
|
||||
(__m128i)__builtin_ia32_vprotwi((__v8hi)(__m128i)(A), (N)); })
|
||||
|
||||
#define _mm_roti_epi32(A, N) __extension__ ({ \
|
||||
(__m128i)__builtin_ia32_vprotdi((__v4si)(__m128i)(A), (N)); })
|
||||
|
||||
#define _mm_roti_epi64(A, N) __extension__ ({ \
|
||||
(__m128i)__builtin_ia32_vprotqi((__v2di)(__m128i)(A), (N)); })
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_shl_epi8(__m128i __A, __m128i __B)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_vpshlb((__v16qi)__A, (__v16qi)__B);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_shl_epi16(__m128i __A, __m128i __B)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_vpshlw((__v8hi)__A, (__v8hi)__B);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_shl_epi32(__m128i __A, __m128i __B)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_vpshld((__v4si)__A, (__v4si)__B);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_shl_epi64(__m128i __A, __m128i __B)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_vpshlq((__v2di)__A, (__v2di)__B);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_sha_epi8(__m128i __A, __m128i __B)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_vpshab((__v16qi)__A, (__v16qi)__B);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_sha_epi16(__m128i __A, __m128i __B)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_vpshaw((__v8hi)__A, (__v8hi)__B);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_sha_epi32(__m128i __A, __m128i __B)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_vpshad((__v4si)__A, (__v4si)__B);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_sha_epi64(__m128i __A, __m128i __B)
|
||||
{
|
||||
return (__m128i)__builtin_ia32_vpshaq((__v2di)__A, (__v2di)__B);
|
||||
}
|
||||
|
||||
#define _mm_com_epu8(A, B, N) __extension__ ({ \
|
||||
(__m128i)__builtin_ia32_vpcomub((__v16qi)(__m128i)(A), \
|
||||
(__v16qi)(__m128i)(B), (N)); })
|
||||
|
||||
#define _mm_com_epu16(A, B, N) __extension__ ({ \
|
||||
(__m128i)__builtin_ia32_vpcomuw((__v8hi)(__m128i)(A), \
|
||||
(__v8hi)(__m128i)(B), (N)); })
|
||||
|
||||
#define _mm_com_epu32(A, B, N) __extension__ ({ \
|
||||
(__m128i)__builtin_ia32_vpcomud((__v4si)(__m128i)(A), \
|
||||
(__v4si)(__m128i)(B), (N)); })
|
||||
|
||||
#define _mm_com_epu64(A, B, N) __extension__ ({ \
|
||||
(__m128i)__builtin_ia32_vpcomuq((__v2di)(__m128i)(A), \
|
||||
(__v2di)(__m128i)(B), (N)); })
|
||||
|
||||
#define _mm_com_epi8(A, B, N) __extension__ ({ \
|
||||
(__m128i)__builtin_ia32_vpcomb((__v16qi)(__m128i)(A), \
|
||||
(__v16qi)(__m128i)(B), (N)); })
|
||||
|
||||
#define _mm_com_epi16(A, B, N) __extension__ ({ \
|
||||
(__m128i)__builtin_ia32_vpcomw((__v8hi)(__m128i)(A), \
|
||||
(__v8hi)(__m128i)(B), (N)); })
|
||||
|
||||
#define _mm_com_epi32(A, B, N) __extension__ ({ \
|
||||
(__m128i)__builtin_ia32_vpcomd((__v4si)(__m128i)(A), \
|
||||
(__v4si)(__m128i)(B), (N)); })
|
||||
|
||||
#define _mm_com_epi64(A, B, N) __extension__ ({ \
|
||||
(__m128i)__builtin_ia32_vpcomq((__v2di)(__m128i)(A), \
|
||||
(__v2di)(__m128i)(B), (N)); })
|
||||
|
||||
#define _MM_PCOMCTRL_LT 0
|
||||
#define _MM_PCOMCTRL_LE 1
|
||||
#define _MM_PCOMCTRL_GT 2
|
||||
#define _MM_PCOMCTRL_GE 3
|
||||
#define _MM_PCOMCTRL_EQ 4
|
||||
#define _MM_PCOMCTRL_NEQ 5
|
||||
#define _MM_PCOMCTRL_FALSE 6
|
||||
#define _MM_PCOMCTRL_TRUE 7
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_comlt_epu8(__m128i __A, __m128i __B)
|
||||
{
|
||||
return _mm_com_epu8(__A, __B, _MM_PCOMCTRL_LT);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_comle_epu8(__m128i __A, __m128i __B)
|
||||
{
|
||||
return _mm_com_epu8(__A, __B, _MM_PCOMCTRL_LE);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_comgt_epu8(__m128i __A, __m128i __B)
|
||||
{
|
||||
return _mm_com_epu8(__A, __B, _MM_PCOMCTRL_GT);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_comge_epu8(__m128i __A, __m128i __B)
|
||||
{
|
||||
return _mm_com_epu8(__A, __B, _MM_PCOMCTRL_GE);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_comeq_epu8(__m128i __A, __m128i __B)
|
||||
{
|
||||
return _mm_com_epu8(__A, __B, _MM_PCOMCTRL_EQ);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_comneq_epu8(__m128i __A, __m128i __B)
|
||||
{
|
||||
return _mm_com_epu8(__A, __B, _MM_PCOMCTRL_NEQ);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_comfalse_epu8(__m128i __A, __m128i __B)
|
||||
{
|
||||
return _mm_com_epu8(__A, __B, _MM_PCOMCTRL_FALSE);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_comtrue_epu8(__m128i __A, __m128i __B)
|
||||
{
|
||||
return _mm_com_epu8(__A, __B, _MM_PCOMCTRL_TRUE);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_comlt_epu16(__m128i __A, __m128i __B)
|
||||
{
|
||||
return _mm_com_epu16(__A, __B, _MM_PCOMCTRL_LT);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_comle_epu16(__m128i __A, __m128i __B)
|
||||
{
|
||||
return _mm_com_epu16(__A, __B, _MM_PCOMCTRL_LE);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_comgt_epu16(__m128i __A, __m128i __B)
|
||||
{
|
||||
return _mm_com_epu16(__A, __B, _MM_PCOMCTRL_GT);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_comge_epu16(__m128i __A, __m128i __B)
|
||||
{
|
||||
return _mm_com_epu16(__A, __B, _MM_PCOMCTRL_GE);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_comeq_epu16(__m128i __A, __m128i __B)
|
||||
{
|
||||
return _mm_com_epu16(__A, __B, _MM_PCOMCTRL_EQ);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_comneq_epu16(__m128i __A, __m128i __B)
|
||||
{
|
||||
return _mm_com_epu16(__A, __B, _MM_PCOMCTRL_NEQ);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_comfalse_epu16(__m128i __A, __m128i __B)
|
||||
{
|
||||
return _mm_com_epu16(__A, __B, _MM_PCOMCTRL_FALSE);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_comtrue_epu16(__m128i __A, __m128i __B)
|
||||
{
|
||||
return _mm_com_epu16(__A, __B, _MM_PCOMCTRL_TRUE);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_comlt_epu32(__m128i __A, __m128i __B)
|
||||
{
|
||||
return _mm_com_epu32(__A, __B, _MM_PCOMCTRL_LT);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_comle_epu32(__m128i __A, __m128i __B)
|
||||
{
|
||||
return _mm_com_epu32(__A, __B, _MM_PCOMCTRL_LE);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_comgt_epu32(__m128i __A, __m128i __B)
|
||||
{
|
||||
return _mm_com_epu32(__A, __B, _MM_PCOMCTRL_GT);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_comge_epu32(__m128i __A, __m128i __B)
|
||||
{
|
||||
return _mm_com_epu32(__A, __B, _MM_PCOMCTRL_GE);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_comeq_epu32(__m128i __A, __m128i __B)
|
||||
{
|
||||
return _mm_com_epu32(__A, __B, _MM_PCOMCTRL_EQ);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_comneq_epu32(__m128i __A, __m128i __B)
|
||||
{
|
||||
return _mm_com_epu32(__A, __B, _MM_PCOMCTRL_NEQ);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_comfalse_epu32(__m128i __A, __m128i __B)
|
||||
{
|
||||
return _mm_com_epu32(__A, __B, _MM_PCOMCTRL_FALSE);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_comtrue_epu32(__m128i __A, __m128i __B)
|
||||
{
|
||||
return _mm_com_epu32(__A, __B, _MM_PCOMCTRL_TRUE);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_comlt_epu64(__m128i __A, __m128i __B)
|
||||
{
|
||||
return _mm_com_epu64(__A, __B, _MM_PCOMCTRL_LT);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_comle_epu64(__m128i __A, __m128i __B)
|
||||
{
|
||||
return _mm_com_epu64(__A, __B, _MM_PCOMCTRL_LE);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_comgt_epu64(__m128i __A, __m128i __B)
|
||||
{
|
||||
return _mm_com_epu64(__A, __B, _MM_PCOMCTRL_GT);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_comge_epu64(__m128i __A, __m128i __B)
|
||||
{
|
||||
return _mm_com_epu64(__A, __B, _MM_PCOMCTRL_GE);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_comeq_epu64(__m128i __A, __m128i __B)
|
||||
{
|
||||
return _mm_com_epu64(__A, __B, _MM_PCOMCTRL_EQ);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_comneq_epu64(__m128i __A, __m128i __B)
|
||||
{
|
||||
return _mm_com_epu64(__A, __B, _MM_PCOMCTRL_NEQ);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_comfalse_epu64(__m128i __A, __m128i __B)
|
||||
{
|
||||
return _mm_com_epu64(__A, __B, _MM_PCOMCTRL_FALSE);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_comtrue_epu64(__m128i __A, __m128i __B)
|
||||
{
|
||||
return _mm_com_epu64(__A, __B, _MM_PCOMCTRL_TRUE);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_comlt_epi8(__m128i __A, __m128i __B)
|
||||
{
|
||||
return _mm_com_epi8(__A, __B, _MM_PCOMCTRL_LT);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_comle_epi8(__m128i __A, __m128i __B)
|
||||
{
|
||||
return _mm_com_epi8(__A, __B, _MM_PCOMCTRL_LE);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_comgt_epi8(__m128i __A, __m128i __B)
|
||||
{
|
||||
return _mm_com_epi8(__A, __B, _MM_PCOMCTRL_GT);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_comge_epi8(__m128i __A, __m128i __B)
|
||||
{
|
||||
return _mm_com_epi8(__A, __B, _MM_PCOMCTRL_GE);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_comeq_epi8(__m128i __A, __m128i __B)
|
||||
{
|
||||
return _mm_com_epi8(__A, __B, _MM_PCOMCTRL_EQ);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_comneq_epi8(__m128i __A, __m128i __B)
|
||||
{
|
||||
return _mm_com_epi8(__A, __B, _MM_PCOMCTRL_NEQ);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_comfalse_epi8(__m128i __A, __m128i __B)
|
||||
{
|
||||
return _mm_com_epi8(__A, __B, _MM_PCOMCTRL_FALSE);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_comtrue_epi8(__m128i __A, __m128i __B)
|
||||
{
|
||||
return _mm_com_epi8(__A, __B, _MM_PCOMCTRL_TRUE);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_comlt_epi16(__m128i __A, __m128i __B)
|
||||
{
|
||||
return _mm_com_epi16(__A, __B, _MM_PCOMCTRL_LT);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_comle_epi16(__m128i __A, __m128i __B)
|
||||
{
|
||||
return _mm_com_epi16(__A, __B, _MM_PCOMCTRL_LE);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_comgt_epi16(__m128i __A, __m128i __B)
|
||||
{
|
||||
return _mm_com_epi16(__A, __B, _MM_PCOMCTRL_GT);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_comge_epi16(__m128i __A, __m128i __B)
|
||||
{
|
||||
return _mm_com_epi16(__A, __B, _MM_PCOMCTRL_GE);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_comeq_epi16(__m128i __A, __m128i __B)
|
||||
{
|
||||
return _mm_com_epi16(__A, __B, _MM_PCOMCTRL_EQ);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_comneq_epi16(__m128i __A, __m128i __B)
|
||||
{
|
||||
return _mm_com_epi16(__A, __B, _MM_PCOMCTRL_NEQ);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_comfalse_epi16(__m128i __A, __m128i __B)
|
||||
{
|
||||
return _mm_com_epi16(__A, __B, _MM_PCOMCTRL_FALSE);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_comtrue_epi16(__m128i __A, __m128i __B)
|
||||
{
|
||||
return _mm_com_epi16(__A, __B, _MM_PCOMCTRL_TRUE);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_comlt_epi32(__m128i __A, __m128i __B)
|
||||
{
|
||||
return _mm_com_epi32(__A, __B, _MM_PCOMCTRL_LT);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_comle_epi32(__m128i __A, __m128i __B)
|
||||
{
|
||||
return _mm_com_epi32(__A, __B, _MM_PCOMCTRL_LE);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_comgt_epi32(__m128i __A, __m128i __B)
|
||||
{
|
||||
return _mm_com_epi32(__A, __B, _MM_PCOMCTRL_GT);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_comge_epi32(__m128i __A, __m128i __B)
|
||||
{
|
||||
return _mm_com_epi32(__A, __B, _MM_PCOMCTRL_GE);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_comeq_epi32(__m128i __A, __m128i __B)
|
||||
{
|
||||
return _mm_com_epi32(__A, __B, _MM_PCOMCTRL_EQ);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_comneq_epi32(__m128i __A, __m128i __B)
|
||||
{
|
||||
return _mm_com_epi32(__A, __B, _MM_PCOMCTRL_NEQ);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_comfalse_epi32(__m128i __A, __m128i __B)
|
||||
{
|
||||
return _mm_com_epi32(__A, __B, _MM_PCOMCTRL_FALSE);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_comtrue_epi32(__m128i __A, __m128i __B)
|
||||
{
|
||||
return _mm_com_epi32(__A, __B, _MM_PCOMCTRL_TRUE);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_comlt_epi64(__m128i __A, __m128i __B)
|
||||
{
|
||||
return _mm_com_epi64(__A, __B, _MM_PCOMCTRL_LT);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_comle_epi64(__m128i __A, __m128i __B)
|
||||
{
|
||||
return _mm_com_epi64(__A, __B, _MM_PCOMCTRL_LE);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_comgt_epi64(__m128i __A, __m128i __B)
|
||||
{
|
||||
return _mm_com_epi64(__A, __B, _MM_PCOMCTRL_GT);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_comge_epi64(__m128i __A, __m128i __B)
|
||||
{
|
||||
return _mm_com_epi64(__A, __B, _MM_PCOMCTRL_GE);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_comeq_epi64(__m128i __A, __m128i __B)
|
||||
{
|
||||
return _mm_com_epi64(__A, __B, _MM_PCOMCTRL_EQ);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_comneq_epi64(__m128i __A, __m128i __B)
|
||||
{
|
||||
return _mm_com_epi64(__A, __B, _MM_PCOMCTRL_NEQ);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_comfalse_epi64(__m128i __A, __m128i __B)
|
||||
{
|
||||
return _mm_com_epi64(__A, __B, _MM_PCOMCTRL_FALSE);
|
||||
}
|
||||
|
||||
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
||||
_mm_comtrue_epi64(__m128i __A, __m128i __B)
|
||||
{
|
||||
return _mm_com_epi64(__A, __B, _MM_PCOMCTRL_TRUE);
|
||||
}
|
||||
|
||||
#define _mm_permute2_pd(X, Y, C, I) __extension__ ({ \
|
||||
(__m128d)__builtin_ia32_vpermil2pd((__v2df)(__m128d)(X), \
|
||||
(__v2df)(__m128d)(Y), \
|
||||
(__v2di)(__m128i)(C), (I)); })
|
||||
|
||||
#define _mm256_permute2_pd(X, Y, C, I) __extension__ ({ \
|
||||
(__m256d)__builtin_ia32_vpermil2pd256((__v4df)(__m256d)(X), \
|
||||
(__v4df)(__m256d)(Y), \
|
||||
(__v4di)(__m256i)(C), (I)); })
|
||||
|
||||
#define _mm_permute2_ps(X, Y, C, I) __extension__ ({ \
|
||||
(__m128)__builtin_ia32_vpermil2ps((__v4sf)(__m128)(X), (__v4sf)(__m128)(Y), \
|
||||
(__v4si)(__m128i)(C), (I)); })
|
||||
|
||||
#define _mm256_permute2_ps(X, Y, C, I) __extension__ ({ \
|
||||
(__m256)__builtin_ia32_vpermil2ps256((__v8sf)(__m256)(X), \
|
||||
(__v8sf)(__m256)(Y), \
|
||||
(__v8si)(__m256i)(C), (I)); })
|
||||
|
||||
static __inline__ __m128 __DEFAULT_FN_ATTRS
|
||||
_mm_frcz_ss(__m128 __A)
|
||||
{
|
||||
return (__m128)__builtin_ia32_vfrczss((__v4sf)__A);
|
||||
}
|
||||
|
||||
static __inline__ __m128d __DEFAULT_FN_ATTRS
|
||||
_mm_frcz_sd(__m128d __A)
|
||||
{
|
||||
return (__m128d)__builtin_ia32_vfrczsd((__v2df)__A);
|
||||
}
|
||||
|
||||
static __inline__ __m128 __DEFAULT_FN_ATTRS
|
||||
_mm_frcz_ps(__m128 __A)
|
||||
{
|
||||
return (__m128)__builtin_ia32_vfrczps((__v4sf)__A);
|
||||
}
|
||||
|
||||
static __inline__ __m128d __DEFAULT_FN_ATTRS
|
||||
_mm_frcz_pd(__m128d __A)
|
||||
{
|
||||
return (__m128d)__builtin_ia32_vfrczpd((__v2df)__A);
|
||||
}
|
||||
|
||||
static __inline__ __m256 __DEFAULT_FN_ATTRS
|
||||
_mm256_frcz_ps(__m256 __A)
|
||||
{
|
||||
return (__m256)__builtin_ia32_vfrczps256((__v8sf)__A);
|
||||
}
|
||||
|
||||
static __inline__ __m256d __DEFAULT_FN_ATTRS
|
||||
_mm256_frcz_pd(__m256d __A)
|
||||
{
|
||||
return (__m256d)__builtin_ia32_vfrczpd256((__v4df)__A);
|
||||
}
|
||||
|
||||
#undef __DEFAULT_FN_ATTRS
|
||||
|
||||
#endif /* __XOPINTRIN_H */
|
||||
@@ -0,0 +1,48 @@
|
||||
/*===---- xsavecintrin.h - XSAVEC intrinsic ------------------------------------===
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
|
||||
#ifndef __IMMINTRIN_H
|
||||
#error "Never use <xsavecintrin.h> directly; include <immintrin.h> instead."
|
||||
#endif
|
||||
|
||||
#ifndef __XSAVECINTRIN_H
|
||||
#define __XSAVECINTRIN_H
|
||||
|
||||
/* Define the default attributes for the functions in this file. */
|
||||
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("xsavec")))
|
||||
|
||||
static __inline__ void __DEFAULT_FN_ATTRS
|
||||
_xsavec(void *__p, unsigned long long __m) {
|
||||
__builtin_ia32_xsavec(__p, __m);
|
||||
}
|
||||
|
||||
#ifdef __x86_64__
|
||||
static __inline__ void __DEFAULT_FN_ATTRS
|
||||
_xsavec64(void *__p, unsigned long long __m) {
|
||||
__builtin_ia32_xsavec64(__p, __m);
|
||||
}
|
||||
#endif
|
||||
|
||||
#undef __DEFAULT_FN_ATTRS
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,58 @@
|
||||
/*===---- xsaveintrin.h - XSAVE intrinsic ------------------------------------===
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
|
||||
#ifndef __IMMINTRIN_H
|
||||
#error "Never use <xsaveintrin.h> directly; include <immintrin.h> instead."
|
||||
#endif
|
||||
|
||||
#ifndef __XSAVEINTRIN_H
|
||||
#define __XSAVEINTRIN_H
|
||||
|
||||
/* Define the default attributes for the functions in this file. */
|
||||
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("xsave")))
|
||||
|
||||
static __inline__ void __DEFAULT_FN_ATTRS
|
||||
_xsave(void *__p, unsigned long long __m) {
|
||||
return __builtin_ia32_xsave(__p, __m);
|
||||
}
|
||||
|
||||
static __inline__ void __DEFAULT_FN_ATTRS
|
||||
_xrstor(void *__p, unsigned long long __m) {
|
||||
return __builtin_ia32_xrstor(__p, __m);
|
||||
}
|
||||
|
||||
#ifdef __x86_64__
|
||||
static __inline__ void __DEFAULT_FN_ATTRS
|
||||
_xsave64(void *__p, unsigned long long __m) {
|
||||
return __builtin_ia32_xsave64(__p, __m);
|
||||
}
|
||||
|
||||
static __inline__ void __DEFAULT_FN_ATTRS
|
||||
_xrstor64(void *__p, unsigned long long __m) {
|
||||
return __builtin_ia32_xrstor64(__p, __m);
|
||||
}
|
||||
#endif
|
||||
|
||||
#undef __DEFAULT_FN_ATTRS
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,48 @@
|
||||
/*===---- xsaveoptintrin.h - XSAVEOPT intrinsic ------------------------------------===
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
|
||||
#ifndef __IMMINTRIN_H
|
||||
#error "Never use <xsaveoptintrin.h> directly; include <immintrin.h> instead."
|
||||
#endif
|
||||
|
||||
#ifndef __XSAVEOPTINTRIN_H
|
||||
#define __XSAVEOPTINTRIN_H
|
||||
|
||||
/* Define the default attributes for the functions in this file. */
|
||||
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("xsaveopt")))
|
||||
|
||||
static __inline__ void __DEFAULT_FN_ATTRS
|
||||
_xsaveopt(void *__p, unsigned long long __m) {
|
||||
return __builtin_ia32_xsaveopt(__p, __m);
|
||||
}
|
||||
|
||||
#ifdef __x86_64__
|
||||
static __inline__ void __DEFAULT_FN_ATTRS
|
||||
_xsaveopt64(void *__p, unsigned long long __m) {
|
||||
return __builtin_ia32_xsaveopt64(__p, __m);
|
||||
}
|
||||
#endif
|
||||
|
||||
#undef __DEFAULT_FN_ATTRS
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,58 @@
|
||||
/*===---- xsavesintrin.h - XSAVES intrinsic ------------------------------------===
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
|
||||
#ifndef __IMMINTRIN_H
|
||||
#error "Never use <xsavesintrin.h> directly; include <immintrin.h> instead."
|
||||
#endif
|
||||
|
||||
#ifndef __XSAVESINTRIN_H
|
||||
#define __XSAVESINTRIN_H
|
||||
|
||||
/* Define the default attributes for the functions in this file. */
|
||||
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("xsaves")))
|
||||
|
||||
static __inline__ void __DEFAULT_FN_ATTRS
|
||||
_xsaves(void *__p, unsigned long long __m) {
|
||||
__builtin_ia32_xsaves(__p, __m);
|
||||
}
|
||||
|
||||
static __inline__ void __DEFAULT_FN_ATTRS
|
||||
_xrstors(void *__p, unsigned long long __m) {
|
||||
__builtin_ia32_xrstors(__p, __m);
|
||||
}
|
||||
|
||||
#ifdef __x86_64__
|
||||
static __inline__ void __DEFAULT_FN_ATTRS
|
||||
_xrstors64(void *__p, unsigned long long __m) {
|
||||
__builtin_ia32_xrstors64(__p, __m);
|
||||
}
|
||||
|
||||
static __inline__ void __DEFAULT_FN_ATTRS
|
||||
_xsaves64(void *__p, unsigned long long __m) {
|
||||
__builtin_ia32_xsaves64(__p, __m);
|
||||
}
|
||||
#endif
|
||||
|
||||
#undef __DEFAULT_FN_ATTRS
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,41 @@
|
||||
/*===---- xtestintrin.h - XTEST intrinsic ---------------------------------===
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
|
||||
#ifndef __IMMINTRIN_H
|
||||
#error "Never use <xtestintrin.h> directly; include <immintrin.h> instead."
|
||||
#endif
|
||||
|
||||
#ifndef __XTESTINTRIN_H
|
||||
#define __XTESTINTRIN_H
|
||||
|
||||
/* xtest returns non-zero if the instruction is executed within an RTM or active
|
||||
* HLE region. */
|
||||
/* FIXME: This can be an either or for RTM/HLE. Deal with this when HLE is
|
||||
* supported. */
|
||||
static __inline__ int
|
||||
__attribute__((__always_inline__, __nodebug__, __target__("rtm")))
|
||||
_xtest(void) {
|
||||
return __builtin_ia32_xtest();
|
||||
}
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,257 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// Don't edit this file! It is auto-generated by frameworks/rs/api/generate.sh.
|
||||
|
||||
/*
|
||||
* rs_atomic.rsh: Atomic Update Functions
|
||||
*
|
||||
* To update values shared between multiple threads, use the functions below.
|
||||
* They ensure that the values are atomically updated, i.e. that the memory
|
||||
* reads, the updates, and the memory writes are done in the right order.
|
||||
*
|
||||
* These functions are slower than their non-atomic equivalents, so use
|
||||
* them only when synchronization is needed.
|
||||
*
|
||||
* Note that in RenderScript, your code is likely to be running in separate
|
||||
* threads even though you did not explicitely create them. The RenderScript
|
||||
* runtime will very often split the execution of one kernel across multiple
|
||||
* threads. Updating globals should be done with atomic functions. If possible,
|
||||
* modify your algorithm to avoid them altogether.
|
||||
*/
|
||||
|
||||
#ifndef RENDERSCRIPT_RS_ATOMIC_RSH
|
||||
#define RENDERSCRIPT_RS_ATOMIC_RSH
|
||||
|
||||
/*
|
||||
* rsAtomicAdd: Thread-safe addition
|
||||
*
|
||||
* Atomicly adds a value to the value at addr, i.e. *addr += value.
|
||||
*
|
||||
* Parameters:
|
||||
* addr: Address of the value to modify.
|
||||
* value: Amount to add.
|
||||
*
|
||||
* Returns: Value of *addr prior to the operation.
|
||||
*/
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 14))
|
||||
extern int32_t __attribute__((overloadable))
|
||||
rsAtomicAdd(volatile int32_t* addr, int32_t value);
|
||||
#endif
|
||||
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 20))
|
||||
extern int32_t __attribute__((overloadable))
|
||||
rsAtomicAdd(volatile uint32_t* addr, uint32_t value);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* rsAtomicAnd: Thread-safe bitwise and
|
||||
*
|
||||
* Atomicly performs a bitwise and of two values, storing the result back at addr,
|
||||
* i.e. *addr &= value.
|
||||
*
|
||||
* Parameters:
|
||||
* addr: Address of the value to modify.
|
||||
* value: Value to and with.
|
||||
*
|
||||
* Returns: Value of *addr prior to the operation.
|
||||
*/
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 14))
|
||||
extern int32_t __attribute__((overloadable))
|
||||
rsAtomicAnd(volatile int32_t* addr, int32_t value);
|
||||
#endif
|
||||
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 20))
|
||||
extern int32_t __attribute__((overloadable))
|
||||
rsAtomicAnd(volatile uint32_t* addr, uint32_t value);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* rsAtomicCas: Thread-safe compare and set
|
||||
*
|
||||
* If the value at addr matches compareValue then the newValue is written at addr,
|
||||
* i.e. if (*addr == compareValue) { *addr = newValue; }.
|
||||
*
|
||||
* You can check that the value was written by checking that the value returned
|
||||
* by rsAtomicCas() is compareValue.
|
||||
*
|
||||
* Parameters:
|
||||
* addr: Address of the value to compare and replace if the test passes.
|
||||
* compareValue: Value to test *addr against.
|
||||
* newValue: Value to write if the test passes.
|
||||
*
|
||||
* Returns: Value of *addr prior to the operation.
|
||||
*/
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 14))
|
||||
extern int32_t __attribute__((overloadable))
|
||||
rsAtomicCas(volatile int32_t* addr, int32_t compareValue, int32_t newValue);
|
||||
#endif
|
||||
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 14))
|
||||
extern uint32_t __attribute__((overloadable))
|
||||
rsAtomicCas(volatile uint32_t* addr, uint32_t compareValue, uint32_t newValue);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* rsAtomicDec: Thread-safe decrement
|
||||
*
|
||||
* Atomicly subtracts one from the value at addr. This is equivalent to rsAtomicSub(addr, 1).
|
||||
*
|
||||
* Parameters:
|
||||
* addr: Address of the value to decrement.
|
||||
*
|
||||
* Returns: Value of *addr prior to the operation.
|
||||
*/
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 14))
|
||||
extern int32_t __attribute__((overloadable))
|
||||
rsAtomicDec(volatile int32_t* addr);
|
||||
#endif
|
||||
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 20))
|
||||
extern int32_t __attribute__((overloadable))
|
||||
rsAtomicDec(volatile uint32_t* addr);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* rsAtomicInc: Thread-safe increment
|
||||
*
|
||||
* Atomicly adds one to the value at addr. This is equivalent to rsAtomicAdd(addr, 1).
|
||||
*
|
||||
* Parameters:
|
||||
* addr: Address of the value to increment.
|
||||
*
|
||||
* Returns: Value of *addr prior to the operation.
|
||||
*/
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 14))
|
||||
extern int32_t __attribute__((overloadable))
|
||||
rsAtomicInc(volatile int32_t* addr);
|
||||
#endif
|
||||
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 20))
|
||||
extern int32_t __attribute__((overloadable))
|
||||
rsAtomicInc(volatile uint32_t* addr);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* rsAtomicMax: Thread-safe maximum
|
||||
*
|
||||
* Atomicly sets the value at addr to the maximum of *addr and value, i.e.
|
||||
* *addr = max(*addr, value).
|
||||
*
|
||||
* Parameters:
|
||||
* addr: Address of the value to modify.
|
||||
* value: Comparison value.
|
||||
*
|
||||
* Returns: Value of *addr prior to the operation.
|
||||
*/
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 14))
|
||||
extern uint32_t __attribute__((overloadable))
|
||||
rsAtomicMax(volatile uint32_t* addr, uint32_t value);
|
||||
#endif
|
||||
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 14))
|
||||
extern int32_t __attribute__((overloadable))
|
||||
rsAtomicMax(volatile int32_t* addr, int32_t value);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* rsAtomicMin: Thread-safe minimum
|
||||
*
|
||||
* Atomicly sets the value at addr to the minimum of *addr and value, i.e.
|
||||
* *addr = min(*addr, value).
|
||||
*
|
||||
* Parameters:
|
||||
* addr: Address of the value to modify.
|
||||
* value: Comparison value.
|
||||
*
|
||||
* Returns: Value of *addr prior to the operation.
|
||||
*/
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 14))
|
||||
extern uint32_t __attribute__((overloadable))
|
||||
rsAtomicMin(volatile uint32_t* addr, uint32_t value);
|
||||
#endif
|
||||
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 14))
|
||||
extern int32_t __attribute__((overloadable))
|
||||
rsAtomicMin(volatile int32_t* addr, int32_t value);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* rsAtomicOr: Thread-safe bitwise or
|
||||
*
|
||||
* Atomicly perform a bitwise or two values, storing the result at addr,
|
||||
* i.e. *addr |= value.
|
||||
*
|
||||
* Parameters:
|
||||
* addr: Address of the value to modify.
|
||||
* value: Value to or with.
|
||||
*
|
||||
* Returns: Value of *addr prior to the operation.
|
||||
*/
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 14))
|
||||
extern int32_t __attribute__((overloadable))
|
||||
rsAtomicOr(volatile int32_t* addr, int32_t value);
|
||||
#endif
|
||||
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 20))
|
||||
extern int32_t __attribute__((overloadable))
|
||||
rsAtomicOr(volatile uint32_t* addr, uint32_t value);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* rsAtomicSub: Thread-safe subtraction
|
||||
*
|
||||
* Atomicly subtracts a value from the value at addr, i.e. *addr -= value.
|
||||
*
|
||||
* Parameters:
|
||||
* addr: Address of the value to modify.
|
||||
* value: Amount to subtract.
|
||||
*
|
||||
* Returns: Value of *addr prior to the operation.
|
||||
*/
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 14))
|
||||
extern int32_t __attribute__((overloadable))
|
||||
rsAtomicSub(volatile int32_t* addr, int32_t value);
|
||||
#endif
|
||||
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 20))
|
||||
extern int32_t __attribute__((overloadable))
|
||||
rsAtomicSub(volatile uint32_t* addr, uint32_t value);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* rsAtomicXor: Thread-safe bitwise exclusive or
|
||||
*
|
||||
* Atomicly performs a bitwise xor of two values, storing the result at addr,
|
||||
* i.e. *addr ^= value.
|
||||
*
|
||||
* Parameters:
|
||||
* addr: Address of the value to modify.
|
||||
* value: Value to xor with.
|
||||
*
|
||||
* Returns: Value of *addr prior to the operation.
|
||||
*/
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 14))
|
||||
extern int32_t __attribute__((overloadable))
|
||||
rsAtomicXor(volatile int32_t* addr, int32_t value);
|
||||
#endif
|
||||
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 20))
|
||||
extern int32_t __attribute__((overloadable))
|
||||
rsAtomicXor(volatile uint32_t* addr, uint32_t value);
|
||||
#endif
|
||||
|
||||
#endif // RENDERSCRIPT_RS_ATOMIC_RSH
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// Don't edit this file! It is auto-generated by frameworks/rs/api/generate.sh.
|
||||
|
||||
/*
|
||||
* rs_core.rsh: Overview
|
||||
*
|
||||
* RenderScript is a high-performance runtime that provides compute operations at the native level.
|
||||
* RenderScript code is compiled on devices at runtime to allow platform-independence as well.
|
||||
*
|
||||
* This reference documentation describes the RenderScript runtime APIs, which you can utilize
|
||||
* to write RenderScript code in C99. The RenderScript compute header files are automatically
|
||||
* included for you.
|
||||
*
|
||||
* To use RenderScript, you need to utilize the RenderScript runtime APIs documented here as well
|
||||
* as the Android framework APIs for RenderScript. For documentation on the Android framework
|
||||
* APIs, see the android.renderscript package reference.
|
||||
*
|
||||
* For more information on how to develop with RenderScript and how the runtime and Android
|
||||
* framework APIs interact, see the RenderScript developer guide and the RenderScript samples.
|
||||
*/
|
||||
|
||||
#ifndef RENDERSCRIPT_RS_CORE_RSH
|
||||
#define RENDERSCRIPT_RS_CORE_RSH
|
||||
|
||||
#define RS_KERNEL __attribute__((kernel))
|
||||
|
||||
#include "stdbool.h"
|
||||
|
||||
#include "rs_value_types.rsh"
|
||||
#include "rs_object_types.rsh"
|
||||
|
||||
#include "rs_allocation_create.rsh"
|
||||
#include "rs_allocation_data.rsh"
|
||||
#include "rs_atomic.rsh"
|
||||
#include "rs_convert.rsh"
|
||||
#include "rs_debug.rsh"
|
||||
#include "rs_for_each.rsh"
|
||||
#include "rs_io.rsh"
|
||||
#include "rs_math.rsh"
|
||||
#include "rs_matrix.rsh"
|
||||
#include "rs_object_info.rsh"
|
||||
#include "rs_quaternion.rsh"
|
||||
#include "rs_time.rsh"
|
||||
#include "rs_vector_math.rsh"
|
||||
|
||||
#endif // RENDERSCRIPT_RS_CORE_RSH
|
||||
@@ -0,0 +1,269 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// Don't edit this file! It is auto-generated by frameworks/rs/api/generate.sh.
|
||||
|
||||
/*
|
||||
* rs_debug.rsh: Debugging Functions
|
||||
*
|
||||
* The functions below are intended to be used during application developement.
|
||||
* They should not be used in shipping applications.
|
||||
*/
|
||||
|
||||
#ifndef RENDERSCRIPT_RS_DEBUG_RSH
|
||||
#define RENDERSCRIPT_RS_DEBUG_RSH
|
||||
|
||||
#define RS_DEBUG(a) rsDebug(#a, a)
|
||||
#define RS_DEBUG_MARKER rsDebug(__FILE__, __LINE__)
|
||||
|
||||
/*
|
||||
* rsDebug: Log a message and values
|
||||
*
|
||||
* This function prints a message to the standard log, followed by the provided values.
|
||||
*
|
||||
* This function is intended for debugging only and should not be used in shipping
|
||||
* applications.
|
||||
*/
|
||||
extern void __attribute__((overloadable))
|
||||
rsDebug(const char* message, double a);
|
||||
|
||||
extern void __attribute__((overloadable))
|
||||
rsDebug(const char* message, int a);
|
||||
|
||||
extern void __attribute__((overloadable))
|
||||
rsDebug(const char* message, uint a);
|
||||
|
||||
extern void __attribute__((overloadable))
|
||||
rsDebug(const char* message, long a);
|
||||
|
||||
extern void __attribute__((overloadable))
|
||||
rsDebug(const char* message, ulong a);
|
||||
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 17))
|
||||
extern void __attribute__((overloadable))
|
||||
rsDebug(const char* message, int2 a);
|
||||
#endif
|
||||
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 17))
|
||||
extern void __attribute__((overloadable))
|
||||
rsDebug(const char* message, int3 a);
|
||||
#endif
|
||||
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 17))
|
||||
extern void __attribute__((overloadable))
|
||||
rsDebug(const char* message, int4 a);
|
||||
#endif
|
||||
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 17))
|
||||
extern void __attribute__((overloadable))
|
||||
rsDebug(const char* message, uint2 a);
|
||||
#endif
|
||||
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 17))
|
||||
extern void __attribute__((overloadable))
|
||||
rsDebug(const char* message, uint3 a);
|
||||
#endif
|
||||
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 17))
|
||||
extern void __attribute__((overloadable))
|
||||
rsDebug(const char* message, uint4 a);
|
||||
#endif
|
||||
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 17))
|
||||
extern void __attribute__((overloadable))
|
||||
rsDebug(const char* message, long2 a);
|
||||
#endif
|
||||
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 17))
|
||||
extern void __attribute__((overloadable))
|
||||
rsDebug(const char* message, long3 a);
|
||||
#endif
|
||||
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 17))
|
||||
extern void __attribute__((overloadable))
|
||||
rsDebug(const char* message, long4 a);
|
||||
#endif
|
||||
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 17))
|
||||
extern void __attribute__((overloadable))
|
||||
rsDebug(const char* message, ulong2 a);
|
||||
#endif
|
||||
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 17))
|
||||
extern void __attribute__((overloadable))
|
||||
rsDebug(const char* message, ulong3 a);
|
||||
#endif
|
||||
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 17))
|
||||
extern void __attribute__((overloadable))
|
||||
rsDebug(const char* message, ulong4 a);
|
||||
#endif
|
||||
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 23))
|
||||
extern void __attribute__((overloadable))
|
||||
rsDebug(const char* message, double2 a);
|
||||
#endif
|
||||
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 23))
|
||||
extern void __attribute__((overloadable))
|
||||
rsDebug(const char* message, double3 a);
|
||||
#endif
|
||||
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 23))
|
||||
extern void __attribute__((overloadable))
|
||||
rsDebug(const char* message, double4 a);
|
||||
#endif
|
||||
|
||||
extern void __attribute__((overloadable))
|
||||
rsDebug(const char* message, float a);
|
||||
|
||||
extern void __attribute__((overloadable))
|
||||
rsDebug(const char* message, float2 a);
|
||||
|
||||
extern void __attribute__((overloadable))
|
||||
rsDebug(const char* message, float3 a);
|
||||
|
||||
extern void __attribute__((overloadable))
|
||||
rsDebug(const char* message, float4 a);
|
||||
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 24))
|
||||
extern void __attribute__((overloadable))
|
||||
rsDebug(const char* message, half a);
|
||||
#endif
|
||||
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 24))
|
||||
extern void __attribute__((overloadable))
|
||||
rsDebug(const char* message, half2 a);
|
||||
#endif
|
||||
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 24))
|
||||
extern void __attribute__((overloadable))
|
||||
rsDebug(const char* message, half3 a);
|
||||
#endif
|
||||
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 24))
|
||||
extern void __attribute__((overloadable))
|
||||
rsDebug(const char* message, half4 a);
|
||||
#endif
|
||||
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 17))
|
||||
extern void __attribute__((overloadable))
|
||||
rsDebug(const char* message, char a);
|
||||
#endif
|
||||
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 17))
|
||||
extern void __attribute__((overloadable))
|
||||
rsDebug(const char* message, char2 a);
|
||||
#endif
|
||||
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 17))
|
||||
extern void __attribute__((overloadable))
|
||||
rsDebug(const char* message, char3 a);
|
||||
#endif
|
||||
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 17))
|
||||
extern void __attribute__((overloadable))
|
||||
rsDebug(const char* message, char4 a);
|
||||
#endif
|
||||
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 17))
|
||||
extern void __attribute__((overloadable))
|
||||
rsDebug(const char* message, uchar a);
|
||||
#endif
|
||||
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 17))
|
||||
extern void __attribute__((overloadable))
|
||||
rsDebug(const char* message, uchar2 a);
|
||||
#endif
|
||||
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 17))
|
||||
extern void __attribute__((overloadable))
|
||||
rsDebug(const char* message, uchar3 a);
|
||||
#endif
|
||||
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 17))
|
||||
extern void __attribute__((overloadable))
|
||||
rsDebug(const char* message, uchar4 a);
|
||||
#endif
|
||||
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 17))
|
||||
extern void __attribute__((overloadable))
|
||||
rsDebug(const char* message, short a);
|
||||
#endif
|
||||
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 17))
|
||||
extern void __attribute__((overloadable))
|
||||
rsDebug(const char* message, short2 a);
|
||||
#endif
|
||||
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 17))
|
||||
extern void __attribute__((overloadable))
|
||||
rsDebug(const char* message, short3 a);
|
||||
#endif
|
||||
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 17))
|
||||
extern void __attribute__((overloadable))
|
||||
rsDebug(const char* message, short4 a);
|
||||
#endif
|
||||
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 17))
|
||||
extern void __attribute__((overloadable))
|
||||
rsDebug(const char* message, ushort a);
|
||||
#endif
|
||||
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 17))
|
||||
extern void __attribute__((overloadable))
|
||||
rsDebug(const char* message, ushort2 a);
|
||||
#endif
|
||||
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 17))
|
||||
extern void __attribute__((overloadable))
|
||||
rsDebug(const char* message, ushort3 a);
|
||||
#endif
|
||||
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 17))
|
||||
extern void __attribute__((overloadable))
|
||||
rsDebug(const char* message, ushort4 a);
|
||||
#endif
|
||||
|
||||
extern void __attribute__((overloadable))
|
||||
rsDebug(const char* message, float a, float b);
|
||||
|
||||
extern void __attribute__((overloadable))
|
||||
rsDebug(const char* message, float a, float b, float c);
|
||||
|
||||
extern void __attribute__((overloadable))
|
||||
rsDebug(const char* message, float a, float b, float c, float d);
|
||||
|
||||
extern void __attribute__((overloadable))
|
||||
rsDebug(const char* message, long long a);
|
||||
|
||||
extern void __attribute__((overloadable))
|
||||
rsDebug(const char* message, unsigned long long a);
|
||||
|
||||
extern void __attribute__((overloadable))
|
||||
rsDebug(const char* message, const void* a);
|
||||
|
||||
extern void __attribute__((overloadable))
|
||||
rsDebug(const char* message, const rs_matrix4x4* a);
|
||||
|
||||
extern void __attribute__((overloadable))
|
||||
rsDebug(const char* message, const rs_matrix3x3* a);
|
||||
|
||||
extern void __attribute__((overloadable))
|
||||
rsDebug(const char* message, const rs_matrix2x2* a);
|
||||
|
||||
#endif // RENDERSCRIPT_RS_DEBUG_RSH
|
||||
@@ -0,0 +1,434 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// Don't edit this file! It is auto-generated by frameworks/rs/api/generate.sh.
|
||||
|
||||
/*
|
||||
* rs_for_each.rsh: Kernel Invocation Functions and Types
|
||||
*
|
||||
* The rsForEach() function can be used to invoke the root kernel of a script.
|
||||
*
|
||||
* The other functions are used to get the characteristics of the invocation of
|
||||
* an executing kernel, like dimensions and current indices. These functions take
|
||||
* a rs_kernel_context as argument.
|
||||
*/
|
||||
|
||||
#ifndef RENDERSCRIPT_RS_FOR_EACH_RSH
|
||||
#define RENDERSCRIPT_RS_FOR_EACH_RSH
|
||||
|
||||
/*
|
||||
* rs_for_each_strategy_t: Suggested cell processing order
|
||||
*
|
||||
* This type is used to suggest how the invoked kernel should iterate over the cells of the
|
||||
* allocations. This is a hint only. Implementations may not follow the suggestion.
|
||||
*
|
||||
* This specification can help the caching behavior of the running kernel, e.g. the cache
|
||||
* locality when the processing is distributed over multiple cores.
|
||||
*/
|
||||
typedef enum rs_for_each_strategy {
|
||||
RS_FOR_EACH_STRATEGY_SERIAL = 0, // Prefer contiguous memory regions.
|
||||
RS_FOR_EACH_STRATEGY_DONT_CARE = 1, // No preferences.
|
||||
RS_FOR_EACH_STRATEGY_DST_LINEAR = 2, // Prefer DST.
|
||||
RS_FOR_EACH_STRATEGY_TILE_SMALL = 3, // Prefer processing small rectangular regions.
|
||||
RS_FOR_EACH_STRATEGY_TILE_MEDIUM = 4, // Prefer processing medium rectangular regions.
|
||||
RS_FOR_EACH_STRATEGY_TILE_LARGE = 5 // Prefer processing large rectangular regions.
|
||||
} rs_for_each_strategy_t;
|
||||
|
||||
/*
|
||||
* rs_kernel_context: Handle to a kernel invocation context
|
||||
*
|
||||
* The kernel context contains common characteristics of the allocations being iterated
|
||||
* over, like dimensions. It also contains rarely used indices of the currently processed
|
||||
* cell, like the Array0 index or the current level of detail.
|
||||
*
|
||||
* You can access the kernel context by adding a special parameter named "context" of type
|
||||
* rs_kernel_context to your kernel function. See rsGetDimX() and rsGetArray0() for examples.
|
||||
*/
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 23))
|
||||
typedef const struct rs_kernel_context_t * rs_kernel_context;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* rs_script_call_t: Cell iteration information
|
||||
*
|
||||
* This structure is used to provide iteration information to a rsForEach call.
|
||||
* It is currently used to restrict processing to a subset of cells. In future
|
||||
* versions, it will also be used to provide hint on how to best iterate over
|
||||
* the cells.
|
||||
*
|
||||
* The Start fields are inclusive and the End fields are exclusive. E.g. to iterate
|
||||
* over cells 4, 5, 6, and 7 in the X dimension, set xStart to 4 and xEnd to 8.
|
||||
*/
|
||||
typedef struct rs_script_call {
|
||||
rs_for_each_strategy_t strategy; // Currently ignored. In the future, will be suggested cell iteration strategy.
|
||||
uint32_t xStart; // Starting index in the X dimension.
|
||||
uint32_t xEnd; // Ending index (exclusive) in the X dimension.
|
||||
uint32_t yStart; // Starting index in the Y dimension.
|
||||
uint32_t yEnd; // Ending index (exclusive) in the Y dimension.
|
||||
uint32_t zStart; // Starting index in the Z dimension.
|
||||
uint32_t zEnd; // Ending index (exclusive) in the Z dimension.
|
||||
uint32_t arrayStart; // Starting index in the Array0 dimension.
|
||||
uint32_t arrayEnd; // Ending index (exclusive) in the Array0 dimension.
|
||||
uint32_t array1Start; // Starting index in the Array1 dimension.
|
||||
uint32_t array1End; // Ending index (exclusive) in the Array1 dimension.
|
||||
uint32_t array2Start; // Starting index in the Array2 dimension.
|
||||
uint32_t array2End; // Ending index (exclusive) in the Array2 dimension.
|
||||
uint32_t array3Start; // Starting index in the Array3 dimension.
|
||||
uint32_t array3End; // Ending index (exclusive) in the Array3 dimension.
|
||||
} rs_script_call_t;
|
||||
|
||||
/*
|
||||
* rs_kernel: Handle to a kernel function
|
||||
*
|
||||
* An opaque type for a function that is defined with the kernel attribute. A value
|
||||
* of this type can be used in a rsForEach call to launch a kernel.
|
||||
*/
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 24))
|
||||
typedef void* rs_kernel;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* rsForEach: Launches a kernel
|
||||
*
|
||||
* Runs the kernel over zero or more input allocations. They are passed after the
|
||||
* rs_kernel argument. If the specified kernel returns a value, an output allocation
|
||||
* must be specified as the last argument. All input allocations,
|
||||
* and the output allocation if it exists, must have the same dimensions.
|
||||
*
|
||||
* This is a synchronous function. A call to this function only returns after all
|
||||
* the work has completed for all cells of the input allocations. If the kernel
|
||||
* function returns any value, the call waits until all results have been written
|
||||
* to the output allocation.
|
||||
*
|
||||
* Up to API level 23, the kernel is implicitly specified as the kernel named
|
||||
* "root" in the specified script, and only a single input allocation can be used.
|
||||
* Starting in API level 24, an arbitrary kernel function can be used,
|
||||
* as specified by the kernel argument. The script argument is removed.
|
||||
* The kernel must be defined in the current script. In addition, more than one
|
||||
* input can be used.
|
||||
*
|
||||
* E.g.
|
||||
* float __attribute__((kernel)) square(float a) {
|
||||
* return a * a;
|
||||
* }
|
||||
*
|
||||
* void compute(rs_allocation ain, rs_allocation aout) {
|
||||
* rsForEach(square, ain, aout);
|
||||
* }
|
||||
*
|
||||
*
|
||||
* Parameters:
|
||||
* script: Script to call.
|
||||
* input: Allocation to source data from.
|
||||
* output: Allocation to write date into.
|
||||
* usrData: User defined data to pass to the script. May be NULL.
|
||||
* sc: Extra control information used to select a sub-region of the allocation to be processed or suggest a walking strategy. May be NULL.
|
||||
* usrDataLen: Size of the userData structure. This will be used to perform a shallow copy of the data if necessary.
|
||||
* kernel: Function designator to a function that is defined with the kernel attribute.
|
||||
* ...: Input and output allocations
|
||||
*/
|
||||
#if !defined(RS_VERSION) || (RS_VERSION <= 13)
|
||||
extern void __attribute__((overloadable))
|
||||
rsForEach(rs_script script, rs_allocation input, rs_allocation output, const void* usrData,
|
||||
const rs_script_call_t* sc);
|
||||
#endif
|
||||
|
||||
#if !defined(RS_VERSION) || (RS_VERSION <= 13)
|
||||
extern void __attribute__((overloadable))
|
||||
rsForEach(rs_script script, rs_allocation input, rs_allocation output, const void* usrData);
|
||||
#endif
|
||||
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 14) && (RS_VERSION <= 20))
|
||||
extern void __attribute__((overloadable))
|
||||
rsForEach(rs_script script, rs_allocation input, rs_allocation output, const void* usrData,
|
||||
size_t usrDataLen, const rs_script_call_t* sc);
|
||||
#endif
|
||||
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 14) && (RS_VERSION <= 20))
|
||||
extern void __attribute__((overloadable))
|
||||
rsForEach(rs_script script, rs_allocation input, rs_allocation output, const void* usrData,
|
||||
size_t usrDataLen);
|
||||
#endif
|
||||
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 14) && (RS_VERSION <= 23))
|
||||
extern void __attribute__((overloadable))
|
||||
rsForEach(rs_script script, rs_allocation input, rs_allocation output);
|
||||
#endif
|
||||
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 24))
|
||||
extern void
|
||||
rsForEach(rs_kernel kernel, ...);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* rsForEachWithOptions: Launches a kernel with options
|
||||
*
|
||||
* Launches kernel in a way similar to rsForEach. However, instead of processing
|
||||
* all cells in the input, this function only processes cells in the subspace of
|
||||
* the index space specified in options. With the index space explicitly specified
|
||||
* by options, no input or output allocation is required for a kernel launch using
|
||||
* this API. If allocations are passed in, they must match the number of arguments
|
||||
* and return value expected by the kernel function. The output allocation is
|
||||
* present if and only if the kernel has a non-void return value.
|
||||
*
|
||||
* E.g.,
|
||||
* rs_script_call_t opts = {0};
|
||||
* opts.xStart = 0;
|
||||
* opts.xEnd = dimX;
|
||||
* opts.yStart = 0;
|
||||
* opts.yEnd = dimY / 2;
|
||||
* rsForEachWithOptions(foo, &opts, out, out);
|
||||
*
|
||||
*
|
||||
* Parameters:
|
||||
* kernel: Function designator to a function that is defined with the kernel attribute.
|
||||
* options: Launch options
|
||||
* ...: Input and output allocations
|
||||
*/
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 24))
|
||||
extern void
|
||||
rsForEachWithOptions(rs_kernel kernel, rs_script_call_t* options, ...);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* rsGetArray0: Index in the Array0 dimension for the specified kernel context
|
||||
*
|
||||
* Returns the index in the Array0 dimension of the cell being processed, as specified
|
||||
* by the supplied kernel context.
|
||||
*
|
||||
* The kernel context contains common characteristics of the allocations being iterated
|
||||
* over and rarely used indices, like the Array0 index.
|
||||
*
|
||||
* You can access the kernel context by adding a special parameter named "context" of
|
||||
* type rs_kernel_context to your kernel function. E.g.
|
||||
* short RS_KERNEL myKernel(short value, uint32_t x, rs_kernel_context context) {
|
||||
* // The current index in the common x, y, z dimensions are accessed by
|
||||
* // adding these variables as arguments. For the more rarely used indices
|
||||
* // to the other dimensions, extract them from the kernel context:
|
||||
* uint32_t index_a0 = rsGetArray0(context);
|
||||
* //...
|
||||
* }
|
||||
*
|
||||
* This function returns 0 if the Array0 dimension is not present.
|
||||
*/
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 23))
|
||||
extern uint32_t __attribute__((overloadable))
|
||||
rsGetArray0(rs_kernel_context context);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* rsGetArray1: Index in the Array1 dimension for the specified kernel context
|
||||
*
|
||||
* Returns the index in the Array1 dimension of the cell being processed, as specified
|
||||
* by the supplied kernel context. See rsGetArray0() for an explanation of the context.
|
||||
*
|
||||
* Returns 0 if the Array1 dimension is not present.
|
||||
*/
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 23))
|
||||
extern uint32_t __attribute__((overloadable))
|
||||
rsGetArray1(rs_kernel_context context);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* rsGetArray2: Index in the Array2 dimension for the specified kernel context
|
||||
*
|
||||
* Returns the index in the Array2 dimension of the cell being processed,
|
||||
* as specified by the supplied kernel context. See rsGetArray0() for an explanation
|
||||
* of the context.
|
||||
*
|
||||
* Returns 0 if the Array2 dimension is not present.
|
||||
*/
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 23))
|
||||
extern uint32_t __attribute__((overloadable))
|
||||
rsGetArray2(rs_kernel_context context);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* rsGetArray3: Index in the Array3 dimension for the specified kernel context
|
||||
*
|
||||
* Returns the index in the Array3 dimension of the cell being processed, as specified
|
||||
* by the supplied kernel context. See rsGetArray0() for an explanation of the context.
|
||||
*
|
||||
* Returns 0 if the Array3 dimension is not present.
|
||||
*/
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 23))
|
||||
extern uint32_t __attribute__((overloadable))
|
||||
rsGetArray3(rs_kernel_context context);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* rsGetDimArray0: Size of the Array0 dimension for the specified kernel context
|
||||
*
|
||||
* Returns the size of the Array0 dimension for the specified kernel context.
|
||||
* See rsGetDimX() for an explanation of the context.
|
||||
*
|
||||
* Returns 0 if the Array0 dimension is not present.
|
||||
*/
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 23))
|
||||
extern uint32_t __attribute__((overloadable))
|
||||
rsGetDimArray0(rs_kernel_context context);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* rsGetDimArray1: Size of the Array1 dimension for the specified kernel context
|
||||
*
|
||||
* Returns the size of the Array1 dimension for the specified kernel context.
|
||||
* See rsGetDimX() for an explanation of the context.
|
||||
*
|
||||
* Returns 0 if the Array1 dimension is not present.
|
||||
*/
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 23))
|
||||
extern uint32_t __attribute__((overloadable))
|
||||
rsGetDimArray1(rs_kernel_context context);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* rsGetDimArray2: Size of the Array2 dimension for the specified kernel context
|
||||
*
|
||||
* Returns the size of the Array2 dimension for the specified kernel context.
|
||||
* See rsGetDimX() for an explanation of the context.
|
||||
*
|
||||
* Returns 0 if the Array2 dimension is not present.
|
||||
*/
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 23))
|
||||
extern uint32_t __attribute__((overloadable))
|
||||
rsGetDimArray2(rs_kernel_context context);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* rsGetDimArray3: Size of the Array3 dimension for the specified kernel context
|
||||
*
|
||||
* Returns the size of the Array3 dimension for the specified kernel context.
|
||||
* See rsGetDimX() for an explanation of the context.
|
||||
*
|
||||
* Returns 0 if the Array3 dimension is not present.
|
||||
*/
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 23))
|
||||
extern uint32_t __attribute__((overloadable))
|
||||
rsGetDimArray3(rs_kernel_context context);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* rsGetDimHasFaces: Presence of more than one face for the specified kernel context
|
||||
*
|
||||
* If the kernel is iterating over a cubemap, this function returns true if there's more
|
||||
* than one face present. In all other cases, it returns false. See rsGetDimX() for an
|
||||
* explanation of the context.
|
||||
*
|
||||
* rsAllocationGetDimFaces() is similar but returns 0 or 1 instead of a bool.
|
||||
*
|
||||
* Returns: Returns true if more than one face is present, false otherwise.
|
||||
*/
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 23))
|
||||
extern bool __attribute__((overloadable))
|
||||
rsGetDimHasFaces(rs_kernel_context context);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* rsGetDimLod: Number of levels of detail for the specified kernel context
|
||||
*
|
||||
* Returns the number of levels of detail for the specified kernel context. This is useful
|
||||
* for mipmaps. See rsGetDimX() for an explanation of the context.
|
||||
*
|
||||
* Returns 0 if Level of Detail is not used.
|
||||
*
|
||||
* rsAllocationGetDimLOD() is similar but returns 0 or 1 instead the actual
|
||||
* number of levels.
|
||||
*/
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 23))
|
||||
extern uint32_t __attribute__((overloadable))
|
||||
rsGetDimLod(rs_kernel_context context);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* rsGetDimX: Size of the X dimension for the specified kernel context
|
||||
*
|
||||
* Returns the size of the X dimension for the specified kernel context.
|
||||
*
|
||||
* The kernel context contains common characteristics of the allocations being iterated
|
||||
* over and rarely used indices, like the Array0 index.
|
||||
*
|
||||
* You can access it by adding a special parameter named "context" of
|
||||
* type rs_kernel_context to your kernel function. E.g.
|
||||
* int4 RS_KERNEL myKernel(int4 value, rs_kernel_context context) {
|
||||
* uint32_t size = rsGetDimX(context); //...
|
||||
*
|
||||
* To get the dimension of specific allocation, use rsAllocationGetDimX().
|
||||
*/
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 23))
|
||||
extern uint32_t __attribute__((overloadable))
|
||||
rsGetDimX(rs_kernel_context context);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* rsGetDimY: Size of the Y dimension for the specified kernel context
|
||||
*
|
||||
* Returns the size of the X dimension for the specified kernel context.
|
||||
* See rsGetDimX() for an explanation of the context.
|
||||
*
|
||||
* Returns 0 if the Y dimension is not present.
|
||||
*
|
||||
* To get the dimension of specific allocation, use rsAllocationGetDimY().
|
||||
*/
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 23))
|
||||
extern uint32_t __attribute__((overloadable))
|
||||
rsGetDimY(rs_kernel_context context);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* rsGetDimZ: Size of the Z dimension for the specified kernel context
|
||||
*
|
||||
* Returns the size of the Z dimension for the specified kernel context.
|
||||
* See rsGetDimX() for an explanation of the context.
|
||||
*
|
||||
* Returns 0 if the Z dimension is not present.
|
||||
*
|
||||
* To get the dimension of specific allocation, use rsAllocationGetDimZ().
|
||||
*/
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 23))
|
||||
extern uint32_t __attribute__((overloadable))
|
||||
rsGetDimZ(rs_kernel_context context);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* rsGetFace: Coordinate of the Face for the specified kernel context
|
||||
*
|
||||
* Returns the face on which the cell being processed is found, as specified by the
|
||||
* supplied kernel context. See rsGetArray0() for an explanation of the context.
|
||||
*
|
||||
* Returns RS_ALLOCATION_CUBEMAP_FACE_POSITIVE_X if the face dimension is not
|
||||
* present.
|
||||
*/
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 23))
|
||||
extern rs_allocation_cubemap_face __attribute__((overloadable))
|
||||
rsGetFace(rs_kernel_context context);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* rsGetLod: Index in the Levels of Detail dimension for the specified kernel context
|
||||
*
|
||||
* Returns the index in the Levels of Detail dimension of the cell being processed,
|
||||
* as specified by the supplied kernel context. See rsGetArray0() for an explanation of
|
||||
* the context.
|
||||
*
|
||||
* Returns 0 if the Levels of Detail dimension is not present.
|
||||
*/
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 23))
|
||||
extern uint32_t __attribute__((overloadable))
|
||||
rsGetLod(rs_kernel_context context);
|
||||
#endif
|
||||
|
||||
#endif // RENDERSCRIPT_RS_FOR_EACH_RSH
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,107 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// Don't edit this file! It is auto-generated by frameworks/rs/api/generate.sh.
|
||||
|
||||
/*
|
||||
* rs_io.rsh: Input/Output Functions
|
||||
*
|
||||
* These functions are used to:
|
||||
* - Send information to the Java client, and
|
||||
* - Send the processed allocation or receive the next allocation to process.
|
||||
*/
|
||||
|
||||
#ifndef RENDERSCRIPT_RS_IO_RSH
|
||||
#define RENDERSCRIPT_RS_IO_RSH
|
||||
|
||||
/*
|
||||
* rsAllocationIoReceive: Receive new content from the queue
|
||||
*
|
||||
* Receive a new set of contents from the queue.
|
||||
*
|
||||
* This function should not be called from inside a kernel, or from any function
|
||||
* that may be called directly or indirectly from a kernel. Doing so would cause a
|
||||
* runtime error.
|
||||
*
|
||||
* Parameters:
|
||||
* a: Allocation to work on.
|
||||
*/
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 16))
|
||||
extern void __attribute__((overloadable))
|
||||
rsAllocationIoReceive(rs_allocation a);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* rsAllocationIoSend: Send new content to the queue
|
||||
*
|
||||
* Send the contents of the Allocation to the queue.
|
||||
*
|
||||
* This function should not be called from inside a kernel, or from any function
|
||||
* that may be called directly or indirectly from a kernel. Doing so would cause a
|
||||
* runtime error.
|
||||
*
|
||||
* Parameters:
|
||||
* a: Allocation to work on.
|
||||
*/
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 16))
|
||||
extern void __attribute__((overloadable))
|
||||
rsAllocationIoSend(rs_allocation a);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* rsSendToClient: Send a message to the client, non-blocking
|
||||
*
|
||||
* Sends a message back to the client. This call does not block.
|
||||
* It returns true if the message was sent and false if the
|
||||
* message queue is full.
|
||||
*
|
||||
* A message ID is required. The data payload is optional.
|
||||
*
|
||||
* See RenderScript.RSMessageHandler.
|
||||
*
|
||||
* Parameters:
|
||||
* data: Application specific data.
|
||||
* len: Length of the data, in bytes.
|
||||
*/
|
||||
extern bool __attribute__((overloadable))
|
||||
rsSendToClient(int cmdID);
|
||||
|
||||
extern bool __attribute__((overloadable))
|
||||
rsSendToClient(int cmdID, const void* data, uint len);
|
||||
|
||||
/*
|
||||
* rsSendToClientBlocking: Send a message to the client, blocking
|
||||
*
|
||||
* Sends a message back to the client. This function will block
|
||||
* until there is room on the message queue for this message.
|
||||
* This function may return before the message was delivered and
|
||||
* processed by the client.
|
||||
*
|
||||
* A message ID is required. The data payload is optional.
|
||||
*
|
||||
* See RenderScript.RSMessageHandler.
|
||||
*
|
||||
* Parameters:
|
||||
* data: Application specific data.
|
||||
* len: Length of the data, in bytes.
|
||||
*/
|
||||
extern void __attribute__((overloadable))
|
||||
rsSendToClientBlocking(int cmdID);
|
||||
|
||||
extern void __attribute__((overloadable))
|
||||
rsSendToClientBlocking(int cmdID, const void* data, uint len);
|
||||
|
||||
#endif // RENDERSCRIPT_RS_IO_RSH
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,612 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// Don't edit this file! It is auto-generated by frameworks/rs/api/generate.sh.
|
||||
|
||||
/*
|
||||
* rs_matrix.rsh: Matrix Functions
|
||||
*
|
||||
* These functions let you manipulate square matrices of rank 2x2, 3x3, and 4x4.
|
||||
* They are particularly useful for graphical transformations and are compatible
|
||||
* with OpenGL.
|
||||
*
|
||||
* We use a zero-based index for rows and columns. E.g. the last element of a
|
||||
* rs_matrix4x4 is found at (3, 3).
|
||||
*
|
||||
* RenderScript uses column-major matrices and column-based vectors. Transforming
|
||||
* a vector is done by postmultiplying the vector, e.g. (matrix * vector),
|
||||
* as provided by rsMatrixMultiply().
|
||||
*
|
||||
* To create a transformation matrix that performs two transformations at once,
|
||||
* multiply the two source matrices, with the first transformation as the right
|
||||
* argument. E.g. to create a transformation matrix that applies the
|
||||
* transformation s1 followed by s2, call rsMatrixLoadMultiply(&combined, &s2, &s1).
|
||||
* This derives from s2 * (s1 * v), which is (s2 * s1) * v.
|
||||
*
|
||||
* We have two style of functions to create transformation matrices:
|
||||
* rsMatrixLoadTransformation and rsMatrixTransformation. The former
|
||||
* style simply stores the transformation matrix in the first argument. The latter
|
||||
* modifies a pre-existing transformation matrix so that the new transformation
|
||||
* happens first. E.g. if you call rsMatrixTranslate() on a matrix that already
|
||||
* does a scaling, the resulting matrix when applied to a vector will first do the
|
||||
* translation then the scaling.
|
||||
*/
|
||||
|
||||
#ifndef RENDERSCRIPT_RS_MATRIX_RSH
|
||||
#define RENDERSCRIPT_RS_MATRIX_RSH
|
||||
|
||||
#include "rs_vector_math.rsh"
|
||||
|
||||
/*
|
||||
* rsExtractFrustumPlanes: Compute frustum planes
|
||||
*
|
||||
* Computes 6 frustum planes from the view projection matrix
|
||||
*
|
||||
* Parameters:
|
||||
* viewProj: Matrix to extract planes from.
|
||||
* left: Left plane.
|
||||
* right: Right plane.
|
||||
* top: Top plane.
|
||||
* bottom: Bottom plane.
|
||||
* near: Near plane.
|
||||
* far: Far plane.
|
||||
*/
|
||||
#if !defined(RS_VERSION) || (RS_VERSION <= 23)
|
||||
static inline void __attribute__((overloadable))
|
||||
rsExtractFrustumPlanes(const rs_matrix4x4* viewProj, float4* left, float4* right, float4* top,
|
||||
float4* bottom, float4* near, float4* far) {
|
||||
// x y z w = a b c d in the plane equation
|
||||
left->x = viewProj->m[3] + viewProj->m[0];
|
||||
left->y = viewProj->m[7] + viewProj->m[4];
|
||||
left->z = viewProj->m[11] + viewProj->m[8];
|
||||
left->w = viewProj->m[15] + viewProj->m[12];
|
||||
|
||||
right->x = viewProj->m[3] - viewProj->m[0];
|
||||
right->y = viewProj->m[7] - viewProj->m[4];
|
||||
right->z = viewProj->m[11] - viewProj->m[8];
|
||||
right->w = viewProj->m[15] - viewProj->m[12];
|
||||
|
||||
top->x = viewProj->m[3] - viewProj->m[1];
|
||||
top->y = viewProj->m[7] - viewProj->m[5];
|
||||
top->z = viewProj->m[11] - viewProj->m[9];
|
||||
top->w = viewProj->m[15] - viewProj->m[13];
|
||||
|
||||
bottom->x = viewProj->m[3] + viewProj->m[1];
|
||||
bottom->y = viewProj->m[7] + viewProj->m[5];
|
||||
bottom->z = viewProj->m[11] + viewProj->m[9];
|
||||
bottom->w = viewProj->m[15] + viewProj->m[13];
|
||||
|
||||
near->x = viewProj->m[3] + viewProj->m[2];
|
||||
near->y = viewProj->m[7] + viewProj->m[6];
|
||||
near->z = viewProj->m[11] + viewProj->m[10];
|
||||
near->w = viewProj->m[15] + viewProj->m[14];
|
||||
|
||||
far->x = viewProj->m[3] - viewProj->m[2];
|
||||
far->y = viewProj->m[7] - viewProj->m[6];
|
||||
far->z = viewProj->m[11] - viewProj->m[10];
|
||||
far->w = viewProj->m[15] - viewProj->m[14];
|
||||
|
||||
float len = length(left->xyz);
|
||||
*left /= len;
|
||||
len = length(right->xyz);
|
||||
*right /= len;
|
||||
len = length(top->xyz);
|
||||
*top /= len;
|
||||
len = length(bottom->xyz);
|
||||
*bottom /= len;
|
||||
len = length(near->xyz);
|
||||
*near /= len;
|
||||
len = length(far->xyz);
|
||||
*far /= len;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 24))
|
||||
extern void __attribute__((overloadable))
|
||||
rsExtractFrustumPlanes(const rs_matrix4x4* viewProj, float4* left, float4* righ, float4* top,
|
||||
float4* bottom, float4* near, float4* far);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* rsIsSphereInFrustum: Checks if a sphere is within the frustum planes
|
||||
*
|
||||
* Returns true if the sphere is within the 6 frustum planes.
|
||||
*
|
||||
* Parameters:
|
||||
* sphere: float4 representing the sphere.
|
||||
* left: Left plane.
|
||||
* right: Right plane.
|
||||
* top: Top plane.
|
||||
* bottom: Bottom plane.
|
||||
* near: Near plane.
|
||||
* far: Far plane.
|
||||
*/
|
||||
#if !defined(RS_VERSION) || (RS_VERSION <= 23)
|
||||
static inline bool __attribute__((always_inline, overloadable))
|
||||
rsIsSphereInFrustum(float4* sphere, float4* left, float4* right, float4* top, float4* bottom,
|
||||
float4* near, float4* far) {
|
||||
float distToCenter = dot(left->xyz, sphere->xyz) + left->w;
|
||||
if (distToCenter < -sphere->w) {
|
||||
return false;
|
||||
}
|
||||
distToCenter = dot(right->xyz, sphere->xyz) + right->w;
|
||||
if (distToCenter < -sphere->w) {
|
||||
return false;
|
||||
}
|
||||
distToCenter = dot(top->xyz, sphere->xyz) + top->w;
|
||||
if (distToCenter < -sphere->w) {
|
||||
return false;
|
||||
}
|
||||
distToCenter = dot(bottom->xyz, sphere->xyz) + bottom->w;
|
||||
if (distToCenter < -sphere->w) {
|
||||
return false;
|
||||
}
|
||||
distToCenter = dot(near->xyz, sphere->xyz) + near->w;
|
||||
if (distToCenter < -sphere->w) {
|
||||
return false;
|
||||
}
|
||||
distToCenter = dot(far->xyz, sphere->xyz) + far->w;
|
||||
if (distToCenter < -sphere->w) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 24))
|
||||
extern bool __attribute__((overloadable))
|
||||
rsIsSphereInFrustum(float4* sphere, float4* left, float4* right, float4* top, float4* bottom,
|
||||
float4* near, float4* far);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* rsMatrixGet: Get one element
|
||||
*
|
||||
* Returns one element of a matrix.
|
||||
*
|
||||
* Warning: The order of the column and row parameters may be unexpected.
|
||||
*
|
||||
* Parameters:
|
||||
* m: Matrix to extract the element from.
|
||||
* col: Zero-based column of the element to be extracted.
|
||||
* row: Zero-based row of the element to extracted.
|
||||
*/
|
||||
extern float __attribute__((overloadable))
|
||||
rsMatrixGet(const rs_matrix4x4* m, uint32_t col, uint32_t row);
|
||||
|
||||
extern float __attribute__((overloadable))
|
||||
rsMatrixGet(const rs_matrix3x3* m, uint32_t col, uint32_t row);
|
||||
|
||||
extern float __attribute__((overloadable))
|
||||
rsMatrixGet(const rs_matrix2x2* m, uint32_t col, uint32_t row);
|
||||
|
||||
/*
|
||||
* rsMatrixInverse: Inverts a matrix in place
|
||||
*
|
||||
* Returns true if the matrix was successfully inverted.
|
||||
*
|
||||
* Parameters:
|
||||
* m: Matrix to invert.
|
||||
*/
|
||||
extern bool __attribute__((overloadable))
|
||||
rsMatrixInverse(rs_matrix4x4* m);
|
||||
|
||||
/*
|
||||
* rsMatrixInverseTranspose: Inverts and transpose a matrix in place
|
||||
*
|
||||
* The matrix is first inverted then transposed. Returns true if the matrix was
|
||||
* successfully inverted.
|
||||
*
|
||||
* Parameters:
|
||||
* m: Matrix to modify.
|
||||
*/
|
||||
extern bool __attribute__((overloadable))
|
||||
rsMatrixInverseTranspose(rs_matrix4x4* m);
|
||||
|
||||
/*
|
||||
* rsMatrixLoad: Load or copy a matrix
|
||||
*
|
||||
* Set the elements of a matrix from an array of floats or from another matrix.
|
||||
*
|
||||
* If loading from an array, the floats should be in row-major order, i.e. the element a
|
||||
* row 0, column 0 should be first, followed by the element at
|
||||
* row 0, column 1, etc.
|
||||
*
|
||||
* If loading from a matrix and the source is smaller than the destination, the rest
|
||||
* of the destination is filled with elements of the identity matrix. E.g.
|
||||
* loading a rs_matrix2x2 into a rs_matrix4x4 will give:
|
||||
*
|
||||
* m00 m01 0.0 0.0
|
||||
* m10 m11 0.0 0.0
|
||||
* 0.0 0.0 1.0 0.0
|
||||
* 0.0 0.0 0.0 1.0
|
||||
*
|
||||
*
|
||||
* Parameters:
|
||||
* destination: Matrix to set.
|
||||
* array: Array of values to set the matrix to. These arrays should be 4, 9, or 16 floats long, depending on the matrix size.
|
||||
* source: Source matrix.
|
||||
*/
|
||||
extern void __attribute__((overloadable))
|
||||
rsMatrixLoad(rs_matrix4x4* destination, const float* array);
|
||||
|
||||
extern void __attribute__((overloadable))
|
||||
rsMatrixLoad(rs_matrix3x3* destination, const float* array);
|
||||
|
||||
extern void __attribute__((overloadable))
|
||||
rsMatrixLoad(rs_matrix2x2* destination, const float* array);
|
||||
|
||||
extern void __attribute__((overloadable))
|
||||
rsMatrixLoad(rs_matrix4x4* destination, const rs_matrix4x4* source);
|
||||
|
||||
extern void __attribute__((overloadable))
|
||||
rsMatrixLoad(rs_matrix3x3* destination, const rs_matrix3x3* source);
|
||||
|
||||
extern void __attribute__((overloadable))
|
||||
rsMatrixLoad(rs_matrix2x2* destination, const rs_matrix2x2* source);
|
||||
|
||||
extern void __attribute__((overloadable))
|
||||
rsMatrixLoad(rs_matrix4x4* destination, const rs_matrix3x3* source);
|
||||
|
||||
extern void __attribute__((overloadable))
|
||||
rsMatrixLoad(rs_matrix4x4* destination, const rs_matrix2x2* source);
|
||||
|
||||
/*
|
||||
* rsMatrixLoadFrustum: Load a frustum projection matrix
|
||||
*
|
||||
* Constructs a frustum projection matrix, transforming the box identified by
|
||||
* the six clipping planes left, right, bottom, top, near, far.
|
||||
*
|
||||
* To apply this projection to a vector, multiply the vector by the created
|
||||
* matrix using rsMatrixMultiply().
|
||||
*
|
||||
* Parameters:
|
||||
* m: Matrix to set.
|
||||
*/
|
||||
extern void __attribute__((overloadable))
|
||||
rsMatrixLoadFrustum(rs_matrix4x4* m, float left, float right, float bottom, float top,
|
||||
float near, float far);
|
||||
|
||||
/*
|
||||
* rsMatrixLoadIdentity: Load identity matrix
|
||||
*
|
||||
* Set the elements of a matrix to the identity matrix.
|
||||
*
|
||||
* Parameters:
|
||||
* m: Matrix to set.
|
||||
*/
|
||||
extern void __attribute__((overloadable))
|
||||
rsMatrixLoadIdentity(rs_matrix4x4* m);
|
||||
|
||||
extern void __attribute__((overloadable))
|
||||
rsMatrixLoadIdentity(rs_matrix3x3* m);
|
||||
|
||||
extern void __attribute__((overloadable))
|
||||
rsMatrixLoadIdentity(rs_matrix2x2* m);
|
||||
|
||||
/*
|
||||
* rsMatrixLoadMultiply: Multiply two matrices
|
||||
*
|
||||
* Sets m to the matrix product of lhs * rhs.
|
||||
*
|
||||
* To combine two 4x4 transformaton matrices, multiply the second transformation matrix
|
||||
* by the first transformation matrix. E.g. to create a transformation matrix that applies
|
||||
* the transformation s1 followed by s2, call rsMatrixLoadMultiply(&combined, &s2, &s1).
|
||||
*
|
||||
* Warning: Prior to version 21, storing the result back into right matrix is not supported and
|
||||
* will result in undefined behavior. Use rsMatrixMulitply instead. E.g. instead of doing
|
||||
* rsMatrixLoadMultiply (&m2r, &m2r, &m2l), use rsMatrixMultiply (&m2r, &m2l).
|
||||
* rsMatrixLoadMultiply (&m2l, &m2r, &m2l) works as expected.
|
||||
*
|
||||
* Parameters:
|
||||
* m: Matrix to set.
|
||||
* lhs: Left matrix of the product.
|
||||
* rhs: Right matrix of the product.
|
||||
*/
|
||||
extern void __attribute__((overloadable))
|
||||
rsMatrixLoadMultiply(rs_matrix4x4* m, const rs_matrix4x4* lhs, const rs_matrix4x4* rhs);
|
||||
|
||||
extern void __attribute__((overloadable))
|
||||
rsMatrixLoadMultiply(rs_matrix3x3* m, const rs_matrix3x3* lhs, const rs_matrix3x3* rhs);
|
||||
|
||||
extern void __attribute__((overloadable))
|
||||
rsMatrixLoadMultiply(rs_matrix2x2* m, const rs_matrix2x2* lhs, const rs_matrix2x2* rhs);
|
||||
|
||||
/*
|
||||
* rsMatrixLoadOrtho: Load an orthographic projection matrix
|
||||
*
|
||||
* Constructs an orthographic projection matrix, transforming the box identified by the
|
||||
* six clipping planes left, right, bottom, top, near, far into a unit cube
|
||||
* with a corner at (-1, -1, -1) and the opposite at (1, 1, 1).
|
||||
*
|
||||
* To apply this projection to a vector, multiply the vector by the created matrix
|
||||
* using rsMatrixMultiply().
|
||||
*
|
||||
* See https://en.wikipedia.org/wiki/Orthographic_projection .
|
||||
*
|
||||
* Parameters:
|
||||
* m: Matrix to set.
|
||||
*/
|
||||
extern void __attribute__((overloadable))
|
||||
rsMatrixLoadOrtho(rs_matrix4x4* m, float left, float right, float bottom, float top, float near,
|
||||
float far);
|
||||
|
||||
/*
|
||||
* rsMatrixLoadPerspective: Load a perspective projection matrix
|
||||
*
|
||||
* Constructs a perspective projection matrix, assuming a symmetrical field of view.
|
||||
*
|
||||
* To apply this projection to a vector, multiply the vector by the created matrix
|
||||
* using rsMatrixMultiply().
|
||||
*
|
||||
* Parameters:
|
||||
* m: Matrix to set.
|
||||
* fovy: Field of view, in degrees along the Y axis.
|
||||
* aspect: Ratio of x / y.
|
||||
* near: Near clipping plane.
|
||||
* far: Far clipping plane.
|
||||
*/
|
||||
extern void __attribute__((overloadable))
|
||||
rsMatrixLoadPerspective(rs_matrix4x4* m, float fovy, float aspect, float near, float far);
|
||||
|
||||
/*
|
||||
* rsMatrixLoadRotate: Load a rotation matrix
|
||||
*
|
||||
* This function creates a rotation matrix. The axis of rotation is the (x, y, z) vector.
|
||||
*
|
||||
* To rotate a vector, multiply the vector by the created matrix using rsMatrixMultiply().
|
||||
*
|
||||
* See http://en.wikipedia.org/wiki/Rotation_matrix .
|
||||
*
|
||||
* Parameters:
|
||||
* m: Matrix to set.
|
||||
* rot: How much rotation to do, in degrees.
|
||||
* x: X component of the vector that is the axis of rotation.
|
||||
* y: Y component of the vector that is the axis of rotation.
|
||||
* z: Z component of the vector that is the axis of rotation.
|
||||
*/
|
||||
extern void __attribute__((overloadable))
|
||||
rsMatrixLoadRotate(rs_matrix4x4* m, float rot, float x, float y, float z);
|
||||
|
||||
/*
|
||||
* rsMatrixLoadScale: Load a scaling matrix
|
||||
*
|
||||
* This function creates a scaling matrix, where each component of a vector is multiplied
|
||||
* by a number. This number can be negative.
|
||||
*
|
||||
* To scale a vector, multiply the vector by the created matrix using rsMatrixMultiply().
|
||||
*
|
||||
* Parameters:
|
||||
* m: Matrix to set.
|
||||
* x: Multiple to scale the x components by.
|
||||
* y: Multiple to scale the y components by.
|
||||
* z: Multiple to scale the z components by.
|
||||
*/
|
||||
extern void __attribute__((overloadable))
|
||||
rsMatrixLoadScale(rs_matrix4x4* m, float x, float y, float z);
|
||||
|
||||
/*
|
||||
* rsMatrixLoadTranslate: Load a translation matrix
|
||||
*
|
||||
* This function creates a translation matrix, where a number is added to each element of
|
||||
* a vector.
|
||||
*
|
||||
* To translate a vector, multiply the vector by the created matrix using
|
||||
* rsMatrixMultiply().
|
||||
*
|
||||
* Parameters:
|
||||
* m: Matrix to set.
|
||||
* x: Number to add to each x component.
|
||||
* y: Number to add to each y component.
|
||||
* z: Number to add to each z component.
|
||||
*/
|
||||
extern void __attribute__((overloadable))
|
||||
rsMatrixLoadTranslate(rs_matrix4x4* m, float x, float y, float z);
|
||||
|
||||
/*
|
||||
* rsMatrixMultiply: Multiply a matrix by a vector or another matrix
|
||||
*
|
||||
* For the matrix by matrix variant, sets m to the matrix product m * rhs.
|
||||
*
|
||||
* When combining two 4x4 transformation matrices using this function, the resulting
|
||||
* matrix will correspond to performing the rhs transformation first followed by
|
||||
* the original m transformation.
|
||||
*
|
||||
* For the matrix by vector variant, returns the post-multiplication of the vector
|
||||
* by the matrix, ie. m * in.
|
||||
*
|
||||
* When multiplying a float3 to a rs_matrix4x4, the vector is expanded with (1).
|
||||
*
|
||||
* When multiplying a float2 to a rs_matrix4x4, the vector is expanded with (0, 1).
|
||||
*
|
||||
* When multiplying a float2 to a rs_matrix3x3, the vector is expanded with (0).
|
||||
*
|
||||
* Starting with API 14, this function takes a const matrix as the first argument.
|
||||
*
|
||||
* Parameters:
|
||||
* m: Left matrix of the product and the matrix to be set.
|
||||
* rhs: Right matrix of the product.
|
||||
*/
|
||||
extern void __attribute__((overloadable))
|
||||
rsMatrixMultiply(rs_matrix4x4* m, const rs_matrix4x4* rhs);
|
||||
|
||||
extern void __attribute__((overloadable))
|
||||
rsMatrixMultiply(rs_matrix3x3* m, const rs_matrix3x3* rhs);
|
||||
|
||||
extern void __attribute__((overloadable))
|
||||
rsMatrixMultiply(rs_matrix2x2* m, const rs_matrix2x2* rhs);
|
||||
|
||||
#if !defined(RS_VERSION) || (RS_VERSION <= 13)
|
||||
extern float4 __attribute__((overloadable))
|
||||
rsMatrixMultiply(rs_matrix4x4* m, float4 in);
|
||||
#endif
|
||||
|
||||
#if !defined(RS_VERSION) || (RS_VERSION <= 13)
|
||||
extern float4 __attribute__((overloadable))
|
||||
rsMatrixMultiply(rs_matrix4x4* m, float3 in);
|
||||
#endif
|
||||
|
||||
#if !defined(RS_VERSION) || (RS_VERSION <= 13)
|
||||
extern float4 __attribute__((overloadable))
|
||||
rsMatrixMultiply(rs_matrix4x4* m, float2 in);
|
||||
#endif
|
||||
|
||||
#if !defined(RS_VERSION) || (RS_VERSION <= 13)
|
||||
extern float3 __attribute__((overloadable))
|
||||
rsMatrixMultiply(rs_matrix3x3* m, float3 in);
|
||||
#endif
|
||||
|
||||
#if !defined(RS_VERSION) || (RS_VERSION <= 13)
|
||||
extern float3 __attribute__((overloadable))
|
||||
rsMatrixMultiply(rs_matrix3x3* m, float2 in);
|
||||
#endif
|
||||
|
||||
#if !defined(RS_VERSION) || (RS_VERSION <= 13)
|
||||
extern float2 __attribute__((overloadable))
|
||||
rsMatrixMultiply(rs_matrix2x2* m, float2 in);
|
||||
#endif
|
||||
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 14))
|
||||
extern float4 __attribute__((overloadable))
|
||||
rsMatrixMultiply(const rs_matrix4x4* m, float4 in);
|
||||
#endif
|
||||
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 14))
|
||||
extern float4 __attribute__((overloadable))
|
||||
rsMatrixMultiply(const rs_matrix4x4* m, float3 in);
|
||||
#endif
|
||||
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 14))
|
||||
extern float4 __attribute__((overloadable))
|
||||
rsMatrixMultiply(const rs_matrix4x4* m, float2 in);
|
||||
#endif
|
||||
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 14))
|
||||
extern float3 __attribute__((overloadable))
|
||||
rsMatrixMultiply(const rs_matrix3x3* m, float3 in);
|
||||
#endif
|
||||
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 14))
|
||||
extern float3 __attribute__((overloadable))
|
||||
rsMatrixMultiply(const rs_matrix3x3* m, float2 in);
|
||||
#endif
|
||||
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 14))
|
||||
extern float2 __attribute__((overloadable))
|
||||
rsMatrixMultiply(const rs_matrix2x2* m, float2 in);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* rsMatrixRotate: Apply a rotation to a transformation matrix
|
||||
*
|
||||
* Multiply the matrix m with a rotation matrix.
|
||||
*
|
||||
* This function modifies a transformation matrix to first do a rotation. The axis of
|
||||
* rotation is the (x, y, z) vector.
|
||||
*
|
||||
* To apply this combined transformation to a vector, multiply the vector by the created
|
||||
* matrix using rsMatrixMultiply().
|
||||
*
|
||||
* Parameters:
|
||||
* m: Matrix to modify.
|
||||
* rot: How much rotation to do, in degrees.
|
||||
* x: X component of the vector that is the axis of rotation.
|
||||
* y: Y component of the vector that is the axis of rotation.
|
||||
* z: Z component of the vector that is the axis of rotation.
|
||||
*/
|
||||
extern void __attribute__((overloadable))
|
||||
rsMatrixRotate(rs_matrix4x4* m, float rot, float x, float y, float z);
|
||||
|
||||
/*
|
||||
* rsMatrixScale: Apply a scaling to a transformation matrix
|
||||
*
|
||||
* Multiply the matrix m with a scaling matrix.
|
||||
*
|
||||
* This function modifies a transformation matrix to first do a scaling. When scaling,
|
||||
* each component of a vector is multiplied by a number. This number can be negative.
|
||||
*
|
||||
* To apply this combined transformation to a vector, multiply the vector by the created
|
||||
* matrix using rsMatrixMultiply().
|
||||
*
|
||||
* Parameters:
|
||||
* m: Matrix to modify.
|
||||
* x: Multiple to scale the x components by.
|
||||
* y: Multiple to scale the y components by.
|
||||
* z: Multiple to scale the z components by.
|
||||
*/
|
||||
extern void __attribute__((overloadable))
|
||||
rsMatrixScale(rs_matrix4x4* m, float x, float y, float z);
|
||||
|
||||
/*
|
||||
* rsMatrixSet: Set one element
|
||||
*
|
||||
* Set an element of a matrix.
|
||||
*
|
||||
* Warning: The order of the column and row parameters may be unexpected.
|
||||
*
|
||||
* Parameters:
|
||||
* m: Matrix that will be modified.
|
||||
* col: Zero-based column of the element to be set.
|
||||
* row: Zero-based row of the element to be set.
|
||||
* v: Value to set.
|
||||
*/
|
||||
extern void __attribute__((overloadable))
|
||||
rsMatrixSet(rs_matrix4x4* m, uint32_t col, uint32_t row, float v);
|
||||
|
||||
extern void __attribute__((overloadable))
|
||||
rsMatrixSet(rs_matrix3x3* m, uint32_t col, uint32_t row, float v);
|
||||
|
||||
extern void __attribute__((overloadable))
|
||||
rsMatrixSet(rs_matrix2x2* m, uint32_t col, uint32_t row, float v);
|
||||
|
||||
/*
|
||||
* rsMatrixTranslate: Apply a translation to a transformation matrix
|
||||
*
|
||||
* Multiply the matrix m with a translation matrix.
|
||||
*
|
||||
* This function modifies a transformation matrix to first do a translation. When
|
||||
* translating, a number is added to each component of a vector.
|
||||
*
|
||||
* To apply this combined transformation to a vector, multiply the vector by the
|
||||
* created matrix using rsMatrixMultiply().
|
||||
*
|
||||
* Parameters:
|
||||
* m: Matrix to modify.
|
||||
* x: Number to add to each x component.
|
||||
* y: Number to add to each y component.
|
||||
* z: Number to add to each z component.
|
||||
*/
|
||||
extern void __attribute__((overloadable))
|
||||
rsMatrixTranslate(rs_matrix4x4* m, float x, float y, float z);
|
||||
|
||||
/*
|
||||
* rsMatrixTranspose: Transpose a matrix place
|
||||
*
|
||||
* Transpose the matrix m in place.
|
||||
*
|
||||
* Parameters:
|
||||
* m: Matrix to transpose.
|
||||
*/
|
||||
extern void __attribute__((overloadable))
|
||||
rsMatrixTranspose(rs_matrix4x4* m);
|
||||
|
||||
extern void __attribute__((overloadable))
|
||||
rsMatrixTranspose(rs_matrix3x3* m);
|
||||
|
||||
extern void __attribute__((overloadable))
|
||||
rsMatrixTranspose(rs_matrix2x2* m);
|
||||
|
||||
#endif // RENDERSCRIPT_RS_MATRIX_RSH
|
||||
@@ -0,0 +1,462 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// Don't edit this file! It is auto-generated by frameworks/rs/api/generate.sh.
|
||||
|
||||
/*
|
||||
* rs_object_info.rsh: Object Characteristics Functions
|
||||
*
|
||||
* The functions below can be used to query the characteristics of an Allocation, Element,
|
||||
* or Sampler object. These objects are created from Java. You can't create them from a
|
||||
* script.
|
||||
*
|
||||
* Allocations:
|
||||
*
|
||||
* Allocations are the primary method used to pass data to and from RenderScript kernels.
|
||||
*
|
||||
* They are a structured collection of cells that can be used to store bitmaps, textures,
|
||||
* arbitrary data points, etc.
|
||||
*
|
||||
* This collection of cells may have many dimensions (X, Y, Z, Array0, Array1, Array2, Array3),
|
||||
* faces (for cubemaps), and level of details (for mipmapping).
|
||||
*
|
||||
* See the android.renderscript.Allocation for details on to create Allocations.
|
||||
*
|
||||
* Elements:
|
||||
*
|
||||
* The term "element" is used a bit ambiguously in RenderScript, as both type information
|
||||
* for the cells of an Allocation and the instantiation of that type. For example:
|
||||
* - rs_element is a handle to a type specification, and
|
||||
* - In functions like rsGetElementAt(), "element" means the instantiation of the type,
|
||||
* i.e. a cell of an Allocation.
|
||||
*
|
||||
* The functions below let you query the characteristics of the type specificiation.
|
||||
*
|
||||
* An Element can specify a simple data types as found in C, e.g. an integer, float, or
|
||||
* boolean. It can also specify a handle to a RenderScript object. See rs_data_type for
|
||||
* a list of basic types.
|
||||
*
|
||||
* Elements can specify fixed size vector (of size 2, 3, or 4) versions of the basic types.
|
||||
* Elements can be grouped together into complex Elements, creating the equivalent of
|
||||
* C structure definitions.
|
||||
*
|
||||
* Elements can also have a kind, which is semantic information used to interpret pixel
|
||||
* data. See rs_data_kind.
|
||||
*
|
||||
* When creating Allocations of common elements, you can simply use one of the many predefined
|
||||
* Elements like F32_2.
|
||||
*
|
||||
* To create complex Elements, use the Element.Builder Java class.
|
||||
*
|
||||
* Samplers:
|
||||
*
|
||||
* Samplers objects define how Allocations can be read as structure within a kernel.
|
||||
* See android.renderscript.S.
|
||||
*/
|
||||
|
||||
#ifndef RENDERSCRIPT_RS_OBJECT_INFO_RSH
|
||||
#define RENDERSCRIPT_RS_OBJECT_INFO_RSH
|
||||
|
||||
/*
|
||||
* rsAllocationGetDimFaces: Presence of more than one face
|
||||
*
|
||||
* If the Allocation is a cubemap, this function returns 1 if there's more than one face
|
||||
* present. In all other cases, it returns 0.
|
||||
*
|
||||
* Use rsGetDimHasFaces() to get the dimension of a currently running kernel.
|
||||
*
|
||||
* Returns: Returns 1 if more than one face is present, 0 otherwise.
|
||||
*/
|
||||
extern uint32_t __attribute__((overloadable))
|
||||
rsAllocationGetDimFaces(rs_allocation a);
|
||||
|
||||
/*
|
||||
* rsAllocationGetDimLOD: Presence of levels of detail
|
||||
*
|
||||
* Query an Allocation for the presence of more than one Level Of Detail. This is useful
|
||||
* for mipmaps.
|
||||
*
|
||||
* Use rsGetDimLod() to get the dimension of a currently running kernel.
|
||||
*
|
||||
* Returns: Returns 1 if more than one LOD is present, 0 otherwise.
|
||||
*/
|
||||
extern uint32_t __attribute__((overloadable))
|
||||
rsAllocationGetDimLOD(rs_allocation a);
|
||||
|
||||
/*
|
||||
* rsAllocationGetDimX: Size of the X dimension
|
||||
*
|
||||
* Returns the size of the X dimension of the Allocation.
|
||||
*
|
||||
* Use rsGetDimX() to get the dimension of a currently running kernel.
|
||||
*
|
||||
* Returns: X dimension of the Allocation.
|
||||
*/
|
||||
extern uint32_t __attribute__((overloadable))
|
||||
rsAllocationGetDimX(rs_allocation a);
|
||||
|
||||
/*
|
||||
* rsAllocationGetDimY: Size of the Y dimension
|
||||
*
|
||||
* Returns the size of the Y dimension of the Allocation. If the Allocation has less
|
||||
* than two dimensions, returns 0.
|
||||
*
|
||||
* Use rsGetDimY() to get the dimension of a currently running kernel.
|
||||
*
|
||||
* Returns: Y dimension of the Allocation.
|
||||
*/
|
||||
extern uint32_t __attribute__((overloadable))
|
||||
rsAllocationGetDimY(rs_allocation a);
|
||||
|
||||
/*
|
||||
* rsAllocationGetDimZ: Size of the Z dimension
|
||||
*
|
||||
* Returns the size of the Z dimension of the Allocation. If the Allocation has less
|
||||
* than three dimensions, returns 0.
|
||||
*
|
||||
* Use rsGetDimZ() to get the dimension of a currently running kernel.
|
||||
*
|
||||
* Returns: Z dimension of the Allocation.
|
||||
*/
|
||||
extern uint32_t __attribute__((overloadable))
|
||||
rsAllocationGetDimZ(rs_allocation a);
|
||||
|
||||
/*
|
||||
* rsAllocationGetElement: Get the object that describes the cell of an Allocation
|
||||
*
|
||||
* Get the Element object describing the type, kind, and other characteristics of a cell
|
||||
* of an Allocation. See the rsElement* functions below.
|
||||
*
|
||||
* Parameters:
|
||||
* a: Allocation to get data from.
|
||||
*
|
||||
* Returns: Element describing Allocation layout.
|
||||
*/
|
||||
extern rs_element __attribute__((overloadable))
|
||||
rsAllocationGetElement(rs_allocation a);
|
||||
|
||||
/*
|
||||
* rsClearObject: Release an object
|
||||
*
|
||||
* Tells the run time that this handle will no longer be used to access the the related
|
||||
* object. If this was the last handle to that object, resource recovery may happen.
|
||||
*
|
||||
* After calling this function, *dst will be set to an empty handle. See rsIsObject().
|
||||
*/
|
||||
extern void __attribute__((overloadable))
|
||||
rsClearObject(rs_element* dst);
|
||||
|
||||
extern void __attribute__((overloadable))
|
||||
rsClearObject(rs_type* dst);
|
||||
|
||||
extern void __attribute__((overloadable))
|
||||
rsClearObject(rs_allocation* dst);
|
||||
|
||||
extern void __attribute__((overloadable))
|
||||
rsClearObject(rs_sampler* dst);
|
||||
|
||||
extern void __attribute__((overloadable))
|
||||
rsClearObject(rs_script* dst);
|
||||
|
||||
/*
|
||||
* rsIsObject: Check for an empty handle
|
||||
*
|
||||
* Returns true if the handle contains a non-null reference.
|
||||
*
|
||||
* This function does not validate that the internal pointer used in the handle
|
||||
* points to an actual valid object; it only checks for null.
|
||||
*
|
||||
* This function can be used to check the Element returned by rsElementGetSubElement()
|
||||
* or see if rsClearObject() has been called on a handle.
|
||||
*/
|
||||
extern bool __attribute__((overloadable))
|
||||
rsIsObject(rs_element v);
|
||||
|
||||
extern bool __attribute__((overloadable))
|
||||
rsIsObject(rs_type v);
|
||||
|
||||
extern bool __attribute__((overloadable))
|
||||
rsIsObject(rs_allocation v);
|
||||
|
||||
extern bool __attribute__((overloadable))
|
||||
rsIsObject(rs_sampler v);
|
||||
|
||||
extern bool __attribute__((overloadable))
|
||||
rsIsObject(rs_script v);
|
||||
|
||||
/*
|
||||
* rsElementGetBytesSize: Size of an Element
|
||||
*
|
||||
* Returns the size in bytes that an instantiation of this Element will occupy.
|
||||
*/
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 16))
|
||||
extern uint32_t __attribute__((overloadable))
|
||||
rsElementGetBytesSize(rs_element e);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* rsElementGetDataKind: Kind of an Element
|
||||
*
|
||||
* Returns the Element's data kind. This is used to interpret pixel data.
|
||||
*
|
||||
* See rs_data_kind.
|
||||
*/
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 16))
|
||||
extern rs_data_kind __attribute__((overloadable))
|
||||
rsElementGetDataKind(rs_element e);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* rsElementGetDataType: Data type of an Element
|
||||
*
|
||||
* Returns the Element's base data type. This can be a type similar to C/C++ (e.g.
|
||||
* RS_TYPE_UNSIGNED_8), a handle (e.g. RS_TYPE_ALLOCATION and RS_TYPE_ELEMENT), or a
|
||||
* more complex numerical type (e.g. RS_TYPE_UNSIGNED_5_6_5 and RS_TYPE_MATRIX_4X4).
|
||||
* See rs_data_type.
|
||||
*
|
||||
* If the Element describes a vector, this function returns the data type of one of its items.
|
||||
* Use rsElementGetVectorSize to get the size of the vector.
|
||||
*
|
||||
* If the Element describes a structure, RS_TYPE_NONE is returned. Use the rsElementGetSub*
|
||||
* functions to explore this complex Element.
|
||||
*/
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 16))
|
||||
extern rs_data_type __attribute__((overloadable))
|
||||
rsElementGetDataType(rs_element e);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* rsElementGetSubElement: Sub-element of a complex Element
|
||||
*
|
||||
* For Elements that represents a structure, this function returns the sub-element at the
|
||||
* specified index.
|
||||
*
|
||||
* If the Element is not a structure or the index is greater or equal to the number of
|
||||
* sub-elements, an invalid handle is returned.
|
||||
*
|
||||
* Parameters:
|
||||
* e: Element to query.
|
||||
* index: Index of the sub-element to return.
|
||||
*
|
||||
* Returns: Sub-element at the given index.
|
||||
*/
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 16))
|
||||
extern rs_element __attribute__((overloadable))
|
||||
rsElementGetSubElement(rs_element e, uint32_t index);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* rsElementGetSubElementArraySize: Array size of a sub-element of a complex Element
|
||||
*
|
||||
* For complex Elements, sub-elements can be statically sized arrays. This function
|
||||
* returns the array size of the sub-element at the index. This sub-element repetition
|
||||
* is different than fixed size vectors.
|
||||
*
|
||||
* Parameters:
|
||||
* e: Element to query.
|
||||
* index: Index of the sub-element.
|
||||
*
|
||||
* Returns: Array size of the sub-element.
|
||||
*/
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 16))
|
||||
extern uint32_t __attribute__((overloadable))
|
||||
rsElementGetSubElementArraySize(rs_element e, uint32_t index);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* rsElementGetSubElementCount: Number of sub-elements
|
||||
*
|
||||
* Elements can be simple, such as an int or a float, or a structure with multiple
|
||||
* sub-elements. This function returns zero for simple Elements and the number of
|
||||
* sub-elements for complex Elements.
|
||||
*
|
||||
* Parameters:
|
||||
* e: Element to get data from.
|
||||
*
|
||||
* Returns: Number of sub-elements.
|
||||
*/
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 16))
|
||||
extern uint32_t __attribute__((overloadable))
|
||||
rsElementGetSubElementCount(rs_element e);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* rsElementGetSubElementName: Name of a sub-element
|
||||
*
|
||||
* For complex Elements, this function returns the name of the sub-element at the
|
||||
* specified index.
|
||||
*
|
||||
* Parameters:
|
||||
* e: Element to get data from.
|
||||
* index: Index of the sub-element.
|
||||
* name: Address of the array to store the name into.
|
||||
* nameLength: Length of the provided name array.
|
||||
*
|
||||
* Returns: Number of characters copied, excluding the null terminator.
|
||||
*/
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 16))
|
||||
extern uint32_t __attribute__((overloadable))
|
||||
rsElementGetSubElementName(rs_element e, uint32_t index, char* name, uint32_t nameLength);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* rsElementGetSubElementNameLength: Length of the name of a sub-element
|
||||
*
|
||||
* For complex Elements, this function returns the length of the name of the sub-element
|
||||
* at the specified index.
|
||||
*
|
||||
* Parameters:
|
||||
* e: Element to get data from.
|
||||
* index: Index of the sub-element.
|
||||
*
|
||||
* Returns: Length of the sub-element name including the null terminator.
|
||||
*/
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 16))
|
||||
extern uint32_t __attribute__((overloadable))
|
||||
rsElementGetSubElementNameLength(rs_element e, uint32_t index);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* rsElementGetSubElementOffsetBytes: Offset of the instantiated sub-element
|
||||
*
|
||||
* This function returns the relative position of the instantiation of the specified
|
||||
* sub-element within the instantiation of the Element.
|
||||
*
|
||||
* For example, if the Element describes a 32 bit float followed by a 32 bit integer,
|
||||
* the offset return for the first will be 0 and the second 4.
|
||||
*
|
||||
* Parameters:
|
||||
* e: Element to get data from.
|
||||
* index: Index of the sub-element.
|
||||
*
|
||||
* Returns: Offset in bytes.
|
||||
*/
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 16))
|
||||
extern uint32_t __attribute__((overloadable))
|
||||
rsElementGetSubElementOffsetBytes(rs_element e, uint32_t index);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* rsElementGetVectorSize: Vector size of the Element
|
||||
*
|
||||
* Returns the Element's vector size. If the Element does not represent a vector,
|
||||
* 1 is returned.
|
||||
*
|
||||
* Parameters:
|
||||
* e: Element to get data from.
|
||||
*
|
||||
* Returns: Length of the element vector.
|
||||
*/
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 16))
|
||||
extern uint32_t __attribute__((overloadable))
|
||||
rsElementGetVectorSize(rs_element e);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* rsGetAllocation: Return the Allocation for a given pointer
|
||||
*
|
||||
* DEPRECATED. Do not use.
|
||||
*
|
||||
* Returns the Allocation for a given pointer. The pointer should point within a valid
|
||||
* allocation. The results are undefined if the pointer is not from a valid Allocation.
|
||||
*/
|
||||
extern rs_allocation __attribute__((overloadable
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 22))
|
||||
, deprecated("This function is deprecated and will be removed from the SDK in a future release.")
|
||||
#endif
|
||||
))
|
||||
rsGetAllocation(const void* p);
|
||||
|
||||
/*
|
||||
* rsSamplerGetAnisotropy: Anisotropy of the Sampler
|
||||
*
|
||||
* Get the Sampler's anisotropy.
|
||||
*
|
||||
* See android.renderscript.S.
|
||||
*/
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 16))
|
||||
extern float __attribute__((overloadable))
|
||||
rsSamplerGetAnisotropy(rs_sampler s);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* rsSamplerGetMagnification: Sampler magnification value
|
||||
*
|
||||
* Get the Sampler's magnification value.
|
||||
*
|
||||
* See android.renderscript.S.
|
||||
*/
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 16))
|
||||
extern rs_sampler_value __attribute__((overloadable))
|
||||
rsSamplerGetMagnification(rs_sampler s);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* rsSamplerGetMinification: Sampler minification value
|
||||
*
|
||||
* Get the Sampler's minification value.
|
||||
*
|
||||
* See android.renderscript.S.
|
||||
*/
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 16))
|
||||
extern rs_sampler_value __attribute__((overloadable))
|
||||
rsSamplerGetMinification(rs_sampler s);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* rsSamplerGetWrapS: Sampler wrap S value
|
||||
*
|
||||
* Get the Sampler's wrap S value.
|
||||
*
|
||||
* See android.renderscript.S.
|
||||
*/
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 16))
|
||||
extern rs_sampler_value __attribute__((overloadable))
|
||||
rsSamplerGetWrapS(rs_sampler s);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* rsSamplerGetWrapT: Sampler wrap T value
|
||||
*
|
||||
* Get the sampler's wrap T value.
|
||||
*
|
||||
* See android.renderscript.S.
|
||||
*/
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 16))
|
||||
extern rs_sampler_value __attribute__((overloadable))
|
||||
rsSamplerGetWrapT(rs_sampler s);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* rsSetObject: For internal use.
|
||||
*
|
||||
*/
|
||||
extern void __attribute__((overloadable))
|
||||
rsSetObject(rs_element* dst, rs_element src);
|
||||
|
||||
extern void __attribute__((overloadable))
|
||||
rsSetObject(rs_type* dst, rs_type src);
|
||||
|
||||
extern void __attribute__((overloadable))
|
||||
rsSetObject(rs_allocation* dst, rs_allocation src);
|
||||
|
||||
extern void __attribute__((overloadable))
|
||||
rsSetObject(rs_sampler* dst, rs_sampler src);
|
||||
|
||||
extern void __attribute__((overloadable))
|
||||
rsSetObject(rs_script* dst, rs_script src);
|
||||
|
||||
#endif // RENDERSCRIPT_RS_OBJECT_INFO_RSH
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user