authorgravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2023-05-08 23:46:19-04:00
committergravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2023-05-10 15:11:52-04:00
log31a13ce2e3fa16de94954f5a6c22d2d650cd8262
tree1d6890bff4d821051d82ff1a6d72ea49a24fa7fb
parent2d2d79a05b8423c7638348dc5a89793c1e0cafce

cbe: use `Assignment` in `airSplat`


1 files changed, 3 insertions(+), 10 deletions(-)

src/codegen/c.zig+3-10
......@@ -6508,23 +6508,16 @@ fn airSplat(f: *Function, inst: Air.Inst.Index) !CValue {
65086508
65096509 const inst_ty = f.air.typeOfIndex(inst);
65106510 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;
65136511
65146512 const writer = f.object.writer();
65156513 const local = try f.allocLocal(inst, inst_ty);
65166514 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);
65186516 try f.writeCValue(writer, local, .Other);
65196517 try v.elem(f, writer);
6520 try writer.writeAll(if (need_memcpy) ", &" else " = ");
6518 try a.assign(f, writer);
65216519 try f.writeCValue(writer, operand, .Other);
6522 if (need_memcpy) {
6523 try writer.writeAll(", sizeof(");
6524 try f.renderCType(writer, inst_scalar_cty);
6525 try writer.writeAll("))");
6526 }
6527 try writer.writeAll(";\n");
6520 try a.end(f, writer);
65286521 try v.end(f, inst, writer);
65296522
65306523 return local;