aboutsummaryrefslogtreecommitdiff
path: root/gcc/real.h
AgeCommit message (Collapse)AuthorFilesLines
2009-02-25backport: re PR middle-end/36578 (cast to long double not taken into account ↵Janis Johnson1-0/+5
when result stored to a double) 2009-02-25 Janis Johnson <janis187@us.ibm.com> gcc/ Backport from mainline: 2008-10-29 Joseph Myers <joseph@codesourcery.com> PR middle-end/36578 * convert.c (convert_to_real): Do not optimize conversions of binary arithmetic operations between binary and decimal floating-point types. Consider mode of target type in determining decimal type for arithmetic. Unless flag_unsafe_math_optimizations, do not optimize binary conversions where this may change rounding behavior. * real.c (real_can_shorten_arithmetic): New. * real.h (real_can_shorten_arithmetic): Declare. gcc/testsuite/ Backport from mainline: 2008-10-29 Joseph Myers <joseph@codesourcery.com> PR middle-end/36578 * gcc.dg/dfp/convert-bfp-13.c, gcc.dg/dfp/convert-bfp-14.c, gcc.dg/dfp/convert-dfp-fold-2.c, gcc.target/i386/pr36578-1.c, gcc.target/i386/pr36578-2.c: New tests. From-SVN: r144436
2008-08-19real.h (struct real_format): New member round_towards_zero.prereleases/gcc-4.3.2-rc1Ulrich Weigand1-0/+8
ChangeLog: * real.h (struct real_format): New member round_towards_zero. * real.c (round_for_format): Respect fmt->round_towards_zero. (ieee_single_format, mips_single_format, motorola_single_format, spu_single_format, ieee_double_format, mips_double_format, motorola_double_format, ieee_extended_motorola_format, ieee_extended_intel_96_format, ieee_extended_intel_128_format, ieee_extended_intel_96_round_53_format, ibm_extended_format, mips_extended_format, ieee_quad_format, mips_quad_format, vax_f_format, vax_d_format, vax_g_format): Initialize it. * config/pdp11/pdp11.c (pdp11_f_format, pdp11_d_format): Likewise. * builtins.s (do_mpfr_arg1): Consider round_towards_zero member of real_format to choose rounding mode when calling MPFR functions. (do_mpfr_arg2, do_mpfr_arg3, do_mpfr_sincos): Likewise. (do_mpfr_bessel_n, do_mpfr_remquo, do_mpfr_lgamma_r): Likewise. * real.h (real_to_decimal_for_mode): Add prototype. * real.c (real_to_decimal_for_mode): Renames old real_to_decimal. Respect target rounding mode when generating decimal representation. (real_to_decimal): New stub for backwards compatibility. * c-cppbuiltin.c (builtin_define_with_hex_fp_value): Use real_to_decimal_for_mode instead of real_to_decimal. * config/spu/spu.md ("floatdisf2", "floatunsdisf2"): New. * config/spu/float_disf.c: New file. * config/spu/float_unsdisf.c: New file. * config/spu/t-elf (LIB2FUNCS_STATIC_EXTRA): Add them. (LIB2FUNCS_EXCLUDE): Define. testsuite/ChangeLog: * gcc.c-torture/execute/20031003-1.c (main): Update test to accommodate SPU single-precision rounding mode. * gcc.c-torture/execute/conversion.c (test_float_to_integer, test_float_to_longlong_integer): Likewise. * gcc.c-torture/execute/ieee/rbug.c (main): Likewise. * gcc.dg/hex-round-1.c: Skip test on SPU. * gcc.dg/hex-round-2.c: Likewise. * gcc.dg/torture/fp-int-convert-float.c: Reenable test on SPU. * gcc.dg/torture/fp-int-convert-timode.c: Reenable "float" test on SPU. From-SVN: r139240
2008-08-18real.c (spu_single_format): New variable.Ulrich Weigand1-0/+1
ChangeLog: * real.c (spu_single_format): New variable. * real.h (spu_single_format): Declare. * config/spu/spu.c (spu_override_options): Install SFmode format. (spu_split_immediate): Use integer mode to operate on pieces of floating-point values in all cases. * config/spu/spu.md (UNSPEC_FLOAT_EXTEND, UNSPEC_FLOAT_TRUNCATE): New. ("extendsfdf2"): Use UNSPEC_FLOAT_EXTEND instead of FLOAT_EXTEND. ("truncdfsf2"): Use UNSPEC_FLOAT_TRUNCATE instead of FLOAT_TRUNCATE. testsuite/ChangeLog: * gcc.c-torture/execute/ieee/inf-2.c (testf): Skip on the SPU. From-SVN: r139198
2008-02-08re PR bootstrap/35051 (Build machine requires GMP and MPFR for building ↵Richard Sandiford1-0/+4
cross-host gccs) gcc/ PR bootstrap/35051 * double-int.h: Don't include gmp.h for GENERATOR_FILEs. (mpz_set_double_int, mpz_get_double_int): Hide from GENERATOR_FILEs. * real.h: Don't include gmp.h or mpfr.h for GENERATOR_FILEs. (real_from_mpfr, mpfr_from_real): Hide from GENERATOR_FILEs. * tree.h (get_type_static_bounds): Likewise. From-SVN: r132188
2008-01-25MAINTAINERS (c4x port): Remove.Joseph Myers1-3/+1
* MAINTAINERS (c4x port): Remove. contrib: * paranoia.cc (main): Remove handling of c4x_single and c4x_extended formats. gcc: * config/c4x: Remove directory. * config.gcc (crx-*, mt-*): Mark obsolete. (c4x-*, tic4x-*, c4x-*-rtems*, tic4x-*-rtems*, c4x-*, tic4x-*, h8300-*-rtemscoff*, ns32k-*-netbsdelf*, ns32k-*-netbsd*, sh-*-rtemscoff*): Remove cases. * defaults.h (C4X_FLOAT_FORMAT): Remove. * real.c (encode_c4x_single, decode_c4x_single, encode_c4x_extended, decode_c4x_extended, c4x_single_format, c4x_extended_format): Remove. * real.h (c4x_single_format, c4x_extended_format): Remove. * doc/extend.texi (interrupt, naked): Remove mention of attributes on C4x. (Pragmas): Remove comment about c4x pragmas. * doc/install.texi (c4x): Remove target-specific instructions. * doc/invoke.texi (TMS320C3x/C4x Options): Remove. * doc/md.texi (Machine Constraints): Remove C4x documentation. * doc/tm.texi (MEMBER_TYPE_FORCES_BLK, c_register_pragma): Do not refer to C4x source files as examples. (C4X_FLOAT_FORMAT): Remove documentation. gcc/testsuite: * gcc.dg/builtin-inf-1.c, gcc.dg/compare6.c, gcc.dg/sibcall-3.c, gcc.dg/sibcall-4.c, gcc.dg/torture/builtin-attr-1.c: Don't handle c4x-*-* targets. libgcc: * config.host (tic4x-*-*, c4x-*-rtems*, tic4x-*-rtems*, c4x-*, tic4x-*, h8300-*-rtemscoff*, ns32k-*-netbsdelf*, ns32k-*-netbsd*, sh-*-rtemscoff*): Remove cases. From-SVN: r131835
2007-09-07Reapply reverted change:Janis Johnson1-1/+1
gcc/ada/ Reapply reverted change: 2007-09-06 Eric Botcazou <ebotcazou@adacore.com> * trans.c (convert_with_check): Update call to real_2expN. gcc/ config/m68k/m68k.c (floating_exact_log2): Update call to real_2expN. config/s390/s390.md (fixuns_trunc<BFP:mode><GPR:mode>2): Ditto. Reapply reverted changes: 2007-09-06 Jan Hubicka <jh@suse.cz> * config/i386.c (ix86_expand_lround, ix86_expand_round): Update call of real_2expN. 2007-09-06 Richard Sandiford <richard@codesourcery.com> * config/mips/mips.md (fixuns_truncdfsi2, fixuns_truncdfdi2) (fixuns_truncsfsi2, fixuns_truncsfdi2): Update calls to real_2expN. 2007-09-05 Janis Johnson <janis187@us.ibm.com> * optabs.c (expand_float): Convert unsigned integer as signed only if it provides sufficient accuracy; add mode argument to real_2expN. (expand_fix): Fix comment typos; extend binary float into mode wider than destination for converion to unsigned integer; add mode argument to real_2expN. * real.c (real_2expN): Add mode argument to special-case decimal float values. * real.h (real_2expN): Ditto. * fixed-value.c (check_real_for_fixed_mode): Add mode argument to real_2expN. (fixed_from_string): Ditto. (fixed_to_decimal): Ditto. (fixed_convert_from_real): Ditto. (real_convert_from_fixed): Ditto. * config/rs6000/rs6000.md (FP): Include DD and TD modes. * config/rs6000/dfp.md (extendddtd2, adddd3, addtd3, subdd3, subtd3, muldd3, multd3, divdd3, divtd3, cmpdd_internal1, cmptd_internal1, floatditd2, ftruncdd2, fixdddi2, ftrunctd2, fixddi2): New. From-SVN: r128247
2007-09-06Revert:Janis Johnson1-1/+1
2007-09-06 Jan Hubicka <jh@suse.cz> * i386.c (ix86_expand_lround, ix86_expand_round): Update call of real_2expN. 2007-09-06 Richard Sandiford <richard@codesourcery.com> * config/mips/mips.md (fixuns_truncdfsi2, fixuns_truncdfdi2) (fixuns_truncsfsi2, fixuns_truncsfdi2): Update calls to real_2expN. 2007-09-05 Janis Johnson <janis187@us.ibm.com> * optabs.c (expand_float): Convert unsigned integer as signed only if it provides sufficient accuracy; add mode argument to real_2expN. (expand_fix): Fix comment typos; extend binary float into mode wider than destination for converion to unsigned integer; add mode argument to real_2expN. * real.c (real_2expN): Add mode argument to special-case decimal float values. * real.h (real_2expN): Ditto. * fixed-value.c (check_real_for_fixed_mode): Add mode argument to real_2expN. (fixed_from_string): Ditto. (fixed_to_decimal): Ditto. (fixed_convert_from_real): Ditto. (real_convert_from_fixed): Ditto. * config/rs6000/rs6000.md (FP): Include DD and TD modes. * config/rs6000/dfp.md (extendddtd2, adddd3, addtd3, subdd3, subtd3, muldd3, multd3, divdd3, divtd3, cmpdd_internal1, cmptd_internal1, floatditd2, ftruncdd2, fixdddi2, ftrunctd2, fixddi2): New. From-SVN: r128193
2007-09-05optabs.c (expand_float): Convert unsigned integer as signed only if it ↵Janis Johnson1-1/+1
provides sufficient accuracy... gcc/ * optabs.c (expand_float): Convert unsigned integer as signed only if it provides sufficient accuracy; add mode argument to real_2expN. (expand_fix): Fix comment typos; extend binary float into mode wider than destination for converion to unsigned integer; add mode argument to real_2expN. * real.c (real_2expN): Add mode argument to special-case decimal float values. * real.h (real_2expN): Ditto. * fixed-value.c (check_real_for_fixed_mode): Add mode argument to real_2expN. (fixed_from_string): Ditto. (fixed_to_decimal): Ditto. (fixed_convert_from_real): Ditto. (real_convert_from_fixed): Ditto. * config/rs6000/rs6000.md (FP): Include DD and TD modes. * config/rs6000/dfp.md (extendddtd2, adddd3, addtd3, subdd3, subtd3, muldd3, multd3, divdd3, divtd3, cmpdd_internal1, cmptd_internal1, floatditd2, ftruncdd2, fixdddi2, ftrunctd2, fixddi2): New. gcc/testsuite/ * gcc.target/powerpc/dfp-dd.c: New test. * gcc.target/powerpc/dfp-td.c: New test. From-SVN: r128156
2007-07-26Change copyright header to refer to version 3 of the GNU General Public ↵Nick Clifton1-4/+3
License and to point readers at the COPYING3 file and the FSF's license web page. From-SVN: r126948
2007-07-25expr.c (handled_component_p): Constify.Kaveh R. Ghazi1-1/+1
* expr.c (handled_component_p): Constify. * fold-const.c (fit_double_type): Likewise. * real.h (real_value_from_int_cst): Likewise. * tree-flow-inline.h (gimple_in_ssa_p, gimple_aliases_computed_p, gimple_addressable_vars, gimple_call_clobbered_vars, gimple_referenced_vars, gimple_global_var, gimple_nonlocal_all, gimple_var_anns, end_htab_p, end_referenced_vars_p, var_ann, function_ann, may_aliases, end_readonly_imm_use_p, has_zero_uses, has_single_use, single_imm_use, num_imm_uses, is_exec_stmt, is_label_stmt, is_global_var, phi_ssa_name_p, factoring_name_p, is_call_clobbered, tree_common_ann, op_iter_done, end_imm_use_stmt_p, end_imm_use_on_stmt_p, unmodifiable_var_p, array_ref_contains_indirect_ref, ref_contains_array_ref, lookup_subvars_for_var, var_can_have_subvars, overlap_subvar, gimple_ssa_operands, gimple_mem_ref_stats): Likewise. * tree-flow.h (tree_common_ann, var_ann, function_ann, may_aliases, is_exec_stmt, is_label_stmt, ref_contains_array_ref, array_ref_contains_indirect_ref, var_can_have_subvars, overlap_subvar, is_call_clobbered, unmodifiable_var_p): Likewise. * tree-gimple.c (is_gimple_min_invariant): Likewise. * tree-gimple.h (is_gimple_min_invariant): Likewise. * tree.c (type_hash_list, attribute_hash_list, tree_size, cst_and_fits_in_hwi, real_value_from_int_cst, build_real_from_int_cst, integer_zerop, integer_onep, integer_all_onesp, integer_pow2p, integer_nonzerop, tree_log2, tree_floor_log2, real_zerop, real_onep, real_twop, real_minus_onep, really_constant_p, purpose_member, chain_member, list_length, fields_length, int_size_in_bytes, bit_position, int_bit_position, byte_position, int_byte_position, expr_align, array_type_nelts, tree_node_structure, type_contains_placeholder_1, iterative_hash_pointer, is_attribute_with_length_p, is_attribute_p, check_qualified_type, tree_map_base_eq, type_hash_list, type_hash_eq, attribute_hash_list, type_num_arguments, tree_int_cst_equal, tree_int_cst_lt, tree_int_cst_compare, host_integerp, tree_low_cst, tree_int_cst_msb, tree_int_cst_sgn, simple_cst_list_equal, compare_tree_int, iterative_hash_expr, int_fits_type_p, get_containing_scope, decl_function_context, decl_type_context, omp_clause_operand_check_failed, initializer_zerop, int_cst_value, num_ending_zeros): Likewise. * tree.h (omp_clause_operand_check_failed, tree_size, build_real_from_int_cst, array_type_nelts, purpose_member, tree_int_cst_equal, tree_int_cst_lt, tree_int_cst_compare, host_integerp, tree_low_cst, tree_int_cst_msb, tree_int_cst_sgn, is_attribute_p, check_qualified_type, expr_align, int_size_in_bytes, bit_position, int_bit_position, byte_position, int_byte_position, list_length, fields_length, initializer_zerop, integer_zerop, integer_onep, integer_all_onesp, integer_pow2p, integer_nonzerop, cst_and_fits_in_hwi, num_ending_zeros, tree_node_structure, handled_component_p, get_containing_scope, decl_function_context, decl_type_context, real_zerop, type_num_arguments, fit_double_type, really_constant_p, int_fits_type_p, tree_log2, tree_floor_log2, iterative_hash_expr, compare_tree_int, chain_member, simple_cst_list_equal, real_onep, real_twop, real_minus_onep, int_cst_value): Likewise. From-SVN: r126923
2007-07-18re PR target/30652 (SSE expansion is missing for isinf() and other ↵Kaveh R. Ghazi1-0/+4
fpclassify functions) PR target/30652 PR middle-end/20558 * builtins.c (expand_builtin_interclass_mathfn): Provide a generic fallback for isinf. * c-cppbuiltin.c (builtin_define_float_constants): Move FP max calculation code ... * real.c (get_max_float): ... to here. * real.h (get_max_float): New. testsuite: * gcc.dg/pr28796-1.c: Add more cases. * gcc.dg/pr28796-2.c: Likewise. From-SVN: r126724
2007-06-12real.c (real_isfinite): New.Kaveh R. Ghazi1-0/+3
* real.c (real_isfinite): New. (real_sqrt): Use it. * real.h (real_isfinite): New. * builtins.c: Use it. From-SVN: r125654
2007-06-03m68k.c (override_options): Don't override REAL_MODE_FORMAT.Andreas Schwab1-3/+3
* config/m68k/m68k.c (override_options): Don't override REAL_MODE_FORMAT. * config/m68k/m68k-modes.def (SF, DF): Define to use motorola_single_format and motorola_double_format, resp. * real.c (motorola_single_format): Renamed from coldfire_single_format. (motorola_double_format): Renamed from coldfire_double_format. (encode_ieee_extended): Generate a proper canonical NaN image respecting canonical_nan_lsbs_set. (ieee_extended_motorola_format): Set canonical_nan_lsbs_set to true. * real.h: Adjust declarations. From-SVN: r125295
2007-05-21defaults.h (IBM_FLOAT_FORMAT): Macro definition removed.Andreas Krebbel1-5/+0
2007-05-21 Andreas Krebbel <krebbel1@de.ibm.com> * defaults.h (IBM_FLOAT_FORMAT): Macro definition removed. * doc/tm.texi (IBM_FLOAT_FORMAT): Documentation entry removed. * real.c (encode_i370_single, decode_i370_single, encode_i370_double, decode_i370_double): Functions removed. (i370_single_format, i370_double_format): Initializations removed. (real_maxval, round_for_format, exact_real_truncate, significand_size): Consider the log2_b field to always be one. (ieee_single_format, mips_single_format, coldfire_single_format, ieee_double_format, mips_double_format, coldfire_double_format, ieee_extended_motorola_format, ieee_extended_intel_96_format, ieee_extended_intel_128_format, ieee_extended_intel_96_round_53_format, ibm_extended_format, mips_extended_format, ieee_quad_format, mips_quad_format, vax_f_format, vax_d_format, vax_g_format, decimal_single_format, decimal_double_format, decimal_quad_format, c4x_single_format, c4x_extended_format, real_internal_format): Remove initialization of log2_b. * real.h (i370_single_format, i370_double_format): Declarations removed. * c-cppbuiltin.c (builtin_define_float_constants): Consider the log2_b field to always be one. From-SVN: r124901
2007-04-24real.c (mpfr_from_real): Handle Inf and NaN, and allow the rounding mode to ↵Brooks Moses1-2/+2
be specified by the caller. * real.c (mpfr_from_real): Handle Inf and NaN, and allow the rounding mode to be specified by the caller. (real_to_mpfr) Likewise. * real.h: Update mpfr_from_real, mpfr_to_real prototypes to include new arguments. * builtins.c: Update mpfr_from_real, mpfr_to_real calls. From-SVN: r124139
2007-03-22re PR other/23572 (No warning for assigning a value to a 'float' variable ↵Manuel López-Ibáñez1-2/+3
that overflows with option -Wextra) 2007-03-22 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR other/23572 * c-lex.c (interpret_float): On overflow, emit pedantic warning if infinities not supported, otherwise emit warning if -Woverflow. On underflow, emit warning if -Woverflow. * real.c (real_from_string): Return -1 if underflow, +1 if overflow and 0 otherwise. * real.h (real_from_string): Update declaration testsuite/ * gcc.dg/float-range-4.c: New. * gcc.dg/float-range-1.c: Update. Test for a warning. * gcc.dg/float-range-3.c: New. * gcc.dg/float-range-5.c: New. From-SVN: r123137
2007-02-03emit-rtl.c (dconstpi): Delete.Kaveh R. Ghazi1-1/+1
* emit-rtl.c (dconstpi): Delete. (dconstsqrt2): New. (init_emit_once): Delete dconstpi and init dconstsqrt2. * real.h (dconstpi): Delete. (dconstsqrt2): New. * builtins.c (fold_builtin_cabs): Use dconstsqrt2. (fold_builtin_hypot): Likewise. From-SVN: r121550
2007-01-18real.h (real_format): Add a canonical_nan_lsbs_set field.Richard Sandiford1-0/+3
gcc/ * real.h (real_format): Add a canonical_nan_lsbs_set field. (coldfire_single_format): Declare. (coldfire_double_format): Likewise. * real.c (encode_ieee_single): Use canonical_nan_lsbs_set instead of qnan_msb_set to determine the lower bits of a canonical NaN significand. (encode_ieee_double): Likewise. (encode_ieee_quad): Likewise. (ieee_single_format): Initialize canonical_nan_lsbs_set. (mips_single_format): Likewise. (ieee_double_format): Likewise. (mips_double_format): Likewise. (ieee_extended_motorola_format): Likewise. (ieee_extended_intel_96_format): Likewise. (ieee_extended_intel_128_format): Likewise. (ieee_extended_intel_96_round_53_format): Likewise. (ibm_extended_format): Likewise. (mips_extended_format): Likewise. (ieee_quad_format): Likewise. (mips_quad_format): Likewise. (vax_f_format): Likewise. (vax_d_format): Likewise. (vax_g_format): Likewise. (i370_single_format): Likewise. (i370_double_format): Likewise. (decimal_single_format): Likewise. (decimal_double_format): Likewise. (decimal_quad_format): Likewise. (c4x_single_format): Likewise. (c4x_extended_format): Likewise. (real_internal_format): Likewise. (coldfire_single_format): New real_format. (coldfire_double_format): Likewise. * config/pdp11/pdp11.c (pdp11_f_format): Initialize canonical_nan_lsbs_set. (pdp11_d_format): Likewise. * config/m68k/m68k.c (override_options): Override REAL_FORMAT_MODE if TARGET_COLDFIRE_CPU. From-SVN: r120922
2006-11-23real.h (real_isinteger): Declare.Manuel López-Ibáñez1-0/+3
2006-11-23 Manuel Lopez-Ibanez <manu@gcc.gnu.org> * real.h (real_isinteger): Declare. * real.c (real_isinteger): Define. * builtins.c (integer_valued_real_p): Use it. From-SVN: r119130
2006-10-23re PR middle-end/29335 (transcendental functions with constant arguments ↵Kaveh R. Ghazi1-0/+8
should be resolved at compile-time) PR middle-end/29335 * builtins.c (fold_builtin_sin, fold_builtin_cos, fold_builtin_tan): Fold all constant arguments. Take a "type" argument as necessary. (do_mpfr_arg1): New. * real.c, real.h (real_from_mpfr, mpfr_from_real): New. From-SVN: r117983
2005-12-02dfp.h, dfp.c: New files.Jon Grimm1-5/+32
2005-12-02 Jon Grimm <jgrimm2@us.ibm.com> Janis Johnson <janis187@us.ibm.com> David Edelsohn <dje@watson.ibm.com> Ben Elliston <bje@au.ibm.com> * dfp.h, dfp.c: New files. * Makefile.in (DECNUM, DECNUMINC, LIBDECNUMBER): New variables. (DECNUM_H): Likewise. (LIBDEPS, LIBS, BACKEND): Append $(LIBDECNUMBER). (INCLUDES): Append $(DECNUMINC). (OBJS-common): Add dfp.o. (dfp.o): New rule. * real.h (EXP_BITS): Pinch one bit to .. (struct real_value): Add decimal field. (real_format): Change table size, update documentation. (REAL_MODE_FORMAT): Update for to handle float, decimal float. (real_from_string3): Declare. (decimal_single_format): Declare. (decimal_double_format): Declare. (decimal_quad_format): Declare. (REAL_VALUE_TO_TARGET_DECIMAL32): New. (REAL_VALUE_TO_TARGET_DECIMAL64): New. (REAL_VALUE_TO_TARGET_DECIMAL128): New. * real.c: Include dfp.h. (normalize): Early return for decimal floats. (do_add): Zero decimal field. (do_compare): Call do_decimal_compare for decimal floats. (do_fix_trunc): Likewise, call decimal_do_fix_trunc. (real_arithmetic): Call decimal_real_arithmetic for decimal floating point operands. (real_identical): If a and b are of differing radix, return false. (real_to_integer): Call decimal_real_to_integer if the value is a decimal float. (real_to_integer2): Likewise, call decimal_real_to_integer2. (real_to_decimal): Likewise, call decimal_real_to_decimal. (real_to_hexadecimal): Place "N/A" in the return string for decimal float. (real_from_string3): New variant, given a mode. (real_maxval): Use decimal_real_maxval for decimal floats. (round_for_format): Use decimal_round_for_format for decimals. (real_convert): Use decimal_real_convert where appropriate. (significand_size): Handle base 10. (encode_decimal_single, decode_decimal_single, encode_decimal_double, decode_decimal_double, encode_decimal_quad, decode_decimal_quad): New functions. (decimal_single_format): New. (decimal_double_format): New. (decimal_quad_format): New. * machmode.def: Add SD, DD and TD decimal floating point modes. * machmode.h (FLOAT_MODE_P, SCALAR_FLOAT_MODE_P, MODES_WIDEN_P): Include MODE_DECIMAL_FLOAT. (DECIMAL_FLOAT_MODE_P): New. * mode-classes.def (MODE_DECIMAL_FLOAT): New mode class. * genmodes.c (struct mode_data): Add counter field. (struct mode_data): Update comment for format. (blank_mode): Initialise counter field. (new_mode): Increment counter field for each mode defined. (complete_mode): Handle MODE_DECIMAL_FLOAT, update check for mode using a format. (make_complex_modes): Handle modes containing `D'. (DECIMAL_FLOAT_MODE, FRACTIONAL_DECIMAL_FLOAT_MODE): New. (make_decimal_float_mode): New. (reset_float_format): Handle MODE_DECIMAL_FLOAT. (cmp_modes): Compare counter field if other characteristics similar. (emit_real_format_for_mode): Support formats for decimal floats. * doc/rtl.texi (Machine Modes): Document SD, DD and TDmodes. Document MODE_DECIMAL_FLOAT. Co-Authored-By: Ben Elliston <bje@au.ibm.com> Co-Authored-By: David Edelsohn <dje@watson.ibm.com> Co-Authored-By: Janis Johnson <janis187@us.ibm.com> From-SVN: r107861
2005-08-01Makefile.in (RTL_BASE_H): Add real.h.Ian Lance Taylor1-1/+1
* Makefile.in (RTL_BASE_H): Add real.h. * real.h (REAL_VALUE_FROM_CONST_DOUBLE): Use structure copy instead of memcpy. * emit-rtl.c (const_double_from_real_value): Likewise; use rtx.u.rv directly. * rtl.c (rtl_check_failed_code_mode): New. * rtl.h (struct rtx_def): Add u.rv. (XCMWINT, XCNMPRV): New. (CONST_DOUBLE_LOW, CONST_DOUBLE_HIGH): Use XCMWINT. (CONST_DOUBLE_REAL_VALUE): Use XCNMPRV; constify. Co-Authored-By: Richard Henderson <rth@redhat.com> From-SVN: r102643
2005-06-25Update FSF address.Kelley Cook1-2/+2
From-SVN: r101317
2005-03-15real.h (struct real_format): Split the signbit field into two two fields, ↵Roger Sayle1-2/+7
signbit_ro and signbit_rw. * real.h (struct real_format): Split the signbit field into two two fields, signbit_ro and signbit_rw. * real.c (ieee_single_format, mips_single_format, ieee_double_format, mips_double_format, ieee_extended_motorola_format, ieee_extended_intel_96_format, ieee_extended_intel_96_round_53_format, ieee_extended_intel_128_format, ibm_extended_format, mips_extended_format, ieee_quad_format, mips_quad_format, vax_f_format, vax_d_format, vax_g_format, i370_single_format, i370_double_format, c4x_single_format, c4x_extended_format, real_internal_format): Update initializers for new field. * builtins.c (expand_builtin_signbit): Use signbit_ro field of the real_format structure. * optabs.c (expand_absneg_bit, expand_copysign): Use signbit_rw field of the real_format structure. From-SVN: r96471
2005-02-03re PR middle-end/19405 (18_support/numeric_limits.cc fails on ppc-darwin ↵Roger Sayle1-0/+6
(long doubles)) PR middle-end/19405 * real.h (REAL_MODE_FORMAT_COMPOSITE_P): New macro. * fold-const.c (const_binop): Avoid constant folding floating point operations in modes that use composite representations. * simplify-rtx.c (simplify_binary_operation): Likewise. From-SVN: r94653
2005-01-22cfganal.c, [...]: Update copyright.Kazu Hirata1-1/+1
* cfganal.c, real.h, reorg.c, timevar.def, tree-ssa-ccp.c, config/alpha/alpha-protos.h, config/alpha/alpha.h, config/alpha/alpha.md, config/alpha/predicates.md, config/sparc/freebsd.h, config/sparc/netbsd-elf.h, config/sparc/sol2.h: Update copyright. From-SVN: r94064
2005-01-21re PR rtl-optimization/576 (gcc performs invalid optimization with float ↵Roger Sayle1-1/+1
operations when different rounding mode.) PR rtl-optimization/576 * real.c (real_arithmetic): Change return type from void to bool to return an indication that the result may be inexact. * real.h (real_arithmeric): Update prototype. * fold-const.c (const_binop): Don't constant fold floating point expressions when the user specifies -frounding-math and the result may depend upon the run-time rounding mode. (fold_convert_const_real_from_real): Clean-up. (fold_initializer): Ignore flag_rounding_math for initializers. * simplify-rtx.c (simplify_binary_operation): Likewise, don't constant fold FP operations with flag_rounding_math if the result may depend upon the run-time rounding mode. From-SVN: r94020
2004-07-25c-common.c: Rename all identifiers named `class' to `cl'.Bernardo Innocenti1-1/+1
* c-common.c: Rename all identifiers named `class' to `cl'. * c-decl.c: Likewise. * c-common.h: Likewise. * c-parse.in: Likewise. * c-typeck.c: Likewise. * genmodes.c: Likewise. * real.c: Likewise. * real.h: Likewise. * recog.c: Likewise. * recog.h: Likewise. * regrename.c: Likewise. * tree.h: Likewise. From-SVN: r85153
2004-06-07real.c (real_copysign): New function to implement libm's copysign.Roger Sayle1-0/+3
* real.c (real_copysign): New function to implement libm's copysign. * real.h (real_copysign): Prototype here. * fold-const.c (tree_expr_nonnegative_p): The result of sqrt, sqrtf and sqrtl can be negative, as sqrt(-0.0) = -0.0. Correct whitespace. * builtins.c (fold_builtin_isascii, fold_builtin_toascii, fold_builtin_isdigit): Add function prototypes. (fold_builtin_copysign): New function to fold copysign, copysignf and copysignl. Optimize copysign(x,x) as x. Evaluate copysign of constant arguments at compile-time using real_copysign. Fold copysign(X,Y) as fabs(X) if Y is always non-negative. (fold_builtin_1): Correct minor whitespace/style issues. Call fold_builtin_copysign for BUILT_IN_COPYSIGN{,F,L}. * gcc.dg/builtins-41.c: New test case. * gcc.dg/builtins-42.c: New test case. From-SVN: r82721
2004-03-22real.h (struct real_value): Use the same type for all bitfields.Alexandre Oliva1-2/+11
* real.h (struct real_value): Use the same type for all bitfields. Rename exp to uexp. (REAL_EXP, SET_REAL_EXP): New accessor macros for uexp. Adjust all uses of exp... * builtins.c: ... here, ... * emit-rtl.c: ... here, and ... * real.c: ... and here. From-SVN: r79802
2004-01-23real.c (real_floor, real_ceil): Tweak to allow input and output arguments to ↵Roger Sayle1-1/+3
overlap. * real.c (real_floor, real_ceil): Tweak to allow input and output arguments to overlap. (real_round): New function to implement round(3m) semantics. * real.h (real_round): Prototype here. * builtins.c (fold_builtin_round): New function to constant fold round, roundf and roundl. (fold_builtin): Call fold_builtin_round for BUILT_IN_ROUND{,F,L}. * gcc.dg/builtins-29.c: New test case. From-SVN: r76428
2003-10-10genmodes.c, [...]: New files.Zack Weinberg1-2/+3
* genmodes.c, mode-classes.def: New files. * machmode.def: Rewritten to genmodes.c interface. * Makefile.in (extra_modes_file): New substitution variable. (MACHMODE_H): No longer includes machmode.def or @extra_modes_file@; instead, mode-classes.def and insn-modes.h. (BUILD_RTL): Add $(BUILD_PREFIX)insn-modes.o. (OBJS-common): Add insn-modes.o. (STAGESTUFF): Add insn-modes.c, insn-modes.h, s-modes, and genmodes$(build_exeext). (insn-modes.o, insn-modes.c, insn-modes.h, s-modes, genmodes.o, genmodes$(build_exeext), $(BUILD_PREFIX_1)insn-modes.o): New targets. (s-genrtl): Don't depend on $(RTL_BASE_H). (gengenrtl.o): Don't depend on coretypes.h, $(GTM_H), real.h, or $(RTL_BASE_H); just rtl.def. * gengenrtl.c: Don't include coretypes.h, tm.h, rtl.h, or real.h. Give fake definition of CONST_DOUBLE_FORMAT and substitute definition of NUM_RTX_CODE. Add casts to avoid warnings. * machmode.h: Include insn-modes.h, not machmode.def. Include mode-classes.def to define enum mode_class. Tweak definitions of GET_MODE_CLASS, GET_MODE_SIZE, GET_MODE_BITSIZE, GET_MODE_MASK, GET_MODE_INNER, GET_MODE_WIDER_MODE, GET_CLASS_NARROWEST_MODE. (inner_mode_array): Renamed mode_inner. (mode_base_align): New. * rtl.c (mode_name, mode_class, mode_bitsize, mode_size, mode_unit_size, mode_wider_mode, mode_mask_array, inner_mode_array, class_narrowest_mode): Delete definitions. * stor-layout.c (get_mode_alignment): Use mode_base_align. * real.h: Use MIN_MODE_FLOAT and MAX_MODE_FLOAT, not QFmode and TFmode, in real_format_for_mode and REAL_MODE_FORMAT. * config/ip2k/ip2k.h, config/iq2000/iq2000.h: No need to define BITS_PER_UNIT. From-SVN: r72313
2003-10-06real.h (REAL_MODE_FORMAT): New macro.Zack Weinberg1-0/+1
* real.h (REAL_MODE_FORMAT): New macro. * c-cppbuiltin.c, optabs.c, real.c, config/alpha/alpha.c * config/c4x/c4x.c, config/i370/i370.c, config/i386/freebsd.h * config/i386/i386.c, config/i960/i960.c, config/ia64/ia64.c * config/m68k/m68k.c, config/mips/mips.c, config/rs6000/rs6000.c * config/vax/vax.c: Use REAL_MODE_FORMAT instead of referring directly to real_format_for_mode array, wherever possible. From-SVN: r72168
2003-09-11builtins.c (builtin_dconsts_init, [...]): Delete.Kaveh R. Ghazi1-0/+2
* builtins.c (builtin_dconsts_init, dconstpi, dconste, init_builtin_dconsts): Delete. * emit-rtl.c (dconstpi, dconste): Define. (init_emit_once): Initialize dconstpi & dconste. * real.h (dconstpi, dconste): Declare. From-SVN: r71320
2003-09-09builtins.c (real_dconstp, [...]): New, split out from fold_builtin.Kaveh R. Ghazi1-1/+4
* builtins.c (real_dconstp, fold_builtin_logarithm, fold_builtin_exponent): New, split out from fold_builtin. Also generalize to add log2, log10, exp2 and exp10/pow10 equivalents. * emit-rtl.c (dconst3, dconst10, dconstthird): New. (init_emit_once): Initialize new dconsts, use ARRAY_SIZE in lieu of hardcoded array size. * fold-const.c (fold): Add cases for exp2, exp10 and pow10. (tree_expr_nonnegative_p): Likewise. * real.h (dconst3, dconst10, dconstthird): New. testsuite: * gcc.dg/torture/builtin-explog-1.c: New testcase. From-SVN: r71252
2003-07-10ggc.h, [...]: Use `rtx' instead of `struct rtx_def *'...Steven Bosscher1-1/+1
2003-07-10 Steven Bosscher <steven@gcc.gnu.org> * ggc.h, integrate.h, langhooks.h, real.h, toplev.h: Use `rtx' instead of `struct rtx_def *', `rtvec' instead of `struct rtvec_dev *' and `tree' instead of `union tree_node *' in function prototypes. * varray.h (const_equiv_data): Likewise for fields. (varray_data_tag): Likewise. * output.h: Likewise, and don't forward declare union tree_node. * emit_rtl.c (const_int_htab_hash): Cast to `rtx' instead of `struct rtxvec *'. * print-tree.c (print_node): Likewise. * reload1.c: Don't redeclare current_function_decl, tree.h is included in this file. From-SVN: r69183
2003-07-06jump.c: Convert prototypes to ISO C90.Andreas Jaeger1-79/+59
* jump.c: Convert prototypes to ISO C90. * langhooks-def.h: Likewise. Add extern to prototypes. * langhooks.c: Likewise. * langhooks.h: Likewise. * lcm.c: Likewise. * local-alloc.c: Likewise. * loop-init.c: Likewise. * loop-unroll.c: Likewise. * loop-unswitch.c: Likewise. * loop.c: Likewise. * loop.h: Likewise. Add extern to prototypes. * machmode.h: Likewise. * main.c: Likewise. * mbchar.c: Likewise. * mbchar.h: Likewise. * mkdeps.c: Likewise. * mkdeps.h: Likewise. * optabs.c: Likewise. * optabs.h: Likewise. * output.h: Likewise. * gccspec.c: Likwise. * postreload.c: Likewise. * prefix.c: Likewise. * prefix.h: Likewise. * print-rtl.c: Likewise. * print-tree.c: Likewise. * profile.c: Likewise. * read-rtl.c: Likewise. * real.c: Likewise. * real.h: Likewise. * recog.c: Likewise. * recog.h: Likewise. * reg-stack.c: Likewise. * regclass.c: Likewise. * regmove.c: Likewise. * regrename.c: Likewise. * regs.h: Likewise. * reload.c: Likewise. * reload.h: Likewise. * reload1.c: Likewise. * reorg.c: Likewise. * resource.c: Likewise. * resource.h: Likewise. * rtl-error.c: Likewise. * rtl.c: Likewise. * rtl.h: Likewise. * rtlanal.c: Likewise. From-SVN: r68998
2003-07-03real.c (real_trunc, [...]): New functions to implement trunc, floor and ceil ↵Roger Sayle1-0/+11
respectively. * real.c (real_trunc, real_floor, real_ceil): New functions to implement trunc, floor and ceil respectively. * real.h (real_trunc, real_floor, real_ceil): Prototype here. * builtins.c (integer_valued_real_p): New function to test if a floating point expression has an integer valued result. (fold_trunc_transparent_mathfn): Optimize foo(foo(x)) as foo(x) where foo is an integer rounding function. Similarly, optimize foo(bar(x)) as bar(x), and foo((double)(int)x) as (double)(int)x when both foo and bar are integer rounding functions and we don't need to honor errno. (fold_builtin_trunc, fold_builtin_floor, fold_builtin_ceil): New functions to fold trunc, floor and ceil. (fold_builtin): Use fold_builtin_trunc to fold BUILT_IN_TRUNC*, fold_builtin_floor to fold BUILT_IN_FLOOR* and fold_builtin_ceil to fold BUILT_IN_CEIL*. * fold-const.c (tree_expr_nonnegative_p): Handle FLOAT_EXPR and the remaining integer rounding functions. * gcc.dg/builtins-25.c: New testcase. * gcc.dg/builtins-26.c: New testcase. From-SVN: r68903
2003-06-25real.h (ieee_extended_intel_96_round_53_format): New.Richard Henderson1-0/+1
* real.h (ieee_extended_intel_96_round_53_format): New. * real.c (ieee_extended_intel_96_round_53_format): New. * config/i386/freebsd.h (SUBTARGET_OVERRIDE_OPTIONS): Use it for XFmode and TFmode. From-SVN: r68445
2003-06-23basic-block.h: Fix comment formatting.Kazu Hirata1-1/+1
* basic-block.h: Fix comment formatting. * bt-load.c: Likewise. * builtins.c: Likewise. * c-common.c: Likewise. * c-common.h: Likewise. * c-format.c: Likewise. * coverage.c: Likewise. * cpplib.h: Likewise. * cpppch.c: Likewise. * dbxout.c: Likewise. * diagnostic.c: Likewise. * dwarf2out.c: Likewise. * expr.c: Likewise. * fold-const.c: Likewise. * function.c: Likewise. * gcc.c: Likewise. * gcov-io.c: Likewise. * gcov-io.h: Likewise. * gcov.c: Likewise. * profile.c: Likewise. * real.h: Likewise. * sched-deps.c: Likewise. From-SVN: r68369
2003-05-23real.c (real_maxval): New function to return the largest finite value ↵Roger Sayle1-0/+3
representable in a given mode (i.e. * real.c (real_maxval): New function to return the largest finite value representable in a given mode (i.e. FLT_MAX and DBL_MAX). * real.h (real_maxval): Prototype here. * fold-const.c (fold_inf_compare): Transform comparisons against +-Infinity into comparisons against DBL_MAX (or equivalent). * gcc.c-torture/execute/ieee/inf-2.c: New test case. From-SVN: r67112
2003-05-06real.c (real_powi): New function to calculate the value of a real raised to ↵Roger Sayle1-0/+6
an integer power, i.e. * real.c (real_powi): New function to calculate the value of a real raised to an integer power, i.e. pow(x,n) for int n. (real_sqrt): Convert to using the faster do_add, do_multiply and do_divide API for consistency with the rest of real.c. * real.h (real_powi): Prototype here. * builtins.c (fold_builtin): Avoid local variable mode when evaluating sqrt at compile time. Attempt to evaluate pow at compile-time, by checking for an integral exponent. * gcc.dg/builtins-14.c: New test case. From-SVN: r66515
2003-04-01real.h (EXP_BITS): Make room for...Alexandre Oliva1-1/+9
* real.h (EXP_BITS): Make room for... (struct real_value): ... added canonical bit. (struct real_format): Added pnan. (mips_single_format, mips_double_format, mips_extended_format, mips_quad_format): New. * real.c: Copy p to pnan in all formats. (get_canonical_qnan, get_canonical_snan): Set canonical bit. (real_nan): Use pnan to compute significand's shift. (real_identical): Disregard significand in canonical NaNs. (real_hash): Likewise. Take signalling into account. (encode_ieee_single, encode_ieee_double, encode_ieee_quad): Disregard significand bits in canonical NaNs. Set all bits of canonical NaN if !qnan_msb_set. (encode_ibm_extended, decode_ibm_extended): Likewise. Use qnan_msb_set to tell the base double format. (ibm_extended_format): Use 53 as pnan. (mips_single_format, mips_double_format, mips_extended_format, mips_quad_format): Copied from the corresponding ieee/ibm formats, with qnan_msb_set false. * config/mips/iris6.h (MIPS_TFMODE_FORMAT): Use mips_extended_format. * config/mips/linux64.h (MIPS_TFMODE_FORMAT): Use mips_quad_format. * config/mips/mips.c (override_options): Use mips_single_format and mips_double_format. Default TFmode to mips_quad_format. * config/mips/t-linux64 (tp-bit.c): Define QUIET_NAN_NEGATED. * config/mips/t-irix6: Likewise. * config/mips/t-mips (fp-bit.c, dp-bit.c): Likewise. * config/fp-bit.c (pack_d, unpack_d): Obey it. From-SVN: r65146
2003-03-31emit-rtl.c (dconstm2, dconsthalf): New real constants.Roger Sayle1-1/+3
* emit-rtl.c (dconstm2, dconsthalf): New real constants. (init_emit_once): Initialize dconstm2 and dconsthalf here. * real.h (dconstm2, dconsthalf): Add prototypes here. * real.c (real_sqrt): Use dconsthalf rather than local copy. * builtins.c (fold_builtin): When optimizing sqrt(exp(x)) as exp(x/2.0) remember to fold the division if possible. Fold sin(0.0) as 0.0, cos(0.0) as 1.0, pow(x,1.0) as x, pow(x,-1.0) as 1.0/x, pow(x,2.0) as x*x, pow(x,-2.0) as 1.0/(x*x) and pow(x,0.5) as sqrt(x). * gcc.dg/builtins-3.c: Add new tests for sin and cos. * gcc.dg/builtins-7.c: New test case. * gcc.dg/builtins-8.c: New test case. From-SVN: r65088
2003-03-27real.h (struct real_value): Add signalling.Richard Henderson1-1/+2
* real.h (struct real_value): Add signalling. (EXP_BITS): Decrement. * real.c (get_canonical_qnan): Don't set MSB-1. (get_canonical_snan): Likewise. Set signalling. (real_identical): Compare signalling. (round_for_format): Remove force-one-bit on code. (real_nan): Likewise. Set signalling. (encode_ieee_single): Add force-one-bit code; honor signalling. (encode_ieee_double, encode_ieee_extended, encode_ieee_quad): Likewise. (decode_ieee_single): Set signalling. (decode_ieee_double, decode_ieee_extended, decode_ieee_quad): Likewise. From-SVN: r64935
2003-01-15real.c (real_sqrt): Return a bool result indicating whether a floating point ↵Roger Sayle1-3/+3
exception or trap... * real.c (real_sqrt): Return a bool result indicating whether a floating point exception or trap should be raised. * real.h (real_sqrt): Update function prototype. * builtins.c (fold_builtin): Only fold non-trapping square roots unless we're ignoring errno and trapping math. From-SVN: r61337
2002-12-16Merge basic-improvements-branch to trunkZack Weinberg1-0/+7
From-SVN: r60174
2002-10-21real.c (sticky_rshift_significand): Return inexact, don't or it in immediately.Richard Henderson1-0/+1
* real.c (sticky_rshift_significand): Return inexact, don't or it in immediately. (sub_significands): Accept incomming carry. (div_significands, rtd_divmod): Update for sub_significands change. (round_for_format): Update for sticky_rshift_significand change. (do_add): Don't involve the inexact bit in addition, do give the inexact bit as the subtraction carry-in. (encode_internal, decode_internal, real_internal_format): New. * real.h (real_internal_format): Declare. From-SVN: r58396
2002-10-15real.c (real_to_decimal): Accept BUF_SIZE and CROP_TRAILING_ZEROS as arguments.Richard Henderson1-5/+2
gcc/ * real.c (real_to_decimal): Accept BUF_SIZE and CROP_TRAILING_ZEROS as arguments. Bound DIGITS by the available buffer size. (real_to_hexadecimal): Likewise. * real.h (real_to_decimal, real_to_hexadecimal): Update prototypes. (REAL_VALUE_TO_DECIMAL): Remove. * c-common.c, c-pretty-print.c, print-rtl.c, print-tree.c, sched-vis.c, config/arc/arc.c, config/c4x/c4x.c, config/fr30/fr30.c, config/i370/i370.h, config/i386/i386.c, config/i960/i960.c, config/ip2k/ip2k.c, config/m32r/m32r.c, config/m68hc11/m68hc11.c, config/m68k/hp320.h, config/m68k/m68k.h, config/m68k/sun2o4.h, config/m68k/sun3.h, config/mips/mips.c, config/ns32k/ns32k.c, config/pdp11/pdp11.h, config/vax/vax.h: Update all callers to use real_to_decimal directly, and with the proper arguments. * doc/tm.texi (REAL_VALUE_TO_DECIMAL): Remove. gcc/cp/ * error.c (dump_expr): Use real_to_decimal directly, and with the new arguments. gcc/f/ * target.h (ffetarget_print_real1, ffetarget_print_real2): Use real_to_decimal directly, and with the new arguments. From-SVN: r58187
2002-10-11cfganal.c (dfs_enumerate_from): Use PARAMS.John David Anglin1-2/+4
* cfganal.c (dfs_enumerate_from): Use PARAMS. * genautomata.c (output_insn_code_cases): Likewise. * real.c (real_format): Likewise. * tree.c (tree_size): Revise expressions using TREE_CODE_LENGTH to ensure value is promoted before doing subtraction. From-SVN: r58064