[clang] Adding `asuint` implementation to hlsl (PR #107292)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 12 15:26:12 PDT 2024
================
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only -disable-llvm-passes -verify -verify-ignore-unexpected
----------------
joaosaffran wrote:
I've updated the tests, but here is the full error message, for such tests:
```hlsl
/workspace/llvm-project/build-debug/bin/clang -cc1 -internal-isystem /workspace/llvm-project/build-debug/lib/clang/20/include -nostdsysteminc -finclude-default-header -x hlsl -triple dxil-pc-shadermodel6.3-library /workspace/llvm-project/clang/test/SemaHLSL/BuiltIns/asuint-errors.hlsl -fnative-half-type -emit-llvm
[12/12] Creating executable symlink bin/clang
/workspace/llvm-project/clang/test/SemaHLSL/BuiltIns/asuint-errors.hlsl:5:10: error: no matching function for call to 'asuint'
5 | return asuint(p0, p1);
| ^~~~~~
/workspace/llvm-project/build-debug/lib/clang/20/include/hlsl/hlsl_intrinsics.h:401:30: note: candidate function template not viable: requires single argument 'V', but 2 arguments were provided
401 | _HLSL_INLINE vector<uint, N> asuint(vector<T, N> V) {
| ^ ~~~~~~~~~~~~~~
/workspace/llvm-project/build-debug/lib/clang/20/include/hlsl/hlsl_intrinsics.h:405:41: note: candidate function template not viable: requires single argument 'F', but 2 arguments were provided
405 | template <typename T> _HLSL_INLINE uint asuint(T F) {
| ^ ~~~
/workspace/llvm-project/build-debug/lib/clang/20/include/hlsl/hlsl_intrinsics.h:406:10: error: no matching function for call to 'bit_cast'
406 | return __detail::bit_cast<uint, T>(F);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/workspace/llvm-project/clang/test/SemaHLSL/BuiltIns/asuint-errors.hlsl:12:12: note: in instantiation of function template specialization 'hlsl::asuint<double>' requested here
12 | return asuint(p1);
| ^
/workspace/llvm-project/build-debug/lib/clang/20/include/hlsl/hlsl_detail.h:27:1: note: candidate template ignored: could not match 'vector<double, N>' against 'double'
27 | bit_cast(vector<T, N> V) {
| ^
/workspace/llvm-project/build-debug/lib/clang/20/include/hlsl/hlsl_detail.h:32:66: note: candidate template ignored: substitution failure [with U = uint, T = double]: no type named 'Type' in 'hlsl::__detail::enable_if<false, unsigned int>'
32 | _HLSL_INLINE typename enable_if<sizeof(U) == sizeof(T), U>::Type bit_cast(T F) {
| ~~~~~~~~ ^
In file included from <built-in>:1:
In file included from /workspace/llvm-project/build-debug/lib/clang/20/include/hlsl.h:13:
/workspace/llvm-project/build-debug/lib/clang/20/include/hlsl/hlsl_intrinsics.h:406:10: error: no matching function for call to 'bit_cast'
406 | return __detail::bit_cast<uint, T>(F);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/workspace/llvm-project/clang/test/SemaHLSL/BuiltIns/asuint-errors.hlsl:20:12: note: in instantiation of function template specialization 'hlsl::asuint<half>' requested here
20 | return asuint(p1);
| ^
/workspace/llvm-project/build-debug/lib/clang/20/include/hlsl/hlsl_detail.h:27:1: note: candidate template ignored: could not match 'vector<half, N>' against 'half'
27 | bit_cast(vector<T, N> V) {
| ^
/workspace/llvm-project/build-debug/lib/clang/20/include/hlsl/hlsl_detail.h:32:66: note: candidate template ignored: substitution failure [with U = uint, T = half]: no type named 'Type' in 'hlsl::__detail::enable_if<false, unsigned int>'
32 | _HLSL_INLINE typename enable_if<sizeof(U) == sizeof(T), U>::Type bit_cast(T F) {
| ~~~~~~~~ ^
3 errors generated.
```
https://github.com/llvm/llvm-project/pull/107292
More information about the cfe-commits
mailing list