authorgravatar for koachan@protonmail.comKoakuma <koachan@protonmail.com> 2022-07-08 20:42:40+07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-09-14 16:57:31-07:00
log61265fba04001e7802cb3e3dc9bca50032afc8e3
tree71ba2a23a829f3acae965f089f64929bca3946be
parent4fc6df9f62f540fccc83bfe1723f37cf1f60d446

stage2: sparc64: Implement airBinop for bool_and/or


1 files changed, 22 insertions(+), 2 deletions(-)

src/arch/sparc64/CodeGen.zig+22-2
...@@ -548,8 +548,8 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void {...@@ -548,8 +548,8 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void {
548 .cmp_vector => @panic("TODO try self.airCmpVector(inst)"),548 .cmp_vector => @panic("TODO try self.airCmpVector(inst)"),
549 .cmp_lt_errors_len => try self.airCmpLtErrorsLen(inst),549 .cmp_lt_errors_len => try self.airCmpLtErrorsLen(inst),
550550
551 .bool_and => @panic("TODO try self.airBoolOp(inst)"),551 .bool_and => try self.airBinOp(inst, .bool_and),
552 .bool_or => @panic("TODO try self.airBoolOp(inst)"),552 .bool_or => try self.airBinOp(inst, .bool_or),
553 .bit_and => try self.airBinOp(inst, .bit_and),553 .bit_and => try self.airBinOp(inst, .bit_and),
554 .bit_or => try self.airBinOp(inst, .bit_or),554 .bit_or => try self.airBinOp(inst, .bit_or),
555 .xor => try self.airBinOp(inst, .xor),555 .xor => try self.airBinOp(inst, .xor),
...@@ -2525,6 +2525,26 @@ fn binOp(...@@ -2525,6 +2525,26 @@ fn binOp(
2525 }2525 }
2526 },2526 },
25272527
2528 .bool_and,
2529 .bool_or,
2530 => {
2531 switch (lhs_ty.zigTypeTag()) {
2532 .Bool => {
2533 assert(lhs != .immediate); // should have been handled by Sema
2534 assert(rhs != .immediate); // should have been handled by Sema
2535
2536 const mir_tag: Mir.Inst.Tag = switch (tag) {
2537 .bool_and => .@"and",
2538 .bool_or => .@"or",
2539 else => unreachable,
2540 };
2541
2542 return try self.binOpRegister(mir_tag, lhs, rhs, lhs_ty, rhs_ty, metadata);
2543 },
2544 else => unreachable,
2545 }
2546 },
2547
2528 .shl => {2548 .shl => {
2529 const base_tag: Air.Inst.Tag = switch (tag) {2549 const base_tag: Air.Inst.Tag = switch (tag) {
2530 .shl => .shl_exact,2550 .shl => .shl_exact,