Commit Graph

528 Commits

Author SHA1 Message Date
Georg-Johann Lay 7db1c40d36 backport: re PR rtl-optimization/75964 (insn combiner removes comparison after ABS)
gcc/
	Backport from 2017-05-06 trunk r247719.
	PR rtl-optimization/75964
	* simplify-rtx.c (simplify_const_relational_operation): Remove
	invalid handling of comparisons of integer ABS.
gcc/testsuite/
	Backport from 2017-05-06 trunk r247719.
	PR rtl-optimization/75964
	* gcc.dg/torture/pr75964.c: New test.

From-SVN: r250509
2017-07-25 11:39:23 +00:00
Jakub Jelinek df1c878ec2 re PR middle-end/80100 (simplify-rtx.c sanitizer detects undefined behaviour with optimization)
PR middle-end/80100
	* simplify-rtx.c (simplify_binary_operation_1) <case IOR>: Perform
	left shift in unsigned HOST_WIDE_INT type.

	* gcc.dg/pr80100.c: New test.

From-SVN: r246851
2017-04-11 19:21:51 +02:00
Jakub Jelinek 8585103f05 re PR rtl-optimization/80385 (Segfault in commutative_operand_precedence() rtlanal.c:3373)
PR rtl-optimization/80385
	* simplify-rtx.c (simplify_unary_operation_1): Don't transform
	(not (neg X)) into (plus X -1) for complex or non-integral modes.

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

From-SVN: r246850
2017-04-11 19:19:56 +02:00
Segher Boessenkool 833bbf60ce simplify-rtx: Fix compare of comparisons (PR60818)
The function simplify_binary_operation_1 has code that does
/* Convert (compare (gt (flags) 0) (lt (flags) 0)) to (flags).  */
but this transformation is only valid if "flags" has the same machine
mode as the outer compare.  This fixes it.


	PR rtl-optimization/60818
	* simplify-rtx.c (simplify_binary_operation_1): Do not replace
	a compare of comparisons with the thing compared if this results
	in a different machine mode.

gcc/testsuite/
	PR rtl-optimization/60818
	* gcc.c-torture/compile/pr60818.c: New testcase.

From-SVN: r246666
2017-04-04 02:10:02 +02:00
Martin Liska c68dda5950 Fix another profiledbootstrap warning (PR libfortran/79956).
2017-03-21  Martin Liska  <mliska@suse.cz>

	PR libfortran/79956
	* simplify-rtx.c (simplify_immed_subreg): Initialize a variable
	to NULL.

From-SVN: r246317
2017-03-21 12:04:17 +00:00
Jakub Jelinek 4cd2eefc85 re PR tree-optimization/61441 (ARM aarch64 fails to quiet signaling NaN)
PR tree-optimization/61441
	* simplify-rtx.c (simplify_const_unary_operation): For
	-fsignaling-nans and sNaN operand, return NULL_RTX rather than
	the sNaN unmodified.

From-SVN: r245620
2017-02-21 09:08:40 +01:00
Jakub Jelinek cbe34bb5ed Update copyright years.
From-SVN: r243994
2017-01-01 13:07:43 +01:00
Segher Boessenkool 5bd12bafb5 simplify-rtx: Fix the last fix (PR78638)
I managed to get the last obvious fix wrong: mode is M1, GET_MODE (op)
is M2.


	* simplify-rtx.c (simplify_truncation): M2 is not mode, it is
	GET_MODE (op).  Fix this.

From-SVN: r243210
2016-12-03 00:51:31 +01:00
Segher Boessenkool 2df22b5f30 simplify-rtx: Add missing line for previous commit (PR78583)
The comment for the added case to simplify_truncation reads

  /* Turn (truncate:M1 (*_extract:M2 (reg:M2) (len) (pos))) into
     (*_extract:M1 (truncate:M1 (reg:M2)) (len) (pos')) if possible without
     changing len.  */

but I forgot to check the two modes M2 are actually the same.


	PR rtl-optimization/78583
	* simplify-rtx.c (simplify_truncation): Add check missing from the
	previous commit.

From-SVN: r243000
2016-11-30 09:41:26 +01:00
Segher Boessenkool 48cf0e51e9 simplify-rtx: Handle truncate of extract
simplify_truncation changes the truncation of many operations into
the operation on the truncation.  This patch makes this code also
handle extracts.


	* simplify-rtx.c (simplify_truncation): Handle truncate of zero_extract
	and sign_extract.

From-SVN: r242946
2016-11-29 02:48:30 +01:00
Jakub Jelinek d057004733 re PR rtl-optimization/78546 (wrong code at -O2 and above)
PR rtl-optimization/78546
	* simplify-rtx.c (neg_const_int): When negating most negative
	number in mode wider than HOST_BITS_PER_WIDE_INT, use
	simplify_const_unary_operation to produce CONST_DOUBLE or
	CONST_WIDE_INT.
	(simplify_plus_minus): Hanlde the case where neg_const_int
	doesn't return a CONST_INT.

	* gcc.dg/torture/pr78546-1.c: New test.
	* gcc.dg/torture/pr78546-2.c: New test.

From-SVN: r242929
2016-11-28 20:15:51 +01:00
Jakub Jelinek ad7a69db52 re PR rtl-optimization/78526 (ICE: in decompose, at rtl.h:2117 with -g -mavx512bw)
PR rtl-optimization/78526
	* simplify-rtx.c (simplify_immed_subreg): Don't use wi::extract_uhwi
	beyond val's precision.

	* gcc.dg/pr78526.c: New test.

From-SVN: r242882
2016-11-25 19:56:50 +01:00
Richard Sandiford f079167a30 Use rtx_mode_t instead of std::make_pair
This change makes the code less sensitive to the exact type of the mode,
i.e. it forces a conversion where necessary.  This becomes important
when wrappers like scalar_int_mode and scalar_mode can also be used
instead of machine_mode.

Using rtx_mode_t also abstracts away the representation.  The fact that
it's a std::pair rather than a custom class isn't important to users of
the interface.

gcc/
2016-11-18  Richard Sandiford  <richard.sandiford@arm.com>
	    Alan Hayward  <alan.hayward@arm.com>
	    David Sherwood  <david.sherwood@arm.com>

	* combine.c (try_combine): Use rtx_mode_t instead of std::make_pair.
	* dwarf2out.c (mem_loc_descriptor, loc_descriptor): Likewise.
	(add_const_value_attribute): Likewise.
	* explow.c (plus_constant): Likewise.
	* expmed.c (expand_mult, make_tree): Likewise.
	* expr.c (convert_modes): Likewise.
	* loop-doloop.c (doloop_optimize): Likewise.
	* postreload.c (reload_cse_simplify_set): Likewise.
	* simplify-rtx.c (simplify_const_unary_operation): Likewise.
	(simplify_binary_operation_1, simplify_const_binary_operation):
	(simplify_const_relational_operation, simplify_immed_subreg): Likewise.
	* wide-int.h: Update documentation to recommend rtx_mode_t
	instead of std::make_pair.

Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
Co-Authored-By: David Sherwood <david.sherwood@arm.com>

From-SVN: r242586
2016-11-18 10:04:53 +00:00
Segher Boessenkool a62436c0a5 simplify-rtx: Transform (xor (and (xor A B) C) B) with C const
match.pd transforms (A&C)|(B&~C) to ((A^B)&C)^B, which is fewer
operations if C is not const (and it is not on simple tests at least,
this transform is done very early already).

Various processors have "insert" instructions that can do this, but
combine cannot build those from the xor-and-xor, especially it has no
chance at all to do that if A or B or multiple instructions as well
(on PowerPC, the rl[wd]imi instructions can do this with together with
a rotate, or a simple shift with appropriate C; other ISAs have similar
insns).

This patch makes RTL simplify transform (xor (and (xor A B) C) B) back
to (ior (and A C) (and B ~C)) for constant C (and similar with A instead
of B for that last term).


	* simplify-rtx.c (simplify_binary_operation_1): Simplify
	(xor (and (xor A B) C) B) to (ior (and A C) (and B ~C)) and
	(xor (and (xor A B) C) A) to (ior (and A ~C) (and B C)) if C
	is a const_int.

From-SVN: r242031
2016-11-10 01:32:43 +01:00
Thomas Preud'homme 4d0cdd0ce6 Move MEMMODEL_* from coretypes.h to memmodel.h
2016-10-13  Thomas Preud'homme  <thomas.preudhomme@arm.com>

    gcc/
    * coretypes.h: Move MEMMODEL_* macros and enum memmodel definition
    into ...
    * memmodel.h: This file.
    * alias.c, asan.c, auto-inc-dec.c, bb-reorder.c, bt-load.c,
      caller-save.c, calls.c, ccmp.c, cfgbuild.c, cfgcleanup.c,
      cfgexpand.c, cfgloopanal.c, cfgrtl.c, cilk-common.c, combine.c,
      combine-stack-adj.c, common/config/aarch64/aarch64-common.c,
      common/config/arm/arm-common.c, common/config/bfin/bfin-common.c,
      common/config/c6x/c6x-common.c, common/config/i386/i386-common.c,
      common/config/ia64/ia64-common.c, common/config/nvptx/nvptx-common.c,
      compare-elim.c, config/aarch64/aarch64-builtins.c,
      config/aarch64/aarch64-c.c, config/aarch64/cortex-a57-fma-steering.c,
      config/arc/arc.c, config/arc/arc-c.c, config/arm/arm-builtins.c,
      config/arm/arm-c.c, config/avr/avr.c, config/avr/avr-c.c,
      config/avr/avr-log.c, config/bfin/bfin.c, config/c6x/c6x.c,
      config/cr16/cr16.c, config/cris/cris.c, config/darwin-c.c,
      config/darwin.c, config/epiphany/epiphany.c,
      config/epiphany/mode-switch-use.c,
      config/epiphany/resolve-sw-modes.c, config/fr30/fr30.c,
      config/frv/frv.c, config/ft32/ft32.c, config/h8300/h8300.c,
      config/i386/i386-c.c, config/i386/winnt.c, config/iq2000/iq2000.c,
      config/lm32/lm32.c, config/m32c/m32c.c, config/m32r/m32r.c,
      config/m68k/m68k.c, config/mcore/mcore.c,
      config/microblaze/microblaze.c, config/mmix/mmix.c,
      config/mn10300/mn10300.c, config/moxie/moxie.c,
      config/msp430/msp430.c, config/nds32/nds32-cost.c,
      config/nds32/nds32-intrinsic.c, config/nds32/nds32-md-auxiliary.c,
      config/nds32/nds32-memory-manipulation.c,
      config/nds32/nds32-predicates.c, config/nds32/nds32.c,
      config/nios2/nios2.c, config/nvptx/nvptx.c, config/pa/pa.c,
      config/pdp11/pdp11.c, config/rl78/rl78.c, config/rs6000/rs6000-c.c,
      config/rx/rx.c, config/s390/s390-c.c, config/s390/s390.c,
      config/sh/sh.c, config/sh/sh-c.c, config/sh/sh-mem.cc,
      config/sh/sh_treg_combine.cc, config/sol2.c, config/spu/spu.c,
      config/stormy16/stormy16.c, config/tilegx/tilegx.c,
      config/tilepro/tilepro.c, config/v850/v850.c, config/vax/vax.c,
      config/visium/visium.c, config/vms/vms-c.c, config/xtensa/xtensa.c,
      coverage.c, cppbuiltin.c, cprop.c, cse.c, cselib.c, dbxout.c, dce.c,
      df-core.c, df-problems.c, df-scan.c, dojump.c, dse.c, dwarf2asm.c,
      dwarf2cfi.c, dwarf2out.c, emit-rtl.c, except.c, explow.c, expmed.c,
      expr.c, final.c, fold-const.c, function.c, fwprop.c, gcse.c,
      ggc-page.c, haifa-sched.c, hsa-brig.c, hsa-gen.c, hw-doloop.c,
      ifcvt.c, init-regs.c, internal-fn.c, ira-build.c, ira-color.c,
      ira-conflicts.c, ira-costs.c, ira-emit.c, ira-lives.c, ira.c, jump.c,
      loop-doloop.c, loop-invariant.c, loop-iv.c, loop-unroll.c,
      lower-subreg.c, lra.c, lra-assigns.c, lra-coalesce.c,
      lra-constraints.c, lra-eliminations.c, lra-lives.c, lra-remat.c,
      lra-spills.c, mode-switching.c, modulo-sched.c, omp-low.c, passes.c,
      postreload-gcse.c, postreload.c, predict.c, print-rtl-function.c,
      recog.c, ree.c, reg-stack.c, regcprop.c, reginfo.c, regrename.c,
      reload.c, reload1.c, reorg.c, resource.c, rtl-chkp.c, rtl-tests.c,
      rtlanal.c, rtlhooks.c, sched-deps.c, sched-rgn.c, sdbout.c,
      sel-sched-ir.c, sel-sched.c, shrink-wrap.c, simplify-rtx.c,
      stack-ptr-mod.c, stmt.c, stor-layout.c, target-globals.c,
      targhooks.c, toplev.c, tree-nested.c, tree-outof-ssa.c,
      tree-profile.c, tree-ssa-coalesce.c, tree-ssa-ifcombine.c,
      tree-ssa-loop-ivopts.c, tree-ssa-loop.c, tree-ssa-reassoc.c,
      tree-ssa-sccvn.c, tree-vect-data-refs.c, ubsan.c, valtrack.c,
      var-tracking.c, varasm.c: Include memmodel.h.
    * genattrtab.c (write_header): Include memmodel.h in generated file.
    * genautomata.c (main): Likewise.
    * gengtype.c (open_base_files): Likewise.
    * genopinit.c (main): Likewise.
    * genconditions.c (write_header): Include memmodel.h earlier in
    generated file.
    * genemit.c (main): Likewise.
    * genoutput.c (output_prologue): Likewise.
    * genpeep.c (main): Likewise.
    * genpreds.c (write_insn_preds_c): Likewise.
    * genrecog.c (write_header): Likewise.
    * Makefile.in (PLUGIN_HEADERS): Include memmodel.h

    gcc/ada/
    * gcc-interface/utils2.c: Include memmodel.h.

    gcc/c-family/
    * c-cppbuiltin.c: Include memmodel.h.
    * c-opts.c: Likewise.
    * c-pragma.c: Likewise.
    * c-warn.c: Likewise.

    gcc/c/
    * c-typeck.c: Include memmodel.h.

    gcc/cp/
    * decl2.c: Include memmodel.h.
    * rtti.c: Likewise.

    gcc/fortran/
    * trans-intrinsic.c: Include memmodel.h.

    gcc/go/
    * go-backend.c: Include memmodel.h.

    libgcc/
    * libgcov-profiler.c: Replace MEMMODEL_* macros by their __ATOMIC_*
    equivalent.
    * config/tilepro/atomic.c: Likewise and stop casting model to
    enum memmodel.

