commit 85a3991a4392cee42acf0ed5fed185afdc2b133c (tree)
parent 27c5c97f21c5e0c96d954246a6cc4d3018b71355
Author: joachimschmidt557 <joachim.schmidt557@outlook.com>
Date: Sat, 21 Nov 2020 19:15:01 +0100
stage2 codegen: use switch in genBoolOp
Diffstat:
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/codegen.zig b/src/codegen.zig
@@ -2189,12 +2189,12 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type {
if (inst.base.isUnused())
return MCValue.dead;
switch (arch) {
- .x86_64 => if (inst.base.tag == .booland) {
+ .x86_64 => switch (inst.base.tag) {
// lhs AND rhs
- return try self.genX8664BinMath(&inst.base, inst.lhs, inst.rhs, 4, 0x20);
- } else {
+ .booland => return try self.genX8664BinMath(&inst.base, inst.lhs, inst.rhs, 4, 0x20),
// lhs OR rhs
- return try self.genX8664BinMath(&inst.base, inst.lhs, inst.rhs, 1, 0x08);
+ .boolor => return try self.genX8664BinMath(&inst.base, inst.lhs, inst.rhs, 1, 0x08),
+ else => unreachable,
},
else => return self.fail(inst.base.src, "TODO implement boolean operations for {}", .{self.target.cpu.arch}),
}