stage2: sparc64: Add BPr support for airCondBr

This commit is contained in:
Koakuma 2022-05-06 23:20:02 +07:00
parent e057ff2496
commit ae2d6b7eea

View File

@ -1031,7 +1031,23 @@ fn airCondBr(self: *Self, inst: Air.Inst.Index) !void {
},
},
}),
else => return self.fail("TODO branch on register content (BPr)", .{}),
else => blk: {
const reg = switch (cond) {
.register => |r| r,
else => try self.copyToTmpRegister(Type.bool, cond),
};
break :blk try self.addInst(.{
.tag = .bpr,
.data = .{
.branch_predict_reg = .{
.cond = .eq_zero,
.rs1 = reg,
.inst = undefined, // populated later through performReloc
},
},
});
},
};
// Regardless of the branch type that's emitted, we need to reserve