authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2022-01-18 01:25:48+01:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2022-01-18 01:25:48+01:00
loge69cb9105a716dfd4a8cc2684417545b2438f606
treed80540e1ff8f325f753ee3537daac3d8cbf0f975
parentf4e051e35d8019c9a8d99ccae8f2e9d8f032629a
parent3145fa97c21704d8822db928e5f988f22497b1b8
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

Merge pull request #10616 from ziglang/stage2-x86_64-array-to-slice

stage2: implement airArrayToSlice for x86_64

4 files changed, 137 insertions(+), 46 deletions(-)

src/arch/x86_64/CodeGen.zig+27-6
...@@ -1659,6 +1659,18 @@ fn store(self: *Self, ptr: MCValue, value: MCValue, ptr_ty: Type, value_ty: Type...@@ -1659,6 +1659,18 @@ fn store(self: *Self, ptr: MCValue, value: MCValue, ptr_ty: Type, value_ty: Type
1659 },1659 },
1660 }1660 }
1661 },1661 },
1662 .register => |src_reg| {
1663 const abi_size = value_ty.abiSize(self.target.*);
1664 _ = try self.addInst(.{
1665 .tag = .mov,
1666 .ops = (Mir.Ops{
1667 .reg1 = reg.to64(),
1668 .reg2 = registerAlias(src_reg, @intCast(u32, abi_size)),
1669 .flags = 0b10,
1670 }).encode(),
1671 .data = .{ .imm = 0 },
1672 });
1673 },
1662 else => |other| {1674 else => |other| {
1663 return self.fail("TODO implement set pointee with {}", .{other});1675 return self.fail("TODO implement set pointee with {}", .{other});
1664 },1676 },
...@@ -1822,7 +1834,7 @@ fn genBinMathOp(self: *Self, inst: Air.Inst.Index, op_lhs: Air.Inst.Ref, op_rhs:...@@ -1822,7 +1834,7 @@ fn genBinMathOp(self: *Self, inst: Air.Inst.Index, op_lhs: Air.Inst.Ref, op_rhs:
1822 const dst_ty = self.air.typeOfIndex(inst);1834 const dst_ty = self.air.typeOfIndex(inst);
1823 const air_tags = self.air.instructions.items(.tag);1835 const air_tags = self.air.instructions.items(.tag);
1824 switch (air_tags[inst]) {1836 switch (air_tags[inst]) {
1825 .add, .addwrap => try self.genBinMathOpMir(.add, dst_ty, .unsigned, dst_mcv, src_mcv),1837 .add, .addwrap, .ptr_add => try self.genBinMathOpMir(.add, dst_ty, .unsigned, dst_mcv, src_mcv),
1826 .bool_or, .bit_or => try self.genBinMathOpMir(.@"or", dst_ty, .unsigned, dst_mcv, src_mcv),1838 .bool_or, .bit_or => try self.genBinMathOpMir(.@"or", dst_ty, .unsigned, dst_mcv, src_mcv),
1827 .bool_and, .bit_and => try self.genBinMathOpMir(.@"and", dst_ty, .unsigned, dst_mcv, src_mcv),1839 .bool_and, .bit_and => try self.genBinMathOpMir(.@"and", dst_ty, .unsigned, dst_mcv, src_mcv),
1828 .sub, .subwrap => try self.genBinMathOpMir(.sub, dst_ty, .unsigned, dst_mcv, src_mcv),1840 .sub, .subwrap => try self.genBinMathOpMir(.sub, dst_ty, .unsigned, dst_mcv, src_mcv),
...@@ -3125,7 +3137,6 @@ fn setRegOrMem(self: *Self, ty: Type, loc: MCValue, val: MCValue) !void {...@@ -3125,7 +3137,6 @@ fn setRegOrMem(self: *Self, ty: Type, loc: MCValue, val: MCValue) !void {
3125fn genSetStack(self: *Self, ty: Type, stack_offset: u32, mcv: MCValue) InnerError!void {3137fn genSetStack(self: *Self, ty: Type, stack_offset: u32, mcv: MCValue) InnerError!void {
3126 switch (mcv) {3138 switch (mcv) {
3127 .dead => unreachable,3139 .dead => unreachable,
3128 .ptr_stack_offset => unreachable,
3129 .ptr_embedded_in_code => unreachable,3140 .ptr_embedded_in_code => unreachable,
3130 .unreach, .none => return, // Nothing to do.3141 .unreach, .none => return, // Nothing to do.
3131 .undef => {3142 .undef => {
...@@ -3241,6 +3252,10 @@ fn genSetStack(self: *Self, ty: Type, stack_offset: u32, mcv: MCValue) InnerErro...@@ -3241,6 +3252,10 @@ fn genSetStack(self: *Self, ty: Type, stack_offset: u32, mcv: MCValue) InnerErro
3241 }3252 }
3242 return self.fail("TODO implement memcpy for setting stack from {}", .{mcv});3253 return self.fail("TODO implement memcpy for setting stack from {}", .{mcv});
3243 },3254 },
3255 .ptr_stack_offset => {
3256 const reg = try self.copyToTmpRegister(ty, mcv);
3257 return self.genSetStack(ty, stack_offset, MCValue{ .register = reg });
3258 },
3244 .stack_offset => |off| {3259 .stack_offset => |off| {
3245 if (stack_offset == off) {3260 if (stack_offset == off) {
3246 // Copy stack variable to itself; nothing to do.3261 // Copy stack variable to itself; nothing to do.
...@@ -3618,10 +3633,16 @@ fn airBitCast(self: *Self, inst: Air.Inst.Index) !void {...@@ -3618,10 +3633,16 @@ fn airBitCast(self: *Self, inst: Air.Inst.Index) !void {
36183633
3619fn airArrayToSlice(self: *Self, inst: Air.Inst.Index) !void {3634fn airArrayToSlice(self: *Self, inst: Air.Inst.Index) !void {
3620 const ty_op = self.air.instructions.items(.data)[inst].ty_op;3635 const ty_op = self.air.instructions.items(.data)[inst].ty_op;
3621 const result: MCValue = if (self.liveness.isUnused(inst))3636 const ptr_ty = self.air.typeOf(ty_op.operand);
3622 .dead3637 const ptr = try self.resolveInst(ty_op.operand);
3623 else3638 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else blk: {
3624 return self.fail("TODO implement airArrayToSlice for {}", .{self.target.cpu.arch});3639 const stack_offset = try self.allocMem(inst, 16, 16);
3640 const array_ty = ptr_ty.childType();
3641 const array_len = array_ty.arrayLenIncludingSentinel();
3642 try self.genSetStack(Type.initTag(.usize), stack_offset + 8, ptr);
3643 try self.genSetStack(Type.initTag(.u64), stack_offset + 16, .{ .immediate = array_len });
3644 break :blk .{ .stack_offset = stack_offset };
3645 };
3625 return self.finishAir(inst, result, .{ ty_op.operand, .none, .none });3646 return self.finishAir(inst, result, .{ ty_op.operand, .none, .none });
3626}3647}
36273648
test/behavior.zig+2-2
...@@ -16,11 +16,11 @@ test {...@@ -16,11 +16,11 @@ test {
16 _ = @import("behavior/type.zig");16 _ = @import("behavior/type.zig");
17 _ = @import("behavior/bugs/655.zig");17 _ = @import("behavior/bugs/655.zig");
18 _ = @import("behavior/bool.zig");18 _ = @import("behavior/bool.zig");
19 _ = @import("behavior/align.zig");
20 _ = @import("behavior/array.zig");
1921
20 if (builtin.zig_backend != .stage2_arm and builtin.zig_backend != .stage2_x86_64) {22 if (builtin.zig_backend != .stage2_arm and builtin.zig_backend != .stage2_x86_64) {
21 // Tests that pass for stage1, llvm backend, C backend, wasm backend.23 // Tests that pass for stage1, llvm backend, C backend, wasm backend.
22 _ = @import("behavior/align.zig");
23 _ = @import("behavior/array.zig");
24 _ = @import("behavior/basic.zig");24 _ = @import("behavior/basic.zig");
25 _ = @import("behavior/bitcast.zig");25 _ = @import("behavior/bitcast.zig");
26 _ = @import("behavior/bugs/624.zig");26 _ = @import("behavior/bugs/624.zig");
test/behavior/align.zig+66-38
...@@ -6,6 +6,8 @@ const native_arch = builtin.target.cpu.arch;...@@ -6,6 +6,8 @@ const native_arch = builtin.target.cpu.arch;
6var foo: u8 align(4) = 100;6var foo: u8 align(4) = 100;
77
8test "global variable alignment" {8test "global variable alignment" {
9 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
10
9 comptime try expect(@typeInfo(@TypeOf(&foo)).Pointer.alignment == 4);11 comptime try expect(@typeInfo(@TypeOf(&foo)).Pointer.alignment == 4);
10 comptime try expect(@TypeOf(&foo) == *align(4) u8);12 comptime try expect(@TypeOf(&foo) == *align(4) u8);
11 {13 {
...@@ -20,10 +22,14 @@ test "global variable alignment" {...@@ -20,10 +22,14 @@ test "global variable alignment" {
20}22}
2123
22test "default alignment allows unspecified in type syntax" {24test "default alignment allows unspecified in type syntax" {
25 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
26
23 try expect(*u32 == *align(@alignOf(u32)) u32);27 try expect(*u32 == *align(@alignOf(u32)) u32);
24}28}
2529
26test "implicitly decreasing pointer alignment" {30test "implicitly decreasing pointer alignment" {
31 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
32
27 const a: u32 align(4) = 3;33 const a: u32 align(4) = 3;
28 const b: u32 align(8) = 4;34 const b: u32 align(8) = 4;
29 try expect(addUnaligned(&a, &b) == 7);35 try expect(addUnaligned(&a, &b) == 7);
...@@ -33,16 +39,9 @@ fn addUnaligned(a: *align(1) const u32, b: *align(1) const u32) u32 {...@@ -33,16 +39,9 @@ fn addUnaligned(a: *align(1) const u32, b: *align(1) const u32) u32 {
33 return a.* + b.*;39 return a.* + b.*;
34}40}
3541
36test "implicitly decreasing slice alignment" {
37 const a: u32 align(4) = 3;
38 const b: u32 align(8) = 4;
39 try expect(addUnalignedSlice(@as(*const [1]u32, &a)[0..], @as(*const [1]u32, &b)[0..]) == 7);
40}
41fn addUnalignedSlice(a: []align(1) const u32, b: []align(1) const u32) u32 {
42 return a[0] + b[0];
43}
44
45test "@alignCast pointers" {42test "@alignCast pointers" {
43 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
44
46 var x: u32 align(4) = 1;45 var x: u32 align(4) = 1;
47 expectsOnly1(&x);46 expectsOnly1(&x);
48 try expect(x == 2);47 try expect(x == 2);
...@@ -54,48 +53,25 @@ fn expects4(x: *align(4) u32) void {...@@ -54,48 +53,25 @@ fn expects4(x: *align(4) u32) void {
54 x.* += 1;53 x.* += 1;
55}54}
5655
57test "specifying alignment allows pointer cast" {
58 try testBytesAlign(0x33);
59}
60fn testBytesAlign(b: u8) !void {
61 var bytes align(4) = [_]u8{ b, b, b, b };
62 const ptr = @ptrCast(*u32, &bytes[0]);
63 try expect(ptr.* == 0x33333333);
64}
65
66test "@alignCast slices" {
67 var array align(4) = [_]u32{ 1, 1 };
68 const slice = array[0..];
69 sliceExpectsOnly1(slice);
70 try expect(slice[0] == 2);
71}
72fn sliceExpectsOnly1(slice: []align(1) u32) void {
73 sliceExpects4(@alignCast(4, slice));
74}
75fn sliceExpects4(slice: []align(4) u32) void {
76 slice[0] += 1;
77}
78
79test "alignment of structs" {56test "alignment of structs" {
57 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
58
80 try expect(@alignOf(struct {59 try expect(@alignOf(struct {
81 a: i32,60 a: i32,
82 b: *i32,61 b: *i32,
83 }) == @alignOf(usize));62 }) == @alignOf(usize));
84}63}
8564
86test "return error union with 128-bit integer" {
87 try expect(3 == try give());
88}
89fn give() anyerror!u128 {
90 return 3;
91}
92
93test "alignment of >= 128-bit integer type" {65test "alignment of >= 128-bit integer type" {
66 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
67
94 try expect(@alignOf(u128) == 16);68 try expect(@alignOf(u128) == 16);
95 try expect(@alignOf(u129) == 16);69 try expect(@alignOf(u129) == 16);
96}70}
9771
98test "alignment of struct with 128-bit field" {72test "alignment of struct with 128-bit field" {
73 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
74
99 try expect(@alignOf(struct {75 try expect(@alignOf(struct {
100 x: u128,76 x: u128,
101 }) == 16);77 }) == 16);
...@@ -108,6 +84,8 @@ test "alignment of struct with 128-bit field" {...@@ -108,6 +84,8 @@ test "alignment of struct with 128-bit field" {
108}84}
10985
110test "size of extern struct with 128-bit field" {86test "size of extern struct with 128-bit field" {
87 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
88
111 try expect(@sizeOf(extern struct {89 try expect(@sizeOf(extern struct {
112 x: u128,90 x: u128,
113 y: u8,91 y: u8,
...@@ -122,12 +100,16 @@ test "size of extern struct with 128-bit field" {...@@ -122,12 +100,16 @@ test "size of extern struct with 128-bit field" {
122}100}
123101
124test "@ptrCast preserves alignment of bigger source" {102test "@ptrCast preserves alignment of bigger source" {
103 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
104
125 var x: u32 align(16) = 1234;105 var x: u32 align(16) = 1234;
126 const ptr = @ptrCast(*u8, &x);106 const ptr = @ptrCast(*u8, &x);
127 try expect(@TypeOf(ptr) == *align(16) u8);107 try expect(@TypeOf(ptr) == *align(16) u8);
128}108}
129109
130test "alignstack" {110test "alignstack" {
111 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
112
131 try expect(fnWithAlignedStack() == 1234);113 try expect(fnWithAlignedStack() == 1234);
132}114}
133115
...@@ -135,3 +117,49 @@ fn fnWithAlignedStack() i32 {...@@ -135,3 +117,49 @@ fn fnWithAlignedStack() i32 {
135 @setAlignStack(256);117 @setAlignStack(256);
136 return 1234;118 return 1234;
137}119}
120
121test "implicitly decreasing slice alignment" {
122 if (builtin.zig_backend == .stage2_x86_64 or builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
123
124 const a: u32 align(4) = 3;
125 const b: u32 align(8) = 4;
126 try expect(addUnalignedSlice(@as(*const [1]u32, &a)[0..], @as(*const [1]u32, &b)[0..]) == 7);
127}
128fn addUnalignedSlice(a: []align(1) const u32, b: []align(1) const u32) u32 {
129 return a[0] + b[0];
130}
131
132test "specifying alignment allows pointer cast" {
133 if (builtin.zig_backend == .stage2_x86_64 or builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
134
135 try testBytesAlign(0x33);
136}
137fn testBytesAlign(b: u8) !void {
138 var bytes align(4) = [_]u8{ b, b, b, b };
139 const ptr = @ptrCast(*u32, &bytes[0]);
140 try expect(ptr.* == 0x33333333);
141}
142
143test "@alignCast slices" {
144 if (builtin.zig_backend == .stage2_x86_64 or builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
145
146 var array align(4) = [_]u32{ 1, 1 };
147 const slice = array[0..];
148 sliceExpectsOnly1(slice);
149 try expect(slice[0] == 2);
150}
151fn sliceExpectsOnly1(slice: []align(1) u32) void {
152 sliceExpects4(@alignCast(4, slice));
153}
154fn sliceExpects4(slice: []align(4) u32) void {
155 slice[0] += 1;
156}
157
158test "return error union with 128-bit integer" {
159 if (builtin.zig_backend == .stage2_x86_64 or builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
160
161 try expect(3 == try give());
162}
163fn give() anyerror!u128 {
164 return 3;
165}
test/behavior/array.zig+42
...@@ -5,7 +5,23 @@ const mem = std.mem;...@@ -5,7 +5,23 @@ const mem = std.mem;
5const expect = testing.expect;5const expect = testing.expect;
6const expectEqual = testing.expectEqual;6const expectEqual = testing.expectEqual;
77
8test "array to slice" {
9 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
10
11 const a: u32 align(4) = 3;
12 const b: u32 align(8) = 4;
13 const a_slice: []align(1) const u32 = @as(*const [1]u32, &a)[0..];
14 const b_slice: []align(1) const u32 = @as(*const [1]u32, &b)[0..];
15 try expect(a_slice[0] + b_slice[0] == 7);
16
17 const d: []const u32 = &[2]u32{ 1, 2 };
18 const e: []const u32 = &[3]u32{ 3, 4, 5 };
19 try expect(d[0] + e[0] + d[1] + e[1] == 10);
20}
21
8test "arrays" {22test "arrays" {
23 if (builtin.zig_backend == .stage2_x86_64 or builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
24
9 var array: [5]u32 = undefined;25 var array: [5]u32 = undefined;
1026
11 var i: u32 = 0;27 var i: u32 = 0;
...@@ -30,6 +46,8 @@ fn getArrayLen(a: []const u32) usize {...@@ -30,6 +46,8 @@ fn getArrayLen(a: []const u32) usize {
30}46}
3147
32test "array init with mult" {48test "array init with mult" {
49 if (builtin.zig_backend == .stage2_x86_64 or builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
50
33 const a = 'a';51 const a = 'a';
34 var i: [8]u8 = [2]u8{ a, 'b' } ** 4;52 var i: [8]u8 = [2]u8{ a, 'b' } ** 4;
35 try expect(std.mem.eql(u8, &i, "abababab"));53 try expect(std.mem.eql(u8, &i, "abababab"));
...@@ -39,6 +57,8 @@ test "array init with mult" {...@@ -39,6 +57,8 @@ test "array init with mult" {
39}57}
4058
41test "array literal with explicit type" {59test "array literal with explicit type" {
60 if (builtin.zig_backend == .stage2_x86_64 or builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
61
42 const hex_mult: [4]u16 = .{ 4096, 256, 16, 1 };62 const hex_mult: [4]u16 = .{ 4096, 256, 16, 1 };
4363
44 try expect(hex_mult.len == 4);64 try expect(hex_mult.len == 4);
...@@ -46,6 +66,8 @@ test "array literal with explicit type" {...@@ -46,6 +66,8 @@ test "array literal with explicit type" {
46}66}
4767
48test "array literal with inferred length" {68test "array literal with inferred length" {
69 if (builtin.zig_backend == .stage2_x86_64 or builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
70
49 const hex_mult = [_]u16{ 4096, 256, 16, 1 };71 const hex_mult = [_]u16{ 4096, 256, 16, 1 };
5072
51 try expect(hex_mult.len == 4);73 try expect(hex_mult.len == 4);
...@@ -53,6 +75,8 @@ test "array literal with inferred length" {...@@ -53,6 +75,8 @@ test "array literal with inferred length" {
53}75}
5476
55test "array dot len const expr" {77test "array dot len const expr" {
78 if (builtin.zig_backend == .stage2_x86_64 or builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
79
56 try expect(comptime x: {80 try expect(comptime x: {
57 break :x some_array.len == 4;81 break :x some_array.len == 4;
58 });82 });
...@@ -64,12 +88,16 @@ const ArrayDotLenConstExpr = struct {...@@ -64,12 +88,16 @@ const ArrayDotLenConstExpr = struct {
64const some_array = [_]u8{ 0, 1, 2, 3 };88const some_array = [_]u8{ 0, 1, 2, 3 };
6589
66test "array literal with specified size" {90test "array literal with specified size" {
91 if (builtin.zig_backend == .stage2_x86_64 or builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
92
67 var array = [2]u8{ 1, 2 };93 var array = [2]u8{ 1, 2 };
68 try expect(array[0] == 1);94 try expect(array[0] == 1);
69 try expect(array[1] == 2);95 try expect(array[1] == 2);
70}96}
7197
72test "array len field" {98test "array len field" {
99 if (builtin.zig_backend == .stage2_x86_64 or builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
100
73 var arr = [4]u8{ 0, 0, 0, 0 };101 var arr = [4]u8{ 0, 0, 0, 0 };
74 var ptr = &arr;102 var ptr = &arr;
75 try expect(arr.len == 4);103 try expect(arr.len == 4);
...@@ -79,6 +107,8 @@ test "array len field" {...@@ -79,6 +107,8 @@ test "array len field" {
79}107}
80108
81test "array with sentinels" {109test "array with sentinels" {
110 if (builtin.zig_backend == .stage2_x86_64 or builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
111
82 const S = struct {112 const S = struct {
83 fn doTheTest(is_ct: bool) !void {113 fn doTheTest(is_ct: bool) !void {
84 if (is_ct or builtin.zig_is_stage2) {114 if (is_ct or builtin.zig_is_stage2) {
...@@ -106,6 +136,8 @@ test "array with sentinels" {...@@ -106,6 +136,8 @@ test "array with sentinels" {
106}136}
107137
108test "void arrays" {138test "void arrays" {
139 if (builtin.zig_backend == .stage2_x86_64 or builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
140
109 var array: [4]void = undefined;141 var array: [4]void = undefined;
110 array[0] = void{};142 array[0] = void{};
111 array[1] = array[2];143 array[1] = array[2];
...@@ -114,6 +146,8 @@ test "void arrays" {...@@ -114,6 +146,8 @@ test "void arrays" {
114}146}
115147
116test "nested arrays" {148test "nested arrays" {
149 if (builtin.zig_backend == .stage2_x86_64 or builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
150
117 if (builtin.zig_backend == .stage2_wasm) {151 if (builtin.zig_backend == .stage2_wasm) {
118 // TODO this is a recent stage2 test case regression due to an enhancement;152 // TODO this is a recent stage2 test case regression due to an enhancement;
119 // now arrays are properly detected as comptime. This exercised a new code153 // now arrays are properly detected as comptime. This exercised a new code
...@@ -132,6 +166,8 @@ test "nested arrays" {...@@ -132,6 +166,8 @@ test "nested arrays" {
132}166}
133167
134test "implicit comptime in array type size" {168test "implicit comptime in array type size" {
169 if (builtin.zig_backend == .stage2_x86_64 or builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
170
135 var arr: [plusOne(10)]bool = undefined;171 var arr: [plusOne(10)]bool = undefined;
136 try expect(arr.len == 11);172 try expect(arr.len == 11);
137}173}
...@@ -141,6 +177,8 @@ fn plusOne(x: u32) u32 {...@@ -141,6 +177,8 @@ fn plusOne(x: u32) u32 {
141}177}
142178
143test "single-item pointer to array indexing and slicing" {179test "single-item pointer to array indexing and slicing" {
180 if (builtin.zig_backend == .stage2_x86_64 or builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
181
144 try testSingleItemPtrArrayIndexSlice();182 try testSingleItemPtrArrayIndexSlice();
145 comptime try testSingleItemPtrArrayIndexSlice();183 comptime try testSingleItemPtrArrayIndexSlice();
146}184}
...@@ -164,6 +202,8 @@ fn doSomeMangling(array: *[4]u8) void {...@@ -164,6 +202,8 @@ fn doSomeMangling(array: *[4]u8) void {
164}202}
165203
166test "implicit cast zero sized array ptr to slice" {204test "implicit cast zero sized array ptr to slice" {
205 if (builtin.zig_backend == .stage2_x86_64 or builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
206
167 {207 {
168 var b = "".*;208 var b = "".*;
169 const c: []const u8 = &b;209 const c: []const u8 = &b;
...@@ -177,6 +217,8 @@ test "implicit cast zero sized array ptr to slice" {...@@ -177,6 +217,8 @@ test "implicit cast zero sized array ptr to slice" {
177}217}
178218
179test "anonymous list literal syntax" {219test "anonymous list literal syntax" {
220 if (builtin.zig_backend == .stage2_x86_64 or builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
221
180 const S = struct {222 const S = struct {
181 fn doTheTest() !void {223 fn doTheTest() !void {
182 var array: [4]u8 = .{ 1, 2, 3, 4 };224 var array: [4]u8 = .{ 1, 2, 3, 4 };