Commit Graph

122 Commits

Author SHA1 Message Date
Janis Johnson 44aea9acab extend.texi (Other Builtins): Add decimal float variants of signbit.
* doc/extend.texi (Other Builtins): Add decimal float variants
	of signbit.
	* builtins.def: Ditto.
	* builtins.c (expand_builtin): Ditto.
testsuite/
	* gcc.dg/dfp/signbit-1.c
	* gcc.dg/dfp/signbit-2.c
M    gcc/doc/extend.texi
M    gcc/builtins.c
M    gcc/ChangeLog
A    gcc/testsuite/gcc.dg/dfp/signbit-2.c
A    gcc/testsuite/gcc.dg/dfp/signbit-1.c
M    gcc/testsuite/ChangeLog
M    gcc/builtins.def

From-SVN: r123528
2007-04-05 22:10:28 +00:00
Kaveh R. Ghazi aeabd15d45 builtins.def (lceil, [...]): Mark with ATTR_CONST_NOTHROW_LIST.
* builtins.def (lceil, lceilf, lceill, lfloor, lfloorf, lfloorl,
	llceil, llceilf, llceill, llfloor, llfloorf, llfloorl): Mark with
	ATTR_CONST_NOTHROW_LIST.
	
	* fold-const.c (tree_expr_nonnegative_warnv_p): Handle
	FIX_TRUNC_EXPR.

testsuite:
	* gcc.dg/builtins-55.c: Test *lceil* and *lfloor*.
	* gcc.dg/torture/builtin-attr-1.c: Likewise.
	* gcc.dg/torture/builtin-convert-1.c: Likewise.  Also test *lrint* and *lround*.
	* gcc.dg/torture/builtin-convert-2.c: Test ceil->lceil and floor->lfloor.
	* gcc.dg/torture/builtin-convert-3.c: Test *lceil* and *lfloor*.
	* gcc.dg/torture/builtin-integral-1.c: Likewise.
	* gcc.dg/torture/builtin-minmax-1.c: Likewise.  Also test *lrint*
	and *lround*.  Correct macro names.
	* gcc.dg/torture/builtin-nonneg-1.c: Test *lceil* and *lfloor*.
	* gcc.dg/torture/builtin-rounding-1.c: Likewise.

From-SVN: r122713
2007-03-08 21:37:28 +00:00
Kaveh R. Ghazi a50639323b builtins.def (ATTR_MATHFN_FPROUNDING): Rely on flag_rounding_math, not flag_unsafe_math_optimizations.
* builtins.def (ATTR_MATHFN_FPROUNDING): Rely on
	flag_rounding_math, not flag_unsafe_math_optimizations.

From-SVN: r122509
2007-03-03 17:18:17 +00:00
Richard Henderson 8893239dc4 Makefile.in (libgcc-support, [...]): Add emutls.c.
gcc/ChangeLog:
* Makefile.in (libgcc-support, libgcc.mvars): Add emutls.c.
* builtin-types.def (BT_WORD): Make unsigned.
(BT_FN_VOID_PTR_WORD_WORD_PTR): New.
* builtins.def (BUILT_IN_EMUTLS_GET_ADDRESS): New.
(BUILT_IN_EMUTLS_REGISTER_COMMON): New.
* c-decl.c (grokdeclarator): Don't error if !have_tls.
* c-parser.c (c_parser_omp_threadprivate): Likewise.
* dwarf2out.c (loc_descriptor_from_tree_1): Don't do anything for
emulated tls.
* expr.c (emutls_var_address): New.
(expand_expr_real_1): Expand emulated tls.
(expand_expr_addr_expr_1): Likewise.
* libgcc-std.ver: Add __emutls_get_address, __emutls_register_common.
* output.h (emutls_finish): Declare.
* toplev.c (compile_file): Call it.
* tree-ssa-address.c (gen_addr_rtx): Check for const-ness of the
address before wrapping in CONST.
* varasm.c (emutls_htab, emutls_object_type): New.
(EMUTLS_VAR_PREFIX, EMUTLS_TMPL_PREFIX): New.
(get_emutls_object_name, get_emutls_object_type): New.
(get_emutls_init_templ_addr, emutls_decl): New.
(emutls_common_1, emutls_finish): New.
(assemble_variable): When emulating tls, swap decls; generate
constructor for the emutls objects.
(do_assemble_alias): When emulating tls, swap decl and target name.
(default_encode_section_info): Don't add SYMBOL_FLAG_TLS_SHIFT
for emulated tls.
* varpool.c (decide_is_variable_needed): Look at force_output.
Recurse for emulated tls.
(cgraph_varpool_remove_unreferenced_decls): Remove checks redundant
with decide_is_variable_needed.
* emutls.c: New file.
* config/sparc/sol2.h (ASM_DECLARE_OBJECT_NAME): Only emit
tls_object for real tls.
gcc/cp/ChangeLog:
* decl.c (grokvardecl): Don't error if !have_tls.
(grokdeclarator): Likewise.
* parser.c (cp_parser_omp_threadprivate): Likewise.
gcc/fortran/ChangeLog:
* f95-lang.c (gfc_init_builtin_functions): Add __emutls_get_address
and __emutls_register_common.
* openmp.c (gfc_match_omp_threadprivate): Don't error if !have_tls.
* trans-common.c (build_common_decl): Don't check have_tls.
* trans-decl.c (gfc_finish_var_decl): Likewise.
* types.def (BT_WORD, BT_FN_PTR_PTR): New.
(BT_FN_VOID_PTR_WORD_WORD_PTR): New.
gcc/testsuite/ChangeLog:
* lib/target-supports.exp (check_effective_target_tls): Redefine
to mean non-emulated tls.
* gcc.dg/tls/alias-1.c: Remove tls requirement.
* gcc.dg/tls/asm-1.c, gcc.dg/tls/debug-1.c, gcc.dg/tls/diag-1.c,
gcc.dg/tls/diag-2.c, gcc.dg/tls/diag-3.c, gcc.dg/tls/diag-4.c,
gcc.dg/tls/diag-5.c, gcc.dg/tls/init-1.c, gcc.dg/tls/nonpic-1.c,
gcc.dg/tls/opt-10.c, gcc.dg/tls/opt-5.c, gcc.dg/tls/opt-6.c,
gcc.dg/tls/opt-8.c, gcc.dg/tls/opt-9.c, gcc.dg/tls/pic-1.c,
gcc.dg/tls/struct-1.c, gcc.dg/tls/trivial.c: Likewise.

From-SVN: r121800
2007-02-10 19:19:10 +00:00
Olga Golovanevsky db9d500a22 Add BUILT_IN_FREE
From-SVN: r120732
2007-01-12 21:01:46 +00:00
Richard Guenther 75c7c595ac re PR tree-optimization/17687 (sincos tree representation causes extra addressable vars)
2006-12-13  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/17687
	* builtins.def (BUILT_IN_CEXPI, BUILT_IN_CEXPIF, BUILT_IN_CEXPIL):
	New builtins for imaginary argument cexp.
	* builtin-types.def (BT_FN_COMPLEX_FLOAT_FLOAT,
	BT_FN_COMPLEX_DOUBLE_DOUBLE, BT_FN_COMPLEX_LONGDOUBLE_LONGDOUBLE):
	New required builtin types.
	* builtins.c (expand_builtin_cexpi): Declare.
	(mathfn_built_in): Handle BUILT_IN_CEXPI.
	(expand_builtin_cexpi): New static helper.
	(expand_builtin): Call it.
	(do_mpfr_sincos): Adjust for CEXPI evaluation.
	(fold_builtin_sincos): New function to fold sincos to cepxi.

	* gcc.dg/builtins-59.c: New testcase.

From-SVN: r119824
2006-12-13 10:17:36 +00:00
Kaveh R. Ghazi e35ae5fe4e builtins.def (gamma, lgamma): Use ATTR_MATHFN_FPROUNDING_STORE.
* builtins.def (gamma, lgamma): Use ATTR_MATHFN_FPROUNDING_STORE.
	
testsuite:
	* gcc.dg/torture/builtin-attr-1.c: Don't test gamma/lgamma.
	* gcc.dg/torture/builtin-convert-1.c: Don't test lgamma.

From-SVN: r118366
2006-11-01 05:38:21 +00:00
Eric Christopher 167fa32c09 extend.texi (__builtin_bswap32): Document.
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-11-01 05:14:40 +00:00
Richard Henderson a98d4769d5 Revert emutls patch.
From-SVN: r117578
2006-10-09 09:27:14 -07:00
Richard Henderson e701a32a98 Makefile.in (libgcc.mk, [...]): Add emutls.c.
gcc/
        * Makefile.in (libgcc.mk, LIBGCC_DEPS): Add emutls.c.
        * builtin-types.def (BT_WORD): Make unsigned.
        (BT_FN_VOID_PTR_WORD_WORD_PTR): New.
        * builtins.def (BUILT_IN_EMUTLS_GET_ADDRESS): New.
        (BUILT_IN_EMUTLS_REGISTER_COMMON): New.
        * c-decl.c (grokdeclarator): Don't error if !have_tls.
        * c-parser.c (c_parser_omp_threadprivate): Likewise.
        * cgraph.c (decide_is_variable_needed): Look at force_output.
        Recurse for emulated tls.
        * cgraphunit.c (cgraph_varpool_remove_unreferenced_decls): Remove
        checks redundant with decide_is_variable_needed.
        (cgraph_build_static_cdtor): Do cgraph_varpool_assemble_pending_decls.
        * dwarf2out.c (loc_descriptor_from_tree_1): Don't do anything for
        emulated tls.
        * expr.c (emutls_var_address): New.
        (expand_expr_real_1): Expand emulated tls.
        (expand_expr_addr_expr_1): Likewise.
        * libgcc-std.ver: Add __emutls_get_address, __emutls_register_common.
        * output.h (emutls_finish): Declare.
        * toplev.c (compile_file): Call it.
        * tree-ssa-address.c (gen_addr_rtx): Check for const-ness of the
        address before wrapping in CONST.
        * varasm.c (emutls_htab, emutls_object_type): New.
        (EMUTLS_VAR_PREFIX, EMUTLS_TMPL_PREFIX): New.
        (get_emutls_object_name, get_emutls_object_type): New.
        (get_emutls_init_templ_addr, emutls_decl): New.
        (emutls_common_1, emutls_finish): New.
        (assemble_variable): When emulating tls, swap decls; generate
        constructor for the emutls objects.
        (do_assemble_alias): When emulating tls, swap decl and target name.
        (default_encode_section_info): Don't add SYMBOL_FLAG_TLS_SHIFT
        for emulated tls.
        * emutls.c: New file.
        * config/sparc/sol2.h (ASM_DECLARE_OBJECT_NAME): Only emit
        tls_object for real tls.

gcc/cp/
        * decl.c (grokvardecl): Don't error if !have_tls.
        (grokdeclarator): Likewise.
        * parser.c (cp_parser_omp_threadprivate): Likewise.

