| author | |
| committer | |
| log | fd6b3db34252f2a548630c0e57fe80f32202aa12 |
| tree | 0111caae6ee7e5c69a98702199609b163ed27405 |
| parent | a1e0b9979ab2a47ad1d13dd06106c3143d9a1c9e |
| parent | 8c153221b9e1ff34edd18382770d02aae36dbe74 |
| signature |
spirv: more instructions96 files changed, 1136 insertions(+), 764 deletions(-)
.github/CODEOWNERS+4-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | # Autodoc | |
| 1 | # Autodoc | |
| 2 | 2 | /src/Autodoc.zig @kristoff-it |
| 3 | 3 | /src/autodoc/* @kristoff-it |
| 4 | 4 | /lib/docs/* @kristoff-it |
| ... | ... | @@ -11,3 +11,6 @@ |
| 11 | 11 | |
| 12 | 12 | # resinator |
| 13 | 13 | /src/resinator/* @squeek502 |
| 14 | ||
| 15 | # SPIR-V selfhosted backend | |
| 16 | /src/codegen/spirv* @Snektron |
lib/std/testing.zig+12-4| ... | ... | @@ -21,11 +21,15 @@ pub var base_allocator_instance = std.heap.FixedBufferAllocator.init(""); |
| 21 | 21 | /// TODO https://github.com/ziglang/zig/issues/5738 |
| 22 | 22 | pub var log_level = std.log.Level.warn; |
| 23 | 23 | |
| 24 | fn print(comptime fmt: []const u8, args: anytype) void { | |
| 25 | // Disable printing in tests for simple backends. | |
| 26 | if (builtin.zig_backend == .stage2_spirv64) return; | |
| 24 | // Disable printing in tests for simple backends. | |
| 25 | pub const backend_can_print = builtin.zig_backend != .stage2_spirv64; | |
| 27 | 26 | |
| 28 | std.debug.print(fmt, args); | |
| 27 | fn print(comptime fmt: []const u8, args: anytype) void { | |
| 28 | if (@inComptime()) { | |
| 29 | @compileError(std.fmt.comptimePrint(fmt, args)); | |
| 30 | } else if (backend_can_print) { | |
| 31 | std.debug.print(fmt, args); | |
| 32 | } | |
| 29 | 33 | } |
| 30 | 34 | |
| 31 | 35 | /// This function is intended to be used only in tests. It prints diagnostics to stderr |
| ... | ... | @@ -300,6 +304,10 @@ pub fn expectEqualSlices(comptime T: type, expected: []const T, actual: []const |
| 300 | 304 | break :diff_index if (expected.len == actual.len) return else shortest; |
| 301 | 305 | }; |
| 302 | 306 | |
| 307 | if (!backend_can_print) { | |
| 308 | return error.TestExpectedEqual; | |
| 309 | } | |
| 310 | ||
| 303 | 311 | print("slices differ. first difference occurs at index {d} (0x{X})\n", .{ diff_index, diff_index }); |
| 304 | 312 | |
| 305 | 313 | // TODO: Should this be configurable by the caller? |
src/InternPool.zig+10-5| ... | ... | @@ -1556,10 +1556,10 @@ pub const Key = union(enum) { |
| 1556 | 1556 | // These are strange: we'll sometimes represent them as f128, even if the |
| 1557 | 1557 | // underlying type is smaller. f80 is an exception: see float_c_longdouble_f80. |
| 1558 | 1558 | const a_val = switch (a_info.storage) { |
| 1559 | inline else => |val| @as(f128, @floatCast(val)), | |
| 1559 | inline else => |val| @as(u128, @bitCast(@as(f128, @floatCast(val)))), | |
| 1560 | 1560 | }; |
| 1561 | 1561 | const b_val = switch (b_info.storage) { |
| 1562 | inline else => |val| @as(f128, @floatCast(val)), | |
| 1562 | inline else => |val| @as(u128, @bitCast(@as(f128, @floatCast(val)))), | |
| 1563 | 1563 | }; |
| 1564 | 1564 | return a_val == b_val; |
| 1565 | 1565 | } |
| ... | ... | @@ -1567,9 +1567,14 @@ pub const Key = union(enum) { |
| 1567 | 1567 | const StorageTag = @typeInfo(Key.Float.Storage).Union.tag_type.?; |
| 1568 | 1568 | assert(@as(StorageTag, a_info.storage) == @as(StorageTag, b_info.storage)); |
| 1569 | 1569 | |
| 1570 | return switch (a_info.storage) { | |
| 1571 | inline else => |val, tag| val == @field(b_info.storage, @tagName(tag)), | |
| 1572 | }; | |
| 1570 | switch (a_info.storage) { | |
| 1571 | inline else => |val, tag| { | |
| 1572 | const Bits = std.meta.Int(.unsigned, @bitSizeOf(@TypeOf(val))); | |
| 1573 | const a_bits: Bits = @bitCast(val); | |
| 1574 | const b_bits: Bits = @bitCast(@field(b_info.storage, @tagName(tag))); | |
| 1575 | return a_bits == b_bits; | |
| 1576 | }, | |
| 1577 | } | |
| 1573 | 1578 | }, |
| 1574 | 1579 | |
| 1575 | 1580 | .opaque_type => |a_info| { |
src/arch/wasm/CodeGen.zig+21-7| ... | ... | @@ -6253,8 +6253,10 @@ fn airMulWithOverflow(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6253 | 6253 | func.finishAir(inst, result_ptr, &.{ extra.lhs, extra.rhs }); |
| 6254 | 6254 | } |
| 6255 | 6255 | |
| 6256 | fn airMaxMin(func: *CodeGen, inst: Air.Inst.Index, op: enum { max, min }) InnerError!void { | |
| 6256 | fn airMaxMin(func: *CodeGen, inst: Air.Inst.Index, op: Op) InnerError!void { | |
| 6257 | assert(op == .max or op == .min); | |
| 6257 | 6258 | const mod = func.bin_file.base.options.module.?; |
| 6259 | const target = mod.getTarget(); | |
| 6258 | 6260 | const bin_op = func.air.instructions.items(.data)[inst].bin_op; |
| 6259 | 6261 | |
| 6260 | 6262 | const ty = func.typeOfIndex(inst); |
| ... | ... | @@ -6269,13 +6271,25 @@ fn airMaxMin(func: *CodeGen, inst: Air.Inst.Index, op: enum { max, min }) InnerE |
| 6269 | 6271 | const lhs = try func.resolveInst(bin_op.lhs); |
| 6270 | 6272 | const rhs = try func.resolveInst(bin_op.rhs); |
| 6271 | 6273 | |
| 6272 | // operands to select from | |
| 6273 | try func.lowerToStack(lhs); | |
| 6274 | try func.lowerToStack(rhs); | |
| 6275 | _ = try func.cmp(lhs, rhs, ty, if (op == .max) .gt else .lt); | |
| 6274 | if (ty.zigTypeTag(mod) == .Float) { | |
| 6275 | var fn_name_buf: [64]u8 = undefined; | |
| 6276 | const float_bits = ty.floatBits(target); | |
| 6277 | const fn_name = std.fmt.bufPrint(&fn_name_buf, "{s}f{s}{s}", .{ | |
| 6278 | target_util.libcFloatPrefix(float_bits), | |
| 6279 | @tagName(op), | |
| 6280 | target_util.libcFloatSuffix(float_bits), | |
| 6281 | }) catch unreachable; | |
| 6282 | const result = try func.callIntrinsic(fn_name, &.{ ty.ip_index, ty.ip_index }, ty, &.{ lhs, rhs }); | |
| 6283 | try func.lowerToStack(result); | |
| 6284 | } else { | |
| 6285 | // operands to select from | |
| 6286 | try func.lowerToStack(lhs); | |
| 6287 | try func.lowerToStack(rhs); | |
| 6288 | _ = try func.cmp(lhs, rhs, ty, if (op == .max) .gt else .lt); | |
| 6276 | 6289 | |
| 6277 | // based on the result from comparison, return operand 0 or 1. | |
| 6278 | try func.addTag(.select); | |
| 6290 | // based on the result from comparison, return operand 0 or 1. | |
| 6291 | try func.addTag(.select); | |
| 6292 | } | |
| 6279 | 6293 | |
| 6280 | 6294 | // store result in local |
| 6281 | 6295 | const result_ty = if (isByRef(ty, mod)) Type.u32 else ty; |
src/codegen/llvm.zig+1| ... | ... | @@ -3050,6 +3050,7 @@ pub const Object = struct { |
| 3050 | 3050 | decl_val: InternPool.Index, |
| 3051 | 3051 | llvm_addr_space: Builder.AddrSpace, |
| 3052 | 3052 | ) Error!Builder.Variable.Index { |
| 3053 | // TODO: Add address space to the anon_decl_map | |
| 3053 | 3054 | const gop = try o.anon_decl_map.getOrPut(o.gpa, decl_val); |
| 3054 | 3055 | if (gop.found_existing) return gop.value_ptr.ptr(&o.builder).kind.variable; |
| 3055 | 3056 | errdefer assert(o.anon_decl_map.remove(decl_val)); |
src/codegen/spirv.zig+953-310| ... | ... | @@ -52,18 +52,136 @@ const Block = struct { |
| 52 | 52 | |
| 53 | 53 | const BlockMap = std.AutoHashMapUnmanaged(Air.Inst.Index, *Block); |
| 54 | 54 | |
| 55 | /// Maps Zig decl indices to linking SPIR-V linking information. | |
| 56 | pub const DeclLinkMap = std.AutoHashMap(Module.Decl.Index, SpvModule.Decl.Index); | |
| 55 | /// This structure holds information that is relevant to the entire compilation, | |
| 56 | /// in contrast to `DeclGen`, which only holds relevant information about a | |
| 57 | /// single decl. | |
| 58 | pub const Object = struct { | |
| 59 | /// A general-purpose allocator that can be used for any allocation for this Object. | |
| 60 | gpa: Allocator, | |
| 61 | ||
| 62 | /// the SPIR-V module that represents the final binary. | |
| 63 | spv: SpvModule, | |
| 64 | ||
| 65 | /// The Zig module that this object file is generated for. | |
| 66 | /// A map of Zig decl indices to SPIR-V decl indices. | |
| 67 | decl_link: std.AutoHashMapUnmanaged(Decl.Index, SpvModule.Decl.Index) = .{}, | |
| 68 | ||
| 69 | /// A map of Zig InternPool indices for anonymous decls to SPIR-V decl indices. | |
| 70 | anon_decl_link: std.AutoHashMapUnmanaged(struct { InternPool.Index, StorageClass }, SpvModule.Decl.Index) = .{}, | |
| 71 | ||
| 72 | /// A map that maps AIR intern pool indices to SPIR-V cache references (which | |
| 73 | /// is basically the same thing except for SPIR-V). | |
| 74 | /// This map is typically only used for structures that are deemed heavy enough | |
| 75 | /// that it is worth to store them here. The SPIR-V module also interns types, | |
| 76 | /// and so the main purpose of this map is to avoid recomputation and to | |
| 77 | /// cache extra information about the type rather than to aid in validity | |
| 78 | /// of the SPIR-V module. | |
| 79 | type_map: TypeMap = .{}, | |
| 80 | ||
| 81 | pub fn init(gpa: Allocator) Object { | |
| 82 | return .{ | |
| 83 | .gpa = gpa, | |
| 84 | .spv = SpvModule.init(gpa), | |
| 85 | }; | |
| 86 | } | |
| 87 | ||
| 88 | pub fn deinit(self: *Object) void { | |
| 89 | self.spv.deinit(); | |
| 90 | self.decl_link.deinit(self.gpa); | |
| 91 | self.anon_decl_link.deinit(self.gpa); | |
| 92 | self.type_map.deinit(self.gpa); | |
| 93 | } | |
| 94 | ||
| 95 | fn genDecl( | |
| 96 | self: *Object, | |
| 97 | mod: *Module, | |
| 98 | decl_index: Decl.Index, | |
| 99 | air: Air, | |
| 100 | liveness: Liveness, | |
| 101 | ) !void { | |
| 102 | var decl_gen = DeclGen{ | |
| 103 | .gpa = self.gpa, | |
| 104 | .object = self, | |
| 105 | .module = mod, | |
| 106 | .spv = &self.spv, | |
| 107 | .decl_index = decl_index, | |
| 108 | .air = air, | |
| 109 | .liveness = liveness, | |
| 110 | .type_map = &self.type_map, | |
| 111 | .current_block_label_id = undefined, | |
| 112 | }; | |
| 113 | defer decl_gen.deinit(); | |
| 114 | ||
| 115 | decl_gen.genDecl() catch |err| switch (err) { | |
| 116 | error.CodegenFail => { | |
| 117 | try mod.failed_decls.put(mod.gpa, decl_index, decl_gen.error_msg.?); | |
| 118 | }, | |
| 119 | else => |other| { | |
| 120 | // There might be an error that happened *after* self.error_msg | |
| 121 | // was already allocated, so be sure to free it. | |
| 122 | if (decl_gen.error_msg) |error_msg| { | |
| 123 | error_msg.deinit(mod.gpa); | |
| 124 | } | |
| 125 | ||
| 126 | return other; | |
| 127 | }, | |
| 128 | }; | |
| 129 | } | |
| 130 | ||
| 131 | pub fn updateFunc( | |
| 132 | self: *Object, | |
| 133 | mod: *Module, | |
| 134 | func_index: InternPool.Index, | |
| 135 | air: Air, | |
| 136 | liveness: Liveness, | |
| 137 | ) !void { | |
| 138 | const decl_index = mod.funcInfo(func_index).owner_decl; | |
| 139 | // TODO: Separate types for generating decls and functions? | |
| 140 | try self.genDecl(mod, decl_index, air, liveness); | |
| 141 | } | |
| 142 | ||
| 143 | pub fn updateDecl( | |
| 144 | self: *Object, | |
| 145 | mod: *Module, | |
| 146 | decl_index: Decl.Index, | |
| 147 | ) !void { | |
| 148 | try self.genDecl(mod, decl_index, undefined, undefined); | |
| 149 | } | |
| 150 | ||
| 151 | /// Fetch or allocate a result id for decl index. This function also marks the decl as alive. | |
| 152 | /// Note: Function does not actually generate the decl, it just allocates an index. | |
| 153 | pub fn resolveDecl(self: *Object, mod: *Module, decl_index: Decl.Index) !SpvModule.Decl.Index { | |
| 154 | const decl = mod.declPtr(decl_index); | |
| 155 | try mod.markDeclAlive(decl); | |
| 156 | ||
| 157 | const entry = try self.decl_link.getOrPut(self.gpa, decl_index); | |
| 158 | if (!entry.found_existing) { | |
| 159 | // TODO: Extern fn? | |
| 160 | const kind: SpvModule.DeclKind = if (decl.val.isFuncBody(mod)) | |
| 161 | .func | |
| 162 | else | |
| 163 | .global; | |
| 164 | ||
| 165 | entry.value_ptr.* = try self.spv.allocDecl(kind); | |
| 166 | } | |
| 167 | ||
| 168 | return entry.value_ptr.*; | |
| 169 | } | |
| 170 | }; | |
| 57 | 171 | |
| 58 | 172 | /// This structure is used to compile a declaration, and contains all relevant meta-information to deal with that. |
| 59 | pub const DeclGen = struct { | |
| 173 | const DeclGen = struct { | |
| 60 | 174 | /// A general-purpose allocator that can be used for any allocations for this DeclGen. |
| 61 | 175 | gpa: Allocator, |
| 62 | 176 | |
| 177 | /// The object that this decl is generated into. | |
| 178 | object: *Object, | |
| 179 | ||
| 63 | 180 | /// The Zig module that we are generating decls for. |
| 64 | 181 | module: *Module, |
| 65 | 182 | |
| 66 | 183 | /// The SPIR-V module that instructions should be emitted into. |
| 184 | /// This is the same as `self.object.spv`, repeated here for brevity. | |
| 67 | 185 | spv: *SpvModule, |
| 68 | 186 | |
| 69 | 187 | /// The decl we are currently generating code for. |
| ... | ... | @@ -77,27 +195,19 @@ pub const DeclGen = struct { |
| 77 | 195 | /// Note: If the declaration is not a function, this value will be undefined! |
| 78 | 196 | liveness: Liveness, |
| 79 | 197 | |
| 80 | /// Maps Zig Decl indices to SPIR-V globals. | |
| 81 | decl_link: *DeclLinkMap, | |
| 82 | ||
| 83 | 198 | /// An array of function argument result-ids. Each index corresponds with the |
| 84 | 199 | /// function argument of the same index. |
| 85 | 200 | args: std.ArrayListUnmanaged(IdRef) = .{}, |
| 86 | 201 | |
| 87 | 202 | /// A counter to keep track of how many `arg` instructions we've seen yet. |
| 88 | next_arg_index: u32, | |
| 203 | next_arg_index: u32 = 0, | |
| 89 | 204 | |
| 90 | 205 | /// A map keeping track of which instruction generated which result-id. |
| 91 | 206 | inst_results: InstMap = .{}, |
| 92 | 207 | |
| 93 | /// A map that maps AIR intern pool indices to SPIR-V cache references (which | |
| 94 | /// is basically the same thing except for SPIR-V). | |
| 95 | /// This map is typically only used for structures that are deemed heavy enough | |
| 96 | /// that it is worth to store them here. The SPIR-V module also interns types, | |
| 97 | /// and so the main purpose of this map is to avoid recomputation and to | |
| 98 | /// cache extra information about the type rather than to aid in validity | |
| 99 | /// of the SPIR-V module. | |
| 100 | type_map: TypeMap = .{}, | |
| 208 | /// A map that maps AIR intern pool indices to SPIR-V cache references. | |
| 209 | /// See Object.type_map | |
| 210 | type_map: *TypeMap, | |
| 101 | 211 | |
| 102 | 212 | /// We need to keep track of result ids for block labels, as well as the 'incoming' |
| 103 | 213 | /// blocks for a block. |
| ... | ... | @@ -115,7 +225,7 @@ pub const DeclGen = struct { |
| 115 | 225 | |
| 116 | 226 | /// If `gen` returned `Error.CodegenFail`, this contains an explanatory message. |
| 117 | 227 | /// Memory is owned by `module.gpa`. |
| 118 | error_msg: ?*Module.ErrorMsg, | |
| 228 | error_msg: ?*Module.ErrorMsg = null, | |
| 119 | 229 | |
| 120 | 230 | /// Possible errors the `genDecl` function may return. |
| 121 | 231 | const Error = error{ CodegenFail, OutOfMemory }; |
| ... | ... | @@ -154,6 +264,12 @@ pub const DeclGen = struct { |
| 154 | 264 | /// This is the actual number of bits of the type, not the size of the backing integer. |
| 155 | 265 | bits: u16, |
| 156 | 266 | |
| 267 | /// The number of bits required to store the type. | |
| 268 | /// For `integer` and `float`, this is equal to `bits`. | |
| 269 | /// For `strange_integer` and `bool` this is the size of the backing integer. | |
| 270 | /// For `composite_integer` this is 0 (TODO) | |
| 271 | backing_bits: u16, | |
| 272 | ||
| 157 | 273 | /// Whether the type is a vector. |
| 158 | 274 | is_vector: bool, |
| 159 | 275 | |
| ... | ... | @@ -175,65 +291,10 @@ pub const DeclGen = struct { |
| 175 | 291 | indirect, |
| 176 | 292 | }; |
| 177 | 293 | |
| 178 | /// Initialize the common resources of a DeclGen. Some fields are left uninitialized, | |
| 179 | /// only set when `gen` is called. | |
| 180 | pub fn init( | |
| 181 | allocator: Allocator, | |
| 182 | module: *Module, | |
| 183 | spv: *SpvModule, | |
| 184 | decl_link: *DeclLinkMap, | |
| 185 | ) DeclGen { | |
| 186 | return .{ | |
| 187 | .gpa = allocator, | |
| 188 | .module = module, | |
| 189 | .spv = spv, | |
| 190 | .decl_index = undefined, | |
| 191 | .air = undefined, | |
| 192 | .liveness = undefined, | |
| 193 | .decl_link = decl_link, | |
| 194 | .next_arg_index = undefined, | |
| 195 | .current_block_label_id = undefined, | |
| 196 | .error_msg = undefined, | |
| 197 | }; | |
| 198 | } | |
| 199 | ||
| 200 | /// Generate the code for `decl`. If a reportable error occurred during code generation, | |
| 201 | /// a message is returned by this function. Callee owns the memory. If this function | |
| 202 | /// returns such a reportable error, it is valid to be called again for a different decl. | |
| 203 | pub fn gen(self: *DeclGen, decl_index: Decl.Index, air: Air, liveness: Liveness) !?*Module.ErrorMsg { | |
| 204 | // Reset internal resources, we don't want to re-allocate these. | |
| 205 | self.decl_index = decl_index; | |
| 206 | self.air = air; | |
| 207 | self.liveness = liveness; | |
| 208 | self.args.items.len = 0; | |
| 209 | self.next_arg_index = 0; | |
| 210 | self.inst_results.clearRetainingCapacity(); | |
| 211 | self.blocks.clearRetainingCapacity(); | |
| 212 | self.current_block_label_id = undefined; | |
| 213 | self.func.reset(); | |
| 214 | self.base_line_stack.items.len = 0; | |
| 215 | self.error_msg = null; | |
| 216 | ||
| 217 | self.genDecl() catch |err| switch (err) { | |
| 218 | error.CodegenFail => return self.error_msg, | |
| 219 | else => |others| { | |
| 220 | // There might be an error that happened *after* self.error_msg | |
| 221 | // was already allocated, so be sure to free it. | |
| 222 | if (self.error_msg) |error_msg| { | |
| 223 | error_msg.deinit(self.module.gpa); | |
| 224 | } | |
| 225 | return others; | |
| 226 | }, | |
| 227 | }; | |
| 228 | ||
| 229 | return null; | |
| 230 | } | |
| 231 | ||
| 232 | 294 | /// Free resources owned by the DeclGen. |
| 233 | 295 | pub fn deinit(self: *DeclGen) void { |
| 234 | 296 | self.args.deinit(self.gpa); |
| 235 | 297 | self.inst_results.deinit(self.gpa); |
| 236 | self.type_map.deinit(self.gpa); | |
| 237 | 298 | self.blocks.deinit(self.gpa); |
| 238 | 299 | self.func.deinit(self.gpa); |
| 239 | 300 | self.base_line_stack.deinit(self.gpa); |
| ... | ... | @@ -269,7 +330,7 @@ pub const DeclGen = struct { |
| 269 | 330 | .func => |func| func.owner_decl, |
| 270 | 331 | else => unreachable, |
| 271 | 332 | }; |
| 272 | const spv_decl_index = try self.resolveDecl(fn_decl_index); | |
| 333 | const spv_decl_index = try self.object.resolveDecl(mod, fn_decl_index); | |
| 273 | 334 | try self.func.decl_deps.put(self.spv.gpa, spv_decl_index, {}); |
| 274 | 335 | return self.spv.declPtr(spv_decl_index).result_id; |
| 275 | 336 | } |
| ... | ... | @@ -280,25 +341,87 @@ pub const DeclGen = struct { |
| 280 | 341 | return self.inst_results.get(index).?; // Assertion means instruction does not dominate usage. |
| 281 | 342 | } |
| 282 | 343 | |
| 283 | /// Fetch or allocate a result id for decl index. This function also marks the decl as alive. | |
| 284 | /// Note: Function does not actually generate the decl. | |
| 285 | fn resolveDecl(self: *DeclGen, decl_index: Module.Decl.Index) !SpvModule.Decl.Index { | |
| 344 | fn resolveAnonDecl(self: *DeclGen, val: InternPool.Index, storage_class: StorageClass) !IdRef { | |
| 345 | // TODO: This cannot be a function at this point, but it should probably be handled anyway. | |
| 346 | const spv_decl_index = blk: { | |
| 347 | const entry = try self.object.anon_decl_link.getOrPut(self.object.gpa, .{ val, storage_class }); | |
| 348 | if (entry.found_existing) { | |
| 349 | try self.func.decl_deps.put(self.spv.gpa, entry.value_ptr.*, {}); | |
| 350 | return self.spv.declPtr(entry.value_ptr.*).result_id; | |
| 351 | } | |
| 352 | ||
| 353 | const spv_decl_index = try self.spv.allocDecl(.global); | |
| 354 | try self.func.decl_deps.put(self.spv.gpa, spv_decl_index, {}); | |
| 355 | entry.value_ptr.* = spv_decl_index; | |
| 356 | break :blk spv_decl_index; | |
| 357 | }; | |
| 358 | ||
| 286 | 359 | const mod = self.module; |
| 287 | const decl = mod.declPtr(decl_index); | |
| 288 | try mod.markDeclAlive(decl); | |
| 360 | const ty = mod.intern_pool.typeOf(val).toType(); | |
| 361 | const ty_ref = try self.resolveType(ty, .indirect); | |
| 362 | const ptr_ty_ref = try self.spv.ptrType(ty_ref, storage_class); | |
| 289 | 363 | |
| 290 | const entry = try self.decl_link.getOrPut(decl_index); | |
| 291 | if (!entry.found_existing) { | |
| 292 | // TODO: Extern fn? | |
| 293 | const kind: SpvModule.DeclKind = if (decl.val.isFuncBody(mod)) | |
| 294 | .func | |
| 295 | else | |
| 296 | .global; | |
| 364 | const var_id = self.spv.declPtr(spv_decl_index).result_id; | |
| 297 | 365 | |
| 298 | entry.value_ptr.* = try self.spv.allocDecl(kind); | |
| 299 | } | |
| 366 | const section = &self.spv.sections.types_globals_constants; | |
| 367 | try section.emit(self.spv.gpa, .OpVariable, .{ | |
| 368 | .id_result_type = self.typeId(ptr_ty_ref), | |
| 369 | .id_result = var_id, | |
| 370 | .storage_class = storage_class, | |
| 371 | }); | |
| 300 | 372 | |
| 301 | return entry.value_ptr.*; | |
| 373 | // TODO: At some point we will be able to generate this all constant here, but then all of | |
| 374 | // constant() will need to be implemented such that it doesn't generate any at-runtime code. | |
| 375 | // NOTE: Because this is a global, we really only want to initialize it once. Therefore the | |
| 376 | // constant lowering of this value will need to be deferred to some other function, which | |
| 377 | // is then added to the list of initializers using endGlobal(). | |
| 378 | ||
| 379 | // Save the current state so that we can temporarily generate into a different function. | |
| 380 | // TODO: This should probably be made a little more robust. | |
| 381 | const func = self.func; | |
| 382 | defer self.func = func; | |
| 383 | const block_label_id = self.current_block_label_id; | |
| 384 | defer self.current_block_label_id = block_label_id; | |
| 385 | ||
| 386 | self.func = .{}; | |
| 387 | ||
| 388 | // TODO: Merge this with genDecl? | |
| 389 | const begin = self.spv.beginGlobal(); | |
| 390 | ||
| 391 | const void_ty_ref = try self.resolveType(Type.void, .direct); | |
| 392 | const initializer_proto_ty_ref = try self.spv.resolve(.{ .function_type = .{ | |
| 393 | .return_type = void_ty_ref, | |
| 394 | .parameters = &.{}, | |
| 395 | } }); | |
| 396 | ||
| 397 | const initializer_id = self.spv.allocId(); | |
| 398 | try self.func.prologue.emit(self.spv.gpa, .OpFunction, .{ | |
| 399 | .id_result_type = self.typeId(void_ty_ref), | |
| 400 | .id_result = initializer_id, | |
| 401 | .function_control = .{}, | |
| 402 | .function_type = self.typeId(initializer_proto_ty_ref), | |
| 403 | }); | |
| 404 | const root_block_id = self.spv.allocId(); | |
| 405 | try self.func.prologue.emit(self.spv.gpa, .OpLabel, .{ | |
| 406 | .id_result = root_block_id, | |
| 407 | }); | |
| 408 | self.current_block_label_id = root_block_id; | |
| 409 | ||
| 410 | const val_id = try self.constant(ty, val.toValue(), .indirect); | |
| 411 | try self.func.body.emit(self.spv.gpa, .OpStore, .{ | |
| 412 | .pointer = var_id, | |
| 413 | .object = val_id, | |
| 414 | }); | |
| 415 | ||
| 416 | self.spv.endGlobal(spv_decl_index, begin, var_id, initializer_id); | |
| 417 | try self.func.body.emit(self.spv.gpa, .OpReturn, {}); | |
| 418 | try self.func.body.emit(self.spv.gpa, .OpFunctionEnd, {}); | |
| 419 | try self.spv.addFunction(spv_decl_index, self.func); | |
| 420 | ||
| 421 | try self.spv.debugNameFmt(var_id, "__anon_{d}", .{@intFromEnum(val)}); | |
| 422 | try self.spv.debugNameFmt(initializer_id, "initializer of __anon_{d}", .{@intFromEnum(val)}); | |
| 423 | ||
| 424 | return var_id; | |
| 302 | 425 | } |
| 303 | 426 | |
| 304 | 427 | /// Start a new SPIR-V block, Emits the label of the new block, and stores which |
| ... | ... | @@ -376,12 +499,14 @@ pub const DeclGen = struct { |
| 376 | 499 | return switch (ty.zigTypeTag(mod)) { |
| 377 | 500 | .Bool => ArithmeticTypeInfo{ |
| 378 | 501 | .bits = 1, // Doesn't matter for this class. |
| 502 | .backing_bits = self.backingIntBits(1).?, | |
| 379 | 503 | .is_vector = false, |
| 380 | 504 | .signedness = .unsigned, // Technically, but doesn't matter for this class. |
| 381 | 505 | .class = .bool, |
| 382 | 506 | }, |
| 383 | 507 | .Float => ArithmeticTypeInfo{ |
| 384 | 508 | .bits = ty.floatBits(target), |
| 509 | .backing_bits = ty.floatBits(target), // TODO: F80? | |
| 385 | 510 | .is_vector = false, |
| 386 | 511 | .signedness = .signed, // Technically, but doesn't matter for this class. |
| 387 | 512 | .class = .float, |
| ... | ... | @@ -392,6 +517,7 @@ pub const DeclGen = struct { |
| 392 | 517 | const maybe_backing_bits = self.backingIntBits(int_info.bits); |
| 393 | 518 | break :blk ArithmeticTypeInfo{ |
| 394 | 519 | .bits = int_info.bits, |
| 520 | .backing_bits = maybe_backing_bits orelse 0, | |
| 395 | 521 | .is_vector = false, |
| 396 | 522 | .signedness = int_info.signedness, |
| 397 | 523 | .class = if (maybe_backing_bits) |backing_bits| |
| ... | ... | @@ -403,8 +529,19 @@ pub const DeclGen = struct { |
| 403 | 529 | .composite_integer, |
| 404 | 530 | }; |
| 405 | 531 | }, |
| 532 | .Enum => return self.arithmeticTypeInfo(ty.intTagType(mod)), | |
| 406 | 533 | // As of yet, there is no vector support in the self-hosted compiler. |
| 407 | .Vector => self.todo("implement arithmeticTypeInfo for Vector", .{}), | |
| 534 | .Vector => blk: { | |
| 535 | const child_type = ty.childType(mod); | |
| 536 | const child_ty_info = try self.arithmeticTypeInfo(child_type); | |
| 537 | break :blk ArithmeticTypeInfo{ | |
| 538 | .bits = child_ty_info.bits, | |
| 539 | .backing_bits = child_ty_info.backing_bits, | |
| 540 | .is_vector = true, | |
| 541 | .signedness = child_ty_info.signedness, | |
| 542 | .class = child_ty_info.class, | |
| 543 | }; | |
| 544 | }, | |
| 408 | 545 | // TODO: For which types is this the case? |
| 409 | 546 | // else => self.todo("implement arithmeticTypeInfo for {}", .{ty.fmt(self.module)}), |
| 410 | 547 | else => unreachable, |
| ... | ... | @@ -482,7 +619,7 @@ pub const DeclGen = struct { |
| 482 | 619 | return result_id; |
| 483 | 620 | } |
| 484 | 621 | |
| 485 | /// Construct a struct at runtime. | |
| 622 | /// Construct an array at runtime. | |
| 486 | 623 | /// result_ty_ref must be an array type. |
| 487 | 624 | /// Constituents should be in `indirect` representation (as the elements of an array should be). |
| 488 | 625 | /// Result is in `direct` representation. |
| ... | ... | @@ -521,59 +658,6 @@ pub const DeclGen = struct { |
| 521 | 658 | return result_id; |
| 522 | 659 | } |
| 523 | 660 | |
| 524 | fn constructDeclRef(self: *DeclGen, ty: Type, decl_index: Decl.Index) !IdRef { | |
| 525 | const mod = self.module; | |
| 526 | const ty_ref = try self.resolveType(ty, .direct); | |
| 527 | const ty_id = self.typeId(ty_ref); | |
| 528 | const decl = mod.declPtr(decl_index); | |
| 529 | const spv_decl_index = try self.resolveDecl(decl_index); | |
| 530 | switch (mod.intern_pool.indexToKey(decl.val.ip_index)) { | |
| 531 | .func => { | |
| 532 | // TODO: Properly lower function pointers. For now we are going to hack around it and | |
| 533 | // just generate an empty pointer. Function pointers are represented by a pointer to usize. | |
| 534 | // TODO: Add dependency | |
| 535 | return try self.spv.constNull(ty_ref); | |
| 536 | }, | |
| 537 | .extern_func => unreachable, // TODO | |
| 538 | else => { | |
| 539 | const decl_id = self.spv.declPtr(spv_decl_index).result_id; | |
| 540 | try self.func.decl_deps.put(self.spv.gpa, spv_decl_index, {}); | |
| 541 | ||
| 542 | const final_storage_class = spvStorageClass(decl.@"addrspace"); | |
| 543 | ||
| 544 | const decl_ty_ref = try self.resolveType(decl.ty, .indirect); | |
| 545 | const decl_ptr_ty_ref = try self.spv.ptrType(decl_ty_ref, final_storage_class); | |
| 546 | ||
| 547 | const ptr_id = switch (final_storage_class) { | |
| 548 | .Generic => blk: { | |
| 549 | // Pointer should be Generic, but is actually placed in CrossWorkgroup. | |
| 550 | const result_id = self.spv.allocId(); | |
| 551 | try self.func.body.emit(self.spv.gpa, .OpPtrCastToGeneric, .{ | |
| 552 | .id_result_type = self.typeId(decl_ptr_ty_ref), | |
| 553 | .id_result = result_id, | |
| 554 | .pointer = decl_id, | |
| 555 | }); | |
| 556 | break :blk result_id; | |
| 557 | }, | |
| 558 | else => decl_id, | |
| 559 | }; | |
| 560 | ||
| 561 | if (decl_ptr_ty_ref != ty_ref) { | |
| 562 | // Differing pointer types, insert a cast. | |
| 563 | const casted_ptr_id = self.spv.allocId(); | |
| 564 | try self.func.body.emit(self.spv.gpa, .OpBitcast, .{ | |
| 565 | .id_result_type = ty_id, | |
| 566 | .id_result = casted_ptr_id, | |
| 567 | .operand = ptr_id, | |
| 568 | }); | |
| 569 | return casted_ptr_id; | |
| 570 | } else { | |
| 571 | return ptr_id; | |
| 572 | } | |
| 573 | }, | |
| 574 | } | |
| 575 | } | |
| 576 | ||
| 577 | 661 | /// This function generates a load for a constant in direct (ie, non-memory) representation. |
| 578 | 662 | /// When the constant is simple, it can be generated directly using OpConstant instructions. |
| 579 | 663 | /// When the constant is more complicated however, it needs to be constructed using multiple values. This |
| ... | ... | @@ -738,7 +822,7 @@ pub const DeclGen = struct { |
| 738 | 822 | return try self.constructStruct(result_ty_ref, &.{ payload_id, has_pl_id }); |
| 739 | 823 | }, |
| 740 | 824 | .aggregate => |aggregate| switch (ip.indexToKey(ty.ip_index)) { |
| 741 | .array_type => |array_type| { | |
| 825 | inline .array_type, .vector_type => |array_type, tag| { | |
| 742 | 826 | const elem_ty = array_type.child.toType(); |
| 743 | 827 | const elem_ty_ref = try self.resolveType(elem_ty, .indirect); |
| 744 | 828 | |
| ... | ... | @@ -765,9 +849,14 @@ pub const DeclGen = struct { |
| 765 | 849 | } |
| 766 | 850 | }, |
| 767 | 851 | } |
| 768 | if (array_type.sentinel != .none) { | |
| 769 | constituents[constituents.len - 1] = try self.constant(elem_ty, array_type.sentinel.toValue(), .indirect); | |
| 852 | ||
| 853 | switch (tag) { | |
| 854 | inline .array_type => if (array_type.sentinel != .none) { | |
| 855 | constituents[constituents.len - 1] = try self.constant(elem_ty, array_type.sentinel.toValue(), .indirect); | |
| 856 | }, | |
| 857 | else => {}, | |
| 770 | 858 | } |
| 859 | ||
| 771 | 860 | return try self.constructArray(result_ty_ref, constituents); |
| 772 | 861 | }, |
| 773 | 862 | .struct_type => { |
| ... | ... | @@ -796,7 +885,7 @@ pub const DeclGen = struct { |
| 796 | 885 | |
| 797 | 886 | return try self.constructStruct(result_ty_ref, constituents.items); |
| 798 | 887 | }, |
| 799 | .vector_type, .anon_struct_type => unreachable, // TODO | |
| 888 | .anon_struct_type => unreachable, // TODO | |
| 800 | 889 | else => unreachable, |
| 801 | 890 | }, |
| 802 | 891 | .un => |un| { |
| ... | ... | @@ -817,9 +906,9 @@ pub const DeclGen = struct { |
| 817 | 906 | const result_ty_ref = try self.resolveType(ptr_ty, .direct); |
| 818 | 907 | const mod = self.module; |
| 819 | 908 | switch (mod.intern_pool.indexToKey(ptr_val.toIntern()).ptr.addr) { |
| 820 | .decl => |decl| return try self.constructDeclRef(ptr_ty, decl), | |
| 821 | .anon_decl => @panic("TODO"), | |
| 822 | .mut_decl => |decl_mut| return try self.constructDeclRef(ptr_ty, decl_mut.decl), | |
| 909 | .decl => |decl| return try self.constantDeclRef(ptr_ty, decl), | |
| 910 | .mut_decl => |decl_mut| return try self.constantDeclRef(ptr_ty, decl_mut.decl), | |
| 911 | .anon_decl => |anon_decl| return try self.constantAnonDeclRef(ptr_ty, anon_decl), | |
| 823 | 912 | .int => |int| { |
| 824 | 913 | const ptr_id = self.spv.allocId(); |
| 825 | 914 | // TODO: This can probably be an OpSpecConstantOp Bitcast, but |
| ... | ... | @@ -836,16 +925,156 @@ pub const DeclGen = struct { |
| 836 | 925 | .opt_payload => unreachable, // TODO |
| 837 | 926 | .comptime_field => unreachable, |
| 838 | 927 | .elem => |elem_ptr| { |
| 839 | const elem_ptr_ty = mod.intern_pool.typeOf(elem_ptr.base).toType(); | |
| 840 | const parent_ptr_id = try self.constantPtr(elem_ptr_ty, elem_ptr.base.toValue()); | |
| 928 | const parent_ptr_ty = mod.intern_pool.typeOf(elem_ptr.base).toType(); | |
| 929 | const parent_ptr_id = try self.constantPtr(parent_ptr_ty, elem_ptr.base.toValue()); | |
| 841 | 930 | const size_ty_ref = try self.sizeType(); |
| 842 | 931 | const index_id = try self.constInt(size_ty_ref, elem_ptr.index); |
| 843 | return self.ptrAccessChain(result_ty_ref, parent_ptr_id, index_id, &.{}); | |
| 932 | ||
| 933 | const elem_ptr_id = try self.ptrElemPtr(parent_ptr_ty, parent_ptr_id, index_id); | |
| 934 | ||
| 935 | // TODO: Can we consolidate this in ptrElemPtr? | |
| 936 | const elem_ty = parent_ptr_ty.elemType2(mod); // use elemType() so that we get T for *[N]T. | |
| 937 | const elem_ty_ref = try self.resolveType(elem_ty, .direct); | |
| 938 | const elem_ptr_ty_ref = try self.spv.ptrType(elem_ty_ref, spvStorageClass(parent_ptr_ty.ptrAddressSpace(mod))); | |
| 939 | ||
| 940 | if (elem_ptr_ty_ref == result_ty_ref) { | |
| 941 | return elem_ptr_id; | |
| 942 | } | |
| 943 | // This may happen when we have pointer-to-array and the result is | |
| 944 | // another pointer-to-array instead of a pointer-to-element. | |
| 945 | const result_id = self.spv.allocId(); | |
| 946 | try self.func.body.emit(self.spv.gpa, .OpBitcast, .{ | |
| 947 | .id_result_type = self.typeId(result_ty_ref), | |
| 948 | .id_result = result_id, | |
| 949 | .operand = elem_ptr_id, | |
| 950 | }); | |
| 951 | return result_id; | |
| 844 | 952 | }, |
| 845 | 953 | .field => unreachable, // TODO |
| 846 | 954 | } |
| 847 | 955 | } |
| 848 | 956 | |
| 957 | fn constantAnonDeclRef(self: *DeclGen, ty: Type, decl_val: InternPool.Index) !IdRef { | |
| 958 | // TODO: Merge this function with constantDeclRef. | |
| 959 | ||
| 960 | const mod = self.module; | |
| 961 | const ip = &mod.intern_pool; | |
| 962 | const ty_ref = try self.resolveType(ty, .direct); | |
| 963 | const decl_ty = ip.typeOf(decl_val).toType(); | |
| 964 | ||
| 965 | if (decl_val.toValue().getFunction(mod)) |func| { | |
| 966 | _ = func; | |
| 967 | unreachable; // TODO | |
| 968 | } else if (decl_val.toValue().getExternFunc(mod)) |func| { | |
| 969 | _ = func; | |
| 970 | unreachable; | |
| 971 | } | |
| 972 | ||
| 973 | // const is_fn_body = decl_ty.zigTypeTag(mod) == .Fn; | |
| 974 | if (!decl_ty.isFnOrHasRuntimeBitsIgnoreComptime(mod)) { | |
| 975 | // Pointer to nothing - return undefoined | |
| 976 | return self.spv.constUndef(ty_ref); | |
| 977 | } | |
| 978 | ||
| 979 | if (decl_ty.zigTypeTag(mod) == .Fn) { | |
| 980 | unreachable; // TODO | |
| 981 | } | |
| 982 | ||
| 983 | const final_storage_class = spvStorageClass(ty.ptrAddressSpace(mod)); | |
| 984 | const actual_storage_class = switch (final_storage_class) { | |
| 985 | .Generic => .CrossWorkgroup, | |
| 986 | else => |other| other, | |
| 987 | }; | |
| 988 | ||
| 989 | const decl_id = try self.resolveAnonDecl(decl_val, actual_storage_class); | |
| 990 | const decl_ty_ref = try self.resolveType(decl_ty, .indirect); | |
| 991 | const decl_ptr_ty_ref = try self.spv.ptrType(decl_ty_ref, final_storage_class); | |
| 992 | ||
| 993 | const ptr_id = switch (final_storage_class) { | |
| 994 | .Generic => blk: { | |
| 995 | const result_id = self.spv.allocId(); | |
| 996 | try self.func.body.emit(self.spv.gpa, .OpPtrCastToGeneric, .{ | |
| 997 | .id_result_type = self.typeId(decl_ptr_ty_ref), | |
| 998 | .id_result = result_id, | |
| 999 | .pointer = decl_id, | |
| 1000 | }); | |
| 1001 | break :blk result_id; | |
| 1002 | }, | |
| 1003 | else => decl_id, | |
| 1004 | }; | |
| 1005 | ||
| 1006 | if (decl_ptr_ty_ref != ty_ref) { | |
| 1007 | // Differing pointer types, insert a cast. | |
| 1008 | const casted_ptr_id = self.spv.allocId(); | |
| 1009 | try self.func.body.emit(self.spv.gpa, .OpBitcast, .{ | |
| 1010 | .id_result_type = self.typeId(ty_ref), | |
| 1011 | .id_result = casted_ptr_id, | |
| 1012 | .operand = ptr_id, | |
| 1013 | }); | |
| 1014 | return casted_ptr_id; | |
| 1015 | } else { | |
| 1016 | return ptr_id; | |
| 1017 | } | |
| 1018 | } | |
| 1019 | ||
| 1020 | fn constantDeclRef(self: *DeclGen, ty: Type, decl_index: Decl.Index) !IdRef { | |
| 1021 | const mod = self.module; | |
| 1022 | const ty_ref = try self.resolveType(ty, .direct); | |
| 1023 | const ty_id = self.typeId(ty_ref); | |
| 1024 | const decl = mod.declPtr(decl_index); | |
| 1025 | switch (mod.intern_pool.indexToKey(decl.val.ip_index)) { | |
| 1026 | .func => { | |
| 1027 | // TODO: Properly lower function pointers. For now we are going to hack around it and | |
| 1028 | // just generate an empty pointer. Function pointers are represented by a pointer to usize. | |
| 1029 | return try self.spv.constUndef(ty_ref); | |
| 1030 | }, | |
| 1031 | .extern_func => unreachable, // TODO | |
| 1032 | else => {}, | |
| 1033 | } | |
| 1034 | ||
| 1035 | if (!decl.ty.isFnOrHasRuntimeBitsIgnoreComptime(mod)) { | |
| 1036 | // Pointer to nothing - return undefined. | |
| 1037 | return self.spv.constUndef(ty_ref); | |
| 1038 | } | |
| 1039 | ||
| 1040 | const spv_decl_index = try self.object.resolveDecl(mod, decl_index); | |
| 1041 | ||
| 1042 | const decl_id = self.spv.declPtr(spv_decl_index).result_id; | |
| 1043 | try self.func.decl_deps.put(self.spv.gpa, spv_decl_index, {}); | |
| 1044 | ||
| 1045 | const final_storage_class = spvStorageClass(decl.@"addrspace"); | |
| 1046 | ||
| 1047 | const decl_ty_ref = try self.resolveType(decl.ty, .indirect); | |
| 1048 | const decl_ptr_ty_ref = try self.spv.ptrType(decl_ty_ref, final_storage_class); | |
| 1049 | ||
| 1050 | const ptr_id = switch (final_storage_class) { | |
| 1051 | .Generic => blk: { | |
| 1052 | // Pointer should be Generic, but is actually placed in CrossWorkgroup. | |
| 1053 | const result_id = self.spv.allocId(); | |
| 1054 | try self.func.body.emit(self.spv.gpa, .OpPtrCastToGeneric, .{ | |
| 1055 | .id_result_type = self.typeId(decl_ptr_ty_ref), | |
| 1056 | .id_result = result_id, | |
| 1057 | .pointer = decl_id, | |
| 1058 | }); | |
| 1059 | break :blk result_id; | |
| 1060 | }, | |
| 1061 | else => decl_id, | |
| 1062 | }; | |
| 1063 | ||
| 1064 | if (decl_ptr_ty_ref != ty_ref) { | |
| 1065 | // Differing pointer types, insert a cast. | |
| 1066 | const casted_ptr_id = self.spv.allocId(); | |
| 1067 | try self.func.body.emit(self.spv.gpa, .OpBitcast, .{ | |
| 1068 | .id_result_type = ty_id, | |
| 1069 | .id_result = casted_ptr_id, | |
| 1070 | .operand = ptr_id, | |
| 1071 | }); | |
| 1072 | return casted_ptr_id; | |
| 1073 | } else { | |
| 1074 | return ptr_id; | |
| 1075 | } | |
| 1076 | } | |
| 1077 | ||
| 849 | 1078 | // Turn a Zig type's name into a cache reference. |
| 850 | 1079 | fn resolveTypeName(self: *DeclGen, ty: Type) !CacheString { |
| 851 | 1080 | var name = std.ArrayList(u8).init(self.gpa); |
| ... | ... | @@ -968,6 +1197,22 @@ pub const DeclGen = struct { |
| 968 | 1197 | return ty_ref; |
| 969 | 1198 | } |
| 970 | 1199 | |
| 1200 | fn resolveFnReturnType(self: *DeclGen, ret_ty: Type) !CacheRef { | |
| 1201 | const mod = self.module; | |
| 1202 | if (!ret_ty.hasRuntimeBitsIgnoreComptime(mod)) { | |
| 1203 | // If the return type is an error set or an error union, then we make this | |
| 1204 | // anyerror return type instead, so that it can be coerced into a function | |
| 1205 | // pointer type which has anyerror as the return type. | |
| 1206 | if (ret_ty.isError(mod)) { | |
| 1207 | return self.resolveType(Type.anyerror, .direct); | |
| 1208 | } else { | |
| 1209 | return self.resolveType(Type.void, .direct); | |
| 1210 | } | |
| 1211 | } | |
| 1212 | ||
| 1213 | return try self.resolveType(ret_ty, .direct); | |
| 1214 | } | |
| 1215 | ||
| 971 | 1216 | /// Turn a Zig type into a SPIR-V Type, and return a reference to it. |
| 972 | 1217 | fn resolveType(self: *DeclGen, ty: Type, repr: Repr) Error!CacheRef { |
| 973 | 1218 | const mod = self.module; |
| ... | ... | @@ -975,14 +1220,31 @@ pub const DeclGen = struct { |
| 975 | 1220 | log.debug("resolveType: ty = {}", .{ty.fmt(mod)}); |
| 976 | 1221 | const target = self.getTarget(); |
| 977 | 1222 | switch (ty.zigTypeTag(mod)) { |
| 978 | .Void, .NoReturn => return try self.spv.resolve(.void_type), | |
| 1223 | .NoReturn => { | |
| 1224 | assert(repr == .direct); | |
| 1225 | return try self.spv.resolve(.void_type); | |
| 1226 | }, | |
| 1227 | .Void => switch (repr) { | |
| 1228 | .direct => return try self.spv.resolve(.void_type), | |
| 1229 | // Pointers to void | |
| 1230 | .indirect => return try self.spv.resolve(.{ .opaque_type = .{ | |
| 1231 | .name = try self.spv.resolveString("void"), | |
| 1232 | } }), | |
| 1233 | }, | |
| 979 | 1234 | .Bool => switch (repr) { |
| 980 | 1235 | .direct => return try self.spv.resolve(.bool_type), |
| 981 | 1236 | .indirect => return try self.intType(.unsigned, 1), |
| 982 | 1237 | }, |
| 983 | 1238 | .Int => { |
| 984 | 1239 | const int_info = ty.intInfo(mod); |
| 985 | // TODO: Integers in OpenCL kernels are always unsigned. | |
| 1240 | if (int_info.bits == 0) { | |
| 1241 | // Some times, the backend will be asked to generate a pointer to i0. OpTypeInt | |
| 1242 | // with 0 bits is invalid, so return an opaque type in this case. | |
| 1243 | assert(repr == .indirect); | |
| 1244 | return try self.spv.resolve(.{ .opaque_type = .{ | |
| 1245 | .name = try self.spv.resolveString("u0"), | |
| 1246 | } }); | |
| 1247 | } | |
| 986 | 1248 | return try self.intType(int_info.signedness, int_info.bits); |
| 987 | 1249 | }, |
| 988 | 1250 | .Enum => { |
| ... | ... | @@ -1012,10 +1274,32 @@ pub const DeclGen = struct { |
| 1012 | 1274 | |
| 1013 | 1275 | const elem_ty = ty.childType(mod); |
| 1014 | 1276 | const elem_ty_ref = try self.resolveType(elem_ty, .indirect); |
| 1015 | const total_len = std.math.cast(u32, ty.arrayLenIncludingSentinel(mod)) orelse { | |
| 1277 | var total_len = std.math.cast(u32, ty.arrayLenIncludingSentinel(mod)) orelse { | |
| 1016 | 1278 | return self.fail("array type of {} elements is too large", .{ty.arrayLenIncludingSentinel(mod)}); |
| 1017 | 1279 | }; |
| 1018 | const ty_ref = try self.spv.arrayType(total_len, elem_ty_ref); | |
| 1280 | const ty_ref = if (!elem_ty.hasRuntimeBitsIgnoreComptime(mod)) blk: { | |
| 1281 | // The size of the array would be 0, but that is not allowed in SPIR-V. | |
| 1282 | // This path can be reached when the backend is asked to generate a pointer to | |
| 1283 | // an array of some zero-bit type. This should always be an indirect path. | |
| 1284 | assert(repr == .indirect); | |
| 1285 | ||
| 1286 | // We cannot use the child type here, so just use an opaque type. | |
| 1287 | break :blk try self.spv.resolve(.{ .opaque_type = .{ | |
| 1288 | .name = try self.spv.resolveString("zero-sized array"), | |
| 1289 | } }); | |
| 1290 | } else if (total_len == 0) blk: { | |
| 1291 | // The size of the array would be 0, but that is not allowed in SPIR-V. | |
| 1292 | // This path can be reached for example when there is a slicing of a pointer | |
| 1293 | // that produces a zero-length array. In all cases where this type can be generated, | |
| 1294 | // this should be an indirect path. | |
| 1295 | assert(repr == .indirect); | |
| 1296 | ||
| 1297 | // In this case, we have an array of a non-zero sized type. In this case, | |
| 1298 | // generate an array of 1 element instead, so that ptr_elem_ptr instructions | |
| 1299 | // can be lowered to ptrAccessChain instead of manually performing the math. | |
| 1300 | break :blk try self.spv.arrayType(1, elem_ty_ref); | |
| 1301 | } else try self.spv.arrayType(total_len, elem_ty_ref); | |
| 1302 | ||
| 1019 | 1303 | try self.type_map.put(self.gpa, ty.toIntern(), .{ .ty_ref = ty_ref }); |
| 1020 | 1304 | return ty_ref; |
| 1021 | 1305 | }, |
| ... | ... | @@ -1030,14 +1314,19 @@ pub const DeclGen = struct { |
| 1030 | 1314 | |
| 1031 | 1315 | const param_ty_refs = try self.gpa.alloc(CacheRef, fn_info.param_types.len); |
| 1032 | 1316 | defer self.gpa.free(param_ty_refs); |
| 1033 | for (param_ty_refs, fn_info.param_types.get(ip)) |*param_type, fn_param_type| { | |
| 1034 | param_type.* = try self.resolveType(fn_param_type.toType(), .direct); | |
| 1317 | var param_index: usize = 0; | |
| 1318 | for (fn_info.param_types.get(ip)) |param_ty_index| { | |
| 1319 | const param_ty = param_ty_index.toType(); | |
| 1320 | if (!param_ty.hasRuntimeBitsIgnoreComptime(mod)) continue; | |
| 1321 | ||
| 1322 | param_ty_refs[param_index] = try self.resolveType(param_ty, .direct); | |
| 1323 | param_index += 1; | |
| 1035 | 1324 | } |
| 1036 | const return_ty_ref = try self.resolveType(fn_info.return_type.toType(), .direct); | |
| 1325 | const return_ty_ref = try self.resolveFnReturnType(fn_info.return_type.toType()); | |
| 1037 | 1326 | |
| 1038 | 1327 | const ty_ref = try self.spv.resolve(.{ .function_type = .{ |
| 1039 | 1328 | .return_type = return_ty_ref, |
| 1040 | .parameters = param_ty_refs, | |
| 1329 | .parameters = param_ty_refs[0..param_index], | |
| 1041 | 1330 | } }); |
| 1042 | 1331 | |
| 1043 | 1332 | try self.type_map.put(self.gpa, ty.toIntern(), .{ .ty_ref = ty_ref }); |
| ... | ... | @@ -1072,19 +1361,14 @@ pub const DeclGen = struct { |
| 1072 | 1361 | } }); |
| 1073 | 1362 | }, |
| 1074 | 1363 | .Vector => { |
| 1075 | // Although not 100% the same, Zig vectors map quite neatly to SPIR-V vectors (including many integer and float operations | |
| 1076 | // which work on them), so simply use those. | |
| 1077 | // Note: SPIR-V vectors only support bools, ints and floats, so pointer vectors need to be supported another way. | |
| 1078 | // "composite integers" (larger than the largest supported native type) can probably be represented by an array of vectors. | |
| 1079 | // TODO: The SPIR-V spec mentions that vector sizes may be quite restricted! look into which we can use, and whether OpTypeVector | |
| 1080 | // is adequate at all for this. | |
| 1081 | ||
| 1082 | // TODO: Properly verify sizes and child type. | |
| 1083 | ||
| 1084 | return try self.spv.resolve(.{ .vector_type = .{ | |
| 1085 | .component_type = try self.resolveType(ty.childType(mod), repr), | |
| 1086 | .component_count = @as(u32, @intCast(ty.vectorLen(mod))), | |
| 1087 | } }); | |
| 1364 | if (self.type_map.get(ty.toIntern())) |info| return info.ty_ref; | |
| 1365 | ||
| 1366 | const elem_ty = ty.childType(mod); | |
| 1367 | const elem_ty_ref = try self.resolveType(elem_ty, .indirect); | |
| 1368 | ||
| 1369 | const ty_ref = try self.spv.arrayType(ty.vectorLen(mod), elem_ty_ref); | |
| 1370 | try self.type_map.put(self.gpa, ty.toIntern(), .{ .ty_ref = ty_ref }); | |
| 1371 | return ty_ref; | |
| 1088 | 1372 | }, |
| 1089 | 1373 | .Struct => { |
| 1090 | 1374 | if (self.type_map.get(ty.toIntern())) |info| return info.ty_ref; |
| ... | ... | @@ -1126,10 +1410,16 @@ pub const DeclGen = struct { |
| 1126 | 1410 | |
| 1127 | 1411 | var it = struct_type.iterateRuntimeOrder(ip); |
| 1128 | 1412 | while (it.next()) |field_index| { |
| 1129 | const field_ty = struct_type.field_types.get(ip)[field_index]; | |
| 1130 | const field_name = ip.stringToSlice(struct_type.field_names.get(ip)[field_index]); | |
| 1131 | try member_types.append(try self.resolveType(field_ty.toType(), .indirect)); | |
| 1132 | try member_names.append(try self.spv.resolveString(field_name)); | |
| 1413 | const field_ty = struct_type.field_types.get(ip)[field_index].toType(); | |
| 1414 | if (!field_ty.hasRuntimeBitsIgnoreComptime(mod)) { | |
| 1415 | // This is a zero-bit field - we only needed it for the alignment. | |
| 1416 | continue; | |
| 1417 | } | |
| 1418 | ||
| 1419 | const field_name = struct_type.fieldName(ip, field_index).unwrap() orelse | |
| 1420 | try ip.getOrPutStringFmt(mod.gpa, "{d}", .{field_index}); | |
| 1421 | try member_types.append(try self.resolveType(field_ty, .indirect)); | |
| 1422 | try member_names.append(try self.spv.resolveString(ip.stringToSlice(field_name))); | |
| 1133 | 1423 | } |
| 1134 | 1424 | |
| 1135 | 1425 | const ty_ref = try self.spv.resolve(.{ .struct_type = .{ |
| ... | ... | @@ -1215,6 +1505,13 @@ pub const DeclGen = struct { |
| 1215 | 1505 | try self.type_map.put(self.gpa, ty.toIntern(), .{ .ty_ref = ty_ref }); |
| 1216 | 1506 | return ty_ref; |
| 1217 | 1507 | }, |
| 1508 | .Opaque => { | |
| 1509 | return try self.spv.resolve(.{ | |
| 1510 | .opaque_type = .{ | |
| 1511 | .name = .none, // TODO | |
| 1512 | }, | |
| 1513 | }); | |
| 1514 | }, | |
| 1218 | 1515 | |
| 1219 | 1516 | .Null, |
| 1220 | 1517 | .Undefined, |
| ... | ... | @@ -1431,7 +1728,7 @@ pub const DeclGen = struct { |
| 1431 | 1728 | const mod = self.module; |
| 1432 | 1729 | const ip = &mod.intern_pool; |
| 1433 | 1730 | const decl = mod.declPtr(self.decl_index); |
| 1434 | const spv_decl_index = try self.resolveDecl(self.decl_index); | |
| 1731 | const spv_decl_index = try self.object.resolveDecl(mod, self.decl_index); | |
| 1435 | 1732 | |
| 1436 | 1733 | const decl_id = self.spv.declPtr(spv_decl_index).result_id; |
| 1437 | 1734 | |
| ... | ... | @@ -1439,20 +1736,23 @@ pub const DeclGen = struct { |
| 1439 | 1736 | |
| 1440 | 1737 | if (decl.val.getFunction(mod)) |_| { |
| 1441 | 1738 | assert(decl.ty.zigTypeTag(mod) == .Fn); |
| 1739 | const fn_info = mod.typeToFunc(decl.ty).?; | |
| 1740 | const return_ty_ref = try self.resolveFnReturnType(fn_info.return_type.toType()); | |
| 1741 | ||
| 1442 | 1742 | const prototype_id = try self.resolveTypeId(decl.ty); |
| 1443 | 1743 | try self.func.prologue.emit(self.spv.gpa, .OpFunction, .{ |
| 1444 | .id_result_type = try self.resolveTypeId(decl.ty.fnReturnType(mod)), | |
| 1744 | .id_result_type = self.typeId(return_ty_ref), | |
| 1445 | 1745 | .id_result = decl_id, |
| 1446 | 1746 | .function_control = .{}, // TODO: We can set inline here if the type requires it. |
| 1447 | 1747 | .function_type = prototype_id, |
| 1448 | 1748 | }); |
| 1449 | 1749 | |
| 1450 | const fn_info = mod.typeToFunc(decl.ty).?; | |
| 1451 | ||
| 1452 | 1750 | try self.args.ensureUnusedCapacity(self.gpa, fn_info.param_types.len); |
| 1453 | for (0..fn_info.param_types.len) |i| { | |
| 1454 | const param_type = fn_info.param_types.get(ip)[i]; | |
| 1455 | const param_type_id = try self.resolveTypeId(param_type.toType()); | |
| 1751 | for (fn_info.param_types.get(ip)) |param_ty_index| { | |
| 1752 | const param_ty = param_ty_index.toType(); | |
| 1753 | if (!param_ty.hasRuntimeBitsIgnoreComptime(mod)) continue; | |
| 1754 | ||
| 1755 | const param_type_id = try self.resolveTypeId(param_ty); | |
| 1456 | 1756 | const arg_result_id = self.spv.allocId(); |
| 1457 | 1757 | try self.func.prologue.emit(self.spv.gpa, .OpFunctionParameter, .{ |
| 1458 | 1758 | .id_result_type = param_type_id, |
| ... | ... | @@ -1693,11 +1993,15 @@ pub const DeclGen = struct { |
| 1693 | 1993 | |
| 1694 | 1994 | .shl => try self.airShift(inst, .OpShiftLeftLogical), |
| 1695 | 1995 | |
| 1996 | .min => try self.airMinMax(inst, .lt), | |
| 1997 | .max => try self.airMinMax(inst, .gt), | |
| 1998 | ||
| 1696 | 1999 | .bitcast => try self.airBitCast(inst), |
| 1697 | 2000 | .intcast, .trunc => try self.airIntCast(inst), |
| 1698 | 2001 | .int_from_ptr => try self.airIntFromPtr(inst), |
| 1699 | 2002 | .float_from_int => try self.airFloatFromInt(inst), |
| 1700 | 2003 | .int_from_float => try self.airIntFromFloat(inst), |
| 2004 | .fpext, .fptrunc => try self.airFloatCast(inst), | |
| 1701 | 2005 | .not => try self.airNot(inst), |
| 1702 | 2006 | |
| 1703 | 2007 | .array_to_slice => try self.airArrayToSlice(inst), |
| ... | ... | @@ -1723,12 +2027,13 @@ pub const DeclGen = struct { |
| 1723 | 2027 | .struct_field_ptr_index_2 => try self.airStructFieldPtrIndex(inst, 2), |
| 1724 | 2028 | .struct_field_ptr_index_3 => try self.airStructFieldPtrIndex(inst, 3), |
| 1725 | 2029 | |
| 1726 | .cmp_eq => try self.airCmp(inst, .eq), | |
| 1727 | .cmp_neq => try self.airCmp(inst, .neq), | |
| 1728 | .cmp_gt => try self.airCmp(inst, .gt), | |
| 1729 | .cmp_gte => try self.airCmp(inst, .gte), | |
| 1730 | .cmp_lt => try self.airCmp(inst, .lt), | |
| 1731 | .cmp_lte => try self.airCmp(inst, .lte), | |
| 2030 | .cmp_eq => try self.airCmp(inst, .eq), | |
| 2031 | .cmp_neq => try self.airCmp(inst, .neq), | |
| 2032 | .cmp_gt => try self.airCmp(inst, .gt), | |
| 2033 | .cmp_gte => try self.airCmp(inst, .gte), | |
| 2034 | .cmp_lt => try self.airCmp(inst, .lt), | |
| 2035 | .cmp_lte => try self.airCmp(inst, .lte), | |
| 2036 | .cmp_vector => try self.airVectorCmp(inst), | |
| 1732 | 2037 | |
| 1733 | 2038 | .arg => self.airArg(), |
| 1734 | 2039 | .alloc => try self.airAlloc(inst), |
| ... | ... | @@ -1784,13 +2089,30 @@ pub const DeclGen = struct { |
| 1784 | 2089 | try self.inst_results.putNoClobber(self.gpa, inst, result_id); |
| 1785 | 2090 | } |
| 1786 | 2091 | |
| 1787 | fn airBinOpSimple(self: *DeclGen, inst: Air.Inst.Index, comptime opcode: Opcode) !?IdRef { | |
| 1788 | if (self.liveness.isUnused(inst)) return null; | |
| 1789 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; | |
| 1790 | const lhs_id = try self.resolve(bin_op.lhs); | |
| 1791 | const rhs_id = try self.resolve(bin_op.rhs); | |
| 2092 | fn binOpSimple(self: *DeclGen, ty: Type, lhs_id: IdRef, rhs_id: IdRef, comptime opcode: Opcode) !IdRef { | |
| 2093 | const mod = self.module; | |
| 2094 | ||
| 2095 | if (ty.isVector(mod)) { | |
| 2096 | const child_ty = ty.childType(mod); | |
| 2097 | const vector_len = ty.vectorLen(mod); | |
| 2098 | ||
| 2099 | var constituents = try self.gpa.alloc(IdRef, vector_len); | |
| 2100 | defer self.gpa.free(constituents); | |
| 2101 | ||
| 2102 | for (constituents, 0..) |*constituent, i| { | |
| 2103 | const lhs_index_id = try self.extractField(child_ty, lhs_id, @intCast(i)); | |
| 2104 | const rhs_index_id = try self.extractField(child_ty, rhs_id, @intCast(i)); | |
| 2105 | const result_id = try self.binOpSimple(child_ty, lhs_index_id, rhs_index_id, opcode); | |
| 2106 | constituent.* = try self.convertToIndirect(child_ty, result_id); | |
| 2107 | } | |
| 2108 | ||
| 2109 | const result_ty = try self.resolveType(child_ty, .indirect); | |
| 2110 | const result_ty_ref = try self.spv.arrayType(vector_len, result_ty); | |
| 2111 | return try self.constructArray(result_ty_ref, constituents); | |
| 2112 | } | |
| 2113 | ||
| 1792 | 2114 | const result_id = self.spv.allocId(); |
| 1793 | const result_type_id = try self.resolveTypeId(self.typeOfIndex(inst)); | |
| 2115 | const result_type_id = try self.resolveTypeId(ty); | |
| 1794 | 2116 | try self.func.body.emit(self.spv.gpa, opcode, .{ |
| 1795 | 2117 | .id_result_type = result_type_id, |
| 1796 | 2118 | .id_result = result_id, |
| ... | ... | @@ -1800,6 +2122,17 @@ pub const DeclGen = struct { |
| 1800 | 2122 | return result_id; |
| 1801 | 2123 | } |
| 1802 | 2124 | |
| 2125 | fn airBinOpSimple(self: *DeclGen, inst: Air.Inst.Index, comptime opcode: Opcode) !?IdRef { | |
| 2126 | if (self.liveness.isUnused(inst)) return null; | |
| 2127 | ||
| 2128 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; | |
| 2129 | const lhs_id = try self.resolve(bin_op.lhs); | |
| 2130 | const rhs_id = try self.resolve(bin_op.rhs); | |
| 2131 | const ty = self.typeOf(bin_op.lhs); | |
| 2132 | ||
| 2133 | return try self.binOpSimple(ty, lhs_id, rhs_id, opcode); | |
| 2134 | } | |
| 2135 | ||
| 1803 | 2136 | fn airShift(self: *DeclGen, inst: Air.Inst.Index, comptime opcode: Opcode) !?IdRef { |
| 1804 | 2137 | if (self.liveness.isUnused(inst)) return null; |
| 1805 | 2138 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; |
| ... | ... | @@ -1825,19 +2158,99 @@ pub const DeclGen = struct { |
| 1825 | 2158 | return result_id; |
| 1826 | 2159 | } |
| 1827 | 2160 | |
| 1828 | fn maskStrangeInt(self: *DeclGen, ty_ref: CacheRef, value_id: IdRef, bits: u16) !IdRef { | |
| 1829 | const mask_value = if (bits == 64) 0xFFFF_FFFF_FFFF_FFFF else (@as(u64, 1) << @as(u6, @intCast(bits))) - 1; | |
| 2161 | fn airMinMax(self: *DeclGen, inst: Air.Inst.Index, op: std.math.CompareOperator) !?IdRef { | |
| 2162 | if (self.liveness.isUnused(inst)) return null; | |
| 2163 | ||
| 2164 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; | |
| 2165 | const lhs_id = try self.resolve(bin_op.lhs); | |
| 2166 | const rhs_id = try self.resolve(bin_op.rhs); | |
| 2167 | const result_ty = self.typeOfIndex(inst); | |
| 2168 | const result_ty_ref = try self.resolveType(result_ty, .direct); | |
| 2169 | ||
| 2170 | const info = try self.arithmeticTypeInfo(result_ty); | |
| 2171 | // TODO: Use fmin for OpenCL | |
| 2172 | const cmp_id = try self.cmp(op, result_ty, lhs_id, rhs_id); | |
| 2173 | const selection_id = switch (info.class) { | |
| 2174 | .float => blk: { | |
| 2175 | // cmp uses OpFOrd. When we have 0 [<>] nan this returns false, | |
| 2176 | // but we want it to pick lhs. Therefore we also have to check if | |
| 2177 | // rhs is nan. We don't need to care about the result when both | |
| 2178 | // are nan. | |
| 2179 | const rhs_is_nan_id = self.spv.allocId(); | |
| 2180 | const bool_ty_ref = try self.resolveType(Type.bool, .direct); | |
| 2181 | try self.func.body.emit(self.spv.gpa, .OpIsNan, .{ | |
| 2182 | .id_result_type = self.typeId(bool_ty_ref), | |
| 2183 | .id_result = rhs_is_nan_id, | |
| 2184 | .x = rhs_id, | |
| 2185 | }); | |
| 2186 | const float_cmp_id = self.spv.allocId(); | |
| 2187 | try self.func.body.emit(self.spv.gpa, .OpLogicalOr, .{ | |
| 2188 | .id_result_type = self.typeId(bool_ty_ref), | |
| 2189 | .id_result = float_cmp_id, | |
| 2190 | .operand_1 = cmp_id, | |
| 2191 | .operand_2 = rhs_is_nan_id, | |
| 2192 | }); | |
| 2193 | break :blk float_cmp_id; | |
| 2194 | }, | |
| 2195 | else => cmp_id, | |
| 2196 | }; | |
| 2197 | ||
| 1830 | 2198 | const result_id = self.spv.allocId(); |
| 1831 | const mask_id = try self.constInt(ty_ref, mask_value); | |
| 1832 | try self.func.body.emit(self.spv.gpa, .OpBitwiseAnd, .{ | |
| 1833 | .id_result_type = self.typeId(ty_ref), | |
| 2199 | try self.func.body.emit(self.spv.gpa, .OpSelect, .{ | |
| 2200 | .id_result_type = self.typeId(result_ty_ref), | |
| 1834 | 2201 | .id_result = result_id, |
| 1835 | .operand_1 = value_id, | |
| 1836 | .operand_2 = mask_id, | |
| 2202 | .condition = selection_id, | |
| 2203 | .object_1 = lhs_id, | |
| 2204 | .object_2 = rhs_id, | |
| 1837 | 2205 | }); |
| 1838 | 2206 | return result_id; |
| 1839 | 2207 | } |
| 1840 | 2208 | |
| 2209 | /// This function canonicalizes a "strange" integer value: | |
| 2210 | /// For unsigned integers, the value is masked so that only the relevant bits can contain | |
| 2211 | /// non-zeros. | |
| 2212 | /// For signed integers, the value is also sign extended. | |
| 2213 | fn normalizeInt(self: *DeclGen, ty_ref: CacheRef, value_id: IdRef, info: ArithmeticTypeInfo) !IdRef { | |
| 2214 | assert(info.class != .composite_integer); // TODO | |
| 2215 | if (info.bits == info.backing_bits) { | |
| 2216 | return value_id; | |
| 2217 | } | |
| 2218 | ||
| 2219 | switch (info.signedness) { | |
| 2220 | .unsigned => { | |
| 2221 | const mask_value = if (info.bits == 64) 0xFFFF_FFFF_FFFF_FFFF else (@as(u64, 1) << @as(u6, @intCast(info.bits))) - 1; | |
| 2222 | const result_id = self.spv.allocId(); | |
| 2223 | const mask_id = try self.constInt(ty_ref, mask_value); | |
| 2224 | try self.func.body.emit(self.spv.gpa, .OpBitwiseAnd, .{ | |
| 2225 | .id_result_type = self.typeId(ty_ref), | |
| 2226 | .id_result = result_id, | |
| 2227 | .operand_1 = value_id, | |
| 2228 | .operand_2 = mask_id, | |
| 2229 | }); | |
| 2230 | return result_id; | |
| 2231 | }, | |
| 2232 | .signed => { | |
| 2233 | // Shift left and right so that we can copy the sight bit that way. | |
| 2234 | const shift_amt_id = try self.constInt(ty_ref, info.backing_bits - info.bits); | |
| 2235 | const left_id = self.spv.allocId(); | |
| 2236 | try self.func.body.emit(self.spv.gpa, .OpShiftLeftLogical, .{ | |
| 2237 | .id_result_type = self.typeId(ty_ref), | |
| 2238 | .id_result = left_id, | |
| 2239 | .base = value_id, | |
| 2240 | .shift = shift_amt_id, | |
| 2241 | }); | |
| 2242 | const right_id = self.spv.allocId(); | |
| 2243 | try self.func.body.emit(self.spv.gpa, .OpShiftRightArithmetic, .{ | |
| 2244 | .id_result_type = self.typeId(ty_ref), | |
| 2245 | .id_result = right_id, | |
| 2246 | .base = left_id, | |
| 2247 | .shift = shift_amt_id, | |
| 2248 | }); | |
| 2249 | return right_id; | |
| 2250 | }, | |
| 2251 | } | |
| 2252 | } | |
| 2253 | ||
| 1841 | 2254 | fn airArithOp( |
| 1842 | 2255 | self: *DeclGen, |
| 1843 | 2256 | inst: Air.Inst.Index, |
| ... | ... | @@ -1848,18 +2261,52 @@ pub const DeclGen = struct { |
| 1848 | 2261 | comptime modular: bool, |
| 1849 | 2262 | ) !?IdRef { |
| 1850 | 2263 | if (self.liveness.isUnused(inst)) return null; |
| 2264 | ||
| 1851 | 2265 | // LHS and RHS are guaranteed to have the same type, and AIR guarantees |
| 1852 | 2266 | // the result to be the same as the LHS and RHS, which matches SPIR-V. |
| 1853 | 2267 | const ty = self.typeOfIndex(inst); |
| 1854 | 2268 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; |
| 1855 | var lhs_id = try self.resolve(bin_op.lhs); | |
| 1856 | var rhs_id = try self.resolve(bin_op.rhs); | |
| 1857 | ||
| 1858 | const result_ty_ref = try self.resolveType(ty, .direct); | |
| 2269 | const lhs_id = try self.resolve(bin_op.lhs); | |
| 2270 | const rhs_id = try self.resolve(bin_op.rhs); | |
| 1859 | 2271 | |
| 1860 | 2272 | assert(self.typeOf(bin_op.lhs).eql(ty, self.module)); |
| 1861 | 2273 | assert(self.typeOf(bin_op.rhs).eql(ty, self.module)); |
| 1862 | 2274 | |
| 2275 | return try self.arithOp(ty, lhs_id, rhs_id, fop, sop, uop, modular); | |
| 2276 | } | |
| 2277 | ||
| 2278 | fn arithOp( | |
| 2279 | self: *DeclGen, | |
| 2280 | ty: Type, | |
| 2281 | lhs_id_: IdRef, | |
| 2282 | rhs_id_: IdRef, | |
| 2283 | comptime fop: Opcode, | |
| 2284 | comptime sop: Opcode, | |
| 2285 | comptime uop: Opcode, | |
| 2286 | /// true if this operation holds under modular arithmetic. | |
| 2287 | comptime modular: bool, | |
| 2288 | ) !IdRef { | |
| 2289 | var rhs_id = rhs_id_; | |
| 2290 | var lhs_id = lhs_id_; | |
| 2291 | ||
| 2292 | const mod = self.module; | |
| 2293 | const result_ty_ref = try self.resolveType(ty, .direct); | |
| 2294 | ||
| 2295 | if (ty.isVector(mod)) { | |
| 2296 | const child_ty = ty.childType(mod); | |
| 2297 | const vector_len = ty.vectorLen(mod); | |
| 2298 | var constituents = try self.gpa.alloc(IdRef, vector_len); | |
| 2299 | defer self.gpa.free(constituents); | |
| 2300 | ||
| 2301 | for (constituents, 0..) |*constituent, i| { | |
| 2302 | const lhs_index_id = try self.extractField(child_ty, lhs_id, @intCast(i)); | |
| 2303 | const rhs_index_id = try self.extractField(child_ty, rhs_id, @intCast(i)); | |
| 2304 | constituent.* = try self.arithOp(child_ty, lhs_index_id, rhs_index_id, fop, sop, uop, modular); | |
| 2305 | } | |
| 2306 | ||
| 2307 | return self.constructArray(result_ty_ref, constituents); | |
| 2308 | } | |
| 2309 | ||
| 1863 | 2310 | // Binary operations are generally applicable to both scalar and vector operations |
| 1864 | 2311 | // in SPIR-V, but int and float versions of operations require different opcodes. |
| 1865 | 2312 | const info = try self.arithmeticTypeInfo(ty); |
| ... | ... | @@ -1870,8 +2317,8 @@ pub const DeclGen = struct { |
| 1870 | 2317 | }, |
| 1871 | 2318 | .strange_integer => blk: { |
| 1872 | 2319 | if (!modular) { |
| 1873 | lhs_id = try self.maskStrangeInt(result_ty_ref, lhs_id, info.bits); | |
| 1874 | rhs_id = try self.maskStrangeInt(result_ty_ref, rhs_id, info.bits); | |
| 2320 | lhs_id = try self.normalizeInt(result_ty_ref, lhs_id, info); | |
| 2321 | rhs_id = try self.normalizeInt(result_ty_ref, rhs_id, info); | |
| 1875 | 2322 | } |
| 1876 | 2323 | break :blk switch (info.signedness) { |
| 1877 | 2324 | .signed => @as(usize, 1), |
| ... | ... | @@ -2174,8 +2621,7 @@ pub const DeclGen = struct { |
| 2174 | 2621 | |
| 2175 | 2622 | fn cmp( |
| 2176 | 2623 | self: *DeclGen, |
| 2177 | comptime op: std.math.CompareOperator, | |
| 2178 | bool_ty_id: IdRef, | |
| 2624 | op: std.math.CompareOperator, | |
| 2179 | 2625 | ty: Type, |
| 2180 | 2626 | lhs_id: IdRef, |
| 2181 | 2627 | rhs_id: IdRef, |
| ... | ... | @@ -2183,38 +2629,104 @@ pub const DeclGen = struct { |
| 2183 | 2629 | const mod = self.module; |
| 2184 | 2630 | var cmp_lhs_id = lhs_id; |
| 2185 | 2631 | var cmp_rhs_id = rhs_id; |
| 2186 | const opcode: Opcode = opcode: { | |
| 2187 | const op_ty = switch (ty.zigTypeTag(mod)) { | |
| 2188 | .Int, .Bool, .Float => ty, | |
| 2189 | .Enum => ty.intTagType(mod), | |
| 2190 | .ErrorSet => Type.u16, | |
| 2191 | .Pointer => blk: { | |
| 2192 | // Note that while SPIR-V offers OpPtrEqual and OpPtrNotEqual, they are | |
| 2193 | // currently not implemented in the SPIR-V LLVM translator. Thus, we emit these using | |
| 2194 | // OpConvertPtrToU... | |
| 2195 | cmp_lhs_id = self.spv.allocId(); | |
| 2196 | cmp_rhs_id = self.spv.allocId(); | |
| 2197 | ||
| 2198 | const usize_ty_id = self.typeId(try self.sizeType()); | |
| 2199 | ||
| 2200 | try self.func.body.emit(self.spv.gpa, .OpConvertPtrToU, .{ | |
| 2201 | .id_result_type = usize_ty_id, | |
| 2202 | .id_result = cmp_lhs_id, | |
| 2203 | .pointer = lhs_id, | |
| 2204 | }); | |
| 2632 | const bool_ty_ref = try self.resolveType(Type.bool, .direct); | |
| 2633 | const op_ty = switch (ty.zigTypeTag(mod)) { | |
| 2634 | .Int, .Bool, .Float => ty, | |
| 2635 | .Enum => ty.intTagType(mod), | |
| 2636 | .ErrorSet => Type.u16, | |
| 2637 | .Pointer => blk: { | |
| 2638 | // Note that while SPIR-V offers OpPtrEqual and OpPtrNotEqual, they are | |
| 2639 | // currently not implemented in the SPIR-V LLVM translator. Thus, we emit these using | |
| 2640 | // OpConvertPtrToU... | |
| 2641 | cmp_lhs_id = self.spv.allocId(); | |
| 2642 | cmp_rhs_id = self.spv.allocId(); | |
| 2643 | ||
| 2644 | const usize_ty_id = self.typeId(try self.sizeType()); | |
| 2645 | ||
| 2646 | try self.func.body.emit(self.spv.gpa, .OpConvertPtrToU, .{ | |
| 2647 | .id_result_type = usize_ty_id, | |
| 2648 | .id_result = cmp_lhs_id, | |
| 2649 | .pointer = lhs_id, | |
| 2650 | }); | |
| 2205 | 2651 | |
| 2206 | try self.func.body.emit(self.spv.gpa, .OpConvertPtrToU, .{ | |
| 2207 | .id_result_type = usize_ty_id, | |
| 2208 | .id_result = cmp_rhs_id, | |
| 2209 | .pointer = rhs_id, | |
| 2210 | }); | |
| 2652 | try self.func.body.emit(self.spv.gpa, .OpConvertPtrToU, .{ | |
| 2653 | .id_result_type = usize_ty_id, | |
| 2654 | .id_result = cmp_rhs_id, | |
| 2655 | .pointer = rhs_id, | |
| 2656 | }); | |
| 2211 | 2657 | |
| 2212 | break :blk Type.usize; | |
| 2213 | }, | |
| 2214 | .Optional => unreachable, // TODO | |
| 2215 | else => unreachable, | |
| 2216 | }; | |
| 2658 | break :blk Type.usize; | |
| 2659 | }, | |
| 2660 | .Optional => { | |
| 2661 | const payload_ty = ty.optionalChild(mod); | |
| 2662 | if (ty.optionalReprIsPayload(mod)) { | |
| 2663 | assert(payload_ty.hasRuntimeBitsIgnoreComptime(mod)); | |
| 2664 | assert(!payload_ty.isSlice(mod)); | |
| 2665 | return self.cmp(op, payload_ty, lhs_id, rhs_id); | |
| 2666 | } | |
| 2667 | ||
| 2668 | const lhs_valid_id = if (payload_ty.hasRuntimeBitsIgnoreComptime(mod)) | |
| 2669 | try self.extractField(Type.bool, lhs_id, 1) | |
| 2670 | else | |
| 2671 | try self.convertToDirect(Type.bool, lhs_id); | |
| 2672 | ||
| 2673 | const rhs_valid_id = if (payload_ty.hasRuntimeBitsIgnoreComptime(mod)) | |
| 2674 | try self.extractField(Type.bool, rhs_id, 1) | |
| 2675 | else | |
| 2676 | try self.convertToDirect(Type.bool, rhs_id); | |
| 2677 | ||
| 2678 | const valid_cmp_id = try self.cmp(op, Type.bool, lhs_valid_id, rhs_valid_id); | |
| 2679 | if (!payload_ty.hasRuntimeBitsIgnoreComptime(mod)) { | |
| 2680 | return valid_cmp_id; | |
| 2681 | } | |
| 2682 | ||
| 2683 | // TODO: Should we short circuit here? It shouldn't affect correctness, but | |
| 2684 | // perhaps it will generate more efficient code. | |
| 2685 | ||
| 2686 | const lhs_pl_id = try self.extractField(payload_ty, lhs_id, 0); | |
| 2687 | const rhs_pl_id = try self.extractField(payload_ty, rhs_id, 0); | |
| 2688 | ||
| 2689 | const pl_cmp_id = try self.cmp(op, payload_ty, lhs_pl_id, rhs_pl_id); | |
| 2217 | 2690 | |
| 2691 | // op == .eq => lhs_valid == rhs_valid && lhs_pl == rhs_pl | |
| 2692 | // op == .neq => lhs_valid != rhs_valid || lhs_pl != rhs_pl | |
| 2693 | ||
| 2694 | const result_id = self.spv.allocId(); | |
| 2695 | const args = .{ | |
| 2696 | .id_result_type = self.typeId(bool_ty_ref), | |
| 2697 | .id_result = result_id, | |
| 2698 | .operand_1 = valid_cmp_id, | |
| 2699 | .operand_2 = pl_cmp_id, | |
| 2700 | }; | |
| 2701 | switch (op) { | |
| 2702 | .eq => try self.func.body.emit(self.spv.gpa, .OpLogicalAnd, args), | |
| 2703 | .neq => try self.func.body.emit(self.spv.gpa, .OpLogicalOr, args), | |
| 2704 | else => unreachable, | |
| 2705 | } | |
| 2706 | return result_id; | |
| 2707 | }, | |
| 2708 | .Vector => { | |
| 2709 | const child_ty = ty.childType(mod); | |
| 2710 | const vector_len = ty.vectorLen(mod); | |
| 2711 | const bool_ty_ref_indirect = try self.resolveType(Type.bool, .indirect); | |
| 2712 | ||
| 2713 | var constituents = try self.gpa.alloc(IdRef, vector_len); | |
| 2714 | defer self.gpa.free(constituents); | |
| 2715 | ||
| 2716 | for (constituents, 0..) |*constituent, i| { | |
| 2717 | const lhs_index_id = try self.extractField(child_ty, cmp_lhs_id, @intCast(i)); | |
| 2718 | const rhs_index_id = try self.extractField(child_ty, cmp_rhs_id, @intCast(i)); | |
| 2719 | const result_id = try self.cmp(op, child_ty, lhs_index_id, rhs_index_id); | |
| 2720 | constituent.* = try self.convertToIndirect(Type.bool, result_id); | |
| 2721 | } | |
| 2722 | ||
| 2723 | const result_ty_ref = try self.spv.arrayType(vector_len, bool_ty_ref_indirect); | |
| 2724 | return try self.constructArray(result_ty_ref, constituents); | |
| 2725 | }, | |
| 2726 | else => unreachable, | |
| 2727 | }; | |
| 2728 | ||
| 2729 | const opcode: Opcode = opcode: { | |
| 2218 | 2730 | const info = try self.arithmeticTypeInfo(op_ty); |
| 2219 | 2731 | const signedness = switch (info.class) { |
| 2220 | 2732 | .composite_integer => { |
| ... | ... | @@ -2222,7 +2734,7 @@ pub const DeclGen = struct { |
| 2222 | 2734 | }, |
| 2223 | 2735 | .float => break :opcode switch (op) { |
| 2224 | 2736 | .eq => .OpFOrdEqual, |
| 2225 | .neq => .OpFOrdNotEqual, | |
| 2737 | .neq => .OpFUnordNotEqual, | |
| 2226 | 2738 | .lt => .OpFOrdLessThan, |
| 2227 | 2739 | .lte => .OpFOrdLessThanEqual, |
| 2228 | 2740 | .gt => .OpFOrdGreaterThan, |
| ... | ... | @@ -2236,8 +2748,8 @@ pub const DeclGen = struct { |
| 2236 | 2748 | .strange_integer => sign: { |
| 2237 | 2749 | const op_ty_ref = try self.resolveType(op_ty, .direct); |
| 2238 | 2750 | // Mask operands before performing comparison. |
| 2239 | cmp_lhs_id = try self.maskStrangeInt(op_ty_ref, cmp_lhs_id, info.bits); | |
| 2240 | cmp_rhs_id = try self.maskStrangeInt(op_ty_ref, cmp_rhs_id, info.bits); | |
| 2751 | cmp_lhs_id = try self.normalizeInt(op_ty_ref, cmp_lhs_id, info); | |
| 2752 | cmp_rhs_id = try self.normalizeInt(op_ty_ref, cmp_rhs_id, info); | |
| 2241 | 2753 | break :sign info.signedness; |
| 2242 | 2754 | }, |
| 2243 | 2755 | .integer => info.signedness, |
| ... | ... | @@ -2265,7 +2777,7 @@ pub const DeclGen = struct { |
| 2265 | 2777 | |
| 2266 | 2778 | const result_id = self.spv.allocId(); |
| 2267 | 2779 | try self.func.body.emitRaw(self.spv.gpa, opcode, 4); |
| 2268 | self.func.body.writeOperand(spec.IdResultType, bool_ty_id); | |
| 2780 | self.func.body.writeOperand(spec.IdResultType, self.typeId(bool_ty_ref)); | |
| 2269 | 2781 | self.func.body.writeOperand(spec.IdResult, result_id); |
| 2270 | 2782 | self.func.body.writeOperand(spec.IdResultType, cmp_lhs_id); |
| 2271 | 2783 | self.func.body.writeOperand(spec.IdResultType, cmp_rhs_id); |
| ... | ... | @@ -2281,11 +2793,22 @@ pub const DeclGen = struct { |
| 2281 | 2793 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; |
| 2282 | 2794 | const lhs_id = try self.resolve(bin_op.lhs); |
| 2283 | 2795 | const rhs_id = try self.resolve(bin_op.rhs); |
| 2284 | const bool_ty_id = try self.resolveTypeId(Type.bool); | |
| 2285 | 2796 | const ty = self.typeOf(bin_op.lhs); |
| 2286 | assert(ty.eql(self.typeOf(bin_op.rhs), self.module)); | |
| 2287 | 2797 | |
| 2288 | return try self.cmp(op, bool_ty_id, ty, lhs_id, rhs_id); | |
| 2798 | return try self.cmp(op, ty, lhs_id, rhs_id); | |
| 2799 | } | |
| 2800 | ||
| 2801 | fn airVectorCmp(self: *DeclGen, inst: Air.Inst.Index) !?IdRef { | |
| 2802 | if (self.liveness.isUnused(inst)) return null; | |
| 2803 | ||
| 2804 | const ty_pl = self.air.instructions.items(.data)[inst].ty_pl; | |
| 2805 | const vec_cmp = self.air.extraData(Air.VectorCmp, ty_pl.payload).data; | |
| 2806 | const lhs_id = try self.resolve(vec_cmp.lhs); | |
| 2807 | const rhs_id = try self.resolve(vec_cmp.rhs); | |
| 2808 | const op = vec_cmp.compareOperator(); | |
| 2809 | const ty = self.typeOf(vec_cmp.lhs); | |
| 2810 | ||
| 2811 | return try self.cmp(op, ty, lhs_id, rhs_id); | |
| 2289 | 2812 | } |
| 2290 | 2813 | |
| 2291 | 2814 | fn bitCast( |
| ... | ... | @@ -2295,26 +2818,58 @@ pub const DeclGen = struct { |
| 2295 | 2818 | src_id: IdRef, |
| 2296 | 2819 | ) !IdRef { |
| 2297 | 2820 | const mod = self.module; |
| 2821 | const src_ty_ref = try self.resolveType(src_ty, .direct); | |
| 2298 | 2822 | const dst_ty_ref = try self.resolveType(dst_ty, .direct); |
| 2299 | const result_id = self.spv.allocId(); | |
| 2823 | if (src_ty_ref == dst_ty_ref) { | |
| 2824 | return src_id; | |
| 2825 | } | |
| 2300 | 2826 | |
| 2301 | 2827 | // TODO: Some more cases are missing here |
| 2302 | 2828 | // See fn bitCast in llvm.zig |
| 2303 | 2829 | |
| 2304 | 2830 | if (src_ty.zigTypeTag(mod) == .Int and dst_ty.isPtrAtRuntime(mod)) { |
| 2831 | const result_id = self.spv.allocId(); | |
| 2305 | 2832 | try self.func.body.emit(self.spv.gpa, .OpConvertUToPtr, .{ |
| 2306 | 2833 | .id_result_type = self.typeId(dst_ty_ref), |
| 2307 | 2834 | .id_result = result_id, |
| 2308 | 2835 | .integer_value = src_id, |
| 2309 | 2836 | }); |
| 2310 | } else { | |
| 2837 | return result_id; | |
| 2838 | } | |
| 2839 | ||
| 2840 | // We can only use OpBitcast for specific conversions: between numerical types, and | |
| 2841 | // between pointers. If the resolved spir-v types fall into this category then emit OpBitcast, | |
| 2842 | // otherwise use a temporary and perform a pointer cast. | |
| 2843 | const src_key = self.spv.cache.lookup(src_ty_ref); | |
| 2844 | const dst_key = self.spv.cache.lookup(dst_ty_ref); | |
| 2845 | ||
| 2846 | if ((src_key.isNumericalType() and dst_key.isNumericalType()) or (src_key == .ptr_type and dst_key == .ptr_type)) { | |
| 2847 | const result_id = self.spv.allocId(); | |
| 2311 | 2848 | try self.func.body.emit(self.spv.gpa, .OpBitcast, .{ |
| 2312 | 2849 | .id_result_type = self.typeId(dst_ty_ref), |
| 2313 | 2850 | .id_result = result_id, |
| 2314 | 2851 | .operand = src_id, |
| 2315 | 2852 | }); |
| 2853 | return result_id; | |
| 2316 | 2854 | } |
| 2317 | return result_id; | |
| 2855 | ||
| 2856 | const src_ptr_ty_ref = try self.spv.ptrType(src_ty_ref, .Function); | |
| 2857 | const dst_ptr_ty_ref = try self.spv.ptrType(dst_ty_ref, .Function); | |
| 2858 | ||
| 2859 | const tmp_id = self.spv.allocId(); | |
| 2860 | try self.func.prologue.emit(self.spv.gpa, .OpVariable, .{ | |
| 2861 | .id_result_type = self.typeId(src_ptr_ty_ref), | |
| 2862 | .id_result = tmp_id, | |
| 2863 | .storage_class = .Function, | |
| 2864 | }); | |
| 2865 | try self.store(src_ty, tmp_id, src_id, false); | |
| 2866 | const casted_ptr_id = self.spv.allocId(); | |
| 2867 | try self.func.body.emit(self.spv.gpa, .OpBitcast, .{ | |
| 2868 | .id_result_type = self.typeId(dst_ptr_ty_ref), | |
| 2869 | .id_result = casted_ptr_id, | |
| 2870 | .operand = tmp_id, | |
| 2871 | }); | |
| 2872 | return try self.load(dst_ty, casted_ptr_id, false); | |
| 2318 | 2873 | } |
| 2319 | 2874 | |
| 2320 | 2875 | fn airBitCast(self: *DeclGen, inst: Air.Inst.Index) !?IdRef { |
| ... | ... | @@ -2331,25 +2886,33 @@ pub const DeclGen = struct { |
| 2331 | 2886 | |
| 2332 | 2887 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; |
| 2333 | 2888 | const operand_id = try self.resolve(ty_op.operand); |
| 2334 | const dest_ty = self.typeOfIndex(inst); | |
| 2335 | const dest_ty_id = try self.resolveTypeId(dest_ty); | |
| 2889 | const src_ty = self.typeOf(ty_op.operand); | |
| 2890 | const dst_ty = self.typeOfIndex(inst); | |
| 2891 | const src_ty_ref = try self.resolveType(src_ty, .direct); | |
| 2892 | const dst_ty_ref = try self.resolveType(dst_ty, .direct); | |
| 2336 | 2893 | |
| 2337 | const mod = self.module; | |
| 2338 | const dest_info = dest_ty.intInfo(mod); | |
| 2894 | const src_info = try self.arithmeticTypeInfo(src_ty); | |
| 2895 | const dst_info = try self.arithmeticTypeInfo(dst_ty); | |
| 2339 | 2896 | |
| 2340 | // TODO: Masking? | |
| 2897 | // While intcast promises that the value already fits, the upper bits of a | |
| 2898 | // strange integer may contain garbage. Therefore, mask/sign extend it before. | |
| 2899 | const src_id = try self.normalizeInt(src_ty_ref, operand_id, src_info); | |
| 2900 | ||
| 2901 | if (src_info.backing_bits == dst_info.backing_bits) { | |
| 2902 | return src_id; | |
| 2903 | } | |
| 2341 | 2904 | |
| 2342 | 2905 | const result_id = self.spv.allocId(); |
| 2343 | switch (dest_info.signedness) { | |
| 2906 | switch (dst_info.signedness) { | |
| 2344 | 2907 | .signed => try self.func.body.emit(self.spv.gpa, .OpSConvert, .{ |
| 2345 | .id_result_type = dest_ty_id, | |
| 2908 | .id_result_type = self.typeId(dst_ty_ref), | |
| 2346 | 2909 | .id_result = result_id, |
| 2347 | .signed_value = operand_id, | |
| 2910 | .signed_value = src_id, | |
| 2348 | 2911 | }), |
| 2349 | 2912 | .unsigned => try self.func.body.emit(self.spv.gpa, .OpUConvert, .{ |
| 2350 | .id_result_type = dest_ty_id, | |
| 2913 | .id_result_type = self.typeId(dst_ty_ref), | |
| 2351 | 2914 | .id_result = result_id, |
| 2352 | .unsigned_value = operand_id, | |
| 2915 | .unsigned_value = src_id, | |
| 2353 | 2916 | }), |
| 2354 | 2917 | } |
| 2355 | 2918 | return result_id; |
| ... | ... | @@ -2422,6 +2985,23 @@ pub const DeclGen = struct { |
| 2422 | 2985 | return result_id; |
| 2423 | 2986 | } |
| 2424 | 2987 | |
| 2988 | fn airFloatCast(self: *DeclGen, inst: Air.Inst.Index) !?IdRef { | |
| 2989 | if (self.liveness.isUnused(inst)) return null; | |
| 2990 | ||
| 2991 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; | |
| 2992 | const operand_id = try self.resolve(ty_op.operand); | |
| 2993 | const dest_ty = self.typeOfIndex(inst); | |
| 2994 | const dest_ty_id = try self.resolveTypeId(dest_ty); | |
| 2995 | ||
| 2996 | const result_id = self.spv.allocId(); | |
| 2997 | try self.func.body.emit(self.spv.gpa, .OpFConvert, .{ | |
| 2998 | .id_result_type = dest_ty_id, | |
| 2999 | .id_result = result_id, | |
| 3000 | .float_value = operand_id, | |
| 3001 | }); | |
| 3002 | return result_id; | |
| 3003 | } | |
| 3004 | ||
| 2425 | 3005 | fn airNot(self: *DeclGen, inst: Air.Inst.Index) !?IdRef { |
| 2426 | 3006 | if (self.liveness.isUnused(inst)) return null; |
| 2427 | 3007 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; |
| ... | ... | @@ -2461,22 +3041,23 @@ pub const DeclGen = struct { |
| 2461 | 3041 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; |
| 2462 | 3042 | const array_ptr_ty = self.typeOf(ty_op.operand); |
| 2463 | 3043 | const array_ty = array_ptr_ty.childType(mod); |
| 2464 | const elem_ty = array_ptr_ty.elemType2(mod); // use elemType() so that we get T for *[N]T. | |
| 2465 | const elem_ty_ref = try self.resolveType(elem_ty, .indirect); | |
| 2466 | const elem_ptr_ty_ref = try self.spv.ptrType(elem_ty_ref, spvStorageClass(array_ptr_ty.ptrAddressSpace(mod))); | |
| 2467 | 3044 | const slice_ty = self.typeOfIndex(inst); |
| 3045 | const elem_ptr_ty = slice_ty.slicePtrFieldType(mod); | |
| 3046 | ||
| 3047 | const elem_ptr_ty_ref = try self.resolveType(elem_ptr_ty, .direct); | |
| 2468 | 3048 | const slice_ty_ref = try self.resolveType(slice_ty, .direct); |
| 2469 | 3049 | const size_ty_ref = try self.sizeType(); |
| 2470 | 3050 | |
| 2471 | 3051 | const array_ptr_id = try self.resolve(ty_op.operand); |
| 2472 | 3052 | const len_id = try self.constInt(size_ty_ref, array_ty.arrayLen(mod)); |
| 2473 | 3053 | |
| 2474 | if (!array_ty.hasRuntimeBitsIgnoreComptime(mod)) { | |
| 2475 | unreachable; // TODO | |
| 2476 | } | |
| 3054 | const elem_ptr_id = if (!array_ty.hasRuntimeBitsIgnoreComptime(mod)) | |
| 3055 | // Note: The pointer is something like *opaque{}, so we need to bitcast it to the element type. | |
| 3056 | try self.bitCast(elem_ptr_ty, array_ptr_ty, array_ptr_id) | |
| 3057 | else | |
| 3058 | // Convert the pointer-to-array to a pointer to the first element. | |
| 3059 | try self.accessChain(elem_ptr_ty_ref, array_ptr_id, &.{0}); | |
| 2477 | 3060 | |
| 2478 | // Convert the pointer-to-array to a pointer to the first element. | |
| 2479 | const elem_ptr_id = try self.accessChain(elem_ptr_ty_ref, array_ptr_id, &.{0}); | |
| 2480 | 3061 | return try self.constructStruct(slice_ty_ref, &.{ elem_ptr_id, len_id }); |
| 2481 | 3062 | } |
| 2482 | 3063 | |
| ... | ... | @@ -2500,6 +3081,7 @@ pub const DeclGen = struct { |
| 2500 | 3081 | if (self.liveness.isUnused(inst)) return null; |
| 2501 | 3082 | |
| 2502 | 3083 | const mod = self.module; |
| 3084 | const ip = &mod.intern_pool; | |
| 2503 | 3085 | const ty_pl = self.air.instructions.items(.data)[inst].ty_pl; |
| 2504 | 3086 | const result_ty = self.typeOfIndex(inst); |
| 2505 | 3087 | const result_ty_ref = try self.resolveType(result_ty, .direct); |
| ... | ... | @@ -2508,15 +3090,53 @@ pub const DeclGen = struct { |
| 2508 | 3090 | |
| 2509 | 3091 | switch (result_ty.zigTypeTag(mod)) { |
| 2510 | 3092 | .Vector => unreachable, // TODO |
| 2511 | .Struct => unreachable, // TODO | |
| 3093 | .Struct => { | |
| 3094 | if (mod.typeToPackedStruct(result_ty)) |struct_type| { | |
| 3095 | _ = struct_type; | |
| 3096 | unreachable; // TODO | |
| 3097 | } | |
| 3098 | ||
| 3099 | const constituents = try self.gpa.alloc(IdRef, elements.len); | |
| 3100 | defer self.gpa.free(constituents); | |
| 3101 | var index: usize = 0; | |
| 3102 | ||
| 3103 | switch (ip.indexToKey(result_ty.toIntern())) { | |
| 3104 | .anon_struct_type => |tuple| { | |
| 3105 | for (tuple.types.get(ip), elements, 0..) |field_ty, element, i| { | |
| 3106 | if ((try result_ty.structFieldValueComptime(mod, i)) != null) continue; | |
| 3107 | assert(field_ty.toType().hasRuntimeBits(mod)); | |
| 3108 | ||
| 3109 | const id = try self.resolve(element); | |
| 3110 | constituents[index] = try self.convertToIndirect(field_ty.toType(), id); | |
| 3111 | index += 1; | |
| 3112 | } | |
| 3113 | }, | |
| 3114 | .struct_type => |struct_type| { | |
| 3115 | var it = struct_type.iterateRuntimeOrder(ip); | |
| 3116 | for (elements, 0..) |element, i| { | |
| 3117 | const field_index = it.next().?; | |
| 3118 | if ((try result_ty.structFieldValueComptime(mod, i)) != null) continue; | |
| 3119 | const field_ty = struct_type.field_types.get(ip)[field_index].toType(); | |
| 3120 | assert(field_ty.hasRuntimeBitsIgnoreComptime(mod)); | |
| 3121 | ||
| 3122 | const id = try self.resolve(element); | |
| 3123 | constituents[index] = try self.convertToIndirect(field_ty, id); | |
| 3124 | index += 1; | |
| 3125 | } | |
| 3126 | }, | |
| 3127 | else => unreachable, | |
| 3128 | } | |
| 3129 | ||
| 3130 | return try self.constructStruct(result_ty_ref, constituents[0..index]); | |
| 3131 | }, | |
| 2512 | 3132 | .Array => { |
| 2513 | 3133 | const array_info = result_ty.arrayInfo(mod); |
| 2514 | 3134 | const n_elems: usize = @intCast(result_ty.arrayLenIncludingSentinel(mod)); |
| 2515 | 3135 | const elem_ids = try self.gpa.alloc(IdRef, n_elems); |
| 2516 | 3136 | defer self.gpa.free(elem_ids); |
| 2517 | 3137 | |
| 2518 | for (elements, 0..) |elem_inst, i| { | |
| 2519 | const id = try self.resolve(elem_inst); | |
| 3138 | for (elements, 0..) |element, i| { | |
| 3139 | const id = try self.resolve(element); | |
| 2520 | 3140 | elem_ids[i] = try self.convertToIndirect(array_info.elem_type, id); |
| 2521 | 3141 | } |
| 2522 | 3142 | |
| ... | ... | @@ -2540,7 +3160,8 @@ pub const DeclGen = struct { |
| 2540 | 3160 | |
| 2541 | 3161 | fn airSliceElemPtr(self: *DeclGen, inst: Air.Inst.Index) !?IdRef { |
| 2542 | 3162 | const mod = self.module; |
| 2543 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; | |
| 3163 | const ty_pl = self.air.instructions.items(.data)[inst].ty_pl; | |
| 3164 | const bin_op = self.air.extraData(Air.Bin, ty_pl.payload).data; | |
| 2544 | 3165 | const slice_ty = self.typeOf(bin_op.lhs); |
| 2545 | 3166 | if (!slice_ty.isVolatilePtr(mod) and self.liveness.isUnused(inst)) return null; |
| 2546 | 3167 | |
| ... | ... | @@ -2593,14 +3214,17 @@ pub const DeclGen = struct { |
| 2593 | 3214 | const mod = self.module; |
| 2594 | 3215 | const ty_pl = self.air.instructions.items(.data)[inst].ty_pl; |
| 2595 | 3216 | const bin_op = self.air.extraData(Air.Bin, ty_pl.payload).data; |
| 2596 | const ptr_ty = self.typeOf(bin_op.lhs); | |
| 2597 | const elem_ty = ptr_ty.childType(mod); | |
| 2598 | // TODO: Make this return a null ptr or something | |
| 2599 | if (!elem_ty.hasRuntimeBitsIgnoreComptime(mod)) return null; | |
| 2600 | ||
| 3217 | const src_ptr_ty = self.typeOf(bin_op.lhs); | |
| 3218 | const elem_ty = src_ptr_ty.childType(mod); | |
| 2601 | 3219 | const ptr_id = try self.resolve(bin_op.lhs); |
| 3220 | ||
| 3221 | if (!elem_ty.hasRuntimeBitsIgnoreComptime(mod)) { | |
| 3222 | const dst_ptr_ty = self.typeOfIndex(inst); | |
| 3223 | return try self.bitCast(dst_ptr_ty, src_ptr_ty, ptr_id); | |
| 3224 | } | |
| 3225 | ||
| 2602 | 3226 | const index_id = try self.resolve(bin_op.rhs); |
| 2603 | return try self.ptrElemPtr(ptr_ty, ptr_id, index_id); | |
| 3227 | return try self.ptrElemPtr(src_ptr_ty, ptr_id, index_id); | |
| 2604 | 3228 | } |
| 2605 | 3229 | |
| 2606 | 3230 | fn airArrayElemVal(self: *DeclGen, inst: Air.Inst.Index) !?IdRef { |
| ... | ... | @@ -3101,15 +3725,25 @@ pub const DeclGen = struct { |
| 3101 | 3725 | |
| 3102 | 3726 | fn airRet(self: *DeclGen, inst: Air.Inst.Index) !void { |
| 3103 | 3727 | const operand = self.air.instructions.items(.data)[inst].un_op; |
| 3104 | const operand_ty = self.typeOf(operand); | |
| 3728 | const ret_ty = self.typeOf(operand); | |
| 3105 | 3729 | const mod = self.module; |
| 3106 | if (operand_ty.hasRuntimeBits(mod)) { | |
| 3107 | // TODO: If we return an empty struct, this branch is also hit incorrectly. | |
| 3108 | const operand_id = try self.resolve(operand); | |
| 3109 | try self.func.body.emit(self.spv.gpa, .OpReturnValue, .{ .value = operand_id }); | |
| 3110 | } else { | |
| 3111 | try self.func.body.emit(self.spv.gpa, .OpReturn, {}); | |
| 3730 | if (!ret_ty.hasRuntimeBitsIgnoreComptime(mod)) { | |
| 3731 | const decl = mod.declPtr(self.decl_index); | |
| 3732 | const fn_info = mod.typeToFunc(decl.ty).?; | |
| 3733 | if (fn_info.return_type.toType().isError(mod)) { | |
| 3734 | // Functions with an empty error set are emitted with an error code | |
| 3735 | // return type and return zero so they can be function pointers coerced | |
| 3736 | // to functions that return anyerror. | |
| 3737 | const err_ty_ref = try self.resolveType(Type.anyerror, .direct); | |
| 3738 | const no_err_id = try self.constInt(err_ty_ref, 0); | |
| 3739 | return try self.func.body.emit(self.spv.gpa, .OpReturnValue, .{ .value = no_err_id }); | |
| 3740 | } else { | |
| 3741 | return try self.func.body.emit(self.spv.gpa, .OpReturn, {}); | |
| 3742 | } | |
| 3112 | 3743 | } |
| 3744 | ||
| 3745 | const operand_id = try self.resolve(operand); | |
| 3746 | try self.func.body.emit(self.spv.gpa, .OpReturnValue, .{ .value = operand_id }); | |
| 3113 | 3747 | } |
| 3114 | 3748 | |
| 3115 | 3749 | fn airRetLoad(self: *DeclGen, inst: Air.Inst.Index) !void { |
| ... | ... | @@ -3119,8 +3753,18 @@ pub const DeclGen = struct { |
| 3119 | 3753 | const ret_ty = ptr_ty.childType(mod); |
| 3120 | 3754 | |
| 3121 | 3755 | if (!ret_ty.hasRuntimeBitsIgnoreComptime(mod)) { |
| 3122 | try self.func.body.emit(self.spv.gpa, .OpReturn, {}); | |
| 3123 | return; | |
| 3756 | const decl = mod.declPtr(self.decl_index); | |
| 3757 | const fn_info = mod.typeToFunc(decl.ty).?; | |
| 3758 | if (fn_info.return_type.toType().isError(mod)) { | |
| 3759 | // Functions with an empty error set are emitted with an error code | |
| 3760 | // return type and return zero so they can be function pointers coerced | |
| 3761 | // to functions that return anyerror. | |
| 3762 | const err_ty_ref = try self.resolveType(Type.anyerror, .direct); | |
| 3763 | const no_err_id = try self.constInt(err_ty_ref, 0); | |
| 3764 | return try self.func.body.emit(self.spv.gpa, .OpReturnValue, .{ .value = no_err_id }); | |
| 3765 | } else { | |
| 3766 | return try self.func.body.emit(self.spv.gpa, .OpReturn, {}); | |
| 3767 | } | |
| 3124 | 3768 | } |
| 3125 | 3769 | |
| 3126 | 3770 | const ptr = try self.resolve(un_op); |
| ... | ... | @@ -3297,31 +3941,26 @@ pub const DeclGen = struct { |
| 3297 | 3941 | payload_ty; |
| 3298 | 3942 | |
| 3299 | 3943 | const ptr_id = if (payload_ty.isSlice(mod)) |
| 3300 | try self.extractField(Type.bool, operand_id, 0) | |
| 3944 | try self.extractField(ptr_ty, operand_id, 0) | |
| 3301 | 3945 | else |
| 3302 | 3946 | operand_id; |
| 3303 | 3947 | |
| 3304 | 3948 | const payload_ty_ref = try self.resolveType(ptr_ty, .direct); |
| 3305 | 3949 | const null_id = try self.spv.constNull(payload_ty_ref); |
| 3306 | const result_id = self.spv.allocId(); | |
| 3307 | const operands = .{ | |
| 3308 | .id_result_type = self.typeId(bool_ty_ref), | |
| 3309 | .id_result = result_id, | |
| 3310 | .operand_1 = ptr_id, | |
| 3311 | .operand_2 = null_id, | |
| 3950 | const op: std.math.CompareOperator = switch (pred) { | |
| 3951 | .is_null => .eq, | |
| 3952 | .is_non_null => .neq, | |
| 3312 | 3953 | }; |
| 3313 | switch (pred) { | |
| 3314 | .is_null => try self.func.body.emit(self.spv.gpa, .OpPtrEqual, operands), | |
| 3315 | .is_non_null => try self.func.body.emit(self.spv.gpa, .OpPtrNotEqual, operands), | |
| 3316 | } | |
| 3317 | return result_id; | |
| 3954 | return try self.cmp(op, ptr_ty, ptr_id, null_id); | |
| 3318 | 3955 | } |
| 3319 | 3956 | |
| 3320 | const is_non_null_id = if (optional_ty.hasRuntimeBitsIgnoreComptime(mod)) | |
| 3957 | const is_non_null_id = if (payload_ty.hasRuntimeBitsIgnoreComptime(mod)) | |
| 3321 | 3958 | try self.extractField(Type.bool, operand_id, 1) |
| 3322 | 3959 | else |
| 3323 | 3960 | // Optional representation is bool indicating whether the optional is set |
| 3324 | operand_id; | |
| 3961 | // Optionals with no payload are represented as an (indirect) bool, so convert | |
| 3962 | // it back to the direct bool here. | |
| 3963 | try self.convertToDirect(Type.bool, operand_id); | |
| 3325 | 3964 | |
| 3326 | 3965 | return switch (pred) { |
| 3327 | 3966 | .is_null => blk: { |
| ... | ... | @@ -3400,17 +4039,19 @@ pub const DeclGen = struct { |
| 3400 | 4039 | const payload_ty = self.typeOf(ty_op.operand); |
| 3401 | 4040 | |
| 3402 | 4041 | if (!payload_ty.hasRuntimeBitsIgnoreComptime(mod)) { |
| 3403 | return try self.constBool(true, .direct); | |
| 4042 | return try self.constBool(true, .indirect); | |
| 3404 | 4043 | } |
| 3405 | 4044 | |
| 3406 | 4045 | const operand_id = try self.resolve(ty_op.operand); |
| 4046 | ||
| 3407 | 4047 | const optional_ty = self.typeOfIndex(inst); |
| 3408 | 4048 | if (optional_ty.optionalReprIsPayload(mod)) { |
| 3409 | 4049 | return operand_id; |
| 3410 | 4050 | } |
| 3411 | 4051 | |
| 3412 | 4052 | const optional_ty_ref = try self.resolveType(optional_ty, .direct); |
| 3413 | const members = [_]IdRef{ operand_id, try self.constBool(true, .indirect) }; | |
| 4053 | const payload_id = try self.convertToIndirect(payload_ty, operand_id); | |
| 4054 | const members = [_]IdRef{ payload_id, try self.constBool(true, .indirect) }; | |
| 3414 | 4055 | return try self.constructStruct(optional_ty_ref, &members); |
| 3415 | 4056 | } |
| 3416 | 4057 | |
| ... | ... | @@ -3437,6 +4078,7 @@ pub const DeclGen = struct { |
| 3437 | 4078 | }; |
| 3438 | 4079 | break :blk if (backing_bits <= 32) @as(u32, 1) else 2; |
| 3439 | 4080 | }, |
| 4081 | .ErrorSet => 1, | |
| 3440 | 4082 | else => return self.todo("implement switch for type {s}", .{@tagName(cond_ty.zigTypeTag(mod))}), // TODO: Figure out which types apply here, and work around them as we can only do integers. |
| 3441 | 4083 | }; |
| 3442 | 4084 | |
| ... | ... | @@ -3490,6 +4132,7 @@ pub const DeclGen = struct { |
| 3490 | 4132 | // TODO: figure out of cond_ty is correct (something with enum literals) |
| 3491 | 4133 | break :blk (try value.intFromEnum(cond_ty, mod)).toUnsignedInt(mod); // TODO: composite integer constants |
| 3492 | 4134 | }, |
| 4135 | .ErrorSet => value.getErrorInt(mod), | |
| 3493 | 4136 | else => unreachable, |
| 3494 | 4137 | }; |
| 3495 | 4138 | const int_lit: spec.LiteralContextDependentNumber = switch (cond_words) { |
| ... | ... | @@ -3533,10 +4176,10 @@ pub const DeclGen = struct { |
| 3533 | 4176 | |
| 3534 | 4177 | fn airDbgStmt(self: *DeclGen, inst: Air.Inst.Index) !void { |
| 3535 | 4178 | const dbg_stmt = self.air.instructions.items(.data)[inst].dbg_stmt; |
| 3536 | const src_fname_id = try self.spv.resolveSourceFileName( | |
| 3537 | self.module, | |
| 3538 | self.module.declPtr(self.decl_index), | |
| 3539 | ); | |
| 4179 | const mod = self.module; | |
| 4180 | const decl = mod.declPtr(self.decl_index); | |
| 4181 | const path = decl.getFileScope(mod).sub_file_path; | |
| 4182 | const src_fname_id = try self.spv.resolveSourceFileName(path); | |
| 3540 | 4183 | const base_line = self.base_line_stack.getLast(); |
| 3541 | 4184 | try self.func.body.emit(self.spv.gpa, .OpLine, .{ |
| 3542 | 4185 | .file = src_fname_id, |
| ... | ... | @@ -3710,7 +4353,7 @@ pub const DeclGen = struct { |
| 3710 | 4353 | const fn_info = mod.typeToFunc(zig_fn_ty).?; |
| 3711 | 4354 | const return_type = fn_info.return_type; |
| 3712 | 4355 | |
| 3713 | const result_type_id = try self.resolveTypeId(return_type.toType()); | |
| 4356 | const result_type_ref = try self.resolveFnReturnType(return_type.toType()); | |
| 3714 | 4357 | const result_id = self.spv.allocId(); |
| 3715 | 4358 | const callee_id = try self.resolve(pl_op.operand); |
| 3716 | 4359 | |
| ... | ... | @@ -3722,16 +4365,16 @@ pub const DeclGen = struct { |
| 3722 | 4365 | // Note: resolve() might emit instructions, so we need to call it |
| 3723 | 4366 | // before starting to emit OpFunctionCall instructions. Hence the |
| 3724 | 4367 | // temporary params buffer. |
| 3725 | const arg_id = try self.resolve(arg); | |
| 3726 | 4368 | const arg_ty = self.typeOf(arg); |
| 3727 | 4369 | if (!arg_ty.hasRuntimeBitsIgnoreComptime(mod)) continue; |
| 4370 | const arg_id = try self.resolve(arg); | |
| 3728 | 4371 | |
| 3729 | 4372 | params[n_params] = arg_id; |
| 3730 | 4373 | n_params += 1; |
| 3731 | 4374 | } |
| 3732 | 4375 | |
| 3733 | 4376 | try self.func.body.emit(self.spv.gpa, .OpFunctionCall, .{ |
| 3734 | .id_result_type = result_type_id, | |
| 4377 | .id_result_type = self.typeId(result_type_ref), | |
| 3735 | 4378 | .id_result = result_id, |
| 3736 | 4379 | .function = callee_id, |
| 3737 | 4380 | .id_ref_3 = params[0..n_params], |
src/codegen/spirv/Cache.zig+32| ... | ... | @@ -81,6 +81,9 @@ const Tag = enum { |
| 81 | 81 | /// have member names trailing. |
| 82 | 82 | /// data is payload to SimpleStructType |
| 83 | 83 | type_struct_simple_with_member_names, |
| 84 | /// Opaque type. | |
| 85 | /// data is name string. | |
| 86 | type_opaque, | |
| 84 | 87 | |
| 85 | 88 | // -- Values |
| 86 | 89 | /// Value of type u8 |
| ... | ... | @@ -235,6 +238,7 @@ pub const Key = union(enum) { |
| 235 | 238 | function_type: FunctionType, |
| 236 | 239 | ptr_type: PointerType, |
| 237 | 240 | struct_type: StructType, |
| 241 | opaque_type: OpaqueType, | |
| 238 | 242 | |
| 239 | 243 | // -- values |
| 240 | 244 | int: Int, |
| ... | ... | @@ -289,6 +293,10 @@ pub const Key = union(enum) { |
| 289 | 293 | } |
| 290 | 294 | }; |
| 291 | 295 | |
| 296 | pub const OpaqueType = struct { | |
| 297 | name: String = .none, | |
| 298 | }; | |
| 299 | ||
| 292 | 300 | pub const Int = struct { |
| 293 | 301 | /// The type: any bitness integer. |
| 294 | 302 | ty: Ref, |
| ... | ... | @@ -427,6 +435,13 @@ pub const Key = union(enum) { |
| 427 | 435 | else => unreachable, |
| 428 | 436 | }; |
| 429 | 437 | } |
| 438 | ||
| 439 | pub fn isNumericalType(self: Key) bool { | |
| 440 | return switch (self) { | |
| 441 | .int_type, .float_type => true, | |
| 442 | else => false, | |
| 443 | }; | |
| 444 | } | |
| 430 | 445 | }; |
| 431 | 446 | |
| 432 | 447 | pub fn deinit(self: *Self, spv: *const Module) void { |
| ... | ... | @@ -539,6 +554,13 @@ fn emit( |
| 539 | 554 | } |
| 540 | 555 | // TODO: Decorations? |
| 541 | 556 | }, |
| 557 | .opaque_type => |opaque_type| { | |
| 558 | const name = if (self.getString(opaque_type.name)) |name| name else ""; | |
| 559 | try section.emit(spv.gpa, .OpTypeOpaque, .{ | |
| 560 | .id_result = result_id, | |
| 561 | .literal_string = name, | |
| 562 | }); | |
| 563 | }, | |
| 542 | 564 | .int => |int| { |
| 543 | 565 | const int_type = self.lookup(int.ty).int_type; |
| 544 | 566 | const ty_id = self.resultId(int.ty); |
| ... | ... | @@ -697,6 +719,11 @@ pub fn resolve(self: *Self, spv: *Module, key: Key) !Ref { |
| 697 | 719 | }; |
| 698 | 720 | } |
| 699 | 721 | }, |
| 722 | .opaque_type => |opaque_type| Item{ | |
| 723 | .tag = .type_opaque, | |
| 724 | .result_id = result_id, | |
| 725 | .data = @intFromEnum(opaque_type.name), | |
| 726 | }, | |
| 700 | 727 | .int => |int| blk: { |
| 701 | 728 | const int_type = self.lookup(int.ty).int_type; |
| 702 | 729 | if (int_type.signedness == .unsigned and int_type.bits == 8) { |
| ... | ... | @@ -874,6 +901,11 @@ pub fn lookup(self: *const Self, ref: Ref) Key { |
| 874 | 901 | }, |
| 875 | 902 | }; |
| 876 | 903 | }, |
| 904 | .type_opaque => .{ | |
| 905 | .opaque_type = .{ | |
| 906 | .name = @as(String, @enumFromInt(data)), | |
| 907 | }, | |
| 908 | }, | |
| 877 | 909 | .float16 => .{ .float = .{ |
| 878 | 910 | .ty = self.get(.{ .float_type = .{ .bits = 16 } }), |
| 879 | 911 | .value = .{ .float16 = @as(f16, @bitCast(@as(u16, @intCast(data)))) }, |
src/codegen/spirv/Module.zig+21-22| ... | ... | @@ -11,9 +11,6 @@ const std = @import("std"); |
| 11 | 11 | const Allocator = std.mem.Allocator; |
| 12 | 12 | const assert = std.debug.assert; |
| 13 | 13 | |
| 14 | const ZigModule = @import("../../Module.zig"); | |
| 15 | const ZigDecl = ZigModule.Decl; | |
| 16 | ||
| 17 | 14 | const spec = @import("spec.zig"); |
| 18 | 15 | const Word = spec.Word; |
| 19 | 16 | const IdRef = spec.IdRef; |
| ... | ... | @@ -103,15 +100,12 @@ pub const EntryPoint = struct { |
| 103 | 100 | /// The declaration that should be exported. |
| 104 | 101 | decl_index: Decl.Index, |
| 105 | 102 | /// The name of the kernel to be exported. |
| 106 | name: []const u8, | |
| 103 | name: CacheString, | |
| 107 | 104 | }; |
| 108 | 105 | |
| 109 | 106 | /// A general-purpose allocator which may be used to allocate resources for this module |
| 110 | 107 | gpa: Allocator, |
| 111 | 108 | |
| 112 | /// An arena allocator used to store things that have the same lifetime as this module. | |
| 113 | arena: Allocator, | |
| 114 | ||
| 115 | 109 | /// Module layout, according to SPIR-V Spec section 2.4, "Logical Layout of a Module". |
| 116 | 110 | sections: struct { |
| 117 | 111 | /// Capability instructions |
| ... | ... | @@ -150,7 +144,7 @@ next_result_id: Word, |
| 150 | 144 | /// Cache for results of OpString instructions for module file names fed to OpSource. |
| 151 | 145 | /// Since OpString is pretty much only used for those, we don't need to keep track of all strings, |
| 152 | 146 | /// just the ones for OpLine. Note that OpLine needs the result of OpString, and not that of OpSource. |
| 153 | source_file_names: std.StringHashMapUnmanaged(IdRef) = .{}, | |
| 147 | source_file_names: std.AutoArrayHashMapUnmanaged(CacheString, IdRef) = .{}, | |
| 154 | 148 | |
| 155 | 149 | /// SPIR-V type- and constant cache. This structure is used to store information about these in a more |
| 156 | 150 | /// efficient manner. |
| ... | ... | @@ -176,10 +170,9 @@ globals: struct { |
| 176 | 170 | section: Section = .{}, |
| 177 | 171 | } = .{}, |
| 178 | 172 | |
| 179 | pub fn init(gpa: Allocator, arena: Allocator) Module { | |
| 173 | pub fn init(gpa: Allocator) Module { | |
| 180 | 174 | return .{ |
| 181 | 175 | .gpa = gpa, |
| 182 | .arena = arena, | |
| 183 | 176 | .next_result_id = 1, // 0 is an invalid SPIR-V result id, so start counting at 1. |
| 184 | 177 | }; |
| 185 | 178 | } |
| ... | ... | @@ -321,7 +314,7 @@ fn entryPoints(self: *Module) !Section { |
| 321 | 314 | try entry_points.emit(self.gpa, .OpEntryPoint, .{ |
| 322 | 315 | .execution_model = .Kernel, |
| 323 | 316 | .entry_point = entry_point_id, |
| 324 | .name = entry_point.name, | |
| 317 | .name = self.cache.getString(entry_point.name).?, | |
| 325 | 318 | .interface = interface.items, |
| 326 | 319 | }); |
| 327 | 320 | } |
| ... | ... | @@ -422,6 +415,18 @@ pub fn flush(self: *Module, file: std.fs.File) !void { |
| 422 | 415 | 0, // Schema (currently reserved for future use) |
| 423 | 416 | }; |
| 424 | 417 | |
| 418 | var source = Section{}; | |
| 419 | defer source.deinit(self.gpa); | |
| 420 | try self.sections.debug_strings.emit(self.gpa, .OpSource, .{ | |
| 421 | .source_language = .Unknown, | |
| 422 | .version = 0, | |
| 423 | // We cannot emit these because the Khronos translator does not parse this instruction | |
| 424 | // correctly. | |
| 425 | // See https://github.com/KhronosGroup/SPIRV-LLVM-Translator/issues/2188 | |
| 426 | .file = null, | |
| 427 | .source = null, | |
| 428 | }); | |
| 429 | ||
| 425 | 430 | // Note: needs to be kept in order according to section 2.3! |
| 426 | 431 | const buffers = &[_][]const Word{ |
| 427 | 432 | &header, |
| ... | ... | @@ -429,6 +434,7 @@ pub fn flush(self: *Module, file: std.fs.File) !void { |
| 429 | 434 | self.sections.extensions.toWords(), |
| 430 | 435 | entry_points.toWords(), |
| 431 | 436 | self.sections.execution_modes.toWords(), |
| 437 | source.toWords(), | |
| 432 | 438 | self.sections.debug_strings.toWords(), |
| 433 | 439 | self.sections.debug_names.toWords(), |
| 434 | 440 | self.sections.annotations.toWords(), |
| ... | ... | @@ -464,9 +470,9 @@ pub fn addFunction(self: *Module, decl_index: Decl.Index, func: Fn) !void { |
| 464 | 470 | /// Fetch the result-id of an OpString instruction that encodes the path of the source |
| 465 | 471 | /// file of the decl. This function may also emit an OpSource with source-level information regarding |
| 466 | 472 | /// the decl. |
| 467 | pub fn resolveSourceFileName(self: *Module, zig_module: *ZigModule, zig_decl: *ZigDecl) !IdRef { | |
| 468 | const path = zig_decl.getFileScope(zig_module).sub_file_path; | |
| 469 | const result = try self.source_file_names.getOrPut(self.gpa, path); | |
| 473 | pub fn resolveSourceFileName(self: *Module, path: []const u8) !IdRef { | |
| 474 | const path_ref = try self.resolveString(path); | |
| 475 | const result = try self.source_file_names.getOrPut(self.gpa, path_ref); | |
| 470 | 476 | if (!result.found_existing) { |
| 471 | 477 | const file_result_id = self.allocId(); |
| 472 | 478 | result.value_ptr.* = file_result_id; |
| ... | ... | @@ -474,13 +480,6 @@ pub fn resolveSourceFileName(self: *Module, zig_module: *ZigModule, zig_decl: *Z |
| 474 | 480 | .id_result = file_result_id, |
| 475 | 481 | .string = path, |
| 476 | 482 | }); |
| 477 | ||
| 478 | try self.sections.debug_strings.emit(self.gpa, .OpSource, .{ | |
| 479 | .source_language = .Unknown, // TODO: Register Zig source language. | |
| 480 | .version = 0, // TODO: Zig version as u32? | |
| 481 | .file = file_result_id, | |
| 482 | .source = null, // TODO: Store actual source also? | |
| 483 | }); | |
| 484 | 483 | } |
| 485 | 484 | |
| 486 | 485 | return result.value_ptr.*; |
| ... | ... | @@ -641,7 +640,7 @@ pub fn endGlobal(self: *Module, global_index: Decl.Index, begin_inst: u32, resul |
| 641 | 640 | pub fn declareEntryPoint(self: *Module, decl_index: Decl.Index, name: []const u8) !void { |
| 642 | 641 | try self.entry_points.append(self.gpa, .{ |
| 643 | 642 | .decl_index = decl_index, |
| 644 | .name = try self.arena.dupe(u8, name), | |
| 643 | .name = try self.resolveString(name), | |
| 645 | 644 | }); |
| 646 | 645 | } |
| 647 | 646 |
src/link/SpirV.zig+18-37| ... | ... | @@ -45,9 +45,7 @@ const IdResult = spec.IdResult; |
| 45 | 45 | |
| 46 | 46 | base: link.File, |
| 47 | 47 | |
| 48 | spv: SpvModule, | |
| 49 | spv_arena: ArenaAllocator, | |
| 50 | decl_link: codegen.DeclLinkMap, | |
| 48 | object: codegen.Object, | |
| 51 | 49 | |
| 52 | 50 | pub fn createEmpty(gpa: Allocator, options: link.Options) !*SpirV { |
| 53 | 51 | const self = try gpa.create(SpirV); |
| ... | ... | @@ -58,11 +56,8 @@ pub fn createEmpty(gpa: Allocator, options: link.Options) !*SpirV { |
| 58 | 56 | .file = null, |
| 59 | 57 | .allocator = gpa, |
| 60 | 58 | }, |
| 61 | .spv = undefined, | |
| 62 | .spv_arena = ArenaAllocator.init(gpa), | |
| 63 | .decl_link = codegen.DeclLinkMap.init(self.base.allocator), | |
| 59 | .object = codegen.Object.init(gpa), | |
| 64 | 60 | }; |
| 65 | self.spv = SpvModule.init(gpa, self.spv_arena.allocator()); | |
| 66 | 61 | errdefer self.deinit(); |
| 67 | 62 | |
| 68 | 63 | // TODO: Figure out where to put all of these |
| ... | ... | @@ -99,9 +94,7 @@ pub fn openPath(allocator: Allocator, sub_path: []const u8, options: link.Option |
| 99 | 94 | } |
| 100 | 95 | |
| 101 | 96 | pub fn deinit(self: *SpirV) void { |
| 102 | self.spv.deinit(); | |
| 103 | self.spv_arena.deinit(); | |
| 104 | self.decl_link.deinit(); | |
| 97 | self.object.deinit(); | |
| 105 | 98 | } |
| 106 | 99 | |
| 107 | 100 | pub fn updateFunc(self: *SpirV, module: *Module, func_index: InternPool.Index, air: Air, liveness: Liveness) !void { |
| ... | ... | @@ -113,12 +106,7 @@ pub fn updateFunc(self: *SpirV, module: *Module, func_index: InternPool.Index, a |
| 113 | 106 | const decl = module.declPtr(func.owner_decl); |
| 114 | 107 | log.debug("lowering function {s}", .{module.intern_pool.stringToSlice(decl.name)}); |
| 115 | 108 | |
| 116 | var decl_gen = codegen.DeclGen.init(self.base.allocator, module, &self.spv, &self.decl_link); | |
| 117 | defer decl_gen.deinit(); | |
| 118 | ||
| 119 | if (try decl_gen.gen(func.owner_decl, air, liveness)) |msg| { | |
| 120 | try module.failed_decls.put(module.gpa, func.owner_decl, msg); | |
| 121 | } | |
| 109 | try self.object.updateFunc(module, func_index, air, liveness); | |
| 122 | 110 | } |
| 123 | 111 | |
| 124 | 112 | pub fn updateDecl(self: *SpirV, module: *Module, decl_index: Module.Decl.Index) !void { |
| ... | ... | @@ -129,12 +117,7 @@ pub fn updateDecl(self: *SpirV, module: *Module, decl_index: Module.Decl.Index) |
| 129 | 117 | const decl = module.declPtr(decl_index); |
| 130 | 118 | log.debug("lowering declaration {s}", .{module.intern_pool.stringToSlice(decl.name)}); |
| 131 | 119 | |
| 132 | var decl_gen = codegen.DeclGen.init(self.base.allocator, module, &self.spv, &self.decl_link); | |
| 133 | defer decl_gen.deinit(); | |
| 134 | ||
| 135 | if (try decl_gen.gen(decl_index, undefined, undefined)) |msg| { | |
| 136 | try module.failed_decls.put(module.gpa, decl_index, msg); | |
| 137 | } | |
| 120 | try self.object.updateDecl(module, decl_index); | |
| 138 | 121 | } |
| 139 | 122 | |
| 140 | 123 | pub fn updateDeclExports( |
| ... | ... | @@ -145,15 +128,9 @@ pub fn updateDeclExports( |
| 145 | 128 | ) !void { |
| 146 | 129 | const decl = mod.declPtr(decl_index); |
| 147 | 130 | if (decl.val.isFuncBody(mod) and decl.ty.fnCallingConvention(mod) == .Kernel) { |
| 148 | // TODO: Unify with resolveDecl in spirv.zig. | |
| 149 | const entry = try self.decl_link.getOrPut(decl_index); | |
| 150 | if (!entry.found_existing) { | |
| 151 | entry.value_ptr.* = try self.spv.allocDecl(.func); | |
| 152 | } | |
| 153 | const spv_decl_index = entry.value_ptr.*; | |
| 154 | ||
| 131 | const spv_decl_index = try self.object.resolveDecl(mod, decl_index); | |
| 155 | 132 | for (exports) |exp| { |
| 156 | try self.spv.declareEntryPoint(spv_decl_index, mod.intern_pool.stringToSlice(exp.opts.name)); | |
| 133 | try self.object.spv.declareEntryPoint(spv_decl_index, mod.intern_pool.stringToSlice(exp.opts.name)); | |
| 157 | 134 | } |
| 158 | 135 | } |
| 159 | 136 | |
| ... | ... | @@ -185,15 +162,19 @@ pub fn flushModule(self: *SpirV, comp: *Compilation, prog_node: *std.Progress.No |
| 185 | 162 | sub_prog_node.activate(); |
| 186 | 163 | defer sub_prog_node.end(); |
| 187 | 164 | |
| 165 | const spv = &self.object.spv; | |
| 166 | ||
| 188 | 167 | const target = comp.getTarget(); |
| 189 | try writeCapabilities(&self.spv, target); | |
| 190 | try writeMemoryModel(&self.spv, target); | |
| 168 | try writeCapabilities(spv, target); | |
| 169 | try writeMemoryModel(spv, target); | |
| 191 | 170 | |
| 192 | 171 | // We need to export the list of error names somewhere so that we can pretty-print them in the |
| 193 | 172 | // executor. This is not really an important thing though, so we can just dump it in any old |
| 194 | 173 | // nonsemantic instruction. For now, just put it in OpSourceExtension with a special name. |
| 195 | 174 | |
| 196 | var error_info = std.ArrayList(u8).init(self.spv.arena); | |
| 175 | var error_info = std.ArrayList(u8).init(self.object.gpa); | |
| 176 | defer error_info.deinit(); | |
| 177 | ||
| 197 | 178 | try error_info.appendSlice("zig_errors"); |
| 198 | 179 | const module = self.base.options.module.?; |
| 199 | 180 | for (module.global_error_set.keys()) |name_nts| { |
| ... | ... | @@ -207,17 +188,17 @@ pub fn flushModule(self: *SpirV, comp: *Compilation, prog_node: *std.Progress.No |
| 207 | 188 | defer self.base.allocator.free(escaped_name); |
| 208 | 189 | try error_info.writer().print(":{s}", .{escaped_name}); |
| 209 | 190 | } |
| 210 | try self.spv.sections.debug_strings.emit(self.spv.gpa, .OpSourceExtension, .{ | |
| 191 | try spv.sections.debug_strings.emit(spv.gpa, .OpSourceExtension, .{ | |
| 211 | 192 | .extension = error_info.items, |
| 212 | 193 | }); |
| 213 | 194 | |
| 214 | try self.spv.flush(self.base.file.?); | |
| 195 | try spv.flush(self.base.file.?); | |
| 215 | 196 | } |
| 216 | 197 | |
| 217 | 198 | fn writeCapabilities(spv: *SpvModule, target: std.Target) !void { |
| 218 | 199 | // TODO: Integrate with a hypothetical feature system |
| 219 | 200 | const caps: []const spec.Capability = switch (target.os.tag) { |
| 220 | .opencl => &.{ .Kernel, .Addresses, .Int8, .Int16, .Int64, .Float64, .GenericPointer }, | |
| 201 | .opencl => &.{ .Kernel, .Addresses, .Int8, .Int16, .Int64, .Float64, .Float16, .GenericPointer }, | |
| 221 | 202 | .glsl450 => &.{.Shader}, |
| 222 | 203 | .vulkan => &.{.Shader}, |
| 223 | 204 | else => unreachable, // TODO |
| ... | ... | @@ -249,7 +230,7 @@ fn writeMemoryModel(spv: *SpvModule, target: std.Target) !void { |
| 249 | 230 | }; |
| 250 | 231 | |
| 251 | 232 | // TODO: Put this in a proper section. |
| 252 | try spv.sections.capabilities.emit(spv.gpa, .OpMemoryModel, .{ | |
| 233 | try spv.sections.extensions.emit(spv.gpa, .OpMemoryModel, .{ | |
| 253 | 234 | .addressing_model = addressing_model, |
| 254 | 235 | .memory_model = memory_model, |
| 255 | 236 | }); |
test/behavior/abs.zig-1| ... | ... | @@ -48,7 +48,6 @@ test "@abs unsigned integers" { |
| 48 | 48 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 49 | 49 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; // TODO |
| 50 | 50 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 51 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 52 | 51 | |
| 53 | 52 | try comptime testAbsUnsignedIntegers(); |
| 54 | 53 | try testAbsUnsignedIntegers(); |
test/behavior/align.zig-7| ... | ... | @@ -18,7 +18,6 @@ test "global variable alignment" { |
| 18 | 18 | test "slicing array of length 1 can not assume runtime index is always zero" { |
| 19 | 19 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 20 | 20 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 21 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 22 | 21 | |
| 23 | 22 | var runtime_index: usize = 1; |
| 24 | 23 | const slice = @as(*align(4) [1]u8, &foo)[runtime_index..]; |
| ... | ... | @@ -226,7 +225,6 @@ fn fnWithAlignedStack() i32 { |
| 226 | 225 | test "implicitly decreasing slice alignment" { |
| 227 | 226 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 228 | 227 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 229 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 230 | 228 | |
| 231 | 229 | const a: u32 align(4) = 3; |
| 232 | 230 | const b: u32 align(8) = 4; |
| ... | ... | @@ -396,7 +394,6 @@ test "function align expression depends on generic parameter" { |
| 396 | 394 | |
| 397 | 395 | test "function callconv expression depends on generic parameter" { |
| 398 | 396 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 399 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 400 | 397 | |
| 401 | 398 | const S = struct { |
| 402 | 399 | fn doTheTest() !void { |
| ... | ... | @@ -414,7 +411,6 @@ test "function callconv expression depends on generic parameter" { |
| 414 | 411 | |
| 415 | 412 | test "runtime-known array index has best alignment possible" { |
| 416 | 413 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 417 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 418 | 414 | |
| 419 | 415 | // take full advantage of over-alignment |
| 420 | 416 | var array align(4) = [_]u8{ 1, 2, 3, 4 }; |
| ... | ... | @@ -546,7 +542,6 @@ test "align(N) on functions" { |
| 546 | 542 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 547 | 543 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 548 | 544 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 549 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 550 | 545 | |
| 551 | 546 | if (builtin.zig_backend == .stage2_c) { |
| 552 | 547 | // https://github.com/ziglang/zig/issues/16845 |
| ... | ... | @@ -585,7 +580,6 @@ test "comptime alloc alignment" { |
| 585 | 580 | test "@alignCast null" { |
| 586 | 581 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 587 | 582 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 588 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 589 | 583 | |
| 590 | 584 | var ptr: ?*anyopaque = null; |
| 591 | 585 | const aligned: ?*anyopaque = @alignCast(ptr); |
| ... | ... | @@ -601,7 +595,6 @@ test "sub-aligned pointer field access" { |
| 601 | 595 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 602 | 596 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 603 | 597 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; |
| 604 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 605 | 598 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; |
| 606 | 599 | |
| 607 | 600 | // Originally reported at https://github.com/ziglang/zig/issues/14904 |
test/behavior/array.zig-6| ... | ... | @@ -72,7 +72,6 @@ test "array concat with tuple" { |
| 72 | 72 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 73 | 73 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 74 | 74 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 75 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 76 | 75 | |
| 77 | 76 | const array: [2]u8 = .{ 1, 2 }; |
| 78 | 77 | { |
| ... | ... | @@ -261,7 +260,6 @@ fn doSomeMangling(array: *[4]u8) void { |
| 261 | 260 | |
| 262 | 261 | test "implicit cast zero sized array ptr to slice" { |
| 263 | 262 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 264 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 265 | 263 | |
| 266 | 264 | { |
| 267 | 265 | var b = "".*; |
| ... | ... | @@ -299,7 +297,6 @@ const Str = struct { a: []Sub }; |
| 299 | 297 | test "set global var array via slice embedded in struct" { |
| 300 | 298 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 301 | 299 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 302 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 303 | 300 | |
| 304 | 301 | var s = Str{ .a = s_array[0..] }; |
| 305 | 302 | |
| ... | ... | @@ -569,7 +566,6 @@ test "type coercion of anon struct literal to array" { |
| 569 | 566 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 570 | 567 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 571 | 568 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 572 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 573 | 569 | |
| 574 | 570 | const S = struct { |
| 575 | 571 | const U = union { |
| ... | ... | @@ -652,7 +648,6 @@ test "array init of container level array variable" { |
| 652 | 648 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 653 | 649 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 654 | 650 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 655 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 656 | 651 | |
| 657 | 652 | const S = struct { |
| 658 | 653 | var pair: [2]usize = .{ 1, 2 }; |
| ... | ... | @@ -732,7 +727,6 @@ test "slicing array of zero-sized values" { |
| 732 | 727 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 733 | 728 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 734 | 729 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; |
| 735 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 736 | 730 | |
| 737 | 731 | var arr: [32]u0 = undefined; |
| 738 | 732 | for (arr[0..]) |*zero| |
test/behavior/basic.zig-13| ... | ... | @@ -357,8 +357,6 @@ fn f2(x: bool) []const u8 { |
| 357 | 357 | } |
| 358 | 358 | |
| 359 | 359 | test "variable is allowed to be a pointer to an opaque type" { |
| 360 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 361 | ||
| 362 | 360 | var x: i32 = 1234; |
| 363 | 361 | _ = hereIsAnOpaqueType(@as(*OpaqueA, @ptrCast(&x))); |
| 364 | 362 | } |
| ... | ... | @@ -380,8 +378,6 @@ fn testTakeAddressOfParameter(f: f32) !void { |
| 380 | 378 | } |
| 381 | 379 | |
| 382 | 380 | test "pointer to void return type" { |
| 383 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 384 | ||
| 385 | 381 | try testPointerToVoidReturnType(); |
| 386 | 382 | } |
| 387 | 383 | fn testPointerToVoidReturnType() anyerror!void { |
| ... | ... | @@ -397,7 +393,6 @@ test "array 2D const double ptr" { |
| 397 | 393 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 398 | 394 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 399 | 395 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 400 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 401 | 396 | |
| 402 | 397 | const rect_2d_vertexes = [_][1]f32{ |
| 403 | 398 | [_]f32{1.0}, |
| ... | ... | @@ -410,7 +405,6 @@ test "array 2D const double ptr with offset" { |
| 410 | 405 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 411 | 406 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 412 | 407 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 413 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 414 | 408 | |
| 415 | 409 | const rect_2d_vertexes = [_][2]f32{ |
| 416 | 410 | [_]f32{ 3.0, 4.239 }, |
| ... | ... | @@ -423,7 +417,6 @@ test "array 3D const double ptr with offset" { |
| 423 | 417 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 424 | 418 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 425 | 419 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 426 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 427 | 420 | |
| 428 | 421 | const rect_3d_vertexes = [_][2][2]f32{ |
| 429 | 422 | [_][2]f32{ |
| ... | ... | @@ -478,7 +471,6 @@ fn testStructInFn() !void { |
| 478 | 471 | |
| 479 | 472 | test "fn call returning scalar optional in equality expression" { |
| 480 | 473 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 481 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 482 | 474 | try expect(getNull() == null); |
| 483 | 475 | } |
| 484 | 476 | |
| ... | ... | @@ -489,7 +481,6 @@ fn getNull() ?*i32 { |
| 489 | 481 | test "global variable assignment with optional unwrapping with var initialized to undefined" { |
| 490 | 482 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 491 | 483 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 492 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 493 | 484 | |
| 494 | 485 | const S = struct { |
| 495 | 486 | var data: i32 = 1234; |
| ... | ... | @@ -578,8 +569,6 @@ test "comptime cast fn to ptr" { |
| 578 | 569 | } |
| 579 | 570 | |
| 580 | 571 | test "equality compare fn ptrs" { |
| 581 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 582 | ||
| 583 | 572 | var a = &emptyFn; |
| 584 | 573 | try expect(a == a); |
| 585 | 574 | } |
| ... | ... | @@ -649,7 +638,6 @@ test "string escapes" { |
| 649 | 638 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 650 | 639 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 651 | 640 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 652 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 653 | 641 | |
| 654 | 642 | try expectEqualStrings("\"", "\x22"); |
| 655 | 643 | try expectEqualStrings("\'", "\x27"); |
| ... | ... | @@ -846,7 +834,6 @@ test "labeled block implicitly ends in a break" { |
| 846 | 834 | test "catch in block has correct result location" { |
| 847 | 835 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 848 | 836 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 849 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 850 | 837 | |
| 851 | 838 | const S = struct { |
| 852 | 839 | fn open() error{A}!@This() { |
test/behavior/bitcast.zig-8| ... | ... | @@ -149,8 +149,6 @@ test "bitcast literal [4]u8 param to u32" { |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | test "bitcast generates a temporary value" { |
| 152 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 153 | ||
| 154 | 152 | var y = @as(u16, 0x55AA); |
| 155 | 153 | const x = @as(u16, @bitCast(@as([2]u8, @bitCast(y)))); |
| 156 | 154 | try expect(y == x); |
| ... | ... | @@ -186,7 +184,6 @@ test "@bitCast packed structs at runtime and comptime" { |
| 186 | 184 | test "@bitCast extern structs at runtime and comptime" { |
| 187 | 185 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 188 | 186 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 189 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 190 | 187 | |
| 191 | 188 | const Full = extern struct { |
| 192 | 189 | number: u16, |
| ... | ... | @@ -241,7 +238,6 @@ test "bitcast packed struct to integer and back" { |
| 241 | 238 | test "implicit cast to error union by returning" { |
| 242 | 239 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 243 | 240 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 244 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 245 | 241 | |
| 246 | 242 | const S = struct { |
| 247 | 243 | fn entry() !void { |
| ... | ... | @@ -271,8 +267,6 @@ test "comptime bitcast used in expression has the correct type" { |
| 271 | 267 | } |
| 272 | 268 | |
| 273 | 269 | test "bitcast passed as tuple element" { |
| 274 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 275 | ||
| 276 | 270 | const S = struct { |
| 277 | 271 | fn foo(args: anytype) !void { |
| 278 | 272 | try comptime expect(@TypeOf(args[0]) == f32); |
| ... | ... | @@ -283,8 +277,6 @@ test "bitcast passed as tuple element" { |
| 283 | 277 | } |
| 284 | 278 | |
| 285 | 279 | test "triple level result location with bitcast sandwich passed as tuple element" { |
| 286 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 287 | ||
| 288 | 280 | const S = struct { |
| 289 | 281 | fn foo(args: anytype) !void { |
| 290 | 282 | try comptime expect(@TypeOf(args[0]) == f64); |
test/behavior/bugs/10684.zig-1| ... | ... | @@ -6,7 +6,6 @@ test "slicing slices" { |
| 6 | 6 | if (builtin.zig_backend == .stage2_x86) return error.SkipZigTest; // TODO |
| 7 | 7 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 8 | 8 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 9 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 10 | 9 | |
| 11 | 10 | const foo = "1234"; |
| 12 | 11 | const bar = foo[0..4]; |
test/behavior/bugs/1076.zig-1| ... | ... | @@ -6,7 +6,6 @@ const expect = std.testing.expect; |
| 6 | 6 | test "comptime code should not modify constant data" { |
| 7 | 7 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 8 | 8 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 9 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 10 | 9 | |
| 11 | 10 | try testCastPtrOfArrayToSliceAndPtr(); |
| 12 | 11 | try comptime testCastPtrOfArrayToSliceAndPtr(); |
test/behavior/bugs/11046.zig-1| ... | ... | @@ -13,7 +13,6 @@ test "fixed" { |
| 13 | 13 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 14 | 14 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 15 | 15 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 16 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 17 | 16 | |
| 18 | 17 | bar() catch |err| switch (err) { |
| 19 | 18 | error.Foo => {}, // error: expected (inferred error set of bar), found error{Foo} |
test/behavior/bugs/11139.zig-1| ... | ... | @@ -6,7 +6,6 @@ test "store array of array of structs at comptime" { |
| 6 | 6 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 7 | 7 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 8 | 8 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 9 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 10 | 9 | |
| 11 | 10 | try expect(storeArrayOfArrayOfStructs() == 15); |
| 12 | 11 | try comptime expect(storeArrayOfArrayOfStructs() == 15); |
test/behavior/bugs/11213.zig-2| ... | ... | @@ -3,8 +3,6 @@ const builtin = @import("builtin"); |
| 3 | 3 | const testing = std.testing; |
| 4 | 4 | |
| 5 | 5 | test { |
| 6 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 7 | ||
| 8 | 6 | const g: error{Test}!void = error.Test; |
| 9 | 7 | |
| 10 | 8 | var v: u32 = 0; |
test/behavior/bugs/11995.zig-1| ... | ... | @@ -20,7 +20,6 @@ test { |
| 20 | 20 | if (builtin.zig_backend == .stage2_x86) return error.SkipZigTest; // TODO |
| 21 | 21 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 22 | 22 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 23 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 24 | 23 | |
| 25 | 24 | var string: [5]u8 = "hello".*; |
| 26 | 25 | const arg_data = wuffs_base__slice_u8{ .ptr = @as([*c]u8, @ptrCast(&string)), .len = string.len }; |
test/behavior/bugs/12092.zig-1| ... | ... | @@ -17,7 +17,6 @@ test { |
| 17 | 17 | if (builtin.zig_backend == .stage2_x86) return error.SkipZigTest; // TODO |
| 18 | 18 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 19 | 19 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 20 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 21 | 20 | |
| 22 | 21 | var baz: u32 = 24; |
| 23 | 22 | try takeFoo(&.{ |
test/behavior/bugs/12142.zig-1| ... | ... | @@ -22,7 +22,6 @@ test { |
| 22 | 22 | if (builtin.zig_backend == .stage2_x86) return error.SkipZigTest; // TODO |
| 23 | 23 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 24 | 24 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 25 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 26 | 25 | |
| 27 | 26 | const test_struct = Test{ |
| 28 | 27 | .holders = &.{ |
test/behavior/bugs/12551.zig-1| ... | ... | @@ -4,7 +4,6 @@ const builtin = @import("builtin"); |
| 4 | 4 | test { |
| 5 | 5 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 6 | 6 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 7 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 8 | 7 | |
| 9 | 8 | try std.testing.expect(for ([1]u8{0}) |x| { |
| 10 | 9 | if (x == 0) break true; |
test/behavior/bugs/12644.zig-2| ... | ... | @@ -10,8 +10,6 @@ fn main0() !void { |
| 10 | 10 | } |
| 11 | 11 | |
| 12 | 12 | test "issue12644" { |
| 13 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 14 | ||
| 15 | 13 | main0() catch |e| { |
| 16 | 14 | try std.testing.expect(e == error.AnError); |
| 17 | 15 | }; |
test/behavior/bugs/12890.zig-1| ... | ... | @@ -11,7 +11,6 @@ fn a(b: []u3, c: u3) void { |
| 11 | 11 | test { |
| 12 | 12 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 13 | 13 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 14 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 15 | 14 | |
| 16 | 15 | var arr: [8]u3 = undefined; |
| 17 | 16 | a(&arr, 5); |
test/behavior/bugs/12891.zig-6| ... | ... | @@ -29,7 +29,6 @@ test "inf >= 1" { |
| 29 | 29 | test "isNan(nan * 1)" { |
| 30 | 30 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 31 | 31 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 32 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 33 | 32 | |
| 34 | 33 | const nan_times_one = comptime std.math.nan(f64) * 1; |
| 35 | 34 | try std.testing.expect(std.math.isNan(nan_times_one)); |
| ... | ... | @@ -37,7 +36,6 @@ test "isNan(nan * 1)" { |
| 37 | 36 | test "runtime isNan(nan * 1)" { |
| 38 | 37 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 39 | 38 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 40 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 41 | 39 | |
| 42 | 40 | const nan_times_one = std.math.nan(f64) * 1; |
| 43 | 41 | try std.testing.expect(std.math.isNan(nan_times_one)); |
| ... | ... | @@ -45,7 +43,6 @@ test "runtime isNan(nan * 1)" { |
| 45 | 43 | test "isNan(nan * 0)" { |
| 46 | 44 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 47 | 45 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 48 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 49 | 46 | |
| 50 | 47 | const nan_times_zero = comptime std.math.nan(f64) * 0; |
| 51 | 48 | try std.testing.expect(std.math.isNan(nan_times_zero)); |
| ... | ... | @@ -55,7 +52,6 @@ test "isNan(nan * 0)" { |
| 55 | 52 | test "isNan(inf * 0)" { |
| 56 | 53 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 57 | 54 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 58 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 59 | 55 | |
| 60 | 56 | const inf_times_zero = comptime std.math.inf(f64) * 0; |
| 61 | 57 | try std.testing.expect(std.math.isNan(inf_times_zero)); |
| ... | ... | @@ -65,7 +61,6 @@ test "isNan(inf * 0)" { |
| 65 | 61 | test "runtime isNan(nan * 0)" { |
| 66 | 62 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 67 | 63 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 68 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 69 | 64 | |
| 70 | 65 | const nan_times_zero = std.math.nan(f64) * 0; |
| 71 | 66 | try std.testing.expect(std.math.isNan(nan_times_zero)); |
| ... | ... | @@ -75,7 +70,6 @@ test "runtime isNan(nan * 0)" { |
| 75 | 70 | test "runtime isNan(inf * 0)" { |
| 76 | 71 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 77 | 72 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 78 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 79 | 73 | |
| 80 | 74 | const inf_times_zero = std.math.inf(f64) * 0; |
| 81 | 75 | try std.testing.expect(std.math.isNan(inf_times_zero)); |
test/behavior/bugs/12972.zig-1| ... | ... | @@ -6,7 +6,6 @@ test { |
| 6 | 6 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 7 | 7 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 8 | 8 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 9 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 10 | 9 | |
| 11 | 10 | const c: u8 = 42; |
| 12 | 11 | f(&[_:null]?u8{c}); |
test/behavior/bugs/13064.zig-1| ... | ... | @@ -6,7 +6,6 @@ test { |
| 6 | 6 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 7 | 7 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 8 | 8 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 9 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 10 | 9 | |
| 11 | 10 | var x: [10][10]u32 = undefined; |
| 12 | 11 |
test/behavior/bugs/13065.zig-1| ... | ... | @@ -11,7 +11,6 @@ test { |
| 11 | 11 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 12 | 12 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 13 | 13 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 14 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 15 | 14 | |
| 16 | 15 | var x = U{ .array = undefined }; |
| 17 | 16 |
test/behavior/bugs/13366.zig-1| ... | ... | @@ -16,7 +16,6 @@ test { |
| 16 | 16 | if (builtin.zig_backend == .stage2_x86) return error.SkipZigTest; // TODO |
| 17 | 17 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 18 | 18 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 19 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 20 | 19 | |
| 21 | 20 | var a: u32 = 16; |
| 22 | 21 | var reason = .{ .c_import = .{ .a = a } }; |
test/behavior/bugs/1381.zig-1| ... | ... | @@ -15,7 +15,6 @@ test "union that needs padding bytes inside an array" { |
| 15 | 15 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 16 | 16 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 17 | 17 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 18 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 19 | 18 | |
| 20 | 19 | var as = [_]A{ |
| 21 | 20 | A{ .B = B{ .D = 1 } }, |
test/behavior/bugs/1442.zig-1| ... | ... | @@ -10,7 +10,6 @@ test "const error union field alignment" { |
| 10 | 10 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 11 | 11 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 12 | 12 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 13 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 14 | 13 | |
| 15 | 14 | var union_or_err: anyerror!Union = Union{ .Color = 1234 }; |
| 16 | 15 | try std.testing.expect((union_or_err catch unreachable).Color == 1234); |
test/behavior/bugs/1607.zig-1| ... | ... | @@ -14,7 +14,6 @@ test "slices pointing at the same address as global array." { |
| 14 | 14 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 15 | 15 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 16 | 16 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 17 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 18 | 17 | |
| 19 | 18 | try checkAddress(&a); |
| 20 | 19 | try comptime checkAddress(&a); |
test/behavior/bugs/1741.zig+1-1| ... | ... | @@ -4,7 +4,7 @@ const builtin = @import("builtin"); |
| 4 | 4 | test "fixed" { |
| 5 | 5 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 6 | 6 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 7 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 7 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; // flaky | |
| 8 | 8 | |
| 9 | 9 | const x: f32 align(128) = 12.34; |
| 10 | 10 | try std.testing.expect(@intFromPtr(&x) % 128 == 0); |
test/behavior/bugs/2346.zig+2| ... | ... | @@ -1,3 +1,5 @@ |
| 1 | const builtin = @import("builtin"); | |
| 2 | ||
| 1 | 3 | test "fixed" { |
| 2 | 4 | const a: *void = undefined; |
| 3 | 5 | const b: *[1]void = a; |
test/behavior/bugs/2578.zig-1| ... | ... | @@ -15,7 +15,6 @@ test "fixed" { |
| 15 | 15 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 16 | 16 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 17 | 17 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 18 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 19 | 18 | |
| 20 | 19 | bar(t); |
| 21 | 20 | } |
test/behavior/bugs/2692.zig-1| ... | ... | @@ -7,7 +7,6 @@ fn foo(a: []u8) void { |
| 7 | 7 | test "address of 0 length array" { |
| 8 | 8 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 9 | 9 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 10 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 11 | 10 | |
| 12 | 11 | var pt: [0]u8 = undefined; |
| 13 | 12 | foo(&pt); |
test/behavior/bugs/3046.zig-1| ... | ... | @@ -16,7 +16,6 @@ test "fixed" { |
| 16 | 16 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 17 | 17 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 18 | 18 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 19 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 20 | 19 | |
| 21 | 20 | some_struct = SomeStruct{ |
| 22 | 21 | .field = couldFail() catch @as(i32, 0), |
test/behavior/bugs/3367.zig-2| ... | ... | @@ -10,8 +10,6 @@ const Mixin = struct { |
| 10 | 10 | }; |
| 11 | 11 | |
| 12 | 12 | test "container member access usingnamespace decls" { |
| 13 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 14 | ||
| 15 | 13 | var foo = Foo{}; |
| 16 | 14 | foo.two(); |
| 17 | 15 | } |
test/behavior/bugs/3742.zig-1| ... | ... | @@ -40,7 +40,6 @@ test "fixed" { |
| 40 | 40 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 41 | 41 | if (builtin.zig_backend == .stage2_llvm and |
| 42 | 42 | builtin.cpu.arch == .aarch64 and builtin.os.tag == .windows) return error.SkipZigTest; |
| 43 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 44 | 43 | |
| 45 | 44 | ArgSerializer.serializeCommand(GET.init("banana")); |
| 46 | 45 | } |
test/behavior/bugs/3779.zig-3| ... | ... | @@ -34,7 +34,6 @@ const ptr_type_name: [*:0]const u8 = type_name; |
| 34 | 34 | test "@typeName() returns a string literal" { |
| 35 | 35 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 36 | 36 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 37 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 38 | 37 | |
| 39 | 38 | try std.testing.expect(*const [type_name.len:0]u8 == @TypeOf(type_name)); |
| 40 | 39 | try std.testing.expect(std.mem.eql(u8, "behavior.bugs.3779.TestType", type_name)); |
| ... | ... | @@ -48,7 +47,6 @@ const expected_contents = "hello zig\n"; |
| 48 | 47 | test "@embedFile() returns a string literal" { |
| 49 | 48 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 50 | 49 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 51 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 52 | 50 | |
| 53 | 51 | try std.testing.expect(*const [expected_contents.len:0]u8 == @TypeOf(actual_contents)); |
| 54 | 52 | try std.testing.expect(std.mem.eql(u8, expected_contents, actual_contents)); |
| ... | ... | @@ -63,7 +61,6 @@ fn testFnForSrc() std.builtin.SourceLocation { |
| 63 | 61 | test "@src() returns a struct containing 0-terminated string slices" { |
| 64 | 62 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 65 | 63 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 66 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 67 | 64 | |
| 68 | 65 | const src = testFnForSrc(); |
| 69 | 66 | try std.testing.expect([:0]const u8 == @TypeOf(src.file)); |
test/behavior/bugs/5487.zig-1| ... | ... | @@ -13,6 +13,5 @@ test "crash" { |
| 13 | 13 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 14 | 14 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 15 | 15 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 16 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 17 | 16 | _ = io.multiWriter(.{writer()}); |
| 18 | 17 | } |
test/behavior/bugs/6905.zig-1| ... | ... | @@ -5,7 +5,6 @@ test "sentinel-terminated 0-length slices" { |
| 5 | 5 | if (builtin.zig_backend == .stage2_x86) return error.SkipZigTest; // TODO |
| 6 | 6 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 7 | 7 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 8 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 9 | 8 | |
| 10 | 9 | var u32s: [4]u32 = [_]u32{ 0, 1, 2, 3 }; |
| 11 | 10 |
test/behavior/bugs/726.zig-2| ... | ... | @@ -5,7 +5,6 @@ test "@ptrCast from const to nullable" { |
| 5 | 5 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 6 | 6 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 7 | 7 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 8 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 9 | 8 | |
| 10 | 9 | const c: u8 = 4; |
| 11 | 10 | var x: ?*const u8 = @as(?*const u8, @ptrCast(&c)); |
| ... | ... | @@ -16,7 +15,6 @@ test "@ptrCast from var in empty struct to nullable" { |
| 16 | 15 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 17 | 16 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 18 | 17 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 19 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 20 | 18 | |
| 21 | 19 | const container = struct { |
| 22 | 20 | var c: u8 = 4; |
test/behavior/bugs/8646.zig-1| ... | ... | @@ -10,7 +10,6 @@ test { |
| 10 | 10 | if (builtin.zig_backend == .stage2_x86) return error.SkipZigTest; // TODO |
| 11 | 11 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 12 | 12 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 13 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 14 | 13 | |
| 15 | 14 | try std.testing.expect(array[0].len == 1); |
| 16 | 15 | try std.testing.expectEqualStrings("hello", array[0][0]); |
test/behavior/call.zig-6| ... | ... | @@ -90,7 +90,6 @@ test "result location of function call argument through runtime condition and st |
| 90 | 90 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 91 | 91 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 92 | 92 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 93 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 94 | 93 | |
| 95 | 94 | const E = enum { a, b }; |
| 96 | 95 | const S = struct { |
| ... | ... | @@ -400,7 +399,6 @@ test "recursive inline call with comptime known argument" { |
| 400 | 399 | test "inline while with @call" { |
| 401 | 400 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 402 | 401 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 403 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 404 | 402 | |
| 405 | 403 | const S = struct { |
| 406 | 404 | fn inc(a: *u32) void { |
| ... | ... | @@ -416,8 +414,6 @@ test "inline while with @call" { |
| 416 | 414 | } |
| 417 | 415 | |
| 418 | 416 | test "method call as parameter type" { |
| 419 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 420 | ||
| 421 | 417 | const S = struct { |
| 422 | 418 | fn foo(x: anytype, y: @TypeOf(x).Inner()) @TypeOf(y) { |
| 423 | 419 | return y; |
| ... | ... | @@ -436,7 +432,6 @@ test "non-anytype generic parameters provide result type" { |
| 436 | 432 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 437 | 433 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 438 | 434 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 439 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; // TODO | |
| 440 | 435 | |
| 441 | 436 | const S = struct { |
| 442 | 437 | fn f(comptime T: type, y: T) !void { |
| ... | ... | @@ -467,7 +462,6 @@ test "argument to generic function has correct result type" { |
| 467 | 462 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 468 | 463 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 469 | 464 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 470 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; // TODO | |
| 471 | 465 | |
| 472 | 466 | const S = struct { |
| 473 | 467 | fn foo(_: anytype, e: enum { a, b }) bool { |
test/behavior/cast.zig+3-55| ... | ... | @@ -67,6 +67,8 @@ test "implicit cast comptime_int to comptime_float" { |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | test "comptime_int @floatFromInt" { |
| 70 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 71 | ||
| 70 | 72 | { |
| 71 | 73 | const result = @as(f16, @floatFromInt(1234)); |
| 72 | 74 | try expect(@TypeOf(result) == f16); |
| ... | ... | @@ -179,7 +181,6 @@ fn expectIntFromFloat(comptime F: type, f: F, comptime I: type, i: I) !void { |
| 179 | 181 | test "implicitly cast indirect pointer to maybe-indirect pointer" { |
| 180 | 182 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 181 | 183 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 182 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 183 | 184 | |
| 184 | 185 | const S = struct { |
| 185 | 186 | const Self = @This(); |
| ... | ... | @@ -240,7 +241,6 @@ test "coerce undefined to optional" { |
| 240 | 241 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 241 | 242 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 242 | 243 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 243 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 244 | 244 | |
| 245 | 245 | try expect(MakeType(void).getNull() == null); |
| 246 | 246 | try expect(MakeType(void).getNonNull() != null); |
| ... | ... | @@ -261,7 +261,6 @@ fn MakeType(comptime T: type) type { |
| 261 | 261 | test "implicit cast from *[N]T to [*c]T" { |
| 262 | 262 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 263 | 263 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 264 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 265 | 264 | |
| 266 | 265 | var x: [4]u16 = [4]u16{ 0, 1, 2, 3 }; |
| 267 | 266 | var y: [*c]u16 = &x; |
| ... | ... | @@ -273,8 +272,6 @@ test "implicit cast from *[N]T to [*c]T" { |
| 273 | 272 | } |
| 274 | 273 | |
| 275 | 274 | test "*usize to *void" { |
| 276 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 277 | ||
| 278 | 275 | var i = @as(usize, 0); |
| 279 | 276 | var v = @as(*void, @ptrCast(&i)); |
| 280 | 277 | v.* = {}; |
| ... | ... | @@ -390,7 +387,6 @@ test "cast from ?[*]T to ??[*]T" { |
| 390 | 387 | test "peer type unsigned int to signed" { |
| 391 | 388 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 392 | 389 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 393 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 394 | 390 | |
| 395 | 391 | var w: u31 = 5; |
| 396 | 392 | var x: u8 = 7; |
| ... | ... | @@ -469,7 +465,6 @@ fn castToOptionalTypeError(z: i32) !void { |
| 469 | 465 | test "implicitly cast from [0]T to anyerror![]T" { |
| 470 | 466 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 471 | 467 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 472 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 473 | 468 | |
| 474 | 469 | try testCastZeroArrayToErrSliceMut(); |
| 475 | 470 | try comptime testCastZeroArrayToErrSliceMut(); |
| ... | ... | @@ -487,7 +482,6 @@ test "peer type resolution: [0]u8, []const u8, and anyerror![]u8" { |
| 487 | 482 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 488 | 483 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 489 | 484 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 490 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 491 | 485 | |
| 492 | 486 | const S = struct { |
| 493 | 487 | fn doTheTest() anyerror!void { |
| ... | ... | @@ -568,7 +562,6 @@ fn testPeerErrorAndArray2(x: u8) anyerror![]const u8 { |
| 568 | 562 | test "single-item pointer of array to slice to unknown length pointer" { |
| 569 | 563 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 570 | 564 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 571 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 572 | 565 | |
| 573 | 566 | try testCastPtrOfArrayToSliceAndPtr(); |
| 574 | 567 | try comptime testCastPtrOfArrayToSliceAndPtr(); |
| ... | ... | @@ -598,7 +591,6 @@ fn testCastPtrOfArrayToSliceAndPtr() !void { |
| 598 | 591 | test "cast *[1][*]const u8 to [*]const ?[*]const u8" { |
| 599 | 592 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 600 | 593 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 601 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 602 | 594 | |
| 603 | 595 | const window_name = [1][*]const u8{"window name"}; |
| 604 | 596 | const x: [*]const ?[*]const u8 = &window_name; |
| ... | ... | @@ -653,7 +645,6 @@ test "@floatCast cast down" { |
| 653 | 645 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 654 | 646 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 655 | 647 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 656 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 657 | 648 | |
| 658 | 649 | { |
| 659 | 650 | var double: f64 = 0.001534; |
| ... | ... | @@ -670,7 +661,6 @@ test "@floatCast cast down" { |
| 670 | 661 | test "peer type resolution: unreachable, error set, unreachable" { |
| 671 | 662 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 672 | 663 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 673 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 674 | 664 | |
| 675 | 665 | const Error = error{ |
| 676 | 666 | FileDescriptorAlreadyPresentInSet, |
| ... | ... | @@ -829,7 +819,6 @@ test "peer cast *[0]T to E![]const T" { |
| 829 | 819 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 830 | 820 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 831 | 821 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 832 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 833 | 822 | |
| 834 | 823 | var buffer: [5]u8 = "abcde".*; |
| 835 | 824 | var buf: anyerror![]const u8 = buffer[0..]; |
| ... | ... | @@ -844,7 +833,6 @@ test "peer cast *[0]T to []const T" { |
| 844 | 833 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 845 | 834 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 846 | 835 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 847 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 848 | 836 | |
| 849 | 837 | var buffer: [5]u8 = "abcde".*; |
| 850 | 838 | var buf: []const u8 = buffer[0..]; |
| ... | ... | @@ -866,7 +854,6 @@ test "peer resolution of string literals" { |
| 866 | 854 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 867 | 855 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 868 | 856 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 869 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 870 | 857 | |
| 871 | 858 | const S = struct { |
| 872 | 859 | const E = enum { a, b, c, d }; |
| ... | ... | @@ -888,7 +875,6 @@ test "peer resolution of string literals" { |
| 888 | 875 | test "peer cast [:x]T to []T" { |
| 889 | 876 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 890 | 877 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 891 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 892 | 878 | |
| 893 | 879 | const S = struct { |
| 894 | 880 | fn doTheTest() !void { |
| ... | ... | @@ -905,7 +891,6 @@ test "peer cast [:x]T to []T" { |
| 905 | 891 | test "peer cast [N:x]T to [N]T" { |
| 906 | 892 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 907 | 893 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 908 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 909 | 894 | |
| 910 | 895 | const S = struct { |
| 911 | 896 | fn doTheTest() !void { |
| ... | ... | @@ -1102,7 +1087,6 @@ test "implicit cast from [*]T to ?*anyopaque" { |
| 1102 | 1087 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 1103 | 1088 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 1104 | 1089 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1105 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 1106 | 1090 | |
| 1107 | 1091 | var a = [_]u8{ 3, 2, 1 }; |
| 1108 | 1092 | var runtime_zero: usize = 0; |
| ... | ... | @@ -1165,7 +1149,6 @@ test "implicit ptr to *anyopaque" { |
| 1165 | 1149 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 1166 | 1150 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 1167 | 1151 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1168 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 1169 | 1152 | |
| 1170 | 1153 | var a: u32 = 1; |
| 1171 | 1154 | var ptr: *align(@alignOf(u32)) anyopaque = &a; |
| ... | ... | @@ -1179,7 +1162,6 @@ test "implicit ptr to *anyopaque" { |
| 1179 | 1162 | test "return null from fn () anyerror!?&T" { |
| 1180 | 1163 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 1181 | 1164 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1182 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 1183 | 1165 | |
| 1184 | 1166 | const a = returnNullFromOptionalTypeErrorRef(); |
| 1185 | 1167 | const b = returnNullLitFromOptionalTypeErrorRef(); |
| ... | ... | @@ -1196,7 +1178,6 @@ fn returnNullLitFromOptionalTypeErrorRef() anyerror!?*A { |
| 1196 | 1178 | test "peer type resolution: [0]u8 and []const u8" { |
| 1197 | 1179 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 1198 | 1180 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1199 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 1200 | 1181 | |
| 1201 | 1182 | try expect(peerTypeEmptyArrayAndSlice(true, "hi").len == 0); |
| 1202 | 1183 | try expect(peerTypeEmptyArrayAndSlice(false, "hi").len == 1); |
| ... | ... | @@ -1217,7 +1198,6 @@ test "implicitly cast from [N]T to ?[]const T" { |
| 1217 | 1198 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 1218 | 1199 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 1219 | 1200 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1220 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 1221 | 1201 | |
| 1222 | 1202 | try expect(mem.eql(u8, castToOptionalSlice().?, "hi")); |
| 1223 | 1203 | try comptime expect(mem.eql(u8, castToOptionalSlice().?, "hi")); |
| ... | ... | @@ -1269,7 +1249,6 @@ test "implicit cast from *T to ?*anyopaque" { |
| 1269 | 1249 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 1270 | 1250 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 1271 | 1251 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1272 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 1273 | 1252 | |
| 1274 | 1253 | var a: u8 = 1; |
| 1275 | 1254 | incrementVoidPtrValue(&a); |
| ... | ... | @@ -1283,7 +1262,6 @@ fn incrementVoidPtrValue(value: ?*anyopaque) void { |
| 1283 | 1262 | test "implicit cast *[0]T to E![]const u8" { |
| 1284 | 1263 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 1285 | 1264 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1286 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 1287 | 1265 | |
| 1288 | 1266 | var x = @as(anyerror![]const u8, &[0]u8{}); |
| 1289 | 1267 | try expect((x catch unreachable).len == 0); |
| ... | ... | @@ -1303,7 +1281,6 @@ test "*const [N]null u8 to ?[]const u8" { |
| 1303 | 1281 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 1304 | 1282 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 1305 | 1283 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1306 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 1307 | 1284 | |
| 1308 | 1285 | const S = struct { |
| 1309 | 1286 | fn doTheTest() !void { |
| ... | ... | @@ -1339,15 +1316,12 @@ test "assignment to optional pointer result loc" { |
| 1339 | 1316 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 1340 | 1317 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 1341 | 1318 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1342 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 1343 | 1319 | |
| 1344 | 1320 | var foo: struct { ptr: ?*anyopaque } = .{ .ptr = &global_struct }; |
| 1345 | 1321 | try expect(foo.ptr.? == @as(*anyopaque, @ptrCast(&global_struct))); |
| 1346 | 1322 | } |
| 1347 | 1323 | |
| 1348 | 1324 | test "cast between *[N]void and []void" { |
| 1349 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 1350 | ||
| 1351 | 1325 | var a: [4]void = undefined; |
| 1352 | 1326 | var b: []void = &a; |
| 1353 | 1327 | try expect(b.len == 4); |
| ... | ... | @@ -1409,7 +1383,6 @@ test "peer type resolution: unreachable, null, slice" { |
| 1409 | 1383 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 1410 | 1384 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 1411 | 1385 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1412 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 1413 | 1386 | |
| 1414 | 1387 | const S = struct { |
| 1415 | 1388 | fn doTheTest(num: usize, word: []const u8) !void { |
| ... | ... | @@ -1449,7 +1422,6 @@ test "cast compatible optional types" { |
| 1449 | 1422 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 1450 | 1423 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 1451 | 1424 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1452 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 1453 | 1425 | |
| 1454 | 1426 | var a: ?[:0]const u8 = null; |
| 1455 | 1427 | var b: ?[]const u8 = a; |
| ... | ... | @@ -1533,7 +1505,6 @@ test "cast typed undefined to int" { |
| 1533 | 1505 | |
| 1534 | 1506 | test "implicit cast from [:0]T to [*c]T" { |
| 1535 | 1507 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 1536 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 1537 | 1508 | |
| 1538 | 1509 | var a: [:0]const u8 = "foo"; |
| 1539 | 1510 | var b: [*c]const u8 = a; |
| ... | ... | @@ -1544,6 +1515,7 @@ test "implicit cast from [:0]T to [*c]T" { |
| 1544 | 1515 | |
| 1545 | 1516 | test "bitcast packed struct with u0" { |
| 1546 | 1517 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 1518 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 1547 | 1519 | |
| 1548 | 1520 | const S = packed struct(u2) { a: u0, b: u2 }; |
| 1549 | 1521 | const s = @as(S, @bitCast(@as(u2, 2))); |
| ... | ... | @@ -1571,8 +1543,6 @@ test "single item pointer to pointer to array to slice" { |
| 1571 | 1543 | } |
| 1572 | 1544 | |
| 1573 | 1545 | test "peer type resolution forms error union" { |
| 1574 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 1575 | ||
| 1576 | 1546 | var foo: i32 = 123; |
| 1577 | 1547 | const result = if (foo < 0) switch (-foo) { |
| 1578 | 1548 | 0 => unreachable, |
| ... | ... | @@ -1610,7 +1580,6 @@ test "peer type resolution: const sentinel slice and mutable non-sentinel slice" |
| 1610 | 1580 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 1611 | 1581 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 1612 | 1582 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1613 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; // TODO | |
| 1614 | 1583 | |
| 1615 | 1584 | const S = struct { |
| 1616 | 1585 | fn doTheTest(comptime T: type, comptime s: T) !void { |
| ... | ... | @@ -1639,7 +1608,6 @@ test "peer type resolution: float and comptime-known fixed-width integer" { |
| 1639 | 1608 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 1640 | 1609 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO |
| 1641 | 1610 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1642 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; // TODO | |
| 1643 | 1611 | |
| 1644 | 1612 | const i: u8 = 100; |
| 1645 | 1613 | var f: f32 = 1.234; |
| ... | ... | @@ -1660,7 +1628,6 @@ test "peer type resolution: same array type with sentinel" { |
| 1660 | 1628 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 1661 | 1629 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 1662 | 1630 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1663 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; // TODO | |
| 1664 | 1631 | |
| 1665 | 1632 | var a: [2:0]u32 = .{ 0, 1 }; |
| 1666 | 1633 | var b: [2:0]u32 = .{ 2, 3 }; |
| ... | ... | @@ -1681,7 +1648,6 @@ test "peer type resolution: array with sentinel and array without sentinel" { |
| 1681 | 1648 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 1682 | 1649 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 1683 | 1650 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1684 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; // TODO | |
| 1685 | 1651 | |
| 1686 | 1652 | var a: [2:0]u32 = .{ 0, 1 }; |
| 1687 | 1653 | var b: [2]u32 = .{ 2, 3 }; |
| ... | ... | @@ -1702,7 +1668,6 @@ test "peer type resolution: array and vector with same child type" { |
| 1702 | 1668 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 1703 | 1669 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 1704 | 1670 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1705 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; // TODO | |
| 1706 | 1671 | |
| 1707 | 1672 | var arr: [2]u32 = .{ 0, 1 }; |
| 1708 | 1673 | var vec: @Vector(2, u32) = .{ 2, 3 }; |
| ... | ... | @@ -1746,7 +1711,6 @@ test "peer type resolution: error union and optional of same type" { |
| 1746 | 1711 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 1747 | 1712 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 1748 | 1713 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1749 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; // TODO | |
| 1750 | 1714 | |
| 1751 | 1715 | const E = error{Foo}; |
| 1752 | 1716 | var a: E!*u8 = error.Foo; |
| ... | ... | @@ -1768,7 +1732,6 @@ test "peer type resolution: C pointer and @TypeOf(null)" { |
| 1768 | 1732 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 1769 | 1733 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 1770 | 1734 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1771 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; // TODO | |
| 1772 | 1735 | |
| 1773 | 1736 | var a: [*c]c_int = 0x1000; |
| 1774 | 1737 | const b = null; |
| ... | ... | @@ -1789,7 +1752,6 @@ test "peer type resolution: three-way resolution combines error set and optional |
| 1789 | 1752 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 1790 | 1753 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 1791 | 1754 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1792 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; // TODO | |
| 1793 | 1755 | |
| 1794 | 1756 | const E = error{Foo}; |
| 1795 | 1757 | var a: E = error.Foo; |
| ... | ... | @@ -1852,7 +1814,6 @@ test "peer type resolution: optional fixed-width int and comptime_int" { |
| 1852 | 1814 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 1853 | 1815 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 1854 | 1816 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1855 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; // TODO | |
| 1856 | 1817 | |
| 1857 | 1818 | var a: ?i32 = 42; |
| 1858 | 1819 | const b: comptime_int = 50; |
| ... | ... | @@ -1873,7 +1834,6 @@ test "peer type resolution: array and tuple" { |
| 1873 | 1834 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 1874 | 1835 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 1875 | 1836 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1876 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; // TODO | |
| 1877 | 1837 | |
| 1878 | 1838 | var arr: [3]i32 = .{ 1, 2, 3 }; |
| 1879 | 1839 | const tup = .{ 4, 5, 6 }; |
| ... | ... | @@ -1896,7 +1856,6 @@ test "peer type resolution: vector and tuple" { |
| 1896 | 1856 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 1897 | 1857 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO |
| 1898 | 1858 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1899 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; // TODO | |
| 1900 | 1859 | |
| 1901 | 1860 | var vec: @Vector(3, i32) = .{ 1, 2, 3 }; |
| 1902 | 1861 | const tup = .{ 4, 5, 6 }; |
| ... | ... | @@ -1919,7 +1878,6 @@ test "peer type resolution: vector and array and tuple" { |
| 1919 | 1878 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 1920 | 1879 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO |
| 1921 | 1880 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1922 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; // TODO | |
| 1923 | 1881 | |
| 1924 | 1882 | var vec: @Vector(2, i8) = .{ 10, 20 }; |
| 1925 | 1883 | var arr: [2]i8 = .{ 30, 40 }; |
| ... | ... | @@ -1960,7 +1918,6 @@ test "peer type resolution: empty tuple pointer and slice" { |
| 1960 | 1918 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 1961 | 1919 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 1962 | 1920 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1963 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; // TODO | |
| 1964 | 1921 | |
| 1965 | 1922 | var a: [:0]const u8 = "Hello"; |
| 1966 | 1923 | var b = &.{}; |
| ... | ... | @@ -1980,7 +1937,6 @@ test "peer type resolution: tuple pointer and slice" { |
| 1980 | 1937 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 1981 | 1938 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 1982 | 1939 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1983 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; // TODO | |
| 1984 | 1940 | |
| 1985 | 1941 | var a: [:0]const u8 = "Hello"; |
| 1986 | 1942 | var b = &.{ @as(u8, 'x'), @as(u8, 'y'), @as(u8, 'z') }; |
| ... | ... | @@ -2000,7 +1956,6 @@ test "peer type resolution: tuple pointer and optional slice" { |
| 2000 | 1956 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 2001 | 1957 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 2002 | 1958 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 2003 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; // TODO | |
| 2004 | 1959 | |
| 2005 | 1960 | var a: ?[:0]const u8 = null; |
| 2006 | 1961 | var b = &.{ @as(u8, 'x'), @as(u8, 'y'), @as(u8, 'z') }; |
| ... | ... | @@ -2116,7 +2071,6 @@ test "peer type resolution: C pointer and many pointer" { |
| 2116 | 2071 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 2117 | 2072 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 2118 | 2073 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 2119 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; // TODO | |
| 2120 | 2074 | |
| 2121 | 2075 | var buf = "hello".*; |
| 2122 | 2076 | |
| ... | ... | @@ -2138,7 +2092,6 @@ test "peer type resolution: pointer attributes are combined correctly" { |
| 2138 | 2092 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 2139 | 2093 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 2140 | 2094 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 2141 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; // TODO | |
| 2142 | 2095 | |
| 2143 | 2096 | var buf_a align(4) = "foo".*; |
| 2144 | 2097 | var buf_b align(4) = "bar".*; |
| ... | ... | @@ -2181,7 +2134,6 @@ test "cast builtins can wrap result in optional" { |
| 2181 | 2134 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 2182 | 2135 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 2183 | 2136 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 2184 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; // TODO | |
| 2185 | 2137 | |
| 2186 | 2138 | const S = struct { |
| 2187 | 2139 | const MyEnum = enum(u32) { _ }; |
| ... | ... | @@ -2257,7 +2209,6 @@ test "cast builtins can wrap result in error union and optional" { |
| 2257 | 2209 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 2258 | 2210 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 2259 | 2211 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 2260 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; // TODO | |
| 2261 | 2212 | |
| 2262 | 2213 | const S = struct { |
| 2263 | 2214 | const MyEnum = enum(u32) { _ }; |
| ... | ... | @@ -2422,7 +2373,6 @@ test "@intFromBool on vector" { |
| 2422 | 2373 | |
| 2423 | 2374 | test "numeric coercions with undefined" { |
| 2424 | 2375 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| 2425 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 2426 | 2376 | |
| 2427 | 2377 | const from: i32 = undefined; |
| 2428 | 2378 | var to: f32 = from; |
| ... | ... | @@ -2434,7 +2384,6 @@ test "numeric coercions with undefined" { |
| 2434 | 2384 | test "15-bit int to float" { |
| 2435 | 2385 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; |
| 2436 | 2386 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| 2437 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 2438 | 2387 | |
| 2439 | 2388 | var a: u15 = 42; |
| 2440 | 2389 | var b: f32 = @floatFromInt(a); |
| ... | ... | @@ -2462,7 +2411,6 @@ test "result information is preserved through many nested structures" { |
| 2462 | 2411 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 2463 | 2412 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 2464 | 2413 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 2465 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 2466 | 2414 | |
| 2467 | 2415 | const S = struct { |
| 2468 | 2416 | fn doTheTest() !void { |
test/behavior/cast_int.zig+3| ... | ... | @@ -149,6 +149,8 @@ const Piece = packed struct { |
| 149 | 149 | |
| 150 | 150 | test "load non byte-sized optional value" { |
| 151 | 151 | // Originally reported at https://github.com/ziglang/zig/issues/14200 |
| 152 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 153 | ||
| 152 | 154 | // note: this bug is triggered by the == operator, expectEqual will hide it |
| 153 | 155 | var opt: ?Piece = try Piece.charToPiece('p'); |
| 154 | 156 | try expect(opt.?.type == .PAWN); |
| ... | ... | @@ -162,6 +164,7 @@ test "load non byte-sized optional value" { |
| 162 | 164 | |
| 163 | 165 | test "load non byte-sized value in struct" { |
| 164 | 166 | if (builtin.cpu.arch.endian() != .Little) return error.SkipZigTest; // packed struct TODO |
| 167 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 165 | 168 | |
| 166 | 169 | // note: this bug is triggered by the == operator, expectEqual will hide it |
| 167 | 170 | // using ptrCast not to depend on unitialised memory state |
test/behavior/comptime_memory.zig-4| ... | ... | @@ -426,8 +426,6 @@ test "mutate entire slice at comptime" { |
| 426 | 426 | } |
| 427 | 427 | |
| 428 | 428 | test "dereference undefined pointer to zero-bit type" { |
| 429 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 430 | ||
| 431 | 429 | const p0: *void = undefined; |
| 432 | 430 | try testing.expectEqual({}, p0.*); |
| 433 | 431 | |
| ... | ... | @@ -436,8 +434,6 @@ test "dereference undefined pointer to zero-bit type" { |
| 436 | 434 | } |
| 437 | 435 | |
| 438 | 436 | test "type pun extern struct" { |
| 439 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 440 | ||
| 441 | 437 | const S = extern struct { f: u8 }; |
| 442 | 438 | comptime var s = S{ .f = 123 }; |
| 443 | 439 | @as(*u8, @ptrCast(&s)).* = 72; |
test/behavior/const_slice_child.zig-1| ... | ... | @@ -10,7 +10,6 @@ test "const slice child" { |
| 10 | 10 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 11 | 11 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 12 | 12 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 13 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 14 | 13 | |
| 15 | 14 | const strs = [_][*]const u8{ "one", "two", "three" }; |
| 16 | 15 | argv = &strs; |
test/behavior/defer.zig-3| ... | ... | @@ -34,7 +34,6 @@ test "defer and labeled break" { |
| 34 | 34 | test "errdefer does not apply to fn inside fn" { |
| 35 | 35 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 36 | 36 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 37 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 38 | 37 | |
| 39 | 38 | if (testNestedFnErrDefer()) |_| @panic("expected error") else |e| try expect(e == error.Bad); |
| 40 | 39 | } |
| ... | ... | @@ -95,7 +94,6 @@ test "mixing normal and error defers" { |
| 95 | 94 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 96 | 95 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 97 | 96 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 98 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 99 | 97 | |
| 100 | 98 | try expect(runSomeErrorDefers(true) catch unreachable); |
| 101 | 99 | try expect(result[0] == 'c'); |
| ... | ... | @@ -160,7 +158,6 @@ test "reference to errdefer payload" { |
| 160 | 158 | test "simple else prong doesn't emit an error for unreachable else prong" { |
| 161 | 159 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 162 | 160 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 163 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 164 | 161 | |
| 165 | 162 | const S = struct { |
| 166 | 163 | fn foo() error{Foo}!void { |
test/behavior/empty_union.zig-4| ... | ... | @@ -44,8 +44,6 @@ test "empty extern union" { |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | test "empty union passed as argument" { |
| 47 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 48 | ||
| 49 | 47 | const U = union(enum) { |
| 50 | 48 | fn f(u: @This()) void { |
| 51 | 49 | switch (u) {} |
| ... | ... | @@ -55,8 +53,6 @@ test "empty union passed as argument" { |
| 55 | 53 | } |
| 56 | 54 | |
| 57 | 55 | test "empty enum passed as argument" { |
| 58 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 59 | ||
| 60 | 56 | const E = enum { |
| 61 | 57 | fn f(e: @This()) void { |
| 62 | 58 | switch (e) {} |
test/behavior/enum.zig-8| ... | ... | @@ -617,7 +617,6 @@ test "enum with specified tag values" { |
| 617 | 617 | test "non-exhaustive enum" { |
| 618 | 618 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 619 | 619 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 620 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 621 | 620 | |
| 622 | 621 | const S = struct { |
| 623 | 622 | const E = enum(u8) { a, b, _ }; |
| ... | ... | @@ -660,8 +659,6 @@ test "non-exhaustive enum" { |
| 660 | 659 | } |
| 661 | 660 | |
| 662 | 661 | test "empty non-exhaustive enum" { |
| 663 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 664 | ||
| 665 | 662 | const S = struct { |
| 666 | 663 | const E = enum(u8) { _ }; |
| 667 | 664 | |
| ... | ... | @@ -683,7 +680,6 @@ test "empty non-exhaustive enum" { |
| 683 | 680 | test "single field non-exhaustive enum" { |
| 684 | 681 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 685 | 682 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 686 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 687 | 683 | |
| 688 | 684 | const S = struct { |
| 689 | 685 | const E = enum(u8) { a, _ }; |
| ... | ... | @@ -856,8 +852,6 @@ fn doALoopThing(id: EnumWithOneMember) void { |
| 856 | 852 | } |
| 857 | 853 | |
| 858 | 854 | test "comparison operator on enum with one member is comptime-known" { |
| 859 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 860 | ||
| 861 | 855 | doALoopThing(EnumWithOneMember.Eof); |
| 862 | 856 | } |
| 863 | 857 | |
| ... | ... | @@ -1211,8 +1205,6 @@ test "enum tag from a local variable" { |
| 1211 | 1205 | } |
| 1212 | 1206 | |
| 1213 | 1207 | test "auto-numbered enum with signed tag type" { |
| 1214 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 1215 | ||
| 1216 | 1208 | const E = enum(i32) { a, b }; |
| 1217 | 1209 | |
| 1218 | 1210 | try std.testing.expectEqual(@as(i32, 0), @intFromEnum(E.a)); |
test/behavior/error.zig-10| ... | ... | @@ -124,7 +124,6 @@ test "debug info for optional error set" { |
| 124 | 124 | |
| 125 | 125 | test "implicit cast to optional to error union to return result loc" { |
| 126 | 126 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 127 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 128 | 127 | |
| 129 | 128 | const S = struct { |
| 130 | 129 | fn entry() !void { |
| ... | ... | @@ -218,7 +217,6 @@ fn testErrorSetType() !void { |
| 218 | 217 | |
| 219 | 218 | test "explicit error set cast" { |
| 220 | 219 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 221 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 222 | 220 | |
| 223 | 221 | try testExplicitErrorSetCast(Set1.A); |
| 224 | 222 | try comptime testExplicitErrorSetCast(Set1.A); |
| ... | ... | @@ -320,7 +318,6 @@ test "error inference with an empty set" { |
| 320 | 318 | |
| 321 | 319 | test "error union peer type resolution" { |
| 322 | 320 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 323 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 324 | 321 | |
| 325 | 322 | try testErrorUnionPeerTypeResolution(1); |
| 326 | 323 | } |
| ... | ... | @@ -404,7 +401,6 @@ test "nested error union function call in optional unwrap" { |
| 404 | 401 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 405 | 402 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 406 | 403 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 407 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 408 | 404 | |
| 409 | 405 | const S = struct { |
| 410 | 406 | const Foo = struct { |
| ... | ... | @@ -469,7 +465,6 @@ test "optional error set is the same size as error set" { |
| 469 | 465 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 470 | 466 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 471 | 467 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 472 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 473 | 468 | |
| 474 | 469 | try comptime expect(@sizeOf(?anyerror) == @sizeOf(anyerror)); |
| 475 | 470 | try comptime expect(@alignOf(?anyerror) == @alignOf(anyerror)); |
| ... | ... | @@ -485,7 +480,6 @@ test "optional error set is the same size as error set" { |
| 485 | 480 | test "nested catch" { |
| 486 | 481 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 487 | 482 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 488 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 489 | 483 | |
| 490 | 484 | const S = struct { |
| 491 | 485 | fn entry() !void { |
| ... | ... | @@ -536,7 +530,6 @@ test "return result loc as peer result loc in inferred error set function" { |
| 536 | 530 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 537 | 531 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 538 | 532 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 539 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 540 | 533 | |
| 541 | 534 | const S = struct { |
| 542 | 535 | fn doTheTest() !void { |
| ... | ... | @@ -568,7 +561,6 @@ test "error payload type is correctly resolved" { |
| 568 | 561 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 569 | 562 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 570 | 563 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 571 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 572 | 564 | |
| 573 | 565 | const MyIntWrapper = struct { |
| 574 | 566 | const Self = @This(); |
| ... | ... | @@ -736,7 +728,6 @@ test "ret_ptr doesn't cause own inferred error set to be resolved" { |
| 736 | 728 | |
| 737 | 729 | test "simple else prong allowed even when all errors handled" { |
| 738 | 730 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 739 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 740 | 731 | |
| 741 | 732 | const S = struct { |
| 742 | 733 | fn foo() !u8 { |
| ... | ... | @@ -920,7 +911,6 @@ test "optional error union return type" { |
| 920 | 911 | test "optional error set return type" { |
| 921 | 912 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 922 | 913 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 923 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 924 | 914 | |
| 925 | 915 | const E = error{ A, B }; |
| 926 | 916 | const S = struct { |
test/behavior/eval.zig-8| ... | ... | @@ -441,7 +441,6 @@ test "binary math operator in partially inlined function" { |
| 441 | 441 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 442 | 442 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 443 | 443 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 444 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 445 | 444 | |
| 446 | 445 | var s: [4]u32 = undefined; |
| 447 | 446 | var b: [16]u8 = undefined; |
| ... | ... | @@ -710,7 +709,6 @@ fn loopNTimes(comptime n: usize) void { |
| 710 | 709 | } |
| 711 | 710 | |
| 712 | 711 | test "variable inside inline loop that has different types on different iterations" { |
| 713 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 714 | 712 | try testVarInsideInlineLoop(.{ true, @as(u32, 42) }); |
| 715 | 713 | } |
| 716 | 714 | |
| ... | ... | @@ -760,7 +758,6 @@ test "array concatenation peer resolves element types - value" { |
| 760 | 758 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 761 | 759 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 762 | 760 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 763 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 764 | 761 | |
| 765 | 762 | var a = [2]u3{ 1, 7 }; |
| 766 | 763 | var b = [3]u8{ 200, 225, 255 }; |
| ... | ... | @@ -777,7 +774,6 @@ test "array concatenation peer resolves element types - pointer" { |
| 777 | 774 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 778 | 775 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 779 | 776 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 780 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 781 | 777 | |
| 782 | 778 | var a = [2]u3{ 1, 7 }; |
| 783 | 779 | var b = [3]u8{ 200, 225, 255 }; |
| ... | ... | @@ -794,7 +790,6 @@ test "array concatenation sets the sentinel - value" { |
| 794 | 790 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 795 | 791 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 796 | 792 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 797 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 798 | 793 | |
| 799 | 794 | var a = [2]u3{ 1, 7 }; |
| 800 | 795 | var b = [3:69]u8{ 200, 225, 255 }; |
| ... | ... | @@ -812,7 +807,6 @@ test "array concatenation sets the sentinel - value" { |
| 812 | 807 | test "array concatenation sets the sentinel - pointer" { |
| 813 | 808 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 814 | 809 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 815 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 816 | 810 | |
| 817 | 811 | var a = [2]u3{ 1, 7 }; |
| 818 | 812 | var b = [3:69]u8{ 200, 225, 255 }; |
| ... | ... | @@ -1668,8 +1662,6 @@ test "early exit in container level const" { |
| 1668 | 1662 | } |
| 1669 | 1663 | |
| 1670 | 1664 | test "@inComptime" { |
| 1671 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 1672 | ||
| 1673 | 1665 | const S = struct { |
| 1674 | 1666 | fn inComptime() bool { |
| 1675 | 1667 | return @inComptime(); |
test/behavior/floatop.zig+18-2| ... | ... | @@ -29,6 +29,7 @@ test "add f32/f64" { |
| 29 | 29 | |
| 30 | 30 | test "add f80/f128/c_longdouble" { |
| 31 | 31 | if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf) return error.SkipZigTest; |
| 32 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 32 | 33 | |
| 33 | 34 | try testAdd(f80); |
| 34 | 35 | try comptime testAdd(f80); |
| ... | ... | @@ -60,6 +61,7 @@ test "sub f32/f64" { |
| 60 | 61 | |
| 61 | 62 | test "sub f80/f128/c_longdouble" { |
| 62 | 63 | if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf) return error.SkipZigTest; |
| 64 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 63 | 65 | |
| 64 | 66 | try testSub(f80); |
| 65 | 67 | try comptime testSub(f80); |
| ... | ... | @@ -91,6 +93,7 @@ test "mul f32/f64" { |
| 91 | 93 | |
| 92 | 94 | test "mul f80/f128/c_longdouble" { |
| 93 | 95 | if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf) return error.SkipZigTest; |
| 96 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 94 | 97 | |
| 95 | 98 | try testMul(f80); |
| 96 | 99 | try comptime testMul(f80); |
| ... | ... | @@ -200,7 +203,6 @@ test "different sized float comparisons" { |
| 200 | 203 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 201 | 204 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 202 | 205 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 203 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 204 | 206 | if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf) return error.SkipZigTest; |
| 205 | 207 | |
| 206 | 208 | try testDifferentSizedFloatComparisons(); |
| ... | ... | @@ -235,6 +237,7 @@ fn testDifferentSizedFloatComparisons() !void { |
| 235 | 237 | test "negative f128 intFromFloat at compile-time" { |
| 236 | 238 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 237 | 239 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 240 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 238 | 241 | |
| 239 | 242 | const a: f128 = -2; |
| 240 | 243 | var b = @as(i64, @intFromFloat(a)); |
| ... | ... | @@ -908,6 +911,7 @@ test "@abs f16" { |
| 908 | 911 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 909 | 912 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 910 | 913 | if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf) return error.SkipZigTest; |
| 914 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 911 | 915 | |
| 912 | 916 | try testFabs(f16); |
| 913 | 917 | try comptime testFabs(f16); |
| ... | ... | @@ -917,6 +921,7 @@ test "@abs f32/f64" { |
| 917 | 921 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 918 | 922 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 919 | 923 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 924 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 920 | 925 | |
| 921 | 926 | try testFabs(f32); |
| 922 | 927 | try comptime testFabs(f32); |
| ... | ... | @@ -930,6 +935,7 @@ test "@abs f80/f128/c_longdouble" { |
| 930 | 935 | if (builtin.zig_backend == .stage2_c and builtin.cpu.arch.isArmOrThumb()) return error.SkipZigTest; |
| 931 | 936 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 932 | 937 | if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf) return error.SkipZigTest; |
| 938 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 933 | 939 | |
| 934 | 940 | try testFabs(f80); |
| 935 | 941 | try comptime testFabs(f80); |
| ... | ... | @@ -1007,6 +1013,7 @@ test "@floor f16" { |
| 1007 | 1013 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 1008 | 1014 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1009 | 1015 | if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf) return error.SkipZigTest; |
| 1016 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 1010 | 1017 | |
| 1011 | 1018 | try testFloor(f16); |
| 1012 | 1019 | try comptime testFloor(f16); |
| ... | ... | @@ -1017,6 +1024,7 @@ test "@floor f32/f64" { |
| 1017 | 1024 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 1018 | 1025 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1019 | 1026 | if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf) return error.SkipZigTest; |
| 1027 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 1020 | 1028 | |
| 1021 | 1029 | try testFloor(f32); |
| 1022 | 1030 | try comptime testFloor(f32); |
| ... | ... | @@ -1030,6 +1038,7 @@ test "@floor f80/f128/c_longdouble" { |
| 1030 | 1038 | if (builtin.zig_backend == .stage2_c and builtin.cpu.arch.isArmOrThumb()) return error.SkipZigTest; |
| 1031 | 1039 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1032 | 1040 | if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf) return error.SkipZigTest; |
| 1041 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 1033 | 1042 | |
| 1034 | 1043 | if (builtin.zig_backend == .stage2_llvm and builtin.os.tag == .windows) { |
| 1035 | 1044 | // https://github.com/ziglang/zig/issues/12602 |
| ... | ... | @@ -1089,6 +1098,7 @@ test "@ceil f16" { |
| 1089 | 1098 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 1090 | 1099 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1091 | 1100 | if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf) return error.SkipZigTest; |
| 1101 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 1092 | 1102 | |
| 1093 | 1103 | try testCeil(f16); |
| 1094 | 1104 | try comptime testCeil(f16); |
| ... | ... | @@ -1099,6 +1109,7 @@ test "@ceil f32/f64" { |
| 1099 | 1109 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 1100 | 1110 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1101 | 1111 | if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf) return error.SkipZigTest; |
| 1112 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 1102 | 1113 | |
| 1103 | 1114 | try testCeil(f32); |
| 1104 | 1115 | try comptime testCeil(f32); |
| ... | ... | @@ -1112,6 +1123,7 @@ test "@ceil f80/f128/c_longdouble" { |
| 1112 | 1123 | if (builtin.zig_backend == .stage2_c and builtin.cpu.arch.isArmOrThumb()) return error.SkipZigTest; |
| 1113 | 1124 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1114 | 1125 | if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf) return error.SkipZigTest; |
| 1126 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 1115 | 1127 | |
| 1116 | 1128 | if (builtin.zig_backend == .stage2_llvm and builtin.os.tag == .windows) { |
| 1117 | 1129 | // https://github.com/ziglang/zig/issues/12602 |
| ... | ... | @@ -1148,8 +1160,8 @@ fn testCeil(comptime T: type) !void { |
| 1148 | 1160 | test "@ceil with vectors" { |
| 1149 | 1161 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 1150 | 1162 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 1151 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 1152 | 1163 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO |
| 1164 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 1153 | 1165 | if (builtin.zig_backend == .stage2_x86_64 and |
| 1154 | 1166 | !comptime std.Target.x86.featureSetHas(builtin.cpu.features, .sse4_1)) return error.SkipZigTest; |
| 1155 | 1167 | |
| ... | ... | @@ -1171,6 +1183,7 @@ test "@trunc f16" { |
| 1171 | 1183 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 1172 | 1184 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1173 | 1185 | if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf) return error.SkipZigTest; |
| 1186 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 1174 | 1187 | |
| 1175 | 1188 | if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch.isMIPS()) { |
| 1176 | 1189 | // https://github.com/ziglang/zig/issues/16846 |
| ... | ... | @@ -1186,6 +1199,7 @@ test "@trunc f32/f64" { |
| 1186 | 1199 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 1187 | 1200 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1188 | 1201 | if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf) return error.SkipZigTest; |
| 1202 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 1189 | 1203 | |
| 1190 | 1204 | if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch.isMIPS()) { |
| 1191 | 1205 | // https://github.com/ziglang/zig/issues/16846 |
| ... | ... | @@ -1204,6 +1218,7 @@ test "@trunc f80/f128/c_longdouble" { |
| 1204 | 1218 | if (builtin.zig_backend == .stage2_c and builtin.cpu.arch.isArmOrThumb()) return error.SkipZigTest; |
| 1205 | 1219 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1206 | 1220 | if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf) return error.SkipZigTest; |
| 1221 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 1207 | 1222 | |
| 1208 | 1223 | if (builtin.zig_backend == .stage2_llvm and builtin.os.tag == .windows) { |
| 1209 | 1224 | // https://github.com/ziglang/zig/issues/12602 |
| ... | ... | @@ -1390,6 +1405,7 @@ test "comptime fixed-width float non-zero divided by zero produces signed Inf" { |
| 1390 | 1405 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 1391 | 1406 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 1392 | 1407 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1408 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 1393 | 1409 | |
| 1394 | 1410 | inline for (.{ f16, f32, f64, f80, f128 }) |F| { |
| 1395 | 1411 | const pos = @as(F, 1) / @as(F, 0); |
test/behavior/fn.zig-11| ... | ... | @@ -201,7 +201,6 @@ fn addPointCoords(pt: Point) i32 { |
| 201 | 201 | |
| 202 | 202 | test "pass by non-copying value through var arg" { |
| 203 | 203 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 204 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 205 | 204 | |
| 206 | 205 | try expect((try addPointCoordsVar(Point{ .x = 1, .y = 2 })) == 3); |
| 207 | 206 | } |
| ... | ... | @@ -257,7 +256,6 @@ test "implicit cast fn call result to optional in field result" { |
| 257 | 256 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 258 | 257 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 259 | 258 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 260 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 261 | 259 | |
| 262 | 260 | const S = struct { |
| 263 | 261 | fn entry() !void { |
| ... | ... | @@ -284,7 +282,6 @@ test "implicit cast fn call result to optional in field result" { |
| 284 | 282 | test "void parameters" { |
| 285 | 283 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 286 | 284 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 287 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 288 | 285 | |
| 289 | 286 | try voidFun(1, void{}, 2, {}); |
| 290 | 287 | } |
| ... | ... | @@ -348,7 +345,6 @@ test "function call with anon list literal" { |
| 348 | 345 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 349 | 346 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 350 | 347 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 351 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 352 | 348 | |
| 353 | 349 | const S = struct { |
| 354 | 350 | fn doTheTest() !void { |
| ... | ... | @@ -369,7 +365,6 @@ test "function call with anon list literal - 2D" { |
| 369 | 365 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 370 | 366 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 371 | 367 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 372 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 373 | 368 | |
| 374 | 369 | const S = struct { |
| 375 | 370 | fn doTheTest() !void { |
| ... | ... | @@ -415,7 +410,6 @@ test "function with inferred error set but returning no error" { |
| 415 | 410 | |
| 416 | 411 | test "import passed byref to function in return type" { |
| 417 | 412 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 418 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 419 | 413 | |
| 420 | 414 | const S = struct { |
| 421 | 415 | fn get() @import("std").ArrayListUnmanaged(i32) { |
| ... | ... | @@ -451,7 +445,6 @@ test "implicit cast function to function ptr" { |
| 451 | 445 | test "method call with optional and error union first param" { |
| 452 | 446 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 453 | 447 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 454 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 455 | 448 | |
| 456 | 449 | const S = struct { |
| 457 | 450 | x: i32 = 1234, |
| ... | ... | @@ -471,7 +464,6 @@ test "method call with optional and error union first param" { |
| 471 | 464 | test "method call with optional pointer first param" { |
| 472 | 465 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 473 | 466 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 474 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 475 | 467 | |
| 476 | 468 | const S = struct { |
| 477 | 469 | x: i32 = 1234, |
| ... | ... | @@ -528,7 +520,6 @@ test "function returns function returning type" { |
| 528 | 520 | |
| 529 | 521 | test "peer type resolution of inferred error set with non-void payload" { |
| 530 | 522 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 531 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 532 | 523 | |
| 533 | 524 | const S = struct { |
| 534 | 525 | fn openDataFile(mode: enum { read, write }) !u32 { |
| ... | ... | @@ -571,8 +562,6 @@ test "lazy values passed to anytype parameter" { |
| 571 | 562 | } |
| 572 | 563 | |
| 573 | 564 | test "pass and return comptime-only types" { |
| 574 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 575 | ||
| 576 | 565 | const S = struct { |
| 577 | 566 | fn returnNull(comptime x: @Type(.Null)) @Type(.Null) { |
| 578 | 567 | return x; |
test/behavior/for.zig-16| ... | ... | @@ -7,7 +7,6 @@ const mem = std.mem; |
| 7 | 7 | test "continue in for loop" { |
| 8 | 8 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 9 | 9 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 10 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 11 | 10 | |
| 12 | 11 | const array = [_]i32{ 1, 2, 3, 4, 5 }; |
| 13 | 12 | var sum: i32 = 0; |
| ... | ... | @@ -70,7 +69,6 @@ test "basic for loop" { |
| 70 | 69 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 71 | 70 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 72 | 71 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 73 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 74 | 72 | |
| 75 | 73 | const expected_result = [_]u8{ 9, 8, 7, 6, 0, 1, 2, 3 } ** 3; |
| 76 | 74 | |
| ... | ... | @@ -114,7 +112,6 @@ test "for with null and T peer types and inferred result location type" { |
| 114 | 112 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 115 | 113 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 116 | 114 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 117 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 118 | 115 | |
| 119 | 116 | const S = struct { |
| 120 | 117 | fn doTheTest(slice: []const u8) !void { |
| ... | ... | @@ -135,7 +132,6 @@ test "for with null and T peer types and inferred result location type" { |
| 135 | 132 | test "2 break statements and an else" { |
| 136 | 133 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 137 | 134 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 138 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 139 | 135 | |
| 140 | 136 | const S = struct { |
| 141 | 137 | fn entry(t: bool, f: bool) !void { |
| ... | ... | @@ -157,7 +153,6 @@ test "for loop with pointer elem var" { |
| 157 | 153 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 158 | 154 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 159 | 155 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 160 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 161 | 156 | |
| 162 | 157 | const source = "abcdefg"; |
| 163 | 158 | var target: [source.len]u8 = undefined; |
| ... | ... | @@ -184,7 +179,6 @@ fn mangleString(s: []u8) void { |
| 184 | 179 | test "for copies its payload" { |
| 185 | 180 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 186 | 181 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 187 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 188 | 182 | |
| 189 | 183 | const S = struct { |
| 190 | 184 | fn doTheTest() !void { |
| ... | ... | @@ -204,7 +198,6 @@ test "for on slice with allowzero ptr" { |
| 204 | 198 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 205 | 199 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 206 | 200 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 207 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 208 | 201 | |
| 209 | 202 | const S = struct { |
| 210 | 203 | fn doTheTest(slice: []const u8) !void { |
| ... | ... | @@ -220,7 +213,6 @@ test "for on slice with allowzero ptr" { |
| 220 | 213 | test "else continue outer for" { |
| 221 | 214 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 222 | 215 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 223 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 224 | 216 | |
| 225 | 217 | var i: usize = 6; |
| 226 | 218 | var buf: [5]u8 = undefined; |
| ... | ... | @@ -282,7 +274,6 @@ test "two counters" { |
| 282 | 274 | test "1-based counter and ptr to array" { |
| 283 | 275 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 284 | 276 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 285 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 286 | 277 | |
| 287 | 278 | var ok: usize = 0; |
| 288 | 279 | |
| ... | ... | @@ -344,7 +335,6 @@ test "two slices, one captured by-ref" { |
| 344 | 335 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 345 | 336 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 346 | 337 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 347 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 348 | 338 | |
| 349 | 339 | var buf: [10]u8 = undefined; |
| 350 | 340 | const slice1: []const u8 = "blah"; |
| ... | ... | @@ -364,7 +354,6 @@ test "raw pointer and slice" { |
| 364 | 354 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 365 | 355 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 366 | 356 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 367 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 368 | 357 | |
| 369 | 358 | var buf: [10]u8 = undefined; |
| 370 | 359 | const slice: []const u8 = "blah"; |
| ... | ... | @@ -384,7 +373,6 @@ test "raw pointer and counter" { |
| 384 | 373 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 385 | 374 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 386 | 375 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 387 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 388 | 376 | |
| 389 | 377 | var buf: [10]u8 = undefined; |
| 390 | 378 | const ptr: [*]u8 = &buf; |
| ... | ... | @@ -433,7 +421,6 @@ test "inline for with counter as the comptime-known" { |
| 433 | 421 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 434 | 422 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 435 | 423 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 436 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 437 | 424 | |
| 438 | 425 | var runtime_slice = "hello"; |
| 439 | 426 | var runtime_i: usize = 3; |
| ... | ... | @@ -464,7 +451,6 @@ test "inline for on tuple pointer" { |
| 464 | 451 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 465 | 452 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 466 | 453 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 467 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; // TODO | |
| 468 | 454 | |
| 469 | 455 | const S = struct { u32, u32, u32 }; |
| 470 | 456 | var s: S = .{ 100, 200, 300 }; |
| ... | ... | @@ -480,7 +466,6 @@ test "ref counter that starts at zero" { |
| 480 | 466 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 481 | 467 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 482 | 468 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 483 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; // TODO | |
| 484 | 469 | |
| 485 | 470 | for ([_]usize{ 0, 1, 2 }, 0..) |i, j| { |
| 486 | 471 | try expectEqual(i, j); |
| ... | ... | @@ -496,7 +481,6 @@ test "inferred alloc ptr of for loop" { |
| 496 | 481 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 497 | 482 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 498 | 483 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 499 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; // TODO | |
| 500 | 484 | |
| 501 | 485 | { |
| 502 | 486 | var cond = false; |
test/behavior/generics.zig-4| ... | ... | @@ -153,7 +153,6 @@ test "generic fn with implicit cast" { |
| 153 | 153 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 154 | 154 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 155 | 155 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 156 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 157 | 156 | |
| 158 | 157 | try expect(getFirstByte(u8, &[_]u8{13}) == 13); |
| 159 | 158 | try expect(getFirstByte(u16, &[_]u16{ |
| ... | ... | @@ -280,7 +279,6 @@ test "generic function instantiation turns into comptime call" { |
| 280 | 279 | |
| 281 | 280 | test "generic function with void and comptime parameter" { |
| 282 | 281 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 283 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 284 | 282 | |
| 285 | 283 | const S = struct { x: i32 }; |
| 286 | 284 | const namespace = struct { |
| ... | ... | @@ -315,7 +313,6 @@ test "generic function instantiation non-duplicates" { |
| 315 | 313 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 316 | 314 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 317 | 315 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 318 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 319 | 316 | if (builtin.os.tag == .wasi) return error.SkipZigTest; |
| 320 | 317 | |
| 321 | 318 | const S = struct { |
| ... | ... | @@ -433,7 +430,6 @@ test "generic function passed as comptime argument" { |
| 433 | 430 | |
| 434 | 431 | test "return type of generic function is function pointer" { |
| 435 | 432 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 436 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 437 | 433 | |
| 438 | 434 | const S = struct { |
| 439 | 435 | fn b(comptime T: type) ?*const fn () error{}!T { |
test/behavior/if.zig-3| ... | ... | @@ -45,7 +45,6 @@ var global_with_err: anyerror!u32 = error.SomeError; |
| 45 | 45 | |
| 46 | 46 | test "unwrap mutable global var" { |
| 47 | 47 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 48 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 49 | 48 | |
| 50 | 49 | if (global_with_val) |v| { |
| 51 | 50 | try expect(v == 0); |
| ... | ... | @@ -116,7 +115,6 @@ test "if peer expressions inferred optional type" { |
| 116 | 115 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 117 | 116 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 118 | 117 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 119 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 120 | 118 | |
| 121 | 119 | var self: []const u8 = "abcdef"; |
| 122 | 120 | var index: usize = 0; |
| ... | ... | @@ -134,7 +132,6 @@ test "if-else expression with runtime condition result location is inferred opti |
| 134 | 132 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 135 | 133 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 136 | 134 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 137 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 138 | 135 | |
| 139 | 136 | const A = struct { b: u64, c: u64 }; |
| 140 | 137 | var d: bool = true; |
test/behavior/inline_switch.zig-1| ... | ... | @@ -84,7 +84,6 @@ test "inline else bool" { |
| 84 | 84 | test "inline else error" { |
| 85 | 85 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 86 | 86 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 87 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 88 | 87 | |
| 89 | 88 | const Err = error{ a, b, c }; |
| 90 | 89 | var a = Err.a; |
test/behavior/int_comparison_elision.zig+1-2| ... | ... | @@ -4,8 +4,6 @@ const maxInt = std.math.maxInt; |
| 4 | 4 | const builtin = @import("builtin"); |
| 5 | 5 | |
| 6 | 6 | test "int comparison elision" { |
| 7 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 8 | ||
| 9 | 7 | testIntEdges(u0); |
| 10 | 8 | testIntEdges(i0); |
| 11 | 9 | testIntEdges(u1); |
| ... | ... | @@ -17,6 +15,7 @@ test "int comparison elision" { |
| 17 | 15 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO |
| 18 | 16 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 19 | 17 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 18 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 20 | 19 | |
| 21 | 20 | // TODO: panic: integer overflow with int types > 65528 bits wide |
| 22 | 21 | // TODO: LLVM generates too many parameters for wasmtime when splitting up int > 64000 bits wide |
test/behavior/ir_block_deps.zig-1| ... | ... | @@ -21,7 +21,6 @@ test "ir block deps" { |
| 21 | 21 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 22 | 22 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 23 | 23 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 24 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 25 | 24 | |
| 26 | 25 | try expect((foo(1) catch unreachable) == 0); |
| 27 | 26 | try expect((foo(2) catch unreachable) == 0); |
test/behavior/lower_strlit_to_vector.zig-1| ... | ... | @@ -6,7 +6,6 @@ test "strlit to vector" { |
| 6 | 6 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 7 | 7 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 8 | 8 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO |
| 9 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 10 | 9 | |
| 11 | 10 | const strlit = "0123456789abcdef0123456789ABCDEF"; |
| 12 | 11 | const vec_from_strlit: @Vector(32, u8) = strlit.*; |
test/behavior/math.zig+6-3| ... | ... | @@ -413,6 +413,7 @@ test "division" { |
| 413 | 413 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 414 | 414 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 415 | 415 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 416 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; | |
| 416 | 417 | if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf) return error.SkipZigTest; |
| 417 | 418 | |
| 418 | 419 | if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch.isMIPS()) { |
| ... | ... | @@ -468,6 +469,9 @@ fn testDivision() !void { |
| 468 | 469 | try expect(mod(i32, -14, -12) == -2); |
| 469 | 470 | try expect(mod(i32, -2, -12) == -2); |
| 470 | 471 | |
| 472 | try expect(divTrunc(i20, 20, -5) == -4); | |
| 473 | try expect(divTrunc(i20, -20, -4) == 5); | |
| 474 | ||
| 471 | 475 | comptime { |
| 472 | 476 | try expect( |
| 473 | 477 | 1194735857077236777412821811143690633098347576 % 508740759824825164163191790951174292733114988 == 177254337427586449086438229241342047632117600, |
| ... | ... | @@ -1116,6 +1120,8 @@ test "@shlWithOverflow" { |
| 1116 | 1120 | } |
| 1117 | 1121 | |
| 1118 | 1122 | test "overflow arithmetic with u0 values" { |
| 1123 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 1124 | ||
| 1119 | 1125 | { |
| 1120 | 1126 | var a: u0 = 0; |
| 1121 | 1127 | const ov = @addWithOverflow(a, 0); |
| ... | ... | @@ -1284,8 +1290,6 @@ fn testShrExact(x: u8) !void { |
| 1284 | 1290 | } |
| 1285 | 1291 | |
| 1286 | 1292 | test "shift left/right on u0 operand" { |
| 1287 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 1288 | ||
| 1289 | 1293 | const S = struct { |
| 1290 | 1294 | fn doTheTest() !void { |
| 1291 | 1295 | var x: u0 = 0; |
| ... | ... | @@ -1562,7 +1566,6 @@ test "vector comparison" { |
| 1562 | 1566 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 1563 | 1567 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO |
| 1564 | 1568 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1565 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 1566 | 1569 | |
| 1567 | 1570 | const S = struct { |
| 1568 | 1571 | fn doTheTest() !void { |
test/behavior/maximum_minimum.zig+12-9| ... | ... | @@ -9,14 +9,16 @@ test "@max" { |
| 9 | 9 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 10 | 10 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 11 | 11 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 12 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 13 | 12 | |
| 14 | 13 | const S = struct { |
| 15 | 14 | fn doTheTest() !void { |
| 16 | 15 | var x: i32 = 10; |
| 17 | 16 | var y: f32 = 0.68; |
| 17 | var nan: f32 = std.math.nan(f32); | |
| 18 | 18 | try expect(@as(i32, 10) == @max(@as(i32, -3), x)); |
| 19 | 19 | try expect(@as(f32, 3.2) == @max(@as(f32, 3.2), y)); |
| 20 | try expect(y == @max(nan, y)); | |
| 21 | try expect(y == @max(y, nan)); | |
| 20 | 22 | } |
| 21 | 23 | }; |
| 22 | 24 | try S.doTheTest(); |
| ... | ... | @@ -58,14 +60,16 @@ test "@min" { |
| 58 | 60 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 59 | 61 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 60 | 62 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 61 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 62 | 63 | |
| 63 | 64 | const S = struct { |
| 64 | 65 | fn doTheTest() !void { |
| 65 | 66 | var x: i32 = 10; |
| 66 | 67 | var y: f32 = 0.68; |
| 68 | var nan: f32 = std.math.nan(f32); | |
| 67 | 69 | try expect(@as(i32, -3) == @min(@as(i32, -3), x)); |
| 68 | 70 | try expect(@as(f32, 0.68) == @min(@as(f32, 3.2), y)); |
| 71 | try expect(y == @min(nan, y)); | |
| 72 | try expect(y == @min(y, nan)); | |
| 69 | 73 | } |
| 70 | 74 | }; |
| 71 | 75 | try S.doTheTest(); |
| ... | ... | @@ -119,6 +123,12 @@ test "@min/max for floats" { |
| 119 | 123 | try expectEqual(x, @min(y, x)); |
| 120 | 124 | try expectEqual(y, @max(x, y)); |
| 121 | 125 | try expectEqual(y, @max(y, x)); |
| 126 | ||
| 127 | if (T != comptime_float) { | |
| 128 | var nan: T = std.math.nan(T); | |
| 129 | try expectEqual(y, @max(nan, y)); | |
| 130 | try expectEqual(y, @max(y, nan)); | |
| 131 | } | |
| 122 | 132 | } |
| 123 | 133 | }; |
| 124 | 134 | |
| ... | ... | @@ -137,8 +147,6 @@ test "@min/@max on lazy values" { |
| 137 | 147 | } |
| 138 | 148 | |
| 139 | 149 | test "@min/@max more than two arguments" { |
| 140 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 141 | ||
| 142 | 150 | const x: u32 = 30; |
| 143 | 151 | const y: u32 = 10; |
| 144 | 152 | const z: u32 = 20; |
| ... | ... | @@ -151,7 +159,6 @@ test "@min/@max more than two vector arguments" { |
| 151 | 159 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 152 | 160 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 153 | 161 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 154 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 155 | 162 | |
| 156 | 163 | const x: @Vector(2, u32) = .{ 3, 2 }; |
| 157 | 164 | const y: @Vector(2, u32) = .{ 4, 1 }; |
| ... | ... | @@ -164,7 +171,6 @@ test "@min/@max notices bounds" { |
| 164 | 171 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 165 | 172 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 166 | 173 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 167 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 168 | 174 | |
| 169 | 175 | var x: u16 = 20; |
| 170 | 176 | const y = 30; |
| ... | ... | @@ -214,7 +220,6 @@ test "@min/@max notices bounds from types" { |
| 214 | 220 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 215 | 221 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 216 | 222 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 217 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 218 | 223 | |
| 219 | 224 | var x: u16 = 123; |
| 220 | 225 | var y: u32 = 456; |
| ... | ... | @@ -295,8 +300,6 @@ test "@min/@max notices bounds from vector types when element of comptime-known |
| 295 | 300 | } |
| 296 | 301 | |
| 297 | 302 | test "@min/@max of signed and unsigned runtime integers" { |
| 298 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 299 | ||
| 300 | 303 | var x: i32 = -1; |
| 301 | 304 | var y: u31 = 1; |
| 302 | 305 |
test/behavior/merge_error_sets.zig-1| ... | ... | @@ -13,7 +13,6 @@ fn foo() C!void { |
| 13 | 13 | |
| 14 | 14 | test "merge error sets" { |
| 15 | 15 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 16 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 17 | 16 | |
| 18 | 17 | if (foo()) { |
| 19 | 18 | @panic("unexpected"); |
test/behavior/null.zig-4| ... | ... | @@ -53,7 +53,6 @@ test "maybe return" { |
| 53 | 53 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 54 | 54 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 55 | 55 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 56 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 57 | 56 | |
| 58 | 57 | try maybeReturnImpl(); |
| 59 | 58 | try comptime maybeReturnImpl(); |
| ... | ... | @@ -84,7 +83,6 @@ fn testTestNullRuntime(x: ?i32) !void { |
| 84 | 83 | test "optional void" { |
| 85 | 84 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 86 | 85 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 87 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 88 | 86 | |
| 89 | 87 | try optionalVoidImpl(); |
| 90 | 88 | try comptime optionalVoidImpl(); |
| ... | ... | @@ -108,7 +106,6 @@ const Empty = struct {}; |
| 108 | 106 | test "optional struct{}" { |
| 109 | 107 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 110 | 108 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 111 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 112 | 109 | |
| 113 | 110 | _ = try optionalEmptyStructImpl(); |
| 114 | 111 | _ = try comptime optionalEmptyStructImpl(); |
| ... | ... | @@ -134,7 +131,6 @@ test "null with default unwrap" { |
| 134 | 131 | |
| 135 | 132 | test "optional pointer to 0 bit type null value at runtime" { |
| 136 | 133 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 137 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 138 | 134 | |
| 139 | 135 | const EmptyStruct = struct {}; |
| 140 | 136 | var x: ?*EmptyStruct = null; |
test/behavior/optional.zig-16| ... | ... | @@ -27,7 +27,6 @@ pub const EmptyStruct = struct {}; |
| 27 | 27 | |
| 28 | 28 | test "optional pointer to size zero struct" { |
| 29 | 29 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 30 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 31 | 30 | |
| 32 | 31 | var e = EmptyStruct{}; |
| 33 | 32 | var o: ?*EmptyStruct = &e; |
| ... | ... | @@ -35,8 +34,6 @@ test "optional pointer to size zero struct" { |
| 35 | 34 | } |
| 36 | 35 | |
| 37 | 36 | test "equality compare optional pointers" { |
| 38 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 39 | ||
| 40 | 37 | try testNullPtrsEql(); |
| 41 | 38 | try comptime testNullPtrsEql(); |
| 42 | 39 | } |
| ... | ... | @@ -61,7 +58,6 @@ test "optional with void type" { |
| 61 | 58 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 62 | 59 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 63 | 60 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 64 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 65 | 61 | |
| 66 | 62 | const Foo = struct { |
| 67 | 63 | x: ?void, |
| ... | ... | @@ -96,7 +92,6 @@ test "nested optional field in struct" { |
| 96 | 92 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 97 | 93 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 98 | 94 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 99 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 100 | 95 | |
| 101 | 96 | const S2 = struct { |
| 102 | 97 | y: u8, |
| ... | ... | @@ -114,7 +109,6 @@ test "equality compare optional with non-optional" { |
| 114 | 109 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 115 | 110 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 116 | 111 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 117 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 118 | 112 | |
| 119 | 113 | try test_cmp_optional_non_optional(); |
| 120 | 114 | try comptime test_cmp_optional_non_optional(); |
| ... | ... | @@ -152,7 +146,6 @@ fn test_cmp_optional_non_optional() !void { |
| 152 | 146 | test "unwrap function call with optional pointer return value" { |
| 153 | 147 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 154 | 148 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 155 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 156 | 149 | |
| 157 | 150 | const S = struct { |
| 158 | 151 | fn entry() !void { |
| ... | ... | @@ -174,7 +167,6 @@ test "unwrap function call with optional pointer return value" { |
| 174 | 167 | test "nested orelse" { |
| 175 | 168 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 176 | 169 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 177 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 178 | 170 | |
| 179 | 171 | const S = struct { |
| 180 | 172 | fn entry() !void { |
| ... | ... | @@ -257,7 +249,6 @@ test "0-bit child type coerced to optional return ptr result location" { |
| 257 | 249 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 258 | 250 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 259 | 251 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 260 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 261 | 252 | |
| 262 | 253 | const S = struct { |
| 263 | 254 | fn doTheTest() !void { |
| ... | ... | @@ -310,7 +301,6 @@ test "array of optional unaligned types" { |
| 310 | 301 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 311 | 302 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 312 | 303 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 313 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 314 | 304 | |
| 315 | 305 | const Enum = enum { one, two, three }; |
| 316 | 306 | |
| ... | ... | @@ -400,7 +390,6 @@ const NoReturn = struct { |
| 400 | 390 | |
| 401 | 391 | test "optional of noreturn used with if" { |
| 402 | 392 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 403 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 404 | 393 | |
| 405 | 394 | NoReturn.a = 64; |
| 406 | 395 | if (NoReturn.loop()) |_| { |
| ... | ... | @@ -412,7 +401,6 @@ test "optional of noreturn used with if" { |
| 412 | 401 | |
| 413 | 402 | test "optional of noreturn used with orelse" { |
| 414 | 403 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 415 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 416 | 404 | |
| 417 | 405 | NoReturn.a = 64; |
| 418 | 406 | const val = NoReturn.testOrelse(); |
| ... | ... | @@ -448,7 +436,6 @@ test "Optional slice size is optimized" { |
| 448 | 436 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 449 | 437 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 450 | 438 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 451 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 452 | 439 | |
| 453 | 440 | try expect(@sizeOf(?[]u8) == @sizeOf([]u8)); |
| 454 | 441 | var a: ?[]const u8 = null; |
| ... | ... | @@ -460,7 +447,6 @@ test "Optional slice size is optimized" { |
| 460 | 447 | test "peer type resolution in nested if expressions" { |
| 461 | 448 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 462 | 449 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 463 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 464 | 450 | |
| 465 | 451 | const Thing = struct { n: i32 }; |
| 466 | 452 | var a = false; |
| ... | ... | @@ -500,8 +486,6 @@ test "cast slice to const slice nested in error union and optional" { |
| 500 | 486 | } |
| 501 | 487 | |
| 502 | 488 | test "variable of optional of noreturn" { |
| 503 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 504 | ||
| 505 | 489 | var null_opv: ?noreturn = null; |
| 506 | 490 | try std.testing.expectEqual(@as(?noreturn, null), null_opv); |
| 507 | 491 | } |
test/behavior/packed-struct.zig+5| ... | ... | @@ -622,6 +622,7 @@ test "@intFromPtr on a packed struct field unaligned and nested" { |
| 622 | 622 | |
| 623 | 623 | test "packed struct fields modification" { |
| 624 | 624 | // Originally reported at https://github.com/ziglang/zig/issues/16615 |
| 625 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 625 | 626 | |
| 626 | 627 | const Small = packed struct { |
| 627 | 628 | val: u8 = 0, |
| ... | ... | @@ -980,6 +981,8 @@ test "store undefined to packed result location" { |
| 980 | 981 | } |
| 981 | 982 | |
| 982 | 983 | test "bitcast back and forth" { |
| 984 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 985 | ||
| 983 | 986 | // Originally reported at https://github.com/ziglang/zig/issues/9914 |
| 984 | 987 | const S = packed struct { one: u6, two: u1 }; |
| 985 | 988 | const s = S{ .one = 0b110101, .two = 0b1 }; |
| ... | ... | @@ -991,6 +994,7 @@ test "bitcast back and forth" { |
| 991 | 994 | |
| 992 | 995 | test "field access of packed struct smaller than its abi size inside struct initialized with rls" { |
| 993 | 996 | // Originally reported at https://github.com/ziglang/zig/issues/14200 |
| 997 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 994 | 998 | |
| 995 | 999 | const S = struct { |
| 996 | 1000 | ps: packed struct { x: i2, y: i2 }, |
| ... | ... | @@ -1039,6 +1043,7 @@ test "modify nested packed struct aligned field" { |
| 1039 | 1043 | |
| 1040 | 1044 | test "assigning packed struct inside another packed struct" { |
| 1041 | 1045 | // Originally reported at https://github.com/ziglang/zig/issues/9674 |
| 1046 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 1042 | 1047 | |
| 1043 | 1048 | const S = struct { |
| 1044 | 1049 | const Inner = packed struct { |
test/behavior/packed-union.zig+1| ... | ... | @@ -88,6 +88,7 @@ test "flags in packed union at offset" { |
| 88 | 88 | |
| 89 | 89 | test "packed union in packed struct" { |
| 90 | 90 | // Originally reported at https://github.com/ziglang/zig/issues/16581 |
| 91 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 91 | 92 | |
| 92 | 93 | const ReadRequest = packed struct { key: i32 }; |
| 93 | 94 | const RequestType = enum { |
test/behavior/pointers.zig-7| ... | ... | @@ -149,7 +149,6 @@ test "implicit casting between C pointer and optional non-C pointer" { |
| 149 | 149 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 150 | 150 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 151 | 151 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 152 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 153 | 152 | |
| 154 | 153 | var slice: []const u8 = "aoeu"; |
| 155 | 154 | const opt_many_ptr: ?[*]const u8 = slice.ptr; |
| ... | ... | @@ -192,7 +191,6 @@ test "allowzero pointer and slice" { |
| 192 | 191 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO |
| 193 | 192 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 194 | 193 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 195 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 196 | 194 | |
| 197 | 195 | var ptr = @as([*]allowzero i32, @ptrFromInt(0)); |
| 198 | 196 | var opt_ptr: ?[*]allowzero i32 = ptr; |
| ... | ... | @@ -211,7 +209,6 @@ test "assign null directly to C pointer and test null equality" { |
| 211 | 209 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 212 | 210 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 213 | 211 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 214 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 215 | 212 | |
| 216 | 213 | var x: [*c]i32 = null; |
| 217 | 214 | try expect(x == null); |
| ... | ... | @@ -278,7 +275,6 @@ test "array initialization types" { |
| 278 | 275 | test "null terminated pointer" { |
| 279 | 276 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 280 | 277 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 281 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 282 | 278 | |
| 283 | 279 | const S = struct { |
| 284 | 280 | fn doTheTest() !void { |
| ... | ... | @@ -413,7 +409,6 @@ test "indexing array with sentinel returns correct type" { |
| 413 | 409 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 414 | 410 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 415 | 411 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 416 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 417 | 412 | |
| 418 | 413 | var s: [:0]const u8 = "abc"; |
| 419 | 414 | try testing.expectEqualSlices(u8, "*const u8", @typeName(@TypeOf(&s[0]))); |
| ... | ... | @@ -498,7 +493,6 @@ test "ptrCast comptime known slice to C pointer" { |
| 498 | 493 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 499 | 494 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 500 | 495 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 501 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 502 | 496 | |
| 503 | 497 | const s: [:0]const u8 = "foo"; |
| 504 | 498 | var p = @as([*c]const u8, @ptrCast(s)); |
| ... | ... | @@ -509,7 +503,6 @@ test "intFromPtr on a generic function" { |
| 509 | 503 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO |
| 510 | 504 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 511 | 505 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 512 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 513 | 506 | |
| 514 | 507 | const S = struct { |
| 515 | 508 | fn generic(i: anytype) @TypeOf(i) { |
test/behavior/ptrcast.zig+2-2| ... | ... | @@ -233,7 +233,6 @@ test "implicit optional pointer to optional anyopaque pointer" { |
| 233 | 233 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 234 | 234 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 235 | 235 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 236 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 237 | 236 | |
| 238 | 237 | var buf: [4]u8 = "aoeu".*; |
| 239 | 238 | var x: ?[*]u8 = &buf; |
| ... | ... | @@ -246,7 +245,6 @@ test "@ptrCast slice to slice" { |
| 246 | 245 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 247 | 246 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 248 | 247 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 249 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 250 | 248 | |
| 251 | 249 | const S = struct { |
| 252 | 250 | fn foo(slice: []u32) []i32 { |
| ... | ... | @@ -286,6 +284,8 @@ test "@ptrCast undefined value at comptime" { |
| 286 | 284 | } |
| 287 | 285 | |
| 288 | 286 | test "comptime @ptrCast with packed struct leaves value unmodified" { |
| 287 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 288 | ||
| 289 | 289 | const S = packed struct { three: u3 }; |
| 290 | 290 | const st: S = .{ .three = 6 }; |
| 291 | 291 | try expect(st.three == 6); |
test/behavior/ptrfromint.zig-2| ... | ... | @@ -33,7 +33,6 @@ test "@ptrFromInt creates null pointer" { |
| 33 | 33 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 34 | 34 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 35 | 35 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 36 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 37 | 36 | |
| 38 | 37 | const ptr = @as(?*u32, @ptrFromInt(0)); |
| 39 | 38 | try expectEqual(@as(?*u32, null), ptr); |
| ... | ... | @@ -43,7 +42,6 @@ test "@ptrFromInt creates allowzero zero pointer" { |
| 43 | 42 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 44 | 43 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 45 | 44 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 46 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 47 | 45 | |
| 48 | 46 | const ptr = @as(*allowzero u32, @ptrFromInt(0)); |
| 49 | 47 | try expectEqual(@as(usize, 0), @intFromPtr(ptr)); |
test/behavior/sizeof_and_typeof.zig-3| ... | ... | @@ -18,8 +18,6 @@ test "@sizeOf on compile-time types" { |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | test "@TypeOf() with multiple arguments" { |
| 21 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 22 | ||
| 23 | 21 | { |
| 24 | 22 | var var_1: u32 = undefined; |
| 25 | 23 | var var_2: u8 = undefined; |
| ... | ... | @@ -268,7 +266,6 @@ test "runtime instructions inside typeof in comptime only scope" { |
| 268 | 266 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 269 | 267 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 270 | 268 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 271 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 272 | 269 | |
| 273 | 270 | { |
| 274 | 271 | var y: i8 = 2; |
test/behavior/slice.zig-19| ... | ... | @@ -64,7 +64,6 @@ test "comptime slice of undefined pointer of length 0" { |
| 64 | 64 | |
| 65 | 65 | test "implicitly cast array of size 0 to slice" { |
| 66 | 66 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 67 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 68 | 67 | |
| 69 | 68 | var msg = [_]u8{}; |
| 70 | 69 | try assertLenIsZero(&msg); |
| ... | ... | @@ -172,7 +171,6 @@ test "comptime pointer cast array and then slice" { |
| 172 | 171 | test "slicing zero length array" { |
| 173 | 172 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 174 | 173 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 175 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 176 | 174 | |
| 177 | 175 | const s1 = ""[0..]; |
| 178 | 176 | const s2 = ([_]u32{})[0..]; |
| ... | ... | @@ -183,8 +181,6 @@ test "slicing zero length array" { |
| 183 | 181 | } |
| 184 | 182 | |
| 185 | 183 | test "slicing pointer by length" { |
| 186 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 187 | ||
| 188 | 184 | const array = [_]u8{ 1, 2, 3, 4, 5, 6, 7, 8 }; |
| 189 | 185 | const ptr: [*]const u8 = @as([*]const u8, @ptrCast(&array)); |
| 190 | 186 | const slice = ptr[1..][0..5]; |
| ... | ... | @@ -219,7 +215,6 @@ test "slice string literal has correct type" { |
| 219 | 215 | |
| 220 | 216 | test "result location zero sized array inside struct field implicit cast to slice" { |
| 221 | 217 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 222 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 223 | 218 | |
| 224 | 219 | const E = struct { |
| 225 | 220 | entries: []u32, |
| ... | ... | @@ -232,7 +227,6 @@ test "runtime safety lets us slice from len..len" { |
| 232 | 227 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 233 | 228 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 234 | 229 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 235 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 236 | 230 | |
| 237 | 231 | var an_array = [_]u8{ 1, 2, 3 }; |
| 238 | 232 | try expect(mem.eql(u8, sliceFromLenToLen(an_array[0..], 3, 3), "")); |
| ... | ... | @@ -245,7 +239,6 @@ fn sliceFromLenToLen(a_slice: []u8, start: usize, end: usize) []u8 { |
| 245 | 239 | test "C pointer" { |
| 246 | 240 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 247 | 241 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 248 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 249 | 242 | |
| 250 | 243 | var buf: [*c]const u8 = "kjdhfkjdhfdkjhfkfjhdfkjdhfkdjhfdkjhf"; |
| 251 | 244 | var len: u32 = 10; |
| ... | ... | @@ -257,7 +250,6 @@ test "C pointer slice access" { |
| 257 | 250 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 258 | 251 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 259 | 252 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 260 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 261 | 253 | |
| 262 | 254 | var buf: [10]u32 = [1]u32{42} ** 10; |
| 263 | 255 | const c_ptr = @as([*c]const u32, @ptrCast(&buf)); |
| ... | ... | @@ -287,7 +279,6 @@ fn sliceSum(comptime q: []const u8) i32 { |
| 287 | 279 | test "slice type with custom alignment" { |
| 288 | 280 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 289 | 281 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 290 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 291 | 282 | |
| 292 | 283 | const LazilyResolvedType = struct { |
| 293 | 284 | anything: i32, |
| ... | ... | @@ -361,7 +352,6 @@ test "slice syntax resulting in pointer-to-array" { |
| 361 | 352 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 362 | 353 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 363 | 354 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 364 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 365 | 355 | |
| 366 | 356 | const S = struct { |
| 367 | 357 | fn doTheTest() !void { |
| ... | ... | @@ -586,7 +576,6 @@ test "slice pointer-to-array null terminated" { |
| 586 | 576 | |
| 587 | 577 | test "slice pointer-to-array zero length" { |
| 588 | 578 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 589 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 590 | 579 | |
| 591 | 580 | comptime { |
| 592 | 581 | { |
| ... | ... | @@ -795,8 +784,6 @@ test "global slice field access" { |
| 795 | 784 | } |
| 796 | 785 | |
| 797 | 786 | test "slice of void" { |
| 798 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 799 | ||
| 800 | 787 | var n: usize = 10; |
| 801 | 788 | var arr: [12]void = undefined; |
| 802 | 789 | const slice = @as([]void, &arr)[0..n]; |
| ... | ... | @@ -804,8 +791,6 @@ test "slice of void" { |
| 804 | 791 | } |
| 805 | 792 | |
| 806 | 793 | test "slice with dereferenced value" { |
| 807 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 808 | ||
| 809 | 794 | var a: usize = 0; |
| 810 | 795 | var idx: *usize = &a; |
| 811 | 796 | _ = blk: { |
| ... | ... | @@ -821,7 +806,6 @@ test "slice with dereferenced value" { |
| 821 | 806 | |
| 822 | 807 | test "empty slice ptr is non null" { |
| 823 | 808 | if (builtin.zig_backend == .stage2_aarch64 and builtin.os.tag == .macos) return error.SkipZigTest; // TODO |
| 824 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 825 | 809 | |
| 826 | 810 | { |
| 827 | 811 | const empty_slice: []u8 = &[_]u8{}; |
| ... | ... | @@ -840,7 +824,6 @@ test "empty slice ptr is non null" { |
| 840 | 824 | test "slice decays to many pointer" { |
| 841 | 825 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 842 | 826 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 843 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 844 | 827 | |
| 845 | 828 | var buf: [8]u8 = "abcdefg\x00".*; |
| 846 | 829 | const p: [*:0]const u8 = buf[0..7 :0]; |
| ... | ... | @@ -851,7 +834,6 @@ test "write through pointer to optional slice arg" { |
| 851 | 834 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 852 | 835 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 853 | 836 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; |
| 854 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 855 | 837 | |
| 856 | 838 | const S = struct { |
| 857 | 839 | fn bar(foo: *?[]const u8) !void { |
| ... | ... | @@ -871,7 +853,6 @@ test "modify slice length at comptime" { |
| 871 | 853 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 872 | 854 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 873 | 855 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; |
| 874 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 875 | 856 | |
| 876 | 857 | const arr: [2]u8 = .{ 10, 20 }; |
| 877 | 858 | comptime var s: []const u8 = arr[0..0]; |
test/behavior/src.zig-3| ... | ... | @@ -17,7 +17,6 @@ test "@src" { |
| 17 | 17 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 18 | 18 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 19 | 19 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 20 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 21 | 20 | |
| 22 | 21 | try doTheTest(); |
| 23 | 22 | } |
| ... | ... | @@ -34,8 +33,6 @@ test "@src used as a comptime parameter" { |
| 34 | 33 | } |
| 35 | 34 | |
| 36 | 35 | test "@src in tuple passed to anytype function" { |
| 37 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 38 | ||
| 39 | 36 | const S = struct { |
| 40 | 37 | fn Foo(a: anytype) u32 { |
| 41 | 38 | return a[0].line; |
test/behavior/struct.zig-16| ... | ... | @@ -134,8 +134,6 @@ test "invoke static method in global scope" { |
| 134 | 134 | const empty_global_instance = StructWithNoFields{}; |
| 135 | 135 | |
| 136 | 136 | test "return empty struct instance" { |
| 137 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 138 | ||
| 139 | 137 | _ = returnEmptyStructInstance(); |
| 140 | 138 | } |
| 141 | 139 | fn returnEmptyStructInstance() StructWithNoFields { |
| ... | ... | @@ -311,7 +309,6 @@ test "struct point to self" { |
| 311 | 309 | test "void struct fields" { |
| 312 | 310 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 313 | 311 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 314 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 315 | 312 | |
| 316 | 313 | const foo = VoidStructFieldsFoo{ |
| 317 | 314 | .a = void{}, |
| ... | ... | @@ -329,7 +326,6 @@ const VoidStructFieldsFoo = struct { |
| 329 | 326 | |
| 330 | 327 | test "return empty struct from fn" { |
| 331 | 328 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 332 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 333 | 329 | |
| 334 | 330 | _ = testReturnEmptyStructFromFn(); |
| 335 | 331 | } |
| ... | ... | @@ -340,7 +336,6 @@ fn testReturnEmptyStructFromFn() EmptyStruct2 { |
| 340 | 336 | |
| 341 | 337 | test "pass slice of empty struct to fn" { |
| 342 | 338 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 343 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 344 | 339 | |
| 345 | 340 | try expect(testPassSliceOfEmptyStructToFn(&[_]EmptyStruct2{EmptyStruct2{}}) == 1); |
| 346 | 341 | } |
| ... | ... | @@ -889,8 +884,6 @@ test "anonymous struct literal syntax" { |
| 889 | 884 | } |
| 890 | 885 | |
| 891 | 886 | test "fully anonymous struct" { |
| 892 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 893 | ||
| 894 | 887 | const S = struct { |
| 895 | 888 | fn doTheTest() !void { |
| 896 | 889 | try dump(.{ |
| ... | ... | @@ -913,8 +906,6 @@ test "fully anonymous struct" { |
| 913 | 906 | } |
| 914 | 907 | |
| 915 | 908 | test "fully anonymous list literal" { |
| 916 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 917 | ||
| 918 | 909 | const S = struct { |
| 919 | 910 | fn doTheTest() !void { |
| 920 | 911 | try dump(.{ @as(u32, 1234), @as(f64, 12.34), true, "hi" }); |
| ... | ... | @@ -960,7 +951,6 @@ test "tuple element initialized with fn call" { |
| 960 | 951 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 961 | 952 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 962 | 953 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 963 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 964 | 954 | |
| 965 | 955 | const S = struct { |
| 966 | 956 | fn doTheTest() !void { |
| ... | ... | @@ -1229,7 +1219,6 @@ test "typed init through error unions and optionals" { |
| 1229 | 1219 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 1230 | 1220 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 1231 | 1221 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1232 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 1233 | 1222 | |
| 1234 | 1223 | const S = struct { |
| 1235 | 1224 | a: u32, |
| ... | ... | @@ -1550,7 +1539,6 @@ test "no dependency loop on optional field wrapped in generic function" { |
| 1550 | 1539 | test "optional field init with tuple" { |
| 1551 | 1540 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 1552 | 1541 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 1553 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 1554 | 1542 | |
| 1555 | 1543 | const S = struct { |
| 1556 | 1544 | a: ?struct { b: u32 }, |
| ... | ... | @@ -1652,7 +1640,6 @@ test "struct field pointer has correct alignment" { |
| 1652 | 1640 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 1653 | 1641 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 1654 | 1642 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1655 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; // TODO | |
| 1656 | 1643 | |
| 1657 | 1644 | const S = struct { |
| 1658 | 1645 | fn doTheTest() !void { |
| ... | ... | @@ -1683,7 +1670,6 @@ test "extern struct field pointer has correct alignment" { |
| 1683 | 1670 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 1684 | 1671 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 1685 | 1672 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1686 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; // TODO | |
| 1687 | 1673 | |
| 1688 | 1674 | const S = struct { |
| 1689 | 1675 | fn doTheTest() !void { |
| ... | ... | @@ -1721,8 +1707,6 @@ test "extern struct field pointer has correct alignment" { |
| 1721 | 1707 | } |
| 1722 | 1708 | |
| 1723 | 1709 | test "packed struct field in anonymous struct" { |
| 1724 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 1725 | ||
| 1726 | 1710 | const T = packed struct { |
| 1727 | 1711 | f1: bool = false, |
| 1728 | 1712 | }; |
test/behavior/switch.zig-7| ... | ... | @@ -623,7 +623,6 @@ test "switch capture copies its payload" { |
| 623 | 623 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 624 | 624 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 625 | 625 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 626 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 627 | 626 | |
| 628 | 627 | const S = struct { |
| 629 | 628 | fn doTheTest() !void { |
| ... | ... | @@ -710,8 +709,6 @@ test "comptime inline switch" { |
| 710 | 709 | } |
| 711 | 710 | |
| 712 | 711 | test "switch capture peer type resolution" { |
| 713 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 714 | ||
| 715 | 712 | const U = union(enum) { |
| 716 | 713 | a: u32, |
| 717 | 714 | b: u64, |
| ... | ... | @@ -727,8 +724,6 @@ test "switch capture peer type resolution" { |
| 727 | 724 | } |
| 728 | 725 | |
| 729 | 726 | test "switch capture peer type resolution for in-memory coercible payloads" { |
| 730 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 731 | ||
| 732 | 727 | const T1 = c_int; |
| 733 | 728 | const T2 = @Type(@typeInfo(T1)); |
| 734 | 729 | |
| ... | ... | @@ -777,8 +772,6 @@ test "switch pointer capture peer type resolution" { |
| 777 | 772 | } |
| 778 | 773 | |
| 779 | 774 | test "inline switch range that includes the maximum value of the switched type" { |
| 780 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 781 | ||
| 782 | 775 | const inputs: [3]u8 = .{ 0, 254, 255 }; |
| 783 | 776 | for (inputs) |input| { |
| 784 | 777 | switch (input) { |
test/behavior/switch_prong_err_enum.zig-1| ... | ... | @@ -24,7 +24,6 @@ test "switch prong returns error enum" { |
| 24 | 24 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 25 | 25 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 26 | 26 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 27 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 28 | 27 | |
| 29 | 28 | switch (doThing(17) catch unreachable) { |
| 30 | 29 | FormValue.Address => |payload| { |
test/behavior/switch_prong_implicit_cast.zig-1| ... | ... | @@ -18,7 +18,6 @@ test "switch prong implicit cast" { |
| 18 | 18 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 19 | 19 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 20 | 20 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 21 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 22 | 21 | |
| 23 | 22 | const result = switch (foo(2) catch unreachable) { |
| 24 | 23 | FormValue.One => false, |
test/behavior/threadlocal.zig-1| ... | ... | @@ -33,7 +33,6 @@ test "pointer to thread local array" { |
| 33 | 33 | else => return error.SkipZigTest, |
| 34 | 34 | }; // TODO |
| 35 | 35 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 36 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 37 | 36 | |
| 38 | 37 | const s = "Hello world"; |
| 39 | 38 | std.mem.copy(u8, buffer[0..], s); |
test/behavior/try.zig-3| ... | ... | @@ -4,7 +4,6 @@ const expect = std.testing.expect; |
| 4 | 4 | |
| 5 | 5 | test "try on error union" { |
| 6 | 6 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 7 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 8 | 7 | |
| 9 | 8 | try tryOnErrorUnionImpl(); |
| 10 | 9 | try comptime tryOnErrorUnionImpl(); |
| ... | ... | @@ -40,8 +39,6 @@ fn failIfTrue(ok: bool) anyerror!void { |
| 40 | 39 | } |
| 41 | 40 | |
| 42 | 41 | test "try then not executed with assignment" { |
| 43 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 44 | ||
| 45 | 42 | if (failIfTrue(true)) { |
| 46 | 43 | unreachable; |
| 47 | 44 | } else |err| { |
test/behavior/tuple.zig-10| ... | ... | @@ -10,7 +10,6 @@ test "tuple concatenation" { |
| 10 | 10 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 11 | 11 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 12 | 12 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 13 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 14 | 13 | |
| 15 | 14 | const S = struct { |
| 16 | 15 | fn doTheTest() !void { |
| ... | ... | @@ -269,7 +268,6 @@ test "tuple in tuple passed to generic function" { |
| 269 | 268 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 270 | 269 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 271 | 270 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 272 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 273 | 271 | |
| 274 | 272 | const S = struct { |
| 275 | 273 | fn pair(x: f32, y: f32) std.meta.Tuple(&.{ f32, f32 }) { |
| ... | ... | @@ -310,8 +308,6 @@ test "tuple type with void field" { |
| 310 | 308 | } |
| 311 | 309 | |
| 312 | 310 | test "zero sized struct in tuple handled correctly" { |
| 313 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 314 | ||
| 315 | 311 | const State = struct { |
| 316 | 312 | const Self = @This(); |
| 317 | 313 | data: @Type(.{ |
| ... | ... | @@ -351,7 +347,6 @@ test "branching inside tuple literal" { |
| 351 | 347 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 352 | 348 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 353 | 349 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 354 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 355 | 350 | |
| 356 | 351 | const S = struct { |
| 357 | 352 | fn foo(a: anytype) !void { |
| ... | ... | @@ -366,7 +361,6 @@ test "tuple initialized with a runtime known value" { |
| 366 | 361 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 367 | 362 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 368 | 363 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 369 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 370 | 364 | |
| 371 | 365 | const E = union(enum) { e: []const u8 }; |
| 372 | 366 | const W = union(enum) { w: E }; |
| ... | ... | @@ -380,7 +374,6 @@ test "tuple of struct concatenation and coercion to array" { |
| 380 | 374 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 381 | 375 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| 382 | 376 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 383 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 384 | 377 | |
| 385 | 378 | const StructWithDefault = struct { value: f32 = 42 }; |
| 386 | 379 | const SomeStruct = struct { array: [4]StructWithDefault }; |
| ... | ... | @@ -395,7 +388,6 @@ test "nested runtime conditionals in tuple initializer" { |
| 395 | 388 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 396 | 389 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 397 | 390 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 398 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 399 | 391 | |
| 400 | 392 | var data: u8 = 0; |
| 401 | 393 | const x = .{ |
| ... | ... | @@ -430,7 +422,6 @@ test "tuple pointer is indexable" { |
| 430 | 422 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 431 | 423 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 432 | 424 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 433 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; // TODO | |
| 434 | 425 | |
| 435 | 426 | const S = struct { u32, bool }; |
| 436 | 427 | |
| ... | ... | @@ -454,7 +445,6 @@ test "coerce anon tuple to tuple" { |
| 454 | 445 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 455 | 446 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 456 | 447 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 457 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; // TODO | |
| 458 | 448 | |
| 459 | 449 | var x: u8 = 1; |
| 460 | 450 | var y: u16 = 2; |
test/behavior/tuple_declarations.zig-2| ... | ... | @@ -7,7 +7,6 @@ const expectEqualStrings = testing.expectEqualStrings; |
| 7 | 7 | test "tuple declaration type info" { |
| 8 | 8 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 9 | 9 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 10 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 11 | 10 | |
| 12 | 11 | { |
| 13 | 12 | const T = struct { comptime u32 align(2) = 1, []const u8 }; |
| ... | ... | @@ -36,7 +35,6 @@ test "tuple declaration type info" { |
| 36 | 35 | test "Tuple declaration usage" { |
| 37 | 36 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 38 | 37 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 39 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 40 | 38 | |
| 41 | 39 | const T = struct { u32, []const u8 }; |
| 42 | 40 | var t: T = .{ 1, "foo" }; |
test/behavior/type.zig-3| ... | ... | @@ -202,7 +202,6 @@ test "Type.Opaque" { |
| 202 | 202 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 203 | 203 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 204 | 204 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 205 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 206 | 205 | |
| 207 | 206 | const Opaque = @Type(.{ |
| 208 | 207 | .Opaque = .{ |
| ... | ... | @@ -260,7 +259,6 @@ test "Type.Struct" { |
| 260 | 259 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 261 | 260 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 262 | 261 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 263 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 264 | 262 | |
| 265 | 263 | const A = @Type(@typeInfo(struct { x: u8, y: u32 })); |
| 266 | 264 | const infoA = @typeInfo(A).Struct; |
| ... | ... | @@ -348,7 +346,6 @@ test "Type.Struct" { |
| 348 | 346 | test "Type.Enum" { |
| 349 | 347 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 350 | 348 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 351 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 352 | 349 | |
| 353 | 350 | const Foo = @Type(.{ |
| 354 | 351 | .Enum = .{ |
test/behavior/type_info.zig-1| ... | ... | @@ -565,7 +565,6 @@ test "value from struct @typeInfo default_value can be loaded at comptime" { |
| 565 | 565 | test "@typeInfo decls and usingnamespace" { |
| 566 | 566 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 567 | 567 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 568 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 569 | 568 | |
| 570 | 569 | const A = struct { |
| 571 | 570 | pub const x = 5; |
test/behavior/type_info_only_pub_decls.zig-2| ... | ... | @@ -15,8 +15,6 @@ const other = struct { |
| 15 | 15 | }; |
| 16 | 16 | |
| 17 | 17 | test { |
| 18 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 19 | ||
| 20 | 18 | const ti = @typeInfo(other); |
| 21 | 19 | const decls = ti.Struct.decls; |
| 22 | 20 |
test/behavior/typename.zig-2| ... | ... | @@ -67,7 +67,6 @@ test "basic" { |
| 67 | 67 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 68 | 68 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 69 | 69 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 70 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 71 | 70 | |
| 72 | 71 | try expectEqualStrings("i64", @typeName(i64)); |
| 73 | 72 | try expectEqualStrings("*usize", @typeName(*usize)); |
| ... | ... | @@ -231,7 +230,6 @@ test "comptime parameters not converted to anytype in function type" { |
| 231 | 230 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 232 | 231 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 233 | 232 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 234 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 235 | 233 | |
| 236 | 234 | const T = fn (fn (type) void, void) void; |
| 237 | 235 | try expectEqualStrings("fn (comptime fn (comptime type) void, void) void", @typeName(T)); |
test/behavior/union.zig+10-7| ... | ... | @@ -97,7 +97,6 @@ const FooExtern = extern union { |
| 97 | 97 | test "basic extern unions" { |
| 98 | 98 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 99 | 99 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 100 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 101 | 100 | |
| 102 | 101 | var foo = FooExtern{ .int = 1 }; |
| 103 | 102 | try expect(foo.int == 1); |
| ... | ... | @@ -218,7 +217,6 @@ test "union with specified enum tag" { |
| 218 | 217 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 219 | 218 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 220 | 219 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 221 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 222 | 220 | |
| 223 | 221 | try doTest(); |
| 224 | 222 | try comptime doTest(); |
| ... | ... | @@ -381,7 +379,6 @@ test "tagged union initialization with runtime void" { |
| 381 | 379 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 382 | 380 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 383 | 381 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 384 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 385 | 382 | |
| 386 | 383 | try expect(testTaggedUnionInit({})); |
| 387 | 384 | } |
| ... | ... | @@ -466,7 +463,6 @@ test "initialize global array of union" { |
| 466 | 463 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 467 | 464 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 468 | 465 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 469 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 470 | 466 | |
| 471 | 467 | glbl_array[1] = FooUnion{ .U1 = 2 }; |
| 472 | 468 | glbl_array[0] = FooUnion{ .U0 = 1 }; |
| ... | ... | @@ -966,7 +962,6 @@ test "cast from anonymous struct to union" { |
| 966 | 962 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 967 | 963 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 968 | 964 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 969 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 970 | 965 | |
| 971 | 966 | const S = struct { |
| 972 | 967 | const U = union(enum) { |
| ... | ... | @@ -1056,7 +1051,6 @@ test "containers with single-field enums" { |
| 1056 | 1051 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 1057 | 1052 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 1058 | 1053 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1059 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 1060 | 1054 | |
| 1061 | 1055 | const S = struct { |
| 1062 | 1056 | const A = union(enum) { f1 }; |
| ... | ... | @@ -1573,7 +1567,6 @@ test "undefined-layout union field pointer has correct alignment" { |
| 1573 | 1567 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 1574 | 1568 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 1575 | 1569 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1576 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; // TODO | |
| 1577 | 1570 | |
| 1578 | 1571 | const S = struct { |
| 1579 | 1572 | fn doTheTest(comptime U: type) !void { |
| ... | ... | @@ -1659,6 +1652,8 @@ test "union with 128 bit integer" { |
| 1659 | 1652 | } |
| 1660 | 1653 | |
| 1661 | 1654 | test "memset extern union" { |
| 1655 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 1656 | ||
| 1662 | 1657 | const U = extern union { |
| 1663 | 1658 | foo: u8, |
| 1664 | 1659 | bar: u32, |
| ... | ... | @@ -1678,6 +1673,8 @@ test "memset extern union" { |
| 1678 | 1673 | } |
| 1679 | 1674 | |
| 1680 | 1675 | test "memset packed union" { |
| 1676 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 1677 | ||
| 1681 | 1678 | const U = packed union { |
| 1682 | 1679 | a: u32, |
| 1683 | 1680 | b: u8, |
| ... | ... | @@ -1703,6 +1700,8 @@ fn littleToNativeEndian(comptime T: type, v: T) T { |
| 1703 | 1700 | } |
| 1704 | 1701 | |
| 1705 | 1702 | test "reinterpret extern union" { |
| 1703 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 1704 | ||
| 1706 | 1705 | const U = extern union { |
| 1707 | 1706 | foo: u8, |
| 1708 | 1707 | baz: u32 align(8), |
| ... | ... | @@ -1771,6 +1770,8 @@ test "reinterpret extern union" { |
| 1771 | 1770 | } |
| 1772 | 1771 | |
| 1773 | 1772 | test "reinterpret packed union" { |
| 1773 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 1774 | ||
| 1774 | 1775 | const U = packed union { |
| 1775 | 1776 | foo: u8, |
| 1776 | 1777 | bar: u29, |
| ... | ... | @@ -1842,6 +1843,8 @@ test "reinterpret packed union" { |
| 1842 | 1843 | } |
| 1843 | 1844 | |
| 1844 | 1845 | test "reinterpret packed union inside packed struct" { |
| 1846 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 1847 | ||
| 1845 | 1848 | const U = packed union { |
| 1846 | 1849 | a: u7, |
| 1847 | 1850 | b: u1, |
test/behavior/usingnamespace.zig-1| ... | ... | @@ -55,7 +55,6 @@ usingnamespace @import("usingnamespace/a.zig"); |
| 55 | 55 | test "two files usingnamespace import each other" { |
| 56 | 56 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 57 | 57 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 58 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 59 | 58 | |
| 60 | 59 | try expect(@This().ok()); |
| 61 | 60 | } |
test/behavior/var_args.zig-10| ... | ... | @@ -14,8 +14,6 @@ fn add(args: anytype) i32 { |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | test "add arbitrary args" { |
| 17 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 18 | ||
| 19 | 17 | try expect(add(.{ @as(i32, 1), @as(i32, 2), @as(i32, 3), @as(i32, 4) }) == 10); |
| 20 | 18 | try expect(add(.{@as(i32, 1234)}) == 1234); |
| 21 | 19 | try expect(add(.{}) == 0); |
| ... | ... | @@ -26,15 +24,12 @@ fn readFirstVarArg(args: anytype) void { |
| 26 | 24 | } |
| 27 | 25 | |
| 28 | 26 | test "send void arg to var args" { |
| 29 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 30 | ||
| 31 | 27 | readFirstVarArg(.{{}}); |
| 32 | 28 | } |
| 33 | 29 | |
| 34 | 30 | test "pass args directly" { |
| 35 | 31 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 36 | 32 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 37 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 38 | 33 | |
| 39 | 34 | try expect(addSomeStuff(.{ @as(i32, 1), @as(i32, 2), @as(i32, 3), @as(i32, 4) }) == 10); |
| 40 | 35 | try expect(addSomeStuff(.{@as(i32, 1234)}) == 1234); |
| ... | ... | @@ -48,7 +43,6 @@ fn addSomeStuff(args: anytype) i32 { |
| 48 | 43 | test "runtime parameter before var args" { |
| 49 | 44 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 50 | 45 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 51 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 52 | 46 | |
| 53 | 47 | try expect((try extraFn(10, .{})) == 0); |
| 54 | 48 | try expect((try extraFn(10, .{false})) == 1); |
| ... | ... | @@ -87,15 +81,11 @@ fn foo2(args: anytype) bool { |
| 87 | 81 | } |
| 88 | 82 | |
| 89 | 83 | test "array of var args functions" { |
| 90 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 91 | ||
| 92 | 84 | try expect(foos[0](.{})); |
| 93 | 85 | try expect(!foos[1](.{})); |
| 94 | 86 | } |
| 95 | 87 | |
| 96 | 88 | test "pass zero length array to var args param" { |
| 97 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 98 | ||
| 99 | 89 | doNothingWithFirstArg(.{""}); |
| 100 | 90 | } |
| 101 | 91 |
test/behavior/vector.zig-21| ... | ... | @@ -11,7 +11,6 @@ test "implicit cast vector to array - bool" { |
| 11 | 11 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 12 | 12 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 13 | 13 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 14 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 15 | 14 | |
| 16 | 15 | const S = struct { |
| 17 | 16 | fn doTheTest() !void { |
| ... | ... | @@ -29,7 +28,6 @@ test "vector wrap operators" { |
| 29 | 28 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 30 | 29 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 31 | 30 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 32 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 33 | 31 | if (builtin.zig_backend == .stage2_x86_64 and |
| 34 | 32 | !comptime std.Target.x86.featureSetHas(builtin.cpu.features, .sse4_1)) return error.SkipZigTest; // TODO |
| 35 | 33 | |
| ... | ... | @@ -54,7 +52,6 @@ test "vector bin compares with mem.eql" { |
| 54 | 52 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 55 | 53 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 56 | 54 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 57 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 58 | 55 | |
| 59 | 56 | const S = struct { |
| 60 | 57 | fn doTheTest() !void { |
| ... | ... | @@ -124,7 +121,6 @@ test "vector bit operators" { |
| 124 | 121 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 125 | 122 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 126 | 123 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 127 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 128 | 124 | |
| 129 | 125 | const S = struct { |
| 130 | 126 | fn doTheTest() !void { |
| ... | ... | @@ -143,7 +139,6 @@ test "implicit cast vector to array" { |
| 143 | 139 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 144 | 140 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 145 | 141 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 146 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 147 | 142 | |
| 148 | 143 | const S = struct { |
| 149 | 144 | fn doTheTest() !void { |
| ... | ... | @@ -161,7 +156,6 @@ test "array to vector" { |
| 161 | 156 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 162 | 157 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 163 | 158 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 164 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 165 | 159 | |
| 166 | 160 | const S = struct { |
| 167 | 161 | fn doTheTest() !void { |
| ... | ... | @@ -286,7 +280,6 @@ test "vector casts of sizes not divisible by 8" { |
| 286 | 280 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 287 | 281 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 288 | 282 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 289 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 290 | 283 | |
| 291 | 284 | const S = struct { |
| 292 | 285 | fn doTheTest() !void { |
| ... | ... | @@ -367,7 +360,6 @@ test "load vector elements via comptime index" { |
| 367 | 360 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 368 | 361 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 369 | 362 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 370 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 371 | 363 | |
| 372 | 364 | const S = struct { |
| 373 | 365 | fn doTheTest() !void { |
| ... | ... | @@ -389,7 +381,6 @@ test "store vector elements via comptime index" { |
| 389 | 381 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 390 | 382 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 391 | 383 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 392 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 393 | 384 | |
| 394 | 385 | const S = struct { |
| 395 | 386 | fn doTheTest() !void { |
| ... | ... | @@ -417,7 +408,6 @@ test "load vector elements via runtime index" { |
| 417 | 408 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 418 | 409 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 419 | 410 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 420 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 421 | 411 | |
| 422 | 412 | const S = struct { |
| 423 | 413 | fn doTheTest() !void { |
| ... | ... | @@ -439,7 +429,6 @@ test "store vector elements via runtime index" { |
| 439 | 429 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 440 | 430 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 441 | 431 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 442 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 443 | 432 | |
| 444 | 433 | const S = struct { |
| 445 | 434 | fn doTheTest() !void { |
| ... | ... | @@ -462,7 +451,6 @@ test "initialize vector which is a struct field" { |
| 462 | 451 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 463 | 452 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 464 | 453 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 465 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 466 | 454 | |
| 467 | 455 | const Vec4Obj = struct { |
| 468 | 456 | data: @Vector(4, f32), |
| ... | ... | @@ -486,7 +474,6 @@ test "vector comparison operators" { |
| 486 | 474 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 487 | 475 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 488 | 476 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 489 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 490 | 477 | |
| 491 | 478 | const S = struct { |
| 492 | 479 | fn doTheTest() !void { |
| ... | ... | @@ -1168,7 +1155,6 @@ test "loading the second vector from a slice of vectors" { |
| 1168 | 1155 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 1169 | 1156 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 1170 | 1157 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1171 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 1172 | 1158 | |
| 1173 | 1159 | @setRuntimeSafety(false); |
| 1174 | 1160 | var small_bases = [2]@Vector(2, u8){ |
| ... | ... | @@ -1185,7 +1171,6 @@ test "array of vectors is copied" { |
| 1185 | 1171 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 1186 | 1172 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 1187 | 1173 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1188 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 1189 | 1174 | |
| 1190 | 1175 | const Vec3 = @Vector(3, i32); |
| 1191 | 1176 | var points = [_]Vec3{ |
| ... | ... | @@ -1256,7 +1241,6 @@ test "zero multiplicand" { |
| 1256 | 1241 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 1257 | 1242 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 1258 | 1243 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1259 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 1260 | 1244 | |
| 1261 | 1245 | const zeros = @Vector(2, u32){ 0.0, 0.0 }; |
| 1262 | 1246 | var ones = @Vector(2, u32){ 1.0, 1.0 }; |
| ... | ... | @@ -1317,7 +1301,6 @@ test "load packed vector element" { |
| 1317 | 1301 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 1318 | 1302 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 1319 | 1303 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1320 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 1321 | 1304 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO |
| 1322 | 1305 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO |
| 1323 | 1306 | |
| ... | ... | @@ -1348,7 +1331,6 @@ test "store to vector in slice" { |
| 1348 | 1331 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO |
| 1349 | 1332 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO |
| 1350 | 1333 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1351 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 1352 | 1334 | |
| 1353 | 1335 | var v = [_]@Vector(3, f32){ |
| 1354 | 1336 | .{ 1, 1, 1 }, |
| ... | ... | @@ -1412,7 +1394,6 @@ test "store vector with memset" { |
| 1412 | 1394 | test "addition of vectors represented as strings" { |
| 1413 | 1395 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 1414 | 1396 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 1415 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 1416 | 1397 | |
| 1417 | 1398 | const V = @Vector(3, u8); |
| 1418 | 1399 | const foo: V = "foo".*; |
| ... | ... | @@ -1438,7 +1419,6 @@ test "vector pointer is indexable" { |
| 1438 | 1419 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 1439 | 1420 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO |
| 1440 | 1421 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1441 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; // TODO | |
| 1442 | 1422 | |
| 1443 | 1423 | const V = @Vector(2, u32); |
| 1444 | 1424 | |
| ... | ... | @@ -1479,7 +1459,6 @@ test "bitcast to vector with different child type" { |
| 1479 | 1459 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 1480 | 1460 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO |
| 1481 | 1461 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1482 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; // TODO | |
| 1483 | 1462 | |
| 1484 | 1463 | const S = struct { |
| 1485 | 1464 | fn doTheTest() !void { |
test/behavior/void.zig-2| ... | ... | @@ -20,7 +20,6 @@ test "compare void with void compile time known" { |
| 20 | 20 | |
| 21 | 21 | test "iterate over a void slice" { |
| 22 | 22 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 23 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 24 | 23 | |
| 25 | 24 | var j: usize = 0; |
| 26 | 25 | for (times(10), 0..) |_, i| { |
| ... | ... | @@ -37,7 +36,6 @@ test "void optional" { |
| 37 | 36 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 38 | 37 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 39 | 38 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 40 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 41 | 39 | |
| 42 | 40 | var x: ?void = {}; |
| 43 | 41 | try expect(x != null); |
test/behavior/while.zig-1| ... | ... | @@ -172,7 +172,6 @@ test "while with optional as condition with else" { |
| 172 | 172 | |
| 173 | 173 | test "while with error union condition" { |
| 174 | 174 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 175 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 176 | 175 | |
| 177 | 176 | numbers_left = 10; |
| 178 | 177 | var sum: i32 = 0; |
test/behavior/widening.zig-2| ... | ... | @@ -22,8 +22,6 @@ fn zero() u0 { |
| 22 | 22 | return 0; |
| 23 | 23 | } |
| 24 | 24 | test "integer widening u0 to u8" { |
| 25 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 26 | ||
| 27 | 25 | const a: u8 = zero(); |
| 28 | 26 | try expect(a == 0); |
| 29 | 27 | } |