aboutsummaryrefslogtreecommitdiff
path: root/gcc/builtins.c
AgeCommit message (Collapse)AuthorFilesLines
2003-07-11optabs.c (prepare_cmp_insn): Try cmpmemM first if it exists, then fall back ↵Jakub Jelinek1-5/+24
to cmpstrM. * optabs.c (prepare_cmp_insn): Try cmpmemM first if it exists, then fall back to cmpstrM. * builtins.c (expand_builtin_memcmp): Likewise. * config/s390/s390-protos.h (s390_expand_cmpstr): Rename to... (s390_expand_cmpmem): ... this. * config/s390/s390.md (cmpmemdi, cmpmemsi, cmpmem_short_64, cmpmem_short_31, cmpmem_long_64, cmpmem_long_31): Renamed from cmpstr* patterns. Rename call to s390_expand_cmpstr to s390_expand_cmpmem. * config/s390/s390.c (s390_expand_cmpstr): Rename to... (s390_expand_cmpstr): ... this. Rename cmpstr* instructions to cmpmem*. * config/i370/i370.md (cmpmemsi, cmpmemsi_1): Renamed from cmpstr* patterns. * doc/md.texi (cmpstrM): Describe as String compare insn, not Block compare insn. (cmpmemM): Add. * gcc.dg/20030711-1.c: New test. From-SVN: r69243
2003-07-03real.c (real_trunc, [...]): New functions to implement trunc, floor and ceil ↵Roger Sayle1-3/+203
respectively. * real.c (real_trunc, real_floor, real_ceil): New functions to implement trunc, floor and ceil respectively. * real.h (real_trunc, real_floor, real_ceil): Prototype here. * builtins.c (integer_valued_real_p): New function to test if a floating point expression has an integer valued result. (fold_trunc_transparent_mathfn): Optimize foo(foo(x)) as foo(x) where foo is an integer rounding function. Similarly, optimize foo(bar(x)) as bar(x), and foo((double)(int)x) as (double)(int)x when both foo and bar are integer rounding functions and we don't need to honor errno. (fold_builtin_trunc, fold_builtin_floor, fold_builtin_ceil): New functions to fold trunc, floor and ceil. (fold_builtin): Use fold_builtin_trunc to fold BUILT_IN_TRUNC*, fold_builtin_floor to fold BUILT_IN_FLOOR* and fold_builtin_ceil to fold BUILT_IN_CEIL*. * fold-const.c (tree_expr_nonnegative_p): Handle FLOAT_EXPR and the remaining integer rounding functions. * gcc.dg/builtins-25.c: New testcase. * gcc.dg/builtins-26.c: New testcase. From-SVN: r68903
2003-06-29builtins.c (expand_builtin_mathfn, [...]): Avoid busy work when builtin is ↵Jan Hubicka1-0/+9
not supported by the backend. * builtins.c (expand_builtin_mathfn, expand_builtin_mathfn_2): Avoid busy work when builtin is not supported by the backend. From-SVN: r68681
2003-06-29alloc-pool.c: Fix comment formatting.Kazu Hirata1-1/+1
* alloc-pool.c: Fix comment formatting. * bitmap.c: Likewise. * bitmap.h: Likewise. * bt-load.c: Likewise. * builtins.c: Likewise. * caller-save.c: Likewise. * cfganal.c: Likewise. * cfgrtl.c: Likewise. * collect2.c: Likewise. * cse.c: Likewise. * df.c: Likewise. * diagnostic.c: Likewise. * dwarf2out.c: Likewise. * dwarfout.c: Likewise. * expmed.c: Likewise. * final.c: Likewise. * flags.h: Likewise. * fold-const.c: Likewise. * gcc.c: Likewise. * gcov-io.h: Likewise. * gcov.c: Likewise. * genattrtab.c: Likewise. * genautomata.c: Likewise. * libgcov.c: Likewise. * mips-tfile.c: Likewise. * optabs.c: Likewise. * prefix.c: Likewise. * rtlanal.c: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * toplev.c: Likewise. * varasm.c: Likewise. * vmsdbgout.c: Likewise. From-SVN: r68672
2003-06-28builtins.c: Follow spelling conventions.Kazu Hirata1-2/+2
* builtins.c: Follow spelling conventions. * cgraph.c: Likewise. * cpplex.c: Likewise. * config/arm/arm.c: Likewise. * config/arm/iwmmxt.md: Likewise. * config/c4x/c4x-modes.def: Likewise. * config/c4x/c4x.c: Likewise. * config/c4x/c4x.h: Likewise. * config/c4x/c4x.md: Likewise. * config/i386/i386-interix.h: Likewise. * config/mips/mips.h: Likewise. From-SVN: r68648
2003-06-28Typo fix.Jakub Jelinek1-1/+1
From-SVN: r68635
2003-06-28builtins.c (c_strlen): Add only_value argument.Jakub Jelinek1-13/+48
* builtins.c (c_strlen): Add only_value argument. Handle COND_EXPR and COMPOUND_EXPR. (expand_builtin_strlen): Optimize also strlen (i++ ? "foo" : "bar"). Adjust c_strlen callers. (expand_builtin_strcpy, expand_builtin_strncpy, expand_builtin_strcmp, expand_builtin_strncmp, expand_builtin_fputs, expand_builtin_sprintf, fold_builtin): Adjust c_strlen callers. * gcc.c-torture/execute/builtins/string-8.c: New test. * gcc.c-torture/execute/builtins/string-8-lib.c: New. * gcc.c-torture/execute/stdio-opt-1.c (main): Add new tests. * gcc.c-torture/execute/string-opt-7.c (main): Add new test. From-SVN: r68634
2003-06-27rtl.h (emit_note): Remove FILE parameter.Nathan Sidwell1-1/+1
* rtl.h (emit_note): Remove FILE parameter. * emit-rtl.c (emit_line_note): Adjust emit_note call. (emit_note): Remove FILE parameter. Adjust. * builtins.c (expand_builtin_expect): Adjust emit_note call. * c-semantics.c (genrtl_scope_stmt): Likewise. (expand_stmt): Likewise. * cfglayout.c (reemit_insn_block_notes): Likewise. (duplicate_insn_chain): Likewise. * except.c (expand_eh_region_start, expand_eh_region_end, sjlj_emit_function_enter): Likewise. * explow.c (probe_stack_range): Likewise. * expr.c (emit_block_move_via_loop): Likewise. * function.c (init_function_start, expand_function_start, expand_function_end, thread_prologue_and_epilogue_insns): Likewise. * integrate.c (expand_inline_function, copy_insn_list): Likewise. * reg-stack.c (compensate_edge): Likewise. * reload1.c (reload): Likewise. * rtlanal.c (hoist_insn_to_edge): Likewise. * stmt.c (expand_fixup, expand_start_loop, expand_start_null_loop, expand_loop_continue_here, expand_end_loop, expand_continue_loop, expand_exit_loop_top_cond, expand_value_return, expand_start_bindings_and_block, expand_end_bindings, expand_decl_cleanup, expand_start_case): Likewise. * unroll.c (copy_loop_body * config/alpha/alpha.c (alpha_output_mi_thunk_osf): Likewise. * config/ia64/ia64.c (ia64_output_mi_thunk): Likewise. * config/rs6000/rs6000.c (rs6000_emit_eh_toc_restore, rs6000_emit_allocate_stack, rs6000_output_function_prologue, rs6000_output_function_epilogue, rs6000_output_mi_thunk): Likewise. * config/sh/sh.c (sh_output_mi_thunk): Likewise. * config/sparc/sparc.c (sparc_output_mi_thunk): Likewise. * ada/misc.c (record_code_position): Likewise. From-SVN: r68561
2003-06-27builtins.c (expand_builtin_sprintf): Use c_getstr and strlen to obtain the ↵Roger Sayle1-24/+17
format string instead of using... * builtins.c (expand_builtin_sprintf): Use c_getstr and strlen to obtain the format string instead of using TREE_STRING_POINTER and TREE_STRING_LENGTH. Only optimize sprintf(dst,"%s",src) when the return value is unused or the length of src is a known constant. * gcc.c-torture/execute/string-opt-16.c: Remove test for disabled sprintf(dst,"%s",src) optimization. * gcc.c-torture/execute/20030626-1.c: New test case. * gcc.c-torture/execute/20030626-2.c: New test case. Co-Authored-By: Jakub Jelinek <jakub@redhat.com> From-SVN: r68555
2003-06-26builtins.c (expand_builtin_mathfn): Always stabilize the argument list ↵Roger Sayle1-65/+37
against re-evaluation. * builtins.c (expand_builtin_mathfn): Always stabilize the argument list against re-evaluation. If expand_unop fails, call expand_call with the stabilized argument list rather than return NULL_RTX. (expand_builtin_mathfn2): Likewise, always stabilize the argument list, and call expand_call ourselves if expand_binop fails. Co-Authored-By: Richard Henderson <rth@redhat.com> From-SVN: r68526
2003-06-25re PR rtl-optimization/11311 (ICE with pow and large exponent)Roger Sayle1-1/+1
PR optimization/11311 * builtins.c (powi_cost): Fix typo. The number of multiplications required is the number to reduce the argument, result, plus the cost of calculating the residual, val [not n, the original value]. * gcc.c-torture/compile/20030624-1.c: New test case. From-SVN: r68452
2003-06-24builtins.c (expand_builtin_strcpy): Don't evaluate side-effects in src twice.Jakub Jelinek1-1/+1
* builtins.c (expand_builtin_strcpy): Don't evaluate side-effects in src twice. * gcc.c-torture/execute/string-opt-17.c: New test. From-SVN: r68431
2003-06-24builtins.c (expand_builtin): Use expand_builtin_pow to expand calls for pow...Roger Sayle1-0/+254
* builtins.c (expand_builtin): Use expand_builtin_pow to expand calls for pow, powf, powl and their __builtin_ variants. (expand_builtin_pow): If the second argument is a constant integer and compiling with -ffast-math, use expand_powi to generate RTL if powi_cost is less than POWI_MAX_MULTS. (powi_cost): New function to return the number of multiplications necessary to evaluate an Nth power, for integer constant N. (expand_powi): New function to expand the RTL for evaluating the Nth power of a floating point value, for integer constant N. * doc/tm.texi (POWI_MAX_MULTS): Document new target macro. * gcc.dg/builtins-24.c: New test case. From-SVN: r68401
2003-06-23basic-block.h: Fix comment formatting.Kazu Hirata1-1/+1
* basic-block.h: Fix comment formatting. * bt-load.c: Likewise. * builtins.c: Likewise. * c-common.c: Likewise. * c-common.h: Likewise. * c-format.c: Likewise. * coverage.c: Likewise. * cpplib.h: Likewise. * cpppch.c: Likewise. * dbxout.c: Likewise. * diagnostic.c: Likewise. * dwarf2out.c: Likewise. * expr.c: Likewise. * fold-const.c: Likewise. * function.c: Likewise. * gcc.c: Likewise. * gcov-io.c: Likewise. * gcov-io.h: Likewise. * gcov.c: Likewise. * profile.c: Likewise. * real.h: Likewise. * sched-deps.c: Likewise. From-SVN: r68369
2003-06-23builtins.c (expand_builtin_mathfn_2): Use tree_cons to build up the ↵Roger Sayle1-10/+114
stabilized argument list, not build_tree_list. * builtins.c (expand_builtin_mathfn_2): Use tree_cons to build up the stabilized argument list, not build_tree_list. (expand_builtin_strcpy): Construct new argument list manually instead of using chainon to modify the original argument list. (expand_builtin_stpcpy): Construct new argument list manually instead of using copy_list and chainon. (expand_builtin_sprintf): New function. Optimize calls to sprintf when the format is "%s" or doesn't contain a '%'. (expand_builtin): Expand BUILT_IN_SPRINTF using the new function expand_builtin_sprintf. * gcc.c-torture/execute/string-opt-16.c: New test case. From-SVN: r68355
2003-06-19builtins.c (expand_errno_check): Assume that flag_errno_math and HONOR_NANS ↵Roger Sayle1-85/+115
have been tested before calling here. * builtins.c (expand_errno_check): Assume that flag_errno_math and HONOR_NANS have been tested before calling here. Only try to set errno ourselves if the decl can't throw an exception. (expand_builtin_mathfn): Move the code to stabilize the arg after the main switch, so that that its only done when needed. BUILT_IN_SQRT{,F,L} doesn't set errno if its arg is nonnegative. Don't modify the original expr when stabilizing the argument. (expand_builtin_mathfn_2): Likewise, move the code to stabilize the args after the main switch, and don't modify the orginal exp. From-SVN: r68217
2003-06-16decl.c, [...]: Don't use the PTR macro.Kaveh R. Ghazi1-10/+10
cp: * cp/decl.c, cp/pt.c, cp/search.c, cp/tree.c: Don't use the PTR macro. gcc: * bitmap.c, builtins.c, c-incpath.c, cgraph.c, config/frv/frv.c, config/mips/mips.c, cppfiles.c, cpphash.c, cppinit.c, cpplib.c, dwarf2out.c, dwarfout.c, except.c, expr.c, expr.h, fold-const.c, function.c, gcc.c, genoutput.c, gensupport.c, global.c, haifa-sched.c, hashtable.c, ifcvt.c, integrate.c, local-alloc.c, loop.c, mips-tdump.c, mips-tfile.c, mkdeps.c, protoize.c, read-rtl.c, recog.h, reload1.c, sbitmap.c, ssa-dce.c, stringpool.c, tlink.c, tree.c, varasm.c, varray.c: Don't use the PTR macro. From-SVN: r68043
2003-06-16builtin-attrs.def, [...]: Don't use macros from "symcat.h", instead rely on ↵Kaveh R. Ghazi1-1/+1
ISO C. * builtin-attrs.def, builtin-attrs.def, builtins.c, cpplex.c, cpplib.c, gencheck.c, gengenrtl.c, machmode.def, protoize.c: Don't use macros from "symcat.h", instead rely on ISO C. * system.h: Don't include "symcat.h". * configure.in (AC_C_STRINGIZE): Delete. * config.in, configure: Regenerate. From-SVN: r68035
2003-06-16optabs.h (enum optab_index): Add new OTI_tan and OTI_atan.Roger Sayle1-9/+23
* optabs.h (enum optab_index): Add new OTI_tan and OTI_atan. (tan_optab, atan_optab): Define corresponding macros. * optabs.c (init_optabs): Initialize tan_optab and atan_optab. * genopinit.c (optabs): Implement tan_optab and atan_optab using tan?f2 and atan?f2 patterns. * builtins.c (expand_builtin_mathfn): Handle BUILT_IN_TAN{,F,L} using tan_optab, and BUILT_IN_ATAN{,F,L} using atan_optab. Change the default value of errno_set to false. (expand_builtin): Expand BUILT_IN_TAN{,F,L} and BUILT_IN_ATAN{,F,L} using expand_builtin_mathfn. * config/i386/i386.md (atansf2, atandf2, atanxf2, atantf2): New expander patterns implemented using existing atan2?f3 patterns. * gcc.dg/i386-387-5.c: New test case. * gcc.dg/i386-387-6.c: New test case. * gcc.dg/builtins-23.c: New test case. From-SVN: r68013
2003-06-15alloc-pool.c: Convert to ISO C90 prototypes.Andreas Jaeger1-340/+170
* alloc-pool.c: Convert to ISO C90 prototypes. * alloc-pool.h: Likewise. * alias.c: Likewise. * attribs.c: Likewise. * bb-reorder.c: Likewise. * bitmap.h: Likewise. * bitmap.c: Likewise. * builtins.c: Likewise. * tree.h: Convert prototypes of attribs.c to ISO C90. * basic-block.h: Convert prototypes of bb-reorder.c to ISO C90. * rtl.h: Convert prototypes of alias.c and builtins.c to ISO C90. * expr.h: Convert prototypes of builtins.c to ISO C90. From-SVN: r67975
2003-06-15builtins.c (expand_builtin_expect_jump): Remove redundant tests that are ↵Kazu Hirata1-7/+2
also in any_condjump_p(). * builtins.c (expand_builtin_expect_jump): Remove redundant tests that are also in any_condjump_p(). From-SVN: r67966
2003-06-13builtins.c: Fix comment typos.Kazu Hirata1-1/+1
* builtins.c: Fix comment typos. * fold-const.c: Likewise. From-SVN: r67907
2003-06-10builtins.c (fold_builtin): Optimize cos(-x) as cos(x).Roger Sayle1-0/+8
* builtins.c (fold_builtin): Optimize cos(-x) as cos(x). * fold-const.c (fold <NEGATE_EXPR>): Convert -f(x) into f(-x) when x is easily negated and f is sin, tan or atan. (fold <MULT_EXPR>): Optimize tan(x)*cos(x) and cos(x)*tan(x) as sin(x) with flag_unsafe_math_optimizations. (fold <RDIV_EXPR>): With flag_unsafe_math_optimizations fold sin(x)/cos(x) as tan(x) and cos(x)/sin(x) as 1.0/tan(x). * gcc.dg/builtins-20.c: New test case. From-SVN: r67701
2003-06-06fold-const.c (fold <ABS_EXPR>): Re-fold the result of folding fabs(-x) into ↵Roger Sayle1-0/+99
fabs(x). * fold-const.c (fold <ABS_EXPR>): Re-fold the result of folding fabs(-x) into fabs(x). Use tree_expr_nonnegative_p to determine when the ABS_EXPR (fabs or abs) is not required. (tree_expr_nonnegative_p): Move the logic that sqrt and exp are always nonnegative from fold to here. Additionally, cabs and fabs are always non-negative, and pow and atan are non-negative if their first argument is non-negative. * builtins.c (fold_builtin_cabs): New function to fold cabs{,f,l}. Evaluate cabs of a constant at compile-time. Convert cabs of a non-complex argument into fabs. Convert cabs(z) into sqrt(z.r*z.r + z.i*z.i) at the tree-level with -ffast-math or -funsafe-math-optimizations or -ffast-math. (fold_builtin): Convert BUILT_IN_FABS{,F,L} into an ABS_EXPR. Fold BUILT_IN_CABS{,F,L} using fold_builtin_cabs. * gcc.dg/builtins-2.c: Add some more tests. * gcc.dg/builtins-18.c: New test case. * gcc.dg/builtins-19.c: New test case. From-SVN: r67541
2003-06-04builtins.c (dconstpi, dconste): New mathematical constants.Roger Sayle1-2/+104
* builtins.c (dconstpi, dconste): New mathematical constants. (init_builtin_dconsts): New function to initialize dconstpi and dconste. (fold_builtin): Optimize exp(1.0) = e. Evaluate exp(x) at compile time with -ffast-math when x is an integer constant. Optimize tan(0.0) = 0.0. Optimize atan(0.0) = 0.0, atan(1.0) = pi/4 and tan(atan(x)) = x with -ffast-math. * gcc.dg/builtins-2.c: Add tests for tan(atan(x)). * gcc.dg/builtins-3.c: Add tests for tan(0.0) and atan(0.0). * gcc.dg/builtins-7.c: Add tests for tan(atan(x)) == x. * gcc.dg/builtins-17.c: New test case. * gcc.dg/i386-387-4.c: New test case. * gcc.c-torture/execute/ieee/mzero4.c: New test case. From-SVN: r67438
2003-06-03builtins.def (BUILT_IN_CABS, [...]): New builtins representing ISO C99's ↵Roger Sayle1-2/+71
cabs, cabsf and cabsl. * builtins.def (BUILT_IN_CABS, BUILT_IN_CABSF, BUILT_IN_CABSL): New builtins representing ISO C99's cabs, cabsf and cabsl. * builtins.c (expand_builtin_fabs): New function. (expand_builtin_cabs): New function. (expand_builtin): Expand BUILT_IN_FABS{,F,L} and BUILT_IN_CABS{,F,L} using expand_builtin_fabs and expand_builtin_cabs respectively. * doc/extend.texi: Document new cabs, cabsf and cabsl builtins. * gcc.dg/builtins-16.c: New test case. From-SVN: r67368
2003-06-03builtins.c (expand_builtin_memcpy): Remove endp argument and endp != 0 handling.Jakub Jelinek1-72/+99
* builtins.c (expand_builtin_memcpy): Remove endp argument and endp != 0 handling. Pass 0 to store_by_pieces. (expand_builtin_mempcpy): Add endp argument. Don't call expand_builtin_memcpy, call store_by_pieces resp. move_by_pieces directly. If ignoring result, only do expand_call. (expand_builtin_stpcpy): Likewise. Call expand_builtin_mempcpy otherwise. (expand_builtin_strncpy, expand_builtin_memset): Adjust store_by_pices callers. (expand_builtin): Adjust expand_builtin_memcpy and expand_builtin_mempcpy callers. * expr.c (can_move_by_pieces): New function. (move_by_pieces): Add endp argument, return to resp. memory at end or one byte earlier depending on endp. (store_by_pieces): Likewise. (emit_block_move): Adjust call to move_by_pieces. (emit_push_insn): Adjust move_by_pieces caller. * expr.h (can_move_by_pieces): New prototype. (store_by_pieces): Adjust prototypes. * rtl.h (move_by_pieces): Adjust prototype. * config/mips/mips.c (expand_block_move): Adjust move_by_pieces caller. * gcc.c-torture/execute/builtins/string-4.c (main_test): Remove mempcpy test with post-increments. * gcc.c-torture/execute/string-opt-3.c: New test. * gcc.dg/string-opt-1.c: New test. From-SVN: r67358
2003-05-27tree.h (contains_placeholder_p): Now returns bool.Richard Kenner1-2/+2
* tree.h (contains_placeholder_p): Now returns bool. (CONTAINS_PLACEHOLDER_P): New macro. (type_contains_placeholder_p): New function. * tree.c (save_expr): Remove code avoiding folding COMPONENT_REF. (contains_placeholder_p): Now returns bool. Rework to use CONTAINS_PLACEHOLDER_P macro. (type_contains_placeholder_p): New function. * fold-const.c (fold, case COMPONENT_REF): Don't fold if type_contains_placeholder_p. (fold_range_test, fold_mathfn_compare, fold_inf_compare, fold): Use CONTAINS_PLACEHOLDER_P macro. * builtins.c (fold_builtin): Likewise. * calls.c (initialize_argument_information): Likewise. * emit-rtl.c (set_mem_attributes_minus_bitpos): Likewise. * explow.c (expr_size): Likewise. * expr.c (store_constructor, get_inner_reference): Likewise. * function.c (assign_parms): Likewise. * stor-layout.c (variable_size): Likewise. From-SVN: r67189
2003-05-24builtins.c (expand_builtin_memcpy): Use mode of dest_addr for intermediate ↵Matt Kraai1-1/+1
computation. * builtins.c (expand_builtin_memcpy): Use mode of dest_addr for intermediate computation. From-SVN: r67154
2003-05-23builtins.def: Defome atan...Roger Sayle1-0/+36
* builtins.def: Defome atan, atanf, atanl, tan, tanf and tanl builtin functions (and their __builtin_* variants). * builtins.c (mathfn_built_in): Handle tan{,f,l} and atan{,f,l}. (expand_builtin): Don't expand tan{,f,l} or atan{,f,l} when not optimizing. * doc/extend.texi: Document new tan and atan builtins, and their float and long double variants. * gcc.dg/builtins-1.c: Add tests for tan and atan. * gcc.dg/builtins-4.c: Add test for fmod. From-SVN: r67137
2003-05-18re PR middle-end/10472 (ICE in instantiate_virtual_regs_lossage)Roger Sayle1-6/+19
PR middle-end/10472 * builtins.c (expand_builtin_memcpy): Call force_operand on expressions and use simplify_gen_binary to create the addition. * gcc.c-torture/compile/20030518-1.c: New test case. Co-Authored-By: Kaveh R. Ghazi <ghazi@caip.rutgers.edu> Co-Authored-By: Zack Weinberg <zack@codesourcery.com> From-SVN: r66941
2003-05-17builtins.c (validate_arglist): Eliminate libiberty VA_ macros, always use ↵Kaveh R. Ghazi1-5/+5
stdarg. gcc: * builtins.c (validate_arglist): Eliminate libiberty VA_ macros, always use stdarg. * c-errors.c (pedwarn_c99): Likewise. * c-format.c (status_warning): Likewise. * c-semantics.c (build_stmt): Likewise. * calls.c (emit_library_call, emit_library_call_value): Likewise. * collect2.c (notice, fatal_perror, fatal, error): Likewise. * cpperror.c (cpp_error, cpp_error_with_line): Likewise. * diagnostic.c (build_message_string, output_printf, output_verbatim, verbatim, inform, warning, pedwarn, error, sorry, fatal_error, internal_error, warning_with_decl, pedwarn_with_decl, error_with_decl, fnotice): Likewise. * dwarf2asm.c (dw2_asm_output_data, dw2_asm_output_delta, dw2_asm_output_offset, dw2_asm_output_pcrel, dw2_asm_output_addr, dw2_asm_output_addr_rtx, dw2_asm_output_nstring, dw2_asm_output_data_uleb128, dw2_asm_output_data_sleb128, dw2_asm_output_delta_uleb128, dw2_asm_output_delta_sleb128, dw2_asm_output_encoded_addr_rtx): Likewise. * emit-rtl.c (gen_rtx, gen_rtvec): Likewise. * errors.c (warning, error, fatal, internal_error): Likewise. * final.c (output_operand_lossage, asm_fprintf): Likewise. * fix-header.c (fatal): Likewise. * gcc.c (fatal, error, notice): Likewise. * gcov.c (fnotice): Likewise. * genattrtab.c (attr_rtx, attr_printf): Likewise. * gengtype.c (error_at_line, xasprintf, oprintf): Likewise. * gensupport.c (message_with_line): Likewise. * mips-tfile.c (fatal, error): Likewise. * protoize.c (notice): Likewise. * ra-debug.c (ra_debug_msg): Likewise. * read-rtl.c (fatal_with_file_and_line): Likewise. * rtl-error.c (error_for_asm, warning_for_asm): Likewise. * tree.c (build, build_nt, build_function_type_list): Likewise. cp: * error.c (cp_error_at, cp_warning_at, cp_pedwarn_at): Eliminate libiberty VA_ macros, always use stdarg. * rtti.c (create_pseudo_type_info): Likewise. * tree.c (build_min_nt, build_min): Likewise. From-SVN: r66919
2003-05-08builtins.c (readonly_data_expr): New function.Kaveh R. Ghazi1-4/+24
gcc: * builtins.c (readonly_data_expr): New function. (expand_builtin_memmove): Optimize any rodata source, not just strings. testsuite gcc.c-torture/execute/string-opt-19.c: Add general rodata tests. (bcopy): Call memmove. From-SVN: r66597
2003-05-06real.c (real_powi): New function to calculate the value of a real raised to ↵Roger Sayle1-3/+23
an integer power, i.e. * real.c (real_powi): New function to calculate the value of a real raised to an integer power, i.e. pow(x,n) for int n. (real_sqrt): Convert to using the faster do_add, do_multiply and do_divide API for consistency with the rest of real.c. * real.h (real_powi): Prototype here. * builtins.c (fold_builtin): Avoid local variable mode when evaluating sqrt at compile time. Attempt to evaluate pow at compile-time, by checking for an integral exponent. * gcc.dg/builtins-14.c: New test case. From-SVN: r66515
2003-05-05builtins.c (expand_builtin_stpcpy): Only expand when the length of the ↵Kaveh R. Ghazi1-3/+7
source string can be evaluated at compile-time. * builtins.c (expand_builtin_stpcpy): Only expand when the length of the source string can be evaluated at compile-time. From-SVN: r66503
2003-05-05builtins.c (expand_builtin_mempcpy): New function.Jakub Jelinek1-2/+60
* builtins.c (expand_builtin_mempcpy): New function. (expand_builtin_stpcpy): Optimize stpcpy whose return value is ignored into strcpy no matter what arguments it has. (expand_builtin) <case BUILT_IN_MEMPCPY>: Call expand_builtin_mempcpy. * gcc.c-torture/execute/string-opt-18.c (main): Add 3 new tests. From-SVN: r66498
2003-05-04builtins.c (expand_builtin_constant_p, [...]): Update prototypes.Kaveh R. Ghazi1-50/+32
* builtins.c (expand_builtin_constant_p, expand_builtin_strlen, expand_builtin_frame_address): Update prototypes. (expand_builtin_constant_p, expand_builtin_strlen, expand_builtin_strcpy, expand_builtin_memset, expand_builtin_bzero, expand_builtin_args_info, expand_builtin_frame_address): Pass in just the argument(s) needed, not the entire expression `exp'. (expand_builtin): Update all calls to these functions. From-SVN: r66448
2003-05-03builtins.c (expand_builtin): Remove.Richard Henderson1-2/+2
* builtins.c (expand_builtin) <BUILT_IN_DWARF_FP_REGNUM>: Remove. <BUILT_IN_DWARF_SP_COLUMN>: New. * builtins.def (BUILT_IN_DWARF_FP_REGNUM): Remove. (BUILT_IN_DWARF_SP_COLUMN): New. * dwarf2out.c (expand_builtin_dwarf_fp_regnum): Remove. (expand_builtin_dwarf_sp_column): New. * except.h: Update to match. * unwind-dw2.c (execute_stack_op): Correct stack push typo. (execute_cfa_program): Record location expression address before extracting length. (uw_update_context_1): Install old CFA into stack pointer column. (uw_init_context_1): Set cfa_reg to stack pointer column. From-SVN: r66447
2003-05-03emit-rtl.c (last_call_insn, [...]): New functions.Olivier Hainque1-23/+4
* emit-rtl.c (last_call_insn, add_function_usage_to): New functions. * rtl.h (last_call_insn, add_function_usage_to): New prototypes. * builtins.c (expand_builtin_apply): Use the new emit-rtl functions. * calls.c (emit_call_1): Likewise. (expand_call): For calls initializing constant memory, replace emission of standalone mem /u clobber with function usage entry. * expr.c (emit_block_move_via_libcall): Likewise. * cse.c (count_reg_usage, case EXPR_LIST): New case. * flow.c (propagate_one_insn): Pass entire operand of CALL_INSN_FUNCTION_USAGE to mark_used_regs. * integrate.c (try_constants): For CALL_INSNs, substitute constants within the FUNCTION_USAGE also. * loop.c (prescan_loop): Note clobbers of const mem mentioned in FUNCTION_USAGE lists. * reload1.c (replace_pseudos_in): Renamed. (reload): Use it for clobbers surviving until the end of the reload. From-SVN: r66429
2003-05-03builtins.c (expand_builtin_stpcpy): Copy `arglist' before modifying it.Kaveh R. Ghazi1-2/+4
* builtins.c (expand_builtin_stpcpy): Copy `arglist' before modifying it. From-SVN: r66409
2003-04-28builtins.def (BUILT_IN_BCOPY, [...]): New.Jakub Jelinek1-0/+95
* builtins.def (BUILT_IN_BCOPY, BUILT_IN_MEMMOVE): New. * builtin-types.def (BT_FN_VOID_CONST_PTR_PTR_SIZE): New. * builtins.c (expand_builtin_memmove, expand_builtin_bcopy): New functions. (expand_builtin): Handle BUILT_IN_BCOPY and BUILT_IN_MEMMOVE. * gcc.c-torture/execute/string-opt-19.c: New test. From-SVN: r66169
2003-04-23re PR rtl-optimization/10339 ([sparc,ppc,ppc64] Invalid optimization: ↵Roger Sayle1-69/+159
replacing strncmp by memcmp) PR optimization/10339 * builtins.c (expand_builtin_strcmp): Try to emit cmpstrsi insn directly instead of unsafely transforming call into a memcmp. (expand_builtin_strncmp): Likewise. From-SVN: r65985
2003-04-20builtins.c (expand_builtin): Don't expand a pure or const built-in function ↵Roger Sayle1-0/+30
if... * builtins.c (expand_builtin): Don't expand a pure or const built-in function if the result will be ignored and none of its arguments are volatile. From-SVN: r65843
2003-04-14builtins.c (expand_builtin_strlen): Evaluate the lengths of string literals ↵Roger Sayle1-5/+9
at compile-time. * builtins.c (expand_builtin_strlen): Evaluate the lengths of string literals at compile-time. From-SVN: r65585
2003-04-14Fix formatting in last commit.Kaveh Ghazi1-3/+3
From-SVN: r65559
2003-04-13builtins.c (expand_builtin_memcpy): Add `endp' argument, use it.Kaveh R. Ghazi1-9/+69
gcc: * builtins.c (expand_builtin_memcpy): Add `endp' argument, use it. (expand_builtin_stpcpy): New. (expand_builtin): Add BUILT_IN_MEMPCPY & BUILT_IN_STPCPY. * builtins.def: Add mempcpy & stpcpy support. * doc/extend.texi (mempcpy, stpcpy): Document new builtins. testsuite: * gcc.c-torture/execute/string-opt-18.c: New test. From-SVN: r65551
2003-04-13tree.c (build_constructor): New function.Zack Weinberg1-19/+0
* tree.c (build_constructor): New function. * tree.h: Prototype it. * c-typeck.c (build_c_cast, pop_init_level) * profile.c (build_function_info_value, build_gcov_info_value) (create_profiler): Use build_constructor. * builtins.c (expand_builtin_args_info): Remove #if 0 blocks. * objc/objc-act.c (build_constructor): Rename objc_build_constructor. Use build_constructor. (build_objc_string_object, objc_add_static_instance) (init_def_list, init_objc_symtab, init_module_descriptor) (generate_static_references, build_selector_translation_table) (build_descriptor_table_initializer, generate_descriptor_table) (build_protocol_initializer, build_ivar_list_initializer) (generate_ivars_list, build_dispatch_table_initializer) (generate_dispatch_table, generate_protocol_list) (build_category_initializer, build_shared_structure_initializer): Update to match. ada: * gigi.h, utils2.c (build_constructor): Rename gnat_build_constructor. Use build_constructor. * decl.c (gnat_to_gnu_entity) * trans.c (tree_transform, pos_to_constructor, extract_values) * ada/utils.c (build_template, convert_to_fat_pointer, convert) (unchecked_convert) * ada/utils2.c (build_binary_op, build_call_raise, build_allocator) (fill_vms_descriptor): Update to match. cp: * class.c (initialize_array) * decl.c (reshape_init) * decl2.c (build_expr_from_tree) * init.c (build_zero_init) * pt.c (tsubst_copy, tsubst_copy_and_build) * rtti.c (tinfo_base_init, generic_initializer, ptr_initializer) (ptm_initializer, class_initializer, get_pseudo_ti_init) * semantics.c (finish_compound_literal) * typeck.c (build_ptrmemfunc1) * typeck2.c (store_init_value, process_init_constructor) (build_functional_cast): Use build_constructor. f: * com.c (ffecom_build_complex_constant_, ffecom_expr_) (ffecom_init_zero_, ffecom_transform_namelist_, ffecom_vardesc_) (ffecom_vardesc_array_, ffecom_vardesc_dims_, ffecom_2) * ste.c (ffeste_io_ialist_, ffeste_io_cilist_, ffeste_io_cllist_) (ffeste_io_icilist_, ffeste_io_inlist_, ffeste_io_olist_): Use build_constructor. java: * class.c (make_field_value, make_method_value, get_dispatch_table) (make_class_data, emit_offset_symbol_table) * constants.c (build_constants_constructor) * java-tree.h (START_RECORD_CONSTRUCTOR) * parse.y (maybe_build_array_element_wfl): Use build_constructor. From-SVN: r65539
2003-04-08builtins.c (fold_builtin): Constant fold expressions as x*0.5 instead of x/2.0.Roger Sayle1-8/+83
* builtins.c (fold_builtin): Constant fold expressions as x*0.5 instead of x/2.0. Optimize sqrt(pow(x,y)) as pow(x,y*0.5), log(pow(x,y)) as y*log(x), pow(exp(x),y) as exp(x*y), pow(sqrt(x),y) as pow(x,y*0.5) and pow(pow(x,y),z) as pow(x,y*z). Delete function scope "fcode" variable to avoid shadowing. * gcc.dg/builtins-9.c: New test case. * gcc.dg/builtins-10.c: New test case. From-SVN: r65386
2003-03-31emit-rtl.c (dconstm2, dconsthalf): New real constants.Roger Sayle1-7/+95
* emit-rtl.c (dconstm2, dconsthalf): New real constants. (init_emit_once): Initialize dconstm2 and dconsthalf here. * real.h (dconstm2, dconsthalf): Add prototypes here. * real.c (real_sqrt): Use dconsthalf rather than local copy. * builtins.c (fold_builtin): When optimizing sqrt(exp(x)) as exp(x/2.0) remember to fold the division if possible. Fold sin(0.0) as 0.0, cos(0.0) as 1.0, pow(x,1.0) as x, pow(x,-1.0) as 1.0/x, pow(x,2.0) as x*x, pow(x,-2.0) as 1.0/(x*x) and pow(x,0.5) as sqrt(x). * gcc.dg/builtins-3.c: Add new tests for sin and cos. * gcc.dg/builtins-7.c: New test case. * gcc.dg/builtins-8.c: New test case. From-SVN: r65088
2003-03-24builtins.c (expand_builtin_fputs): When optimizing for size, don't transform ↵Arpad Beszedes1-1/+5
fputs into fwrite. gcc: * builtins.c (expand_builtin_fputs): When optimizing for size, don't transform fputs into fwrite. testsuite: * gcc.c-torture/execute/stdio-opt-1.c: Adjust test for change to builtin fputs. From-SVN: r64771