1 //===----- hlsl_intrinsics.h - HLSL definitions for intrinsics ----------===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 #ifndef _HLSL_HLSL_INTRINSICS_H_ 10 #define _HLSL_HLSL_INTRINSICS_H_ 11 12 namespace hlsl { 13 14 // Note: Functions in this file are sorted alphabetically, then grouped by base 15 // element type, and the element types are sorted by size, then singed integer, 16 // unsigned integer and floating point. Keeping this ordering consistent will 17 // help keep this file manageable as it grows. 18 19 #define _HLSL_BUILTIN_ALIAS(builtin) \ 20 __attribute__((clang_builtin_alias(builtin))) 21 #define _HLSL_AVAILABILITY(platform, version) \ 22 __attribute__((availability(platform, introduced = version))) 23 #define _HLSL_AVAILABILITY_STAGE(platform, version, stage) \ 24 __attribute__(( \ 25 availability(platform, introduced = version, environment = stage))) 26 27 #ifdef __HLSL_ENABLE_16_BIT 28 #define _HLSL_16BIT_AVAILABILITY(platform, version) \ 29 __attribute__((availability(platform, introduced = version))) 30 #define _HLSL_16BIT_AVAILABILITY_STAGE(platform, version, stage) \ 31 __attribute__(( \ 32 availability(platform, introduced = version, environment = stage))) 33 #else 34 #define _HLSL_16BIT_AVAILABILITY(environment, version) 35 #define _HLSL_16BIT_AVAILABILITY_STAGE(environment, version, stage) 36 #endif 37 38 //===----------------------------------------------------------------------===// 39 // abs builtins 40 //===----------------------------------------------------------------------===// 41 42 /// \fn T abs(T Val) 43 /// \brief Returns the absolute value of the input value, \a Val. 44 /// \param Val The input value. 45 46 #ifdef __HLSL_ENABLE_16_BIT 47 _HLSL_AVAILABILITY(shadermodel, 6.2) 48 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs) 49 int16_t abs(int16_t); 50 _HLSL_AVAILABILITY(shadermodel, 6.2) 51 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs) 52 int16_t2 abs(int16_t2); 53 _HLSL_AVAILABILITY(shadermodel, 6.2) 54 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs) 55 int16_t3 abs(int16_t3); 56 _HLSL_AVAILABILITY(shadermodel, 6.2) 57 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs) 58 int16_t4 abs(int16_t4); 59 #endif 60 61 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 62 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs) 63 half abs(half); 64 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 65 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs) 66 half2 abs(half2); 67 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 68 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs) 69 half3 abs(half3); 70 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 71 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs) 72 half4 abs(half4); 73 74 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs) 75 int abs(int); 76 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs) 77 int2 abs(int2); 78 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs) 79 int3 abs(int3); 80 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs) 81 int4 abs(int4); 82 83 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs) 84 float abs(float); 85 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs) 86 float2 abs(float2); 87 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs) 88 float3 abs(float3); 89 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs) 90 float4 abs(float4); 91 92 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs) 93 int64_t abs(int64_t); 94 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs) 95 int64_t2 abs(int64_t2); 96 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs) 97 int64_t3 abs(int64_t3); 98 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs) 99 int64_t4 abs(int64_t4); 100 101 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs) 102 double abs(double); 103 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs) 104 double2 abs(double2); 105 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs) 106 double3 abs(double3); 107 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs) 108 double4 abs(double4); 109 110 //===----------------------------------------------------------------------===// 111 // acos builtins 112 //===----------------------------------------------------------------------===// 113 114 /// \fn T acos(T Val) 115 /// \brief Returns the arccosine of the input value, \a Val. 116 /// \param Val The input value. 117 118 #ifdef __HLSL_ENABLE_16_BIT 119 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_acos) 120 half acos(half); 121 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_acos) 122 half2 acos(half2); 123 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_acos) 124 half3 acos(half3); 125 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_acos) 126 half4 acos(half4); 127 #endif 128 129 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_acos) 130 float acos(float); 131 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_acos) 132 float2 acos(float2); 133 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_acos) 134 float3 acos(float3); 135 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_acos) 136 float4 acos(float4); 137 138 //===----------------------------------------------------------------------===// 139 // all builtins 140 //===----------------------------------------------------------------------===// 141 142 /// \fn bool all(T x) 143 /// \brief Returns True if all components of the \a x parameter are non-zero; 144 /// otherwise, false. \param x The input value. 145 146 #ifdef __HLSL_ENABLE_16_BIT 147 _HLSL_AVAILABILITY(shadermodel, 6.2) 148 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_all) 149 bool all(int16_t); 150 _HLSL_AVAILABILITY(shadermodel, 6.2) 151 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_all) 152 bool all(int16_t2); 153 _HLSL_AVAILABILITY(shadermodel, 6.2) 154 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_all) 155 bool all(int16_t3); 156 _HLSL_AVAILABILITY(shadermodel, 6.2) 157 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_all) 158 bool all(int16_t4); 159 _HLSL_AVAILABILITY(shadermodel, 6.2) 160 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_all) 161 bool all(uint16_t); 162 _HLSL_AVAILABILITY(shadermodel, 6.2) 163 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_all) 164 bool all(uint16_t2); 165 _HLSL_AVAILABILITY(shadermodel, 6.2) 166 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_all) 167 bool all(uint16_t3); 168 _HLSL_AVAILABILITY(shadermodel, 6.2) 169 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_all) 170 bool all(uint16_t4); 171 #endif 172 173 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 174 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_all) 175 bool all(half); 176 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 177 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_all) 178 bool all(half2); 179 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 180 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_all) 181 bool all(half3); 182 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 183 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_all) 184 bool all(half4); 185 186 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_all) 187 bool all(bool); 188 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_all) 189 bool all(bool2); 190 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_all) 191 bool all(bool3); 192 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_all) 193 bool all(bool4); 194 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_all) 195 196 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_all) 197 bool all(int); 198 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_all) 199 bool all(int2); 200 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_all) 201 bool all(int3); 202 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_all) 203 bool all(int4); 204 205 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_all) 206 bool all(uint); 207 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_all) 208 bool all(uint2); 209 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_all) 210 bool all(uint3); 211 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_all) 212 bool all(uint4); 213 214 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_all) 215 bool all(float); 216 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_all) 217 bool all(float2); 218 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_all) 219 bool all(float3); 220 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_all) 221 bool all(float4); 222 223 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_all) 224 bool all(int64_t); 225 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_all) 226 bool all(int64_t2); 227 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_all) 228 bool all(int64_t3); 229 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_all) 230 bool all(int64_t4); 231 232 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_all) 233 bool all(uint64_t); 234 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_all) 235 bool all(uint64_t2); 236 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_all) 237 bool all(uint64_t3); 238 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_all) 239 bool all(uint64_t4); 240 241 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_all) 242 bool all(double); 243 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_all) 244 bool all(double2); 245 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_all) 246 bool all(double3); 247 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_all) 248 bool all(double4); 249 250 //===----------------------------------------------------------------------===// 251 // any builtins 252 //===----------------------------------------------------------------------===// 253 254 /// \fn bool any(T x) 255 /// \brief Returns True if any components of the \a x parameter are non-zero; 256 /// otherwise, false. \param x The input value. 257 258 #ifdef __HLSL_ENABLE_16_BIT 259 _HLSL_AVAILABILITY(shadermodel, 6.2) 260 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_any) 261 bool any(int16_t); 262 _HLSL_AVAILABILITY(shadermodel, 6.2) 263 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_any) 264 bool any(int16_t2); 265 _HLSL_AVAILABILITY(shadermodel, 6.2) 266 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_any) 267 bool any(int16_t3); 268 _HLSL_AVAILABILITY(shadermodel, 6.2) 269 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_any) 270 bool any(int16_t4); 271 _HLSL_AVAILABILITY(shadermodel, 6.2) 272 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_any) 273 bool any(uint16_t); 274 _HLSL_AVAILABILITY(shadermodel, 6.2) 275 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_any) 276 bool any(uint16_t2); 277 _HLSL_AVAILABILITY(shadermodel, 6.2) 278 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_any) 279 bool any(uint16_t3); 280 _HLSL_AVAILABILITY(shadermodel, 6.2) 281 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_any) 282 bool any(uint16_t4); 283 #endif 284 285 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 286 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_any) 287 bool any(half); 288 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 289 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_any) 290 bool any(half2); 291 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 292 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_any) 293 bool any(half3); 294 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 295 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_any) 296 bool any(half4); 297 298 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_any) 299 bool any(bool); 300 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_any) 301 bool any(bool2); 302 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_any) 303 bool any(bool3); 304 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_any) 305 bool any(bool4); 306 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_any) 307 308 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_any) 309 bool any(int); 310 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_any) 311 bool any(int2); 312 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_any) 313 bool any(int3); 314 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_any) 315 bool any(int4); 316 317 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_any) 318 bool any(uint); 319 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_any) 320 bool any(uint2); 321 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_any) 322 bool any(uint3); 323 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_any) 324 bool any(uint4); 325 326 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_any) 327 bool any(float); 328 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_any) 329 bool any(float2); 330 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_any) 331 bool any(float3); 332 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_any) 333 bool any(float4); 334 335 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_any) 336 bool any(int64_t); 337 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_any) 338 bool any(int64_t2); 339 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_any) 340 bool any(int64_t3); 341 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_any) 342 bool any(int64_t4); 343 344 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_any) 345 bool any(uint64_t); 346 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_any) 347 bool any(uint64_t2); 348 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_any) 349 bool any(uint64_t3); 350 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_any) 351 bool any(uint64_t4); 352 353 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_any) 354 bool any(double); 355 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_any) 356 bool any(double2); 357 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_any) 358 bool any(double3); 359 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_any) 360 bool any(double4); 361 362 //===----------------------------------------------------------------------===// 363 // asin builtins 364 //===----------------------------------------------------------------------===// 365 366 /// \fn T asin(T Val) 367 /// \brief Returns the arcsine of the input value, \a Val. 368 /// \param Val The input value. 369 370 #ifdef __HLSL_ENABLE_16_BIT 371 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_asin) 372 half asin(half); 373 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_asin) 374 half2 asin(half2); 375 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_asin) 376 half3 asin(half3); 377 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_asin) 378 half4 asin(half4); 379 #endif 380 381 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_asin) 382 float asin(float); 383 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_asin) 384 float2 asin(float2); 385 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_asin) 386 float3 asin(float3); 387 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_asin) 388 float4 asin(float4); 389 390 //===----------------------------------------------------------------------===// 391 // atan builtins 392 //===----------------------------------------------------------------------===// 393 394 /// \fn T atan(T Val) 395 /// \brief Returns the arctangent of the input value, \a Val. 396 /// \param Val The input value. 397 398 #ifdef __HLSL_ENABLE_16_BIT 399 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_atan) 400 half atan(half); 401 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_atan) 402 half2 atan(half2); 403 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_atan) 404 half3 atan(half3); 405 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_atan) 406 half4 atan(half4); 407 #endif 408 409 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_atan) 410 float atan(float); 411 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_atan) 412 float2 atan(float2); 413 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_atan) 414 float3 atan(float3); 415 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_atan) 416 float4 atan(float4); 417 418 //===----------------------------------------------------------------------===// 419 // ceil builtins 420 //===----------------------------------------------------------------------===// 421 422 /// \fn T ceil(T Val) 423 /// \brief Returns the smallest integer value that is greater than or equal to 424 /// the input value, \a Val. 425 /// \param Val The input value. 426 427 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 428 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_ceil) 429 half ceil(half); 430 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 431 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_ceil) 432 half2 ceil(half2); 433 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 434 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_ceil) 435 half3 ceil(half3); 436 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 437 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_ceil) 438 half4 ceil(half4); 439 440 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_ceil) 441 float ceil(float); 442 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_ceil) 443 float2 ceil(float2); 444 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_ceil) 445 float3 ceil(float3); 446 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_ceil) 447 float4 ceil(float4); 448 449 //===----------------------------------------------------------------------===// 450 // clamp builtins 451 //===----------------------------------------------------------------------===// 452 453 /// \fn T clamp(T X, T Min, T Max) 454 /// \brief Clamps the specified value \a X to the specified 455 /// minimum ( \a Min) and maximum ( \a Max) range. 456 /// \param X A value to clamp. 457 /// \param Min The specified minimum range. 458 /// \param Max The specified maximum range. 459 /// 460 /// Returns The clamped value for the \a X parameter. 461 /// For values of -INF or INF, clamp will behave as expected. 462 /// However for values of NaN, the results are undefined. 463 464 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 465 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_clamp) 466 half clamp(half, half, half); 467 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 468 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_clamp) 469 half2 clamp(half2, half2, half2); 470 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 471 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_clamp) 472 half3 clamp(half3, half3, half3); 473 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 474 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_clamp) 475 half4 clamp(half4, half4, half4); 476 477 #ifdef __HLSL_ENABLE_16_BIT 478 _HLSL_AVAILABILITY(shadermodel, 6.2) 479 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_clamp) 480 int16_t clamp(int16_t, int16_t, int16_t); 481 _HLSL_AVAILABILITY(shadermodel, 6.2) 482 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_clamp) 483 int16_t2 clamp(int16_t2, int16_t2, int16_t2); 484 _HLSL_AVAILABILITY(shadermodel, 6.2) 485 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_clamp) 486 int16_t3 clamp(int16_t3, int16_t3, int16_t3); 487 _HLSL_AVAILABILITY(shadermodel, 6.2) 488 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_clamp) 489 int16_t4 clamp(int16_t4, int16_t4, int16_t4); 490 491 _HLSL_AVAILABILITY(shadermodel, 6.2) 492 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_clamp) 493 uint16_t clamp(uint16_t, uint16_t, uint16_t); 494 _HLSL_AVAILABILITY(shadermodel, 6.2) 495 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_clamp) 496 uint16_t2 clamp(uint16_t2, uint16_t2, uint16_t2); 497 _HLSL_AVAILABILITY(shadermodel, 6.2) 498 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_clamp) 499 uint16_t3 clamp(uint16_t3, uint16_t3, uint16_t3); 500 _HLSL_AVAILABILITY(shadermodel, 6.2) 501 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_clamp) 502 uint16_t4 clamp(uint16_t4, uint16_t4, uint16_t4); 503 #endif 504 505 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_clamp) 506 int clamp(int, int, int); 507 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_clamp) 508 int2 clamp(int2, int2, int2); 509 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_clamp) 510 int3 clamp(int3, int3, int3); 511 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_clamp) 512 int4 clamp(int4, int4, int4); 513 514 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_clamp) 515 uint clamp(uint, uint, uint); 516 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_clamp) 517 uint2 clamp(uint2, uint2, uint2); 518 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_clamp) 519 uint3 clamp(uint3, uint3, uint3); 520 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_clamp) 521 uint4 clamp(uint4, uint4, uint4); 522 523 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_clamp) 524 int64_t clamp(int64_t, int64_t, int64_t); 525 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_clamp) 526 int64_t2 clamp(int64_t2, int64_t2, int64_t2); 527 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_clamp) 528 int64_t3 clamp(int64_t3, int64_t3, int64_t3); 529 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_clamp) 530 int64_t4 clamp(int64_t4, int64_t4, int64_t4); 531 532 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_clamp) 533 uint64_t clamp(uint64_t, uint64_t, uint64_t); 534 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_clamp) 535 uint64_t2 clamp(uint64_t2, uint64_t2, uint64_t2); 536 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_clamp) 537 uint64_t3 clamp(uint64_t3, uint64_t3, uint64_t3); 538 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_clamp) 539 uint64_t4 clamp(uint64_t4, uint64_t4, uint64_t4); 540 541 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_clamp) 542 float clamp(float, float, float); 543 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_clamp) 544 float2 clamp(float2, float2, float2); 545 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_clamp) 546 float3 clamp(float3, float3, float3); 547 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_clamp) 548 float4 clamp(float4, float4, float4); 549 550 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_clamp) 551 double clamp(double, double, double); 552 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_clamp) 553 double2 clamp(double2, double2, double2); 554 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_clamp) 555 double3 clamp(double3, double3, double3); 556 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_clamp) 557 double4 clamp(double4, double4, double4); 558 559 //===----------------------------------------------------------------------===// 560 // cos builtins 561 //===----------------------------------------------------------------------===// 562 563 /// \fn T cos(T Val) 564 /// \brief Returns the cosine of the input value, \a Val. 565 /// \param Val The input value. 566 567 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 568 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_cos) 569 half cos(half); 570 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 571 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_cos) 572 half2 cos(half2); 573 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 574 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_cos) 575 half3 cos(half3); 576 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 577 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_cos) 578 half4 cos(half4); 579 580 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_cos) 581 float cos(float); 582 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_cos) 583 float2 cos(float2); 584 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_cos) 585 float3 cos(float3); 586 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_cos) 587 float4 cos(float4); 588 589 //===----------------------------------------------------------------------===// 590 // cosh builtins 591 //===----------------------------------------------------------------------===// 592 593 /// \fn T cosh(T Val) 594 /// \brief Returns the hyperbolic cosine of the input value, \a Val. 595 /// \param Val The input value. 596 597 #ifdef __HLSL_ENABLE_16_BIT 598 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_cosh) 599 half cosh(half); 600 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_cosh) 601 half2 cosh(half2); 602 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_cosh) 603 half3 cosh(half3); 604 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_cosh) 605 half4 cosh(half4); 606 #endif 607 608 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_cosh) 609 float cosh(float); 610 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_cosh) 611 float2 cosh(float2); 612 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_cosh) 613 float3 cosh(float3); 614 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_cosh) 615 float4 cosh(float4); 616 617 //===----------------------------------------------------------------------===// 618 // dot product builtins 619 //===----------------------------------------------------------------------===// 620 621 /// \fn K dot(T X, T Y) 622 /// \brief Return the dot product (a scalar value) of \a X and \a Y. 623 /// \param X The X input value. 624 /// \param Y The Y input value. 625 626 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 627 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_dot) 628 half dot(half, half); 629 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 630 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_dot) 631 half dot(half2, half2); 632 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 633 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_dot) 634 half dot(half3, half3); 635 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 636 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_dot) 637 half dot(half4, half4); 638 639 #ifdef __HLSL_ENABLE_16_BIT 640 _HLSL_AVAILABILITY(shadermodel, 6.2) 641 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_dot) 642 int16_t dot(int16_t, int16_t); 643 _HLSL_AVAILABILITY(shadermodel, 6.2) 644 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_dot) 645 int16_t dot(int16_t2, int16_t2); 646 _HLSL_AVAILABILITY(shadermodel, 6.2) 647 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_dot) 648 int16_t dot(int16_t3, int16_t3); 649 _HLSL_AVAILABILITY(shadermodel, 6.2) 650 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_dot) 651 int16_t dot(int16_t4, int16_t4); 652 653 _HLSL_AVAILABILITY(shadermodel, 6.2) 654 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_dot) 655 uint16_t dot(uint16_t, uint16_t); 656 _HLSL_AVAILABILITY(shadermodel, 6.2) 657 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_dot) 658 uint16_t dot(uint16_t2, uint16_t2); 659 _HLSL_AVAILABILITY(shadermodel, 6.2) 660 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_dot) 661 uint16_t dot(uint16_t3, uint16_t3); 662 _HLSL_AVAILABILITY(shadermodel, 6.2) 663 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_dot) 664 uint16_t dot(uint16_t4, uint16_t4); 665 #endif 666 667 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_dot) 668 float dot(float, float); 669 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_dot) 670 float dot(float2, float2); 671 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_dot) 672 float dot(float3, float3); 673 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_dot) 674 float dot(float4, float4); 675 676 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_dot) 677 double dot(double, double); 678 679 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_dot) 680 int dot(int, int); 681 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_dot) 682 int dot(int2, int2); 683 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_dot) 684 int dot(int3, int3); 685 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_dot) 686 int dot(int4, int4); 687 688 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_dot) 689 uint dot(uint, uint); 690 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_dot) 691 uint dot(uint2, uint2); 692 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_dot) 693 uint dot(uint3, uint3); 694 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_dot) 695 uint dot(uint4, uint4); 696 697 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_dot) 698 int64_t dot(int64_t, int64_t); 699 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_dot) 700 int64_t dot(int64_t2, int64_t2); 701 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_dot) 702 int64_t dot(int64_t3, int64_t3); 703 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_dot) 704 int64_t dot(int64_t4, int64_t4); 705 706 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_dot) 707 uint64_t dot(uint64_t, uint64_t); 708 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_dot) 709 uint64_t dot(uint64_t2, uint64_t2); 710 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_dot) 711 uint64_t dot(uint64_t3, uint64_t3); 712 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_dot) 713 uint64_t dot(uint64_t4, uint64_t4); 714 715 //===----------------------------------------------------------------------===// 716 // exp builtins 717 //===----------------------------------------------------------------------===// 718 719 /// \fn T exp(T x) 720 /// \brief Returns the base-e exponential, or \a e**x, of the specified value. 721 /// \param x The specified input value. 722 /// 723 /// The return value is the base-e exponential of the \a x parameter. 724 725 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 726 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_exp) 727 half exp(half); 728 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 729 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_exp) 730 half2 exp(half2); 731 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 732 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_exp) 733 half3 exp(half3); 734 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 735 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_exp) 736 half4 exp(half4); 737 738 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_exp) 739 float exp(float); 740 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_exp) 741 float2 exp(float2); 742 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_exp) 743 float3 exp(float3); 744 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_exp) 745 float4 exp(float4); 746 747 //===----------------------------------------------------------------------===// 748 // exp2 builtins 749 //===----------------------------------------------------------------------===// 750 751 /// \fn T exp2(T x) 752 /// \brief Returns the base 2 exponential, or \a 2**x, of the specified value. 753 /// \param x The specified input value. 754 /// 755 /// The base 2 exponential of the \a x parameter. 756 757 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 758 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_exp2) 759 half exp2(half); 760 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 761 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_exp2) 762 half2 exp2(half2); 763 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 764 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_exp2) 765 half3 exp2(half3); 766 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 767 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_exp2) 768 half4 exp2(half4); 769 770 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_exp2) 771 float exp2(float); 772 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_exp2) 773 float2 exp2(float2); 774 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_exp2) 775 float3 exp2(float3); 776 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_exp2) 777 float4 exp2(float4); 778 779 //===----------------------------------------------------------------------===// 780 // floor builtins 781 //===----------------------------------------------------------------------===// 782 783 /// \fn T floor(T Val) 784 /// \brief Returns the largest integer that is less than or equal to the input 785 /// value, \a Val. 786 /// \param Val The input value. 787 788 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 789 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_floor) 790 half floor(half); 791 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 792 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_floor) 793 half2 floor(half2); 794 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 795 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_floor) 796 half3 floor(half3); 797 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 798 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_floor) 799 half4 floor(half4); 800 801 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_floor) 802 float floor(float); 803 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_floor) 804 float2 floor(float2); 805 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_floor) 806 float3 floor(float3); 807 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_floor) 808 float4 floor(float4); 809 810 //===----------------------------------------------------------------------===// 811 // frac builtins 812 //===----------------------------------------------------------------------===// 813 814 /// \fn T frac(T x) 815 /// \brief Returns the fractional (or decimal) part of x. \a x parameter. 816 /// \param x The specified input value. 817 /// 818 /// If \a the return value is greater than or equal to 0 and less than 1. 819 820 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 821 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_frac) 822 half frac(half); 823 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 824 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_frac) 825 half2 frac(half2); 826 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 827 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_frac) 828 half3 frac(half3); 829 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 830 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_frac) 831 half4 frac(half4); 832 833 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_frac) 834 float frac(float); 835 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_frac) 836 float2 frac(float2); 837 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_frac) 838 float3 frac(float3); 839 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_frac) 840 float4 frac(float4); 841 842 //===----------------------------------------------------------------------===// 843 // isinf builtins 844 //===----------------------------------------------------------------------===// 845 846 /// \fn T isinf(T x) 847 /// \brief Determines if the specified value \a x is infinite. 848 /// \param x The specified input value. 849 /// 850 /// Returns a value of the same size as the input, with a value set 851 /// to True if the x parameter is +INF or -INF. Otherwise, False. 852 853 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 854 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_isinf) 855 bool isinf(half); 856 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 857 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_isinf) 858 bool2 isinf(half2); 859 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 860 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_isinf) 861 bool3 isinf(half3); 862 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 863 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_isinf) 864 bool4 isinf(half4); 865 866 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_isinf) 867 bool isinf(float); 868 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_isinf) 869 bool2 isinf(float2); 870 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_isinf) 871 bool3 isinf(float3); 872 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_isinf) 873 bool4 isinf(float4); 874 875 //===----------------------------------------------------------------------===// 876 // lerp builtins 877 //===----------------------------------------------------------------------===// 878 879 /// \fn T lerp(T x, T y, T s) 880 /// \brief Returns the linear interpolation of x to y by s. 881 /// \param x [in] The first-floating point value. 882 /// \param y [in] The second-floating point value. 883 /// \param s [in] A value that linearly interpolates between the x parameter and 884 /// the y parameter. 885 /// 886 /// Linear interpolation is based on the following formula: x*(1-s) + y*s which 887 /// can equivalently be written as x + s(y-x). 888 889 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 890 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_lerp) 891 half lerp(half, half, half); 892 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 893 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_lerp) 894 half2 lerp(half2, half2, half2); 895 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 896 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_lerp) 897 half3 lerp(half3, half3, half3); 898 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 899 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_lerp) 900 half4 lerp(half4, half4, half4); 901 902 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_lerp) 903 float lerp(float, float, float); 904 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_lerp) 905 float2 lerp(float2, float2, float2); 906 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_lerp) 907 float3 lerp(float3, float3, float3); 908 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_lerp) 909 float4 lerp(float4, float4, float4); 910 911 //===----------------------------------------------------------------------===// 912 // log builtins 913 //===----------------------------------------------------------------------===// 914 915 /// \fn T log(T Val) 916 /// \brief The base-e logarithm of the input value, \a Val parameter. 917 /// \param Val The input value. 918 /// 919 /// If \a Val is negative, this result is undefined. If \a Val is 0, this 920 /// function returns negative infinity. 921 922 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 923 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_log) 924 half log(half); 925 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 926 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_log) 927 half2 log(half2); 928 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 929 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_log) 930 half3 log(half3); 931 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 932 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_log) 933 half4 log(half4); 934 935 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_log) 936 float log(float); 937 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_log) 938 float2 log(float2); 939 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_log) 940 float3 log(float3); 941 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_log) 942 float4 log(float4); 943 944 //===----------------------------------------------------------------------===// 945 // log10 builtins 946 //===----------------------------------------------------------------------===// 947 948 /// \fn T log10(T Val) 949 /// \brief The base-10 logarithm of the input value, \a Val parameter. 950 /// \param Val The input value. 951 /// 952 /// If \a Val is negative, this result is undefined. If \a Val is 0, this 953 /// function returns negative infinity. 954 955 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 956 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_log10) 957 half log10(half); 958 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 959 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_log10) 960 half2 log10(half2); 961 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 962 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_log10) 963 half3 log10(half3); 964 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 965 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_log10) 966 half4 log10(half4); 967 968 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_log10) 969 float log10(float); 970 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_log10) 971 float2 log10(float2); 972 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_log10) 973 float3 log10(float3); 974 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_log10) 975 float4 log10(float4); 976 977 //===----------------------------------------------------------------------===// 978 // log2 builtins 979 //===----------------------------------------------------------------------===// 980 981 /// \fn T log2(T Val) 982 /// \brief The base-2 logarithm of the input value, \a Val parameter. 983 /// \param Val The input value. 984 /// 985 /// If \a Val is negative, this result is undefined. If \a Val is 0, this 986 /// function returns negative infinity. 987 988 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 989 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_log2) 990 half log2(half); 991 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 992 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_log2) 993 half2 log2(half2); 994 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 995 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_log2) 996 half3 log2(half3); 997 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 998 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_log2) 999 half4 log2(half4); 1000 1001 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_log2) 1002 float log2(float); 1003 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_log2) 1004 float2 log2(float2); 1005 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_log2) 1006 float3 log2(float3); 1007 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_log2) 1008 float4 log2(float4); 1009 1010 //===----------------------------------------------------------------------===// 1011 // mad builtins 1012 //===----------------------------------------------------------------------===// 1013 1014 /// \fn T mad(T M, T A, T B) 1015 /// \brief The result of \a M * \a A + \a B. 1016 /// \param M The multiplication value. 1017 /// \param A The first addition value. 1018 /// \param B The second addition value. 1019 1020 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 1021 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad) 1022 half mad(half, half, half); 1023 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 1024 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad) 1025 half2 mad(half2, half2, half2); 1026 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 1027 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad) 1028 half3 mad(half3, half3, half3); 1029 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 1030 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad) 1031 half4 mad(half4, half4, half4); 1032 1033 #ifdef __HLSL_ENABLE_16_BIT 1034 _HLSL_AVAILABILITY(shadermodel, 6.2) 1035 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad) 1036 int16_t mad(int16_t, int16_t, int16_t); 1037 _HLSL_AVAILABILITY(shadermodel, 6.2) 1038 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad) 1039 int16_t2 mad(int16_t2, int16_t2, int16_t2); 1040 _HLSL_AVAILABILITY(shadermodel, 6.2) 1041 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad) 1042 int16_t3 mad(int16_t3, int16_t3, int16_t3); 1043 _HLSL_AVAILABILITY(shadermodel, 6.2) 1044 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad) 1045 int16_t4 mad(int16_t4, int16_t4, int16_t4); 1046 1047 _HLSL_AVAILABILITY(shadermodel, 6.2) 1048 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad) 1049 uint16_t mad(uint16_t, uint16_t, uint16_t); 1050 _HLSL_AVAILABILITY(shadermodel, 6.2) 1051 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad) 1052 uint16_t2 mad(uint16_t2, uint16_t2, uint16_t2); 1053 _HLSL_AVAILABILITY(shadermodel, 6.2) 1054 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad) 1055 uint16_t3 mad(uint16_t3, uint16_t3, uint16_t3); 1056 _HLSL_AVAILABILITY(shadermodel, 6.2) 1057 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad) 1058 uint16_t4 mad(uint16_t4, uint16_t4, uint16_t4); 1059 #endif 1060 1061 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad) 1062 int mad(int, int, int); 1063 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad) 1064 int2 mad(int2, int2, int2); 1065 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad) 1066 int3 mad(int3, int3, int3); 1067 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad) 1068 int4 mad(int4, int4, int4); 1069 1070 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad) 1071 uint mad(uint, uint, uint); 1072 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad) 1073 uint2 mad(uint2, uint2, uint2); 1074 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad) 1075 uint3 mad(uint3, uint3, uint3); 1076 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad) 1077 uint4 mad(uint4, uint4, uint4); 1078 1079 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad) 1080 int64_t mad(int64_t, int64_t, int64_t); 1081 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad) 1082 int64_t2 mad(int64_t2, int64_t2, int64_t2); 1083 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad) 1084 int64_t3 mad(int64_t3, int64_t3, int64_t3); 1085 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad) 1086 int64_t4 mad(int64_t4, int64_t4, int64_t4); 1087 1088 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad) 1089 uint64_t mad(uint64_t, uint64_t, uint64_t); 1090 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad) 1091 uint64_t2 mad(uint64_t2, uint64_t2, uint64_t2); 1092 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad) 1093 uint64_t3 mad(uint64_t3, uint64_t3, uint64_t3); 1094 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad) 1095 uint64_t4 mad(uint64_t4, uint64_t4, uint64_t4); 1096 1097 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad) 1098 float mad(float, float, float); 1099 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad) 1100 float2 mad(float2, float2, float2); 1101 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad) 1102 float3 mad(float3, float3, float3); 1103 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad) 1104 float4 mad(float4, float4, float4); 1105 1106 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad) 1107 double mad(double, double, double); 1108 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad) 1109 double2 mad(double2, double2, double2); 1110 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad) 1111 double3 mad(double3, double3, double3); 1112 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad) 1113 double4 mad(double4, double4, double4); 1114 1115 //===----------------------------------------------------------------------===// 1116 // max builtins 1117 //===----------------------------------------------------------------------===// 1118 1119 /// \fn T max(T X, T Y) 1120 /// \brief Return the greater of \a X and \a Y. 1121 /// \param X The X input value. 1122 /// \param Y The Y input value. 1123 1124 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 1125 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 1126 half max(half, half); 1127 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 1128 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 1129 half2 max(half2, half2); 1130 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 1131 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 1132 half3 max(half3, half3); 1133 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 1134 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 1135 half4 max(half4, half4); 1136 1137 #ifdef __HLSL_ENABLE_16_BIT 1138 _HLSL_AVAILABILITY(shadermodel, 6.2) 1139 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 1140 int16_t max(int16_t, int16_t); 1141 _HLSL_AVAILABILITY(shadermodel, 6.2) 1142 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 1143 int16_t2 max(int16_t2, int16_t2); 1144 _HLSL_AVAILABILITY(shadermodel, 6.2) 1145 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 1146 int16_t3 max(int16_t3, int16_t3); 1147 _HLSL_AVAILABILITY(shadermodel, 6.2) 1148 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 1149 int16_t4 max(int16_t4, int16_t4); 1150 1151 _HLSL_AVAILABILITY(shadermodel, 6.2) 1152 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 1153 uint16_t max(uint16_t, uint16_t); 1154 _HLSL_AVAILABILITY(shadermodel, 6.2) 1155 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 1156 uint16_t2 max(uint16_t2, uint16_t2); 1157 _HLSL_AVAILABILITY(shadermodel, 6.2) 1158 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 1159 uint16_t3 max(uint16_t3, uint16_t3); 1160 _HLSL_AVAILABILITY(shadermodel, 6.2) 1161 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 1162 uint16_t4 max(uint16_t4, uint16_t4); 1163 #endif 1164 1165 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 1166 int max(int, int); 1167 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 1168 int2 max(int2, int2); 1169 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 1170 int3 max(int3, int3); 1171 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 1172 int4 max(int4, int4); 1173 1174 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 1175 uint max(uint, uint); 1176 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 1177 uint2 max(uint2, uint2); 1178 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 1179 uint3 max(uint3, uint3); 1180 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 1181 uint4 max(uint4, uint4); 1182 1183 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 1184 int64_t max(int64_t, int64_t); 1185 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 1186 int64_t2 max(int64_t2, int64_t2); 1187 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 1188 int64_t3 max(int64_t3, int64_t3); 1189 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 1190 int64_t4 max(int64_t4, int64_t4); 1191 1192 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 1193 uint64_t max(uint64_t, uint64_t); 1194 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 1195 uint64_t2 max(uint64_t2, uint64_t2); 1196 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 1197 uint64_t3 max(uint64_t3, uint64_t3); 1198 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 1199 uint64_t4 max(uint64_t4, uint64_t4); 1200 1201 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 1202 float max(float, float); 1203 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 1204 float2 max(float2, float2); 1205 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 1206 float3 max(float3, float3); 1207 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 1208 float4 max(float4, float4); 1209 1210 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 1211 double max(double, double); 1212 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 1213 double2 max(double2, double2); 1214 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 1215 double3 max(double3, double3); 1216 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 1217 double4 max(double4, double4); 1218 1219 //===----------------------------------------------------------------------===// 1220 // min builtins 1221 //===----------------------------------------------------------------------===// 1222 1223 /// \fn T min(T X, T Y) 1224 /// \brief Return the lesser of \a X and \a Y. 1225 /// \param X The X input value. 1226 /// \param Y The Y input value. 1227 1228 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 1229 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 1230 half min(half, half); 1231 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 1232 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 1233 half2 min(half2, half2); 1234 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 1235 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 1236 half3 min(half3, half3); 1237 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 1238 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 1239 half4 min(half4, half4); 1240 1241 #ifdef __HLSL_ENABLE_16_BIT 1242 _HLSL_AVAILABILITY(shadermodel, 6.2) 1243 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 1244 int16_t min(int16_t, int16_t); 1245 _HLSL_AVAILABILITY(shadermodel, 6.2) 1246 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 1247 int16_t2 min(int16_t2, int16_t2); 1248 _HLSL_AVAILABILITY(shadermodel, 6.2) 1249 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 1250 int16_t3 min(int16_t3, int16_t3); 1251 _HLSL_AVAILABILITY(shadermodel, 6.2) 1252 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 1253 int16_t4 min(int16_t4, int16_t4); 1254 1255 _HLSL_AVAILABILITY(shadermodel, 6.2) 1256 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 1257 uint16_t min(uint16_t, uint16_t); 1258 _HLSL_AVAILABILITY(shadermodel, 6.2) 1259 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 1260 uint16_t2 min(uint16_t2, uint16_t2); 1261 _HLSL_AVAILABILITY(shadermodel, 6.2) 1262 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 1263 uint16_t3 min(uint16_t3, uint16_t3); 1264 _HLSL_AVAILABILITY(shadermodel, 6.2) 1265 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 1266 uint16_t4 min(uint16_t4, uint16_t4); 1267 #endif 1268 1269 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 1270 int min(int, int); 1271 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 1272 int2 min(int2, int2); 1273 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 1274 int3 min(int3, int3); 1275 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 1276 int4 min(int4, int4); 1277 1278 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 1279 uint min(uint, uint); 1280 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 1281 uint2 min(uint2, uint2); 1282 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 1283 uint3 min(uint3, uint3); 1284 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 1285 uint4 min(uint4, uint4); 1286 1287 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 1288 float min(float, float); 1289 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 1290 float2 min(float2, float2); 1291 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 1292 float3 min(float3, float3); 1293 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 1294 float4 min(float4, float4); 1295 1296 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 1297 int64_t min(int64_t, int64_t); 1298 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 1299 int64_t2 min(int64_t2, int64_t2); 1300 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 1301 int64_t3 min(int64_t3, int64_t3); 1302 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 1303 int64_t4 min(int64_t4, int64_t4); 1304 1305 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 1306 uint64_t min(uint64_t, uint64_t); 1307 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 1308 uint64_t2 min(uint64_t2, uint64_t2); 1309 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 1310 uint64_t3 min(uint64_t3, uint64_t3); 1311 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 1312 uint64_t4 min(uint64_t4, uint64_t4); 1313 1314 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 1315 double min(double, double); 1316 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 1317 double2 min(double2, double2); 1318 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 1319 double3 min(double3, double3); 1320 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 1321 double4 min(double4, double4); 1322 1323 //===----------------------------------------------------------------------===// 1324 // pow builtins 1325 //===----------------------------------------------------------------------===// 1326 1327 /// \fn T pow(T Val, T Pow) 1328 /// \brief Return the value \a Val, raised to the power \a Pow. 1329 /// \param Val The input value. 1330 /// \param Pow The specified power. 1331 1332 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 1333 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_pow) 1334 half pow(half, half); 1335 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 1336 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_pow) 1337 half2 pow(half2, half2); 1338 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 1339 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_pow) 1340 half3 pow(half3, half3); 1341 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 1342 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_pow) 1343 half4 pow(half4, half4); 1344 1345 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_pow) 1346 float pow(float, float); 1347 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_pow) 1348 float2 pow(float2, float2); 1349 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_pow) 1350 float3 pow(float3, float3); 1351 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_pow) 1352 float4 pow(float4, float4); 1353 1354 //===----------------------------------------------------------------------===// 1355 // reversebits builtins 1356 //===----------------------------------------------------------------------===// 1357 1358 /// \fn T reversebits(T Val) 1359 /// \brief Return the value \a Val with the bit order reversed. 1360 /// \param Val The input value. 1361 1362 #ifdef __HLSL_ENABLE_16_BIT 1363 _HLSL_AVAILABILITY(shadermodel, 6.2) 1364 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_bitreverse) 1365 uint16_t reversebits(uint16_t); 1366 _HLSL_AVAILABILITY(shadermodel, 6.2) 1367 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_bitreverse) 1368 uint16_t2 reversebits(uint16_t2); 1369 _HLSL_AVAILABILITY(shadermodel, 6.2) 1370 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_bitreverse) 1371 uint16_t3 reversebits(uint16_t3); 1372 _HLSL_AVAILABILITY(shadermodel, 6.2) 1373 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_bitreverse) 1374 uint16_t4 reversebits(uint16_t4); 1375 #endif 1376 1377 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_bitreverse) 1378 uint reversebits(uint); 1379 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_bitreverse) 1380 uint2 reversebits(uint2); 1381 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_bitreverse) 1382 uint3 reversebits(uint3); 1383 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_bitreverse) 1384 uint4 reversebits(uint4); 1385 1386 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_bitreverse) 1387 uint64_t reversebits(uint64_t); 1388 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_bitreverse) 1389 uint64_t2 reversebits(uint64_t2); 1390 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_bitreverse) 1391 uint64_t3 reversebits(uint64_t3); 1392 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_bitreverse) 1393 uint64_t4 reversebits(uint64_t4); 1394 1395 //===----------------------------------------------------------------------===// 1396 // rcp builtins 1397 //===----------------------------------------------------------------------===// 1398 1399 /// \fn T rcp(T x) 1400 /// \brief Calculates a fast, approximate, per-component reciprocal ie 1 / \a x. 1401 /// \param x The specified input value. 1402 /// 1403 /// The return value is the reciprocal of the \a x parameter. 1404 1405 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 1406 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_rcp) 1407 half rcp(half); 1408 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 1409 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_rcp) 1410 half2 rcp(half2); 1411 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 1412 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_rcp) 1413 half3 rcp(half3); 1414 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 1415 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_rcp) 1416 half4 rcp(half4); 1417 1418 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_rcp) 1419 float rcp(float); 1420 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_rcp) 1421 float2 rcp(float2); 1422 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_rcp) 1423 float3 rcp(float3); 1424 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_rcp) 1425 float4 rcp(float4); 1426 1427 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_rcp) 1428 double rcp(double); 1429 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_rcp) 1430 double2 rcp(double2); 1431 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_rcp) 1432 double3 rcp(double3); 1433 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_rcp) 1434 double4 rcp(double4); 1435 1436 //===----------------------------------------------------------------------===// 1437 // rsqrt builtins 1438 //===----------------------------------------------------------------------===// 1439 1440 /// \fn T rsqrt(T x) 1441 /// \brief Returns the reciprocal of the square root of the specified value. 1442 /// ie 1 / sqrt( \a x). 1443 /// \param x The specified input value. 1444 /// 1445 /// This function uses the following formula: 1 / sqrt(x). 1446 1447 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 1448 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_rsqrt) 1449 half rsqrt(half); 1450 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 1451 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_rsqrt) 1452 half2 rsqrt(half2); 1453 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 1454 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_rsqrt) 1455 half3 rsqrt(half3); 1456 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 1457 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_rsqrt) 1458 half4 rsqrt(half4); 1459 1460 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_rsqrt) 1461 float rsqrt(float); 1462 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_rsqrt) 1463 float2 rsqrt(float2); 1464 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_rsqrt) 1465 float3 rsqrt(float3); 1466 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_rsqrt) 1467 float4 rsqrt(float4); 1468 1469 //===----------------------------------------------------------------------===// 1470 // round builtins 1471 //===----------------------------------------------------------------------===// 1472 1473 /// \fn T round(T x) 1474 /// \brief Rounds the specified value \a x to the nearest integer. 1475 /// \param x The specified input value. 1476 /// 1477 /// The return value is the \a x parameter, rounded to the nearest integer 1478 /// within a floating-point type. Halfway cases are 1479 /// rounded to the nearest even value. 1480 1481 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 1482 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_roundeven) 1483 half round(half); 1484 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 1485 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_roundeven) 1486 half2 round(half2); 1487 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 1488 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_roundeven) 1489 half3 round(half3); 1490 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 1491 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_roundeven) 1492 half4 round(half4); 1493 1494 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_roundeven) 1495 float round(float); 1496 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_roundeven) 1497 float2 round(float2); 1498 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_roundeven) 1499 float3 round(float3); 1500 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_roundeven) 1501 float4 round(float4); 1502 1503 //===----------------------------------------------------------------------===// 1504 // sin builtins 1505 //===----------------------------------------------------------------------===// 1506 1507 /// \fn T sin(T Val) 1508 /// \brief Returns the sine of the input value, \a Val. 1509 /// \param Val The input value. 1510 1511 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 1512 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_sin) 1513 half sin(half); 1514 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 1515 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_sin) 1516 half2 sin(half2); 1517 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 1518 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_sin) 1519 half3 sin(half3); 1520 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 1521 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_sin) 1522 half4 sin(half4); 1523 1524 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_sin) 1525 float sin(float); 1526 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_sin) 1527 float2 sin(float2); 1528 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_sin) 1529 float3 sin(float3); 1530 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_sin) 1531 float4 sin(float4); 1532 1533 //===----------------------------------------------------------------------===// 1534 // sinh builtins 1535 //===----------------------------------------------------------------------===// 1536 1537 /// \fn T sinh(T Val) 1538 /// \brief Returns the hyperbolic sine of the input value, \a Val. 1539 /// \param Val The input value. 1540 1541 #ifdef __HLSL_ENABLE_16_BIT 1542 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_sinh) 1543 half sinh(half); 1544 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_sinh) 1545 half2 sinh(half2); 1546 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_sinh) 1547 half3 sinh(half3); 1548 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_sinh) 1549 half4 sinh(half4); 1550 #endif 1551 1552 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_sinh) 1553 float sinh(float); 1554 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_sinh) 1555 float2 sinh(float2); 1556 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_sinh) 1557 float3 sinh(float3); 1558 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_sinh) 1559 float4 sinh(float4); 1560 1561 //===----------------------------------------------------------------------===// 1562 // sqrt builtins 1563 //===----------------------------------------------------------------------===// 1564 1565 /// \fn T sqrt(T Val) 1566 /// \brief Returns the square root of the input value, \a Val. 1567 /// \param Val The input value. 1568 1569 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 1570 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_sqrt) 1571 half sqrt(half); 1572 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 1573 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_sqrt) 1574 half2 sqrt(half2); 1575 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 1576 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_sqrt) 1577 half3 sqrt(half3); 1578 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 1579 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_sqrt) 1580 half4 sqrt(half4); 1581 1582 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_sqrt) 1583 float sqrt(float); 1584 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_sqrt) 1585 float2 sqrt(float2); 1586 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_sqrt) 1587 float3 sqrt(float3); 1588 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_sqrt) 1589 float4 sqrt(float4); 1590 1591 //===----------------------------------------------------------------------===// 1592 // tan builtins 1593 //===----------------------------------------------------------------------===// 1594 1595 /// \fn T tan(T Val) 1596 /// \brief Returns the tangent of the input value, \a Val. 1597 /// \param Val The input value. 1598 1599 #ifdef __HLSL_ENABLE_16_BIT 1600 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_tan) 1601 half tan(half); 1602 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_tan) 1603 half2 tan(half2); 1604 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_tan) 1605 half3 tan(half3); 1606 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_tan) 1607 half4 tan(half4); 1608 #endif 1609 1610 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_tan) 1611 float tan(float); 1612 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_tan) 1613 float2 tan(float2); 1614 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_tan) 1615 float3 tan(float3); 1616 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_tan) 1617 float4 tan(float4); 1618 1619 //===----------------------------------------------------------------------===// 1620 // tanh builtins 1621 //===----------------------------------------------------------------------===// 1622 1623 /// \fn T tanh(T Val) 1624 /// \brief Returns the hyperbolic tangent of the input value, \a Val. 1625 /// \param Val The input value. 1626 1627 #ifdef __HLSL_ENABLE_16_BIT 1628 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_tanh) 1629 half tanh(half); 1630 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_tanh) 1631 half2 tanh(half2); 1632 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_tanh) 1633 half3 tanh(half3); 1634 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_tanh) 1635 half4 tanh(half4); 1636 #endif 1637 1638 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_tanh) 1639 float tanh(float); 1640 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_tanh) 1641 float2 tanh(float2); 1642 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_tanh) 1643 float3 tanh(float3); 1644 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_tanh) 1645 float4 tanh(float4); 1646 1647 //===----------------------------------------------------------------------===// 1648 // trunc builtins 1649 //===----------------------------------------------------------------------===// 1650 1651 /// \fn T trunc(T Val) 1652 /// \brief Returns the truncated integer value of the input value, \a Val. 1653 /// \param Val The input value. 1654 1655 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 1656 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_trunc) 1657 half trunc(half); 1658 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 1659 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_trunc) 1660 half2 trunc(half2); 1661 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 1662 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_trunc) 1663 half3 trunc(half3); 1664 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) 1665 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_trunc) 1666 half4 trunc(half4); 1667 1668 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_trunc) 1669 float trunc(float); 1670 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_trunc) 1671 float2 trunc(float2); 1672 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_trunc) 1673 float3 trunc(float3); 1674 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_trunc) 1675 float4 trunc(float4); 1676 1677 //===----------------------------------------------------------------------===// 1678 // Wave* builtins 1679 //===----------------------------------------------------------------------===// 1680 1681 /// \brief Counts the number of boolean variables which evaluate to true across 1682 /// all active lanes in the current wave. 1683 /// 1684 /// \param Val The input boolean value. 1685 /// \return The number of lanes for which the boolean variable evaluates to 1686 /// true, across all active lanes in the current wave. 1687 _HLSL_AVAILABILITY(shadermodel, 6.0) 1688 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_count_bits) 1689 __attribute__((convergent)) uint WaveActiveCountBits(bool Val); 1690 1691 /// \brief Returns the index of the current lane within the current wave. 1692 _HLSL_AVAILABILITY(shadermodel, 6.0) 1693 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_get_lane_index) 1694 __attribute__((convergent)) uint WaveGetLaneIndex(); 1695 1696 } // namespace hlsl 1697 #endif //_HLSL_HLSL_INTRINSICS_H_ 1698