[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Sema / count-builtins.c
blob79fa812f3f206bb7ec3f8f8d0dd60027cb0eaab9
1 // RUN: %clang_cc1 -std=c23 -triple=x86_64-pc-linux-gnu -fsyntax-only -verify -Wpedantic %s
3 typedef int int2 __attribute__((ext_vector_type(2)));
5 void test_builtin_popcountg(short s, int i, __int128 i128, _BitInt(128) bi128,
6 double d, int2 i2) {
7 __builtin_popcountg();
8 // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
9 __builtin_popcountg(i, i);
10 // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
11 __builtin_popcountg(s);
12 // expected-error@-1 {{1st argument must be an unsigned integer (was 'short')}}
13 __builtin_popcountg(i);
14 // expected-error@-1 {{1st argument must be an unsigned integer (was 'int')}}
15 __builtin_popcountg(i128);
16 // expected-error@-1 {{1st argument must be an unsigned integer (was '__int128')}}
17 __builtin_popcountg(bi128);
18 // expected-error@-1 {{1st argument must be an unsigned integer (was '_BitInt(128)')}}
19 __builtin_popcountg(d);
20 // expected-error@-1 {{1st argument must be an unsigned integer (was 'double')}}
21 __builtin_popcountg(i2);
22 // expected-error@-1 {{1st argument must be an unsigned integer (was 'int2' (vector of 2 'int' values))}}
25 void test_builtin_clzg(short s, int i, unsigned int ui, __int128 i128,
26 _BitInt(128) bi128, double d, int2 i2) {
27 __builtin_clzg();
28 // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
29 __builtin_clzg(i, i, i);
30 // expected-error@-1 {{too many arguments to function call, expected at most 2, have 3}}
31 __builtin_clzg(s);
32 // expected-error@-1 {{1st argument must be an unsigned integer (was 'short')}}
33 __builtin_clzg(i);
34 // expected-error@-1 {{1st argument must be an unsigned integer (was 'int')}}
35 __builtin_clzg(i128);
36 // expected-error@-1 {{1st argument must be an unsigned integer (was '__int128')}}
37 __builtin_clzg(bi128);
38 // expected-error@-1 {{1st argument must be an unsigned integer (was '_BitInt(128)')}}
39 __builtin_clzg(d);
40 // expected-error@-1 {{1st argument must be an unsigned integer (was 'double')}}
41 __builtin_clzg(i2);
42 // expected-error@-1 {{1st argument must be an unsigned integer (was 'int2' (vector of 2 'int' values))}}
43 __builtin_clzg(i2);
44 // expected-error@-1 {{1st argument must be an unsigned integer (was 'int2' (vector of 2 'int' values))}}
45 __builtin_clzg(ui, ui);
46 // expected-error@-1 {{2nd argument must be an 'int' (was 'unsigned int')}}
47 __builtin_clzg(ui, i128);
48 // expected-error@-1 {{2nd argument must be an 'int' (was '__int128')}}
49 __builtin_clzg(ui, bi128);
50 // expected-error@-1 {{2nd argument must be an 'int' (was '_BitInt(128)')}}
51 __builtin_clzg(ui, d);
52 // expected-error@-1 {{2nd argument must be an 'int' (was 'double')}}
53 __builtin_clzg(ui, i2);
54 // expected-error@-1 {{2nd argument must be an 'int' (was 'int2' (vector of 2 'int' values))}}
57 void test_builtin_ctzg(short s, int i, unsigned int ui, __int128 i128,
58 _BitInt(128) bi128, double d, int2 i2) {
59 __builtin_ctzg();
60 // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
61 __builtin_ctzg(i, i, i);
62 // expected-error@-1 {{too many arguments to function call, expected at most 2, have 3}}
63 __builtin_ctzg(s);
64 // expected-error@-1 {{1st argument must be an unsigned integer (was 'short')}}
65 __builtin_ctzg(i);
66 // expected-error@-1 {{1st argument must be an unsigned integer (was 'int')}}
67 __builtin_ctzg(i128);
68 // expected-error@-1 {{1st argument must be an unsigned integer (was '__int128')}}
69 __builtin_ctzg(bi128);
70 // expected-error@-1 {{1st argument must be an unsigned integer (was '_BitInt(128)')}}
71 __builtin_ctzg(d);
72 // expected-error@-1 {{1st argument must be an unsigned integer (was 'double')}}
73 __builtin_ctzg(i2);
74 // expected-error@-1 {{1st argument must be an unsigned integer (was 'int2' (vector of 2 'int' values))}}
75 __builtin_ctzg(i2);
76 // expected-error@-1 {{1st argument must be an unsigned integer (was 'int2' (vector of 2 'int' values))}}
77 __builtin_ctzg(ui, ui);
78 // expected-error@-1 {{2nd argument must be an 'int' (was 'unsigned int')}}
79 __builtin_ctzg(ui, i128);
80 // expected-error@-1 {{2nd argument must be an 'int' (was '__int128')}}
81 __builtin_ctzg(ui, bi128);
82 // expected-error@-1 {{2nd argument must be an 'int' (was '_BitInt(128)')}}
83 __builtin_ctzg(ui, d);
84 // expected-error@-1 {{2nd argument must be an 'int' (was 'double')}}
85 __builtin_ctzg(ui, i2);
86 // expected-error@-1 {{2nd argument must be an 'int' (was 'int2' (vector of 2 'int' values))}}