From-SVN: r241121
2016-10-13 14:17:52 +00:00
Jakub Jelinek 8813a647b5 tree-ssa.c (target_for_debug_bind, [...]): Use VAR_P and/or VAR_OR_FUNCTION_DECL_P macros.
* tree-ssa.c (target_for_debug_bind, verify_phi_args,
	ssa_undefined_value_p, maybe_optimize_var): Use VAR_P and/or
	VAR_OR_FUNCTION_DECL_P macros.
	* tree-chkp.c (chkp_register_var_initializer, chkp_make_static_bounds,
	chkp_get_bounds_for_decl_addr, chkp_parse_array_and_component_ref,
	chkp_find_bounds_1): Likewise.
	* ipa-polymorphic-call.c (decl_maybe_in_construction_p): Likewise.
	* hsa-gen.c (get_symbol_for_decl): Likewise.
	* cgraphunit.c (check_global_declaration, analyze_functions,
	handle_alias_pairs, thunk_adjust, cgraph_node::expand_thunk):
	Likewise.
	* gimple-fold.c (can_refer_decl_in_current_unit_p,
	canonicalize_constructor_val, gimple_get_virt_method_for_vtable):
	Likewise.
	* tree.c (set_decl_section_name, copy_node_stat,
	need_assembler_name_p, free_lang_data_in_decl, find_decls_types_r,
	merge_dllimport_decl_attributes, handle_dll_attribute,
	decl_init_priority_insert, auto_var_in_fn_p, array_at_struct_end_p,
	verify_type): Likewise.
	* gimple-ssa-isolate-paths.c (find_implicit_erroneous_behavior,
	find_explicit_erroneous_behavior): Likewise.
	* sdbout.c (sdbout_toplevel_data, sdbout_late_global_decl): Likewise.
	* ipa.c (process_references): Likewise.
	* tree-chkp-opt.c (chkp_get_check_result): Likewise.
	* varasm.c (get_block_for_decl, use_blocks_for_decl_p, make_decl_rtl,
	notice_global_symbol, assemble_variable, mark_decl_referenced,
	build_constant_desc, output_constant_def_contents, do_assemble_alias,
	make_decl_one_only, default_section_type_flags,
	categorize_decl_for_section, default_encode_section_info): Likewise.
	* trans-mem.c (requires_barrier): Likewise.
	* gimple-expr.c (mark_addressable): Likewise.
	* cfgexpand.c (add_scope_conflicts_1, expand_one_var,
	expand_used_vars_for_block, clear_tree_used, stack_protect_decl_p,
	expand_debug_expr): Likewise.
	* tree-dump.c (dequeue_and_dump): Likewise.
	* ubsan.c (instrument_bool_enum_load): Likewise.
	* tree-pretty-print.c (print_declaration): Likewise.
	* simplify-rtx.c (delegitimize_mem_from_attrs): Likewise.
	* tree-ssa-uninit.c (warn_uninitialized_vars): Likewise.
	* asan.c (asan_protect_global, instrument_derefs): Likewise.
	* tree-into-ssa.c (rewrite_stmt, maybe_register_def,
	pass_build_ssa::execute): Likewise.
	* var-tracking.c (var_debug_decl, track_expr_p): Likewise.
	* tree-ssa-loop-ivopts.c (force_expr_to_var_cost, split_address_cost):
	Likewise.
	* ipa-split.c (test_nonssa_use, consider_split, mark_nonssa_use):
	Likewise.
	* tree-inline.c (insert_debug_decl_map, remap_ssa_name,
	can_be_nonlocal, remap_decls, copy_debug_stmt,
	initialize_inlined_parameters, add_local_variables,
	reset_debug_binding, replace_locals_op): Likewise.
	* dse.c (can_escape): Likewise.
	* ipa-devirt.c (compare_virtual_tables, referenced_from_vtable_p):
	Likewise.
	* tree-diagnostic.c (default_tree_printer): Likewise.
	* tree-streamer-in.c (unpack_ts_decl_common_value_fields,
	unpack_ts_decl_with_vis_value_fields,
	lto_input_ts_decl_common_tree_pointers): Likewise.
	* builtins.c (builtin_save_expr, fold_builtin_expect,
	readonly_data_expr): Likewise.
	* tree-ssa-structalias.c (new_var_info, get_constraint_for_ssa_var,
	create_variable_info_for, set_uids_in_ptset, visit_loadstore):
	Likewise.
	* gimple-streamer-out.c (output_gimple_stmt): Likewise.
	* gimplify.c (force_constant_size, gimplify_bind_expr,
	gimplify_decl_expr, gimplify_var_or_parm_decl,
	gimplify_compound_lval, gimplify_init_constructor,
	gimplify_modify_expr, gimplify_asm_expr, gimplify_oacc_declare,
	gimplify_type_sizes): Likewise.
	* cgraphbuild.c (record_reference, record_type_list, mark_address,
	mark_load, mark_store, pass_build_cgraph_edges::execute): Likewise.
	* tree-ssa-live.c (mark_all_vars_used_1, remove_unused_scope_block_p,
	remove_unused_locals): Likewise.
	* tree-ssa-alias.c (ptr_deref_may_alias_decl_p, ptrs_compare_unequal,
	ref_maybe_used_by_call_p_1, call_may_clobber_ref_p_1): Likewise.
	* function.c (instantiate_expr, instantiate_decls_1,
	setjmp_vars_warning, add_local_decl): Likewise.
	* alias.c (ao_ref_from_mem, get_alias_set, compare_base_symbol_refs):
	Likewise.
	* tree-stdarg.c (find_va_list_reference, va_list_counter_struct_op,
	va_list_ptr_read, va_list_ptr_write, check_all_va_list_escapes,
	optimize_va_list_gpr_fpr_size): Likewise.
	* tree-nrv.c (pass_nrv::execute): Likewise.
	* tsan.c (instrument_expr): Likewise.
	* tree-ssa-dce.c (remove_dead_stmt): Likewise.
	* vtable-verify.c (verify_bb_vtables): Likewise.
	* tree-dfa.c (ssa_default_def, set_ssa_default_def,
	get_ref_base_and_extent): Likewise.
	* toplev.c (wrapup_global_declaration_1, wrapup_global_declaration_2):
	Likewise.
	* tree-sra.c (static bool constant_decl_p, find_var_candidates,
	analyze_all_variable_accesses): Likewise.
	* tree-nested.c (get_nonlocal_debug_decl,
	convert_nonlocal_omp_clauses, note_nonlocal_vla_type,
	note_nonlocal_block_vlas, convert_nonlocal_reference_stmt,
	get_local_debug_decl, convert_local_omp_clauses,
	convert_local_reference_stmt, nesting_copy_decl, remap_vla_decls):
	Likewise.
	* tree-vect-data-refs.c (vect_can_force_dr_alignment_p): Likewise.
	* stmt.c (decl_overlaps_hard_reg_set_p): Likewise.
	* dbxout.c (dbxout_late_global_decl, dbxout_type_fields,
	dbxout_symbol, dbxout_common_check): Likewise.
	* expr.c (expand_assignment, expand_expr_real_2, expand_expr_real_1,
	string_constant): Likewise.
	* hsa.c (hsa_get_declaration_name): Likewise.
	* passes.c (rest_of_decl_compilation): Likewise.
	* tree-ssanames.c (make_ssa_name_fn): Likewise.
	* tree-streamer-out.c (pack_ts_decl_common_value_fields,
	pack_ts_decl_with_vis_value_fields,
	write_ts_decl_common_tree_pointers): Likewise.
	* stor-layout.c (place_field): Likewise.
	* symtab.c (symtab_node::maybe_create_reference,
	symtab_node::verify_base, symtab_node::make_decl_local,
	symtab_node::copy_visibility_from,
	symtab_node::can_increase_alignment_p): Likewise.
	* dwarf2out.c (add_var_loc_to_decl, tls_mem_loc_descriptor,
	decl_by_reference_p, reference_to_unused, rtl_for_decl_location,
	fortran_common, add_location_or_const_value_attribute,
	add_scalar_info, add_linkage_name, set_block_abstract_flags,
	local_function_static, gen_variable_die, dwarf2out_late_global_decl,
	optimize_one_addr_into_implicit_ptr,
	optimize_location_into_implicit_ptr): Likewise.
	* gimple-low.c (record_vars_into): Likewise.
	* ipa-visibility.c (update_vtable_references): Likewise.
	* tree-ssa-address.c (fixed_address_object_p, copy_ref_info):
	Likewise.
	* lto-streamer-out.c (tree_is_indexable, get_symbol_initial_value,
	DFS::DFS_write_tree_body, write_symbol): Likewise.
	* langhooks.c (lhd_warn_unused_global_decl,
	lhd_set_decl_assembler_name): Likewise.
	* attribs.c (decl_attributes): Likewise.
	* except.c (output_ttype): Likewise.
	* varpool.c (varpool_node::get_create, ctor_for_folding,
	varpool_node::assemble_decl, varpool_node::create_alias): Likewise.
	* fold-const.c (fold_unary_loc): Likewise.
	* ipa-prop.c (ipa_compute_jump_functions_for_edge,
	ipa_find_agg_cst_from_init): Likewise.
	* omp-low.c (expand_omp_regimplify_p, expand_omp_taskreg,
	expand_omp_target, lower_omp_regimplify_p,
	grid_reg_assignment_to_local_var_p, grid_remap_prebody_decls,
	find_link_var_op): Likewise.
	* tree-chrec.c (chrec_contains_symbols): Likewise.
	* tree-cfg.c (verify_address, verify_expr, verify_expr_location_1,
	gimple_duplicate_bb, move_stmt_op, replace_block_vars_by_duplicates,
	execute_fixup_cfg): Likewise.

