Skip to content

Commit 7894703

Browse files
committed
aarch64: implement more optional/error union/union support
1 parent 69abc94 commit 7894703

File tree

13 files changed

+342
-68
lines changed

13 files changed

+342
-68
lines changed

lib/compiler_rt.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ comptime {
240240
_ = @import("compiler_rt/udivmodti4.zig");
241241

242242
// extra
243-
if (builtin.zig_backend != .stage2_aarch64) _ = @import("compiler_rt/os_version_check.zig");
243+
_ = @import("compiler_rt/os_version_check.zig");
244244
_ = @import("compiler_rt/emutls.zig");
245245
_ = @import("compiler_rt/arm.zig");
246246
_ = @import("compiler_rt/aulldiv.zig");

src/codegen/aarch64/Select.zig

Lines changed: 341 additions & 29 deletions
Large diffs are not rendered by default.

test/behavior/decl_literals.zig

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ test "decl literal with pointer" {
3333
}
3434

3535
test "call decl literal with optional" {
36-
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
3736
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest;
3837
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
3938
if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
@@ -74,7 +73,6 @@ test "call decl literal" {
7473
}
7574

7675
test "call decl literal with error union" {
77-
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
7876
if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; // TODO
7977

8078
const S = struct {

test/behavior/error.zig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -943,7 +943,6 @@ test "optional error set function parameter" {
943943
}
944944

945945
test "returning an error union containing a type with no runtime bits" {
946-
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
947946
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
948947
if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
949948

test/behavior/field_parent_ptr.zig

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,6 @@ test "@fieldParentPtr extern struct last zero-bit field" {
587587
}
588588

589589
test "@fieldParentPtr unaligned packed struct" {
590-
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
591590
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
592591
if (builtin.zig_backend == .stage2_llvm) return error.SkipZigTest;
593592
if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
@@ -726,7 +725,6 @@ test "@fieldParentPtr unaligned packed struct" {
726725
}
727726

728727
test "@fieldParentPtr aligned packed struct" {
729-
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
730728
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
731729
if (builtin.zig_backend == .stage2_llvm) return error.SkipZigTest;
732730
if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;

test/behavior/inline_switch.zig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ test "inline switch enums" {
4343

4444
const U = union(E) { a: void, b: u2, c: u3, d: u4 };
4545
test "inline switch unions" {
46-
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
4746
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
4847
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
4948

test/behavior/optional.zig

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,6 @@ test "assigning to an unwrapped optional field in an inline loop" {
319319
}
320320

321321
test "coerce an anon struct literal to optional struct" {
322-
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
323322
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
324323
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
325324
if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
@@ -447,7 +446,6 @@ test "optional pointer to zero bit optional payload" {
447446
}
448447

449448
test "optional pointer to zero bit error union payload" {
450-
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
451449
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
452450
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
453451
if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;

test/behavior/struct.zig

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -797,7 +797,6 @@ test "fn with C calling convention returns struct by value" {
797797
}
798798

799799
test "non-packed struct with u128 entry in union" {
800-
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
801800
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
802801
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
803802
if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
@@ -1026,7 +1025,6 @@ test "packed struct with undefined initializers" {
10261025
}
10271026

10281027
test "for loop over pointers to struct, getting field from struct pointer" {
1029-
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
10301028
if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
10311029
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
10321030
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
@@ -1093,7 +1091,6 @@ test "anon init through error unions and optionals" {
10931091
}
10941092

10951093
test "anon init through optional" {
1096-
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
10971094
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
10981095
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
10991096
if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
@@ -1113,7 +1110,6 @@ test "anon init through optional" {
11131110
}
11141111

11151112
test "anon init through error union" {
1116-
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
11171113
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
11181114
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
11191115
if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
@@ -1398,7 +1394,6 @@ test "struct has only one reference" {
13981394
}
13991395

14001396
test "no dependency loop on pointer to optional struct" {
1401-
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
14021397
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
14031398
if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
14041399

test/behavior/switch.zig

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,6 @@ fn switchProngWithVarFn(a: SwitchProngWithVarEnum) !void {
299299
}
300300

301301
test "switch on enum using pointer capture" {
302-
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
303302
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
304303
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
305304

@@ -360,7 +359,6 @@ fn testSwitchHandleAllCasesRange(x: u8) u8 {
360359
}
361360

362361
test "switch on union with some prongs capturing" {
363-
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
364362
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
365363
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
366364

@@ -975,8 +973,6 @@ test "switch prong captures range" {
975973
}
976974

977975
test "prong with inline call to unreachable" {
978-
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
979-
980976
const U = union(enum) {
981977
void: void,
982978
bool: bool,

test/behavior/switch_on_captured_error.zig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ const expectEqual = std.testing.expectEqual;
66
const builtin = @import("builtin");
77

88
test "switch on error union catch capture" {
9-
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
109
if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
1110
if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
1211

0 commit comments

Comments
 (0)