| ... | @@ -5768,21 +5768,25 @@ fn airAsm(f: *Function, inst: Air.Inst.Index) !CValue { | ... | @@ -5768,21 +5768,25 @@ fn airAsm(f: *Function, inst: Air.Inst.Index) !CValue { |
| 5768 | switch (aggregate.storage) { | 5768 | switch (aggregate.storage) { |
| 5769 | .elems => |elems| for (elems, 0..) |elem, i| switch (elem) { | 5769 | .elems => |elems| for (elems, 0..) |elem, i| switch (elem) { |
| 5770 | .bool_true => { | 5770 | .bool_true => { |
| 5771 | const name = struct_type.structFieldName(i, zcu).toSlice(ip).?; | 5771 | const field_name = struct_type.structFieldName(i, zcu).toSlice(ip).?; |
| 5772 | assert(name.len != 0); | 5772 | assert(field_name.len != 0); |
| 5773 | | 5773 | |
| 5774 | const target = &f.object.dg.mod.resolved_target.result; | 5774 | const target = &f.object.dg.mod.resolved_target.result; |
| 5775 | if (target.cpu.arch.isMIPS() and name[0] == 'r') { | 5775 | var c_name_buf: [16]u8 = undefined; |
| 5776 | // GCC uses "$N" for register names instead of "rN" used by Zig. | 5776 | const name = |
| 5777 | var c_name_buf: [4]u8 = undefined; | 5777 | if ((target.cpu.arch.isMIPS() or target.cpu.arch == .alpha) and field_name[0] == 'r') name: { |
| 5778 | const c_name = (&c_name_buf)[0..name.len]; | 5778 | // Convert "rN" to "$N" |
| 5779 | @memcpy(c_name, name); | 5779 | const c_name = (&c_name_buf)[0..field_name.len]; |
| 5780 | c_name_buf[0] = '$'; | 5780 | @memcpy(c_name, field_name); |
| 5781 | | 5781 | c_name_buf[0] = '$'; |
| 5782 | try w.print(" {f}", .{fmtStringLiteral(c_name, null)}); | 5782 | break :name c_name; |
| 5783 | (try w.writableArray(1))[0] = ','; | 5783 | } else if ((target.cpu.arch.isMIPS() and (mem.startsWith(u8, field_name, "fcc") or field_name[0] == 'w')) or |
| 5784 | continue; | 5784 | ((target.cpu.arch.isMIPS() or target.cpu.arch == .alpha) and field_name[0] == 'f')) name: { |
| 5785 | } | 5785 | // "$" prefix for FCC, W and F registers |
| | 5786 | c_name_buf[0] = '$'; |
| | 5787 | @memcpy((&c_name_buf)[1..][0..field_name.len], field_name); |
| | 5788 | break :name (&c_name_buf)[0 .. 1 + field_name.len]; |
| | 5789 | } else field_name; |
| 5786 | | 5790 | |
| 5787 | try w.print(" {f}", .{fmtStringLiteral(name, null)}); | 5791 | try w.print(" {f}", .{fmtStringLiteral(name, null)}); |
| 5788 | (try w.writableArray(1))[0] = ','; | 5792 | (try w.writableArray(1))[0] = ','; |