gcc/fortran/
        * f95-lang.c (gfc_init_builtin_functions): Add __emutls_get_address
        and __emutls_register_common.
        * openmp.c (gfc_match_omp_threadprivate): Don't error if !have_tls.
        * trans-common.c (build_common_decl): Don't check have_tls.
        * trans-decl.c (gfc_finish_var_decl): Likewise.
        * types.def (BT_WORD, BT_FN_PTR_PTR): New.
        (BT_FN_VOID_PTR_WORD_WORD_PTR): New.

gcc/testsuite/
        * lib/target-supports.exp (check_effective_target_tls): Redefine
        to mean non-emulated tls.
        * gcc.dg/tls/alias-1.c: Remove tls requirement.
        * gcc.dg/tls/asm-1.c, gcc.dg/tls/debug-1.c, gcc.dg/tls/diag-1.c,
        gcc.dg/tls/diag-2.c, gcc.dg/tls/diag-3.c, gcc.dg/tls/diag-4.c,
        gcc.dg/tls/diag-5.c, gcc.dg/tls/init-1.c, gcc.dg/tls/nonpic-1.c,
        gcc.dg/tls/opt-10.c, gcc.dg/tls/opt-5.c, gcc.dg/tls/opt-6.c,
        gcc.dg/tls/opt-8.c, gcc.dg/tls/opt-9.c, gcc.dg/tls/pic-1.c,
        gcc.dg/tls/struct-1.c, gcc.dg/tls/trivial.c: Likewise.

From-SVN: r117440
2006-10-04 14:09:20 -07:00
Eric Botcazou 4f6c213142 builtins.c (expand_builtin_setjmp): Delete.
* 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-29 06:32:58 +00:00
Mike Stump c22cacf346 Whitespace fixups
From-SVN: r113893
2006-05-18 22:16:23 +00:00
Diego Novillo 953ff28998 [multiple changes]
2006-01-18  Richard Henderson  <rth@redhat.com>
	    Jakub Jelinek  <jakub@redhat.com>
            Diego Novillo  <dnovillo@redhat.com>

	* libgomp: New directory.
	* Makefile.def: Add target_module libgomp.
	* Makefile.in: Regenerate.
	* configure.in (target_libraries): Add target-libgomp.
	* configure: Regenerate.


contrib/

2006-01-18  Richard Henderson  <rth@redhat.com>
            Diego Novillo  <dnovillo@redhat.com>

	* gcc_update (files_and_dependencies): Add libgomp files.


gcc/

2006-01-18  Richard Henderson  <rth@redhat.com>
            Aldy Hernandez  <aldyh@redhat.com>
	    Jakub Jelinek  <jakub@redhat.com>
            Diego Novillo  <dnovillo@redhat.com>

	* omp-low.c: New file.
	* c-omp.c: New file.