From-SVN: r240900
2016-10-09 13:19:48 +02:00
Kyrylo Tkachov 125f0e39bf [simplify-rtx] Zero-initialise local array in simplify_immed_subreg
* simplify-rtx.c (simplify_immed_subreg): Zero-initialize tmp array
	before merging in bytes to pass down to real_from_target.

From-SVN: r240866
2016-10-07 14:47:55 +00:00
Trevor Saunders c9b0a22777 make next/prev _nonnote_insn take rtx_insn *
gcc/ChangeLog:

2016-09-22  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* emit-rtl.c (next_nonnote_insn): Change argument type to
	rtx_insn *.
	(prev_nonnote_insn): Likewise.
	* jump.c (reversed_comparison_code_parts): Likewise.
	(reversed_comparison): Likewise.
	* rtl.h: Adjust prototypes.
	* config/arc/arc.md: Adjust.
	* cse.c (find_comparison_args): Likewise.
	* reorg.c (redundant_insn): Change return type to rtx_insn *.
	(fix_reg_dead_note): Change argument type to rtx_insn *.
	(delete_prior_computation): Likewise.
	(delete_computation): Likewise.
	(fill_slots_from_thread): Adjust.
	(relax_delay_slots): Likewise.
	* simplify-rtx.c (simplify_unary_operation_1): Likewise.
	(simplify_relational_operation_1): Likewise.
	(simplify_ternary_operation): Likewise.

From-SVN: r240357
2016-09-22 13:16:17 +00:00
Kyrylo Tkachov 5fa9e6441f [simplify-rtx] (GTU (PLUS a C) (C - 1)) --> (LTU a -C)
* simplify-rtx.c (simplify_relational_operation_1): Add transformation
	(GTU (PLUS a C) (C - 1)) --> (LTU a -C).

	* gcc.target/aarch64/gtu_to_ltu_cmp_1.c: New test.
	* gcc.target/aarch64/gtu_to_ltu_cmp_2.c: New test.

From-SVN: r240238
2016-09-19 16:15:57 +00:00
Jakub Jelinek 26122e2d8a re PR middle-end/77377 (c-c++-common/pr59037.c ICEs with -fpic -msse on i686)
PR middle-end/77377
	* simplify-rtx.c (avoid_constant_pool_reference): For out of bounds
	constant pool reference return x instead of c.

	* gcc.target/i386/pr77377.c: New test.

From-SVN: r239854
2016-08-30 08:45:56 +02:00
Marek Polacek 191816a36b re PR c/7652 (-Wswitch-break : Warn if a switch case falls through)
PR c/7652
gcc/
	* alias.c (find_base_value): Adjust fall through comment.
	* cfgexpand.c (expand_debug_expr): Likewise.
	* combine.c (find_split_point): Likewise.
	(expand_compound_operation): Likewise.  Add FALLTHRU.
	(make_compound_operation): Adjust fall through comment.
	(canon_reg_for_combine): Add FALLTHRU.
	(force_to_mode): Adjust fall through comment.
	(simplify_shift_const_1): Likewise.
	(simplify_comparison): Likewise.
	* config/aarch64/aarch64-builtins.c (aarch64_simd_expand_args): Add
	FALLTHRU.
	* config/aarch64/predicates.md: Likewise.
	* config/i386/i386.c (function_arg_advance_32): Likewise.
	(ix86_gimplify_va_arg): Likewise.
	(print_reg): Likewise.
	(ix86_print_operand): Likewise.
	(ix86_build_const_vector): Likewise.
	(ix86_expand_branch): Likewise.
	(ix86_sched_init_global): Adjust fall through comment.
	(ix86_expand_args_builtin): Add FALLTHRU.
	(ix86_expand_builtin): Likewise.
	(ix86_expand_vector_init_one_var): Likewise.
	* config/rs6000/rs6000.c (rs6000_emit_vector_compare_inner): Likewise.
	(rs6000_adjust_cost): Likewise.
	(insn_must_be_first_in_group): Likewise.
	* config/rs6000/rs6000.md: Likewise.  Adjust fall through comment.
	* dbxout.c (dbxout_symbol): Adjust fall through comment.
	* df-scan.c (df_uses_record): Likewise.
	* dojump.c (do_jump): Add FALLTHRU.
	* dwarf2out.c (mem_loc_descriptor): Likewise.  Adjust fall through
	comment.
	(resolve_args_picking_1): Adjust fall through comment.
	(loc_list_from_tree_1): Likewise.
	* expmed.c (make_tree): Likewise.
	* expr.c (expand_expr_real_2): Add FALLTHRU.
	(expand_expr_real_1): Likewise.  Adjust fall through comment.
	* fold-const.c (const_binop): Adjust fall through comment.
	(fold_truth_not_expr): Likewise.
	(fold_cond_expr_with_comparison): Add FALLTHRU.
	(fold_binary_loc): Likewise.
	(contains_label_1): Adjust fall through comment.
	(multiple_of_p): Likewise.
	* gcov-tool.c (process_args): Add FALLTHRU.
	* genattrtab.c (check_attr_test): Likewise.
	(write_test_expr): Likewise.
	* genconfig.c (walk_insn_part): Likewise.
	* genpreds.c (validate_exp): Adjust fall through comment.
	(needs_variable): Likewise.
	* gensupport.c (get_alternatives_number): Add FALLTHRU.
	(subst_dup): Likewise.
	* gimple-pretty-print.c (dump_gimple_assign): Likewise.
	* gimplify.c (gimplify_addr_expr): Adjust fall through comment.
	(gimplify_scan_omp_clauses): Add FALLTHRU.
	(goa_stabilize_expr): Likewise.
	* graphite-isl-ast-to-gimple.c (substitute_ssa_name): Adjust fall
	through comment.
	* hsa-gen.c (get_address_from_value): Likewise.
	* ipa-icf.c (sem_function::hash_stmt): Likewise.
	* ira.c (ira_setup_alts): Add FALLTHRU.
	* lra-eliminations.c (lra_eliminate_regs_1): Adjust fall through
	comment.
	* lto-streamer-out.c (lto_output_tree_ref): Add FALLTHRU.
	* opts.c (common_handle_option): Likewise.
	* read-rtl.c (read_rtx_code): Likewise.
	* real.c (round_for_format): Likewise.
	* recog.c (asm_operand_ok): Likewise.
	* reginfo.c (reg_scan_mark_refs): Adjust fall through comment.
	* reload1.c (set_label_offsets): Likewise.
	(eliminate_regs_1): Likewise.
	(reload_reg_reaches_end_p): Likewise.
	* rtlanal.c (commutative_operand_precedence): Add FALLTHRU.
	(rtx_cost): Likewise.
	* sched-rgn.c (is_exception_free): Likewise.
	* simplify-rtx.c (simplify_rtx): Adjust fall through comment.
	* stor-layout.c (int_mode_for_mode): Likewise.
	* toplev.c (print_to_asm_out_file): Likewise.
	(print_to_stderr): Likewise.
	* tree-cfg.c (gimple_verify_flow_info): Likewise.
	* tree-chrec.c (chrec_fold_plus_1): Add FALLTHRU.
	(chrec_fold_multiply): Likewise.
	(evolution_function_is_invariant_rec_p): Likewise.
	(for_each_scev_op): Likewise.
	* tree-data-ref.c (siv_subscript_p): Likewise.
	(get_references_in_stmt): Likewise.
	* tree.c (find_placeholder_in_expr): Adjust fall through comment.
	(substitute_in_expr): Likewise.
	(type_cache_hasher::equal): Likewise.
	(walk_type_fields): Likewise.
	* var-tracking.c (adjust_mems): Add FALLTHRU.
	(set_dv_changed): Adjust fall through comment.
	* varasm.c (default_function_section): Add FALLTHRU.
gcc/c-family/
	* c-common.c (scalar_to_vector): Adjust fall through comment.
	* c-opts.c (c_common_handle_option): Likewise.
	* c-pragma.c (handle_pragma_pack): Add FALLTHRU.
	* c-pretty-print.c (c_pretty_printer::postfix_expression): Adjust
	fall through comment.
	* cilk.c (extract_free_variables): Add FALLTHRU.
gcc/c/
	* c-parser.c (c_parser_external_declaration): Add FALLTHRU.
	(c_parser_postfix_expression): Likewise.
	* c-typeck.c (build_unary_op): Adjust fall through comment.
	(c_mark_addressable): Likewise.
gcc/cp/
	* call.c (add_builtin_candidate): Add FALLTHRU.
	(build_integral_nontype_arg_conv): Adjust fall through comment.
	(build_new_op_1): Add FALLTHRU.
	(convert_like_real): Adjust fall through comment.
	* class.c (fixed_type_or_null): Likewise.
	* constexpr.c (cxx_eval_constant_expression): Likewise.
	(potential_constant_expression_1): Likewise.  Add FALLTHRU.
	* cp-gimplify.c (cp_gimplify_expr): Adjust fall through comment.
	(cp_fold): Add FALLTHRU.
	* cvt.c (build_expr_type_conversion): Adjust fall through comment.
	* cxx-pretty-print.c (pp_cxx_unqualified_id): Add FALLTHRU.
	(pp_cxx_qualified_id): Likewise.
	(cxx_pretty_printer::constant): Adjust fall through comment.
	(cxx_pretty_printer::primary_expression): Add FALLTHRU.
	(pp_cxx_pm_expression): Adjust fall through comment.
	(cxx_pretty_printer::expression): Add FALLTHRU.
	(cxx_pretty_printer::declaration_specifiers): Reformat code.
	(pp_cxx_type_specifier_seq): Adjust fall through comment.
	(pp_cxx_ptr_operator): Likewise.  Add FALLTHRU.
	* error.c (dump_type): Adjust fall through comment.
	(dump_decl): Likewise.
	* mangle.c (write_type): Likewise.
	* method.c (synthesized_method_walk): Add FALLTHRU.
	* name-lookup.c (arg_assoc_type): Likewise.
	* parser.c (cp_lexer_print_token): Adjust fall through comment.
	(cp_parser_primary_expression): Add FALLTHRU.
	(cp_parser_operator): Likewise.
	* pt.c (find_parameter_packs_r): Likewise.
	(tsubst_aggr_type): Adjust fall through comment.
	* semantics.c (finish_omp_clauses): Add FALLTHRU.
	* tree.c (lvalue_kind): Likewise.
gcc/fortran/
	* decl.c (match_attr_spec): Add FALLTHRU.
	* primary.c (match_arg_list_function): Likewise.
	* resolve.c (resolve_operator): Adjust fall through comment.
	(fixup_charlen): Add FALLTHRU.
	(resolve_allocate_expr): Adjust fall through comment.
	* trans-array.c (gfc_conv_ss_startstride): Add FALLTHRU.
	* trans-intrinsic.c (gfc_conv_intrinsic_len): Adjust fall through
	comment.
gcc/java/
	* expr.c (java_truthvalue_conversion): Adjust fall through comment.
	* jcf-io.c (verify_constant_pool): Likewise.
	* typeck.c (promote_type): Likewise.
gcc/objc/
	* objc-encoding.c (encode_type): Add FALLTHRU.
libcpp/
	* lex.c (search_line_fast): Add FALLTHRU.
	(_cpp_lex_direct): Likewise.
	(cpp_token_val_index): Adjust fall through comment.
	* macro.c (parse_params): Add FALLTHRU.
	* pch.c (count_defs): Adjust fall through comment.
	(write_defs): Likewise.
