aboutsummaryrefslogtreecommitdiff
path: root/gcc/builtins.c
AgeCommit message (Collapse)AuthorFilesLines
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
2006-10-03builtins.c (expand_builtin_return_addr): Deal with FRAME_ADDR_RTX.Eric Botcazou1-5/+9
* builtins.c (expand_builtin_return_addr): Deal with FRAME_ADDR_RTX. * doc/tm.texi (Basic Stack Layout): Document FRAME_ADDR_RTX. * config/sparc/sparc.h (FRAME_ADDR_RTX): Define. From-SVN: r117403
2006-09-29builtins.c (expand_builtin_setjmp): Delete.Eric Botcazou1-75/+57
* builtins.c (expand_builtin_setjmp): Delete. (expand_builtin) <BUILT_IN_SETJMP>: Mark as unreachable. <BUILT_IN_SETJMP_SETUP>: New case. <BUILT_IN_SETJMP_DISPATCHER>: Likewise. <BUILT_IN_SETJMP_RECEIVER>: Likewise. * builtins.def (BUILT_IN_SETJMP_SETUP): New built-in stub. (BUILT_IN_SETJMP_DISPATCHER): Likewise. (BUILT_IN_SETJMP_RECEIVER): Likewise. * gimple-low.c (struct lower_data): New field calls_builtin_setjmp. (lower_function_body): Initialize it to false. If it is set to true at the end of the processing, emit the setjmp dispatcher. (lower_stmt) <CALL_EXPR>: Invoke lower_builtin_setjmp if the callee is __builtin_setjmp and set calls_builtin_setjmp to true as well. <MODIFY_EXPR>: Fall through to above case if there is a CALL_EXPR on the rhs of the assignment. (lower_builtin_setjmp): New function. * tree.c (build_common_builtin_nodes): Build BUILT_IN_SETJMP_SETUP, BUILT_IN_SETJMP_DISPATCHER and BUILT_IN_SETJMP_RECEIVER nodes. * tree-cfg.c (make_exit_edges) <CALL_EXPR>: Use specific predicate to detect calls that can go to non-local labels. Use specific helper to create the abnormal edges associated with them. <MODIFY_EXPR>: Likewise. (make_abnormal_goto_edges): New function extracted from... (make_goto_expr_edges): ...here. Call it for computed gotos. (simple_goto_p): Minor tweak. (tree_can_make_abnormal_goto): New predicate. (tree_redirect_edge_and_branch): Return zero on all abnormal edges. (tree_purge_dead_abnormal_call_edges): New function. * tree-flow.h (tree_can_make_abnormal_goto): Declare. (tree_purge_dead_abnormal_call_edges): Likewise. (make_abnormal_goto_edges): Likewise. * tree-inline.c (expand_call_inline): Simplify statement frobbing. Purge all dead abnormal edges if the call was in the last statement. * tree-optimize.c (has_abnormal_outgoing_edge_p): New predicate. (execute_fixup_cfg): If there are non-local labels in the function, scan the basic blocks and split them at calls that can go to non-local labels or add missing abnormal call edges. Write down the CFG in the dump file. (pass_fixup_cfg): Remove TODO_dump_func flag. * unwind-sjlj.c: Poison setjmp. * doc/install.texi (enable-sjlj-exceptions): Use more general wording. * doc/tm.texi (DWARF2_UNWIND_INFO): Likewise. (TARGET_UNWIND_TABLES_DEFAULT): Fix typo. (DONT_USE_BUILTIN_SETJMP): Document it. From-SVN: r117298
2006-09-12re PR middle-end/28493 (Wrong address of stack object used for destructor ↵Jason Merrill1-1/+6
call on PPC) PR middle-end/28493 * builtins.c (expand_builtin_setjmp_receiver): Clobber hard_frame_pointer_rtx after using it to update the frame pointer. From-SVN: r116900
2006-09-10re PR middle-end/26983 (Missing label with builtin_setjmp/longjmp)Steven Bosscher1-0/+6
PR middle-end/26983 gcc/ * builtins.c (expand_builtin_setjmp): Force next_lab to be preserved. testsuite/ * gcc.dg/pr26983.c: New test. From-SVN: r116826
2006-09-02re PR middle-end/27567 (__builtin_memcpy generates redundant stores/moves.)Jakub Jelinek1-58/+253
PR middle-end/27567 * builtins.c (fold_builtin_memcpy, fold_builtin_memmove): Remove. (fold_builtin_mempcpy): Rename to... (fold_builtin_memory_op): ... this. Optimize one element copy into an assignment. (fold_builtin_memset, fold_builtin_bzero, fold_builtin_bcopy): New functions. (expand_builtin_strcpy, expand_builtin_strncpy): Handle COMPOUND_EXPR. (expand_builtin_memcpy, expand_builtin_mempcpy, expand_builtin_memmove): Likewise. Use fold_builtin_memory_op. (fold_builtin_1): Handle BUILT_IN_MEMSET, BUILT_IN_BZERO and BUILT_IN_BCOPY. Use fold_builtin_memory_op for BUILT_IN_MEM{CPY,PCPY,MOVE}. From-SVN: r116656
2006-09-01re PR middle-end/27226 (Compiler looses track of alignment for emit_block_move)J"orn Rennecke1-9/+40
2006-09-01 J"orn Rennecke <joern.rennecke@st.com> Richard Guenther <rguenther@suse.de> Adam Nemet <anemet@caviumnetworks.com> PR middle-end/27226 * builtins.c (get_pointer_alignment): Handle more forms of base addresses that can be used to derive more precise information about alignment. * gcc.target/mips/memcpy-1.c: New testcase. * gcc.dg/pr27226.c: Likewise. Co-Authored-By: Adam Nemet <anemet@caviumnetworks.com> Co-Authored-By: Richard Guenther <rguenther@suse.de> From-SVN: r116641
2006-07-27builtins.c (fold_fixed_mathfn): When long and long long are the same size...Roger Sayle1-0/+36
* builtins.c (fold_fixed_mathfn): When long and long long are the same size, canonicalize llceil*, llfloor*, llround* and llrint* functions to their lceil*, lfloor*, lround* and lrint* forms. * gcc.dg/builtins-55.c: New test case. From-SVN: r115775
2006-06-12builtins.c (expand_builtin_return_addr): Only use frame_pointer_rtx when ↵Mark Shinwell1-5/+9
count == 0 and we are expanding... gcc/ * builtins.c (expand_builtin_return_addr): Only use frame_pointer_rtx when count == 0 and we are expanding __builtin_return_address. From-SVN: r114567
2006-06-04tree.h: Declare folding_initializer.Mark Shinwell1-1/+2
gcc: * tree.h: Declare folding_initializer. * builtins.c (fold_builtin_constant_p): Give definite answer if folding inside an initializer. * fold-const.c: Define folding_initializer. (START_FOLD_INIT): Save and then set folding_initializer. (END_FOLD_INIT): Restore folding_initializer. gcc/testsuite: * gcc.c-torture/compile/builtin_constant_p.c: New test. From-SVN: r114358
2006-05-31builtins.c (fold_builtin_cabs): Delete prototype.Roger Sayle1-5/+13
* builtins.c (fold_builtin_cabs): Delete prototype. Require an additional FNDECL argument. Optimize cabs(-z) and cabs(~z) as cabs(z). (fold_builtin_decl) <BUILT_IN_CABS>: Update fold_builtin_cabs call. * gcc.dg/builtins-54.c: New test case. From-SVN: r114276
2006-05-22revert: invoke.texi (-msselibm): Document.Richard Guenther1-20/+0
2006-05-22 Richard Guenther <rguenther@suse.de> Revert 2006-01-31 Richard Guenther <rguenther@suse.de> * doc/invoke.texi (-msselibm): Document. * target.h (expand_library_builtin): New target hook. * builtins.c (expand_builtin): Use expand_library_builtin. (default_expand_library_builtin): New function. * gcc.c (LINK_GCC_MATH_SPEC): Define. (LINK_COMMAND_SPEC): Handle %(link_gcc_math). (link_gcc_math_spec): Declare. (static_specs): Add link_gcc_math_spec. * expr.h (default_expand_library_builtin): Declare. * target-def.h (TARGET_EXPAND_LIBRARY_BUILTIN): Define. (TARGET_INITIALIZER): Add TARGET_EXPAND_LIBRARY_BUILTIN. * config/i386/i386.h: Provide LINK_GCC_MATH_SPEC. * config/i386/i386.opt (msselibm): New target option. * config/i386/i386.c (ix86_builtin_function_variants): New array. (ix86_init_sse_abi_builtins): New function. (ix86_expand_library_builtin): Likewise. (TARGET_EXPAND_LIBRARY_BUILTIN): Define. (override_options): Handle error conditions wrt -msselibm. (ix86_builtins): Add function codes for SSE2 ABI builtins. (ix86_init_builtins): Call ix86_init_sse_abi_builtins. * doc/extend.texi (__builtin_sse2_*): Document new target specific builtins. * gcc.target/i386/sselibm-1.c: New testcase. * gcc.target/i386/sselibm-2.c: Likewise. * gcc.target/i386/sselibm-3.c: Likewise. * gcc.target/i386/sselibm-4.c: Likewise. * gcc.target/i386/sselibm-5.c: Likewise. From-SVN: r113977
2006-05-18Whitespace fixupsMike Stump1-104/+104
From-SVN: r113893
2006-04-28re PR middle-end/27260 (ICE in expand_expr_real_1, at expr.c:6750)Alan Modra1-3/+3
gcc/ PR middle-end/27260 * builtins.c (expand_builtin_memset): Expand val in original mode. gcc/testsuite/ PR middle-end/27260 * gcc.c-torture/execute/pr27260.c: New. From-SVN: r113341
2006-04-18builtins.c (expand_builtin_strcmp): Cover label definition of do_libcall ↵Andreas Krebbel1-0/+2
with HAVE_cmpstrnsi. 2006-04-18 Andreas Krebbel <krebbel1@de.ibm.com> * builtins.c (expand_builtin_strcmp): Cover label definition of do_libcall with HAVE_cmpstrnsi. From-SVN: r113039
2006-04-14re PR middle-end/27134 (ICE with floor and -ffast-math)Uros Bizjak1-1/+1
PR middle-end/27134 * builtins.c (expand_builtin_int_roundingfn): Use expand_normal() to expand fallback builtin function call. testsuite/ChangeLog: PR middle-end/27134 * gcc.dg/pr27314.c: New test. From-SVN: r112949
2006-04-14re PR middle-end/27095 (O2 produces duplicate code)Alan Modra1-12/+33
PR middle-end/27095 * builtins.c: (expand_builtin_memset): Stabilize args before expansion and emit libcall here in case the builtin fails. (expand_builtin_strcmp): Always emit the libcall here on failure. From-SVN: r112948