| ... | @@ -1031,7 +1031,23 @@ fn airCondBr(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -1031,7 +1031,23 @@ fn airCondBr(self: *Self, inst: Air.Inst.Index) !void { |
| 1031 | }, | 1031 | }, |
| 1032 | }, | 1032 | }, |
| 1033 | }), | 1033 | }), |
| 1034 | else => return self.fail("TODO branch on register content (BPr)", .{}), | 1034 | else => blk: { |
| | 1035 | const reg = switch (cond) { |
| | 1036 | .register => |r| r, |
| | 1037 | else => try self.copyToTmpRegister(Type.bool, cond), |
| | 1038 | }; |
| | 1039 | |
| | 1040 | break :blk try self.addInst(.{ |
| | 1041 | .tag = .bpr, |
| | 1042 | .data = .{ |
| | 1043 | .branch_predict_reg = .{ |
| | 1044 | .cond = .eq_zero, |
| | 1045 | .rs1 = reg, |
| | 1046 | .inst = undefined, // populated later through performReloc |
| | 1047 | }, |
| | 1048 | }, |
| | 1049 | }); |
| | 1050 | }, |
| 1035 | }; | 1051 | }; |
| 1036 | | 1052 | |
| 1037 | // Regardless of the branch type that's emitted, we need to reserve | 1053 | // Regardless of the branch type that's emitted, we need to reserve |