diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2021-10-21 19:05:26 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2021-10-21 19:05:26 -0700 |
| commit | 7f70c27e9d57c8234545120da81861e2cfb354b5 (patch) | |
| tree | 47948dcf37e5e5767db2b428a8ef8177ef8eee86 /src/codegen/c.zig | |
| parent | a3c9bfef301e0a4675fcea57356653334e07df45 (diff) | |
| download | zig-7f70c27e9d57c8234545120da81861e2cfb354b5.tar.gz zig-7f70c27e9d57c8234545120da81861e2cfb354b5.zip | |
stage2: more division support
AIR:
* div is renamed to div_trunc.
* Add div_float, div_floor, div_exact.
- Implemented in Sema and LLVM codegen. C backend has a stub.
Improvements to std.math.big.Int:
* Add `eqZero` function to `Mutable`.
* Fix incorrect results for `divFloor`.
Compiler-rt:
* Add muloti4 to the stage2 section.
Diffstat (limited to 'src/codegen/c.zig')
| -rw-r--r-- | src/codegen/c.zig | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/codegen/c.zig b/src/codegen/c.zig index 9050499fce..aa1ece7ba3 100644 --- a/src/codegen/c.zig +++ b/src/codegen/c.zig @@ -976,7 +976,8 @@ fn genBody(f: *Function, body: []const Air.Inst.Index) error{ AnalysisFail, OutO .mul => try airBinOp (f, inst, " * "), // TODO use a different strategy for div that communicates to the optimizer // that wrapping is UB. - .div => try airBinOp( f, inst, " / "), + .div_float, .div_exact, .div_trunc => try airBinOp( f, inst, " / "), + .div_floor => try airBinOp( f, inst, " divfloor "), .rem => try airBinOp( f, inst, " % "), .mod => try airBinOp( f, inst, " mod "), // TODO implement modulus division |
