[clang] [llvm] [HLSL] Implement elementwise popcount (PR #108121)

Farzon Lotfi via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 12 15:15:13 PDT 2024


================
@@ -0,0 +1,27 @@
+// RUN: %clang_cc1 -finclude-default-header
+// -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only
+// -disable-llvm-passes -verify
+
+
+double test_int_builtin(double p0) {
+  return countbits(p0);
+  // expected-error at -1 {{call to 'countbits' is ambiguous}}
+  // expected-note at hlsl/hlsl_intrinsics.h:* {{candidate function}}
+  // expected-note at hlsl/hlsl_intrinsics.h:* {{candidate function}}
+  // expected-note at hlsl/hlsl_intrinsics.h:* {{candidate function}}
+  // expected-note at hlsl/hlsl_intrinsics.h:* {{candidate function}}
+  // expected-note at hlsl/hlsl_intrinsics.h:* {{candidate function}}
+  // expected-note at hlsl/hlsl_intrinsics.h:* {{candidate function}}
+}
+
+double2 test_int_builtin_2(double2 p0) {
+  return __builtin_elementwise_popcount(p0);
+  // expected-error at -1 {{1st argument must be a vector of integers
+  // (was 'double2' (aka 'vector<double, 2>'))}}
+}
+
+double test_int_builtin_3(float p0) {
+  return __builtin_elementwise_popcount(p0);
+  // expected-error at -1 {{1st argument must be a vector of integers
+  // (was 'float')}}
+}
----------------
farzonl wrote:

add a new line

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


More information about the cfe-commits mailing list