Commit Graph

528 Commits

Author SHA1 Message Date
Chung-Lin Tang d303c992f6 re PR rtl-optimization/49720 (Infinite recursion compiling gold binary_test.cc testcase)
2011-10-28  Chung-Lin Tang  <cltang@codesourcery.com>

	PR rtl-optimization/49720
	* simplify-rtx.c (simplify_relational_operation_1): Detect
	infinite recursion condition in "(eq/ne (plus x cst1) cst2)
	simplifies to (eq/ne x (cst2 - cst1))" case.

	testsuite/
	* g++.dg/torture/pr49720.C: New test.

From-SVN: r180604
2011-10-28 06:35:31 +00:00
Jakub Jelinek e7c82a9925 rtl.h (const_tiny_rtx): Change into array of 4 x MAX_MACHINE_MODE from 3 x MAX_MACHINE_MODE.
* rtl.h (const_tiny_rtx): Change into array of 4 x MAX_MACHINE_MODE
	from 3 x MAX_MACHINE_MODE.
	(CONSTM1_RTX): Define.
	* emit-rtl.c (const_tiny_rtx): Change into array of 4 x MAX_MACHINE_MODE
        from 3 x MAX_MACHINE_MODE.
	(gen_rtx_CONST_VECTOR): Use CONSTM1_RTX if all inner constants are
	CONSTM1_RTX.
	(init_emit_once): Initialize CONSTM1_RTX for MODE_INT and
	MODE_VECTOR_INT modes.
	* simplify-rtx.c (simplify_binary_operation_1) <case IOR, XOR, AND>:
	Optimize if one operand is CONSTM1_RTX.
	* config/i386/i386.c (ix86_expand_sse_movcc): Optimize mask ? -1 : x
	into mask | x.

From-SVN: r179238
2011-09-27 09:29:21 +02:00
Richard Sandiford fafaf06fba simplify-rtx.c (simplify_subreg): Check that the inner mode is a scalar integer before applying integer-only...
gcc/
	* simplify-rtx.c (simplify_subreg): Check that the inner mode is
	a scalar integer before applying integer-only optimisations to
	inner arithmetic.

From-SVN: r178848
2011-09-14 12:17:03 +00:00
Jakub Jelinek e2f0083772 re PR middle-end/50161 (wrong code with -fno-tree-ter and __builtin_popcountl)
PR middle-end/50161
	* simplify-rtx.c (simplify_const_unary_operation): If
	op is CONST_INT, don't look at op_mode, but use instead
	mode.
	* optabs.c (add_equal_note): For FFS, CLZ, CTZ,
	CLRSB, POPCOUNT, PARITY and BSWAP use operand mode for
	operation and TRUNCATE/ZERO_EXTEND if needed.
	* doc/rtl.texi (ffs, clrsb, clz, ctz, popcount, parity, bswap):
	Document that operand mode must be same as operation mode,
	or VOIDmode.
	* config/avr/avr.md (paritysi2, *parityqihi2.libgcc,
	*paritysihi2.libgcc, popcountsi2, *popcountsi2.libgcc,
	*popcountqihi2.libgcc, clzsi2, *clzsihi2.libgcc, ctzsi2,
	*ctzsihi2.libgcc, ffssi2, *ffssihi2.libgcc): For unary ops
	use the mode of operand for the operation and add truncate
	or zero_extend around if needed.
	* config/c6x/c6x.md (ctzdi2): Likewise.
	* config/bfin/bfin.md (clrsbsi2, signbitssi2): Likewise.

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

From-SVN: r177991
2011-08-23 17:51:45 +02:00
Richard Sandiford 5e8f01f434 rtl.h (set_src_cost, [...]): New functions.
gcc/
	* rtl.h (set_src_cost, get_full_set_src_cost): New functions.
	* auto-inc-dec.c (attempt_change): Use set_src_cost instead of
	rtx_cost.
	* calls.c (precompute_register_parameters): Likewise.
	* combine.c (expand_compound_operation, make_extraction): Likewise.
	(force_to_mode, distribute_and_simplify_rtx): Likewise.
	* dse.c (find_shift_sequence): Likewise.
	* expmed.c (init_expmed, expand_mult, expand_smod_pow2): Likewise.
	* expr.c (compress_float_constant): Likewise.
	* fwprop.c (should_replace_address, try_fwprop_subst): Likewise.
	* gcse.c (want_to_gcse_p): Likewise.
	* ifcvt.c (noce_try_sign_mask): Likewise.
	* loop-doloop.c (doloop_optimize): Likewise.
	* loop-invariant.c (create_new_invariant): Likewise.
	* optabs.c (avoid_expensive_constant): Likewise.
	* postreload.c (reload_cse_simplify_set, reload_cse_simplify_operands)
	(try_replace_in_use, reload_cse_move2add): Likewise.
	* reload1.c (calculate_elim_costs_all_insns): Likewise.
	(note_reg_elim_costly): Likewise.
	* rtlanal.c (insn_rtx_cost): Likewise.
	* simplify-rtx.c (simplify_binary_operation_1): Likewise.
	* stmt.c (lshift_cheap_p): Likewise.
	* tree-ssa-loop-ivopts.c (seq_cost, computation_cost): Likewise.
	* config/avr/avr.c (final_prescan_insn): Likewise.
	* config/bfin/bfin.c (bfin_rtx_costs): Likewise.
	* config/mips/mips.c (mips_binary_cost, mips_rtx_costs): Likewise.

From-SVN: r177851
2011-08-18 12:37:27 +00:00
Richard Sandiford 527210c448 rtl.texi (MEM_OFFSET_KNOWN_P): Document.
gcc/
	* doc/rtl.texi (MEM_OFFSET_KNOWN_P): Document.
	(MEM_OFFSET): Change from returning an rtx to returning a
	HOST_WIDE_INT.
	* rtl.h (MEM_OFFSET_KNOWN_P): New macro.
	(MEM_OFFSET): Return a HOST_WIDE_INT rather than an rtx.
	* emit-rtl.h (set_mem_offset): Take a HOST_WIDE_INT rather than an rtx.
	(clear_mem_offset): Declare.
	* alias.c (ao_ref_from_mem): Adjust uses of MEM_OFFSET, using
	MEM_OFFSET_KNOWN_P to test whether the offset is known, and
	MEM_OFFSET to get a HOST_WIDE_INT offset.
	(nonoverlapping_memrefs_p): Likewise.  Adjust calls to...
	(adjust_offset_for_component_ref): Take a bool "known_p"
	parameter and a HOST_WIDE_INT "offset" parameter.
	* builtins.c (get_memory_rtx): As for ao_ref_from_mem.
	Adjust calls to set_mem_offset, passing a HOST_WIDE_INT rather
	than an rtx.  Use clear_mem_offset to clear the offset.
	* cfgcleanup.c (merge_memattrs): Likewise.
	* dwarf2out.c (tls_mem_loc_descriptor): Likewise.
	* function.c (assign_parm_find_stack_rtl): Likewise.
	(assign_parm_setup_stack): Likewise.
	* print-rtl.c (print_rtx): Likewise.
	* reload.c (find_reloads_subreg_address): Likewise.
	* simplify-rtx.c (delegitimize_mem_from_attrs): Likewise.
	* var-tracking.c (INT_MEM_OFFSET): Likewise.
	* emit-rtl.c (set_reg_attrs_from_value): Likewise.
	(get_mem_align_offset): Likewise.
	(set_mem_offset): Take a HOST_WIDE_INT rather than an rtx.
	(clear_mem_offset): New function.
	* config/mips/mips.c (r10k_safe_mem_expr_p): Take a HOST_WIDE_INT
	offset rather than an rtx.  Assume both the expressio and offset
	are available.
	(r10k_needs_protection_p_1): Update accordingly, checking the
	expression and offset availability here instead.

From-SVN: r176477
2011-07-19 17:43:27 +00:00
Bernd Schmidt d58c1a38e5 revert: simplify-rtx.c (simplify_const_binary_operation): Use the shift_truncation_mask hook instead of performing modulo by width.
Revert:
	* simplify-rtx.c (simplify_const_binary_operation): Use the
	shift_truncation_mask hook instead of performing modulo by
	width.  Compare against mode precision, not bitsize.
	* combine.c (combine_simplify_rtx, simplify_shift_const_1):
	Use shift_truncation_mask instead of constructing the value
	manually.

From-SVN: r175949
2011-07-06 23:56:28 +00:00
Bernd Schmidt 5511bc5ada explow.c (trunc_int_for_mode): Use GET_MODE_PRECISION instead of GET_MODE_BITSIZE where appropriate.
* explow.c (trunc_int_for_mode): Use GET_MODE_PRECISION
	instead of GET_MODE_BITSIZE where appropriate.
	* rtlanal.c (subreg_lsb_1, subreg_get_info, nonzero_bits1,
	num_sign_bit_copies1, canonicalize_condition, low_bitmask_len,
	init_num_sign_bit_copies_in_rep): Likewise.
	* cse.c (fold_rtx, cse_insn): Likewise.
	* loop-doloop.c (doloop_modify, doloop_optimize): Likewise.
	* simplify-rtx.c (simplify_unary_operation_1,
	simplify_const_unary_operation, simplify_binary_operation_1,
	simplify_const_binary_operation, simplify_ternary_operation,
	simplify_const_relational_operation, simplify_subreg): Likewise.
	* combine.c (try_combine, find_split_point, combine_simplify_rtx,
	simplify_if_then_else, simplify_set, expand_compound_operation,
	expand_field_assignment, make_extraction, if_then_else_cond,
	make_compound_operation, force_to_mode, make_field_assignment,
	reg_nonzero_bits_for_combine, reg_num_sign_bit_copies_for_combine,
	extended_count, try_widen_shift_mode, simplify_shift_const_1,
	simplify_comparison, record_promoted_value, simplify_compare_const,
	record_dead_and_set_regs_1): Likewise.

From-SVN: r175946
2011-07-06 23:16:39 +00:00
Bernd Schmidt 46c9550f31 machmode.h (HWI_COMPUTABLE_MODE_P): New macro.
* machmode.h (HWI_COMPUTABLE_MODE_P): New macro.
	* combine.c (set_nonzero_bits_and_sign_copies): Use it.
	(find_split-point, combine_simplify_rtx, simplify_if_then_else,
	simplify_set, simplify_logical, expand_compound_operation,
	make_extraction, force_to_mode, if_then_else_cond, extended_count,
	try_widen_shift_mode, simplify_shift_const_1, simplify_comparison,
	record_value_for_reg): Likewise.
	* expmed.c (expand_widening_mult, expand_mult_highpart): Likewise.
	* simplify-rtx. c (simplify_unary_operation_1,
	simplify_binary_operation_1, simplify_const_relational_operation):
	Likewise.

From-SVN: r175945
2011-07-06 23:12:45 +00:00
Bernd Schmidt d0edd768de machmode.h (TRULY_NOOP_TRUNCATION_MODES_P): New macro.
* machmode.h (TRULY_NOOP_TRUNCATION_MODES_P): New macro.
	* combine.c (make_extraction, gen_lowpart_or_truncate,
	apply_distributive_law, simplify_comparison,
	reg_truncated_to_mode, record_truncated_value): Use it.
	* cse.c (notreg_cost): Likewise.
	* expmed.c (store_bit_field_1, extract_bit_field_1): Likewise.
	* expr.c (convert_move, convert_modes): Likewise.
	* optabs.c (expand_binop, expand_unop): Likewise.
	* postreload.c (move2add_last_label): Likewise.
	* regmove.c (optimize_reg_copy_3): Likewise.
	* rtlhooks.c (gen_lowpart_general): Likewise.
	* simplify-rtx.c (simplify_unary_operation_1): Likewise.

From-SVN: r175921
2011-07-06 14:44:30 +00:00
Bernd Schmidt f9c083450b * simplify-rtx.c (simplify_ternary_operation): Remove dead code.
From-SVN: r175918
2011-07-06 14:21:51 +00:00
Bernd Schmidt 2d0c270fd2 cse.c (find_comparison_args): Use val_mode_signbit_set_p.
* cse.c (find_comparison_args): Use val_mode_signbit_set_p.
	* simplify-rtx.c (mode_signbit_p): Use GET_MODE_PRECISION.
	(val_mode_signbit_p, val_mode_signbit_set_p): New functions.
	(simplify_const_unary_operation, simplify_binary_operation_1,
	simplify_const_binary_operation,
	simplify_const_relational_operation): Use them.  Use
	GET_MODE_MASK for masking and sign-extensions.
	* combine.c (set_nonzero_bits_and_sign_copies, simplify_set,
	combine_simplify_rtx, force_to_mode, reg_nonzero_bits_for_combine,
	simplify_shift_const_1, simplify_comparison): Likewise.
	* expr.c (convert_modes): Likewise.
	* rtlanal.c (nonzero_bits1, canonicalize_condition): Likewise.
	* expmed.c (emit_cstore, emit_store_flag_1, emit_store_flag):
	Likewise.
	* rtl.h (val_mode_signbit_p, val_mode_signbit_set_p): Declare.

From-SVN: r175917
2011-07-06 14:21:03 +00:00
Bernd Schmidt ff3e08afdd simplify-rtx.c (simplify_const_binary_operation): Use the shift_truncation_mask hook instead of performing modulo by width.
* simplify-rtx.c (simplify_const_binary_operation): Use the
	shift_truncation_mask hook instead of performing modulo by
	width.  Compare against mode precision, not bitsize.
	* combine.c (combine_simplify_rtx, simplify_shift_const_1):
	Use shift_truncation_mask instead of constructing the value
	manually.

From-SVN: r175913
2011-07-06 13:36:16 +00:00
Jakub Jelinek af421d9cf0 re PR rtl-optimization/49619 (ICE in simplify_subreg, at simplify-rtx.c:5362)
PR rtl-optimization/49619
	* combine.c (combine_simplify_rtx): In PLUS -> IOR simplification
	pass VOIDmode as op0_mode to recursive call, and return temp even
	when different from tor, just if it is not IOR of the original
	PLUS arguments.

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

From-SVN: r175825
2011-07-04 23:04:54 +02:00
Jakub Jelinek 707f991907 re PR rtl-optimization/49472 (Compiler segfault on valid code)
PR rtl-optimization/49472
	* simplify-rtx.c (simplify_unary_operation_1) <case NEG>: When
	negating MULT, negate the second operand instead of first.
	(simplify_binary_operation_1) <case MULT>: If one operand is
	a NEG and the other is MULT, don't attempt to optimize by
	negation of the MULT operand if it only moves the NEG operation
	around.

	* gfortran.dg/pr49472.f90: New test.

From-SVN: r175821
2011-07-04 20:53:56 +02:00
Bernd Schmidt 3801c801f3 Makefile.in (lib2funcs): Add _clrsbsi2 and _clrsbdi2.
libgcc/
	* Makefile.in (lib2funcs): Add _clrsbsi2 and _clrsbdi2.
	* libgcc-std.ver.in (GCC_4.7.0): New section.

	gcc/
	* doc/extend.texi (__builtin_clrsb, __builtin_clrsbl,
	__builtin_clrsbll): Document.
	* doc/rtl.texi (clrsb): New entry.
	* optabs.c (widen_leading): Renamed from widen_clz.  New argument
	UNOPTAB.  All callers changed.  Use UNOPTAB instead of clz_optab.
	(expand_unop): Handle clrsb_optab.
	(init_optabs): Initialize it.
	* optabs.h (enum optab_index): New entry OTI_clrsb.
	(clrsb_optab): Define.
	* genopinit.c (optabs): Add an entry for it.
	* builtins.c (expand_builtin): Handle clrsb builtin functions.
	* builtins.def (BUILT_IN_CLRSB, BUILT_IN_CLRSBIMAX, BUILT_IN_CLRSBL,
	BUILT_IN_CLRSBLL): New.
	* rtl.def (CLRSB): New code.
	* dwarf2out.c (mem_loc_descriptor): Handle it.
	* simplify-rtx.c (simplify_const_unary_operation): Likewise.
	Use op_mode rather than mode when optimizing ffs, clz, ctz, parity
	and popcount.
	* libgcc2.c (__clrsbSI2, __clrsbDI2): New functions.
	* libgcc2.h (__clrsbSI2, __clrsbDI2): Define and declare.
	(__ctzDI2): Move declaration.
	* config/bfin/bfin.md (clrsbsi2): New expander.
	(signbitssi2): Use the CLRSB rtx.
	(clrsbhi2): Renamed from signbitshi2.  Use the CLRSB rtx.
	* config/bfin/bfin.c (bdesc_1arg): Changed accordingly.

	gcc/testsuite/
	* gcc.c-torture/excute/builtin-bitops-1.c (MAKE_FUNS): Make
	my_clrsb test functions.
	(main): Test clrsb.
	* gcc.dg/builtin-protos-1.c (test_s, test_u, test_sl, test_ul,
	test_sll, test_ull): Add clrsb tests.
	* gcc.dg/torture/builtin-attr-1.c: Add tests for clrsb, clrsbl,
	clrsbll.

From-SVN: r175261
2011-06-21 14:16:39 +00:00
Andrew Stubbs c536876e06 simplify-rtx.c (simplify_unary_operation_1): Canonicalize widening multiplies.
2011-06-07  Bernd Schmidt  <bernds@codesourcery.com>
	    Andrew Stubbs  <ams@codesourcery.com>

	gcc/
	* simplify-rtx.c (simplify_unary_operation_1): Canonicalize widening
	multiplies.
	* doc/md.texi (Canonicalization of Instructions): Document widening
	multiply canonicalization.

	gcc/testsuite/
	* gcc.target/arm/mla-2.c: New test.

From-SVN: r174740
2011-06-07 10:58:16 +00:00
Jakub Jelinek 6f0c9f06a5 re PR debug/48204 (ICE: in decimal_to_decnumber, at dfp.c:115 with -fno-tree-ccp -fno-tree-dominator-opts -fno-tree-fre -g)
PR debug/48204
	* simplify-rtx.c (simplify_const_unary_operation): Call
	real_convert when changing mode class with FLOAT_EXTEND.

	* gcc.dg/dfp/pr48204.c: New test.

From-SVN: r171423
2011-03-24 19:58:58 +01:00
Chung-Lin Tang 54833ec0a6 simplify-rtx.c (simplify_binary_operation_1): Handle (xor (and A B) C) case when B and C are both constants.
2011-03-21  Chung-Lin Tang  <cltang@codesourcery.com>

	* simplify-rtx.c (simplify_binary_operation_1): Handle
	(xor (and A B) C) case when B and C are both constants.

	testsuite/
	* gcc.target/arm/xor-and.c: New.

From-SVN: r171208
2011-03-21 07:27:03 +00:00
Joseph Myers c59ffc4195 hwint.c: New.
* hwint.c:  New.  Extracted from toplev.c.
	* hwint.h (clz_hwi, ctz_hwi, ffs_hwi, exact_log2, floor_log2):
	Move from toplev.h.
	* toplev.c (clz_hwi, ctz_hwi, ffs_hwi, exact_log2, floor_log2):
	Move to hwint.c.
	* toplev.h (clz_hwi, ctz_hwi, ffs_hwi, exact_log2, floor_log2):
	Move to hwint.h.
	* builtins.c, combine.c, config/i386/winnt.c, double-int.c,
	explow.c, expmed.c, fold-const.c, ggc-page.c, ggc-zone.c, ifcvt.c,
	ipa-struct-reorg.c, ira-color.c, matrix-reorg.c, omp-low.c,
	real.c, recog.c, reload.c, rtlanal.c, simplify-rtx.c,
	stor-layout.c, tree-dfa.c, tree-ssa-alias.c,
	tree-ssa-loop-niter.c, tree-vect-data-refs.c,
	tree-vect-loop-manip.c, tree-vect-loop.c, tree-vect-stmts.c,
	tree-vrp.c: Don't include toplev.h.
	* genattrtab.c, genconditions.c, genemit.c, genextract.c,
	genoutput.c, genpeep.c, genpreds.c, genrecog.c: Don't include
	toplev.h in generated output.
	* Makefile.in (OBJS-common): Add hwint.o.
	Dependencies for above files changed to remove toplev.h.
	(hwint.o): New.
	(insn-attrtab.o, insn-emit.o, insn-extract.o, insn-output.o,
	insn-peep.o, insn-preds.o, insn-recog.o): Don't depend on
	toplev.h.
	* config/i386/t-cygming (winnt.o): Don't depend on toplev.h.
	* config/i386/t-interix (winnt.o): Don't depend on toplev.h.

fortran:
	* trans-common.c: Don't include toplev.h.

java:
	* boehm.c: Don't include toplev.h.
	* Make-lang.in (java/boehm.o): Don't depend on toplev.h.

lto:
	* lto-object.c: Don't include toplev.h.
	* Make-lang.in (lto/lto-object.o): Don't depend on toplev.h.

From-SVN: r167301
2010-11-30 16:36:19 +00:00
Ian Lance Taylor 0e1b8b109f tree-vrp.c (extract_range_from_binary_expr): If flag_non_call_exceptions don't eliminate division by zero.
gcc/:
	* tree-vrp.c (extract_range_from_binary_expr): If
	flag_non_call_exceptions don't eliminate division by zero.
	* simplify-rtx.c (simplify_binary_operation_1): Likewise.
gcc/testsuite/:
	* gcc.c-torture/execute/20101011-1.c: New test.
	* gcc.c-torture/execute/20101011-1.x: New test driver.

From-SVN: r165884
2010-10-23 16:18:32 +00:00
Richard Henderson 5c82219425 simplify-rtx.c (simplify_ternary_operation): Simplify (fma (neg a) (neg b) c) and (fma a (neg b) c).
* simplify-rtx.c (simplify_ternary_operation) [FMA]: Simplify
	(fma (neg a) (neg b) c) and (fma a (neg b) c).

From-SVN: r165677
2010-10-18 19:12:07 -07:00
Michael Meissner 1b1562a559 Add fma support
From-SVN: r165515
2010-10-15 17:42:05 +00:00
Eric Botcazou 43c3628797 simplify-rtx.c (simplify_unary_operation_1): Use unsigned arithmetics in masking operations.
* simplify-rtx.c (simplify_unary_operation_1): Use unsigned arithmetics
	in masking operations.
	(simplify_const_unary_operation): Likewise.
	(simplify_binary_operation_1): Likewise.
	(simplify_const_binary_operation): Likewise.
	(simplify_const_relational_operation): Likewise.
	(simplify_ternary_operation): Likewise.
	(simplify_immed_subreg): Likewise.

From-SVN: r165320
2010-10-11 17:15:41 +00:00
Jakub Jelinek 509dd3804c re PR rtl-optimization/45903 (unnecessary load of 32/64bit variable when only 8 bits are needed)
PR tree-optimization/45903
	* simplify-rtx.c (simplify_subreg): Optimize lowpart SUBREG
	of *SHIFTRT of MEM.

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

From-SVN: r165200
2010-10-08 22:49:19 +02:00
Jakub Jelinek a82e045dea re PR rtl-optimization/45739 (static evaluation of SSE intrinsics (pxor))
PR rtl-optimization/45739
	* simplify-rtx.c (simplify_binary_operation_1): Optimize even
	vector mode | CONST0_RTX (mode) and ^ CONST0_RTX (mode).

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

