| author | |
| committer | |
| log | 3faf376b081caa47a98a172fe7c7f63f82b150e4 |
| tree | 26924f0e7aa1720da8e21b9e784b7725246ab712 |
| parent | 6c2f3745564aefa669b336e249888bb7390b3a3f |
| parent | 1042deb86fd57278f3a16fd064b370bf72f28160 |
| signature |
21 files changed, 197 insertions(+), 82 deletions(-)
src/arch/wasm/CodeGen.zig+193-36| ... | ... | @@ -1014,6 +1014,17 @@ fn typeToValtype(ty: Type, target: std.Target) wasm.Valtype { |
| 1014 | 1014 | .direct => wasm.Valtype.v128, |
| 1015 | 1015 | .unrolled => wasm.Valtype.i32, |
| 1016 | 1016 | }, |
| 1017 | .Union => switch (ty.containerLayout()) { | |
| 1018 | .Packed => { | |
| 1019 | var int_ty_payload: Type.Payload.Bits = .{ | |
| 1020 | .base = .{ .tag = .int_unsigned }, | |
| 1021 | .data = @intCast(u16, ty.bitSize(target)), | |
| 1022 | }; | |
| 1023 | const int_ty = Type.initPayload(&int_ty_payload.base); | |
| 1024 | return typeToValtype(int_ty, target); | |
| 1025 | }, | |
| 1026 | else => wasm.Valtype.i32, | |
| 1027 | }, | |
| 1017 | 1028 | else => wasm.Valtype.i32, // all represented as reference/immediate |
| 1018 | 1029 | }; |
| 1019 | 1030 | } |
| ... | ... | @@ -1715,8 +1726,15 @@ fn isByRef(ty: Type, target: std.Target) bool { |
| 1715 | 1726 | |
| 1716 | 1727 | .Array, |
| 1717 | 1728 | .Frame, |
| 1718 | .Union, | |
| 1719 | 1729 | => return ty.hasRuntimeBitsIgnoreComptime(), |
| 1730 | .Union => { | |
| 1731 | if (ty.castTag(.@"union")) |union_ty| { | |
| 1732 | if (union_ty.data.layout == .Packed) { | |
| 1733 | return ty.abiSize(target) > 8; | |
| 1734 | } | |
| 1735 | } | |
| 1736 | return ty.hasRuntimeBitsIgnoreComptime(); | |
| 1737 | }, | |
| 1720 | 1738 | .Struct => { |
| 1721 | 1739 | if (ty.castTag(.@"struct")) |struct_ty| { |
| 1722 | 1740 | const struct_obj = struct_ty.data; |
| ... | ... | @@ -2311,6 +2329,7 @@ fn airStore(func: *CodeGen, inst: Air.Inst.Index, safety: bool) InnerError!void |
| 2311 | 2329 | |
| 2312 | 2330 | fn store(func: *CodeGen, lhs: WValue, rhs: WValue, ty: Type, offset: u32) InnerError!void { |
| 2313 | 2331 | assert(!(lhs != .stack and rhs == .stack)); |
| 2332 | const abi_size = ty.abiSize(func.target); | |
| 2314 | 2333 | switch (ty.zigTypeTag()) { |
| 2315 | 2334 | .ErrorUnion => { |
| 2316 | 2335 | const pl_ty = ty.errorUnionPayload(); |
| ... | ... | @@ -2318,7 +2337,7 @@ fn store(func: *CodeGen, lhs: WValue, rhs: WValue, ty: Type, offset: u32) InnerE |
| 2318 | 2337 | return func.store(lhs, rhs, Type.anyerror, 0); |
| 2319 | 2338 | } |
| 2320 | 2339 | |
| 2321 | const len = @intCast(u32, ty.abiSize(func.target)); | |
| 2340 | const len = @intCast(u32, abi_size); | |
| 2322 | 2341 | return func.memcpy(lhs, rhs, .{ .imm32 = len }); |
| 2323 | 2342 | }, |
| 2324 | 2343 | .Optional => { |
| ... | ... | @@ -2334,16 +2353,16 @@ fn store(func: *CodeGen, lhs: WValue, rhs: WValue, ty: Type, offset: u32) InnerE |
| 2334 | 2353 | return func.store(lhs, rhs, Type.anyerror, 0); |
| 2335 | 2354 | } |
| 2336 | 2355 | |
| 2337 | const len = @intCast(u32, ty.abiSize(func.target)); | |
| 2356 | const len = @intCast(u32, abi_size); | |
| 2338 | 2357 | return func.memcpy(lhs, rhs, .{ .imm32 = len }); |
| 2339 | 2358 | }, |
| 2340 | 2359 | .Struct, .Array, .Union => if (isByRef(ty, func.target)) { |
| 2341 | const len = @intCast(u32, ty.abiSize(func.target)); | |
| 2360 | const len = @intCast(u32, abi_size); | |
| 2342 | 2361 | return func.memcpy(lhs, rhs, .{ .imm32 = len }); |
| 2343 | 2362 | }, |
| 2344 | 2363 | .Vector => switch (determineSimdStoreStrategy(ty, func.target)) { |
| 2345 | 2364 | .unrolled => { |
| 2346 | const len = @intCast(u32, ty.abiSize(func.target)); | |
| 2365 | const len = @intCast(u32, abi_size); | |
| 2347 | 2366 | return func.memcpy(lhs, rhs, .{ .imm32 = len }); |
| 2348 | 2367 | }, |
| 2349 | 2368 | .direct => { |
| ... | ... | @@ -2375,7 +2394,7 @@ fn store(func: *CodeGen, lhs: WValue, rhs: WValue, ty: Type, offset: u32) InnerE |
| 2375 | 2394 | return; |
| 2376 | 2395 | } |
| 2377 | 2396 | }, |
| 2378 | .Int => if (ty.intInfo(func.target).bits > 64) { | |
| 2397 | .Int, .Float => if (abi_size > 8 and abi_size <= 16) { | |
| 2379 | 2398 | try func.emitWValue(lhs); |
| 2380 | 2399 | const lsb = try func.load(rhs, Type.u64, 0); |
| 2381 | 2400 | try func.store(.{ .stack = {} }, lsb, Type.u64, 0 + lhs.offset()); |
| ... | ... | @@ -2384,8 +2403,15 @@ fn store(func: *CodeGen, lhs: WValue, rhs: WValue, ty: Type, offset: u32) InnerE |
| 2384 | 2403 | const msb = try func.load(rhs, Type.u64, 8); |
| 2385 | 2404 | try func.store(.{ .stack = {} }, msb, Type.u64, 8 + lhs.offset()); |
| 2386 | 2405 | return; |
| 2406 | } else if (abi_size > 16) { | |
| 2407 | try func.memcpy(lhs, rhs, .{ .imm32 = @intCast(u32, ty.abiSize(func.target)) }); | |
| 2408 | }, | |
| 2409 | else => if (abi_size > 8) { | |
| 2410 | return func.fail("TODO: `store` for type `{}` with abisize `{d}`", .{ | |
| 2411 | ty.fmt(func.bin_file.base.options.module.?), | |
| 2412 | abi_size, | |
| 2413 | }); | |
| 2387 | 2414 | }, |
| 2388 | else => {}, | |
| 2389 | 2415 | } |
| 2390 | 2416 | try func.emitWValue(lhs); |
| 2391 | 2417 | // In this case we're actually interested in storing the stack position |
| ... | ... | @@ -2393,11 +2419,9 @@ fn store(func: *CodeGen, lhs: WValue, rhs: WValue, ty: Type, offset: u32) InnerE |
| 2393 | 2419 | try func.lowerToStack(rhs); |
| 2394 | 2420 | |
| 2395 | 2421 | const valtype = typeToValtype(ty, func.target); |
| 2396 | const abi_size = @intCast(u8, ty.abiSize(func.target)); | |
| 2397 | ||
| 2398 | 2422 | const opcode = buildOpcode(.{ |
| 2399 | 2423 | .valtype1 = valtype, |
| 2400 | .width = abi_size * 8, | |
| 2424 | .width = @intCast(u8, abi_size * 8), | |
| 2401 | 2425 | .op = .store, |
| 2402 | 2426 | }); |
| 2403 | 2427 | |
| ... | ... | @@ -3131,6 +3155,14 @@ fn lowerConstant(func: *CodeGen, arg_val: Value, ty: Type) InnerError!WValue { |
| 3131 | 3155 | val.writeToMemory(ty, func.bin_file.base.options.module.?, &buf) catch unreachable; |
| 3132 | 3156 | return func.storeSimdImmd(buf); |
| 3133 | 3157 | }, |
| 3158 | .Union => { | |
| 3159 | // in this case we have a packed union which will not be passed by reference. | |
| 3160 | const union_ty = ty.cast(Type.Payload.Union).?.data; | |
| 3161 | const union_obj = val.castTag(.@"union").?.data; | |
| 3162 | const field_index = ty.unionTagFieldIndex(union_obj.tag, func.bin_file.base.options.module.?).?; | |
| 3163 | const field_ty = union_ty.fields.values()[field_index].ty; | |
| 3164 | return func.lowerConstant(union_obj.val, field_ty); | |
| 3165 | }, | |
| 3134 | 3166 | else => |zig_type| return func.fail("Wasm TODO: LowerConstant for zigTypeTag {}", .{zig_type}), |
| 3135 | 3167 | } |
| 3136 | 3168 | } |
| ... | ... | @@ -3146,7 +3178,7 @@ fn storeSimdImmd(func: *CodeGen, value: [16]u8) !WValue { |
| 3146 | 3178 | fn emitUndefined(func: *CodeGen, ty: Type) InnerError!WValue { |
| 3147 | 3179 | switch (ty.zigTypeTag()) { |
| 3148 | 3180 | .Bool, .ErrorSet => return WValue{ .imm32 = 0xaaaaaaaa }, |
| 3149 | .Int => switch (ty.intInfo(func.target).bits) { | |
| 3181 | .Int, .Enum => switch (ty.intInfo(func.target).bits) { | |
| 3150 | 3182 | 0...32 => return WValue{ .imm32 = 0xaaaaaaaa }, |
| 3151 | 3183 | 33...64 => return WValue{ .imm64 = 0xaaaaaaaaaaaaaaaa }, |
| 3152 | 3184 | else => unreachable, |
| ... | ... | @@ -3617,7 +3649,6 @@ fn airStructFieldVal(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 3617 | 3649 | .Packed => switch (struct_ty.zigTypeTag()) { |
| 3618 | 3650 | .Struct => result: { |
| 3619 | 3651 | const struct_obj = struct_ty.castTag(.@"struct").?.data; |
| 3620 | assert(struct_obj.layout == .Packed); | |
| 3621 | 3652 | const offset = struct_obj.packedFieldBitOffset(func.target, field_index); |
| 3622 | 3653 | const backing_ty = struct_obj.backing_int_ty; |
| 3623 | 3654 | const wasm_bits = toWasmBits(backing_ty.intInfo(func.target).bits) orelse { |
| ... | ... | @@ -3661,7 +3692,44 @@ fn airStructFieldVal(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 3661 | 3692 | const truncated = try func.trunc(shifted_value, field_ty, backing_ty); |
| 3662 | 3693 | break :result try truncated.toLocal(func, field_ty); |
| 3663 | 3694 | }, |
| 3664 | .Union => return func.fail("TODO: airStructFieldVal for packed unions", .{}), | |
| 3695 | .Union => result: { | |
| 3696 | if (isByRef(struct_ty, func.target)) { | |
| 3697 | if (!isByRef(field_ty, func.target)) { | |
| 3698 | const val = try func.load(operand, field_ty, 0); | |
| 3699 | break :result try val.toLocal(func, field_ty); | |
| 3700 | } else { | |
| 3701 | const new_stack_val = try func.allocStack(field_ty); | |
| 3702 | try func.store(new_stack_val, operand, field_ty, 0); | |
| 3703 | break :result new_stack_val; | |
| 3704 | } | |
| 3705 | } | |
| 3706 | ||
| 3707 | var payload: Type.Payload.Bits = .{ | |
| 3708 | .base = .{ .tag = .int_unsigned }, | |
| 3709 | .data = @intCast(u16, struct_ty.bitSize(func.target)), | |
| 3710 | }; | |
| 3711 | const union_int_type = Type.initPayload(&payload.base); | |
| 3712 | if (field_ty.zigTypeTag() == .Float) { | |
| 3713 | var int_payload: Type.Payload.Bits = .{ | |
| 3714 | .base = .{ .tag = .int_unsigned }, | |
| 3715 | .data = @intCast(u16, field_ty.bitSize(func.target)), | |
| 3716 | }; | |
| 3717 | const int_type = Type.initPayload(&int_payload.base); | |
| 3718 | const truncated = try func.trunc(operand, int_type, union_int_type); | |
| 3719 | const bitcasted = try func.bitcast(field_ty, int_type, truncated); | |
| 3720 | break :result try bitcasted.toLocal(func, field_ty); | |
| 3721 | } else if (field_ty.isPtrAtRuntime()) { | |
| 3722 | var int_payload: Type.Payload.Bits = .{ | |
| 3723 | .base = .{ .tag = .int_unsigned }, | |
| 3724 | .data = @intCast(u16, field_ty.bitSize(func.target)), | |
| 3725 | }; | |
| 3726 | const int_type = Type.initPayload(&int_payload.base); | |
| 3727 | const truncated = try func.trunc(operand, int_type, union_int_type); | |
| 3728 | break :result try truncated.toLocal(func, field_ty); | |
| 3729 | } | |
| 3730 | const truncated = try func.trunc(operand, field_ty, union_int_type); | |
| 3731 | break :result try truncated.toLocal(func, field_ty); | |
| 3732 | }, | |
| 3665 | 3733 | else => unreachable, |
| 3666 | 3734 | }, |
| 3667 | 3735 | else => result: { |
| ... | ... | @@ -3907,7 +3975,12 @@ fn airUnwrapErrUnionPayload(func: *CodeGen, inst: Air.Inst.Index, op_is_ptr: boo |
| 3907 | 3975 | const payload_ty = err_ty.errorUnionPayload(); |
| 3908 | 3976 | |
| 3909 | 3977 | const result = result: { |
| 3910 | if (!payload_ty.hasRuntimeBitsIgnoreComptime()) break :result WValue{ .none = {} }; | |
| 3978 | if (!payload_ty.hasRuntimeBitsIgnoreComptime()) { | |
| 3979 | if (op_is_ptr) { | |
| 3980 | break :result func.reuseOperand(ty_op.operand, operand); | |
| 3981 | } | |
| 3982 | break :result WValue{ .none = {} }; | |
| 3983 | } | |
| 3911 | 3984 | |
| 3912 | 3985 | const pl_offset = @intCast(u32, errUnionPayloadOffset(payload_ty, func.target)); |
| 3913 | 3986 | if (op_is_ptr or isByRef(payload_ty, func.target)) { |
| ... | ... | @@ -4397,7 +4470,7 @@ fn airPtrElemVal(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 4397 | 4470 | try func.addTag(.i32_add); |
| 4398 | 4471 | |
| 4399 | 4472 | const elem_result = val: { |
| 4400 | var result = try func.allocLocal(elem_ty); | |
| 4473 | var result = try func.allocLocal(Type.usize); | |
| 4401 | 4474 | try func.addLabel(.local_set, result.local.value); |
| 4402 | 4475 | if (isByRef(elem_ty, func.target)) { |
| 4403 | 4476 | break :val result; |
| ... | ... | @@ -4864,6 +4937,9 @@ fn airAggregateInit(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 4864 | 4937 | const result = try func.allocStack(result_ty); |
| 4865 | 4938 | const elem_ty = result_ty.childType(); |
| 4866 | 4939 | const elem_size = @intCast(u32, elem_ty.abiSize(func.target)); |
| 4940 | const sentinel = if (result_ty.sentinel()) |sent| blk: { | |
| 4941 | break :blk try func.lowerConstant(sent, elem_ty); | |
| 4942 | } else null; | |
| 4867 | 4943 | |
| 4868 | 4944 | // When the element type is by reference, we must copy the entire |
| 4869 | 4945 | // value. It is therefore safer to move the offset pointer and store |
| ... | ... | @@ -4876,10 +4952,13 @@ fn airAggregateInit(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 4876 | 4952 | const elem_val = try func.resolveInst(elem); |
| 4877 | 4953 | try func.store(offset, elem_val, elem_ty, 0); |
| 4878 | 4954 | |
| 4879 | if (elem_index < elements.len - 1) { | |
| 4955 | if (elem_index < elements.len - 1 and sentinel == null) { | |
| 4880 | 4956 | _ = try func.buildPointerOffset(offset, elem_size, .modify); |
| 4881 | 4957 | } |
| 4882 | 4958 | } |
| 4959 | if (sentinel) |sent| { | |
| 4960 | try func.store(offset, sent, elem_ty, 0); | |
| 4961 | } | |
| 4883 | 4962 | } else { |
| 4884 | 4963 | var offset: u32 = 0; |
| 4885 | 4964 | for (elements) |elem| { |
| ... | ... | @@ -4887,6 +4966,9 @@ fn airAggregateInit(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 4887 | 4966 | try func.store(result, elem_val, elem_ty, offset); |
| 4888 | 4967 | offset += elem_size; |
| 4889 | 4968 | } |
| 4969 | if (sentinel) |sent| { | |
| 4970 | try func.store(result, sent, elem_ty, offset); | |
| 4971 | } | |
| 4890 | 4972 | } |
| 4891 | 4973 | break :result_value result; |
| 4892 | 4974 | }, |
| ... | ... | @@ -4982,31 +5064,85 @@ fn airUnionInit(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 4982 | 5064 | const result = result: { |
| 4983 | 5065 | const union_ty = func.air.typeOfIndex(inst); |
| 4984 | 5066 | const layout = union_ty.unionGetLayout(func.target); |
| 5067 | const union_obj = union_ty.cast(Type.Payload.Union).?.data; | |
| 5068 | const field = union_obj.fields.values()[extra.field_index]; | |
| 5069 | const field_name = union_obj.fields.keys()[extra.field_index]; | |
| 5070 | ||
| 5071 | const tag_int = blk: { | |
| 5072 | const tag_ty = union_ty.unionTagTypeHypothetical(); | |
| 5073 | const enum_field_index = tag_ty.enumFieldIndex(field_name).?; | |
| 5074 | var tag_val_payload: Value.Payload.U32 = .{ | |
| 5075 | .base = .{ .tag = .enum_field_index }, | |
| 5076 | .data = @intCast(u32, enum_field_index), | |
| 5077 | }; | |
| 5078 | const tag_val = Value.initPayload(&tag_val_payload.base); | |
| 5079 | break :blk try func.lowerConstant(tag_val, tag_ty); | |
| 5080 | }; | |
| 4985 | 5081 | if (layout.payload_size == 0) { |
| 4986 | 5082 | if (layout.tag_size == 0) { |
| 4987 | 5083 | break :result WValue{ .none = {} }; |
| 4988 | 5084 | } |
| 4989 | 5085 | assert(!isByRef(union_ty, func.target)); |
| 4990 | break :result WValue{ .imm32 = extra.field_index }; | |
| 5086 | break :result tag_int; | |
| 4991 | 5087 | } |
| 4992 | assert(isByRef(union_ty, func.target)); | |
| 4993 | 5088 | |
| 4994 | const result_ptr = try func.allocStack(union_ty); | |
| 4995 | const payload = try func.resolveInst(extra.init); | |
| 4996 | const union_obj = union_ty.cast(Type.Payload.Union).?.data; | |
| 4997 | assert(union_obj.haveFieldTypes()); | |
| 4998 | const field = union_obj.fields.values()[extra.field_index]; | |
| 5089 | if (isByRef(union_ty, func.target)) { | |
| 5090 | const result_ptr = try func.allocStack(union_ty); | |
| 5091 | const payload = try func.resolveInst(extra.init); | |
| 5092 | if (layout.tag_align >= layout.payload_align) { | |
| 5093 | if (isByRef(field.ty, func.target)) { | |
| 5094 | const payload_ptr = try func.buildPointerOffset(result_ptr, layout.tag_size, .new); | |
| 5095 | try func.store(payload_ptr, payload, field.ty, 0); | |
| 5096 | } else { | |
| 5097 | try func.store(result_ptr, payload, field.ty, @intCast(u32, layout.tag_size)); | |
| 5098 | } | |
| 4999 | 5099 | |
| 5000 | if (layout.tag_align >= layout.payload_align) { | |
| 5001 | const payload_ptr = try func.buildPointerOffset(result_ptr, layout.tag_size, .new); | |
| 5002 | try func.store(payload_ptr, payload, field.ty, 0); | |
| 5100 | if (layout.tag_size > 0) { | |
| 5101 | try func.store(result_ptr, tag_int, union_obj.tag_ty, 0); | |
| 5102 | } | |
| 5103 | } else { | |
| 5104 | try func.store(result_ptr, payload, field.ty, 0); | |
| 5105 | if (layout.tag_size > 0) { | |
| 5106 | try func.store( | |
| 5107 | result_ptr, | |
| 5108 | tag_int, | |
| 5109 | union_obj.tag_ty, | |
| 5110 | @intCast(u32, layout.payload_size), | |
| 5111 | ); | |
| 5112 | } | |
| 5113 | } | |
| 5114 | break :result result_ptr; | |
| 5003 | 5115 | } else { |
| 5004 | try func.store(result_ptr, payload, field.ty, 0); | |
| 5116 | const operand = try func.resolveInst(extra.init); | |
| 5117 | var payload: Type.Payload.Bits = .{ | |
| 5118 | .base = .{ .tag = .int_unsigned }, | |
| 5119 | .data = @intCast(u16, union_ty.bitSize(func.target)), | |
| 5120 | }; | |
| 5121 | const union_int_type = Type.initPayload(&payload.base); | |
| 5122 | if (field.ty.zigTypeTag() == .Float) { | |
| 5123 | var int_payload: Type.Payload.Bits = .{ | |
| 5124 | .base = .{ .tag = .int_unsigned }, | |
| 5125 | .data = @intCast(u16, field.ty.bitSize(func.target)), | |
| 5126 | }; | |
| 5127 | const int_type = Type.initPayload(&int_payload.base); | |
| 5128 | const bitcasted = try func.bitcast(field.ty, int_type, operand); | |
| 5129 | const casted = try func.trunc(bitcasted, int_type, union_int_type); | |
| 5130 | break :result try casted.toLocal(func, field.ty); | |
| 5131 | } else if (field.ty.isPtrAtRuntime()) { | |
| 5132 | var int_payload: Type.Payload.Bits = .{ | |
| 5133 | .base = .{ .tag = .int_unsigned }, | |
| 5134 | .data = @intCast(u16, field.ty.bitSize(func.target)), | |
| 5135 | }; | |
| 5136 | const int_type = Type.initPayload(&int_payload.base); | |
| 5137 | const casted = try func.intcast(operand, int_type, union_int_type); | |
| 5138 | break :result try casted.toLocal(func, field.ty); | |
| 5139 | } | |
| 5140 | const casted = try func.intcast(operand, field.ty, union_int_type); | |
| 5141 | break :result try casted.toLocal(func, field.ty); | |
| 5005 | 5142 | } |
| 5006 | break :result result_ptr; | |
| 5007 | 5143 | }; |
| 5008 | 5144 | |
| 5009 | func.finishAir(inst, result, &.{extra.init}); | |
| 5145 | return func.finishAir(inst, result, &.{extra.init}); | |
| 5010 | 5146 | } |
| 5011 | 5147 | |
| 5012 | 5148 | fn airPrefetch(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| ... | ... | @@ -5073,8 +5209,8 @@ fn cmpOptionals(func: *CodeGen, lhs: WValue, rhs: WValue, operand_ty: Type, op: |
| 5073 | 5209 | fn cmpBigInt(func: *CodeGen, lhs: WValue, rhs: WValue, operand_ty: Type, op: std.math.CompareOperator) InnerError!WValue { |
| 5074 | 5210 | assert(operand_ty.abiSize(func.target) >= 16); |
| 5075 | 5211 | assert(!(lhs != .stack and rhs == .stack)); |
| 5076 | if (operand_ty.intInfo(func.target).bits > 128) { | |
| 5077 | return func.fail("TODO: Support cmpBigInt for integer bitsize: '{d}'", .{operand_ty.intInfo(func.target).bits}); | |
| 5212 | if (operand_ty.bitSize(func.target) > 128) { | |
| 5213 | return func.fail("TODO: Support cmpBigInt for integer bitsize: '{d}'", .{operand_ty.bitSize(func.target)}); | |
| 5078 | 5214 | } |
| 5079 | 5215 | |
| 5080 | 5216 | var lhs_high_bit = try (try func.load(lhs, Type.u64, 0)).toLocal(func, Type.u64); |
| ... | ... | @@ -5295,11 +5431,23 @@ fn airMemcpy(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 5295 | 5431 | const bin_op = func.air.instructions.items(.data)[inst].bin_op; |
| 5296 | 5432 | const dst = try func.resolveInst(bin_op.lhs); |
| 5297 | 5433 | const dst_ty = func.air.typeOf(bin_op.lhs); |
| 5434 | const ptr_elem_ty = dst_ty.childType(); | |
| 5298 | 5435 | const src = try func.resolveInst(bin_op.rhs); |
| 5299 | 5436 | const src_ty = func.air.typeOf(bin_op.rhs); |
| 5300 | 5437 | const len = switch (dst_ty.ptrSize()) { |
| 5301 | .Slice => try func.sliceLen(dst), | |
| 5302 | .One => @as(WValue, .{ .imm32 = @intCast(u32, dst_ty.childType().arrayLen()) }), | |
| 5438 | .Slice => blk: { | |
| 5439 | const slice_len = try func.sliceLen(dst); | |
| 5440 | if (ptr_elem_ty.abiSize(func.target) != 1) { | |
| 5441 | try func.emitWValue(slice_len); | |
| 5442 | try func.emitWValue(.{ .imm32 = @intCast(u32, ptr_elem_ty.abiSize(func.target)) }); | |
| 5443 | try func.addTag(.i32_mul); | |
| 5444 | try func.addLabel(.local_set, slice_len.local.value); | |
| 5445 | } | |
| 5446 | break :blk slice_len; | |
| 5447 | }, | |
| 5448 | .One => @as(WValue, .{ | |
| 5449 | .imm32 = @intCast(u32, ptr_elem_ty.arrayLen() * ptr_elem_ty.childType().abiSize(func.target)), | |
| 5450 | }), | |
| 5303 | 5451 | .C, .Many => unreachable, |
| 5304 | 5452 | }; |
| 5305 | 5453 | const dst_ptr = try func.sliceOrArrayPtr(dst, dst_ty); |
| ... | ... | @@ -5559,6 +5707,7 @@ fn airShlWithOverflow(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 5559 | 5707 | const lhs = try func.resolveInst(extra.lhs); |
| 5560 | 5708 | const rhs = try func.resolveInst(extra.rhs); |
| 5561 | 5709 | const lhs_ty = func.air.typeOf(extra.lhs); |
| 5710 | const rhs_ty = func.air.typeOf(extra.rhs); | |
| 5562 | 5711 | |
| 5563 | 5712 | if (lhs_ty.zigTypeTag() == .Vector) { |
| 5564 | 5713 | return func.fail("TODO: Implement overflow arithmetic for vectors", .{}); |
| ... | ... | @@ -5570,7 +5719,15 @@ fn airShlWithOverflow(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 5570 | 5719 | return func.fail("TODO: Implement shl_with_overflow for integer bitsize: {d}", .{int_info.bits}); |
| 5571 | 5720 | }; |
| 5572 | 5721 | |
| 5573 | var shl = try (try func.binOp(lhs, rhs, lhs_ty, .shl)).toLocal(func, lhs_ty); | |
| 5722 | // Ensure rhs is coerced to lhs as they must have the same WebAssembly types | |
| 5723 | // before we can perform any binary operation. | |
| 5724 | const rhs_wasm_bits = toWasmBits(rhs_ty.intInfo(func.target).bits).?; | |
| 5725 | const rhs_final = if (wasm_bits != rhs_wasm_bits) blk: { | |
| 5726 | const rhs_casted = try func.intcast(rhs, rhs_ty, lhs_ty); | |
| 5727 | break :blk try rhs_casted.toLocal(func, lhs_ty); | |
| 5728 | } else rhs; | |
| 5729 | ||
| 5730 | var shl = try (try func.binOp(lhs, rhs_final, lhs_ty, .shl)).toLocal(func, lhs_ty); | |
| 5574 | 5731 | defer shl.free(func); |
| 5575 | 5732 | var result = if (wasm_bits != int_info.bits) blk: { |
| 5576 | 5733 | break :blk try (try func.wrapOperand(shl, lhs_ty)).toLocal(func, lhs_ty); |
| ... | ... | @@ -5581,11 +5738,11 @@ fn airShlWithOverflow(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 5581 | 5738 | // emit lhs to stack to we can keep 'wrapped' on the stack also |
| 5582 | 5739 | try func.emitWValue(lhs); |
| 5583 | 5740 | const abs = try func.signAbsValue(shl, lhs_ty); |
| 5584 | const wrapped = try func.wrapBinOp(abs, rhs, lhs_ty, .shr); | |
| 5741 | const wrapped = try func.wrapBinOp(abs, rhs_final, lhs_ty, .shr); | |
| 5585 | 5742 | break :blk try func.cmp(.{ .stack = {} }, wrapped, lhs_ty, .neq); |
| 5586 | 5743 | } else blk: { |
| 5587 | 5744 | try func.emitWValue(lhs); |
| 5588 | const shr = try func.binOp(result, rhs, lhs_ty, .shr); | |
| 5745 | const shr = try func.binOp(result, rhs_final, lhs_ty, .shr); | |
| 5589 | 5746 | break :blk try func.cmp(.{ .stack = {} }, shr, lhs_ty, .neq); |
| 5590 | 5747 | }; |
| 5591 | 5748 | var overflow_local = try overflow_bit.toLocal(func, Type.initTag(.u1)); |
src/codegen.zig+4| ... | ... | @@ -611,6 +611,10 @@ pub fn generateSymbol( |
| 611 | 611 | } |
| 612 | 612 | } |
| 613 | 613 | |
| 614 | if (layout.padding > 0) { | |
| 615 | try code.writer().writeByteNTimes(0, layout.padding); | |
| 616 | } | |
| 617 | ||
| 614 | 618 | return Result.ok; |
| 615 | 619 | }, |
| 616 | 620 | .Optional => { |
test/behavior/align.zig-1| ... | ... | @@ -16,7 +16,6 @@ test "global variable alignment" { |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | test "slicing array of length 1 can not assume runtime index is always zero" { |
| 19 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | |
| 20 | 19 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 21 | 20 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 22 | 21 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
test/behavior/atomics.zig-1| ... | ... | @@ -383,7 +383,6 @@ fn testAtomicRmwInt128(comptime signedness: std.builtin.Signedness) !void { |
| 383 | 383 | } |
| 384 | 384 | |
| 385 | 385 | test "atomics with different types" { |
| 386 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | |
| 387 | 386 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 388 | 387 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 389 | 388 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
test/behavior/basic.zig-3| ... | ... | @@ -413,7 +413,6 @@ test "array 2D const double ptr with offset" { |
| 413 | 413 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 414 | 414 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 415 | 415 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 416 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; | |
| 417 | 416 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 418 | 417 | |
| 419 | 418 | const rect_2d_vertexes = [_][2]f32{ |
| ... | ... | @@ -427,7 +426,6 @@ test "array 3D const double ptr with offset" { |
| 427 | 426 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 428 | 427 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 429 | 428 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 430 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | |
| 431 | 429 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 432 | 430 | |
| 433 | 431 | const rect_3d_vertexes = [_][2][2]f32{ |
| ... | ... | @@ -1052,7 +1050,6 @@ test "inline call of function with a switch inside the return statement" { |
| 1052 | 1050 | } |
| 1053 | 1051 | |
| 1054 | 1052 | test "namespace lookup ignores decl causing the lookup" { |
| 1055 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | |
| 1056 | 1053 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 1057 | 1054 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 1058 | 1055 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
test/behavior/bugs/12142.zig-1| ... | ... | @@ -19,7 +19,6 @@ fn letter(e: Letter) u8 { |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | test { |
| 22 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | |
| 23 | 22 | if (builtin.zig_backend == .stage2_x86) return error.SkipZigTest; // TODO |
| 24 | 23 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 25 | 24 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
test/behavior/bugs/13113.zig-1| ... | ... | @@ -7,7 +7,6 @@ const Foo = extern struct { |
| 7 | 7 | }; |
| 8 | 8 | |
| 9 | 9 | test { |
| 10 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | |
| 11 | 10 | if (builtin.zig_backend == .stage2_x86) return error.SkipZigTest; // TODO |
| 12 | 11 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 13 | 12 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
test/behavior/bugs/13128.zig-1| ... | ... | @@ -14,7 +14,6 @@ fn foo(val: U) !void { |
| 14 | 14 | test "runtime union init, most-aligned field != largest" { |
| 15 | 15 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 16 | 16 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 17 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | |
| 18 | 17 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 19 | 18 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 20 | 19 |
test/behavior/bugs/13664.zig-1| ... | ... | @@ -13,7 +13,6 @@ fn value() i64 { |
| 13 | 13 | return 1341; |
| 14 | 14 | } |
| 15 | 15 | test { |
| 16 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | |
| 17 | 16 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO |
| 18 | 17 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 19 | 18 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
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_x86_64) return error.SkipZigTest; |
| 16 | 16 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 17 | 17 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 18 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; | |
| 19 | 18 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 20 | 19 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 21 | 20 |
test/behavior/cast_int.zig-1| ... | ... | @@ -4,7 +4,6 @@ const expect = std.testing.expect; |
| 4 | 4 | const maxInt = std.math.maxInt; |
| 5 | 5 | |
| 6 | 6 | test "@intCast i32 to u7" { |
| 7 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | |
| 8 | 7 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 9 | 8 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 10 | 9 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
test/behavior/empty_union.zig-5| ... | ... | @@ -3,15 +3,12 @@ const std = @import("std"); |
| 3 | 3 | const expect = std.testing.expect; |
| 4 | 4 | |
| 5 | 5 | test "switch on empty enum" { |
| 6 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | |
| 7 | ||
| 8 | 6 | const E = enum {}; |
| 9 | 7 | var e: E = undefined; |
| 10 | 8 | switch (e) {} |
| 11 | 9 | } |
| 12 | 10 | |
| 13 | 11 | test "switch on empty enum with a specified tag type" { |
| 14 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | |
| 15 | 12 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 16 | 13 | |
| 17 | 14 | const E = enum(u8) {}; |
| ... | ... | @@ -21,7 +18,6 @@ test "switch on empty enum with a specified tag type" { |
| 21 | 18 | |
| 22 | 19 | test "switch on empty auto numbered tagged union" { |
| 23 | 20 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 24 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | |
| 25 | 21 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 26 | 22 | |
| 27 | 23 | const U = union(enum(u8)) {}; |
| ... | ... | @@ -31,7 +27,6 @@ test "switch on empty auto numbered tagged union" { |
| 31 | 27 | |
| 32 | 28 | test "switch on empty tagged union" { |
| 33 | 29 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 34 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | |
| 35 | 30 | |
| 36 | 31 | const E = enum {}; |
| 37 | 32 | const U = union(E) {}; |
test/behavior/enum.zig-2| ... | ... | @@ -1079,7 +1079,6 @@ const bit_field_1 = BitFieldOfEnums{ |
| 1079 | 1079 | }; |
| 1080 | 1080 | |
| 1081 | 1081 | test "bit field access with enum fields" { |
| 1082 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | |
| 1083 | 1082 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 1084 | 1083 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 1085 | 1084 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| ... | ... | @@ -1120,7 +1119,6 @@ test "enum literal in array literal" { |
| 1120 | 1119 | } |
| 1121 | 1120 | |
| 1122 | 1121 | test "tag name functions are unique" { |
| 1123 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | |
| 1124 | 1122 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 1125 | 1123 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 1126 | 1124 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
test/behavior/error.zig-5| ... | ... | @@ -720,7 +720,6 @@ test "ret_ptr doesn't cause own inferred error set to be resolved" { |
| 720 | 720 | } |
| 721 | 721 | |
| 722 | 722 | test "simple else prong allowed even when all errors handled" { |
| 723 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | |
| 724 | 723 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 725 | 724 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 726 | 725 | |
| ... | ... | @@ -749,7 +748,6 @@ test "simple else prong allowed even when all errors handled" { |
| 749 | 748 | test "pointer to error union payload" { |
| 750 | 749 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 751 | 750 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 752 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | |
| 753 | 751 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 754 | 752 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 755 | 753 | |
| ... | ... | @@ -783,7 +781,6 @@ const NoReturn = struct { |
| 783 | 781 | test "error union of noreturn used with if" { |
| 784 | 782 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 785 | 783 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 786 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | |
| 787 | 784 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 788 | 785 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 789 | 786 | |
| ... | ... | @@ -798,7 +795,6 @@ test "error union of noreturn used with if" { |
| 798 | 795 | test "error union of noreturn used with try" { |
| 799 | 796 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 800 | 797 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 801 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | |
| 802 | 798 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 803 | 799 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 804 | 800 | |
| ... | ... | @@ -810,7 +806,6 @@ test "error union of noreturn used with try" { |
| 810 | 806 | test "error union of noreturn used with catch" { |
| 811 | 807 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 812 | 808 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 813 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | |
| 814 | 809 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 815 | 810 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 816 | 811 |
test/behavior/eval.zig-5| ... | ... | @@ -470,7 +470,6 @@ test "binary math operator in partially inlined function" { |
| 470 | 470 | } |
| 471 | 471 | |
| 472 | 472 | test "comptime shl" { |
| 473 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | |
| 474 | 473 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 475 | 474 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 476 | 475 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| ... | ... | @@ -501,7 +500,6 @@ test "comptime bitwise operators" { |
| 501 | 500 | |
| 502 | 501 | test "comptime shlWithOverflow" { |
| 503 | 502 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 504 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | |
| 505 | 503 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 506 | 504 | |
| 507 | 505 | const ct_shifted = @shlWithOverflow(~@as(u64, 0), 16)[0]; |
| ... | ... | @@ -812,7 +810,6 @@ test "array concatenation peer resolves element types - pointer" { |
| 812 | 810 | } |
| 813 | 811 | |
| 814 | 812 | test "array concatenation sets the sentinel - value" { |
| 815 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; | |
| 816 | 813 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 817 | 814 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 818 | 815 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| ... | ... | @@ -850,7 +847,6 @@ test "array concatenation sets the sentinel - pointer" { |
| 850 | 847 | } |
| 851 | 848 | |
| 852 | 849 | test "array multiplication sets the sentinel - value" { |
| 853 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; | |
| 854 | 850 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 855 | 851 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 856 | 852 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| ... | ... | @@ -1550,7 +1546,6 @@ test "x or true is comptime-known true" { |
| 1550 | 1546 | test "non-optional and optional array elements concatenated" { |
| 1551 | 1547 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 1552 | 1548 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 1553 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | |
| 1554 | 1549 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1555 | 1550 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 1556 | 1551 |
test/behavior/optional.zig-1| ... | ... | @@ -365,7 +365,6 @@ test "optional pointer to zero bit optional payload" { |
| 365 | 365 | test "optional pointer to zero bit error union payload" { |
| 366 | 366 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 367 | 367 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 368 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | |
| 369 | 368 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 370 | 369 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 371 | 370 |
test/behavior/ptrcast.zig-2| ... | ... | @@ -129,7 +129,6 @@ fn testReinterpretOverAlignedExternStructAsExternStruct() !void { |
| 129 | 129 | test "lower reinterpreted comptime field ptr (with under-aligned fields)" { |
| 130 | 130 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 131 | 131 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 132 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | |
| 133 | 132 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 134 | 133 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 135 | 134 | |
| ... | ... | @@ -153,7 +152,6 @@ test "lower reinterpreted comptime field ptr (with under-aligned fields)" { |
| 153 | 152 | test "lower reinterpreted comptime field ptr" { |
| 154 | 153 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 155 | 154 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 156 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | |
| 157 | 155 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 158 | 156 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 159 | 157 |
test/behavior/return_address.zig-1| ... | ... | @@ -6,7 +6,6 @@ fn retAddr() usize { |
| 6 | 6 | } |
| 7 | 7 | |
| 8 | 8 | test "return address" { |
| 9 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | |
| 10 | 9 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 11 | 10 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 12 | 11 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
test/behavior/type.zig-2| ... | ... | @@ -258,7 +258,6 @@ test "Type.ErrorSet" { |
| 258 | 258 | } |
| 259 | 259 | |
| 260 | 260 | test "Type.Struct" { |
| 261 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | |
| 262 | 261 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 263 | 262 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 264 | 263 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| ... | ... | @@ -488,7 +487,6 @@ test "Type.Union from regular enum" { |
| 488 | 487 | } |
| 489 | 488 | |
| 490 | 489 | test "Type.Fn" { |
| 491 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | |
| 492 | 490 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 493 | 491 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 494 | 492 |
test/behavior/union.zig-11| ... | ... | @@ -452,7 +452,6 @@ var glbl: Foo1 = undefined; |
| 452 | 452 | test "global union with single field is correctly initialized" { |
| 453 | 453 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 454 | 454 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 455 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | |
| 456 | 455 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 457 | 456 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 458 | 457 | |
| ... | ... | @@ -500,7 +499,6 @@ test "update the tag value for zero-sized unions" { |
| 500 | 499 | test "union initializer generates padding only if needed" { |
| 501 | 500 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 502 | 501 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 503 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | |
| 504 | 502 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 505 | 503 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 506 | 504 | |
| ... | ... | @@ -788,7 +786,6 @@ fn Setter(comptime attr: Attribute) type { |
| 788 | 786 | test "return union init with void payload" { |
| 789 | 787 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 790 | 788 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 791 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | |
| 792 | 789 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 793 | 790 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 794 | 791 | |
| ... | ... | @@ -814,7 +811,6 @@ test "return union init with void payload" { |
| 814 | 811 | test "@unionInit stored to a const" { |
| 815 | 812 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 816 | 813 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 817 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | |
| 818 | 814 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 819 | 815 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 820 | 816 | |
| ... | ... | @@ -985,7 +981,6 @@ test "function call result coerces from tagged union to the tag" { |
| 985 | 981 | test "cast from anonymous struct to union" { |
| 986 | 982 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 987 | 983 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 988 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | |
| 989 | 984 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 990 | 985 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 991 | 986 | |
| ... | ... | @@ -1018,7 +1013,6 @@ test "cast from anonymous struct to union" { |
| 1018 | 1013 | test "cast from pointer to anonymous struct to pointer to union" { |
| 1019 | 1014 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 1020 | 1015 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 1021 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | |
| 1022 | 1016 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1023 | 1017 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 1024 | 1018 | |
| ... | ... | @@ -1108,7 +1102,6 @@ test "containers with single-field enums" { |
| 1108 | 1102 | test "@unionInit on union with tag but no fields" { |
| 1109 | 1103 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 1110 | 1104 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 1111 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | |
| 1112 | 1105 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1113 | 1106 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 1114 | 1107 | |
| ... | ... | @@ -1382,7 +1375,6 @@ test "union and enum field order doesn't match" { |
| 1382 | 1375 | test "@unionInit uses tag value instead of field index" { |
| 1383 | 1376 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 1384 | 1377 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 1385 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | |
| 1386 | 1378 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1387 | 1379 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 1388 | 1380 | |
| ... | ... | @@ -1440,7 +1432,6 @@ test "union field ptr - zero sized field" { |
| 1440 | 1432 | test "packed union in packed struct" { |
| 1441 | 1433 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 1442 | 1434 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 1443 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | |
| 1444 | 1435 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1445 | 1436 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 1446 | 1437 | |
| ... | ... | @@ -1528,7 +1519,6 @@ test "union reassignment can use previous value" { |
| 1528 | 1519 | test "packed union with zero-bit field" { |
| 1529 | 1520 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 1530 | 1521 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 1531 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | |
| 1532 | 1522 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1533 | 1523 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 1534 | 1524 | |
| ... | ... | @@ -1549,7 +1539,6 @@ test "packed union with zero-bit field" { |
| 1549 | 1539 | test "reinterpreting enum value inside packed union" { |
| 1550 | 1540 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 1551 | 1541 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 1552 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | |
| 1553 | 1542 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 1554 | 1543 | |
| 1555 | 1544 | const U = packed union { |
test/behavior/union_with_members.zig-1| ... | ... | @@ -17,7 +17,6 @@ const ET = union(enum) { |
| 17 | 17 | }; |
| 18 | 18 | |
| 19 | 19 | test "enum with members" { |
| 20 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | |
| 21 | 20 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 22 | 21 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 23 | 22 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |