authorgravatar for koachan@protonmail.comKoakuma <koachan@protonmail.com> 2022-06-19 10:46:50+07:00
committergravatar for koachan@protonmail.comKoakuma <koachan@protonmail.com> 2022-06-24 21:19:33+07:00
log4fd0500bb570572a89c8f342c6d9bdb4a69331a7
treeaa9fb25e31698dce66ba4cb53761d1ca20a0ea38
parent837cd0d8af294405316dc6757ce3d0e105c86218

stage2: sparc64: Implement airBoolToInt


1 files changed, 8 insertions(+), 1 deletions(-)

src/arch/sparc64/CodeGen.zig+8-1
...@@ -585,7 +585,7 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void {...@@ -585,7 +585,7 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void {
585 .fpext => @panic("TODO try self.airFpext(inst)"),585 .fpext => @panic("TODO try self.airFpext(inst)"),
586 .intcast => try self.airIntCast(inst),586 .intcast => try self.airIntCast(inst),
587 .trunc => @panic("TODO try self.airTrunc(inst)"),587 .trunc => @panic("TODO try self.airTrunc(inst)"),
588 .bool_to_int => @panic("TODO try self.airBoolToInt(inst)"),588 .bool_to_int => try self.airBoolToInt(inst),
589 .is_non_null => try self.airIsNonNull(inst),589 .is_non_null => try self.airIsNonNull(inst),
590 .is_non_null_ptr => @panic("TODO try self.airIsNonNullPtr(inst)"),590 .is_non_null_ptr => @panic("TODO try self.airIsNonNullPtr(inst)"),
591 .is_null => try self.airIsNull(inst),591 .is_null => try self.airIsNull(inst),
...@@ -985,6 +985,13 @@ fn airBinOp(self: *Self, inst: Air.Inst.Index, tag: Air.Inst.Tag) !void {...@@ -985,6 +985,13 @@ fn airBinOp(self: *Self, inst: Air.Inst.Index, tag: Air.Inst.Tag) !void {
985 return self.finishAir(inst, result, .{ bin_op.lhs, bin_op.rhs, .none });985 return self.finishAir(inst, result, .{ bin_op.lhs, bin_op.rhs, .none });
986}986}
987987
988fn airBoolToInt(self: *Self, inst: Air.Inst.Index) !void {
989 const un_op = self.air.instructions.items(.data)[inst].un_op;
990 const operand = try self.resolveInst(un_op);
991 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else operand;
992 return self.finishAir(inst, result, .{ un_op, .none, .none });
993}
994
988fn airPtrArithmetic(self: *Self, inst: Air.Inst.Index, tag: Air.Inst.Tag) !void {995fn airPtrArithmetic(self: *Self, inst: Air.Inst.Index, tag: Air.Inst.Tag) !void {
989 const ty_pl = self.air.instructions.items(.data)[inst].ty_pl;996 const ty_pl = self.air.instructions.items(.data)[inst].ty_pl;
990 const bin_op = self.air.extraData(Air.Bin, ty_pl.payload).data;997 const bin_op = self.air.extraData(Air.Bin, ty_pl.payload).data;