2006-01-18  Richard Henderson  <rth@redhat.com>
	    Jakub Jelinek  <jakub@redhat.com>
            Diego Novillo  <dnovillo@redhat.com>

	* doc/invoke.texi: Document -fopenmp.
	* tree-dump.h (debug_function): Declare.

	* hooks.c (hook_bool_tree_bool_false): New function.
	(hook_tree_tree_null): Remove.
	(hook_tree_tree_tree_null): New.
	* hooks.h: Update to match.

	* tree-pretty-print.c (debug_tree_chain): New.
	(print_generic_expr): Handle TDF_CHAIN.
	(dump_generic_node): Handle BLOCK.
	Do not abort with incomplete SWITCH_EXPRs.
	Do not dump body of an OpenMP directive if TDF_SLIM is given.
	<case OMP_PARALLEL, OMP_FOR, OMP_SECTIONS>: Don't
	print space after directive name.
	<OMP_FOR>: Handle printing OMP_FOR_PRE_BODY.
	Handle OMP_MASTER and OMP_ORDERED.
	Handle printing of OMP_BODY just in one place, goto
	dump_omp_body in the rest of OMP_* nodes that have
	OMP_BODY.
	Don't handle clause nodes here.  Update omp statements to
	use dump_omp_clauses.
	Handle OMP_SINGLE, OMP_SECTIONS, OMP_SECTION,
	OMP_CLAUSE_ORDERED, OMP_CLAUSE_SCHEDULE, OMP_ATOMIC,
	OMP_CRITICAL, OMP_CLAUSE_NOWAIT, GOMP_CLAUSE_IF,
	GOMP_CLAUSE_NUM_THREADS, GOMP_FOR, GOMP_CLAUSE_SHARED,
	GOMP_CLAUSE_FIRSTPRIVATE, GOMP_CLAUSE_LASTPRIVATE,
	GOMP_CLAUSE_COPYIN and GOMP_CLAUSE_COPYPRIVATE.
	Adjust output for GOMP_PARALLEL.
	(dump_omp_clauses): New.
	(print_declaration): Dump DECL_VALUE_EXPR.
	(op_symbol_1): Split out of op_symbol.
	(dumping_stmts): Remove.  Update all users.

	* cgraph.c (cgraph_analyze_queue): New.
	(cgraph_add_new_function): New.
	* cgraph.h (cgraph_analyze_queue): Declare.
	(cgraph_add_new_function): Declare.
	(cgraph_lower_function): Remove.

	* tree.c (walk_tree): Walk OMP_CLAUSE_CHAIN of OMP_CLAUSE_*
	nodes.  Use switch for all nodes, handle most of IS_EXPR_CODE_CLASS
	and TYPE_P nodes in its default clause.
	(empty_body_p): New.
	(tree_range_check_failed): New.
	(build5_stat): New.

	* tree.h (OMP_CLAUSE_REDUCTION_INIT,
	OMP_CLAUSE_REDUCTION_MERGE,
	OMP_CLAUSE_REDUCTION_PLACEHOLDER,
	OMP_CLAUSE_PRIVATE_DEBUG,
	OMP_CLAUSE_LASTPRIVATE_FIRSTPRIVATE, OMP_FOR_PRE_BODY,
	OMP_MASTER_BODY, OMP_ORDERED_BODY OMP_BODY,
	OMP_CLAUSES, OMP_CLAUSE_DECL, OMP_CLAUSE_DEFAULT_KIND,
	OMP_CLAUSE_CHAIN, OMP_CLAUSE_OUTER_DECL,
	OMP_CLAUSE_INNER_DECL, OMP_CLAUSE_NUM_THREADS_EXPR,
	OMP_CLAUSE_IF_EXPR, OMP_CLAUSE_SCHEDULE_CHUNK_EXPR,
	OMP_CLAUSE_SCHEDULE_CHUNK_SIZE. OMP_PARALLEL_VAR_INIT,
	OMP_PARALLEL_VAR_REDUC, OMP_FOR_VAR_INIT,
	OMP_FOR_VAR_LAST, OMP_FOR_VAR_REDUC,
	OMP_SECTIONS_VAR_INIT, OMP_SECTIONS_VAR_LAST,
	OMP_SECTIONS_VAR_REDUC, OMP_CLAUSE_REDUCTION_CODE
	OMP_SINGLE_CLAUSES, OMP_SINGLE_BODY,
	OMP_CLAUSE_SCHEDULE_CHUNK_SIZE, OMP_SECTION_BODY,
	OMP_CRITICAL_NAME, OMP_CRITICAL_BODY): New.
	(TREE_RANGE_CHECK): New.
	(empty_body_p): Declare.
	(enum omp_clause_default_kind): New.
	(build_string_literal): Declare.
	(enum omp_clause_schedule_kind, OMP_CLAUSE_SCHEDULE_KIND): New.
	(build5_stat, build5): Declare.

	* tree-pass.h (TDF_CHAIN): Define.
	* tree-pass.h (PROP_gimple_lomp): Define.
	(pass_lower_omp): Declare.

	* diagnostic.h (debug_tree_chain): Declare.

	* builtins.c (get_builtin_sync_mode): Use 0 as last argument to
	mode_for_size.
	(expand_builtin): Handle sync BUILT_IN_*_16 builtins.
	* builtins.c (build_string_literal): Make extern.

	* gcc.c (include_spec_function): New.
	(static_spec_functions): Add it.
	(main): Move load of libgomp.spec ...
	(LINK_COMMAND_SPEC): ... here.
	(link_gomp_spec): New.
	(static_specs): Include it.
	(LINK_COMMAND_SPEC): Add link_gomp.
	(GOMP_SELF_SPECS): New.
	(driver_self_specs): Include it.
	(switch_matches): Don't mark inline.
	(main): Load libgomp.spec.

	* tree-gimple.c (is_gimple_stmt): True for OMP_MASTER,
	OMP_ORDERED, OMP_CRITICAL, OMP_SECTIONS, OMP_SECTION,
	and OMP_SINGLE, OMP_FOR and OMP_PARALLEL.

	* tree-gimple.h (enum omp_parallel): Declare.
	(determine_parallel_type): Declare.
	(omp_firstprivatize_variable): Declare.
	(omp_reduction_init): Declare.
	(diagnose_omp_structured_block_errors): Declare.
	(struct walk_stmt_info): Add want_return_expr.
	(struct walk_stmt_info): Add want_bind_expr, want_locations.
	(find_omp_clause): Declare.
	(insert_field_into_struct): Declare.
	(struct walk_stmt_info): Move from tree-nested.c
	(walk_stmts): Declare.

	* c-cppbuiltin.c (c_cpp_builtins): If -fopenmp, #define _OPENMP
	to 200505.

	* cgraphunit.c (cgraph_lower_function): Make static.
	(cgraph_finalize_pending_functions): New.
	(cgraph_finalize_function): Call it.
	(cgraph_finalize_compilation_unit): Likewise.

	* builtin-types.def (BT_I16, BT_FN_I16_VPTR_I16,
	BT_FN_BOOL_VPTR_I16_I16, BT_FN_I16_VPTR_I16_I16): Add.
	(BT_FN_UINT_UINT): New.
	(DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_7,
	DEF_FUNCTION_TYPE_VAR_4): Document.
	(BT_PTR_LONG, BT_PTR_PTR, BT_FN_BOOL, BT_FN_INT,
	BT_FN_VOID_PTRPTR, BT_PTR_FN_VOID_PTR,
	BT_FN_BOOL_LONGPTR_LONGPTR, BT_FN_VOID_OMPFN_PTR_UINT,
	BT_FN_VOID_OMPFN_PTR_UINT_UINT,
	BT_FN_BOOL_LONG_LONG_LONG_LONGPTR_LONGPTR,
	BT_FN_BOOL_LONG_LONG_LONG_LONG_LONGPTR_LONGPTR,
	BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG,
	BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_LONG): New.

	* builtins.def: Update DEF_BUILTIN comment to include COND argument.
	Move all DEF_SYNC_BUILTIN () and DEF_GOMP_BUILTIN () builtins
	into separate files.
	(DEF_GOMP_BUILTIN): New.
	(BUILT_IN_OMP_GET_THREAD_NUM, BUILT_IN_GOMP_BARRIER,
	BUILT_IN_GOMP_CRITICAL_START, BUILT_IN_GOMP_CRITICAL_END,
	BUILT_IN_GOMP_CRITICAL_NAME_START, BUILT_IN_GOMP_CRITICAL_NAME_END,
	BUILT_IN_GOMP_LOOP_STATIC_START, BUILT_IN_GOMP_LOOP_DYNAMIC_START,
	BUILT_IN_GOMP_LOOP_GUIDED_START, BUILT_IN_GOMP_LOOP_RUNTIME_START,
	BUILT_IN_GOMP_LOOP_ORDERED_STATIC_START,
	BUILT_IN_GOMP_LOOP_ORDERED_DYNAMIC_START,
	BUILT_IN_GOMP_LOOP_ORDERED_GUIDED_START,
	BUILT_IN_GOMP_LOOP_ORDERED_RUNTIME_START,
	BUILT_IN_GOMP_LOOP_STATIC_NEXT, BUILT_IN_GOMP_LOOP_DYNAMIC_NEXT,
	BUILT_IN_GOMP_LOOP_GUIDED_NEXT, BUILT_IN_GOMP_LOOP_RUNTIME_NEXT,
	BUILT_IN_GOMP_LOOP_ORDERED_STATIC_NEXT,
	BUILT_IN_GOMP_LOOP_ORDERED_DYNAMIC_NEXT,
	BUILT_IN_GOMP_LOOP_ORDERED_GUIDED_NEXT,
	BUILT_IN_GOMP_LOOP_ORDERED_RUNTIME_NEXT,
	BUILT_IN_GOMP_PARALLEL_LOOP_STATIC_START,
	BUILT_IN_GOMP_PARALLEL_LOOP_DYNAMIC_START,
	BUILT_IN_GOMP_PARALLEL_LOOP_GUIDED_START,
	BUILT_IN_GOMP_PARALLEL_LOOP_RUNTIME_START,
	BUILT_IN_GOMP_LOOP_END, BUILT_IN_GOMP_LOOP_END_NOWAIT,
	BUILT_IN_GOMP_ORDERED_START, BUILT_IN_GOMP_ORDERED_END,
	BUILT_IN_GOMP_PARALLEL_START, BUILT_IN_GOMP_PARALLEL_END,
	BUILT_IN_GOMP_SECTIONS_START, BUILT_IN_GOMP_SECTIONS_NEXT,
	BUILT_IN_GOMP_PARALLEL_SECTIONS_START, BUILT_IN_GOMP_SECTIONS_END,
	BUILT_IN_GOMP_SECTIONS_END_NOWAIT, BUILT_IN_GOMP_SINGLE_START,
	BUILT_IN_GOMP_SINGLE_COPY_START, BUILT_IN_GOMP_SINGLE_COPY_END): New.
	* sync-builtins.def: New file, moved from builtins.def.
	* omp-builtins.def: New file, moved from builtins.def.

	* c-objc-common.h (LANG_HOOKS_OMP_PREDETERMINED_SHARING): Redefine.

	* gimple-low.c (lower_function_body): Clear data.
	(lower_stmt): Do not handle COMPOUND_EXPR.
	Remove call to print_node_brief.

	* c-tree.h (c_finish_omp_clauses): New prototype.
	(C_DECL_THREADPRIVATE_P): Define.
	(lookup_name_no_remap, c_omp_remap_private): Remove
	(c_begin_omp_parallel, c_finish_omp_parallel): Update.
	(check_for_loop_decls): Update decl.
	(lookup_name_no_remap, c_omp_remap_private): Declare.
	(build_indirect_ref, build_modify_expr, pushdecl,
	pushdecl_top_level): Move to c-common.h.

	* dwarf2out.c (loc_descriptor_from_tree_1): Don't set unsignedp
	before the switch, but just in the 2 places that need it.

	* c-decl.c (diagnose_mismatched_decls): Do not check for
	mismatched thread-local attributes when OLDDECL is marked
	threadprivate and NEWDECL has no thread-local attributes.
	(merge_decls): Merge C_DECL_THREADPRIVATE_P.
	(c_gimple_diagnostics_recursively): Rename from
	c_warn_unused_result_recursively.  Invoke
	diagnose_omp_structured_block_errors.
	(check_for_loop_decls): Return a singular decl found.

	* langhooks.c (lhd_omp_predetermined_sharing): Return
	OMP_CLAUSE_DEFAULT_SHARED for DECL_ARTIFICIAL decls.
	(lhd_omp_firstprivatize_type_sizes): New.
	(lhd_omp_assignment): New.
	(lhd_omp_predetermined_sharing): New.

	* langhooks.h (struct gimplify_omp_ctx): Forward declare.
	(struct lang_hooks_for_types): Add
	omp_firstprivatize_type_sizes, omp_privatize_by_reference,
	omp_predetermined_sharing, omp_disregard_value_expr,
	omp_private_debug_clause, omp_clause_default_ctor,
	omp_clause_copy_ctor, omp_clause_assign_op, omp_clause_dtor.

	(c_finish_omp_clauses): New.
	(c_finish_bc_stmt): Diagnose break within omp for.
	(c_begin_omp_parallel, c_finish_omp_parallel): New.
	(build_unary_op): Return error_mark after reporting
	a readonly_error.
	(build_modify_expr): Likewise.

	* gimplify.c: Include optabs.h and pointer-set.h.
	(enum gimplify_omp_var_data): Declare.
	(struct gimplify_omp_ctx): Declare.
	(struct gimplify_ctx): Add fields prev_context, combined_pre_p
	and combined_ctxp.
	(gimplify_ctxp, gimplify_omp_ctxp): New local variables.
	(push_gimplify_context, pop_gimplify_context): Allow nesting.
	(splay_tree_compare_decl_uid): New.
	(new_omp_context): New.
	(delete_omp_context): New.
	(gimple_add_tmp_var): Call omp_add_variable.
	(gimplify_bind_expr): Likewise.
	(gimplify_var_or_parm_decl): If omp_notice_variable returned
	true, disregard DECL_VALUE_EXPR on the decl if any.
	(gimplify_expr_in_ctx): New.
	(omp_firstprivatize_variable, omp_firstprivatize_type_sizes
	omp_add_variable, omp_notice_variable, omp_is_private
	gimplify_scan_omp_clauses, gimplify_adjust_omp_clauses_1
	gimplify_adjust_omp_clauses, gimplify_omp_parallel
	gimplify_omp_for, gimplify_omp_workshare, goa_lhs_expr_p
	gimplify_omp_atomic_fetch_op, goa_stabilize_expr
	gimplify_omp_atomic_pipeline, gimplify_omp_atomic_mutex
	gimplify_omp_atomic): New.
	(gimplify_expr): Handle OMP_PARALLEL, OMP_FOR, OMP_SECTIONS,
	OMP_SINGLE, OMP_SECTION, OMP_MASTER, OMP_ORDERED,
	OMP_CRITICAL and OMP_ATOMIC.
	(gimplify_body): Verify gimplify_ctxp is empty after gimplification.

	* c-pragma.h (enum pragma_kind): Add
	PRAGMA_OMP_ATOMIC, PRAGMA_OMP_BARRIER,
	PRAGMA_OMP_CRITICAL, PRAGMA_OMP_FLUSH, PRAGMA_OMP_FOR,
	PRAGMA_OMP_MASTER, PRAGMA_OMP_ORDERED,
	PRAGMA_OMP_PARALLEL, PRAGMA_OMP_PARALLEL_FOR,
	PRAGMA_OMP_PARALLEL_SECTIONS, PRAGMA_OMP_SECTION,
	PRAGMA_OMP_SECTIONS, PRAGMA_OMP_SINGLE,
	PRAGMA_OMP_THREADPRIVATE.

	* tree.def (OMP_PARALLEL, OMP_FOR, OMP_SECTIONS,
	OMP_SINGLE, OMP_SECTION, OMP_MASTER, OMP_ORDERED,
	OMP_CRITICAL, OMP_ATOMIC, OMP_CLAUSE_PRIVATE,
	OMP_CLAUSE_SHARED, OMP_CLAUSE_FIRSTPRIVATE,
	OMP_CLAUSE_LASTPRIVATE, OMP_CLAUSE_REDUCTION,
	OMP_CLAUSE_COPYIN, OMP_CLAUSE_COPYPRIVATE,
	OMP_CLAUSE_IF, OMP_CLAUSE_NUM_THREADS,
	OMP_CLAUSE_SCHEDULE, OMP_CLAUSE_NOWAIT,
	OMP_CLAUSE_ORDERED, OMP_CLAUSE_DEFAULT): Define.

	* print-tree.c (print_node): Dump DECL_VALUE_EXPR.

	* tree-ssa-dce.c (find_control_dependence): Do not assume that
	ENTRY_BLOCK_PTR->next_bb == single_succ (ENTRY_BLOCK_PTR).

	* tree-nested.c (convert_call_expr): Call walk_body on OMP_BODY for
	OpenMP directives.
	(struct nesting_info): Add field_map,
	suppress_expansion, debug_var_chain.
	(create_nesting_tree): Initialize them.
	(lookup_field_for_decl): Use field_map.
	(get_nonlocal_debug_decl, get_local_debug_decl): New.
	(convert_local_omp_clauses): New.
	(finalize_nesting_tree_1): Add debug_var_chain to toplevel block.
	(walk_body): Split out of walk_function.
	(convert_nonlocal_omp_clauses, convert_local_omp_clauses): New.
	(convert_nonlocal_reference): Handle omp statements.
	(convert_local_reference): Likewise.
	(unnest_nesting_tree_1): Split out of finalize_nesting_tree_1.
	(unnest_nesting_tree): New.
	(lower_nested_functions): Call it.
	(insert_field_into_struct): Make extern.
	(struct walk_stmt_info): Move to tree-gimple.h.
	(walk_stmts): Make extern.

	* omp-builtins.def: New file.

	* tree-iterator.c (expr_only): Clarify comment.

	* c-common.h (pushdecl_top_level, pushdecl,
	build_modify_expr, build_indirect_ref,
	c_finish_omp_master, c_finish_omp_critical,
	c_finish_omp_ordered, c_finish_omp_barrier,
	c_finish_omp_atomic, c_finish_omp_flush,
	c_finish_omp_for, c_split_parallel_clauses,
	omp_clause_default_kind, c_omp_sharing_predetermined,
	c_omp_remap_decl): Declare.

	* Makefile.in (BUILTINS_DEF): Add omp-builtins.def.
	(OBJS-common): Add omp-low.o.
	(c-omp.o, omp-low.o): Add.
	(gimplify.o): Add dependency on $(OPTABS_H).
	(GTFILES): Add omp-low.c.
	(gt-stringpool.h): Add.

	* tree-cfg.c (set_bb_for_stmt): Do not update the
	block-to-labels map if we are currently expanding to RTL.
	(tree_node_can_be_shared): Remove unnecessary CONSTANT_CLASS_P
	checks.
	Handle IDENTIFIER_NODE.
	(tree_verify_flow_info): Do not ICE when emitting error
	messages about invalid labels.
	(dump_function_to_file): Reset CFUN before emitting the body
	of the function.
	(debug_function): New.

	* passes.c (init_optimization_passes): Schedule
	pass_lower_omp.

	* langhooks-def.h (lhd_omp_predetermined_sharing,
	lhd_omp_assignment, lhd_omp_firstprivatize_type_sizes):
	Declare.
	(LANG_HOOKS_OMP_FIRSTPRIVATIZE_TYPE_SIZES): Define.
	(LANG_HOOKS_FOR_TYPES_INITIALIZER): Use it.
	(LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE,
	LANG_HOOKS_OMP_PREDETERMINED_SHARING,
	LANG_HOOKS_OMP_DISREGARD_VALUE_EXPR,
	LANG_HOOKS_OMP_PRIVATE_DEBUG_CLAUSE,
	LANG_HOOKS_OMP_CLAUSE_DEFAULT_CTOR,
	LANG_HOOKS_OMP_CLAUSE_COPY_CTOR,
	LANG_HOOKS_OMP_CLAUSE_ASSIGN_OP,
	LANG_HOOKS_OMP_CLAUSE_DTOR): Define.
	(LANG_HOOK_DECLS): Use them.


