(sgt,sgtu,sge,sle,bgt,blt,bge,ble): Use CC_FCOM
authorStan Cox <coxs@gnu.org>
Wed, 6 Nov 1996 14:43:13 +0000 (14:43 +0000)
committerStan Cox <coxs@gnu.org>
Wed, 6 Nov 1996 14:43:13 +0000 (14:43 +0000)
From-SVN: r13103

gcc/config/i386/i386.md

index 33c307040cd181a1ce8669c72356ea8a32bcc42c..757e2cd7966d873cb14dd51fb8f0d5232d611997 100644 (file)
   ""
   "*
 {
-  if (TARGET_IEEE_FP && (cc_prev_status.flags & CC_IN_80387) && !TARGET_CMOVE)
+  if (TARGET_IEEE_FP && (cc_prev_status.flags & CC_IN_80387)
+      && ! (cc_prev_status.flags & CC_FCOMI))
     return AS1 (sete,%0);
 
   OUTPUT_JUMP (\"setg %0\", \"seta %0\", NULL_PTR);
   ""
   "*
 {
-  if (TARGET_IEEE_FP && (cc_prev_status.flags & CC_IN_80387) && !TARGET_CMOVE)
+  if (TARGET_IEEE_FP && (cc_prev_status.flags & CC_IN_80387)
+      && ! (cc_prev_status.flags & CC_FCOMI))
     return AS1 (sete,%0);
 
   OUTPUT_JUMP (\"setl %0\", \"setb %0\", \"sets %0\");
   ""
   "*
 {
-  if (TARGET_IEEE_FP && (cc_prev_status.flags & CC_IN_80387) && !TARGET_CMOVE)
+  if (TARGET_IEEE_FP && (cc_prev_status.flags & CC_IN_80387)
+      && ! (cc_prev_status.flags & CC_FCOMI))
     return AS1 (sete,%0);
 
   OUTPUT_JUMP (\"setge %0\", \"setae %0\", \"setns %0\");
   ""
   "*
 {
-  if (TARGET_IEEE_FP && (cc_prev_status.flags & CC_IN_80387) && !TARGET_CMOVE)
+  if (TARGET_IEEE_FP && (cc_prev_status.flags & CC_IN_80387)
+      && ! (cc_prev_status.flags & CC_FCOMI))
     return AS1 (setb,%0);
 
   OUTPUT_JUMP (\"setle %0\", \"setbe %0\", NULL_PTR);
   ""
   "*
 {
-  if (TARGET_IEEE_FP && (cc_prev_status.flags & CC_IN_80387) && !TARGET_CMOVE)
+  if (TARGET_IEEE_FP && (cc_prev_status.flags & CC_IN_80387)
+      && ! (cc_prev_status.flags & CC_FCOMI))
     return AS1 (je,%l0);
 
   if (cc_prev_status.flags & CC_TEST_AX)
   ""
   "*
 {
-  if (TARGET_IEEE_FP && (cc_prev_status.flags & CC_IN_80387) && !TARGET_CMOVE)
+  if (TARGET_IEEE_FP && (cc_prev_status.flags & CC_IN_80387)
+      && ! (cc_prev_status.flags & CC_FCOMI))
     return AS1 (je,%l0);
 
   if (cc_prev_status.flags & CC_TEST_AX)
   ""
   "*
 {
-  if (TARGET_IEEE_FP && (cc_prev_status.flags & CC_IN_80387) && !TARGET_CMOVE)
+  if (TARGET_IEEE_FP && (cc_prev_status.flags & CC_IN_80387)
+      && ! (cc_prev_status.flags & CC_FCOMI))
     return AS1 (je,%l0);
   if (cc_prev_status.flags & CC_TEST_AX)
     {
   ""
   "*
 {
-  if (TARGET_IEEE_FP && (cc_prev_status.flags & CC_IN_80387) && !TARGET_CMOVE)
+  if (TARGET_IEEE_FP && (cc_prev_status.flags & CC_IN_80387)
+      && ! (cc_prev_status.flags & CC_FCOMI))
     return AS1 (jb,%l0);
   if (cc_prev_status.flags & CC_TEST_AX)
     {
   ""
   "*
 {
-  if (TARGET_IEEE_FP && (cc_prev_status.flags & CC_IN_80387) && !TARGET_CMOVE)
+  if (TARGET_IEEE_FP && (cc_prev_status.flags & CC_IN_80387)
+      && ! (cc_prev_status.flags & CC_FCOMI))
     return AS1 (jne,%l0);
   if (cc_prev_status.flags & CC_TEST_AX)
     {
   ""
   "*
 {
-  if (TARGET_IEEE_FP && (cc_prev_status.flags & CC_IN_80387) && !TARGET_CMOVE)
+  if (TARGET_IEEE_FP && (cc_prev_status.flags & CC_IN_80387)
+      && ! (cc_prev_status.flags & CC_FCOMI))
     return AS1 (jne,%l0);
   if (cc_prev_status.flags & CC_TEST_AX)
     {
   ""
   "*
 {
-  if (TARGET_IEEE_FP && (cc_prev_status.flags & CC_IN_80387) && !TARGET_CMOVE)
+  if (TARGET_IEEE_FP && (cc_prev_status.flags & CC_IN_80387)
+      && ! (cc_prev_status.flags & CC_FCOMI))
     return AS1 (jne,%l0);
   if (cc_prev_status.flags & CC_TEST_AX)
     {
   ""
   "*
 {
-  if (TARGET_IEEE_FP && (cc_prev_status.flags & CC_IN_80387) && !TARGET_CMOVE)
+  if (TARGET_IEEE_FP && (cc_prev_status.flags & CC_IN_80387)
+      && ! (cc_prev_status.flags & CC_FCOMI))
     return AS1 (jae,%l0);
 
   if (cc_prev_status.flags & CC_TEST_AX)
   "TARGET_CMOVE"
   "*
 {
-  if (cc_prev_status.flags & CC_IN_80387)
-    abort ();
-
   if (which_alternative == 0)
     {
       /* r <- cond ? arg : r */
     if (! rtx_equal_p (operands[0], operands[2]))
        if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[2]) == MEM)
          {
-           output_asm_insn (AS2 (mov%L2,%2,%4), operands);
-           output_asm_insn (AS2 (mov%L2,%4,%0), operands);
+           output_asm_insn (AS2 (mov%z2,%2,%4), operands);
+           output_asm_insn (AS2 (mov%z2,%4,%0), operands);
          }
        else
-      output_asm_insn (AS2 (mov%L0,%2,%0), operands);
+      output_asm_insn (AS2 (mov%z0,%2,%0), operands);
     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%L2,%3,%4), operands);
-            output_asm_insn (AS2 (mov%L2,%4,%0), operands);
+            output_asm_insn (AS2 (mov%z2,%3,%4), operands);
+            output_asm_insn (AS2 (mov%z2,%4,%0), operands);
           }
         else
-      output_asm_insn (AS2 (mov%L0,%3,%0), operands);
+      output_asm_insn (AS2 (mov%z0,%3,%0), operands);
         ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\", CODE_LABEL_NUMBER (operands[5]));
       }
     }  
   "TARGET_CMOVE"
   "*
 {
-  if (cc_prev_status.flags & CC_IN_80387)
-    abort ();
-
   if (which_alternative == 0)
     {
       /* r <- cond ? arg : r */
     if (! rtx_equal_p (operands[0], operands[2]))
        if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[2]) == MEM)
          {
-           output_asm_insn (AS2 (mov%L2,%2,%4), operands);
-           output_asm_insn (AS2 (mov%L2,%4,%0), operands);
+           output_asm_insn (AS2 (mov%z2,%2,%4), operands);
+           output_asm_insn (AS2 (mov%z2,%4,%0), operands);
          }
        else
-      output_asm_insn (AS2 (mov%L0,%2,%0), operands);
+      output_asm_insn (AS2 (mov%z0,%2,%0), operands);
     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%L2,%3,%4), operands);
-            output_asm_insn (AS2 (mov%L2,%4,%0), operands);
+            output_asm_insn (AS2 (mov%z2,%3,%4), operands);
+            output_asm_insn (AS2 (mov%z2,%4,%0), operands);
           }
         else
-      output_asm_insn (AS2 (mov%L0,%3,%0), operands);
+      output_asm_insn (AS2 (mov%z0,%3,%0), operands);
         ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\", CODE_LABEL_NUMBER (operands[5]));
       }
     }  
       operands[4] = gen_label_rtx ();
 
       if (STACK_REG_P (operands[2]) || GET_CODE (operands[2]) == MEM)
-       output_asm_insn (AS1 (fld,%y2), operands);
+       output_asm_insn (AS1 (fld%z2,%y2), operands);
       else
         {
           xops[0] = operands[0];
           xops[1] = operands[2];
-         /* SET_SRC (PATTERN (insn)) = XEXP (SET_SRC (PATTERN (insn)), 1);*/
-         output_asm_insn (output_move_const_single (xops), xops);
+         output_move_const_single (xops);
         }
       output_asm_insn (\"j%C1 %l4\", operands);
       if (STACK_REG_P (operands[3]) || GET_CODE (operands[0]) == MEM)
-         output_asm_insn (AS1 (fld,%y3), operands);
+         output_asm_insn (AS1 (fld%z3,%y3), operands);
       else
        {
          xops[1] = operands[3];
          SET_SRC (PATTERN (insn)) = XEXP (SET_SRC (PATTERN (insn)), 2);
-         output_asm_insn (output_move_const_single (xops), xops);
-         /* output_move_memory (xops, insn, GET_MODE_SIZE (DFmode), 2, 4);*/
-         /* output_asm_insn (AS1 (fld%z0,%y3), operands);*/
+         output_move_const_single (xops);
        }
       ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\", CODE_LABEL_NUMBER (operands[4]));
 }
 }")
 
 (define_insn "movdfcc_1"
-  [(set (match_operand:DF 0 "register_operand" "=t,t")
+  [(set (match_operand:DF 0 "general_operand" "=t,=t,f,fFm")
        (if_then_else:DF (match_operator 1 "comparison_operator" 
                                [(cc0) (const_int 0)])
-                     (match_operand:DF 2 "register_operand" "0,f")
-                     (match_operand:DF 3 "register_operand" "f,0")))]
+                     (match_operand:DF 2 "general_operand" "0,f,f,fFm")
+                     (match_operand:DF 3 "general_operand" "f,0,f,fFm")))]
   "TARGET_CMOVE"
   "*
 {
       /* r <- cond ? r : arg */
       output_asm_insn (AS2 (fcmov%F1,%2,%0), operands);
     }
+  else if (which_alternative == 2)
+    {
+      /* r <- cond ? r : arg */
+      output_asm_insn (AS2 (fcmov%F1,%2,%0), operands);
+      output_asm_insn (AS2 (fcmov%f1,%3,%0), operands);
+    }
+  else if (which_alternative == 3)
+    {
+      rtx xops[2];
+
+      /* r <- cond ? arg1 : arg2 */
+      operands[4] = gen_label_rtx ();
+
+      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_move_const_single (xops);
+        }
+      output_asm_insn (\"j%C1 %l4\", operands);
+      if (STACK_REG_P (operands[3]) || GET_CODE (operands[0]) == MEM)
+         output_asm_insn (AS1 (fld%z3,%y3), operands);
+      else
+       {
+         xops[1] = operands[3];
+         SET_SRC (PATTERN (insn)) = XEXP (SET_SRC (PATTERN (insn)), 2);
+         output_move_const_single (xops);
+       }
+      ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\", CODE_LABEL_NUMBER (operands[4]));
+}
   RET;
 }")