diff options
-rw-r--r-- | gcc/ChangeLog | 19 | ||||
-rw-r--r-- | gcc/c-typeck.c | 1 | ||||
-rw-r--r-- | gcc/config/sparc/sparc.c | 53 | ||||
-rw-r--r-- | gcc/config/sparc/sparc.h | 12 | ||||
-rw-r--r-- | gcc/config/sparc/sparc.md | 18 | ||||
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/typeck.c | 1 | ||||
-rw-r--r-- | gcc/expr.c | 8 | ||||
-rw-r--r-- | gcc/jump.c | 90 | ||||
-rw-r--r-- | gcc/rtl.def | 4 | ||||
-rw-r--r-- | gcc/rtl.h | 1 | ||||
-rw-r--r-- | gcc/tree.def | 1 |
12 files changed, 133 insertions, 79 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7ea22e3..644ba3e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,22 @@ +2000-01-25 Richard Henderson <rth@cygnus.com> + + * tree.def (UNNE_EXPR): Remove. + * c-typeck.c (build_binary_op): Don't handle it. + * expr.c (expand_expr, do_jump, do_store_flag): Likewise. + + * rtl.def (UNNE): Remove. + (LTGT): Add. + * jump.c (reverse_condition): Update accordingly. + (swap_condition): Likewise. + (comparison_dominates_p): Handle unordered comparisons. + (reverse_condition_maybe_unordered): New. + * rtl.h (reverse_condition_maybe_unordered): Declare. + + * sparc.c (select_cc_mode): Update for UNNE/LTGT. + (output_cbranch): Use reverse_condition_maybe_unordered and LTGT. + * sparc.h (REVERSIBLE_CC_MODE): Always true. Update docs. + * sparc.md (bltgt): New. + 2000-01-25 Nick Clifton <nickc@redhat.com> * emit-rtl.c (emit_insn): Only check machine class insns for diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index a424242..8bf54cb 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -2233,7 +2233,6 @@ build_binary_op (code, orig_op0, orig_op1, convert_p) case UNGT_EXPR: case UNGE_EXPR: case UNEQ_EXPR: - case UNNE_EXPR: build_type = integer_type_node; if (code0 != REAL_TYPE || code1 != REAL_TYPE) { diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c index f459832..cbf246f 100644 --- a/gcc/config/sparc/sparc.c +++ b/gcc/config/sparc/sparc.c @@ -2097,7 +2097,7 @@ select_cc_mode (op, x, y) case UNGT: case UNGE: case UNEQ: - case UNNE: + case LTGT: return CCFPmode; case LT: @@ -4655,54 +4655,7 @@ output_cbranch (op, label, reversed, annul, noop, insn) /* Reversal of FP compares takes care -- an ordered compare becomes an unordered compare and vice versa. */ if (mode == CCFPmode || mode == CCFPEmode) - { - switch (code) - { - case EQ: - code = NE; - break; - case NE: - code = EQ; - break; - case GE: - code = UNLT; - break; - case GT: - code = UNLE; - break; - case LE: - code = UNGT; - break; - case LT: - code = UNGE; - break; - case UNORDERED: - code = ORDERED; - break; - case ORDERED: - code = UNORDERED; - break; - case UNGT: - code = LE; - break; - case UNLT: - code = GE; - break; - case UNEQ: - /* ??? We don't have a "less or greater" rtx code. */ - code = UNKNOWN; - break; - case UNGE: - code = LT; - break; - case UNLE: - code = GT; - break; - - default: - abort (); - } - } + code = reverse_condition_maybe_unordered (code); else code = reverse_condition (code); } @@ -4750,7 +4703,7 @@ output_cbranch (op, label, reversed, annul, noop, insn) case UNLE: branch = "fbule"; break; - case UNKNOWN: + case LTGT: branch = "fblg"; break; diff --git a/gcc/config/sparc/sparc.h b/gcc/config/sparc/sparc.h index 02f0116..03317bd 100644 --- a/gcc/config/sparc/sparc.h +++ b/gcc/config/sparc/sparc.h @@ -2669,15 +2669,15 @@ do { \ /* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE, return the mode to be used for the comparison. For floating-point, - CCFP[E]mode is used. CC_NOOVmode should be used when the first operand is a - PLUS, MINUS, NEG, or ASHIFT. CCmode should be used when no special + CCFP[E]mode is used. CC_NOOVmode should be used when the first operand + is a PLUS, MINUS, NEG, or ASHIFT. CCmode should be used when no special processing is needed. */ #define SELECT_CC_MODE(OP,X,Y) select_cc_mode ((OP), (X), (Y)) -/* Return non-zero if SELECT_CC_MODE will never return MODE for a - floating point inequality comparison. */ - -#define REVERSIBLE_CC_MODE(MODE) ((MODE) != CCFPEmode && (MODE) != CCFPmode) +/* Return non-zero if MODE implies a floating point inequality can be + reversed. For Sparc this is always true because we have a full + compliment of ordered and unordered comparisons. */ +#define REVERSIBLE_CC_MODE(MODE) 1 /* A function address in a call instruction is a byte address (for indexing purposes) diff --git a/gcc/config/sparc/sparc.md b/gcc/config/sparc/sparc.md index ac8f9aa..950d9ae 100644 --- a/gcc/config/sparc/sparc.md +++ b/gcc/config/sparc/sparc.md @@ -1923,6 +1923,24 @@ } operands[1] = gen_compare_reg (UNLE, sparc_compare_op0, sparc_compare_op1); }") + +(define_expand "bltgt" + [(set (pc) + (if_then_else (ltgt (match_dup 1) (const_int 0)) + (label_ref (match_operand 0 "" "")) + (pc)))] + "" + " +{ + if (GET_MODE (sparc_compare_op0) == TFmode + && TARGET_ARCH64 && ! TARGET_HARD_QUAD) + { + sparc_emit_float_lib_cmp (sparc_compare_op0, sparc_compare_op1, LTGT); + emit_jump_insn (gen_bne (operands[0])); + DONE; + } + operands[1] = gen_compare_reg (LTGT, sparc_compare_op0, sparc_compare_op1); +}") ;; Now match both normal and inverted jump. diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 97231fb..d6eea72 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,7 @@ +2000-01-25 Richard Henderson <rth@cygnus.com> + + * typeck.c (build_binary_op_nodefault): Remove UNNE_EXPR. + 2000-01-25 Mark Mitchell <mark@codesourcery.com> * cp-tree.h (vcall_offset_in_vtable_p): New macro. diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 8b1a31c..04feacf 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -3786,7 +3786,6 @@ build_binary_op_nodefault (code, orig_op0, orig_op1, error_code) case UNGT_EXPR: case UNGE_EXPR: case UNEQ_EXPR: - case UNNE_EXPR: build_type = integer_type_node; if (code0 != REAL_TYPE || code1 != REAL_TYPE) { @@ -7626,7 +7626,6 @@ expand_expr (exp, target, tmode, modifier) case UNGT_EXPR: case UNGE_EXPR: case UNEQ_EXPR: - case UNNE_EXPR: preexpand_calls (exp); temp = do_store_flag (exp, target, tmode != VOIDmode ? tmode : mode, 0); if (temp != 0) @@ -9556,9 +9555,7 @@ do_jump (exp, if_false_label, if_true_label) rcode1 = UNEQ; tcode2 = EQ_EXPR; goto unordered_bcc; - case UNNE_EXPR: - rcode1 = UNNE; - tcode2 = NE_EXPR; + unordered_bcc: mode = TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0))); if (can_compare_p (rcode1, mode, ccp_jump)) @@ -10165,9 +10162,6 @@ do_store_flag (exp, target, mode, only_cheap) case UNEQ_EXPR: code = UNEQ; break; - case UNNE_EXPR: - code = UNNE; - break; default: abort (); @@ -3473,7 +3473,7 @@ reverse_condition (code) case UNGT: case UNGE: case UNEQ: - case UNNE: + case LTGT: return UNKNOWN; default: @@ -3481,6 +3481,62 @@ reverse_condition (code) } } +/* Similar, but we're allowed to generate unordered comparisons, which + makes it safe for IEEE floating-point. Of course, we have to recognize + that the target will support them too... */ + +enum rtx_code +reverse_condition_maybe_unordered (code) + enum rtx_code code; +{ + /* Non-IEEE formats don't have unordered conditions. */ + if (TARGET_FLOAT_FORMAT != IEEE_FLOAT_FORMAT) + return reverse_condition (code); + + switch (code) + { + case EQ: + return NE; + case NE: + return EQ; + case GT: + return UNLE; + case GE: + return UNLT; + case LT: + return UNGE; + case LE: + return UNGT; + case LTGT: + return UNEQ; + case GTU: + return LEU; + case GEU: + return LTU; + case LTU: + return GEU; + case LEU: + return GTU; + case UNORDERED: + return ORDERED; + case ORDERED: + return UNORDERED; + case UNLT: + return GE; + case UNLE: + return GT; + case UNGT: + return LE; + case UNGE: + return LT; + case UNEQ: + return LTGT; + + default: + abort (); + } +} + /* Similar, but return the code when two operands of a comparison are swapped. This IS safe for IEEE floating-point. */ @@ -3495,7 +3551,7 @@ swap_condition (code) case UNORDERED: case ORDERED: case UNEQ: - case UNNE: + case LTGT: return code; case GT: @@ -3514,7 +3570,6 @@ swap_condition (code) return GTU; case LEU: return GEU; - case UNLT: return UNGT; case UNLE: @@ -3549,13 +3604,10 @@ unsigned_condition (code) case GT: return GTU; - case GE: return GEU; - case LT: return LTU; - case LE: return LEU; @@ -3582,13 +3634,10 @@ signed_condition (code) case GTU: return GT; - case GEU: return GE; - case LTU: return LT; - case LEU: return LE; @@ -3610,17 +3659,29 @@ comparison_dominates_p (code1, code2) switch (code1) { case EQ: - if (code2 == LE || code2 == LEU || code2 == GE || code2 == GEU) + if (code2 == LE || code2 == LEU || code2 == GE || code2 == GEU + || code2 == ORDERED) return 1; break; case LT: - if (code2 == LE || code2 == NE) + if (code2 == LE || code2 == NE || code2 == ORDERED) return 1; break; case GT: - if (code2 == GE || code2 == NE) + if (code2 == GE || code2 == NE || code2 == ORDERED) + return 1; + break; + + case GE: + case LE: + if (code2 == ORDERED) + return 1; + break; + + case LTGT: + if (code2 == NE || code2 == ORDERED) return 1; break; @@ -3633,6 +3694,11 @@ comparison_dominates_p (code1, code2) if (code2 == GEU || code2 == NE) return 1; break; + + case UNORDERED: + if (code2 == NE) + return 1; + break; default: break; diff --git a/gcc/rtl.def b/gcc/rtl.def index 94b72b8..996a38e 100644 --- a/gcc/rtl.def +++ b/gcc/rtl.def @@ -742,13 +742,15 @@ DEF_RTL_EXPR(UNORDERED, "unordered", "ee", '<') DEF_RTL_EXPR(ORDERED, "ordered", "ee", '<') /* These are equivalent to unordered or ... */ -DEF_RTL_EXPR(UNNE, "unne", "ee", '<') DEF_RTL_EXPR(UNEQ, "uneq", "ee", '<') DEF_RTL_EXPR(UNGE, "unge", "ee", '<') DEF_RTL_EXPR(UNGT, "ungt", "ee", '<') DEF_RTL_EXPR(UNLE, "unle", "ee", '<') DEF_RTL_EXPR(UNLT, "unlt", "ee", '<') +/* This is an ordered NE, ie !UNEQ, ie false for NaN. */ +DEF_RTL_EXPR(LTGT, "ltgt", "ee", '<') + /* Represents the result of sign-extending the sole operand. The machine modes of the operand and of the SIGN_EXTEND expression determine how much sign-extension is going on. */ @@ -1056,6 +1056,7 @@ extern rtx next_cc0_user PARAMS ((rtx)); extern rtx prev_cc0_setter PARAMS ((rtx)); extern rtx next_nondeleted_insn PARAMS ((rtx)); extern enum rtx_code reverse_condition PARAMS ((enum rtx_code)); +extern enum rtx_code reverse_condition_maybe_unordered PARAMS ((enum rtx_code)); extern enum rtx_code swap_condition PARAMS ((enum rtx_code)); extern enum rtx_code unsigned_condition PARAMS ((enum rtx_code)); extern enum rtx_code signed_condition PARAMS ((enum rtx_code)); diff --git a/gcc/tree.def b/gcc/tree.def index b4fb3ca..eadf1f5 100644 --- a/gcc/tree.def +++ b/gcc/tree.def @@ -651,7 +651,6 @@ DEFTREECODE (UNLE_EXPR, "unle_expr", '<', 2) DEFTREECODE (UNGT_EXPR, "ungt_expr", '<', 2) DEFTREECODE (UNGE_EXPR, "unge_expr", '<', 2) DEFTREECODE (UNEQ_EXPR, "uneq_expr", '<', 2) -DEFTREECODE (UNNE_EXPR, "unne_expr", '<', 2) /* Operations for Pascal sets. Not used now. */ DEFTREECODE (IN_EXPR, "in_expr", '2', 2) |