authorgravatar for twostepted@gmail.comTravis Staloch <twostepted@gmail.com> 2021-09-08 16:30:11-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-09-28 17:03:43-07:00
logbdb90a07bbf0fdedca71f5deace7087bc562b437
treef62be4936977a1af845abe6687bc624618eed22a
parentdcbc52ec85d00fbd3603c314aaaab98fb3866892

sat-arithmetic: fixups zig fmt / astcheck


2 files changed, 6 insertions(+), 7 deletions(-)

src/AstGen.zig+1-1
...@@ -2786,7 +2786,7 @@ fn assignShift(...@@ -2786,7 +2786,7 @@ fn assignShift(
2786fn assignShiftSat(2786fn assignShiftSat(
2787 gz: *GenZir,2787 gz: *GenZir,
2788 scope: *Scope,2788 scope: *Scope,
2789 infix_node: ast.Node.Index,2789 infix_node: Ast.Node.Index,
2790 op_inst_tag: Zir.Inst.Tag,2790 op_inst_tag: Zir.Inst.Tag,
2791) InnerError!void {2791) InnerError!void {
2792 try emitDbgNode(gz, infix_node);2792 try emitDbgNode(gz, infix_node);
src/codegen/c.zig+5-6
...@@ -1317,7 +1317,6 @@ fn airWrapOp(...@@ -1317,7 +1317,6 @@ fn airWrapOp(
1317fn airSatOp(1317fn airSatOp(
1318 o: *Object,1318 o: *Object,
1319 inst: Air.Inst.Index,1319 inst: Air.Inst.Index,
1320 str_op: [*:0]const u8,
1321 fn_op: [*:0]const u8,1320 fn_op: [*:0]const u8,
1322) !CValue {1321) !CValue {
1323 if (o.liveness.isUnused(inst))1322 if (o.liveness.isUnused(inst))
...@@ -1328,12 +1327,12 @@ fn airSatOp(...@@ -1328,12 +1327,12 @@ fn airSatOp(
1328 const int_info = inst_ty.intInfo(o.dg.module.getTarget());1327 const int_info = inst_ty.intInfo(o.dg.module.getTarget());
1329 const bits = int_info.bits;1328 const bits = int_info.bits;
13301329
1331 // if it's an unsigned int with non-arbitrary bit size then we can just add1330 switch (bits) {
1332 const ok_bits = switch (bits) {1331 8, 16, 32, 64, 128 => {},
1333 8, 16, 32, 64, 128 => true,1332 else => return o.dg.fail("TODO: C backend: airSatOp for non power of 2 integers", .{}),
1334 else => false,1333 }
1335 };
13361334
1335 // if it's an unsigned int with non-arbitrary bit size then we can just add
1337 if (bits > 64) {1336 if (bits > 64) {
1338 return f.fail("TODO: C backend: airSatOp for large integers", .{});1337 return f.fail("TODO: C backend: airSatOp for large integers", .{});
1339 }1338 }