From c5c60e15bccccf2462a8b6593035399585ebd386 Mon Sep 17 00:00:00 2001 From: Bernd Schmidt Date: Mon, 23 Aug 1999 16:09:52 +0000 Subject: [PATCH] Fix sparc compilation failure From-SVN: r28807 --- gcc/ChangeLog | 13 +++++++ gcc/config/sparc/sparc.h | 5 +++ gcc/config/sparc/sparc.md | 82 +++------------------------------------ gcc/expr.h | 4 -- gcc/optabs.c | 28 +++++++------ gcc/tm.texi | 9 +++++ 6 files changed, 49 insertions(+), 92 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 93581f43c15..7d0ed0b8b7e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,16 @@ +Mon Aug 23 16:04:13 1999 Bernd Schmidt + + * 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 * resource.c (mark_target_live_regs): Use diff --git a/gcc/config/sparc/sparc.h b/gcc/config/sparc/sparc.h index 7fafc4dc4c6..82e3727c8c5 100644 --- a/gcc/config/sparc/sparc.h +++ b/gcc/config/sparc/sparc.h @@ -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, diff --git a/gcc/config/sparc/sparc.md b/gcc/config/sparc/sparc.md index e8390961dca..eff6b2939ad 100644 --- a/gcc/config/sparc/sparc.md +++ b/gcc/config/sparc/sparc.md @@ -606,7 +606,7 @@ [(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]; @@ -834,12 +834,6 @@ 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)) @@ -887,12 +881,6 @@ 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)) @@ -908,13 +896,7 @@ "! 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; @@ -929,13 +911,7 @@ "! 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; @@ -950,13 +926,7 @@ "! 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; @@ -971,13 +941,7 @@ "! 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; @@ -1605,12 +1569,6 @@ 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); }") @@ -1629,12 +1587,6 @@ 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); }") @@ -1653,12 +1605,6 @@ 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); }") @@ -1687,12 +1633,6 @@ 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); }") @@ -1721,12 +1661,6 @@ 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); }") @@ -1755,12 +1689,6 @@ 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); }") diff --git a/gcc/expr.h b/gcc/expr.h index b3fbaeada93..54eb3274b04 100644 --- a/gcc/expr.h +++ b/gcc/expr.h @@ -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)); diff --git a/gcc/optabs.c b/gcc/optabs.c index 814a483fee4..dc742627a77 100644 --- a/gcc/optabs.c +++ b/gcc/optabs.c @@ -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 *)); /* 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; } diff --git a/gcc/tm.texi b/gcc/tm.texi index 0704ff5925c..70dc6d0d318 100644 --- a/gcc/tm.texi +++ b/gcc/tm.texi @@ -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 -- 2.30.2