mirror of
https://github.com/ziglang/zig.git
synced 2024-11-27 23:52:31 +00:00
cbe: fix atomic float min/max
These need `zig_atomic`, unlike int min/max.
This commit is contained in:
parent
e364627e3e
commit
a519c9dace
@ -6070,17 +6070,15 @@ fn airAtomicRmw(f: *Function, inst: Air.Inst.Index) !CValue {
|
||||
try writer.writeByte('(');
|
||||
try f.writeCValue(writer, local, .Other);
|
||||
try writer.writeAll(", (");
|
||||
switch (extra.op()) {
|
||||
else => {
|
||||
try writer.writeAll("zig_atomic(");
|
||||
try f.renderType(writer, ty);
|
||||
try writer.writeByte(')');
|
||||
},
|
||||
.Nand, .Min, .Max => {
|
||||
// These are missing from stdatomic.h, so no atomic types for now.
|
||||
try f.renderType(writer, ty);
|
||||
},
|
||||
}
|
||||
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,
|
||||
};
|
||||
if (use_atomic) try writer.writeAll("zig_atomic(");
|
||||
try f.renderType(writer, ty);
|
||||
if (use_atomic) try writer.writeByte(')');
|
||||
if (ptr_ty.isVolatilePtr()) try writer.writeAll(" volatile");
|
||||
try writer.writeAll(" *)");
|
||||
try f.writeCValue(writer, ptr, .Other);
|
||||
|
Loading…
Reference in New Issue
Block a user