From-SVN: r164501
2010-09-22 01:33:01 +02:00
Jakub Jelinek 561da6bc0b simplify-rtx.c (simplify_unary_operation_1): Optimize (sign_extend (zero_extend ()) and ({sign,zero}_extend (lshiftrt...
* simplify-rtx.c (simplify_unary_operation_1): Optimize
	(sign_extend (zero_extend ()) and
	({sign,zero}_extend (lshiftrt (ashift X (const_int I)) (const_int I))).

Co-Authored-By: Paolo Bonzini <bonzini@gnu.org>

From-SVN: r163413
2010-08-20 20:08:10 +02:00
Jakub Jelinek a5d8253f7a re PR target/45336 (pextr{b,w,d}, (worse than) redundant extensions)
PR target/45336
	* simplify-rtx.c (simplify_unary_operation_1): Optimize nested
	SIGN_EXTENDs or ZERO_EXTENDs.

From-SVN: r163384
2010-08-19 19:43:50 +02:00
Richard Henderson bd95721f86 Replace exact_log2(x & -x) in favor of more direct computation.
* toplev.h (ctz_hwi, clz_hwi, ffs_hwi): New.
	(floor_log2): Use clz_hwi.
	(exact_log2): Use ctz_hwi.
	* toplev.c (ctz_hwi, clz_hwi, ffs_hwi): New.
	* builtins.c (fold_builtin_bitop): Use them.
	* simplify-rtx.c (simplify_const_unary_operation): Likewise.
	* combine.c (get_pos_from_mask): Use ctz_hwi.
	* double-int.c (double_int_ctz): Likewise.
	* explow.c (force_reg): Likewise.
	* tree.h (SET_DECL_OFFSET_ALIGN): Use ffs_hwi.

From-SVN: r162920
2010-08-05 12:41:31 -07:00
Bernd Schmidt 29b40d79bb simplify-rtx.c (simplify_binary_operation_1): Try to simplify away NEG as operand of a MULT by merging it with the other operand.
* simplify-rtx.c (simplify_binary_operation_1): Try to simplify away
	NEG as operand of a MULT by merging it with the other operand.
	* combine.c (make_compound_operation): Use trunc_int_for_mode when
	generating a MULT with constant.  Canonicalize PLUS and MINUS involving
	MULT.
	* config/arm/constraints.md (M): Examine only 32 bits of a
	HOST_WIDE_INT.
	* config/arm/predicates.md (power_of_two_operand): Likewise.

From-SVN: r162849
2010-08-03 23:48:52 +00:00
Manuel López-Ibáñez 718f9c0f87 toplev.h: Do not include diagnostic-core.h.
2010-07-08  Manuel López-Ibáñez  <manu@gcc.gnu.org>

	* toplev.h: Do not include diagnostic-core.h.
	Include diagnostic-core.h in every file that includes toplev.h.
	* c-tree.h: Do not include toplev.h.
	* pretty-print.h: Update comment.
	* Makefile.in: Update dependencies.
	* alias.c: Include diagnostic-core.h in every file that includes
	toplev.h.
	* attribs.c: Likewise.
	* auto-inc-dec.c: Likewise.
	* bb-reorder.c: Likewise.
	* bt-load.c: Likewise.
	* caller-save.c: Likewise.
	* calls.c: Likewise.
	* cfg.c: Likewise.
	* cfganal.c: Likewise.
	* cfgbuild.c: Likewise.
	* cfgcleanup.c: Likewise.
	* cfghooks.c: Likewise.
	* cfgloop.c: Likewise.
	* combine.c: Likewise.
	* config/alpha/alpha.c: Likewise.
	* config/arc/arc.c: Likewise.
	* config/arm/arm.c: Likewise.
	* config/arm/pe.c: Likewise.
	* config/avr/avr.c: Likewise.
	* config/bfin/bfin.c: Likewise.
	* config/cris/cris.c: Likewise.
	* config/crx/crx.c: Likewise.
	* config/darwin-c.c: Likewise.
	* config/darwin.c: Likewise.
	* config/fr30/fr30.c: Likewise.
	* config/frv/frv.c: Likewise.
	* config/h8300/h8300.c: Likewise.
	* config/host-darwin.c: Likewise.
	* config/i386/i386.c: Likewise.
	* config/i386/netware.c: Likewise.
	* config/i386/nwld.c: Likewise.
	* config/i386/winnt-cxx.c: Likewise.
	* config/i386/winnt-stubs.c: Likewise.
	* config/i386/winnt.c: Likewise.
	* config/ia64/ia64-c.c: Likewise.
	* config/ia64/ia64.c: Likewise.
	* config/iq2000/iq2000.c: Likewise.
	* config/lm32/lm32.c: Likewise.
	* config/m32c/m32c-pragma.c: Likewise.
	* config/m32c/m32c.c: Likewise.
	* config/m32r/m32r.c: Likewise.
	* config/m68hc11/m68hc11.c: Likewise.
	* config/m68k/m68k.c: Likewise.
	* config/mcore/mcore.c: Likewise.
	* config/mep/mep-pragma.c: Likewise.
	* config/mep/mep.c: Likewise.
	* config/mmix/mmix.c: Likewise.
	* config/mn10300/mn10300.c: Likewise.
	* config/moxie/moxie.c: Likewise.
	* config/pa/pa.c: Likewise.
	* config/pdp11/pdp11.c: Likewise.
	* config/picochip/picochip.c: Likewise.
	* config/rs6000/rs6000-c.c: Likewise.
	* config/rs6000/rs6000.c: Likewise.
	* config/rx/rx.c: Likewise.
	* config/s390/s390.c: Likewise.
	* config/score/score.c: Likewise.
	* config/score/score3.c: Likewise.
	* config/score/score7.c: Likewise.
	* config/sh/sh.c: Likewise.
	* config/sh/symbian-base.c: Likewise.
	* config/sh/symbian-c.c: Likewise.
	* config/sh/symbian-cxx.c: Likewise.
	* config/sol2-c.c: Likewise.
	* config/sol2.c: Likewise.
	* config/sparc/sparc.c: Likewise.
	* config/spu/spu.c: Likewise.
	* config/stormy16/stormy16.c: Likewise.
	* config/v850/v850-c.c: Likewise.
	* config/v850/v850.c: Likewise.
	* config/vax/vax.c: Likewise.
	* config/vxworks.c: Likewise.
	* config/xtensa/xtensa.c: Likewise.
	* convert.c: Likewise.
	* cse.c: Likewise.
	* cselib.c: Likewise.
	* dbgcnt.c: Likewise.
	* dbxout.c: Likewise.
	* ddg.c: Likewise.
	* dominance.c: Likewise.
	* emit-rtl.c: Likewise.
	* explow.c: Likewise.
	* expmed.c: Likewise.
	* fixed-value.c: Likewise.
	* fold-const.c: Likewise.
	* fwprop.c: Likewise.
	* gcse.c: Likewise.
	* ggc-common.c: Likewise.
	* ggc-page.c: Likewise.
	* ggc-zone.c: Likewise.
	* gimple-low.c: Likewise.
	* gimplify.c: Likewise.
	* graph.c: Likewise.
	* haifa-sched.c: Likewise.
	* ifcvt.c: Likewise.
	* implicit-zee.c: Likewise.
	* integrate.c: Likewise.
	* ira-build.c: Likewise.
	* ira-color.c: Likewise.
	* ira-conflicts.c: Likewise.
	* ira-costs.c: Likewise.
	* ira-lives.c: Likewise.
	* ira.c: Likewise.
	* lists.c: Likewise.
	* loop-doloop.c: Likewise.
	* loop-iv.c: Likewise.
	* lto-opts.c: Likewise.
	* lto-symtab.c: Likewise.
	* main.c: Likewise.
	* modulo-sched.c: Likewise.
	* optabs.c: Likewise.
	* params.c: Likewise.
	* plugin.c: Likewise.
	* postreload-gcse.c: Likewise.
	* postreload.c: Likewise.
	* predict.c: Likewise.
	* profile.c: Likewise.
	* real.c: Likewise.
	* regcprop.c: Likewise.
	* reginfo.c: Likewise.
	* regmove.c: Likewise.
	* reorg.c: Likewise.
	* resource.c: Likewise.
	* rtl.c: Likewise.
	* rtlanal.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.
	* simplify-rtx.c: Likewise.
	* stmt.c: Likewise.
	* stor-layout.c: Likewise.
	* store-motion.c: Likewise.
	* targhooks.c: Likewise.
	* tree-cfg.c: Likewise.
	* tree-cfgcleanup.c: Likewise.
	* tree-dump.c: Likewise.
	* tree-eh.c: Likewise.
	* tree-inline.c: Likewise.
	* tree-nomudflap.c: Likewise.
	* tree-object-size.c: Likewise.
	* tree-optimize.c: Likewise.
	* tree-outof-ssa.c: Likewise.
	* tree-phinodes.c: Likewise.
	* tree-profile.c: Likewise.
	* tree-ssa-ccp.c: Likewise.
	* tree-ssa-coalesce.c: Likewise.
	* tree-ssa-live.c: Likewise.
	* tree-ssa-loop-niter.c: Likewise.
	* tree-ssa-loop-prefetch.c: Likewise.
	* tree-ssa-loop.c: Likewise.
	* tree-ssa-structalias.c: Likewise.
	* tree-ssa-uninit.c: Likewise.
	* tree-ssa.c: Likewise.
	* tree-vect-data-refs.c: Likewise.
	* tree-vect-loop-manip.c: Likewise.
	* tree-vect-loop.c: Likewise.
	* tree-vect-patterns.c: Likewise.
	* tree-vect-stmts.c: Likewise.
	* tree-vrp.c: Likewise.
	* varasm.c: Likewise.
	* vec.c: Likewise.
	* web.c: Likewise.
	* xcoffout.c: Likewise.

c-family/
	* c-common.h: Include diagnostic-core.h. Error if already
	included.
	* c-semantics.c: Do not define GCC_DIAG_STYLE here.
cp/
	* cp-tree.h: Do not include toplev.h.
	
java/
	* boehm.c: Include diagnostic-core.h in every file that includes
	toplev.h.
	* class.c: Likewise.
	* constants.c: Likewise.
	* decl.c: Likewise.
	* except.c: Likewise.
	* expr.c: Likewise.
	* jcf-parse.c: Likewise.
	* mangle.c: Likewise.
	* mangle_name.c: Likewise.
	* resource.c: Likewise.
	* typeck.c: Likewise.
	* verify-glue.c: Likewise.
ada/
	* gcc-interface/utils.c: Include diagnostic-core.h in every file
	that includes toplev.h.
lto/
	* lto-coff.c: Include diagnostic-core.h in every file that
	includes toplev.h.
	* lto-elf.c: Likewise.
	* lto-lang.c: Likewise.
	* lto-macho.c: Likewise.

From-SVN: r161943
2010-07-08 04:22:54 +00:00
Alexandre Oliva e0a80069ba re PR debug/44610 (VTA produces wrong variable location information)
PR debug/44610
* simplify-rtx.c (delegitimize_mem_from_attrs): Don't use a base
address if the offset is unknown.

From-SVN: r161413
2010-06-25 21:11:32 +00:00
Anatoly Sokolov fd7de64cee double-int.h (double_int_to_shwi, [...]): Implement as static inline.
* double-int.h (double_int_to_shwi, double_int_to_uhwi,
	double_int_fits_in_uhwi_p): Implement as static inline.
	(double_int_xor): New inline function.
	(double_int_lrotate, double_int_rrotate, double_int_max,
	double_int_umax, double_int_smax, double_int_min, double_int_umin,
	double_int_smin): Declare.
	(lrotate_double, rrotate_double): Remove declaration.
	* double-int.c (double_int_fits_in_uhwi_p, double_int_to_shwi,
	double_int_to_uhwi, lrotate_double, rrotate_double): Remove function.
	(double_int_lrotate, double_int_rrotate, double_int_max,
	double_int_umax, double_int_smax, double_int_min, double_int_umin,
	double_int_smin): New function.
	* fold-const.c (int_const_binop): Clean up, use double_int_*
	functions.
	* simplify-rtx.c (simplify_const_binary_operation): Clean up, use
	double_int_* and immed_double_int_const functions.

From-SVN: r161002
2010-06-18 19:58:48 +04:00
Diego Novillo 558c51c59d Undo inadvertent commit in rev 160105.
From-SVN: r160107
2010-06-01 10:20:24 -04:00
Diego Novillo 7bab65434c richi's fixes for c++ bootstrap
From-SVN: r160105
2010-06-01 10:05:17 -04:00
Steven Bosscher d49b6e1e33 real: Do not include gmp.h, mpfr.h, and mpc.h.
gcc/ChangeLog:
	* real: Do not include gmp.h, mpfr.h, and mpc.h.
	(REAL_VALUE_NEGATE, REAL_VALUE_ABS, real_arithmetic2): Remove.
	(real_value_negate, real_value_abs): New prototypes.
	(do_mpc_arg2, real_from_mpfr, mpfr_from_real): Move from here...
	* realmpfr.h (do_mpc_arg2, real_from_mpfr, mpfr_from_real): ...to here,
	new include file for interface between MPFR and REAL_VALUE_TYPE.
	* real.c: Include realmpfr.h.
	(real_arithmetic2): Remove legacy function.
	(real_value_negate): New.
	(real_value_abs): New.
	(mfpr_from_real, real_from_mpfr): Move from here...
	* realmpfr.c (mpfr_from_real, real_from_mpfr): ...to here, new file.
	* builtins.c: Include realmpfr.h.
	* fold-const.c: Include realmpfr.h.
	(fold_comparison): Use real_value_negate instead of REAL_VALUE_NEGATE.
	(fold_negate_const): Likewise.
	(fold_abs_const): Use real_value_abs instead of REAL_VALUE_ABS.
	* toplev.c: Include realmpfr.h.
	* simplify-rtx.c (simplify_const_unary_operation): Use real_value_abs
	and real_value_negate.
	* fixed-value.c (check_real_for_fixed_mode): Likewise.
	* config/arm/arm.c (neg_const_double_rtx_ok_for_fpa): Likewise.
	(vfp3_const_double_index): Likewise.
	(arm_print_operand): Likewise.
	* Makefile.in: Update dependencies.

fortran/ChangeLog:
	* trans-const.c: Include realmpfr.h.
	* Make-lang.in: Update dependencies.

From-SVN: r159679
2010-05-21 18:13:54 +00:00
Steven Bosscher 40013784db tree.h: Include real.h and fixed-value.h as basic datatypes.
gcc/ChangeLog:
	* tree.h: Include real.h and fixed-value.h as basic datatypes.
	* dfp.c, convert.c, reload1.c, reginfo.c, tree-flow.h,
	tree-ssa-threadedge.c, tree-ssanames.c, tree-loop-linear.c,
	tree-into-ssa.c, tree-vect-generic.c, tree-ssa-structalias.c,
	tree-ssa-loop-im.c, tree-dump.c, tree-complex.c, tree-ssa-uninit.c,
	genrecog.c, tree-ssa-threadupdate.c, tree-ssa-loop-niter.c,
	tree-pretty-print.c, tree-loop-distribution.c,
	tree-ssa-loop-unswitch.c, c-lex.c, optabs.c, postreload-gcse.c,
	tree-ssa-loop-manip.c, postreload.c, tree-ssa-loop-ch.c,
	tree-tailcall.c, tree.c, reload.c, tree-scalar-evolution.c, rtlanal.c,
	tree-phinodes.c, builtins.c, final.c, genoutput.c, fold-const.c,
	tree-ssa-dse.c, genautomata.c, tree-ssa-uncprop.c, toplev.c,
	tree-chrec.c, genemit.c, c-cppbuiltin.c, tree-ssa-sccvn.c,
	tree-ssa-ccp.c, tree-ssa-loop-ivopts.c, mode-switching.c,
	tree-call-cdce.c, cse.c, genpeep.c, tree-ssa-math-opts.c,
	tree-ssa-dom.c, tree-nrv.c, tree-ssa-propagate.c, tree-ssa-alias.c,
	tree-ssa-sink.c, jump.c, ifcvt.c, dwarf2out.c, expr.c, genattrtab.c,
	genconditions.c, tree-ssa-loop-ivcanon.c, tree-ssa-loop.c,
	tree-parloops.c, recog.c, tree-ssa-address.c, lcm.c, tree-eh.c,
	gimple-pretty-print.c, c-pretty-print.c, print-rtl.c, gcse.c,
	tree-if-conv.c, tree-data-ref.c, tree-affine.c, gimplify.c,
	tree-ssa-phiopt.c, implicit-zee.c, expmed.c, tree-dfa.c, emit-rtl.c,
	store-motion.c, cselib.c, tree-cfgcleanup.c, simplify-rtx.c,
	tree-ssa-pre.c, genpreds.c, tree-mudflap.c, print-tree.c,
	tree-ssa-copy.c, tree-ssa-forwprop.c, tree-ssa-dce.c, varasm.c,
	tree-nested.c, tree-ssa.c, tree-ssa-loop-prefetch.c, rtl.c,
	tree-inline.c, integrate.c, tree-optimize.c, tree-ssa-phiprop.c,
	fixed-value.c, combine.c, tree-profile.c, c-common.c, sched-vis.c,
	tree-cfg.c, passes.c, tree-ssa-reassoc.c, config/alpha/alpha.c,
	config/frv/frv.c, config/s390/s390.c, config/m32c/m32c.c,
	config/spu/spu.c, config/sparc/sparc.c, config/mep/mep.c,
	config/m32r/m32r.c, config/rx/rx.c, config/i386/i386.c,
	config/sh/sh.c, config/pdp11/pdp11.c, config/avr/avr.c,
	config/crx/crx.c, config/xtensa/xtensa.c, config/stormy16/stormy16.c,
	config/fr30/fr30.c, config/lm32/lm32.c, config/moxie/moxie.c,
	config/m68hc11/m68hc11.c, config/cris/cris.c, config/iq2000/iq2000.c,
	config/mn10300/mn10300.c, config/ia64/ia64.c, config/m68k/m68k.c,
	config/rs6000/rs6000.c, config/picochip/picochip.c, config/darwin.c,
	config/arc/arc.c, config/mcore/mcore.c, config/score/score3.c,
	config/score/score7.c, config/score/score.c, config/arm/arm.c,
	config/pa/pa.c, config/mips/mips.c, config/vax/vax.c,
	config/h8300/h8300.c, config/v850/v850.c, config/mmix/mmix.c,
	config/bfin/bfin.c:
	Clean up redundant includes.
	* Makefile.in: Update accordingly.

java/ChangeLog:
	* typeck.c, decl.c, jcf-parse.c, except.c, expr.c:

cp/Changelog:
	* error.c, tree.c, typeck2.c, cxx-pretty-print.c, mangle.c:
	Clean up redundant includes.

fortran/ChangeLog:
	* trans-const.c, trans-types.c, trans-intrinsic.c:
	Clean up redundant includes.

From-SVN: r159663
2010-05-21 13:53:22 +00:00
Anatoly Sokolov 54fb1ae03e double-int.h (double_int_setbit): Declare.
* double-int.h (double_int_setbit): Declare.
	* double-int.c (double_int_setbit): New function.
	* rtl.h (immed_double_int_const): Declare.
	* emit-rtl.c (immed_double_int_const): New function.
	* builtins.c (expand_builtin_signbit): Clean up, use double_int_*
	and immed_double_int_const functions.
	* optabs.c (expand_absneg_bit, expand_copysign_absneg,
	expand_copysign_bit):  (Ditto.).
	* simplify-rtx.c (simplify_binary_operation_1): (Ditto.).
	* tree-ssa-address.c (addr_for_mem_ref): (Ditto.).
	* dojump.c (prefer_and_bit_test): (Ditto.).
	* expr.c (convert_modes, reduce_to_bit_field_precision,
	const_vector_from_tree): (Ditto.).
	* expmed.c (mask_rtx, lshift_value): (Ditto.).

From-SVN: r158566
2010-04-20 20:33:46 +04:00
Jakub Jelinek 457eeaae81 re PR debug/43051 (VTA causes a stack living parameter unavailable in most of the function)
PR debug/43051
	PR debug/43092
	* cselib.c (cselib_preserve_constants,
	cfa_base_preserved_val): New static variables.
	(preserve_only_constants): New function.
	(cselib_reset_table): If cfa_base_preserved_val is non-NULL, don't
	clear its REG_VALUES.  If cselib_preserve_constants, don't 
	empty the whole hash table, but preserve there VALUEs with constants,
	cfa_base_preserved_val and cfa_base_preserved_val plus constant.
	(cselib_preserve_cfa_base_value): New function.
	(cselib_invalidate_regno): Don't invalidate cfa_base_preserved_val.
	(cselib_init): Change argument to int bitfield.  Set
	cselib_preserve_constants to whether CSELIB_PRESERVE_CONSTANTS
	is in it.
	(cselib_finish): Clear cselib_preserve_constants and
	cfa_base_preserved_val.
	* cselib.h (enum cselib_record_what): New enum.
	(cselib_init): Change argument to int.
	(cselib_preserve_cfa_base_value): New prototype.
	* postreload.c (reload_cse_regs_1): Adjust cselib_init caller.
	* dse.c (dse_step1): Likewise.
	* cfgcleanup.c (thread_jump): Likewise.
	* sched-deps.c (sched_analyze): Likewise.
	* gcse.c (local_cprop_pass): Likewise.
	* simplify-rtx.c (simplify_replace_fn_rtx): Add argument to callback.
	If FN is non-NULL, call the callback always and whenever it returns
	non-NULL just return that.  Only do rtx_equal_p if FN is NULL.
	* rtl.h (simplify_replace_fn_rtx): Add argument to callback.
	* combine.c (propagate_for_debug_subst): Add old_rtx argument,
	compare from with old_rtx and if it isn't rtx_equal_p, return NULL.
	* Makefile.in (var-tracking.o): Depend on $(RECOG_H).
	* var-tracking.c: Include recog.h.
	(bb_stack_adjust_offset): Remove.
	(vt_stack_adjustments): Don't call it, instead just gather the
	adjustments using insn_stack_adjust_offset_pre_post on each bb insn.
	(adjust_stack_reference): Remove.
	(compute_cfa_pointer): New function.
	(hard_frame_pointer_adjustment, cfa_base_rtx): New static variables.
	(struct adjust_mem_data): New type.
	(adjust_mems, adjust_mem_uses, adjust_mem_stores, adjust_insn): New
	functions.
	(get_address_mode): New function.
	(replace_expr_with_values): Use it.
	(use_type): Don't do cselib_lookup for VAR_LOC_UNKNOWN_P.
	Use get_address_mode.  For cfa_base_rtx return MO_CLOBBER.
	(adjust_sets): Remove.
	(add_uses): Don't add extra MO_VAL_USE for cfa_base_rtx plus constant.
	Use get_address_mode.
	(get_adjusted_src): Remove.
	(add_stores): Don't call it.  Never reuse expr SET.  Don't add extra
	MO_VAL_USE for cfa_base_rtx plus constant.  Use get_address_mode.
	(add_with_sets): Don't call adjust_sets.
	(fp_setter, vt_init_cfa_base): New functions.
	(vt_initialize): Change return type to bool.  Move most of pool etc.
	initialization to the beginning of the function from end.  Pass
	CSELIB_RECORD_MEMORY | CSELIB_PRESERVE_CONSTANTS to cselib_init.
	If !frame_pointer_needed, call vt_stack_adjustment before mos
	vector is filled, call vt_init_cfa_base if argp/framep has been
	eliminated to sp.  If frame_pointer_needed and argp/framep has
	been eliminated to hard frame pointer, set
	hard_frame_pointer_adjustment and call vt_init_cfa_base after
	encountering fp setter in the prologue.  For MO_ADJUST, call
	log_op_type before pusing the op into mos vector, not afterwards.
	Call adjust_insn before cselib_process_insn/add_with_sets,
	call cancel_changes (0) afterwards.
	(variable_tracking_main_1): Adjust for vt_initialize calling
	vt_stack_adjustments and returning whether it succeeded or not.

	* gcc.dg/guality/pr43051-1.c: New test.

From-SVN: r157476
2010-03-16 11:50:42 +01:00
Jakub Jelinek acc2dd549f Update Copyright years.
From-SVN: r155833
2010-01-12 10:49:51 +01:00
Jakub Jelinek 4942b76bf6 re PR debug/42662 (invalid rtl sharing found in the insn)
PR debug/42662
	* simplify-rtx.c (simplify_relational_operation_1): Avoid invalid rtx
	sharing when canonicalizing ({lt,ge}u (plus a b) b).

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

From-SVN: r155831
2010-01-12 10:45:19 +01:00
H.J. Lu b8698a0f37 Remove trailing white spaces.
2009-11-25  H.J. Lu  <hongjiu.lu@intel.com>

	* alias.c: Remove trailing white spaces.
	* alloc-pool.c: Likewise.
	* alloc-pool.h: Likewise.
	* attribs.c: Likewise.
	* auto-inc-dec.c: Likewise.
	* basic-block.h: Likewise.
	* bb-reorder.c: Likewise.
	* bt-load.c: Likewise.
	* builtins.c: Likewise.
	* builtins.def: Likewise.
	* c-common.c: Likewise.
	* c-common.h: Likewise.
	* c-cppbuiltin.c: Likewise.
	* c-decl.c: Likewise.
	* c-format.c: Likewise.
	* c-lex.c: Likewise.
	* c-omp.c: Likewise.
	* c-opts.c: Likewise.
	* c-parser.c: Likewise.
	* c-pretty-print.c: Likewise.
	* c-tree.h: Likewise.
	* c-typeck.c: Likewise.
	* caller-save.c: Likewise.
	* calls.c: Likewise.
	* cfg.c: Likewise.
	* cfganal.c: Likewise.
	* cfgexpand.c: Likewise.
	* cfghooks.c: Likewise.
	* cfghooks.h: Likewise.
	* cfglayout.c: Likewise.
	* cfgloop.c: Likewise.
	* cfgloop.h: Likewise.
	* cfgloopmanip.c: Likewise.
	* cfgrtl.c: Likewise.
	* cgraph.c: Likewise.
	* cgraph.h: Likewise.
	* cgraphbuild.c: Likewise.
	* cgraphunit.c: Likewise.
	* cif-code.def: Likewise.
	* collect2.c: Likewise.
	* combine.c: Likewise.
	* convert.c: Likewise.
	* coverage.c: Likewise.
	* crtstuff.c: Likewise.
	* cse.c: Likewise.
	* cselib.c: Likewise.
	* dbgcnt.c: Likewise.
	* dbgcnt.def: Likewise.
	* dbgcnt.h: Likewise.
	* dbxout.c: Likewise.
	* dce.c: Likewise.
	* ddg.c: Likewise.
	* ddg.h: Likewise.
	* defaults.h: Likewise.
	* df-byte-scan.c: Likewise.
	* df-core.c: Likewise.
	* df-problems.c: Likewise.
	* df-scan.c: Likewise.
	* df.h: Likewise.
	* dfp.c: Likewise.
	* diagnostic.c: Likewise.
	* diagnostic.h: Likewise.
	* dominance.c: Likewise.
	* domwalk.c: Likewise.
	* double-int.c: Likewise.
	* double-int.h: Likewise.
	* dse.c: Likewise.
	* dwarf2asm.c: Likewise.
	* dwarf2asm.h: Likewise.
	* dwarf2out.c: Likewise.
	* ebitmap.c: Likewise.
	* ebitmap.h: Likewise.
	* emit-rtl.c: Likewise.
	* et-forest.c: Likewise.
	* except.c: Likewise.
	* except.h: Likewise.
	* expmed.c: Likewise.
	* expr.c: Likewise.
	* expr.h: Likewise.
	* final.c: Likewise.
	* flags.h: Likewise.
	* fold-const.c: Likewise.
	* function.c: Likewise.
	* function.h: Likewise.
	* fwprop.c: Likewise.
	* gcc.c: Likewise.
	* gcov-dump.c: Likewise.
	* gcov-io.c: Likewise.
	* gcov-io.h: Likewise.
	* gcov.c: Likewise.
	* gcse.c: Likewise.
	* genattr.c: Likewise.
	* genattrtab.c: Likewise.
	* genautomata.c: Likewise.
	* genchecksum.c: Likewise.
	* genconfig.c: Likewise.
	* genflags.c: Likewise.
	* gengtype-parse.c: Likewise.
	* gengtype.c: Likewise.
	* gengtype.h: Likewise.
	* genmddeps.c: Likewise.
	* genmodes.c: Likewise.
	* genopinit.c: Likewise.
	* genpreds.c: Likewise.
	* gensupport.c: Likewise.
	* ggc-common.c: Likewise.
	* ggc-page.c: Likewise.
	* ggc-zone.c: Likewise.
	* ggc.h: Likewise.
	* gimple-iterator.c: Likewise.
	* gimple-low.c: Likewise.
	* gimple-pretty-print.c: Likewise.
	* gimple.c: Likewise.
	* gimple.def: Likewise.
	* gimple.h: Likewise.
	* gimplify.c: Likewise.
	* graphds.c: Likewise.
	* graphite-clast-to-gimple.c: Likewise.
	* gthr-nks.h: Likewise.
	* gthr-posix.c: Likewise.
	* gthr-posix.h: Likewise.
	* gthr-posix95.h: Likewise.
	* gthr-single.h: Likewise.
	* gthr-tpf.h: Likewise.
	* gthr-vxworks.h: Likewise.
	* gthr.h: Likewise.
	* haifa-sched.c: Likewise.
	* hard-reg-set.h: Likewise.
	* hooks.c: Likewise.
	* hooks.h: Likewise.
	* hosthooks.h: Likewise.
	* hwint.h: Likewise.
	* ifcvt.c: Likewise.
	* incpath.c: Likewise.
	* init-regs.c: Likewise.
	* integrate.c: Likewise.
	* ipa-cp.c: Likewise.
	* ipa-inline.c: Likewise.
	* ipa-prop.c: Likewise.
	* ipa-pure-const.c: Likewise.
	* ipa-reference.c: Likewise.
	* ipa-struct-reorg.c: Likewise.
	* ipa-struct-reorg.h: Likewise.
	* ipa-type-escape.c: Likewise.
	* ipa-type-escape.h: Likewise.
	* ipa-utils.c: Likewise.
	* ipa-utils.h: 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-int.h: Likewise.
	* ira-lives.c: Likewise.
	* ira.c: Likewise.
	* jump.c: Likewise.
	* lambda-code.c: Likewise.
	* lambda-mat.c: Likewise.
	* lambda-trans.c: Likewise.
	* lambda.h: Likewise.
	* langhooks.c: Likewise.
	* lcm.c: Likewise.
	* libgcov.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.
	* 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.
	* lto-streamer.h: Likewise.
	* lto-symtab.c: Likewise.
	* lto-wpa-fixup.c: Likewise.
	* matrix-reorg.c: Likewise.
	* mcf.c: Likewise.
	* mode-switching.c: Likewise.
	* modulo-sched.c: Likewise.
	* omega.c: Likewise.
	* omega.h: Likewise.
	* omp-low.c: Likewise.
	* optabs.c: Likewise.
	* optabs.h: Likewise.
	* opts-common.c: Likewise.
	* opts.c: Likewise.
	* params.def: Likewise.
	* params.h: Likewise.
	* passes.c: Likewise.
	* plugin.c: Likewise.
	* postreload-gcse.c: Likewise.
	* postreload.c: Likewise.
	* predict.c: Likewise.
	* predict.def: Likewise.
	* pretty-print.c: Likewise.
	* pretty-print.h: Likewise.
	* print-rtl.c: Likewise.
	* print-tree.c: Likewise.
	* profile.c: Likewise.
	* read-rtl.c: Likewise.
	* real.c: Likewise.
	* recog.c: Likewise.
	* reg-stack.c: Likewise.
	* regcprop.c: Likewise.
	* reginfo.c: Likewise.
	* regmove.c: Likewise.
	* regrename.c: Likewise.
	* regs.h: Likewise.
	* regstat.c: Likewise.
	* reload.c: Likewise.
	* reload1.c: Likewise.
	* resource.c: Likewise.
	* rtl.c: Likewise.
	* rtl.def: Likewise.
	* rtl.h: Likewise.
	* rtlanal.c: Likewise.
	* sbitmap.c: Likewise.
	* sched-deps.c: Likewise.
	* sched-ebb.c: Likewise.
	* sched-int.h: Likewise.
	* sched-rgn.c: Likewise.
	* sched-vis.c: Likewise.
	* sdbout.c: Likewise.
	* sel-sched-dump.c: Likewise.
	* sel-sched-dump.h: Likewise.
	* sel-sched-ir.c: Likewise.
	* sel-sched-ir.h: Likewise.
	* sel-sched.c: Likewise.
	* sel-sched.h: Likewise.
	* sese.c: Likewise.
	* sese.h: Likewise.
	* simplify-rtx.c: Likewise.
	* stack-ptr-mod.c: Likewise.
	* stmt.c: Likewise.
	* stor-layout.c: Likewise.
	* store-motion.c: Likewise.
	* stringpool.c: Likewise.
	* stub-objc.c: Likewise.
	* sync-builtins.def: Likewise.
	* target-def.h: Likewise.
	* target.h: Likewise.
	* targhooks.c: Likewise.
	* targhooks.h: Likewise.
	* timevar.c: Likewise.
	* tlink.c: Likewise.
	* toplev.c: Likewise.
	* toplev.h: Likewise.
	* tracer.c: Likewise.
	* tree-affine.c: Likewise.
	* tree-affine.h: Likewise.
	* tree-browser.def: Likewise.
	* tree-call-cdce.c: Likewise.
	* tree-cfg.c: Likewise.
	* tree-cfgcleanup.c: Likewise.
	* tree-chrec.c: Likewise.
	* tree-chrec.h: Likewise.
	* tree-complex.c: Likewise.
	* tree-data-ref.c: Likewise.
	* tree-data-ref.h: Likewise.
	* tree-dfa.c: Likewise.
	* tree-dump.c: Likewise.
	* tree-dump.h: Likewise.
	* tree-eh.c: Likewise.
	* tree-flow-inline.h: Likewise.
	* tree-flow.h: Likewise.
	* tree-if-conv.c: Likewise.
	* tree-inline.c: Likewise.
	* tree-into-ssa.c: Likewise.
	* tree-loop-distribution.c: Likewise.
	* tree-loop-linear.c: Likewise.
	* tree-mudflap.c: Likewise.
	* tree-nested.c: Likewise.
	* tree-nomudflap.c: Likewise.
	* tree-nrv.c: Likewise.
	* tree-object-size.c: Likewise.
	* tree-optimize.c: Likewise.
	* tree-outof-ssa.c: Likewise.
	* tree-parloops.c: Likewise.
	* tree-pass.h: Likewise.
	* tree-phinodes.c: Likewise.
	* tree-predcom.c: Likewise.
	* tree-pretty-print.c: Likewise.
	* tree-profile.c: Likewise.
	* tree-scalar-evolution.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-copyrename.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-live.h: 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-operands.h: 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-sink.c: Likewise.
	* tree-ssa-structalias.c: Likewise.
	* tree-ssa-ter.c: Likewise.
	* tree-ssa-threadedge.c: Likewise.
	* tree-ssa-threadupdate.c: Likewise.
	* tree-ssa-uncprop.c: Likewise.
	* tree-ssa.c: Likewise.
	* tree-ssanames.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-vectorizer.h: Likewise.
	* tree-vrp.c: Likewise.
	* tree.c: Likewise.
	* tree.def: Likewise.
	* tree.h: Likewise.
	* treestruct.def: Likewise.
	* unwind-compat.c: Likewise.
	* unwind-dw2-fde-glibc.c: Likewise.
	* unwind-dw2.c: Likewise.
	* value-prof.c: Likewise.
	* value-prof.h: Likewise.
	* var-tracking.c: Likewise.
	* varasm.c: Likewise.
	* varpool.c: Likewise.
	* vec.c: Likewise.
	* vec.h: Likewise.
	* vmsdbgout.c: Likewise.
	* web.c: Likewise.
	* xcoffout.c: Likewise.

From-SVN: r154645
2009-11-25 02:55:54 -08:00
Uros Bizjak 8a1eb57b7d re PR middle-end/41930 (cc1 SEGV compiling maxval_r16.c)
PR middle-end/41930
	* simplify-rtx.c (simplify_replace_fn_rtx) <case 'e'>: Skip
	processing if XEXP (x, i) is NULL.

From-SVN: r154116
2009-11-12 08:30:05 +01:00
Andrew Pinski 0e159e0f2b re PR rtl-optimization/41833 (vec_splat followed by vec_splat could be improved)
2009-11-04  Andrew Pinski  <andrew_pinski@playstation.sony.com>
            Trevor Smigiel <Trevor_Smigiel@playstation.sony.com>

        PR rtl-opt/41833
        * simplify-rtx.c (simplify_binary_operation_1): Simplify vec_select of
        a vec_duplicate.

2009-11-04  Andrew Pinski  <andrew_pinski@playstation.sony.com>

        PR rtl-opt/41833
        * gcc.target/powerpc/altivec-33.c: New testcase.


Co-Authored-By: Trevor Smigiel <Trevor_Smigiel@playstation.sony.com>

From-SVN: r153906
2009-11-04 10:35:57 -08:00
Ben Elliston d4ebfa65c9 tm.texi (TARGET_ADDR_SPACE_POINTER_MODE): Document.
2009-10-26  Ben Elliston  <bje@au.ibm.com>
	    Michael Meissner  <meissner@linux.vnet.ibm.com>
	    Ulrich Weigand  <uweigand@de.ibm.com>

	* doc/tm.texi (TARGET_ADDR_SPACE_POINTER_MODE): Document.
	(TARGET_ADDR_SPACE_ADDRESS_MODE): Likewise.
	(TARGET_ADDR_SPACE_VALID_POINTER_MODE): Likewise.

	* target.h (struct target_def): Add pointer_mode, address_mode,
	and valid_pointer_mode to addr_space substructure.
	* target-def.h (TARGET_ADDR_SPACE_POINTER_MODE): Define.
	(TARGET_ADDR_SPACE_ADDRESS_MODE): Likewise.
	(TARGET_ADDR_SPACE_VALID_POINTER_MODE): Likewise.
	(TARGET_ADDR_SPACE_HOOKS): Add them.
	* targhooks.c (target_default_pointer_address_modes_p): New function.
	* target.h (target_default_pointer_address_modes_p): Add prototype.
	* targhooks.c (default_addr_space_pointer_mode): New function.
	(default_addr_space_address_mode): Likewise.
	(default_addr_space_valid_pointer_mode): Likewise.
	* targhooks.h (default_addr_space_pointer_mode): Add prototype.
	(default_addr_space_address_mode): Likewise.
	(default_addr_space_valid_pointer_mode): Likewise.
	* output.h (default_valid_pointer_mode): Move to ...
	* targhooks.h (default_valid_pointer_mode): ... here.
	* varasm.c (default_valid_pointer_mode): Move to ...
	* targhooks.c (default_valid_pointer_mode): ... here.

	* varasm.c (output_constant): Use targetm.addr_space.valid_pointer_mode
	instead of targetm.valid_pointer_mode.

	* fold-const.c (fit_double_type): Use int_or_pointer_precision.
	* tree.c (integer_pow2p): Likewise.
	(tree_log2): Likewise.
	(tree_floor_log2): Likewise.
	(signed_or_unsigned_type_for): Support pointer type of different size.
	(int_or_pointer_precision): New function.
	* tree.h (int_or_pointer_precision): Add prototype.
	* stor-layout.c (layout_type): Set TYPE_PRECISION for offset types.
	* varasm.c (initializer_constant_valid_p): Use TYPE_PRECISION of
	incoming pointer type instead of POINTER_SIZE.

	* tree.c (build_pointer_type): Use appropriate pointer mode
	instead of ptr_mode.
	(build_reference_type): Likewise.
	* expr.c (store_expr): Likewise.
	(expand_expr_addr_expr): Likewise.
	* tree-vect-data-refs.c (vect_create_data_ref_ptr): Likewise.
	* cfgexpand.c (expand_debug_expr): Likewise.
	
	* auto-inc-dec.c: Include "target.h".
	(try_merge): Use appropriate address mode instead of Pmode.
	(find_inc): Likewise.
	* combine.c (find_split_point): Likewise.
	* cselib.c (cselib_record_sets): Likewise.
	* dse.c (replace_inc_dec): Likewise.
	(canon_address): Likewise.
	* var-tracking.c (replace_expr_with_values): Likewise.
	(count_uses): Likewise.
	(add_uses): Likewise.
	(add_stores): Likewise.
	* emit-rtl.c: Include "target.h".
	(adjust_address_1): Use appropriate address mode instead of Pmode.
	(offset_address): Likewise.
	* explow.c (break_out_memory_refs): Likewise.
	(memory_address_addr_space): Likewise.
	(promote_mode): Likewise.
	* expr.c (move_by_pieces): Likewise.
	(emit_block_move_via_loop): Likewise.
	(store_by_pieces): Likewise.
	(store_by_pieces_1): Likewise.
	(expand_assignment): Likewise.
	(store_constructor): Likewise.
	(expand_expr_addr_expr): Likewise.
	(expand_expr_real_1): Likewise.
	* cfgexpand.c (expand_debug_expr): Likewise.
	* ifcvt.c (noce_try_cmove_arith): Likewise.
	* regcprop.c (kill_autoinc_value): Likewise.
	* regmove.c (try_auto_increment): Likewise.
	* reload.c (find_reloads): Likewise.
	(find_reloads_address): Likewise.
	(find_reloads_address_1): Likewise.
	* sched-deps.c: Include "target.h".
	(sched_analyze_1): Use appropriate address mode instead of Pmode.
	(sched_analyze_2): Likewise.
	* sel-sched-dump.c: Include "target.h".
	(debug_mem_addr_value): Use appropriate address mode instead of Pmode.
	* stor-layout.c (layout_type): Likewise.
	* tree-ssa-loop-ivopts.c (produce_memory_decl_rtl): Likewise.
	(multiplier_allowed_in_address_p): Likewise.
	(get_address_cost): Likewise.
	* varasm.c (make_decl_rtl): Likewise.
	
	* expr.c (expand_assignment): Always convert offsets to appropriate
	address mode.
	(store_expr): Likewise.
	(store_constructor): Likewise.
	(expand_expr_real_1): Likewise.

	* reload.h (form_sum): Add MODE argument.
	* reload.c (form_sum): Add MODE argument, use it instead of Pmode.
	Update recursive calls.
	(subst_indexed_address): Update calls to form_sum.
	
	* tree-flow.h (addr_for_mem_ref): Add ADDRSPACE argument.
	* tree-ssa-address.c: Include "target.h".
	(templates): Replace by ...
	(mem_addr_template_list): ... this new vector.
	(TEMPL_IDX): Handle address space numbers.
	(gen_addr_rtx): Add address mode argument, use it instead of Pmode.
	(addr_for_mem_ref): Add ADDRSPACE argument.  Use per-address-space
	instead of global cache.  Update call to gen_addr_rtx.
	(valid_mem_ref_p): Update call to addr_for_mem_ref.
	* expr.c (expand_expr_real_1): Update call to addr_for_mem_ref.
	
	* rtl.h (convert_memory_address_addr_space): Add prototype.
	(convert_memory_address): Define as macro.
	* explow.c (convert_memory_address): Rename to ...
	(convert_memory_address_addr_space): ... this.  Add ADDRSPACE argument.
	Use appropriate pointer and address modes instead of ptr_mode / Pmode.
	Update recursive calls.
	(memory_address_addr_space): Call convert_memory_address_addr_space.
	* expmed.c (make_tree): Likewise.
	* expr.c (expand_assignment): Likewise.
	(expand_expr_addr_expr_1): Likewise.  Also, add ADDRSPACE argument.
	(expand_expr_addr_expr): Likewise.  Also, update call.

	* alias.c (find_base_value): Guard pointer size optimizations.
	(find_base_term): Likewise.
	* rtlanal.c (nonzero_bits1): Likewise.
	(num_sign_bit_copies1): Likewise.
	* simplify-rtx.c (simplify_unary_operation_1): Likewise.

	* Makefile.in (tree-ssa-address.o): Add $(TARGET_H) dependency.
	(emit-rtl.o): Likewise.
	(auto-inc-dec.o): Likewise.
	(sched-deps.o): Likewise.

Co-Authored-By: Michael Meissner <meissner@linux.vnet.ibm.com>
Co-Authored-By: Ulrich Weigand <uweigand@de.ibm.com>

From-SVN: r153573
2009-10-26 21:57:10 +00:00
Richard Sandiford 4fb296d9f0 simplify-rtx.c (simplify_replace_fn_rtx): Add a fallback case for rtxes that aren't handled specially.
gcc/
	* simplify-rtx.c (simplify_replace_fn_rtx): Add a fallback case
	for rtxes that aren't handled specially.

From-SVN: r153476
2009-10-22 22:30:27 +00:00
Richard Sandiford 3af4ba41cc rtl.h (simplify_replace_fn_rtx): Declare.
gcc/
	* rtl.h (simplify_replace_fn_rtx): Declare.
	(wrap_constant, unwrap_constant): Delete.
	* cfgexpand.c (unwrap_constant, wrap_constant): Delete.
	(expand_debug_expr): Don't call wrap_constant.
	* combine.c (rtx_subst_pair): Only define for AUTO_INC_DEC.
	(auto_adjust_pair): Fold into...
	(propagate_for_debug_subst): ...here.  Only define for AUTO_INC_DEC.
	Just return a new value.
	(propagate_for_debug): Use simplify_replace_fn_rtx for AUTO_INC_DEC,
	otherwise use simplify_replace_rtx.
	* cselib.c (wrap_constant): Reinstate old definition.
	(cselib_expand_value_rtx_1): Don't wrap constants.
	* gcse.c (try_replace_reg): Don't use copy_rtx in the call to
	simplify_replace_rtx.
	(bypass_block): Fix formatting in calls to simplify_replace_rtx.
	* reload1.c (reload): Skip all uses for an insn before adjusting it.
	Use simplify_replace_rtx.
	* simplify-rtx.c (simplify_replace_fn_rtx): New function,
	adapted from...
	(simplify_replace_rtx): ...here.  Turn into a wrapper for
	simplify_replace_fn_rtx.
	(simplify_unary_operation): Don't unwrap CONSTs.
	* var-tracking.c (check_wrap_constant): Delete.
	(vt_expand_loc_callback): Don't call it.
	(vt_expand_loc): Likewise.

From-SVN: r153037
2009-10-20 19:50:38 +00:00
Jie Zhang 91c29f68ef simplify-rtx.c (simplify_const_unary_operation): Handle SS_ABS.
* simplify-rtx.c (simplify_const_unary_operation): Handle
	SS_ABS.
	* doc/rtl.texi: Document ss_abs.

From-SVN: r153003
2009-10-20 03:33:57 +00:00
Richard Sandiford c47d1dbaeb simplify-rtx.c (simplify_replace_rtx): Use rtx_equal_p for all OLD_RTXes, not just REGs.
gcc/
	* simplify-rtx.c (simplify_replace_rtx): Use rtx_equal_p for
	all OLD_RTXes, not just REGs.  Use copy_rtx to create the
	replacement value.

From-SVN: r152646
2009-10-11 19:09:01 +00:00
Alexandre Oliva b5b8b0ac64 invoke.texi (-fvar-tracking-assignments): New.
gcc/ChangeLog:
* doc/invoke.texi (-fvar-tracking-assignments): New.
(-fvar-tracking-assignments-toggle): New.
(-fdump-final-insns=file): Mark filename as optional.
(--param min-nondebug-insn-uid): New.
(-gdwarf-@{version}): Mention version 4.
* opts.c (common_handle_option): Accept it.
* tree-vrp.c (find_assert_locations_1): Skip debug stmts.
* regrename.c (regrename_optimize): Drop last.  Don't count debug
insns as uses.  Don't reject change because of debug insn.
(do_replace): Reject DEBUG_INSN as chain starter.  Take base_regno
from the chain starter, and check for inexact matches in
DEBUG_INSNS.
(scan_rtx_reg): Accept inexact matches in DEBUG_INSNs.
(build_def_use): Simplify and fix the marking of DEBUG_INSNs.
* sched-ebb.c (schedule_ebbs): Skip boundary debug insns.
* fwprop.c (forward_propagate_and_simplify): ...into debug insns.
* doc/gimple.texi (is_gimple_debug): New.
(gimple_debug_bind_p): New.
(is_gimple_call, gimple_assign_cast_p): End sentence with period.
* doc/install.texi (bootstrap-debug): More details.
(bootstrap-debug-big, bootstrap-debug-lean): Document.
(bootstrap-debug-lib): More details.
(bootstrap-debug-ckovw): Update.
(bootstrap-time): New.
* tree-into-ssa.c (mark_def_sites): Skip debug stmts.
(insert_phi_nodes_for): Insert debug stmts.
(rewrite_stmt): Take iterator.  Insert debug stmts.
(rewrite_enter_block): Adjust.
(maybe_replace_use_in_debug_stmt): New.
(rewrite_update_stmt): Use it.
(mark_use_interesting): Return early for debug stmts.
* tree-ssa-loop-im.c (rewrite_bittest): Propagate DEFs into debug
stmts before replacing stmt.
(move_computations_stmt): Likewise.
* ira-conflicts.c (add_copies): Skip debug insns.
* regstat.c (regstat_init_n_sets_and_refs): Discount debug insns.
(regstat_bb_compute_ri): Skip debug insns.
* tree-ssa-threadupdate.c (redirection_block_p): Skip debug stmts.
* tree-ssa-loop-manip.c (find_uses_to_rename_stmt,
check_loop_closed_ssa_stmt): Skip debug stmts.
* tree-tailcall.c (find_tail_calls): Likewise.
* tree-ssa-loop-ch.c (should_duplicate_loop_header_p): Likewise.
* tree.h (MAY_HAVE_DEBUG_STMTS): New.
(build_var_debug_value_stat): Declare.
(build_var_debug_value): Define.
(target_for_debug_bind): Declare.
* reload.c (find_equiv_reg): Skip debug insns.
* rtlanal.c (reg_used_between_p): Skip debug insns.
(side_effects_p): Likewise.
(canonicalize_condition): Likewise.
* ddg.c (create_ddg_dep_from_intra_loop_link): Check that non-debug
insns never depend on debug insns.
(create_ddg_dep_no_link): Likewise.
(add_cross_iteration_register_deps): Use ANTI_DEP for debug insns.
Don't add inter-loop dependencies for debug insns.
(build_intra_loop_deps): Likewise.
(create_ddg): Count debug insns.
* ddg.h (struct ddg::num_debug): New.
(num_backargs): Pair up with previous int field.
* diagnostic.c (diagnostic_report_diagnostic): Skip notes on
-fcompare-debug-second.
* final.c (get_attr_length_1): Skip debug insns.
(rest_of_clean-state): Don't dump CFA_RESTORE_STATE.
* gcc.c (invoke_as): Call compare-debug-dump-opt.
(driver_self_specs): Map -fdump-final-insns to
-fdump-final-insns=..
(get_local_tick): New.
(compare_debug_dump_opt_spec_function): Test for . argument and
compute output name.  Compute temp output spec without flag name.
Compute -frandom-seed.
(OPT): Undef after use.
* cfgloopanal.c (num_loop_insns): Skip debug insns.
(average_num_loop_insns): Likewise.
* params.h (MIN_NONDEBUG_INSN_UID): New.
* gimple.def (GIMPLE_DEBUG): New.
* ipa-reference.c (scan_stmt_for_static_refs): Skip debug stmts.
* auto-inc-dec.c (merge_in_block): Skip debug insns.
(merge_in_block): Fix whitespace.
* toplev.c (flag_var_tracking): Update comment.
(flag_var_tracking_assignments): New.
(flag_var_tracking_assignments_toggle): New.
(process_options): Don't open final insns dump file if we're not
going to write to it.  Compute defaults for var_tracking.
* df-scan.c (df_insn_rescan_debug_internal): New.
(df_uses_record): Handle debug insns.
* haifa-sched.c (ready): Initialize n_debug.
(contributes_to_priority): Skip debug insns.
(dep_list_size): New.
(priority): Use it.
(rank_for_schedule): Likewise.  Schedule debug insns as soon as
they're ready.  Disregard previous debug insns to make decisions.
(queue_insn): Never queue debug insns.
(ready_add, ready_remove_first, ready_remove): Count debug insns.
(schedule_insn): Don't reject debug insns because of issue rate.
(get_ebb_head_tail, no_real_insns_p): Skip boundary debug insns.
(queue_to_ready): Skip and discount debug insns.
(choose_ready): Let debug insns through.
(schedule_block): Check boundary debug insns.  Discount debug
insns, schedule them early.  Adjust whitespace.
(set_priorities): Check for boundary debug insns.
(add_jump_dependencies): Use dep_list_size.
(prev_non_location_insn): New.
(check_cfg): Use it.
* tree-ssa-loop-ivopts.c (find-interesting_users): Skip debug
stmts.
(remove_unused_ivs): Reset debug stmts.
* modulo-sched.c (const_iteration_count): Skip debug insns.
(res_MII): Discount debug insns.
(loop_single_full_bb_p): Skip debug insns.
(sms_schedule): Likewise.
(sms_schedule_by_order): Likewise.
(ps_has_conflicts): Likewise.
* caller-save.c (refmarker_fn): New.
(save_call_clobbered_regs): Replace regs with saved mem in
debug insns.
(mark_referenced_regs): Take pointer, mark and arg.  Adjust.
Call refmarker_fn mark for hardregnos.
(mark_reg_as_referenced): New.
(replace_reg_with_saved_mem): New.
* ipa-pure-const.c (check_stmt): Skip debug stmts.
* cse.c (cse_insn): Canonicalize debug insns.  Skip them when
searching back.
(cse_extended_basic_block): Skip debug insns.
(count_reg_usage): Likewise.
(is_dead_reg): New, split out of...
(set_live_p): ... here.
(insn_live_p): Use it for debug insns.
* tree-stdarg.c (check_all_va_list_escapes): Skip debug stmts.
(execute_optimize_stdarg): Likewise.
* tree-ssa-dom.c (propagate_rhs_into_lhs): Likewise.
* tree-ssa-propagate.c (substitute_and_fold): Don't regard
changes in debug stmts as changes.
* sel-sched.c (moving_insn_creates_bookkeeping_block_p): New.
(moveup_expr): Don't move across debug insns.  Don't move
debug insn if it would create a bookkeeping block.
(moveup_expr_cached): Don't use cache for debug insns that
are heads of blocks.
(compute_av_set_inside_bb): Skip debug insns.
(sel_rank_for_schedule): Schedule debug insns first.  Remove
dead code.
(block_valid_for_bookkeeping_p); Support lax searches.
(create_block_for_bookkeeping): Adjust block numbers when
encountering debug-only blocks.
(find_place_for_bookkeeping): Deal with debug-only blocks.
(generate_bookkeeping_insn): Accept no place to insert.
(remove_temp_moveop_nops): New argument full_tidying.
(prepare_place_to_insert): Deal with debug insns.
(advance_state_on_fence): Debug insns don't start cycles.
(update_boundaries): Take fence as argument.  Deal with
debug insns.
(schedule_expr_on_boundary): No full_tidying on debug insns.
(fill_insns): Deal with debug insns.
(track_scheduled_insns_and_blocks): Don't count debug insns.
(need_nop_to_preserve_insn_bb): New, split out of...
(remove_insn_from_stream): ... this.
(fur_orig_expr_not_found): Skip debug insns.
* rtl.def (VALUE): Move up.
(DEBUG_INSN): New.
* tree-ssa-sink.c (all_immediate_uses_same_place): Skip debug
stmts.
(nearest_common_dominator_of_uses): Take debug_stmts argument.
Set it if debug stmts are found.
(statement_sink_location): Skip debug stmts.  Propagate
moving defs into debug stmts.
* ifcvt.c (first_active_insn): Skip debug insns.
(last_active_insns): Likewise.
(cond_exec_process_insns): Likewise.
(noce_process_if_block): Likewise.
(check_cond_move_block): Likewise.
(cond_move_convert_if_block): Likewise.
(block_jumps_and_fallthru_p): Likewise.
(dead_or_predicable): Likewise.
* dwarf2out.c (debug_str_hash_forced): New.
(find_AT_string): Add comment.
(gen_label_for_indirect_string): New.
(get_debug_string_label): New.
(AT_string_form): Use it.
(mem_loc_descriptor): Handle non-TLS symbols.  Handle MINUS , DIV,
MOD, AND, IOR, XOR, NOT, ABS, NEG, and CONST_STRING.  Accept but
discard COMPARE, IF_THEN_ELSE, ROTATE, ROTATERT, TRUNCATE and
several operations that cannot be represented with DWARF opcodes.
(loc_descriptor): Ignore SIGN_EXTEND and ZERO_EXTEND.  Require
dwarf_version 4 for DW_OP_implicit_value and DW_OP_stack_value.
(dwarf2out_var_location): Take during-call mark into account.
(output_indirect_string): Update comment.  Output if there are
label and references.
(prune_indirect_string): New.
(prune_unused_types): Call it if debug_str_hash_forced.
More in dwarf2out.c, from Jakub Jelinek <jakub@redhat.com>:
(dw_long_long_const): Remove.
(struct dw_val_struct): Change val_long_long type to rtx.
(print_die, attr_checksum, same_dw_val_p, loc_descriptor): Adjust for
val_long_long change to CONST_DOUBLE rtx from a long hi/lo pair.
(output_die): Likewise.  Use HOST_BITS_PER_WIDE_INT size of each
component instead of HOST_BITS_PER_LONG.
(output_loc_operands): Likewise.   For const8* assert
HOST_BITS_PER_WIDE_INT rather than HOST_BITS_PER_LONG is >= 64.
(output_loc_operands_raw): For const8* assert HOST_BITS_PER_WIDE_INT
rather than HOST_BITS_PER_LONG is >= 64.
(add_AT_long_long): Remove val_hi and val_lo arguments, add
val_const_double.
(size_of_die): Use HOST_BITS_PER_WIDE_INT size multiplier instead of
HOST_BITS_PER_LONG for dw_val_class_long_long.
(add_const_value_attribute): Adjust add_AT_long_long caller.  Don't
handle TLS SYMBOL_REFs.  If CONST wraps a constant, tail recurse.
(dwarf_stack_op_name): Handle DW_OP_implicit_value and
DW_OP_stack_value.
(size_of_loc_descr, output_loc_operands, output_loc_operands_raw):
Handle DW_OP_implicit_value.
(extract_int): Move prototype earlier.
(mem_loc_descriptor): For SUBREG punt if inner
mode size is wider than DWARF2_ADDR_SIZE.  Handle SIGN_EXTEND
and ZERO_EXTEND by DW_OP_shl and DW_OP_shr{a,}.  Handle
EQ, NE, GT, GE, LT, LE, GTU, GEU, LTU, LEU, SMIN, SMAX, UMIN,
UMAX, SIGN_EXTRACT, ZERO_EXTRACT.
(loc_descriptor): Compare mode size with DWARF2_ADDR_SIZE
instead of Pmode size.
(loc_descriptor): Add MODE argument.  Handle CONST_INT, CONST_DOUBLE,
CONST_VECTOR, CONST, LABEL_REF and SYMBOL_REF if mode != VOIDmode,
attempt to handle other expressions.  Don't handle TLS SYMBOL_REFs.
(concat_loc_descriptor, concatn_loc_descriptor,
loc_descriptor_from_tree_1): Adjust loc_descriptor callers.
(add_location_or_const_value_attribute): Likewise.  For single
location loc_lists attempt to use add_const_value_attribute
for constant decls.  Add DW_AT_const_value even if
NOTE_VAR_LOCATION is VAR_LOCATION with CONSTANT_P or CONST_STRING
in its expression.
* cfgbuild.c (inside_basic_block_p): Handle debug insns.
(control_flow_insn_p): Likewise.
* tree-parloops.c (eliminate_local_variables_stmt): Handle debug
stmt.
(separate_decls_in_region_debug_bind): New.
(separate_decls_in_region): Process debug bind stmts afterwards.
* recog.c (verify_changes): Handle debug insns.
(extract_insn): Likewise.
(peephole2_optimize): Skip debug insns.
* dse.c (scan_insn): Skip debug insns.
* sel-sched-ir.c (return_nop_to_pool): Take full_tidying argument.
Pass it on.
(setup_id_for_insn): Handle debug insns.
(maybe_tidy_empty_bb): Adjust whitespace.
(tidy_control_flow): Skip debug insns.
(sel_remove_insn): Adjust for debug insns.
(sel_estimate_number_of_insns): Skip debug insns.
(create_insn_rtx_from_pattern): Handle debug insns.
(create_copy_of_insn_rtx): Likewise.
* sel-sched-.h (sel_bb_end): Declare.
(sel_bb_empty_or_nop_p): New.
(get_all_loop_exits): Use it.
(_eligible_successor_edge_p): Likewise.
(return_nop_to_pool): Adjust.
* tree-eh.c (tre_empty_eh_handler_p): Skip debug stmts.
* ira-lives.c (process_bb_node_lives): Skip debug insns.
* gimple-pretty-print.c (dump_gimple_debug): New.
(dump_gimple_stmt): Use it.
(dump_bb_header): Skip gimple debug stmts.
* regmove.c (optimize_reg_copy_1): Discount debug insns.
(fixup_match_2): Likewise.
(regmove_backward_pass): Likewise.  Simplify combined
replacement.  Handle debug insns.
* function.c (instantiate_virtual_regs): Handle debug insns.
* function.h (struct emit_status): Add x_cur_debug_insn_uid.
* print-rtl.h: Include cselib.h.
(print_rtx): Print VALUEs.  Split out and recurse for
VAR_LOCATIONs.
* df.h (df_inns_rescan_debug_internal): Declare.
* gcse.c (alloc_hash_table): Estimate n_insns.
(cprop_insn): Don't regard debug insns as changes.
(bypass_conditional_jumps): Skip debug insns.
(one_pre_gcse_pass): Adjust.
(one_code_hoisting_pass): Likewise.
(compute_ld_motion_mems): Skip debug insns.
(one_cprop_pass): Adjust.
* tree-if-conv.c (tree_if_convert_stmt): Reset debug stmts.
(if_convertible_stmt_p): Handle debug stmts.
* init-regs.c (initialize_uninitialized_regs): Skip debug insns.
* tree-vect-loop.c (vect_is_simple_reduction): Skip debug stmts.
* ira-build.c (create_bb_allocnos): Skip debug insns.
* tree-flow-inline.h (has_zero_uses): Discount debug stmts.
(has_single_use): Likewise.
(single_imm_use): Likewise.
(num_imm_uses): Likewise.
* tree-ssa-phiopt.c (empty_block_p): Skip debug stmts.
* tree-ssa-coalesce.c (build_ssa_conflict_graph): Skip debug stmts.
(create_outofssa_var_map): Likewise.
* lower-subreg.c (adjust_decomposed_uses): New.
(resolve_debug): New.
(decompose_multiword_subregs): Use it.
* tree-dfa.c (find_referenced_vars): Skip debug stmts.
* emit-rtl.c: Include params.h.
(cur_debug_insn_uid): Define.
(set_new_first_and_last_insn): Set cur_debug_insn_uid too.
(copy_rtx_if_shared_1): Handle debug insns.
(reset_used_flags): Likewise.
(set_used_flags): LIkewise.
(get_max_insn_count): New.
(next_nondebug_insn): New.
(prev_nondebug_insn): New.
(make_debug_insn_raw): New.
(emit_insn_before_noloc): Handle debug insns.
(emit_jump_insn_before_noloc): Likewise.
(emit_call_insn_before_noloc): Likewise.
(emit_debug_insn_before_noloc): New.
(emit_insn_after_noloc): Handle debug insns.
(emit_jump_insn_after_noloc): Likewise.
(emit_call_insn_after_noloc): Likewise.
(emit_debug_insn_after_noloc): Likewise.
(emit_insn_after): Take loc from earlier non-debug insn.
(emit_jump_insn_after): Likewise.
(emit_call_insn_after): Likewise.
(emit_debug_insn_after_setloc): New.
(emit_debug_insn_after): New.
(emit_insn_before): Take loc from later non-debug insn.
(emit_jump_insn_before): Likewise.
(emit_call_insn_before): Likewise.
(emit_debug_insn_before_setloc): New.
(emit_debug_insn_before): New.
(emit_insn): Handle debug insns.
(emit_debug_insn): New.
(emit_jump_insn): Handle debug insns.
(emit_call_insn): Likewise.
(emit): Likewise.
(init_emit): Take min-nondebug-insn-uid into account.
Initialize cur_debug_insn_uid.
(emit_copy_of_insn_after): Handle debug insns.
* cfgexpand.c (gimple_assign_rhs_to_tree): Do not overwrite
location of single rhs in place.
(maybe_dump_rtl_for_gimple_stmt): Dump lineno.
(floor_sdiv_adjust): New.
(cell_sdiv_adjust): New.
(cell_udiv_adjust): New.
(round_sdiv_adjust): New.
(round_udiv_adjust): New.
(wrap_constant): Moved from cselib.
(unwrap_constant): New.
(expand_debug_expr): New.
(expand_debug_locations): New.
(expand_gimple_basic_block): Drop hiding redeclaration.  Expand
debug bind stmts.
(gimple_expand_cfg): Expand debug locations.
* cselib.c: Include tree-pass.h.
(struct expand_value_data): New.
(cselib_record_sets_hook): New.
(PRESERVED_VALUE_P, LONG_TERM_PRESERVED_VALUE_P): New.
(cselib_clear_table): Move, and implemnet in terms of...
(cselib_reset_table_with_next_value): ... this.
(cselib_get_next_unknown_value): New.
(discard_useless_locs): Don't discard preserved values.
(cselib_preserve_value): New.
(cselib_preserved_value_p): New.
(cselib_preserve_definitely): New.
(cselib_clear_preserve): New.
(cselib_preserve_only_values): New.
(new_cselib_val): Take rtx argument.  Dump it in details.
(cselib_lookup_mem): Adjust.
(expand_loc): Take regs_active in struct.  Adjust.  Silence
dumps unless details are requested.
(cselib_expand_value_rtx_cb): New.
(cselib_expand_value_rtx): Rename and reimplment in terms of...
(cselib_expand_value_rtx_1): ... this.  Adjust.  Silence dumps
without details.  Copy more subregs.  Try to resolve values
using a callback.  Wrap constants.
(cselib_subst_to_values): Adjust.
(cselib_log_lookup): New.
(cselib_lookup): Call it.
(cselib_invalidate_regno): Don't count preserved values as
useless.
(cselib_invalidate_mem): Likewise.
(cselib_record_set): Likewise.
(struct set): Renamed to cselib_set, moved to cselib.h.
(cselib_record_sets): Adjust.  Call hook.
(cselib_process_insn): Reset table when it would be cleared.
(dump_cselib_val): New.
(dump_cselib_table): New.
* tree-cfgcleanup.c (tree_forwarded_block_p): Skip debug stmts.
(remove_forwarder_block): Support moving debug stmts.
* cselib.h (cselib_record_sets_hook): Declare.
(cselib_expand_callback): New type.
(cselib_expand_value_rtx_cb): Declare.
(cselib_reset_table_with_next_value): Declare.
(cselib_get_next_unknown_value): Declare.
(cselib_preserve_value): Declare.
(cselib_preserved_value_p): Declare.
(cselib_preserve_only_values): Declare.
(dump_cselib_table): Declare.
* cfgcleanup.c (flow_find_cross_jump): Skip debug insns.
(try_crossjump_to_edge): Likewise.
(delete_unreachable_blocks): Remove dominant GIMPLE blocks after
dominated blocks when debug stmts are present.
* simplify-rtx.c (delegitimize_mem_from_attrs): New.
* tree-ssa-live.c (remove_unused_locals): Skip debug stmts.
(set_var_live_on_entry): Likewise.
* loop-invariant.c (find_invariants_bb): Skip debug insns.
* cfglayout.c (curr_location, last_location): Make static.
(set_curr_insn_source_location): Don't avoid bouncing.
(get_curr_insn_source_location): New.
(get_curr_insn_block): New.
(duplicate_insn_chain): Handle debug insns.
* tree-ssa-forwprop.c (forward_propagate_addr_expr): Propagate
into debug stmts.
* common.opt (fcompare-debug): Move to sort order.
(fdump-unnumbered-links): Likewise.
(fvar-tracking-assignments): New.
(fvar-tracking-assignments-toggle): New.
* tree-ssa-dce.c (mark_stmt_necessary): Don't mark blocks
because of debug stmts.
(mark_stmt_if_obviously_necessary): Mark debug stmts.
(eliminate_unnecessary_stmts): Walk dominated blocks before
dominators.
* tree-ssa-ter.c (find_replaceable_in_bb): Skip debug stmts.
* ira.c (memref_used_between_p): Skip debug insns.
(update_equiv_regs): Likewise.
* sched-deps.c (sd_lists_size): Accept empty list.
(sd_init_insn): Mark debug insns.
(sd_finish_insn): Unmark them.
(sd_add_dep): Reject non-debug deps on debug insns.
(fixup_sched_groups): Give debug insns group treatment.
Skip debug insns.
(sched_analyze_reg): Don't mark debug insns for sched before call.
(sched_analyze_2): Handle debug insns.
(sched_analyze_insn): Compute next non-debug insn.  Handle debug
insns.
(deps_analyze_insn): Handle debug insns.
(deps_start_bb): Skip debug insns.
(init_deps): Initialize last_debug_insn.
* tree-ssa.c (target_for_debug_bind): New.
(find_released_ssa_name): New.
(propagate_var_def_into_debug_stmts): New.
(propagate_defs_into_debug_stmts): New.
(verify_ssa): Skip debug bind stmts without values.
(warn_uninialized_vars): Skip debug stmts.
* target-def.h (TARGET_DELEGITIMIZE_ADDRESS): Set default.
* rtl.c (rtx_equal_p_cb): Handle VALUEs.
(rtx_equal_p): Likewise.
* ira-costs.c (scan_one_insn): Skip debug insns.
(process_bb_node_for_hard_reg_moves): Likewise.
* rtl.h (DEBUG_INSN_P): New.
(NONDEBUG_INSN_P): New.
(MAY_HAVE_DEBUG_INSNS): New.
(INSN_P): Accept debug insns.
(RTX_FRAME_RELATED_P): Likewise.
(INSN_DELETED_P): Likewise
(PAT_VAR_LOCATION_DECL): New.
(PAT_VAR_LOCATION_LOC): New.
(PAT_VAR_OCATION_STATUS): New.
(NOTE_VAR_LOCATION_DECL): Reimplement.
(NOTE_VAR_LOCATION_LOC): Likewise.
(NOTE_VAR_LOCATION_STATUS): Likewise.
(INSN_VAR_LOCATION): New.
(INSN_VAR_LOCATION_DECL): New.
(INSN_VAR_LOCATION_LOC): New.
(INSN_VAR_LOCATION_STATUS): New.
(gen_rtx_UNKNOWN_VAR_LOC): New.
(VAR_LOC_UNKNOWN_P): New.
(NOTE_DURING_CALL_P): New.
(SCHED_GROUP_P): Accept debug insns.
(emit_debug_insn_before): Declare.
(emit_debug_insn_before_noloc): Declare.
(emit_debug_insn_beore_setloc): Declare.
(emit_debug_insn_after): Declare.
(emit_debug_insn_after_noloc): Declare.
(emit_debug_insn_after_setloc): Declare.
(emit_debug_insn): Declare.
(make_debug_insn_raw): Declare.
(prev_nondebug_insn): Declare.
(next_nondebug_insn): Declare.
(delegitimize_mem_from_attrs): Declare.
(get_max_insn_count): Declare.
(wrap_constant): Declare.
(unwrap_constant): Declare.
(get_curr_insn_source_location): Declare.
(get_curr_insn_block): Declare.
* tree-inline.c (insert_debug_decl_map): New.
(processing_debug_stmt): New.
(remap_decl): Don't create new mappings in debug stmts.
(remap_gimple_op_r): Don't add references in debug stmts.
(copy_tree_body_r): Likewise.
(remap_gimple_stmt): Handle debug bind stmts.
(copy_bb): Skip debug stmts.
(copy_edges_for_bb): Likewise.
(copy_debug_stmt): New.
(copy_debug_stmts): New.
(copy_body): Copy debug stmts at the end.
(insert_init_debug_bind): New.
(insert_init_stmt): Take id.  Skip and emit debug stmts.
(setup_one_parameter): Remap variable earlier, register debug
mapping.
(estimate_num_insns): Skip debug stmts.
(expand_call_inline): Preserve debug_map.
(optimize_inline_calls): Check for no debug_stmts left-overs.
(unsave_expr_now): Preserve debug_map.
(copy_gimple_seq_and_replace_locals): Likewise.
(tree_function_versioning): Check for no debug_stmts left-overs.
Init and destroy debug_map as needed.  Split edges unconditionally.
(build_duplicate_type): Init and destroy debug_map as needed.
* tree-inline.h: Include gimple.h instead of pointer-set.h.
(struct copy_body_data): Add debug_stmts and debug_map.
* sched-int.h (struct ready_list): Add n_debug.
(struct deps): Add last_debug_insn.
(DEBUG_INSN_SCHED_P): New.
(BOUNDARY_DEBUG_INSN_P): New.
(SCHEDULE_DEBUG_INSN_P): New.
(sd_iterator_cond): Accept empty list.
* combine.c (create_log_links): Skip debug insns.
(combine_instructions): Likewise.
(cleanup_auto_inc_dec): New.  From Jakub Jelinek: Make sure the
return value is always unshared.
(struct rtx_subst_pair): New.
(auto_adjust_pair): New.
(propagate_for_debug_subst): New.
(propagate_for_debug): New.
(try_combine): Skip debug insns.  Propagate removed defs into
debug insns.
(next_nonnote_nondebug_insn): New.
(distribute_notes): Use it.  Skip debug insns.
(distribute_links): Skip debug insns.
* tree-outof-ssa.c (set_location_for_edge): Likewise.
* resource.c (mark_target_live_regs): Likewise.
* var-tracking.c: Include cselib.h and target.h.
(enum micro_operation_type): Add MO_VAL_USE, MO_VAL_LOC, and
MO_VAL_SET.
(micro_operation_type_name): New.
(enum emit_note_where): Add EMIT_NOTE_AFTER_CALL_INSN.
(struct micro_operation_def): Update comments.
(decl_or_value): New type.  Use instead of decls.
(struct emit_note_data_def): Add vars.
(struct attrs_def): Use decl_or_value.
(struct variable_tracking_info_def): Add permp, flooded.
(struct location_chain_def): Update comment.
(struct variable_part_def): Use decl_or_value.
(struct variable_def): Make var_part a variable length array.
(valvar_pool): New.
(scratch_regs): New.
(cselib_hook_called): New.
(dv_is_decl_p): New.
(dv_is_value_p): New.
(dv_as_decl): New.
(dv_as_value): New.
(dv_as_opaque): New.
(dv_onepart_p): New.
(dv_pool): New.
(IS_DECL_CODE): New.
(check_value_is_not_decl): New.
(dv_from_decl): New.
(dv_from_value): New.
(dv_htab_hash): New.
(variable_htab_hash): Use it.
(variable_htab_eq): Support values.
(variable_htab_free): Free from the right pool.
(attrs_list_member, attrs_list_insert): Use decl_or_value.
(attrs_list_union): Adjust.
(attrs_list_mpdv_union): New.
(tie_break_pointers): New.
(canon_value_cmp): New.
(unshare_variable): Return possibly-modified slot.
(vars_copy_1): Adjust.
(var_reg_decl_set): Adjust.  Split out of...
(var_reg_set): ... this.
(get_init_value): Adjust.
(var_reg_delete_and_set): Adjust.
(var_reg_delete): Adjust.
(var_regno_delete): Adjust.
(var_mem_decl_set): Split out of...
(var_mem_set): ... this.
(var_mem_delete_and_set): Adjust.
(var_mem_delete): Adjust.
(val_store): New.
(val_reset): New.
(val_resolve): New.
(variable_union): Adjust.  Speed up merge of 1-part vars.
(variable_canonicalize): Use unshared slot.
(VALUED_RECURSED_INTO): New.
(find_loc_in_1pdv): New.
(struct dfset_merge): New.
(insert_into_intersection): New.
(intersect_loc_chains): New.
(loc_cmp): New.
(canonicalize_loc_order_check): New.
(canonicalize_values_mark): New.
(canonicalize_values_star): New.
(variable_merge_over_cur): New.
(variable_merge_over_src): New.
(dataflow_set_merge): New.
(dataflow_set_equiv_regs): New.
(remove_duplicate_values): New.
(struct dfset_post_merge): New.
(variable_post_merge_new_vals): New.
(variable_post_merge_perm_vals): New.
(dataflow_post_merge_adjust): New.
(find_mem_expr_in_1pdv): New.
(dataflow_set_preserve_mem_locs): New.
(dataflow_set_remove_mem_locs): New.
(dataflow_set_clear_at_call): New.
(onepart_variable_different_p): New.
(variable_different_p): Use it.
(dataflow_set_different_1): Adjust.  Make detailed dump
more verbose.
(track_expr_p): Add need_rtl parameter.  Don't generate rtl
if not needed.
(track_loc_p): Pass it true.
(struct count_use_info): New.
(find_use_val): New.
(replace_expr_with_values): New.
(log_op_type): New.
(use_type): New, partially split out of...
(count_uses): ... this.  Count new micro-ops.
(count_uses_1): Adjust.
(count_stores): Adjust.
(count_with_sets): New.
(VAL_NEEDS_RESOLUTION): New.
(VAL_HOLDS_TRACK_EXPR): New.
(VAL_EXPR_IS_COPIED): New.
(VAL_EXPR_IS_CLOBBERED): New.
(add_uses): Adjust.  Generate new micro-ops.
(add_uses_1): Adjust.
(add_stores): Generate new micro-ops.
(add_with_sets): New.
(find_src_status): Adjust.
(find_src_set_src): Adjust.
(compute_bb_dataflow): Use dataflow_set_clear_at_call.
Handle new micro-ops.  Canonicalize value equivalances.
(vt_find_locations): Compute total size of hash tables for
dumping.  Perform merge for var-tracking-assignments.  Don't
disregard single-block loops.
(dump_attrs_list): Handle decl_or_value.
(dump_variable): Take variable.  Deal with decl_or_value.
(dump_variable_slot): New.
(dump_vars): Use it.
(dump_dataflow_sets): Adjust.
(set_slot_part): New, extended to support one-part variables
after splitting out of...
(set_variable_part): ... this.
(clobber_slot_part): New, split out of...
(clobber_variable_part): ... this.
(delete_slot_part): New, split out of...
(delete_variable_part): .... this.
(check_wrap_constant): New.
(vt_expand_loc_callback): New.
(vt_expand_loc): New.
(emit_note_insn_var_location): Adjust.  Handle values.  Handle
EMIT_NOTE_AFTER_CALL_INSN.
(emit_notes_for_differences_1): Adjust.  Handle values.
(emit_notes_for_differences_2): Likewise.
(emit_notes_for_differences): Adjust.
(emit_notes_in_bb): Take pointer to set.  Emit AFTER_CALL_INSN
notes.  Adjust.  Handle new micro-ops.
(vt_add_function_parameters): Adjust.  Create and bind values.
(vt_initialize): Adjust.  Initialize scratch_regs and
valvar_pool, flooded and perm..  Initialize and use cselib.  Log
operations.  Move some code to count_with_sets and add_with_sets.
(delete_debug_insns): New.
(vt_debug_insns_local): New.
(vt_finalize): Release permp, valvar_pool, scratch_regs.  Finish
cselib.
(var_tracking_main): If var-tracking-assignments is enabled
but var-tracking isn't, delete debug insns and leave.  Likewise
if we exceed limits or fail the stack adjustments tests, and
after all var-tracking processing.
More in var-tracking, from Jakub Jelinek <jakub@redhat.com>:
(dataflow_set): Add traversed_vars.
(value_chain, const_value_chain): New typedefs.
(value_chain_pool, value_chains): New variables.
(value_chain_htab_hash, value_chain_htab_eq, add_value_chain,
add_value_chains, add_cselib_value_chains, remove_value_chain,
remove_value_chains, remove_cselib_value_chains): New functions.
(shared_hash_find_slot_unshare_1, shared_hash_find_slot_1,
shared_hash_find_slot_noinsert_1, shared_hash_find_1): New
static inlines.
(shared_hash_find_slot_unshare, shared_hash_find_slot,
shared_hash_find_slot_noinsert, shared_hash_find): Update.
(dst_can_be_shared): New variable.
(unshare_variable): Unshare set->vars if shared, use shared_hash_*.
Clear dst_can_be_shared.  If set->traversed_vars is non-NULL and
different from set->vars, look up slot again instead of using the
passed in slot.
(dataflow_set_init): Initialize traversed_vars.
(variable_union): Use shared_hash_*.  Use initially NO_INSERT
lookup if set->vars is shared.  Don't keep slot cleared before
calling unshare_variable.  Unshare set->vars if needed.  Adjust
unshare_variable callers.  Clear dst_can_be_shared if needed.
Even ->refcount == 1 vars must be unshared if set->vars is shared
and var needs to be modified.
(dataflow_set_union): Set traversed_vars during canonicalization.
(VALUE_CHANGED, DECL_CHANGED): Define.
(set_dv_changed, dv_changed_p): New static inlines.
(track_expr_p): Clear DECL_CHANGED.
(dump_dataflow_sets): Set it.
(variable_was_changed): Call set_dv_changed.
(emit_note_insn_var_location): Likewise.
(changed_variables_stack): New variable.
(check_changed_vars_1, check_changed_vars_2): New functions.
(emit_notes_for_changes): Do nothing if changed_variables is
empty.  Traverse changed_variables with check_changed_vars_1,
call check_changed_vars_2 on each changed_variables_stack entry.
(emit_notes_in_bb): Add SET argument.  Just clear it at the
beginning, use it instead of local &set, don't destroy it at the
end.
(vt_emit_notes): Call dataflow_set_clear early on all
VTI(bb)->out sets, never use them, instead use emit_notes_in_bb
computed set, dataflow_set_clear also VTI(bb)->in when we are
done with the basic block.  Initialize changed_variables_stack,
free it afterwards.  If ENABLE_CHECKING verify that after noting
differences to an empty set value_chains hash table is empty.
(vt_initialize): Initialize value_chains and value_chain_pool.
(vt_finalize): Delete value_chains htab, free value_chain_pool.
(variable_tracking_main): Call dump_dataflow_sets before calling
vt_emit_notes, not after it.
* tree-flow.h (propagate_defs_into_debug_stmts): Declare.
(propagate_var_def_into_debug_stmts): Declare.
* df-problems.c (df_lr_bb_local_compute): Skip debug insns.
(df_set_note): Reject debug insns.
(df_whole_mw_reg_dead_p): Take added_notes_p argument.  Don't
add notes to debug insns.
(df_note_bb_compute): Adjust.  Likewise.
(df_simulate_uses): Skip debug insns.
(df_simulate_initialize_backwards): Likewise.
* reg-stack.c (subst_stack_regs_in_debug_insn): New.
(subst_stack_regs_pat): Reject debug insns.
(convert_regs_1): Handle debug insns.
* Makefile.in (TREE_INLINE_H): Take pointer-set.h from GIMPLE_H.
(print-rtl.o): Depend on cselib.h.
(cselib.o): Depend on TREE_PASS_H.
(var-tracking.o): Depend on cselib.h and TARGET_H.
* sched-rgn.c (rgn_estimate_number_of_insns): Discount
debug insns.
(init_ready_list): Skip boundary debug insns.
(add_branch_dependences): Skip debug insns.
(free_block_dependencies): Check for blocks with only debug
insns.
(compute_priorities): Likewise.
* gimple.c (gss_for_code): Handle GIMPLE_DEBUG.
(gimple_build_with_ops_stat): Take subcode as unsigned.  Adjust
all callers.
(gimple_build_debug_bind_stat): New.
(empty_body_p): Skip debug stmts.
(gimple_has_side_effects): Likewise.
(gimple_rhs_has_side_effects): Likewise.
* gimple.h (enum gimple_debug_subcode, GIMPLE_DEBUG_BIND): New.
(gimple_build_debug_bind_stat): Declare.
(gimple_build_debug_bind): Define.
(is_gimple_debug): New.
(gimple_debug_bind_p): New.
(gimple_debug_bind_get_var): New.
(gimple_debug_bind_get_value): New.
(gimple_debug_bind_get_value_ptr): New.
(gimple_debug_bind_set_var): New.
(gimple_debug_bind_set_value): New.
(GIMPLE_DEBUG_BIND_NOVALUE): New internal temporary macro.
(gimple_debug_bind_reset_value): New.
(gimple_debug_bind_has_value_p): New.
(gsi_next_nondebug): New.
(gsi_prev_nondebug): New.
(gsi_start_nondebug_bb): New.
(gsi_last_nondebug_bb): New.
* sched-vis.c (print_pattern): Handle VAR_LOCATION.
(print_insn): Handle DEBUG_INSN.
* tree-cfg.c (remove_bb): Walk stmts backwards.  Let loc
of first insn prevail.
(first_stmt): Skip debug stmts.
(first_non_label_stmt): Likewise.
(last_stmt): Likewise.
(has_zero_uses_1): New.
(single_imm_use_1): New.
(verify_gimple_debug): New.
(verify_types_in_gimple_stmt): Handle debug stmts.
(verify_stmt): Likewise.
(debug_loop_num): Skip debug stmts.
(remove_edge_and_dominated_blocks): Remove dominators last.
* tree-ssa-reasssoc.c (rewrite_expr_tree): Propagate into
debug stmts.
(linearize_expr): Likewise.
* config/i386/i386.c (ix86_delegitimize_address): Call
default implementation.
* config/ia64/ia64.c (ia64_safe_itanium_class): Handle debug
insns.
(group_barrier_needed): Skip debug insns.
(emit_insn_group_barriers): Likewise.
(emit_all_insn_group_barriers): Likewise.
(ia64_variable_issue): Handle debug insns.
(ia64_dfa_new_cycle): Likewise.
(final_emit_insn_group_barriers): Skip debug insns.
(ia64_dwarf2out_def_steady_cfa): Take frame argument.  Don't
def cfa without frame.
(process_set): Likewise.
(process_for_unwind_directive): Pass frame on.
* config/rs6000/rs6000.c (TARGET_DELEGITIMIZE_ADDRESS): Define.
(rs6000_delegitimize_address): New.
(rs6000_debug_adjust_cost): Handle debug insns.
(is_microcoded_insn): Likewise.
(is_cracked_insn): Likewise.
(is_nonpipeline_insn): Likewise.
(insn_must_be_first_in_group): Likewise.
(insn_must_be_last_in_group): Likewise.
(force_new_group): Likewise.
* cfgrtl.c (rtl_split_block): Emit INSN_DELETED note if block
contains only debug insns.
(rtl_merge_blocks): Skip debug insns.
(purge_dead_edges): Likewise.
(rtl_block_ends_with_call_p): Skip debug insns.
* dce.c (deletable_insn_p): Handle VAR_LOCATION.
(mark_reg_dependencies): Skip debug insns.
* params.def (PARAM_MIN_NONDEBUG_INSN_UID): New.
* tree-ssanames.c (release_ssa_name): Propagate def into
debug stmts.
* tree-ssa-threadedge.c
(record_temporary_equivalences_from_stmts): Skip debug stmts.
* regcprop.c (replace_oldest_value_addr): Skip debug insns.
(replace_oldest_value_mem): Use ALL_REGS for debug insns.
(copyprop_hardreg_forward_1): Handle debug insns.
* reload1.c (reload): Skip debug insns.  Replace unassigned
pseudos in debug insns with their equivalences.
(eliminate_regs_in_insn): Skip debug insns.
(emit_input_reload_insns): Skip debug insns at first, adjust
them later.
* tree-ssa-operands.c (add_virtual_operand): Reject debug stmts.
(get_indirect_ref_operands): Pass opf_no_vops on.
(get_expr_operands): Likewise.  Skip debug stmts.
(parse_ssa_operands): Scan debug insns with opf_no_vops.
gcc/testsuite/ChangeLog:
* gcc.dg/guality/guality.c: New.
* gcc.dg/guality/guality.h: New.
* gcc.dg/guality/guality.exp: New.
* gcc.dg/guality/example.c: New.
* lib/gcc-dg.exp (cleanup-dump): Remove .gk files.
(cleanup-saved-temps): Likewise, .gkd files too.
gcc/cp/ChangeLog:
* cp-tree.h (TFF_NO_OMIT_DEFAULT_TEMPLATE_ARGUMENTS): New.
* cp-lang.c (cxx_dwarf_name): Pass it.
* error.c (count_non_default_template_args): Take flags as
argument.  Adjust all callers.  Skip counting of default
arguments if the new flag is given.
ChangeLog:
* Makefile.tpl (BUILD_CONFIG): Default to bootstrap-debug.
* Makefile.in: Rebuilt.
contrib/ChangeLog:
* compare-debug: Look for .gkd files and compare them.
config/ChangeLog:
* bootstrap-debug.mk: Add comments.
* bootstrap-debug-big.mk: New.
* bootstrap-debug-lean.mk: New.
* bootstrap-debug-ckovw.mk: Add comments.
* bootstrap-debug-lib.mk: Drop CFLAGS for stages.  Use -g0
for TFLAGS in stage1.  Drop -fvar-tracking-assignments-toggle.

From-SVN: r151312
2009-09-02 02:42:21 +00:00
Uros Bizjak 2b3b22d35e re PR rtl-optimization/40861 (ICE in simplify_subreg, at simplify-rtx.c:4981)
PR rtl-optimization/40861
	* simplify-rtx.c (simplify_subreg): Do not call simplify_gen_subreg to
	extract word from a multi-word subreg for negative byte positions.

testsuite/ChangeLog:

	PR rtl-optimization/40861
	* gcc.dg/pr40861.c: New test.

From-SVN: r151149
2009-08-27 22:54:28 +02:00
Janis Johnson 50cd60be11 re PR c/39902 (x * 1.0DF gets wrong value)
PR c/39902
	* simplify-rtx.c (simplify_binary_operation_1): Disable
	simplifications for decimal float operations.

	PR c/39902
	* gcc.target/powerpc/pr39902-2.c: New test.

From-SVN: r150383
2009-08-03 21:38:53 +00:00
Adam Nemet fcaf7e1250 simplify-rtx.c (simplify_binary_operation_1): Transform (and (truncate)) into (truncate (and)).
* simplify-rtx.c (simplify_binary_operation_1) <AND>: Transform (and
        (truncate)) into (truncate (and)).

testsuite/
	* gcc.target/mips/truncate-5.c: New test.

From-SVN: r149402
2009-07-09 05:43:56 +00:00
Shujing Zhao 481683e1d5 alias.c: Use REG_P...
2009-06-22  Shujing Zhao  <pearly.zhao@oracle.com>

	* alias.c: Use REG_P, MEM_P, CONST_INT_P, LABEL_P, CALL_P, NOTE_P and
	JUMP_TABLE_DATA_P predicates where applicable.
	* auto-inc-dec.c: Ditto.
	* builtins.c: Ditto.
	* caller-save.c: Ditto.
	* calls.c: Ditto.
	* cfgcleanup.c: Ditto.
	* cfglayout.c: Ditto.
	* cfgrtl.c: Ditto.
	* combine.c: Ditto.
	* combine-stack-adj.c: Ditto.
	* cse.c: Ditto.
	* cselib.c: Ditto.
	* dbxout.c: Ditto.
	* df-scan.c: Ditto.
	* dse.c: Ditto.
	* dwarf2asm.c: Ditto.
	* dwarf2out.c: Ditto.
	* emit-rtl.c: Ditto.
	* except.c: Ditto.
	* explow.c: Ditto.
	* expmed.c: Ditto.
	* expr.c: Ditto.
	* final.c: Ditto.
	* function.c: Ditto.
	* fwprop.c: Ditto.
	* gcse.c: Ditto.
	* genpreds.c: Ditto.
	* genrecog.c: Ditto.
	* ifcvt.c: Ditto.
	* ira-costs.c: Ditto.
	* ira-lives.c: Ditto.
	* jump.c: Ditto.
	* loop-iv.c: Ditto.
	* lower-subreg.c: Ditto.
	* modulo-sched.c: Ditto.
	* optabs.c: Ditto.
	* postreload.c: Ditto.
	* print-rtl.c: Ditto.
	* recog.c: Ditto.
	* reginfo.c: Ditto.
	* regmove.c: Ditto.
	* reload1.c: Ditto.
	* reload.c: Ditto.
	* reorg.c: Ditto.
	* rtlanal.c: Ditto.
	* rtl.c: Ditto.
	* sched-vis.c: Ditto.
	* sdbout.c: Ditto.
	* sel-sched-ir.c: Ditto.
	* simplify-rtx.c: Ditto.
	* targhooks.c: Ditto.
	* var-tracking.c: Ditto.
	* vmsdbgout.c: Ditto.

From-SVN: r148786
2009-06-22 10:29:13 +00:00
Paolo Bonzini f90b7a5a79 Merge cond-optab branch.
From-SVN: r147425
2009-05-12 09:43:48 +00:00
Bernd Schmidt f5a17c436d simplify-rtx.c (simplify_binary_operation_1, case AND): Result is zero if no overlap in nonzero bits between the operands.
* simplify-rtx.c (simplify_binary_operation_1, case AND): Result is
	zero if no overlap in nonzero bits between the operands.

From-SVN: r146738
2009-04-24 16:19:36 +00:00
Bernd Schmidt 1d1eb80cf6 simplify-rtx.c (simplify_relational_operation_1): Simplify (LTU (PLUS a C) C) or (LTU (PLUS a C) a) to (GEU a -C)...
* simplify-rtx.c (simplify_relational_operation_1): Simplify
	(LTU (PLUS a C) C) or (LTU (PLUS a C) a) to (GEU a -C); likewise with
	GEU/LTU reversed.

From-SVN: r145353
2009-03-31 15:19:33 +00:00
Jakub Jelinek 66647d441f Update Copyright years for files modified in 2008 and/or 2009.
From-SVN: r144324
2009-02-20 16:20:38 +01:00
Zdenek Dvorak dc5b3407f2 re PR rtl-optimization/32283 (Missed induction variable optimization)
PR rtl-optimization/32283
	* tree-ssa-loop-niter.c (scev_probably_wraps_p): Use type of the base
	of the induction variable to decide whether it may wrap.
	* tree-ssa-loop-ivopts.c (rewrite_use_compare): Emit the initialization
	of the bound before the loop.
	* simplify-rtx.c (simplify_binary_operation_1): Add two simplifications
	regarding AND.
	(simplify_plus_minus): Only fail if no simplification is possible.
	* loop-iv.c (simple_rhs_p): Consider reg + reg and reg << cst simple.

From-SVN: r142035
2008-11-20 08:05:12 +00:00
Richard Sandiford 2f1e2391d8 re PR rtl-optimization/37363 (Fix for PR 36090 causes libstdc++ regressions)
gcc/
	PR rtl-optimization/37363
	* simplify-rtx.c (simplify_plus_minus): Don't create (const (minus ...))
	expresisons.

From-SVN: r141774
2008-11-11 23:23:23 +00:00
Richard Sandiford dd59ef130e simplify-rtx.c (simplify_binary_operation_1): Check for CONST...
gcc/
	* simplify-rtx.c (simplify_binary_operation_1): Check for CONST,
	SYMBOL_REF and LABEL_REF when applying plus_constant, instead of
	checking for a non-VOID CONSTANT_P.

From-SVN: r139903
2008-09-02 18:39:32 +00:00
Jan Hubicka f40751dd34 fwprop.c (should_replace_address): Add speed attribute.
* fwprop.c (should_replace_address): Add speed attribute.
	(PR_OPTIMIZE_FOR_SPEED): New flag.
	(propagate_rtx_1): Use it.
	(propagate_rtx): Set it.
	(try_fwprop_subst): Update call of rtx_costs.
	(forward_propagate_and_simplify): LIkewise.
	* hooks.c (hook_int_rtx_bool_0): New
	(hook_bool_rtx_int_int_intp_false): Replace by ...
	(hook_bool_rtx_int_int_intp_bool_false): .. thisone.
	* hooks.h (hook_int_rtx_bool_0): New
	(hook_bool_rtx_int_int_intp_false): Replace by ...
	(hook_bool_rtx_int_int_intp_bool_false): .. thisone.
	* optabs.c (avoid_expensive_constant): UPdate call of rtx_cost.
	(prepare_cmp_insn): UPdate call of rtx_cost.
	* postreload.c (reload_cse_simplify_set): Update call of rtx_cost.
	(reload_cse_simplify_operands): Update call of rtx_cost.
	(reload_cse_move2add): call of rtx_cost.
	* target.h (struct gcc_target): Update rtx_costs and address_costs.
	* rtlanal.c (rtx_cost): Add speed argument.
	(address_cost): Add speed argument
	(default_address_cost): Likewise.
	(insn_rtx_cost): Likewise.
	* cfgloopanal.c (seq_cost): Add speed argument.
	(target_reg_cost, target_spill_cost): Turn to array.
	(init_set_costs): Update for speed.
	(estimate_reg_pressure_cost): Add speed argument.
	* auto-inc-dec.c (attempt_change): Update call of rtx_cost.
	* dojump.c (prefer_and_bit_test): UPdate call of rtx_cost.
	* tree-ssa-loop-ivopts.c (struct ivopts_data): New field speed.
	(seq_cost): Add speed argument.
	(computation_cost): Add speed arugment.
	(add_cost, multiply_by_const, get_address_cost): add speed argument.
	(force_expr_to_var_cost): Update for profile info.
	(force_var_cost): Likewise.
	(split_address_cost): Likewise.
	(ptr_difference_cost): Likewise.
	(difference_cost): Likewise.
	(get_computation_cost_at): Likewise.
	(determine_iv_cost): Likewise.
	(ivopts_global_cost_for_size): Likewise.
	(rewrite_use_address): Likewise.
	(tree_ssa_iv_optimize_loop): Initialize speed field.
	* cse.c (optimize_this_for_speed_p): New static var.
	(notreg_cost): Update call of rtx_cost.
	(cse_extended_basic_block): set optimize_this_for_speed_p.
	* ifcvt.c (cheap_bb_rtx_cost_p): Update call of rtx_cost.
	(noce_try_cmove_arith): Likewise.
	(noce_try_sign_mask): LIkewise.
	* expr.c (compress_float_constant): Update rtx_cost calls.
	* tree-ssa-address.c (most_expensive_mult_to_index): Add speed argument.
	(addr_to_parts): Likewise.
	(create_mem_ref): Likewise.
	* dse.c (find_shift_sequence): Add speed argument.
	(replace_read): Update call.
	* calls.c (precompute_register_parameters): Update call of rtx_cost.
	* expmed.c (sdiv_pow2_cheap, smod_pow2_cheap, zero_cost, add_cost,
	* neg_cost, shift_cost, shiftadd_cost,
	shiftsub_cost, mul_cost, sdiv_cost, udiv_cost ,mul_widen_cost,
	mul_highpart_cost): Increase dimension.
	(init_expmed): Initialize for both size and speed.
	(expand_shift): Use profile.
	(synth_mult): Use profile.
	(choose_mult_variant): Use profile.
	(expand_mult): Use profile.
	(expand_mult_highpart_optab): Use profile.
	(expand_mult_highpart): Use profile.
	(expand_smod_pow2): Use profile.
	(expand_divmod): Use profile.
	* simplify-rtx.c (simplify_binary_operation_1): Update call of rtx_cost.
	* loop-invariant.c (create_new_invariant): Use profile.
	(gain_for_invariant): Add speed parameter.
	(best_gain_for_invariant): Likewise.
	(find_invariants_to_move): Likewise.
	(move_single_loop_invariants): Set it.
	* target-def.h (TARGET_RTX_COSTS): Use hook.
	* rtl.h (rtx_cost, address_cost, insn_rtx_cost): Update prototpe.
	(optimize_insn_for_size_p, optimize_insn_for_speed_p): Declare.
	* output.h (default_address_cost): Update prototype.
	* combine.c (optimize_this_for_speed_p): New static var.
	(combine_validate_cost): Update call of rtx_cost.
	(combine_instructions): Set optimize_this_for_speed_p.
	(expand_compound_operation): Update call of rtx_cost.
	(make_extraction):Update call of rtx_cost.
	(force_to_mode):Update call of rtx_cost.
	(distribute_and_simplify_rtx):Update call of rtx_cost.
	* cfgloop.h (target_reg_cost, target_spill_cost): Turn to array.
	(estimate_reg_pressure_cost): Update prototype.
	* tree-flow.h (multiply_by_cost, create_mem_ref): Update prototype.
	* basic-block.h (optimize_insn_for_size_p, optimize_insn_for_speed_p):
	Remove.
	* config/alpha/alpha.c (alpha_rtx_costs): Update.
	(alpha_rtx_costs): Update.
	* config/frv/frv.c (frv_rtx_costs): Update.
	* config/s390/s390.c (s390_rtx_costs): Update.
	* config/m32c/m32c.c (m32c_memory_move_cost): Update.
	(m32c_rtx_costs): Update.
	* config/spu/spu.c (TARGET_ADDRESS_COST): Upate.
	(spu_rtx_costs): Update.
	* config/sparc/sparc.c (sparc_rtx_costs): Update.
	* config/m32r/m32r.c (m32r_rtx_costs): Update.
	* config/i386/i386.c (:ix86_address_cost): Update.
	(ix86_rtx_costs): Update.
	* config/sh/sh.c (sh_rtx_costs, sh_address_cost): Update.
	* config/pdp11/pdp11.c (pdp11_rtx_costs): Update.
	* config/avr/avr.c (avr_rtx_costs, avr_address_cost): Update.
	* config/crx/crx.c (crx_address_cost): Update.
	* config/xtensa/xtensa.c (xtensa_rtx_costs): Update.
	* config/stormy16/stormy16.c
	(xstormy16_address_cost, xstormy16_rtx_costs): Update.
	* config/m68hc11/m68hc11.c
	(m68hc11_address_cost, m68hc11_rtx_costs): Update.
	* config/cris/cris.c (cris_rtx_costs, cris_address_cost): Update.
	* config/iq2000/iq2000.c (iq2000_rtx_costs, iq2000_address_cost): Update.
	* config/mn10300/mn10300.c (mn10300_address_cost, mn10300_rtx_costs): Update
	* config/ia64/ia64.c (ia64_rtx_costs): Update.
	* config/m68k/m68k.c (m68k_rtx_costs): Update.
	* config/rs6000/rs6000.c (rs6000_rtx_costs): Update.
	* config/arc/arc.c (arc_rtx_costs, arc_address_cost): Update.
	* config/mcore/mcore.c (TARGET_ADDRESS_COST): Update.
	(mcore_rtx_costs): update.
	* config/score/score3.c (score3_rtx_costs): Update.
	* config/score/score7.c (score7_rtx_costs): Update.
	* config/score/score3.h (score3_rtx_costs):Update.
	* config/score/score7.h (score7_rtx_costs): Update.
	* config/score/score.c (score_rtx_costs): Update.
	* config/arm/arm.c (arm_address_cost): Update.
	(arm_rtx_costs_1): Update.
	(arm_rtx_costs_1): Update.
	(arm_size_rtx_costs): Update.
	(arm_size_rtx_costs): Update.
	(arm_size_rtx_costs): Update.
	(arm_xscale_rtx_costs): Update.
	(arm_thumb_address_cost): Update.
	* config/pa/pa.c (hppa_address_cost): Update.
	* config/mips/mips.c (mips_rtx_costs): Update.
	* config/vax/vax.c (vax_address_cost): Update.
	* config/h8300/h8300.c (h8300_shift_costs): Update.
	(h8300_rtx_costs): Update.
	* config/v850/v850.c (TARGET_ADDRESS_COST): Update.
	(v850_rtx_costs): Update.
	* config/mmix/mmix.c (mmix_rtx_costs, mmix_rtx_costs): Update.
	* config/bfin/bfin.c
	(bfin_address_cost): Update.
	(bfin_rtx_costs): Update.
	* stmt.c (lshift_cheap_p): Update.

From-SVN: r139821
2008-08-31 09:44:25 +00:00
Richard Sandiford eef302d277 rtl.h (simplify_subreg_regno): Declare.
gcc/
	* rtl.h (simplify_subreg_regno): Declare.
	* rtlanal.c (simplify_subreg_regno): New function, split out from...
	* simplify-rtx.c (simplify_subreg): ...here.
	* reload.c (find_reloads): Use simplify_subreg_regno instead of
	subreg_offset_representable_p.

From-SVN: r139736
2008-08-28 20:02:54 +00:00
Ulrich Weigand b89723546a defaults.h (TARGET_FLOAT_FORMAT): Remove.
ChangeLog:

	* defaults.h (TARGET_FLOAT_FORMAT): Remove.
	(UNKNOWN_FLOAT_FORMAT, IEEE_FLOAT_FORMAT, VAX_FLOAT_FORMAT): Remove.

	* config/alpha/alpha.h (TARGET_FLOAT_FORMAT): Remove.
	* config/iq2000/iq2000.h (TARGET_FLOAT_FORMAT): Remove.
	* config/pdp11/pdp11.h (TARGET_FLOAT_FORMAT): Remove.
	* config/score/score.h (TARGET_FLOAT_FORMAT): Remove.
	* config/vax/vax.h (TARGET_FLOAT_FORMAT): Remove.

	* doc/tm.texi (Storage Layout): Remove documentation for
	TARGET_FLOAT_FORMAT.

	* simplify-rtx.c (simplify_binary_operation_1): Replace
	TARGET_FLOAT_FORMAT check by appropriate HONOR_... checks.

java/ChangeLog:

	* typeck.c (convert): Do not check for TARGET_FLOAT_FORMAT.

From-SVN: r139017
2008-08-12 13:27:30 +00:00
Ulrich Weigand 4099e2c2bb real.h (struct real_format): New member has_sign_dependent_rounding.
* real.h (struct real_format): New member has_sign_dependent_rounding.
	* real.c (ieee_single_format, mips_single_format, motorola_single_format,
	spu_single_format, ieee_double_format, mips_double_format,
	motorola_double_format, ieee_extended_motorola_format,
	ieee_extended_intel_96_format, ieee_extended_intel_128_format,
	ieee_extended_intel_96_round_53_format, ibm_extended_format,
	mips_extended_format, ieee_quad_format, mips_quad_format,
	vax_f_format, vax_d_format, vax_g_format): Initialize it.
	* config/pdp11/pdp11.c (pdp11_f_format, pdp11_d_format): Likewise.

	* defaults.h (MODE_HAS_NANS, MODE_HAS_INFINITIES,
	MODE_HAS_SIGNED_ZEROS, MODE_HAS_SIGN_DEPENDENT_ROUNDING): Remove.
	* config/spu/spu.h (MODE_HAS_NANS, MODE_HAS_INFINITIES,
	MODE_HAS_SIGN_DEPENDENT_ROUNDING): Remove.
	(ROUND_TOWARDS_ZERO): Likewise.

	* real.h (REAL_MODE_FORMAT): Protect MODE against macro expansion.
	(FLOAT_MODE_FORMAT): New macro.
	(REAL_MODE_FORMAT_COMPOSITE_P): Remove, replace by ...
	(MODE_COMPOSITE_P): ... this new macro.
	(MODE_HAS_NANS, MODE_HAS_INFINITIES, MODE_HAS_SIGNED_ZEROS,
	MODE_HAS_SIGN_DEPENDENT_ROUNDING): New macros.
	* machmode.h (GET_MODE_INNER): Cast result to enum machine_mode.

	* flags.h: Include "real.h".

	* fold-const.c (const_binop): Use MODE_COMPOSITE_P instead of
	REAL_MODE_FORMAT_COMPOSITE_P.
	* simplify-rtx.c (simplify_const_binary_operation): Likewise.

	* doc/tm.texi (Storage Layout): Remove documentation of
	MODE_HAS_NANS, MODE_HAS_INFINITIES, MODE_HAS_SIGNED_ZEROS,
	MODE_HAS_SIGN_DEPENDENT_ROUNDING.  Update documentation of
	ROUND_TOWARDS_ZERO and LARGEST_EXPONENT_IS_NORMAL to clarify
	they only apply to libgcc2.a.

From-SVN: r139016
2008-08-12 13:25:22 +00:00
Andy Hutchinson 3115c00d85 re PR middle-end/36447 (simplify_subreg ICE with right shift more than length type AVR)
PR middle-end/36447
* simplify-rtx.c (simplify_subreg): Add check for shift count greater than size.

From-SVN: r136602
2008-06-09 22:38:34 +00:00
Paolo Bonzini 627ab8616c re PR target/36090 (ppc64 cacoshl miscompilation)
2008-05-08  Paolo Bonzini  <bonzini@gnu.org>

        PR target/36090
        * simplify-rtx.c (simplify_plus_minus): Create CONST of
        similar RTX_CONST_OBJ before CONST_INT.

From-SVN: r135086
2008-05-08 12:35:56 -04:00
Paolo Bonzini 97efb03aed simplify-rtx.c (simplify_subreg): Remove useless shifts from word-extractions out of a multi-word object.
2008-03-06  Paolo Bonzini  <bonzini@gnu.org>

	* simplify-rtx.c (simplify_subreg): Remove useless shifts from
	word-extractions out of a multi-word object.

From-SVN: r132971
2008-03-06 13:30:10 +00:00
Richard Sandiford 4613543f82 simplify-rtx.c (simplify_unary_operation_1): Extend the handling of SUBREG_PROMOTED_VAR_P to cope with cases where the...
gcc/
	* simplify-rtx.c (simplify_unary_operation_1): Extend the handling
	of SUBREG_PROMOTED_VAR_P to cope with cases where the extended value
	is smaller than the original promoted value.
	(simplify_subreg): If OP is a SUBREG, try to preserve its
	SUBREG_PROMOTED_VAR_P information.

From-SVN: r132755
2008-02-28 20:02:09 +00:00
Andrew Pinski f79db4f66e re PR tree-optimization/33512 (Simple bitwise simplification missed)
2008-02-23  Andrew Pinski  <andrew_pinski@playstation.sony.com>

        PR rtl-opt/33512
        * simplify-rtx.c (simplify_binary_operation_1): Add simplification
        of (and X (ior (not X) Y) and (and (ior (not X) Y) X).

2008-02-23  Andrew Pinski  <andrew_pinski@playstation.sony.com>

        PR rtl-opt/33512
        * gcc.dg/and-1.c: New test.

From-SVN: r132575
2008-02-23 09:58:48 -08:00
Uros Bizjak d1f0728e65 re PR target/34856 (ICE with some constant vectors)
PR target/34856
	* simplifx-rtx.c (simplify_const_binary_operation) [VEC_CONCAT]:
	Consider only CONST_INT, CONST_DOUBLE and CONST_FIXED as constant
	vector elements.

testsuite/ChangeLog:

	PR target/34856
	* gcc.dg/pr34856.c: Use pointer mode for "pin".

From-SVN: r131821
2008-01-25 11:25:21 +01:00
Jakub Jelinek dc7c279e97 re PR rtl-optimization/34490 (r128833 causes miscompilation of glibc clock_gettime.c)
PR rtl-optimization/34490
	* simplify-rtx.c (simplify_const_relational_operation): If !sign,
	don't reduce mmin/mmax using num_sign_bit_copies.

	* gcc.c-torture/execute/20071216-1.c: New test.

From-SVN: r131023
2007-12-18 01:13:29 +01:00
Richard Sandiford cbc9503d78 simplify-rtx.c (simplify_binary_operation_1): Canonicalize truncated shift counts.
gcc/
	* simplify-rtx.c (simplify_binary_operation_1): Canonicalize
	truncated shift counts.

From-SVN: r129072
2007-10-07 18:40:02 +00:00
Paolo Bonzini a567207e71 simplify-rtx.c (comparison_result, [...]): Rename CR_* constants to CMP_*.
2007-10-01  Paolo Bonzini  <bonzini@gnu.org>

	* simplify-rtx.c (comparison_result, simplify_relational_operation_1):
	Rename CR_* constants to CMP_*.  Fix spacing.

From-SVN: r128906
2007-10-01 15:14:29 +00:00
Paolo Bonzini 3964148968 simplify-rtx.c (comparison_result): New.
2007-09-04  Paolo Bonzini  <bonzini@gnu.org>

	* simplify-rtx.c (comparison_result): New.
	(simplify_const_relational_operation): Use it instead of the five
	"equal|op[01]ltu?" variables; consequently remove redundant "else"s.
	Improve bounds-checking optimizations; remove subsumed POPCOUNT
	optimizations.  Extract nonzero_address_p optimizations into a
	separate "if" together with optimizations where op1 is const0_rtx.
	Optimize comparing an IOR with zero.  Simplify op0 RELOP op0 for
	floating-point arguments too when appropriate.  Hoist test for ABS
	outside the final switch statement.
	* cse.c (fold_rtx): Don't look for an IOR equivalent of
	folded_arg0 if we found a constant equivalent.	Remove
	transformations done in simplify-rtx.c for "op0 RELOP op0".

From-SVN: r128833
2007-09-27 11:29:10 +00:00
Hans-Peter Nilsson cf369845fd simplify-rtx.c (simplify_relational_operation_1): For recent canonicalization, don't recurse if op1 equals both PLUS arguments.
* simplify-rtx.c (simplify_relational_operation_1): For recent
	canonicalization, don't recurse if op1 equals both PLUS arguments.

From-SVN: r128323
2007-09-10 07:30:16 +00:00
Rask Ingemann Lambertsen 921c44189a re PR target/30315 (optimize unsigned-add overflow test on x86 to use cpu flags from addl)
PR target/30315
	* config/i386/i386.h (CANONICALIZE_COMPARISON): Delete.
	* simplify-rtx.c (simplify_relational_operation_1): Add the
	canonicalization from i386.h.
	* doc/md.texi (Canonicalization of Instructions): Document it.

From-SVN: r128305
2007-09-09 19:21:59 +00:00
Revital Eres a1a8261107 Add new fp flags: -fassociative-math and -freciprocal-math
Co-Authored-By: R. Clint Whaley <whaley@cs.utsa.edu>
Co-Authored-By: Richard Guenther <rguenther@suse.de>

From-SVN: r128075
2007-09-04 12:11:11 +00:00
Chao-ying Fu 14c931f142 c-lex.c (interpret_fixed): Declare.
* c-lex.c (interpret_fixed): Declare.
	(interpret_float): Process _Fract and _Accum.
	(interpret_fixed): New function.
	* final.c (output_addr_const): Process CONST_FIXED.
	* simplify-rtx.c (simplify_const_unary_operation): Handle US_NEG.
	(simplify_binary_operation_1): Handle US_ASHIFT, SS_MULT, US_MULT,
	SS_DIV, US_DIV.
	(simplify_const_binary_operation): Handle SS_MULT, US_MULT, SS_DIV,
	US_DIV, US_ASHIFT.
	(simplify_immed_subreg): Support CONST_FIXED.
	Process MODE_FRACT, MODE_UFRACT, MODE_ACCUM, MODE_UACCUM.
	(simplify_subreg): Support CONST_FIXED.

From-SVN: r127941
2007-08-30 23:09:28 +00:00
Uros Bizjak 3743c639c7 simplify-rtx.c (simplify_binary_operation_1): Change CONST_VECTOR_ELT to XVECEXP in elem calculation.
* simplify-rtx.c (simplify_binary_operation_1) [VEC_SELECT]:
	Change CONST_VECTOR_ELT to XVECEXP in elem calculation.

From-SVN: r127902
2007-08-29 17:00:38 +02:00
Uros Bizjak 7f97f938a7 re PR target/32661 (__builtin_ia32_vec_ext suboptimal for pointer/ref args)
PR target/32661
	* simplify-rtx.c (simplify_binary_operation_1) [VEC_SELECT]:
	Simplify nested VEC_SELECT (with optional VEC_CONCAT operator as
	operand) when top VEC_SELECT extracts scalar element.
	* config/i386/sse.md (*vec_extract_v4si_mem): New.
	(*vec_extract_v4sf_mem): Ditto.

testsuite/ChangeLog:

	PR target/32661
	* gcc.target/i386/pr32661.c: New test.

From-SVN: r127857
2007-08-28 11:52:06 +02:00
Jakub Jelinek 71cca28908 re PR rtl-optimization/33148 (ICE in trunc_int_for_mode, at explow.c:56 during combine)
PR rtl-optimization/33148
	* simplify-rtx.c (simplify_unary_operation_1): Only optimize
	(neg (lt X 0)) if X has scalar int mode.

	* gcc.c-torture/compile/20070827-1.c: New test.

From-SVN: r127855
2007-08-28 11:47:32 +02:00
Kaveh R. Ghazi 58f9752a2a c-common.c (vector_types_convertible_p, [...]): Constify.
* c-common.c (vector_types_convertible_p,
	decl_with_nonnull_addr_p, c_promoting_integer_type_p,
	self_promoting_args_p): Constify.
	* c-common.h (has_c_linkage, decl_with_nonnull_addr_p,
	c_promoting_integer_type_p, self_promoting_args_p,
	anon_aggr_type_p, vector_types_convertible_p): Likewise.
	* c-decl.c (anon_aggr_type_p): Likewise.
	* * c-dump.c (dump_stmt): Likewise.
	* c-objc-common.c (has_c_linkage): Likewise.
	* c-tree.h (same_translation_unit_p): Likewise.
	* c-typeck.c (null_pointer_constant_p,
	tagged_types_tu_compatible_p, function_types_compatible_p,
	type_lists_compatible_p, lvalue_or_else, lvalue_p,
	comptypes_internal, struct tagged_tu_seen_cache,
	same_translation_unit_p, alloc_tagged_tu_seen_cache,
	c_size_in_bytes): Likewise.
	* ggc-common.c (compare_ptr_data, hash_descriptor, eq_descriptor,
	hash_ptr, eq_ptr): Likewise.
	* langhooks-def.h (lhd_decl_ok_for_sibcall,
	LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE): Likewise.
	* langhooks.c (lhd_decl_ok_for_sibcall): Likewise.
	* langhooks.h (ok_for_sibcall, omp_privatize_by_reference):
	Likewise.
	* optabs.c (optab_for_tree_code): Likewise.
	* optabs.h (optab_for_tree_code): Likewise.
	* rtl.h (simplify_rtx): Likewise.
	* simplify-rtx.c (simplify_rtx): Likewise.
	* tree-dump.c (queue, queue_and_dump_index, queue_and_dump_type,
	dump_flag, dump_node): Likewise.
	* tree-dump.h (struct dump_info, dump_stmt, queue_and_dump_index,
	queue_and_dump_type, dump_flag): Likewise.
	* tree-flow.h (vect_can_force_dr_alignment_p): Likewise.
	* tree-pass.h (dump_node): Likewise.
	* tree-vectorizer.c (vect_can_force_dr_alignment_p,
	supportable_narrowing_operation): Likewise.
	* tree-vectorizer.h (vect_can_force_dr_alignment_p,
	supportable_narrowing_operation): Likewise.
	* tree-vrp.c (needs_overflow_infinity, supports_overflow_infinity,
	is_negative_overflow_infinity, is_positive_overflow_infinity,
	is_overflow_infinity, vrp_val_is_max, vrp_val_is_min,
	nonnull_arg_p, get_value_range, vrp_operand_equal_p,
	update_value_range, add_equivalence, ssa_name_nonnegative_p,
	ssa_name_nonzero_p, fp_predicate): Likewise.
	* tree.c (auto_var_in_fn_p, empty_body_p): Likewise.
	* tree.h (empty_body_p, auto_var_in_fn_p, ssa_name_nonzero_p,
	ssa_name_nonnegative_p): Likewise.

cp:
	* call.c (sufficient_parms_p): Constify.
	* class.c (same_signature_p): Likewise.
	* cp-gimplify.c (is_invisiref_parm,
	cxx_omp_privatize_by_reference): Likewise.
	* cp-objcp-common.c (has_c_linkage): Likewise.
	* cp-tree.h (NON_THUNK_FUNCTION_CHECK, THUNK_FUNCTION_CHECK,
	sufficient_parms_p, same_signature_p, copy_fn_p, move_fn_p,
	grok_ctor_properties, nothrow_libfn_p, skip_artificial_parms_for,
	num_artificial_parms_for, comp_template_parms,
	template_parameter_pack_p, any_dependent_template_arguments_p,
	any_type_dependent_arguments_p, any_value_dependent_elements_p,
	repo_export_class_p, cxx_omp_privatize_by_reference, pod_type_p,
	zero_init_p, member_p, cp_lvalue_kind,
	builtin_valid_in_constant_expr_p, decl_anon_ns_mem_p,
	varargs_function_p, is_dummy_object, special_function_kind,
	string_conv_p, type_unknown_p, comp_except_specs, compparms,
	comp_cv_qualification, is_bitfield_expr_with_lowered_type,
	unlowered_expr_type, ptr_reasonably_similar, cp_type_readonly,
	cp_has_mutable_p, at_least_as_qualified_p,
	invalid_nonstatic_memfn_p, lvalue_or_else, lvalue_p): Likewise.
	* decl.c (copy_fn_p, move_fn_p, grok_ctor_properties): Likewise.
	* except.c (nothrow_libfn_p): Likewise.
	* method.c (skip_artificial_parms_for, num_artificial_parms_for):
	Likewise.
	* pt.c (comp_template_parms, template_parameter_pack_p,
	any_type_dependent_arguments_p, any_value_dependent_elements_p,
	any_dependent_template_arguments_p): Likewise.
	* repo.c (repo_export_class_p): Likewise.
	* semantics.c (anon_aggr_type_p): Likewise.
	* tree.c (lvalue_p_1, real_lvalue_p, lvalue_p,
	builtin_valid_in_constant_expr_p, decl_anon_ns_mem_p,
	varargs_function_p, member_p, is_dummy_object, pod_type_p,
	zero_init_p, special_function_p): Likewise.
	* typeck.c (comp_array_types, type_unknown_p, comp_except_specs,
	comp_array_types, at_least_as_qualified_p, comp_cv_qualification,
	compparms, invalid_nonstatic_memfn_p,
	is_bitfield_expr_with_lowered_type, unlowered_expr_type,
	string_conv_p, ptr_reasonably_similar, cp_type_readonly,
	cp_has_mutable_p, lvalue_or_else): Likewise.

fortran:
	* trans-openmp.c (gfc_omp_privatize_by_reference): Constify.
	* trans.h (gfc_omp_privatize_by_reference): Likewise.

java:
	* lang.c (java_decl_ok_for_sibcall): Likewise.

From-SVN: r127799
2007-08-25 15:10:40 +00:00
Christian Bruel 81d2fb0294 fixed -ffinite-math-only A-A missing optimisation
Co-Authored-By: Richard Guenther <rguenther@suse.de>

From-SVN: r127705
2007-08-22 16:38:16 +02:00
Simon Baldwin d6bc05d4a4 simplify-rtx.c (simplify_binary_operation_1): Removed erroneous break that was preventing simplify_associative_operation()...
* simplify-rtx.c (simplify_binary_operation_1): Removed erroneous
        break that was preventing simplify_associative_operation() for xor.

From-SVN: r127319
2007-08-09 18:30:49 +00:00
Nick Clifton 9dcd6f09a3 Change copyright header to refer to version 3 of the GNU General Public License and to point readers at the COPYING3 file and the FSF's license web page.
From-SVN: r126948
2007-07-26 08:37:01 +00:00
Kaveh R. Ghazi f7d504c227 cfglayout.c (insn_scope, insn_line): Constify.
* cfglayout.c (insn_scope, insn_line): Constify.
	* emit-rtl.c (const_int_htab_hash, const_int_htab_eq,
	const_double_htab_hash, const_double_htab_eq,
	mem_attrs_htab_hash): Likewise.
	* loop-iv.c (biv_eq): Likewise.
	* print-rtl.c (print_rtx, print_decl_name, print_mem_expr,
	print_inline_rtx, debug_rtx, debug_rtx_list, debug_rtx_range,
	debug_rtx_find, print_rtl, print_rtl_single, print_simple_rtl):
	Likewise. 
	* rtl-error.c (location_for_asm, diagnostic_for_asm,
	error_for_asm, warning_for_asm, _fatal_insn,
	_fatal_insn_not_found): Likewise. 
	* rtl.c (rtx_size, shared_const_p, shallow_copy_rtx_stat,
	rtx_equal_p, rtl_check_failed_bounds, rtl_check_failed_type1,
	rtl_check_failed_type2, rtl_check_failed_code1,
	rtl_check_failed_code2, rtl_check_failed_code_mode,
	rtvec_check_failed_bounds, rtl_check_failed_flag): Likewise.
	* rtl.h (rtl_check_failed_bounds, rtl_check_failed_type1,
	rtl_check_failed_type2, rtl_check_failed_code1,
	rtl_check_failed_code2, rtl_check_failed_code_mode,
	rtvec_check_failed_bounds, rtl_check_failed_flag, LABEL_KIND,
	SET_LABEL_KIND, rhs_regno, subreg_lsb, subreg_regno, subreg_nregs,
	shared_const_p, rtx_size, shallow_copy_rtx_stat, rtx_equal_p,
	get_pool_mode, insn_line, insn_file, simplify_replace_rtx,
	mode_signbit_p, rtx_addr_can_trap_p, nonzero_address_p,
	rtx_unstable_p, get_integer_term, get_related_value,
	offset_within_block_p, reg_mentioned_p, count_occurrences,
	reg_referenced_p, reg_used_between_p, no_labels_between_p,
	single_set_2, multiple_sets, set_noop_p, refers_to_regno_p,
	reg_overlap_mentioned_p, dead_or_set_p, dead_or_set_regno_p,
	find_reg_note, find_regno_note, find_reg_equal_equiv_note,
	find_constant_src, find_reg_fusage, find_regno_fusage,
	pure_call_p, remove_note, side_effects_p, volatile_refs_p,
	volatile_insn_p, may_trap_p, may_trap_after_code_motion_p,
	may_trap_or_fault_p, inequality_comparisons_p, tablejump_p,
	computed_jump_p, auto_inc_p, in_expr_list_p,
	remove_node_from_expr_list, loc_mentioned_in_p,
	label_is_jump_target_p, reversed_comparison_code_parts,
	debug_rtx, debug_rtx_list, debug_rtx_range, debug_rtx_find,
	print_mem_expr, print_rtl, print_simple_rtl, print_rtl_single,
	print_inline_rtx): Likewise.
	* rtlanal.c (covers_regno_p, covers_regno_no_parallel_p,
	computed_jump_p_1, nonzero_bits1, rtx_unstable_p,
	rtx_addr_can_trap_p_1, rtx_addr_can_trap_p, nonzero_address_p,
	get_integer_term, get_related_value, offset_within_block_p,
	count_occurrences, reg_mentioned_p, no_labels_between_p,
	reg_used_between_p, reg_referenced_p, single_set_2,
	multiple_sets, set_noop_p, refers_to_regno_p,
	reg_overlap_mentioned_p, dead_or_set_p,
	covers_regno_no_parallel_p, covers_regno_p,
	dead_or_set_regno_p, find_reg_note, find_regno_note,
	find_reg_equal_equiv_note, find_constant_src, find_reg_fusage,
	find_regno_fusage, pure_call_p, remove_note, in_expr_list_p,
	remove_node_from_expr_list, volatile_insn_p, volatile_refs_p,
	side_effects_p, may_trap_p_1, may_trap_p,
	may_trap_after_code_motion_p, may_trap_or_fault_p,
	inequality_comparisons_p, tablejump_p, computed_jump_p_1,
	computed_jump_p, auto_inc_p, loc_mentioned_in_p, subreg_lsb,
	subreg_regno, subreg_nregs, label_is_jump_target_p): Likewise.
	* simplify-rtx.c (neg_const_int, plus_minus_operand_p,
	mode_signbit_p, simplify_replace_rtx, plus_minus_operand_p):
	Likewise. 
	* toplev.h (_fatal_insn_not_found, _fatal_insn, error_for_asm,
	warning_for_asm): Likewise.
	* tree.h (print_rtl): Likewise.
	* varasm.c (get_pool_mode): Likewise.

From-SVN: r126922
2007-07-25 18:33:26 +00:00
Peter Bergner 7e0b4eaea1 PR middle-end/PR28690
PR middle-end/PR28690
	* optabs.c (expand_binop): (emit_cmp_and_jump_insns): Allow EQ compares.
	* rtlanal.c (commutative_operand_precedence): Prefer both REG_POINTER
	and MEM_POINTER operands over REG and MEM operands.
	(swap_commutative_operands_p): Change return value to bool.
	* rtl.h: Update the corresponding prototype.
	* tree-ssa-address.c (gen_addr_rtx): Use simplify_gen_binary
	instead of gen_rtx_PLUS.
	* simplify-rtx.c (simplify_plus_minus_op_data_cmp): Change return
	value to bool.  Change function arguments to rtx's and update code
	to match.
	(simplify_plus_minus): Update the simplify_plus_minus_op_data_cmp
	calls to match the new declaration.
	* simplify-rtx.c (simplify_associative_operation): Don't
	reorder simplify_binary_operation arguments.

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

From-SVN: r126852
2007-07-23 11:43:24 -05:00
Uros Bizjak a0c6429598 re PR rtl-optimization/32366 (Segfault in significand_size with -ftree-vectorize)
PR rtl-optimization/32366
        * simplify-rtx.c (simplify_unary_operation_1) [FLOAT_TRUNCATE,
        FLOAT_EXTEND]: Prevent non-scalar modes from entering
        significand_size.

testsuite/ChangeLog:

        PR rtl-optimization/32366
        * testsuite/gcc.dg/vect/pr32366.c: New test.

From-SVN: r125777
2007-06-17 21:23:30 +02:00
Kaveh R. Ghazi 52a39a4c5d fold-const.c (fold_binary): Guard (X-X) -> 0 transformation with !HONOR_NANS and !HONOR_INFINITIES.
* fold-const.c (fold_binary): Guard (X-X) -> 0 transformation
	with !HONOR_NANS and !HONOR_INFINITIES.
	* simplify-rtx.c (simplify_binary_operation_1): Likewise.

From-SVN: r125652
2007-06-12 16:28:01 +00:00
Richard Guenther 4bf371ea7e re PR middle-end/31530 (Incorrect folding of multiplication and sign change when followed by an addition)
2007-04-11  Richard Guenther  <rguenther@suse.de>

	PR middle-end/31530
	* simplify-rtx.c (simplify_binary_operation_1): Do not simplify
	a * -b + c as c - a * b if we honor sign dependent rounding.

From-SVN: r123715
2007-04-11 11:13:54 +00:00
Richard Sandiford 2a45063980 rtl.h (constant_pool_reference_p): Delete.
gcc/
	* rtl.h (constant_pool_reference_p): Delete.
	(find_constant_src): Declare.
	* rtlanal.c (find_constant_src): New function.
	* simplify-rtx.c (constant_pool_reference_p): Delete.
	* config/i386/i386.md: Use find_constant_src instead of
	constant_pool_reference_p/avoid_constant_pool_reference pairs.

From-SVN: r123106
2007-03-21 09:10:08 +00:00
Roger Sayle 49e7a9d4b8 re PR rtl-optimization/28173 (misses constant folding)
PR rtl-optimization/28173
	* simplify-rtx.c (simplify_binary_operation_1) <IOR>:  Optimize
	(X & C1) | C2 as C2 when (C1 & C2) == C1 and X has no side-effects.
	Optimize (X & C1) | C2 as X | C2 when (C1 | C2) == ~0.
	Canonicalize (X & C1) | C2 as (X & (C1 & ~C2)) | C2.
	<AND>: Canonicalize (X | C1) & C2 as (X & C2) | (C1 & C2).

	* gcc.target/i386/andor-1.c: New test case.

From-SVN: r122116
2007-02-19 00:54:29 +00:00
Ian Lance Taylor 6ac015100f common.opt: Add Wstrict-overflow and Wstrict-overflow=.
./:	* common.opt: Add Wstrict-overflow and Wstrict-overflow=.
	* flags.h (warn_strict_overflow): Declare.
	(enum warn_strict_overflow_code): Define.
	(issue_strict_overflow_warning): New static inline function.
	* opts.c (warn_strict_overflow): New variable.
	(common_handle_option): Handle OPT_Wstrict_overflow and
	OPT_Wstrict_overflow_.
	* c-opts.c (c_common_handle_option): Set warn_strict_overflow for
	OPT_Wall.
	* fold-const.c: Include intl.h.
	(fold_deferring_overflow_warnings): New static variable.
	(fold_deferred_overflow_warning): New static variable.
	(fold_deferred_overflow_code): New static variable.
	(fold_defer_overflow_warnings): New function.
	(fold_undefer_overflow_warnings): New function.
	(fold_undefer_and_ignore_overflow_warnings): New function.
	(fold_deferring_overflow_warnings_p): New function.
	(fold_overflow_warning): New static function.
	(make_range): Add strict_overflow_p parameter.  Change all
	callers.
	(extract_muldiv, extract_muldiv_1): Likewise.
	(fold_unary) [ABS_EXPR]: Check ABS_EXPR before calling
	tree_expr_nonnegative_p.
	(fold_negate_expr): Call fold_overflow_warning.
	(fold_range_test): Likewise.
	(fold_comparison): Likewise.
	(fold_binary): Likewise.  Call tree_expr_nonnegative_warnv_p
	instead of tree_expr_nonnegative_p.
	(tree_expr_nonnegative_warnv_p): Rename from
	tree_expr_nonnegative_p, add strict_overflow_p parameter.
	(tree_expr_nonnegative_p): New function.
	(tree_expr_nonzero_warnv_p): Rename from tree_expr_nonzero_p, add
	strict_overflow_p parameter.
	(tree_expr_nonzero_p): New function.
	* passes.c (verify_interpass_invariants): New static function.
	(execute_one_pass): Call it.
	* tree-ssa-loop-niter.c (expand_simple_operations): Ignore fold
	warnings.
	(number_of_iterations_exit, loop_niter_by_eval): Likewise.
	(estimate_numbers_of_iterations): Likewise.
	(scev_probably_wraps_p): Likewise.
	* tree-ssa-ccp.c: Include "toplev.h".
	(evaluate_stmt): Defer fold overflow warnings until we know we are
	going to optimize.
	(struct fold_stmt_r_data): Add stmt field.
	(fold_stmt_r): Defer fold overflow warnings until we know we
	optimized.
	(fold_stmt): Initialize stmt field of fold_stmt_r_data.
	(fold_stmt_inplace): Likewise.
	* tree-cfgcleanup.c: Include "toplev.h" rather than "errors.h".
	(cleanup_control_expr_graph): Defer fold overflow warnings until
	we know we are going to optimize.
	* tree-cfg.c (fold_cond_expr_cond): Likewise.
	* tree-ssa-threadedge.c (simplify_control_stmt_condition):
	Likewise.
	* tree-vrp.c (vrp_expr_computes_nonnegative): Call
	tree_expr_nonnegative_warnv_p instead of tree_expr_nonnegative_p.
	* tree-ssa-loop-manip.c (create_iv): Likewise.
	* c-typeck.c (build_conditional_expr): Likewise.
	(build_binary_op): Likewise.
	* tree-vrp.c (vrp_expr_computes_nonzero): Call
	tree_expr_nonzero_warnv_p instead of tree_expr_nonzero_p.
	(extract_range_from_unary_expr): Likewise.
	* simplify-rtx.c (simplify_const_relational_operation): Warn when
	assuming that signed overflow does not occur.
	* c-common.c (pointer_int_sum): Ignore fold overflow warnings.
	* tree.h (tree_expr_nonnegative_warnv_p): Declare.
	(fold_defer_overflow_warnings): Declare.
	(fold_undefer_overflow_warnings): Declare.
	(fold_undefer_and_ignore_overflow_warnings): Declare.
	(fold_deferring_overflow_warnings_p): Declare.
	(tree_expr_nonzero_warnv_p): Declare.
	* doc/invoke.texi (Option Summary): Add -Wstrict-overflow to list
	of warning options.
	(Warning Options): Document -Wstrict-overflow.
	* Makefile.in (tree-ssa-threadedge.o): Depend on toplev.h.
	(tree-ssa-ccp.o): Likewise.
	(tree-cfgcleanup.o): Change errors.h dependency to toplev.h.
	(fold-const.o): Depend on intl.h.
testsuite/:
	* gcc.dg/Wstrict-overflow-1.c: New test.
	* gcc.dg/Wstrict-overflow-2.c: New test.
	* gcc.dg/Wstrict-overflow-3.c: New test.
	* gcc.dg/Wstrict-overflow-4.c: New test.
	* gcc.dg/Wstrict-overflow-5.c: New test.
	* gcc.dg/Wstrict-overflow-6.c: New test.
	* gcc.dg/Wstrict-overflow-7.c: New test.
	* gcc.dg/Wstrict-overflow-8.c: New test.
	* gcc.dg/Wstrict-overflow-9.c: New test.
	* gcc.dg/Wstrict-overflow-10.c: New test.

From-SVN: r121895
2007-02-13 22:34:45 +00:00
Roger Sayle 2376c58f22 simplify-rtx.c (simplify_relational_operation_1): Correct typo.
* simplify-rtx.c (simplify_relational_operation_1): Correct typo.


Co-Authored-By: Matt Thomas <matt@3am-software.com>

From-SVN: r121839
2007-02-12 04:19:42 +00:00
Roger Sayle 69fce32ff9 simplify-rtx.c (simplify_relational_operation_1): Optimize comparisons of POPCOUNT against zero.
* simplify-rtx.c (simplify_relational_operation_1): Optimize
	comparisons of POPCOUNT against zero.
	(simplify_const_relational_operation): Likewise.

	* gcc.target/ia64/builtin-popcount-1.c: New test case.
	* gcc.target/ia64/builtin-popcount-2.c: Likewise.

From-SVN: r121838
2007-02-12 01:43:50 +00:00
Roger Sayle 9f05adb09f simplify-rtx.c (simplify_unary_operation_1): We can strip zero_extend, bswap and rotates from POCOUNT's argument.
* simplify-rtx.c (simplify_unary_operation_1) <POPCOUNT>: We can
	strip zero_extend, bswap and rotates from POCOUNT's argument.
	<PARITY>: Likewise, we can strip not, bswap, sign_extend,
	zero_extend and rotates from PARITY's argument.
	<BSWAP>: A byte-swap followed by a byte-swap is an identity.
	(simplify_const_unary_operation) <BSWAP>: Evaluate the byte-swap
	of an integer constant at compile-time.

	* gcc.target/i386/builtin-bswap-2.c: New test case.

From-SVN: r121716
2007-02-08 17:10:56 +00:00
Roger Sayle 3fa0cacdb5 simplify-rtx.c (simplify_relational_operation_1): Implement some canonicalization transformations that attempt to simplify...
* simplify-rtx.c (simplify_relational_operation_1): Implement some
	canonicalization transformations that attempt to simplify integer
	constant comparisons to become comparisons against zero.

From-SVN: r121544
2007-02-03 16:22:09 +00:00
Ian Lance Taylor eeef0e452e common.opt: Add fstrict-overflow.
./:	* common.opt: Add fstrict-overflow.
	* opts.c (decode_options): Set flag_strict_overflow if -O2.
	* flags.h (TYPE_OVERFLOW_WRAPS): Define.
	(TYPE_OVERFLOW_UNDEFINED): Define.
	(TYPE_OVERFLOW_TRAPS): Define.  This replaces TYPE_TRAP_SIGNED.
	Replace all uses.
	* tree.h (TYPE_TRAP_SIGNED): Don't define.
	* fold-const.c (negate_expr_p): Use TYPE_OVERFLOW_UNDEFINED.
	(fold_negate_expr): Likewise.
	(make_range): Likewise.
	(extract_muldiv_1): Likewise.
	(maybe_canonicalize_comparison): Likewise.
	(fold_comparison): Likewise.
	(fold_binary): Likewise.
	(tree_expr_nonnegative_p): Likewise.
	(tree_expr_nonzero_p): Likewise.
	* tree-vrp.c (compare_values): Likewise.
	(extract_range_from_binary_expr): Likewise.
	(extract_range_from_unary_expr): Likewise.
	* tree-ssa-loop-niter.c (infer_loop_bounds_from_signedness):
	Likewise.
	(nowrap_type_p): Likewise.
	* tree-scalar-evolution.c (simple_iv): Likewise.
	* fold-const.c (negate_expr_p): Use TYPE_OVERFLOW_WRAPS.
	(build_range_check): Likewise.
	(extract_muldiv_1): Likewise.
	(fold_comparison): Likewise.
	* tree-vrp.c (vrp_int_const_binop): Likewise.
	(extract_range_from_unary_expr): Likewise.
	* convert.c (convert_to_integer): Likewise.
	* fold-const.c (fold_negate_expr): Use TYPE_OVERFLOW_TRAPS.
	(fold_comparison): Likewise.
	(fold_binary): Likewise.
	* optabs.c (optab_for_tree_code): Likewise.
	* tree-vectorizer.c (vect_is_simple_reduction): Likewise.
	* simplify-rtx.c (simplify_const_relational_operation): Check
	flag_strict_overflow and flag_trapv.
	(simplify_const_relational_operation): Likewise.
	* doc/invoke.texi (Option Summary): Mention -fstrict-overflow.
	(Optimize Options): Add -fstrict-overflow to -O2 list.  Document
	-fstrict-overflow.
testsuite/:
	* gcc.dg/strict-overflow-1.c: New test.
	* gcc.dg/no-strict-overflow-1.c: New test.
	* gcc.dg/strict-overflow-2.c: New test.
	* gcc.dg/no-strict-overflow-2.c: New test.
	* gcc.dg/strict-overflow-3.c: New test.
	* gcc.dg/no-strict-overflow-3.c: New test.
	* gcc.dg/strict-overflow-4.c: New test.
	* gcc.dg/no-strict-overflow-4.c: New test.
	* gcc.dg/fold-mod-1.c: Add -fstrict-overflow option.
	* gcc.dg/pr15784-1.c: Likewise.
	* gcc.dg/pr20922-1.c: Likewise.
	* gcc.dg/pr20922-3.c: Likewise.
	* gcc.dg/pr20922-4.c: Likewise.
	* gcc.dg/pr20922-6.c: Likewise.
	* gcc.dg/compare-4.c: Likewise.
	* gcc.dg/torture/pr26898-1.c: Likewise.
	* gcc.dg/tree-ssa/divide-1.c: Likewise.
	* gcc.dg/tree-ssa/divide-2.c: Likewise.
	* gcc.dg/tree-ssa/divide-3.c: Likewise.
	* gcc.dg/tree-ssa/divide-4.c: Likewise.
	* gcc.dg/tree-ssa/pr14490-1.c: Likewise.
	* gcc.dg/tree-ssa/pr14490-3.c: Likewise.
	* gcc.dg/tree-ssa/pr21082.c: Likewise.
	* gcc.dg/tree-ssa/pr26899.c: Likewise.
	* g++.dg/tree-ssa/pr21082.C: Likewise.

From-SVN: r121254
2007-01-28 05:15:06 +00:00
Roger Sayle a957d77fc3 simplify-rtx.c (simplify_subreg): Use the correct mode when determining whether a SUBREG of a CONCAT refers to...
* simplify-rtx.c (simplify_subreg): Use the correct mode when
	determining whether a SUBREG of a CONCAT refers to the first or
	second component.

From-SVN: r120101
2006-12-21 04:35:05 +00:00
Richard Sandiford e25615581d simplify-rtx.c (simplify_rtx): Use simplify_subreg rather than simplify_gen_subreg.
gcc/
	* simplify-rtx.c (simplify_rtx): Use simplify_subreg rather than
	simplify_gen_subreg.

From-SVN: r119380
2006-11-30 21:54:20 +00:00
Andreas Krebbel d82a02fa4f simplify-rtx.c (avoid_constant_pool_reference): Avoid calling simplify_subreg with BLKmode outer mode.
2006-11-09  Andreas Krebbel  <krebbel1@de.ibm.com>

	* simplify-rtx.c (avoid_constant_pool_reference): Avoid calling 
	simplify_subreg with BLKmode outer mode.

2006-11-09  Andreas Krebbel  <krebbel1@de.ibm.com>

	* gcc.dg/20061109-1.c: New testcase.

From-SVN: r118622
2006-11-09 17:56:04 +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 Guenther bdbb046092 re PR middle-end/28796 (__builtin_nan() and __builtin_unordered() inconsistent)
2006-10-21  Richard Guenther  <rguenther@suse.de>

	PR middle-end/28796
	* simplify-rtx.c (simplify_const_relational_operation):
	Do not constant-fold ORDERED and UNORDERED for
	flag_unsafe_math_optimizations but only we do not need to
	honor NaNs for the given mode.

From-SVN: r117928
2006-10-21 10:13:13 +00:00
Paolo Bonzini d26cef13fb re PR rtl-optimization/26847 (Missed optimization in simplify_plus_minus)
2006-09-05  Paolo Bonzini  <bonzini@gnu.org>

	PR rtl-optimization/26847
	* simplify-rtx.c (struct simplify_plus_minus_op_data): Remove ix.
	(simplify_plus_minus_op_data_cmp): For REGs, break ties on the regno.
	(simplify_plus_minus): Count n_constants while filling ops.  Replace
	qsort with insertion sort.  Before going through the array to simplify
	pairs, sort it.  Delay early exit until after the first sort, exiting
	only if no swaps occurred.  Simplify pairs in reversed order, without
	special-casing the first iteration.  Pack ops after simplifying pairs.

From-SVN: r116701
2006-09-05 17:41:22 +00:00
Richard Guenther e0d0c1939b re PR middle-end/28651 (signed compare incorrectly false for (int)(U+4)<(int)U where U is unsigned INT_MAX (for optimized x86))
2006-08-11  Richard Guenther  <rguenther@suse.de>

	PR middle-end/28651
	* simplify-rtx.c (simplify_const_relational_operation):
	Simplify A CMP B to A - B CMP 0 only for EQ and NE comparison
	codes.

	* gcc.c-torture/execute/pr28651.c: New testcase.

From-SVN: r116079
2006-08-11 07:44:45 +00:00
Roger Sayle e40122f0fa simplify-rtx.c (simplify_binary_operation_1): Cast width to HOST_WIDE_INT to avoid comparison warnings on some targets.
* simplify-rtx.c (simplify_binary_operation_1) <LSHIFTRT>: Cast
	width to HOST_WIDE_INT to avoid comparison warnings on some targets.

From-SVN: r114248
2006-05-30 21:54:17 +00:00
Roger Sayle 70233f3788 simplify-rtx.c (simplify_binary_operation): Unfactor the shift and rotate cases.
* simplify-rtx.c (simplify_binary_operation): Unfactor the shift
	and rotate cases.
	<LSHIFTRT>: Optimize (lshiftrt (clz X) C) as (eq X 0) where C is
	log2(GET_MODE_BITSIZE(X)) on targets with the appropriate semantics.

	* gcc.target/ppc-eq0-1.c: New test case.
	* gcc.target/ppc-negeq0-1.c: New test case.

From-SVN: r114239
2006-05-30 15:32:52 +00:00
Roger Sayle 1753331b5b re PR tree-optimization/24964 (Does not optimise abs(x)**2 to x**2)
PR tree-optimization/24964
	* simplify-rtx.c (simplify_binary_operation_1): Add function comment.
	<MULT>: Minor clean-up.  Don't convert x*-1.0 into -x if we honor
	signaling NaNs.  Optimize -x*-x as x*x for all float modes, and
	abs(x)*abs(x) as x*x for scalar floating point modes.

	* gcc.target/i386/387-10.c: New test case.

From-SVN: r114206
2006-05-29 16:22:05 +00:00
Alexandre Oliva dedc1e6d9e simplify-rtx.c (simplify_subreg): Adjust REG_OFFSET for big-endian paradoxical subregs.
* simplify-rtx.c (simplify_subreg): Adjust REG_OFFSET for
big-endian paradoxical subregs.
* var-tracking.c (struct micro_operation_def): Document that,
for modify micro operations, insn is the subsequent instruction.
(var_reg_delete_and_set, var_mem_delete_and_set): Split into...
(var_reg_set, var_mem_set): ... new functions.
(add_stores): Record subsequent insn.
(compute_bb_dataflow): Use new functions for MO_USE.
(emit_notes_in_bb): Use new functions for MO_USE.  Emit use
notes after the insn, and modify notes before the insn known
to be the subsequent one.
(vt_initialize): Invert sorting of MO_CLOBBERs and MO_SETs.

From-SVN: r114013
2006-05-23 05:35:21 +00:00
Kazu Hirata 4d49d44d66 re PR rtl-optimization/27671 (optimization error on pentium4-Linux with %, regression from gcc-4.1.0)
gcc/
	PR rtl-optimization/27671
	* simplify-rtx.c (simplify_relational_operation_1): Fix
	simplifications of (eq/ne (xor x y) y) and
	(eq/ne (xor x y) x).

gcc/testsuite/
	PR rtl-optimization/27671
	* gcc.c-torture/execute/pr27671-1.c: New.
	* gcc.dg/pr27671-2.c: Likewise.

From-SVN: r113955
2006-05-21 15:13:36 +00:00
Bernd Schmidt e551ad2608 rtl.def (SS_ASHIFT, SS_NEG): New codes.
* rtl.def (SS_ASHIFT, SS_NEG): New codes.
	* doc/rtl.texi: Document them.
	* simplify-rtx.c (simplify_unary_operation,
	simplify_binary_operation_1): Don't abort when we see them.

From-SVN: r113227
2006-04-24 19:35:38 +00:00
Adam Nemet 2332d58558 simplify-rtx.c (simplify_unary_operation_1): When trying to remove TRUNCATE check if all bits outside the new mode are...
* simplify-rtx.c (simplify_unary_operation_1) <TRUNCATE>: When
	trying to remove TRUNCATE check if all bits outside the new mode
	are identical to the sign bit.

From-SVN: r112643
2006-04-03 18:12:15 +00:00
Adam Nemet 30a440a7f6 simplify-rtx.c (simplify_relational_operation): Call simplify_relational_operation_1 even if mode is VOIDmode.
* simplify-rtx.c (simplify_relational_operation): Call
	simplify_relational_operation_1 even if mode is VOIDmode.

From-SVN: r112383
2006-03-25 21:58:01 +00:00
Andreas Krebbel 349f4ea14a simplify-rtx.c (simplify_plus_minus): Simplify within CONST terms.
2006-03-16  Andreas Krebbel  <krebbel1@de.ibm.com>

	* simplify-rtx.c (simplify_plus_minus): Simplify within CONST terms.

From-SVN: r112131
2006-03-16 08:15:35 +00:00
Roger Sayle 0f2f71b552 simplify-rtx.c (simplify_unary_operation): When simplifying (neg (lt X 0)) into (ashiftrt X C) or (lshiftrt X C)...
* simplify-rtx.c (simplify_unary_operation): When simplifying
	(neg (lt X 0)) into (ashiftrt X C) or (lshiftrt X C), make sure
	that we perform the right shift in the appropriate mode, and
	then extend or truncate the result to requested mode.

From-SVN: r111671
2006-03-03 05:55:02 +00:00
Paolo Bonzini d3b7269024 rtl.h (truncated_to_mode): Declare it.
* rtl.h (truncated_to_mode): Declare it.
	(struct rtl_hooks): Add reg_truncated_to_mode hook.
	* rtlhooks-def.h (RTL_HOOKS_REG_TRUNCATED_TO_MODE): New macro.
	(RTL_HOOKS_INITIALIZER): Include it.
	* rtlhooks.c (reg_truncated_to_mode_general): New function.
	* combine.c (RTL_HOOKS_REG_TRUNCATED_TO_MODE): Override to
	reg_truncated_to_mode.
	* rtlanal.c (truncated_to_mode): Define it.
	* simplify-rtx.c (simplify_unary_operation_1): Use it.

Co-Authored-By: Adam Nemet <anemet@caviumnetworks.com>

From-SVN: r111573
2006-02-28 20:32:20 +00:00
Roger Sayle 5484a3c37c simplify-rtx.c (simplify_relational_operation_1): Simplify (X^Y) == 0 as X == Y and (X^Y) != 0 as X != Y.
* simplify-rtx.c (simplify_relational_operation_1):  Simplify
	(X^Y) == 0 as X == Y and (X^Y) != 0 as X != Y.  Simplify (X^Y) == Y
	as X == 0, and some symmetry related transformations.
	Simplify (X^C1) == C2 as X == (C1^C2).  Split long comment line.

From-SVN: r111443
2006-02-25 22:29:48 +00:00
Roger Sayle 8305d7868d re PR rtl-optimization/25600 (unsigned>>31?-1:0 should be optimized to int>>31)
PR middle-end/25600
	* fold-const.c (fold_binary): Fold (X >> C) != 0 into X < 0 when
	C is one less than the width of X (and related transformations).
	* simplify_rtx.c (simplify_unary_operation_1): Transform 
	(neg (lt x 0)) into either (ashiftrt X C) or (lshiftrt X C)
	depending on STORE_FLAG_VALUE, were C is one less then the
	width of X.

From-SVN: r111226
2006-02-18 05:22:46 +00:00
Adam Nemet de7f492b61 * simplify-rtx.c (simplify_subreg): Combine SUBREG and TRUNCATE.
From-SVN: r110990
2006-02-14 17:45:55 +00:00
Adam Nemet e963b86613 simplify-rtx.c (simplify_unary_operation_1): Return new expression in the requested machine mode.
* simplify-rtx.c (simplify_unary_operation_1) <TRUNCATE>: Return
	new expression in the requested machine mode.

From-SVN: r110959
2006-02-14 07:10:35 +00:00
Ian Lance Taylor bc3839706c - Fix up date in ChangeLog. Update copyrights in changed files.
Co-Authored-By: David Edelsohn <edelsohn@gnu.org>

From-SVN: r109475
2006-01-08 15:52:57 -05:00
Ian Lance Taylor 68162a9766 re PR target/25662 (Unrecognizable insn with -O on PPC)
2005-01-07  Ian Lance Taylor  <ian@airs.com>
            David Edelsohn  <edelsohn@gnu.org>

        PR rtl-optimization/25662
        * optabs.c (simplify_expand_binop): Use simplify_binary_operation
        for constant operands instead of simplify_gen_binary.
        * simplify-rtx.c (simplify_gen_binary): Swap commutative operands
        after trying simplify_binary_operation

Co-Authored-By: David Edelsohn <edelsohn@gnu.org>

From-SVN: r109456
2006-01-07 17:23:27 -05:00
Jon Grimm 15ed7b52cb optabs.c (init_floating_libfuncs): Handle decimal float modes.
* optabs.c (init_floating_libfuncs): Handle decimal float modes.
	(init_optabs): Handle libfuncs for decimal float.
	* genopinit.c (gen_insn): Handle MODE_DECIMAL_FLOAT.
	* stor-layout.c (int_mode_for_mode): Likewise.
	* simplify-rtx.c (simplify_immed_subreg): Likewise.
	(simplify_unary_operation_1): Skip optimisations for decimal float
	modes.
	* varasm.c (output_constant_pool_2): Handle MODE_DECIMAL_FLOAT.
	* emit-rtl.c (gen_const_vector): Add assertion check.
	(init_emit_once): Populate const_tiny_rtx with constants in each
	decimal float mode.
	* expmed.c (extract_high_half, expand_mult_highpart_optab,
	expand_mult_highpart): Assert that mode is not a scalar float
	mode.
	* expr.c (convert_move): Handle conversion between decimal and
	binary floats of the same size.
	* convert.c (convert_to_real): Consider decimal float types when
	folding.
	* dwarf2out.c (base_type_die): Use DW_ATE_decimal_float to
	describe decimal floating point types.

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

From-SVN: r108762
2005-12-19 08:40:47 +11:00
Alan Modra 0157856478 simplify-rtx.c (simplify_binary_operation_1 <IOR>): Correct bug introduced 2005-12-16.
* simplify-rtx.c (simplify_binary_operation_1 <IOR>): Correct bug
	introduced 2005-12-16.

From-SVN: r108697
2005-12-17 10:20:42 +10:30
Paolo Bonzini bd1ef75776 combine.c (combine_simplify_rtx <case NOT, [...]): Move simplifications that do not require additional infrastructure...
2005-12-16  Paolo Bonzini  <bonzini@gnu.org>

	* combine.c (combine_simplify_rtx <case NOT, NEG, TRUNCATE,
	FLOAT_TRUNCATE, FLOAT_EXTEND, PLUS, MINUS, AND, IOR, XOR,
	ABS, VEC_SELECT, POPCOUNT, PARITY, FFS, FLOAT>,
	simplify_logical): Move simplifications that do not require
	additional infrastructure...
	* simplify-rtx.c (simplify_unary_operation_1,
	simplify_binary_operation_1): ... here.

From-SVN: r108634
2005-12-16 09:24:19 +00:00
Alan Modra 36686ad6c0 simplify-rtx.c (simplify_plus_minus): Do simplify constants.
* simplify-rtx.c (simplify_plus_minus): Do simplify constants.
	Delete dead code.

From-SVN: r107840
2005-12-02 10:18:13 +10:30
Paolo Bonzini 1941069a58 simplify-rtx.c (simplify_plus_minus): Remove final parameter.
2005-11-30  Paolo Bonzini  <bonzini@gnu.org>

	* simplify-rtx.c (simplify_plus_minus): Remove final parameter.
	Always produce an output if we can remove NEGs or canonicalize
	(minus (minus ...)) expressions.  Provide a fast path for the
	two-operand case.
	(simplify_gen_binary): Do not call simplify_plus_minus.
	(simplify_binary_operation_1): Reassociate at the end of the
	function.

From-SVN: r107702
2005-11-30 08:20:23 +00:00
Ben Elliston 3d8bf70f59 optabs.c (expand_abs_nojump): Use SCALAR_FLOAT_MODE_P instead of explicitly testing GET_MODE_CLASS (x) ==...
* optabs.c (expand_abs_nojump): Use SCALAR_FLOAT_MODE_P instead of
	explicitly testing GET_MODE_CLASS (x) == MODE_FLOAT.
	* genopinit.c (gen_insn): Likewise.
	* reload.c (find_equiv_reg): Likewise.
	* loop.c (load_mems): Likewise.
	* rtlanal.c (may_trap_p_1, canonicalize_condition): Likewise.
	* cse.c (find_comparison_args, fold_rtx): Likewise.
	* dwarf2out.c (add_const_value_attribute): Likewise.
	* expr.c (convert_move): Likewise.
	* recog.c (general_operand, register_operand): Likewise.
	* reg-stack.c (replace_reg): Likewise.
	* tree-vect-generic.c (type_for_widest_vector_mode): Likewise.
	* c-common.c (handle_vector_size_attribute): Likewise.
	* simplify-rtx.c (simplify_const_unary_operation): Likewise.
	(simplify_binary_operation_1): Likewise.
	(simplify_const_binary_operation): Likewise.
	(simplify_relational_operation): Likewise.
	(simplify_const_relational_operation): Likewise.
	(simplify_immed_subreg): Likewise.
	* emit-rtl.c (gen_lowpart_common): Likewise.
	* expmed.c (expand_mult): Likewise.
	* stor-layout.c (layout_type): Likewise.

From-SVN: r107322
2005-11-22 07:53:27 +11:00
Eric Botcazou 68328cdaef fold-const.c (const_binop): Don't constant fold the operation if the result has overflowed and...
* fold-const.c (const_binop): Don't constant fold the operation
	if the result has overflowed and flag_trapping_math.
	* simplify-rtx.c (simplify_const_binary_operation): Likewise.

From-SVN: r107092
2005-11-16 17:15:23 +00:00
Uros Bizjak 3242fbd83f re PR middle-end/23831 (ICE in immed_double_const with vectorized multipication)
PR middle-end/23831
	* simplify-rtx.c (simplify_immed_subreg) [MODE_INT]: Skip
	simplification if elem_bitsize > 2 * HOST_BITS_PER_WIDE_INT.

From-SVN: r104650
2005-09-26 18:16:07 +00:00
Saurabh Verma f5d1572a8a simplify-rtx.c (simplify_binary_operation_1): Correct the condition for detecting cases like (a&a) and (a^a).
* simplify-rtx.c (simplify_binary_operation_1): Correct the
	condition for detecting cases like (a&a) and (a^a).

From-SVN: r103955
2005-09-06 17:51:48 +00:00
Jakub Jelinek 1c653a41cf re PR rtl-optimization/23098 (store of 0.0 to float)
PR rtl-optimization/23098
	* cse.c (fold_rtx_mem): Call delegitimize_address target hook.
	* simplify-rtx.c (constant_pool_reference_p): New function.
	* rtl.h (constant_pool_reference_p): New prototype.
	* config/i386/i386.md (pushf split, mov[sdx]f split): Use
	constant_pool_reference_p in condition and
	avoid_constant_pool_reference in preparation statements.

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

From-SVN: r103935
2005-09-06 10:53:11 +02:00
J"orn Rennecke f805670fc3 re PR rtl-optimization/20365 (simplify_plus_minus results are erratic)
PR rtl-optimization/20365
	* simplify-rtx.c (simplify_plus_minus_op_data): Change type of neg
	to short.  New member ix.
	(simplify_plus_minus_op_data_cmp): Break ties using ix member.
	(simplify_plus_minus): Initialize ix members before calling qsort.

From-SVN: r103771
2005-09-02 13:04:22 +01:00
Jakub Jelinek 1125164cd3 simplify-rtx.c (simplify_immed_subreg): Only clear up to elem_bitsize bits, not max_bitsize.
* simplify-rtx.c (simplify_immed_subreg) <case CONST_DOUBLE>: Only clear
	up to elem_bitsize bits, not max_bitsize.

	* gcc.target/i386/sse-4.c: New test.

From-SVN: r103318
2005-08-21 15:27:56 +02:00
Ulrich Weigand 5b5dc47588 simplify-rtx.c (simplify_const_relational_operation): When extracting arguments of a COMPARE, recompute the mode as well.
* simplify-rtx.c (simplify_const_relational_operation): When
	extracting arguments of a COMPARE, recompute the mode as well.

From-SVN: r103143
2005-08-16 02:01:27 +00:00
James A. Morrison 77d1d8e01f re PR rtl-optimization/23047 (Combine ignores flag_wrapv)
2005-07-27  James A. Morrison  <phython@gcc.gnu.org>

        PR rtl-optimization/23047
        * simplify-rtx.c (simplify_const_relational_operation): Respect
        flag_wrapv for comparisons with ABS.

From-SVN: r102459
2005-07-28 04:40:05 +00:00
Kelley Cook 366ccddb2b Update FSF address.
From-SVN: r101317
2005-06-25 02:02:01 +00:00
Paolo Bonzini bdb8217782 simplify-rtx.c (avoid_constant_pool_reference): Support offsetted addresses in the constant pool.
2005-05-26  Paolo Bonzini  <bonzini@gnu.org>

	* simplify-rtx.c (avoid_constant_pool_reference): Support
	offsetted addresses in the constant pool.

From-SVN: r100198
2005-05-26 08:15:31 +00:00
Richard Henderson 3f2960d5a5 re PR rtl-optimization/21163 (internal compiler error: in output_constant_pool_2, at varasm.c:3135)
PR rtl-opt/21163
        * simplify-rtx.c (simplify_binary_operation) <IOR>: Check
        for SCALAR_INT_MODE_P instead of not MODE_CC before returning
        constm1_rtx.
        <AND, LSHIFTRT, UMIN>: Use CONST0_RTX.
        <UDIV, UMOD>: Use CONST0_RTX and CONST1_RTX.
        <DIV, MOD>: Likewise.

From-SVN: r98678
2005-04-24 15:16:48 -07:00
Richard Henderson 6800ea5c57 re PR rtl-optimization/21102 (ICE: in immed_double_const, on SSE2 intrinsics)
PR rtl-opt/21102
        * simplify-rtx.c (simplify_binary_operation): Fix mode check before
        performing some integral scalar simplifications.

From-SVN: r98631
2005-04-23 12:16:54 -07:00
Fariborz Jahanian 6bd1354069 Fix result of folding of xor operation on two identical vectors.
OKed by Roger Sayle.

From-SVN: r98107
2005-04-13 19:47:30 +00:00
Joseph Myers 7443a71d62 re PR target/20093 (23_containers/deque/cons/2.cc execution test fails on ia64-hpux, -milp32)
PR target/20093
	* simplify-rtx.c (simplify_unary_operation_1): Check
	SUBREG_PROMOTED_UNSIGNED_P (op) > 0 for zero-extension.

From-SVN: r97775
2005-04-07 09:21:31 +01:00
Alexandre Oliva fab2f52cf8 re PR rtl-optimization/20532 (Bad code for DImode left shifts by 31 and then 1)
gcc/ChangeLog:
PR rtl-optimization/20532
* simplify-rtx.c (simplify_binary_operation_1): Protect from
overflow when adding coefficients for PLUS or MINUS.
(simplify_binary_operation_1): Handle CONST_DOUBLE exact power of
two as multiplier.
gcc/testsuite/ChangeLog:
PR rtl-optimization/20532
* gcc.target/i386/badshift.c: New.

From-SVN: r96982
2005-03-24 05:57:52 +00:00
Paolo Bonzini 9ce921aba8 rtl.h (struct rtx_hooks): Add gen_lowpart_no_emit.
2005-03-21  Paolo Bonzini  <bonzini@gnu.org>

	* rtl.h (struct rtx_hooks): Add gen_lowpart_no_emit.
	* rtlhooks.c (gen_lowpart_no_emit_general): New.
	* rtlhooks-def.h (gen_lowpart_no_emit_general): Declare.
	(RTL_HOOKS_GEN_LOWPART_NO_EMIT): New.
	* simplify-rtx.c (simplify_binary_operation_1): Use it.

From-SVN: r96799
2005-03-21 14:30:51 +00:00
Andrew Pinski dddcca1d19 re PR rtl-optimization/20412 (RTL checking failure in the combiner)
PR rtl-opt/20412
	* simplify-rtx.c (simplify_relational_operation_1): Fix typo - check the
	correct mode.

	PR rtl-opt/20412
	* gcc.c-torture/compile/pr20412.c: New test.

From-SVN: r96264
2005-03-10 14:13:01 -08:00
Kazu Hirata bb80db7b6d combine.c (simplify_and_const_int): Use gen_int_mode instead of GEN_INT (trunc_int_for_mode (...)).
* combine.c (simplify_and_const_int): Use gen_int_mode instead
	of GEN_INT (trunc_int_for_mode (...)).
	* loop-iv.c (iv_number_of_iterations): Likewise.
	* postreload.c (reload_cse_move2add): Likewise.
	* simplify-rtx.c (simplify_const_unary_operation,
	simplify_const_binary_operation): Likewise.
	* stor-layout.c (get_mode_bounds): Likewise.

From-SVN: r95935
2005-03-05 17:25:33 +00:00
Paolo Bonzini 0a67e02c3a simplify-rtx.c (simplify_unary_operation_1, [...]): New, extracted from...
2005-02-28 Paolo Bonzini <bonzini@gnu.org>

	* simplify-rtx.c (simplify_unary_operation_1,
	simplify_const_unary_operation): New, extracted from...
	(simplify_unary_operation): ... this one.
	(simplify_binary_operation_1,
	simplify_const_binary_operation): New, extracted from...
	(simplify_binary_operation): ... this one.
	* rtl.h (simplify_const_unary_operation,
	simplify_const_binary_operation): Add prototypes.

From-SVN: r95686
2005-02-28 15:29:43 +00:00
Roger Sayle 61961eff56 re PR target/20018 ([ia64] unable to find a register to spill in class`PR_REG')
PR target/20018
	PR rtl-optimization/20097
	* simplify-rtx.c (simplify_relational_operation_1): Avoid creating
	BImode SUBREGs of SImode registers which confuse the ia64 backend.

From-SVN: r95461
2005-02-23 18:20:52 +00:00
Paolo Bonzini 35ef372de4 simplify-rtx.c (simplify_unary_operation): Add a missing "break" statement.
2005-02-21  Paolo Bonzini  <bonzini@gnu.org>

	* simplify-rtx.c (simplify_unary_operation): Add a missing
	"break" statement.

From-SVN: r95321
2005-02-21 07:37:51 +00:00
Kazu Hirata 647eea9dd8 c-tree.h, [...]: Fix comment typos.
* c-tree.h, combine.c, expmed.c, flow.c, libgcc2.c,
	simplify-rtx.c, tree-ssa-live.h: Fix comment typos.  Follow
	spelling conventions.

From-SVN: r94939
2005-02-12 15:17:56 +00:00
Roger Sayle f8eacd975b simplify-rtx.c (simplify_relational_operation_1): Avoid creating zero extensions of BImode operands.
* simplify-rtx.c (simplify_relational_operation_1): Avoid creating
	zero extensions of BImode operands.  Call lowpart_subreg instead
	of gen_lowpart_common and gen_lowpart_SUBREG.

From-SVN: r94730
2005-02-08 03:38:26 +00:00
Roger Sayle b1a224073e re PR rtl-optimization/19800 (mmix-knuth-mmixware broken, building newlib/libm/common/s_fmax.c)
PR rtl-optimization/19800
	* simplify_rtx.c (simplify_relational_operaration_1): Explicitly
	call gen_lowpart_common and gen_lowpart_SUBREG instead of calling
	gen_lowpart.

From-SVN: r94691
2005-02-07 05:39:05 +00:00
Roger Sayle 1419a8859b simplify-rtx.c (simplify_relational_operation_1): Simplify (ne:SI (zero_extract:SI FOO (const_int 1) BAR) (const_int 0)) into...
* simplify-rtx.c (simplify_relational_operation_1): Simplify
	(ne:SI (zero_extract:SI FOO (const_int 1) BAR) (const_int 0))
	into just (zero_extract:SI FOO (const_int 1) BAR).

Co-Authored-By: Andrew Pinski <pinskia@physics.uc.edu>
Co-Authored-By: Paolo Bonzini <paolo.bonzini@lu.unisi.ch>

From-SVN: r94684
2005-02-06 23:33:25 +00:00
Roger Sayle 762297d941 re PR middle-end/19405 (18_support/numeric_limits.cc fails on ppc-darwin (long doubles))
PR middle-end/19405
	* real.h (REAL_MODE_FORMAT_COMPOSITE_P): New macro.
	* fold-const.c (const_binop): Avoid constant folding floating
	point operations in modes that use composite representations.
	* simplify-rtx.c (simplify_binary_operation): Likewise.

From-SVN: r94653
2005-02-03 06:44:35 +00:00
Roger Sayle d284eb28eb re PR rtl-optimization/576 (gcc performs invalid optimization with float operations when different rounding mode.)
PR rtl-optimization/576
	* real.c (real_arithmetic): Change return type from void to bool
	to return an indication that the result may be inexact.
	* real.h (real_arithmeric): Update prototype.
	* fold-const.c (const_binop):  Don't constant fold floating
	point expressions when the user specifies -frounding-math and
	the result may depend upon the run-time rounding mode.
	(fold_convert_const_real_from_real): Clean-up.
	(fold_initializer): Ignore flag_rounding_math for initializers.
	* simplify-rtx.c (simplify_binary_operation): Likewise, don't
	constant fold FP operations with flag_rounding_math if the
	result may depend upon the run-time rounding mode.

From-SVN: r94020
2005-01-21 17:54:26 +00:00
Roger Sayle a0ee8b5f99 simplify-rtx.c (simplify_binary_operation): Optimize (and (sign_extend X) C) into (zero_extend (and X C)).
* simplify-rtx.c (simplify_binary_operation) <AND>: Optimize
	(and (sign_extend X) C) into (zero_extend (and X C)).

From-SVN: r93629
2005-01-14 04:17:13 +00:00
Roger Sayle c79fc2963d simplify-rtx.c (simplify_subreg): Simplify truncations of shifts of sign or zero extended values.
* simplify-rtx.c (simplify_subreg): Simplify truncations of shifts
	of sign or zero extended values.

From-SVN: r93022
2005-01-07 00:47:13 +00:00
Uros Bizjak 21e5076a0b re PR middle-end/17767 (MMX intrinsics cause internal compiler error)
PR middle-end/17767
	* cse.c (fold_rtx) [RTX_COMPARE, RTX_COMM_COMPARE]: Don't attempt
	any simplifications of vector mode comparison operators.
	* simplify-rtx.c (simplify_relational_operation): Fix variable name.

testsuite:

	* gcc.dg/i386-mmx-6.c: New test case.

From-SVN: r92896
2005-01-04 16:44:25 +01:00
Richard Henderson 3198b947a8 * simplify-rtx.c (simplify_binary_operation): Handle VEC_CONCAT.
From-SVN: r92861
2005-01-03 11:41:06 -08:00
Richard Henderson 551a3297bb simplify-rtx.c (simplify_relational_operation_1): Don't simplify plus/minus across EQ for floating-point.
* simplify-rtx.c (simplify_relational_operation_1): Don't simplify
        plus/minus across EQ for floating-point.

From-SVN: r92631
2004-12-26 19:31:49 -08:00
Zdenek Dvorak bc4ad38cc7 re PR rtl-optimization/18942 (Do loop is not as optimized as 3.3.2)
PR rtl-optimization/18942
	* simplify-rtx.c (simplify_relational_operation_1): Simplify
	x + cst1 == cst2 to x == cst2 - cst1.  Made static.

From-SVN: r92429
2004-12-20 20:48:53 +00:00
Richard Henderson b2b7ec86c2 simplify-rtx.c (simplify_replace_rtx): Do not blindly replace hard registers.
* simplify-rtx.c (simplify_replace_rtx): Do not blindly replace
	hard registers.

[[Split portion of a mixed commit.]]

Co-Authored-By: Aldy Hernandez <aldyh@redhat.com>

From-SVN: r92278.2
2004-12-16 19:19:04 +00:00
Roger Sayle 5ac20c1a83 re PR rtl-optimization/18928 (ice on valid code with -O2 -fPIC)
PR rtl-optimization/18928
	* simplify_rtx.c (plus_minus_operand_p): New function to encode
	the test for suitable operands for calls to simplify_plus_minus.
	Only allow (CONST (PLUS x y)) if both x and y are CONSTANT_P.
	(simplify_binary_operation): Use plus_minus_operand_p.

	* gcc.dg/pr18928-1.c: New test case.

From-SVN: r92109
2004-12-13 23:49:28 +00:00
Richard Sandiford 4f1da2e923 simplify-rtx.c (simplify_subreg): In the CONCAT case...
* simplify-rtx.c (simplify_subreg): In the CONCAT case, check whether
	the request subreg is entirely contained in the requested component.
	(simplify_gen_subreg): Return null for CONCATs that are rejected
	by simplify_subreg.
	* expmed.c (store_bit_field): Create a temporary when changing the
	value to an integer mode.

From-SVN: r91965
2004-12-09 20:28:14 +00:00
Richard Henderson 6e4b5aaf4d re PR target/18774 (mmix-knuth-mmixware testsuite failure: gcc.c-torture/execute/20020227-1.c -Os -O2 compile)
PR 18774
        * simplify-rtx.c (simplify_immed_subreg): Fail complex modes.

From-SVN: r91672
2004-12-02 19:27:34 -08:00
Ulrich Weigand fbee756399 re PR rtl-optimization/18420 (ICE compiling mesa at -O2)
PR rtl-optimization/18420
	* simplify-rtx.c (simplify_gen_subreg): Revert 2004-10-28 change.

From-SVN: r91419
2004-11-28 13:02:52 +00:00
Richard Henderson beb7268481 rtl.h (validate_subreg): Declare.
* rtl.h (validate_subreg): Declare.
        * emit-rtl.c (validate_subreg): New.
        (gen_rtx_SUBREG): Use it.
        * simplify-rtx.c (simplify_subreg): Likewise.
        (simplify_gen_subreg): Likewise.  Remove duplicate asserts.
        * expr.c (emit_move_insn_1): Tidy complex move code.  Use memory
        fallback whenever gen_realpart/gen_imagpart would not be able to
        create SUBREGs.

From-SVN: r91126
2004-11-23 16:09:03 -08:00
Richard Henderson 4488a8b876 simplify-rtx.c (simplify_subreg): Use subreg_regno_offset directly instead of using a SUBREG temporary.
* simplify-rtx.c (simplify_subreg): Use subreg_regno_offset directly
        instead of using a SUBREG temporary.

From-SVN: r91114
2004-11-23 15:03:15 -08:00
Uros Bizjak 27b28c6dcd simplify-rtx.c (simplify_binary_operation): Do not simplify inner elements of constant arguments of VEC_CONCAT insn.
rtl-optimization/18614
        * simplify-rtx.c (simplify_binary_operation): Do not
        simplify inner elements of constant arguments of
        VEC_CONCAT insn.

testsuite:

        * gcc.dg/pr18614-1.c: New test.

From-SVN: r91094
2004-11-23 17:20:51 +01:00
Aldy Hernandez 449ecb09b3 simplify-rtx.c (simplify_ternary_operation): Use trunc_int_for_mode.
* simplify-rtx.c (simplify_ternary_operation): Use
        trunc_int_for_mode.

From-SVN: r90948
2004-11-20 01:44:25 +00:00
Ulrich Weigand fd326ba823 re PR target/15286 (ICE cause by reload)
PR target/15286
	* final.c (alter_subreg): Compute correct offset to use with
	paradoxical SUBREGs of memory operands.
	* recog.c (general_operand): Allow paradoxical SUBREGs of
	memory operands after reload.
	* simplify-rtx.c (simplify_gen_subreg): Fail if simplify_subreg
	has failed when passed a hard register.

From-SVN: r89752
2004-10-28 12:47:21 +00:00
Pat Haugen b757b9f8b2 simplify-rtx.c (mode_signbit_p): Externalize function...
2004-10-18  Pat Haugen  <pthaugen@us.ibm.com>

        * simplify-rtx.c (mode_signbit_p): Externalize function...
        * rtl.h (mode_signbit_p): ... to here.
        * combine.c (simplify_shift_const): Recognize PLUS signbit as
        canonical form of XOR signbit and move to outer op.

From-SVN: r89235
2004-10-18 14:46:06 -04:00
Roger Sayle fc7ca5fd39 [multiple changes]
2004-10-09  Roger Sayle  <roger@eyesopen.com>

	PR rtl-optimization/17853
	* simplify-rtx.c (simplify_relational_operation): Correct comment.
	Reorganize handling of comparison operations with floating point
	results (always return 0.0 even without FLOAT_STORE_FLAG_VALUE).
	Likewise, introduce support for comparison operations with vector
	result types, introducing a new VECTOR_STORE_FLAG_VALUE target macro.

	* doc/rtl.texi: Document new VECTOR_STORE_FLAG_VALUE target macro.
	* doc/tm.texi: Likewise.

2004-10-09  Stuart Hastings  <stuart@apple.com>
	    Roger Sayle  <roger@eyesopen.com>

	PR rtl-optimization/17853
	* gcc.dg/i386-mmx-5.c: New testcase.

From-SVN: r88826
2004-10-09 19:27:55 +00:00
Nathan Sidwell 41374e13ac ra-build.c (copy_insn_p, [...]): Use gcc_assert and gcc_unreachable instead of abort.
* ra-build.c (copy_insn_p, remember_move, defuse_overlap_p_1,
	live_out_1, prune_hardregs_for_mode, init_one_web_common,
	reinit_one_web, add_subweb, add_subweb_2, init_web_parts,
	record_conflict, compare_and_free_webs, init_webs_defs_uses,
	parts_to_webs_1, parts_to_webs, reset_conflicts,
	check_conflict_numbers, remember_web_was_spilled, handle_asm_insn,
	ra_build_free): Use gcc_assert and gcc_unreachable instead of abort.
	* ra-colorize.c (push_list, put_web, reset_lists, put_web_at_end,
	put_move, remove_move, combine, select_spill, colorize_one_web,
	try_recolor_web, insert_coalesced_conflicts, check_colors,
	break_precolored_alias, restore_conflicts_from_coalesce,
	sort_and_combine_web_pairs, check_uncoalesced_moves): Likewise.
	* ra-rewrite.c (spill_coalescing, slots_overlap_p, emit_loads,
	reloads_to_loads, rewrite_program2, emit_colors): Likewise.
	* ra.c (first_hard_reg, create_insn_info, find_subweb, init_ra,
	check_df): Likewise.
	* real.c (do_add, do_multiply, do_divide, do_compare, do_fix_trunc,
	real_arithmetic, real_compare, real_exponent, real_ldexp,
	real_identical, real_to_integer, real_to_integer2, real_to_decimal,
	real_to_hexadecimal, real_from_integer, ten_to_ptwo, ten_to_mptwo,
	real_digit, real_nan, real_maxval, round_for_format, real_convert,
	real_to_target, real_from_target, real_hash, encode_ieee_single,
	encode_ieee_double, encode_ieee_extended, encode_ieee_quad,
	encode_vax_f, encode_vax_d, encode_vax_g, encode_i370_single,
	encode_i370_double, encode_c4x_single, encode_c4x_extended): Likewise.
	* recog.c (validate_change, validate_replace_rtx_1, asm_operand_ok,
	extract_insn, peep2_next_insn, peep2_reg_dead_p,
	peep2_find_free_register, peephole2_optimize, store_data_bypass_p,
	if_test_bypass_p): Likewise.
	* reg-stack.c (record_label_references, get_asm_operand_n_inputs,
	stack_result, remove_regno_note, get_hard_regnum, emit_pop_insn,
	emit_swap_insn, swap_to_top, move_for_stack_reg,
	subst_stack_regs_pat, subst_asm_stack_regs, change_stack,
	compensate_edge, convert_regs_1): Likewise.
	* regclass.c (init_reg_sets, init_reg_sets_1,
	memory_move_secondary_cost): Likewise.
	* regrename.c (note_sets, clear_dead_regs, scan_rtx_reg, scan_rtx):
	Likewise.
	* reload.c (push_secondary_reload, find_valid_class, push_reload,
	operands_match_p, decompose, immune_p, find_reloads,
	find_reloads_toplev, find_reloads_address_1, subst_reloads,
	copy_replacements, refers_to_regno_for_reload_p,
	reg_overlap_mentioned_for_reload_p): Likewise.
	* reload1.c (compute_use_by_pseudos, replace_pseudos_in, reload,
	count_pseudo, find_reg, eliminate_regs, eliminate_regs_in_insn,
	verify_initial_elim_offsets, finish_spills, clear_reload_reg_in_use,
	reload_reg_free_p, reload_reg_reaches_end_p, reloads_conflict,
	choose_reload_regs, merge_assigned_reloads, emit_input_reload_insns,
	do_output_reload, fixup_abnormal_edges): Likewise.
	* reorg.c (stop_search_p, emit_delay_sequence, get_jump_flags,
	fill_slots_from_thread, relax_delay_slots): Likewise.
	* resource.c (mark_referenced_resources, mark_set_resources):
	Likewise.
	* rtl.c (copy_rtx, rtx_equal_p): Likewise.
	* rtlanal.c (insn_dependent_p, reg_overlap_mentioned_p,
	dead_or_set_p, find_reg_fusage, remove_note, replace_rtx,
	subreg_lsb_1, subreg_regno_offset, subreg_offset_representable_p,
	find_first_parameter_load, can_hoist_insn_p, hoist_update_store,
	hoist_insn_after, hoist_insn_to_edge, nonzero_bits1): Likewise.
	* rtlhooks.c (gen_lowpart_general): Likewise.
	* sbitmap.c (sbitmap_difference): Likewise.
	* sched-deps.c (add_dependence, sched_analyze_1, sched_analyze_2,
	sched_analyze, add_forward_dependence): Likewise.
	* sched-ebb.c (fix_basic_block_boundaries, schedule_ebb): Likewise.
	* sched-rgn.c (debug_regions, compute_trg_info, schedule_region,
	schedule_insns): Likewise.
	* sched-vis.c (print_pattern): Likewise.
	* sdbout.c (sdbout_symbol, sdbout_toplevel_data): Likewise.
	* simplify-rtx.c (simplify_unary_operation, simplify_binary_operation,
	simplify_const_relational_operation, simplify_ternary_operation,
	simplify_immed_subreg, simplify_subreg, simplify_gen_subreg):
	Likewise.
	* sreal.c (copy, sreal_sub, sreal_div): Likewise.
	* stmt.c (force_label_rtx, expand_goto, expand_asm_operands,
	resolve_operand_name_1, expand_return, expand_decl,
	expand_anon_union_decl, emit_case_bit_tests, expand_case): Likewise.
	* stor-layout.c (put_pending_size, smallest_mode_for_size,
	int_mode_for_mode, layout_decl, finish_builtin_struct, layout_type,
	set_sizetype, get_mode_bounds): Likewise.

From-SVN: r87244
2004-09-09 17:19:16 +00:00
Richard Sandiford 273a2526bd md.texi (shift patterns): New anchor.
* doc/md.texi (shift patterns): New anchor.  Add reference to
	TARGET_SHIFT_TRUNCATION_MASK.
	* doc/tm.texi (TARGET_SHIFT_TRUNCATION_MASK): Document.
	* target.h (shift_truncation_mask): New target hook.
	* targhook.h (default_shift_truncation_mask): Declare.
	* targhook.c (default_shift_truncation_mask): Define.
	* target-def.h (TARGET_SHIFT_TRUNCATION_MASK): Define.
	(TARGET_INITIALIZER): Include it.
	* simplify-rtx.c (simplify_binary_operation): Combine ASHIFT, ASHIFTRT
	and LSHIFTRT cases.  Truncate arg1 if SHIFT_COUNT_TRUNCATED, otherwise
	reject all out-of-range values.  Fix sign-extension code for modes
	whose width is smaller than HOST_BITS_PER_WIDE_INT.
	* optabs.c (simplify_expand_binop, force_expand_binop): New functions.
	(expand_superword_shift, expand_subword_shift): Likewise.
	(expand_doubleword_shift_condmove, expand_doubleword_shift): Likewise.
	(expand_binop): Use them to implement double-word shifts.
	* config/arm/arm.c (arm_shift_truncation_mask): New function.
	(TARGET_SHIFT_TRUNCATION_MASK): Define.

From-SVN: r87079
2004-09-04 08:50:36 +00:00
Steven Bosscher 3fbd86b1a8 cfgexpand.c (tree_expand_cfg): Fix comment.
* cfgexpand.c (tree_expand_cfg): Fix comment.

	* calls.c (expand_call): Ignore rtx_equal_function_value_matters.
	* function.c (purge_single_hard_subreg_set, purge_hard_subreg_sets):
	Remove.
	(prepare_function_start): Don't set rtx_equal_function_value_matters.
	* integrate.c (copy_rtx_and_substitute): Don't test for it.
	* passes.c (rest_of_compilation): Don't call purge_hard_subreg_sets.
	Don't set rtx_equal_function_value_matters.  Don't register RTL hooks
	here again.  Update leading comment.
	* rtl.c (rtx_equal_function_value_matters): Remove.
	(rtx_equal_p): Don't test for it.
	* simplify-rtx.c (simplify_binary_operation, simplify_subreg):
	Likewise.

	* rtl.h (enum insn_note): Remove NOTE_INSN_LOOP_END_TOP_COND.
	* rtl.c (note_insn_name): Likewise.
	* emit-rtl.c (remove_unnecessary_notes): Don't handle it.
	* final.c (final_scan_insn): Likewise.

	* except.c (finish_eh_generation): Don't call cfg_cleanup from here.
	* passes.c (rest_of_handle_eh): Do it here.

	* stmt.c (struct nesting): Remove struct nesting block member.
	(struct stmt_status): Remove x_block_start_count field.
	(current_block_start_count): Remove.

From-SVN: r85228
2004-07-27 19:09:32 +00:00
Bernardo Innocenti 1ad463f493 c-common.c (disable_builtin_function): Rename variable n to new_disabled_builtin.
* c-common.c (disable_builtin_function): Rename variable n to
	new_disabled_builtin.
	* c-decl.c (duplicate_decls): Rename parameter decl to new_decl.
	Rename local variable old to old_decl.
	* gensupport.c (shift_output_template): Rename parameter old to src.
	* simplify-rtx.c (simplify_replace_rtx): Rename parameter oldx to
	old_rtx and newx to new_rtx.

From-SVN: r85175
2004-07-26 02:38:05 +02:00
Bernardo Innocenti 53ed1a12d3 c-common.c: Rename all identifiers named `new'.
* c-common.c: Rename all identifiers named `new'.
	* c-decl.c: Likewise.
	* gensupport.c: Likewise.
	* simplify-rtx.c: Likewise.

From-SVN: r85159
2004-07-25 21:09:36 +02:00
Paolo Bonzini ad76cef84c expr.c (enqueue_insn, [...]): Remove.
2004-07-14  Paolo Bonzini  <bonzini@gnu.org>

	* expr.c (enqueue_insn, finish_expr_for_function,
	protect_from_queue, queued_subexp_p, mark_queue,
	emit_insns_enqueued_after_mark, emit_queue,
	expand_increment): Remove.
	(store_constructor): Expand increment as an assignment.
	(expand_expr_real_1 <case PREINCREMENT_EXPR,
	case PREDECREMENT_EXPR, case POSTINCREMENT_EXPR,
	case POSTDECREMENT_EXPR>): Abort.
	* expr.h (QUEUED_VAR, QUEUED_INSN, QUEUED_COPY,
	QUEUED_BODY, QUEUED_NEXT, finish_expr_for_function,
	protect_from_queue, emit_queue, queued_subexp_p): Remove.
	* function.h (pending_chain, x_pending_chain): Remove.
	* rtl.def (QUEUED): Remove.

	* emit-rtl.c (copy_insn_1, copy_most_rtx,
	set_used_flags, verify_rtx_sharing): Remove references to QUEUED.
	* genattrtab.c (attr_copy_rtx, clear_struct_flag,
	encode_units_mask): Likewise.
	* local-alloc.c (equiv_init_varies_p): Likewise.
	* rtl.c (copy_rtx): Likewise.
	* rtlanal.c (rtx_unstable_p, rtx_varies_p): Likewise.
	* simplify-rtx.c (simplify_gen_subreg): Likewise.
	* config/mn10300/mn10300.c (legitimate_pic_operand_p): Likewise.

	* builtins.c (expand_builtin, expand_builtin_apply,
	expand_builtin_mathfn, expand_builtin_mathfn_2,
	expand_builtin_mathfn_3, expand_builtin_setjmp_setup):
	Remove calls to emit_queue and protect_from_queue.
	* calls.c (expand_call, precompute_arguments,
	precompute_register_parameters, rtx_for_function_call,
	store_one_arg): Likewise.
	* dojump.c (do_compare_and_jump, do_jump): Likewise.
	* explow.c (memory_address): Likewise.
	* expmed.c (clear_by_pieces_1, clear_storage,
	clear_storage_via_libcall, emit_group_load,
	emit_group_store, emit_store_flag,
	expand_expr_real_1, store_by_pieces,
	store_constructor, store_expr, try_casesi,
	try_tablejump): Likewise.
	* function.c (expand_pending_sizes): Likewise.
	* optabs.c (emit_cmp_and_jump_insns,
	emit_conditional_add, emit_conditional_move,
	expand_fix, expand_float, prepare_cmp_insn): Likewise.
	* stmt.c (emit_case_bit_tests,
	expand_asm_expr, expand_computed_goto,
	expand_decl_init, expand_end_case_type,
	expand_end_stmt_expr, expand_expr_stmt_value,
	expand_return, expand_start_case,
	optimize_tail_recursion): Likewise.
	* config/c4x/c4x.c (c4x_expand_builtin): Likewise.
	* config/s390/s390.c (s390_expand_cmpmem): Likewise.

From-SVN: r84675
2004-07-14 07:30:23 +00:00
Richard Henderson 04b80a8885 simplify-rtx.c (simplify_const_relational_operation): Only look at bounds of scalar integers.
* simplify-rtx.c (simplify_const_relational_operation): Only
        look at bounds of scalar integers.

From-SVN: r84427
2004-07-09 17:24:23 -07:00
Roger Sayle aec53add6a simplify-rtx.c (simplify_binary_operation): Use rtx_cost instead of "had_mult" to determine whether the transformed...
* simplify-rtx.c (simplify_binary_operation) <PLUS, MINUS>: Use
	rtx_cost instead of "had_mult" to determine whether the transformed
	expression is cheaper than the original.

From-SVN: r83981
2004-07-01 13:09:39 +00:00
Jerry Quinn 3c0cb5de6a alias.c (get_alias_set, [...]): Use MEM_P.
2004-07-01  Jerry Quinn  <jlquinn@optonline.net>

	* alias.c (get_alias_set, canon_rtx, get_addr,
	nonoverlapping_memrefs_p, nonlocal_referenced_p_1, memory_modified_1):
	Use MEM_P.
	* builtins.c (expand_builtin_prefetch, expand_builtin_profile_func,
	expand_builtin): Likewise.
	* calls.c (expand_call, emit_library_call_value_1, store_one_arg):
	Likewise.
	* combine.c (can_combine_p, combinable_i3pat, try_combine,
	find_split_point, combine_simplify_rtx, simplify_set, make_extraction,
	rtx_equal_for_field_assignment_p, gen_lowpart_for_combine,
	record_dead_and_set_regs_1, get_last_value_validate,
	mark_used_regs_combine, move_deaths, unmentioned_reg_p_1): Likewise.
	* cse.c (check_dependence, canon_hash, equiv_constant,
	gen_lowpart_if_possible, cse_insn, invalidate_from_clobbers,
	cse_around_loop, cse_check_loop_start, cse_set_around_loop,
	count_reg_usage): Likewise.
	* cselib.c (rtx_equal_for_cselib_p, add_mem_for_addr, cselib_lookup,
	cselib_invalidate_mem, cselib_invalidate_rtx, cselib_record_set,
	cselib_record_sets): Likewise.
	* dbxout.c (PARM_PASSED_IN_MEMORY, dbxout_symbol,
	dbxout_symbol_location, dbxout_parms, dbxout_reg_parms): Likewise.
	* ddg.c (mark_mem_use, mark_mem_store, rtx_mem_access_p): Likewise.
	* df.c (df_uses_record): Likewise.
	* dojump (do_jump): Likewise.
	* dwarf2out.c (stack_adjust_offset, mem_loc_descriptor,
	loc_descriptor_from_tree, rtl_for_decl_location, add_bound_info,
	decl_start_label): Likewise.
	* emit-rtl.c (gen_complex_constant_part, gen_highpart,
	operand_subword, change_address_1, make_safe_from): Likewise.
	* explow.c (break_out_memory_refs, copy_all_regs, validize_mem,
	stabilize, force_not_mem): Likewise.
	* expmed.c (store_bit_field, store_split_bit_field, extract_bit_field,
	expand_mult_const, expand_divmod, emit_store_flag): Likewise.
	* expr.c (convert_move, convert_modes, emit_block_move,
	emit_group_load, emit_group_store, clear_storage, emit_move_insn,
	emit_move_insn_1, expand_assignment, store_expr,
	store_constructor_field, store_constructor, store_field,
	force_operand, safe_from_p, expand_expr_real_1, expand_increment):
	Likewise.
	* final.c (cleanup_subreg_operands, alter_subreg,
	get_mem_expr_from_op): Likewise.
	* flow.c (notice_stack_pointer_modification_1,
	init_propagate_block_info, insn_dead_p, mark_set_1, mark_used_regs):
	Likewise.
	* function.c (mark_temp_addr_taken, preserve_temp_slots,
	preserve_rtl_expr_result, put_var_into_stack, fixup_var_refs_1,
	optimize_bit_field, flush_addressof, purge_addressof_1,
	instantiate_decl, instantiate_virtual_regs_1, assign_parms,
	setjmp_protect, setjmp_protect_args, fix_lexical_addr,
	keep_stack_depressed): Likewise.
	* ifcvt.c (noce_try_cmove_arith, noce_try_abs, noce_operand_ok,
	noce_process_if_block, find_memory): Likewise.
	* integrate.c (subst_constants, allocate_initial_values): Likewise.
	* local-alloc.c (validate_equiv_mem_from_store, memref_referenced_p,
	update_equiv_regs): Likewise.
	* loop.c (scan_loop, prescan_loop, note_addr_stored, check_store,
	maybe_eliminate_biv_1, find_mem_in_note_1): Likewise.
	* optabs.c (expand_abs, emit_unop_insn): Likewise.
	* passes.c (rest_of_handle_final): Likewise.
	* postreload.c (reload_cse_simplify_set, reload_cse_simplify_operands,
	move2add_note_store): Likewise.
	* ra-build.c (detect_remat_webs): Likewise.
	* ra-debug.c (dump_static_insn_cost): Likewise.
	* ra-rewrite.c (slots_overlap_p, insert_stores): Likewise.
	* recog.c (validate_change, apply_change_group, cancel_changes,
	validate_replace_rtx_1, general_operand, register_operand,
	nonmemory_operand, push_operand, pop_operand, memory_operand,
	indirect_operand, asm_operand_ok, offsettable_memref_p,
	offsettable_nonstrict_memref_p, constrain_operands,
	store_data_bypass_p): Likewise.
	* reg-stack.c (subst_stack_regs_pat): Likewise.
	* regclass.c (record_operand_costs, scan_one_insn, record_reg_classes,
	copy_cost, reg_scan_mark_refs): Likewise.
	* regmove.c (optimize_reg_copy_3, stack_memref_p,
	combine_stack_adjustments_for_block): Likewise.
	* regrename.c (copyprop_hardreg_forward_1): Likewise.
	* reload.c (can_reload_into, push_reload, decompose, immune_p,
	find_reloads, find_reloads_address, find_reloads_address_1,
	reg_overlap_mentioned_for_reload_p, refers_to_mem_for_reload_p,
	find_equiv_reg): Likewise.
	* reload1.c (reload, eliminate_regs, eliminate_regs_in_insn,
	reload_as_needed, choose_reload_regs, emit_input_reload_insns,
	do_input_reload, emit_reload_insns, gen_reload, delete_output_reload,
	delete_address_reloads): Likewise.
	* resource.c (mark_referenced_resources): Likewise.
	* rtlanal.c (get_jump_table_offset, count_occurrences,
	reg_referenced_p, reg_set_p, set_of_1, set_noop_p,
	reg_overlap_mentioned_p, note_uses, replace_regs, nonzero_bits1,
	num_sign_bit_copies1): Likewise.
	* rtlhooks.c (gen_lowpart_general): Likewise.
	* sched-deps.c (sched_analyze_1, sched_analyze_2): Likewise.
	* sdbout.c (PARM_PASSED_IN_MEMORY, sdbout_symbol,
	sdbout_toplevel_data, sdbout_parms, sdbout_reg_parms,
	sdbout_global_decl): Likewise.
	* simplify-rtx.c (simplify_subreg): Likewise.
	* stmt.c (expand_asm_operands, expand_expr_stmt_value, expand_decl,
	expand_anon_union_decl, expand_end_case_type): Likewise.
	* unroll.c (calculate_giv_inc): Likewise.
	* var-tracking.c (stack_adjust_offset_pre_post,
	bb_stack_adjust_offset, track_expr_p, count_uses, add_uses,
	add_stores, compute_bb_dataflow, vt_get_decl_and_offset,
	vt_add_function_parameters): Likewise.
	* varasm.c (make_var_volatile, notice_global_symbol,
	assemble_external, decode_addr_const, mark_weak,
	default_encode_section_info): Likewise.

From-SVN: r83980
2004-07-01 12:52:53 +00:00
Jakub Jelinek df62f18ae1 re PR tree-optimization/15310 ([tree-ssa] Optimize an addition in a bit field)
* simplify-rtx.c (simplify_binary_operation): Simplify
	((A & N) + B) & M -> (A + B) & M if M is pow2 minus 1 constant and
	N has at least all bits in M set as well.

	PR tree-optimization/15310
	* expr.c (expand_assignment): Optimize += or -= on a bit field in
	most significant bits.

	* gcc.c-torture/execute/20040629-1.c: New test.

From-SVN: r83900
2004-06-30 12:09:55 +02:00
Jerry Quinn f8cfc6aa07 alias.c (record_set, [...]): Use REG_P.
2004-06-15  Jerry Quinn  <jlquinn@optonline.net>

	* alias.c (record_set, record_base_value, canon_rtx, get_addr,
	nonlocal_mentioned_p_1, init_alias_analysis): Use REG_P.
	* bt-load.c (find_btr_reference, insn_sets_btr_p, note_btr_set):
	Likewise.
	* builtins.c (expand_builtin_setjmp, expand_builtin_apply,
	expand_builtin_mathfn, expand_builtin_strlen, expand_builtin_memcmp,
	expand_builtin_strcmp, expand_builtin_strncmp,
	expand_builtin_frame_address): Likewise.
	* caller-save.c (mark_set_regs, add_stored_regs, mark_referenced_regs,
	insert_one_insn): Likewise.
	* calls.c (prepare_call_address, precompute_register_parameters,
	precompute_arguments, expand_call, emit_library_call_value_1): Likewise.
	* cfganal.c (flow_active_insn_p): Likewise.
	* combine.c (set_nonzero_bits_and_sign_copies, can_combine_p,
	combinable_i3pat, try_combine, find_split_point, COMBINE_RTX_EQUAL_P,
	subst, combine_simplify_rtx, simplify_if_then_else, simplify_set,
	make_extraction, recog_for_combine, gen_lowpart_for_combine,
	simplify_comparison, record_dead_and_set_regs_1,
	record_dead_and_set_regs, record_promoted_value,
	check_promoted_subreg, get_last_value_validate, get_last_value,
	reg_dead_at_p_1, reg_bitfield_target_p, distribute_notes,
	unmentioned_reg_p_1): Likewise.
	* conflict.c (mark_reg): Likewise.
	* cse.c (HASH, COST, COST_IN, approx_reg_cost_1, notreg_cost,
	mention_regs, insert_regs, lookup, lookup_for_remove, insert,
	merge_equiv_classes, flush_hash_table, invalidate,
	remove_invalid_refs, remove_invalid_subreg_refs, rehash_using_reg,
	invalidate_for_call, use_related_value, canon_hash, exp_equiv_p,
	cse_rtx_varies_p, canon_reg, find_best_addr, fold_rtx, equiv_constant,
	record_jump_cond, cse_insn, addr_affects_sp_p,
	invalidate_from_clobbers, cse_process_notes, cse_around_loop,
	cse_set_around_loop, count_reg_usage, set_live_p, cse_change_cc_mode,
	cse_cc_succs, cse_condition_code_reg): Likewise.
	* cselib.c (cselib_reg_set_mode, rtx_equal_for_cselib_p,
	cselib_lookup, cselib_invalidate_regno, cselib_invalidate_rtx,
	cselib_record_set, cselib_record_sets): Likewise.
	* dbxout.c (dbxout_symbol_location, dbxout_parms, dbxout_reg_parms,
	dbxout_block): Likewise.
	* df.c (df_ref_record, df_def_record_1, df_uses_record): Likewise.
	* dojump.c (do_jump): Likewise.
	* dwarf2out.c (dwarf2out_frame_debug_expr, is_pseudo_reg,
	is_based_loc, rtl_for_decl_location): Likewise.
	* emit-rtl.c (set_reg_attrs_for_parm, set_decl_rtl,
	set_decl_incoming_rtl, mark_user_reg): Likewise.
	* explow.c (copy_all_regs, copy_all_regs, memory_address, force_reg,
	copy_to_suggested_reg, allocate_dynamic_stack_space,
	probe_stack_range, hard_function_value): Likewise.
	* expmed.c (store_bit_field, store_fixed_bit_field,
	store_split_bit_field, extract_bit_field, extract_fixed_bit_field,
	extract_split_bit_field, expand_divmod, emit_store_flag_force):
	Likewise.
	* expr.c (convert_move, convert_modes,
	block_move_libcall_safe_for_call_parm, emit_group_load, use_reg,
	use_group_regs, emit_move_insn, emit_move_insn_1,
	compress_float_constant, push_block, emit_single_push_insn,
	emit_push_insn, get_subtarget, expand_assignment, store_expr,
	store_constructor, store_field, force_operand, safe_from_p,
	expand_expr_real_1, expand_increment, do_store_flag, do_tablejump):
	Likewise.
	* final.c (profile_function, final_scan_insn, alter_subreg,
	get_mem_expr_from_op, output_asm_operand_names, output_operand,
	only_leaf_regs_used, leaf_renumber_regs_insn): Likewise.
	* flow.c (verify_wide_reg_1, mark_regs_live_at_end,
	find_regno_partial, propagate_one_insn, init_propagate_block_info,
	insn_dead_p, libcall_dead_p, mark_set_1, not_reg_cond,
	attempt_auto_inc, find_auto_inc, mark_used_regs,
	count_or_remove_death_notes_bb): Likewise.
	* function.c (find_temp_slot_from_address, update_temp_slot_address,
	preserve_temp_slots, put_var_into_stack, fixup_var_refs_insn,
	fixup_var_refs_1, fixup_stack_1, optimize_bit_field, flush_addressof,
	put_addressof_into_stack, purge_addressof_1, insns_for_mem_walk,
	purge_single_hard_subreg_set, instantiate_decl,
	instantiate_virtual_regs_1, aggregate_value_p, assign_parms,
	promoted_input_arg, setjmp_vars_warning, setjmp_args_warning,
	setjmp_protect, setjmp_protect_args, fix_lexical_addr,
	expand_function_start, diddle_return_value, clobber_return_register,
	expand_function_end, keep_stack_depressed, handle_epilogue_set,
	update_epilogue_consts): Likewise.
	* genemit.c (gen_exp, gen_insn): Likewise.
	* genrecog.c (make_insn_sequence): Likewise.
	* global.c (global_conflicts, expand_preferences, mark_reg_store,
	mark_reg_conflicts, set_preference, reg_becomes_live,
	build_insn_chain, mark_reg_change): Likewise.
	* haifa_sched.c (CONST_BASED_ADDRESS_P, find_set_reg_weight):
	Likewise.
	* ifcvt.c (noce_try_abs, noce_get_condition, noce_process_if_block):
	Likewise.
	* integrate.c (copy_rtx_and_substitute, try_constants,
	subst_constants, mark_stores, allocate_initial_values): Likewise.
	* jump.c (reversed_comparison_code_parts, delete_prior_computation,
	delete_computation, rtx_renumbered_equal_p, true_regnum,
	reg_or_subregno): Likewise.
	* lcm.c (reg_dies, reg_becomes_live): Likewise.
	* local-alloc.c (validate_equiv_mem_from_store, validate_equiv_mem,
	update_equiv_regs, no_equiv, block_alloc, combine_regs, reg_is_set,
	wipe_dead_reg, no_conflict_p): Likewise.
	* loop-iv.c (simple_reg_p, simple_set_p, kill_sets,
	iv_get_reaching_def, iv_analyze_biv, altered_reg_used, mark_altered,
	simple_rhs_p, simplify_using_assignment, implies_p): Likewise.
	* loop.c (scan_loop, combine_movables, rtx_equal_for_loop_p,
	move_movables, note_set_pseudo_multiple_uses, consec_sets_invariant_p,
	find_single_use_in_loop, count_one_set, loop_bivs_init_find,
	loop_givs_rescan, check_insn_for_bivs, check_insn_for_givs,
	valid_initial_value_p, simplify_giv_expr, consec_sets_giv,
	loop_regs_update, check_dbra_loop, maybe_eliminate_biv,
	maybe_eliminate_biv_1, record_initial, update_reg_last_use,
	canonicalize_condition, loop_regs_scan, load_mems, try_copy_prop,
	try_swap_copy_prop): Likewise.
	* optabs.c (expand_binop, expand_vector_binop, expand_vector_unop,
	expand_abs, emit_no_conflict_block, emit_libcall_block, expand_float):
	Likewise.
	* postreload.c (reload_cse_simplify, reload_cse_simplify_set,
	reload_cse_simplify_operands, reload_combine,
	reload_combine_note_store, reload_combine_note_use,
	reload_cse_move2add, move2add_note_store): Likewise.
	* print-rtl.c (print_rtx): Likewise.
	* ra-build.c (copy_insn_p, remember_move, init_one_web_common,
	contains_pseudo, handle_asm_insn): Likewise.
	* ra-debug.c (ra_print_rtx_object, dump_constraints,
	dump_static_insn_cost): Likewise.
	* ra-rewrite.c (slots_overlap_p, emit_colors,
	remove_suspicious_death_notes): Likewise.
	* recog.c (validate_replace_rtx_1, find_single_use_1, find_single_use,
	register_operand, scratch_operand, nonmemory_operand,
	constrain_operands): Likewise.
	* reg-stack (check_asm_stack_operands, remove_regno_note,
	emit_swap_insn, swap_rtx_condition, subst_stack_regs_pat,
	subst_asm_stack_regs): Likewise.
	* regclass.c (scan_one_insn, record_reg_classes, copy_cost,
	record_address_regs, reg_scan_mark_refs): Likewise.
	* regmove.c (discover_flags_reg, replacement_quality,
	copy_src_to_dest, reg_is_remote_constant_p, regmove_optimize,
	fixup_match_1): Likewise.
	* regrename.c (note_sets, clear_dead_regs, build_def_use, kill_value,
	kill_set_value, copyprop_hardreg_forward_1): Likewise.
	* reload.c (MATCHES, push_secondary_reload, find_reusable_reload,
	reload_inner_reg_of_subreg, can_reload_into, push_reload,
	combine_reloads, find_dummy_reload, hard_reg_set_here_p,
	operands_match_p, decompose, find_reloads, find_reloads_toplev,
	find_reloads_address, subst_indexed_address, find_reloads_address_1,
	find_reloads_subreg_address, find_replacement,
	refers_to_regno_for_reload_p, reg_overlap_mentioned_for_reload_p,
	refers_to_mem_for_reload_p, find_equiv_reg, regno_clobbered_p): Likewise.
	* reload1.c (replace_pseudos_in, reload, calculate_needs_all_insns,
	find_reg, delete_dead_insn, alter_reg, eliminate_regs,
	elimination_effects, eliminate_regs_in_insn, scan_paradoxical_subregs,
	forget_old_reloads_1, reload_reg_free_for_value_p, choose_reload_regs,
	emit_input_reload_insns, emit_output_reload_insns, do_input_reload,
	do_output_reload, emit_reload_insns, gen_reload,
	delete_address_reloads_1, inc_for_reload): Likewise.
	* reorg.c (update_reg_dead_notes, fix_reg_dead_note,
	update_reg_unused_notes, fill_slots_from_thread): Likewise.
	* resource.c (update_live_status, mark_referenced_resources,
	mark_set_resources, mark_target_live_regs): Likewise.
	* rtlanal.c (nonzero_address_p, get_jump_table_offset,
	global_reg_mentioned_p_1, reg_mentioned_p, reg_referenced_p,
	reg_set_p, set_noop_p, find_last_value, refers_to_regno_p,
	note_stores, dead_or_set_p, dead_or_set_regno_p, find_regno_note,
	find_reg_fusage, find_regno_fusage, replace_regs, regno_use_in,
	parms_set, find_first_parameter_load, keep_with_call_p,
	hoist_test_store, hoist_update_store, address_cost, nonzero_bits1,
	num_sign_bit_copies1): Likewise.
	* rtlhooks.c (gen_lowpart_general): Likewise.
	* sched-deps.c (deps_may_trap_p, sched_analyze_1, sched_analyze_insn,
	sched_analyze): Likewise.
	* sched-rgn.c (check_live_1, update_live_1, sets_likely_spilled_1):
	Likewise.
	* sdbout.c (sdbout_symbol, sdbout_parms, sdbout_reg_parms): Likewise.
	* simplify-rtx.c (simplify_replace_rtx, simplify_unary_operation,
	simplify_binary_operation, simplify_const_relational_operation,
	simplify_subreg): Likewise.
	* stmt.c (decl_conflicts_with_clobbers_p, expand_asm_operands,
	expand_end_stmt_expr, expand_return, expand_decl,
	expand_anon_union_decl): Likewise.
	* unroll.c (precondition_loop_p, calculate_giv_inc, copy_loop_body,
	find_splittable_regs, find_splittable_givs, find_common_reg_term,
	loop_iterations): Likewise.
	* var-tracking.c (variable_union, variable_part_different_p,
	variable_different_p, count_uses, add_uses, add_stores,
	compute_bb_dataflow, set_variable_part, delete_variable_part,
	emit_notes_in_bb, vt_get_decl_and_offset, vt_add_function_parameters):
	Likewise.
	* varasm.c (assemble_variable): Likewise.

From-SVN: r83195
2004-06-15 18:02:40 +00:00
Jakub Jelinek 6355b2d5bb re PR middle-end/15945 (Incorrect floating point optimization)
PR middle-end/15945
	* simplify-rtx.c (simplify_binary_operation): Don't optimize out
	Inf + -Inf, Inf - Inf, Inf / Inf and 0 * Inf if flag_trapping_math.

From-SVN: r83121
2004-06-14 19:45:08 +02:00
Paolo Bonzini dce1438a65 combine.c (gen_binary): Remove.
2004-05-25  Paolo Bonzini  <bonzini@gnu.org>

        * combine.c (gen_binary): Remove.
        (known_cond, simplify_shift_const
        find_split_point, combine_simplify_rtx,
        simplify_if_then_else, simplify_set,
        simplify_logical, expand_field_assignment,
        extract_left_shift, force_to_mode,
        if_then_else_cond, apply_distributive_law,
        simplify_and_const_int, simplify_shift_const,
        gen_lowpart_for_combine, simplify_comparison,
        reversed_comparison): Replace with
        simplify_gen_binary, simplify_gen_relational or
        distribute_and_simplify_rtx.
        (distribute_and_simplify_rtx): New function.
        * simplify-rtx.c (simplify_binary_operation):
        Use nonzero_bits to simplify ANDs where we are
        turning off bits already known to be off in OP0.

From-SVN: r82317
2004-05-27 08:28:31 +00:00
Zdenek Dvorak 0aea6467d5 Multiple fixes: PRs 14692, 15274 and 15463
PR c++/15463
	* loop-iv.c (iv_number_of_iterations):  Use trunc_int_for_mode on
	result of inverse.

	PR rtl-optimization/15274
	* loop-iv.c (determine_max_iter, shorten_into_mode,
	iv_number_of_iterations): Handle constants correctly.
	* rtl.h (get_mode_bounds): Declaration changed.
	* stor-layout.c (get_mode_bounds): Return a constant suitable for
	the target mode.

	PR rtl-optimization/14692
	* loop-unswitch.c (may_unswitch_on): Try folding the result.
	(unswitch_single_loop): Work correctly when may_unswitch_on
	returns a folded constant.

	* loop-iv.c (implies_p): Handle A < B ==> A + 1 <= B.
	* simplify-rtx.c (simplify_const_relational_operation): Optimize
	comparisons with mode bounds.

	* function.c (struct temp_slot): Add new field prev.
	(free_after_compilation, init_temp_slots): Free new fields.
	(cut_slot_from_list, insert_slot_to_list,
	temp_slots_at_level, max_slot_level, move_slot_to_level,
	make_slot_available): New functions.
	(assign_stack_temp_for_type, combine_temp_slots,
	find_temp_slot_from_address, preserve_temp_slots,
	preserve_rtl_expr_result, free_temp_slots,
	free_temps_for_rtl_expr, pop_temp_slots): Work with
	the new structure of lists.
	(mark_all_temps_used): Removed.
	* function.h (struct function): Field x_temp_slots
	replaced by x_used_temp_slots and x_avail_temp_slots.
	(temp_slots): Replaced by ...
	(used_temp_slots, avail_temp_slots): New.
	* tree.h (mark_all_temps_used): Declaration removed.

	* loop-iv.c (mark_single_set, get_biv_step_1, iv_analyze,
	simplify_using_assignment): Take the expression out of
	the expr_list wrapper.

	* loop-iv.c (iv_number_of_iterations): Improve clasification of
	infinite loops.

From-SVN: r82028
2004-05-19 17:53:45 +00:00
Diego Novillo 6de9cd9a88 Merge tree-ssa-20020619-branch into mainline.
From-SVN: r81764
2004-05-13 02:41:07 -04:00
Paolo Bonzini 77306e3e64 simplify-rtx.c (simplify_ternary_operation): When converting an IF_THEN_ELSE to a relational op, return correct mode.
2004-05-01  Paolo Bonzini  <bonzini@gnu.org>

        * simplify-rtx.c (simplify_ternary_operation): When
        converting an IF_THEN_ELSE to a relational op, return
        correct mode.

From-SVN: r81383
2004-05-01 09:36:55 +00:00
Paolo Bonzini c6fb08ad28 combine.c (combine_simplify_rtx): Adjust call to use simplify_relational_operation.
2004-04-29  Paolo Bonzini  <bonzini@gnu.org>

        * combine.c (combine_simplify_rtx): Adjust call to use
        simplify_relational_operation.  Do not use SELECT_CC_MODE
        when a comparison already has a MODE_CC mode.
        (simplify_set): simplify_relational_operation may now
        return another relational expression.
        * cse.c (fold_rtx): simplify_relational_operation now
        takes of computing the comparison mode.
        * dojump.c (compare_from_rtx): Use simplify_relational_operation,
        remove dead code.
        (do_compare_rtx_and_jump): Likewise.
        * integrate.c (subst_constants): simplify_relational_operation
        may now return another relational expression.
        * simplify-rtx.c (simplify_gen_relational): Move most code to
        the new simplify_relational_operation and
        simplify_relational_operation_1 functions.
        (simplify_relational_operation): Rewritten.
        (simplify_relational_operation_1): New function.
        (simplify_ternary_operation): simplify_relational_operation
        may now return another relational expression.
        (simplify_rtx): Remove unnecessary temp variable.

From-SVN: r81282
2004-04-29 07:50:55 +00:00
Roger Sayle 1e9b78b094 simplify-rtx.c (simplify_binary_operation): Remove fall throughs.
* simplify-rtx.c (simplify_binary_operation) <UDIV, DIV, UMOD, MOD>:
	Remove fall throughs.  Convert 0/x and 0%x into x&0 when x has
	side-effects.  Don't convert x/1.0 into x if we honor signaling NaNs.
	Convert x/-1.0 into -x if we don't honor signaling NaNs.  Convert
	x/-1 into -x.  Optimize x%1 into x&0 if x has side-effects.  Optimize
	x%-1 into 0 (or x&0 if x has side-effects).

From-SVN: r80625
2004-04-12 17:28:11 +00:00
Roger Sayle 0b24db885b simplify-rtx.c (mode_signbit_p): New function to check whether an RTX is an immediate constant that represents...
* simplify-rtx.c (mode_signbit_p): New function to check whether
	an RTX is an immediate constant that represents the most significant
	bit of a given machine mode.
	(simplify_unary_operation) <NOT>: Optimize ~(X+C) as X ^ ~C, where
	C is the sign bit.
	(simplify_binary_operation) <PLUS>: Optimize (X^C1) + C2 as X^(C1^C2)
	when C2 is the sign bit.
	(simplify_binary_operation) <XOR>: Canonicalize X^C as X+C when C
	is the sign bit.  Optimize (X+C1) ^ C2 as X^(C1^C2) when C1 is the
	sign bit.

	* gcc.c-torture/execute/20040409-1.c: New test case.
	* gcc.c-torture/execute/20040409-2.c: New test case.
	* gcc.c-torture/execute/20040409-3.c: New test case.

From-SVN: r80568
2004-04-09 21:39:14 +00:00
Roger Sayle 9d3172516d simplify-rtx.c (simplify_binary_operation): Constant fold DIV, MOD, UDIV and UMOD using div_and_round_double.
* simplify-rtx.c (simplify_binary_operation): Constant fold
	DIV, MOD, UDIV and UMOD using div_and_round_double.

From-SVN: r80420
2004-04-05 03:14:13 +00:00
Kazu Hirata 5fd9b17875 alias.c, [...]: Replace calls via (*targetm.foo) () with targetm.foo ().
* alias.c, attribs.c, bt-load.c, builtins.c, c-common.c,
	c-decl.c, c-objc-common.c, c-typeck.c, calls.c, cfglayout.c,
	cse.c, dbxout.c, dwarf2out.c, except.c, final.c,
	haifa-sched.c, integrate.c, passes.c, rtlanal.c, sched-rgn.c,
	sched-vis.c, simplify-rtx.c, stor-layout.c, tree.c, varasm.c,
	vmsdbgout.c: Replace calls via (*targetm.foo) () with
	targetm.foo ().

From-SVN: r79729
2004-03-20 04:52:59 +00:00
Richard Henderson 55cf9d623f * simplify-rtx.c (simplify_relational_operation): Fix typo.
From-SVN: r79353
2004-03-11 15:48:02 -08:00
Roger Sayle 239a625ee8 fold-const.c (negate_expr_p): We can optimize -((int)X>>C) where C is an integer constant one bit less than...
* fold-const.c (negate_expr_p) <RSHIFT_EXPR>: We can optimize
	-((int)X>>C) where C is an integer constant one bit less than the
	size of X into (unsigned)X>>C.  Similarly for unsigned->signed.
	(negate_expr) <RSHIFT_EXPR>: Implement the above transformations.

	* simplify-rtx.c (simplify_unary_operation): Also implement the
	above transformations at the RTL level.

	* gcc.c-torture/execute/20040311-1.c: New test case.

From-SVN: r79334
2004-03-11 17:45:03 +00:00
Roger Sayle 7ce3e360d6 simplify-rtx.c (simplify_const_relational_operation): New function renamed from simplify_relational_operation.
* simplify-rtx.c (simplify_const_relational_operation): New function
	renamed from simplify_relational_operation.
	(simplify_relational_operation): Change prototype to accept an
	additional mode argument.  Call simplify_const_relational_operation.
	(simplify_gen_relational): Update simplify_relational_operation call.
	(simplify_ternary_operation): Update simplify_relational_operation
	subroutine call to use simplify_const_relational_operation instead.

	* rtl.h (simplify_const_relational_operation): Prototype here.
	(simplify_relational_operation): Add addtional mode argument.

	* combine.c (combine_simplify_rtx): Update calls to
	simplify_relational_operation.
	(simplify_set): Likewise.
	(gen_binary): Likewise.
	* cse.c (fold_rtx): Likewise.
	* dojump.c (compare_from_rtx): Likewise.
	(do_compare_rtx_and_jump): Likewise.
	* integrate.c (subst_constants): Likewise.
	* unroll.c (simplify_cmp_and_jump_insns): Likewise.

From-SVN: r79187
2004-03-09 17:06:25 +00:00
Paolo Bonzini d2782048a2 simplify-rtx.c (simplify_relational_operation): If flag_wrapv is set...
2004-03-05  Paolo Bonzini  <bonzini@gnu.org>

	* simplify-rtx.c (simplify_relational_operation): If
        flag_wrapv is set, do not move terms between the two
        side of a relational operator.

From-SVN: r78962
2004-03-05 10:41:27 +00:00
Paolo Bonzini ec8e098d3d alias.c (rtx_equal_for_memref_p): Use predicates to test rtx classes and new rtx class codes...
2004-02-07  Paolo Bonzini  <bonzini@gnu.org>

	* alias.c (rtx_equal_for_memref_p): Use predicates
	to test rtx classes and new rtx class codes, possibly
	splitting conditionals that tested against '<' and 'o'.
	* caller-save.c (save_call_clobbered_regs): Likewise.
	* combine.c (contains_muldiv, find_split_point, subst,
	combine_simplify_rtx, simplify_if_then_else,
	simplify_set, simplify_logical, expand_compound_operation,
	make_compound_operation, if_then_else_cond, known_cond,
	apply_distributive_law, cached_nonzero_bits,
	cached_num_sign_bit_copies, simplify_shift_const,
	gen_binary, simplify_comparison, update_table_tick,
	record_value_for_reg, get_lsat_value_validate): Likewise.
	* cse.c (mention_regs, find_best_addr, find_comparison_args,
	fold_rtx, cse_insn, invalidate_memory, cse_basic_block):
	Likewise.
	* emit-rtl.c (copy_insn_1): Likewise.
	* expr.c (force_operand): Likewise.
	* final.c (final_scan_insn, get_mem_expr_from_op): Likewise.
	* flow.c (notice_stack_pointer_modification_1,
	invalidate_mems_from_autoinc, ior_reg_cond, not_reg_cond,
	and_reg_cond, elim_reg_cond): Likewise.
	* function.c (update_epilogue_consts): Likewise.
	* genattrtab.c (attr_rtx_1): Likewise.
	* genopinit.c (gen_insn): Likewise.
	* integrate.c (subst_constants): Likewise.
	* jump.c (reversed_comparison_code_parts,
	reversed_comparison_code, delete_related_insns,
	rtx_renumbered_equal_p): Likewise.
	* local-alloc.c (block_alloc): Likewise.
	* loop.c (rtx_equal_for_prefetch_p, maybe_eliminate_biv,
	canonicalize_condition): Likewise.
	* loop-iv.c (simplify_using_conditions, iv_number_of_iterations):
	Likewise.
	* optabs.c (add_equal_node, expand_binop): Likewise.
	* predict.c (estimate_probability): Likewise.
	* ra-debug.c (ra_print_rtx_2op, ra_print_rtx): Likewise.
	* recog.c (validate_replace_rtx_1, comparison_operator,
	offsettable_address_p, constrain_operands): Likewise.
	* reg-stack.c (swap_rtx_condition_1, subst_stack_regs_pat):
	Likewise.
	* regclass.c (scan_one_insn): Likewise.
	* regmove.c (stable_and_no_regs_but_for_p): Likewise.
	* regrename.c (kill_autoinc_value): Likewise.
	* reload.c (find_reusable_reload, find_reloads,
	reg_overlap_mentioned_for_reload_p): Likewise.
	* reload1.c (gen_reload, delete_address_reloads_1): Likewise.
	* rtl.c (copy_rtx): Likewise.
	* rtl.h (CONSTANT_P, INSN_P): Likewise.
	* rtlanal.c (commutative_operand_precedence): Likewise.
	* sched-deps.c (conditions_mutex_p): Likewise.
	* sched-rgn.c (is_cfg_nonregular): Likewise.
	* simplify-rtx.c (simplify_gen_binary,
	simplify_gen_relational, simplify_replace_rtx,
	simplify_unary_operation, simplify_binary_operation,
	simplify_ternary_operation, simplify_rtx): Likewise.
	* unroll.c (reg_dead_after_loop): Likewise.
	* config/alpha/alpha.c (alpha_swapped_comparison_operator,
	print_operand): Likewise.
	* config/arc/arc.c (proper_comparison_operator): Likewise.
	* config/arm/arm.c (arm_arm_address_cost, arm_select_cc_mode):
	Likewise.
	* config/avr/avr.c (_reg_unused_after): Likewise.
	* config/frv/frv.c (frv_ifcvt_modify_tests,
	frv_ifcvt_modify_insn, frv_pack_insn): Likewise.
	* config/i386/i386.c (ix86_comparison_operator,
	ix86_carry_flag_operator, fcmov_comparison_operator,
	arith_or_logical_operator, print_operand,
	ix86_expand_binary_operator, ix86_binary_operator_ok):
	Likewise.
	* config/i386/i386.md: Likewise.
	* config/ia64/ia64.c (not_postinc_memory_operand,
	ia64_print_operand, update_set_flags, errata_emit_nops):
	Likewise.
	* config/ia64/ia64.h (PREFERRED_RELOAD_CLASS,
	CONSTRAINT_OK_FOR_S): Likewise.
	* config/ip2k/ip2k.c (mdr_resequence_xy_yx,
	mdr_try_move_dp_reload, ip2k_check_can_adjust_stack_ref,
	ip2k_xexp_not_uses_reg_for_mem, ip2k_xexp_not_uses_reg_p,
	ip2k_composite_xexp_not_uses_reg_p, ip2k_unary_operator):
	Likewise.
	* config/iq2000/iq2000.c (cmp_op, symbolic_expression_p,
	eqne_comparison_operator, signed_comparison_operator):
	Likewise.
	* config/mips/mips.c (cmp_op, symbolic_expression_p):
	Likewise.
	* config/mmix/mmix (mmix_foldable_comparison_operator,
	mmix_comparison_operator): Likewise.
	* config/pa/pa.c (hppa_legitimize_address): Likewise.
	* config/rs6000/rs6000.c (stmw_operation,
	branch_comparison_operator, trap_comparison_operator,
	ccr_bit): Likewise.
	* config/rs6000/rs6000.h (SELECT_CC_MODE): Likewise.
	* config/s390/s390.c (s390_alc_comparison,
	s390_slb_comparison):L Likewise.
	* config/sh/sh.c (gen_block_redirect, reg_unused_after):
	Likewise.
	* config/sparc/sparc.c (eq_or_neq, normal_comp_operator,
	noov_compare_op, noov_compare64_op, v9_regcmp_op,
	emit_hard_tfmode_operation, reg_unused_after)
	* doc/md.texi, doc/rtl.texi: Likewise.

	* ra-debug.c: Add 2004 to list of copyright years.
	* unroll.c: Likewise.

	* combine.c (simplify_logical): Remove dummy test,
	(apply_distributive_law): Fix typo in comment.
	GET_CODE (x) == AND so x is a commutative binary op.
	* jump.c (delete_related_insns): simplify loop
	condition, move testing of RTX codes inside the loop.
	(rtx_renumbered_equal_p): do not use RTX_CODE.
	* rtl.c (rtx_class): Declare as enum rtx_class.
	* rtl.def (EQ, NE, UNEQ, LTGT, UNORDERED, ORDERED):
	Move to RTX_COMM_COMPARE class.
	(HIGH, SYMBOL_REF, LABEL_REF, CONST, CONST_INT, CONST_DOUBLE):
	Move to RTX_CONST_OBJ class.
	* rtl.h (enum rtx_class): New declaration,
	(RTX_OBJ_MASK, RTX_OBJ_RESULT, RTX_COMPARE_MASK,
	RTX_COMPARE_RESULT, RTX_ARITHMETIC_MASK, RTX_ARITHMETIC_RESULT,
	RTX_BINARY_MASK, RTX_BINARY_RESULT, RTX_COMMUTATIVE_MASK,
	RTX_COMMUTATIVE_RESULT, RTX_NON_COMMUTATIVE_RESULT,
	RTX_EXPR_FIRST, RTX_EXPR_LAST, UNARY_P, BINARY_P,
	ARITHMETIC_P, COMMUTATIVE_ARITHMETIC_P, COMPARISON_P,
	SWAPPABLE_OPERANDS_P, NON_COMMUTATIVE_P, COMMUTATIVE_P,
	OBJECT_P): New macros.
	* config/sparc/sparc.c (noov_compare_op): Remove register
	from parameter.

From-SVN: r78824
2004-03-03 08:35:33 +00:00