[clang] [HLSL] Update CheckAccessFullyMapped definition (PR #170949)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Dec 5 15:23:10 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-x86
Author: Joshua Batista (bob80905)
<details>
<summary>Changes</summary>
This PR updates the definition for CheckAccessFullyMapped in hlsl_intrinsics.h.
Previously, the whole uint would be cast to a bool, which means any value > 0 would be treated as true.
However, the DXC implementation actually casts just the LSB to bool and returns that. So all even values would result in false, and odd values would result in true after running CheckAccessFullyMapped on it.
This PR changes the implementation to match the DXC implementation.
---
Full diff: https://github.com/llvm/llvm-project/pull/170949.diff
1 Files Affected:
- (modified) clang/lib/Headers/hlsl/hlsl_intrinsics.h (+3-1)
``````````diff
diff --git a/clang/lib/Headers/hlsl/hlsl_intrinsics.h b/clang/lib/Headers/hlsl/hlsl_intrinsics.h
index a538be5ebd099..e8cda388b4ff4 100644
--- a/clang/lib/Headers/hlsl/hlsl_intrinsics.h
+++ b/clang/lib/Headers/hlsl/hlsl_intrinsics.h
@@ -667,7 +667,9 @@ smoothstep(__detail::HLSL_FIXED_VECTOR<float, N> Min,
}
inline bool CheckAccessFullyMapped(uint Status) {
- return static_cast<bool>(Status);
+ // The bool cast should only apply to the LSB.
+ uint TruncStatus = Status % 2;
+ return static_cast<bool>(TruncStatus);
}
//===----------------------------------------------------------------------===//
``````````
</details>
https://github.com/llvm/llvm-project/pull/170949
More information about the cfe-commits
mailing list