aboutsummaryrefslogtreecommitdiff
path: root/gcc/builtins.c
AgeCommit message (Collapse)AuthorFilesLines
2004-02-11optabs.h (enum optab_index): Add new OTI_log10 and OTI_log2.Uros Bizjak1-0/+14
2004-02-11 Uros Bizjak <uros@kss-loka.si> * optabs.h (enum optab_index): Add new OTI_log10 and OTI_log2. (log10_optab, log2_optab): Define corresponding macros. * optabs.c (init_optabs): Initialize log10_optab and log2_optab. * genopinit.c (optabs): Implement log10_optab and log2_optab using log10?f2 and log2?f2 patterns. * builtins.c (expand_builtin_mathfn): Handle BUILT_IN_LOG10{,F,L} using log10_optab, and BUILT_IN_LOG2{,F,L} using log2_optab. (expand_builtin): Expand BUILT_IN_LOG10{,F,L} and BUILT_IN_LOG2{,F,L} using expand_builtin_mathfn if flag_unsafe_math_optimizations is set. * config/i386/i386.md (log10sf2, log10df2, log10xf2, log2sf2, log2df2, log2xf2): New patterns to implement log10, log10f, log10l, log2, log2f and log2l built-ins as inline x87 intrinsics. * gcc.dg/builtins-33.c: New test. From-SVN: r77675
2004-02-09re PR libstdc++/5625 ([mips] exception unwinding creates invalid pointer on ↵James E Wilson1-0/+3
mips) PR libstdc++/5625 * builtin-types.def (BT_WORD, BT_FN_WORD_PTR): New. * builtins.c (expand_builtin): Handle BUILT_IN_EXTEND_POINTER. * builtins.def (BUILT_IN_EXTEND_POINTER): New. * except.c (expand_builtin_extend_pointer): New. * except.h (expand_builtin_extend_pointer): Declare. From-SVN: r77554
2004-02-07builtins.c (expand_builtin_signbit): Use extract_bit_field instead of ↵Roger Sayle1-22/+23
gen_highpart or gen_lowpart when... * builtins.c (expand_builtin_signbit): Use extract_bit_field instead of gen_highpart or gen_lowpart when the floating point format is wider than the result mode. Co-Authored-By: Ulrich Weigand <uweigand@de.ibm.com> From-SVN: r77439
2004-02-02alias.c (record_set): Use hard_regno_nregs.Jan Hubicka1-1/+1
* alias.c (record_set): Use hard_regno_nregs. * bt-load.c (find_btr_reference, note_btr_set): Likewise. * builtins.c (apply_args_size): Likewise. * caller-save.c (setup_save_areas, save_call_clobbered_regs, mark_set_regs, add_stored_regs, mark_referenced_regs, insert_restore, insert_save, insert_one_insn): Likewise. * cfgcleanup.c: Include regs.h (mark_effect, mentions_nonequal_regs): Likewise. * cfgrtl.c (mark_killed_regs): Likewise * combine.c (update_table_tick, record_value_for_reg, record_dead_and_set_regs, get_last_value_validate, use_crosses_set_p, reg_dead_at_p_1, reg_dead_at_p, mark_used_regs_combine, move_deaths, reg_bitfield_target_p, distribute_notes): Likewise. * cse.c (mention_regs, insert, invalidate, invalidate_for_call, exp_equiv_p, cse_insn): Likewise. * cselib.c (cselib_lookup): Likewise. (cselib_invalidate_regno, cselib_record_set): Likewise. * df.c (df_ref_record): Likewise. * dwarf2out.c (reg_loc_descriptor, multiple_reg_loc_descriptor): Likewise. * flow.c (mark_reg, insn_dead_p, mark_set_1, mark_used_reg, count_or_remove_death_notes_bb): Likewise. * function.c (aggregate_value_p, keep_stack_depressed): Likewise. * gloval.c (global_alloc, find_reg, mark_reg_store, mark_reg_conflicts, mark_reg_death, set_preference, reg_becomes_live, reg_dies): Likewise. * integrate.c (mark_stores): Likewise. * jump.c (delete_prior_computation): Likewise. * lcm.c (reg_dies, reg_becomes_live): Likewise. * local-alloc.c (combine_regs, find_free_reg, post_mark_life): Likewise. * loop.c (LOOP_REGNO_NREGS): Likewise. * postreload.c (reload_combine, reload_combine_note_store, reload_combine_note_use, reload_cse_move2add, move2add_note_store): Likewise. * ra-colorize.c (combine, color_usable_p, get_free_reg, calculate_dont_begin, calculate_dont_begin, colorize_one_web, try_recolor_web, insert_coalesced_conflicts, check_colors, break_precolored_alias): Likewise. * ra-debug.c: Include regs.h (ra_print_rtx_object): Likewise. * ra-rewrite (choose_spill_colors): Likewise. (spill_same_color_p, update_spill_colors, spill_is_free): Likewise. * ra.c (init_ra): Likewise. * recog.c (reg_fits_class_p, peep2_reg_dead_p, peep2_find_free_register): Likewise. * reg-stack.c (subst_stack_regs_pat, convert_regs_exit): Likewise. * regclass.c (hard_regno_nregs): New array. (init_reg_modes_once): Initialize it. (choose_hard_reg_mode): Use it. (record_reg_classes): Likewise. * regmove.c (mark_flags_life_zones): Likewise. * regrename.c (note_sets, clear_dead_regs, regrename_optimize, scan_rtx_reg, dump_def_use_chain, kill_value, set_value_regno, copy_value, maybe_mode_change, find_oldest_value_reg, copyprop_hardreg_forward_1): * regs.h (hard_regno_nregs): Declare. * realod.c (reload_inner_reg_of_subreg): Use it. (push_reload, combine_reloads, find_dummy_reload, hard_reg_set_here_p, operands_match_p, decompose, find_reloads, refers_to_regno_for_reload_p, find_equiv_reg, regno_clobbered_p, reload_adjust_reg_for_mode): Likewise. * reload1.c (compute_use_by_pseudos, count_pseudo, count_spilled_pseudo, find_reg, find_reload_regs, mark_home_live, spill_hard_reg, forget_old_reloads_1, mark_reload_reg_in_use, clear_reload_reg_in_use, reload_reg_free_for_value_p, free_for_value_p allocate_reload_reg, choose_reload_regs, emit_reload_insns, delete_output_reload): Likewise. * resource.c (update_live_status, mark_referenced_resources, mark_set_resources, mark_target_live_regs): Likewise. * rtlanal.c: Include regs.h (refers_to_regno_p, reg_overlap_mentioned_p, dead_or_set_p, dead_or_set_regno_p, find_regno_note, find_reg_fusage, subreg_regno_offset, subreg_offset_representable_p, hoist_test_store): Likewise. * sched-deps.c (sched_analyze_1, sched_analyze_2): Likewise. * sched-rgn.c (check_live_1, update_live_1): Likewise. * stmt.c: Include regs.h (decl_conflicts_with_clobbers_p): Likewise. * varasm.c (make_decl_rtl): Likewise. * Makefile.in (cfgcleanup.o, rtlanal.o, ra-debug.o): Add regs.h dependnecy. From-SVN: r77088
2004-02-01builtins.c (expand_builtin_pow): If flag_unsafe_math_optimizations isn't set...Roger Sayle1-3/+4
* builtins.c (expand_builtin_pow): If flag_unsafe_math_optimizations isn't set, don't call expand_builtin_mathfn_2 to use the pow optab. (expand_builtin): Always call expand_builtin_pow. From-SVN: r77071
2004-02-01builtins.def (BUILT_IN_SIGNBIT, [...]): New GCC builtins.Roger Sayle1-0/+144
* builtins.def (BUILT_IN_SIGNBIT, BUILT_IN_SIGNBITF, BUILT_IN_SIGNBITL): New GCC builtins. * builtins.c (expand_builtin_signbit): New function to RTL expand calls to signbit, signbitf and signbitl as inline intrinsics. (expand_builtin): Call expand_builtin_signbit for BUILT_IN_SIGNBIT*. (fold_builtin_signbit): New function to perform constant folding of signbit, signbitf and signbitl. (fold_builtin): Call fold_builtin_signbit for BUILT_IN_SIGNBIT*. * doc/extend.texi: Document new signbit{,f,l} builtins. * gcc.dg/builtins-1.c: Also test for __builtin_signbit{,f,l}. * gcc.dg/builtins-31.c: New testcase. * gcc.dg/builtins-32.c: New testcase. From-SVN: r77070
2004-01-23real.c (real_floor, real_ceil): Tweak to allow input and output arguments to ↵Roger Sayle1-0/+35
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-18builtins.c (expand_builtin_expect_jump): Fix thinko of reusing live "next" ↵Roger Sayle1-8/+12
variable, which can lead to an infinite loop. * builtins.c (expand_builtin_expect_jump): Fix thinko of reusing live "next" variable, which can lead to an infinite loop. From-SVN: r76111
2004-01-17builtins.c (expand_builtin_expect_jump): Fix mistake in my last patch.Roger Sayle1-6/+6
* builtins.c (expand_builtin_expect_jump): Fix mistake in my last patch. Use XEXP (x, 0) to get a LABEL_REF's CODE_LABEL. From-SVN: r76064
2004-01-15builtins.c (expand_builtin_va_end): Don't use EXPAND_BUILTIN_VA_END.Kazu Hirata1-5/+0
* builtins.c (expand_builtin_va_end): Don't use EXPAND_BUILTIN_VA_END. * system.h (EXPAND_BUILTIN_VA_END): Poison. * config/d30v/d30v.h: Remove a commented-out definition of EXPAND_BUILTIN_VA_END. * config/stormy16/stormy16.h: Likewise. From-SVN: r75906
2004-01-14builtins.c (std_expand_builtin_va_arg): Align operand when needed.Jan Hubicka1-0/+22
* builtins.c (std_expand_builtin_va_arg): Align operand when needed. * i386.c (init_cumulative_args): Set warn_sse; fix handling of variadic functions accepting SSE arguments (function_arg): Warn only when asked to warn. * i386.h (ix86_args): Add warn_sse/warn_mmx fiels. From-SVN: r75892
2004-01-13builtins.c (expand_builtin_expect_jump): Simplify logic.Roger Sayle1-44/+52
* builtins.c (expand_builtin_expect_jump): Simplify logic. Handle conditional jumps that drop through to unconditional jumps or the end of the sequence. From-SVN: r75780
2004-01-11Update Copyright year.Jakub Jelinek1-1/+1
From-SVN: r75685
2004-01-11re PR middle-end/13392 (ICE in convert_from_eh_region_ranges_1, at ↵Jakub Jelinek1-35/+11
except.c:1133) PR middle-end/13392 * builtins.c (expand_builtin_expect_jump): Handle conditional jumps to drop through label. Don't fall back to SCC even when conditional jump has not been found. * g++.dg/opt/expect2.C: New test. From-SVN: r75684
2004-01-06alias.c: Fix comment typos.Kazu Hirata1-1/+1
* alias.c: Fix comment typos. * builtins.c: Likewise. * cfg.c: Likewise. * df.c: Likewise. * dominance.c: Likewise. * dwarf2out.c: Likewise. * emit-rtl.c: Likewise. * expr.c: Likewise. * final.c: Likewise. * fold-const.c: Likewise. * gcse.c: Likewise. * genattrtab.c: Likewise. * genrecog.c: Likewise. * gensupport.c: Likewise. * ggc-zone.c: Likewise. * integrate.c: Likewise. * local-alloc.c: Likewise. * loop.c: Likewise. * recog.c: Likewise. * regmove.c: Likewise. * reg-stack.c: Likewise. * reorg.c: Likewise. * rtlanal.c: Likewise. * rtl.h: Likewise. * sched-ebb.c: Likewise. * simplify-rtx.c: Likewise. * toplev.c: Likewise. * varasm.c: Likewise. From-SVN: r75475
2004-01-01builtins.c (expand_builtin_apply_args_1): Call force_operand on ↵Hans-Peter Nilsson1-2/+5
plus_constant result. * builtins.c (expand_builtin_apply_args_1) [STACK_GROWS_DOWNWARD]: Call force_operand on plus_constant result. From-SVN: r75306
2003-12-30builtins.c (expand_builtin_apply_args_1): Fix typo in previous change.Nathan Sidwell1-1/+1
* builtins.c (expand_builtin_apply_args_1): Fix typo in previous change. From-SVN: r75234
2003-12-29builtins.c (expand_builtin_apply_args_1): Add pretend args size to the ↵Nathan Sidwell1-5/+9
virtual incoming args pointer for downward stacks. * builtins.c (expand_builtin_apply_args_1): Add pretend args size to the virtual incoming args pointer for downward stacks. From-SVN: r75207
2003-12-19re PR c++/13239 (Assertion does not seem to work correctly anymore)Jakub Jelinek1-0/+8
PR c++/13239 * builtins.c (expand_builtin_expect_jump): Update TREE_VALUE (arglist) if unsave_expr_now langhook created a new tree. * g++.dg/opt/expect1.C: New test. From-SVN: r74832
2003-12-05re PR middle-end/11151 (__builtin_return(__builtin_apply(...)) gives wrong ↵Eric Botcazou1-1/+1
result) PR middle-end/11151 * function.h (struct function): New field 'x_naked_return_label'. * function.c (free_after_compilation): Set it to NULL. (expand_function_end): Emit 'naked_return_label' if it exists. * rtl.h (expand_naked_return): Declare. * stmt.c (expand_naked_return): New function to generate a jump to 'naked_return_label'. * builtins.c (expand_builtin_return): Call expand_naked_return instead of expand_null_return. * config/sparc/sparc.md (untyped_return): Likewise. From-SVN: r74312
2003-12-01builtins.c (expand_builtin_longjmp): Added two memory clobbers.Andreas Krebbel1-0/+7
2003-12-01 Andreas Krebbel <krebbel1@de.ibm.com> * builtins.c (expand_builtin_longjmp): Added two memory clobbers. From-SVN: r74108
2003-11-27re PR middle-end/8028 (__builtin_apply() passes wrong arguments)Eric Botcazou1-6/+10
PR middle-end/8028 PR middle-end/9890 PR middle-end/11151 PR middle-end/12210 PR middle-end/12503 PR middle-end/12692 * builtins.c (expand_builtin_apply): Use virtual_outgoing_args_rtx as the base address to copy the memory arguments to. From-SVN: r73976
2003-11-06builtins.c (simplify_builtin_strrchr, [...]): Add missing casts.Jan Hubicka1-4/+8
* builtins.c (simplify_builtin_strrchr, simplify_builtin_strpbrk): Add missing casts. From-SVN: r73296
2003-10-29builtins.c (std_build_builtin_va_list): New.Richard Henderson1-0/+8
* builtins.c (std_build_builtin_va_list): New. * expr.h (std_build_builtin_va_list): Declare. * defaults.h (BUILD_VA_LIST_TYPE): New. * system.h (BUILD_VA_LIST_TYPE): Poison. * target-def.h (TARGET_BUILD_BUILTIN_VA_LIST): New. * target.h (struct gcc_target): Add build_builtin_va_list. * tree.c (build_common_tree_nodes_2): Use it. * config/alpha/alpha-protos.h, config/alpha/alpha.c, config/alpha/alpha.h, config/alpha/unicosmk.h, config/d30v/d30v-protos.h, config/d30v/d30v.c, config/d30v/d30v.h, config/i386/i386-protos.h, config/i386/i386.c, config/i386/i386.h, config/i860/i860-protos.h, config/i860/i860.c, config/i860/i860.h, config/i960/i960-protos.h, config/i960/i960.c, config/i960/i960.h, config/mips/iris6.h, config/mips/mips-protos.h, config/mips/mips.c, config/mips/mips.h, config/rs6000/rs6000-protos.h, config/rs6000/rs6000.c, config/rs6000/rs6000.h, config/s390/s390-protos.h, config/s390/s390.c, config/s390/s390.h, config/sh/sh-protos.h, config/sh/sh.c, config/sh/sh.h, config/xtensa/xtensa-protos.h, config/xtensa/xtensa.c, config/xtensa/xtensa.h: Rename foo_build_va_list to foo_build_builtin_va_list; make it static. Define TARGET_BUILD_BUILTIN_VA_LIST. Remove BUILD_VA_LIST_TYPE. Update protos. * config/i386/i386.c (ix86_expand_carry_flag_compare): Make static. * config/iq2000/iq2000.h (BUILD_VA_LIST_TYPE): Remove. From-SVN: r73076
2003-10-16builtins.c (fold_builtin_memcpy, [...]): New functions.Roger Sayle1-14/+300
* builtins.c (fold_builtin_memcpy, fold_builtin_mempcpy, fold_builtin_memmove, fold_builtin_strcpy, fold_builtin_strncpy, fold_builtin_memcmp, fold_builtin_strcmp, fold_builtin_strncmp): New functions. (expand_builtin_memcpy): Use integer_zerop instead of testing host_integerp and tree_low_cst directly. Move misapplied hunk for optimization wher SRC and DEST point to the same location. (expand_builtin_mempcpy): From here. (expand_builtin_memmove): Use integer_zerop instead of testing host_integerp and tree_low_cst_directly. (expand_builtin_memset): Likewise. (expand_builtin_memcmp): Likewise (and for integer_onep). (expand_builtin_strncmp): Likewise. (fold_builtin): Call the appropriate fold_builtin_foo functions to optimize memcpy, mempcpy, memmove, strcpy, strncpy, memcmp, strcmp and strncmp. From-SVN: r72547
2003-10-11builtins.c (expand_builtin_strcmp): Defend against the possibility that ↵Roger Sayle1-24/+52
gen_cmpstrsi may fail... * builtins.c (expand_builtin_strcmp): Defend against the possibility that gen_cmpstrsi may fail: Stabilize the argument list against re-evaluation and expand the library call directly using this saved argument list if a cmpstrsi sequence can't be generated. (expand_builtin_strncmp): Likewise. * config/i386/i386.md (cmpstrsi, movstrsi): Disable with -Os. * gcc.c-torture/execute/string-opt-8.c: Don't test optimizations that inline strncmp as cmpstrsi on i386 when compiled with -Os. From-SVN: r72380
2003-10-11builtins.c (expand_builtin_memcpy): Optimize case when the two pointer ↵Roger Sayle1-5/+69
arguments are the equal... * builtins.c (expand_builtin_memcpy): Optimize case when the two pointer arguments are the equal, non-volatile and side-effect free. (expand_builtin_mempcpy): Likewise. (expand_builtin_memmove): Likewise. (expand_builtin_strcpy): Likewise. (expand_builtin_memcmp): Likewise. (expand_builtin_strcmp): Likewise. (expand_builtin_strncmp): Likewise. * gcc.c-torture/execute/string-opt-18.c: New testcase. From-SVN: r72335
2003-10-11builtins.c (builtin_mathfn_code): Generalize to check whether the call is to ↵Roger Sayle1-24/+46
any built-in function by comparing... * builtins.c (builtin_mathfn_code): Generalize to check whether the call is to any built-in function by comparing the call's argument list against the builtin decl's function type. From-SVN: r72327
2003-10-07* libfuncs.h (LTI_extendsfdf2, LTI_extendsfxf2, LTI_extendsftf2)Zack Weinberg1-1/+1
(LTI_extenddfxf2, LTI_extenddftf2, LTI_truncdfsf2, LTI_truncxfsf2) (LTI_trunctfsf2, LTI_truncxfdf2, LTI_trunctfdf2, LTI_floatsisf) (LTI_floatdisf, LTI_floattisf, LTI_floatsidf, LTI_floatdidf) (LTI_floattidf, LTI_floatsixf, LTI_floatdixf, LTI_floattixf) (LTI_floatsitf, LTI_floatditf, LTI_floattitf, LTI_fixsfsi, LTI_fixsfdi) (LTI_fixsfti, LTI_fixdfsi, LTI_fixdfdi, LTI_fixdfti, LTI_fixxfsi) (LTI_fixxfdi, LTI_fixxfti, LTI_fixtfsi, LTI_fixtfdi, LTI_fixtfti) (LTI_fixunssfsi, LTI_fixunssfdi, LTI_fixunssfti, LTI_fixunsdfsi) (LTI_fixunsdfdi, LTI_fixunsdfti, LTI_fixunsxfsi, LTI_fixunsxfdi) (LTI_fixunsxfti, LTI_fixunstfsi, LTI_fixunstfdi, LTI_fixunstfti) (extendsfdf2_libfunc, extendsfxf2_libfunc, extendsftf2_libfunc) (extenddfxf2_libfunc, extenddftf2_libfunc, truncdfsf2_libfunc) (truncxfsf2_libfunc, trunctfsf2_libfunc, truncxfdf2_libfunc) (trunctfdf2_libfunc, floatsisf_libfunc, floatdisf_libfunc) (floattisf_libfunc, floatsidf_libfunc, floatdidf_libfunc) (floattidf_libfunc, floatsixf_libfunc, floatdixf_libfunc) (floattixf_libfunc, floatsitf_libfunc, floatditf_libfunc) (floattitf_libfunc, fixsfsi_libfunc, fixsfdi_libfunc, fixsfti_libfunc) (fixdfsi_libfunc, fixdfdi_libfunc, fixdfti_libfunc, fixxfsi_libfunc) (fixxfdi_libfunc, fixxfti_libfunc, fixtfsi_libfunc, fixtfdi_libfunc) (fixtfti_libfunc, fixunssfsi_libfunc, fixunssfdi_libfunc) (fixunssfti_libfunc, fixunsdfsi_libfunc, fixunsdfdi_libfunc) (fixunsdfti_libfunc, fixunsxfsi_libfunc, fixunsxfdi_libfunc) (fixunsxfti_libfunc, fixunstfsi_libfunc, fixunstfdi_libfunc) (fixunstfti_libfunc): Delete. * optabs.h (struct optab_handlers): Break out of struct optab. (struct convert_optab, convert_optab, enum convert_optab_index, convert_optab_table, sext_optab, zext_optab, trunc_optab, sfix_optab, ufix_optab, sfixtrunc_optab, ufixtrunc_optab, sfloat_optab, ufloat_optab): New. (set_conv_libfunc): Prototype. (GEN_FCN): Use C90 indirect call syntax, remove unnecessary cast. (trunc_optab): Renamed btrunc_optab. * builtins.c (expand_builtin_mathfn): Update to match. * optabs.c (extendtab, fixtab, fixtrunctab, floattab): Delete. (convert_optab_table, new_convert_optab, init_convert_optab) (init_interclass_conv_libfuncs, init_intraclass_conv_libfuncs) (set_conv_libfunc): New. (can_extend_p, gen_extend_insn, can_fix_p, can_float_p) (expand_float, expand_fix): Use new conversion optabs, not old insn code tables or long chains of ifs. (init_optabs): No need to clear old insn code tables. Initialize the new optabs, not the old libfunc array entries. Don't handle FIXUNS_TRUNC_LIKE_FIX_TRUNC here. * genopinit.c: Initialize conversion optabs, not the former insn code tables. Remove unnecessary casts. Handle FIXUNS_TRUNC_LIKE_FIX_TRUNC here. * expr.c (convert_move): Remove redundant check that to_real==from_real. Use the conversion optabs instead of long chains of tests of modes. Move partial-integer-mode interconversion above all integer conversion. Do not recurse on a value forced into a register in the original mode. * config/gofast.h, config/frv/frv.c, config/ia64/ia64.c * config/mips/mips.c, config/pa/pa.c, config/rs6000/rs6000.c * config/sparc/sparc.c: Use set_conv_libfunc to adjust entries in new conversion optabs; do not reference the old libfunc array entries. No need to include libfuncs.h. From-SVN: r72178
2003-10-02target.h (init_libfuncs): New hook.Zack Weinberg1-7/+0
* target.h (init_libfuncs): New hook. * target-def.h: Default TARGET_INIT_BUILTINS and TARGET_INIT_LIBFUNCS to hook_void_void. Add TARGET_INIT_LIBFUNCS to TARGET_INITIALIZER. * builtins.c (default_init_builtins): Delete. * expr.h (default_init_builtins): Delete prototype. * doc/tm.texi: Document TARGET_INIT_LIBFUNCS and US_SOFTWARE_GOFAST. Tweak documentation of TARGET_FLOAT_LIB_COMPARE_RETURNS_BOOL. Remove documentation of INIT_TARGET_OPTABS, MULSI3_LIBCALL, DIVSI3_LIBCALL, UDIVSI3_LIBCALL, MODSI3_LIBCALL, UMODSI3_LIBCALL, MULDI3_LIBCALL, DIVDI3_LIBCALL, UDIVDI3_LIBCALL, MODDI3_LIBCALL, and UMODDI3_LIBCALL, * Makefile.in (optabs.o): Depends on target.h. * defaults.h: Provide default for FLOAT_LIB_COMPARE_RETURNS_BOOL. * optabs.c: Include target.h. (prepare_float_lib_cmp): No need for #ifdef around use of FLOAT_LIB_COMPARE_RETURNS_BOOL. (set_optab_libfunc): New function. (init_optabs): Delete use of all *_LIBCALL defines. Call targetm.init_libfuncs not INIT_TARGET_OPTABS. * optabs.h: Prototype set_optab_libfunc. * config.gcc: Remove all references to pa/long_double.h, ia64/hpux_longdouble.h, and gofast.h. (mips-*-*): When --enable-gofast, just add US_SOFTWARE_GOFAST to tm_defines; don't set INIT_SUBTARGET_OPTABS or change tm_file. * config/alpha/alpha.c, config/c4x/c4x.c, config/cris/cris.c * config/frv/frv.c, config/h8300/h8300.c, config/i860/i860.c * config/ia64/ia64.c, config/ip2k/ip2k.c, config/m68hc11/m68hc11.c * config/mips/mips.c, config/pa/pa.c, config/rs6000/rs6000.c * config/sparc/sparc.c, config/vax/vax.c: Provide a definition for TARGET_INIT_LIBFUNCS. Where necessary, include optabs.h, libfuncs.h, and/or config/gofast.h. * config/alpha/unicosmk.h, config/alpha/vms.h, config/c4x/c4x.h * config/avr/avr.h, config/cris/cris.h, config/frv/frv.h * config/h8300/h8300.h, config/i860/i860.h, config/ip2k/ip2k.h * config/iq2000/iq2000.h, config/m68hc11/m68hc11.h, config/mips/mips.h * config/rs6000/aix.h, config/rs6000/sysv4.h, config/sparc/elf.h * config/sparc/lite.h, config/sparc/netbsd-elf.h, config/sparc/sol2.h * config/sparc/sparc.h, config/v850/v850.h, config/vax/vax.h * config/vax/elf.h: Don't define or use INIT_TARGET_OPTABS, INIT_SUBTARGET_OPTABS, or any *_LIBCALL macros. * config/ia64/hpux.h: Redefine INTEL_EXTENDED_IEEE_FORMAT to 0. Set TARGET_INIT_LIBFUNCS and FLOAT_LIB_COMPARE_RETURNS_BOOL here. * config/pa/pa-hpux.h: Define LONG_DOUBLE_TYPE_SIZE, HPUX_LONG_DOUBLE_LIBRARY, and FLOAT_LIB_COMPARE_RETURNS_BOOL here. * config/ia64/hpux_longdouble.h, config/pa/long_double.h: Delete. * config/rs6000/xcoff.h: Don't define RS6000_ITRUNC nor RS6000_UITRUNC. * config/sparc/sparc.h: Default SUN_CONVERSION_LIBFUNCS and SUN_INTEGER_MULTIPLY_64 to 0. * config/sparc/sol2.h: Redefine SUN_CONVERSION_LIBFUNCS and SUN_INTEGER_MULTIPLY_64 to 1. * config/sparc/elf.h: Redefine SUN_CONVERSION_LIBFUNCS and SUN_INTEGER_MULTIPLY_64 to 0. * config/sparc/lite.h, config/sparc/liteelf.h, config/sparc/sp86x-elf.h: Define US_SOFTWARE_GOFAST. * config/vax/vax.h: Default TARGET_ELF to 0. * config/vax/elf.h: Redefine TARGET_ELF to 1. * config/gofast.h: Don't define any macros here. Provide one static function, gofast_maybe_init_libfuncs, which does what INIT_GOFAST_LIBFUNCS used to do but only if US_SOFTWARE_GOFAST is already defined. Do not clear negation libfuncs. Do not mess with HFmode, XFmode, or TFmode libfuncs. * config/avr/avr.c (avr_init_once): #if 0 out; mark FIXME. From-SVN: r72009
2003-09-18re PR target/11184 ([ia64 hpux] ICE on __builtin_apply building libobjc)Mark Mitchell1-73/+20
PR target/11184 * builtins.c (expand_builtin_apply): Use convert_memory_address before returning the value. * alias.c (find_base_value): Simplify use of convert_memory_address. (find_base_term): Likewise. * builtins.c (expand_builtin_stejmp_setup): Likewise. (expand_builtin_longjmp): Likewise. (expand_builtin_prefetch): Likewise. (get_memory_rtx): Likewise. (expand_builtin_return): Likewise. (expand_builtin_memcpy): Likewise. (expand_builtin_strncpy): Likewise. (expand_builtin_memset): Likewise. (expand_builtin_va_arg): Likewise. (expand_builtin_va_copy): Likewise. (expand_builtin_alloca): Likewise. * calls.c (expand_call): Likewise. * except.c (expand_builtin_extract_return_addr): Likewise. (expand_builtin_eh_return): Likewise. * explow.c (convert_memory_address): Define even when POINTER_EXTEND_UNSIGNED is not defined. Do nothing if the address is already in the right mode. * explow.c (memory_address): Simplify use of convert_memory_address. (probe_stack_range): Likewise. * expmed.c (make_tree): Likewise. * expr.c (emit_block_move_in_libcall): Likewise. (expand_assignment): Likewise. (expand_expr): Likewise. * function.c (assign_parms): Likewise. (expand_function_end): Likewise. * integrate.c (copy_rtx_and_substitute): Likewise. * stmt.c (expand_computed_goto): Likewise. PR target/11184 * gcc.dg/builtin-apply1.c: New test. From-SVN: r71539
2003-09-11builtins.c (fold_builtin_logarithm): if N can't be truncated to MODE exactly...Kaveh R. Ghazi1-5/+10
* builtins.c (fold_builtin_logarithm): if N can't be truncated to MODE exactly, then only convert logN(N) -> 1.0 if flag_unsafe_math_optimizations is set. From-SVN: r71322
2003-09-11builtins.c (builtin_dconsts_init, [...]): Delete.Kaveh R. Ghazi1-28/+0
* builtins.c (builtin_dconsts_init, dconstpi, dconste, init_builtin_dconsts): Delete. * emit-rtl.c (dconstpi, dconste): Define. (init_emit_once): Initialize dconstpi & dconste. * real.h (dconstpi, dconste): Declare. From-SVN: r71320
2003-09-09builtins.c (real_dconstp, [...]): New, split out from fold_builtin.Kaveh R. Ghazi1-98/+234
* 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-09builtins.c (fold_builtin_cabs): Protect the complex argument against ↵Roger Sayle1-0/+2
multiple evaluation when... * builtins.c (fold_builtin_cabs): Protect the complex argument against multiple evaluation when optimizing cabs* into sqrt*. From-SVN: r71242
2003-09-04builtins.c (apply_args_size): Guard against a NULL cfun.DJ Delorie1-4/+4
* builtins.c (apply_args_size): Guard against a NULL cfun. (expand_builtin_apply_args_1): Likewise. (expand_builtin_apply_args_1): Likewise. (expand_builtin_apply): Likewise. From-SVN: r71095
2003-09-03targhooks.c: New file.DJ Delorie1-23/+12
* targhooks.c: New file. * targhooks.h: New file. * Makefile.in: Add targhooks.o support. (function.o): Depend on$(TARGET_H). (stmt.o): Likewise. (combine.o): Depend on $(TREE_H) and $(TARGET_H). * builtins.c (apply_args_size, expand_builtin_apply_args_1, expand_builtin_apply): Convert to calls.struct_value_rtx hook. (expand_builtin_saveregs): Convert to calls.expand_builtin_saveregs hook. * c-decl.c (start_decl): Handle new calls.promote_prototypes hook here, instead of ... (get_parm_info) ... here. (store_parm_decls_oldstyle): Convert to calls.promote_prototypes hook. (finish_function): Handle calls.promote_prototypes hook here too. * c-typeck.c (convert_arguments): Convert to calls.promote_prototypes hook. (c_convert_parm_for_inlining): Likewise. * calls.c (initialize_argument_information): Convert to calls.promote_function_args hook. (expand_call): Convert to calls.struct_value_rtx, calls.strict_argument_naming, calls.pretend_outgoing_varargs_named, and calls.promote_function_return hooks. Pass fndecl to aggregate_value_p. Initialize CUMULATIVE_ARGS before calling hooks, so they can use that. (emit_library_call_value_1): Likewise. * combine.c (setup_incoming_promotions): Convert to calls.promote_function_args hook. * emit-rtl.c: Convert to calls.struct_value_rtx hook. * expr.c (expand_assignment): Pass call to aggregate_value_p. (expand_expr): Likewise. * expr.h: Remove support for SETUP_INCOMING_VARARGS, STRICT_ARGUMENT_NAMING, PRETEND_OUTGOING_VARARGS_NAMED, RETURN_IN_MEMORY macro defaults. * final.c (profile_function): Convert to calls.struct_value_rtx hook. * function.c (aggregate_value_p): Accept function type tree as second parameter; try to deduce fntype from it. Convert to calls.return_in_memory hook. (assign_parms): Convert to calls.setup_incoming_varargs, calls.strict_argument_naming, calls.promote_function_args, calls.pretend_outgoing_varargs_named hooks. Pass fndecl to aggregate_value_p. (expand_function_start): Likewise. Convert to calls.struct_value_rtx hook. (expand_function_end): Convert to calls.promote_function_return hook. (allocate_struct_function): Pass fndecl to aggregate_value_p. * hard-reg-set.h: Update comments to new hook names. * integrate.c (expand_inline_function): Pass fndecl to aggregate_value_p. * reg-stack.c (stack_result): Likewise. * rtl.h (struct_value_rtx, struct_value_incoming_rtx): Delete. * stmt.c (expand_value_return): Convert to calls.promote_function_return hook. * target-def.h: Add TARGET_PROMOTE_FUNCTION_ARGS, TARGET_PROMOTE_FUNCTION_RETURN, TARGET_PROMOTE_PROTOTYPES, TARGET_STRUCT_VALUE_RTX, TARGET_RETURN_IN_MEMORY, TARGET_EXPAND_BUILTIN_SAVEREGS, TARGET_SETUP_INCOMING_VARARGS, TARGET_STRICT_ARGUMENT_NAMING, TARGET_PRETEND_OUTGOING_VARARGS_NAMED, and TARGET_CALLS. * target.h: Likewise. * tree.h (aggregate_value_p): Also takes a tree to deduce function attributes from (for target hooks). * doc/tm.texi (PROMOTE_FUNCTION_ARGS, PROMOTE_FUNCTION_RETURN, PROMOTE_PROTOTYPES, RETURN_IN_MEMORY, STRUCT_VALUE_REGNUM, STRUCT_VALUE, STRUCT_VALUE_INCOMING_REGNUM, STRUCT_VALUE_INCOMING, EXPAND_BUILTIN_SAVEREGS, SETUP_INCOMING_VARARGS, STRICT_ARGUMENT_NAMING, PRETEND_OUTGOING_VARARGS_NAMED): Convert to hooks. * config/alpha/alpha.c (alpha_output_mi_thunk_osf): Pass function to aggregate_value_p. * config/arm/arm.c (arm_init_cumulative_args, arm_output_mi_thunk): Likewise. * config/i386/i386.c (ix86_return_pops_args, x86_this_parameter): Likewise. * config/mips/mips.c (mips_save_reg_p, mips_expand_prologue, mips_can_use_return_insn): Likewise. * config/rs6000/rs6000.c (rs6000_output_mi_thunk): Likewise. * config/s390/s390.c (s390_output_mi_thunk): Likewise. * config/sparc/sparc.c (sparc_output_mi_thunk): Pass function to aggregate_value_p. * config/story16/stormy16.c (xstormy16_asm_output_mi_thunk): Pass function to aggregate_value_p. * objc/objc-act.c (generate_struct_by_value_array): Pass NULL to aggregate_value_p. * config/sh/sh-protos.h (sh_builtin_saveregs): Remove. (sh_attr_renesas_p, sh_cfun_attr_renesas_p, sh_function_arg, sh_function_arg_advance, sh_pass_in_reg_p): New. * config/sh/sh.c (sh_handle_renesas_attribute, sh_promote_prototypes, sh_struct_value_rtx, sh_return_in_memory, sh_builtin_saveregs, sh_setup_incoming_varargs, sh_strict_argument_naming, sh_pretend_outgoing_varargs_named): New decls. (targetm): Add new hooks. (calc_live_regs): Save MACL and MACH if the function has the renesas attribute. (sh_expand_prologue): Support renesas attribute. (sh_builtin_saveregs): Make static. (sh_build_va_list): Support renesas attribute. (sh_va_start): Likewise. (sh_va_arg): Likewise. (sh_promote_prototypes): New. (sh_function_arg): New, moved from sh.h. Support renesas attribute. (sh_function_arg_advance): Likewise. (sh_return_in_memory): Likewise. (sh_strict_argument_naming): Likewise. (sh_pretend_outgoing_varargs_named): Likewise. (sh_struct_value_rtx): New. (sh_attribute): Add renesas attribute. (sh_handle_renesas_attribute): New. (sh_attr_renesas_p, sh_cfun_attr_renesas_p): New. (sh_ms_bitfield_layout_p): Support renesas attribute also. (sh_output_mi_thunk): Pass function to aggregate_value_p. * config/sh/sh.h (TARGET_SWITCHES): Add -mrenesas as an alias for -mhitachi. (STRUCT_VALUE_REGNUM, STRUCT_VALUE, RETURN_IN_MEMORY): Moved to target hooks. (sh_args): Add renesas_abi flag. (INIT_CUMULATIVE_ARGS): Set it. Pass fndecl to aggregate_value_p. (FUNCTION_ARG_ADVANCE, FUNCTION_ARG): Move to sh.c. (PASS_IN_REG_P): Support renesas attribute. Pass DF and TF on the stack for the renesas abi. (STRICT_ARGUMENT_NAMING, PRETEND_OUTGOING_VARARGS_NAMED, SETUP_INCOMING_VARARGS, EXPAND_BUILTIN_SAVEREGS, PROMOTE_PROTOTYPES): Moved to sh.c. * config/sh/sh.md (call): Set call cookie to indicate renesas calls. * decl.c (finish_function): Pass fndecl to aggregate_value_p. * misc.c (default_pass_by_ref): Convert to calls.return_in_memory hook. From-SVN: r71048
2003-08-31builtins.c (expand_builtin_setjmp): Use emit_jump to jump around the != 0 ↵Olivier Hainque1-3/+4
case... * builtins.c (expand_builtin_setjmp): Use emit_jump to jump around the != 0 case, which ensures pending stack adjustments are flushed. From-SVN: r70958
2003-08-29builtins.c (expand_builtin_constant_p): Check cse_not_expected here, ↵Richard Henderson1-6/+9
(fold_builtin_constant_p) ... * builtins.c (expand_builtin_constant_p): Check cse_not_expected here, (fold_builtin_constant_p) ... not here. From-SVN: r70926
2003-08-29* builtins.c (mathfn_built_in): Handle new math builtins.Kaveh R. Ghazi1-0/+61
From-SVN: r70913
2003-08-27builtins.c (expand_builtin_expect_jump): Save pending_stack_adjust and ↵Jakub Jelinek1-1/+5
restore it if returning NULL. * builtins.c (expand_builtin_expect_jump): Save pending_stack_adjust and restore it if returning NULL. * gcc.dg/20030826-2.c: New test. From-SVN: r70844
2003-08-26builtins.c (fold_builtin_bitop): New function to perform constant folding of ↵Roger Sayle1-0/+126
ffs... * builtins.c (fold_builtin_bitop): New function to perform constant folding of ffs, clz, ctz, popcount and parity builtin functions and their long and long long variants (such as ffsl and ffsll). (fold_builtin): fold_builtin_bitop when appropriate. * simplify-rtx.c (simplify_unary_operation): Honor both CLZ_DEFINED_VALUE_AT_ZERO and CTZ_DEFINED_VALUE_AT_ZERO when evaluating clz and ctz at compile-time, for operands wider than HOST_WIDE_INT. From-SVN: r70806
2003-08-26builtins.c (build_function_call_expr): Don't set TREE_SIDE_EFFECTS here.Nathan Sidwell1-1/+0
* builtins.c (build_function_call_expr): Don't set TREE_SIDE_EFFECTS here. * expr.c (emit_block_move_via_libcall): Likewise. (clear_storage_via_libcall): Likewise. * tree.c (build): Set TREE_SIDE_EFFECTS for non-const, non-pure CALL_EXPRs. cp: * call.c (build_call): Don't set TREE_SIDE_EFFECTS here. (build_new_method_call): Add goto finish. * semantics.c (simplify_aggr_init_exprs_r): Don't set TREE_SIDE_EFFECTS on a call. testsuite: * c++.dg/warn/noeffect3.C: New test. From-SVN: r70802
2003-08-26builtins.c (expand_builtin_mathfn): Rearrange so that we only return 0 for ↵Roger Sayle1-32/+76
invalid argument types. * builtins.c (expand_builtin_mathfn): Rearrange so that we only return 0 for invalid argument types. Instead drop through to a call of expand_call at the bottom of function. If op is SQRT, try attaching a SQRT rtx as the REQ_EQUAL note of the libcall. From-SVN: r70792
2003-08-20builtins.c (expand_builtin_mathfn): Use get_callee_fndecl.Jason Merrill1-7/+7
* builtins.c (expand_builtin_mathfn): Use get_callee_fndecl. (expand_builtin_mathfn2, expand_builtin, builtin_mathfn_code, fold_trunc_transparent_mathfn, fold_builtin): Likewise. * dojump.c (do_jump): Likewise. * fold-const.c (operand_equal_p, fold): Likewise. (tree_expr_nonnegative_p): Likewise. From-SVN: r70611
2003-08-19builtins.c: Fix comment typos.Kazu Hirata1-1/+1
* builtins.c: Fix comment typos. * c-common.c: Likewise. * c-decl.c: Likewise. * c-pretty-print.c: Likewise. * cfgbuild.c: Likewise. * cfglayout.c: Likewise. * cfgloopanal.c: Likewise. * cgraphunit.c: Likewise. * cppfiles.c: Likewise. * dwarfout.c: Likewise. * expr.c: Likewise. * fold-const.c: Likewise. * gcse.c: Likewise. * ggc-page.c: Likewise. * haifa-sched.c: Likewise. * pretty-print.c: Likewise. * tree.c: Likewise. * tree.h: Likewise. * value-prof.c: Likewise. From-SVN: r70583
2003-08-14builtins.c (CASE_MATHFN): New helper macro.Kaveh R. Ghazi1-200/+39
* builtins.c (CASE_MATHFN): New helper macro. (mathfn_built_in): Simplify and sort. From-SVN: r70436
2003-08-11builtins.c (expand_builtin_strcat): Optimize constant strings.Kaveh R. Ghazi1-3/+46
* builtins.c (expand_builtin_strcat): Optimize constant strings. testsuite: * gcc.c-torture/execute/string-opt-9.c: Add more strcat cases. From-SVN: r70317
2003-08-06builtins.c (expand_builtin): When not optimizing...Roger Sayle1-91/+6
* builtins.c (expand_builtin): When not optimizing, call the library function for all builtins that have library functions (except alloca). From-SVN: r70195
2003-08-01fold-const.c (fold <MULT_EXPR>): Optimize both x*pow(x,c) and pow(x,c)*x as ↵Roger Sayle1-32/+15
pow(x,c+1) for constant values c. * fold-const.c (fold <MULT_EXPR>): Optimize both x*pow(x,c) and pow(x,c)*x as pow(x,c+1) for constant values c. Optimize x*x as pow(x,2.0) when the latter will be expanded back into x*x. (fold <RDIV_EXPR>): Optimize pow(x,c)/x as pow(x,c-1). * builtins.c (expand_builtin_pow): Ignore flag_errno_math as pow can never set errno when used with an integer exponent. Always use expand_powi when exponent is -1, 0, 1 or 2. (fold_builtin): Don't rewrite pow(x,2.0) as x*x nor pow(x,-2.0) as 1.0/(x*x). This avoids unbounded recursion as we now prefer the pow forms of these expressions. * gcc.dg/builtins-27.c: New test case. From-SVN: r70030