This is the mail archive of the
mailing list for the GCC project.
Re: [RFC] Fold floating-point comparisons
- From: Roger Sayle <roger at eyesopen dot com>
- To: Paolo Bonzini <bonzini at gnu dot org>
- Cc: gcc-patches at gcc dot gnu dot org, Richard Henderson <rth at redhat dot com>
- Date: Fri, 28 May 2004 08:23:23 -0600 (MDT)
- Subject: Re: [RFC] Fold floating-point comparisons
On Fri, 28 May 2004, Paolo Bonzini wrote:
> 2004-05-27 Paolo Bonzini <email@example.com>
> Roger Sayle <firstname.lastname@example.org>
> PR rtl-optimization/15649
> Add LTGT_EXPR and improve pretty-printing of unordered
> * c-common.c (c_common_truthvalue_conversion):
> Handle LTGT_EXPR.
> * c-typeck.c (build_binary_op): Likewise.
> * dojump.c (do_jump): Likewise.
> * expr.c (expand_expr_real_1, do_store_flag): Likewise.
> * predict.c (tree_predict_by_opcode): Likewise.
> * real.c (real_compare): Likewise.
> * tree-cfg.c (verify_expr): Likewise.
> * tree-inline.c (estimate_num_insns_1): Likewise.
> * tree-pretty-print.c (dump_generic_node): Likewise.
> Handle ORDERED_EXPR, UNORDERED_EXPR.
> (op_symbol): Print unordered comparisons differently
> than ordered ones.
> * tree.def (LTGT_EXPR): New '<' tree code.
> * doc/c-tree.texi (Expressions): Document floating-point
> comparison nodes.
> Fold comparisons between floating point values.
> * fold-const.c (enum comparison_code): New, from
> #define'd constants. Define compcodes for unordered
> comparisons and for invalid transformations.
> (invert_truthvalue): Fold the resulting trees whenever
> (invert_tree_comparison): Add "honor_nans" parameter.
> (fold_truthop): Revamp to work on floating-point types too.
> (comparison_to_compcode): Support unordered comparisons.
> Use new enum comparison_code.
> (compcode_to_comparison): Likewise.
> (combine_compcodes): New function.
> (invert_truthvalue): Let invert_tree_comparison decide
> whether it is valid to fold the comparison. Fold ORDERED
> and UNORDERED even if flag_unsafe_math_optimizations is off,
> and the remaining even if flag_unsafe_math_optimizations
> is off but we are under -fno-trapping-math.
> (fold_relational_const): Integer modes do not honor NaNs.
>2004-05-27 Paolo Bonzini <email@example.com>
> * gcc.dg/compare-fp-1.c, gcc.dg/compare-fp-2.c,
> gcc.dg/compare-fp-3.c, gcc.dg/compare-fp-4.c,
> gcc.dg/pr15649-1.c: New.
This is OK for mainline. The remaining issues can always be sorted
out as follow-up patches, and this is no worse than what's currently