| author | |
| committer | |
| log | 65e74dfbda3e50ba09a2b59061ccb90a7dd68e9f |
| tree | 60faead2672c05bc933745300d323086937e7346 |
| parent | 508cbec69455d82c0e9bb5ae47f064ab33460469 |
24 files changed, 133 insertions(+), 19 deletions(-)
lib/std/lang.zig+2-1| ... | @@ -1173,11 +1173,12 @@ pub const ExternOptions = struct { | ... | @@ -1173,11 +1173,12 @@ pub const ExternOptions = struct { |
| 1173 | 1173 | ||
| 1174 | pub const Decoration = union(enum) { | 1174 | pub const Decoration = union(enum) { |
| 1175 | location: u32, | 1175 | location: u32, |
| 1176 | flat: u32, | ||
| 1176 | descriptor: Descriptor, | 1177 | descriptor: Descriptor, |
| 1177 | 1178 | ||
| 1178 | pub const Descriptor = struct { | 1179 | pub const Descriptor = struct { |
| 1179 | binding: u32, | ||
| 1180 | set: u32, | 1180 | set: u32, |
| 1181 | binding: u32, | ||
| 1181 | }; | 1182 | }; |
| 1182 | }; | 1183 | }; |
| 1183 | 1184 |
src/InternPool.zig+4-4| ... | @@ -5406,16 +5406,15 @@ pub const Tag = enum(u8) { | ... | @@ -5406,16 +5406,15 @@ pub const Tag = enum(u8) { |
| 5406 | _: u23 = 0, | 5406 | _: u23 = 0, |
| 5407 | 5407 | ||
| 5408 | pub const Source = enum(u1) { builtin, syntax }; | 5408 | pub const Source = enum(u1) { builtin, syntax }; |
| 5409 | pub const DecorationType = enum(u2) { none, location, descriptor }; | 5409 | pub const DecorationType = enum(u2) { none, location, descriptor, flat }; |
| 5410 | }; | 5410 | }; |
| 5411 | 5411 | ||
| 5412 | pub fn decoration(self: Extern) ?std.lang.ExternOptions.Decoration { | 5412 | pub fn decoration(self: Extern) ?std.lang.ExternOptions.Decoration { |
| 5413 | return switch (self.flags.decoration_type) { | 5413 | return switch (self.flags.decoration_type) { |
| 5414 | .none => null, | 5414 | .none => null, |
| 5415 | .location => std.lang.ExternOptions.Decoration{ | 5415 | .location => std.lang.ExternOptions.Decoration{ .location = self.location_or_descriptor_set }, |
| 5416 | .location = self.location_or_descriptor_set, | ||
| 5417 | }, | ||
| 5418 | .descriptor => std.lang.ExternOptions.Decoration{ .descriptor = .{ .set = self.location_or_descriptor_set, .binding = self.descriptor_binding } }, | 5416 | .descriptor => std.lang.ExternOptions.Decoration{ .descriptor = .{ .set = self.location_or_descriptor_set, .binding = self.descriptor_binding } }, |
| 5417 | .flat => std.lang.ExternOptions.Decoration{ .flat = self.location_or_descriptor_set }, | ||
| 5419 | }; | 5418 | }; |
| 5420 | } | 5419 | } |
| 5421 | }; | 5420 | }; |
| ... | @@ -9199,6 +9198,7 @@ pub fn getExtern( | ... | @@ -9199,6 +9198,7 @@ pub fn getExtern( |
| 9199 | }) catch unreachable; // capacity asserted above | 9198 | }) catch unreachable; // capacity asserted above |
| 9200 | const decoration_type, const location_or_descriptor_set, const descriptor_binding = if (key.decoration) |decoration| switch (decoration) { | 9199 | const decoration_type, const location_or_descriptor_set, const descriptor_binding = if (key.decoration) |decoration| switch (decoration) { |
| 9201 | .location => |location| .{ Tag.Extern.Flags.DecorationType.location, location, undefined }, | 9200 | .location => |location| .{ Tag.Extern.Flags.DecorationType.location, location, undefined }, |
| 9201 | .flat => |location| .{ Tag.Extern.Flags.DecorationType.flat, location, undefined }, | ||
| 9202 | .descriptor => |descriptor| .{ Tag.Extern.Flags.DecorationType.descriptor, descriptor.set, descriptor.binding }, | 9202 | .descriptor => |descriptor| .{ Tag.Extern.Flags.DecorationType.descriptor, descriptor.set, descriptor.binding }, |
| 9203 | } else .{ Tag.Extern.Flags.DecorationType.none, undefined, undefined }; | 9203 | } else .{ Tag.Extern.Flags.DecorationType.none, undefined, undefined }; |
| 9204 | const extra_index = addExtraAssumeCapacity(extra, Tag.Extern{ | 9204 | const extra_index = addExtraAssumeCapacity(extra, Tag.Extern{ |
src/Sema.zig+7| ... | @@ -25021,6 +25021,13 @@ fn zirBuiltinExtern( | ... | @@ -25021,6 +25021,13 @@ fn zirBuiltinExtern( |
| 25021 | .pcrel => if (options.visibility == .default) return sema.fail(block, options_src, "cannot require a pc-relative relocation to a symbol with default visibility", .{}), | 25021 | .pcrel => if (options.visibility == .default) return sema.fail(block, options_src, "cannot require a pc-relative relocation to a symbol with default visibility", .{}), |
| 25022 | } | 25022 | } |
| 25023 | 25023 | ||
| 25024 | if (options.decoration) |decoration| switch (decoration) { | ||
| 25025 | .flat => if (ptr_info.flags.address_space != .input) { | ||
| 25026 | return sema.fail(block, options_src, "'flat' decoration requires 'input' address space", .{}); | ||
| 25027 | }, | ||
| 25028 | .location, .descriptor => {}, | ||
| 25029 | }; | ||
| 25030 | |||
| 25024 | // TODO: error for threadlocal functions, non-const functions, etc | 25031 | // TODO: error for threadlocal functions, non-const functions, etc |
| 25025 | 25032 | ||
| 25026 | const extern_val = try pt.getExtern(.{ | 25033 | const extern_val = try pt.getExtern(.{ |
src/codegen/spirv/Assembler.zig+9| ... | @@ -393,6 +393,15 @@ fn processGenericInstruction(ass: *Assembler) !?AsmValue { | ... | @@ -393,6 +393,15 @@ fn processGenericInstruction(ass: *Assembler) !?AsmValue { |
| 393 | const actual_word_count = section.instructions.items.len - first_word; | 393 | const actual_word_count = section.instructions.items.len - first_word; |
| 394 | section.instructions.items[first_word] |= @as(u32, @as(u16, @intCast(actual_word_count))) << 16 | @intFromEnum(ass.inst.opcode); | 394 | section.instructions.items[first_word] |= @as(u32, @as(u16, @intCast(actual_word_count))) << 16 | @intFromEnum(ass.inst.opcode); |
| 395 | 395 | ||
| 396 | switch (ass.inst.opcode) { | ||
| 397 | .OpKill, | ||
| 398 | .OpReturn, | ||
| 399 | .OpReturnValue, | ||
| 400 | .OpUnreachable, | ||
| 401 | => ass.cg.block_terminated = true, | ||
| 402 | else => {}, | ||
| 403 | } | ||
| 404 | |||
| 396 | if (maybe_result_id) |result| return .{ .value = result }; | 405 | if (maybe_result_id) |result| return .{ .value = result }; |
| 397 | return null; | 406 | return null; |
| 398 | } | 407 | } |
src/codegen/spirv/CodeGen.zig+30-10| ... | @@ -118,6 +118,10 @@ block_stack: std.ArrayList(*Block) = .empty, | ... | @@ -118,6 +118,10 @@ block_stack: std.ArrayList(*Block) = .empty, |
| 118 | block_results: std.AutoHashMapUnmanaged(Air.Inst.Index, Id) = .empty, | 118 | block_results: std.AutoHashMapUnmanaged(Air.Inst.Index, Id) = .empty, |
| 119 | base_line: u32, | 119 | base_line: u32, |
| 120 | block_label: Id = .none, | 120 | block_label: Id = .none, |
| 121 | /// Whether the current block has been terminated by a terminator | ||
| 122 | /// instruction (e.g. OpKill from inline assembly). When true, no further | ||
| 123 | /// branch instructions should be emitted for the current block. | ||
| 124 | block_terminated: bool = false, | ||
| 121 | next_arg_index: u32 = 0, | 125 | next_arg_index: u32 = 0, |
| 122 | args: std.ArrayList(Id) = .empty, | 126 | args: std.ArrayList(Id) = .empty, |
| 123 | virtual_allocas: std.AutoHashMapUnmanaged(Id, ?Id) = .empty, | 127 | virtual_allocas: std.AutoHashMapUnmanaged(Id, ?Id) = .empty, |
| ... | @@ -428,10 +432,13 @@ pub fn genNav(cg: *CodeGen, do_codegen: bool) Error!void { | ... | @@ -428,10 +432,13 @@ pub fn genNav(cg: *CodeGen, do_codegen: bool) Error!void { |
| 428 | if (ty.zigTypeTag(zcu) == .@"struct" and storage_class != .physical_storage_buffer) { | 432 | if (ty.zigTypeTag(zcu) == .@"struct" and storage_class != .physical_storage_buffer) { |
| 429 | try cg.module.decorate(ty_id, .block); | 433 | try cg.module.decorate(ty_id, .block); |
| 430 | } | 434 | } |
| 431 | try cg.module.decorate(ptr_ty_id, .{ | 435 | |
| 432 | .array_stride = .{ .array_stride = @intCast(ty.abiSize(zcu)) }, | 436 | if (ty.hasRuntimeBits(zcu)) { |
| 433 | }); | 437 | try cg.module.decorate(ptr_ty_id, .{ |
| 434 | try cg.decorateLayout(ty, ty_id); | 438 | .array_stride = .{ .array_stride = @intCast(ty.abiSize(zcu)) }, |
| 439 | }); | ||
| 440 | try cg.decorateLayout(ty, ty_id); | ||
| 441 | } | ||
| 435 | }, | 442 | }, |
| 436 | else => {}, | 443 | else => {}, |
| 437 | } | 444 | } |
| ... | @@ -445,6 +452,10 @@ pub fn genNav(cg: *CodeGen, do_codegen: bool) Error!void { | ... | @@ -445,6 +452,10 @@ pub fn genNav(cg: *CodeGen, do_codegen: bool) Error!void { |
| 445 | .location = .{ .location = location }, | 452 | .location = .{ .location = location }, |
| 446 | }); | 453 | }); |
| 447 | }, | 454 | }, |
| 455 | .flat => |location| { | ||
| 456 | try cg.module.decorate(result_id, .{ .location = .{ .location = location } }); | ||
| 457 | try cg.module.decorate(result_id, .flat); | ||
| 458 | }, | ||
| 448 | .descriptor => |descriptor| { | 459 | .descriptor => |descriptor| { |
| 449 | if (storage_class != .storage_buffer and storage_class != .uniform and storage_class != .uniform_constant) { | 460 | if (storage_class != .storage_buffer and storage_class != .uniform and storage_class != .uniform_constant) { |
| 450 | return cg.fail("storage class must be one of (storage_buffer, uniform, uniform_constant) but is {s}", .{@tagName(storage_class)}); | 461 | return cg.fail("storage class must be one of (storage_buffer, uniform, uniform_constant) but is {s}", .{@tagName(storage_class)}); |
| ... | @@ -770,6 +781,7 @@ fn addFunctionDep(cg: *CodeGen, decl_index: Module.Decl.Index, storage_class: St | ... | @@ -770,6 +781,7 @@ fn addFunctionDep(cg: *CodeGen, decl_index: Module.Decl.Index, storage_class: St |
| 770 | fn beginSpvBlock(cg: *CodeGen, label: Id) !void { | 781 | fn beginSpvBlock(cg: *CodeGen, label: Id) !void { |
| 771 | try cg.body.emit(cg.module.gpa, .OpLabel, .{ .id_result = label }); | 782 | try cg.body.emit(cg.module.gpa, .OpLabel, .{ .id_result = label }); |
| 772 | cg.block_label = label; | 783 | cg.block_label = label; |
| 784 | cg.block_terminated = false; | ||
| 773 | } | 785 | } |
| 774 | 786 | ||
| 775 | /// Return the amount of bits in the largest supported integer type. This is either 32 (always supported), or 64 (if | 787 | /// Return the amount of bits in the largest supported integer type. This is either 32 (always supported), or 64 (if |
| ... | @@ -2038,10 +2050,12 @@ fn resolveType(cg: *CodeGen, ty: Type, repr: Repr) Error!Id { | ... | @@ -2038,10 +2050,12 @@ fn resolveType(cg: *CodeGen, ty: Type, repr: Repr) Error!Id { |
| 2038 | const elem_ty: Type = .fromInterned(spirv_type.ty); | 2050 | const elem_ty: Type = .fromInterned(spirv_type.ty); |
| 2039 | const elem_ty_id = try cg.resolveType(elem_ty, .indirect); | 2051 | const elem_ty_id = try cg.resolveType(elem_ty, .indirect); |
| 2040 | const result_id = try cg.module.runtimeArrayType(ip_index, elem_ty_id); | 2052 | const result_id = try cg.module.runtimeArrayType(ip_index, elem_ty_id); |
| 2041 | try cg.module.decorate( | 2053 | |
| 2042 | result_id, | 2054 | if (elem_ty.hasRuntimeBits(zcu)) { |
| 2043 | .{ .array_stride = .{ .array_stride = @intCast(elem_ty.abiSize(zcu)) } }, | 2055 | try cg.module.decorate(result_id, .{ .array_stride = .{ |
| 2044 | ); | 2056 | .array_stride = @intCast(elem_ty.abiSize(zcu)), |
| 2057 | } }); | ||
| 2058 | } | ||
| 2045 | return result_id; | 2059 | return result_id; |
| 2046 | }, | 2060 | }, |
| 2047 | } | 2061 | } |
| ... | @@ -6564,6 +6578,8 @@ fn structuredNextBlock(cg: *CodeGen, incoming: []const Block.Incoming) !Id { | ... | @@ -6564,6 +6578,8 @@ fn structuredNextBlock(cg: *CodeGen, incoming: []const Block.Incoming) !Id { |
| 6564 | /// terminating a body, there should be no instructions after it. | 6578 | /// terminating a body, there should be no instructions after it. |
| 6565 | /// This function should only be called with structured control flow generation. | 6579 | /// This function should only be called with structured control flow generation. |
| 6566 | fn structuredBreak(cg: *CodeGen, target_block: Id) !void { | 6580 | fn structuredBreak(cg: *CodeGen, target_block: Id) !void { |
| 6581 | if (cg.block_terminated) return; | ||
| 6582 | |||
| 6567 | const gpa = cg.module.gpa; | 6583 | const gpa = cg.module.gpa; |
| 6568 | const sblock = cg.block_stack.getLast().?; | 6584 | const sblock = cg.block_stack.getLast().?; |
| 6569 | const merge_block = switch (sblock.*) { | 6585 | const merge_block = switch (sblock.*) { |
| ... | @@ -6833,7 +6849,9 @@ fn airCondBr(cg: *CodeGen, inst: Air.Inst.Index) !void { | ... | @@ -6833,7 +6849,9 @@ fn airCondBr(cg: *CodeGen, inst: Air.Inst.Index) !void { |
| 6833 | .next_block = then_next, | 6849 | .next_block = then_next, |
| 6834 | }; | 6850 | }; |
| 6835 | 6851 | ||
| 6836 | try cg.body.emit(gpa, .OpBranch, .{ .target_label = merge_label }); | 6852 | if (!cg.block_terminated) { |
| 6853 | try cg.body.emit(gpa, .OpBranch, .{ .target_label = merge_label }); | ||
| 6854 | } | ||
| 6837 | 6855 | ||
| 6838 | try cg.beginSpvBlock(else_label); | 6856 | try cg.beginSpvBlock(else_label); |
| 6839 | const else_next = try cg.genStructuredBody(.selection, else_body); | 6857 | const else_next = try cg.genStructuredBody(.selection, else_body); |
| ... | @@ -6842,7 +6860,9 @@ fn airCondBr(cg: *CodeGen, inst: Air.Inst.Index) !void { | ... | @@ -6842,7 +6860,9 @@ fn airCondBr(cg: *CodeGen, inst: Air.Inst.Index) !void { |
| 6842 | .next_block = else_next, | 6860 | .next_block = else_next, |
| 6843 | }; | 6861 | }; |
| 6844 | 6862 | ||
| 6845 | try cg.body.emit(gpa, .OpBranch, .{ .target_label = merge_label }); | 6863 | if (!cg.block_terminated) { |
| 6864 | try cg.body.emit(gpa, .OpBranch, .{ .target_label = merge_label }); | ||
| 6865 | } | ||
| 6846 | 6866 | ||
| 6847 | try cg.beginSpvBlock(merge_label); | 6867 | try cg.beginSpvBlock(merge_label); |
| 6848 | const next_block = try cg.structuredNextBlock(&.{ then_incoming, else_incoming }); | 6868 | const next_block = try cg.structuredNextBlock(&.{ then_incoming, else_incoming }); |
test/behavior/basic.zig+4| ... | @@ -302,6 +302,8 @@ test "compile time global reinterpret" { | ... | @@ -302,6 +302,8 @@ test "compile time global reinterpret" { |
| 302 | } | 302 | } |
| 303 | 303 | ||
| 304 | test "cast undefined" { | 304 | test "cast undefined" { |
| 305 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | ||
| 306 | |||
| 305 | const array: [100]u8 = undefined; | 307 | const array: [100]u8 = undefined; |
| 306 | const slice = @as([]const u8, &array); | 308 | const slice = @as([]const u8, &array); |
| 307 | testCastUndefined(slice); | 309 | testCastUndefined(slice); |
| ... | @@ -372,6 +374,7 @@ test "call function pointer in struct" { | ... | @@ -372,6 +374,7 @@ test "call function pointer in struct" { |
| 372 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | 374 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 373 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | 375 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; |
| 374 | try expect(mem.eql(u8, f3(true), "a")); | 376 | try expect(mem.eql(u8, f3(true), "a")); |
| 377 | try expect(mem.eql(u8, f3(false), "b")); | ||
| 375 | } | 378 | } |
| 376 | 379 | ||
| 377 | fn f3(x: bool) []const u8 { | 380 | fn f3(x: bool) []const u8 { |
| ... | @@ -412,6 +415,7 @@ test "call result of if else expression" { | ... | @@ -412,6 +415,7 @@ test "call result of if else expression" { |
| 412 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | 415 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; |
| 413 | 416 | ||
| 414 | try expect(mem.eql(u8, f2(true), "a")); | 417 | try expect(mem.eql(u8, f2(true), "a")); |
| 418 | try expect(mem.eql(u8, f2(false), "b")); | ||
| 415 | } | 419 | } |
| 416 | fn f2(x: bool) []const u8 { | 420 | fn f2(x: bool) []const u8 { |
| 417 | return (if (x) &fA else &fB)(); | 421 | return (if (x) &fA else &fB)(); |
test/behavior/bitcast.zig+3| ... | @@ -35,6 +35,8 @@ test "@bitCast iX -> uX exotic integers" { | ... | @@ -35,6 +35,8 @@ test "@bitCast iX -> uX exotic integers" { |
| 35 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | 35 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 36 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | 36 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 37 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | 37 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 38 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | ||
| 39 | |||
| 38 | const bit_values = [_]usize{ 1, 48, 27, 512, 493, 293, 125, 204, 112 }; | 40 | const bit_values = [_]usize{ 1, 48, 27, 512, 493, 293, 125, 204, 112 }; |
| 39 | 41 | ||
| 40 | inline for (bit_values) |bits| { | 42 | inline for (bit_values) |bits| { |
| ... | @@ -77,6 +79,7 @@ test "bitcast uX to bytes" { | ... | @@ -77,6 +79,7 @@ test "bitcast uX to bytes" { |
| 77 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | 79 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 78 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | 80 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 79 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | 81 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; |
| 82 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | ||
| 80 | 83 | ||
| 81 | const bit_values = [_]usize{ 1, 48, 27, 512, 493, 293, 125, 204, 112 }; | 84 | const bit_values = [_]usize{ 1, 48, 27, 512, 493, 293, 125, 204, 112 }; |
| 82 | inline for (bit_values) |bits| { | 85 | inline for (bit_values) |bits| { |
test/behavior/cast.zig+13| ... | @@ -103,6 +103,10 @@ test "comptime_int @floatFromInt" { | ... | @@ -103,6 +103,10 @@ test "comptime_int @floatFromInt" { |
| 103 | } | 103 | } |
| 104 | 104 | ||
| 105 | test "@floatFromInt" { | 105 | test "@floatFromInt" { |
| 106 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | ||
| 107 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | ||
| 108 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | ||
| 109 | |||
| 106 | const S = struct { | 110 | const S = struct { |
| 107 | fn doTheTest() !void { | 111 | fn doTheTest() !void { |
| 108 | try testIntToFloat(-2); | 112 | try testIntToFloat(-2); |
| ... | @@ -128,9 +132,13 @@ fn testIntFromFloat(comptime F: type, f: F, comptime I: type, i: I) !void { | ... | @@ -128,9 +132,13 @@ fn testIntFromFloat(comptime F: type, f: F, comptime I: type, i: I) !void { |
| 128 | 132 | ||
| 129 | test "@intFromFloat > 128 bits" { | 133 | test "@intFromFloat > 128 bits" { |
| 130 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | 134 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; |
| 135 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 131 | if (builtin.zig_backend == .stage2_llvm) return error.SkipZigTest; | 136 | if (builtin.zig_backend == .stage2_llvm) return error.SkipZigTest; |
| 137 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; | ||
| 132 | 138 | ||
| 139 | try testIntFromFloat(f16, 1024, u140, 1024); | ||
| 133 | try testIntFromFloat(f16, -1024, i140, -1024); | 140 | try testIntFromFloat(f16, -1024, i140, -1024); |
| 141 | |||
| 134 | try testIntFromFloat(f32, 1 << 24, u140, 1 << 24); | 142 | try testIntFromFloat(f32, 1 << 24, u140, 1 << 24); |
| 135 | try testIntFromFloat(f32, -1 << 24, i140, -1 << 24); | 143 | try testIntFromFloat(f32, -1 << 24, i140, -1 << 24); |
| 136 | 144 | ||
| ... | @@ -152,10 +160,13 @@ test "@floatFromInt > 128 bits" { | ... | @@ -152,10 +160,13 @@ test "@floatFromInt > 128 bits" { |
| 152 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | 160 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; |
| 153 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | 161 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 154 | if (builtin.zig_backend == .stage2_llvm) return error.SkipZigTest; | 162 | if (builtin.zig_backend == .stage2_llvm) return error.SkipZigTest; |
| 163 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; | ||
| 155 | 164 | ||
| 156 | try testFloatFromInt(u140, 1024, f16, 1024); | 165 | try testFloatFromInt(u140, 1024, f16, 1024); |
| 166 | try testFloatFromInt(i140, -1024, f16, -1024); | ||
| 157 | 167 | ||
| 158 | try testFloatFromInt(u140, 1 << 24, f32, 1 << 24); | 168 | try testFloatFromInt(u140, 1 << 24, f32, 1 << 24); |
| 169 | try testFloatFromInt(i140, -1 << 24, f32, -1 << 24); | ||
| 159 | 170 | ||
| 160 | try testFloatFromInt(u200, 1 << 53, f64, 1 << 53); | 171 | try testFloatFromInt(u200, 1 << 53, f64, 1 << 53); |
| 161 | try testFloatFromInt(i200, -1 << 53, f64, -1 << 53); | 172 | try testFloatFromInt(i200, -1 << 53, f64, -1 << 53); |
| ... | @@ -416,9 +427,11 @@ test "implicit cast from *[N]T to [*c]T" { | ... | @@ -416,9 +427,11 @@ test "implicit cast from *[N]T to [*c]T" { |
| 416 | var y: [*c]u16 = &x; | 427 | var y: [*c]u16 = &x; |
| 417 | 428 | ||
| 418 | try expect(std.mem.eql(u16, x[0..4], y[0..4])); | 429 | try expect(std.mem.eql(u16, x[0..4], y[0..4])); |
| 430 | x[0] = 8; | ||
| 419 | y[3] = 6; | 431 | y[3] = 6; |
| 420 | try expect(std.mem.eql(u16, x[0..4], y[0..4])); | 432 | try expect(std.mem.eql(u16, x[0..4], y[0..4])); |
| 421 | } | 433 | } |
| 434 | |||
| 422 | test "*usize to *void" { | 435 | test "*usize to *void" { |
| 423 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | 436 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; |
| 424 | 437 |
test/behavior/cast_int.zig+4| ... | @@ -8,6 +8,8 @@ const minInt = std.math.minInt; | ... | @@ -8,6 +8,8 @@ const minInt = std.math.minInt; |
| 8 | test "@intCast i32 to u7" { | 8 | test "@intCast i32 to u7" { |
| 9 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | 9 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 10 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | 10 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 11 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | ||
| 12 | |||
| 11 | var x: u128 = maxInt(u128); | 13 | var x: u128 = maxInt(u128); |
| 12 | var y: i32 = 120; | 14 | var y: i32 = 120; |
| 13 | _ = .{ &x, &y }; | 15 | _ = .{ &x, &y }; |
| ... | @@ -143,6 +145,7 @@ test "@intCast <= 64 bits" { | ... | @@ -143,6 +145,7 @@ test "@intCast <= 64 bits" { |
| 143 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | 145 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 144 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | 146 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; |
| 145 | try testIntCast(i32, minInt(i32), i64, minInt(i32)); | 147 | try testIntCast(i32, minInt(i32), i64, minInt(i32)); |
| 148 | try testIntCast(i32, maxInt(i32), i64, maxInt(i32)); | ||
| 146 | try testIntCast(u32, maxInt(u32), u64, maxInt(u32)); | 149 | try testIntCast(u32, maxInt(u32), u64, maxInt(u32)); |
| 147 | try testIntCast(u32, maxInt(i32), i64, maxInt(i32)); | 150 | try testIntCast(u32, maxInt(i32), i64, maxInt(i32)); |
| 148 | try testIntCast(u32, maxInt(u32), i64, maxInt(u32)); | 151 | try testIntCast(u32, maxInt(u32), i64, maxInt(u32)); |
| ... | @@ -169,6 +172,7 @@ test "@intCast > 128 bits" { | ... | @@ -169,6 +172,7 @@ test "@intCast > 128 bits" { |
| 169 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | 172 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; |
| 170 | 173 | ||
| 171 | try testIntCast(u8, 123, u140, 123); | 174 | try testIntCast(u8, 123, u140, 123); |
| 175 | try testIntCast(u64, 1 << 63, u140, 1 << 63); | ||
| 172 | try testIntCast(u127, maxInt(u127), u140, maxInt(u127)); | 176 | try testIntCast(u127, maxInt(u127), u140, maxInt(u127)); |
| 173 | try testIntCast(i8, -42, i140, -42); | 177 | try testIntCast(i8, -42, i140, -42); |
| 174 | try testIntCast(i64, minInt(i64), i140, minInt(i64)); | 178 | try testIntCast(i64, minInt(i64), i140, minInt(i64)); |
test/behavior/enum.zig+6| ... | @@ -932,6 +932,7 @@ test "constant enum initialization with differing sizes" { | ... | @@ -932,6 +932,7 @@ test "constant enum initialization with differing sizes" { |
| 932 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | 932 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; |
| 933 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | 933 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; |
| 934 | try test3_1(test3_foo); | 934 | try test3_1(test3_foo); |
| 935 | try test3_2(test3_bar); | ||
| 935 | } | 936 | } |
| 936 | const Test3Foo = union(enum) { | 937 | const Test3Foo = union(enum) { |
| 937 | One: void, | 938 | One: void, |
| ... | @@ -972,7 +973,9 @@ test "@tagName" { | ... | @@ -972,7 +973,9 @@ test "@tagName" { |
| 972 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | 973 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 973 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | 974 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 974 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | 975 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; |
| 976 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | ||
| 975 | 977 | ||
| 978 | try expect(mem.eql(u8, testEnumTagNameBare(BareNumber.Three), "Three")); | ||
| 976 | comptime assert(mem.eql(u8, testEnumTagNameBare(BareNumber.Three), "Three")); | 979 | comptime assert(mem.eql(u8, testEnumTagNameBare(BareNumber.Three), "Three")); |
| 977 | } | 980 | } |
| 978 | 981 | ||
| ... | @@ -987,7 +990,9 @@ test "@tagName non-exhaustive enum" { | ... | @@ -987,7 +990,9 @@ test "@tagName non-exhaustive enum" { |
| 987 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | 990 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 988 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | 991 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 989 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | 992 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; |
| 993 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | ||
| 990 | 994 | ||
| 995 | try expect(mem.eql(u8, testEnumTagNameBare(NonExhaustive.B), "B")); | ||
| 991 | comptime assert(mem.eql(u8, testEnumTagNameBare(NonExhaustive.B), "B")); | 996 | comptime assert(mem.eql(u8, testEnumTagNameBare(NonExhaustive.B), "B")); |
| 992 | } | 997 | } |
| 993 | const NonExhaustive = enum(u8) { A, B, _ }; | 998 | const NonExhaustive = enum(u8) { A, B, _ }; |
| ... | @@ -1029,6 +1034,7 @@ test "@tagName on enum literals" { | ... | @@ -1029,6 +1034,7 @@ test "@tagName on enum literals" { |
| 1029 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | 1034 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; |
| 1030 | 1035 | ||
| 1031 | try expect(mem.eql(u8, @tagName(.FooBar), "FooBar")); | 1036 | try expect(mem.eql(u8, @tagName(.FooBar), "FooBar")); |
| 1037 | comptime assert(mem.eql(u8, @tagName(.FooBar), "FooBar")); | ||
| 1032 | } | 1038 | } |
| 1033 | 1039 | ||
| 1034 | test "tag name with signed enum values" { | 1040 | test "tag name with signed enum values" { |
test/behavior/error.zig+10| ... | @@ -145,11 +145,17 @@ test "implicit cast to optional to error union to return result loc" { | ... | @@ -145,11 +145,17 @@ test "implicit cast to optional to error union to return result loc" { |
| 145 | } | 145 | } |
| 146 | 146 | ||
| 147 | test "fn returning empty error set can be passed as fn returning any error" { | 147 | test "fn returning empty error set can be passed as fn returning any error" { |
| 148 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | ||
| 149 | |||
| 150 | entry(); | ||
| 151 | comptime entry(); | ||
| 148 | } | 152 | } |
| 149 | 153 | ||
| 150 | test "fn returning empty error set can be passed as fn returning any error - pointer" { | 154 | test "fn returning empty error set can be passed as fn returning any error - pointer" { |
| 151 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | 155 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; |
| 156 | |||
| 152 | entryPtr(); | 157 | entryPtr(); |
| 158 | comptime entryPtr(); | ||
| 153 | } | 159 | } |
| 154 | fn entry() void { | 160 | fn entry() void { |
| 155 | foo2(bar2); | 161 | foo2(bar2); |
| ... | @@ -362,8 +368,10 @@ test "error: Infer error set from literals" { | ... | @@ -362,8 +368,10 @@ test "error: Infer error set from literals" { |
| 362 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | 368 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; |
| 363 | 369 | ||
| 364 | _ = nullLiteral("n") catch |err| handleErrors(err); | 370 | _ = nullLiteral("n") catch |err| handleErrors(err); |
| 371 | _ = floatLiteral("n") catch |err| handleErrors(err); | ||
| 365 | _ = intLiteral("n") catch |err| handleErrors(err); | 372 | _ = intLiteral("n") catch |err| handleErrors(err); |
| 366 | _ = comptime nullLiteral("n") catch |err| handleErrors(err); | 373 | _ = comptime nullLiteral("n") catch |err| handleErrors(err); |
| 374 | _ = comptime floatLiteral("n") catch |err| handleErrors(err); | ||
| 367 | _ = comptime intLiteral("n") catch |err| handleErrors(err); | 375 | _ = comptime intLiteral("n") catch |err| handleErrors(err); |
| 368 | } | 376 | } |
| 369 | 377 | ||
| ... | @@ -689,6 +697,7 @@ test "coerce error set to the current inferred error set" { | ... | @@ -689,6 +697,7 @@ test "coerce error set to the current inferred error set" { |
| 689 | test "error union payload is properly aligned" { | 697 | test "error union payload is properly aligned" { |
| 690 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | 698 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 691 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | 699 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 700 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | ||
| 692 | 701 | ||
| 693 | const S = struct { | 702 | const S = struct { |
| 694 | a: u128, | 703 | a: u128, |
| ... | @@ -746,6 +755,7 @@ test "pointer to error union payload" { | ... | @@ -746,6 +755,7 @@ test "pointer to error union payload" { |
| 746 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | 755 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 747 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | 756 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 748 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | 757 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; |
| 758 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | ||
| 749 | 759 | ||
| 750 | var err_union: anyerror!u8 = 15; | 760 | var err_union: anyerror!u8 = 15; |
| 751 | 761 |
test/behavior/eval.zig-1| ... | @@ -1181,7 +1181,6 @@ test "lazy sizeof is resolved in division" { | ... | @@ -1181,7 +1181,6 @@ test "lazy sizeof is resolved in division" { |
| 1181 | } | 1181 | } |
| 1182 | 1182 | ||
| 1183 | test "lazy sizeof union tag size in compare" { | 1183 | test "lazy sizeof union tag size in compare" { |
| 1184 | |||
| 1185 | const A = union(enum) { | 1184 | const A = union(enum) { |
| 1186 | a: void, | 1185 | a: void, |
| 1187 | b: void, | 1186 | b: void, |
test/behavior/floatop.zig+8| ... | @@ -134,6 +134,8 @@ test "cmp f32" { | ... | @@ -134,6 +134,8 @@ test "cmp f32" { |
| 134 | } | 134 | } |
| 135 | 135 | ||
| 136 | test "cmp f64" { | 136 | test "cmp f64" { |
| 137 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | ||
| 138 | |||
| 137 | try testCmp(f64); | 139 | try testCmp(f64); |
| 138 | try comptime testCmp(f64); | 140 | try comptime testCmp(f64); |
| 139 | } | 141 | } |
| ... | @@ -142,7 +144,9 @@ test "cmp f128" { | ... | @@ -142,7 +144,9 @@ test "cmp f128" { |
| 142 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | 144 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 143 | if (builtin.zig_backend == .stage2_c and builtin.cpu.arch.isArm()) return error.SkipZigTest; | 145 | if (builtin.zig_backend == .stage2_c and builtin.cpu.arch.isArm()) return error.SkipZigTest; |
| 144 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | 146 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; |
| 147 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | ||
| 145 | 148 | ||
| 149 | try testCmp(f128); | ||
| 146 | try comptime testCmp(f128); | 150 | try comptime testCmp(f128); |
| 147 | } | 151 | } |
| 148 | 152 | ||
| ... | @@ -150,7 +154,10 @@ test "cmp f80/c_longdouble" { | ... | @@ -150,7 +154,10 @@ test "cmp f80/c_longdouble" { |
| 150 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | 154 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 151 | if (builtin.zig_backend == .stage2_c and builtin.cpu.arch.isArm()) return error.SkipZigTest; | 155 | if (builtin.zig_backend == .stage2_c and builtin.cpu.arch.isArm()) return error.SkipZigTest; |
| 152 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | 156 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; |
| 157 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | ||
| 153 | 158 | ||
| 159 | try testCmp(f80); | ||
| 160 | try comptime testCmp(f80); | ||
| 154 | try testCmp(c_longdouble); | 161 | try testCmp(c_longdouble); |
| 155 | try comptime testCmp(c_longdouble); | 162 | try comptime testCmp(c_longdouble); |
| 156 | } | 163 | } |
| ... | @@ -225,6 +232,7 @@ test "vector cmp f32" { | ... | @@ -225,6 +232,7 @@ test "vector cmp f32" { |
| 225 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | 232 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; |
| 226 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | 233 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 227 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | 234 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; |
| 235 | if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch.isArm()) return error.SkipZigTest; | ||
| 228 | if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch.isPowerPC64()) return error.SkipZigTest; | 236 | if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch.isPowerPC64()) return error.SkipZigTest; |
| 229 | if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .hexagon) return error.SkipZigTest; | 237 | if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .hexagon) return error.SkipZigTest; |
| 230 | 238 |
test/behavior/fn.zig+6| ... | @@ -292,6 +292,9 @@ fn voidFun(a: i32, b: void, c: i32, d: void) !void { | ... | @@ -292,6 +292,9 @@ fn voidFun(a: i32, b: void, c: i32, d: void) !void { |
| 292 | 292 | ||
| 293 | test "call function with empty string" { | 293 | test "call function with empty string" { |
| 294 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | 294 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 295 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | ||
| 296 | |||
| 297 | acceptsString(""); | ||
| 295 | } | 298 | } |
| 296 | 299 | ||
| 297 | fn acceptsString(foo: []u8) void { | 300 | fn acceptsString(foo: []u8) void { |
| ... | @@ -302,7 +305,9 @@ test "function pointers" { | ... | @@ -302,7 +305,9 @@ test "function pointers" { |
| 302 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | 305 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 303 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | 306 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 304 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | 307 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; |
| 308 | |||
| 305 | const fns = [_]*const @TypeOf(fn1){ | 309 | const fns = [_]*const @TypeOf(fn1){ |
| 310 | &fn1, | ||
| 306 | &fn2, | 311 | &fn2, |
| 307 | &fn3, | 312 | &fn3, |
| 308 | &fn4, | 313 | &fn4, |
| ... | @@ -440,6 +445,7 @@ test "method call with optional and error union first param" { | ... | @@ -440,6 +445,7 @@ test "method call with optional and error union first param" { |
| 440 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | 445 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; |
| 441 | 446 | ||
| 442 | const S = struct { | 447 | const S = struct { |
| 448 | x: i32 = 1234, | ||
| 443 | 449 | ||
| 444 | fn opt(s: ?@This()) !void { | 450 | fn opt(s: ?@This()) !void { |
| 445 | try expect(s.?.x == 1234); | 451 | try expect(s.?.x == 1234); |
test/behavior/math.zig+1-1| ... | @@ -574,6 +574,7 @@ test "large integer division" { | ... | @@ -574,6 +574,7 @@ test "large integer division" { |
| 574 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | 574 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 575 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; | 575 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; |
| 576 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | 576 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; |
| 577 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | ||
| 577 | 578 | ||
| 578 | { | 579 | { |
| 579 | var numerator: u256 = 99999999999999999997315645440; | 580 | var numerator: u256 = 99999999999999999997315645440; |
| ... | @@ -654,7 +655,6 @@ fn testSignedWrappingEval(x: i32) !void { | ... | @@ -654,7 +655,6 @@ fn testSignedWrappingEval(x: i32) !void { |
| 654 | } | 655 | } |
| 655 | 656 | ||
| 656 | test "signed negation wrapping" { | 657 | test "signed negation wrapping" { |
| 657 | |||
| 658 | try testSignedNegationWrappingEval(minInt(i16)); | 658 | try testSignedNegationWrappingEval(minInt(i16)); |
| 659 | try comptime testSignedNegationWrappingEval(minInt(i16)); | 659 | try comptime testSignedNegationWrappingEval(minInt(i16)); |
| 660 | } | 660 | } |
test/behavior/maximum_minimum.zig+1| ... | @@ -350,6 +350,7 @@ test "@min/@max with runtime signed and unsigned integers of same size" { | ... | @@ -350,6 +350,7 @@ test "@min/@max with runtime signed and unsigned integers of same size" { |
| 350 | 350 | ||
| 351 | test "@min/@max with runtime vectors of signed and unsigned integers of same size" { | 351 | test "@min/@max with runtime vectors of signed and unsigned integers of same size" { |
| 352 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | 352 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; |
| 353 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 353 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | 354 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 354 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | 355 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 355 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | 356 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; |
test/behavior/memcpy.zig-1| ... | @@ -168,7 +168,6 @@ test "@memcpy with sentinel" { | ... | @@ -168,7 +168,6 @@ test "@memcpy with sentinel" { |
| 168 | } | 168 | } |
| 169 | 169 | ||
| 170 | test "@memcpy no sentinel source into sentinel destination" { | 170 | test "@memcpy no sentinel source into sentinel destination" { |
| 171 | |||
| 172 | const S = struct { | 171 | const S = struct { |
| 173 | fn doTheTest() void { | 172 | fn doTheTest() void { |
| 174 | const src: []const u8 = &.{ 1, 2, 3 }; | 173 | const src: []const u8 = &.{ 1, 2, 3 }; |
test/behavior/muladd.zig+3| ... | @@ -34,6 +34,7 @@ test "@mulAdd f16" { | ... | @@ -34,6 +34,7 @@ test "@mulAdd f16" { |
| 34 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | 34 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; |
| 35 | 35 | ||
| 36 | try comptime testMulAdd16(); | 36 | try comptime testMulAdd16(); |
| 37 | try testMulAdd16(); | ||
| 37 | } | 38 | } |
| 38 | 39 | ||
| 39 | fn testMulAdd16() !void { | 40 | fn testMulAdd16() !void { |
| ... | @@ -48,7 +49,9 @@ test "@mulAdd f80" { | ... | @@ -48,7 +49,9 @@ test "@mulAdd f80" { |
| 48 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | 49 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 49 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | 50 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 50 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | 51 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; |
| 52 | if (builtin.zig_backend == .stage2_c and builtin.cpu.arch.isArm()) return error.SkipZigTest; | ||
| 51 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | 53 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; |
| 54 | |||
| 52 | try comptime testMulAdd80(); | 55 | try comptime testMulAdd80(); |
| 53 | try testMulAdd80(); | 56 | try testMulAdd80(); |
| 54 | } | 57 | } |
test/behavior/optional.zig+1| ... | @@ -522,6 +522,7 @@ test "alignment of wrapping an optional payload" { | ... | @@ -522,6 +522,7 @@ test "alignment of wrapping an optional payload" { |
| 522 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | 522 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 523 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | 523 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 524 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | 524 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; |
| 525 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | ||
| 525 | 526 | ||
| 526 | const S = struct { | 527 | const S = struct { |
| 527 | const I = extern struct { x: i128 }; | 528 | const I = extern struct { x: i128 }; |
test/behavior/packed-struct.zig+3| ... | @@ -227,6 +227,8 @@ test "nested packed structs" { | ... | @@ -227,6 +227,8 @@ test "nested packed structs" { |
| 227 | test "regular in irregular packed struct" { | 227 | test "regular in irregular packed struct" { |
| 228 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | 228 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 229 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | 229 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 230 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 231 | |||
| 230 | const Irregular = packed struct { | 232 | const Irregular = packed struct { |
| 231 | bar: Regular = Regular{}, | 233 | bar: Regular = Regular{}, |
| 232 | _: u24 = 0, | 234 | _: u24 = 0, |
| ... | @@ -247,6 +249,7 @@ test "nested packed struct unaligned" { | ... | @@ -247,6 +249,7 @@ test "nested packed struct unaligned" { |
| 247 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | 249 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 248 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | 250 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; |
| 249 | const S1 = packed struct { | 251 | const S1 = packed struct { |
| 252 | a: u4, | ||
| 250 | b: u4, | 253 | b: u4, |
| 251 | c: u8, | 254 | c: u8, |
| 252 | }; | 255 | }; |
test/behavior/struct.zig+3| ... | @@ -446,6 +446,7 @@ test "runtime struct initialization of bitfield" { | ... | @@ -446,6 +446,7 @@ test "runtime struct initialization of bitfield" { |
| 446 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | 446 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 447 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | 447 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 448 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | 448 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 449 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | ||
| 449 | 450 | ||
| 450 | const s1 = Nibbles{ | 451 | const s1 = Nibbles{ |
| 451 | .x = x1, | 452 | .x = x1, |
| ... | @@ -503,6 +504,7 @@ test "implicit cast packed struct field to const ptr" { | ... | @@ -503,6 +504,7 @@ test "implicit cast packed struct field to const ptr" { |
| 503 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | 504 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 504 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | 505 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 505 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | 506 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 507 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; // TODO | ||
| 506 | 508 | ||
| 507 | const LevelUpMove = packed struct { | 509 | const LevelUpMove = packed struct { |
| 508 | move_id: u9, | 510 | move_id: u9, |
| ... | @@ -536,6 +538,7 @@ test "packed struct with non-ABI-aligned field" { | ... | @@ -536,6 +538,7 @@ test "packed struct with non-ABI-aligned field" { |
| 536 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO | 538 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO |
| 537 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | 539 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 538 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | 540 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; |
| 541 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | ||
| 539 | 542 | ||
| 540 | const S = packed struct { | 543 | const S = packed struct { |
| 541 | x: u9, | 544 | x: u9, |
test/behavior/vector.zig+2| ... | @@ -415,6 +415,7 @@ test "vector @splat" { | ... | @@ -415,6 +415,7 @@ test "vector @splat" { |
| 415 | 415 | ||
| 416 | test "load vector elements via comptime index" { | 416 | test "load vector elements via comptime index" { |
| 417 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | 417 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; |
| 418 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | ||
| 418 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | 419 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 419 | 420 | ||
| 420 | const S = struct { | 421 | const S = struct { |
| ... | @@ -617,6 +618,7 @@ test "vector division operators" { | ... | @@ -617,6 +618,7 @@ test "vector division operators" { |
| 617 | test "vector bitwise not operator" { | 618 | test "vector bitwise not operator" { |
| 618 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | 619 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 619 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | 620 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; |
| 621 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | ||
| 620 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | 622 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 621 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | 623 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; |
| 622 | 624 |
test/behavior/while.zig-1| ... | @@ -38,7 +38,6 @@ fn staticWhileLoop2() i32 { | ... | @@ -38,7 +38,6 @@ fn staticWhileLoop2() i32 { |
| 38 | } | 38 | } |
| 39 | 39 | ||
| 40 | test "while with continue expression" { | 40 | test "while with continue expression" { |
| 41 | |||
| 42 | var sum: i32 = 0; | 41 | var sum: i32 = 0; |
| 43 | { | 42 | { |
| 44 | var i: i32 = 0; | 43 | var i: i32 = 0; |
test/cases/compile_errors/extern_spirv_decoration_validation.zig created+13| ... | @@ -0,0 +1,13 @@ | ||
| 1 | const x = @extern(*addrspace(.output) u32, .{ | ||
| 2 | .name = "x", | ||
| 3 | .decoration = .{ .flat = 0 }, | ||
| 4 | }); | ||
| 5 | comptime { | ||
| 6 | _ = x; | ||
| 7 | } | ||
| 8 | |||
| 9 | // error | ||
| 10 | // backend=selfhosted | ||
| 11 | // target=spirv64-vulkan | ||
| 12 | // | ||
| 13 | // :1:45: error: 'flat' decoration requires 'input' address space | ||