libiberty/
	* cp-demangle.c (d_print_mod): Add FALLTHRU.

From-SVN: r239410
2016-08-12 10:30:47 +00:00
Richard Biener 0b64ca40f3 re PR rtl-optimization/71984 (wrong code with -O -mavx512cd)
2016-07-26  Richard Biener  <rguenther@suse.de>

	PR rtl-optimization/71984
	* simplify-rtx.c (simplify_subreg): Use GET_MODE_SIZE and prepare
	for VOIDmode.

	* gcc.dg/torture/pr71984.c: New testcase.

From-SVN: r238757
2016-07-26 14:11:21 +00:00
Uros Bizjak 07e96250ae hwint.h (HOST_WIDE_INT_0): New define.
* hwint.h (HOST_WIDE_INT_0): New define.
	(HOST_WIDE_INT_0U): Ditto.
	* double-int.c: Use HOST_WIDE_INT_0 instead of (HOST_WIDE_INT) 0.
	* dse.c: Use HOST_WIDE_INT_0U instead of (unsigned HOST_WIDE_INT) 0.
	* simplify-rtx.c: Ditto.
	* tree-object-size.c: Ditto.

From-SVN: r238545
2016-07-20 23:59:44 +02:00
Uros Bizjak fecfbfa4a2 builtins.c: Use HOST_WIDE_INT_1 instead of (HOST_WIDE_INT) 1...
* builtins.c: Use HOST_WIDE_INT_1 instead of (HOST_WIDE_INT) 1,
	HOST_WIDE_INT_1U instead of (unsigned HOST_WIDE_INT) 1,
	HOST_WIDE_INT_M1 instead of (HOST_WIDE_INT) -1 and
	HOST_WIDE_INT_M1U instead of (unsigned HOST_WIDE_INT) -1.
	* combine.c: Ditto.
	* cse.c: Ditto.
	* dojump.c: Ditto.
	* double-int.c: Ditto.
	* dse.c: Ditto.
	* dwarf2out.c: Ditto.
	* expmed.c: Ditto.
	* expr.c: Ditto.
	* fold-const.c: Ditto.
	* function.c: Ditto.
	* fwprop.c: Ditto.
	* genmodes.c: Ditto.
	* hwint.c: Ditto.
	* hwint.h: Ditto.
	* ifcvt.c: Ditto.
	* loop-doloop.c: Ditto.
	* loop-invariant.c: Ditto.
	* loop-iv.c: Ditto.
	* match.pd: Ditto.
	* optabs.c: Ditto.
	* real.c: Ditto.
	* reload.c: Ditto.
	* rtlanal.c: Ditto.
	* simplify-rtx.c: Ditto.
	* stor-layout.c: Ditto.
	* toplev.c: Ditto.
	* tree-ssa-loop-ivopts.c: Ditto.
	* tree-vect-generic.c: Ditto.
	* tree-vect-patterns.c: Ditto.
	* tree.c: Ditto.
	* tree.h: Ditto.
	* ubsan.c: Ditto.
	* varasm.c: Ditto.
	* wide-int-print.cc: Ditto.
	* wide-int.cc: Ditto.
	* wide-int.h: Ditto.

From-SVN: r238481
2016-07-19 18:40:55 +02:00
Bernd Edlinger 25b75a48d2 Convert TYPE_ALIGN_OK to a TYPE_LANG_FLAG.
2016-07-11  Bernd Edlinger  <bernd.edlinger@hotmail.de>

        Convert TYPE_ALIGN_OK to a TYPE_LANG_FLAG.
        * tree-core.h (tree_base::nothrow_flag): Adjust comment.
        (tree_type_common::lang_flag_7): New.
        (tree_type_common::spare): Reduce size.
        * tree.h (TYPE_ALIGN_OK): Remove.
        (TYPE_LANG_FLAG_7): New.
        (get_inner_reference): Adjust header.
        * print-tree.c (print_node): Adjust.
        * expr.c (get_inner_reference): Remove parameter keep_aligning.
        (get_bit_range, expand_assignment, expand_expr_addr_expr_1): Adjust
        calls to get_inner_reference.
        (expand_expr_real_1): Adjust call to get_inner_reference.  Remove
        handling of TYPE_ALIGN_OK.
        * builtins.c (get_object_alignment_2): Adjust call to
        get_inner_reference.  Remove handling of VIEW_CONVERT_EXPR.
        * emit-rtl.c (set_mem_attributes_minus_bitpos): Remove handling of
        TYPE_ALIGN_OK.
        * asan.c (instrument_derefs): Adjust calls to get_inner_reference.
        * cfgexpand.c (expand_debug_expr): Likewise.
        * dbxout.c (dbxout_expand_expr): Likewise.
        * dwarf2out.c (loc_list_for_address_of_addr_expr_of_indirect_ref,
        loc_list_from_tree, fortran_common): Likewise.
        * fold-const.c (optimize_bit_field_compare,
        decode_field_reference, fold_unary_loc, fold_comparison,
        split_address_to_core_and_offset): Likewise.
        * gimple-laddress.c (execute): Likewise.
        * gimple-ssa-strength-reduction.c (slsr_process_ref): Likewise.
        * gimplify.c (gimplify_scan_omp_clauses): Likewise.
        * hsa-gen.c (gen_hsa_addr): Likewise.
        * simplifx-rtx.c (delegitimize_mem_from_attrs): Likewise.
        * tsan.c (instrument_expr): Likewise.
        * ubsan.c (instrument_bool_enum_load, instrument_object_size): Likewise.
        * tree.c (verify_type_variant): Remove handling of TYPE_ALIGN_OK.
        * tree-affine.c (tree_to_aff_combination,
        get_inner_reference_aff): Adjust calls to get_inner_reference.
        * tree-data-ref.c (split_constant_offset_1,
        dr_analyze_innermost): Likewise.
        * tree-scalar-evolution.c (interpret_rhs_expr): Likewise.
        * tree-sra.c (ipa_sra_check_caller): Likewise.
        * tree-ssa-loop-ivopts.c (split_address_cost): Likewise.
        * tree-ssa-math-opts.c (find_bswap_or_nop_load,
        bswap_replace): Likewise.
        * tree-vect-data-refs.c (vect_check_gather,
        vect_analyze_data_refs): Likewise.
        * config/mips/mips.c (r10k_safe_mem_expr_p): Likewise.
        * config/pa/pa.c (pa_emit_move_sequence): Remove handling of
        TYPE_ALIGN_OK.

ada:
2016-07-11  Bernd Edlinger  <bernd.edlinger@hotmail.de>

        Convert TYPE_ALIGN_OK to a TYPE_LANG_FLAG.
        * gcc-interface/ada-tree.h (TYPE_ALIGN_OK): Define.
        * gcc-interface/trans.c (Attribute_to_gnu): Adjust call to
        get_inner_reference.
        * gcc-interface/utils2.c (build_unary_op): Likewise.

From-SVN: r238210
2016-07-11 15:02:12 +00:00
Richard Biener 36d0d9be55 re PR tree-optimization/68961 (Test case gcc.target/powerpc/pr60203.c fails since r231674)
2016-06-29  Richard Biener  <rguenther@suse.de>

	PR rtl-optimization/68961
	* simplify-rtx.c (simplify_subreg): Handle VEC_CONCAT like CONCAT.

From-SVN: r237840
2016-06-29 07:52:35 +00:00
Kyrylo Tkachov e10183dce1 [simplify-rtx] Fix unused variable warning in simplify_cond_clz_ctz on some targets
* simplify-rtx.c (simplify_cond_clz_ctz): Delete 'mode' local
	variable.

From-SVN: r237180
2016-06-07 16:52:20 +00:00
Kyrylo Tkachov 36f9ad6933 [3/3][RTL ifcvt] PR middle-end/37780: Conditional expression with __builtin_clz() should be optimized out
PR middle-end/37780
	* ifcvt.c (noce_try_ifelse_collapse): New function.
	Declare prototype.
	(noce_process_if_block): Call noce_try_ifelse_collapse.
	* simplify-rtx.c (simplify_cond_clz_ctz): New function.
	(simplify_ternary_operation): Use the above to simplify
	conditional CLZ/CTZ expressions.

	* gcc.c-torture/execute/pr37780.c: New test.
	* gcc.target/aarch64/pr37780_1.c: Likewise.
	* gcc.target/arm/pr37780_1.c: Likewise.

From-SVN: r237141
2016-06-06 16:06:05 +00:00
Jakub Jelinek 3d3f9e7e69 re PR debug/70628 (ICE in get_reg_rtx, at emit-rtl.c:1025)
PR debug/70628
	* rtl.h (convert_memory_address_addr_space_1): New prototype.
	* explow.c (convert_memory_address_addr_space_1): No longer static,
	add NO_EMIT argument and don't call convert_modes if true, pass
	it down recursively, remove break after return.
	(convert_memory_address_addr_space): Adjust caller.
	* simplify-rtx.c (simplify_unary_operation_1): Call
	convert_memory_address_addr_space_1 instead of convert_memory_address,
	if it returns NULL, don't simplify.

	* gcc.dg/torture/pr70628.c: New test.

From-SVN: r234933
2016-04-13 14:26:26 +02:00
Marc Glisse 02a49e4f9f re PR tree-optimization/70509 (wrong code with extract from a v64qi)
PR tree-optimization/70509
	* simplify-rtx.c (simplify_binary_operation_1) <case VEC_SELECT>:
	Shift HOST_WIDE_INT_1U instead of 1.

Co-Authored-By: Jakub Jelinek <jakub@redhat.com>

From-SVN: r234755
2016-04-05 19:01:52 +02:00
Richard Henderson 08c1904dcc re PR rtl-optimization/67145 (associativity from pseudo-reg ordering)
PR rtl-opt/67145

  * simplify-rtx.c (simplify_plus_minus): Allow reassoc without
  simplification when all args are positive non-fixed registers.

From-SVN: r233916
2016-03-02 13:09:54 -08:00
Bernd Schmidt 2efc145507 Fix missed comment fix in last change.
From-SVN: r232690
2016-01-21 18:11:10 +00:00
Bernd Schmidt 9776e6920d Fix PR66178, ICE due to misexpansion of constant expressions involving labels.
PR middle-end/66178
	* expr.c (expand_expr_real_2) [PLUS_EXPR, MINUS_EXPR]: Don't
	drop EXPAND_INITIALIZER.
	* rtl.h (contains_symbolic_reference_p): Declare.
	* rtlanal.c (contains_symbolic_reference_p): New function.
	* simplify-rtx.c (simplify_binary_operation_1): Don't turn
	a subtraction into a NOT if symbolic constants are involved.

testsuite/
	PR middle-end/66178
	gcc.dg/torture/pr66178.c: New test.

From-SVN: r232689
2016-01-21 18:10:03 +00:00
Jakub Jelinek 818ab71a41 Update copyright years.
From-SVN: r232055
2016-01-04 15:30:50 +01:00
Sujoy Saraswati 5a00b0aaf0 This series of patches fix PR61441.
This series of patches fix PR61441. This patch avoids various transformations
with signaling NaN operands when flag_signaling_nans is on, to avoid folding
which would lose exceptions.

Bootstrapped & regression-tested on x86_64-linux-gnu.

