authorgravatar for joachim.schmidt557@outlook.comJoachim Schmidt <joachim.schmidt557@outlook.com> 2022-03-05 11:31:51+01:00
committergravatar for joachim.schmidt557@outlook.comJoachim Schmidt <joachim.schmidt557@outlook.com> 2022-03-05 11:31:51+01:00
loga06e9eca45f72b28ed9ca00da5c9562e969cc84d
treeeebd5b573c86e1ec206e5a57328c3649a05002e0
parented7e2938ff2385d658f04248f1c757b324009be4
signaturelock-open Commit is signed but in an unrecognized format.

stage2 AArch64: add more slice support

* airSlice * airArrayToSlice * and initial support for airSlicePtr and co

27 files changed, 71 insertions(+), 180 deletions(-)

src/arch/aarch64/CodeGen.zig+71-12
......@@ -818,9 +818,7 @@ fn allocRegOrMem(self: *Self, inst: Air.Inst.Index, reg_ok: bool) !MCValue {
818818
819819 if (reg_ok) {
820820 // Make sure the type can fit in a register before we try to allocate one.
821 const ptr_bits = self.target.cpu.arch.ptrBitWidth();
822 const ptr_bytes: u64 = @divExact(ptr_bits, 8);
823 if (abi_size <= ptr_bytes) {
821 if (abi_size <= 8) {
824822 if (self.register_manager.tryAllocReg(inst)) |reg| {
825823 return MCValue{ .register = registerAlias(reg, abi_size) };
826824 }
......@@ -1038,7 +1036,20 @@ fn airMax(self: *Self, inst: Air.Inst.Index) !void {
10381036fn airSlice(self: *Self, inst: Air.Inst.Index) !void {
10391037 const ty_pl = self.air.instructions.items(.data)[inst].ty_pl;
10401038 const bin_op = self.air.extraData(Air.Bin, ty_pl.payload).data;
1041 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement slice for {}", .{self.target.cpu.arch});
1039 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: {
1040 const ptr = try self.resolveInst(bin_op.lhs);
1041 const ptr_ty = self.air.typeOf(bin_op.lhs);
1042 const len = try self.resolveInst(bin_op.rhs);
1043 const len_ty = self.air.typeOf(bin_op.rhs);
1044
1045 const ptr_bits = self.target.cpu.arch.ptrBitWidth();
1046 const ptr_bytes = @divExact(ptr_bits, 8);
1047
1048 const stack_offset = try self.allocMem(inst, ptr_bytes * 2, ptr_bytes * 2);
1049 try self.genSetStack(ptr_ty, stack_offset + ptr_bytes, ptr);
1050 try self.genSetStack(len_ty, stack_offset, len);
1051 break :result MCValue{ .stack_offset = stack_offset };
1052 };
10421053 return self.finishAir(inst, result, .{ bin_op.lhs, bin_op.rhs, .none });
10431054}
10441055
......@@ -1602,22 +1613,39 @@ fn airWrapErrUnionErr(self: *Self, inst: Air.Inst.Index) !void {
16021613
16031614fn airSlicePtr(self: *Self, inst: Air.Inst.Index) !void {
16041615 const ty_op = self.air.instructions.items(.data)[inst].ty_op;
1605 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement slice_ptr for {}", .{self.target.cpu.arch});
1616 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: {
1617 const ptr_bits = self.target.cpu.arch.ptrBitWidth();
1618 const ptr_bytes = @divExact(ptr_bits, 8);
1619 const mcv = try self.resolveInst(ty_op.operand);
1620 switch (mcv) {
1621 .dead, .unreach, .none => unreachable,
1622 .register => unreachable, // a slice doesn't fit in one register
1623 .stack_offset => |off| {
1624 break :result MCValue{ .stack_offset = off + ptr_bytes };
1625 },
1626 .memory => |addr| {
1627 break :result MCValue{ .memory = addr };
1628 },
1629 else => return self.fail("TODO implement slice_len for {}", .{mcv}),
1630 }
1631 };
16061632 return self.finishAir(inst, result, .{ ty_op.operand, .none, .none });
16071633}
16081634
16091635fn airSliceLen(self: *Self, inst: Air.Inst.Index) !void {
16101636 const ty_op = self.air.instructions.items(.data)[inst].ty_op;
16111637 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: {
1638 const ptr_bits = self.target.cpu.arch.ptrBitWidth();
1639 const ptr_bytes = @divExact(ptr_bits, 8);
16121640 const mcv = try self.resolveInst(ty_op.operand);
16131641 switch (mcv) {
1614 .dead, .unreach => unreachable,
1642 .dead, .unreach, .none => unreachable,
16151643 .register => unreachable, // a slice doesn't fit in one register
16161644 .stack_offset => |off| {
16171645 break :result MCValue{ .stack_offset = off };
16181646 },
16191647 .memory => |addr| {
1620 break :result MCValue{ .memory = addr + 8 };
1648 break :result MCValue{ .memory = addr + ptr_bytes };
16211649 },
16221650 else => return self.fail("TODO implement slice_len for {}", .{mcv}),
16231651 }
......@@ -1627,13 +1655,33 @@ fn airSliceLen(self: *Self, inst: Air.Inst.Index) !void {
16271655
16281656fn airPtrSliceLenPtr(self: *Self, inst: Air.Inst.Index) !void {
16291657 const ty_op = self.air.instructions.items(.data)[inst].ty_op;
1630 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement ptr_slice_len_ptr for {}", .{self.target.cpu.arch});
1658 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: {
1659 const ptr_bits = self.target.cpu.arch.ptrBitWidth();
1660 const ptr_bytes = @divExact(ptr_bits, 8);
1661 const mcv = try self.resolveInst(ty_op.operand);
1662 switch (mcv) {
1663 .dead, .unreach, .none => unreachable,
1664 .ptr_stack_offset => |off| {
1665 break :result MCValue{ .ptr_stack_offset = off + ptr_bytes };
1666 },
1667 else => return self.fail("TODO implement ptr_slice_len_ptr for {}", .{mcv}),
1668 }
1669 };
16311670 return self.finishAir(inst, result, .{ ty_op.operand, .none, .none });
16321671}
16331672
16341673fn airPtrSlicePtrPtr(self: *Self, inst: Air.Inst.Index) !void {
16351674 const ty_op = self.air.instructions.items(.data)[inst].ty_op;
1636 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement ptr_slice_ptr_ptr for {}", .{self.target.cpu.arch});
1675 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: {
1676 const mcv = try self.resolveInst(ty_op.operand);
1677 switch (mcv) {
1678 .dead, .unreach, .none => unreachable,
1679 .ptr_stack_offset => |off| {
1680 break :result MCValue{ .ptr_stack_offset = off };
1681 },
1682 else => return self.fail("TODO implement ptr_slice_len_ptr for {}", .{mcv}),
1683 }
1684 };
16371685 return self.finishAir(inst, result, .{ ty_op.operand, .none, .none });
16381686}
16391687
......@@ -3475,9 +3523,20 @@ fn airBitCast(self: *Self, inst: Air.Inst.Index) !void {
34753523
34763524fn airArrayToSlice(self: *Self, inst: Air.Inst.Index) !void {
34773525 const ty_op = self.air.instructions.items(.data)[inst].ty_op;
3478 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement airArrayToSlice for {}", .{
3479 self.target.cpu.arch,
3480 });
3526 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: {
3527 const ptr_ty = self.air.typeOf(ty_op.operand);
3528 const ptr = try self.resolveInst(ty_op.operand);
3529 const array_ty = ptr_ty.childType();
3530 const array_len = @intCast(u32, array_ty.arrayLen());
3531
3532 const ptr_bits = self.target.cpu.arch.ptrBitWidth();
3533 const ptr_bytes = @divExact(ptr_bits, 8);
3534
3535 const stack_offset = try self.allocMem(inst, ptr_bytes * 2, ptr_bytes * 2);
3536 try self.genSetStack(ptr_ty, stack_offset + ptr_bytes, ptr);
3537 try self.genSetStack(Type.initTag(.usize), stack_offset, .{ .immediate = array_len });
3538 break :result MCValue{ .stack_offset = stack_offset };
3539 };
34813540 return self.finishAir(inst, result, .{ ty_op.operand, .none, .none });
34823541}
34833542
test/behavior/align.zig-1
......@@ -269,7 +269,6 @@ fn whyWouldYouEverDoThis(comptime align_bytes: u8) align(align_bytes) u8 {
269269
270270test "runtime known array index has best alignment possible" {
271271 if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO
272 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
273272 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
274273
275274 // take full advantage of over-alignment
test/behavior/array.zig-2
......@@ -142,8 +142,6 @@ test "array with sentinels" {
142142}
143143
144144test "void arrays" {
145 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
146
147145 var array: [4]void = undefined;
148146 array[0] = void{};
149147 array[1] = array[2];
test/behavior/bitcast.zig-10
......@@ -75,8 +75,6 @@ fn conv_uN(comptime N: usize, x: std.meta.Int(.unsigned, N)) std.meta.Int(.signe
7575}
7676
7777test "nested bitcast" {
78 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
79
8078 const S = struct {
8179 fn moo(x: isize) !void {
8280 try expect(@intCast(isize, 42) == x);
......@@ -94,8 +92,6 @@ test "nested bitcast" {
9492}
9593
9694test "@bitCast enum to its integer type" {
97 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
98
9995 const SOCK = enum(c_int) {
10096 A,
10197 B,
......@@ -113,15 +109,11 @@ test "@bitCast enum to its integer type" {
113109
114110// issue #3010: compiler segfault
115111test "bitcast literal [4]u8 param to u32" {
116 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
117
118112 const ip = @bitCast(u32, [_]u8{ 255, 255, 255, 255 });
119113 try expect(ip == maxInt(u32));
120114}
121115
122116test "bitcast generates a temporary value" {
123 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
124
125117 var y = @as(u16, 0x55AA);
126118 const x = @bitCast(u16, @bitCast([2]u8, y));
127119 try expect(y == x);
......@@ -240,7 +232,6 @@ test "implicit cast to error union by returning" {
240232test "bitcast packed struct literal to byte" {
241233 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest;
242234 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
243 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
244235
245236 const Foo = packed struct {
246237 value: u8,
......@@ -252,7 +243,6 @@ test "bitcast packed struct literal to byte" {
252243test "comptime bitcast used in expression has the correct type" {
253244 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest;
254245 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
255 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
256246
257247 const Foo = packed struct {
258248 value: u8,
test/behavior/bugs/3367.zig-1
......@@ -10,7 +10,6 @@ const Mixin = struct {
1010};
1111
1212test "container member access usingnamespace decls" {
13 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
1413 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
1514 var foo = Foo{};
1615 foo.two();
test/behavior/bugs/3586.zig-2
......@@ -7,8 +7,6 @@ const Container = struct {
77};
88
99test "fixed" {
10 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
11
1210 var ctr = Container{
1311 .params = NoteParams{},
1412 };
test/behavior/bugs/704.zig-2
......@@ -6,8 +6,6 @@ const xxx = struct {
66 }
77};
88test "bug 704" {
9 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
10
119 var x: xxx = undefined;
1210 x.bar();
1311}
test/behavior/cast.zig-2
......@@ -984,7 +984,6 @@ test "peer type resolve array pointers, one of them const" {
984984test "peer type resolve array pointer and unknown pointer" {
985985 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
986986 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
987 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
988987 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
989988 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
990989
......@@ -1255,7 +1254,6 @@ test "assignment to optional pointer result loc" {
12551254}
12561255
12571256test "cast between *[N]void and []void" {
1258 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
12591257 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
12601258
12611259 var a: [4]void = undefined;
test/behavior/defer.zig-4
......@@ -5,8 +5,6 @@ const expectEqual = std.testing.expectEqual;
55const expectError = std.testing.expectError;
66
77test "break and continue inside loop inside defer expression" {
8 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
9
108 testBreakContInDefer(10);
119 comptime testBreakContInDefer(10);
1210}
......@@ -23,8 +21,6 @@ fn testBreakContInDefer(x: usize) void {
2321}
2422
2523test "defer and labeled break" {
26 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
27
2824 var i = @as(usize, 0);
2925
3026 blk: {
test/behavior/enum.zig-40
......@@ -11,8 +11,6 @@ fn shouldEqual(n: Number, expected: u3) !void {
1111}
1212
1313test "enum to int" {
14 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
15
1614 try shouldEqual(Number.Zero, 0);
1715 try shouldEqual(Number.One, 1);
1816 try shouldEqual(Number.Two, 2);
......@@ -558,8 +556,6 @@ const ValueCount257 = enum {
558556};
559557
560558test "enum sizes" {
561 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
562
563559 comptime {
564560 try expect(@sizeOf(ValueCount1) == 0);
565561 try expect(@sizeOf(ValueCount2) == 1);
......@@ -569,8 +565,6 @@ test "enum sizes" {
569565}
570566
571567test "enum literal equality" {
572 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
573
574568 const x = .hi;
575569 const y = .ok;
576570 const z = .hi;
......@@ -580,8 +574,6 @@ test "enum literal equality" {
580574}
581575
582576test "enum literal cast to enum" {
583 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
584
585577 const Color = enum { Auto, Off, On };
586578
587579 var color1: Color = .Auto;
......@@ -590,8 +582,6 @@ test "enum literal cast to enum" {
590582}
591583
592584test "peer type resolution with enum literal" {
593 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
594
595585 const Items = enum { one, two };
596586
597587 try expect(Items.two == .two);
......@@ -668,8 +658,6 @@ test "non-exhaustive enum" {
668658}
669659
670660test "empty non-exhaustive enum" {
671 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
672
673661 const S = struct {
674662 const E = enum(u8) { _ };
675663
......@@ -732,8 +720,6 @@ const EnumWithTagValues = enum(u4) {
732720 D = 1 << 3,
733721};
734722test "enum with tag values don't require parens" {
735 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
736
737723 try expect(@enumToInt(EnumWithTagValues.C) == 0b0100);
738724}
739725
......@@ -750,8 +736,6 @@ const MultipleChoice2 = enum(u32) {
750736};
751737
752738test "cast integer literal to enum" {
753 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
754
755739 try expect(@intToEnum(MultipleChoice2, 0) == MultipleChoice2.Unspecified1);
756740 try expect(@intToEnum(MultipleChoice2, 40) == MultipleChoice2.B);
757741}
......@@ -783,8 +767,6 @@ const Small2 = enum(u2) { One, Two };
783767const Small = enum(u2) { One, Two, Three, Four };
784768
785769test "set enum tag type" {
786 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
787
788770 {
789771 var x = Small.One;
790772 x = Small.Two;
......@@ -798,8 +780,6 @@ test "set enum tag type" {
798780}
799781
800782test "casting enum to its tag type" {
801 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
802
803783 try testCastEnumTag(Small2.Two);
804784 comptime try testCastEnumTag(Small2.Two);
805785}
......@@ -809,8 +789,6 @@ fn testCastEnumTag(value: Small2) !void {
809789}
810790
811791test "enum with 1 field but explicit tag type should still have the tag type" {
812 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
813
814792 const Enum = enum(u8) {
815793 B = 2,
816794 };
......@@ -818,8 +796,6 @@ test "enum with 1 field but explicit tag type should still have the tag type" {
818796}
819797
820798test "signed integer as enum tag" {
821 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
822
823799 const SignedEnum = enum(i2) {
824800 A0 = -1,
825801 A1 = 0,
......@@ -832,8 +808,6 @@ test "signed integer as enum tag" {
832808}
833809
834810test "enum with one member and custom tag type" {
835 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
836
837811 const E = enum(u2) {
838812 One,
839813 };
......@@ -845,8 +819,6 @@ test "enum with one member and custom tag type" {
845819}
846820
847821test "enum with one member and u1 tag type @enumToInt" {
848 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
849
850822 const Enum = enum(u1) {
851823 Test,
852824 };
......@@ -854,8 +826,6 @@ test "enum with one member and u1 tag type @enumToInt" {
854826}
855827
856828test "enum with comptime_int tag type" {
857 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
858
859829 const Enum = enum(comptime_int) {
860830 One = 3,
861831 Two = 2,
......@@ -865,8 +835,6 @@ test "enum with comptime_int tag type" {
865835}
866836
867837test "enum with one member default to u0 tag type" {
868 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
869
870838 const E0 = enum { X };
871839 comptime try expect(Tag(E0) == u0);
872840}
......@@ -883,15 +851,11 @@ fn doALoopThing(id: EnumWithOneMember) void {
883851}
884852
885853test "comparison operator on enum with one member is comptime known" {
886 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
887
888854 doALoopThing(EnumWithOneMember.Eof);
889855}
890856
891857const State = enum { Start };
892858test "switch on enum with one member is comptime known" {
893 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
894
895859 var state = State.Start;
896860 switch (state) {
897861 State.Start => return,
......@@ -900,8 +864,6 @@ test "switch on enum with one member is comptime known" {
900864}
901865
902866test "method call on an enum" {
903 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
904
905867 const S = struct {
906868 const E = enum {
907869 one,
......@@ -1141,8 +1103,6 @@ fn getC(data: *const BitFieldOfEnums) C {
11411103}
11421104
11431105test "enum literal in array literal" {
1144 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
1145
11461106 const Items = enum { one, two };
11471107 const array = [_]Items{ .one, .two };
11481108
test/behavior/error.zig-13
......@@ -6,16 +6,12 @@ const expectEqual = std.testing.expectEqual;
66const mem = std.mem;
77
88test "error values" {
9 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
10
119 const a = @errorToInt(error.err1);
1210 const b = @errorToInt(error.err2);
1311 try expect(a != b);
1412}
1513
1614test "redefinition of error values allowed" {
17 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
18
1915 shouldBeNotEqual(error.AnError, error.SecondError);
2016}
2117fn shouldBeNotEqual(a: anyerror, b: anyerror) void {
......@@ -36,8 +32,6 @@ fn errBinaryOperatorG(x: bool) anyerror!isize {
3632}
3733
3834test "empty error union" {
39 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
40
4135 const x = error{} || error{};
4236 _ = x;
4337}
......@@ -91,8 +85,6 @@ fn makeANonErr() anyerror!i32 {
9185}
9286
9387test "syntax: optional operator in front of error union operator" {
94 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
95
9688 comptime {
9789 try expect(?(anyerror!i32) == ?(anyerror!i32));
9890 }
......@@ -147,8 +139,6 @@ test "implicit cast to optional to error union to return result loc" {
147139}
148140
149141test "error: fn returning empty error set can be passed as fn returning any error" {
150 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
151
152142 entry();
153143 comptime entry();
154144}
......@@ -165,7 +155,6 @@ fn foo2(f: fn () anyerror!void) void {
165155fn bar2() (error{}!void) {}
166156
167157test "error union type " {
168 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
169158 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
170159 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
171160
......@@ -182,7 +171,6 @@ fn testErrorUnionType() !void {
182171}
183172
184173test "error set type" {
185 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
186174 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
187175 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
188176
......@@ -209,7 +197,6 @@ fn testErrorSetType() !void {
209197}
210198
211199test "explicit error set cast" {
212 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
213200 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
214201 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
215202 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
test/behavior/floatop.zig-2
......@@ -24,7 +24,6 @@ test "floating point comparisons" {
2424 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
2525 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
2626 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
27 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
2827
2928 try testFloatComparisons();
3029 comptime try testFloatComparisons();
......@@ -96,7 +95,6 @@ test "negative f128 floatToInt at compile-time" {
9695 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
9796 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
9897 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
99 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
10098
10199 const a: f128 = -2;
102100 var b = @floatToInt(i64, a);
test/behavior/fn.zig-20
......@@ -5,8 +5,6 @@ const expect = testing.expect;
55const expectEqual = testing.expectEqual;
66
77test "params" {
8 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
9
108 try expect(testParamsAdd(22, 11) == 33);
119}
1210fn testParamsAdd(a: i32, b: i32) i32 {
......@@ -14,8 +12,6 @@ fn testParamsAdd(a: i32, b: i32) i32 {
1412}
1513
1614test "local variables" {
17 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
18
1915 testLocVars(2);
2016}
2117fn testLocVars(b: i32) void {
......@@ -24,8 +20,6 @@ fn testLocVars(b: i32) void {
2420}
2521
2622test "mutable local variables" {
27 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
28
2923 var zero: i32 = 0;
3024 try expect(zero == 0);
3125
......@@ -37,8 +31,6 @@ test "mutable local variables" {
3731}
3832
3933test "separate block scopes" {
40 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
41
4234 {
4335 const no_conflict: i32 = 5;
4436 try expect(no_conflict == 5);
......@@ -55,14 +47,10 @@ fn @"weird function name"() i32 {
5547 return 1234;
5648}
5749test "weird function name" {
58 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
59
6050 try expect(@"weird function name"() == 1234);
6151}
6252
6353test "assign inline fn to const variable" {
64 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
65
6654 const a = inlineFn;
6755 a();
6856}
......@@ -80,8 +68,6 @@ fn outer(y: u32) *const fn (u32) u32 {
8068}
8169
8270test "return inner function which references comptime variable of outer function" {
83 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
84
8571 if (builtin.zig_backend == .stage1) return error.SkipZigTest;
8672
8773 var func = outer(10);
......@@ -149,8 +135,6 @@ test "inline function call that calls optional function pointer, return pointer
149135}
150136
151137test "implicit cast function unreachable return" {
152 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
153
154138 wantsFnWithVoid(fnWithUnreachable);
155139}
156140
......@@ -348,8 +332,6 @@ fn fn4() u32 {
348332}
349333
350334test "number literal as an argument" {
351 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
352
353335 try numberLiteralArg(3);
354336 comptime try numberLiteralArg(3);
355337}
......@@ -380,8 +362,6 @@ test "function call with anon list literal" {
380362}
381363
382364test "ability to give comptime types and non comptime types to same parameter" {
383 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
384
385365 const S = struct {
386366 fn doTheTest() !void {
387367 var x: i32 = 1;
test/behavior/for.zig-6
......@@ -21,8 +21,6 @@ test "continue in for loop" {
2121}
2222
2323test "break from outer for loop" {
24 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
25
2624 try testBreakOuter();
2725 comptime try testBreakOuter();
2826}
......@@ -40,8 +38,6 @@ fn testBreakOuter() !void {
4038}
4139
4240test "continue outer for loop" {
43 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
44
4541 try testContinueOuter();
4642 comptime try testContinueOuter();
4743}
......@@ -59,8 +55,6 @@ fn testContinueOuter() !void {
5955}
6056
6157test "ignore lval with underscore (for loop)" {
62 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
63
6458 for ([_]void{}) |_, i| {
6559 _ = i;
6660 for ([_]void{}) |_, j| {
test/behavior/generics.zig-9
......@@ -5,8 +5,6 @@ const expect = testing.expect;
55const expectEqual = testing.expectEqual;
66
77test "one param, explicit comptime" {
8 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
9
108 var x: usize = 0;
119 x += checkSize(i32);
1210 x += checkSize(bool);
......@@ -42,8 +40,6 @@ fn add(comptime a: i32, b: i32) i32 {
4240
4341const the_max = max(u32, 1234, 5678);
4442test "compile time generic eval" {
45 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
46
4743 try expect(the_max == 5678);
4844}
4945
......@@ -142,8 +138,6 @@ pub fn SmallList(comptime T: type, comptime STATIC_SIZE: usize) type {
142138}
143139
144140test "const decls in struct" {
145 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
146
147141 try expect(GenericDataThing(3).count_plus_one == 4);
148142}
149143fn GenericDataThing(comptime count: isize) type {
......@@ -153,8 +147,6 @@ fn GenericDataThing(comptime count: isize) type {
153147}
154148
155149test "use generic param in generic param" {
156 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
157
158150 try expect(aGenericFn(i32, 3, 4) == 7);
159151}
160152fn aGenericFn(comptime T: type, comptime a: T, b: T) T {
......@@ -197,7 +189,6 @@ test "generic fn keeps non-generic parameter types" {
197189}
198190
199191test "array of generic fns" {
200 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
201192 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
202193
203194 try expect(foos[0](true));
test/behavior/if.zig-8
......@@ -4,8 +4,6 @@ const expect = std.testing.expect;
44const expectEqual = std.testing.expectEqual;
55
66test "if statements" {
7 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
8
97 shouldBeEqual(1, 1);
108 firstEqlThird(2, 1, 2);
119}
......@@ -29,8 +27,6 @@ fn firstEqlThird(a: i32, b: i32, c: i32) void {
2927}
3028
3129test "else if expression" {
32 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
33
3430 try expect(elseIfExpressionF(1) == 1);
3531}
3632fn elseIfExpressionF(c: u8) u8 {
......@@ -64,8 +60,6 @@ test "unwrap mutable global var" {
6460}
6561
6662test "labeled break inside comptime if inside runtime if" {
67 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
68
6963 var answer: i32 = 0;
7064 var c = true;
7165 if (c) {
......@@ -77,8 +71,6 @@ test "labeled break inside comptime if inside runtime if" {
7771}
7872
7973test "const result loc, runtime if cond, else unreachable" {
80 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
81
8274 const Num = enum { One, Two };
8375
8476 var t = true;
test/behavior/inttoptr.zig-1
......@@ -2,7 +2,6 @@ const builtin = @import("builtin");
22
33test "casting integer address to function pointer" {
44 if (builtin.zig_backend == .stage1) return error.SkipZigTest;
5 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
65
76 addressToFunction();
87 comptime addressToFunction();
test/behavior/math.zig-2
......@@ -312,7 +312,6 @@ test "comptime_int multi-limb partial shift right" {
312312test "xor" {
313313 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
314314 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
315 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
316315
317316 try test_xor();
318317 comptime try test_xor();
......@@ -732,7 +731,6 @@ test "overflow arithmetic with u0 values" {
732731 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
733732 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
734733 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
735 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
736734
737735 var result: u0 = undefined;
738736 try expect(!@addWithOverflow(u0, 0, 0, &result));
test/behavior/null.zig-2
......@@ -125,8 +125,6 @@ fn baz(x: ?Empty) ?Empty {
125125}
126126
127127test "null with default unwrap" {
128 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
129
130128 const x: i32 = null orelse 1;
131129 try expect(x == 1);
132130}
test/behavior/slice.zig-2
......@@ -218,8 +218,6 @@ test "compile time slice of pointer to hard coded address" {
218218}
219219
220220test "slice string literal has correct type" {
221 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
222
223221 comptime {
224222 try expect(@TypeOf("aoeu"[0..]) == *const [4:0]u8);
225223 const array = [_]i32{ 1, 2, 3, 4 };
test/behavior/struct.zig-3
......@@ -213,8 +213,6 @@ fn makeBar2(x: i32, y: i32) Bar {
213213}
214214
215215test "call method with mutable reference to struct with no fields" {
216 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
217
218216 const S = struct {
219217 fn doC(s: *const @This()) bool {
220218 _ = s;
......@@ -768,7 +766,6 @@ test "pointer to packed struct member in a stack variable" {
768766test "packed struct with u0 field access" {
769767 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
770768 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
771 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
772769 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
773770
774771 const S = packed struct {
test/behavior/switch.zig-4
......@@ -190,8 +190,6 @@ test "switch with disjoint range" {
190190}
191191
192192test "switch variable for range and multiple prongs" {
193 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
194
195193 const S = struct {
196194 fn doTheTest() !void {
197195 var u: u8 = 16;
......@@ -357,8 +355,6 @@ fn returnsFalse() bool {
357355 }
358356}
359357test "switch on const enum with var" {
360 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
361
362358 try expect(!returnsFalse());
363359}
364360
test/behavior/this.zig-2
......@@ -21,8 +21,6 @@ fn add(x: i32, y: i32) i32 {
2121}
2222
2323test "this refer to module call private fn" {
24 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
25
2624 try expect(module.add(1, 2) == 3);
2725}
2826
test/behavior/truncate.zig-16
......@@ -3,62 +3,46 @@ const builtin = @import("builtin");
33const expect = std.testing.expect;
44
55test "truncate u0 to larger integer allowed and has comptime known result" {
6 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
7
86 var x: u0 = 0;
97 const y = @truncate(u8, x);
108 comptime try expect(y == 0);
119}
1210
1311test "truncate.u0.literal" {
14 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
15
1612 var z = @truncate(u0, 0);
1713 try expect(z == 0);
1814}
1915
2016test "truncate.u0.const" {
21 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
22
2317 const c0: usize = 0;
2418 var z = @truncate(u0, c0);
2519 try expect(z == 0);
2620}
2721
2822test "truncate.u0.var" {
29 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
30
3123 var d: u8 = 2;
3224 var z = @truncate(u0, d);
3325 try expect(z == 0);
3426}
3527
3628test "truncate i0 to larger integer allowed and has comptime known result" {
37 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
38
3929 var x: i0 = 0;
4030 const y = @truncate(i8, x);
4131 comptime try expect(y == 0);
4232}
4333
4434test "truncate.i0.literal" {
45 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
46
4735 var z = @truncate(i0, 0);
4836 try expect(z == 0);
4937}
5038
5139test "truncate.i0.const" {
52 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
53
5440 const c0: isize = 0;
5541 var z = @truncate(i0, c0);
5642 try expect(z == 0);
5743}
5844
5945test "truncate.i0.var" {
60 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
61
6246 var d: i8 = 2;
6347 var z = @truncate(i0, d);
6448 try expect(z == 0);
test/behavior/try.zig-4
......@@ -24,8 +24,6 @@ fn returnsTen() anyerror!i32 {
2424}
2525
2626test "try without vars" {
27 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
28
2927 const result1 = if (failIfTrue(true)) 1 else |_| @as(i32, 2);
3028 try expect(result1 == 2);
3129
......@@ -42,8 +40,6 @@ fn failIfTrue(ok: bool) anyerror!void {
4240}
4341
4442test "try then not executed with assignment" {
45 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
46
4743 if (failIfTrue(true)) {
4844 unreachable;
4945 } else |err| {
test/behavior/usingnamespace.zig-8
......@@ -11,8 +11,6 @@ const C = struct {
1111};
1212
1313test "basic usingnamespace" {
14 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
15
1614 try std.testing.expect(C.B == bool);
1715}
1816
......@@ -23,8 +21,6 @@ fn Foo(comptime T: type) type {
2321}
2422
2523test "usingnamespace inside a generic struct" {
26 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
27
2824 const std2 = Foo(std);
2925 const testing2 = Foo(std.testing);
3026 try std2.testing.expect(true);
......@@ -36,8 +32,6 @@ usingnamespace struct {
3632};
3733
3834test "usingnamespace does not redeclare an imported variable" {
39 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
40
4135 comptime try std.testing.expect(@This().foo == 42);
4236}
4337
......@@ -54,8 +48,6 @@ fn privateFunction() bool {
5448}
5549
5650test {
57 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
58
5951 _ = @import("usingnamespace/import_segregation.zig");
6052}
6153
test/behavior/while.zig-2
......@@ -247,8 +247,6 @@ fn returnTrue() bool {
247247}
248248
249249test "return with implicit cast from while loop" {
250 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
251
252250 returnWithImplicitCastFromWhileLoopTest() catch unreachable;
253251}
254252fn returnWithImplicitCastFromWhileLoopTest() anyerror!void {