[clang] [llvm] Implements isnan() HLSL intrinsic for DXIL and SPIR-V targets. (PR #157733)

via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 11 10:59:31 PDT 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions h,cpp -- clang/lib/CodeGen/CGHLSLBuiltins.cpp clang/lib/CodeGen/CGHLSLRuntime.h clang/lib/Headers/hlsl/hlsl_alias_intrinsics.h clang/lib/Headers/hlsl/hlsl_compat_overloads.h clang/lib/Headers/hlsl/hlsl_intrinsics.h clang/lib/Sema/SemaHLSL.cpp llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/lib/Headers/hlsl/hlsl_intrinsics.h b/clang/lib/Headers/hlsl/hlsl_intrinsics.h
index ab0c5faad..b87265604 100644
--- a/clang/lib/Headers/hlsl/hlsl_intrinsics.h
+++ b/clang/lib/Headers/hlsl/hlsl_intrinsics.h
@@ -315,9 +315,9 @@ fmod(__detail::HLSL_FIXED_VECTOR<float, N> X,
 
 template <typename T>
 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
-const inline __detail::enable_if_t<
-    __detail::is_arithmetic<T>::Value && __detail::is_same<half, T>::value, T>
-isnan(T X) {
+const inline __detail::enable_if_t<__detail::is_arithmetic<T>::Value &&
+                                       __detail::is_same<half, T>::value,
+                                   T> isnan(T X) {
   return __builtin_elementwise_isnan(X);
 }
 template <typename T>
@@ -329,8 +329,8 @@ isnan(T X) {
 
 template <int N>
 _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
-const inline __detail::HLSL_FIXED_VECTOR<half, N>
-isnan(__detail::HLSL_FIXED_VECTOR<half, N> X) {
+const inline __detail::HLSL_FIXED_VECTOR<half, N> isnan(
+    __detail::HLSL_FIXED_VECTOR<half, N> X) {
   return __builtin_elementwise_isnan(X);
 }
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/157733


More information about the llvm-commits mailing list