From d56c6c77913a6d560b7d3ebd6283cbf71d5a0222 Mon Sep 17 00:00:00 2001 From: Jacob Young Date: Fri, 21 Apr 2023 15:58:40 -0400 Subject: cbe: implement 128-bit atomics support * Disable 128-bit atomics for x86_64 generic (currently also baseline) because they require heavy abi agreement to correctly lower. ** This is a breaking change ** * Enable 128-bit atomics for aarch64 in Sema since it just works. --- src/codegen/c.zig | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/codegen') diff --git a/src/codegen/c.zig b/src/codegen/c.zig index 832a97526e..8697411793 100644 --- a/src/codegen/c.zig +++ b/src/codegen/c.zig @@ -6062,19 +6062,19 @@ fn airAtomicRmw(f: *Function, inst: Air.Inst.Index) !CValue { .data = @intCast(u16, ty.abiSize(target) * 8), }; const is_float = ty.isRuntimeFloat(); + const is_128 = repr_pl.data == 128; const repr_ty = if (is_float) Type.initPayload(&repr_pl.base) else ty; const operand_mat = try Materialize.start(f, inst, writer, ty, operand); try writer.print("zig_atomicrmw_{s}", .{toAtomicRmwSuffix(extra.op())}); - if (is_float) try writer.writeAll("_float"); + if (is_float) try writer.writeAll("_float") else if (is_128) try writer.writeAll("_int128"); try writer.writeByte('('); try f.writeCValue(writer, local, .Other); try writer.writeAll(", ("); const use_atomic = switch (extra.op()) { else => true, - // These are missing from stdatomic.h, so no atomic types for now. - .Nand => false, - .Min, .Max => is_float, + // These are missing from stdatomic.h, so no atomic types unless a fallback is used. + .Nand, .Min, .Max => is_float or is_128, }; if (use_atomic) try writer.writeAll("zig_atomic("); try f.renderType(writer, ty); -- cgit v1.2.3