gcc/
	* fold-const.c (const_binop): Convert sNaN to qNaN when
	flag_signaling_nans is off.
	(const_unop): Avoid the operation, other than NEGATE and
	ABS, if flag_signaling_nans is on and the operand is an sNaN.
	(fold_convert_const_real_from_real): Avoid the operation if
	flag_signaling_nans is on and the operand is an sNaN.
	(integer_valued_real_unary_p): Update comment stating it
	returns false for sNaN values.
	(integer_valued_real_binary_p, integer_valued_real_call_p): Same.
	(integer_valued_real_single_p): Same.
	(integer_valued_real_invalid_p, integer_valued_real_p): Same.
	* fold-const-call.c (fold_const_pow): Avoid the operation
	if flag_signaling_nans is on and the operand is an sNaN.
	(fold_const_builtin_load_exponent) Same.
	(fold_const_call_sss): Same for CASE_CFN_POWI.
	* gimple-fold.c (gimple_assign_integer_valued_real_p): Same.
	(gimple_call_integer_valued_real_p): Same.
	(gimple_phi_integer_valued_real_p): Same.
	(gimple_stmt_integer_valued_real_p): Same.
	* simplify-rtx.c (simplify_const_unary_operation): Avoid the
	operation if flag_signaling_nans is on and the operand is an sNaN.
	(simplify_const_binary_operation): Same.
	* tree-ssa-math-opts.c (gimple_expand_builtin_pow): Avoid the
	operation if flag_signaling_nans is on and the operand is an sNaN.

	* gcc.dg/pr61441.c: New testcase.

From-SVN: r231901
2015-12-22 14:04:30 +00:00
Sujoy Saraswati 683aa9290b This series of patches are for fixing PR61441.
This series of patches are for fixing PR61441. This patch modifies code to use
REAL_VALUE_ISSIGNALING_NAN instead of REAL_VALUE_ISNAN to avoid the operatins
only for sNaN operands.

Bootstrapped & regression-tested on x86_64-linux-gnu.

gcc/
	* fold-const.c (const_binop): Use REAL_VALUE_ISSIGNALING_NAN instead
	of REAL_VALUE_ISNAN to avoid the operation for sNaN operands.
	* simplify-rtx.c (simplify_const_binary_operation): Same.

From-SVN: r231857
2015-12-20 09:13:51 +00:00
Segher Boessenkool 7d006b0d34 simplify-rtx: Simplify sign_extend of lshiftrt to zero_extend (PR68330)
Since r230164, in PR68330 combine ends up with a sign_extend of an
lshiftrt by some constant, and it does not know to morph that into a
zero_extract (the extend will always extend with zeroes).  I think
it is best to let simplify-rtx always replace such a sign_extend by
a zero_extend, after which everything works as expected.


2015-11-15  Segher Boessenkool  <segher@kernel.crashing.org>

	PR rtl-optimization/68330
	* simplify-rtx.c (simplify_unary_operation_1): Simplify SIGN_EXTEND
	of LSHIFTRT by a non-zero constant integer.

From-SVN: r230429
2015-11-16 16:51:33 +01:00
Segher Boessenkool 3b1da8bb77 simplify-rtx: Simplify trunc of and of shiftrt
If we have

	(truncate:M1 (and:M2 (lshiftrt:M2 (x:M2) C) C2))

we can write it instead as

	(and:M1 (lshiftrt:M1 (truncate:M1 (x:M2)) C) C2)

(if that is valid, of course), which has smaller modes for the
binary ops, and the truncate can often simplify further (if "x"
is a register, for example).


	* gcc/simplify-rtx.c (simplify_truncation): Simplify TRUNCATE
	of AND of [LA]SHIFTRT.

From-SVN: r230164
2015-11-11 15:09:30 +01:00
Eric Botcazou ee45a32dae Merge of the scalar-storage-order branch.
From-SVN: r229965
2015-11-08 18:33:42 +00:00
Andrew MacLeod 68a750e938 alias.c: Remove unused headers.
2015-10-30  Andrew MacLeod  <amacleod@redhat.com>
	
	* alias.c: Remove unused headers.
	* asan.c: Likewise.
	* attribs.c: Likewise.
	* auto-inc-dec.c: Likewise.
	* auto-profile.c: Likewise.
	* bb-reorder.c: Likewise.
	* bitmap.c: Likewise.
	* bt-load.c: Likewise.
	* builtins.c: Likewise.
	* caller-save.c: Likewise.
	* calls.c: Likewise.
	* ccmp.c: Likewise.
	* cfg.c: Likewise.
	* cfganal.c: Likewise.
	* cfgbuild.c: Likewise.
	* cfgcleanup.c: Likewise.
	* cfgexpand.c: Likewise.
	* cfghooks.c: Likewise.
	* cfgloop.c: Likewise.
	* cfgloopanal.c: Likewise.
	* cfgloopmanip.c: Likewise.
	* cfgrtl.c: Likewise.
	* cgraph.c: Likewise.
	* cgraphbuild.c: Likewise.
	* cgraphclones.c: Likewise.
	* cgraphunit.c: Likewise.
	* cilk-common.c: Likewise.
	* combine-stack-adj.c: Likewise.
	* combine.c: Likewise.
	* compare-elim.c: Likewise.
	* convert.c: Likewise.
	* coverage.c: Likewise.
	* cppbuiltin.c: Likewise.
	* cprop.c: Likewise.
	* cse.c: Likewise.
	* cselib.c: Likewise.
	* data-streamer-in.c: Likewise.
	* data-streamer-out.c: Likewise.
	* data-streamer.c: Likewise.
	* dbxout.c: Likewise.
	* dce.c: Likewise.
	* ddg.c: Likewise.
	* debug.c: Likewise.
	* df-core.c: Likewise.
	* df-problems.c: Likewise.
	* df-scan.c: Likewise.
	* dfp.c: Likewise.
	* dojump.c: Likewise.
	* dominance.c: Likewise.
	* domwalk.c: Likewise.
	* double-int.c: Likewise.
	* dse.c: Likewise.
	* dumpfile.c: Likewise.
	* dwarf2asm.c: Likewise.
	* dwarf2cfi.c: Likewise.
	* dwarf2out.c: Likewise.
	* emit-rtl.c: Likewise.
	* except.c: Likewise.
	* explow.c: Likewise.
	* expmed.c: Likewise.
	* expr.c: Likewise.
	* final.c: Likewise.
	* fixed-value.c: Likewise.
	* fold-const.c: Likewise.
	* function.c: Likewise.
	* fwprop.c: Likewise.
	* gcse.c: Likewise.
	* generic-match-head.c: Likewise.
	* ggc-common.c: Likewise.
	* gimple-builder.c: Likewise.
	* gimple-expr.c: Likewise.
	* gimple-fold.c: Likewise.
	* gimple-iterator.c: Likewise.
	* gimple-low.c: Likewise.
	* gimple-match-head.c: Likewise.
	* gimple-pretty-print.c: Likewise.
	* gimple-ssa-isolate-paths.c: Likewise.
	* gimple-ssa-strength-reduction.c: Likewise.
	* gimple-streamer-in.c: Likewise.
	* gimple-streamer-out.c: Likewise.
	* gimple-walk.c: Likewise.
	* gimple.c: Likewise.
	* gimplify-me.c: Likewise.
	* gimplify.c: Likewise.
	* godump.c: Likewise.
	* graph.c: Likewise.
	* graphds.c: Likewise.
	* haifa-sched.c: Likewise.
	* hw-doloop.c: Likewise.
	* ifcvt.c: Likewise.
	* init-regs.c: Likewise.
	* internal-fn.c: Likewise.
	* ipa-chkp.c: Likewise.
	* ipa-comdats.c: Likewise.
	* ipa-cp.c: Likewise.
	* ipa-devirt.c: Likewise.
	* ipa-icf-gimple.c: Likewise.
	* ipa-icf.c: Likewise.
	* ipa-inline-analysis.c: Likewise.
	* ipa-inline-transform.c: Likewise.
	* ipa-inline.c: Likewise.
	* ipa-polymorphic-call.c: Likewise.
	* ipa-profile.c: Likewise.
	* ipa-prop.c: Likewise.
	* ipa-pure-const.c: Likewise.
	* ipa-ref.c: Likewise.
	* ipa-reference.c: Likewise.
	* ipa-split.c: Likewise.
	* ipa-utils.c: Likewise.
	* ipa-visibility.c: Likewise.
	* ipa.c: Likewise.
	* ira-build.c: Likewise.
	* ira-color.c: Likewise.
	* ira-conflicts.c: Likewise.
	* ira-costs.c: Likewise.
	* ira-emit.c: Likewise.
	* ira-lives.c: Likewise.
	* ira.c: Likewise.
	* jump.c: Likewise.
	* langhooks.c: Likewise.
	* lcm.c: Likewise.
	* lists.c: Likewise.
	* loop-doloop.c: Likewise.
	* loop-init.c: Likewise.
	* loop-invariant.c: Likewise.
	* loop-iv.c: Likewise.
	* loop-unroll.c: Likewise.
	* lower-subreg.c: Likewise.
	* lra-assigns.c: Likewise.
	* lra-coalesce.c: Likewise.
	* lra-constraints.c: Likewise.
	* lra-eliminations.c: Likewise.
	* lra-lives.c: Likewise.
	* lra-remat.c: Likewise.
	* lra-spills.c: Likewise.
	* lra.c: Likewise.
	* lto-cgraph.c: Likewise.
	* lto-compress.c: Likewise.
	* lto-opts.c: Likewise.
	* lto-section-in.c: Likewise.
	* lto-section-out.c: Likewise.
	* lto-streamer-in.c: Likewise.
	* lto-streamer-out.c: Likewise.
	* lto-streamer.c: Likewise.
	* mcf.c: Likewise.
	* mode-switching.c: Likewise.
	* modulo-sched.c: Likewise.
	* optabs.c: Likewise.
	* opts-global.c: Likewise.
	* passes.c: Likewise.
	* plugin.c: Likewise.
	* postreload-gcse.c: Likewise.
	* postreload.c: Likewise.
	* predict.c: Likewise.
	* print-tree.c: Likewise.
	* profile.c: Likewise.
	* real.c: Likewise.
	* realmpfr.c: Likewise.
	* recog.c: Likewise.
	* ree.c: Likewise.
	* reg-stack.c: Likewise.
	* regcprop.c: Likewise.
	* reginfo.c: Likewise.
	* regrename.c: Likewise.
	* regstat.c: Likewise.
	* reload.c: Likewise.
	* reload1.c: Likewise.
	* reorg.c: Likewise.
	* resource.c: Likewise.
	* rtl-chkp.c: Likewise.
	* rtl-error.c: Likewise.
	* rtlanal.c: Likewise.
	* rtlhooks.c: Likewise.
	* sanopt.c: Likewise.
	* sched-deps.c: Likewise.
	* sched-ebb.c: Likewise.
	* sched-rgn.c: Likewise.
	* sdbout.c: Likewise.
	* sel-sched-dump.c: Likewise.
	* sel-sched-ir.c: Likewise.
	* sel-sched.c: Likewise.
	* sese.c: Likewise.
	* shrink-wrap.c: Likewise.
	* simplify-rtx.c: Likewise.
	* stack-ptr-mod.c: Likewise.
	* statistics.c: Likewise.
	* stmt.c: Likewise.
	* stor-layout.c: Likewise.
	* store-motion.c: Likewise.
	* stringpool.c: Likewise.
	* symtab.c: Likewise.
	* target-globals.c: Likewise.
	* targhooks.c: Likewise.
	* toplev.c: Likewise.
	* tracer.c: Likewise.
	* trans-mem.c: Likewise.
	* tree-affine.c: Likewise.
	* tree-call-cdce.c: Likewise.
	* tree-cfg.c: Likewise.
	* tree-cfgcleanup.c: Likewise.
	* tree-chkp-opt.c: Likewise.
	* tree-chkp.c: Likewise.
	* tree-chrec.c: Likewise.
	* tree-complex.c: Likewise.
	* tree-data-ref.c: Likewise.
	* tree-dfa.c: Likewise.
	* tree-diagnostic.c: Likewise.
	* tree-dump.c: Likewise.
	* tree-eh.c: Likewise.
	* tree-emutls.c: Likewise.
	* tree-if-conv.c: Likewise.
	* tree-inline.c: Likewise.
	* tree-into-ssa.c: Likewise.
	* tree-iterator.c: Likewise.
	* tree-loop-distribution.c: Likewise.
	* tree-nested.c: Likewise.
	* tree-nrv.c: Likewise.
	* tree-object-size.c: Likewise.
	* tree-outof-ssa.c: Likewise.
	* tree-parloops.c: Likewise.
	* tree-phinodes.c: Likewise.
	* tree-predcom.c: Likewise.
	* tree-pretty-print.c: Likewise.
	* tree-profile.c: Likewise.
	* tree-scalar-evolution.c: Likewise.
	* tree-sra.c: Likewise.
	* tree-ssa-address.c: Likewise.
	* tree-ssa-alias.c: Likewise.
	* tree-ssa-ccp.c: Likewise.
	* tree-ssa-coalesce.c: Likewise.
	* tree-ssa-copy.c: Likewise.
	* tree-ssa-dce.c: Likewise.
	* tree-ssa-dse.c: Likewise.
	* tree-ssa-forwprop.c: Likewise.
	* tree-ssa-ifcombine.c: Likewise.
	* tree-ssa-live.c: Likewise.
	* tree-ssa-loop-ch.c: Likewise.
	* tree-ssa-loop-im.c: Likewise.
	* tree-ssa-loop-ivcanon.c: Likewise.
	* tree-ssa-loop-ivopts.c: Likewise.
	* tree-ssa-loop-manip.c: Likewise.
	* tree-ssa-loop-niter.c: Likewise.
	* tree-ssa-loop-prefetch.c: Likewise.
	* tree-ssa-loop-unswitch.c: Likewise.
	* tree-ssa-loop.c: Likewise.
	* tree-ssa-math-opts.c: Likewise.
	* tree-ssa-operands.c: Likewise.
	* tree-ssa-phiopt.c: Likewise.
	* tree-ssa-phiprop.c: Likewise.
	* tree-ssa-pre.c: Likewise.
	* tree-ssa-propagate.c: Likewise.
	* tree-ssa-reassoc.c: Likewise.
	* tree-ssa-scopedtables.c: Likewise.
	* tree-ssa-sink.c: Likewise.
	* tree-ssa-strlen.c: Likewise.
	* tree-ssa-structalias.c: Likewise.
	* tree-ssa-tail-merge.c: Likewise.
	* tree-ssa-ter.c: Likewise.
	* tree-ssa-threadupdate.c: Likewise.
	* tree-ssa-uncprop.c: Likewise.
	* tree-ssa-uninit.c: Likewise.
	* tree-ssa.c: Likewise.
	* tree-ssanames.c: Likewise.
	* tree-stdarg.c: Likewise.
	* tree-streamer-in.c: Likewise.
	* tree-streamer-out.c: Likewise.
	* tree-streamer.c: Likewise.
	* tree-switch-conversion.c: Likewise.
	* tree-tailcall.c: Likewise.
	* tree-vect-data-refs.c: Likewise.
	* tree-vect-generic.c: Likewise.
	* tree-vect-loop-manip.c: Likewise.
	* tree-vect-loop.c: Likewise.
	* tree-vect-patterns.c: Likewise.
	* tree-vect-slp.c: Likewise.
	* tree-vect-stmts.c: Likewise.
	* tree-vectorizer.c: Likewise.
	* tree-vrp.c: Likewise.
	* tree.c: Likewise.
	* tsan.c: Likewise.
	* ubsan.c: Likewise.
	* value-prof.c: Likewise.
	* var-tracking.c: Likewise.
	* varasm.c: Likewise.
	* varpool.c: Likewise.
	* vmsdbgout.c: Likewise.
	* vtable-verify.c: Likewise.
	* web.c: Likewise.
	* wide-int-print.cc: Likewise.
	* wide-int.cc: Likewise.
	* xcoffout.c: Likewise.

