authorgravatar for koachan@protonmail.comKoakuma <koachan@protonmail.com> 2022-04-14 22:34:51+07:00
committergravatar for koachan@protonmail.comKoakuma <koachan@protonmail.com> 2022-04-14 22:34:51+07:00
log9201fbe85bff4ae40573b64382131f779a7ed85c
tree58071aea10a1b4f49902ec4fa6a81d7e172351b5
parentf6b95166ebfce9faf3cc0806c6feb089e6922a2e

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


1 files changed, 5 insertions(+), 2 deletions(-)

src/arch/sparcv9/CodeGen.zig+5-2
...@@ -475,6 +475,7 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void {...@@ -475,6 +475,7 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void {
475 .cmp_gt => @panic("TODO try self.airCmp(inst, .gt)"),475 .cmp_gt => @panic("TODO try self.airCmp(inst, .gt)"),
476 .cmp_neq => @panic("TODO try self.airCmp(inst, .neq)"),476 .cmp_neq => @panic("TODO try self.airCmp(inst, .neq)"),
477 .cmp_vector => @panic("TODO try self.airCmpVector(inst)"),477 .cmp_vector => @panic("TODO try self.airCmpVector(inst)"),
478 .cmp_lt_errors_len => @panic("TODO try self.airCmpLtErrorsLen(inst)"),
478479
479 .bool_and => @panic("TODO try self.airBoolOp(inst)"),480 .bool_and => @panic("TODO try self.airBoolOp(inst)"),
480 .bool_or => @panic("TODO try self.airBoolOp(inst)"),481 .bool_or => @panic("TODO try self.airBoolOp(inst)"),
...@@ -647,10 +648,12 @@ fn airAsm(self: *Self, inst: Air.Inst.Index) !void {...@@ -647,10 +648,12 @@ fn airAsm(self: *Self, inst: Air.Inst.Index) !void {
647 } else null;648 } else null;
648649
649 for (inputs) |input| {650 for (inputs) |input| {
650 const constraint = std.mem.sliceTo(std.mem.sliceAsBytes(self.air.extra[extra_i..]), 0);651 const input_bytes = std.mem.sliceAsBytes(self.air.extra[extra_i..]);
652 const constraint = std.mem.sliceTo(input_bytes, 0);
653 const input_name = std.mem.sliceTo(input_bytes[constraint.len + 1 ..], 0);
651 // This equation accounts for the fact that even if we have exactly 4 bytes654 // This equation accounts for the fact that even if we have exactly 4 bytes
652 // for the string, we still use the next u32 for the null terminator.655 // for the string, we still use the next u32 for the null terminator.
653 extra_i += constraint.len / 4 + 1;656 extra_i += (constraint.len + input_name.len + 1) / 4 + 1;
654657
655 if (constraint.len < 3 or constraint[0] != '{' or constraint[constraint.len - 1] != '}') {658 if (constraint.len < 3 or constraint[0] != '{' or constraint[constraint.len - 1] != '}') {
656 return self.fail("unrecognized asm input constraint: '{s}'", .{constraint});659 return self.fail("unrecognized asm input constraint: '{s}'", .{constraint});