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 &gt; 
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
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to