[clang] Adding `asuint` implementation to hlsl (PR #107292)

Justin Bogner via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 9 10:28:32 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
+
+
+export uint4 test_asuint_too_many_arg(float p0, float p1) {
+  return __builtin_hlsl_elementwise_asuint(p0, p1);
+  // expected-error at -1 {{too many arguments to function call, expected 1, have 2}}
+}
+
+
+export uint fn(double p1) {
+    return asuint(p1);
+    // expected-error at -1 {{passing 'double' to parameter of incompatible type 'float'}}
+}
----------------
bogner wrote:

I suspect this test is failing because we won't actually get to the error handling on the builtin - since `asuint` has `float` and `int` overloads, this call should be ambiguous.

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


More information about the cfe-commits mailing list