re PR rtl-optimization/37544 (Conversion double -> unsigned long long -> unsigned...
authorUros Bizjak <uros@gcc.gnu.org>
Thu, 18 Sep 2008 10:17:42 +0000 (12:17 +0200)
committerUros Bizjak <uros@gcc.gnu.org>
Thu, 18 Sep 2008 10:17:42 +0000 (12:17 +0200)
PR rtl-optimization/37544
* regrename.c (maybe_mode_change): Exit early when copy_mode
is narrower than orig_mode and narrower than new_mode.

testsuite/ChangeLog:

PR rtl-optimization/37544
* gcc.dg/pr37544.c: New test.

From-SVN: r140446

gcc/ChangeLog
gcc/regrename.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr37544.c [new file with mode: 0644]

index 1091895..26d38e4 100644 (file)
@@ -1,3 +1,9 @@
+2008-09-18  Uros Bizjak  <ubizjak@gmail.com>
+
+       PR rtl-optimization/37544
+       * regrename.c (maybe_mode_change): Exit early when copy_mode
+       is narrower than orig_mode and narrower than new_mode.
+
 2008-09-18  Alexander Monakov  <amonakov@ispras.ru>
 
        PR middle-end/37499
 
 2008-09-13  Jan Hubicka  <jh@suse.cz>
 
-       * i386.c (ix86_expand_movmem, ix86_expand_movstr): Avoid processing too
-       many bytes on misalligned blocks.
+       * i386.c (ix86_expand_movmem, ix86_expand_movstr): Avoid processing
+       too many bytes on misalligned blocks.
 
 2008-09-13  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
 
 2008-09-12  Sebastian Pop  <sebastian.pop@amd.com>
 
-       * tree-scalar-evolution.c (set_instantiated_value): Set instantiated_below.
+       * tree-scalar-evolution.c (set_instantiated_value): Set
+       instantiated_below.
 
 2008-09-12  Vladimir Makarov  <vmakarov@redhat.com>
 
        TRUTH_AND_EXPR for boolean (1-bit precision) expressions.
        (do_jump) [BIT_IOR_EXPR]: Compile as TRUTH_OR_EXPR.
 
-       * tree-flow.h (simplify_stmt_using_ranges): Accept a GSI, return a bool.
+       * tree-flow.h (simplify_stmt_using_ranges): Accept a GSI, return
+       a bool.
        * tree-ssa-propagate.c (substitute_and_fold): Pass a GSI to
        VRP's simplify_stmt_using_ranges.  Do simplify_stmt_using_ranges
        before finalizing the changes.
 2008-09-11  Jan Hubicka  <jh@suse.cz>
 
        * cgraph.c (cgraph_release_function_body): Plug memory leak on
-       ipa_transforms_to_apply and CFG; ggc_free gimple df and struct function
-       so we are sure we do not dangle it forever.
+       ipa_transforms_to_apply and CFG; ggc_free gimple df and struct
+       function so we are sure we do not dangle it forever.
        * function.c (outer_function_chain, find_function_data): Remove.
        (function_context_stack): New.
        (push_function_context, pop_function_context): Update.
        register_overhead, free_overhead, vec_heap_free): New functions.
        (vec_gc_o_reserve_1): ggc_free when resizing to 0.
        (vec_heap_o_reserve_1): free when resizing to 0; add statistics.
-       (cmp_statistic, add_statistics, dump_vec_loc_statistics): New functions.
+       (cmp_statistic, add_statistics, dump_vec_loc_statistics):
+       New functions.
 
 2008-09-11  Ira Rosen  <irar@il.ibm.com>
 
        calls.
 
        PR target/37438
-       * config/i386/i386.md (zero_extendqihi2_movzbl): Enable when optimizing
-       for size, not speed.
+       * config/i386/i386.md (zero_extendqihi2_movzbl): Enable when
+       optimizing for size, not speed.
 
        PR rtl-optimization/37408
        * function.c (assign_parm_find_stack_rtl): Set correct MEM_SIZE
 2008-09-09  Sebastian Pop  <sebastian.pop@amd.com>
 
        PR tree-optimization/37375