2006-01-18  Dmitry Kurochkin <dmitry.kurochkin@gmail.com>
	    Richard Henderson  <rth@redhat.com>
	    Jakub Jelinek  <jakub@redhat.com>
            Diego Novillo  <dnovillo@redhat.com>

	* c-parser.c (pragma_omp_clause): Define.
	(c_parser_declaration_or_fndef): Document OpenMP syntax.
	(c_parser_compound_statement): Likewise.
	(c_parser_statement): Likewise.
	(c_parser_pragma): Handle omp pragmas.
	(OMP_FOR_CLAUSE_MASK, OMP_SECTIONS_CLAUSE_MASK,
	OMP_PARALLEL_CLAUSE_MASK, OMP_SINGLE_CLAUSE_MASK): Define.
	(c_parser_omp_clause_name, check_no_duplicate_clause,
	c_parser_omp_variable_list,
	c_parser_omp_var_list_parens, c_parser_omp_clause_copyin,
	c_parser_omp_clause_copyprivate,
	c_parser_omp_clause_default,
	c_parser_omp_clause_firstprivate, c_parser_omp_clause_if,
	c_parser_omp_clause_lastprivate,
	c_parser_omp_clause_nowait,
	c_parser_omp_clause_num_threads,
	c_parser_omp_clause_ordered, c_parser_omp_clause_private,
	c_parser_omp_clause_reduction,
	c_parser_omp_clause_schedule, c_parser_omp_clause_shared,
	c_parser_omp_all_clauses, c_parser_omp_structured_block,
	c_parser_omp_atomic, c_parser_omp_barrier,
	c_parser_omp_critical, c_parser_omp_flush,
	c_parser_omp_for_loop, c_parser_omp_for,
	c_parser_omp_master, c_parser_omp_ordered,
	c_parser_omp_sections_scope, c_parser_omp_sections,
	c_parser_omp_parallel, c_parser_omp_single,
	c_parser_omp_construct, c_parser_omp_threadprivate): New.
	* c-pragma.c (init_pragma): Do omp pragma registration here.
	* c.opt (fopenmp): New flag.


2006-01-18  Eric Christopher  <echristo@apple.com>

	* gcc.c (GOMP_SELF_SPECS): Bracket in #ifndef/#endif.
	* config/darwin.h (GOMP_SELF_SPECS): Define.


testsuite/

2006-01-18  Richard Henderson  <rth@redhat.com>
            Aldy Hernandez  <aldyh@redhat.com>
	    Jakub Jelinek  <jakub@redhat.com>
            Diego Novillo  <dnovillo@redhat.com>
            Uros Bizjak  <uros@kss-loka.si>

	* testsuite/gcc.dg/gomp: New directory.

From-SVN: r109902
2006-01-18 14:21:25 -05:00
Jakub Jelinek a0274e3e23 backport: builtins.def: Move all DEF_SYNC_BUILTIN to ...
Merge from gomp-branch.
        * builtins.def: Move all DEF_SYNC_BUILTIN to ...
        * sync-builtins.def: ... new file.
        (BUILT_IN_FETCH_AND_ADD_16,
        BUILT_IN_FETCH_AND_SUB_16, BUILT_IN_FETCH_AND_OR_16,
        BUILT_IN_FETCH_AND_AND_16, BUILT_IN_FETCH_AND_XOR_16,
        BUILT_IN_FETCH_AND_NAND_16, BUILT_IN_ADD_AND_FETCH_16,
        BUILT_IN_SUB_AND_FETCH_16, BUILT_IN_OR_AND_FETCH_16,
        BUILT_IN_AND_AND_FETCH_16, BUILT_IN_XOR_AND_FETCH_16,
        BUILT_IN_NAND_AND_FETCH_16, BUILT_IN_BOOL_COMPARE_AND_SWAP_16,
        BUILT_IN_VAL_COMPARE_AND_SWAP_16, BUILT_IN_LOCK_TEST_AND_SET_16,
        BUILT_IN_LOCK_RELEASE_16): New builtins.
        * builtin-types.def (BT_I16, BT_FN_I16_VPTR_I16,
        BT_FN_BOOL_VPTR_I16_I16, BT_FN_I16_VPTR_I16_I16): Add.
        * builtins.c (expand_builtin): Handle sync BUILT_IN_*_16 builtins.
        * c-common.c (enum c_builtin_type): Move to top-level from
        c_common_nodes_and_builtins enum builtin_type.
        (builtin_types): Move from c_common_nodes_and_builtins.
        (def_fn_type): New.
        (c_common_nodes_and_builtins): Use it.
        (def_builtin_1): Check for error_mark_node.
        (sync_resolve_size): Handle also 128 bit sync builtins.
        * Makefile.in (BUILTINS_DEF): New.  Use it instead of builtins.def.

        * config/i386/i386.h (x86_cmpxchg8b, x86_cmpxchg16b): New decls.
        (TARGET_CMPXCHG8B, TARGET_CMPXCHG16B): Define.
        * config/i386/i386.c (x86_cmpxchg8b, x86_cmpxchg16b): New variables.
        * config/i386/sync.md (CASMODE, DCASMODE): New mode macros.
        (doublemodesuffix, DCASHMODE): New mode attrs.
        (sync_compare_and_swap<mode>): Change into expand, use CASMODE
        instead of IMODE, if mode is wider than a word, expand into
        sync_double_compare_and_swap*.
        (*sync_compare_and_swap<mode>): New insn.
        (sync_double_compare_and_swap<mode>): Likewise.
        (*sync_double_compare_and_swapdi_pic): Likewise.
        (sync_compare_and_swap_cc<mode>): Use CASMODE instead of IMODE, if
        mode is wider than a word, expand into
        sync_double_compare_and_swap_cc*.
        (sync_double_compare_and_swap_cc<mode>): New insn.
        (*sync_double_compare_and_swap_ccdi_pic): Likewise.

From-SVN: r108997
2005-12-22 16:43:34 -08:00
Jon Grimm 9a8ce21f3b target-def.h (TARGET_DECIMAL_FLOAT_SUPPORTED_P): New.
2005-12-16  Jon Grimm  <jgrimm2@us.ibm.com>
	    Janis Johnson  <janis187@us.ibm.com>
	    Ben Elliston  <bje@au.ibm.com>

	* target-def.h (TARGET_DECIMAL_FLOAT_SUPPORTED_P): New.
	(TARGET_INITIALIZER): Add TARGET_DECIMAL_FLOAT_P.
	* target.h (struct gcc_target): Add decimal_float_supported_p.
	* targhooks.c (default_scalar_mode_supported_p): Handle
	MODE_DECIMAL_FLOAT.
	* builtins.def: Add new builtins for 32, 64 and 128 bit variants
	of inf, nan, finite, isinf and isnan.
	* builtin-types.def (BT_DFLOAT32, BT_DFLOAT64, BT_DFLOAT128,
	BT_DFLOAT32_PTR, BT_DFLOAT64_PTR, BT_DFLOAT128_PTR,
	BT_FN_DFLOAT32, BT_FN_DFLOAT64, BT_FN_DFLOAT128,
	BT_FN_INT_DFLOAT32, BT_FN_INT_DFLOAT64, BT_FN_INT_DFLOAT128,
	BT_FN_DFLOAT32_CONST_STRING, BT_FN_DFLOAT64_CONST_STRING,
	BT_FN_DFLOAT32_CONST_STRING, BT_FN_DFLOAT32_DFLOAT32,
	BT_FN_DFLOAT64_DFLOAT64, BT_FN_DFLOAT128_DFLOAT128): New.
	* c-decl.c (declspecs_add_type): Verify combos on type qualifiers.
	Pedwarn if decimal floating point types are used.  Error if
	decimal floating point is not supported by the target.
	(finish_declspecs): Return type from DFP typespec_word.
	* c-typeck.c (c_common_type): Choose the decimal floating point
	type with the greater precision when determining a common type.
	(convert_arguments): Warn if there is a mismatch between argument
	and prototype for decimal float types.  Warn of conversions with
	binary float types and of precision narrowing due to prototype.
	* c-parser.c (reswords): Add _Decimal32, _Decimal64, _Decimal128.
	(c_token_starts_typename): Handle RID_DFLOAT32/64/128.
	(c_token_starts_declspecs): Likewise.
	(c_parser_attributes): Likewise.
	* c-common.h (enum rid): Add new enumeration values RID_DFLOAT32,
	RID_DFLOAT64, RID_DFLOAT128.
	(T_D32, TEX_D32, T_D64, TEX_D64, T_D128, TEX_D128): New macros.
	* c-common.c (c_common_type_for_mode): Handle decimal float modes.
	(shorten_compare): Convert DFP/BFP operands to a common type.
	(c_common_modes_and_builtins): Register built-in decimal float
	types if the target supports them.
	(handle_mode_addtribute): Handle MODE_DECIMAL_FLOAT.
	* builtins.c (fold_builtin_1): Handle 32, 64 and 128 bit cases of
	inf, nan, finite, isinf and isnan builtins.
	* c-cppbuiltin.c (builtin_define_decimal_float_constants): New.
	(builtin_define_float_constants): Assert non-decimal radix.
	(c_cpp_builtins): Register built-in __DEC_EVAL_METHOD__ define.
	Call builtin_define_decimal_float_constants for each type.
	* c-lex.c (interpret_float): Decode decimal float types from CPP_N
	flags.  Use real_from_string3, which can handle binary or decimal
	floats.
	* c-tree.h (enum c_typespec_keyword): Add cts_dfloat32,
	cts_dfloat64, cts_dfloat128.
	* tree.c (build_common_tree_nodes_2): Add decimal float types.
	* tree.h (enum tree_index): Add new enumeration values
	TI_DFLOAT32_TYPE, TI_DFLOAT64_TYPE, TI_DFLOAT128_TYPE,
	TI_DFLOAT32_PTR_TYPE, TI_DFLOAT64_PTR_TYPE, TI_DFLOAT128_PTR_TYPE.
	(dfloat32_type_node): New macro.
	(dfloat64_type_node, dfloat128_type_node): Likewise.
	(dfloat32_ptr_type_node, dfloat64_ptr_type_node): Likewise.
	(dfloat128_ptr_type_node): Likewise.
	* c-pretty-print.c (pp_c_floating_constant): Append 32, 64 and 128
	bit decimal floating point types with "df", "dd" and "dl".
	* c-format.h (enum format_lengths): Add new enumeration values
	FMT_LEN_H, FMT_LEN_D and FMT_LEN_DD.
	* c-format.c (printf_length_specs, scanf_length_specs): Add
	entries for H, D, DD.
	(print_char_table, scan_char_table): Use new entries.
	(asm_fprintf_char_table, gcc_diag_char_table,
	gcc_cdiag_char_table, gcc_cxxdiag_char_table): Adjust for longer
	length arrays.
	* defaults.h (DECIMAL32_TYPE_SIZE): Define.
	(DECIMAL64_TYPE_SIZE): Likewise.
	(DECIMAL128_TYPE_SIZE): Likewise.
	(TARGET_DEC_EVAL_METHOD): Likewise.
	* doc/extend.texi (Decimal Float): New node.
	(Constructing Calls): Document decimal float built-ins.
	* doc/tm.texi: Document TARGET_DECIMAL_FLOAT_SUPPORTED_P hook.
	* Makefile.in (USER_H): Add $(srcdir)/ginclude/decfloat.h.
	* ginclude/decfloat.h: New file.

