Commit Graph

119 Commits

Author SHA1 Message Date
Joseph Myers 8d8da22788 MAINTAINERS (c4x port): Remove.
* 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
2008-01-25 20:49:04 +00:00
Janis Johnson 6ef9a246ce Reapply reverted change:
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-07 16:42:48 +00:00
Janis Johnson fcde2932c1 Revert:
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-06 17:15:55 +00:00
Janis Johnson be677dc12a optabs.c (expand_float): Convert unsigned integer as signed only if it 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-09-05 22:16:33 +00:00
Nick Clifton 9dcd6f09a3 Change copyright header to refer to version 3 of the GNU General Public License and to point readers at the COPYING3 file and the FSF's license web page.
From-SVN: r126948
2007-07-26 08:37:01 +00:00
Kaveh R. Ghazi 9566a75938 expr.c (handled_component_p): Constify.
* 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-25 18:43:25 +00:00
Kaveh R. Ghazi 7faa1bbb5d re PR target/30652 (SSE expansion is missing for isinf() and other 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-07-18 17:30:38 +00:00
Kaveh R. Ghazi 4c8c70e06a real.c (real_isfinite): New.
* real.c (real_isfinite): New.
	(real_sqrt): Use it.
	* real.h (real_isfinite): New.
	* builtins.c: Use it.

From-SVN: r125654
2007-06-12 18:36:05 +00:00
Andreas Schwab b6a9c30c80 m68k.c (override_options): Don't override REAL_MODE_FORMAT.
* 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-06-03 14:32:43 +00:00
Andreas Krebbel 4d8a8a0a22 defaults.h (IBM_FLOAT_FORMAT): Macro definition removed.
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-05-21 12:53:08 +00:00
Brooks Moses 205a4d09ca real.c (mpfr_from_real): Handle Inf and NaN, and allow the rounding mode to 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-04-24 19:12:47 -07:00
Manuel López-Ibáñez 92ef5cf999 re PR other/23572 (No warning for assigning a value to a 'float' variable 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-03-22 23:04:24 +00:00
Kaveh R. Ghazi b86a760aed emit-rtl.c (dconstpi): Delete.
* 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-02-03 20:49:51 +00:00
Richard Sandiford 58145e4deb real.h (real_format): Add a canonical_nan_lsbs_set field.
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
2007-01-18 19:45:13 +00:00
Manuel López-Ibáñez 313f234ba1 real.h (real_isinteger): Declare.
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-11-23 18:49:22 +00:00
Kaveh R. Ghazi 1f3f1f6827 re PR middle-end/29335 (transcendental functions with constant arguments 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
2006-10-23 20:24:55 +00:00
Jon Grimm 909e225622 dfp.h, dfp.c: New files.
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-12-02 13:30:42 +11:00
Ian Lance Taylor 9e254451d2 Makefile.in (RTL_BASE_H): Add real.h.
* 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-08-01 14:16:31 -07:00
Kelley Cook 366ccddb2b Update FSF address.
From-SVN: r101317
2005-06-25 02:02:01 +00:00
Roger Sayle b87a020620 real.h (struct real_format): Split the signbit field into two two fields, 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-03-15 04:24:02 +00:00
Roger Sayle 762297d941 re PR middle-end/19405 (18_support/numeric_limits.cc fails on ppc-darwin (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-02-03 06:44:35 +00:00
Kazu Hirata 1e052c19d5 cfganal.c, [...]: Update copyright.
* 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-22 12:53:25 +00:00
Roger Sayle d284eb28eb re PR rtl-optimization/576 (gcc performs invalid optimization with float 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
2005-01-21 17:54:26 +00:00
Bernardo Innocenti e3a64162f5 c-common.c: Rename all identifiers named `class' to `cl'.
* 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-07-25 19:57:24 +02:00
Roger Sayle 67057c537b real.c (real_copysign): New function to implement libm's copysign.
* 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-06-07 20:50:14 +00:00
Alexandre Oliva 1e92bbb907 real.h (struct real_value): Use the same type for all bitfields.
* 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-03-22 00:40:44 +00:00
Roger Sayle 25348c94e7 real.c (real_floor, real_ceil): Tweak to allow input and output arguments to 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
2004-01-23 16:16:33 +00:00
Zack Weinberg 0974c7d70d genmodes.c, [...]: New files.
* 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-10 20:33:07 +00:00
Zack Weinberg 70a01792d8 real.h (REAL_MODE_FORMAT): New macro.
* 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-10-06 22:47:32 +00:00
Kaveh R. Ghazi ab01a87cbc builtins.c (builtin_dconsts_init, [...]): Delete.
* 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-11 21:40:41 +00:00
Kaveh R. Ghazi f7657db990 builtins.c (real_dconstp, [...]): New, split out from fold_builtin.
* 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-09-09 22:10:32 +00:00
Steven Bosscher bcda12f4f4 ggc.h, [...]: Use `rtx' instead of `struct rtx_def *'...
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-10 11:38:18 +00:00
Andreas Jaeger 0c20a65f04 jump.c: Convert prototypes to ISO C90.
* 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-06 11:56:09 +02:00
Roger Sayle 0a9530a9d7 real.c (real_trunc, [...]): New functions to implement trunc, floor and ceil 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-07-03 21:38:55 +00:00
Richard Henderson bfa0c51930 real.h (ieee_extended_intel_96_round_53_format): New.
* 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-25 00:11:33 +00:00
Kazu Hirata 71c0e7fc96 basic-block.h: Fix comment formatting.
* 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-06-23 15:27:37 +00:00
Roger Sayle 18c2511ccb real.c (real_maxval): New function to return the largest finite value 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-23 03:46:53 +00:00
Roger Sayle e82a312b55 real.c (real_powi): New function to calculate the value of a real raised to 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-05-06 03:14:10 +00:00
Alexandre Oliva fe0002ee9d real.h (EXP_BITS): Make room for...
* 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-04-01 21:45:28 +00:00
Roger Sayle 03f2ea9356 emit-rtl.c (dconstm2, dconsthalf): New real constants.
* 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-31 14:30:29 +00:00
Richard Henderson ad59ba209d real.h (struct real_value): Add signalling.
* 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-03-27 14:42:02 -08:00
Roger Sayle 03cd8aba32 real.c (real_sqrt): Return a bool result indicating whether a floating point 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
2003-01-15 17:40:26 +00:00
Zack Weinberg 4977bab6ed Merge basic-improvements-branch to trunk
From-SVN: r60174
2002-12-16 18:23:00 +00:00
Richard Henderson 5e26e5a278 real.c (sticky_rshift_significand): Return inexact, don't or it in immediately.
* 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-21 17:17:15 -07:00
Richard Henderson da6eec72f5 real.c (real_to_decimal): Accept BUF_SIZE and CROP_TRAILING_ZEROS as arguments.
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-15 17:40:39 -07:00
John David Anglin a0bed689af cfganal.c (dfs_enumerate_from): Use PARAMS.
* 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
2002-10-11 21:10:00 +00:00
Richard Henderson ee6ff31927 real.h (SIGNIFICAND_BITS): Add one more word.
* real.h (SIGNIFICAND_BITS): Add one more word.
        (CONST_DOUBLE_FORMAT): Accomodate 6 words.
        * real.c (times_pten): New.
        (real_to_decimal, real_from_string): Use it.
        (sticky_rshift_significand): Use & to find modulus.
        (rshift_significand, lshift_significand): Likewise.
        (do_divide): Apply sticky bit after normalization.
        (real_to_decimal, real_to_hexadecimal): Fix sign of Inf and NaN.

From-SVN: r57811
2002-10-04 01:01:12 -07:00
Richard Henderson a751939354 * real.h (struct real_value): Use ENUM_BITFIELD.
From-SVN: r57796
2002-10-03 17:50:58 -07:00
David Edelsohn d454e75a29 real.h (ibm_extended_format): Declare.
* real.h (ibm_extended_format): Declare.
        * real.c (encode_ibm_extended, decode_ibm_extended): New
        functions.

From-SVN: r57633
2002-09-29 17:23:45 -04:00
Kaveh R. Ghazi 9fc63af58c * real.h (real_value): Make `exp' explicitly signed.
From-SVN: r57469
2002-09-24 13:13:35 +00:00