From-SVN: r229585
2015-10-30 15:48:59 +00:00
Andrew MacLeod 957060b5c5 alias.c: Reorder #include statements and remove duplicates.
2015-10-29  Andrew MacLeod  <amacleod@redhat.com>

	* alias.c: Reorder #include statements and remove duplicates.
	* asan.c: Likewise.
	* attribs.c: Likewise.
	* auto-inc-dec.c: Likewise.
	* auto-profile.c: Likewise.
	* bb-reorder.c: Likewise.
	* bt-load.c: Likewise.
	* builtins.c: Likewise.
	* caller-save.c: Likewise.
	* calls.c: Likewise.
	* ccmp.c: Likewise.
	* cfg.c: Likewise.
	* cfganal.c: Likewise.
	* cfgbuild.c: Likewise.
	* cfgcleanup.c: Likewise.
	* cfgexpand.c: Likewise.
	* cfghooks.c: Likewise.
	* cfgloop.c: Likewise.
	* cfgloopanal.c: Likewise.
	* cfgloopmanip.c: Likewise.
	* cfgrtl.c: Likewise.
	* cgraph.c: Likewise.
	* cgraphbuild.c: Likewise.
	* cgraphclones.c: Likewise.
	* cgraphunit.c: Likewise.
	* cilk-common.c: Likewise.
	* combine-stack-adj.c: Likewise.
	* combine.c: Likewise.
	* compare-elim.c: Likewise.
	* convert.c: Likewise.
	* coverage.c: Likewise.
	* cppbuiltin.c: Likewise.
	* cprop.c: Likewise.
	* cse.c: Likewise.
	* cselib.c: Likewise.
	* data-streamer-in.c: Likewise.
	* data-streamer-out.c: Likewise.
	* data-streamer.c: Likewise.
	* dbxout.c: Likewise.
	* dce.c: Likewise.
	* ddg.c: Likewise.
	* debug.c: Likewise.
	* df-core.c: Likewise.
	* df-problems.c: Likewise.
	* df-scan.c: Likewise.
	* dfp.c: Likewise.
	* dojump.c: Likewise.
	* dominance.c: Likewise.
	* double-int.c: Likewise.
	* dse.c: Likewise.
	* dumpfile.c: Likewise.
	* dwarf2asm.c: Likewise.
	* dwarf2cfi.c: Likewise.
	* dwarf2out.c: Likewise.
	* emit-rtl.c: Likewise.
	* except.c: Likewise.
	* explow.c: Likewise.
	* expmed.c: Likewise.
	* expr.c: Likewise.
	* final.c: Likewise.
	* fixed-value.c: Likewise.
	* fold-const.c: Likewise.
	* function.c: Likewise.
	* fwprop.c: Likewise.
	* gcse.c: Likewise.
	* generic-match-head.c: Likewise.
	* ggc-common.c: Likewise.
	* gimple-builder.c: Likewise.
	* gimple-expr.c: Likewise.
	* gimple-fold.c: Likewise.
	* gimple-iterator.c: Likewise.
	* gimple-low.c: Likewise.
	* gimple-match-head.c: Likewise.
	* gimple-pretty-print.c: Likewise.
	* gimple-ssa-isolate-paths.c: Likewise.
	* gimple-ssa-strength-reduction.c: Likewise.
	* gimple-streamer-in.c: Likewise.
	* gimple-streamer-out.c: Likewise.
	* gimple-walk.c: Likewise.
	* gimple.c: Likewise.
	* gimplify-me.c: Likewise.
	* gimplify.c: Likewise.
	* godump.c: Likewise.
	* graph.c: Likewise.
	* graphite-poly.c: Likewise.
	* haifa-sched.c: Likewise.
	* hw-doloop.c: Likewise.
	* ifcvt.c: Likewise.
	* incpath.c: Likewise.
	* init-regs.c: Likewise.
	* internal-fn.c: Likewise.
	* ipa-chkp.c: Likewise.
	* ipa-comdats.c: Likewise.
	* ipa-cp.c: Likewise.
	* ipa-devirt.c: Likewise.
	* ipa-icf-gimple.c: Likewise.
	* ipa-icf.c: Likewise.
	* ipa-inline-analysis.c: Likewise.
	* ipa-inline-transform.c: Likewise.
	* ipa-inline.c: Likewise.
	* ipa-polymorphic-call.c: Likewise.
	* ipa-profile.c: Likewise.
	* ipa-prop.c: Likewise.
	* ipa-pure-const.c: Likewise.
	* ipa-ref.c: Likewise.
	* ipa-reference.c: Likewise.
	* ipa-split.c: Likewise.
	* ipa-utils.c: Likewise.
	* ipa-visibility.c: Likewise.
	* ipa.c: Likewise.
	* ira-build.c: Likewise.
	* ira-color.c: Likewise.
	* ira-conflicts.c: Likewise.
	* ira-costs.c: Likewise.
	* ira-emit.c: Likewise.
	* ira-lives.c: Likewise.
	* ira.c: Likewise.
	* jump.c: Likewise.
	* langhooks.c: Likewise.
	* lcm.c: Likewise.
	* lists.c: Likewise.
	* loop-doloop.c: Likewise.
	* loop-init.c: Likewise.
	* loop-invariant.c: Likewise.
	* loop-iv.c: Likewise.
	* loop-unroll.c: Likewise.
	* lower-subreg.c: Likewise.
	* lra-assigns.c: Likewise.
	* lra-coalesce.c: Likewise.
	* lra-constraints.c: Likewise.
	* lra-eliminations.c: Likewise.
	* lra-lives.c: Likewise.
	* lra-remat.c: Likewise.
	* lra-spills.c: Likewise.
	* lra.c: Likewise.
	* lto-cgraph.c: Likewise.
	* lto-compress.c: Likewise.
	* lto-opts.c: Likewise.
	* lto-section-in.c: Likewise.
	* lto-section-out.c: Likewise.
	* lto-streamer-in.c: Likewise.
	* lto-streamer-out.c: Likewise.
	* lto-streamer.c: Likewise.
	* mode-switching.c: Likewise.
	* modulo-sched.c: Likewise.
	* omp-low.c: Likewise.
	* optabs.c: Likewise.
	* opts-global.c: Likewise.
	* passes.c: Likewise.
	* plugin.c: Likewise.
	* postreload-gcse.c: Likewise.
	* postreload.c: Likewise.
	* predict.c: Likewise.
	* print-tree.c: Likewise.
	* profile.c: Likewise.
	* real.c: Likewise.
	* realmpfr.c: Likewise.
	* recog.c: Likewise.
	* ree.c: Likewise.
	* reg-stack.c: Likewise.
	* regcprop.c: Likewise.
	* reginfo.c: Likewise.
	* regrename.c: Likewise.
	* regstat.c: Likewise.
	* reload.c: Likewise.
	* reload1.c: Likewise.
	* reorg.c: Likewise.
	* resource.c: Likewise.
	* rtl-chkp.c: Likewise.
	* rtl-error.c: Likewise.
	* rtlanal.c: Likewise.
	* rtlhooks.c: Likewise.
	* sanopt.c: Likewise.
	* sched-deps.c: Likewise.
	* sched-ebb.c: Likewise.
	* sched-rgn.c: Likewise.
	* sese.c: Likewise.
	* shrink-wrap.c: Likewise.
	* simplify-rtx.c: Likewise.
	* stack-ptr-mod.c: Likewise.
	* statistics.c: Likewise.
	* stmt.c: Likewise.
	* stor-layout.c: Likewise.
	* store-motion.c: Likewise.
	* stringpool.c: Likewise.
	* symtab.c: Likewise.
	* target-globals.c: Likewise.
	* targhooks.c: Likewise.
	* toplev.c: Likewise.
	* tracer.c: Likewise.
	* trans-mem.c: Likewise.
	* tree-affine.c: Likewise.
	* tree-call-cdce.c: Likewise.
	* tree-cfg.c: Likewise.
	* tree-cfgcleanup.c: Likewise.
	* tree-chkp-opt.c: Likewise.
	* tree-chkp.c: Likewise.
	* tree-chrec.c: Likewise.
	* tree-complex.c: Likewise.
	* tree-data-ref.c: Likewise.
	* tree-dfa.c: Likewise.
	* tree-diagnostic.c: Likewise.
	* tree-dump.c: Likewise.
	* tree-eh.c: Likewise.
	* tree-emutls.c: Likewise.
	* tree-if-conv.c: Likewise.
	* tree-inline.c: Likewise.
	* tree-into-ssa.c: Likewise.
	* tree-iterator.c: Likewise.
	* tree-loop-distribution.c: Likewise.
	* tree-nested.c: Likewise.
	* tree-nrv.c: Likewise.
	* tree-object-size.c: Likewise.
	* tree-outof-ssa.c: Likewise.
	* tree-parloops.c: Likewise.
	* tree-phinodes.c: Likewise.
	* tree-predcom.c: Likewise.
	* tree-pretty-print.c: Likewise.
	* tree-profile.c: Likewise.
	* tree-scalar-evolution.c: Likewise.
	* tree-sra.c: Likewise.
	* tree-ssa-address.c: Likewise.
	* tree-ssa-alias.c: Likewise.
	* tree-ssa-ccp.c: Likewise.
	* tree-ssa-coalesce.c: Likewise.
	* tree-ssa-copy.c: Likewise.
	* tree-ssa-dce.c: Likewise.
	* tree-ssa-dom.c: Likewise.
	* tree-ssa-dse.c: Likewise.
	* tree-ssa-forwprop.c: Likewise.
	* tree-ssa-ifcombine.c: Likewise.
	* tree-ssa-live.c: Likewise.
	* tree-ssa-loop-ch.c: Likewise.
	* tree-ssa-loop-im.c: Likewise.
	* tree-ssa-loop-ivcanon.c: Likewise.
	* tree-ssa-loop-ivopts.c: Likewise.
	* tree-ssa-loop-manip.c: Likewise.
	* tree-ssa-loop-niter.c: Likewise.
	* tree-ssa-loop-prefetch.c: Likewise.
	* tree-ssa-loop-unswitch.c: Likewise.
	* tree-ssa-loop.c: Likewise.
	* tree-ssa-math-opts.c: Likewise.
	* tree-ssa-operands.c: Likewise.
	* tree-ssa-phiopt.c: Likewise.
	* tree-ssa-phiprop.c: Likewise.
	* tree-ssa-pre.c: Likewise.
	* tree-ssa-propagate.c: Likewise.
	* tree-ssa-reassoc.c: Likewise.
	* tree-ssa-sccvn.c: Likewise.
	* tree-ssa-scopedtables.c: Likewise.
	* tree-ssa-sink.c: Likewise.
	* tree-ssa-strlen.c: Likewise.
	* tree-ssa-structalias.c: Likewise.
	* tree-ssa-tail-merge.c: Likewise.
	* tree-ssa-ter.c: Likewise.
	* tree-ssa-threadedge.c: Likewise.
	* tree-ssa-threadupdate.c: Likewise.
	* tree-ssa-uncprop.c: Likewise.
	* tree-ssa-uninit.c: Likewise.
	* tree-ssa.c: Likewise.
	* tree-ssanames.c: Likewise.
	* tree-stdarg.c: Likewise.
	* tree-streamer-in.c: Likewise.
	* tree-streamer-out.c: Likewise.
	* tree-streamer.c: Likewise.
	* tree-switch-conversion.c: Likewise.
	* tree-tailcall.c: Likewise.
	* tree-vect-data-refs.c: Likewise.
	* tree-vect-generic.c: Likewise.
	* tree-vect-loop-manip.c: Likewise.
	* tree-vect-loop.c: Likewise.
	* tree-vect-patterns.c: Likewise.
	* tree-vect-slp.c: Likewise.
	* tree-vect-stmts.c: Likewise.
	* tree-vectorizer.c: Likewise.
	* tree-vrp.c: Likewise.
	* tree.c: Likewise.
	* tsan.c: Likewise.
	* ubsan.c: Likewise.
	* value-prof.c: Likewise.
	* var-tracking.c: Likewise.
	* varasm.c: Likewise.
	* varpool.c: Likewise.
	* vtable-verify.c: Likewise.
	* web.c: Likewise.
	* wide-int-print.cc: Likewise.
	* wide-int.cc: Likewise.
	* xcoffout.c: Likewise.

