| author | |
| committer | |
| log | 6b0c950cb873f5fe65c0029140b91dfd8a7b1adb |
| tree | 290acd017849ae6dd1944f07cac267e055c59c08 |
| parent | 37fea3e3ddc1f7d266d95789c3b1005291bcb96b |
| signature |
7 files changed, 17 insertions(+), 22 deletions(-)
src/arch/arm/CodeGen.zig+17-7| ... | @@ -3180,7 +3180,6 @@ fn setRegOrMem(self: *Self, ty: Type, loc: MCValue, val: MCValue) !void { | ... | @@ -3180,7 +3180,6 @@ fn setRegOrMem(self: *Self, ty: Type, loc: MCValue, val: MCValue) !void { |
| 3180 | fn genSetStack(self: *Self, ty: Type, stack_offset: u32, mcv: MCValue) InnerError!void { | 3180 | fn genSetStack(self: *Self, ty: Type, stack_offset: u32, mcv: MCValue) InnerError!void { |
| 3181 | switch (mcv) { | 3181 | switch (mcv) { |
| 3182 | .dead => unreachable, | 3182 | .dead => unreachable, |
| 3183 | .ptr_stack_offset => unreachable, | ||
| 3184 | .ptr_embedded_in_code => unreachable, | 3183 | .ptr_embedded_in_code => unreachable, |
| 3185 | .unreach, .none => return, // Nothing to do. | 3184 | .unreach, .none => return, // Nothing to do. |
| 3186 | .undef => { | 3185 | .undef => { |
| ... | @@ -3194,6 +3193,10 @@ fn genSetStack(self: *Self, ty: Type, stack_offset: u32, mcv: MCValue) InnerErro | ... | @@ -3194,6 +3193,10 @@ fn genSetStack(self: *Self, ty: Type, stack_offset: u32, mcv: MCValue) InnerErro |
| 3194 | else => return self.fail("TODO implement memset", .{}), | 3193 | else => return self.fail("TODO implement memset", .{}), |
| 3195 | } | 3194 | } |
| 3196 | }, | 3195 | }, |
| 3196 | .ptr_stack_offset => { | ||
| 3197 | const reg = try self.copyToTmpRegister(ty, mcv); | ||
| 3198 | return self.genSetStack(ty, stack_offset, MCValue{ .register = reg }); | ||
| 3199 | }, | ||
| 3197 | .compare_flags_unsigned, | 3200 | .compare_flags_unsigned, |
| 3198 | .compare_flags_signed, | 3201 | .compare_flags_signed, |
| 3199 | .immediate, | 3202 | .immediate, |
| ... | @@ -3858,9 +3861,7 @@ fn lowerDeclRef(self: *Self, tv: TypedValue, decl: *Module.Decl) InnerError!MCVa | ... | @@ -3858,9 +3861,7 @@ fn lowerDeclRef(self: *Self, tv: TypedValue, decl: *Module.Decl) InnerError!MCVa |
| 3858 | const got_addr = got.p_vaddr + decl.link.elf.offset_table_index * ptr_bytes; | 3861 | const got_addr = got.p_vaddr + decl.link.elf.offset_table_index * ptr_bytes; |
| 3859 | return MCValue{ .memory = got_addr }; | 3862 | return MCValue{ .memory = got_addr }; |
| 3860 | } else if (self.bin_file.cast(link.File.MachO)) |_| { | 3863 | } else if (self.bin_file.cast(link.File.MachO)) |_| { |
| 3861 | // TODO I'm hacking my way through here by repurposing .memory for storing | 3864 | unreachable; // unsupported architecture for MachO |
| 3862 | // index to the GOT target symbol index. | ||
| 3863 | return MCValue{ .memory = decl.link.macho.local_sym_index }; | ||
| 3864 | } else if (self.bin_file.cast(link.File.Coff)) |coff_file| { | 3865 | } else if (self.bin_file.cast(link.File.Coff)) |coff_file| { |
| 3865 | const got_addr = coff_file.offset_table_virtual_address + decl.link.coff.offset_table_index * ptr_bytes; | 3866 | const got_addr = coff_file.offset_table_virtual_address + decl.link.coff.offset_table_index * ptr_bytes; |
| 3866 | return MCValue{ .memory = got_addr }; | 3867 | return MCValue{ .memory = got_addr }; |
| ... | @@ -3929,10 +3930,19 @@ fn genTypedValue(self: *Self, typed_value: TypedValue) InnerError!MCValue { | ... | @@ -3929,10 +3930,19 @@ fn genTypedValue(self: *Self, typed_value: TypedValue) InnerError!MCValue { |
| 3929 | }, | 3930 | }, |
| 3930 | .Int => { | 3931 | .Int => { |
| 3931 | const info = typed_value.ty.intInfo(self.target.*); | 3932 | const info = typed_value.ty.intInfo(self.target.*); |
| 3932 | if (info.bits > ptr_bits or info.signedness == .signed) { | 3933 | if (info.bits <= ptr_bits) { |
| 3933 | return self.fail("TODO const int bigger than ptr and signed int", .{}); | 3934 | const unsigned = switch (info.signedness) { |
| 3935 | .signed => blk: { | ||
| 3936 | const signed = @intCast(i32, typed_value.val.toSignedInt()); | ||
| 3937 | break :blk @bitCast(u32, signed); | ||
| 3938 | }, | ||
| 3939 | .unsigned => @intCast(u32, typed_value.val.toUnsignedInt()), | ||
| 3940 | }; | ||
| 3941 | |||
| 3942 | return MCValue{ .immediate = unsigned }; | ||
| 3943 | } else { | ||
| 3944 | return self.lowerUnnamedConst(typed_value); | ||
| 3934 | } | 3945 | } |
| 3935 | return MCValue{ .immediate = @intCast(u32, typed_value.val.toUnsignedInt()) }; | ||
| 3936 | }, | 3946 | }, |
| 3937 | .Bool => { | 3947 | .Bool => { |
| 3938 | return MCValue{ .immediate = @boolToInt(typed_value.val.toBool()) }; | 3948 | return MCValue{ .immediate = @boolToInt(typed_value.val.toBool()) }; |
test/behavior/align.zig-2| ... | @@ -93,8 +93,6 @@ test "@ptrCast preserves alignment of bigger source" { | ... | @@ -93,8 +93,6 @@ test "@ptrCast preserves alignment of bigger source" { |
| 93 | } | 93 | } |
| 94 | 94 | ||
| 95 | test "alignstack" { | 95 | test "alignstack" { |
| 96 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 97 | |||
| 98 | try expect(fnWithAlignedStack() == 1234); | 96 | try expect(fnWithAlignedStack() == 1234); |
| 99 | } | 97 | } |
| 100 | 98 |
test/behavior/bugs/1277.zig-1| ... | @@ -12,6 +12,5 @@ fn f() i32 { | ... | @@ -12,6 +12,5 @@ fn f() i32 { |
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | test "don't emit an LLVM global for a const function when it's in an optional in a struct" { | 14 | test "don't emit an LLVM global for a const function when it's in an optional in a struct" { |
| 15 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 16 | try std.testing.expect(s.f.?() == 1234); | 15 | try std.testing.expect(s.f.?() == 1234); |
| 17 | } | 16 | } |
test/behavior/bugs/1310.zig-1| ... | @@ -23,6 +23,5 @@ fn agent_callback(_vm: [*]VM, options: [*]u8) callconv(.C) i32 { | ... | @@ -23,6 +23,5 @@ fn agent_callback(_vm: [*]VM, options: [*]u8) callconv(.C) i32 { |
| 23 | } | 23 | } |
| 24 | 24 | ||
| 25 | test "fixed" { | 25 | test "fixed" { |
| 26 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 27 | try expect(agent_callback(undefined, undefined) == 11); | 26 | try expect(agent_callback(undefined, undefined) == 11); |
| 28 | } | 27 | } |
test/behavior/bugs/2006.zig-1| ... | @@ -7,7 +7,6 @@ const S = struct { | ... | @@ -7,7 +7,6 @@ const S = struct { |
| 7 | }; | 7 | }; |
| 8 | test "bug 2006" { | 8 | test "bug 2006" { |
| 9 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; | 9 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; |
| 10 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 11 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | 10 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| 12 | var a: S = undefined; | 11 | var a: S = undefined; |
| 13 | a = S{ .p = undefined }; | 12 | a = S{ .p = undefined }; |
test/behavior/cast.zig-4| ... | @@ -35,8 +35,6 @@ fn peerTypeTAndOptionalT(c: bool, b: bool) ?usize { | ... | @@ -35,8 +35,6 @@ fn peerTypeTAndOptionalT(c: bool, b: bool) ?usize { |
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | test "resolve undefined with integer" { | 37 | test "resolve undefined with integer" { |
| 38 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 39 | |||
| 40 | try testResolveUndefWithInt(true, 1234); | 38 | try testResolveUndefWithInt(true, 1234); |
| 41 | comptime try testResolveUndefWithInt(true, 1234); | 39 | comptime try testResolveUndefWithInt(true, 1234); |
| 42 | } | 40 | } |
| ... | @@ -205,8 +203,6 @@ test "implicit cast from *[N]T to [*c]T" { | ... | @@ -205,8 +203,6 @@ test "implicit cast from *[N]T to [*c]T" { |
| 205 | } | 203 | } |
| 206 | 204 | ||
| 207 | test "*usize to *void" { | 205 | test "*usize to *void" { |
| 208 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 209 | |||
| 210 | var i = @as(usize, 0); | 206 | var i = @as(usize, 0); |
| 211 | var v = @ptrCast(*void, &i); | 207 | var v = @ptrCast(*void, &i); |
| 212 | v.* = {}; | 208 | v.* = {}; |
test/behavior/struct.zig-6| ... | @@ -114,8 +114,6 @@ test "struct byval assign" { | ... | @@ -114,8 +114,6 @@ test "struct byval assign" { |
| 114 | } | 114 | } |
| 115 | 115 | ||
| 116 | test "call struct static method" { | 116 | test "call struct static method" { |
| 117 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 118 | |||
| 119 | const result = StructWithNoFields.add(3, 4); | 117 | const result = StructWithNoFields.add(3, 4); |
| 120 | try expect(result == 7); | 118 | try expect(result == 7); |
| 121 | } | 119 | } |
| ... | @@ -193,8 +191,6 @@ test "store member function in variable" { | ... | @@ -193,8 +191,6 @@ test "store member function in variable" { |
| 193 | } | 191 | } |
| 194 | 192 | ||
| 195 | test "member functions" { | 193 | test "member functions" { |
| 196 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 197 | |||
| 198 | const r = MemberFnRand{ .seed = 1234 }; | 194 | const r = MemberFnRand{ .seed = 1234 }; |
| 199 | try expect(r.getSeed() == 1234); | 195 | try expect(r.getSeed() == 1234); |
| 200 | } | 196 | } |
| ... | @@ -244,8 +240,6 @@ test "call method with mutable reference to struct with no fields" { | ... | @@ -244,8 +240,6 @@ test "call method with mutable reference to struct with no fields" { |
| 244 | } | 240 | } |
| 245 | 241 | ||
| 246 | test "usingnamespace within struct scope" { | 242 | test "usingnamespace within struct scope" { |
| 247 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 248 | |||
| 249 | const S = struct { | 243 | const S = struct { |
| 250 | usingnamespace struct { | 244 | usingnamespace struct { |
| 251 | pub fn inner() i32 { | 245 | pub fn inner() i32 { |