diff options
| author | gingerBill <bill@gingerbill.org> | 2020-08-05 22:51:24 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2020-08-05 22:51:24 +0100 |
| commit | 9f24188ec885d0d09ca8823ccf3210467dc61e11 (patch) | |
| tree | 5595905bdb5d5d170b2af923380b4b36734fad53 /src/ir.cpp | |
| parent | 5551404be438ba437040316c85abb9d243a9424e (diff) | |
Fix #708
Diffstat (limited to 'src/ir.cpp')
| -rw-r--r-- | src/ir.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/ir.cpp b/src/ir.cpp index bfed55083..6561c0beb 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -3316,7 +3316,19 @@ irValue *ir_emit_call(irProcedure *p, irValue *value, Array<irValue *> const &ar } else if (is_type_tuple(new_type)) { Type *abi_type = pt->Proc.abi_compat_params[i]; Type *st = struct_type_from_systemv_distribute_struct_fields(abi_type); - irValue *x = ir_emit_transmute(p, args[i], st); + irValue *x = nullptr; + i64 st_sz = type_size_of(st); + i64 arg_sz = type_size_of(ir_type(args[i])); + if (st_sz == arg_sz) { + x = ir_emit_transmute(p, args[i], st); + } else { + // NOTE(bill): struct{f32, f32, f32} != struct{#simd[2]f32, f32} + GB_ASSERT(st_sz > arg_sz); + irValue *xx = ir_add_local_generated(p, st, false); + irValue *pp = ir_emit_conv(p, xx, alloc_type_pointer(ir_type(args[i]))); + ir_emit_store(p, pp, args[i]); + x = ir_emit_load(p, xx); + } for (isize j = 0; j < new_type->Tuple.variables.count; j++) { irValue *xx = ir_emit_struct_ev(p, x, cast(i32)j); array_add(&processed_args, xx); |