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(environment, version) \ 22 __attribute__((availability(environment, introduced = version))) 23 24 //===----------------------------------------------------------------------===// 25 // abs builtins 26 //===----------------------------------------------------------------------===// 27 #ifdef __HLSL_ENABLE_16_BIT 28 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs) 29 int16_t abs(int16_t); 30 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs) 31 int16_t2 abs(int16_t2); 32 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs) 33 int16_t3 abs(int16_t3); 34 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs) 35 int16_t4 abs(int16_t4); 36 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs) 37 38 half abs(half); 39 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs) 40 half2 abs(half2); 41 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs) 42 half3 abs(half3); 43 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs) 44 half4 abs(half4); 45 #endif 46 47 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs) 48 int abs(int); 49 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs) 50 int2 abs(int2); 51 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs) 52 int3 abs(int3); 53 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs) 54 int4 abs(int4); 55 56 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs) 57 float abs(float); 58 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs) 59 float2 abs(float2); 60 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs) 61 float3 abs(float3); 62 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs) 63 float4 abs(float4); 64 65 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs) 66 int64_t abs(int64_t); 67 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs) 68 int64_t2 abs(int64_t2); 69 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs) 70 int64_t3 abs(int64_t3); 71 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs) 72 int64_t4 abs(int64_t4); 73 74 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs) 75 double abs(double); 76 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs) 77 double2 abs(double2); 78 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs) 79 double3 abs(double3); 80 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs) 81 double4 abs(double4); 82 83 //===----------------------------------------------------------------------===// 84 // ceil builtins 85 //===----------------------------------------------------------------------===// 86 #ifdef __HLSL_ENABLE_16_BIT 87 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_ceil) 88 half ceil(half); 89 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_ceil) 90 half2 ceil(half2); 91 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_ceil) 92 half3 ceil(half3); 93 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_ceil) 94 half4 ceil(half4); 95 #endif 96 97 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_ceil) 98 float ceil(float); 99 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_ceil) 100 float2 ceil(float2); 101 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_ceil) 102 float3 ceil(float3); 103 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_ceil) 104 float4 ceil(float4); 105 106 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_ceil) 107 double ceil(double); 108 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_ceil) 109 double2 ceil(double2); 110 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_ceil) 111 double3 ceil(double3); 112 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_ceil) 113 double4 ceil(double4); 114 115 //===----------------------------------------------------------------------===// 116 // cos builtins 117 //===----------------------------------------------------------------------===// 118 #ifdef __HLSL_ENABLE_16_BIT 119 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_cos) 120 half cos(half); 121 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_cos) 122 half2 cos(half2); 123 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_cos) 124 half3 cos(half3); 125 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_cos) 126 half4 cos(half4); 127 #endif 128 129 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_cos) 130 float cos(float); 131 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_cos) 132 float2 cos(float2); 133 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_cos) 134 float3 cos(float3); 135 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_cos) 136 float4 cos(float4); 137 138 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_cos) 139 double cos(double); 140 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_cos) 141 double2 cos(double2); 142 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_cos) 143 double3 cos(double3); 144 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_cos) 145 double4 cos(double4); 146 147 //===----------------------------------------------------------------------===// 148 // floor builtins 149 //===----------------------------------------------------------------------===// 150 #ifdef __HLSL_ENABLE_16_BIT 151 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_floor) 152 half floor(half); 153 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_floor) 154 half2 floor(half2); 155 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_floor) 156 half3 floor(half3); 157 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_floor) 158 half4 floor(half4); 159 #endif 160 161 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_floor) 162 float floor(float); 163 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_floor) 164 float2 floor(float2); 165 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_floor) 166 float3 floor(float3); 167 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_floor) 168 float4 floor(float4); 169 170 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_floor) 171 double floor(double); 172 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_floor) 173 double2 floor(double2); 174 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_floor) 175 double3 floor(double3); 176 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_floor) 177 double4 floor(double4); 178 179 //===----------------------------------------------------------------------===// 180 // log builtins 181 //===----------------------------------------------------------------------===// 182 #ifdef __HLSL_ENABLE_16_BIT 183 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_log) 184 half log(half); 185 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_log) 186 half2 log(half2); 187 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_log) 188 half3 log(half3); 189 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_log) 190 half4 log(half4); 191 #endif 192 193 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_log) 194 float log(float); 195 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_log) 196 float2 log(float2); 197 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_log) 198 float3 log(float3); 199 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_log) 200 float4 log(float4); 201 202 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_log) 203 double log(double); 204 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_log) 205 double2 log(double2); 206 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_log) 207 double3 log(double3); 208 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_log) 209 double4 log(double4); 210 211 //===----------------------------------------------------------------------===// 212 // log10 builtins 213 //===----------------------------------------------------------------------===// 214 #ifdef __HLSL_ENABLE_16_BIT 215 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_log10) 216 half log10(half); 217 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_log10) 218 half2 log10(half2); 219 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_log10) 220 half3 log10(half3); 221 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_log10) 222 half4 log10(half4); 223 #endif 224 225 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_log10) 226 float log10(float); 227 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_log10) 228 float2 log10(float2); 229 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_log10) 230 float3 log10(float3); 231 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_log10) 232 float4 log10(float4); 233 234 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_log10) 235 double log10(double); 236 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_log10) 237 double2 log10(double2); 238 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_log10) 239 double3 log10(double3); 240 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_log10) 241 double4 log10(double4); 242 243 //===----------------------------------------------------------------------===// 244 // log2 builtins 245 //===----------------------------------------------------------------------===// 246 #ifdef __HLSL_ENABLE_16_BIT 247 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_log2) 248 half log2(half); 249 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_log2) 250 half2 log2(half2); 251 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_log2) 252 half3 log2(half3); 253 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_log2) 254 half4 log2(half4); 255 #endif 256 257 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_log2) 258 float log2(float); 259 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_log2) 260 float2 log2(float2); 261 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_log2) 262 float3 log2(float3); 263 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_log2) 264 float4 log2(float4); 265 266 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_log2) 267 double log2(double); 268 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_log2) 269 double2 log2(double2); 270 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_log2) 271 double3 log2(double3); 272 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_log2) 273 double4 log2(double4); 274 275 //===----------------------------------------------------------------------===// 276 // max builtins 277 //===----------------------------------------------------------------------===// 278 #ifdef __HLSL_ENABLE_16_BIT 279 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 280 half max(half, half); 281 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 282 half2 max(half2, half2); 283 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 284 half3 max(half3, half3); 285 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 286 half4 max(half4, half4); 287 288 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 289 int16_t max(int16_t, int16_t); 290 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 291 int16_t2 max(int16_t2, int16_t2); 292 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 293 int16_t3 max(int16_t3, int16_t3); 294 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 295 int16_t4 max(int16_t4, int16_t4); 296 297 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 298 uint16_t max(uint16_t, uint16_t); 299 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 300 uint16_t2 max(uint16_t2, uint16_t2); 301 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 302 uint16_t3 max(uint16_t3, uint16_t3); 303 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 304 uint16_t4 max(uint16_t4, uint16_t4); 305 #endif 306 307 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 308 int max(int, int); 309 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 310 int2 max(int2, int2); 311 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 312 int3 max(int3, int3); 313 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 314 int4 max(int4, int4); 315 316 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 317 uint max(uint, uint); 318 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 319 uint2 max(uint2, uint2); 320 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 321 uint3 max(uint3, uint3); 322 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 323 uint4 max(uint4, uint4); 324 325 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 326 int64_t max(int64_t, int64_t); 327 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 328 int64_t2 max(int64_t2, int64_t2); 329 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 330 int64_t3 max(int64_t3, int64_t3); 331 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 332 int64_t4 max(int64_t4, int64_t4); 333 334 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 335 uint64_t max(uint64_t, uint64_t); 336 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 337 uint64_t2 max(uint64_t2, uint64_t2); 338 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 339 uint64_t3 max(uint64_t3, uint64_t3); 340 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 341 uint64_t4 max(uint64_t4, uint64_t4); 342 343 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 344 float max(float, float); 345 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 346 float2 max(float2, float2); 347 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 348 float3 max(float3, float3); 349 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 350 float4 max(float4, float4); 351 352 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 353 double max(double, double); 354 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 355 double2 max(double2, double2); 356 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 357 double3 max(double3, double3); 358 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) 359 double4 max(double4, double4); 360 361 //===----------------------------------------------------------------------===// 362 // min builtins 363 //===----------------------------------------------------------------------===// 364 #ifdef __HLSL_ENABLE_16_BIT 365 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 366 half min(half, half); 367 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 368 half2 min(half2, half2); 369 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 370 half3 min(half3, half3); 371 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 372 half4 min(half4, half4); 373 374 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 375 int16_t min(int16_t, int16_t); 376 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 377 int16_t2 min(int16_t2, int16_t2); 378 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 379 int16_t3 min(int16_t3, int16_t3); 380 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 381 int16_t4 min(int16_t4, int16_t4); 382 383 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 384 uint16_t min(uint16_t, uint16_t); 385 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 386 uint16_t2 min(uint16_t2, uint16_t2); 387 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 388 uint16_t3 min(uint16_t3, uint16_t3); 389 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 390 uint16_t4 min(uint16_t4, uint16_t4); 391 #endif 392 393 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 394 int min(int, int); 395 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 396 int2 min(int2, int2); 397 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 398 int3 min(int3, int3); 399 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 400 int4 min(int4, int4); 401 402 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 403 uint min(uint, uint); 404 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 405 uint2 min(uint2, uint2); 406 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 407 uint3 min(uint3, uint3); 408 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 409 uint4 min(uint4, uint4); 410 411 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 412 float min(float, float); 413 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 414 float2 min(float2, float2); 415 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 416 float3 min(float3, float3); 417 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 418 float4 min(float4, float4); 419 420 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 421 int64_t min(int64_t, int64_t); 422 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 423 int64_t2 min(int64_t2, int64_t2); 424 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 425 int64_t3 min(int64_t3, int64_t3); 426 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 427 int64_t4 min(int64_t4, int64_t4); 428 429 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 430 uint64_t min(uint64_t, uint64_t); 431 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 432 uint64_t2 min(uint64_t2, uint64_t2); 433 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 434 uint64_t3 min(uint64_t3, uint64_t3); 435 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 436 uint64_t4 min(uint64_t4, uint64_t4); 437 438 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 439 double min(double, double); 440 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 441 double2 min(double2, double2); 442 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 443 double3 min(double3, double3); 444 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_min) 445 double4 min(double4, double4); 446 447 //===----------------------------------------------------------------------===// 448 // pow builtins 449 //===----------------------------------------------------------------------===// 450 #ifdef __HLSL_ENABLE_16_BIT 451 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_pow) 452 half pow(half, half); 453 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_pow) 454 half2 pow(half2, half2); 455 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_pow) 456 half3 pow(half3, half3); 457 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_pow) 458 half4 pow(half4, half4); 459 #endif 460 461 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_pow) 462 float pow(float, float); 463 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_pow) 464 float2 pow(float2, float2); 465 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_pow) 466 float3 pow(float3, float3); 467 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_pow) 468 float4 pow(float4, float4); 469 470 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_pow) 471 double pow(double, double); 472 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_pow) 473 double2 pow(double2, double2); 474 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_pow) 475 double3 pow(double3, double3); 476 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_pow) 477 double4 pow(double4, double4); 478 479 //===----------------------------------------------------------------------===// 480 // reversebits builtins 481 //===----------------------------------------------------------------------===// 482 #ifdef __HLSL_ENABLE_16_BIT 483 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_bitreverse) 484 int16_t reversebits(int16_t); 485 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_bitreverse) 486 int16_t2 reversebits(int16_t2); 487 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_bitreverse) 488 int16_t3 reversebits(int16_t3); 489 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_bitreverse) 490 int16_t4 reversebits(int16_t4); 491 492 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_bitreverse) 493 uint16_t reversebits(uint16_t); 494 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_bitreverse) 495 uint16_t2 reversebits(uint16_t2); 496 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_bitreverse) 497 uint16_t3 reversebits(uint16_t3); 498 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_bitreverse) 499 uint16_t4 reversebits(uint16_t4); 500 #endif 501 502 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_bitreverse) 503 int reversebits(int); 504 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_bitreverse) 505 int2 reversebits(int2); 506 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_bitreverse) 507 int3 reversebits(int3); 508 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_bitreverse) 509 int4 reversebits(int4); 510 511 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_bitreverse) 512 uint reversebits(uint); 513 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_bitreverse) 514 uint2 reversebits(uint2); 515 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_bitreverse) 516 uint3 reversebits(uint3); 517 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_bitreverse) 518 uint4 reversebits(uint4); 519 520 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_bitreverse) 521 int64_t reversebits(int64_t); 522 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_bitreverse) 523 int64_t2 reversebits(int64_t2); 524 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_bitreverse) 525 int64_t3 reversebits(int64_t3); 526 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_bitreverse) 527 int64_t4 reversebits(int64_t4); 528 529 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_bitreverse) 530 uint64_t reversebits(uint64_t); 531 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_bitreverse) 532 uint64_t2 reversebits(uint64_t2); 533 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_bitreverse) 534 uint64_t3 reversebits(uint64_t3); 535 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_bitreverse) 536 uint64_t4 reversebits(uint64_t4); 537 538 //===----------------------------------------------------------------------===// 539 // sin builtins 540 //===----------------------------------------------------------------------===// 541 #ifdef __HLSL_ENABLE_16_BIT 542 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_sin) 543 half sin(half); 544 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_sin) 545 half2 sin(half2); 546 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_sin) 547 half3 sin(half3); 548 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_sin) 549 half4 sin(half4); 550 #endif 551 552 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_sin) 553 float sin(float); 554 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_sin) 555 float2 sin(float2); 556 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_sin) 557 float3 sin(float3); 558 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_sin) 559 float4 sin(float4); 560 561 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_sin) 562 double sin(double); 563 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_sin) 564 double2 sin(double2); 565 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_sin) 566 double3 sin(double3); 567 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_sin) 568 double4 sin(double4); 569 570 //===----------------------------------------------------------------------===// 571 // sqrt builtins 572 //===----------------------------------------------------------------------===// 573 #ifdef __HLSL_ENABLE_16_BIT 574 _HLSL_BUILTIN_ALIAS(__builtin_sqrtf16) 575 half sqrt(half In); 576 #endif 577 578 _HLSL_BUILTIN_ALIAS(__builtin_sqrtf) 579 float sqrt(float In); 580 581 _HLSL_BUILTIN_ALIAS(__builtin_sqrt) 582 double sqrt(double In); 583 584 //===----------------------------------------------------------------------===// 585 // trunc builtins 586 //===----------------------------------------------------------------------===// 587 #ifdef __HLSL_ENABLE_16_BIT 588 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_trunc) 589 half trunc(half); 590 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_trunc) 591 half2 trunc(half2); 592 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_trunc) 593 half3 trunc(half3); 594 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_trunc) 595 half4 trunc(half4); 596 #endif 597 598 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_trunc) 599 float trunc(float); 600 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_trunc) 601 float2 trunc(float2); 602 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_trunc) 603 float3 trunc(float3); 604 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_trunc) 605 float4 trunc(float4); 606 607 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_trunc) 608 double trunc(double); 609 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_trunc) 610 double2 trunc(double2); 611 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_trunc) 612 double3 trunc(double3); 613 _HLSL_BUILTIN_ALIAS(__builtin_elementwise_trunc) 614 double4 trunc(double4); 615 616 //===----------------------------------------------------------------------===// 617 // Wave* builtins 618 //===----------------------------------------------------------------------===// 619 _HLSL_AVAILABILITY(shadermodel, 6.0) 620 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_count_bits) 621 uint WaveActiveCountBits(bool bBit); 622 623 } // namespace hlsl 624 #endif //_HLSL_HLSL_INTRINSICS_H_ 625