(*trunc*): Use scratch memory for output_fix_trunc.
authorStan Cox <coxs@gnu.org>
Thu, 31 Jul 1997 20:37:46 +0000 (20:37 +0000)
committerStan Cox <coxs@gnu.org>
Thu, 31 Jul 1997 20:37:46 +0000 (20:37 +0000)
From-SVN: r14569

gcc/config/i386/i386.md

index e3deee5..3b2a4eb 100644 (file)
@@ -1,4 +1,4 @@
-;; GCC machine description for Intel X86.
+; GCC machine description for Intel X86.
 ;; Copyright (C) 1988, 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
 ;; Mostly by William Schelter.
 
 
   if (STACK_TOP_P (operands[1]) && NON_STACK_REG_P (operands[0]))
     {
-      output_to_reg (operands[0], stack_top_dies);
+      output_to_reg (operands[0], stack_top_dies, 0);
       RET;
     }
 
 
   if (STACK_TOP_P (operands[1]) && NON_STACK_REG_P (operands[0]))
     {
-      output_to_reg (operands[0], stack_top_dies);
+      output_to_reg (operands[0], stack_top_dies, 0);
       RET;
     }
 
 
   if (STACK_TOP_P (operands[1]) && NON_STACK_REG_P (operands[0]))
     {
-      output_to_reg (operands[0], stack_top_dies);
+      output_to_reg (operands[0], stack_top_dies, 0);
       RET;
     }
 
 
   if (NON_STACK_REG_P (operands[0]))
     {
-      output_to_reg (operands[0], stack_top_dies);
+      output_to_reg (operands[0], stack_top_dies, 0);
       RET;
     }
 
 
   if (NON_STACK_REG_P (operands[0]))
     {
-      output_to_reg (operands[0], stack_top_dies);
+      output_to_reg (operands[0], stack_top_dies, 0);
       RET;
     }
 
 
   if (NON_STACK_REG_P (operands[0]))
     {
-      output_to_reg (operands[0], stack_top_dies);
+      output_to_reg (operands[0], stack_top_dies, 0);
       RET;
     }
 
          output_asm_insn (AS1 (fld,%y1), operands);
          stack_top_dies = 1;
        }
-      output_to_reg (operands[0], stack_top_dies);
+      output_to_reg (operands[0], stack_top_dies, 0);
       RET;
     }
   else if (GET_CODE (operands[0]) == MEM)
          output_asm_insn (AS1 (fld,%y1), operands);
          stack_top_dies = 1;
        }
-      output_to_reg (operands[0], stack_top_dies);
+      output_to_reg (operands[0], stack_top_dies, 0);
       RET;
     }
   else if (GET_CODE (operands[0]) == MEM)
   operands[3] = gen_lowpart (SImode, operands[2]);
   operands[4] = gen_reg_rtx (XFmode);
   operands[5] = (rtx) assign_386_stack_local (SImode, 0);
-  operands[6] = (rtx) assign_386_stack_local (SImode, 1);
+  operands[6] = (rtx) assign_386_stack_local (DImode, 1);
 }")
 
 (define_expand "fixuns_truncdfsi2"
   operands[3] = gen_lowpart (SImode, operands[2]);
   operands[4] = gen_reg_rtx (DFmode);
   operands[5] = (rtx) assign_386_stack_local (SImode, 0);
-  operands[6] = (rtx) assign_386_stack_local (SImode, 1);
+  operands[6] = (rtx) assign_386_stack_local (DImode, 1);
 }")
 
 (define_expand "fixuns_truncsfsi2"
   operands[3] = gen_lowpart (SImode, operands[2]);
   operands[4] = gen_reg_rtx (SFmode);
   operands[5] = (rtx) assign_386_stack_local (SImode, 0);
-  operands[6] = (rtx) assign_386_stack_local (SImode, 1);
+  operands[6] = (rtx) assign_386_stack_local (DImode, 1);
 }")
 
 ;; Signed conversion to DImode.
   operands[1] = copy_to_mode_reg (XFmode, operands[1]);
   operands[2] = gen_reg_rtx (XFmode);
   operands[3] = (rtx) assign_386_stack_local (SImode, 0);
