Fix a_load64_reg_ref and a_load64_ref_reg mips methods

(cherry picked from commit d18ff64ed7)
This commit is contained in:
Pierre Muller 2022-11-07 22:24:34 +00:00
parent 2aa3270ca0
commit 2640e77307

View File

@ -1700,6 +1700,42 @@ var
tmpref: treference; tmpref: treference;
tmpreg: tregister; tmpreg: tregister;
incr: shortint; incr: shortint;
begin
tmpref := ref;
tcgmips(cg).make_simple_ref(list,tmpref);
if (ref.alignment <4) then
begin
if target_info.endian = endian_little then
begin
inc(tmpref.offset,7);
incr:=-1;
end
else
incr:=1;
list.concat(taicpu.op_reg_ref(A_SB,reg.reghi,tmpref));
Inc(tmpref.offset,incr);
list.concat(taicpu.op_reg_reg_const(A_SRL,reg.reghi,reg.reghi,8));
list.concat(taicpu.op_reg_ref(A_SB,reg.reghi,tmpref));
Inc(tmpref.offset,incr);
list.concat(taicpu.op_reg_reg_const(A_SRL,reg.reghi,reg.reghi,8));
list.concat(taicpu.op_reg_ref(A_SB,reg.reghi,tmpref));
Inc(tmpref.offset,incr);
list.concat(taicpu.op_reg_reg_const(A_SRL,reg.reghi,reg.reghi,8));
list.concat(taicpu.op_reg_ref(A_SB,reg.reghi,tmpref));
Inc(tmpref.offset,incr);
list.concat(taicpu.op_reg_ref(A_SB,reg.reglo,tmpref));
Inc(tmpref.offset,incr);
list.concat(taicpu.op_reg_reg_const(A_SRL,reg.reglo,reg.reglo,8));
list.concat(taicpu.op_reg_ref(A_SB,reg.reglo,tmpref));
Inc(tmpref.offset,incr);
list.concat(taicpu.op_reg_reg_const(A_SRL,reg.reglo,reg.reglo,8));
list.concat(taicpu.op_reg_ref(A_SB,reg.reglo,tmpref));
Inc(tmpref.offset,incr);
list.concat(taicpu.op_reg_reg_const(A_SRL,reg.reglo,reg.reglo,8));
list.concat(taicpu.op_reg_ref(A_SB,reg.reglo,tmpref));
Inc(tmpref.offset,incr);
end
else
begin begin
if target_info.endian = endian_big then if target_info.endian = endian_big then
begin begin
@ -1707,44 +1743,6 @@ begin
reg.reglo := reg.reghi; reg.reglo := reg.reghi;
reg.reghi := tmpreg; reg.reghi := tmpreg;
end; end;
tmpref := ref;
tcgmips(cg).make_simple_ref(list,tmpref);
if (ref.alignment <4) then
begin
if target_info.endian = endian_big then
begin
inc(tmpref.offset,3);
incr:=-1;
end
else
incr:=1;
list.concat(taicpu.op_reg_ref(A_SB,reg.reglo,tmpref));
Inc(tmpref.offset,incr);
list.concat(taicpu.op_reg_reg_const(A_SRL,reg.reglo,reg.reglo,8));
list.concat(taicpu.op_reg_ref(A_SB,reg.reglo,tmpref));
Inc(tmpref.offset,incr);
list.concat(taicpu.op_reg_reg_const(A_SRL,reg.reglo,reg.reglo,8));
list.concat(taicpu.op_reg_ref(A_SB,reg.reglo,tmpref));
Inc(tmpref.offset,incr);
list.concat(taicpu.op_reg_reg_const(A_SRL,reg.reglo,reg.reglo,8));
list.concat(taicpu.op_reg_ref(A_SB,reg.reglo,tmpref));
Inc(tmpref.offset,incr);
if target_info.endian = endian_big then
inc(tmpref.offset,7);
list.concat(taicpu.op_reg_ref(A_SB,reg.reghi,tmpref));
Inc(tmpref.offset,incr);
list.concat(taicpu.op_reg_reg_const(A_SRL,reg.reghi,reg.reghi,8));
list.concat(taicpu.op_reg_ref(A_SB,reg.reghi,tmpref));
Inc(tmpref.offset,incr);
list.concat(taicpu.op_reg_reg_const(A_SRL,reg.reghi,reg.reghi,8));
list.concat(taicpu.op_reg_ref(A_SB,reg.reghi,tmpref));
Inc(tmpref.offset,incr);
list.concat(taicpu.op_reg_reg_const(A_SRL,reg.reghi,reg.reghi,8));
list.concat(taicpu.op_reg_ref(A_SB,reg.reghi,tmpref));
Inc(tmpref.offset,incr);
end
else
begin
list.concat(taicpu.op_reg_ref(A_SW,reg.reglo,tmpref)); list.concat(taicpu.op_reg_ref(A_SW,reg.reglo,tmpref));
Inc(tmpref.offset, 4); Inc(tmpref.offset, 4);
list.concat(taicpu.op_reg_ref(A_SW,reg.reghi,tmpref)); list.concat(taicpu.op_reg_ref(A_SW,reg.reghi,tmpref));
@ -1757,6 +1755,49 @@ var
tmpref: treference; tmpref: treference;
tmpreg: tregister; tmpreg: tregister;
incr: shortint; incr: shortint;
begin
tmpref := ref;
tcgmips(cg).make_simple_ref(list,tmpref);
if (ref.alignment <4) then
begin
tmpreg:=cg.getintregister(list,OS_INT);
if target_info.endian = endian_little then
begin
inc(tmpref.offset,7);
incr:=-1;
end
else
incr:=1;
list.concat(taicpu.op_reg_ref(A_LBU,reg.reghi,tmpref));
Inc(tmpref.offset,incr);
list.concat(taicpu.op_reg_reg_const(A_SLL,reg.reghi,reg.reghi,8));
list.concat(taicpu.op_reg_ref(A_LBU,tmpreg,tmpref));
list.concat(taicpu.op_reg_reg_reg(A_ADDU,reg.reghi,reg.reghi,tmpreg));
Inc(tmpref.offset,incr);
list.concat(taicpu.op_reg_reg_const(A_SLL,reg.reghi,reg.reghi,8));
list.concat(taicpu.op_reg_ref(A_LBU,tmpreg,tmpref));
list.concat(taicpu.op_reg_reg_reg(A_ADDU,reg.reghi,reg.reghi,tmpreg));
Inc(tmpref.offset,incr);
list.concat(taicpu.op_reg_reg_const(A_SLL,reg.reghi,reg.reghi,8));
list.concat(taicpu.op_reg_ref(A_LBU,tmpreg,tmpref));
list.concat(taicpu.op_reg_reg_reg(A_ADDU,reg.reghi,reg.reghi,tmpreg));
Inc(tmpref.offset,incr);
list.concat(taicpu.op_reg_ref(A_LBU,reg.reglo,tmpref));
Inc(tmpref.offset,incr);
list.concat(taicpu.op_reg_reg_const(A_SLL,reg.reglo,reg.reglo,8));
list.concat(taicpu.op_reg_ref(A_LBU,tmpreg,tmpref));
list.concat(taicpu.op_reg_reg_reg(A_ADDU,reg.reglo,reg.reglo,tmpreg));
Inc(tmpref.offset,incr);
list.concat(taicpu.op_reg_reg_const(A_SLL,reg.reglo,reg.reglo,8));
list.concat(taicpu.op_reg_ref(A_LBU,tmpreg,tmpref));
list.concat(taicpu.op_reg_reg_reg(A_ADDU,reg.reglo,reg.reglo,tmpreg));
Inc(tmpref.offset,incr);
list.concat(taicpu.op_reg_reg_const(A_SLL,reg.reglo,reg.reglo,8));
list.concat(taicpu.op_reg_ref(A_LBU,tmpreg,tmpref));
list.concat(taicpu.op_reg_reg_reg(A_ADDU,reg.reglo,reg.reglo,tmpreg));
Inc(tmpref.offset,incr);
end
else
begin begin
if target_info.endian = endian_big then if target_info.endian = endian_big then
begin begin
@ -1764,44 +1805,6 @@ begin
reg.reglo := reg.reghi; reg.reglo := reg.reghi;
reg.reghi := tmpreg; reg.reghi := tmpreg;
end; end;
tmpref := ref;
tcgmips(cg).make_simple_ref(list,tmpref);
if (ref.alignment <4) then
begin
if target_info.endian = endian_big then
begin
inc(tmpref.offset,3);
incr:=-1;
end
else
incr:=1;
list.concat(taicpu.op_reg_ref(A_LBU,reg.reglo,tmpref));
Inc(tmpref.offset,incr);
list.concat(taicpu.op_reg_reg_const(A_SLL,reg.reglo,reg.reglo,8));
list.concat(taicpu.op_reg_ref(A_LBU,reg.reglo,tmpref));
Inc(tmpref.offset,incr);
list.concat(taicpu.op_reg_reg_const(A_SLL,reg.reglo,reg.reglo,8));
list.concat(taicpu.op_reg_ref(A_LBU,reg.reglo,tmpref));
Inc(tmpref.offset,incr);
list.concat(taicpu.op_reg_reg_const(A_SLL,reg.reglo,reg.reglo,8));
list.concat(taicpu.op_reg_ref(A_LBU,reg.reglo,tmpref));
Inc(tmpref.offset,incr);
if target_info.endian = endian_big then
inc(tmpref.offset,7);
list.concat(taicpu.op_reg_ref(A_LBU,reg.reghi,tmpref));
Inc(tmpref.offset,incr);
list.concat(taicpu.op_reg_reg_const(A_SLL,reg.reghi,reg.reghi,8));
list.concat(taicpu.op_reg_ref(A_LBU,reg.reghi,tmpref));
Inc(tmpref.offset,incr);
list.concat(taicpu.op_reg_reg_const(A_SLL,reg.reghi,reg.reghi,8));
list.concat(taicpu.op_reg_ref(A_LBU,reg.reghi,tmpref));
Inc(tmpref.offset,incr);
list.concat(taicpu.op_reg_reg_const(A_SLL,reg.reghi,reg.reghi,8));
list.concat(taicpu.op_reg_ref(A_LBU,reg.reghi,tmpref));
Inc(tmpref.offset,incr);
end
else
begin
list.concat(taicpu.op_reg_ref(A_LW,reg.reglo,tmpref)); list.concat(taicpu.op_reg_ref(A_LW,reg.reglo,tmpref));
Inc(tmpref.offset, 4); Inc(tmpref.offset, 4);
list.concat(taicpu.op_reg_ref(A_LW,reg.reghi,tmpref)); list.concat(taicpu.op_reg_ref(A_LW,reg.reghi,tmpref));