diff options
| author | John Schmidt <john.schmidt.h@gmail.com> | 2022-02-04 20:21:15 +0100 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2022-02-09 20:29:41 -0500 |
| commit | 7f0cf395aa74eb5ea250bd28f7525b3036790a6a (patch) | |
| tree | e2faf4e4a19836331d3e47180438fab4db4fb178 /src/codegen/c.zig | |
| parent | 44b5fdf3266f11607313bc9990a876b5a7f9e174 (diff) | |
| download | zig-7f0cf395aa74eb5ea250bd28f7525b3036790a6a.tar.gz zig-7f0cf395aa74eb5ea250bd28f7525b3036790a6a.zip | |
stage2: implement all builtin floatops for f{16,32,64}
- Merge `floatop.zig` and `floatop_stage1.zig` since most tests now pass
on stage2.
- Add more behavior tests for a bunch of functions.
Diffstat (limited to 'src/codegen/c.zig')
| -rw-r--r-- | src/codegen/c.zig | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/codegen/c.zig b/src/codegen/c.zig index fc3848df21..5d7bdcee55 100644 --- a/src/codegen/c.zig +++ b/src/codegen/c.zig @@ -1446,7 +1446,20 @@ fn genBody(f: *Function, body: []const Air.Inst.Index) error{ AnalysisFail, OutO .mul_sat => try airSatOp(f, inst, "muls_"), .shl_sat => try airSatOp(f, inst, "shls_"), - .sqrt => try airSqrt(f, inst), + .sqrt, + .sin, + .cos, + .exp, + .exp2, + .log, + .log2, + .log10, + .fabs, + .floor, + .ceil, + .round, + .trunc_float, + => |tag| return f.fail("TODO: C backend: implement unary op for tag '{s}'", .{@tagName(tag)}), .add_with_overflow => try airAddWithOverflow(f, inst), .sub_with_overflow => try airSubWithOverflow(f, inst), @@ -3395,12 +3408,6 @@ fn airPrefetch(f: *Function, inst: Air.Inst.Index) !CValue { return CValue.none; } -fn airSqrt(f: *Function, inst: Air.Inst.Index) !CValue { - _ = f; - _ = inst; - return f.fail("TODO: C backend: implement sqrt", .{}); -} - fn toMemoryOrder(order: std.builtin.AtomicOrder) [:0]const u8 { return switch (order) { .Unordered => "memory_order_relaxed", |
