Sema: implement @setFloatMode

We are putting off actual optimization of floats because we have a
couple proposals being considered which would change how it works.

In the meantime, lowering optimized float mode to be the same as
strict is a perfectly legal way to implement the Zig language specification.
This commit is contained in:
Andrew Kelley 2022-03-27 14:52:12 -07:00
parent c8f8440271
commit 3fc0e0c57b

View File

@ -4315,7 +4315,13 @@ fn zirSetCold(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!voi
fn zirSetFloatMode(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void {
const inst_data = sema.code.instructions.items(.data)[inst].un_node;
const src: LazySrcLoc = inst_data.src();
return sema.fail(block, src, "TODO: implement Sema.zirSetFloatMode", .{});
const float_mode = try sema.resolveBuiltinEnum(block, src, inst_data.operand, "FloatMode");
switch (float_mode) {
.Strict => return,
.Optimized => {
// TODO implement optimized float mode
},
}
}
fn zirSetRuntimeSafety(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void {