[clang] [llvm] [HLSL] Implement elementwise popcount (PR #108121)
Simon Pilgrim via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 12 02:47:00 PDT 2024
================
@@ -505,6 +505,27 @@ void test_builtin_elementwise_log2(int i, float f, double d, float4 v, int3 iv,
// expected-error at -1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
}
+void test_builtin_elementwise_popcount(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
+
+ struct Foo s = __builtin_elementwise_popcount(i);
+ // expected-error at -1 {{initializing 'struct Foo' with an expression of incompatible type 'int'}}
+
+ i = __builtin_elementwise_popcount();
+ // expected-error at -1 {{too few arguments to function call, expected 1, have 0}}
+
+ i = __builtin_elementwise_popcount(f);
+ // expected-error at -1 {{1st argument must be a vector of integers (was 'float')}}
+
+ i = __builtin_elementwise_popcount(f, f);
+ // expected-error at -1 {{too many arguments to function call, expected 1, have 2}}
+
+ u = __builtin_elementwise_popcount(d);
+ // expected-error at -1 {{1st argument must be a vector of integers (was 'double')}}
+
+ v = __builtin_elementwise_popcount(v);
+ // expected-error at -1 {{1st argument must be a vector of integers (was 'float4' (vector of 4 'float' values))}}
----------------
RKSimon wrote:
please can you add tests for vector element count mismatches and implicit arg vs result vector extension/truncation/sign changes
https://github.com/llvm/llvm-project/pull/108121
More information about the cfe-commits
mailing list