| ... | @@ -6508,23 +6508,16 @@ fn airSplat(f: *Function, inst: Air.Inst.Index) !CValue { | ... | @@ -6508,23 +6508,16 @@ fn airSplat(f: *Function, inst: Air.Inst.Index) !CValue { |
| 6508 | | 6508 | |
| 6509 | const inst_ty = f.air.typeOfIndex(inst); | 6509 | const inst_ty = f.air.typeOfIndex(inst); |
| 6510 | const inst_scalar_ty = inst_ty.scalarType(); | 6510 | const inst_scalar_ty = inst_ty.scalarType(); |
| 6511 | const inst_scalar_cty = try f.typeToIndex(inst_scalar_ty, .complete); | | |
| 6512 | const need_memcpy = f.indexToCType(inst_scalar_cty).tag() == .array; | | |
| 6513 | | 6511 | |
| 6514 | const writer = f.object.writer(); | 6512 | const writer = f.object.writer(); |
| 6515 | const local = try f.allocLocal(inst, inst_ty); | 6513 | const local = try f.allocLocal(inst, inst_ty); |
| 6516 | const v = try Vectorize.start(f, inst, writer, inst_ty); | 6514 | const v = try Vectorize.start(f, inst, writer, inst_ty); |
| 6517 | if (need_memcpy) try writer.writeAll("memcpy(&"); | 6515 | const a = try Assignment.init(f, inst_scalar_ty); |
| 6518 | try f.writeCValue(writer, local, .Other); | 6516 | try f.writeCValue(writer, local, .Other); |
| 6519 | try v.elem(f, writer); | 6517 | try v.elem(f, writer); |
| 6520 | try writer.writeAll(if (need_memcpy) ", &" else " = "); | 6518 | try a.assign(f, writer); |
| 6521 | try f.writeCValue(writer, operand, .Other); | 6519 | try f.writeCValue(writer, operand, .Other); |
| 6522 | if (need_memcpy) { | 6520 | try a.end(f, writer); |
| 6523 | try writer.writeAll(", sizeof("); | | |
| 6524 | try f.renderCType(writer, inst_scalar_cty); | | |
| 6525 | try writer.writeAll("))"); | | |
| 6526 | } | | |
| 6527 | try writer.writeAll(";\n"); | | |
| 6528 | try v.end(f, inst, writer); | 6521 | try v.end(f, inst, writer); |
| 6529 | | 6522 | |
| 6530 | return local; | 6523 | return local; |