Fix a_load64_reg_ref and a_load64_ref_reg mips methods

This commit is contained in:
Pierre Muller 2022-11-07 22:24:34 +00:00
parent c96bb0f416
commit d18ff64ed7

View File

@ -1761,36 +1761,17 @@ var
tmpreg: tregister; tmpreg: tregister;
incr: shortint; incr: shortint;
begin begin
if target_info.endian = endian_big then
begin
tmpreg := reg.reglo;
reg.reglo := reg.reghi;
reg.reghi := tmpreg;
end;
tmpref := ref; tmpref := ref;
tcgmips(cg).make_simple_ref(list,tmpref); tcgmips(cg).make_simple_ref(list,tmpref);
if (ref.alignment <4) then if (ref.alignment <4) then
begin begin
if target_info.endian = endian_big then if target_info.endian = endian_little then
begin begin
inc(tmpref.offset,3); inc(tmpref.offset,7);
incr:=-1; incr:=-1;
end end
else else
incr:=1; 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)); list.concat(taicpu.op_reg_ref(A_SB,reg.reghi,tmpref));
Inc(tmpref.offset,incr); Inc(tmpref.offset,incr);
list.concat(taicpu.op_reg_reg_const(A_SRL,reg.reghi,reg.reghi,8)); list.concat(taicpu.op_reg_reg_const(A_SRL,reg.reghi,reg.reghi,8));
@ -1802,9 +1783,26 @@ begin
list.concat(taicpu.op_reg_reg_const(A_SRL,reg.reghi,reg.reghi,8)); 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)); list.concat(taicpu.op_reg_ref(A_SB,reg.reghi,tmpref));
Inc(tmpref.offset,incr); 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 end
else else
begin begin
if target_info.endian = endian_big then
begin
tmpreg := reg.reglo;
reg.reglo := reg.reghi;
reg.reghi := tmpreg;
end;
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));
@ -1818,50 +1816,55 @@ var
tmpreg: tregister; tmpreg: tregister;
incr: shortint; incr: shortint;
begin begin
if target_info.endian = endian_big then
begin
tmpreg := reg.reglo;
reg.reglo := reg.reghi;
reg.reghi := tmpreg;
end;
tmpref := ref; tmpref := ref;
tcgmips(cg).make_simple_ref(list,tmpref); tcgmips(cg).make_simple_ref(list,tmpref);
if (ref.alignment <4) then if (ref.alignment <4) then
begin begin
if target_info.endian = endian_big then tmpreg:=cg.getintregister(list,OS_INT);
if target_info.endian = endian_little then
begin begin
inc(tmpref.offset,3); inc(tmpref.offset,7);
incr:=-1; incr:=-1;
end end
else else
incr:=1; 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)); list.concat(taicpu.op_reg_ref(A_LBU,reg.reghi,tmpref));
Inc(tmpref.offset,incr); Inc(tmpref.offset,incr);
list.concat(taicpu.op_reg_reg_const(A_SLL,reg.reghi,reg.reghi,8)); 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)); 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); Inc(tmpref.offset,incr);
list.concat(taicpu.op_reg_reg_const(A_SLL,reg.reghi,reg.reghi,8)); 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)); 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); Inc(tmpref.offset,incr);
list.concat(taicpu.op_reg_reg_const(A_SLL,reg.reghi,reg.reghi,8)); 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)); 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); Inc(tmpref.offset,incr);
end end
else else
begin begin
if target_info.endian = endian_big then
begin
tmpreg := reg.reglo;
reg.reglo := reg.reghi;
reg.reghi := tmpreg;
end;
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));