9#ifndef _HLSL_HLSL_INTRINSICS_H_
10#define _HLSL_HLSL_INTRINSICS_H_
21#define _HLSL_BUILTIN_ALIAS(builtin) \
22 __attribute__((clang_builtin_alias(builtin)))
23#define _HLSL_AVAILABILITY(platform, version) \
24 __attribute__((availability(platform, introduced = version)))
25#define _HLSL_AVAILABILITY_STAGE(platform, version, stage) \
27 availability(platform, introduced = version, environment = stage)))
29#ifdef __HLSL_ENABLE_16_BIT
30#define _HLSL_16BIT_AVAILABILITY(platform, version) \
31 __attribute__((availability(platform, introduced = version)))
32#define _HLSL_16BIT_AVAILABILITY_STAGE(platform, version, stage) \
34 availability(platform, introduced = version, environment = stage)))
36#define _HLSL_16BIT_AVAILABILITY(environment, version)
37#define _HLSL_16BIT_AVAILABILITY_STAGE(environment, version, stage)
48#ifdef __HLSL_ENABLE_16_BIT
54int16_t2
abs(int16_t2);
57int16_t3
abs(int16_t3);
60int16_t4
abs(int16_t4);
120#ifdef __HLSL_ENABLE_16_BIT
148#ifdef __HLSL_ENABLE_16_BIT
260#ifdef __HLSL_ENABLE_16_BIT
390template <typename T,
int N>
391constexpr vector<
float, N>
asfloat(vector<T, N>
V) {
392 return __detail::bit_cast<float, T, N>(
V);
395template <
typename T>
constexpr float asfloat(T F) {
396 return __detail::bit_cast<float, T>(F);
407template <
typename T,
int N>
constexpr vector<int, N>
asint(vector<T, N>
V) {
408 return __detail::bit_cast<int, T, N>(
V);
411template <
typename T>
constexpr int asint(T F) {
412 return __detail::bit_cast<int, T>(F);
423#ifdef __HLSL_ENABLE_16_BIT
451template <typename T,
int N> constexpr vector<
uint, N>
asuint(vector<T, N>
V) {
452 return __detail::bit_cast<uint, T, N>(
V);
456 return __detail::bit_cast<uint, T>(F);
485#ifdef __HLSL_ENABLE_16_BIT
515#ifdef __HLSL_ENABLE_16_BIT
517half
atan2(half y, half x);
594#ifdef __HLSL_ENABLE_16_BIT
597int16_t
clamp(int16_t, int16_t, int16_t);
600int16_t2
clamp(int16_t2, int16_t2, int16_t2);
603int16_t3
clamp(int16_t3, int16_t3, int16_t3);
606int16_t4
clamp(int16_t4, int16_t4, int16_t4);
610uint16_t
clamp(uint16_t, uint16_t, uint16_t);
613uint16_t2
clamp(uint16_t2, uint16_t2, uint16_t2);
616uint16_t3
clamp(uint16_t3, uint16_t3, uint16_t3);
619uint16_t4
clamp(uint16_t4, uint16_t4, uint16_t4);
668double clamp(
double,
double,
double);
731#ifdef __HLSL_ENABLE_16_BIT
759#ifdef __HLSL_ENABLE_16_BIT
762 return __builtin_elementwise_popcount(x);
766 return __builtin_elementwise_popcount(x);
770 return __builtin_elementwise_popcount(x);
774 return __builtin_elementwise_popcount(x);
778 return __builtin_elementwise_popcount(x);
782 return __builtin_elementwise_popcount(x);
786 return __builtin_elementwise_popcount(x);
790 return __builtin_elementwise_popcount(x);
794const inline uint countbits(
int x) {
return __builtin_elementwise_popcount(x); }
796 return __builtin_elementwise_popcount(x);
799 return __builtin_elementwise_popcount(x);
802 return __builtin_elementwise_popcount(x);
806 return __builtin_elementwise_popcount(x);
809 return __builtin_elementwise_popcount(x);
812 return __builtin_elementwise_popcount(x);
815 return __builtin_elementwise_popcount(x);
819 return __builtin_elementwise_popcount(x);
822 return __builtin_elementwise_popcount(x);
825 return __builtin_elementwise_popcount(x);
828 return __builtin_elementwise_popcount(x);
832 return __builtin_elementwise_popcount(x);
835 return __builtin_elementwise_popcount(x);
838 return __builtin_elementwise_popcount(x);
841 return __builtin_elementwise_popcount(x);
894const inline half
distance(vector<half, N>
X, vector<half, N> Y) {
899const inline float distance(vector<float, N>
X, vector<float, N> Y) {
925#ifdef __HLSL_ENABLE_16_BIT
928int16_t
dot(int16_t, int16_t);
931int16_t
dot(int16_t2, int16_t2);
934int16_t
dot(int16_t3, int16_t3);
937int16_t
dot(int16_t4, int16_t4);
941uint16_t
dot(uint16_t, uint16_t);
944uint16_t
dot(uint16_t2, uint16_t2);
947uint16_t
dot(uint16_t3, uint16_t3);
950uint16_t
dot(uint16_t4, uint16_t4);
963double dot(
double,
double);
1090#ifdef __HLSL_ENABLE_16_BIT
1339template <
int N>
const inline float length(vector<float, N>
X) {
1465#ifdef __HLSL_ENABLE_16_BIT
1468int16_t
mad(int16_t, int16_t, int16_t);
1471int16_t2
mad(int16_t2, int16_t2, int16_t2);
1474int16_t3
mad(int16_t3, int16_t3, int16_t3);
1477int16_t4
mad(int16_t4, int16_t4, int16_t4);
1481uint16_t
mad(uint16_t, uint16_t, uint16_t);
1484uint16_t2
mad(uint16_t2, uint16_t2, uint16_t2);
1487uint16_t3
mad(uint16_t3, uint16_t3, uint16_t3);
1490uint16_t4
mad(uint16_t4, uint16_t4, uint16_t4);
1530float mad(
float,
float,
float);
1539double mad(
double,
double,
double);
1569#ifdef __HLSL_ENABLE_16_BIT
1572int16_t
max(int16_t, int16_t);
1575int16_t2
max(int16_t2, int16_t2);
1578int16_t3
max(int16_t3, int16_t3);
1581int16_t4
max(int16_t4, int16_t4);
1585uint16_t
max(uint16_t, uint16_t);
1588uint16_t2
max(uint16_t2, uint16_t2);
1591uint16_t3
max(uint16_t3, uint16_t3);
1594uint16_t4
max(uint16_t4, uint16_t4);
1673#ifdef __HLSL_ENABLE_16_BIT
1676int16_t
min(int16_t, int16_t);
1679int16_t2
min(int16_t2, int16_t2);
1682int16_t3
min(int16_t3, int16_t3);
1685int16_t4
min(int16_t4, int16_t4);
1689uint16_t
min(uint16_t, uint16_t);
1692uint16_t2
min(uint16_t2, uint16_t2);
1695uint16_t3
min(uint16_t3, uint16_t3);
1698uint16_t4
min(uint16_t4, uint16_t4);
1826#ifdef __HLSL_ENABLE_16_BIT
2055template <typename T>
2067template <typename T,
int Sz>
2069vector<T, Sz>
select(vector<
bool, Sz>, vector<T, Sz>, vector<T, Sz>);
2109#ifdef __HLSL_ENABLE_16_BIT
2200#ifdef __HLSL_ENABLE_16_BIT
2228#ifdef __HLSL_ENABLE_16_BIT
2298__attribute__((convergent))
bool WaveActiveAnyTrue(
bool Val);
2335#ifdef __HLSL_ENABLE_16_BIT
2407#ifdef __HLSL_ENABLE_16_BIT
_Float16 __2f16 __attribute__((ext_vector_type(2)))
Zeroes the upper 128 bits (bits 255:128) of all YMM registers.
#define _HLSL_BUILTIN_ALIAS(builtin)
#define _HLSL_AVAILABILITY(platform, version)
#define _HLSL_16BIT_AVAILABILITY(environment, version)
constexpr enable_if_t< is_same< float, T >::value||is_same< half, T >::value, T > distance_impl(T X, T Y)
constexpr vector< uint, 4 > d3d_color_to_ubyte4_impl(vector< float, 4 > V)
constexpr enable_if_t< is_same< float, T >::value||is_same< half, T >::value, T > distance_vec_impl(vector< T, N > X, vector< T, N > Y)
constexpr enable_if_t< is_same< float, T >::value||is_same< half, T >::value, T > length_impl(T X)
constexpr enable_if_t< is_same< float, T >::value||is_same< half, T >::value, T > length_vec_impl(vector< T, N > X)
double asdouble(uint, uint)
Reinterprets a cast value (two 32-bit values) into a double.
half mad(half, half, half)
T select(bool, T, T)
ternary operator.
const uint countbits(int x)
vector< uint64_t, 2 > uint64_t2
half3 cross(half3, half3)
vector< float, 4 > float4
vector< int64_t, 4 > int64_t4
int dot4add_i8packed(uint, uint, int)
vector< uint64_t, 3 > uint64_t3
half lerp(half, half, half)
void GroupMemoryBarrierWithGroupSync(void)
Blocks execution of all threads in a group until all group shared accesses have been completed and al...
vector< int64_t, 3 > int64_t3
constexpr vector< uint, 4 > D3DCOLORtoUBYTE4(vector< float, 4 > V)
half clamp(half, half, half)
vector< uint64_t, 4 > uint64_t4
const half length(half X)
constexpr vector< uint, N > asuint(vector< T, N > V)
vector< double, 3 > double3
vector< float, 2 > float2
vector< float, 3 > float3
vector< int64_t, 2 > int64_t2
const half distance(half X, half Y)
vector< double, 4 > double4
vector< double, 2 > double2
uint dot4add_u8packed(uint, uint, uint)
constexpr vector< int, N > asint(vector< T, N > V)
constexpr vector< float, N > asfloat(vector< T, N > V)
unsigned int uint
An unsigned 32-bit integer.