stage2: sparcv9: Add cmp_lt_errors_len AIR inst & fix asm parsing

This commit is contained in:
Koakuma 2022-04-14 22:34:51 +07:00
parent f6b95166eb
commit 9201fbe85b

View File

@ -475,6 +475,7 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void {
.cmp_gt => @panic("TODO try self.airCmp(inst, .gt)"), .cmp_gt => @panic("TODO try self.airCmp(inst, .gt)"),
.cmp_neq => @panic("TODO try self.airCmp(inst, .neq)"), .cmp_neq => @panic("TODO try self.airCmp(inst, .neq)"),
.cmp_vector => @panic("TODO try self.airCmpVector(inst)"), .cmp_vector => @panic("TODO try self.airCmpVector(inst)"),
.cmp_lt_errors_len => @panic("TODO try self.airCmpLtErrorsLen(inst)"),
.bool_and => @panic("TODO try self.airBoolOp(inst)"), .bool_and => @panic("TODO try self.airBoolOp(inst)"),
.bool_or => @panic("TODO try self.airBoolOp(inst)"), .bool_or => @panic("TODO try self.airBoolOp(inst)"),
@ -647,10 +648,12 @@ fn airAsm(self: *Self, inst: Air.Inst.Index) !void {
} else null; } else null;
for (inputs) |input| { for (inputs) |input| {
const constraint = std.mem.sliceTo(std.mem.sliceAsBytes(self.air.extra[extra_i..]), 0); const input_bytes = std.mem.sliceAsBytes(self.air.extra[extra_i..]);
const constraint = std.mem.sliceTo(input_bytes, 0);
const input_name = std.mem.sliceTo(input_bytes[constraint.len + 1 ..], 0);
// This equation accounts for the fact that even if we have exactly 4 bytes // This equation accounts for the fact that even if we have exactly 4 bytes
// for the string, we still use the next u32 for the null terminator. // for the string, we still use the next u32 for the null terminator.
extra_i += constraint.len / 4 + 1; extra_i += (constraint.len + input_name.len + 1) / 4 + 1;
if (constraint.len < 3 or constraint[0] != '{' or constraint[constraint.len - 1] != '}') { if (constraint.len < 3 or constraint[0] != '{' or constraint[constraint.len - 1] != '}') {
return self.fail("unrecognized asm input constraint: '{s}'", .{constraint}); return self.fail("unrecognized asm input constraint: '{s}'", .{constraint});