clang 20.0.0git
hlsl_intrinsics.h
Go to the documentation of this file.
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
12namespace 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)
49int16_t abs(int16_t);
50_HLSL_AVAILABILITY(shadermodel, 6.2)
51_HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs)
52int16_t2 abs(int16_t2);
53_HLSL_AVAILABILITY(shadermodel, 6.2)
54_HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs)
55int16_t3 abs(int16_t3);
56_HLSL_AVAILABILITY(shadermodel, 6.2)
57_HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs)
58int16_t4 abs(int16_t4);
59#endif
60
61_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
62_HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs)
63half abs(half);
64_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
65_HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs)
67_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
68_HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs)
70_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
71_HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs)
73
74_HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs)
75int abs(int);
76_HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs)
78_HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs)
80_HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs)
82
83_HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs)
84float abs(float);
85_HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs)
87_HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs)
89_HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs)
91
92_HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs)
94_HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs)
96_HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs)
98_HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs)
100
101_HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs)
102double abs(double);
103_HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs)
105_HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs)
107_HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs)
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)
120half acos(half);
121_HLSL_BUILTIN_ALIAS(__builtin_elementwise_acos)
123_HLSL_BUILTIN_ALIAS(__builtin_elementwise_acos)
125_HLSL_BUILTIN_ALIAS(__builtin_elementwise_acos)
127#endif
128
129_HLSL_BUILTIN_ALIAS(__builtin_elementwise_acos)
130float acos(float);
131_HLSL_BUILTIN_ALIAS(__builtin_elementwise_acos)
133_HLSL_BUILTIN_ALIAS(__builtin_elementwise_acos)
135_HLSL_BUILTIN_ALIAS(__builtin_elementwise_acos)
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_all)
149bool all(int16_t);
150_HLSL_AVAILABILITY(shadermodel, 6.2)
151_HLSL_BUILTIN_ALIAS(__builtin_hlsl_all)
152bool all(int16_t2);
153_HLSL_AVAILABILITY(shadermodel, 6.2)
154_HLSL_BUILTIN_ALIAS(__builtin_hlsl_all)
155bool all(int16_t3);
156_HLSL_AVAILABILITY(shadermodel, 6.2)
157_HLSL_BUILTIN_ALIAS(__builtin_hlsl_all)
158bool all(int16_t4);
159_HLSL_AVAILABILITY(shadermodel, 6.2)
160_HLSL_BUILTIN_ALIAS(__builtin_hlsl_all)
161bool all(uint16_t);
162_HLSL_AVAILABILITY(shadermodel, 6.2)
163_HLSL_BUILTIN_ALIAS(__builtin_hlsl_all)
164bool all(uint16_t2);
165_HLSL_AVAILABILITY(shadermodel, 6.2)
166_HLSL_BUILTIN_ALIAS(__builtin_hlsl_all)
167bool all(uint16_t3);
168_HLSL_AVAILABILITY(shadermodel, 6.2)
169_HLSL_BUILTIN_ALIAS(__builtin_hlsl_all)
170bool all(uint16_t4);
171#endif
172
173_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
174_HLSL_BUILTIN_ALIAS(__builtin_hlsl_all)
175bool all(half);
176_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
177_HLSL_BUILTIN_ALIAS(__builtin_hlsl_all)
178bool all(half2);
179_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
180_HLSL_BUILTIN_ALIAS(__builtin_hlsl_all)
181bool all(half3);
182_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
183_HLSL_BUILTIN_ALIAS(__builtin_hlsl_all)
184bool all(half4);
185
186_HLSL_BUILTIN_ALIAS(__builtin_hlsl_all)
187bool all(bool);
188_HLSL_BUILTIN_ALIAS(__builtin_hlsl_all)
189bool all(bool2);
190_HLSL_BUILTIN_ALIAS(__builtin_hlsl_all)
191bool all(bool3);
192_HLSL_BUILTIN_ALIAS(__builtin_hlsl_all)
193bool all(bool4);
194_HLSL_BUILTIN_ALIAS(__builtin_hlsl_all)
195
196_HLSL_BUILTIN_ALIAS(__builtin_hlsl_all)
197bool all(int);
198_HLSL_BUILTIN_ALIAS(__builtin_hlsl_all)
199bool all(int2);
200_HLSL_BUILTIN_ALIAS(__builtin_hlsl_all)
201bool all(int3);
202_HLSL_BUILTIN_ALIAS(__builtin_hlsl_all)
203bool all(int4);
204
205_HLSL_BUILTIN_ALIAS(__builtin_hlsl_all)
206bool all(uint);
207_HLSL_BUILTIN_ALIAS(__builtin_hlsl_all)
208bool all(uint2);
209_HLSL_BUILTIN_ALIAS(__builtin_hlsl_all)
210bool all(uint3);
211_HLSL_BUILTIN_ALIAS(__builtin_hlsl_all)
212bool all(uint4);
213
214_HLSL_BUILTIN_ALIAS(__builtin_hlsl_all)
215bool all(float);
216_HLSL_BUILTIN_ALIAS(__builtin_hlsl_all)
218_HLSL_BUILTIN_ALIAS(__builtin_hlsl_all)
220_HLSL_BUILTIN_ALIAS(__builtin_hlsl_all)
222
223_HLSL_BUILTIN_ALIAS(__builtin_hlsl_all)
225_HLSL_BUILTIN_ALIAS(__builtin_hlsl_all)
227_HLSL_BUILTIN_ALIAS(__builtin_hlsl_all)
229_HLSL_BUILTIN_ALIAS(__builtin_hlsl_all)
231
232_HLSL_BUILTIN_ALIAS(__builtin_hlsl_all)
234_HLSL_BUILTIN_ALIAS(__builtin_hlsl_all)
236_HLSL_BUILTIN_ALIAS(__builtin_hlsl_all)
238_HLSL_BUILTIN_ALIAS(__builtin_hlsl_all)
240
241_HLSL_BUILTIN_ALIAS(__builtin_hlsl_all)
242bool all(double);
243_HLSL_BUILTIN_ALIAS(__builtin_hlsl_all)
245_HLSL_BUILTIN_ALIAS(__builtin_hlsl_all)
247_HLSL_BUILTIN_ALIAS(__builtin_hlsl_all)
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_any)
261bool any(int16_t);
262_HLSL_AVAILABILITY(shadermodel, 6.2)
263_HLSL_BUILTIN_ALIAS(__builtin_hlsl_any)
264bool any(int16_t2);
265_HLSL_AVAILABILITY(shadermodel, 6.2)
266_HLSL_BUILTIN_ALIAS(__builtin_hlsl_any)
267bool any(int16_t3);
268_HLSL_AVAILABILITY(shadermodel, 6.2)
269_HLSL_BUILTIN_ALIAS(__builtin_hlsl_any)
270bool any(int16_t4);
271_HLSL_AVAILABILITY(shadermodel, 6.2)
272_HLSL_BUILTIN_ALIAS(__builtin_hlsl_any)
273bool any(uint16_t);
274_HLSL_AVAILABILITY(shadermodel, 6.2)
275_HLSL_BUILTIN_ALIAS(__builtin_hlsl_any)
276bool any(uint16_t2);
277_HLSL_AVAILABILITY(shadermodel, 6.2)
278_HLSL_BUILTIN_ALIAS(__builtin_hlsl_any)
279bool any(uint16_t3);
280_HLSL_AVAILABILITY(shadermodel, 6.2)
281_HLSL_BUILTIN_ALIAS(__builtin_hlsl_any)
282bool any(uint16_t4);
283#endif
284
285_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
286_HLSL_BUILTIN_ALIAS(__builtin_hlsl_any)
287bool any(half);
288_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
289_HLSL_BUILTIN_ALIAS(__builtin_hlsl_any)
290bool any(half2);
291_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
292_HLSL_BUILTIN_ALIAS(__builtin_hlsl_any)
293bool any(half3);
294_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
295_HLSL_BUILTIN_ALIAS(__builtin_hlsl_any)
296bool any(half4);
297
298_HLSL_BUILTIN_ALIAS(__builtin_hlsl_any)
299bool any(bool);
300_HLSL_BUILTIN_ALIAS(__builtin_hlsl_any)
301bool any(bool2);
302_HLSL_BUILTIN_ALIAS(__builtin_hlsl_any)
303bool any(bool3);
304_HLSL_BUILTIN_ALIAS(__builtin_hlsl_any)
305bool any(bool4);
306_HLSL_BUILTIN_ALIAS(__builtin_hlsl_any)
307
308_HLSL_BUILTIN_ALIAS(__builtin_hlsl_any)
309bool any(int);
310_HLSL_BUILTIN_ALIAS(__builtin_hlsl_any)
311bool any(int2);
312_HLSL_BUILTIN_ALIAS(__builtin_hlsl_any)
313bool any(int3);
314_HLSL_BUILTIN_ALIAS(__builtin_hlsl_any)
315bool any(int4);
316
317_HLSL_BUILTIN_ALIAS(__builtin_hlsl_any)
318bool any(uint);
319_HLSL_BUILTIN_ALIAS(__builtin_hlsl_any)
320bool any(uint2);
321_HLSL_BUILTIN_ALIAS(__builtin_hlsl_any)
322bool any(uint3);
323_HLSL_BUILTIN_ALIAS(__builtin_hlsl_any)
324bool any(uint4);
325
326_HLSL_BUILTIN_ALIAS(__builtin_hlsl_any)
327bool any(float);
328_HLSL_BUILTIN_ALIAS(__builtin_hlsl_any)
330_HLSL_BUILTIN_ALIAS(__builtin_hlsl_any)
332_HLSL_BUILTIN_ALIAS(__builtin_hlsl_any)
334
335_HLSL_BUILTIN_ALIAS(__builtin_hlsl_any)
337_HLSL_BUILTIN_ALIAS(__builtin_hlsl_any)
339_HLSL_BUILTIN_ALIAS(__builtin_hlsl_any)
341_HLSL_BUILTIN_ALIAS(__builtin_hlsl_any)
343
344_HLSL_BUILTIN_ALIAS(__builtin_hlsl_any)
346_HLSL_BUILTIN_ALIAS(__builtin_hlsl_any)
348_HLSL_BUILTIN_ALIAS(__builtin_hlsl_any)
350_HLSL_BUILTIN_ALIAS(__builtin_hlsl_any)
352
353_HLSL_BUILTIN_ALIAS(__builtin_hlsl_any)
354bool any(double);
355_HLSL_BUILTIN_ALIAS(__builtin_hlsl_any)
357_HLSL_BUILTIN_ALIAS(__builtin_hlsl_any)
359_HLSL_BUILTIN_ALIAS(__builtin_hlsl_any)
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)
372half asin(half);
373_HLSL_BUILTIN_ALIAS(__builtin_elementwise_asin)
375_HLSL_BUILTIN_ALIAS(__builtin_elementwise_asin)
377_HLSL_BUILTIN_ALIAS(__builtin_elementwise_asin)
379#endif
380
381_HLSL_BUILTIN_ALIAS(__builtin_elementwise_asin)
382float asin(float);
383_HLSL_BUILTIN_ALIAS(__builtin_elementwise_asin)
385_HLSL_BUILTIN_ALIAS(__builtin_elementwise_asin)
387_HLSL_BUILTIN_ALIAS(__builtin_elementwise_asin)
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)
400half atan(half);
401_HLSL_BUILTIN_ALIAS(__builtin_elementwise_atan)
403_HLSL_BUILTIN_ALIAS(__builtin_elementwise_atan)
405_HLSL_BUILTIN_ALIAS(__builtin_elementwise_atan)
407#endif
408
409_HLSL_BUILTIN_ALIAS(__builtin_elementwise_atan)
410float atan(float);
411_HLSL_BUILTIN_ALIAS(__builtin_elementwise_atan)
413_HLSL_BUILTIN_ALIAS(__builtin_elementwise_atan)
415_HLSL_BUILTIN_ALIAS(__builtin_elementwise_atan)
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)
429half ceil(half);
430_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
431_HLSL_BUILTIN_ALIAS(__builtin_elementwise_ceil)
433_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
434_HLSL_BUILTIN_ALIAS(__builtin_elementwise_ceil)
436_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
437_HLSL_BUILTIN_ALIAS(__builtin_elementwise_ceil)
439
440_HLSL_BUILTIN_ALIAS(__builtin_elementwise_ceil)
441float ceil(float);
442_HLSL_BUILTIN_ALIAS(__builtin_elementwise_ceil)
444_HLSL_BUILTIN_ALIAS(__builtin_elementwise_ceil)
446_HLSL_BUILTIN_ALIAS(__builtin_elementwise_ceil)
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)
466half clamp(half, half, half);
467_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
468_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_clamp)
470_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
471_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_clamp)
473_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
474_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_clamp)
476
477#ifdef __HLSL_ENABLE_16_BIT
478_HLSL_AVAILABILITY(shadermodel, 6.2)
479_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_clamp)
480int16_t clamp(int16_t, int16_t, int16_t);
481_HLSL_AVAILABILITY(shadermodel, 6.2)
482_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_clamp)
483int16_t2 clamp(int16_t2, int16_t2, int16_t2);
484_HLSL_AVAILABILITY(shadermodel, 6.2)
485_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_clamp)
486int16_t3 clamp(int16_t3, int16_t3, int16_t3);
487_HLSL_AVAILABILITY(shadermodel, 6.2)
488_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_clamp)
489int16_t4 clamp(int16_t4, int16_t4, int16_t4);
490
491_HLSL_AVAILABILITY(shadermodel, 6.2)
492_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_clamp)
493uint16_t clamp(uint16_t, uint16_t, uint16_t);
494_HLSL_AVAILABILITY(shadermodel, 6.2)
495_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_clamp)
496uint16_t2 clamp(uint16_t2, uint16_t2, uint16_t2);
497_HLSL_AVAILABILITY(shadermodel, 6.2)
498_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_clamp)
499uint16_t3 clamp(uint16_t3, uint16_t3, uint16_t3);
500_HLSL_AVAILABILITY(shadermodel, 6.2)
501_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_clamp)
502uint16_t4 clamp(uint16_t4, uint16_t4, uint16_t4);
503#endif
504
505_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_clamp)
506int clamp(int, int, int);
507_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_clamp)
509_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_clamp)
511_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_clamp)
513
514_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_clamp)
516_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_clamp)
518_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_clamp)
520_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_clamp)
522
523_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_clamp)
525_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_clamp)
527_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_clamp)
529_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_clamp)
531
532_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_clamp)
534_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_clamp)
536_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_clamp)
538_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_clamp)
540
541_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_clamp)
542float clamp(float, float, float);
543_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_clamp)
545_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_clamp)
547_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_clamp)
549
550_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_clamp)
551double clamp(double, double, double);
552_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_clamp)
554_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_clamp)
556_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_clamp)
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)
569half cos(half);
570_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
571_HLSL_BUILTIN_ALIAS(__builtin_elementwise_cos)
573_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
574_HLSL_BUILTIN_ALIAS(__builtin_elementwise_cos)
576_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
577_HLSL_BUILTIN_ALIAS(__builtin_elementwise_cos)
579
580_HLSL_BUILTIN_ALIAS(__builtin_elementwise_cos)
581float cos(float);
582_HLSL_BUILTIN_ALIAS(__builtin_elementwise_cos)
584_HLSL_BUILTIN_ALIAS(__builtin_elementwise_cos)
586_HLSL_BUILTIN_ALIAS(__builtin_elementwise_cos)
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)
599half cosh(half);
600_HLSL_BUILTIN_ALIAS(__builtin_elementwise_cosh)
602_HLSL_BUILTIN_ALIAS(__builtin_elementwise_cosh)
604_HLSL_BUILTIN_ALIAS(__builtin_elementwise_cosh)
606#endif
607
608_HLSL_BUILTIN_ALIAS(__builtin_elementwise_cosh)
609float cosh(float);
610_HLSL_BUILTIN_ALIAS(__builtin_elementwise_cosh)
612_HLSL_BUILTIN_ALIAS(__builtin_elementwise_cosh)
614_HLSL_BUILTIN_ALIAS(__builtin_elementwise_cosh)
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)
628half dot(half, half);
629_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
630_HLSL_BUILTIN_ALIAS(__builtin_hlsl_dot)
632_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
633_HLSL_BUILTIN_ALIAS(__builtin_hlsl_dot)
635_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
636_HLSL_BUILTIN_ALIAS(__builtin_hlsl_dot)
638
639#ifdef __HLSL_ENABLE_16_BIT
640_HLSL_AVAILABILITY(shadermodel, 6.2)
641_HLSL_BUILTIN_ALIAS(__builtin_hlsl_dot)
642int16_t dot(int16_t, int16_t);
643_HLSL_AVAILABILITY(shadermodel, 6.2)
644_HLSL_BUILTIN_ALIAS(__builtin_hlsl_dot)
645int16_t dot(int16_t2, int16_t2);
646_HLSL_AVAILABILITY(shadermodel, 6.2)
647_HLSL_BUILTIN_ALIAS(__builtin_hlsl_dot)
648int16_t dot(int16_t3, int16_t3);
649_HLSL_AVAILABILITY(shadermodel, 6.2)
650_HLSL_BUILTIN_ALIAS(__builtin_hlsl_dot)
651int16_t dot(int16_t4, int16_t4);
652
653_HLSL_AVAILABILITY(shadermodel, 6.2)
654_HLSL_BUILTIN_ALIAS(__builtin_hlsl_dot)
655uint16_t dot(uint16_t, uint16_t);
656_HLSL_AVAILABILITY(shadermodel, 6.2)
657_HLSL_BUILTIN_ALIAS(__builtin_hlsl_dot)
658uint16_t dot(uint16_t2, uint16_t2);
659_HLSL_AVAILABILITY(shadermodel, 6.2)
660_HLSL_BUILTIN_ALIAS(__builtin_hlsl_dot)
661uint16_t dot(uint16_t3, uint16_t3);
662_HLSL_AVAILABILITY(shadermodel, 6.2)
663_HLSL_BUILTIN_ALIAS(__builtin_hlsl_dot)
664uint16_t dot(uint16_t4, uint16_t4);
665#endif
666
667_HLSL_BUILTIN_ALIAS(__builtin_hlsl_dot)
668float dot(float, float);
669_HLSL_BUILTIN_ALIAS(__builtin_hlsl_dot)
671_HLSL_BUILTIN_ALIAS(__builtin_hlsl_dot)
673_HLSL_BUILTIN_ALIAS(__builtin_hlsl_dot)
675
676_HLSL_BUILTIN_ALIAS(__builtin_hlsl_dot)
677double dot(double, double);
678
679_HLSL_BUILTIN_ALIAS(__builtin_hlsl_dot)
680int dot(int, int);
681_HLSL_BUILTIN_ALIAS(__builtin_hlsl_dot)
683_HLSL_BUILTIN_ALIAS(__builtin_hlsl_dot)
685_HLSL_BUILTIN_ALIAS(__builtin_hlsl_dot)
687
688_HLSL_BUILTIN_ALIAS(__builtin_hlsl_dot)
690_HLSL_BUILTIN_ALIAS(__builtin_hlsl_dot)
692_HLSL_BUILTIN_ALIAS(__builtin_hlsl_dot)
694_HLSL_BUILTIN_ALIAS(__builtin_hlsl_dot)
696
697_HLSL_BUILTIN_ALIAS(__builtin_hlsl_dot)
699_HLSL_BUILTIN_ALIAS(__builtin_hlsl_dot)
701_HLSL_BUILTIN_ALIAS(__builtin_hlsl_dot)
703_HLSL_BUILTIN_ALIAS(__builtin_hlsl_dot)
705
706_HLSL_BUILTIN_ALIAS(__builtin_hlsl_dot)
708_HLSL_BUILTIN_ALIAS(__builtin_hlsl_dot)
710_HLSL_BUILTIN_ALIAS(__builtin_hlsl_dot)
712_HLSL_BUILTIN_ALIAS(__builtin_hlsl_dot)
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)
727half exp(half);
728_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
729_HLSL_BUILTIN_ALIAS(__builtin_elementwise_exp)
731_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
732_HLSL_BUILTIN_ALIAS(__builtin_elementwise_exp)
734_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
735_HLSL_BUILTIN_ALIAS(__builtin_elementwise_exp)
737
738_HLSL_BUILTIN_ALIAS(__builtin_elementwise_exp)
739float exp(float);
740_HLSL_BUILTIN_ALIAS(__builtin_elementwise_exp)
742_HLSL_BUILTIN_ALIAS(__builtin_elementwise_exp)
744_HLSL_BUILTIN_ALIAS(__builtin_elementwise_exp)
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)
759half exp2(half);
760_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
761_HLSL_BUILTIN_ALIAS(__builtin_elementwise_exp2)
763_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
764_HLSL_BUILTIN_ALIAS(__builtin_elementwise_exp2)
766_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
767_HLSL_BUILTIN_ALIAS(__builtin_elementwise_exp2)
769
770_HLSL_BUILTIN_ALIAS(__builtin_elementwise_exp2)
771float exp2(float);
772_HLSL_BUILTIN_ALIAS(__builtin_elementwise_exp2)
774_HLSL_BUILTIN_ALIAS(__builtin_elementwise_exp2)
776_HLSL_BUILTIN_ALIAS(__builtin_elementwise_exp2)
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)
790half floor(half);
791_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
792_HLSL_BUILTIN_ALIAS(__builtin_elementwise_floor)
794_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
795_HLSL_BUILTIN_ALIAS(__builtin_elementwise_floor)
797_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
798_HLSL_BUILTIN_ALIAS(__builtin_elementwise_floor)
800
801_HLSL_BUILTIN_ALIAS(__builtin_elementwise_floor)
802float floor(float);
803_HLSL_BUILTIN_ALIAS(__builtin_elementwise_floor)
805_HLSL_BUILTIN_ALIAS(__builtin_elementwise_floor)
807_HLSL_BUILTIN_ALIAS(__builtin_elementwise_floor)
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)
822half frac(half);
823_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
824_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_frac)
826_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
827_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_frac)
829_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
830_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_frac)
832
833_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_frac)
834float frac(float);
835_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_frac)
837_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_frac)
839_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_frac)
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)
855bool isinf(half);
856_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
857_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_isinf)
859_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
860_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_isinf)
862_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
863_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_isinf)
865
866_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_isinf)
867bool isinf(float);
868_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_isinf)
870_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_isinf)
872_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_isinf)
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)
891half lerp(half, half, half);
892_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
893_HLSL_BUILTIN_ALIAS(__builtin_hlsl_lerp)
895_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
896_HLSL_BUILTIN_ALIAS(__builtin_hlsl_lerp)
898_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
899_HLSL_BUILTIN_ALIAS(__builtin_hlsl_lerp)
901
902_HLSL_BUILTIN_ALIAS(__builtin_hlsl_lerp)
903float lerp(float, float, float);
904_HLSL_BUILTIN_ALIAS(__builtin_hlsl_lerp)
906_HLSL_BUILTIN_ALIAS(__builtin_hlsl_lerp)
908_HLSL_BUILTIN_ALIAS(__builtin_hlsl_lerp)
910
911//===----------------------------------------------------------------------===//
912// length builtins
913//===----------------------------------------------------------------------===//
914
915/// \fn T length(T x)
916/// \brief Returns the length of the specified floating-point vector.
917/// \param x [in] The vector of floats, or a scalar float.
918///
919/// Length is based on the following formula: sqrt(x[0]^2 + x[1]^2 + ...).
920
921_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
922_HLSL_BUILTIN_ALIAS(__builtin_hlsl_length)
923half length(half);
924_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
925_HLSL_BUILTIN_ALIAS(__builtin_hlsl_length)
927_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
928_HLSL_BUILTIN_ALIAS(__builtin_hlsl_length)
930_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
931_HLSL_BUILTIN_ALIAS(__builtin_hlsl_length)
933
934_HLSL_BUILTIN_ALIAS(__builtin_hlsl_length)
935float length(float);
936_HLSL_BUILTIN_ALIAS(__builtin_hlsl_length)
938_HLSL_BUILTIN_ALIAS(__builtin_hlsl_length)
940_HLSL_BUILTIN_ALIAS(__builtin_hlsl_length)
942
943//===----------------------------------------------------------------------===//
944// log builtins
945//===----------------------------------------------------------------------===//
946
947/// \fn T log(T Val)
948/// \brief The base-e logarithm of the input value, \a Val parameter.
949/// \param Val The input value.
950///
951/// If \a Val is negative, this result is undefined. If \a Val is 0, this
952/// function returns negative infinity.
953
954_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
955_HLSL_BUILTIN_ALIAS(__builtin_elementwise_log)
956half log(half);
957_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
958_HLSL_BUILTIN_ALIAS(__builtin_elementwise_log)
960_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
961_HLSL_BUILTIN_ALIAS(__builtin_elementwise_log)
963_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
964_HLSL_BUILTIN_ALIAS(__builtin_elementwise_log)
966
967_HLSL_BUILTIN_ALIAS(__builtin_elementwise_log)
968float log(float);
969_HLSL_BUILTIN_ALIAS(__builtin_elementwise_log)
971_HLSL_BUILTIN_ALIAS(__builtin_elementwise_log)
973_HLSL_BUILTIN_ALIAS(__builtin_elementwise_log)
975
976//===----------------------------------------------------------------------===//
977// log10 builtins
978//===----------------------------------------------------------------------===//
979
980/// \fn T log10(T Val)
981/// \brief The base-10 logarithm of the input value, \a Val parameter.
982/// \param Val The input value.
983///
984/// If \a Val is negative, this result is undefined. If \a Val is 0, this
985/// function returns negative infinity.
986
987_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
988_HLSL_BUILTIN_ALIAS(__builtin_elementwise_log10)
989half log10(half);
990_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
991_HLSL_BUILTIN_ALIAS(__builtin_elementwise_log10)
993_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
994_HLSL_BUILTIN_ALIAS(__builtin_elementwise_log10)
996_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
997_HLSL_BUILTIN_ALIAS(__builtin_elementwise_log10)
999
1000_HLSL_BUILTIN_ALIAS(__builtin_elementwise_log10)
1001float log10(float);
1002_HLSL_BUILTIN_ALIAS(__builtin_elementwise_log10)
1004_HLSL_BUILTIN_ALIAS(__builtin_elementwise_log10)
1006_HLSL_BUILTIN_ALIAS(__builtin_elementwise_log10)
1008
1009//===----------------------------------------------------------------------===//
1010// log2 builtins
1011//===----------------------------------------------------------------------===//
1012
1013/// \fn T log2(T Val)
1014/// \brief The base-2 logarithm of the input value, \a Val parameter.
1015/// \param Val The input value.
1016///
1017/// If \a Val is negative, this result is undefined. If \a Val is 0, this
1018/// function returns negative infinity.
1019
1020_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
1021_HLSL_BUILTIN_ALIAS(__builtin_elementwise_log2)
1022half log2(half);
1023_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
1024_HLSL_BUILTIN_ALIAS(__builtin_elementwise_log2)
1026_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
1027_HLSL_BUILTIN_ALIAS(__builtin_elementwise_log2)
1029_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
1030_HLSL_BUILTIN_ALIAS(__builtin_elementwise_log2)
1032
1033_HLSL_BUILTIN_ALIAS(__builtin_elementwise_log2)
1034float log2(float);
1035_HLSL_BUILTIN_ALIAS(__builtin_elementwise_log2)
1037_HLSL_BUILTIN_ALIAS(__builtin_elementwise_log2)
1039_HLSL_BUILTIN_ALIAS(__builtin_elementwise_log2)
1041
1042//===----------------------------------------------------------------------===//
1043// mad builtins
1044//===----------------------------------------------------------------------===//
1045
1046/// \fn T mad(T M, T A, T B)
1047/// \brief The result of \a M * \a A + \a B.
1048/// \param M The multiplication value.
1049/// \param A The first addition value.
1050/// \param B The second addition value.
1051
1052_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
1053_HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad)
1054half mad(half, half, half);
1055_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
1056_HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad)
1058_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
1059_HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad)
1061_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
1062_HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad)
1064
1065#ifdef __HLSL_ENABLE_16_BIT
1066_HLSL_AVAILABILITY(shadermodel, 6.2)
1067_HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad)
1068int16_t mad(int16_t, int16_t, int16_t);
1069_HLSL_AVAILABILITY(shadermodel, 6.2)
1070_HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad)
1071int16_t2 mad(int16_t2, int16_t2, int16_t2);
1072_HLSL_AVAILABILITY(shadermodel, 6.2)
1073_HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad)
1074int16_t3 mad(int16_t3, int16_t3, int16_t3);
1075_HLSL_AVAILABILITY(shadermodel, 6.2)
1076_HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad)
1077int16_t4 mad(int16_t4, int16_t4, int16_t4);
1078
1079_HLSL_AVAILABILITY(shadermodel, 6.2)
1080_HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad)
1081uint16_t mad(uint16_t, uint16_t, uint16_t);
1082_HLSL_AVAILABILITY(shadermodel, 6.2)
1083_HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad)
1084uint16_t2 mad(uint16_t2, uint16_t2, uint16_t2);
1085_HLSL_AVAILABILITY(shadermodel, 6.2)
1086_HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad)
1087uint16_t3 mad(uint16_t3, uint16_t3, uint16_t3);
1088_HLSL_AVAILABILITY(shadermodel, 6.2)
1089_HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad)
1090uint16_t4 mad(uint16_t4, uint16_t4, uint16_t4);
1091#endif
1092
1093_HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad)
1094int mad(int, int, int);
1095_HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad)
1097_HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad)
1099_HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad)
1101
1102_HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad)
1104_HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad)
1106_HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad)
1108_HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad)
1110
1111_HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad)
1113_HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad)
1115_HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad)
1117_HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad)
1119
1120_HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad)
1122_HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad)
1124_HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad)
1126_HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad)
1128
1129_HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad)
1130float mad(float, float, float);
1131_HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad)
1133_HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad)
1135_HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad)
1137
1138_HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad)
1139double mad(double, double, double);
1140_HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad)
1142_HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad)
1144_HLSL_BUILTIN_ALIAS(__builtin_hlsl_mad)
1146
1147//===----------------------------------------------------------------------===//
1148// max builtins
1149//===----------------------------------------------------------------------===//
1150
1151/// \fn T max(T X, T Y)
1152/// \brief Return the greater of \a X and \a Y.
1153/// \param X The X input value.
1154/// \param Y The Y input value.
1155
1156_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
1157_HLSL_BUILTIN_ALIAS(__builtin_elementwise_max)
1158half max(half, half);
1159_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
1160_HLSL_BUILTIN_ALIAS(__builtin_elementwise_max)
1162_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
1163_HLSL_BUILTIN_ALIAS(__builtin_elementwise_max)
1165_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
1166_HLSL_BUILTIN_ALIAS(__builtin_elementwise_max)
1168
1169#ifdef __HLSL_ENABLE_16_BIT
1170_HLSL_AVAILABILITY(shadermodel, 6.2)
1171_HLSL_BUILTIN_ALIAS(__builtin_elementwise_max)
1172int16_t max(int16_t, int16_t);
1173_HLSL_AVAILABILITY(shadermodel, 6.2)
1174_HLSL_BUILTIN_ALIAS(__builtin_elementwise_max)
1175int16_t2 max(int16_t2, int16_t2);
1176_HLSL_AVAILABILITY(shadermodel, 6.2)
1177_HLSL_BUILTIN_ALIAS(__builtin_elementwise_max)
1178int16_t3 max(int16_t3, int16_t3);
1179_HLSL_AVAILABILITY(shadermodel, 6.2)
1180_HLSL_BUILTIN_ALIAS(__builtin_elementwise_max)
1181int16_t4 max(int16_t4, int16_t4);
1182
1183_HLSL_AVAILABILITY(shadermodel, 6.2)
1184_HLSL_BUILTIN_ALIAS(__builtin_elementwise_max)
1185uint16_t max(uint16_t, uint16_t);
1186_HLSL_AVAILABILITY(shadermodel, 6.2)
1187_HLSL_BUILTIN_ALIAS(__builtin_elementwise_max)
1188uint16_t2 max(uint16_t2, uint16_t2);
1189_HLSL_AVAILABILITY(shadermodel, 6.2)
1190_HLSL_BUILTIN_ALIAS(__builtin_elementwise_max)
1191uint16_t3 max(uint16_t3, uint16_t3);
1192_HLSL_AVAILABILITY(shadermodel, 6.2)
1193_HLSL_BUILTIN_ALIAS(__builtin_elementwise_max)
1194uint16_t4 max(uint16_t4, uint16_t4);
1195#endif
1196
1197_HLSL_BUILTIN_ALIAS(__builtin_elementwise_max)
1198int max(int, int);
1199_HLSL_BUILTIN_ALIAS(__builtin_elementwise_max)
1201_HLSL_BUILTIN_ALIAS(__builtin_elementwise_max)
1203_HLSL_BUILTIN_ALIAS(__builtin_elementwise_max)
1205
1206_HLSL_BUILTIN_ALIAS(__builtin_elementwise_max)
1208_HLSL_BUILTIN_ALIAS(__builtin_elementwise_max)
1210_HLSL_BUILTIN_ALIAS(__builtin_elementwise_max)
1212_HLSL_BUILTIN_ALIAS(__builtin_elementwise_max)
1214
1215_HLSL_BUILTIN_ALIAS(__builtin_elementwise_max)
1217_HLSL_BUILTIN_ALIAS(__builtin_elementwise_max)
1219_HLSL_BUILTIN_ALIAS(__builtin_elementwise_max)
1221_HLSL_BUILTIN_ALIAS(__builtin_elementwise_max)
1223
1224_HLSL_BUILTIN_ALIAS(__builtin_elementwise_max)
1226_HLSL_BUILTIN_ALIAS(__builtin_elementwise_max)
1228_HLSL_BUILTIN_ALIAS(__builtin_elementwise_max)
1230_HLSL_BUILTIN_ALIAS(__builtin_elementwise_max)
1232
1233_HLSL_BUILTIN_ALIAS(__builtin_elementwise_max)
1234float max(float, float);
1235_HLSL_BUILTIN_ALIAS(__builtin_elementwise_max)
1237_HLSL_BUILTIN_ALIAS(__builtin_elementwise_max)
1239_HLSL_BUILTIN_ALIAS(__builtin_elementwise_max)
1241
1242_HLSL_BUILTIN_ALIAS(__builtin_elementwise_max)
1243double max(double, double);
1244_HLSL_BUILTIN_ALIAS(__builtin_elementwise_max)
1246_HLSL_BUILTIN_ALIAS(__builtin_elementwise_max)
1248_HLSL_BUILTIN_ALIAS(__builtin_elementwise_max)
1250
1251//===----------------------------------------------------------------------===//
1252// min builtins
1253//===----------------------------------------------------------------------===//
1254
1255/// \fn T min(T X, T Y)
1256/// \brief Return the lesser of \a X and \a Y.
1257/// \param X The X input value.
1258/// \param Y The Y input value.
1259
1260_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
1261_HLSL_BUILTIN_ALIAS(__builtin_elementwise_min)
1262half min(half, half);
1263_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
1264_HLSL_BUILTIN_ALIAS(__builtin_elementwise_min)
1266_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
1267_HLSL_BUILTIN_ALIAS(__builtin_elementwise_min)
1269_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
1270_HLSL_BUILTIN_ALIAS(__builtin_elementwise_min)
1272
1273#ifdef __HLSL_ENABLE_16_BIT
1274_HLSL_AVAILABILITY(shadermodel, 6.2)
1275_HLSL_BUILTIN_ALIAS(__builtin_elementwise_min)
1276int16_t min(int16_t, int16_t);
1277_HLSL_AVAILABILITY(shadermodel, 6.2)
1278_HLSL_BUILTIN_ALIAS(__builtin_elementwise_min)
1279int16_t2 min(int16_t2, int16_t2);
1280_HLSL_AVAILABILITY(shadermodel, 6.2)
1281_HLSL_BUILTIN_ALIAS(__builtin_elementwise_min)
1282int16_t3 min(int16_t3, int16_t3);
1283_HLSL_AVAILABILITY(shadermodel, 6.2)
1284_HLSL_BUILTIN_ALIAS(__builtin_elementwise_min)
1285int16_t4 min(int16_t4, int16_t4);
1286
1287_HLSL_AVAILABILITY(shadermodel, 6.2)
1288_HLSL_BUILTIN_ALIAS(__builtin_elementwise_min)
1289uint16_t min(uint16_t, uint16_t);
1290_HLSL_AVAILABILITY(shadermodel, 6.2)
1291_HLSL_BUILTIN_ALIAS(__builtin_elementwise_min)
1292uint16_t2 min(uint16_t2, uint16_t2);
1293_HLSL_AVAILABILITY(shadermodel, 6.2)
1294_HLSL_BUILTIN_ALIAS(__builtin_elementwise_min)
1295uint16_t3 min(uint16_t3, uint16_t3);
1296_HLSL_AVAILABILITY(shadermodel, 6.2)
1297_HLSL_BUILTIN_ALIAS(__builtin_elementwise_min)
1298uint16_t4 min(uint16_t4, uint16_t4);
1299#endif
1300
1301_HLSL_BUILTIN_ALIAS(__builtin_elementwise_min)
1302int min(int, int);
1303_HLSL_BUILTIN_ALIAS(__builtin_elementwise_min)
1305_HLSL_BUILTIN_ALIAS(__builtin_elementwise_min)
1307_HLSL_BUILTIN_ALIAS(__builtin_elementwise_min)
1309
1310_HLSL_BUILTIN_ALIAS(__builtin_elementwise_min)
1312_HLSL_BUILTIN_ALIAS(__builtin_elementwise_min)
1314_HLSL_BUILTIN_ALIAS(__builtin_elementwise_min)
1316_HLSL_BUILTIN_ALIAS(__builtin_elementwise_min)
1318
1319_HLSL_BUILTIN_ALIAS(__builtin_elementwise_min)
1320float min(float, float);
1321_HLSL_BUILTIN_ALIAS(__builtin_elementwise_min)
1323_HLSL_BUILTIN_ALIAS(__builtin_elementwise_min)
1325_HLSL_BUILTIN_ALIAS(__builtin_elementwise_min)
1327
1328_HLSL_BUILTIN_ALIAS(__builtin_elementwise_min)
1330_HLSL_BUILTIN_ALIAS(__builtin_elementwise_min)
1332_HLSL_BUILTIN_ALIAS(__builtin_elementwise_min)
1334_HLSL_BUILTIN_ALIAS(__builtin_elementwise_min)
1336
1337_HLSL_BUILTIN_ALIAS(__builtin_elementwise_min)
1339_HLSL_BUILTIN_ALIAS(__builtin_elementwise_min)
1341_HLSL_BUILTIN_ALIAS(__builtin_elementwise_min)
1343_HLSL_BUILTIN_ALIAS(__builtin_elementwise_min)
1345
1346_HLSL_BUILTIN_ALIAS(__builtin_elementwise_min)
1347double min(double, double);
1348_HLSL_BUILTIN_ALIAS(__builtin_elementwise_min)
1350_HLSL_BUILTIN_ALIAS(__builtin_elementwise_min)
1352_HLSL_BUILTIN_ALIAS(__builtin_elementwise_min)
1354
1355//===----------------------------------------------------------------------===//
1356// normalize builtins
1357//===----------------------------------------------------------------------===//
1358
1359/// \fn T normalize(T x)
1360/// \brief Returns the normalized unit vector of the specified floating-point
1361/// vector. \param x [in] The vector of floats.
1362///
1363/// Normalize is based on the following formula: x / length(x).
1364
1365_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
1366_HLSL_BUILTIN_ALIAS(__builtin_hlsl_normalize)
1367half normalize(half);
1368_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
1369_HLSL_BUILTIN_ALIAS(__builtin_hlsl_normalize)
1371_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
1372_HLSL_BUILTIN_ALIAS(__builtin_hlsl_normalize)
1374_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
1375_HLSL_BUILTIN_ALIAS(__builtin_hlsl_normalize)
1377
1378_HLSL_BUILTIN_ALIAS(__builtin_hlsl_normalize)
1379float normalize(float);
1380_HLSL_BUILTIN_ALIAS(__builtin_hlsl_normalize)
1382_HLSL_BUILTIN_ALIAS(__builtin_hlsl_normalize)
1384_HLSL_BUILTIN_ALIAS(__builtin_hlsl_normalize)
1386
1387//===----------------------------------------------------------------------===//
1388// pow builtins
1389//===----------------------------------------------------------------------===//
1390
1391/// \fn T pow(T Val, T Pow)
1392/// \brief Return the value \a Val, raised to the power \a Pow.
1393/// \param Val The input value.
1394/// \param Pow The specified power.
1395
1396_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
1397_HLSL_BUILTIN_ALIAS(__builtin_elementwise_pow)
1398half pow(half, half);
1399_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
1400_HLSL_BUILTIN_ALIAS(__builtin_elementwise_pow)
1402_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
1403_HLSL_BUILTIN_ALIAS(__builtin_elementwise_pow)
1405_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
1406_HLSL_BUILTIN_ALIAS(__builtin_elementwise_pow)
1408
1409_HLSL_BUILTIN_ALIAS(__builtin_elementwise_pow)
1410float pow(float, float);
1411_HLSL_BUILTIN_ALIAS(__builtin_elementwise_pow)
1413_HLSL_BUILTIN_ALIAS(__builtin_elementwise_pow)
1415_HLSL_BUILTIN_ALIAS(__builtin_elementwise_pow)
1417
1418//===----------------------------------------------------------------------===//
1419// reversebits builtins
1420//===----------------------------------------------------------------------===//
1421
1422/// \fn T reversebits(T Val)
1423/// \brief Return the value \a Val with the bit order reversed.
1424/// \param Val The input value.
1425
1426#ifdef __HLSL_ENABLE_16_BIT
1427_HLSL_AVAILABILITY(shadermodel, 6.2)
1428_HLSL_BUILTIN_ALIAS(__builtin_elementwise_bitreverse)
1429uint16_t reversebits(uint16_t);
1430_HLSL_AVAILABILITY(shadermodel, 6.2)
1431_HLSL_BUILTIN_ALIAS(__builtin_elementwise_bitreverse)
1432uint16_t2 reversebits(uint16_t2);
1433_HLSL_AVAILABILITY(shadermodel, 6.2)
1434_HLSL_BUILTIN_ALIAS(__builtin_elementwise_bitreverse)
1435uint16_t3 reversebits(uint16_t3);
1436_HLSL_AVAILABILITY(shadermodel, 6.2)
1437_HLSL_BUILTIN_ALIAS(__builtin_elementwise_bitreverse)
1438uint16_t4 reversebits(uint16_t4);
1439#endif
1440
1441_HLSL_BUILTIN_ALIAS(__builtin_elementwise_bitreverse)
1443_HLSL_BUILTIN_ALIAS(__builtin_elementwise_bitreverse)
1445_HLSL_BUILTIN_ALIAS(__builtin_elementwise_bitreverse)
1447_HLSL_BUILTIN_ALIAS(__builtin_elementwise_bitreverse)
1449
1450_HLSL_BUILTIN_ALIAS(__builtin_elementwise_bitreverse)
1452_HLSL_BUILTIN_ALIAS(__builtin_elementwise_bitreverse)
1454_HLSL_BUILTIN_ALIAS(__builtin_elementwise_bitreverse)
1456_HLSL_BUILTIN_ALIAS(__builtin_elementwise_bitreverse)
1458
1459//===----------------------------------------------------------------------===//
1460// rcp builtins
1461//===----------------------------------------------------------------------===//
1462
1463/// \fn T rcp(T x)
1464/// \brief Calculates a fast, approximate, per-component reciprocal ie 1 / \a x.
1465/// \param x The specified input value.
1466///
1467/// The return value is the reciprocal of the \a x parameter.
1468
1469_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
1470_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_rcp)
1471half rcp(half);
1472_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
1473_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_rcp)
1475_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
1476_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_rcp)
1478_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
1479_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_rcp)
1481
1482_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_rcp)
1483float rcp(float);
1484_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_rcp)
1486_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_rcp)
1488_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_rcp)
1490
1491_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_rcp)
1492double rcp(double);
1493_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_rcp)
1495_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_rcp)
1497_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_rcp)
1499
1500//===----------------------------------------------------------------------===//
1501// rsqrt builtins
1502//===----------------------------------------------------------------------===//
1503
1504/// \fn T rsqrt(T x)
1505/// \brief Returns the reciprocal of the square root of the specified value.
1506/// ie 1 / sqrt( \a x).
1507/// \param x The specified input value.
1508///
1509/// This function uses the following formula: 1 / sqrt(x).
1510
1511_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
1512_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_rsqrt)
1513half rsqrt(half);
1514_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
1515_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_rsqrt)
1517_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
1518_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_rsqrt)
1520_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
1521_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_rsqrt)
1523
1524_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_rsqrt)
1525float rsqrt(float);
1526_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_rsqrt)
1528_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_rsqrt)
1530_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_rsqrt)
1532
1533//===----------------------------------------------------------------------===//
1534// round builtins
1535//===----------------------------------------------------------------------===//
1536
1537/// \fn T round(T x)
1538/// \brief Rounds the specified value \a x to the nearest integer.
1539/// \param x The specified input value.
1540///
1541/// The return value is the \a x parameter, rounded to the nearest integer
1542/// within a floating-point type. Halfway cases are
1543/// rounded to the nearest even value.
1544
1545_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
1546_HLSL_BUILTIN_ALIAS(__builtin_elementwise_roundeven)
1547half round(half);
1548_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
1549_HLSL_BUILTIN_ALIAS(__builtin_elementwise_roundeven)
1551_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
1552_HLSL_BUILTIN_ALIAS(__builtin_elementwise_roundeven)
1554_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
1555_HLSL_BUILTIN_ALIAS(__builtin_elementwise_roundeven)
1557
1558_HLSL_BUILTIN_ALIAS(__builtin_elementwise_roundeven)
1559float round(float);
1560_HLSL_BUILTIN_ALIAS(__builtin_elementwise_roundeven)
1562_HLSL_BUILTIN_ALIAS(__builtin_elementwise_roundeven)
1564_HLSL_BUILTIN_ALIAS(__builtin_elementwise_roundeven)
1566
1567//===----------------------------------------------------------------------===//
1568// saturate builtins
1569//===----------------------------------------------------------------------===//
1570
1571/// \fn T saturate(T Val)
1572/// \brief Returns input value, \a Val, clamped within the range of 0.0f
1573/// to 1.0f. \param Val The input value.
1574
1575_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
1576_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_saturate)
1577half saturate(half);
1578_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
1579_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_saturate)
1581_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
1582_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_saturate)
1584_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
1585_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_saturate)
1587
1588_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_saturate)
1589float saturate(float);
1590_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_saturate)
1592_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_saturate)
1594_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_saturate)
1596
1597_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_saturate)
1598double saturate(double);
1599_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_saturate)
1601_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_saturate)
1603_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_saturate)
1605
1606//===----------------------------------------------------------------------===//
1607// sin builtins
1608//===----------------------------------------------------------------------===//
1609
1610/// \fn T sin(T Val)
1611/// \brief Returns the sine of the input value, \a Val.
1612/// \param Val The input value.
1613
1614_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
1615_HLSL_BUILTIN_ALIAS(__builtin_elementwise_sin)
1616half sin(half);
1617_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
1618_HLSL_BUILTIN_ALIAS(__builtin_elementwise_sin)
1620_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
1621_HLSL_BUILTIN_ALIAS(__builtin_elementwise_sin)
1623_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
1624_HLSL_BUILTIN_ALIAS(__builtin_elementwise_sin)
1626
1627_HLSL_BUILTIN_ALIAS(__builtin_elementwise_sin)
1628float sin(float);
1629_HLSL_BUILTIN_ALIAS(__builtin_elementwise_sin)
1631_HLSL_BUILTIN_ALIAS(__builtin_elementwise_sin)
1633_HLSL_BUILTIN_ALIAS(__builtin_elementwise_sin)
1635
1636//===----------------------------------------------------------------------===//
1637// sinh builtins
1638//===----------------------------------------------------------------------===//
1639
1640/// \fn T sinh(T Val)
1641/// \brief Returns the hyperbolic sine of the input value, \a Val.
1642/// \param Val The input value.
1643
1644#ifdef __HLSL_ENABLE_16_BIT
1645_HLSL_BUILTIN_ALIAS(__builtin_elementwise_sinh)
1646half sinh(half);
1647_HLSL_BUILTIN_ALIAS(__builtin_elementwise_sinh)
1649_HLSL_BUILTIN_ALIAS(__builtin_elementwise_sinh)
1651_HLSL_BUILTIN_ALIAS(__builtin_elementwise_sinh)
1653#endif
1654
1655_HLSL_BUILTIN_ALIAS(__builtin_elementwise_sinh)
1657_HLSL_BUILTIN_ALIAS(__builtin_elementwise_sinh)
1659_HLSL_BUILTIN_ALIAS(__builtin_elementwise_sinh)
1661_HLSL_BUILTIN_ALIAS(__builtin_elementwise_sinh)
1663
1664//===----------------------------------------------------------------------===//
1665// sqrt builtins
1666//===----------------------------------------------------------------------===//
1667
1668/// \fn T sqrt(T Val)
1669/// \brief Returns the square root of the input value, \a Val.
1670/// \param Val The input value.
1671
1672_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
1673_HLSL_BUILTIN_ALIAS(__builtin_elementwise_sqrt)
1674half sqrt(half);
1675_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
1676_HLSL_BUILTIN_ALIAS(__builtin_elementwise_sqrt)
1678_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
1679_HLSL_BUILTIN_ALIAS(__builtin_elementwise_sqrt)
1681_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
1682_HLSL_BUILTIN_ALIAS(__builtin_elementwise_sqrt)
1684
1685_HLSL_BUILTIN_ALIAS(__builtin_elementwise_sqrt)
1686float sqrt(float);
1687_HLSL_BUILTIN_ALIAS(__builtin_elementwise_sqrt)
1689_HLSL_BUILTIN_ALIAS(__builtin_elementwise_sqrt)
1691_HLSL_BUILTIN_ALIAS(__builtin_elementwise_sqrt)
1693
1694//===----------------------------------------------------------------------===//
1695// tan builtins
1696//===----------------------------------------------------------------------===//
1697
1698/// \fn T tan(T Val)
1699/// \brief Returns the tangent of the input value, \a Val.
1700/// \param Val The input value.
1701
1702#ifdef __HLSL_ENABLE_16_BIT
1703_HLSL_BUILTIN_ALIAS(__builtin_elementwise_tan)
1704half tan(half);
1705_HLSL_BUILTIN_ALIAS(__builtin_elementwise_tan)
1706half2 tan(half2);
1707_HLSL_BUILTIN_ALIAS(__builtin_elementwise_tan)
1708half3 tan(half3);
1709_HLSL_BUILTIN_ALIAS(__builtin_elementwise_tan)
1710half4 tan(half4);
1711#endif
1712
1713_HLSL_BUILTIN_ALIAS(__builtin_elementwise_tan)
1714float tan(float);
1715_HLSL_BUILTIN_ALIAS(__builtin_elementwise_tan)
1717_HLSL_BUILTIN_ALIAS(__builtin_elementwise_tan)
1719_HLSL_BUILTIN_ALIAS(__builtin_elementwise_tan)
1721
1722//===----------------------------------------------------------------------===//
1723// tanh builtins
1724//===----------------------------------------------------------------------===//
1725
1726/// \fn T tanh(T Val)
1727/// \brief Returns the hyperbolic tangent of the input value, \a Val.
1728/// \param Val The input value.
1729
1730#ifdef __HLSL_ENABLE_16_BIT
1731_HLSL_BUILTIN_ALIAS(__builtin_elementwise_tanh)
1732half tanh(half);
1733_HLSL_BUILTIN_ALIAS(__builtin_elementwise_tanh)
1735_HLSL_BUILTIN_ALIAS(__builtin_elementwise_tanh)
1737_HLSL_BUILTIN_ALIAS(__builtin_elementwise_tanh)
1739#endif
1740
1741_HLSL_BUILTIN_ALIAS(__builtin_elementwise_tanh)
1743_HLSL_BUILTIN_ALIAS(__builtin_elementwise_tanh)
1745_HLSL_BUILTIN_ALIAS(__builtin_elementwise_tanh)
1747_HLSL_BUILTIN_ALIAS(__builtin_elementwise_tanh)
1749
1750//===----------------------------------------------------------------------===//
1751// trunc builtins
1752//===----------------------------------------------------------------------===//
1753
1754/// \fn T trunc(T Val)
1755/// \brief Returns the truncated integer value of the input value, \a Val.
1756/// \param Val The input value.
1757
1758_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
1759_HLSL_BUILTIN_ALIAS(__builtin_elementwise_trunc)
1760half trunc(half);
1761_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
1762_HLSL_BUILTIN_ALIAS(__builtin_elementwise_trunc)
1764_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
1765_HLSL_BUILTIN_ALIAS(__builtin_elementwise_trunc)
1767_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
1768_HLSL_BUILTIN_ALIAS(__builtin_elementwise_trunc)
1770
1771_HLSL_BUILTIN_ALIAS(__builtin_elementwise_trunc)
1772float trunc(float);
1773_HLSL_BUILTIN_ALIAS(__builtin_elementwise_trunc)
1775_HLSL_BUILTIN_ALIAS(__builtin_elementwise_trunc)
1777_HLSL_BUILTIN_ALIAS(__builtin_elementwise_trunc)
1779
1780//===----------------------------------------------------------------------===//
1781// Wave* builtins
1782//===----------------------------------------------------------------------===//
1783
1784/// \brief Counts the number of boolean variables which evaluate to true across
1785/// all active lanes in the current wave.
1786///
1787/// \param Val The input boolean value.
1788/// \return The number of lanes for which the boolean variable evaluates to
1789/// true, across all active lanes in the current wave.
1790_HLSL_AVAILABILITY(shadermodel, 6.0)
1791_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_count_bits)
1792__attribute__((convergent)) uint WaveActiveCountBits(bool Val);
1793
1794/// \brief Returns the index of the current lane within the current wave.
1795_HLSL_AVAILABILITY(shadermodel, 6.0)
1796_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_get_lane_index)
1797__attribute__((convergent)) uint WaveGetLaneIndex();
1798
1799} // namespace hlsl
1800#endif //_HLSL_HLSL_INTRINSICS_H_
_Float16 __2f16 __attribute__((ext_vector_type(2)))
Zeroes the upper 128 bits (bits 255:128) of all YMM registers.
__device__ int
__device__ float
#define _HLSL_BUILTIN_ALIAS(builtin)
#define _HLSL_AVAILABILITY(platform, version)
#define _HLSL_16BIT_AVAILABILITY(environment, version)
unsigned int uint
half normalize(half)
vector< half, 4 > half4
half mad(half, half, half)
bool any(half)
vector< half, 2 > half2
vector< uint, 2 > uint2
vector< int, 3 > int3
vector< uint64_t, 2 > uint64_t2
half rsqrt(half)
half max(half, half)
half saturate(half)
half abs(half)
vector< float, 4 > float4
half dot(half, half)
vector< int64_t, 4 > int64_t4
unsigned long uint64_t
vector< uint64_t, 3 > uint64_t3
half lerp(half, half, half)
vector< bool, 4 > bool4
long int64_t
vector< int64_t, 3 > int64_t3
vector< int, 4 > int4
vector< bool, 3 > bool3
half clamp(half, half, half)
vector< uint64_t, 4 > uint64_t4
vector< double, 3 > double3
vector< float, 2 > float2
vector< float, 3 > float3
vector< int64_t, 2 > int64_t2
half length(half)
vector< uint, 3 > uint3
half rcp(half)
vector< double, 4 > double4
vector< double, 2 > double2
vector< bool, 2 > bool2
vector< int, 2 > int2
half min(half, half)
vector< uint, 4 > uint4
vector< half, 3 > half3
half frac(half)
bool all(half)
bool isinf(half)
uint reversebits(uint)
#define sinh(__x)
Definition: tgmath.h:373
#define asin(__x)
Definition: tgmath.h:112
#define sqrt(__x)
Definition: tgmath.h:520
#define acos(__x)
Definition: tgmath.h:83
#define exp(__x)
Definition: tgmath.h:431
#define exp2(__x)
Definition: tgmath.h:670
#define sin(__x)
Definition: tgmath.h:286
#define log2(__x)
Definition: tgmath.h:970
#define cosh(__x)
Definition: tgmath.h:344
#define trunc(__x)
Definition: tgmath.h:1216
#define round(__x)
Definition: tgmath.h:1148
#define tan(__x)
Definition: tgmath.h:315
#define cos(__x)
Definition: tgmath.h:257
#define log10(__x)
Definition: tgmath.h:936
#define pow(__x, __y)
Definition: tgmath.h:490
#define tanh(__x)
Definition: tgmath.h:402
#define atan(__x)
Definition: tgmath.h:141
#define floor(__x)
Definition: tgmath.h:722
#define ceil(__x)
Definition: tgmath.h:601
#define log(__x)
Definition: tgmath.h:460