From 31a13ce2e3fa16de94954f5a6c22d2d650cd8262 Mon Sep 17 00:00:00 2001 From: Jacob Young Date: Mon, 8 May 2023 23:46:19 -0400 Subject: cbe: use `Assignment` in `airSplat` --- src/codegen/c.zig | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'src/codegen/c.zig') diff --git a/src/codegen/c.zig b/src/codegen/c.zig index 7da99de5c1..86b74b1429 100644 --- a/src/codegen/c.zig +++ b/src/codegen/c.zig @@ -6508,23 +6508,16 @@ fn airSplat(f: *Function, inst: Air.Inst.Index) !CValue { const inst_ty = f.air.typeOfIndex(inst); const inst_scalar_ty = inst_ty.scalarType(); - const inst_scalar_cty = try f.typeToIndex(inst_scalar_ty, .complete); - const need_memcpy = f.indexToCType(inst_scalar_cty).tag() == .array; const writer = f.object.writer(); const local = try f.allocLocal(inst, inst_ty); const v = try Vectorize.start(f, inst, writer, inst_ty); - if (need_memcpy) try writer.writeAll("memcpy(&"); + const a = try Assignment.init(f, inst_scalar_ty); try f.writeCValue(writer, local, .Other); try v.elem(f, writer); - try writer.writeAll(if (need_memcpy) ", &" else " = "); + try a.assign(f, writer); try f.writeCValue(writer, operand, .Other); - if (need_memcpy) { - try writer.writeAll(", sizeof("); - try f.renderCType(writer, inst_scalar_cty); - try writer.writeAll("))"); - } - try writer.writeAll(";\n"); + try a.end(f, writer); try v.end(f, inst, writer); return local; -- cgit v1.2.3