diff options
| author | Travis Staloch <twostepted@gmail.com> | 2021-09-02 13:50:24 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2021-09-28 17:02:43 -0700 |
| commit | 29f41896ed9d99e82a88f4b63efa182ca0d2f93c (patch) | |
| tree | 1e6eb1159df89f79b04f050da662653925c77b1c /src/codegen/c.zig | |
| parent | 79bc5891c1c4cde0592fe1b10b6c9a85914155cf (diff) | |
| download | zig-29f41896ed9d99e82a88f4b63efa182ca0d2f93c.tar.gz zig-29f41896ed9d99e82a88f4b63efa182ca0d2f93c.zip | |
sat-arithmetic: add operator support
- adds initial support for the operators +|, -|, *|, <<|, +|=, -|=, *|=, <<|=
- uses operators in addition to builtins in behavior test
- adds binOpExt() and assignBinOpExt() to AstGen.zig. these need to be audited
Diffstat (limited to 'src/codegen/c.zig')
| -rw-r--r-- | src/codegen/c.zig | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/codegen/c.zig b/src/codegen/c.zig index 4964f17cd3..dce0c10b4c 100644 --- a/src/codegen/c.zig +++ b/src/codegen/c.zig @@ -885,14 +885,17 @@ fn genBody(f: *Function, body: []const Air.Inst.Index) error{ AnalysisFail, OutO // that wrapping is UB. .add, .ptr_add => try airBinOp( f, inst, " + "), .addwrap => try airWrapOp(f, inst, " + ", "addw_"), + .addsat => return o.dg.fail("TODO: C backend: implement codegen for addsat", .{}), // TODO use a different strategy for sub that communicates to the optimizer // that wrapping is UB. .sub, .ptr_sub => try airBinOp( f, inst, " - "), .subwrap => try airWrapOp(f, inst, " - ", "subw_"), + .subsat => return o.dg.fail("TODO: C backend: implement codegen for subsat", .{}), // TODO use a different strategy for mul that communicates to the optimizer // that wrapping is UB. .mul => try airBinOp( f, inst, " * "), .mulwrap => try airWrapOp(f, inst, " * ", "mulw_"), + .mulsat => return o.dg.fail("TODO: C backend: implement codegen for mulsat", .{}), // TODO use a different strategy for div that communicates to the optimizer // that wrapping is UB. .div => try airBinOp( f, inst, " / "), |
