save two more FP registers on ia64
authorred5_2@hotmail.com <unknown>
Tue, 27 Mar 2007 04:18:11 +0000 (04:18 +0000)
committerred5_2@hotmail.com <unknown>
Tue, 27 Mar 2007 04:18:11 +0000 (04:18 +0000)
Save/restore two more registers in StgCRun().  The extra
registers are used by ffi009.hs, when compiling with gcc 4.1.2.

driver/mangler/ghc-asm.lprl
rts/StgCRun.c

index 4221b3d..7bde909 100644 (file)
@@ -942,13 +942,14 @@ sub mangle_asm {
                      }
 
                    # Remove floating-point spill instructions.
-                   # Only fp registers 2-5 and 16-21 are saved by the runtime.
-                   if ($p =~ s/^\tstf\.spill \[r1[4-9]\] = f([2-5]|1[6-9]|20|21)(, [0-9]+)?\n//g) {
+                   # Only fp registers 2-5 and 16-23 are saved by the runtime.
+                   if ($p =~ s/^\tstf\.spill \[r1[4-9]\] = f([2-5]|1[6-9]|2[0-3])(, [0-9]+)?\n//g) {
                        # Being paranoid, only try to remove these if we saw a
                        # spill operation.
                         $p =~ s/^\tmov r1[4-9] = r12\n//;
                         $p =~ s/^\tadds r1[4-9] = -[0-9]+, r12\n//g;
                         $p =~ s/^\t\.save\.f 0x[0-9a-fA-F]\n//g;
+                        $p =~ s/^\t\.save\.gf 0x0, 0x[0-9a-fA-F]+\n//g;
                    }
 
                    $p =~ s/^\tnop(?:\.[mifb])?\s+\d+\n//g; # remove nop instructions
@@ -1118,8 +1119,8 @@ sub mangle_asm {
                    $e =~ s/^\tmov r8 = r14\n//;
 
                    # Remove floating-point fill instructions.
-                   # Only fp registers 2-5 and 16-21 are saved by the runtime.
-                   if ($e =~ s/^\tldf\.fill f([2-5]|1[6-9]|20|21) = \[r1[4-9]\](, [0-9]+)?\n//g) {
+                   # Only fp registers 2-5 and 16-23 are saved by the runtime.
+                   if ($e =~ s/^\tldf\.fill f([2-5]|1[6-9]|2[0-3]) = \[r1[4-9]\](, [0-9]+)?\n//g) {
                        # Being paranoid, only try to remove this if we saw a fill
                        # operation.
                        $e =~ s/^\tadds r1[4-9] = [0-9]+, r12//g;
index 16158bd..ba27ff2 100644 (file)
@@ -854,7 +854,7 @@ StgRunIsImplementedInAssembler(void)
            loc32: saved ar.lc
            loc33: saved pr
        f2  -  f5: preserved floating-point registers
-       f16 - f21: preserved floating-point registers
+       f16 - f23: preserved floating-point registers
    -------------------------------------------------------------------------- */
 
 #ifdef ia64_HOST_ARCH
@@ -865,7 +865,7 @@ StgRunIsImplementedInAssembler(void)
 
 /* We don't spill all the callee-save FP registers, only the ones that
  * gcc has been observed to use */
-#define PRESERVED_FP_REGISTERS 10
+#define PRESERVED_FP_REGISTERS 12
 
 /* We always allocate 34 local and 8 output registers.  As long as gcc used
  * fewer than 32 locals, the mangler will adjust the stack frame accordingly. */
@@ -890,7 +890,9 @@ StgRunIsImplementedInAssembler(void)
                "\tstf.spill [r17] = f19,32\n"
                "\tmov loc30 = b0 ;;\n"                 /* save return address */
                "\tstf.spill [r16] = f20,32\n"
-               "\tstf.spill [r17] = f21,32\n"
+               "\tstf.spill [r17] = f21,32 ;;\n"
+               "\tstf.spill [r16] = f22,32\n"
+               "\tstf.spill [r17] = f23,32\n"
                 "\tmov loc32 = ar.lc ;;\n"             /* save loop counter */
                "\tstf.spill [r16] = f2,32\n"
                "\tstf.spill [r17] = f3,32\n"
@@ -912,9 +914,11 @@ StgRunIsImplementedInAssembler(void)
                "\tldf.fill f20 = [r16],32\n"
                "\tldf.fill f21 = [r17],32\n"
                 "\tmov ar.lc = loc32 ;;\n"     /* restore loop counter */
+               "\tldf.fill f22 = [r16],32\n"
+               "\tldf.fill f23 = [r17],32\n"
+               "\tmov pr = loc33 ;;\n"         /* restore predicate registers */
                "\tldf.fill f2 = [r16],32\n"
                "\tldf.fill f3 = [r17],32\n"
-               "\tmov pr = loc33\n"            /* restore predicate registers */
                "\tadds sp = %0, sp ;;\n"       /* restore stack */
                "\tldf.fill f4 = [r16],32\n"
                "\tldf.fill f5 = [r17],32\n"