Browse Source

* patch by Jeppe Johansen: fixes TCGMIPS.getfpuregister

git-svn-id: trunk@21419 -
florian 13 years ago
parent
commit
1b3dd8eefe
1 changed files with 14 additions and 4 deletions
  1. 14 4
      compiler/mips/cgcpu.pas

+ 14 - 4
compiler/mips/cgcpu.pas

@@ -544,7 +544,7 @@ end;
 function TCGMIPS.getfpuregister(list: tasmlist; size: Tcgsize): Tregister;
 begin
   if size = OS_F64 then
-    Result := rg[R_FPUREGISTER].getregister(list, R_SUBFS)
+    Result := rg[R_FPUREGISTER].getregister(list, R_SUBFD)
   else
     Result := rg[R_FPUREGISTER].getregister(list, R_SUBFS);
 end;
@@ -1484,9 +1484,19 @@ begin
              end;
          end;
 
-       list.concat(taicpu.op_reg(A_J, NR_R31));
-       { correct stack pointer in the delay slot }
-       list.concat(Taicpu.Op_reg_reg_const(A_ADDIU, NR_STACK_POINTER_REG, NR_STACK_POINTER_REG, stacksize));
+       if (-stacksize >= simm16lo) and (-stacksize <= simm16hi) then
+         begin
+           list.concat(taicpu.op_reg(A_J, NR_R31));
+           { correct stack pointer in the delay slot }
+           list.concat(Taicpu.Op_reg_reg_const(A_ADDIU, NR_STACK_POINTER_REG, NR_STACK_POINTER_REG, stacksize));
+         end
+       else
+         begin
+           a_load_const_reg(list,OS_32,stacksize,NR_R1);
+           list.concat(taicpu.op_reg(A_J, NR_R31));
+           { correct stack pointer in the delay slot }
+           list.concat(taicpu.op_reg_reg_reg(A_ADD,NR_STACK_POINTER_REG,NR_STACK_POINTER_REG,NR_R1));
+         end;
        list.concat(Taicpu.op_none(A_P_SET_MACRO));
        list.concat(Taicpu.op_none(A_P_SET_REORDER));
     end;