Debian Codegraph @

clang/test/SemaSPIRV/BuiltIns/subgroup-errors.c

raw
1 // RUN: %clang_cc1 -O1 -Wno-unused-value -triple spirv64 -fsycl-is-device -verify %s -o -
2 // RUN: %clang_cc1 -O1 -Wno-unused-value -triple spirv64 -verify %s -cl-std=CL3.0 -x cl -o -
3 // RUN: %clang_cc1 -O1 -Wno-unused-value -triple spirv32 -verify %s -cl-std=CL3.0 -x cl -o -
4
5 typedef unsigned __attribute__((ext_vector_type(4))) int4;
6
7 void ballot(_Bool c) {
8 int4 x;
9 x = __builtin_spirv_subgroup_ballot(c);
10 x = __builtin_spirv_subgroup_ballot(1);
11 x = __builtin_spirv_subgroup_ballot(x); // expected-error{{parameter of incompatible type}}
12 int y = __builtin_spirv_subgroup_ballot(c); // expected-error{{with an expression of incompatible type}}
13 }
14
15 void shuffle() {
16 int x = 0;
17 long long l = 0;
18 float f = 0;
19 int [[clang::ext_vector_type(1)]] v;
20 (void)__builtin_spirv_subgroup_shuffle(x, x);
21 (void)__builtin_spirv_subgroup_shuffle(f, f);
22 (void)__builtin_spirv_subgroup_shuffle(x, x, x); // expected-error{{too many arguments to function call, expected 2, have 3}}
23 (void)__builtin_spirv_subgroup_shuffle(v, f); // expected-error{{1st argument must be a scalar type}}
24 (void)__builtin_spirv_subgroup_shuffle(f, v); // expected-error{{to parameter of incompatible type}}
25 }