-       * tree-scalar-evolution.c (scev_info_str): Add field instantiated_below.
+       * tree-scalar-evolution.c (scev_info_str): Add field
+       instantiated_below.
        (new_scev_info_str, eq_scev_info, find_var_scev_info,
        set_scalar_evolution, get_scalar_evolution, get_instantiated_value,
        set_instantiated_value): Pass instantiated_below.
-       (analyze_scalar_evolution_1, analyze_scalar_evolution): Update calls to
-       above functions.
+       (analyze_scalar_evolution_1, analyze_scalar_evolution): Update calls
+       to above functions.
        (instantiate_scev_1, instantiate_scev): Pass a basic block above which
        the definitions are not instantiated.
 
        * tree-scalar-evolution.h (instantiate_scev): Update declaration.
        (block_before_loop): New.
-       * tree-data-ref.c (dr_analyze_indices): Update uses of instantiate_scev.
+       * tree-data-ref.c (dr_analyze_indices): Update uses of
+       instantiate_scev.
        * graphite.c (block_before_scop): New.
        (loop_affine_expr, stmt_simple_for_scop_p, harmful_stmt_in_bb): Pass a
        basic block, not a loop for determining the parameters.
        openmp applications.
        * pa-hpux11.h (LIB_SPEC): Likewise.
 
-       * ira.c (setup_eliminable_regset): Only declare i if ELIMINABLE_REGS is
-       defined.
+       * ira.c (setup_eliminable_regset): Only declare i if ELIMINABLE_REGS
+       is defined.
 
 2008-09-01  Jan Hubicka  <jh@suse.cz>
 
 
        * sel-sched.h, sel-sched-dump.h, sel-sched-ir.h, sel-sched.c,
        sel-sched-dump.c, sel-sched-ir.c: New files.
-       * Makefile.in (OBJS-common): Add selective scheduling object
-       files.
+       * Makefile.in (OBJS-common): Add selective scheduling object files.
        (sel-sched.o, sel-sched-dump.o, sel-sched-ir.o): New entries.
        (SEL_SCHED_IR_H, SEL_SCHED_DUMP_H): New entries.
        (sched-vis.o): Add dependency on $(INSN_ATTR_H).
        (setup_sched_dump): New function.
        (haifa_init_only_bb): New static function.
        (haifa_speculate_insn): New static function.
-       (try_ready): Use haifa_* instead of speculate_insn and
-       change_pattern.
+       (try_ready): Use haifa_* instead of speculate_insn and change_pattern.
        (extend_ready, extend_all): Remove.
        (sched_extend_ready_list, sched_finish_ready_list): New functions.
        (create_check_block_twin, add_to_speculative_block): Use
        (current_sched_info_var): Remove.
        (move_block_after_check): Use common_sched_info.
        (haifa_luid_for_non_insn): New static function.
