mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-05-21 08:32:02 +03:00
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
This commit is contained in:
committed by
Andrew Kelley
parent
79bc5891c1
commit
29f41896ed
@@ -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, " / "),
|
||||
|
||||
Reference in New Issue
Block a user