commit 3fc0e0c57bcc8eb4a14712abc20c16677722fce0 (tree)
parent c8f844027185b808e2176a73fd41c955bc6e153e
Author: Andrew Kelley <andrew@ziglang.org>
Date: Sun, 27 Mar 2022 14:52:12 -0700
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.
Diffstat:
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/Sema.zig b/src/Sema.zig
@@ -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 {