Fix sparc compilation failure
authorBernd Schmidt <bernds@cygnus.co.uk>
Mon, 23 Aug 1999 16:09:52 +0000 (16:09 +0000)
committerBernd Schmidt <crux@gcc.gnu.org>
Mon, 23 Aug 1999 16:09:52 +0000 (16:09 +0000)
From-SVN: r28807

gcc/ChangeLog
gcc/config/sparc/sparc.h
gcc/config/sparc/sparc.md
gcc/expr.h
gcc/optabs.c
gcc/tm.texi

index 93581f43c1528b006d6d4abd947efd3415fb17dd..7d0ed0b8b7e8c86db7ceb72c6552d9e1f7d60b08 100644 (file)
@@ -1,3 +1,16 @@
+Mon Aug 23 16:04:13 1999  Bernd Schmidt  <bernds@cygnus.co.uk>
+
+       * optabs.c (prepare_cmp_insn): Turn COMPARISON arg into a pointer.
+       All callers changed.
+       (prepare_float_lib_cmp): Likewise.
+       Use FLOAT_LIB_COMPARE_RETURNS_BOOL.
+       * expr.h (emit_float_lib_cmp): Delete declaration.
+       * tm.texi (FLOAT_LIB_COMPARE_RETURNS_BOOL): Document.
+       * sparc.h (FLOAT_LIB_COMPARE_RETURNS_BOOL): Define.
+       * sparc.md (bcc and scc patterns): Don't handle TFmode comparisons
+       specially.
+       (cmptf): Now conditional on TARGET_HARD_QUAD.
+
 Fri Aug 20 17:52:27 1999  Jim Wilson  <wilson@cygnus.com>
 
        * resource.c (mark_target_live_regs): Use
