| ... | ... | @@ -176364,7 +176364,7 @@ fn genTry( |
| 176364 | 176364 | .close_scope = true, |
| 176365 | 176365 | }); |
| 176366 | 176366 | |
| 176367 | | self.performReloc(reloc); |
| 176367 | if (reloc) |r| self.performReloc(r); |
| 176368 | 176368 | |
| 176369 | 176369 | for (liveness_cond_br.then_deaths) |death| try self.processDeath(death, .{}); |
| 176370 | 176370 | |
| ... | ... | @@ -176377,30 +176377,26 @@ fn genTry( |
| 176377 | 176377 | return result; |
| 176378 | 176378 | } |
| 176379 | 176379 | |
| 176380 | | fn genCondBrMir(self: *CodeGen, ty: Type, mcv: MCValue) !Mir.Inst.Index { |
| 176381 | | const pt = self.pt; |
| 176382 | | const abi_size = ty.abiSize(pt.zcu); |
| 176380 | fn genCondBrMir(self: *CodeGen, ty: Type, mcv: MCValue) !?Mir.Inst.Index { |
| 176383 | 176381 | switch (mcv) { |
| 176384 | | .eflags => |cc| { |
| 176385 | | // Here we map the opposites since the jump is to the false branch. |
| 176386 | | return self.asmJccReloc(cc.negate(), undefined); |
| 176387 | | }, |
| 176382 | .eflags => |cc| return try self.asmJccReloc(cc.negate(), undefined), |
| 176388 | 176383 | .register => |reg| { |
| 176389 | 176384 | try self.spillEflagsIfOccupied(); |
| 176390 | 176385 | try self.asmRegisterImmediate(.{ ._, .@"test" }, reg.to8(), .u(1)); |
| 176391 | | return self.asmJccReloc(.z, undefined); |
| 176386 | return try self.asmJccReloc(.z, undefined); |
| 176392 | 176387 | }, |
| 176393 | | .immediate, |
| 176394 | | .load_frame, |
| 176395 | | => { |
| 176388 | .immediate => |imm| switch (@as(u1, @truncate(imm))) { |
| 176389 | 0 => return try self.asmJmpReloc(undefined), |
| 176390 | 1 => return null, |
| 176391 | }, |
| 176392 | .load_frame => { |
| 176396 | 176393 | try self.spillEflagsIfOccupied(); |
| 176397 | | if (abi_size <= 8) { |
| 176398 | | const reg = try self.copyToTmpRegister(ty, mcv); |
| 176399 | | return self.genCondBrMir(ty, .{ .register = reg }); |
| 176400 | | } |
| 176401 | | return self.fail("TODO implement condbr when condition is {f} with abi larger than 8 bytes", .{mcv}); |
| 176394 | try self.asmMemoryImmediate(.{ ._, .@"test" }, try mcv.mem(self, .{ .size = .byte }), .u(1)); |
| 176395 | return try self.asmJccReloc(.z, undefined); |
| 176402 | 176396 | }, |
| 176403 | | else => return self.fail("TODO implement condbr when condition is {s}", .{@tagName(mcv)}), |
| 176397 | else => return self.fail("TODO implement condbr when condition is {f} {s}", .{ |
| 176398 | ty.fmt(self.pt), @tagName(mcv), |
| 176399 | }), |
| 176404 | 176400 | } |
| 176405 | 176401 | } |
| 176406 | 176402 | |
| ... | ... | @@ -176433,7 +176429,7 @@ fn airCondBr(self: *CodeGen, inst: Air.Inst.Index) !void { |
| 176433 | 176429 | .close_scope = true, |
| 176434 | 176430 | }); |
| 176435 | 176431 | |
| 176436 | | self.performReloc(reloc); |
| 176432 | if (reloc) |r| self.performReloc(r); |
| 176437 | 176433 | |
| 176438 | 176434 | for (liveness_cond_br.else_deaths) |death| try self.processDeath(death, .{}); |
| 176439 | 176435 | try self.genBodyBlock(else_body); |