mirror of
https://github.com/ziglang/zig.git
synced 2025-01-27 12:20:46 +00:00
Merge pull request #12799 from joachimschmidt557/stage2-arm
stage2 ARM: introduce allocRegs mechanism and other improvements
This commit is contained in:
commit
5778077f9f
File diff suppressed because it is too large
Load Diff
@ -11,6 +11,7 @@ const link = @import("../../link.zig");
|
||||
const Module = @import("../../Module.zig");
|
||||
const Type = @import("../../type.zig").Type;
|
||||
const ErrorMsg = Module.ErrorMsg;
|
||||
const Target = std.Target;
|
||||
const assert = std.debug.assert;
|
||||
const DW = std.dwarf;
|
||||
const leb128 = std.leb;
|
||||
@ -93,6 +94,8 @@ pub fn emitMir(
|
||||
.sub => try emit.mirDataProcessing(inst),
|
||||
.subs => try emit.mirDataProcessing(inst),
|
||||
|
||||
.sub_sp_scratch_r0 => try emit.mirSubStackPointer(inst),
|
||||
|
||||
.asr => try emit.mirShift(inst),
|
||||
.lsl => try emit.mirShift(inst),
|
||||
.lsr => try emit.mirShift(inst),
|
||||
@ -190,6 +193,24 @@ fn instructionSize(emit: *Emit, inst: Mir.Inst.Index) usize {
|
||||
.dbg_epilogue_begin,
|
||||
.dbg_prologue_end,
|
||||
=> return 0,
|
||||
|
||||
.sub_sp_scratch_r0 => {
|
||||
const imm32 = emit.mir.instructions.items(.data)[inst].imm32;
|
||||
|
||||
if (imm32 == 0) {
|
||||
return 0 * 4;
|
||||
} else if (Instruction.Operand.fromU32(imm32) != null) {
|
||||
// sub
|
||||
return 1 * 4;
|
||||
} else if (Target.arm.featureSetHas(emit.target.cpu.features, .has_v7)) {
|
||||
// movw; movt; sub
|
||||
return 3 * 4;
|
||||
} else {
|
||||
// mov; orr; orr; orr; sub
|
||||
return 5 * 4;
|
||||
}
|
||||
},
|
||||
|
||||
else => return 4,
|
||||
}
|
||||
}
|
||||
@ -385,20 +406,75 @@ fn dbgAdvancePCAndLine(self: *Emit, line: u32, column: u32) !void {
|
||||
fn mirDataProcessing(emit: *Emit, inst: Mir.Inst.Index) !void {
|
||||
const tag = emit.mir.instructions.items(.tag)[inst];
|
||||
const cond = emit.mir.instructions.items(.cond)[inst];
|
||||
const rr_op = emit.mir.instructions.items(.data)[inst].rr_op;
|
||||
|
||||
switch (tag) {
|
||||
.add => try emit.writeInstruction(Instruction.add(cond, rr_op.rd, rr_op.rn, rr_op.op)),
|
||||
.adds => try emit.writeInstruction(Instruction.adds(cond, rr_op.rd, rr_op.rn, rr_op.op)),
|
||||
.@"and" => try emit.writeInstruction(Instruction.@"and"(cond, rr_op.rd, rr_op.rn, rr_op.op)),
|
||||
.cmp => try emit.writeInstruction(Instruction.cmp(cond, rr_op.rn, rr_op.op)),
|
||||
.eor => try emit.writeInstruction(Instruction.eor(cond, rr_op.rd, rr_op.rn, rr_op.op)),
|
||||
.mov => try emit.writeInstruction(Instruction.mov(cond, rr_op.rd, rr_op.op)),
|
||||
.mvn => try emit.writeInstruction(Instruction.mvn(cond, rr_op.rd, rr_op.op)),
|
||||
.orr => try emit.writeInstruction(Instruction.orr(cond, rr_op.rd, rr_op.rn, rr_op.op)),
|
||||
.rsb => try emit.writeInstruction(Instruction.rsb(cond, rr_op.rd, rr_op.rn, rr_op.op)),
|
||||
.sub => try emit.writeInstruction(Instruction.sub(cond, rr_op.rd, rr_op.rn, rr_op.op)),
|
||||
.subs => try emit.writeInstruction(Instruction.subs(cond, rr_op.rd, rr_op.rn, rr_op.op)),
|
||||
.add,
|
||||
.adds,
|
||||
.@"and",
|
||||
.eor,
|
||||
.orr,
|
||||
.rsb,
|
||||
.sub,
|
||||
.subs,
|
||||
=> {
|
||||
const rr_op = emit.mir.instructions.items(.data)[inst].rr_op;
|
||||
switch (tag) {
|
||||
.add => try emit.writeInstruction(Instruction.add(cond, rr_op.rd, rr_op.rn, rr_op.op)),
|
||||
.adds => try emit.writeInstruction(Instruction.adds(cond, rr_op.rd, rr_op.rn, rr_op.op)),
|
||||
.@"and" => try emit.writeInstruction(Instruction.@"and"(cond, rr_op.rd, rr_op.rn, rr_op.op)),
|
||||
.eor => try emit.writeInstruction(Instruction.eor(cond, rr_op.rd, rr_op.rn, rr_op.op)),
|
||||
.orr => try emit.writeInstruction(Instruction.orr(cond, rr_op.rd, rr_op.rn, rr_op.op)),
|
||||
.rsb => try emit.writeInstruction(Instruction.rsb(cond, rr_op.rd, rr_op.rn, rr_op.op)),
|
||||
.sub => try emit.writeInstruction(Instruction.sub(cond, rr_op.rd, rr_op.rn, rr_op.op)),
|
||||
.subs => try emit.writeInstruction(Instruction.subs(cond, rr_op.rd, rr_op.rn, rr_op.op)),
|
||||
else => unreachable,
|
||||
}
|
||||
},
|
||||
.cmp => {
|
||||
const r_op_cmp = emit.mir.instructions.items(.data)[inst].r_op_cmp;
|
||||
try emit.writeInstruction(Instruction.cmp(cond, r_op_cmp.rn, r_op_cmp.op));
|
||||
},
|
||||
.mov,
|
||||
.mvn,
|
||||
=> {
|
||||
const r_op_mov = emit.mir.instructions.items(.data)[inst].r_op_mov;
|
||||
switch (tag) {
|
||||
.mov => try emit.writeInstruction(Instruction.mov(cond, r_op_mov.rd, r_op_mov.op)),
|
||||
.mvn => try emit.writeInstruction(Instruction.mvn(cond, r_op_mov.rd, r_op_mov.op)),
|
||||
else => unreachable,
|
||||
}
|
||||
},
|
||||
else => unreachable,
|
||||
}
|
||||
}
|
||||
|
||||
fn mirSubStackPointer(emit: *Emit, inst: Mir.Inst.Index) !void {
|
||||
const tag = emit.mir.instructions.items(.tag)[inst];
|
||||
const cond = emit.mir.instructions.items(.cond)[inst];
|
||||
const imm32 = emit.mir.instructions.items(.data)[inst].imm32;
|
||||
|
||||
switch (tag) {
|
||||
.sub_sp_scratch_r0 => {
|
||||
if (imm32 == 0) return;
|
||||
|
||||
const operand = Instruction.Operand.fromU32(imm32) orelse blk: {
|
||||
const scratch: Register = .r0;
|
||||
|
||||
if (Target.arm.featureSetHas(emit.target.cpu.features, .has_v7)) {
|
||||
try emit.writeInstruction(Instruction.movw(cond, scratch, @truncate(u16, imm32)));
|
||||
try emit.writeInstruction(Instruction.movt(cond, scratch, @truncate(u16, imm32 >> 16)));
|
||||
} else {
|
||||
try emit.writeInstruction(Instruction.mov(cond, scratch, Instruction.Operand.imm(@truncate(u8, imm32), 0)));
|
||||
try emit.writeInstruction(Instruction.orr(cond, scratch, scratch, Instruction.Operand.imm(@truncate(u8, imm32 >> 8), 12)));
|
||||
try emit.writeInstruction(Instruction.orr(cond, scratch, scratch, Instruction.Operand.imm(@truncate(u8, imm32 >> 16), 8)));
|
||||
try emit.writeInstruction(Instruction.orr(cond, scratch, scratch, Instruction.Operand.imm(@truncate(u8, imm32 >> 24), 4)));
|
||||
}
|
||||
|
||||
break :blk Instruction.Operand.reg(scratch, Instruction.Operand.Shift.none);
|
||||
};
|
||||
|
||||
try emit.writeInstruction(Instruction.sub(cond, .sp, .sp, operand));
|
||||
},
|
||||
else => unreachable,
|
||||
}
|
||||
}
|
||||
|
@ -111,6 +111,11 @@ pub const Inst = struct {
|
||||
strh,
|
||||
/// Subtract
|
||||
sub,
|
||||
/// Pseudo-instruction: Subtract 32-bit immediate from stack
|
||||
///
|
||||
/// r0 can be used by Emit as a scratch register for loading
|
||||
/// the immediate
|
||||
sub_sp_scratch_r0,
|
||||
/// Subtract, update condition flags
|
||||
subs,
|
||||
/// Supervisor Call
|
||||
@ -144,6 +149,10 @@ pub const Inst = struct {
|
||||
///
|
||||
/// Used by e.g. svc
|
||||
imm24: u24,
|
||||
/// A 32-bit immediate value.
|
||||
///
|
||||
/// Used by e.g. sub_sp_scratch_r0
|
||||
imm32: u32,
|
||||
/// Index into `extra`. Meaning of what can be found there is context-dependent.
|
||||
///
|
||||
/// Used by e.g. load_memory
|
||||
@ -166,6 +175,20 @@ pub const Inst = struct {
|
||||
rd: Register,
|
||||
imm16: u16,
|
||||
},
|
||||
/// A register and an operand
|
||||
///
|
||||
/// Used by mov and mvn
|
||||
r_op_mov: struct {
|
||||
rd: Register,
|
||||
op: bits.Instruction.Operand,
|
||||
},
|
||||
/// A register and an operand
|
||||
///
|
||||
/// Used by cmp
|
||||
r_op_cmp: struct {
|
||||
rn: Register,
|
||||
op: bits.Instruction.Operand,
|
||||
},
|
||||
/// Two registers and a shift amount
|
||||
///
|
||||
/// Used by e.g. lsl
|
||||
|
@ -13,7 +13,6 @@ const Foo = struct {
|
||||
test "@alignOf(T) before referencing T" {
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
|
||||
comptime try expect(@alignOf(Foo) != maxInt(usize));
|
||||
if (native_arch == .x86_64) {
|
||||
comptime try expect(@alignOf(Foo) == 4);
|
||||
|
@ -175,7 +175,6 @@ test "nested arrays of integers" {
|
||||
|
||||
test "implicit comptime in array type size" {
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
|
||||
|
||||
var arr: [plusOne(10)]bool = undefined;
|
||||
try expect(arr.len == 11);
|
||||
@ -245,7 +244,6 @@ const Sub = struct { b: u8 };
|
||||
const Str = struct { a: []Sub };
|
||||
test "set global var array via slice embedded in struct" {
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
|
||||
var s = Str{ .a = s_array[0..] };
|
||||
|
||||
@ -298,7 +296,6 @@ fn testArrayByValAtComptime(b: [2]u8) u8 {
|
||||
|
||||
test "comptime evaluating function that takes array by value" {
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
|
||||
const arr = [_]u8{ 1, 2 };
|
||||
const x = comptime testArrayByValAtComptime(arr);
|
||||
@ -427,7 +424,6 @@ test "anonymous literal in array" {
|
||||
|
||||
test "access the null element of a null terminated array" {
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
|
||||
const S = struct {
|
||||
fn doTheTest() !void {
|
||||
@ -484,7 +480,6 @@ test "sentinel element count towards the ABI size calculation" {
|
||||
test "zero-sized array with recursive type definition" {
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
|
||||
const U = struct {
|
||||
fn foo(comptime T: type, comptime n: usize) type {
|
||||
|
@ -465,7 +465,6 @@ fn nine() u8 {
|
||||
|
||||
test "struct inside function" {
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
|
||||
|
||||
try testStructInFn();
|
||||
comptime try testStructInFn();
|
||||
@ -514,7 +513,6 @@ var global_foo: *i32 = undefined;
|
||||
|
||||
test "peer result location with typed parent, runtime condition, comptime prongs" {
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
|
||||
|
||||
const S = struct {
|
||||
fn doTheTest(arg: i32) i32 {
|
||||
@ -643,7 +641,6 @@ test "global constant is loaded with a runtime-known index" {
|
||||
|
||||
test "multiline string literal is null terminated" {
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
|
||||
|
||||
const s1 =
|
||||
\\one
|
||||
@ -1060,7 +1057,6 @@ comptime {
|
||||
|
||||
test "switch inside @as gets correct type" {
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
|
||||
var a: u32 = 0;
|
||||
var b: [2]u32 = undefined;
|
||||
|
@ -138,7 +138,6 @@ test "@bitCast extern structs at runtime and comptime" {
|
||||
if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
|
||||
|
||||
const Full = extern struct {
|
||||
number: u16,
|
||||
|
@ -523,7 +523,6 @@ fn testCastConstArrayRefToConstSlice() !void {
|
||||
|
||||
test "peer type resolution: error and [N]T" {
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
|
||||
try expect(mem.eql(u8, try testPeerErrorAndArray(0), "OK"));
|
||||
comptime try expect(mem.eql(u8, try testPeerErrorAndArray(0), "OK"));
|
||||
@ -548,7 +547,6 @@ fn testPeerErrorAndArray2(x: u8) anyerror![]const u8 {
|
||||
test "single-item pointer of array to slice to unknown length pointer" {
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
|
||||
try testCastPtrOfArrayToSliceAndPtr();
|
||||
comptime try testCastPtrOfArrayToSliceAndPtr();
|
||||
@ -578,7 +576,6 @@ fn testCastPtrOfArrayToSliceAndPtr() !void {
|
||||
test "cast *[1][*]const u8 to [*]const ?[*]const u8" {
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
|
||||
|
||||
const window_name = [1][*]const u8{"window name"};
|
||||
@ -649,7 +646,6 @@ test "@floatCast cast down" {
|
||||
test "peer type resolution: unreachable, error set, unreachable" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
|
||||
const Error = error{
|
||||
FileDescriptorAlreadyPresentInSet,
|
||||
@ -922,7 +918,6 @@ test "peer cast *[N:x]T to *[N]T" {
|
||||
|
||||
test "peer cast [*:x]T to [*]T" {
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
|
||||
|
||||
const S = struct {
|
||||
@ -964,7 +959,6 @@ test "peer cast [:x]T to [*:x]T" {
|
||||
|
||||
test "peer type resolution implicit cast to return type" {
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
|
||||
const S = struct {
|
||||
fn doTheTest() !void {
|
||||
@ -984,7 +978,6 @@ test "peer type resolution implicit cast to return type" {
|
||||
|
||||
test "peer type resolution implicit cast to variable type" {
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
|
||||
|
||||
const S = struct {
|
||||
@ -1009,7 +1002,6 @@ test "variable initialization uses result locations properly with regards to the
|
||||
|
||||
test "cast between C pointer with different but compatible types" {
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
|
||||
const S = struct {
|
||||
fn foo(arg: [*]c_ushort) u16 {
|
||||
@ -1026,7 +1018,6 @@ test "cast between C pointer with different but compatible types" {
|
||||
|
||||
test "peer type resolve string lit with sentinel-terminated mutable slice" {
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
|
||||
|
||||
var array: [4:0]u8 = undefined;
|
||||
@ -1079,7 +1070,6 @@ test "comptime float casts" {
|
||||
test "pointer reinterpret const float to int" {
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
|
||||
// The hex representation is 0x3fe3333333333303.
|
||||
const float: f64 = 5.99999999999994648725e-01;
|
||||
|
@ -87,7 +87,6 @@ fn bigToNativeEndian(comptime T: type, v: T) T {
|
||||
test "type pun endianness" {
|
||||
if (builtin.zig_backend == .stage1) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
|
||||
comptime {
|
||||
const StructOfBytes = extern struct { x: [4]u8 };
|
||||
@ -398,7 +397,6 @@ test "offset field ptr by enclosing array element size" {
|
||||
test "accessing reinterpreted memory of parent object" {
|
||||
if (builtin.zig_backend == .stage1) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
const S = extern struct {
|
||||
a: f32,
|
||||
b: [4]u8,
|
||||
|
@ -9,7 +9,6 @@ var argv: [*]const [*]const u8 = undefined;
|
||||
test "const slice child" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
|
||||
const strs = [_][*]const u8{ "one", "two", "three" };
|
||||
argv = &strs;
|
||||
|
@ -606,7 +606,6 @@ fn testEnumWithSpecifiedTagValues(x: MultipleChoice) !void {
|
||||
}
|
||||
|
||||
test "enum with specified tag values" {
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
|
||||
|
||||
try testEnumWithSpecifiedTagValues(MultipleChoice.C);
|
||||
@ -614,7 +613,6 @@ test "enum with specified tag values" {
|
||||
}
|
||||
|
||||
test "non-exhaustive enum" {
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
|
||||
|
||||
const S = struct {
|
||||
@ -677,7 +675,6 @@ test "empty non-exhaustive enum" {
|
||||
}
|
||||
|
||||
test "single field non-exhaustive enum" {
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
|
||||
|
||||
const S = struct {
|
||||
@ -741,7 +738,6 @@ test "cast integer literal to enum" {
|
||||
}
|
||||
|
||||
test "enum with specified and unspecified tag values" {
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
|
||||
|
||||
try testEnumWithSpecifiedAndUnspecifiedTagValues(MultipleChoice2.D);
|
||||
@ -925,7 +921,6 @@ test "enum literal casting to tagged union" {
|
||||
const Bar = enum { A, B, C, D };
|
||||
|
||||
test "enum literal casting to error union with payload enum" {
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
|
||||
|
||||
var bar: error{B}!Bar = undefined;
|
||||
@ -1132,7 +1127,6 @@ test "tag name functions are unique" {
|
||||
|
||||
test "size of enum with only one tag which has explicit integer tag type" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
|
||||
|
||||
const E = enum(u8) { nope = 10 };
|
||||
|
@ -222,7 +222,6 @@ fn testErrorSetType() !void {
|
||||
|
||||
test "explicit error set cast" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
|
||||
try testExplicitErrorSetCast(Set1.A);
|
||||
@ -282,7 +281,6 @@ test "inferred empty error set comptime catch" {
|
||||
}
|
||||
|
||||
test "error union peer type resolution" {
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
|
||||
try testErrorUnionPeerTypeResolution(1);
|
||||
@ -327,7 +325,6 @@ fn foo3(b: usize) Error!usize {
|
||||
|
||||
test "error: Infer error set from literals" {
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
|
||||
_ = nullLiteral("n") catch |err| handleErrors(err);
|
||||
_ = floatLiteral("n") catch |err| handleErrors(err);
|
||||
@ -700,7 +697,6 @@ test "ret_ptr doesn't cause own inferred error set to be resolved" {
|
||||
|
||||
test "simple else prong allowed even when all errors handled" {
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
|
||||
|
||||
const S = struct {
|
||||
|
@ -69,7 +69,6 @@ fn constExprEvalOnSingleExprBlocksFn(x: i32, b: bool) i32 {
|
||||
}
|
||||
|
||||
test "constant expressions" {
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
|
||||
var array: [array_size]u8 = undefined;
|
||||
@ -138,7 +137,6 @@ test "pointer to type" {
|
||||
test "a type constructed in a global expression" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
|
||||
var l: List = undefined;
|
||||
l.array[0] = 10;
|
||||
@ -338,7 +336,6 @@ fn doesAlotT(comptime T: type, value: usize) T {
|
||||
}
|
||||
|
||||
test "@setEvalBranchQuota at same scope as generic function call" {
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
|
||||
try expect(doesAlotT(u32, 2) == 2);
|
||||
@ -565,7 +562,6 @@ test "inlined loop has array literal with elided runtime scope on first iteratio
|
||||
}
|
||||
|
||||
test "ptr to local array argument at comptime" {
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
|
||||
comptime {
|
||||
@ -806,7 +802,6 @@ test "array concatenation sets the sentinel - value" {
|
||||
test "array concatenation sets the sentinel - pointer" {
|
||||
if (builtin.zig_backend == .stage1) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
|
||||
|
||||
var a = [2]u3{ 1, 7 };
|
||||
@ -956,7 +951,6 @@ test "const local with comptime init through array init" {
|
||||
|
||||
test "closure capture type of runtime-known parameter" {
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
|
||||
const S = struct {
|
||||
fn b(c: anytype) !void {
|
||||
@ -1074,7 +1068,6 @@ test "comptime break operand passing through runtime switch converted to runtime
|
||||
|
||||
test "no dependency loop for alignment of self struct" {
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
|
||||
const S = struct {
|
||||
fn doTheTest() !void {
|
||||
@ -1111,7 +1104,6 @@ test "no dependency loop for alignment of self struct" {
|
||||
|
||||
test "no dependency loop for alignment of self bare union" {
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
|
||||
const S = struct {
|
||||
fn doTheTest() !void {
|
||||
@ -1148,7 +1140,6 @@ test "no dependency loop for alignment of self bare union" {
|
||||
|
||||
test "no dependency loop for alignment of self tagged union" {
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
|
||||
const S = struct {
|
||||
fn doTheTest() !void {
|
||||
@ -1336,7 +1327,6 @@ test "lazy sizeof is resolved in division" {
|
||||
}
|
||||
|
||||
test "lazy value is resolved as slice operand" {
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
|
||||
const A = struct { a: u32 };
|
||||
|
@ -2,7 +2,6 @@ const expect = @import("std").testing.expect;
|
||||
const builtin = @import("builtin");
|
||||
|
||||
test "@fieldParentPtr non-first field" {
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
|
||||
@ -11,7 +10,6 @@ test "@fieldParentPtr non-first field" {
|
||||
}
|
||||
|
||||
test "@fieldParentPtr first field" {
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
|
||||
|
@ -5,7 +5,6 @@ const expectEqual = std.testing.expectEqual;
|
||||
const mem = std.mem;
|
||||
|
||||
test "continue in for loop" {
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
|
||||
|
||||
const array = [_]i32{ 1, 2, 3, 4, 5 };
|
||||
@ -130,7 +129,6 @@ test "for with null and T peer types and inferred result location type" {
|
||||
}
|
||||
|
||||
test "2 break statements and an else" {
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
|
||||
|
||||
const S = struct {
|
||||
@ -177,7 +175,6 @@ fn mangleString(s: []u8) void {
|
||||
}
|
||||
|
||||
test "for copies its payload" {
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
|
||||
const S = struct {
|
||||
@ -213,7 +210,6 @@ test "for on slice with allowzero ptr" {
|
||||
|
||||
test "else continue outer for" {
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
|
||||
var i: usize = 6;
|
||||
var buf: [5]u8 = undefined;
|
||||
|
@ -91,7 +91,6 @@ fn max_f64(a: f64, b: f64) f64 {
|
||||
|
||||
test "type constructed by comptime function call" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
|
||||
|
||||
var l: SimpleList(10) = undefined;
|
||||
|
@ -12,7 +12,6 @@ fn foo() C!void {
|
||||
}
|
||||
|
||||
test "merge error sets" {
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
if (foo()) {
|
||||
|
@ -18,7 +18,6 @@ fn testDerefPtr() !void {
|
||||
|
||||
test "pointer arithmetic" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
|
||||
|
||||
var ptr: [*]const u8 = "abcd";
|
||||
@ -66,7 +65,6 @@ test "initialize const optional C pointer to null" {
|
||||
|
||||
test "assigning integer to C pointer" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
|
||||
|
||||
var x: i32 = 0;
|
||||
@ -281,7 +279,6 @@ test "array initialization types" {
|
||||
|
||||
test "null terminated pointer" {
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
|
||||
|
||||
const S = struct {
|
||||
@ -299,7 +296,6 @@ test "null terminated pointer" {
|
||||
|
||||
test "allow any sentinel" {
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
|
||||
|
||||
const S = struct {
|
||||
@ -315,7 +311,6 @@ test "allow any sentinel" {
|
||||
|
||||
test "pointer sentinel with enums" {
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
|
||||
|
||||
const S = struct {
|
||||
|
@ -4,7 +4,6 @@ const expect = std.testing.expect;
|
||||
const native_endian = builtin.target.cpu.arch.endian();
|
||||
|
||||
test "reinterpret bytes as integer with nonzero offset" {
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
|
||||
try testReinterpretBytesAsInteger();
|
||||
@ -39,7 +38,6 @@ fn testReinterpretWithOffsetAndNoWellDefinedLayout() !void {
|
||||
}
|
||||
|
||||
test "reinterpret bytes inside auto-layout struct as integer with nonzero offset" {
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
|
||||
try testReinterpretStructWrappedBytesAsInteger();
|
||||
@ -179,7 +177,6 @@ test "lower reinterpreted comptime field ptr" {
|
||||
}
|
||||
|
||||
test "reinterpret struct field at comptime" {
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
|
||||
const numNative = comptime Bytes.init(0x12345678);
|
||||
|
@ -18,7 +18,6 @@ test "@sizeOf on compile-time types" {
|
||||
}
|
||||
|
||||
test "@TypeOf() with multiple arguments" {
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
|
||||
{
|
||||
@ -77,7 +76,6 @@ const P = packed struct {
|
||||
};
|
||||
|
||||
test "@offsetOf" {
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
|
||||
|
||||
// Packed structs have fixed memory layout
|
||||
|
@ -28,7 +28,6 @@ comptime {
|
||||
|
||||
test "slicing" {
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
|
||||
|
||||
var array: [20]i32 = undefined;
|
||||
|
||||
@ -269,7 +268,6 @@ fn sliceSum(comptime q: []const u8) i32 {
|
||||
|
||||
test "slice type with custom alignment" {
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
|
||||
|
||||
const LazilyResolvedType = struct {
|
||||
anything: i32,
|
||||
@ -283,7 +281,6 @@ test "slice type with custom alignment" {
|
||||
|
||||
test "obtaining a null terminated slice" {
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
|
||||
|
||||
// here we have a normal array
|
||||
var buf: [50]u8 = undefined;
|
||||
|
@ -10,7 +10,6 @@ top_level_field: i32,
|
||||
|
||||
test "top level fields" {
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
|
||||
|
||||
var instance = @This(){
|
||||
.top_level_field = 1234,
|
||||
@ -104,7 +103,6 @@ fn testMutation(foo: *StructFoo) void {
|
||||
|
||||
test "struct byval assign" {
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
|
||||
|
||||
var foo1: StructFoo = undefined;
|
||||
var foo2: StructFoo = undefined;
|
||||
@ -240,7 +238,6 @@ test "usingnamespace within struct scope" {
|
||||
|
||||
test "struct field init with catch" {
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
|
||||
|
||||
const S = struct {
|
||||
fn doTheTest() !void {
|
||||
@ -281,7 +278,6 @@ const Val = struct {
|
||||
test "struct point to self" {
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
|
||||
var root: Node = undefined;
|
||||
root.val.x = 1;
|
||||
@ -297,7 +293,6 @@ test "struct point to self" {
|
||||
|
||||
test "void struct fields" {
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
|
||||
const foo = VoidStructFieldsFoo{
|
||||
.a = void{},
|
||||
@ -761,7 +756,6 @@ test "packed struct with u0 field access" {
|
||||
}
|
||||
|
||||
test "access to global struct fields" {
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
|
||||
|
||||
@ -1260,7 +1254,6 @@ test "typed init through error unions and optionals" {
|
||||
|
||||
test "initialize struct with empty literal" {
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
|
||||
const S = struct { x: i32 = 1234 };
|
||||
var s: S = .{};
|
||||
@ -1362,7 +1355,6 @@ test "store to comptime field" {
|
||||
|
||||
test "struct field init value is size of the struct" {
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
|
||||
const namespace = struct {
|
||||
const S = extern struct {
|
||||
|
@ -348,7 +348,6 @@ test "switch on const enum with var" {
|
||||
}
|
||||
|
||||
test "anon enum literal used in switch on union enum" {
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
|
||||
const Foo = union(enum) {
|
||||
@ -490,7 +489,6 @@ test "switch prongs with error set cases make a new error set type for capture v
|
||||
}
|
||||
|
||||
test "return result loc and then switch with range implicit casted to error union" {
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
|
||||
const S = struct {
|
||||
|
@ -25,7 +25,6 @@ test "this refer to module call private fn" {
|
||||
}
|
||||
|
||||
test "this refer to container" {
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
|
||||
|
||||
var pt: Point(i32) = undefined;
|
||||
|
@ -3,7 +3,6 @@ const builtin = @import("builtin");
|
||||
const expect = std.testing.expect;
|
||||
|
||||
test "try on error union" {
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
|
||||
|
||||
try tryOnErrorUnionImpl();
|
||||
|
@ -92,7 +92,6 @@ const FooExtern = extern union {
|
||||
};
|
||||
|
||||
test "basic extern unions" {
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
|
||||
|
||||
var foo = FooExtern{ .int = 1 };
|
||||
|
@ -58,7 +58,6 @@ test "two files usingnamespace import each other" {
|
||||
}
|
||||
|
||||
test {
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
|
||||
const AA = struct {
|
||||
|
@ -175,7 +175,6 @@ test "while with optional as condition with else" {
|
||||
|
||||
test "while with error union condition" {
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
|
||||
|
||||
numbers_left = 10;
|
||||
|
Loading…
Reference in New Issue
Block a user