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/cp | |
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/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 12 | ||||
-rw-r--r-- | gcc/cp/call.c | 20 | ||||
-rw-r--r-- | gcc/cp/typeck.c | 62 |
3 files changed, 51 insertions, 43 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 0b2cda1..92dcb79 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2000-01-24 Richard Henderson <rth@cygnus.com> + + * call.c (build_over_call): Use expand_tree_builtin. + * typeck.c (build_function_call_real): Likewise. + (build_binary_op_nodefault): Handle unordered compares. + 2000-01-24 Nathan Sidwell <sidwell@codesourcery.com> * cp-tree.h (CPTI_BAD_CAST, CPTI_BAD_TYPEID, CPTI_DCAST): New @@ -111,10 +117,10 @@ 2000-01-19 Gabriel Dos Reis <gdr@codesourcery.coom> - * typeck.c (build_unary_op): Use cp_pedwarn, not pedwarn. + * typeck.c (build_unary_op): Use cp_pedwarn, not pedwarn. - * typeck2.c (incomplete_type_error): Restore previous - cp_error and cp_error_at call sequence. + * typeck2.c (incomplete_type_error): Restore previous + cp_error and cp_error_at call sequence. 2000-01-20 Brad Lucier <lucier@math.purdue.edu> diff --git a/gcc/cp/call.c b/gcc/cp/call.c index f526abf..991a79d 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -4145,19 +4145,13 @@ build_over_call (cand, args, flags) if (TREE_CODE (fn) == ADDR_EXPR && TREE_CODE (TREE_OPERAND (fn, 0)) == FUNCTION_DECL - && DECL_BUILT_IN (TREE_OPERAND (fn, 0)) - && DECL_BUILT_IN_CLASS (TREE_OPERAND (fn, 0)) == BUILT_IN_NORMAL) - switch (DECL_FUNCTION_CODE (TREE_OPERAND (fn, 0))) - { - case BUILT_IN_ABS: - case BUILT_IN_LABS: - case BUILT_IN_FABS: - if (converted_args == 0) - return integer_zero_node; - return build_unary_op (ABS_EXPR, TREE_VALUE (converted_args), 0); - default: - break; - } + && DECL_BUILT_IN (TREE_OPERAND (fn, 0))) + { + tree exp; + exp = expand_tree_builtin (TREE_OPERAND (fn, 0), args, converted_args); + if (exp) + return exp; + } fn = build_call (fn, TREE_TYPE (TREE_TYPE (TREE_TYPE (fn))), converted_args); if (TREE_CODE (TREE_TYPE (fn)) == VOID_TYPE) diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 2a4a668..29f6086 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -2926,6 +2926,7 @@ build_function_call_real (function, params, require_complete, flags) register tree fntype, fndecl; register tree value_type; register tree coerced_params; + tree result; tree name = NULL_TREE, assembler_name = NULL_TREE; int is_method; @@ -3023,37 +3024,27 @@ build_function_call_real (function, params, require_complete, flags) if (TREE_CODE (function) == ADDR_EXPR && TREE_CODE (TREE_OPERAND (function, 0)) == FUNCTION_DECL - && DECL_BUILT_IN (TREE_OPERAND (function, 0)) - && DECL_BUILT_IN_CLASS (TREE_OPERAND (function, 0)) == BUILT_IN_NORMAL) - switch (DECL_FUNCTION_CODE (TREE_OPERAND (function, 0))) - { - case BUILT_IN_ABS: - case BUILT_IN_LABS: - case BUILT_IN_FABS: - if (coerced_params == 0) - return integer_zero_node; - return build_unary_op (ABS_EXPR, TREE_VALUE (coerced_params), 0); - - default: - break; - } + && DECL_BUILT_IN (TREE_OPERAND (function, 0))) + { + result = expand_tree_builtin (TREE_OPERAND (function, 0), + params, coerced_params); + if (result) + return result; + } /* C++ */ value_type = TREE_TYPE (fntype) ? TREE_TYPE (fntype) : void_type_node; - { - register tree result - = build_call (function, value_type, coerced_params); + result = build_call (function, value_type, coerced_params); - if (require_complete) - { - if (TREE_CODE (value_type) == VOID_TYPE) - return result; - result = require_complete_type (result); - } - if (IS_AGGR_TYPE (value_type)) - result = build_cplus_new (value_type, result); - return convert_from_reference (result); - } + if (require_complete) + { + if (TREE_CODE (value_type) == VOID_TYPE) + return result; + result = require_complete_type (result); + } + if (IS_AGGR_TYPE (value_type)) + result = build_cplus_new (value_type, result); + return convert_from_reference (result); } tree @@ -3792,6 +3783,23 @@ build_binary_op_nodefault (code, orig_op0, orig_op1, error_code) } break; + case UNORDERED_EXPR: + case ORDERED_EXPR: + case UNLT_EXPR: + case UNLE_EXPR: + case UNGT_EXPR: + case UNGE_EXPR: + case UNEQ_EXPR: + case UNNE_EXPR: + build_type = integer_type_node; + if (code0 != REAL_TYPE || code1 != REAL_TYPE) + { + error ("unordered comparison on non-floating point argument"); + return error_mark_node; + } + common = 1; + break; + default: break; } |