aboutsummaryrefslogtreecommitdiff
path: root/gcc/builtins.c
AgeCommit message (Collapse)AuthorFilesLines
2006-12-26re PR middle-end/29335 (transcendental functions with constant arguments ↵Kaveh R. Ghazi1-5/+17
should be resolved at compile-time) PR middle-end/29335 * builtins.c (do_mpfr_arg1, do_mpfr_arg2, do_mpfr_arg3, do_mpfr_sincos): Ensure target base equals two. From-SVN: r120211
2006-12-14re PR middle-end/30197 (cexp ( __complex__ ( 0, x ) ) can be folded to cexpi ↵Richard Guenther1-0/+64
(x)) 2006-12-14 Richard Guenther <rguenther@suse.de> PR tree-optimization/30197 * builtins.c (fold_builtin_cexp): New function to fold cexp to cexpi and exp parts. * tree-ssa-pre.c (try_combine_conversion): Also handle REALPART_EXPR and IMAGPART_EXPR. * gcc.c-torture/execute/complex-1.c: Fix function name. * gcc.dg/builtins-61.c: New testcase. From-SVN: r119860
2006-12-13builtins.c (expand_builtin_cexpi): Fix typo.Richard Guenther1-1/+1
2006-12-13 Richard Guenther <rguenther@suse.de> * builtins.c (expand_builtin_cexpi): Fix typo. From-SVN: r119834
2006-12-13re PR tree-optimization/17687 (sincos tree representation causes extra ↵Richard Guenther1-4/+130
addressable vars) 2006-12-13 Richard Guenther <rguenther@suse.de> PR tree-optimization/17687 * builtins.def (BUILT_IN_CEXPI, BUILT_IN_CEXPIF, BUILT_IN_CEXPIL): New builtins for imaginary argument cexp. * builtin-types.def (BT_FN_COMPLEX_FLOAT_FLOAT, BT_FN_COMPLEX_DOUBLE_DOUBLE, BT_FN_COMPLEX_LONGDOUBLE_LONGDOUBLE): New required builtin types. * builtins.c (expand_builtin_cexpi): Declare. (mathfn_built_in): Handle BUILT_IN_CEXPI. (expand_builtin_cexpi): New static helper. (expand_builtin): Call it. (do_mpfr_sincos): Adjust for CEXPI evaluation. (fold_builtin_sincos): New function to fold sincos to cepxi. * gcc.dg/builtins-59.c: New testcase. From-SVN: r119824
2006-12-11value-prof.c (tree_stringops_transform): New.Jan Hubicka1-6/+3
* value-prof.c (tree_stringops_transform): New. (tree_value_profile_transformations): Require count to be non-zero; call stringop transform; reset stmt BSI after BB changed. (tree_divmod_fixed_value, tree_mod_pow2): Don't emit unnecesary label. (interesting_stringop_to_profile_p, tree_stringop_fixed_value): New. (tree_stringops_values_to_profile): New. (tree_values_to_profile): Call tree_stringops_values_to_profile. * tree.h (build_string_literal): Tidy prototype. (validate_arglist, builtin_memset_read_str, get_pointer_alignment): Declare. * builtins.c (validate_arglist, builtin_memset_read_str, get_pointer_alignment): Export. From-SVN: r119735
2006-12-07builtins.c (expand_builtin_pow): Adjust predicates for pow to cbrt expansion ↵Richard Guenther1-3/+8
to unsafe math and !HONOR_NANS for... 2006-12-07 Richard Guenther <rguenther@suse.de> * builtins.c (expand_builtin_pow): Adjust predicates for pow to cbrt expansion to unsafe math and !HONOR_NANS for negative base. From-SVN: r119622
2006-12-05Merge gimple-tuples-branch into mainline.Aldy Hernandez1-12/+14
From-SVN: r119546
2006-12-04cp-objcp-common.c (cp_expr_size): Return NULL in the case size is undefined.Jan Hubicka1-2/+6
* cp-objcp-common.c (cp_expr_size): Return NULL in the case size is undefined. * builtins.c (fold_builtin_memory_op): Check that expr_size match. * explow.c (expr_size, int_expr_size): Assert that size is non_NULL. From-SVN: r119515
2006-12-02builtins.c, [...]: Fix comment typos.Kazu Hirata1-2/+2
* builtins.c, cfgloop.h, cgraph.h, config/arm/arm.c, config/i386/i386.c, config/i386/i386.h, config/mips/mips.h, config/rs6000/cell.md, config/rs6000/rs6000.c, config/sh/sh.c, config/sh/sh4-300.md, config/spu/spu-builtins.def, config/spu/spu-c.c, config/spu/spu-modes.def, config/spu/spu.c, config/spu/spu.md, config/spu/spu_internals.h, config/spu/vmx2spu.h, fold-const.c, fwprop.c, predict.c, tree-data-ref.h, tree-flow.h, tree-ssa-loop-manip.c, tree-ssa-loop-niter.c, tree-ssa-pre.c, tree-vect-analyze.c, tree-vect-transform.c, tree-vectorizer.c, tree-vrp.c: Fix comment typos. Follow spelling conventions. From-SVN: r119442
2006-11-30re PR middle-end/30028 (bcopy is wrongly converted to memcpy)Jan Hubicka1-1/+1
PR middle-end/30028 * builtins.c (fold_builtin_memory_op): Fix typo in the check for memmove/bcopy->memcpy conversion. From-SVN: r119375
2006-11-28Privatize SSA variables into gimple_df.Jan Hubicka1-1/+1
* 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): New accessors. (first_referenced_var): Update. (mark_stmt_modified): Update. (is_call_clobbered): Update. (mark_call_clobbered): Update. (clear_call_clobbered): Update. (mark_non_addressable): Update. * tree-vrp.c (get_value_range): Update. * tree-into-ssa.c (in_ssa_p): Kill. (get_default_def_for): Update. (rewrite_into_ssa): Update. * tree-complex.c (init_parameter_lattice_values): Update. (update_complex_assignment): Update. (update_parameter_components): Update. (expand_complex_libcall): Update. (expand_complex_operations_1): Update. * tree-tailcall.c (arg_needs_copy_p): Update. (add_virtual_phis): Update. (tree_optimize_tail_calls_1): Update. * tree-ssa-dse.c (memory_ssa_name_same): Update. * tree-ssa-copyrename.c (copy_rename_partition_coalesce): Update. * tree-ssa-math-opts.c (execute_cse_reciprocals): Update. * tree-ssa-propagate.c (set_rhs): Update. * tree-ssa-alias.c (aliases_computed_p, call_clobbered_vars, addressable_vars, global_var):Kill. (set_initial_properties): Update. (init_alias_info): Update. (finalize_ref_all_pointers): Update. (setup_pointers_and_addressables): Update. (maybe_create_global_var): Update. (create_global_var): Update. (dump_points_to_info): Update. * function.h (struct gimple_df): Forward declare. (struct function): Add GIMPLE_DF field. * gimplify.c (force_gimple_operand): Update. * tree-dfa.c (referenced_vars, default_defs): KIll. (make_rename_temp): Update. (dump_variable): Update. (referenced_var_lookup): Update. (referenced_var_check_and_insert): Update. (default_def): Rename to ... (gimple_default_def): ... this one; accept cfun argument. (set_default_def): Update. * tree-cfgcleanup.c (modified_noreturn_calls): Kill. (cleanup_control_flow): Update. * tree-ssa-pre.c (compute_avail): Update * tree-ssa-live.c (calculate_live_on_entry): Update. * tree-ssa.c (verify_use): Update. (verify_call_clobbering): Update. (verify_call_clobbering): Update. (init_tree_ssa): Update. (delete_tree_ssa): Update. * tree-outof-ssa.c (coalesce_ssa_name): Update. (rewrite_out_of_ssa): Update. * tree-flow.h (gimple_df): New structure collecting dataflow variables. (FREE_SSANAMES, SSANAMES, MODIFIED_NORETURN_CALLS, DEFAULT_DEFS): New private accessors. (in_ssa_p, modified_noreturn_calls, referenced_vars, default_defs, ssa_names, global_var, nonlocal_all, call_clobbered_vars, addressable_vars, aliases_computed_p): Kill. (default_def): Rename to... (gimple_default_def): ... this one. (defaule_def_fn): Kill. (num_referenced_vars, ssa_names, num_ssa_names): Update. * tree-ssa-structalias.c (nonlocal_all): Kill. (get_constraint_exp_from_ssa_var): Update. (create_nonlocal_var): Update. (get_constraint_for): Update. (update_alias_info): Update. (find_global_initializers): Update. (intra_create_variable_infos): Update. (intra_create_variable_infos): (find_what_p_points_to): Update. (init_alias_heapvars): Update. * tree-cfg.c (remove_bb): Update. (gimplify_val): Update. * tree-ssa-reassoc.c (get_rank): Update. (init_reassoc): Update. * tree-ssanames.c: Do not include gt-tree-ssanames.h (ssa_names, free_ssanames): Kill. (init_ssanames): Update. (make_ssa_name): Update. (release_ssa_name): Update. (release_defs): Update. (replace_ssa_name_symbol): Update. * tree-ssa-operands.c (access_can_touch_variable): Update. (add_virtual_operand): Update. (add_call_clobber_ops): Update. (add_call_read_ops): Update. (get_call_expr_operands): Update. (get_asm_expr_operands): Update. From-SVN: r119294
2006-11-28builtins.c: Include tree-flow.h.Jan Hubicka1-42/+50
* builtins.c: Include tree-flow.h. (fold_builtin_memory_op): Be more aggressive on converting memcpy to assignment; convert memmove to memcpy for sizes greater than 1 where alignment of operands prohibit the partial overlap. From-SVN: r119292
2006-11-27re PR fortran/25620 (Missed optimization with power)Richard Guenther1-23/+100
2006-11-27 Richard Guenther <rguenther@suse.de> PR middle-end/25620 * builtins.c (expand_builtin_pow): Optimize non integer valued constant exponents using sqrt or cbrt if possible. Always fall back to expanding via optabs. * gcc.target/i386/pow-1.c: New testcase. * gcc.dg/builtins-58.c: Likewise. From-SVN: r119248
2006-11-26builtins.c (fold_builtin_fmin_fmax): Handle NaN arguments.Kaveh R. Ghazi1-0/+14
* builtins.c (fold_builtin_fmin_fmax): Handle NaN arguments. testsuite: * gcc.dg/torture/builtin-minmax-1.c: Test NaN in fmin/fmax. Don't ever inline the testcase. From-SVN: r119224
2006-11-23real.h (real_isinteger): Declare.Manuel López-Ibáñez1-9/+1
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-18builtins.c (integer_valued_real_p): Handle fmin/fmax.Kaveh R. Ghazi1-10/+39
* builtins.c (integer_valued_real_p): Handle fmin/fmax. (fold_builtin_fmin_fmax): New. (fold_builtin_1): Use it. testsuite: * gcc.dg/builtins-20.c: Add fmin/fmax cases. * gcc.dg/torture/builtin-minmax-1.c: New. From-SVN: r118976
2006-11-12builtins.c (fold_builtin_cosh): New.Kaveh R. Ghazi1-4/+25
* builtins.c (fold_builtin_cosh): New. (fold_builtin_1): Use it. * fold-const.c (negate_mathfn_p): Add llround, lround, round, trunc to the list of "odd" functions. Also add llrint, lrint, rint and nearbyint when flag_rounding_math is false. testsuite: * gcc.dg/torture/builtin-symmetric-1.c: Add more cases. From-SVN: r118733
2006-11-11Oops, commited wrong variant of patch in last commit, this is the diffJan Hubicka1-1/+0
to correct one. From-SVN: r118698
2006-11-11extended.texi (__builtin_expect): We no longer require second argument to be ↵Jan Hubicka1-142/+5
constant. * extended.texi (__builtin_expect): We no longer require second argument to be constant. * gengtype.c (adjust_field_rtx_def): Drop NOTE_INSN_EXPECTED_VALUE. * builtins.c (expand_builtin_expect): Simplify. (expand_builtin_expect_jump): Kill. * final.c (final_scan_insn): Do not skip the removed notes. * insn-notes.def (LOOP_BEG, LOOP_END, REPEATED_LINE_NUMBER, EXPECTED_VALUE): Remove. * dojump.c (do_jump): Do not care about __builtin_expect. * predict.c (expected_value_to_br_prob): Kill. * function.c (expand_function_end): Do not expand NOTE_INSN_REPEATED_LINE_NUMBER. * print-rtl.c (print_rtx): Do not pretty print the removed notes. * expect.c (sjlj_emit_function_enter): Emit directly branch probability. * cfgexpand.c (add_reg_br_prob_note): Export. * cfgcleanup.c (rest_of_handle_jump2): Do not call expected_value_to_br_prob. * cfglayout.c (duplicate_insn_chain): Do not deal with removed notes. * rtl.h (add_reg_br_prob_note): Declare. From-SVN: r118696
2006-11-11builtins.c (fold_builtin_cos): Use fold_strip_sign_ops().Kaveh R. Ghazi1-19/+12
* builtins.c (fold_builtin_cos): Use fold_strip_sign_ops(). (fold_builtin_hypot): Likewise. * fold-const.c (fold_strip_sign_ops): Handle "odd" builtins. testsuite: * gcc.dg/builtins-20.c: Add more cases for stripping sign ops. From-SVN: r118683
2006-11-10builtins.c (do_mpfr_arg3): New.Kaveh R. Ghazi1-0/+70
* builtins.c (do_mpfr_arg3): New. (fold_builtin_1): Handle builtins fma, fmin and fmax. testsuite: * gcc.dg/torture/builtin-math-2.c: Test builtin fma. * gcc.dg/torture/builtin-math-3.c (CKSGN_F, CKSGN, CKSGN_L): New macros. Use them in exact tests. (TESTIT3): New macro. Add tests for fmin, fmax and fma. From-SVN: r118648
2006-11-08tree-ssa-propagate.c (set_rhs): Restructure validity tests as a test for ↵Roger Sayle1-13/+4
inclusion rather than as a test for... * tree-ssa-propagate.c (set_rhs): Restructure validity tests as a test for inclusion rather than as a test for exclusion. * tree-ssa-ccp.c (fold_stmt_r) <COND_EXPR>: Use set_rhs to modify the condition after calling fold_binary. * fold-const.c (fold_inf_compare): Remove in_gimple_form check. (fold_binary) <LT_EXPR, GT_EXPR, LE_EXPR, GE_EXPR>: Likewise. * builtins.c (fold_builtin_isascii): Likewise. (fold_builtin_isdigit): Likewise. From-SVN: r118593
2006-11-02re PR middle-end/29335 (transcendental functions with constant arguments ↵Kaveh R. Ghazi1-0/+62
should be resolved at compile-time) PR middle-end/29335 * builtins.c (do_mpfr_sincos): New. (fold_builtin_1): Use it to fold builtin sincos. testsuite: * gcc.dg/torture/builtin-math-3.c: Fix semicolons. (TESTIT_2P, TESTIT_2P_R): New macros. Test sincos. From-SVN: r118409
2006-11-01extend.texi (__builtin_bswap32): Document.Eric Christopher1-0/+97
2006-09-07 Eric Christopher <echristo@apple.com> Falk Hueffner <falk@debian.org> * doc/extend.texi (__builtin_bswap32): Document. (__builtin_bswap64): Ditto. * doc/libgcc.texi (bswapsi2): Document. (bswapdi2): Ditto. * doc/rtl.texi (bswap): Document. * optabs.c (expand_unop): Don't widen a bswap. (init_optabs): Init bswap. Set libfuncs explicitly for bswapsi2 and bswapdi2. * optabs.h (OTI_bswap): New. (bswap_optab): Ditto. * genopinit.c (optabs): Handle bswap_optab. * tree.h (tree_index): Add TI_UINT32_TYPE and TI_UINT64_TYPE. (uint32_type_node): New. (uint64_type_node): Ditto. * tree.c (build_common_tree_nodes_2): Initialize uint32_type_node and uint64_type_node. * builtins.c (expand_builtin_bswap): New. (expand_builtin): Call. (fold_builtin_bswap): New. (fold_builtin_1): Call. * fold-const.c (tree_expr_nonnegative_p): Return true for bswap. * builtin-types.def (BT_UINT32): New. (BT_UINT64): Ditto. (BT_FN_UINT32_UINT32): Ditto. (BT_FN_UINT64_UINT64): Ditto. * builtins.def (BUILT_IN_BSWAP32): New. (BUILT_IN_BSWAP64): Ditto. * rtl.def (BSWAP): New. * genattrtab.c (check_attr_value): New. * libgcc2.c (__bswapSI2): New. (__bswapDI2): Ditto. * libgcc2.h (__bswapSI2): Declare. (__bswapDI2): Ditto. * mklibgcc.in (lib2funcs): Add _bswapsi2 and _bswapdi2. * simplify-rtx.c (simplify_const_unary_operation): Return 0 for BSWAP. * libgcc-std.ver (__bwapsi2): Add. (__bswapdi2): Ditto. * reload1.c (eliminate_regs_1): Add bswap. (elimination_effects): Ditto. * config/i386/i386.h (x86_bswap): New. (TARGET_BSWAP): Use. * config/i386/i386.c (x86_bswap): Set. Co-Authored-By: Falk Hueffner <falk@debian.org> From-SVN: r118361
2006-10-30re PR middle-end/29335 (transcendental functions with constant arguments ↵Kaveh R. Ghazi1-0/+6
should be resolved at compile-time) PR middle-end/29335 * builtins.c (fold_builtin_1): Evaluate tgamma using MPFR. testsuite: * gcc.dg/torture/builtin-math-2.c: Add tgamma tests. * gcc.dg/torture/builtin-math-3.c: Likewise. From-SVN: r118200
2006-10-30builtins.c (expand_builtin_mathfn_3): Correct coding style.Roger Sayle1-2/+1
* builtins.c (expand_builtin_mathfn_3): Correct coding style. * ddg.c (print_ddg_edge): Likewise. * dwarf2out.c (prune_unused_types_walk): Likewise. * ifcvt.c (noce_try_cmove_arith): Likewise. * langhooks.c (add_builtin_function): Likewise. * reg-stack.c (subst_stack_regs_pat): Likewise. * tree.c (expanded_location): Likewise. * tree-dump.c (dequeue_and_dump): Likewise. From-SVN: r118187
2006-10-30builtins.c (fold_builtin_floor): Check for the availability of the C99 trunc ↵Roger Sayle1-3/+5
function before transforming floor... * builtins.c (fold_builtin_floor): Check for the availability of the C99 trunc function before transforming floor into trunc. From-SVN: r118168
2006-10-29builtins.c (fold_builtin_hypot): Rearrange recursive transformation before ↵Kaveh R. Ghazi1-16/+21
others, and also do ABS_EXPR. * builtins.c (fold_builtin_hypot): Rearrange recursive transformation before others, and also do ABS_EXPR. When necessary, check flag_unsafe_math_optimizations. When necessary, add fabs. testsuite: * gcc.dg/builtins-20.c: Add more hypot tests. From-SVN: r118160
2006-10-29builtins.c (expand_builtin_mathfn): Expand nearbyint as rint in case ↵Richard Guenther1-1/+4
-fno-trapping-math is enabled. 2006-10-29 Richard Guenther <rguenther@suse.de> * builtins.c (expand_builtin_mathfn): Expand nearbyint as rint in case -fno-trapping-math is enabled. * config/i386/i386-protos.h (ix86_expand_rint): Declare. * config/i386/i386.c (ix86_gen_TWO52): New static helper function. (ix86_expand_sse_fabs): Likewise. (ix86_expand_rint): New function expanding rint to x87 or SSE math. * config/i386/i386.md (rintdf2): Enable for SSE math if -fno-trapping-math is enabled, use ix86_expand_rint for expansion. (rintsf2): Likewise. * gcc.target/i386/math-torture/rint.c: New testcase. * gcc.target/i386/math-torture/nearbyint.c: Likewise. From-SVN: r118144
2006-10-29genopinit.c (optabs): Change lfloor_optab and lceil_optab to conversion optabs.Richard Guenther1-32/+25
2006-10-29 Richard Guenther <rguenther@suse.de> * genopinit.c (optabs): Change lfloor_optab and lceil_optab to conversion optabs. * optabs.c (init_optabs): Initialize lfloor_optab and lceil_optab as conversion optab. * optabs.h (enum optab_index): Remove OTI_lfloor and OTI_lceil. (enum convert_optab_index): Add COI_lfloor and COI_lceil. (lfloor_optab, lceil_optab): Adjust defines. * builtins.c (expand_builtin_int_roundingfn): Adjust for lfloor and lceil optabs now being conversion optabs. * config/i386/i386-protos.h (ix86_expand_lfloorceil): Declare. * config/i386/i386.c (ix86_expand_sse_compare_and_jump): New static helper function. (ix86_expand_lfloorceil): New function to expand lfloor and lceil inline. * config/i386/i386.md (lfloor<mode>2): Split into ... (lfloorxf<mode>2): ... x87 variant (lfloor<mode>di2, lfloor<mode>si2): ... and SSE variants using ix86_expand_lfloorceil. (lceil<mode>2, lceilxf<mode>2, lceil<mode>di2, lceil<mode>si2): Likewise. * doc/md.texi (lfloorMN, lceilMN): Document. * gcc.target/i386/math-torture/lfloor.c: New testcase. * gcc.target/i386/math-torture/lceil.c: Likewise. From-SVN: r118143
2006-10-29re PR middle-end/29335 (transcendental functions with constant arguments ↵Kaveh R. Ghazi1-29/+152
should be resolved at compile-time) PR middle-end/29335 * builtins.c (do_mpfr_arg2, fold_builtin_hypot): New. (fold_builtin_pow): Evaluate constant arguments at compile-time using MPFR. (fold_builtin_1): Handle BUILT_IN_ATAN2 and BUILT_IN_HYPOT. (do_mpfr_ckconv): New helper function. (do_mpfr_arg1): Use do_mpfr_ckconv. (do_mpfr_arg2): New. testsuite: * gcc.dg/builtins-20.c: Add tests for hypot. * gcc.dg/torture/builtin-math-2.c (TESTIT2): New. Add tests for two-argument builtins. * gcc.dg/torture/builtin-math-3.c (TESTIT_R): Renamed from TESTIT2. Update all callers. (TESTIT2, TESTIT2_R): New helper macros. Add testcases for pow, hypot and atan2. From-SVN: r118129
2006-10-28re PR target/28806 (lround is not expanded inline to SSE conversion sequence)Richard Guenther1-0/+5
2006-10-28 Richard Guenther <rguenther@suse.de> PR target/28806 * builtins.c (expand_builtin_int_roundingfn_2): Expand BUILT_IN_LROUND and BUILT_IN_LLROUND from here. (expand_builtin): Adjust likewise. * genopinit.c (optabs[]): Add lround optab. * optabs.c (init_optabs): Initialize lround_optab. * optabs.h (enum convert_optab_index): Add COI_lround. (lround_optab): Define. * config/i386/i386-protos.h (ix86_expand_lround): Declare. * config/i386/i386.c (ix86_sse_copysign_to_positive): New static function. (ix86_expand_lround): New function. * config/i386/i386.md (lround<mode>di2, lround<mode>si2): New expanders. * doc/md.texi (lroundMN2): Document. * gcc.target/i386/math-torture/lround.c: New testcase. From-SVN: r118105
2006-10-27builtins.c (fold_builtin): Don't generate NOP_EXPR that is going to be ↵Jan Hubicka1-1/+1
thrown away soon when IGNORE is set. * builtins.c (fold_builtin): Don't generate NOP_EXPR that is going to be thrown away soon when IGNORE is set. * tree-ssa-ccp.c (convert_to_gimple_builtin): Add IGNORE argument indicating when return value shall not be computed. * gimplify.c (internal_get_tmp_var): Avoid random tree sharing. From-SVN: r118091
2006-10-25re PR middle-end/29335 (transcendental functions with constant arguments ↵Kaveh R. Ghazi1-27/+56
should be resolved at compile-time) PR middle-end/29335 * builtins.c (fold_builtin_cbrt, fold_builtin_logarithm): Calculate compile-time constants using MPFR. (fold_builtin_1): Likewise handle BUILT_IN_ERF, BUILT_IN_ERFC, BUILT_IN_EXPM1 and BUILT_IN_LOG1P. testsuite: * gcc.dg/torture/builtin-math-2.c (TESTIT): Use new helper macro. Add checks for log, log2, log10 and log1p. * gcc.dg/torture/builtin-math-3.c: Add checks for -0.0 everywhere we already test 0.0. Add checks for expm1, log, log2, log10, log1p, cbrt, erf and erfc. From-SVN: r118042
2006-10-25optabs.h (enum optab_index): Remove OTI_lrint.Richard Guenther1-33/+25
2006-10-25 Richard Guenther <rguenther@suse.de> * optabs.h (enum optab_index): Remove OTI_lrint. (enum convert_optab_index): Add COI_lrint. (lrint_optab): Adjust. (expand_sfix_optab): Declare. * optabs.c (expand_sfix_optab): New function. (init_optabs): Init lrint_optab as conversion optab. * genopinit.c (lrint_optab): Change to a conversion optab. * builtins.c (expand_builtin_int_roundingfn_2): Adjust to expansion via conversion optab. * config/i386/i386.md (*fistdi2_1): Remove flag_unsafe_math_optimizations guard. (fistdi2, fistdi2_with_temp, *fist<mode>2_1, fist<mode>2, fist<mode>2_with_temp): Likewise. (lrint<mode>2): Split into... (lrintxf<mode>2): ... x87 part (lrint<mode>di2, lrint<mode>si2): ... and SSE parts. * config/i386/sse.md (sse_cvtss2si_2, sse_cvtss2_siq_2, sse2_cvtsd2si_2, sse2_cvtsd2siq_2): New insns for UNSPEC_FIX_NOTRUNC matching non-vector float modes. * doc/md.texi (lrintMN2): Document. From-SVN: r118029
2006-10-25optabs.h (enum optab_index): Rename OTI_drem to OTI_remainder.Uros Bizjak1-3/+6
* optabs.h (enum optab_index): Rename OTI_drem to OTI_remainder. (remainder_optab): Define corresponding macro. (drem_optab): Remove. * optabs.c (init_optabs): Initialize remainder_optab. Remove drem_optab initialization. * genopinit.c (optabs): Implement remainder_optab using remainder?f3 patterns. Remove drem_optab. * builtins.c (expand_builtin_mathfn_2): Handle BUILT_IN_REMAINDER{,F,L} using remainder_optab. (expand_builtin): Expand BUILT_IN_REMAINDER{,F,L} using expand_builtin_mathfn_2. (expand_builtin) [BUILT_IN_FMOD, BUILT_IN_DREM]: Do not depend on flag_unsafe_math_optimizations. * config/i386/i386.md ("remaindersf3", "remainderdf3") ("remainderxf3"): Renamed from "drem{s,d,x}f3" expanders. Do not depend on flag_unsafe_math_optimizations. Use truncxf?f expander instead of truncxf?f_i387_noop. ("fpremxf4", "fprem1xf4"): Do not depend on flag_unsafe_math_optimizations. ("fmodsf3", "fmoddf3", "fmodxf3"): Do not depend on flag_unsafe_math_optimizations. Use truncxf?f expander instead of truncxf?f_i387_noop. * doc/md.texi (fmod, remainder): Document standard named pattern. testsuite/ChangeLog: * gcc.dg/builtins-40.c: Also check remainder(), remainderf() and remainderl() built-in functions. Remove -ffast-math from dg-options. From-SVN: r118024
2006-10-24re PR middle-end/29335 (transcendental functions with constant arguments ↵Kaveh R. Ghazi1-64/+78
should be resolved at compile-time) PR middle-end/29335 * builtins.c (fold_builtin_sin, fold_builtin_atan): Remove. (do_mpfr_arg1): Add `min', `max' and `inclusive' arguments. Update all callers. (BUILT_IN_SIN, BUILT_IN_ATAN): Handle in main switch. (BUILT_IN_ASIN, BUILT_IN_ACOS, BUILT_IN_ATAN, BUILT_IN_ASINH, BUILT_IN_ACOSH, BUILT_IN_ATANH, BUILT_IN_SINH, BUILT_IN_COSH, BUILT_IN_TANH): Calculate compile-time arguments using MPFR. testsuite: * gcc.dg/torture/builtin-math-3.c: New test. From-SVN: r118009
2006-10-24re PR middle-end/28796 (__builtin_nan() and __builtin_unordered() inconsistent)Richard Guenther1-7/+7
2006-10-24 Richard Guenther <rguenther@suse.de> PR middle-end/28796 * builtins.c (fold_builtin_classify): Use HONOR_INFINITIES and HONOR_NANS instead of MODE_HAS_INFINITIES and MODE_HAS_NANS for deciding optimizations in consistency with fold-const.c (fold_builtin_unordered_cmp): Likewise. * gcc.dg/pr28796-1.c: New testcase. * gcc.dg/pr28796-1.c: Likewise. From-SVN: r118001
2006-10-24builtins.c (fold_builtin_floor): Fold floor (x) where x is nonnegative to ↵Richard Guenther1-0/+18
trunc (x). 2006-10-24 Richard Guenther <rguenther@suse.de> * builtins.c (fold_builtin_floor): Fold floor (x) where x is nonnegative to trunc (x). (fold_builtin_int_roundingfn): Fold lfloor (x) where x is nonnegative to FIX_TRUNC_EXPR. * gcc.dg/builtins-57.c: New testcase. From-SVN: r117998
2006-10-24builtins.c (fold_builtin_exponent): Evaluate constant arguments at ↵Kaveh R. Ghazi1-55/+36
compile-time using MPFR. * builtins.c (fold_builtin_exponent): Evaluate constant arguments at compile-time using MPFR. Change parameter VALUE to FUNC, update all callers. (do_mpfr_arg1): Rename `exact' to `inexact'. Carefully check for overflow and underflow at all times and avoid folding in those cases. From-SVN: r117995
2006-10-23re PR middle-end/29335 (transcendental functions with constant arguments ↵Kaveh R. Ghazi1-21/+67
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-23builtins.c (expand_builtin, [...]): Handle BUILT_IN_STRNCAT_CHK.Jakub Jelinek1-0/+22
* builtins.c (expand_builtin, maybe_emit_chk_warning): Handle BUILT_IN_STRNCAT_CHK. * gcc.dg/builtin-strncat-chk-1.c: New test. From-SVN: r117980
2006-10-23builtins.c (expand_builtin_memmove): Remove ORIG_EXP argument; don't do ↵Jan Hubicka1-43/+25
conversion from memmove to memcpy here. * builtins.c (expand_builtin_memmove): Remove ORIG_EXP argument; don't do conversion from memmove to memcpy here. (expand_builtin_bcopy, expand_builtin): Update call of expand_builtin_memmove. (fold_builtin_memory_op): Do folding of memmove to memcpy here. * gcc.dg/memmove-1.c: New test. From-SVN: r117979
2006-10-21re PR middle-end/28252 (pow(x,1/3.0) should be converted to cbrt(x))Uros Bizjak1-0/+17
2006-10-21 Uros Bizjak <uros@kss-loka.si> PR middle-end/28252 * builtins.c (fold_builtin): Fold pow(x,1.0/3.0) as cbrt(x) if flag_unsafe_math_optimizations is set. testsuite/ChangeLog: PR middle-end/28252 * gcc.dg/builtins-8.c: Also check pow(x,1.0/3.0) to cbrt(x) transformation. From-SVN: r117937
2006-10-21builtins.c (expand_builtin_int_roundingfn_2): New function.Richard Guenther1-6/+93
2006-10-21 Richard Guenther <rguenther@suse.de> * builtins.c (expand_builtin_int_roundingfn_2): New function. (expand_builtin): Use it to expand lrint instead of expand_builtin_mathfn. From-SVN: r117936
2006-10-21builtins.c (fold_builtin_classify): Fix typo.Richard Guenther1-1/+1
2006-10-21 Richard Guenther <rguenther@suse.de> * builtins.c (fold_builtin_classify): Fix typo. From-SVN: r117929
2006-10-15Cosmetic tweak to previous checkin.Eric Botcazou1-3/+3
From-SVN: r117751
2006-10-15re PR middle-end/29111 (FAIL: gcc.dg/torture/pr26565.c -O0 execution test)Eric Botcazou1-0/+4
PR middle-end/29111 * builtins.c (get_pointer_alignment): Return 0 if TER is not run. Co-Authored-By: Andrew Pinski <pinskia@gmail.com> Co-Authored-By: John David Anglin <dave.anglin@nrc-cnrc.gc.ca> From-SVN: r117750
2006-10-10re PR middle-end/29272 (memcpy optimization causes wrong-code)Jakub Jelinek1-0/+20
PR middle-end/29272 * builtins.c (var_decl_component_p): New function. (fold_builtin_memset, fold_builtin_memory_op): Restrict single entry optimization to variables and components thereof. * gcc.c-torture/execute/20060930-2.c: New test. From-SVN: r117599
2006-10-06re PR target/28924 (x86 sync builtins fail for char and short memory operands)Jakub Jelinek1-0/+8
PR target/28924 * builtins.c (expand_builtin_sync_operation, expand_builtin_compare_and_swap, expand_builtin_lock_test_and_set): Use convert_to_mode to handle promoted arguments. * gcc.c-torture/compile/20061005-1.c: New test. From-SVN: r117508