Skip to content

Commit ceb363a

Browse files
committed
Add separate union test
1 parent 6dafa4a commit ceb363a

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

clang/test/CodeGen/builtins-wasm.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -796,9 +796,9 @@ void test_function_pointer_funcref(FFuncRef func) {
796796
// the normal type lowering code.
797797
// Single element structs are unboxed, multi element structs are passed on
798798
// stack.
799-
typedef struct {double x;} (*Fstructs1)(struct {double x;}, struct {float x;}, struct {double x; float y;}, union {double x; float y;});
799+
typedef struct {double x;} (*Fstructs1)(struct {double x;}, struct {float x;}, struct {double x; float y;});
800800
void test_function_pointer_structs1(Fstructs1 func) {
801-
// WEBASSEMBLY: %0 = tail call i32 (ptr, ...) @llvm.wasm.ref.test.func(ptr %func, double poison, token poison, double poison, float poison, ptr poison, ptr poison)
801+
// WEBASSEMBLY: %0 = tail call i32 (ptr, ...) @llvm.wasm.ref.test.func(ptr %func, double poison, token poison, double poison, float poison, ptr poison)
802802
use(__builtin_wasm_test_function_pointer_signature(func));
803803
}
804804

@@ -808,3 +808,10 @@ void test_function_pointer_structs2(Fstructs2 func) {
808808
// WEBASSEMBLY: %0 = tail call i32 (ptr, ...) @llvm.wasm.ref.test.func(ptr %func, token poison, ptr poison)
809809
use(__builtin_wasm_test_function_pointer_signature(func));
810810
}
811+
812+
// Return union ==> return ptr on stack, one element union => unboxed
813+
typedef union {double x; float y;} (*FUnions)(union {double x; float y;}, union {double x;});
814+
void test_function_pointer_unions(FUnions func) {
815+
// WEBASSEMBLY: %0 = tail call i32 (ptr, ...) @llvm.wasm.ref.test.func(ptr %func, token poison, ptr poison, ptr poison, double poison)
816+
use(__builtin_wasm_test_function_pointer_signature(func));
817+
}

0 commit comments

Comments
 (0)