mirror of
https://github.com/ziglang/zig.git
synced 2024-11-27 07:32:44 +00:00
x86_64: fix packed struct field reuse
This commit is contained in:
parent
bdb6546a8f
commit
c70c333594
@ -7324,8 +7324,8 @@ fn airStructFieldVal(self: *Self, inst: Air.Inst.Index) !void {
|
|||||||
.load_frame => |frame_addr| {
|
.load_frame => |frame_addr| {
|
||||||
const field_abi_size: u32 = @intCast(field_ty.abiSize(mod));
|
const field_abi_size: u32 = @intCast(field_ty.abiSize(mod));
|
||||||
if (field_off % 8 == 0) {
|
if (field_off % 8 == 0) {
|
||||||
const off_mcv =
|
const field_byte_off = @divExact(field_off, 8);
|
||||||
src_mcv.address().offset(@intCast(@divExact(field_off, 8))).deref();
|
const off_mcv = src_mcv.address().offset(@intCast(field_byte_off)).deref();
|
||||||
const field_bit_size = field_ty.bitSize(mod);
|
const field_bit_size = field_ty.bitSize(mod);
|
||||||
|
|
||||||
if (field_abi_size <= 8) {
|
if (field_abi_size <= 8) {
|
||||||
@ -7350,7 +7350,9 @@ fn airStructFieldVal(self: *Self, inst: Air.Inst.Index) !void {
|
|||||||
try self.copyToRegisterWithInstTracking(inst, field_ty, dst_mcv);
|
try self.copyToRegisterWithInstTracking(inst, field_ty, dst_mcv);
|
||||||
}
|
}
|
||||||
|
|
||||||
const dst_mcv = if (self.reuseOperand(inst, operand, 0, src_mcv))
|
const container_abi_size: u32 = @intCast(container_ty.abiSize(mod));
|
||||||
|
const dst_mcv = if (field_byte_off + field_abi_size <= container_abi_size and
|
||||||
|
self.reuseOperand(inst, operand, 0, src_mcv))
|
||||||
off_mcv
|
off_mcv
|
||||||
else dst: {
|
else dst: {
|
||||||
const dst_mcv = try self.allocRegOrMem(inst, true);
|
const dst_mcv = try self.allocRegOrMem(inst, true);
|
||||||
|
@ -804,7 +804,6 @@ test "nested packed struct at non-zero offset" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
test "nested packed struct at non-zero offset 2" {
|
test "nested packed struct at non-zero offset 2" {
|
||||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
|
|
||||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
|
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
|
||||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
|
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
|
||||||
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
|
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
|
||||||
|
Loading…
Reference in New Issue
Block a user