-  operands[4] = (rtx) assign_386_stack_local (SImode, 1);
+  operands[4] = (rtx) assign_386_stack_local (DImode, 1);
 }")
 
 (define_expand "fix_truncdfdi2"
   operands[1] = copy_to_mode_reg (DFmode, operands[1]);
   operands[2] = gen_reg_rtx (DFmode);
   operands[3] = (rtx) assign_386_stack_local (SImode, 0);
-  operands[4] = (rtx) assign_386_stack_local (SImode, 1);
+  operands[4] = (rtx) assign_386_stack_local (DImode, 1);
 }")
 
 (define_expand "fix_truncsfdi2"
   operands[1] = copy_to_mode_reg (SFmode, operands[1]);
   operands[2] = gen_reg_rtx (SFmode);
   operands[3] = (rtx) assign_386_stack_local (SImode, 0);
-  operands[4] = (rtx) assign_386_stack_local (SImode, 1);
+  operands[4] = (rtx) assign_386_stack_local (DImode, 1);
 }")
 
 ;; These match a signed conversion of either DFmode or SFmode to DImode.
        (fix:DI (fix:XF (match_operand:XF 1 "register_operand" "f"))))
    (clobber (match_dup 1))
    (clobber (match_operand:SI 2 "memory_operand" "m"))
-   (clobber (match_operand:SI 3 "memory_operand" "m"))
+   (clobber (match_operand:DI 3 "memory_operand" "m"))
    (clobber (match_scratch:SI 4 "=&q"))]
   "TARGET_80387"
   "* return output_fix_trunc (insn, operands);")
        (fix:DI (fix:DF (match_operand:DF 1 "register_operand" "f"))))
    (clobber (match_dup 1))
    (clobber (match_operand:SI 2 "memory_operand" "m"))
-   (clobber (match_operand:SI 3 "memory_operand" "m"))
+   (clobber (match_operand:DI 3 "memory_operand" "m"))
    (clobber (match_scratch:SI 4 "=&q"))]
   "TARGET_80387"
   "* return output_fix_trunc (insn, operands);")
        (fix:DI (fix:SF (match_operand:SF 1 "register_operand" "f"))))
    (clobber (match_dup 1))
    (clobber (match_operand:SI 2 "memory_operand" "m"))
-   (clobber (match_operand:SI 3 "memory_operand" "m"))
+   (clobber (match_operand:DI 3 "memory_operand" "m"))
    (clobber (match_scratch:SI 4 "=&q"))]
   "TARGET_80387"
   "* return output_fix_trunc (insn, operands);")
   "
 {
   operands[2] = (rtx) assign_386_stack_local (SImode, 0);
-  operands[3] = (rtx) assign_386_stack_local (SImode, 1);
+  operands[3] = (rtx) assign_386_stack_local (DImode, 1);
 }")
 
 (define_expand "fix_truncdfsi2"
   "
 {
   operands[2] = (rtx) assign_386_stack_local (SImode, 0);
-  operands[3] = (rtx) assign_386_stack_local (SImode, 1);
+  operands[3] = (rtx) assign_386_stack_local (DImode, 1);
 }")
 
 (define_expand "fix_truncsfsi2"
   "
 {
   operands[2] = (rtx) assign_386_stack_local (SImode, 0);
-  operands[3] = (rtx) assign_386_stack_local (SImode, 1);
+  operands[3] = (rtx) assign_386_stack_local (DImode, 1);
 }")
 
 (define_insn ""
   [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
        (fix:SI (fix:XF (match_operand:XF 1 "register_operand" "f"))))
    (clobber (match_operand:SI 2 "memory_operand" "m"))
-   (clobber (match_operand:SI 3 "memory_operand" "m"))
+   (clobber (match_operand:DI 3 "memory_operand" "m"))
    (clobber (match_scratch:SI 4 "=&q"))]
   "TARGET_80387"
   "* return output_fix_trunc (insn, operands);")
   [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
        (fix:SI (fix:DF (match_operand:DF 1 "register_operand" "f"))))
    (clobber (match_operand:SI 2 "memory_operand" "m"))
-   (clobber (match_operand:SI 3 "memory_operand" "m"))
+   (clobber (match_operand:DI 3 "memory_operand" "m"))
    (clobber (match_scratch:SI 4 "=&q"))]
   "TARGET_80387"
   "* return output_fix_trunc (insn, operands);")
   [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
        (fix:SI (fix:SF (match_operand:SF 1 "register_operand" "f"))))
    (clobber (match_operand:SI 2 "memory_operand" "m"))
