Skip to content

Commit 7cdc5d3

Browse files
committed
Update builtins-wasm.c CodeGen test
1 parent a763b1e commit 7cdc5d3

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
@@ -745,3 +745,27 @@ void *tp (void) {
745745
return __builtin_thread_pointer ();
746746
// WEBASSEMBLY: call {{.*}} @llvm.thread.pointer()
747747
}
748+
749+
750+
typedef void (*funcref_t)();
751+
typedef int (*funcref_int_t)(int);
752+
typedef float (*F1)(float, double, int);
753+
typedef int (*F2)(float, double, int);
754+
typedef int (*F3)(int, int, int);
755+
typedef void (*F4)(int, int, int);
756+
typedef void (*F5)(void);
757+
758+
void use(int);
759+
760+
void test_function_pointer_signature_void(F1 func) {
761+
// 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)
762+
use(__builtin_wasm_test_function_pointer_signature(func));
763+
// 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)
764+
use(__builtin_wasm_test_function_pointer_signature((F2)func));
765+
// WEBASSEMBLY: %2 = tail call i32 (ptr, ...) @llvm.wasm.ref.test.func(ptr %func, i32 0, i32 0, i32 0, i32 0)
766+
use(__builtin_wasm_test_function_pointer_signature((F3)func));
767+
// WEBASSEMBLY: %3 = tail call i32 (ptr, ...) @llvm.wasm.ref.test.func(ptr %func, token undef, i32 0, i32 0, i32 0)
768+
use(__builtin_wasm_test_function_pointer_signature((F4)func));
769+
// WEBASSEMBLY: %4 = tail call i32 (ptr, ...) @llvm.wasm.ref.test.func(ptr %func, token undef)
770+
use(__builtin_wasm_test_function_pointer_signature((F5)func));
771+
}

0 commit comments

Comments
 (0)