From-SVN: r229526
2015-10-29 13:57:32 +00:00
Kyrylo Tkachov bfb792b604 [simplify-rtx][2/2] Use constants from pool when simplifying binops
* simplify-rtx.c (simplify_binary_operation): If either operand was
	a constant pool reference use them if all other simplifications failed.

	* gcc.target/aarch64/fmul_fcvt_1.c: Add multiply-by-32 cases.

From-SVN: r229086
2015-10-20 16:13:29 +00:00
Richard Sandiford 34a72c3348 Remove REAL_VALUE_FROM_CONST_DOUBLE
To maintain symmetry after the previous removal of
CONST_DOUBLE_FROM_REAL_VALUE, this patch also gets rid of
REAL_VALUE_FROM_CONST_DOUBLE.  All the macro did was copy the
contents of CONST_DOUBLE_REAL_VALUE into a temporary real_value
structure.  In many cases there was no need for this temporary
and we could simply use the CONST_DOUBLE_REAL_VALUE directly.
For that reason this patch is less automatic than the others.

Bootstrapped & regression-tested on x86_64-linux-gnu.  Also tested by
building one target per CPU directory and checking that there were
no new warnings and no changes in testsuite output at -O2.

gcc/
	* real.h (REAL_VALUE_FROM_CONST_DOUBLE): Delete.
	* config/aarch64/aarch64.c (aarch64_float_const_zero_rtx_p)
	(aarch64_print_operand, aarch64_float_const_representable_p)
	(aarch64_output_simd_mov_immediate): Use CONST_DOUBLE_REAL_VALUE
	instead of REAL_VALUE_FROM_CONST_DOUBLE.
	* config/arc/arc.c (arc_print_operand): Likewise.
	* config/arm/arm.c (arm_const_double_rtx, vfp3_const_double_index)
	(neon_valid_immediate, arm_print_operand, arm_emit_fp16_const)
	(vfp3_const_double_for_fract_bits, vfp3_const_double_for_bits):
	Likewise.
	* config/arm/arm.md (*arm32_movhf, consttable_4, consttable_8)
	(consttable_16): Likewise.
	* config/arm/vfp.md (*movhf_vfp_neon, *movhf_vfp): Likewise.
	* config/avr/avr.c (avr_print_operand): Likewise.
	* config/bfin/bfin.md: Likewise (in a define_split).
	* config/c6x/c6x.md: Likewise (in a define_split).
	* config/cr16/cr16.c (cr16_const_double_ok): Likewise.
	(cr16_print_operand): Likewise.
	* config/cris/cris.c (cris_print_operand): Likewise.
	* config/epiphany/epiphany.c (epiphany_print_operand): Likewise.
	* config/fr30/fr30.c (fr30_print_operand): Likewise.
	(fr30_const_double_is_zero): Likewise.
	* config/frv/frv.c (frv_print_operand, output_move_single): Likewise.
	* config/frv/frv.md: Likewise (in a define_split).
	* config/frv/predicates.md (int_2word_operand): Likewise.
	* config/h8300/h8300.c (h8300_print_operand): Likewise.
	* config/i386/i386.c (standard_80387_constant_p): Likewise.
	(ix86_print_operand, ix86_split_to_parts): Likewise.
	* config/i386/i386.md: Likewise (in a define_split).
	* config/ia64/ia64.c (ia64_split_tmode, ia64_print_operand): Likewise.
	* config/iq2000/iq2000.md (movsf_lo_sum, movsf_high): Likewise.
	* config/m32r/m32r.c (easy_df_const, m32r_print_operand): Likewise.
	* config/m68k/m68k.c (handle_move_double, standard_68881_constant_p)
	(print_operand): Likewise.
	* config/m68k/m68k.md (movsf_cf_hard, movdf_cf_hard): Likewise.
	* config/mep/mep.md: Likewise (in define_split).
	* config/microblaze/microblaze.c (microblaze_const_double_ok)
	(print_operand): Likewise.
	* config/mips/mips.md (consttable_float): Likewise.
	* config/mmix/mmix.c (mmix_intval): Likewise.
	* config/mn10300/mn10300.c (mn10300_print_operand): Likewise.
	* config/nvptx/nvptx.c (nvptx_print_operand): Likewise.
	* config/pa/pa.c (pa_singlemove_string): Likewise.
	* config/pdp11/pdp11.c (pdp11_expand_operands): Likewise.
	(pdp11_asm_print_operand, legitimate_const_double_p): Likewise.
	* config/rs6000/rs6000.c (num_insns_constant, rs6000_emit_cmove)
	(output_toc): Likewise.
	* config/rs6000/rs6000.md: Likewise (in define_splits).
	* config/rx/rx.c (rx_print_operand): Likewise.
	* config/s390/s390.c (s390_output_pool_entry): Likewise.
	* config/sh/sh.c (fp_zero_operand, fp_one_operand): Likewise.
	* config/sh/sh.md (consttable_sf, consttable_df): Likewise
	(and also in define_splits).
	* config/sparc/sparc.c (fp_sethi_p, fp_mov_p): Likewise.
	(fp_high_losum_p): Likewise.
	* config/sparc/sparc.md (*movsf_insn, *movsf_lo_sum): Likewise.
	(*movsf_high): Likewise.
	* config/spu/spu.c (const_double_to_hwint): Likewise.
	* config/v850/v850.c (const_double_split): Likewise.
	* config/vax/vax.c (vax_float_literal): Likewise.
	* config/visium/visium.c (visium_expand_copysign): Likewise.
	* config/visium/visium.md: Likewise (in define_split).
	* config/xtensa/predicates.md (const_float_1_operand): Likewise.
	* config/xtensa/xtensa.c (print_operand): Likewise.
	(xtensa_output_literal): Likewise.
	* cprop.c (implicit_set_cond_p): Likewise.
	* dwarf2out.c (insert_float): Likewise.
	* expmed.c (expand_mult, make_tree): Likewise.
	* expr.c (compress_float_constant): Likewise.
	* rtlanal.c (split_double): Likewise.
	* simplify-rtx.c (avoid_constant_pool_reference): Likewise.
	(simplify_const_unary_operation, simplify_binary_operation_1)
	(simplify_const_binary_operation): Likewise.
	(simplify_const_relational_operation): Likewise.
	* varasm.c (output_constant_pool_2): Likewise.

From-SVN: r228478
2015-10-05 11:37:49 +00:00
Richard Sandiford 555affd7a4 Remove remaining uses of CONST_DOUBLE_FROM_REAL_VALUE
This patch replaces all uses of CONST_DOUBLE_FROM_REAL_VALUE
with the already-existing const_double_from_real_value.

Bootstrapped & regression-tested on x86_64-linux-gnu.  Also tested by
building one target per CPU directory and checking that there were
no new warnings and no changes in testsuite output at -O2.

gcc/
	* real.h (CONST_DOUBLE_ATOF): Use const_double_from_real_value
	instead of CONST_DOUBLE_FROM_REAL_VALUE.
	(CONST_DOUBLE_FROM_REAL_VALUE): Delete.
	* config/c6x/c6x.md (divsf3, divdf3): Use const_double_from_real_value
	instead of CONST_DOUBLE_FROM_REAL_VALUE.
	* config/epiphany/epiphany.md (fixuns_truncsfsi2): Likewise.
	* config/i386/i386.c (standard_80387_constant_rtx): Likewise.
	(ix86_expand_builtin, ix86_emit_i387_log1p, ix86_emit_i387_round)
	(ix86_emit_swsqrtsf): Likewise.
	* config/ia64/ia64.c (ia64_expand_builtin): Likewise.
	* config/mips/mips.md (fixuns_truncdfsi2, fixuns_truncdfdi2)
	(fixuns_truncsfsi2, fixuns_truncsfdi2): Likewise.
	* config/pa/pa.c (pa_expand_builtin): Likewise.
	* config/rs6000/rs6000.c (rs6000_load_constant_and_splat): Likewise.
	(rs6000_scale_v2df): Likewise.
	* config/rs6000/rs6000.md (*cmptf_internal2): Likewise.
	* config/s390/s390.md (fixuns_truncdddi2, fixuns_trunctddi2)
	(fixuns_trunc<BFP:mode><GPR:mode>2): Likewise.
	* config/s390/vx-builtins.md (vec_ctd_s64, vec_ctd_u64, vec_ctsl)
	(vec_ctul): Likewise.
	* config/sparc/sparc.c (sparc_emit_fixunsdi): Likewise.
	* config/spu/spu.c (hwint_to_const_double, spu_float_const): Likewise.
	* config/spu/spu.md (floatunsdisf2, floatunstisf2): Likewise.
	* cse.c (fold_rtx): Likewise.
	* emit-rtl.c (immed_double_const): Likewise (in comments).
	(init_emit_once): Likewise.
	* expr.c (compress_float_constant, expand_expr_real_1)
	(const_vector_from_tree): Likewise.
	* optabs.c (expand_float, expand_fix): Likewise.
	* reg-stack.c (reg_to_stack): Likewise.
	* simplify-rtx.c (avoid_constant_pool_reference): Likewise.
	(simplify_const_unary_operation, simplify_binary_operation_1)
	(simplify_const_binary_operation, simplify_relational_operation)
	(simplify_immed_subreg): Likewise.