index 7fafc4dc4c69272e7e42224a7c8520bd13fb5be4..82e3727c8c5876cf485bfb4a82ee3130ab930da3 100644 (file)
@@ -2676,6 +2676,11 @@ do {                                                                    \
 /* This is meant to be redefined in the host dependent files */
 #define INIT_SUBTARGET_OPTABS
 
+/* Nonzero if a floating point comparison library call for
+   mode MODE that will return a boolean value.  Zero if one
+   of the libgcc2 functions is used.  */
+#define FLOAT_LIB_COMPARE_RETURNS_BOOL(MODE, COMPARISON) ((MODE) == TFmode)
+
 /* Compute the cost of computing a constant rtl expression RTX
    whose rtx-code is CODE.  The body of this macro is a portion
    of a switch statement.  If the code is computed here,
index e8390961dcab407d91617de69c2c12abc9702f0f..eff6b2939adc46ba897c1fdcef22bc6775837035 100644 (file)
   [(set (reg:CCFP 96)
        (compare:CCFP (match_operand:TF 0 "register_operand" "")
                      (match_operand:TF 1 "register_operand" "")))]
-  "TARGET_FPU"
+  "TARGET_FPU && TARGET_HARD_QUAD"
   "
 {
   sparc_compare_op0 = operands[0];
       emit_insn (pat);
       DONE;
     }
-  else if (GET_MODE (sparc_compare_op0) == TFmode && ! TARGET_HARD_QUAD)
-    {
-      emit_float_lib_cmp (sparc_compare_op0, sparc_compare_op1, EQ);
-      emit_insn (gen_sne (operands[0]));
-      DONE;
-    }      
   else if (TARGET_V9)
     {
       if (gen_v9_scc (EQ, operands))
       emit_insn (pat);
       DONE;
     }
-  else if (GET_MODE (sparc_compare_op0) == TFmode && ! TARGET_HARD_QUAD)
-    {
-      emit_float_lib_cmp (sparc_compare_op0, sparc_compare_op1, NE);
-      emit_insn (gen_sne (operands[0]));
-      DONE;
-    }      
   else if (TARGET_V9)
     {
       if (gen_v9_scc (NE, operands))
   "! TARGET_LIVE_G0"
   "
 {
-  if (GET_MODE (sparc_compare_op0) == TFmode && ! TARGET_HARD_QUAD)
-    {
-      emit_float_lib_cmp (sparc_compare_op0, sparc_compare_op1, GT);
-      emit_insn (gen_sne (operands[0]));
-      DONE;
-    }
-  else if (TARGET_V9)
+  if (TARGET_V9)
     {
       if (gen_v9_scc (GT, operands))
        DONE;
   "! TARGET_LIVE_G0"
   "
 {
-  if (GET_MODE (sparc_compare_op0) == TFmode && ! TARGET_HARD_QUAD)
-    {
-      emit_float_lib_cmp (sparc_compare_op0, sparc_compare_op1, LT);
-      emit_insn (gen_sne (operands[0]));
-      DONE;
-    }
-  else if (TARGET_V9)
+  if (TARGET_V9)
     {
       if (gen_v9_scc (LT, operands))
        DONE;
   "! TARGET_LIVE_G0"
   "
 {
-  if (GET_MODE (sparc_compare_op0) == TFmode && ! TARGET_HARD_QUAD)
-    {
-      emit_float_lib_cmp (sparc_compare_op0, sparc_compare_op1, GE);
-      emit_insn (gen_sne (operands[0]));
-      DONE;
-    }
-  else if (TARGET_V9)
+  if (TARGET_V9)
     {
       if (gen_v9_scc (GE, operands))
        DONE;
   "! TARGET_LIVE_G0"
   "
 {
-  if (GET_MODE (sparc_compare_op0) == TFmode && ! TARGET_HARD_QUAD)
-    {
-      emit_float_lib_cmp (sparc_compare_op0, sparc_compare_op1, LE);
-      emit_insn (gen_sne (operands[0]));
-      DONE;
-    }
-  else if (TARGET_V9)
+  if (TARGET_V9)
     {
       if (gen_v9_scc (LE, operands))
        DONE;
       emit_v9_brxx_insn (EQ, sparc_compare_op0, operands[0]);
       DONE;
     }
-  else if (GET_MODE (sparc_compare_op0) == TFmode && ! TARGET_HARD_QUAD)
-    {
-      emit_float_lib_cmp (sparc_compare_op0, sparc_compare_op1, EQ);
-      emit_jump_insn (gen_bne (operands[0]));
-      DONE;
-    }      
   operands[1] = gen_compare_reg (EQ, sparc_compare_op0, sparc_compare_op1);
 }")
 
       emit_v9_brxx_insn (NE, sparc_compare_op0, operands[0]);
       DONE;
     }
-  else if (GET_MODE (sparc_compare_op0) == TFmode && ! TARGET_HARD_QUAD)
-    {
-      emit_float_lib_cmp (sparc_compare_op0, sparc_compare_op1, NE);
-      emit_jump_insn (gen_bne (operands[0]));
-      DONE;
-    }      
   operands[1] = gen_compare_reg (NE, sparc_compare_op0, sparc_compare_op1);
 }")
 
       emit_v9_brxx_insn (GT, sparc_compare_op0, operands[0]);
       DONE;
     }
-  else if (GET_MODE (sparc_compare_op0) == TFmode && ! TARGET_HARD_QUAD)
-    {
-      emit_float_lib_cmp (sparc_compare_op0, sparc_compare_op1, GT);
-      emit_jump_insn (gen_bne (operands[0]));
-      DONE;
-    }      
   operands[1] = gen_compare_reg (GT, sparc_compare_op0, sparc_compare_op1);
 }")
 
       emit_v9_brxx_insn (LT, sparc_compare_op0, operands[0]);
       DONE;
     }
-  else if (GET_MODE (sparc_compare_op0) == TFmode && ! TARGET_HARD_QUAD)
-    {
-      emit_float_lib_cmp (sparc_compare_op0, sparc_compare_op1, LT);
-      emit_jump_insn (gen_bne (operands[0]));
-      DONE;
-    }      
   operands[1] = gen_compare_reg (LT, sparc_compare_op0, sparc_compare_op1);
 }")
 
       emit_v9_brxx_insn (GE, sparc_compare_op0, operands[0]);
       DONE;
     }
-  else if (GET_MODE (sparc_compare_op0) == TFmode && ! TARGET_HARD_QUAD)
-    {
-      emit_float_lib_cmp (sparc_compare_op0, sparc_compare_op1, GE);
-      emit_jump_insn (gen_bne (operands[0]));
-      DONE;
-    }      
   operands[1] = gen_compare_reg (GE, sparc_compare_op0, sparc_compare_op1);
 }")
 
       emit_v9_brxx_insn (LE, sparc_compare_op0, operands[0]);
       DONE;
     }
-  else if (GET_MODE (sparc_compare_op0) == TFmode && ! TARGET_HARD_QUAD)
-    {
-      emit_float_lib_cmp (sparc_compare_op0, sparc_compare_op1, LE);
-      emit_jump_insn (gen_bne (operands[0]));
-      DONE;
-    }      
   operands[1] = gen_compare_reg (LE, sparc_compare_op0, sparc_compare_op1);
 }")
 
index b3fbaeada939c919bb728152db0c550b0b92293c..54eb3274b041d4b3d7f24c29a6c16528d8811223 100644 (file)
@@ -567,10 +567,6 @@ extern void emit_cmp_and_jump_insns PROTO((rtx, rtx, enum rtx_code, rtx,
    (without splitting it into pieces).  */
 extern int can_compare_p PROTO((enum machine_mode));
 
-/* Emit a library call comparison between floating point X and Y.
-   COMPARISON is the rtl operator to compare with (EQ, NE, GT, etc.).  */
-extern void emit_float_lib_cmp PROTO((rtx, rtx, enum rtx_code));
-
 /* Generate code to indirectly jump to a location given in the rtx LOC.  */
 extern void emit_indirect_jump PROTO((rtx));
 
index 814a483fee49f5f378b27a3d904dc09313f39b08..dc742627a77e41639ac9315e1de6c26a03e5f2d4 100644 (file)
@@ -270,11 +270,11 @@ static void init_traps PROTO((void));
 static int cmp_available_p PROTO((enum machine_mode, enum rtx_code, int));
 static void emit_cmp_and_jump_insn_1 PROTO((rtx, rtx, enum machine_mode,
                                            enum rtx_code, int, rtx));
-static void prepare_cmp_insn PROTO((rtx *, rtx *, enum rtx_code, rtx,
+static void prepare_cmp_insn PROTO((rtx *, rtx *, enum rtx_code *, rtx,
                                    enum machine_mode *, int *, int));
 static rtx prepare_operand PROTO((int, rtx, int, enum machine_mode,
                                  enum machine_mode, int));
-static void prepare_float_lib_cmp PROTO((rtx *, rtx *, enum rtx_code,
+static void prepare_float_lib_cmp PROTO((rtx *, rtx *, enum rtx_code *,
                                         enum machine_mode *, int *));
 \f
 /* Add a REG_EQUAL note to the last insn in SEQ.  TARGET is being set to
@@ -3019,15 +3019,16 @@ cmp_available_p (mode, code, can_use_tst_p)
    The values which are passed in through pointers can be modified; the caller
    should perform the comparison on the modified values.  */
 
-void
-prepare_cmp_insn (px, py, comparison, size, pmode, punsignedp, align)
+static void
+prepare_cmp_insn (px, py, pcomparison, size, pmode, punsignedp, align)
      rtx *px, *py;
-     enum rtx_code comparison;
+     enum rtx_code *pcomparison;
      rtx size;
      enum machine_mode *pmode;
      int *punsignedp;
      int align;
 {
+  enum rtx_code comparison = *pcomparison;
   enum machine_mode mode = *pmode;
   rtx x = *px, y = *py;
   int unsignedp = *punsignedp;
@@ -3181,7 +3182,7 @@ prepare_cmp_insn (px, py, comparison, size, pmode, punsignedp, align)
     }
 
   if (class == MODE_FLOAT)
-    prepare_float_lib_cmp (px, py, comparison, pmode, punsignedp);
+    prepare_float_lib_cmp (px, py, pcomparison, pmode, punsignedp);
 
   else
     abort ();
@@ -3322,7 +3323,7 @@ emit_cmp_and_jump_insns (x, y, comparison, size, mode, unsignedp, align, label)
   emit_queue ();
   if (unsignedp)
     comparison = unsigned_condition (comparison);
-  prepare_cmp_insn (&op0, &op1, comparison, size, &mode, &unsignedp, align);
+  prepare_cmp_insn (&op0, &op1, &comparison, size, &mode, &unsignedp, align);
   emit_cmp_and_jump_insn_1 (op0, op1, mode, comparison, unsignedp, label);
 }
 
@@ -3360,13 +3361,14 @@ can_compare_p (mode)
 /* Emit a library call comparison between floating point X and Y.
    COMPARISON is the rtl operator to compare with (EQ, NE, GT, etc.).  */
 
-void
-prepare_float_lib_cmp (px, py, comparison, pmode, punsignedp)
+static void
+prepare_float_lib_cmp (px, py, pcomparison, pmode, punsignedp)
      rtx *px, *py;
-     enum rtx_code comparison;
+     enum rtx_code *pcomparison;
      enum machine_mode *pmode;
      int *punsignedp;
 {
+  enum rtx_code comparison = *pcomparison;
   rtx x = *px, y = *py;
   enum machine_mode mode = GET_MODE (x);
   rtx libfunc = 0;
@@ -3537,7 +3539,7 @@ prepare_float_lib_cmp (px, py, comparison, pmode, punsignedp)
              y = protect_from_queue (y, 0);
              *px = convert_to_mode (wider_mode, x, 0);
              *py = convert_to_mode (wider_mode, y, 0);
-             prepare_float_lib_cmp (px, py, comparison, pmode, punsignedp);
+             prepare_float_lib_cmp (px, py, pcomparison, pmode, punsignedp);
              return;
            }
        }
@@ -3558,6 +3560,10 @@ prepare_float_lib_cmp (px, py, comparison, pmode, punsignedp)
   *px = result;
   *py = const0_rtx;
   *pmode = word_mode;
+#ifdef FLOAT_LIB_COMPARE_RETURNS_BOOL
+  if (FLOAT_LIB_COMPARE_RETURNS_BOOL (mode, comparison))
+    *pcomparison = NE;
+#endif
   *punsignedp = 0;
 }
 \f
index 0704ff5925c622e22821bfb81038bd4e32b85f0a..70dc6d0d3180507c7d036190ccaacf46f2aaac6a 100644 (file)
@@ -4046,6 +4046,15 @@ Define this macro as a C statement that declares additional library
 routines renames existing ones. @code{init_optabs} calls this macro after
 initializing all the normal library routines.
 
+@findex FLOAT_LIB_COMPARE_RETURNS_BOOL (@var{mode}, @var{comparison})
+@item FLOAT_LIB_COMPARE_RETURNS_BOOL
+Define this macro as a C statement that returns nonzero if a call to
+the floating point comparison library function will return a boolean
+value that indicates the result of the comparison.  It should return
+zero if one of gcc's own libgcc functions is called.
+
+Most ports don't need to define this macro.
+
 @findex TARGET_EDOM
 @cindex @code{EDOM}, implicit usage
 @item TARGET_EDOM