Skip to content

Commit bec1ced

Browse files
committed
Update builtins-wasm.c CodeGen test
1 parent d52e1e8 commit bec1ced

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

clang/test/CodeGen/builtins-wasm.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -751,3 +751,27 @@ void *tp (void) {
751751
return __builtin_thread_pointer ();
752752
// WEBASSEMBLY: call {{.*}} @llvm.thread.pointer.p0()
753753
}
754+
755+
756+
typedef void (*funcref_t)();
757+
typedef int (*funcref_int_t)(int);
758+
typedef float (*F1)(float, double, int);
759+
typedef int (*F2)(float, double, int);
760+
typedef int (*F3)(int, int, int);
761+
typedef void (*F4)(int, int, int);
762+
typedef void (*F5)(void);
763+
764+
void use(int);
765+
766+
void test_function_pointer_signature_void(F1 func) {
767+
// WEBASSEMBLY: %0 = tail call i32 (ptr, ...) @llvm.wasm.ref.test.func(ptr %func, float 0.000000e+00, float 0.000000e+00, double 0.000000e+00, i32 0)
768+
use(__builtin_wasm_test_function_pointer_signature(func));
769+
// WEBASSEMBLY: %1 = tail call i32 (ptr, ...) @llvm.wasm.ref.test.func(ptr %func, i32 0, float 0.000000e+00, double 0.000000e+00, i32 0)
770+
use(__builtin_wasm_test_function_pointer_signature((F2)func));
771+
// WEBASSEMBLY: %2 = tail call i32 (ptr, ...) @llvm.wasm.ref.test.func(ptr %func, i32 0, i32 0, i32 0, i32 0)
772+
use(__builtin_wasm_test_function_pointer_signature((F3)func));
773+
// WEBASSEMBLY: %3 = tail call i32 (ptr, ...) @llvm.wasm.ref.test.func(ptr %func, token undef, i32 0, i32 0, i32 0)
774+
use(__builtin_wasm_test_function_pointer_signature((F4)func));
775+
// WEBASSEMBLY: %4 = tail call i32 (ptr, ...) @llvm.wasm.ref.test.func(ptr %func, token undef)
776+
use(__builtin_wasm_test_function_pointer_signature((F5)func));
777+
}

0 commit comments

Comments
 (0)