Co-Authored-By: Ben Elliston <bje@au.ibm.com>
Co-Authored-By: Janis Johnson <janis187@us.ibm.com>

From-SVN: r108629
2005-12-16 17:38:26 +11:00
Kaveh R. Ghazi b53b5aa509 builtins.def (BUILT_IN_PUTC, [...]): New.
* builtins.def (BUILT_IN_PUTC, BUILT_IN_PUTC_UNLOCKED): New.

	* config/pa/pa.c (pa_init_builtins): If we detect
	DONT_HAVE_FPUTC_UNLOCKED, set builtin fputc_unlocked to
	putc_unlocked.

From-SVN: r107833
2005-12-01 22:46:14 +00:00
Francois-Xavier Coudert 1b135aa53e builtins.def: Add DEF_EXT_C99RES_BUILTIN to define builtins that C99 reserve for future use.
* builtins.def: Add DEF_EXT_C99RES_BUILTIN to define builtins
	that C99 reserve for future use. Use it to define clog10,
	clog10f and clog10l.

From-SVN: r102331
2005-07-24 08:36:33 +00:00
Jakub Jelinek 10a0d49571 builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6.
* builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6.
	(DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6.
	(ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define.
	(ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5,
	ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define.
	* builtins.c: Include tree-flow.h.
	(expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes.
	(expand_builtin_object_size, expand_builtin_memory_chk,
	maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning,
	compute_object_offset, compute_builtin_object_size,
	fold_builtin_object_size): New functions.
	(expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK.
	(fold_builtin_1): Likewise.  Handle BUILT_IN_{,V}{,F}PRINTF
	and BUILT_IN_{,F}PRINTF_UNLOCKED.
	(fold_builtin_memory_chk, fold_builtin_stxcpy_chk,
	fold_builtin_strncpy_chk, fold_builtin_strcat_chk,
	fold_builtin_strncat_chk, fold_builtin_sprintf_chk,
	fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf):
	New functions.
	* builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK,
	BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK,
	BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK,
	BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK,
	BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK,
	BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK,
	BUILT_IN_VPRINTF_CHK): New builtins.
	* builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4):
	Document.
	(BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG,
	BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE,
	BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE,
	BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG,
	BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG,
	BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG,
	BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR,
	BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR,
	BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types.
	* c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6,
	DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define.
	* Makefile.in (OBJS-common): Add tree-object-size.o.
	(tree-object-size.o): Add dependencies.
	* tree-pass.h (pass_object_sizes): Add.
	* tree-optimize.c (init_tree_optimization_passes): Add
	pass_object_sizes.
	* tree-object-size.c: New file.
	* tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk,
	fold_builtin_strncpy_chk, fold_builtin_snprintf_chk,
	compute_builtin_object_size, init_object_sizes, fini_object_sizes):
	New prototypes.
	* tree-ssa-ccp.c (get_strlen): Rename to ...
	(get_maxval_strlen): ...this function.  Handle also computing of maximum
	string length and maximum integral value.
	(ccp_fold_builtin): Handle BUILT_IN_*_CHK.  Use get_maxval_strlen
	instead of get_strlen.  Pass CALLEE and ARGLIST variables to the
	folding functions instead of computing them again.
	(execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed
	into some other builtin.
	* doc/extend.texi (Object Size Checking): Document.

	* gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype.
	* gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid
	testing uninitialized var.

	* gcc.c-torture/execute/builtins/chk.h: New.
	* gcc.c-torture/execute/builtins/lib/chk.c: New.
	* gcc.c-torture/execute/builtins/memcpy-chk.c: New test.
	* gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New.
	* gcc.c-torture/execute/builtins/memmove-chk.c: New test.
	* gcc.c-torture/execute/builtins/memmove-chk-lib.c: New.
	* gcc.c-torture/execute/builtins/mempcpy-chk.c: New test.
	* gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New.
	* gcc.c-torture/execute/builtins/memset-chk.c: New test.
	* gcc.c-torture/execute/builtins/memset-chk-lib.c: New.
	* gcc.c-torture/execute/builtins/snprintf-chk.c: New test.
	* gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New.
	* gcc.c-torture/execute/builtins/sprintf-chk.c: New test.
	* gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New.
	* gcc.c-torture/execute/builtins/stpcpy-chk.c: New test.
	* gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New.
	* gcc.c-torture/execute/builtins/strcat-chk.c: New test.
	* gcc.c-torture/execute/builtins/strcat-chk-lib.c: New.
	* gcc.c-torture/execute/builtins/strcpy-chk.c: New test.
	* gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New.
	* gcc.c-torture/execute/builtins/strncat-chk.c: New test.
	* gcc.c-torture/execute/builtins/strncat-chk-lib.c: New.
	* gcc.c-torture/execute/builtins/strncpy-chk.c: New test.
	* gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New.
	* gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test.
	* gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New.
	* gcc.c-torture/execute/builtins/vsprintf-chk.c: New test.
	* gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New.
	* gcc.dg/builtin-object-size-1.c: New test.
	* gcc.dg/builtin-object-size-2.c: New test.
	* gcc.dg/builtin-object-size-3.c: New test.
	* gcc.dg/builtin-object-size-4.c: New test.
	* gcc.dg/builtin-object-size-5.c: New test.
	* gcc.dg/builtin-stringop-chk-1.c: New test.
	* gcc.dg/builtin-stringop-chk-2.c: New test.
	* gcc.dg/tree-ssa/builtin-fprintf-1.c: New test.
	* gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test.
	* gcc.dg/tree-ssa/builtin-printf-1.c: New test.
	* gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test.
	* gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test.
	* gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test.
	* gcc.dg/tree-ssa/builtin-vprintf-1.c: New test.
	* gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test.
	* gcc.c-torture/execute/printf-1.c: New test.
	* gcc.c-torture/execute/fprintf-1.c: New test.
	* gcc.c-torture/execute/vprintf-1.c: New test.
	* gcc.c-torture/execute/vfprintf-1.c: New test.
	* gcc.c-torture/execute/printf-chk-1.c: New test.
	* gcc.c-torture/execute/fprintf-chk-1.c: New test.
	* gcc.c-torture/execute/vprintf-chk-1.c: New test.
	* gcc.c-torture/execute/vfprintf-chk-1.c: New test.

From-SVN: r101352
2005-06-27 14:17:39 +02:00
Kelley Cook 366ccddb2b Update FSF address.
From-SVN: r101317
2005-06-25 02:02:01 +00:00
Paolo Carlini c3887ef239 re PR middle-end/21743 (Enable __builtin_clog)
2005-05-30  Paolo Carlini  <pcarlini@suse.de>

	PR middle-end/21743
	* builtins.def (BUILT_IN_CLOG, BUILT_IN_CLOGF, BUILT_IN_CLOGL):
	Enable.
	* doc/extend.texi: Add clog, clogf, clogl.

From-SVN: r100374
2005-05-30 20:15:46 +00:00
Richard Henderson 48ae6c138c re PR middle-end/14311 (builtins for atomic operations needed)
PR middle-end/14311
	* builtin-types.def (BT_BOOL, BT_VOLATILE_PTR, BT_I1, BT_I2,
	BT_I4, BT_I8, BT_FN_VOID_VPTR, BT_FN_I1_VPTR_I1, BT_FN_I2_VPTR_I2,
	BT_FN_I4_VPTR_I4, BT_FN_I8_VPTR_I8, BT_FN_BOOL_VPTR_I1_I1,
	BT_FN_BOOL_VPTR_I2_I2, BT_FN_BOOL_VPTR_I4_I4, BT_FN_BOOL_VPTR_I8_I8,
	BT_FN_I1_VPTR_I1_I1, BT_FN_I2_VPTR_I2_I2, BT_FN_I4_VPTR_I4_I4,
	BT_FN_I8_VPTR_I8_I8): New.
	* builtins.def (DEF_SYNC_BUILTIN): New.
	(BUILT_IN_FETCH_AND_ADD_N, BUILT_IN_FETCH_AND_ADD_1,
	BUILT_IN_FETCH_AND_ADD_2, BUILT_IN_FETCH_AND_ADD_4,
	BUILT_IN_FETCH_AND_ADD_8, BUILT_IN_FETCH_AND_SUB_N,
	BUILT_IN_FETCH_AND_SUB_1, BUILT_IN_FETCH_AND_SUB_2,
	BUILT_IN_FETCH_AND_SUB_4, BUILT_IN_FETCH_AND_SUB_8,
	BUILT_IN_FETCH_AND_OR_N, BUILT_IN_FETCH_AND_OR_1,
	BUILT_IN_FETCH_AND_OR_2, BUILT_IN_FETCH_AND_OR_4,
	BUILT_IN_FETCH_AND_OR_8, BUILT_IN_FETCH_AND_AND_N,
	BUILT_IN_FETCH_AND_AND_1, BUILT_IN_FETCH_AND_AND_2,
	BUILT_IN_FETCH_AND_AND_4, BUILT_IN_FETCH_AND_AND_8,
	BUILT_IN_FETCH_AND_XOR_N, BUILT_IN_FETCH_AND_XOR_1,
	BUILT_IN_FETCH_AND_XOR_2, BUILT_IN_FETCH_AND_XOR_4,
	BUILT_IN_FETCH_AND_XOR_8, BUILT_IN_FETCH_AND_NAND_N,
	BUILT_IN_FETCH_AND_NAND_1, BUILT_IN_FETCH_AND_NAND_2,
	BUILT_IN_FETCH_AND_NAND_4, BUILT_IN_FETCH_AND_NAND_8,
	BUILT_IN_ADD_AND_FETCH_N, BUILT_IN_ADD_AND_FETCH_1,
	BUILT_IN_ADD_AND_FETCH_2, BUILT_IN_ADD_AND_FETCH_4,
	BUILT_IN_ADD_AND_FETCH_8, BUILT_IN_SUB_AND_FETCH_N,
	BUILT_IN_SUB_AND_FETCH_1, BUILT_IN_SUB_AND_FETCH_2,
	BUILT_IN_SUB_AND_FETCH_4, BUILT_IN_SUB_AND_FETCH_8,
	BUILT_IN_OR_AND_FETCH_N, BUILT_IN_OR_AND_FETCH_1,
	BUILT_IN_OR_AND_FETCH_2, BUILT_IN_OR_AND_FETCH_4,
	BUILT_IN_OR_AND_FETCH_8, BUILT_IN_AND_AND_FETCH_N,
	BUILT_IN_AND_AND_FETCH_1, BUILT_IN_AND_AND_FETCH_2,
	BUILT_IN_AND_AND_FETCH_4, BUILT_IN_AND_AND_FETCH_8,
	BUILT_IN_XOR_AND_FETCH_N, BUILT_IN_XOR_AND_FETCH_1,
	BUILT_IN_XOR_AND_FETCH_2, BUILT_IN_XOR_AND_FETCH_4,
	BUILT_IN_XOR_AND_FETCH_8, BUILT_IN_NAND_AND_FETCH_N,
	BUILT_IN_NAND_AND_FETCH_1, BUILT_IN_NAND_AND_FETCH_2,
	BUILT_IN_NAND_AND_FETCH_4, BUILT_IN_NAND_AND_FETCH_8,
	BUILT_IN_BOOL_COMPARE_AND_SWAP_N, BUILT_IN_BOOL_COMPARE_AND_SWAP_1,
	BUILT_IN_BOOL_COMPARE_AND_SWAP_2, BUILT_IN_BOOL_COMPARE_AND_SWAP_4,
	BUILT_IN_BOOL_COMPARE_AND_SWAP_8, BUILT_IN_VAL_COMPARE_AND_SWAP_N,
	BUILT_IN_VAL_COMPARE_AND_SWAP_1, BUILT_IN_VAL_COMPARE_AND_SWAP_2,
	BUILT_IN_VAL_COMPARE_AND_SWAP_4, BUILT_IN_VAL_COMPARE_AND_SWAP_8,
	BUILT_IN_LOCK_TEST_AND_SET_N, BUILT_IN_LOCK_TEST_AND_SET_1,
	BUILT_IN_LOCK_TEST_AND_SET_2, BUILT_IN_LOCK_TEST_AND_SET_4,
	BUILT_IN_LOCK_TEST_AND_SET_8, BUILT_IN_LOCK_RELEASE_N,
	BUILT_IN_LOCK_RELEASE_1, BUILT_IN_LOCK_RELEASE_2,
	BUILT_IN_LOCK_RELEASE_4, BUILT_IN_LOCK_RELEASE_8,
	BUILT_IN_SYNCHRONIZE: New.
	* builtins.c (called_as_built_in): Rewrite from CALLED_AS_BUILT_IN
	as a function.  Accept __sync_ as a prefix as well.
	(expand_builtin_sync_operation, expand_builtin_compare_and_swap,
	expand_builtin_lock_test_and_set, expand_builtin_synchronize,
	expand_builtin_lock_release): New.
	(expand_builtin): Call them.
	* c-common.c (DEF_BUILTIN): Don't require __builtin_ prefix if
	neither BOTH_P nor FALLBACK_P are defined.
	(builtin_type_for_size): New.
	(sync_resolve_size, sync_resolve_params, sync_resolve_return): New.
	(resolve_overloaded_builtin): New.
	* c-common.h (resolve_overloaded_builtin): Declare.
	(builtin_type_for_size): Declare.
	* c-typeck.c (build_function_call): Invoke resolve_overloaded_builtin.
	* expr.c (sync_add_optab, sync_sub_optab, sync_ior_optab,
	sync_and_optab, sync_xor_optab, sync_nand_optab, sync_old_add_optab,
	sync_old_sub_optab, sync_old_ior_optab, sync_old_and_optab,
	sync_old_xor_optab, sync_old_nand_optab, sync_new_add_optab,
	sync_new_sub_optab, sync_new_ior_optab, sync_new_and_optab,
	sync_new_xor_optab, sync_new_nand_optab, sync_compare_and_swap,
	sync_compare_and_swap_cc, sync_lock_test_and_set,
	sync_lock_release): New.
	* optabs.h: Declare them.
	* expr.h (expand_val_compare_and_swap, expand_bool_compare_and_swap,
	expand_sync_operation, expand_sync_fetch_operation,
	expand_sync_lock_test_and_set): Declare.
	* genopinit.c (optabs): Add sync optabs.
	* optabs.c (init_optabs): Initialize sync optabs.
	(expand_val_compare_and_swap_1, expand_val_compare_and_swap,
	expand_bool_compare_and_swap, expand_compare_and_swap_loop,
	expand_sync_operation, expand_sync_fetch_operation,
	expand_sync_lock_test_and_set): New.
	* doc/extend.texi (Atomic Builtins): New section
	* doc/md.texi (Standard Names): Add sync patterns.

From-SVN: r98154
2005-04-14 16:37:47 -07:00
Uros Bizjak f94b16611c * builtins.def (BUILT_IN_LCEIL, BUILT_IN_LCEILF, BUILT_IN_LCEILL)
(BUILT_IN_LLCEIL, BUILT_IN_LLCEILF, BUILT_IN_LLCEILL): New.
	* optabs.h (enum optab_index): Add new OTI_lceil.
	(lceil_optab): Define corresponding macro.
	* optabs.c (init_optabs): Initialize lceil_optab.
	* genopinit.c (optabs): Implement lceil_optab using lceilsi2
	and lceildi2 patterns.

	* builtins.c (expand_builtin_int_roundingfn): Handle
	BUILT_IN_LCEIL{,F,L} and BUILT_IN_LLCEIL{,F,L}.
	(fold_builtin_int_roundingfn): Handle BUILT_IN_LCEIL{,F,L} and
	BUILT_IN_LLCEIL{,F,L}.
	(fold_builtin_1): Fold BUILT_IN_LCEIL{,F,L} and
	BUILT_IN_LLCEIL{,F,L} using fold_builtin_int_roundingfn.
	(mathfn_built_in): Handle BUILT_IN LCEIL and BUILT_IN_LLCEIL.
	(expand_builtin): Expand BUILT_IN_LCEIL{,F,L} and
	BUILT_IN_LLCEIL{,F,L} using expand_builtin_int_roundingfn.

	* convert.c (convert_to_integer): Convert (long int)ceil{,f,l},
	into lceil built-in function and (long long int)ceil{,f,l} into
	llceil built-in function.
	* fold-const.c (tree_expr_nonnegative_p): Add BUILT_IN_LCEIL and
	BUILT_IN_LLCEIL.
testsuite:

	* gcc.dg/builtins-53.c: Also check (int)ceil* and
	(long long int)ceil*.

From-SVN: r97964
2005-04-11 08:16:39 +02:00
Uros Bizjak d8b42d069e * builtins.def (BUILT_IN_LFLOOR, BUILT_IN_LFLOORF, BUILT_IN_LFLOORL)
(BUILT_IN_LLFLOOR, BUILT_IN_LLFLOORF, BUILT_IN_LLFLOORL): New.
	* optabs.h (enum optab_index): Add new OTI_lfloor.
	(lfloor_optab): Define corresponding macro.
	* optabs.c (init_optabs): Initialize lfloor_optab.
	* genopinit.c (optabs): Implement lfloor_optab using lfloorsi2
	and lfloordi2 patterns.

	* builtins.c (expand_builtin_int_roundingfn): New prototype.
	(expand_builtin_int_roundingfn): New function.
	(fold_builtin_int_roundingfn): New prototype.
	(fold_builtin_int_roundingfn): New function, renamed from
	fold_builtin_lround.
	Handle BUILT_IN_LROUND{,F,L}, BUILT_IN_LLROUND{,F,L} and
	BUILT_IN_LFLOOR{,F,L}, BUILT_IN_LLFLOOR{,F,L}.
	(fold_builtin_1): Fold BUILT_IN_LFLOOR{,F,L} and
	BUILT_IN_LLFLOOR{,F,L} using fold_builtin_int_roundingfn.
	(mathfn_built_in): Handle BUILT_IN LFLOOR and BUILT_IN_LLFLOOR.
	(expand_builtin): Expand BUILT_IN_LFLOOR{,F,L} and
	BUILT_IN_LLFLOOR{,F,L} using expand_builtin_int_roundingfn.

	* convert.c (convert_to_integer): Convert (long int)floor{,f,l},
	into lfloor built-in function and (long long int)floor{,f,l} into
	llfloor built-in function.
	* fold-const.c (tree_expr_nonnegative_p): Add BUILT_IN_LFLOOR and
	BUILT_IN_LLFLOOR.

testsuite:

	* gcc.dg/builtins-53.c: New test.

From-SVN: r97886
2005-04-09 07:31:46 +02:00
Kaveh R. Ghazi e905ac64c0 builtins.def (BUILT_IN_STPNCPY, [...]): New.
* builtins.def (BUILT_IN_STPNCPY, BUILT_IN_STRCASECMP,
	BUILT_IN_STRNCASECMP): New.
	* doc/extend.texi: Document stpncpy, strcasecmp, strncasecmp
	and strndup.

testsuite:
	* gcc.dg/nonnull-3.c: Also test __builtin_stpncpy,
	__builtin_strcasecmp and __builtin_strncasecmp.

From-SVN: r97498
2005-04-03 22:08:12 +00:00
Kaveh R. Ghazi 1ad81c8e57 builtin-types.def (BT_FN_STRING_CONST_STRING_SIZE): New.
* builtin-types.def (BT_FN_STRING_CONST_STRING_SIZE): New.
	* builtins.def (BUILT_IN_STRNDUP): New.

testsuite:
	* gcc.dg/nonnull-3.c: Also test __builtin_strndup.

From-SVN: r97077
2005-03-26 02:25:30 +00:00
Zdenek Dvorak dcd6de6d69 builtin-attrs.def (ATTR_NOVOPS, [...]): New.
* builtin-attrs.def (ATTR_NOVOPS, ATTR_NOVOPS_LIST,
	ATTR_PURE_NOTHROW_NOVOPS_LIST): New.
	* builtins.def (ATTR_MATHFN_FPROUNDING): Use NOVOPS.
	(BUILT_IN_PREFETCH): Set the NOVOPS attribute.
	* c-common.c (handle_novops_attribute): New function.
	(c_common_attribute_table): Add "no vops" entry.
	* c-decl.c (merge_decls): Copy DECL_IS_NOVOPS.
	* calls.c (flags_from_decl_or_type): Set ECF_NOVOPS.
	* tree-ssa-operands.c (get_call_expr_operands): Do not
	create virtual operands for calls with ECF_NOVOPS flag.
	* tree.h (DECL_IS_NOVOPS): New macro.
	(struct tree_decl): Add novops_flag.
	(ECF_NOVOPS): New constant.

From-SVN: r96438
2005-03-14 16:21:16 +00:00
Kaveh R. Ghazi 74124c73c1 builtin-attrs.def (ATTR_NONNULL_LIST, [...]): New "nonnull" attribute lists which are non-specific regarding the nonnull...
* builtin-attrs.def (ATTR_NONNULL_LIST, ATTR_NOTHROW_NONNULL,
	ATTR_CONST_NOTHROW_NONNULL, ATTR_PURE_NOTHROW_NONNULL,
	ATTR_MALLOC_NOTHROW_NONNULL): New "nonnull" attribute lists which
	are non-specific regarding the nonnull parameter positions.
	(ATTR_NONNULL_1_2, ATTR_NONNULL_1_4, ATTR_NOTHROW_NONNULL_1_2,
	ATTR_NOTHROW_NONNULL_1_4, ATTR_CONST_NOTHROW_NONNULL_1,
	ATTR_PURE_NOTHROW_NONNULL_1, ATTR_PURE_NOTHROW_NONNULL_1_2,
	ATTR_MALLOC_NOTHROW_NONNULL_1): Delete.

	* builtins.def: Use the non-specific "nonnull" attibute lists.

From-SVN: r96298
2005-03-11 13:33:21 +00:00
Kazu Hirata c486021de8 builtins.def, [...]: Update copyright.
* builtins.def, haifa-sched.c, libgcc2.c, libgcc2.h,
	tree-ssa-loop-ivcanon.c, tree-ssa-loop-niter.c,
	config/cris/cris-protos.h, config/cris/cris.c: Update
	copyright.

From-SVN: r94840
2005-02-10 18:59:07 +00:00
Richard Henderson c6a912da40 builtins.c (DEF_BUILTIN): Add COND argument.
* builtins.c (DEF_BUILTIN): Add COND argument.
        * tree.h (DEF_BUILTIN): Likewise.
        * builtins.def (DEF_GCC_BUILTIN, DEF_LIB_BUILTIN, DEF_EXT_LIB_BUILTIN,
        DEF_C94_BUILTIN, DEF_C99_BUILTIN, DEF_C99_C90RES_BUILTIN): Update to
        match.
        (DEF_BUILTIN_STUB): New.
        (BUILT_IN_STACK_SAVE, BUILT_IN_STACK_RESTORE, BUILT_IN_INIT_TRAMPOLINE,
        BUILT_IN_ADJUST_TRAMPOLINE, BUILT_IN_NONLOCAL_GOTO,
        BUILT_IN_PROFILE_FUNC_ENTER, BUILT_IN_PROFILE_FUNC_EXIT): Use it.
        * c-common.c (DEF_BUILTIN): Add COND argument.
        * tree.c (local_define_builtin): New.
        (build_common_builtin_nodes): New.
ada/
        * utils.c (gnat_define_builtin): Remove.
        (gnat_install_builtins): Use build_common_builtin_nodes.
fortran/
        * f95-lang.c (gfc_init_builtin_functions): Call
        build_common_builtin_nodes; do not define any functions handled
        by it.
java/
        * builtins.c (initialize_builtins): Call build_common_builtin_nodes.
        * decl.c (java_init_decl_processing): Initialize const_ptr_type_node.
treelang/
        * treetree.c (treelang_init_decl_processing): Call
        build_common_builtin_nodes.

From-SVN: r94785
2005-02-09 16:22:25 -08:00
Richard Guenther 17684d4629 re PR middle-end/19402 (__builtin_powi? still missing)
2005-02-09  Richard Guenther  <rguenth@gcc.gnu.org>

	PR middle-end/19402

	* builtins.def: New __builtin_powi[lf].
	* builtins.c (mathfn_built_in): Handle BUILT_IN_POWI.
	(expand_builtin_powi): New function.
	(expand_builtin): Dispatch to expand_builtin_powi.
	* libgcc2.h: Add prototypes for __builtin_powi[lf].
	* libgcc2.c: Add __builtin_powi[lf] implementation.
	* mklibgcc.in: Add __builtin_powi[lf] to lib2funcs.
	* optabs.h: Add powi_optab.
	* optabs.c (init_optabs): Initialize powi_optab.
	* doc/extend.texi: Document __builtin_powi[lf].

	* gcc.dg/pr19402-1.c: New testcase.
	* gcc.dg/pr19402-2.c: likewise.

From-SVN: r94774
2005-02-09 20:58:13 +00:00
Jakub Jelinek 0d5b215ca1 builtins.def (BUILT_IN_FPUTC, [...]): Remove nothrow attribute.
* builtins.def (BUILT_IN_FPUTC, BUILT_IN_FPUTC_UNLOCKED,
	BUILT_IN_FPUTS, BUILT_IN_FPUTS_UNLOCKED, BUILT_IN_FWRITE,
	BUILT_IN_FWRITE_UNLOCKED, BUILT_IN_PUTCHAR, BUILT_IN_PUTCHAR_UNLOCKED,
	BUILT_IN_PUTS, BUILT_IN_PUTS_UNLOCKED): Remove nothrow attribute.
	* builtin-attrs.def (ATTR_NONNULL_1, ATTR_NONNULL_2, ATTR_NONNULL_1_2,
	ATTR_NONNULL_1_4): New.

From-SVN: r88278
2004-09-29 11:06:49 +02:00
Kaveh R. Ghazi 254986c7ff builtin-attrs.def (ATTR_NOTHROW_SENTINEL_1): New.
* builtin-attrs.def (ATTR_NOTHROW_SENTINEL_1): New.
	* builtins.def (BUILT_IN_EXECLE): Set ATTR_NOTHROW_SENTINEL_1.
	* c-common.c (c_common_attribute_table): Accept parameters to
	sentinel attribute.
	(check_function_sentinel, handle_sentinel_attribute): Likewise.
	* doc/extend.texi: Update accordingly.

testsuite:
	* gcc.dg/format/sentinel-1.c: Update for parameter option.

From-SVN: r87098
2004-09-05 02:55:28 +00:00
Kaveh Ghazi 3d091dac56 builtin-attrs.def (ATTR_SENTINEL, [...]): New.
gcc:
	* builtin-attrs.def (ATTR_SENTINEL, ATTR_SENTINEL_NOTHROW_LIST):
	New.
	* builtins.def (BUILT_IN_EXECL, BUILT_IN_EXECLP): Add `sentinel'
	attribute.
	* c-common.c (handle_sentinel_attribute, check_function_sentinel):
	New functions.
	(c_common_attribute_table): Add `sentinel' attribute.
	(check_function_arguments): Handle `sentinel' attribute.
	* doc/extend.texi: Document `sentinel' attribute.

gcc/testsuite:
	* gcc.dg/format/sentinel-1.c: New test.

include:
	* ansidecl.h (ATTRIBUTE_SENTINEL): Define.
	* libiberty.h (concat, reconcat, concat_length, concat_copy,
	concat_copy2): Use ATTRIBUTE_SENTINEL.

From-SVN: r87096
2004-09-05 02:50:09 +00:00
Richard Henderson 1a186ec558 builtins.def (BUILT_IN_STACK_ALLOC): Remove.
* builtins.def (BUILT_IN_STACK_ALLOC): Remove.
        * builtins.c (expand_builtin) <BUILT_IN_STACK_ALLOC>: Remove.
        * dwarf2out.c (loc_descriptor): Handle PARALLEL here ...
        (add_location_or_const_value_attribute): ... not here.  Use
        loc_descriptor_from_tree if possible.
        (loc_descriptor_from_tree_1): Rename from loc_descriptor_from_tree.
        Simplify address handling.  Handle DECL_VALUE_EXPR.  Handle register
        values specially.
        (loc_descriptor_from_tree): New.  Update callers.
        * expr.c (expand_var): Ignore DECL_VALUE_EXPR variables.
        * gimplify.c (gimplify_decl_expr): Lower variable sized types to
        pointer plus dereference.  Set DECL_VALUE_EXPR.  Set save_stack.
        (gimplify_call_expr): Do not recognize BUILT_IN_STACK_ALLOC
        and BUILT_IN_STACK_RESTORE.
        (gimplify_expr): Lower DECL_VALUE_EXPR decls.
        * stmt.c (expand_stack_alloc): Remove.
        * tree-mudflap.c (mx_register_decls): Don't look for
        BUILT_IN_STACK_ALLOC.
        * tree-nested.c (convert_local_reference): Likewise.
        * tree.h (DECL_VALUE_EXPR): New.
ada/
        * utils.c (gnat_install_builtins): Remove __builtin_stack_alloc,
        add __builtin_alloca.
fortran/
        * f95-lang.c (gfc_init_builtin_functions): Remove
         __builtin_stack_alloc, add __builtin_alloca.
        * trans-array.c (gfc_trans_auto_array_allocation): Use DECL_EXPR.
        * trans-decl.c (gfc_trans_auto_character_variable): Likewise.

From-SVN: r85794
2004-08-10 21:16:07 -07:00
Jan Beulich 2319a1d1f7 builtin-types.def (BT_UINT): Rename from BT_UNSIGNED.
* builtin-types.def (BT_UINT): Rename from BT_UNSIGNED.
        (BT_FN_UINT): Rename from BT_FN_UNSIGNED.
        (BT_FN_PTR_UINT): Rename from BT_FN_PTR_UNSIGNED.
        (BT_ULONG, BT_ULONGLONG, BT_UINTMAX, BT_FN_INT_UINT, BT_FN_INT_ULONG,
        BT_FN_INT_ULONGLONG, BT_FN_INT_INTMAX, BT_FN_INT_UINTMAX): New.
        * builtins.def (BUILTIN_CLZxxx, BUILTIN_CTXxxx, BUILTIN_PARITYxxx,
        BUILTIN_POPCOUNTxxx): Arguments are unsigned.
        (BUILTIN_xxxIMAX): New.
        * builtins.c (expand_builtin): Handle BUILT_IN_FFSIMAX,
        BUILT_IN_CLZIMAX, BUILT_IN_CTZIMAX, BUILT_IN_POPCOUNIMAX, and
        BUILT_IN_PARITYIMAX.

From-SVN: r84415
2004-07-09 16:04:33 -07:00
Paolo Bonzini 64a9295a72 builtins.c (fold_builtin_classify): New.
gcc/ChangeLog:
2004-07-01  Paolo Bonzini  <bonzini@gnu.org>

	* builtins.c (fold_builtin_classify): New.
	(fold_builtin_unordered_cmp): Fix commentary.
	(fold_builtin): Use it.
	* builtins.def: Define builtins for isnan,
	isnanf, isnanl, finite, finitef, finitel,
	isinf, isinff, isinfl.

gcc/testsuite/ChangeLog:
2004-07-01  Paolo Bonzini  <bonzini@gnu.org>

	* gcc.dg/builtins-43.c: New.
	* gcc.dg/builtins-44.c: New.
	* gcc.dg/builtins-45.c: New.

From-SVN: r83960
2004-07-01 08:02:34 +00:00
Joseph Myers f51af25f33 builtins.def (execl, [...]): Change to DEF_EXT_LIB_BUILTIN.
* builtins.def (execl, execlp, execle, execv, execvp, execve,
	fork): Change to DEF_EXT_LIB_BUILTIN.

From-SVN: r83817
2004-06-28 22:50:51 +01:00
Jakub Jelinek 498c0f2757 re PR c++/14791 (13070 does not fix -Wformat with fprintf)
PR c++/14791
	* tree.h (enum tree_index): Add TI_FILEPTR_TYPE.
	(fileptr_type_node): Define.
	* tree.c (build_common_tree_nodes_2): Initialize
	fileptr_type_node to ptr_type_node.
	* c-common.c (c_common_nodes_and_builtins): For C++, make
	fileptr_type_node a distinct type copy.
	* builtin-types.def (BT_FILEPTR, BT_FN_INT_CONST_STRING_FILEPTR,
	BT_FN_INT_INT_FILEPTR, BT_FN_INT_FILEPTR_CONST_STRING_VALIST_ARG,
	BT_FN_SIZE_CONST_PTR_SIZE_SIZE_FILEPTR,
	BT_FN_INT_FILEPTR_CONST_STRING_VAR): Add.
	(BT_FN_INT_CONST_STRING_PTR, BT_FN_INT_INT_PTR,
	BT_FN_SIZE_CONST_PTR_SIZE_SIZE_PTR, BT_FN_INT_PTR_CONST_STRING_VAR,
	BT_FN_INT_PTR_CONST_STRING_VALIST_ARG): Remove.
	* builtins.def (BUILT_IN_FPRINTF, BUILT_IN_FPRINTF_UNLOCKED,
	BUILT_IN_FPUTC, BUILT_IN_FPUTC_UNLOCKED, BUILT_IN_FPUTS,
	BUILT_IN_FPUTS_UNLOCKED, BUILT_IN_FSCANF, BUILT_IN_FWRITE,
	BUILT_IN_FWRITE_UNLOCKED, BUILT_IN_VFPRINTF, BUILT_IN_VFSCANF): Use
	the above *FILEPTR* types instead of *PTR*.

	* decl.c (duplicate_decls): Handle fileptr_type_node arguments
	specially.

	* g++.dg/opt/builtins1.C: New test.

From-SVN: r82902
2004-06-10 10:08:02 +02:00
Jan Hubicka d601c996f8 * builtins.def (__builtin_expect): Mark the function as const&nothrow.
From-SVN: r82243
2004-05-25 16:25:47 +00:00
Diego Novillo 6de9cd9a88 Merge tree-ssa-20020619-branch into mainline.
From-SVN: r81764
2004-05-13 02:41:07 -04:00
Richard Kenner 2b92e7f5cd builtins.c (expand_builtin_update_setjmp_buf): New function.
* builtins.c (expand_builtin_update_setjmp_buf): New function.
	(expand_builtin, case BUILT_IN_UPDATE_SETJMP_BUF): New case.
	* builtins.def (BUILT_IN_UPDATE_SETJMP_BUF): New code.

From-SVN: r81198
2004-04-26 14:11:32 -04:00
Zdenek Dvorak d1c3882392 Makefile.in (LIBGCOV): Add _gcov_fork...
* Makefile.in (LIBGCOV): Add _gcov_fork, _gcov_execl, _gcov_execlp,
	_gcov_execle, _gcov_execv, _gcov_execvp, _gcov_execve.
	* builtin-types.def (BT_PID, BT_PTR_CONST_STRING, BT_FN_PID,
	BT_FN_INT_CONST_STRING_PTR_CONST_STRING,
	BT_FN_INT_CONST_STRING_PTR_CONST_STRING_PTR_CONST_STRING): New.
	* builtins.c (expand_builtin_fork_or_exec): New.
	(expand_builtin): Call it.
	* builtins.def (BUILT_IN_EXECL, BUILT_IN_EXECLP,BUILT_IN_EXECLE,
	BUILT_IN_EXECV, BUILT_IN_EXECVP, BUILT_IN_EXECVE, BUILT_IN_FORK): New.
	* c-common.c (PID_TYPE): New macro.
	(c_common_nodes_and_builtins): Initialize pid_type_node.
	* calls.c (special_function_p): Do not handle fork and exec.
	(expand_call): Do not handle ECF_FORK_OR_EXEC.
	* gcov-io.h (__gcov_fork, __gcov_execl, __gcov_execlp, __gcov_execle,
	__gcov_execv, __gcov_execvp, __gcov_execve): Declare.
	* libgcov.c (__gcov_fork, __gcov_execl, __gcov_execlp, __gcov_execle,
	__gcov_execv, __gcov_execvp, __gcov_execve): New.
	* tree.h (enum tree_index): Add TI_PID_TYPE.
	(pid_type_node): New macro.
	(ECF_FORK_OR_EXEC): Removed.

From-SVN: r81118
2004-04-23 22:50:16 +00:00
Kaveh R. Ghazi b069dd3f1f builtins.def (BUILT_IN_ISDIGIT, [...]): Mark with ATTR_CONST_NOTHROW_LIST.
* builtins.def (BUILT_IN_ISDIGIT, BUILT_IN_ISXDIGIT): Mark with
	ATTR_CONST_NOTHROW_LIST.

From-SVN: r80740
2004-04-16 00:48:51 +00:00
Kaveh R. Ghazi ca4944e1fe builtin-types.def (BT_WINT, [...]): New.
* builtin-types.def (BT_WINT, BT_FN_INT_WINT, BT_FN_WINT_WINT): New.
	* builtins.def (DEF_C94_BUILTIN): New.  Add wctype builtins.
	* doc/extend.texi: Likewise.
testsuite:
	* gcc.dg/torture/builtin-wctype-1.c: New test.

From-SVN: r80011
2004-03-27 05:29:40 +00:00
Kaveh R. Ghazi 740e5b6f17 builtins.def: Add ctype builtins.
* builtins.def: Add ctype builtins.
	* doc/extend.texi: Likewise.
testsuite:
	* gcc.dg/torture/builtin-ctype-1.c: New test.

From-SVN: r79960
2004-03-25 17:55:13 +00:00
Joseph Myers b1c2d04a28 re PR c/14635 (nan functions should not be C90 built-ins)
PR c/14635
	* builtins.def (nan, nanf, nanl, nans, nansf, nansl): Change to
	DEF_GCC_BUILTIN.

testsuite:
	* builtins-1.c (nan, nans): Don't test.
	* builtins-30.c: Don't use nan, nanf, nanl.
	* builtins-35.c: New test.

From-SVN: r79736
2004-03-20 10:19:11 +00:00
James E Wilson c76362b488 re PR libstdc++/5625 ([mips] exception unwinding creates invalid pointer on 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-09 13:18:45 -08:00
Roger Sayle ef79730c93 builtins.def (BUILT_IN_SIGNBIT, [...]): New GCC builtins.
* 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-02-01 14:59:15 +00:00
Kazu Hirata a457ee07af alloc-pool.c: Fix comment typos.
* alloc-pool.c: Fix comment typos.
	* builtin-types.def: Likewise.
	* builtins.def: Likewise.
	* c-pretty-print.c: Likewise.
	* df.h: Likewise.
	* reload1.c: Likewise.

From-SVN: r77043
2004-01-31 17:47:43 +00:00
Kaveh R. Ghazi 11bf0eb0c7 builtin-types.def (BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, [...]): New.
* builtin-types.def
	(BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE,
	BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE_COMPLEX_DOUBLE,
	BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT_COMPLEX_FLOAT): New.
	* builtins.def (BUILT_IN_CACOS, BUILT_IN_CACOSF, BUILT_IN_CACOSH,
	BUILT_IN_CACOSHF, BUILT_IN_CACOSHL, BUILT_IN_CACOSL,
	BUILT_IN_CARG, BUILT_IN_CARGF, BUILT_IN_CARGL, BUILT_IN_CASIN,
	BUILT_IN_CASINF, BUILT_IN_CASINH, BUILT_IN_CASINHF,
	BUILT_IN_CASINHL, BUILT_IN_CASINL, BUILT_IN_CATAN,
	BUILT_IN_CATANF, BUILT_IN_CATANH, BUILT_IN_CATANHF,
	BUILT_IN_CATANHL, BUILT_IN_CATANL, BUILT_IN_CCOS, BUILT_IN_CCOSF,
	BUILT_IN_CCOSH, BUILT_IN_CCOSHF, BUILT_IN_CCOSHL, BUILT_IN_CCOSL,
	BUILT_IN_CEXP, BUILT_IN_CEXPF, BUILT_IN_CEXPL, BUILT_IN_CPOW,
	BUILT_IN_CPOWF, BUILT_IN_CPOWL, BUILT_IN_CPROJ, BUILT_IN_CPROJF,
	BUILT_IN_CPROJL, BUILT_IN_CSIN, BUILT_IN_CSINF, BUILT_IN_CSINH,
	BUILT_IN_CSINHF, BUILT_IN_CSINHL, BUILT_IN_CSINL, BUILT_IN_CSQRT,
	BUILT_IN_CSQRTF, BUILT_IN_CSQRTL, BUILT_IN_CTAN, BUILT_IN_CTANF,
	BUILT_IN_CTANH, BUILT_IN_CTANHF, BUILT_IN_CTANHL, BUILT_IN_CTANL):
	New.
	* doc/extend.texi: Document new builtins.

testsuite:
	* gcc.dg/builtins-1.c: Add more _Complex tests.
	* gcc.dg/torture/builtin-attr-1.c: Likewise.

From-SVN: r71226
2003-09-09 03:29:18 +00:00