diff options
| author | Koakuma <koachan@protonmail.com> | 2022-07-08 20:42:40 +0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2022-09-14 16:57:31 -0700 |
| commit | 61265fba04001e7802cb3e3dc9bca50032afc8e3 (patch) | |
| tree | 71ba2a23a829f3acae965f089f64929bca3946be | |
| parent | 4fc6df9f62f540fccc83bfe1723f37cf1f60d446 (diff) | |
| download | zig-61265fba04001e7802cb3e3dc9bca50032afc8e3.tar.gz zig-61265fba04001e7802cb3e3dc9bca50032afc8e3.zip | |
stage2: sparc64: Implement airBinop for bool_and/or
| -rw-r--r-- | src/arch/sparc64/CodeGen.zig | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/src/arch/sparc64/CodeGen.zig b/src/arch/sparc64/CodeGen.zig index d0a05c3525..97309e12cc 100644 --- a/src/arch/sparc64/CodeGen.zig +++ b/src/arch/sparc64/CodeGen.zig @@ -548,8 +548,8 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void { .cmp_vector => @panic("TODO try self.airCmpVector(inst)"), .cmp_lt_errors_len => try self.airCmpLtErrorsLen(inst), - .bool_and => @panic("TODO try self.airBoolOp(inst)"), - .bool_or => @panic("TODO try self.airBoolOp(inst)"), + .bool_and => try self.airBinOp(inst, .bool_and), + .bool_or => try self.airBinOp(inst, .bool_or), .bit_and => try self.airBinOp(inst, .bit_and), .bit_or => try self.airBinOp(inst, .bit_or), .xor => try self.airBinOp(inst, .xor), @@ -2525,6 +2525,26 @@ fn binOp( } }, + .bool_and, + .bool_or, + => { + switch (lhs_ty.zigTypeTag()) { + .Bool => { + assert(lhs != .immediate); // should have been handled by Sema + assert(rhs != .immediate); // should have been handled by Sema + + const mir_tag: Mir.Inst.Tag = switch (tag) { + .bool_and => .@"and", + .bool_or => .@"or", + else => unreachable, + }; + + return try self.binOpRegister(mir_tag, lhs, rhs, lhs_ty, rhs_ty, metadata); + }, + else => unreachable, + } + }, + .shl => { const base_tag: Air.Inst.Tag = switch (tag) { .shl => .shl_exact, |
