[clang] [HLSL] Implement the `lit` intrinsic (PR #134171)

Kaitlin Peng via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 8 11:17:01 PDT 2025


================
@@ -0,0 +1,31 @@
+// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only -disable-llvm-passes -verify
+
+float4 test_no_second_arg(float p0) {
+  return lit(p0);
+  // expected-error at -1 {{no matching function for call to 'lit'}}
+  // expected-note at hlsl/hlsl_compat_overloads.h:* {{candidate function template not viable: requires 3 arguments, but 1 was provided}}
+}
+
+float4 test_no_third_arg(float p0) {
+  return lit(p0, p0);
+  // expected-error at -1 {{no matching function for call to 'lit'}}
+  // expected-note at hlsl/hlsl_compat_overloads.h:* {{candidate function template not viable: requires 3 arguments, but 2 were provided}}
+}
+
+float4 test_too_many_arg(float p0) {
+  return lit(p0, p0, p0, p0);
+  // expected-error at -1 {{no matching function for call to 'lit'}}
----------------
kmpeng wrote:

Code updated.

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


More information about the cfe-commits mailing list