[AArch64] Add fpext and fpround costs (#119292)
[llvm-project.git] / clang / test / Sema / builtins-wasm.c
blobbeb430616233afb277db33f5de793d9ebe3e863f
1 // RUN: %clang_cc1 -fsyntax-only -verify -triple wasm32 -target-feature +reference-types %s
3 #define EXPR_HAS_TYPE(expr, type) _Generic((expr), type : 1, default : 0)
5 static __externref_t table[0];
7 typedef void (*__funcref funcref_t)();
8 void test_ref_null() {
9 funcref_t func = __builtin_wasm_ref_null_func(0); // expected-error {{too many arguments to function call, expected 0, have 1}}
12 void test_table_size(__externref_t ref, void *ptr, int arr[]) {
13 __builtin_wasm_table_size(); // expected-error {{too few arguments to function call, expected 1, have 0}}
14 __builtin_wasm_table_size(1); // expected-error {{1st argument must be a WebAssembly table}}
15 __builtin_wasm_table_size(ref); // expected-error {{1st argument must be a WebAssembly table}}
16 __builtin_wasm_table_size(ptr); // expected-error {{1st argument must be a WebAssembly table}}
17 __builtin_wasm_table_size(arr); // expected-error {{1st argument must be a WebAssembly table}}
18 __builtin_wasm_table_size(table, table); // expected-error {{too many arguments to function call, expected 1, have 2}}
20 _Static_assert(EXPR_HAS_TYPE(__builtin_wasm_table_size(table), unsigned long), "");
23 void test_table_grow(__externref_t ref, int size) {
24 __builtin_wasm_table_grow(); // expected-error {{too few arguments to function call, expected 3, have 0}}
25 __builtin_wasm_table_grow(table, table, table, table); // expected-error {{too many arguments to function call, expected 3, have 4}}
26 __builtin_wasm_table_grow(ref, ref, size); // expected-error {{1st argument must be a WebAssembly table}}
27 __builtin_wasm_table_grow(table, table, size); // expected-error {{2nd argument must match the element type of the WebAssembly table in the 1st argument}}
28 __builtin_wasm_table_grow(table, ref, table); // expected-error {{3rd argument must be an integer}}
30 _Static_assert(EXPR_HAS_TYPE(__builtin_wasm_table_grow(table, ref, size), int), "");
33 void test_table_fill(int index, __externref_t ref, int nelem) {
34 __builtin_wasm_table_fill(); // expected-error {{too few arguments to function call, expected 4, have 0}}
35 __builtin_wasm_table_fill(table, table, table, table, table); // expected-error {{too many arguments to function call, expected 4, have 5}}
36 __builtin_wasm_table_fill(index, index, ref, nelem); // expected-error {{1st argument must be a WebAssembly table}}
37 __builtin_wasm_table_fill(table, table, ref, nelem); // expected-error {{2nd argument must be an integer}}
38 __builtin_wasm_table_fill(table, index, index, ref); // expected-error {{3rd argument must match the element type of the WebAssembly table in the 1st argument}}
39 __builtin_wasm_table_fill(table, index, ref, table); // expected-error {{4th argument must be an integer}}
40 __builtin_wasm_table_fill(table, index, ref, nelem);
43 void test_table_copy(int dst_idx, int src_idx, int nelem) {
44 __builtin_wasm_table_copy(); // expected-error {{too few arguments to function call, expected 5, have 0}}
45 __builtin_wasm_table_copy(table, table, table, table, table, table); // expected-error {{too many arguments to function call, expected 5, have 6}}
46 __builtin_wasm_table_copy(src_idx, table, dst_idx, src_idx, nelem); // expected-error {{1st argument must be a WebAssembly table}}
47 __builtin_wasm_table_copy(table, src_idx, dst_idx, src_idx, nelem); // expected-error {{2nd argument must be a WebAssembly table}}
48 __builtin_wasm_table_copy(table, table, table, src_idx, nelem); // expected-error {{3rd argument must be an integer}}
49 __builtin_wasm_table_copy(table, table, dst_idx, table, nelem); // expected-error {{4th argument must be an integer}}
50 __builtin_wasm_table_copy(table, table, dst_idx, src_idx, table); // expected-error {{5th argument must be an integer}}
51 __builtin_wasm_table_copy(table, table, dst_idx, src_idx, nelem);