-   (clobber (match_operand:SI 3 "memory_operand" "m"))
+   (clobber (match_operand:DI 3 "memory_operand" "m"))
    (clobber (match_scratch:SI 4 "=&q"))]
   "TARGET_80387"
   "* return output_fix_trunc (insn, operands);")
@@ -7270,7 +7270,13 @@ byte_xor_operation:
   else if (which_alternative == 3)
     {
       /* r <- cond ? arg1 : arg2 */
-    operands[5] = gen_label_rtx ();
+    rtx xops[3];
+
+    xops[0] = gen_label_rtx ();
+    xops[1] = gen_label_rtx ();
+    xops[2] = operands[1];
+
+    output_asm_insn (\"j%c2 %l0\", xops);
     if (! rtx_equal_p (operands[0], operands[2]))
        if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[2]) == MEM)
          {
@@ -7279,9 +7285,10 @@ byte_xor_operation:
          }
        else
       output_asm_insn (AS2 (mov%z0,%2,%0), operands);
+    output_asm_insn (\"jmp %l1\", xops);
+    ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\", CODE_LABEL_NUMBER (xops[0]));
     if (! rtx_equal_p (operands[0], operands[3]))
       {
-        output_asm_insn (\"j%C1 %l5\", operands);
         if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[3]) == MEM)
           {
             output_asm_insn (AS2 (mov%z2,%3,%4), operands);
@@ -7289,8 +7296,8 @@ byte_xor_operation:
           }
         else
       output_asm_insn (AS2 (mov%z0,%3,%0), operands);
-        ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\", CODE_LABEL_NUMBER (operands[5]));
       }
+    ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\", CODE_LABEL_NUMBER (xops[1]));
     }  
   RET;
 }")
@@ -7324,7 +7331,13 @@ byte_xor_operation:
   else if (which_alternative == 3)
     {
       /* r <- cond ? arg1 : arg2 */
-    operands[5] = gen_label_rtx ();
+    rtx xops[3];
+
+    xops[0] = gen_label_rtx ();
+    xops[1] = gen_label_rtx ();
+    xops[2] = operands[1];
+
+    output_asm_insn (\"j%c2 %l0\", xops);
     if (! rtx_equal_p (operands[0], operands[2]))
        if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[2]) == MEM)
          {
@@ -7333,9 +7346,10 @@ byte_xor_operation:
          }
        else
       output_asm_insn (AS2 (mov%z0,%2,%0), operands);
+    output_asm_insn (\"jmp %l1\", xops);
+    ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\", CODE_LABEL_NUMBER (xops[0]));
     if (! rtx_equal_p (operands[0], operands[3]))
       {
-        output_asm_insn (\"j%C1 %l5\", operands);
         if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[3]) == MEM)
           {
             output_asm_insn (AS2 (mov%z2,%3,%4), operands);
@@ -7343,8 +7357,8 @@ byte_xor_operation:
           }
         else
       output_asm_insn (AS2 (mov%z0,%3,%0), operands);
-        ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\", CODE_LABEL_NUMBER (operands[5]));
       }
+    ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\", CODE_LABEL_NUMBER (xops[1]));
     }  
   RET;
 }")
