diff options
author | Richard Henderson <rth@gcc.gnu.org> | 2000-01-24 12:10:04 -0800 |
---|---|---|
committer | Richard Henderson <rth@gcc.gnu.org> | 2000-01-24 12:10:04 -0800 |
commit | 1eb8759b1bc0fd2a74ddbd83db1f01df1a35df69 (patch) | |
tree | a9f7967b844ec94122754eade0945e4f551bf9f1 /gcc/jump.c | |
parent | d6cde8451a650824fcf971d56978b50d949aa3a2 (diff) | |
download | gcc-1eb8759b1bc0fd2a74ddbd83db1f01df1a35df69.zip gcc-1eb8759b1bc0fd2a74ddbd83db1f01df1a35df69.tar.gz gcc-1eb8759b1bc0fd2a74ddbd83db1f01df1a35df69.tar.bz2 |
rtl.def: Add unordered fp comparisions.
* rtl.def: Add unordered fp comparisions.
* tree.def: Likewise.
* tree.h: Add ISO C 9x unordered fp comparision builtins.
* builtins.c (expand_tree_builtin): New function.
* c-typeck.c (build_function_call): Use it.
(build_binary_op): Support unordered compares.
* c-common.c (c_common_nodes_and_builtins): Add unordered compares.
* combine.c (known_cond): Handle reverse_condition returning UNKNOWN.
(reversible_comparison_p): Allow UNORDERED/ORDERED to be reversed.
* cse.c (fold_rtx): Check FLOAT_MODE_P before reversing.
(record_jump_equiv): Handle reverse_condition returning UNKNOWN.
* jump.c (reverse_condition): Don't abort for UNLE etc, but
return UNKNOWN.
(swap_condition): Handle unordered compares.
(thread_jumps): Check can_reverse before reversing.
* loop.c (get_condition): Likewise. Allow UNORERED/ORDERED to be
reversed for FP.
* optabs.c (can_compare_p): New argument CODE. Verify branch or
setcc is present before acking for cmp_optab. Update all callers.
(prepare_float_lib_cmp, init_optabs): Handle UNORDERED.
* expmed.c (do_cmp_and_jump): Update for can_compare_p.
* expr.c (expand_expr): Likewise. Support unordered compares.
(do_jump, do_store_flag): Likewise.
* expr.h (enum libfunc_index): Add unordered compares.
* Makefile.in (FPBIT_FUNCS): Add _unord_sf.
(DPBIT_FUNCS): Add _unord_df.
* config/fp-bit.c (_unord_f2): New.
* fp-test.c (main): Try unordered compare builtins.
* alpha-protos.h (alpha_fp_comparison_operator): Declare.
* alpha.c (alpha_comparison_operator): Check mode properly.
(alpha_swapped_comparison_operator): Likewise.
(signed_comparison_operator): Likewise.
(alpha_fp_comparison_operator): New.
(alpha_emit_conditional_branch): Handle unordered compares.
* alpha.h (PREDICATE_CODES): Update.
* alpha.md (fp compares): Use alpha_fp_comparison_operator.
(bunordered, bordered): New.
* cp/call.c (build_over_call): Use expand_tree_builtin.
* cp/typeck.c (build_function_call_real): Likewise.
(build_binary_op_nodefault): Handle unordered compares.
* gcc.c-torture/execute/ieee/fp-cmp-4.c: New.
From-SVN: r31591
Diffstat (limited to 'gcc/jump.c')
-rw-r--r-- | gcc/jump.c | 63 |
1 files changed, 36 insertions, 27 deletions
@@ -3429,11 +3429,12 @@ can_reverse_comparison_p (comparison, insn) && GET_MODE_CLASS (GET_MODE (arg0)) != MODE_FLOAT)); } -/* Given an rtx-code for a comparison, return the code - for the negated comparison. - WATCH OUT! reverse_condition is not safe to use on a jump - that might be acting on the results of an IEEE floating point comparison, - because of the special treatment of non-signaling nans in comparisons. +/* Given an rtx-code for a comparison, return the code for the negated + comparison. If no such code exists, return UNKNOWN. + + WATCH OUT! reverse_condition is not safe to use on a jump that might + be acting on the results of an IEEE floating point comparison, because + of the special treatment of non-signaling nans in comparisons. Use can_reverse_comparison_p to be sure. */ enum rtx_code @@ -3444,37 +3445,39 @@ reverse_condition (code) { case EQ: return NE; - case NE: return EQ; - case GT: return LE; - case GE: return LT; - case LT: return GE; - case LE: return GT; - 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: + case UNLE: + case UNGT: + case UNGE: + case UNEQ: + case UNNE: + return UNKNOWN; default: abort (); - return UNKNOWN; } } @@ -3489,35 +3492,40 @@ swap_condition (code) { case EQ: case NE: + case UNORDERED: + case ORDERED: + case UNEQ: + case UNNE: return code; case GT: return LT; - case GE: return LE; - case LT: return GT; - case LE: return GE; - case GTU: return LTU; - case GEU: return LEU; - case LTU: return GTU; - case LEU: return GEU; + case UNLT: + return UNGT; + case UNLE: + return UNGE; + case UNGT: + return UNLT; + case UNGE: + return UNLE; + default: abort (); - return UNKNOWN; } } @@ -5272,10 +5280,11 @@ thread_jumps (f, max_reg, flag_before_loop) if (rtx_equal_for_thread_p (b1op0, b2op0, b2) && rtx_equal_for_thread_p (b1op1, b2op1, b2) && (comparison_dominates_p (code1, code2) - || (comparison_dominates_p (code1, reverse_condition (code2)) - && can_reverse_comparison_p (XEXP (SET_SRC (PATTERN (b1)), - 0), - b1)))) + || (can_reverse_comparison_p (XEXP (SET_SRC (PATTERN (b1)), + 0), + b1) + && comparison_dominates_p (code1, reverse_condition (code2))))) + { t1 = prev_nonnote_insn (b1); t2 = prev_nonnote_insn (b2); |