| author | |
| committer | |
| log | ffb63a05a3327e64bcf8ec7fd05c6aab8d304480 |
| tree | 5284c825f8126f35d756599f524a2f612620ddd4 |
| parent | 2fd83d8c0a8dd28c2474b26ead8cb24d6bde0901 |
i just hadn't realized that I placed the `riscv_start` branch in the non-simplified
starts28 files changed, 139 insertions(+), 66 deletions(-)
lib/std/start.zig+20-6| ... | @@ -22,7 +22,8 @@ pub const simplified_logic = | ... | @@ -22,7 +22,8 @@ pub const simplified_logic = |
| 22 | builtin.zig_backend == .stage2_arm or | 22 | builtin.zig_backend == .stage2_arm or |
| 23 | builtin.zig_backend == .stage2_sparc64 or | 23 | builtin.zig_backend == .stage2_sparc64 or |
| 24 | builtin.cpu.arch == .spirv32 or | 24 | builtin.cpu.arch == .spirv32 or |
| 25 | builtin.cpu.arch == .spirv64; | 25 | builtin.cpu.arch == .spirv64 or |
| 26 | builtin.zig_backend == .stage2_riscv64; | ||
| 26 | 27 | ||
| 27 | comptime { | 28 | comptime { |
| 28 | // No matter what, we import the root file, so that any export, test, comptime | 29 | // No matter what, we import the root file, so that any export, test, comptime |
| ... | @@ -42,6 +43,10 @@ comptime { | ... | @@ -42,6 +43,10 @@ comptime { |
| 42 | } else if (builtin.os.tag == .opencl) { | 43 | } else if (builtin.os.tag == .opencl) { |
| 43 | if (@hasDecl(root, "main")) | 44 | if (@hasDecl(root, "main")) |
| 44 | @export(spirvMain2, .{ .name = "main" }); | 45 | @export(spirvMain2, .{ .name = "main" }); |
| 46 | } else if (native_arch.isRISCV()) { | ||
| 47 | if (!@hasDecl(root, "_start")) { | ||
| 48 | @export(riscv_start, .{ .name = "_start" }); | ||
| 49 | } | ||
| 45 | } else { | 50 | } else { |
| 46 | if (!@hasDecl(root, "_start")) { | 51 | if (!@hasDecl(root, "_start")) { |
| 47 | @export(_start2, .{ .name = "_start" }); | 52 | @export(_start2, .{ .name = "_start" }); |
| ... | @@ -60,10 +65,6 @@ comptime { | ... | @@ -60,10 +65,6 @@ comptime { |
| 60 | } else if (@typeInfo(@TypeOf(root.main)).Fn.calling_convention != .C) { | 65 | } else if (@typeInfo(@TypeOf(root.main)).Fn.calling_convention != .C) { |
| 61 | @export(main, .{ .name = "main" }); | 66 | @export(main, .{ .name = "main" }); |
| 62 | } | 67 | } |
| 63 | } else if (native_arch.isRISCV()) { | ||
| 64 | if (!@hasDecl(root, "_start")) { | ||
| 65 | @export(riscv_start, .{ .name = "_start" }); | ||
| 66 | } | ||
| 67 | } else if (native_os == .windows) { | 68 | } else if (native_os == .windows) { |
| 68 | if (!@hasDecl(root, "WinMain") and !@hasDecl(root, "WinMainCRTStartup") and | 69 | if (!@hasDecl(root, "WinMain") and !@hasDecl(root, "WinMainCRTStartup") and |
| 69 | !@hasDecl(root, "wWinMain") and !@hasDecl(root, "wWinMainCRTStartup")) | 70 | !@hasDecl(root, "wWinMain") and !@hasDecl(root, "wWinMainCRTStartup")) |
| ... | @@ -208,7 +209,20 @@ fn wasi_start() callconv(.C) void { | ... | @@ -208,7 +209,20 @@ fn wasi_start() callconv(.C) void { |
| 208 | } | 209 | } |
| 209 | 210 | ||
| 210 | fn riscv_start() callconv(.C) noreturn { | 211 | fn riscv_start() callconv(.C) noreturn { |
| 211 | std.process.exit(@call(.always_inline, callMain, .{})); | 212 | std.process.exit(switch (@typeInfo(@typeInfo(@TypeOf(root.main)).Fn.return_type.?)) { |
| 213 | .NoReturn => root.main(), | ||
| 214 | .Void => ret: { | ||
| 215 | root.main(); | ||
| 216 | break :ret 0; | ||
| 217 | }, | ||
| 218 | .Int => |info| ret: { | ||
| 219 | if (info.bits != 8 or info.signedness == .signed) { | ||
| 220 | @compileError(bad_main_ret); | ||
| 221 | } | ||
| 222 | break :ret root.main(); | ||
| 223 | }, | ||
| 224 | else => @compileError("expected return type of main to be 'void', 'noreturn', 'u8'"), | ||
| 225 | }); | ||
| 212 | } | 226 | } |
| 213 | 227 | ||
| 214 | fn EfiMain(handle: uefi.Handle, system_table: *uefi.tables.SystemTable) callconv(.C) usize { | 228 | fn EfiMain(handle: uefi.Handle, system_table: *uefi.tables.SystemTable) callconv(.C) usize { |
lib/std/testing.zig+1-1| ... | @@ -22,7 +22,7 @@ pub var base_allocator_instance = std.heap.FixedBufferAllocator.init(""); | ... | @@ -22,7 +22,7 @@ pub var base_allocator_instance = std.heap.FixedBufferAllocator.init(""); |
| 22 | pub var log_level = std.log.Level.warn; | 22 | pub var log_level = std.log.Level.warn; |
| 23 | 23 | ||
| 24 | // Disable printing in tests for simple backends. | 24 | // Disable printing in tests for simple backends. |
| 25 | pub const backend_can_print = builtin.zig_backend != .stage2_spirv64 and builtin.zig_backend != .stage2_riscv64; | 25 | pub const backend_can_print = !(builtin.zig_backend == .stage2_spirv64 or builtin.zig_backend == .stage2_riscv64); |
| 26 | 26 | ||
| 27 | fn print(comptime fmt: []const u8, args: anytype) void { | 27 | fn print(comptime fmt: []const u8, args: anytype) void { |
| 28 | if (@inComptime()) { | 28 | if (@inComptime()) { |
src/arch/riscv64/CodeGen.zig+65-21| ... | @@ -43,6 +43,8 @@ const callee_preserved_regs = abi.callee_preserved_regs; | ... | @@ -43,6 +43,8 @@ const callee_preserved_regs = abi.callee_preserved_regs; |
| 43 | const gp = abi.RegisterClass.gp; | 43 | const gp = abi.RegisterClass.gp; |
| 44 | /// Function Args | 44 | /// Function Args |
| 45 | const fa = abi.RegisterClass.fa; | 45 | const fa = abi.RegisterClass.fa; |
| 46 | /// Function Returns | ||
| 47 | const fr = abi.RegisterClass.fr; | ||
| 46 | /// Temporary Use | 48 | /// Temporary Use |
| 47 | const tp = abi.RegisterClass.tp; | 49 | const tp = abi.RegisterClass.tp; |
| 48 | 50 | ||
| ... | @@ -1083,8 +1085,8 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void { | ... | @@ -1083,8 +1085,8 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void { |
| 1083 | .mod => try self.airMod(inst), | 1085 | .mod => try self.airMod(inst), |
| 1084 | .shl, .shl_exact => try self.airShl(inst), | 1086 | .shl, .shl_exact => try self.airShl(inst), |
| 1085 | .shl_sat => try self.airShlSat(inst), | 1087 | .shl_sat => try self.airShlSat(inst), |
| 1086 | .min => try self.airMin(inst), | 1088 | .min => try self.airMinMax(inst, .min), |
| 1087 | .max => try self.airMax(inst), | 1089 | .max => try self.airMinMax(inst, .max), |
| 1088 | .slice => try self.airSlice(inst), | 1090 | .slice => try self.airSlice(inst), |
| 1089 | 1091 | ||
| 1090 | .sqrt, | 1092 | .sqrt, |
| ... | @@ -1672,7 +1674,6 @@ fn airAlloc(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -1672,7 +1674,6 @@ fn airAlloc(self: *Self, inst: Air.Inst.Index) !void { |
| 1672 | 1674 | ||
| 1673 | fn airRetPtr(self: *Self, inst: Air.Inst.Index) !void { | 1675 | fn airRetPtr(self: *Self, inst: Air.Inst.Index) !void { |
| 1674 | const result: MCValue = switch (self.ret_mcv.long) { | 1676 | const result: MCValue = switch (self.ret_mcv.long) { |
| 1675 | else => unreachable, | ||
| 1676 | .none => .{ .lea_frame = .{ .index = try self.allocMemPtr(inst) } }, | 1677 | .none => .{ .lea_frame = .{ .index = try self.allocMemPtr(inst) } }, |
| 1677 | .load_frame => .{ .register_offset = .{ | 1678 | .load_frame => .{ .register_offset = .{ |
| 1678 | .reg = (try self.copyToNewRegister( | 1679 | .reg = (try self.copyToNewRegister( |
| ... | @@ -1681,6 +1682,7 @@ fn airRetPtr(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -1681,6 +1682,7 @@ fn airRetPtr(self: *Self, inst: Air.Inst.Index) !void { |
| 1681 | )).register, | 1682 | )).register, |
| 1682 | .off = self.ret_mcv.short.indirect.off, | 1683 | .off = self.ret_mcv.short.indirect.off, |
| 1683 | } }, | 1684 | } }, |
| 1685 | else => |t| return self.fail("TODO: airRetPtr {s}", .{@tagName(t)}), | ||
| 1684 | }; | 1686 | }; |
| 1685 | return self.finishAir(inst, result, .{ .none, .none, .none }); | 1687 | return self.finishAir(inst, result, .{ .none, .none, .none }); |
| 1686 | } | 1688 | } |
| ... | @@ -1799,7 +1801,14 @@ fn airNot(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -1799,7 +1801,14 @@ fn airNot(self: *Self, inst: Air.Inst.Index) !void { |
| 1799 | return self.finishAir(inst, result, .{ ty_op.operand, .none, .none }); | 1801 | return self.finishAir(inst, result, .{ ty_op.operand, .none, .none }); |
| 1800 | } | 1802 | } |
| 1801 | 1803 | ||
| 1802 | fn airMin(self: *Self, inst: Air.Inst.Index) !void { | 1804 | fn airMinMax( |
| 1805 | self: *Self, | ||
| 1806 | inst: Air.Inst.Index, | ||
| 1807 | comptime tag: enum { | ||
| 1808 | max, | ||
| 1809 | min, | ||
| 1810 | }, | ||
| 1811 | ) !void { | ||
| 1803 | const zcu = self.bin_file.comp.module.?; | 1812 | const zcu = self.bin_file.comp.module.?; |
| 1804 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | 1813 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; |
| 1805 | 1814 | ||
| ... | @@ -1882,7 +1891,7 @@ fn airMin(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -1882,7 +1891,7 @@ fn airMin(self: *Self, inst: Air.Inst.Index) !void { |
| 1882 | .ops = .rrr, | 1891 | .ops = .rrr, |
| 1883 | .data = .{ .r_type = .{ | 1892 | .data = .{ .r_type = .{ |
| 1884 | .rd = result_reg, | 1893 | .rd = result_reg, |
| 1885 | .rs1 = rhs_reg, | 1894 | .rs1 = if (tag == .min) rhs_reg else lhs_reg, |
| 1886 | .rs2 = mask_reg, | 1895 | .rs2 = mask_reg, |
| 1887 | } }, | 1896 | } }, |
| 1888 | }); | 1897 | }); |
| ... | @@ -1892,12 +1901,6 @@ fn airMin(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -1892,12 +1901,6 @@ fn airMin(self: *Self, inst: Air.Inst.Index) !void { |
| 1892 | return self.finishAir(inst, result, .{ bin_op.lhs, bin_op.rhs, .none }); | 1901 | return self.finishAir(inst, result, .{ bin_op.lhs, bin_op.rhs, .none }); |
| 1893 | } | 1902 | } |
| 1894 | 1903 | ||
| 1895 | fn airMax(self: *Self, inst: Air.Inst.Index) !void { | ||
| 1896 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | ||
| 1897 | const result: MCValue = if (self.liveness.isUnused(inst)) .unreach else return self.fail("TODO implement max for {}", .{self.target.cpu.arch}); | ||
| 1898 | return self.finishAir(inst, result, .{ bin_op.lhs, bin_op.rhs, .none }); | ||
| 1899 | } | ||
| 1900 | |||
| 1901 | fn airSlice(self: *Self, inst: Air.Inst.Index) !void { | 1904 | fn airSlice(self: *Self, inst: Air.Inst.Index) !void { |
| 1902 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | 1905 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; |
| 1903 | const bin_op = self.air.extraData(Air.Bin, ty_pl.payload).data; | 1906 | const bin_op = self.air.extraData(Air.Bin, ty_pl.payload).data; |
| ... | @@ -3577,10 +3580,10 @@ fn genCall( | ... | @@ -3577,10 +3580,10 @@ fn genCall( |
| 3577 | const func_key = zcu.intern_pool.indexToKey(func_value.ip_index); | 3580 | const func_key = zcu.intern_pool.indexToKey(func_value.ip_index); |
| 3578 | switch (switch (func_key) { | 3581 | switch (switch (func_key) { |
| 3579 | else => func_key, | 3582 | else => func_key, |
| 3580 | .ptr => |ptr| switch (ptr.addr) { | 3583 | .ptr => |ptr| if (ptr.byte_offset == 0) switch (ptr.base_addr) { |
| 3581 | .decl => |decl| zcu.intern_pool.indexToKey(zcu.declPtr(decl).val.toIntern()), | 3584 | .decl => |decl| zcu.intern_pool.indexToKey(zcu.declPtr(decl).val.toIntern()), |
| 3582 | else => func_key, | 3585 | else => func_key, |
| 3583 | }, | 3586 | } else func_key, |
| 3584 | }) { | 3587 | }) { |
| 3585 | .func => |func| { | 3588 | .func => |func| { |
| 3586 | if (self.bin_file.cast(link.File.Elf)) |elf_file| { | 3589 | if (self.bin_file.cast(link.File.Elf)) |elf_file| { |
| ... | @@ -4174,8 +4177,7 @@ fn performReloc(self: *Self, inst: Mir.Inst.Index) void { | ... | @@ -4174,8 +4177,7 @@ fn performReloc(self: *Self, inst: Mir.Inst.Index) void { |
| 4174 | .bne, | 4177 | .bne, |
| 4175 | .beq, | 4178 | .beq, |
| 4176 | => self.mir_instructions.items(.data)[inst].b_type.inst = target, | 4179 | => self.mir_instructions.items(.data)[inst].b_type.inst = target, |
| 4177 | .jal, | 4180 | .jal => self.mir_instructions.items(.data)[inst].j_type.inst = target, |
| 4178 | => self.mir_instructions.items(.data)[inst].j_type.inst = target, | ||
| 4179 | .pseudo => switch (ops) { | 4181 | .pseudo => switch (ops) { |
| 4180 | .pseudo_j => self.mir_instructions.items(.data)[inst].inst = target, | 4182 | .pseudo_j => self.mir_instructions.items(.data)[inst].inst = target, |
| 4181 | else => std.debug.panic("TODO: performReloc {s}", .{@tagName(ops)}), | 4183 | else => std.debug.panic("TODO: performReloc {s}", .{@tagName(ops)}), |
| ... | @@ -5021,13 +5023,36 @@ fn airReduce(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -5021,13 +5023,36 @@ fn airReduce(self: *Self, inst: Air.Inst.Index) !void { |
| 5021 | 5023 | ||
| 5022 | fn airAggregateInit(self: *Self, inst: Air.Inst.Index) !void { | 5024 | fn airAggregateInit(self: *Self, inst: Air.Inst.Index) !void { |
| 5023 | const zcu = self.bin_file.comp.module.?; | 5025 | const zcu = self.bin_file.comp.module.?; |
| 5024 | const vector_ty = self.typeOfIndex(inst); | 5026 | const result_ty = self.typeOfIndex(inst); |
| 5025 | const len = vector_ty.vectorLen(zcu); | 5027 | const len: usize = @intCast(result_ty.arrayLen(zcu)); |
| 5026 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | 5028 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; |
| 5027 | const elements: []const Air.Inst.Ref = @ptrCast(self.air.extra[ty_pl.payload..][0..len]); | 5029 | const elements: []const Air.Inst.Ref = @ptrCast(self.air.extra[ty_pl.payload..][0..len]); |
| 5028 | const result: MCValue = res: { | 5030 | const result: MCValue = result: { |
| 5029 | if (self.liveness.isUnused(inst)) break :res .unreach; | 5031 | switch (result_ty.zigTypeTag(zcu)) { |
| 5030 | return self.fail("TODO implement airAggregateInit for riscv64", .{}); | 5032 | .Struct => { |
| 5033 | const frame_index = try self.allocFrameIndex(FrameAlloc.initSpill(result_ty, zcu)); | ||
| 5034 | |||
| 5035 | if (result_ty.containerLayout(zcu) == .@"packed") {} else for (elements, 0..) |elem, elem_i| { | ||
| 5036 | if ((try result_ty.structFieldValueComptime(zcu, elem_i)) != null) continue; | ||
| 5037 | |||
| 5038 | const elem_ty = result_ty.structFieldType(elem_i, zcu); | ||
| 5039 | const elem_off: i32 = @intCast(result_ty.structFieldOffset(elem_i, zcu)); | ||
| 5040 | const elem_mcv = try self.resolveInst(elem); | ||
| 5041 | |||
| 5042 | const elem_frame: FrameAddr = .{ | ||
| 5043 | .index = frame_index, | ||
| 5044 | .off = elem_off, | ||
| 5045 | }; | ||
| 5046 | try self.genSetStack( | ||
| 5047 | elem_ty, | ||
| 5048 | elem_frame, | ||
| 5049 | elem_mcv, | ||
| 5050 | ); | ||
| 5051 | } | ||
| 5052 | }, | ||
| 5053 | else => return self.fail("TODO: airAggregateInit {}", .{result_ty.fmt(zcu)}), | ||
| 5054 | } | ||
| 5055 | break :result .{ .register = .zero }; | ||
| 5031 | }; | 5056 | }; |
| 5032 | 5057 | ||
| 5033 | if (elements.len <= Liveness.bpi - 1) { | 5058 | if (elements.len <= Liveness.bpi - 1) { |
| ... | @@ -5189,12 +5214,24 @@ fn resolveCallingConventionValues( | ... | @@ -5189,12 +5214,24 @@ fn resolveCallingConventionValues( |
| 5189 | 5214 | ||
| 5190 | for (classes) |class| switch (class) { | 5215 | for (classes) |class| switch (class) { |
| 5191 | .integer => { | 5216 | .integer => { |
| 5192 | const ret_int_reg = abi.function_arg_regs[ret_int_reg_i]; | 5217 | const ret_int_reg = abi.function_ret_regs[ret_int_reg_i]; |
| 5193 | ret_int_reg_i += 1; | 5218 | ret_int_reg_i += 1; |
| 5194 | 5219 | ||
| 5195 | ret_tracking[ret_tracking_i] = InstTracking.init(.{ .register = ret_int_reg }); | 5220 | ret_tracking[ret_tracking_i] = InstTracking.init(.{ .register = ret_int_reg }); |
| 5196 | ret_tracking_i += 1; | 5221 | ret_tracking_i += 1; |
| 5197 | }, | 5222 | }, |
| 5223 | .memory => { | ||
| 5224 | const ret_int_reg = abi.function_ret_regs[ret_int_reg_i]; | ||
| 5225 | ret_int_reg_i += 1; | ||
| 5226 | const ret_indirect_reg = abi.function_arg_regs[param_int_reg_i]; | ||
| 5227 | param_int_reg_i += 1; | ||
| 5228 | |||
| 5229 | ret_tracking[ret_tracking_i] = .{ | ||
| 5230 | .short = .{ .indirect = .{ .reg = ret_int_reg } }, | ||
| 5231 | .long = .{ .indirect = .{ .reg = ret_indirect_reg } }, | ||
| 5232 | }; | ||
| 5233 | ret_tracking_i += 1; | ||
| 5234 | }, | ||
| 5198 | else => return self.fail("TODO: C calling convention return class {}", .{class}), | 5235 | else => return self.fail("TODO: C calling convention return class {}", .{class}), |
| 5199 | }; | 5236 | }; |
| 5200 | 5237 | ||
| ... | @@ -5226,6 +5263,13 @@ fn resolveCallingConventionValues( | ... | @@ -5226,6 +5263,13 @@ fn resolveCallingConventionValues( |
| 5226 | arg_mcv[arg_mcv_i] = .{ .register = param_int_reg }; | 5263 | arg_mcv[arg_mcv_i] = .{ .register = param_int_reg }; |
| 5227 | arg_mcv_i += 1; | 5264 | arg_mcv_i += 1; |
| 5228 | }, | 5265 | }, |
| 5266 | .memory => { | ||
| 5267 | const param_int_regs = abi.function_arg_regs; | ||
| 5268 | const param_int_reg = param_int_regs[param_int_reg_i]; | ||
| 5269 | |||
| 5270 | arg_mcv[arg_mcv_i] = .{ .indirect = .{ .reg = param_int_reg } }; | ||
| 5271 | arg_mcv_i += 1; | ||
| 5272 | }, | ||
| 5229 | else => return self.fail("TODO: C calling convention arg class {}", .{class}), | 5273 | else => return self.fail("TODO: C calling convention arg class {}", .{class}), |
| 5230 | } else { | 5274 | } else { |
| 5231 | arg.* = switch (arg_mcv_i) { | 5275 | arg.* = switch (arg_mcv_i) { |
src/arch/riscv64/abi.zig+16-9| ... | @@ -96,7 +96,6 @@ pub fn classifyType(ty: Type, mod: *Module) Class { | ... | @@ -96,7 +96,6 @@ pub fn classifyType(ty: Type, mod: *Module) Class { |
| 96 | /// There are a maximum of 8 possible return slots. Returned values are in | 96 | /// There are a maximum of 8 possible return slots. Returned values are in |
| 97 | /// the beginning of the array; unused slots are filled with .none. | 97 | /// the beginning of the array; unused slots are filled with .none. |
| 98 | pub fn classifySystem(ty: Type, zcu: *Module) [8]Class { | 98 | pub fn classifySystem(ty: Type, zcu: *Module) [8]Class { |
| 99 | const ip = zcu.intern_pool; | ||
| 100 | var result = [1]Class{.none} ** 8; | 99 | var result = [1]Class{.none} ** 8; |
| 101 | const memory_class = [_]Class{ | 100 | const memory_class = [_]Class{ |
| 102 | .memory, .none, .none, .none, | 101 | .memory, .none, .none, .none, |
| ... | @@ -158,22 +157,17 @@ pub fn classifySystem(ty: Type, zcu: *Module) [8]Class { | ... | @@ -158,22 +157,17 @@ pub fn classifySystem(ty: Type, zcu: *Module) [8]Class { |
| 158 | std.debug.panic("TODO: classifySystem ErrorUnion > 64 bit payload", .{}); | 157 | std.debug.panic("TODO: classifySystem ErrorUnion > 64 bit payload", .{}); |
| 159 | }, | 158 | }, |
| 160 | .Struct => { | 159 | .Struct => { |
| 161 | const loaded_struct = ip.loadStructType(ty.toIntern()); | 160 | const layout = ty.containerLayout(zcu); |
| 162 | const ty_size = ty.abiSize(zcu); | 161 | const ty_size = ty.abiSize(zcu); |
| 163 | 162 | ||
| 164 | if (loaded_struct.layout == .@"packed") { | 163 | if (layout == .@"packed") { |
| 165 | assert(ty_size <= 16); | 164 | assert(ty_size <= 16); |
| 166 | result[0] = .integer; | 165 | result[0] = .integer; |
| 167 | if (ty_size > 8) result[1] = .integer; | 166 | if (ty_size > 8) result[1] = .integer; |
| 168 | return result; | 167 | return result; |
| 169 | } | 168 | } |
| 170 | if (ty_size > 64) | ||
| 171 | return memory_class; | ||
| 172 | 169 | ||
| 173 | var byte_offset: u64 = 0; | 170 | return memory_class; |
| 174 | classifyStruct(&result, &byte_offset, loaded_struct, zcu); | ||
| 175 | |||
| 176 | return result; | ||
| 177 | }, | 171 | }, |
| 178 | else => |bad_ty| std.debug.panic("classifySystem {s}", .{@tagName(bad_ty)}), | 172 | else => |bad_ty| std.debug.panic("classifySystem {s}", .{@tagName(bad_ty)}), |
| 179 | } | 173 | } |
| ... | @@ -245,6 +239,10 @@ pub const function_arg_regs = [_]Register{ | ... | @@ -245,6 +239,10 @@ pub const function_arg_regs = [_]Register{ |
| 245 | .a0, .a1, .a2, .a3, .a4, .a5, .a6, .a7, | 239 | .a0, .a1, .a2, .a3, .a4, .a5, .a6, .a7, |
| 246 | }; | 240 | }; |
| 247 | 241 | ||
| 242 | pub const function_ret_regs = [_]Register{ | ||
| 243 | .a0, .a1, | ||
| 244 | }; | ||
| 245 | |||
| 248 | pub const temporary_regs = [_]Register{ | 246 | pub const temporary_regs = [_]Register{ |
| 249 | .t0, .t1, .t2, .t3, .t4, .t5, .t6, | 247 | .t0, .t1, .t2, .t3, .t4, .t5, .t6, |
| 250 | }; | 248 | }; |
| ... | @@ -273,6 +271,15 @@ pub const RegisterClass = struct { | ... | @@ -273,6 +271,15 @@ pub const RegisterClass = struct { |
| 273 | break :blk set; | 271 | break :blk set; |
| 274 | }; | 272 | }; |
| 275 | 273 | ||
| 274 | pub const fr: RegisterBitSet = blk: { | ||
| 275 | var set = RegisterBitSet.initEmpty(); | ||
| 276 | set.setRangeValue(.{ | ||
| 277 | .start = callee_preserved_regs.len, | ||
| 278 | .end = callee_preserved_regs.len + function_ret_regs.len, | ||
| 279 | }, true); | ||
| 280 | break :blk set; | ||
| 281 | }; | ||
| 282 | |||
| 276 | pub const tp: RegisterBitSet = blk: { | 283 | pub const tp: RegisterBitSet = blk: { |
| 277 | var set = RegisterBitSet.initEmpty(); | 284 | var set = RegisterBitSet.initEmpty(); |
| 278 | set.setRangeValue(.{ | 285 | set.setRangeValue(.{ |
test/behavior/align.zig-1| ... | @@ -388,7 +388,6 @@ test "function align expression depends on generic parameter" { | ... | @@ -388,7 +388,6 @@ test "function align expression depends on generic parameter" { |
| 388 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | 388 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 389 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | 389 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 390 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | 390 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 391 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | ||
| 392 | 391 | ||
| 393 | // function alignment is a compile error on wasm32/wasm64 | 392 | // function alignment is a compile error on wasm32/wasm64 |
| 394 | if (native_arch == .wasm32 or native_arch == .wasm64) return error.SkipZigTest; | 393 | if (native_arch == .wasm32 or native_arch == .wasm64) return error.SkipZigTest; |
test/behavior/basic.zig+1| ... | @@ -593,6 +593,7 @@ test "equality compare fn ptrs" { | ... | @@ -593,6 +593,7 @@ test "equality compare fn ptrs" { |
| 593 | 593 | ||
| 594 | test "self reference through fn ptr field" { | 594 | test "self reference through fn ptr field" { |
| 595 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | 595 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 596 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | ||
| 596 | 597 | ||
| 597 | const S = struct { | 598 | const S = struct { |
| 598 | const A = struct { | 599 | const A = struct { |
test/behavior/bitcast.zig+2| ... | @@ -541,6 +541,7 @@ test "@bitCast of packed struct containing pointer" { | ... | @@ -541,6 +541,7 @@ test "@bitCast of packed struct containing pointer" { |
| 541 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO | 541 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO |
| 542 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | 542 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO |
| 543 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; // TODO | 543 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; // TODO |
| 544 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | ||
| 544 | 545 | ||
| 545 | const S = struct { | 546 | const S = struct { |
| 546 | const A = packed struct { | 547 | const A = packed struct { |
| ... | @@ -570,6 +571,7 @@ test "@bitCast of extern struct containing pointer" { | ... | @@ -570,6 +571,7 @@ test "@bitCast of extern struct containing pointer" { |
| 570 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO | 571 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO |
| 571 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | 572 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO |
| 572 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; // TODO | 573 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; // TODO |
| 574 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | ||
| 573 | 575 | ||
| 574 | const S = struct { | 576 | const S = struct { |
| 575 | const A = extern struct { | 577 | const A = extern struct { |
test/behavior/cast.zig-1| ... | @@ -2713,7 +2713,6 @@ test "bitcast vector" { | ... | @@ -2713,7 +2713,6 @@ test "bitcast vector" { |
| 2713 | if (builtin.zig_backend == .stage2_x86) return error.SkipZigTest; // TODO | 2713 | if (builtin.zig_backend == .stage2_x86) return error.SkipZigTest; // TODO |
| 2714 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | 2714 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 2715 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | 2715 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 2716 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | ||
| 2717 | 2716 | ||
| 2718 | const u8x32 = @Vector(32, u8); | 2717 | const u8x32 = @Vector(32, u8); |
| 2719 | const u32x8 = @Vector(8, u32); | 2718 | const u32x8 = @Vector(8, u32); |
test/behavior/comptime_memory.zig+6-2| ... | @@ -32,6 +32,8 @@ test "type pun signed and unsigned as array pointer" { | ... | @@ -32,6 +32,8 @@ test "type pun signed and unsigned as array pointer" { |
| 32 | } | 32 | } |
| 33 | 33 | ||
| 34 | test "type pun signed and unsigned as offset many pointer" { | 34 | test "type pun signed and unsigned as offset many pointer" { |
| 35 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | ||
| 36 | |||
| 35 | comptime { | 37 | comptime { |
| 36 | var x: [11]u32 = undefined; | 38 | var x: [11]u32 = undefined; |
| 37 | var y: [*]i32 = @ptrCast(&x[10]); | 39 | var y: [*]i32 = @ptrCast(&x[10]); |
| ... | @@ -42,6 +44,8 @@ test "type pun signed and unsigned as offset many pointer" { | ... | @@ -42,6 +44,8 @@ test "type pun signed and unsigned as offset many pointer" { |
| 42 | } | 44 | } |
| 43 | 45 | ||
| 44 | test "type pun signed and unsigned as array pointer with pointer arithemtic" { | 46 | test "type pun signed and unsigned as array pointer with pointer arithemtic" { |
| 47 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | ||
| 48 | |||
| 45 | comptime { | 49 | comptime { |
| 46 | var x: [11]u32 = undefined; | 50 | var x: [11]u32 = undefined; |
| 47 | const y = @as([*]i32, @ptrCast(&x[10])) - 10; | 51 | const y = @as([*]i32, @ptrCast(&x[10])) - 10; |
| ... | @@ -289,6 +293,8 @@ test "dance on linker values" { | ... | @@ -289,6 +293,8 @@ test "dance on linker values" { |
| 289 | } | 293 | } |
| 290 | 294 | ||
| 291 | test "offset array ptr by element size" { | 295 | test "offset array ptr by element size" { |
| 296 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | ||
| 297 | |||
| 292 | comptime { | 298 | comptime { |
| 293 | const VirtualStruct = struct { x: u32 }; | 299 | const VirtualStruct = struct { x: u32 }; |
| 294 | var arr: [4]VirtualStruct = .{ | 300 | var arr: [4]VirtualStruct = .{ |
| ... | @@ -418,8 +424,6 @@ test "dereference undefined pointer to zero-bit type" { | ... | @@ -418,8 +424,6 @@ test "dereference undefined pointer to zero-bit type" { |
| 418 | } | 424 | } |
| 419 | 425 | ||
| 420 | test "type pun extern struct" { | 426 | test "type pun extern struct" { |
| 421 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | ||
| 422 | |||
| 423 | const S = extern struct { f: u8 }; | 427 | const S = extern struct { f: u8 }; |
| 424 | comptime var s = S{ .f = 123 }; | 428 | comptime var s = S{ .f = 123 }; |
| 425 | @as(*u8, @ptrCast(&s)).* = 72; | 429 | @as(*u8, @ptrCast(&s)).* = 72; |
test/behavior/enum.zig-2| ... | @@ -1246,8 +1246,6 @@ test "auto-numbered enum with signed tag type" { | ... | @@ -1246,8 +1246,6 @@ test "auto-numbered enum with signed tag type" { |
| 1246 | } | 1246 | } |
| 1247 | 1247 | ||
| 1248 | test "lazy initialized field" { | 1248 | test "lazy initialized field" { |
| 1249 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | ||
| 1250 | |||
| 1251 | try std.testing.expectEqual(@as(u8, @alignOf(struct {})), getLazyInitialized(.a)); | 1249 | try std.testing.expectEqual(@as(u8, @alignOf(struct {})), getLazyInitialized(.a)); |
| 1252 | } | 1250 | } |
| 1253 | 1251 |
test/behavior/error.zig+1| ... | @@ -1102,6 +1102,7 @@ test "result location initialization of error union with OPV payload" { | ... | @@ -1102,6 +1102,7 @@ test "result location initialization of error union with OPV payload" { |
| 1102 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | 1102 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 1103 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | 1103 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 1104 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | 1104 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1105 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | ||
| 1105 | 1106 | ||
| 1106 | const S = struct { | 1107 | const S = struct { |
| 1107 | x: u0, | 1108 | x: u0, |
test/behavior/eval.zig-2| ... | @@ -1705,8 +1705,6 @@ test "early exit in container level const" { | ... | @@ -1705,8 +1705,6 @@ test "early exit in container level const" { |
| 1705 | } | 1705 | } |
| 1706 | 1706 | ||
| 1707 | test "@inComptime" { | 1707 | test "@inComptime" { |
| 1708 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | ||
| 1709 | |||
| 1710 | const S = struct { | 1708 | const S = struct { |
| 1711 | fn inComptime() bool { | 1709 | fn inComptime() bool { |
| 1712 | return @inComptime(); | 1710 | return @inComptime(); |
test/behavior/fn.zig+3-2| ... | @@ -191,6 +191,7 @@ test "function with complex callconv and return type expressions" { | ... | @@ -191,6 +191,7 @@ test "function with complex callconv and return type expressions" { |
| 191 | 191 | ||
| 192 | test "pass by non-copying value" { | 192 | test "pass by non-copying value" { |
| 193 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | 193 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 194 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | ||
| 194 | 195 | ||
| 195 | try expect(addPointCoords(Point{ .x = 1, .y = 2 }) == 3); | 196 | try expect(addPointCoords(Point{ .x = 1, .y = 2 }) == 3); |
| 196 | } | 197 | } |
| ... | @@ -218,6 +219,7 @@ fn addPointCoordsVar(pt: anytype) !i32 { | ... | @@ -218,6 +219,7 @@ fn addPointCoordsVar(pt: anytype) !i32 { |
| 218 | 219 | ||
| 219 | test "pass by non-copying value as method" { | 220 | test "pass by non-copying value as method" { |
| 220 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | 221 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 222 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | ||
| 221 | 223 | ||
| 222 | var pt = Point2{ .x = 1, .y = 2 }; | 224 | var pt = Point2{ .x = 1, .y = 2 }; |
| 223 | try expect(pt.addPointCoords() == 3); | 225 | try expect(pt.addPointCoords() == 3); |
| ... | @@ -234,6 +236,7 @@ const Point2 = struct { | ... | @@ -234,6 +236,7 @@ const Point2 = struct { |
| 234 | 236 | ||
| 235 | test "pass by non-copying value as method, which is generic" { | 237 | test "pass by non-copying value as method, which is generic" { |
| 236 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | 238 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 239 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | ||
| 237 | 240 | ||
| 238 | var pt = Point3{ .x = 1, .y = 2 }; | 241 | var pt = Point3{ .x = 1, .y = 2 }; |
| 239 | try expect(pt.addPointCoords(i32) == 3); | 242 | try expect(pt.addPointCoords(i32) == 3); |
| ... | @@ -624,8 +627,6 @@ test "comptime parameters don't have to be marked comptime if only called at com | ... | @@ -624,8 +627,6 @@ test "comptime parameters don't have to be marked comptime if only called at com |
| 624 | } | 627 | } |
| 625 | 628 | ||
| 626 | test "inline function with comptime-known comptime-only return type called at runtime" { | 629 | test "inline function with comptime-known comptime-only return type called at runtime" { |
| 627 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | ||
| 628 | |||
| 629 | const S = struct { | 630 | const S = struct { |
| 630 | inline fn foo(x: *i32, y: *const i32) type { | 631 | inline fn foo(x: *i32, y: *const i32) type { |
| 631 | x.* = y.*; | 632 | x.* = y.*; |
test/behavior/fn_delegation.zig+1| ... | @@ -34,6 +34,7 @@ fn custom(comptime T: type, comptime num: u64) fn (T) u64 { | ... | @@ -34,6 +34,7 @@ fn custom(comptime T: type, comptime num: u64) fn (T) u64 { |
| 34 | test "fn delegation" { | 34 | test "fn delegation" { |
| 35 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | 35 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 36 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | 36 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 37 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | ||
| 37 | 38 | ||
| 38 | const foo = Foo{}; | 39 | const foo = Foo{}; |
| 39 | try expect(foo.one() == 11); | 40 | try expect(foo.one() == 11); |
test/behavior/generics.zig+1| ... | @@ -395,6 +395,7 @@ test "extern function used as generic parameter" { | ... | @@ -395,6 +395,7 @@ test "extern function used as generic parameter" { |
| 395 | 395 | ||
| 396 | test "generic struct as parameter type" { | 396 | test "generic struct as parameter type" { |
| 397 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | 397 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 398 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | ||
| 398 | 399 | ||
| 399 | const S = struct { | 400 | const S = struct { |
| 400 | fn doTheTest(comptime Int: type, thing: struct { int: Int }) !void { | 401 | fn doTheTest(comptime Int: type, thing: struct { int: Int }) !void { |
test/behavior/if.zig-2| ... | @@ -179,8 +179,6 @@ fn returnTrue() bool { | ... | @@ -179,8 +179,6 @@ fn returnTrue() bool { |
| 179 | } | 179 | } |
| 180 | 180 | ||
| 181 | test "if value shouldn't be load-elided if used later (structs)" { | 181 | test "if value shouldn't be load-elided if used later (structs)" { |
| 182 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | ||
| 183 | |||
| 184 | const Foo = struct { x: i32 }; | 182 | const Foo = struct { x: i32 }; |
| 185 | 183 | ||
| 186 | var a = Foo{ .x = 1 }; | 184 | var a = Foo{ .x = 1 }; |
test/behavior/maximum_minimum.zig-6| ... | @@ -160,8 +160,6 @@ test "@min/@max on lazy values" { | ... | @@ -160,8 +160,6 @@ test "@min/@max on lazy values" { |
| 160 | } | 160 | } |
| 161 | 161 | ||
| 162 | test "@min/@max more than two arguments" { | 162 | test "@min/@max more than two arguments" { |
| 163 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | ||
| 164 | |||
| 165 | const x: u32 = 30; | 163 | const x: u32 = 30; |
| 166 | const y: u32 = 10; | 164 | const y: u32 = 10; |
| 167 | const z: u32 = 20; | 165 | const z: u32 = 20; |
| ... | @@ -187,7 +185,6 @@ test "@min/@max notices bounds" { | ... | @@ -187,7 +185,6 @@ test "@min/@max notices bounds" { |
| 187 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | 185 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 188 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | 186 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 189 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | 187 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 190 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | ||
| 191 | 188 | ||
| 192 | var x: u16 = 20; | 189 | var x: u16 = 20; |
| 193 | const y = 30; | 190 | const y = 30; |
| ... | @@ -239,7 +236,6 @@ test "@min/@max notices bounds from types" { | ... | @@ -239,7 +236,6 @@ test "@min/@max notices bounds from types" { |
| 239 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | 236 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 240 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | 237 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 241 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | 238 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 242 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | ||
| 243 | 239 | ||
| 244 | var x: u16 = 123; | 240 | var x: u16 = 123; |
| 245 | var y: u32 = 456; | 241 | var y: u32 = 456; |
| ... | @@ -325,8 +321,6 @@ test "@min/@max notices bounds from vector types when element of comptime-known | ... | @@ -325,8 +321,6 @@ test "@min/@max notices bounds from vector types when element of comptime-known |
| 325 | } | 321 | } |
| 326 | 322 | ||
| 327 | test "@min/@max of signed and unsigned runtime integers" { | 323 | test "@min/@max of signed and unsigned runtime integers" { |
| 328 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | ||
| 329 | |||
| 330 | var x: i32 = -1; | 324 | var x: i32 = -1; |
| 331 | var y: u31 = 1; | 325 | var y: u31 = 1; |
| 332 | _ = .{ &x, &y }; | 326 | _ = .{ &x, &y }; |
test/behavior/optional.zig+1| ... | @@ -640,6 +640,7 @@ test "result location initialization of optional with OPV payload" { | ... | @@ -640,6 +640,7 @@ test "result location initialization of optional with OPV payload" { |
| 640 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | 640 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 641 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | 641 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 642 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | 642 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO |
| 643 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | ||
| 643 | 644 | ||
| 644 | const S = struct { | 645 | const S = struct { |
| 645 | x: u0, | 646 | x: u0, |
test/behavior/packed-struct.zig-2| ... | @@ -124,7 +124,6 @@ test "correct sizeOf and offsets in packed structs" { | ... | @@ -124,7 +124,6 @@ test "correct sizeOf and offsets in packed structs" { |
| 124 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | 124 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 125 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | 125 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 126 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | 126 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 127 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | ||
| 128 | 127 | ||
| 129 | const PStruct = packed struct { | 128 | const PStruct = packed struct { |
| 130 | bool_a: bool, | 129 | bool_a: bool, |
| ... | @@ -193,7 +192,6 @@ test "nested packed structs" { | ... | @@ -193,7 +192,6 @@ test "nested packed structs" { |
| 193 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | 192 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 194 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | 193 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 195 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | 194 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 196 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | ||
| 197 | 195 | ||
| 198 | const S1 = packed struct { a: u8, b: u8, c: u8 }; | 196 | const S1 = packed struct { a: u8, b: u8, c: u8 }; |
| 199 | 197 |
test/behavior/packed-union.zig+2| ... | @@ -177,6 +177,8 @@ test "assigning to non-active field at comptime" { | ... | @@ -177,6 +177,8 @@ test "assigning to non-active field at comptime" { |
| 177 | } | 177 | } |
| 178 | 178 | ||
| 179 | test "comptime packed union of pointers" { | 179 | test "comptime packed union of pointers" { |
| 180 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | ||
| 181 | |||
| 180 | const U = packed union { | 182 | const U = packed union { |
| 181 | a: *const u32, | 183 | a: *const u32, |
| 182 | b: *const [1]u32, | 184 | b: *const [1]u32, |
test/behavior/packed_struct_explicit_backing_int.zig-1| ... | @@ -10,7 +10,6 @@ test "packed struct explicit backing integer" { | ... | @@ -10,7 +10,6 @@ test "packed struct explicit backing integer" { |
| 10 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | 10 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 11 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | 11 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 12 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | 12 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 13 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | ||
| 14 | 13 | ||
| 15 | const S1 = packed struct { a: u8, b: u8, c: u8 }; | 14 | const S1 = packed struct { a: u8, b: u8, c: u8 }; |
| 16 | 15 |
test/behavior/pointers.zig+4| ... | @@ -640,6 +640,8 @@ test "cast pointers with zero sized elements" { | ... | @@ -640,6 +640,8 @@ test "cast pointers with zero sized elements" { |
| 640 | } | 640 | } |
| 641 | 641 | ||
| 642 | test "comptime pointer equality through distinct fields with well-defined layout" { | 642 | test "comptime pointer equality through distinct fields with well-defined layout" { |
| 643 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | ||
| 644 | |||
| 643 | const A = extern struct { | 645 | const A = extern struct { |
| 644 | x: u32, | 646 | x: u32, |
| 645 | z: u16, | 647 | z: u16, |
| ... | @@ -664,6 +666,8 @@ test "comptime pointer equality through distinct fields with well-defined layout | ... | @@ -664,6 +666,8 @@ test "comptime pointer equality through distinct fields with well-defined layout |
| 664 | } | 666 | } |
| 665 | 667 | ||
| 666 | test "comptime pointer equality through distinct elements with well-defined layout" { | 668 | test "comptime pointer equality through distinct elements with well-defined layout" { |
| 669 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | ||
| 670 | |||
| 667 | const buf: [2]u32 = .{ 123, 456 }; | 671 | const buf: [2]u32 = .{ 123, 456 }; |
| 668 | 672 | ||
| 669 | const ptr: *const [2]u32 = &buf; | 673 | const ptr: *const [2]u32 = &buf; |
test/behavior/ptrcast.zig+4| ... | @@ -298,6 +298,8 @@ test "comptime @ptrCast with packed struct leaves value unmodified" { | ... | @@ -298,6 +298,8 @@ test "comptime @ptrCast with packed struct leaves value unmodified" { |
| 298 | } | 298 | } |
| 299 | 299 | ||
| 300 | test "@ptrCast restructures comptime-only array" { | 300 | test "@ptrCast restructures comptime-only array" { |
| 301 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | ||
| 302 | |||
| 301 | { | 303 | { |
| 302 | const a3a2: [3][2]comptime_int = .{ | 304 | const a3a2: [3][2]comptime_int = .{ |
| 303 | .{ 1, 2 }, | 305 | .{ 1, 2 }, |
| ... | @@ -340,6 +342,8 @@ test "@ptrCast restructures comptime-only array" { | ... | @@ -340,6 +342,8 @@ test "@ptrCast restructures comptime-only array" { |
| 340 | } | 342 | } |
| 341 | 343 | ||
| 342 | test "@ptrCast restructures sliced comptime-only array" { | 344 | test "@ptrCast restructures sliced comptime-only array" { |
| 345 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | ||
| 346 | |||
| 343 | const a3a2: [4][2]comptime_int = .{ | 347 | const a3a2: [4][2]comptime_int = .{ |
| 344 | .{ 1, 2 }, | 348 | .{ 1, 2 }, |
| 345 | .{ 3, 4 }, | 349 | .{ 3, 4 }, |
test/behavior/sizeof_and_typeof.zig+1| ... | @@ -412,6 +412,7 @@ test "Extern function calls, dereferences and field access in @TypeOf" { | ... | @@ -412,6 +412,7 @@ test "Extern function calls, dereferences and field access in @TypeOf" { |
| 412 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | 412 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 413 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | 413 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 414 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | 414 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 415 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | ||
| 415 | 416 | ||
| 416 | const Test = struct { | 417 | const Test = struct { |
| 417 | fn test_fn_1(a: c_long) @TypeOf(c_fopen("test", "r").*) { | 418 | fn test_fn_1(a: c_long) @TypeOf(c_fopen("test", "r").*) { |
test/behavior/struct.zig+7-3| ... | @@ -176,6 +176,7 @@ const MemberFnTestFoo = struct { | ... | @@ -176,6 +176,7 @@ const MemberFnTestFoo = struct { |
| 176 | 176 | ||
| 177 | test "call member function directly" { | 177 | test "call member function directly" { |
| 178 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | 178 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 179 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | ||
| 179 | 180 | ||
| 180 | const instance = MemberFnTestFoo{ .x = 1234 }; | 181 | const instance = MemberFnTestFoo{ .x = 1234 }; |
| 181 | const result = MemberFnTestFoo.member(instance); | 182 | const result = MemberFnTestFoo.member(instance); |
| ... | @@ -184,6 +185,7 @@ test "call member function directly" { | ... | @@ -184,6 +185,7 @@ test "call member function directly" { |
| 184 | 185 | ||
| 185 | test "store member function in variable" { | 186 | test "store member function in variable" { |
| 186 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | 187 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 188 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | ||
| 187 | 189 | ||
| 188 | const instance = MemberFnTestFoo{ .x = 1234 }; | 190 | const instance = MemberFnTestFoo{ .x = 1234 }; |
| 189 | const memberFn = MemberFnTestFoo.member; | 191 | const memberFn = MemberFnTestFoo.member; |
| ... | @@ -1559,6 +1561,7 @@ test "discarded struct initialization works as expected" { | ... | @@ -1559,6 +1561,7 @@ test "discarded struct initialization works as expected" { |
| 1559 | test "function pointer in struct returns the struct" { | 1561 | test "function pointer in struct returns the struct" { |
| 1560 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | 1562 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 1561 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | 1563 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 1564 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | ||
| 1562 | 1565 | ||
| 1563 | const A = struct { | 1566 | const A = struct { |
| 1564 | const A = @This(); | 1567 | const A = @This(); |
| ... | @@ -1699,7 +1702,6 @@ test "struct field pointer has correct alignment" { | ... | @@ -1699,7 +1702,6 @@ test "struct field pointer has correct alignment" { |
| 1699 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | 1702 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 1700 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | 1703 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 1701 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | 1704 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1702 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | ||
| 1703 | 1705 | ||
| 1704 | const S = struct { | 1706 | const S = struct { |
| 1705 | fn doTheTest() !void { | 1707 | fn doTheTest() !void { |
| ... | @@ -1781,6 +1783,8 @@ fn countFields(v: anytype) usize { | ... | @@ -1781,6 +1783,8 @@ fn countFields(v: anytype) usize { |
| 1781 | } | 1783 | } |
| 1782 | 1784 | ||
| 1783 | test "struct init with no result pointer sets field result types" { | 1785 | test "struct init with no result pointer sets field result types" { |
| 1786 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | ||
| 1787 | |||
| 1784 | const S = struct { | 1788 | const S = struct { |
| 1785 | // A function parameter has a result type, but no result pointer. | 1789 | // A function parameter has a result type, but no result pointer. |
| 1786 | fn f(s: struct { x: u32 }) u32 { | 1790 | fn f(s: struct { x: u32 }) u32 { |
| ... | @@ -1928,6 +1932,8 @@ test "circular dependency through pointer field of a struct" { | ... | @@ -1928,6 +1932,8 @@ test "circular dependency through pointer field of a struct" { |
| 1928 | } | 1932 | } |
| 1929 | 1933 | ||
| 1930 | test "field calls do not force struct field init resolution" { | 1934 | test "field calls do not force struct field init resolution" { |
| 1935 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | ||
| 1936 | |||
| 1931 | const S = struct { | 1937 | const S = struct { |
| 1932 | x: u32 = blk: { | 1938 | x: u32 = blk: { |
| 1933 | _ = @TypeOf(make().dummyFn()); // runtime field call - S not fully resolved - dummyFn call should not force field init resolution | 1939 | _ = @TypeOf(make().dummyFn()); // runtime field call - S not fully resolved - dummyFn call should not force field init resolution |
| ... | @@ -1958,7 +1964,6 @@ test "extern struct fields are aligned to 1" { | ... | @@ -1958,7 +1964,6 @@ test "extern struct fields are aligned to 1" { |
| 1958 | if (builtin.zig_backend == .stage2_x86) return error.SkipZigTest; // TODO | 1964 | if (builtin.zig_backend == .stage2_x86) return error.SkipZigTest; // TODO |
| 1959 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | 1965 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 1960 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | 1966 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 1961 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | ||
| 1962 | 1967 | ||
| 1963 | const Foo = extern struct { | 1968 | const Foo = extern struct { |
| 1964 | a: u8 align(1), | 1969 | a: u8 align(1), |
| ... | @@ -2090,7 +2095,6 @@ test "struct field default value is a call" { | ... | @@ -2090,7 +2095,6 @@ test "struct field default value is a call" { |
| 2090 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | 2095 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 2091 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | 2096 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 2092 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | 2097 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 2093 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | ||
| 2094 | 2098 | ||
| 2095 | const Z = packed struct { | 2099 | const Z = packed struct { |
| 2096 | a: u32, | 2100 | a: u32, |
test/behavior/tuple.zig-1| ... | @@ -451,7 +451,6 @@ test "tuple pointer is indexable" { | ... | @@ -451,7 +451,6 @@ test "tuple pointer is indexable" { |
| 451 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | 451 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 452 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | 452 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 453 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | 453 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 454 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | ||
| 455 | 454 | ||
| 456 | const S = struct { u32, bool }; | 455 | const S = struct { u32, bool }; |
| 457 | 456 |
test/behavior/type.zig+3-1| ... | @@ -203,6 +203,7 @@ test "Type.Opaque" { | ... | @@ -203,6 +203,7 @@ test "Type.Opaque" { |
| 203 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | 203 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 204 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | 204 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 205 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | 205 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 206 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | ||
| 206 | 207 | ||
| 207 | const Opaque = @Type(.{ | 208 | const Opaque = @Type(.{ |
| 208 | .Opaque = .{ | 209 | .Opaque = .{ |
| ... | @@ -348,7 +349,6 @@ test "Type.Struct" { | ... | @@ -348,7 +349,6 @@ test "Type.Struct" { |
| 348 | test "Type.Enum" { | 349 | test "Type.Enum" { |
| 349 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | 350 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 350 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | 351 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 351 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | ||
| 352 | 352 | ||
| 353 | const Foo = @Type(.{ | 353 | const Foo = @Type(.{ |
| 354 | .Enum = .{ | 354 | .Enum = .{ |
| ... | @@ -763,6 +763,8 @@ test "matching captures causes opaque equivalence" { | ... | @@ -763,6 +763,8 @@ test "matching captures causes opaque equivalence" { |
| 763 | } | 763 | } |
| 764 | 764 | ||
| 765 | test "reify enum where fields refers to part of array" { | 765 | test "reify enum where fields refers to part of array" { |
| 766 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | ||
| 767 | |||
| 766 | const fields: [3]std.builtin.Type.EnumField = .{ | 768 | const fields: [3]std.builtin.Type.EnumField = .{ |
| 767 | .{ .name = "foo", .value = 0 }, | 769 | .{ .name = "foo", .value = 0 }, |
| 768 | .{ .name = "bar", .value = 1 }, | 770 | .{ .name = "bar", .value = 1 }, |
test/behavior/union.zig-3| ... | @@ -1622,7 +1622,6 @@ test "defined-layout union field pointer has correct alignment" { | ... | @@ -1622,7 +1622,6 @@ test "defined-layout union field pointer has correct alignment" { |
| 1622 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | 1622 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 1623 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | 1623 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1624 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; // TODO | 1624 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; // TODO |
| 1625 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | ||
| 1626 | 1625 | ||
| 1627 | const S = struct { | 1626 | const S = struct { |
| 1628 | fn doTheTest(comptime U: type) !void { | 1627 | fn doTheTest(comptime U: type) !void { |
| ... | @@ -1658,7 +1657,6 @@ test "undefined-layout union field pointer has correct alignment" { | ... | @@ -1658,7 +1657,6 @@ test "undefined-layout union field pointer has correct alignment" { |
| 1658 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | 1657 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 1659 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | 1658 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 1660 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | 1659 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1661 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | ||
| 1662 | 1660 | ||
| 1663 | const S = struct { | 1661 | const S = struct { |
| 1664 | fn doTheTest(comptime U: type) !void { | 1662 | fn doTheTest(comptime U: type) !void { |
| ... | @@ -1694,7 +1692,6 @@ test "packed union field pointer has correct alignment" { | ... | @@ -1694,7 +1692,6 @@ test "packed union field pointer has correct alignment" { |
| 1694 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | 1692 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 1695 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | 1693 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1696 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; // TODO | 1694 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; // TODO |
| 1697 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | ||
| 1698 | 1695 | ||
| 1699 | const U = packed union { x: u20 }; | 1696 | const U = packed union { x: u20 }; |
| 1700 | const S = packed struct(u24) { a: u2, u: U, b: u2 }; | 1697 | const S = packed struct(u24) { a: u2, u: U, b: u2 }; |