authorgravatar for joachim.schmidt557@outlook.comJoachim Schmidt <joachim.schmidt557@outlook.com> 2021-01-17 22:22:47+01:00
committergravatar for joachim.schmidt557@outlook.comJoachim Schmidt <joachim.schmidt557@outlook.com> 2021-01-17 22:22:47+01:00
logc6cb02c2265f181baaae4d57679baa8306431c11
tree54b3eb169ba2f694b7a94da9d274667f4739ee2e
parent3562edf13772bca66b4f04fc87be25b518393221
signaturelock-open Commit is signed but in an unrecognized format.

stage2 AArch64: fix stack offsets in genSetStack


1 files changed, 10 insertions(+), 9 deletions(-)

src/codegen.zig+10-9
......@@ -2693,9 +2693,9 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type {
26932693
26942694 switch (abi_size) {
26952695 1, 4 => {
2696 const offset = if (adj_off <= math.maxInt(u12)) blk: {
2697 break :blk Instruction.Offset.imm(@intCast(u12, adj_off));
2698 } else Instruction.Offset.reg(try self.copyToTmpRegister(src, MCValue{ .immediate = adj_off }), 0);
2696 const offset = if (math.cast(u12, adj_off)) |imm| blk: {
2697 break :blk Instruction.Offset.imm(imm);
2698 } else |_| Instruction.Offset.reg(try self.copyToTmpRegister(src, MCValue{ .immediate = adj_off }), 0);
26992699 const str = switch (abi_size) {
27002700 1 => Instruction.strb,
27012701 4 => Instruction.str,
......@@ -2856,12 +2856,13 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type {
28562856
28572857 switch (abi_size) {
28582858 4, 8 => {
2859 const offset = if (adj_off <= math.maxInt(u12)) blk: {
2860 break :blk Instruction.LoadStoreOffset.imm(@intCast(u12, adj_off));
2861 } else Instruction.LoadStoreOffset.reg(try self.copyToTmpRegister(src, MCValue{ .immediate = adj_off }));
2862 const rn: Register = switch (abi_size) {
2863 4 => .w29,
2864 8 => .x29,
2859 const offset = if (math.cast(i9, adj_off)) |imm|
2860 Instruction.LoadStoreOffset.imm_post_index(-imm)
2861 else |_|
2862 Instruction.LoadStoreOffset.reg(try self.copyToTmpRegister(src, MCValue{ .immediate = adj_off }));
2863 const rn: Register = switch (arch) {
2864 .aarch64, .aarch64_be => .x29,
2865 .aarch64_32 => .w29,
28652866 else => unreachable,
28662867 };
28672868