+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
/* 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,
[(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);
}")
(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));
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
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;
}
if (class == MODE_FLOAT)
- prepare_float_lib_cmp (px, py, comparison, pmode, punsignedp);
+ prepare_float_lib_cmp (px, py, pcomparison, pmode, punsignedp);
else
abort ();
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);
}
/* 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;
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;
}
}
*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
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