@@ -7358,6 +7372,16 @@ byte_xor_operation:
   "TARGET_CMOVE"
   "
 {
+  int i;
+  
+  for (i = 2; i <= 3; i++)
+   {
+     if ((reload_in_progress | reload_completed) == 0
+       && CONSTANT_P (operands[i]))
+       {
+         operands[i] = force_const_mem (SFmode, operands[i]);
+       }
+     }
   operands[4] = i386_compare_gen (i386_compare_op0, i386_compare_op1);
 }")
 
@@ -7370,6 +7394,16 @@ byte_xor_operation:
   "TARGET_CMOVE"
   "
 {
+  int i;
+  
+  for (i = 2; i <= 3; i++)
+   {
+     if ((reload_in_progress | reload_completed) == 0
+       && CONSTANT_P (operands[i]))
+       {
+         operands[i] = force_const_mem (DFmode, operands[i]);
+       }
+     }
   operands[4] = i386_compare_gen (i386_compare_op0, i386_compare_op1);
 }")
 
@@ -7382,11 +7416,21 @@ byte_xor_operation:
   "TARGET_CMOVE"
   "
 {
+  int i;
+  
+  for (i = 2; i <= 3; i++)
+   {
+     if ((reload_in_progress | reload_completed) == 0
+       && CONSTANT_P (operands[i]))
+       {
+         operands[i] = force_const_mem (XFmode, operands[i]);
+       }
+     }
   operands[4] = i386_compare_gen (i386_compare_op0, i386_compare_op1);
 }")
 
 (define_insn "movsfcc_1"
-  [(set (match_operand:SF 0 "general_operand" "=t,=t,f,fFm")
+  [(set (match_operand:SF 0 "general_operand" "=f,=f,=f,=f")
        (if_then_else:SF (match_operator 1 "comparison_operator" 
                                [(cc0) (const_int 0)])
                      (match_operand:SF 2 "general_operand" "0,f,f,fFm")
@@ -7412,35 +7456,37 @@ byte_xor_operation:
     }
   else if (which_alternative == 3)
     {
-      rtx xops[2];
-
       /* r <- cond ? arg1 : arg2 */
-      operands[4] = gen_label_rtx ();
+      rtx xops[3];
+
+      xops[0] = gen_label_rtx ();
+      xops[1] = gen_label_rtx ();
+      xops[2] = operands[1];
 
+      output_asm_insn (\"j%f2 %l0\", xops);
       if (STACK_REG_P (operands[2]) || GET_CODE (operands[2]) == MEM)
        output_asm_insn (AS1 (fld%z2,%y2), operands);
       else
         {
-          xops[0] = operands[0];
-          xops[1] = operands[2];
-         output_asm_insn (singlemove_string (xops), xops);
+         operands[2] = XEXP (operands[2], 0);
+         output_asm_insn (AS1 (fld%z2,%y2), operands);
         }
-      output_asm_insn (\"j%C1 %l4\", operands);
+      output_asm_insn (\"jmp %l1\", xops);
+      ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\", CODE_LABEL_NUMBER (xops[0]));
       if (STACK_REG_P (operands[3]) || GET_CODE (operands[0]) == MEM)
          output_asm_insn (AS1 (fld%z3,%y3), operands);
       else
        {
-          xops[0] = operands[0];
-         xops[1] = operands[3];
-         output_asm_insn (singlemove_string (xops), xops);
+         operands[3] = XEXP (operands[3], 0);
+         output_asm_insn (AS1 (fld%z3,%y3), operands);
        }
-      ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\", CODE_LABEL_NUMBER (operands[4]));
+      ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\", CODE_LABEL_NUMBER (xops[1]));
 }
   RET;
 }")
 
 (define_insn "movdfcc_1"
-  [(set (match_operand:DF 0 "general_operand" "=t,=t,f,fFm")
+  [(set (match_operand:DF 0 "general_operand" "=f,=f,=f,=f")
        (if_then_else:DF (match_operator 1 "comparison_operator" 
                                [(cc0) (const_int 0)])
                      (match_operand:DF 2 "general_operand" "0,f,f,fFm")
@@ -7466,35 +7512,37 @@ byte_xor_operation:
     }
   else if (which_alternative == 3)
     {
-      rtx xops[2];
-
       /* r <- cond ? arg1 : arg2 */
-      operands[4] = gen_label_rtx ();
+      rtx xops[3];
+
+      xops[0] = gen_label_rtx ();
+      xops[1] = gen_label_rtx ();
+      xops[2] = operands[1];
 
+      output_asm_insn (\"j%f2 %l0\", xops);
       if (STACK_REG_P (operands[2]) || GET_CODE (operands[2]) == MEM)
        output_asm_insn (AS1 (fld%z2,%y2), operands);
       else
         {
-          xops[0] = operands[0];
-          xops[1] = operands[2];
-         output_asm_insn (singlemove_string (xops), xops);
+         operands[2] = XEXP (operands[2], 0);
+         output_asm_insn (AS1 (fld%z2,%y2), operands);
         }
-      output_asm_insn (\"j%C1 %l4\", operands);
+      output_asm_insn (\"jmp %l1\", xops);
+      ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\", CODE_LABEL_NUMBER (xops[0]));
       if (STACK_REG_P (operands[3]) || GET_CODE (operands[0]) == MEM)
          output_asm_insn (AS1 (fld%z3,%y3), operands);
       else
        {
-          xops[0] = operands[0];
-         xops[1] = operands[3];
-         output_asm_insn (singlemove_string (xops), xops);
+         operands[3] = XEXP (operands[3], 0);
+         output_asm_insn (AS1 (fld%z3,%y3), operands);
        }
-      ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\", CODE_LABEL_NUMBER (operands[4]));
+      ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\", CODE_LABEL_NUMBER (xops[1]));
 }
   RET;
 }")
 
 (define_insn "movxfcc_1"
-  [(set (match_operand:XF 0 "register_operand" "=t,=t,f,fFm")
+  [(set (match_operand:XF 0 "register_operand" "=f,=f,=f,=f")
        (if_then_else:XF (match_operator 1 "comparison_operator" 
                                [(cc0) (const_int 0)])
                      (match_operand:XF 2 "register_operand" "0,f,f,fFm")
@@ -7520,29 +7568,31 @@ byte_xor_operation:
     }
   else if (which_alternative == 3)
     {
-      rtx xops[2];
-
       /* r <- cond ? arg1 : arg2 */
-      operands[4] = gen_label_rtx ();
+      rtx xops[3];
 
+      xops[0] = gen_label_rtx ();
+      xops[1] = gen_label_rtx ();
+      xops[2] = operands[1];
+
+      output_asm_insn (\"j%f2 %l0\", xops);
       if (STACK_REG_P (operands[2]) || GET_CODE (operands[2]) == MEM)
        output_asm_insn (AS1 (fld%z2,%y2), operands);
       else
         {
-          xops[0] = operands[0];
-          xops[1] = operands[2];
-         output_asm_insn (singlemove_string (xops), xops);
+         operands[2] = XEXP (operands[2], 0);
+         output_asm_insn (AS1 (fld%z2,%y2), operands);
         }
-      output_asm_insn (\"j%C1 %l4\", operands);
+      output_asm_insn (\"jmp %l1\", xops);
+      ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\", CODE_LABEL_NUMBER (xops[0]));
       if (STACK_REG_P (operands[3]) || GET_CODE (operands[0]) == MEM)
          output_asm_insn (AS1 (fld%z3,%y3), operands);
       else
        {
-          xops[0] = operands[0];
-         xops[1] = operands[3];
-         output_asm_insn (singlemove_string (xops), xops);
+         operands[3] = XEXP (operands[3], 0);
+         output_asm_insn (AS1 (fld%z3,%y3), operands);
        }
-      ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\", CODE_LABEL_NUMBER (operands[4]));
+      ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\", CODE_LABEL_NUMBER (xops[1]));
 }
   RET;
 }")