From-SVN: r228477
2015-10-05 11:36:08 +00:00
Richard Sandiford 5c88ea9456 Remove remaining uses of REAL_ARITHMETIC
This patch replaces all remaining uses of the old target macro
REAL_ARITHMETIC with calls to the (now generic) real_arithmetic
function.

Bootstrapped & regression-tested on x86_64-linux-gnu.  Also tested by
building one target per CPU directory and checking that there were
no new warnings and no changes in testsuite output at -O2.

gcc/ada/
	* gcc-interface/trans.c (convert_with_check): Use real_arithmetic
	instead of REAL_ARITHMETIC.

gcc/
	* doc/tm.texi.in (REAL_ARITHMETIC): Delete.
	* doc/tm.texi: Regenerate.
	* real.h (REAL_ARITHMETIC): Delete.
	* config/i386/i386.c (ix86_expand_lround, ix86_expand_round)
	(ix86_expand_round_sse4): Use real_arithmetic instead of
	REAL_ARITHMETIC.
	* config/i386/sse.md (round<mode>2): Likewise.
	* rtl.h (rtx_to_tree_code): Likewise (in comment).
	* explow.c (rtx_to_tree_code): Likewise (in comment).
	* match.pd: Likewise.
	* simplify-rtx.c (simplify_binary_operation_1): Likewise.
	* tree-ssa-math-opts.c (representable_as_half_series_p): Likewise.
	(expand_pow_as_sqrts): Likewise.
	* tree-pretty-print.c (dump_generic_node): Remove code that
	was conditional on REAL_ARITHMETIC being undefined.

From-SVN: r228476
2015-10-05 11:35:07 +00:00
Richard Sandiford 8cb41028fe Replace REAL_VALUES_LESS with real_less
This patch continues the removal of real-related macros by
replacing REAL_VALUES_LESS with real_less.

Bootstrapped & regression-tested on x86_64-linux-gnu.  Also tested by
building one target per CPU directory and checking that there were
no new warnings and no changes in testsuite output at -O2.

gcc/ada/
	* gcc-interface/trans.c (convert_with_check): Use real_less instead
	of REAL_VALUES_LESS.

gcc/
	* doc/tm.texi.in (REAL_VALUES_LESS): Delete.
	* doc/tm.texi: Regenerate.
	* real.h (real_less): Declare.
	(REAL_VALUES_LESS): Delete.
	* real.c (real_less): New function.
	(real_compare): Use it.
	* config/m68k/m68k.c (floating_exact_log2): Use real_less instead
	of REAL_VALUES_LESS.
	* config/microblaze/microblaze.c (microblaze_const_double_ok):
	Likewise.
	* fold-const.c (fold_convert_const_int_from_real): Likewise.
	* simplify-rtx.c (simplify_const_unary_operation): Likewise.
	(simplify_const_relational_operation): Likewise.
	* tree-call-cdce.c (check_pow): Likewise.
	(gen_conditions_for_pow_cst_base): Likewise.

From-SVN: r228475
2015-10-05 11:32:25 +00:00
Richard Sandiford 624d31fe01 Replace REAL_VALUES_EQUAL with real_equal
Richard B suggested we should replace dconsthalf etc. with
dconst<1, 2> ().  When I tried that, the extra comma caused problems
with some lingering uses of the old target macros for handling reals
(e.g. REAL_ARITHMETIC instead of real_arithmetic), since the constant
was then treated as two macro parameters.  It would have been possible
to add an extra level of brackets to avoid this, but I thought I might
as well take the opportunity to remove the macros instead.  (Note that
I'm only removing macros that caused a problem directly, or are closely
related to ones that did.)

This first patch replaces REAL_VALUES_EQUAL with a real_equal function.
The prototype is the same as for real_identical, which has already
undergone a half-transition in this direction.

Bootstrapped & regression-tested on x86_64-linux-gnu.  Also tested by
building one target per CPU directory and checking that there were
no new warnings and no changes in testsuite output at -O2.

gcc/c-family/
	* c-lex.c (interpret_float): Use real_equal instead of
	REAL_VALUES_EQUAL.

gcc/c/
	* c-typeck.c (c_tree_equal): Use real_equal instead of
	REAL_VALUES_EQUAL.

gcc/cp/
	* tree.c (cp_tree_equal): Use real_equal instead of
	REAL_VALUES_EQUAL.

gcc/
	* real.h (real_equal): Declare.
	(REAL_VALUES_EQUAL): Delete.
	* real.c (real_equal): New function.
	(real_compare): Use it.
	* doc/tm.texi.in (REAL_VALUES_EQUAL): Delete.
	* doc/tm.texi: Regenerate.
	* builtins.c (fold_builtin_pow, fold_builtin_load_exponent): Use
	real_equal instead of REAL_VALUES_EQUAL.
	* config/aarch64/aarch64.c (aarch64_float_const_zero_rtx_p): Likewise.
	* config/arm/arm.c (arm_const_double_rtx, neon_valid_immediate)
	(fp_const_from_val): Likewise.
	* config/fr30/fr30.c (fr30_const_double_is_zero): Likewise.
	* config/m68k/m68k.c (standard_68881_constant_p): Likewise.
	(floating_exact_log2): Likewise.
	* config/sh/sh.c (fp_zero_operand, fp_one_operand): Likewise.
	* config/vax/vax.c (vax_float_literal): Likewise.
	* config/xtensa/predicates.md (const_float_1_operand): Likewise.
	* cprop.c (implicit_set_cond_p): Likewise.
	* expmed.c (expand_mult): Likewise.
	* fold-const.c (const_binop): Likewise.
	* simplify-rtx.c (simplify_binary_operation_1): Likewise.
	(simplify_const_binary_operation): Likewise.
	(simplify_const_relational_operation): Likewise.
	* tree-call-cdce.c (check_pow): Likewise.
	(gen_conditions_for_pow_cst_base): Likewise.
	* tree-inline.c (estimate_num_insns): Likewise.
	* tree-ssa-dom.c (record_equality): Likewise.
	* tree-ssa-math-opts.c (representable_as_half_series_p): Likewise.
	(gimple_expand_builtin_pow): Likewise.
	(pass_optimize_widening_mul::execute): Likewise.
	* tree-ssa-uncprop.c (associate_equivalences_with_edges): Likewise.
	* tree-vect-patterns.c (vect_recog_pow_pattern): Likewise.
	* tree.c (real_zerop, real_onep, real_minus_onep): Likewise.
---
 gcc/builtins.c                  | 14 +++++++-------
 gcc/c-family/c-lex.c            |  6 +++---
 gcc/c/c-typeck.c                |  2 +-
 gcc/config/aarch64/aarch64.c    |  2 +-
 gcc/config/arm/arm.c            |  6 +++---
 gcc/config/fr30/fr30.c          |  2 +-
 gcc/config/m68k/m68k.c          |  6 +++---
 gcc/config/sh/sh.c              |  4 ++--
 gcc/config/vax/vax.c            |  4 ++--
 gcc/config/xtensa/predicates.md |  2 +-
 gcc/cp/tree.c                   |  2 +-
 gcc/cprop.c                     |  2 +-
 gcc/doc/tm.texi                 |  7 -------
 gcc/doc/tm.texi.in              |  7 -------
 gcc/expmed.c                    |  2 +-
 gcc/fold-const.c                |  2 +-
 gcc/real.c                      | 10 +++++++++-
 gcc/real.h                      |  4 ++--
 gcc/simplify-rtx.c              | 16 ++++++++--------
 gcc/tree-call-cdce.c            |  4 ++--
 gcc/tree-inline.c               |  5 +++--
 gcc/tree-ssa-dom.c              |  2 +-
 gcc/tree-ssa-math-opts.c        | 16 ++++++++--------
 gcc/tree-ssa-uncprop.c          |  2 +-
 gcc/tree-vect-patterns.c        |  4 ++--
 gcc/tree.c                      |  6 +++---
 26 files changed, 67 insertions(+), 72 deletions(-)

From-SVN: r228473
2015-10-05 11:29:35 +00:00
Richard Sandiford a1c045caab re PR rtl-optimization/67218 (Combine incorrectly folds (double) (float) (unsigned))
gcc/
	PR rtl-optimization/67218
	* simplify-rtx.c (exact_int_to_float_conversion_p): New function.
	(simplify_unary_operation_1): Use it.

gcc/testsuite/
	PR rtl-optimization/67218
	* gcc.c-torture/execute/ieee/pr67218.c,
	gcc.target/aarch64/fcvt_int_float_double1.c,
	gcc.target/aarch64/fcvt_int_float_double2.c,
	gcc.target/aarch64/fcvt_int_float_double3.c,
	gcc.target/aarch64/fcvt_int_float_double4.c,
	gcc.target/aarch64/fcvt_uint_float_double1.c,
	gcc.target/aarch64/fcvt_uint_float_double2.c,
	gcc.target/aarch64/fcvt_uint_float_double3.c,
	gcc.target/aarch64/fcvt_uint_float_double4.c: New tests.

From-SVN: r226987
2015-08-18 19:04:41 +00:00
David Sherwood 6c825cd46b arm.c (neon_element_bits): Replace call to GET_MODE_BITSIZE (GET_MODE_INNER (m)) with...
* config/arm/arm.c (neon_element_bits): Replace call to
        GET_MODE_BITSIZE (GET_MODE_INNER (m)) with GET_MODE_UNIT_BITSIZE (m).
        * config/arm/neon.md (neon_vget_lane<mode>): Likewise.
        (neon_vget_laneu<mode>, neon_vset_lane<mode>): Likewise
        (neon_vdup_lane<mode>): Likewise.
        * config/i386/i386.c (ix86_expand_int_vcond): Likewise.
        (ix86_expand_multi_arg_builtin, ix86_expand_reduc): Likewise.
        (expand_vec_perm_palignr, ix86_expand_sse2_abs): Likewise.
        * config/rs6000/rs6000.c (rs6000_do_expand_vec_perm): Likewise.
        * config/spu/spu.c (arith_immediate_p): Likewise.
        * expmed.c (store_bit_field_1, extract_bit_field_1): Likewise.
        * expr.c (expand_expr_real_2): Likewise.
        * optabs.c (shift_amt_for_vec_perm_mask): Likewise.
        * simplify-rtx.c (simplify_immed_subreg): Likewise.
        * tree-cfg.c (verify_gimple_assign_ternary): Likewise.
        * tree-vect-patterns.c (vect_recog_mixed_size_cond_pattern): Likewise.
        New variable.
        * fold-const.c (fold_binary_loc): Replace call to
        GET_MODE_PRECISION (GET_MODE_INNER (m)) with
        GET_MODE_UNIT_PRECISION (m).

From-SVN: r226936
2015-08-17 11:06:34 +00:00
Anatoly Sokolov 3403a1a959 Use lowpart_subreg instead of simplify_gen_subreg
From-SVN: r226417
2015-07-31 00:25:29 +03:00