i386.c (output_fix_trunc): Add code to emulate non-popping DImode case.
authorJim Wilson <wilson@cygnus.com>
Tue, 5 May 1998 00:44:36 +0000 (00:44 +0000)
committerJeff Law <law@gcc.gnu.org>
Tue, 5 May 1998 00:44:36 +0000 (18:44 -0600)
        * i386.c (output_fix_trunc): Add code to emulate non-popping DImode
        case.

From-SVN: r19538

gcc/ChangeLog
gcc/config/i386/i386.c

index 0b36736c7c844ee750fd7e5a2d0fd30f3d19e5e3..cb23598d74c7dbdc2a3137e30bf2d8fed4c53b12 100644 (file)
@@ -1,3 +1,8 @@
+Tue May  5 01:43:16 1998  Jim Wilson  <wilson@cygnus.com>
+
+       * i386.c (output_fix_trunc): Add code to emulate non-popping DImode
+       case.
+
 Tue May  5 01:15:06 1998  Jeffrey A Law  (law@cygnus.com)
 
        * reorg.c (fill_slots_from_thread): Update REG_DEAD/REG_UNUSED notes
index 4a29f88739b2dabb805dac5332a4ad88732a5859..73ca40cc50118058bfbcb27b84da5b05ce375a0d 100644 (file)
@@ -3943,8 +3943,7 @@ output_fix_trunc (insn, operands)
   int stack_top_dies = find_regno_note (insn, REG_DEAD, FIRST_STACK_REG) != 0;
   rtx xops[2];
 
-  if (! STACK_TOP_P (operands[1])
-      || (GET_MODE (operands[0]) == DImode && ! stack_top_dies))
+  if (! STACK_TOP_P (operands[1]))
     abort ();
 
   xops[0] = GEN_INT (12);
@@ -3963,6 +3962,17 @@ output_fix_trunc (insn, operands)
     {
       if (stack_top_dies)
        output_asm_insn (AS1 (fistp%z0,%0), operands);
+      else if (GET_MODE (operands[0]) == DImode && ! stack_top_dies)
+       {
+         /* There is no DImode version of this without a stack pop, so
+            we must emulate it.  It doesn't matter much what the second
+            instruction is, because the value being pushed on the FP stack
+            is not used except for the following stack popping store.
+            This case can only happen without optimization, so it doesn't
+            matter that it is inefficient.  */
+         output_asm_insn (AS1 (fistp%z0,%0), operands);
+         output_asm_insn (AS1 (fild%z0,%0), operands);
+       }
       else
        output_asm_insn (AS1 (fist%z0,%0), operands);
     }