authorgravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2023-04-21 00:15:19-04:00
committergravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2023-04-21 16:36:31-04:00
loga519c9daced7dc182a57d8a49992463eabf3c825
tree596e8154fac01211c21ee66382898049de2b15e3
parente364627e3ea0de3037ced086406516d956c3bcd7

cbe: fix atomic float min/max

These need `zig_atomic`, unlike int min/max.

1 files changed, 9 insertions(+), 11 deletions(-)

src/codegen/c.zig+9-11
......@@ -6070,17 +6070,15 @@ fn airAtomicRmw(f: *Function, inst: Air.Inst.Index) !CValue {
60706070 try writer.writeByte('(');
60716071 try f.writeCValue(writer, local, .Other);
60726072 try writer.writeAll(", (");
6073 switch (extra.op()) {
6074 else => {
6075 try writer.writeAll("zig_atomic(");
6076 try f.renderType(writer, ty);
6077 try writer.writeByte(')');
6078 },
6079 .Nand, .Min, .Max => {
6080 // These are missing from stdatomic.h, so no atomic types for now.
6081 try f.renderType(writer, ty);
6082 },
6083 }
6073 const use_atomic = switch (extra.op()) {
6074 else => true,
6075 // These are missing from stdatomic.h, so no atomic types for now.
6076 .Nand => false,
6077 .Min, .Max => is_float,
6078 };
6079 if (use_atomic) try writer.writeAll("zig_atomic(");
6080 try f.renderType(writer, ty);
6081 if (use_atomic) try writer.writeByte(')');
60846082 if (ptr_ty.isVolatilePtr()) try writer.writeAll(" volatile");
60856083 try writer.writeAll(" *)");
60866084 try f.writeCValue(writer, ptr, .Other);