-       (init_before_recovery): Use haifa_init_only_bb instead of
-       add_block.
+       (init_before_recovery): Use haifa_init_only_bb instead of add_block.
        (increase_insn_priority): New.
        * modulo-sched.c: (issue_rate): Remove static declaration.
        (sms_sched_info): Change type to haifa_sched_info.
        (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.
+       * 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.
        (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.
+       * 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.
        * config/sparc/sparc.h (BRANCH_COST): Update.
        * config/m32r/m32r.h (BRANCH_COST): Update.
        * config/i386/i386.h (BRANCH_COST): Update.
-       * config/i386/i386.c (ix86_expand_int_movcc): Update use of BRANCH_COST.
+       * config/i386/i386.c (ix86_expand_int_movcc): Update use of
+       BRANCH_COST.
        * config/sh/sh.h (BRANCH_COST): Update.
        * config/pdp11/pdp11.h (BRANCH_COST): Update.
        * config/avr/avr.h (BRANCH_COST): Update.
        * tree-ssa-pre.c (do_pre): Use optimize_function_for_speed_p.
        * tree-predcom.c (tree_predictive_commoning): Use
        optimize_loop_for_speed_p.
-       * varasm.c (assemble_start_function): Use optimize_function_for_speed_p.
+       * varasm.c (assemble_start_function): Use
+       optimize_function_for_speed_p.
        * bb-reorder.c (rest_of_handle_reorder_blocks): Likewise.
        * predict.c (optimize_loop_for_speed_p): Fix walk.
 
 
 2008-08-29  Jan Hubicka  <jh@suse.cz>
 
-       * tree.c (build_function_type_skip_args, build_function_decl_skip_args):
-       New functions.
-       * tree.h (build_function_type_skip_args, build_function_decl_skip_args):
-       Declare.
+       * tree.c (build_function_type_skip_args,
+       build_function_decl_skip_args): New functions.
+       * tree.h (build_function_type_skip_args,
+       build_function_decl_skip_args): Declare.
        * gimple.c (giple_copy_call_skip_args): New function.
        (giple_copy_call_skip_args): Declare.
 
        * cgraph.h (cgraph_function_versioning): Add skip_args arugmnet
        * ipa-cp.c (ipcp_node_not_modifiable_p): Rename to ...
-       (ipcp_node_modifiable_p): ... this one; use tree_versionable_function_p.
+       (ipcp_node_modifiable_p): ... this one; use
+       tree_versionable_function_p.
        (ipcp_create_replace_map): Improve debug output.
        (ipcp_need_redirect_p): Return false when not clonning.
        (ipcp_update_callgraph): Skip args.
        * cgraphunit.c (cgraph_function_versioning): Add skip_args argument.
        (save_inline_function_body): Update call of tree_function_versioning.
        * ipa-prop.c (ipa_edge_removal_hook): Do not ICE on unanalyzed nodes.
-       * tree-inline.c (copy_arguments_for_versioning): Add skip_args argument.
+       * tree-inline.c (copy_arguments_for_versioning): Add skip_args
+       argument.
        (tree_function_versioning): Likewise.
        * tree-inline.h (tree_function_versioning): Update prototype.
 
 2008-08-29  Jan Hubicka  <jh@suse.cz>
 
-       * loop-unswitch.c (unswitch_single_loop): Use optimize_loop_for_speed_p.
+       * loop-unswitch.c (unswitch_single_loop): Use
+       optimize_loop_for_speed_p.
        * tree-ssa-threadupdate.c (mark_threaded_blocks):
        Use optimize_function_for_size_p.
        * tracer.c (ignore_bb_p): Use optimize_bb_for_size_p.
        * builtins.c (fold_builtin_cabs): Use optimize_function_for_speed_p.
        (fold_builtin_strcpy, fold_builtin_fputs): Use
        optimize_function_for_size_p.
-       * fold-const.c (tree_swap_operands_p): Use optimize_function_for_size_p.
+       * fold-const.c (tree_swap_operands_p): Use
+       optimize_function_for_size_p.
        * recog.c (relax_delay_slots): Likewise.
        * tree-ssa-math-opts.c (replace_reciprocal):
        Use optimize_bb_for_speed_p.
        work it out from profile.
        * tree-ssa-loop-ivcanon.c (tree_unroll_loops_completely): Use
        optimize_loop_for_speed_p.
-       * predict.c (optimize_bb_for_size_p, optimize_bb_for_speed_p): Constify
-       argument.
+       * predict.c (optimize_bb_for_size_p, optimize_bb_for_speed_p):
+       Constify argument.
        (optimize_loop_nest_for_size_p, optimize_loop_nest_for_speed_p): New.
        * tree-parloops.c (parallelize_loops): Use optimize_loop_for_size_p.
-       * tree-eh.c (decide_copy_try_finally): Use optimize_function_for_size_p.
+       * tree-eh.c (decide_copy_try_finally): Use
+       optimize_function_for_size_p.
        * local-alloc.c (block_alloc): Pass BB pointer.
        (find_free_reg): Add BB pointer, use optimize_bb_for_size_p.
        * gcse.c (gcse_main): Use optimize_function_for_size_p.
        (update_call_notes_after_inlining): Expect ADDR_EXPR in operand.
        * ipa-prop.h (jump_func_type): Remove IPA_CONST_REF.
        (jump_func_type): Remove IPA_CONST_VALUE_REF.
-       * tree-inline.c (tree_function_versioning): Add variables referenced by
-       replacing trees.
+       * tree-inline.c (tree_function_versioning): Add variables referenced
+       by replacing trees.
 
 2008-08-23  Jan Hubicka  <jh@suse.cz>
 
        (vect_get_and_check_slp_defs): Detect patterns.
        (vect_build_slp_tree): Add an argument, don't fail in case of multiple
        types.
-       (vect_analyze_slp_instance): Don't fail in case of multiple types. Call
-       vect_build_slp_tree with correct arguments. Calculate unrolling factor
-       according to the smallest type in the loop.
+       (vect_analyze_slp_instance): Don't fail in case of multiple types.
+       Call vect_build_slp_tree with correct arguments. Calculate unrolling
+       factor according to the smallest type in the loop.
        (vect_detect_hybrid_slp_stmts): Include statements from patterns.
        * tree-vect-patterns.c (vect_recog_widen_mult_pattern): Call
        supportable_widening_operation with correct arguments.
 
 2008-08-09  Richard Sandiford  <rdsandiford@googlemail.com>
 
-       * config/mips/mips.c (mips_unspec_address_offset): Move earlier in file.
+       * config/mips/mips.c (mips_unspec_address_offset): Move earlier
+       in file.
        (mips_unspec_address, mips_unspec_offset_high): Likewise.
        (mips_ok_for_lazy_binding_p, mips_load_call_address): Likewise.
        (mips16_cfun_returns_in_fpr_p): Likewise.
        * configure.ac (HAVE_GAS_CFI_DIRECTIVE): New.
        * config.in, configure: Rebuild.
        * dwarf2asm.c (dw2_asm_output_data_raw): New.
-       (dw2_asm_output_data_uleb128_raw, dw2_asm_output_data_sleb128_raw): New.
+       (dw2_asm_output_data_uleb128_raw, dw2_asm_output_data_sleb128_raw):
+       New.
        (dw2_force_const_mem): Externalize.
        * dwarf2asm.h: Update.
        * dwarf2out.c (dwarf2out_cfi_label): If flag_dwarf2_cfi_asm, don't
 
        (MFC_MIN_DMA_LIST_ELEMENTS): New define.
        (MFC_MAX_DMA_LIST_ELEMENTS): Likewise.
-       (MFC_MIN_DMA_LIST_SIZE): Redefine in terms of MFC_MIN_DMA_LIST_ELEMENTS.
-       (MFC_MAX_DMA_LIST_SIZE): Redefine in terms of MFC_MAX_DMA_LIST_ELEMENTS.
+       (MFC_MIN_DMA_LIST_SIZE): Redefine in terms of
+       MFC_MIN_DMA_LIST_ELEMENTS.
+       (MFC_MAX_DMA_LIST_SIZE): Redefine in terms of
+       MFC_MAX_DMA_LIST_ELEMENTS.
 
        (MFC_START_ENABLE): Remove PPU-only define.
        (MFC_PUTS_CMD, MFC_PUTFS_CMD, MFC_PUTBS_CMD): Likewise.
 
        * configure.ac: Use the m4_do macro to concatenate the warnings into
        one string in ACX_PROG_CC_WARNING_OPTS,
-       ACX_PROG_CC_WARNING_ALMOST_PEDANTIC and ACX_PROG_CC_WARNINGS_ARE_ERRORS.
+       ACX_PROG_CC_WARNING_ALMOST_PEDANTIC and
+       ACX_PROG_CC_WARNINGS_ARE_ERRORS.
        * configure: Regenerate.
 
 2008-07-28  Richard Guenther  <rguenther@suse.de>
        (ipa_analyze_params_uses): New function.
        (ipa_free_node_params_substructures): Also free the param_calls linked
        list.
-       (ipa_node_duplication_hook): Also duplicate the param_calls linked list.
+       (ipa_node_duplication_hook): Also duplicate the param_calls
+       linked list.
        (ipa_print_node_param_flags): New function.
        (ipa_print_all_params_modified): Renamed to ipa_print_all_param_flags.
        (ipa_print_all_param_flags): Calls ipa_print_node_param_flags.
        not optimizing so unused user vars remains visible.
        * common.opt (flag_tree_ter): Always enable by default.
        * tree-ssa-ter.c: Include flags.h
-       (is_replaceable_p): Check that locations match; when aliasing is missing
-       be conservative about loads.
+       (is_replaceable_p): Check that locations match; when aliasing
+       is missing be conservative about loads.
        * tree-optimize.c (gate_init_datastructures): Remove.
        (pass_init_datastructures): New.
        * passes.c: Reorder passes so we always go into SSA.
 
 2008-07-19  Jan Hubicka  <jh@suse.cz>
 
-       * doc/extend.texi (flatten attribute): Remove note about unit-at-a-time
+       * doc/extend.texi (flatten attribute): Remove note about
+       unit-at-a-time.
        * doc/invoke.texi (--combine): Likewise.
        (-finline-functions-called-once): Update levels when enabled.
        (-funit-at-a-time): Document new behaviour.
index bd2373c..e70dae8 100644 (file)
@@ -1314,6 +1314,10 @@ maybe_mode_change (enum machine_mode orig_mode, enum machine_mode copy_mode,
                   enum machine_mode new_mode, unsigned int regno,
                   unsigned int copy_regno ATTRIBUTE_UNUSED)
 {
+  if (GET_MODE_SIZE (copy_mode) < GET_MODE_SIZE (orig_mode)
+      && GET_MODE_SIZE (copy_mode) < GET_MODE_SIZE (new_mode))
+    return NULL_RTX;
+
   if (orig_mode == new_mode)
     return gen_rtx_raw_REG (new_mode, regno);
   else if (mode_change_ok (orig_mode, new_mode, regno))
index 8e83278..7bbee66 100644 (file)
@@ -1,3 +1,8 @@
+2008-09-18  Uros Bizjak  <ubizjak@gmail.com>
+
+       PR rtl-optimization/37544
+       * gcc.dg/pr37544.c: New test.
+
 2008-09-17  Janis Johnson  <janis187@us.ibm.com>
 
        PR testsuite/25241
diff --git a/gcc/testsuite/gcc.dg/pr37544.c b/gcc/testsuite/gcc.dg/pr37544.c
new file mode 100644 (file)
index 0000000..6393d2f
--- /dev/null
@@ -0,0 +1,39 @@
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+/* { dg-options "-O2 -msse2 -mtune=core2 -mfpmath=387" { target { i?86-*-* x86_64-*-* } } } */
+
+#ifdef __i386__
+#include "cpuid.h"
+#endif
+
+extern void abort (void);
+
+int main(void)
+{
+  double arr[1000];
+  double a, b;
+
+  int i;
+
+#ifdef __i386__
+  unsigned int eax, ebx, ecx, edx;
+  if (!__get_cpuid (1, &eax, &ebx, &ecx, &edx))
+    return 0;
+
+  /* Run SSE2 test only if host has SSE2 support.  */
+  if (!(edx & bit_SSE2))
+    return 0;
+#endif
+
+  for (i = 0; i < 1000; i++)
+    arr[i] = 4294967296.0 + (double)i;
+
+  a = arr[0];
+  b = (unsigned int)((unsigned long long int)a % 4294967296ULL);
+
+  if (b >= 4294967296.0)
+    abort ();
+
+  return 0;
+}