diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2022-06-30 17:34:05 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-06-30 17:34:05 -0400 |
| commit | 77a334451f1329110d6c1bd07b46813cef10e97c (patch) | |
| tree | 6708ceee35b9c7fc1c358696cd18a7b05d87bbf7 /src/Sema.zig | |
| parent | be18459c81f831e455750e62f37dae6aeef62f1d (diff) | |
| parent | b3b96b5e288ddf3694b4a0d203c684b9b8f6b49f (diff) | |
| download | zig-77a334451f1329110d6c1bd07b46813cef10e97c.tar.gz zig-77a334451f1329110d6c1bd07b46813cef10e97c.zip | |
Merge pull request #11967 from ziglang/runtime-float-negation
stage2: lower float negation explicitly + modify hash/eql logic for floats
Diffstat (limited to 'src/Sema.zig')
| -rw-r--r-- | src/Sema.zig | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/Sema.zig b/src/Sema.zig index fdf3810d4a..a071c97df3 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -10070,12 +10070,14 @@ fn zirNegate(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air. } if (rhs_scalar_ty.isAnyFloat()) { - // We handle comptime negation here to ensure negative zero is represented in the bits. + // We handle float negation here to ensure negative zero is represented in the bits. if (try sema.resolveMaybeUndefVal(block, rhs_src, rhs)) |rhs_val| { if (rhs_val.isUndef()) return sema.addConstUndef(rhs_ty); const target = sema.mod.getTarget(); return sema.addConstant(rhs_ty, try rhs_val.floatNeg(rhs_ty, sema.arena, target)); } + try sema.requireRuntimeBlock(block, rhs_src); + return block.addUnOp(.neg, rhs); } const lhs = if (rhs_ty.zigTypeTag() == .Vector) |
