diff options
author | Farzon Lotfi <1802579+farzonl@users.noreply.github.com> | 2024-03-14 18:07:48 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-14 18:07:48 -0400 |
commit | d192b643701062064408dd7be0301f7a5d070c03 (patch) | |
tree | 04aed5ddbd55727e94bab4837972156ebc7f8ac3 /clang/lib/Headers | |
parent | 229640343e400394b315c6798c7c19e8a9bd188c (diff) | |
download | llvm-d192b643701062064408dd7be0301f7a5d070c03.zip llvm-d192b643701062064408dd7be0301f7a5d070c03.tar.gz llvm-d192b643701062064408dd7be0301f7a5d070c03.tar.bz2 |
[HLSL] implement the `isinf` intrinsic (#84927)
This change implements part 1 of 2 for #70095
- `hlsl_intrinsics.h` - add the `isinf` api
- `Builtins.td` - add an hlsl builtin for `isinf`.
- `CGBuiltin.cpp` add the ir generation for `isinf` intrinsic.
- `SemaChecking.cpp` - add a non-math elementwise checks because this is
a bool return.
- `IntrinsicsDirectX.td` - add an `isinf` intrinsic.
`DXIL.td` lowering is left, but changes need to be made there before we
can support this case.
Diffstat (limited to 'clang/lib/Headers')
-rw-r--r-- | clang/lib/Headers/hlsl/hlsl_intrinsics.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/clang/lib/Headers/hlsl/hlsl_intrinsics.h b/clang/lib/Headers/hlsl/hlsl_intrinsics.h index 3bdb0a3..718fb9a 100644 --- a/clang/lib/Headers/hlsl/hlsl_intrinsics.h +++ b/clang/lib/Headers/hlsl/hlsl_intrinsics.h @@ -526,6 +526,39 @@ _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_frac) float4 frac(float4); //===----------------------------------------------------------------------===// +// isinf builtins +//===----------------------------------------------------------------------===// + +/// \fn T isinf(T x) +/// \brief Determines if the specified value \a x is infinite. +/// \param x The specified input value. +/// +/// Returns a value of the same size as the input, with a value set +/// to True if the x parameter is +INF or -INF. Otherwise, False. + +_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) +_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_isinf) +bool isinf(half); +_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) +_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_isinf) +bool2 isinf(half2); +_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) +_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_isinf) +bool3 isinf(half3); +_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) +_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_isinf) +bool4 isinf(half4); + +_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_isinf) +bool isinf(float); +_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_isinf) +bool2 isinf(float2); +_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_isinf) +bool3 isinf(float3); +_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_isinf) +bool4 isinf(float4); + +//===----------------------------------------------------------------------===// // lerp builtins //===----------------------------------------------------------------------===// |