[PATCH] SSA default-def TLC

2012-08-02 Thread Richard Guenther

This is one thing I noticed when removing referenced vars:

Index: trunk/gcc/tree-cfg.c
===
*** trunk.orig/gcc/tree-cfg.c   2012-08-02 10:13:52.0 +0200
--- trunk/gcc/tree-cfg.c2012-08-02 10:16:24.593266230 +0200
*** replace_ssa_name (tree name, struct poin
*** 6047,6057 
  {
replace_by_duplicate_decl (decl, vars_map, to_context);

-   push_cfun (DECL_STRUCT_FUNCTION (to_context));
new_name = make_ssa_name (decl, SSA_NAME_DEF_STMT (name));
if (SSA_NAME_IS_DEFAULT_DEF (name))
!   set_default_def (decl, new_name);
!   pop_cfun ();

so we push/pop cfun just because we call set_default_def which
for some weird reason does not take a struct function argument
(compared to gimple_default_def).

So I went out to fix that, noticing on the way the common pattern
to create a new default def if it does not exist.  Moved the
helper from tree-into-ssa.c and renamed it, making all the function
names a bit more sensible:

! extern void set_default_def (tree, tree);
! extern tree gimple_default_def (struct function *, tree);
--- 445,453 
! extern void set_ssa_default_def (struct function *, tree, tree);
! extern tree ssa_default_def (struct function *, tree);
! extern tree get_or_create_ssa_default_def (struct function *, tree);

Queued for bootstrap and regtest on x86_64-unknown-linux-gnu.

Richard.

2012-08-02  Richard Guenther  rguent...@suse.de

* tree-flow.h (set_default_def): Rename to ...
(set_ssa_default_def): ... this.  Take a struct function argument.
(gimple_default_def): Rename to ...
(ssa_default_def): ... this.
(get_or_create_ssa_default_def): New function.
* tree-dfa.c: Likewise.
(dump_variable): Adjust.
* ipa-prop.c (ipa_analyze_params_uses): Adjust, properly check
for used parameters.
* ipa-split.c (consider_split): Adjust, avoid repeated default-def
lookups.
(split_function): Likewise.
* lto-streamer-in.c (input_ssa_names): Adjust.
* omp-low.c (expand_omp_taskreg): Likewise.
* tree-cfg.c (replace_ssa_name): Adjust, no need to push/pop cfun.
* tree-complex.c (init_parameter_lattice_values): Adjust.
(get_component_ssa_name): Likewise.
(update_parameter_components): Likewise.
* tree-inline.c (remap_ssa_name): Likewise.
(setup_one_parameter): Likewise.
(initialize_inlined_parameters): Likewise.
(declare_return_variable): Likewise.
(expand_call_inline): Likewise.
(tree_function_versioning): Likewise.
* tree-into-ssa.c (get_default_def_for): Remove.
(get_reaching_def): Use get_or_create_ssa_default_def instead.
* tree-predcom.c (replace_ref_with): Adjust.
* tree-sra.c (get_repl_default_def_ssa_name): Likewise.
(is_unused_scalar_param): Likewise.
(ptr_parm_has_direct_uses): Likewise.
(sra_ipa_reset_debug_stmts): Likewise.
* tree-ssa-coalesce.c (create_outofssa_var_map): Adjust.
* tree-ssa-copyrename.c (copy_rename_partition_coalesce): Likewise.
* tree-ssa-live.c (verify_live_on_entry): Likewise.
* tree-ssa-math-opts.c (execute_cse_reciprocals): Likewise,
avoid repeated default def lookups.
* tree-ssa-sccvn.c (run_scc_vn): Likewise.
* tree-tailcall.c (arg_needs_copy_p): Adjust.
(tree_optimize_tail_calls_1): Likewise.

Index: trunk/gcc/ipa-prop.c
===
*** trunk.orig/gcc/ipa-prop.c   2012-08-02 10:13:52.0 +0200
--- trunk/gcc/ipa-prop.c2012-08-02 10:31:58.660233887 +0200
*** ipa_analyze_params_uses (struct cgraph_n
*** 1623,1632 
for (i = 0; i  ipa_get_param_count (info); i++)
  {
tree parm = ipa_get_param (info, i);
/* For SSA regs see if parameter is used.  For non-SSA we compute
 the flag during modification analysis.  */
if (is_gimple_reg (parm)
!  gimple_default_def (DECL_STRUCT_FUNCTION (node-symbol.decl), 
parm))
ipa_set_param_used (info, i, true);
  }
  
--- 1623,1635 
for (i = 0; i  ipa_get_param_count (info); i++)
  {
tree parm = ipa_get_param (info, i);
+   tree ddef;
/* For SSA regs see if parameter is used.  For non-SSA we compute
 the flag during modification analysis.  */
if (is_gimple_reg (parm)
!  (ddef = ssa_default_def (DECL_STRUCT_FUNCTION (node-symbol.decl),
! parm)) != NULL_TREE
!  !has_zero_uses (ddef))
ipa_set_param_used (info, i, true);
  }
  
Index: trunk/gcc/ipa-split.c
===
*** trunk.orig/gcc/ipa-split.c  2012-08-02 10:13:52.0 +0200
--- trunk/gcc/ipa-split.c   2012-08-02 10:16:24.588266230 +0200

[PATCH] Remove make_rename_temp

2012-08-02 Thread Richard Guenther

It's now a wrapper around create_tmp_reg.

Bootstrap and regtest pending on x86_64-unknown-linux-gnu.

Richard.

2012-08-02  Richard Guenther  rguent...@suse.de

* tree-flow.h (make_rename_temp): Remove.
* tree-dfa.c (make_rename_temp): Likewise.
* cgraphunit.c (thunk_adjust, assemble_thunk): Use create_tmp_reg
instead of make_rename_temp.
* omp-low.c (expand_omp_for_generic, expand_omp_for_static_nochunk,
expand_omp_atomic_pipeline): Likewise.
* trans-mem.c (tm_log_emit_save_or_restores, build_tm_load,
build_tm_store, expand_call_tm, expand_transaction,
ipa_tm_insert_gettmclone_call): Likewise.
* tree-complex.c (expand_complex_div_wide): Likewise.
* tree-mudflap.c (mf_decl_cache_locals, mf_build_check_statement_for):
Likewise.
* tree-ssa-loop-im.c (execute_sm_if_changed_flag_set, execute_sm):
Likewise.
* tree-ssa-math-opts.c (insert_reciprocals): Likewise.
* value-prof.c (gimple_divmod_fixed_value, gimple_mod_pow2,
gimple_mod_subtract): Likewise.

Index: trunk/gcc/tree-dfa.c
===
*** trunk.orig/gcc/tree-dfa.c   2012-08-02 10:32:07.0 +0200
--- trunk/gcc/tree-dfa.c2012-08-02 10:40:21.102216493 +0200
*** renumber_gimple_stmt_uids_in_blocks (bas
*** 114,127 
  }
  }
  
- /* Build a temporary.  Make sure and register it to be renamed.  */
- 
- tree
- make_rename_temp (tree type, const char *prefix)
- {
-   return create_tmp_reg (type, prefix);
- }
- 
  
  
  /*---
--- 114,119 
Index: trunk/gcc/tree-flow.h
===
*** trunk.orig/gcc/tree-flow.h  2012-08-02 10:16:24.0 +0200
--- trunk/gcc/tree-flow.h   2012-08-02 10:40:21.103216493 +0200
*** extern void dump_dfa_stats (FILE *);
*** 444,450 
  extern void debug_dfa_stats (void);
  extern void dump_variable (FILE *, tree);
  extern void debug_variable (tree);
- extern tree make_rename_temp (tree, const char *);
  extern void set_ssa_default_def (struct function *, tree, tree);
  extern tree ssa_default_def (struct function *, tree);
  extern tree get_or_create_ssa_default_def (struct function *, tree);
--- 444,449 
Index: trunk/gcc/cgraphunit.c
===
*** trunk.orig/gcc/cgraphunit.c 2012-08-02 10:13:51.0 +0200
--- trunk/gcc/cgraphunit.c  2012-08-02 10:42:22.119212303 +0200
*** thunk_adjust (gimple_stmt_iterator * bsi
*** 1280,1286 
}
  
vtabletmp =
!   make_rename_temp (build_pointer_type
  (build_pointer_type (vtable_entry_type)), vptr);
  
/* The vptr is always at offset zero in the object.  */
--- 1280,1286 
}
  
vtabletmp =
!   create_tmp_reg (build_pointer_type
  (build_pointer_type (vtable_entry_type)), vptr);
  
/* The vptr is always at offset zero in the object.  */
*** thunk_adjust (gimple_stmt_iterator * bsi
*** 1290,1296 
gsi_insert_after (bsi, stmt, GSI_NEW_STMT);
  
/* Form the vtable address.  */
!   vtabletmp2 = make_rename_temp (TREE_TYPE (TREE_TYPE (vtabletmp)),
 vtableaddr);
stmt = gimple_build_assign (vtabletmp2,
  build_simple_mem_ref (vtabletmp));
--- 1290,1296 
gsi_insert_after (bsi, stmt, GSI_NEW_STMT);
  
/* Form the vtable address.  */
!   vtabletmp2 = create_tmp_reg (TREE_TYPE (TREE_TYPE (vtabletmp)),
 vtableaddr);
stmt = gimple_build_assign (vtabletmp2,
  build_simple_mem_ref (vtabletmp));
*** thunk_adjust (gimple_stmt_iterator * bsi
*** 1304,1310 
gsi_insert_after (bsi, stmt, GSI_NEW_STMT);
  
/* Get the offset itself.  */
!   vtabletmp3 = make_rename_temp (TREE_TYPE (TREE_TYPE (vtabletmp2)),
 vcalloffset);
stmt = gimple_build_assign (vtabletmp3,
  build_simple_mem_ref (vtabletmp2));
--- 1304,1310 
gsi_insert_after (bsi, stmt, GSI_NEW_STMT);
  
/* Get the offset itself.  */
!   vtabletmp3 = create_tmp_reg (TREE_TYPE (TREE_TYPE (vtabletmp2)),
 vcalloffset);
stmt = gimple_build_assign (vtabletmp3,
  build_simple_mem_ref (vtabletmp2));
*** thunk_adjust (gimple_stmt_iterator * bsi
*** 1326,1332 
  ptrtmp = ptr;
else
  {
!   ptrtmp = make_rename_temp (TREE_TYPE (ptr), ptr);
stmt = gimple_build_assign (ptrtmp, ptr);
  gsi_insert_after (bsi, stmt, GSI_NEW_STMT);
}

Re: ORDERED_EXPR in invert_tree_comparison

2012-08-02 Thread Richard Guenther
On Wed, Aug 1, 2012 at 9:21 PM, Marc Glisse marc.gli...@inria.fr wrote:
 Hello,

 an opinion on this?

 (I just noticed: I'll update the list in the comment visible at the top of
 the patch if this gets in).

It looks ok to me but I am no floating-point expert.  Can you add a testcase?

Ok with that change.

Thanks,
Richard.


 On Thu, 19 Jul 2012, Marc Glisse wrote:

 Hello,

 the simple patch below passes the testsuite after a c,c++ bootstrap
 without new regressions. Note however that

 #include math.h
 int f(double a, double b){
  return (!isunordered(a,b))(ab);
 }

 is then optimized by ifcombine to return (ab);, which seems wrong in
 the absence of -fno-trapping-math. I don't know if there are ways to trigger
 this latent bug without the patch.



 2012-06-15  Marc Glisse  marc.gli...@inria.fr

PR tree-optimization/53805
* fold-const.c (invert_tree_comparison): Do invert ORDERED_EXPR and
UNORDERED_EXPR for floating point.

 --- fold-const.c(revision 189622)
 +++ fold-const.c(working copy)
 @@ -2096,13 +2096,14 @@ pedantic_non_lvalue_loc (location_t loc,
It is generally not safe to do this for floating-point comparisons,
 except
for EQ_EXPR and NE_EXPR, so we return ERROR_MARK in this case.  */

 enum tree_code
 invert_tree_comparison (enum tree_code code, bool honor_nans)
 {
 -  if (honor_nans  flag_trapping_math  code != EQ_EXPR  code !=
 NE_EXPR)
 +  if (honor_nans  flag_trapping_math  code != EQ_EXPR  code !=
 NE_EXPR
 +   code != ORDERED_EXPR  code != UNORDERED_EXPR)
 return ERROR_MARK;

   switch (code)
 {
 case EQ_EXPR:
   return NE_EXPR;


 --
 Marc Glisse


Re: [patch, fortran] Fix PR 54033, problems with -I, with test cases

2012-08-02 Thread Richard Guenther
On Tue, Jul 31, 2012 at 3:47 PM, Tobias Burnus bur...@net-b.de wrote:
 On 07/29/2012 11:24 AM, Thomas Koenig wrote:

 here is an updated patch for PR 54033, this time with test cases.
 Thanks to Janis for pointing me in the right direction with these.
 Regression-tested. OK for trunk?


 Ok. Thanks for the patch - and to Janis for the first review.

 Can you eliminate the extra line before else if?

Seems to break testing, all testcases emit

Warning: Nonexistent include directory finclude^M

now and thus all testcases fail like

FAIL: gfortran.dg/alloc_comp_basics_1.f90  -O0  (test for excess errors)

Richard.

 Tobias


 2012-07-29 Thomas König  tkoe...@gcc.gnu.org

 PR fortran/54033
 * scanner.c (add_path_to_list): Emit warning if an error occurs
 for an include path, if it is not present or if it is not a
 directory.  Do not add the path in these cases.

 2012-07-29  Thomas König  tkoe...@gcc.gnu.org

 PR fortran/54033
 * gfortran.dg/include_6.f90:  New test case.
 * gfortran.dg/include_7.f90:  New test case.
 * gfortran.dg/include_3.f90:  Add dg-warning for missing
 directory.





Re: [PATCH] Fix ARM constant-pool layout calculations under -falign-labels

2012-08-02 Thread Julian Brown
On Wed, 1 Aug 2012 14:43:33 -0700
Roland McGrath mcgra...@google.com wrote:

 Using e.g. -falign-labels=16 on ARM can confuse the constant-pool
 layout code such that it places pool entries too far away from their
 referring instructions.  This change seems to fix it.
 
 I don't have a small test case, only a large one, which I haven't
 actually tried to get to reproduce on any vanilla ARM target.  But
 the logic of the change seems straightforward and sound.

FWIW, I've hit this issue in the past, and used a patch as follows to
fix it:

@@ -12015,7 +12025,10 @@ create_fix_barrier (Mfix *fix, HOST_WIDE
   gcc_assert (GET_CODE (from) != BARRIER);
 
   /* Count the length of this insn.  */
-  count += get_attr_length (from);
+  if (LABEL_P (from)  (align_jumps  0 || align_loops  0))
+count += MAX (align_jumps, align_loops);
+  else
+count += get_attr_length (from);
 
   /* If there is a jump table, add its length.  */
   tmp = is_jump_table (from);
@@ -12435,6 +12448,8 @@ arm_reorg (void)
  insn = table;
}
}
+  else if (LABEL_P (insn)  (align_jumps  0 || align_loops  0))
+   address += MAX (align_jumps, align_loops);
 }
 
   fix = minipool_fix_head;

Not sure if that's equivalent, but you might want to check
-falign-jumps too while you're at it.

Cheers,

Julian


Re: [Patch, Fortran, F03] PR 54147: Interface checks for PPCs deferred TBPs

2012-08-02 Thread Janus Weil
 Patch was regtested on x86_64-unknown-linux-gnu. Ok for trunk?


 Looks OK. Thanks!

Thanks for the review. Committed as r190069.

Cheers,
Janus



 2012-08-01  Janus Weil  ja...@gcc.gnu.org

 PR fortran/54147
 * resolve.c (check_proc_interface): New routine for PROCEDURE
 interface
 checks.
 (resolve_procedure_interface,resolve_typebound_procedure,
 resolve_fl_derived0): Call it.

 2012-08-01  Janus Weil  ja...@gcc.gnu.org

 PR fortran/54147
 * gfortran.dg/abstract_type_6.f03: Modified.
 * gfortran.dg/proc_ptr_comp_3.f90: Modified.
 * gfortran.dg/proc_ptr_comp_35.f90: New.
 * gfortran.dg/typebound_proc_9.f03: Modified.
 * gfortran.dg/typebound_proc_26.f90: New.




Our Biggest Blockbuster Announcement of the Year is Coming Soon!

2012-08-02 Thread Anna Clay
Important: Your investment can get you an extra $10,000 by Friday with only 
$300 purchase of blockbuster symbol!


V_ND_B is a pioneer in manufacturing of battaries for mobiles it gained a 
lot of interest in the last couple of day, investors are spending.


We expect V_ND_B gainining 60% in the next couple of days and hitting $1.20, 
a clear sign that V_ND_B will soar this week.


Get $300 of V_ND_B shares on August 2, Thursday while you can get it at 
06! Call your borker or use your own online trading account (*Etrade or 
similair).




Re: [PATCH] Fix ARM constant-pool layout calculations under -falign-labels

2012-08-02 Thread Julian Brown
On Thu, 2 Aug 2012 09:57:40 +0100
Julian Brown jul...@codesourcery.com wrote:

 On Wed, 1 Aug 2012 14:43:33 -0700
 Roland McGrath mcgra...@google.com wrote:
 
  Using e.g. -falign-labels=16 on ARM can confuse the constant-pool
  layout code such that it places pool entries too far away from their
  referring instructions.  This change seems to fix it.
  
  I don't have a small test case, only a large one, which I haven't
  actually tried to get to reproduce on any vanilla ARM target.  But
  the logic of the change seems straightforward and sound.
 
 FWIW, I've hit this issue in the past, and used a patch as follows to
 fix it:
 
 @@ -12015,7 +12025,10 @@ create_fix_barrier (Mfix *fix, HOST_WIDE
gcc_assert (GET_CODE (from) != BARRIER);
  
/* Count the length of this insn.  */
 -  count += get_attr_length (from);
 +  if (LABEL_P (from)  (align_jumps  0 || align_loops  0))
 +count += MAX (align_jumps, align_loops);
 +  else
 +count += get_attr_length (from);
  
/* If there is a jump table, add its length.  */
tmp = is_jump_table (from);
 @@ -12435,6 +12448,8 @@ arm_reorg (void)
   insn = table;
 }
 }
 +  else if (LABEL_P (insn)  (align_jumps  0 || align_loops 
 0))
 +   address += MAX (align_jumps, align_loops);
  }
  
fix = minipool_fix_head;
 
 Not sure if that's equivalent, but you might want to check
 -falign-jumps too while you're at it.

(...and -falign-loops. Whoops, misread :-)).


Re: PING [PATCH] Fix PR libstdc++/54036, problem negating DFP NaNs

2012-08-02 Thread Paolo Carlini

Hi,

On 08/02/2012 01:53 AM, Peter Bergner wrote:

So just to be sure, like the patch below?

More or less. See comments below.

Also, is this ok for the 4.6 and 4.7 release branches?

I don't think this is a regression, thus I would say 4.7 only, to be safe.

Peter


libstdc++-v3/
PR libstdc++/54036
* include/decimal/decimal.h (_DEFINE_DECIMAL_UNARY_OP): Use _Op as
a unary operator.

libstdc++-v3/testsuite/
PR libstdc++/54036
* decimal/pr54036-1.cc: New test.
* decimal/pr54036-2.cc: Likewise.
* decimal/pr54036-3.cc: Likewise.
we don't have a separate ChangeLog in libstdc++-v3/testsuite/. Thus a 
single ChangeLog entry for everything.


Index: libstdc++-v3/include/decimal/decimal.h
===
--- libstdc++-v3/include/decimal/decimal.h  (revision 189599)
+++ libstdc++-v3/include/decimal/decimal.h  (working copy)
@@ -288,7 +288,7 @@
inline _Tp operator _Op(_Tp __rhs)  \
{   \
  _Tp __tmp;\
-__tmp.__setval(0 _Op __rhs.__getval());\
+__tmp.__setval(_Op __rhs.__getval());  \
  return __tmp; \
}
  
Index: libstdc++-v3/testsuite/decimal/pr54036-1.cc

===
--- libstdc++-v3/testsuite/decimal/pr54036-1.cc (revision 0)
+++ libstdc++-v3/testsuite/decimal/pr54036-1.cc (revision 0)
@@ -0,0 +1,56 @@

Copyright blurb missing. Also, you need:

// { dg-require-effective-target dfp }

Likewise for the other testcases.


+#include decimal/decimal
+using namespace std;
+
+decimal::decimal32
+__attribute__ ((noinline))
+my_nan32 (void)
+{
+  decimal::decimal32 z = 0;
+  decimal::decimal32 v = z/z;
+  return v;
+}
+
+decimal::decimal32
+__attribute__ ((noinline))
+my_inf32 (void)
+{
+  decimal::decimal32 o = 1;
+  decimal::decimal32 z = 0;
+  decimal::decimal32 v = o/z;
+  return v;
+}
+
+int
+main (void)
+{
+  decimal::decimal32 v;
+
+  v = my_nan32 ();
+  if (!__builtin_isnand32 (v.__getval ()))
+__builtin_abort ();
+  if (__builtin_signbitd32 (v.__getval ()))
+__builtin_abort ();
+
+  v = -v;
+
+  if (!__builtin_isnand32 (v.__getval ()))
+__builtin_abort ();
+  if (!__builtin_signbitd32 (v.__getval ()))
+__builtin_abort ();
+
+  v = my_inf32 ();
+  if (!__builtin_isinfd32 (v.__getval ()))
+__builtin_abort ();
+  if (__builtin_signbitd32 (v.__getval ()))
+__builtin_abort ();
+
+  v = -v;
+
+  if (!__builtin_isinfd32 (v.__getval ()))
+__builtin_abort ();
+  if (!__builtin_signbitd32 (v.__getval ()))
+__builtin_abort ();
+
+  return 0;
+}
+

In the library testsuite we include:

#include testsuite_hooks.h

and then we use VERIFY not __builtin_abort. Also, for decimal, we 
normally use:


using namespace std::decimal.

Please have the other existing decimal floating point testcases as 
reference, for these details, please try to be consistent.


Also, watch out blank lines at the end of the testcases.

Paolo.


Re: [patch, fortran] Fix PR 54033, problems with -I, with test cases

2012-08-02 Thread Tobias Burnus

On 08/02/2012 10:54 AM, Richard Guenther wrote:

Seems to break testing, all testcases emit

Warning: Nonexistent include directory finclude^M

now and thus all testcases fail like

FAIL: gfortran.dg/alloc_comp_basics_1.f90  -O0  (test for excess errors)


First, I actually wonder why it only lists finclude and not the full 
pathname.


I think the problem is that gfortran (the driver) passes something like
   -fintrinsic-modules-path 
/$PREFIX/lib64/gcc/x86_64-unknown-linux-gnu/4.8.0/finclude

to the actual compiler (f951).

That directory only exists if the compiler is installed but not if one 
runs the test suite without installing it. I wonder how the OpenMP tests 
handle it - there one needs the files from that directory. (It currently 
contains the following files: omp_lib.f90 omp_lib.h  omp_lib_kinds.mod  
omp_lib.mod.) Answer: Theose seemingly include $BUILD/$triplet/libgomp 
in the -I path, which also contain those files. (That probably clashes 
with use, intrinsic :: omp_lib, but that shouldn't matter.)


I am not sure whether it is the best solution, but one possibility would 
be to ignore -fintrinsic-modules-path for the warning. (That assumes 
that the warning is (almost) never needed for an installed compiler.)


Tobias


Re: [PATCH][7/n] into-SSA TLC

2012-08-02 Thread Richard Guenther
On Thu, 2 Aug 2012, Tom de Vries wrote:

 On 01/08/12 10:47, Richard Guenther wrote:
  * tree-ssa-tail-merge.c (release_last_vdef): Remove.
  (replace_block_by): Adjust.
  (tail_merge_optimize): Use mark_virtual_operands_for_renaming.
 
 Richard,
 
 this caused PR50672 to trigger again.

Hmm, indeed.  Reverted as follows.

Richard.

2012-08-02  Richard Guenther  rguent...@suse.de

PR tree-optimization/50672
Revert
2012-08-01  Richard Guenther  rguent...@suse.de

* tree-ssa-tail-merge.c (release_last_vdef): Remove.
(replace_block_by): Adjust.

* g++.dg/torture/pr50672.C: New testcase.

Index: gcc/tree-ssa-tail-merge.c
===
*** gcc/tree-ssa-tail-merge.c   (revision 190067)
--- gcc/tree-ssa-tail-merge.c   (working copy)
*** same_succ_flush_bbs (bitmap bbs)
*** 812,817 
--- 812,848 
  same_succ_flush_bb (BASIC_BLOCK (i));
  }
  
+ /* Release the last vdef in BB, either normal or phi result.  */
+ 
+ static void
+ release_last_vdef (basic_block bb)
+ {
+   gimple_stmt_iterator i;
+ 
+   for (i = gsi_last_bb (bb); !gsi_end_p (i); gsi_prev_nondebug (i))
+ {
+   gimple stmt = gsi_stmt (i);
+   if (gimple_vdef (stmt) == NULL_TREE)
+   continue;
+ 
+   mark_virtual_operand_for_renaming (gimple_vdef (stmt));
+   return;
+ }
+ 
+   for (i = gsi_start_phis (bb); !gsi_end_p (i); gsi_next (i))
+ {
+   gimple phi = gsi_stmt (i);
+   tree res = gimple_phi_result (phi);
+ 
+   if (is_gimple_reg (res))
+   continue;
+ 
+   mark_virtual_phi_result_for_renaming (phi);
+   return;
+ }
+   
+ }
+ 
  /* For deleted_bb_preds, find bbs with same successors.  */
  
  static void
*** replace_block_by (basic_block bb1, basic
*** 1446,1451 
--- 1477,1483 
bb1-frequency = 0;
  
/* Do updates that use bb1, before deleting bb1.  */
+   release_last_vdef (bb1);
same_succ_flush_bb (bb1);
  
delete_basic_block (bb1);
Index: gcc/testsuite/g++.dg/torture/pr50672.C
===
*** gcc/testsuite/g++.dg/torture/pr50672.C  (revision 0)
--- gcc/testsuite/g++.dg/torture/pr50672.C  (working copy)
***
*** 0 
--- 1,22 
+ // { dg-do compile }
+ 
+ struct A
+ {
+   bool isHint();
+ };
+ class B
+ {
+   void makeLine( int *) const;
+   void drawLine() const; A* to() const;
+   void _print() const;
+ };
+ A a;
+ void  B::makeLine(int *p1) const
+ {
+   if (a.isHint()  to()-isHint()) ;
+   else {
+   if (p1) B::drawLine(); else B::_print();
+   return;
+   }
+   if (p1) B::drawLine(); else B::_print();
+ }


PATCH: Remove redundant instructions after regcprop

2012-08-02 Thread Paulo J. Matos
Extended regcprop to check and remove for redundant move instructions 
resulting from the pass.


Paulo.

2012-08-02   Paulo Matos paulo.ma...@csr.com

* regcprop.c (copy_value): remove check for redundant moves.
* regcprop.c (copy_value): add check for redundant moves,
remove instructions if redundant.

--- //depot/bc/main/devHost/gcc46/gcc/gcc/regcprop.c	2011-09-06 14:29:15.0 0100
+++ /home/pm18/p4ws/pm18_binutils/bc/main/devHost/gcc46/gcc/gcc/regcprop.c	2011-09-06 14:29:15.0 0100
@@ -301,11 +301,8 @@
   unsigned int dn, sn;
   unsigned int i;
 
-  /* ??? At present, it's possible to see noop sets.  It'd be nice if
- this were cleaned up beforehand...  */
-  if (sr == dr)
-return;
-
+  gcc_assert(dr != sr);
+  
   /* Do not propagate copies to the stack pointer, as that can leave
  memory accesses with no scheduling dependency on the stack update.  */
   if (dr == STACK_POINTER_REGNUM)
@@ -734,9 +731,9 @@
 copyprop_hardreg_forward_1 (basic_block bb, struct value_data *vd)
 {
   bool anything_changed = false;
-  rtx insn;
+  rtx insn, next;
 
-  for (insn = BB_HEAD (bb); ; insn = NEXT_INSN (insn))
+  FOR_BB_INSNS_SAFE(bb, insn, next)
 {
   int n_ops, i, alt, predicated;
   bool is_asm, any_replacements;
@@ -755,10 +752,7 @@
 	   insn, vd);
 	}
 
-	  if (insn == BB_END (bb))
-	break;
-	  else
-	continue;
+	  continue;
 	}
 
   set = single_set (insn);
@@ -966,10 +960,19 @@
 
   /* Notice copies.  */
   if (set  REG_P (SET_DEST (set))  REG_P (SET_SRC (set)))
-	copy_value (SET_DEST (set), SET_SRC (set), vd);
-
-  if (insn == BB_END (bb))
-	break;
+  {
+unsigned int dr = REGNO(SET_DEST(set));
+unsigned int sr = REGNO(SET_SRC(set));
+
+if(dr == sr)
+{
+  /* noop set */
+  delete_insn_and_edges(insn);
+} 
+else
+  copy_value (SET_DEST (set), SET_SRC (set), vd);
+  }
+  
 }
 
   return anything_changed;


Re: PATCH: Remove redundant instructions after regcprop

2012-08-02 Thread Paulo J. Matos

Forgot to mention: this is to fix PR 54154.

Updated changelog:

2012-08-02   Paulo Matos paulo.ma...@csr.com

PR middle-end/54154
* regcprop.c (copy_value): remove check for redundant moves.
* regcprop.c (copy_value): add check for redundant moves,
remove instructions if redundant.





Re: PR middle-end/53321: [4.8 Regression] LTO bootstrap failed with bootstrap-profiled

2012-08-02 Thread Jan Hubicka
 
 This patch works passed profiledbootstrap with LTO as well as LTO -O3
 on 176.gcc in SPEC CPU 2000.  I have to add 2 inline_edge_summary_vec
 checks to avoid ICE.  OK to install?

Thanks, it looks good. I am just concerned about...
 diff --git a/gcc/ipa-split.c b/gcc/ipa-split.c
 index 33cf7d2..7a8844f 100644
 --- a/gcc/ipa-split.c
 +++ b/gcc/ipa-split.c
 @@ -1415,7 +1415,7 @@ execute_split_functions (void)
  }
/* This can be relaxed; function might become inlinable after splitting
   away the uninlinable part.  */
 -  if (!inline_summary (node)-inlinable)
 +  if (inline_edge_summary_vec  !inline_summary (node)-inlinable)

.. this one. spliting is executed before free_inline_summary and thus should
not be affected. Or is it because of it gets called from process_new_functions
because some IPA pass adds a new function?
If so, I think we need to make sure that process_new_function do not make 
inline summary
allocated when it was previously free (and thus hunk would be OK).

Honza


Re: PATCH: Remove redundant instructions after regcprop

2012-08-02 Thread Steven Bosscher
On Thu, Aug 2, 2012 at 12:17 PM, Paulo J. Matos paulo at matos-sorge
dot com wrote:
 Extended regcprop to check and remove for redundant move instructions
 resulting from the pass.

 Paulo.

 2012-08-02   Paulo Matos Paulo dot Matos at csr dot com

 * regcprop.c (copy_value): remove check for redundant moves.
 * regcprop.c (copy_value): add check for redundant moves,
 remove instructions if redundant.


Hello,

Thanks for working on this.

How did you test this? How do you account for mode differences between
the two registers?

Please also fix the patch (and the ChangeLog entry) to conform to the
GCC coding style requirements.

Ciao!
Steven


Re: PATCH: Remove redundant instructions after regcprop

2012-08-02 Thread Richard Guenther
On Thu, Aug 2, 2012 at 12:19 PM, Paulo J. Matos pa...@matos-sorge.com wrote:
 Forgot to mention: this is to fix PR 54154.

 Updated changelog:

 2012-08-02   Paulo Matos paulo.ma...@csr.com

 PR middle-end/54154

 * regcprop.c (copy_value): remove check for redundant moves.
 * regcprop.c (copy_value): add check for redundant moves,
 remove instructions if redundant.

That's in copyprop_hardreg_forward_1

+  gcc_assert(dr != sr);
+

space before ().

+  FOR_BB_INSNS_SAFE(bb, insn, next)
 {

Likewise.

+unsigned int dr = REGNO(SET_DEST(set));
+unsigned int sr = REGNO(SET_SRC(set));
+

Likewise.

Richard.






Re: [PATCH, RFC] Re-work find_reloads_subreg_address (Re: [PATCH][RFC, Reload]. Reload bug?)

2012-08-02 Thread Tejas Belagod

Ulrich Weigand wrote:


The following patch implements this idea; it passes a basic regression
test on arm-linux-gnueabi.  (Obviously this would need a lot more
testing on various platforms before getting into mainline ...)

Can you have a look whether this fixes the problem you're seeing?



Sorry for the delay in replying. Thanks for the patch. I tried this patch -  it 
doesn't seem to reach as far as cleanup_subreg_operands (), but fails an 
assertion in push_reload () in reload.c:1307. I'm currently investigating this 
and will let you know the reason soon.


Thanks,
Tejas Belagod.
ARM.



Bernd, Vlad, I'd appreciate your comments on this approach as well.

Thanks,
Ulrich


ChangeLog:

* reload.c (find_reloads_subreg_address): Remove FORCE_REPLACE
parameter.  Always replace normal subreg with memory reference
whenever possible.  Return NULL otherwise.
(find_reloads_toplev): Always call find_reloads_subreg_address
for subregs of registers equivalent to a memory location.
Only recurse further if find_reloads_subreg_address fails.
(find_reloads_address_1): Only call find_reloads_subreg_address
for subregs of registers equivalent to a memory location.
Properly handle failure of find_reloads_subreg_address.


Index: gcc/reload.c
===
*** gcc/reload.c(revision 189809)
--- gcc/reload.c(working copy)
*** static int find_reloads_address_1 (enum
*** 282,288 
  static void find_reloads_address_part (rtx, rtx *, enum reg_class,
   enum machine_mode, int,
   enum reload_type, int);
! static rtx find_reloads_subreg_address (rtx, int, int, enum reload_type,
int, rtx, int *);
  static void copy_replacements_1 (rtx *, rtx *, int);
  static int find_inc_amount (rtx, rtx);
--- 282,288 
  static void find_reloads_address_part (rtx, rtx *, enum reg_class,
   enum machine_mode, int,
   enum reload_type, int);
! static rtx find_reloads_subreg_address (rtx, int, enum reload_type,
int, rtx, int *);
  static void copy_replacements_1 (rtx *, rtx *, int);
  static int find_inc_amount (rtx, rtx);
*** find_reloads_toplev (rtx x, int opnum, e
*** 4755,4785 
}

/* If the subreg contains a reg that will be converted to a mem,
!convert the subreg to a narrower memref now.
!Otherwise, we would get (subreg (mem ...) ...),
!which would force reload of the mem.
!
!We also need to do this if there is an equivalent MEM that is
!not offsettable.  In that case, alter_subreg would produce an
!invalid address on big-endian machines.
!
!For machines that extend byte loads, we must not reload using
!a wider mode if we have a paradoxical SUBREG.  find_reloads will
!force a reload in that case.  So we should not do anything here.  */

if (regno = FIRST_PSEUDO_REGISTER
! #ifdef LOAD_EXTEND_OP
!  !paradoxical_subreg_p (x)
! #endif
!  (reg_equiv_address (regno) != 0
! || (reg_equiv_mem (regno) != 0
!  (! strict_memory_address_addr_space_p
! (GET_MODE (x), XEXP (reg_equiv_mem (regno), 0),
!  MEM_ADDR_SPACE (reg_equiv_mem (regno)))
! || ! offsettable_memref_p (reg_equiv_mem (regno))
! || num_not_at_initial_offset
!   x = find_reloads_subreg_address (x, 1, opnum, type, ind_levels,
!  insn, address_reloaded);
  }

for (copied = 0, i = GET_RTX_LENGTH (code) - 1; i = 0; i--)
--- 4755,4773 
}

/* If the subreg contains a reg that will be converted to a mem,
!attempt to convert the whole subreg to a (narrower or wider)
!memory reference instead.  If this succeeds, we're done --
!otherwise fall through to check whether the inner reg still
!needs address reloads anyway.  */

if (regno = FIRST_PSEUDO_REGISTER
!  reg_equiv_memory_loc (regno) != 0)
!   {
! tem = find_reloads_subreg_address (x, opnum, type, ind_levels,
!insn, address_reloaded);
! if (tem)
!   return tem;
!   }
  }

for (copied = 0, i = GET_RTX_LENGTH (code) - 1; i = 0; i--)
*** find_reloads_address_1 (enum machine_mod
*** 6018,6029 
  if (ira_reg_class_max_nregs [rclass][GET_MODE (SUBREG_REG (x))]
   reg_class_size[(int) rclass])
{
! x = find_reloads_subreg_address (x, 0, opnum,
!  ADDR_TYPE (type),
!  

[google/main] Omit TARGET_LIB_PATH from RPATH_ENVVAR in HOST_EXPORTS on bootstrap builds (issue6441093)

2012-08-02 Thread Simon Baldwin
Omit TARGET_LIB_PATH from RPATH_ENVVAR in HOST_EXPORTS on bootstrap builds.

Discussion and rationale at: http://gcc.gnu.org/ml/gcc/2012-06/msg00314.html

For google/main.  Tested for bootstrap and regression.

2012-08-02  Simon Baldwin  sim...@google.com

* Makefile.tpl: Omit TARGET_LIB_PATH from RPATH_ENVVAR set in
HOST_EXPORTS on bootstrap builds.
* Makefile.in: Regenerate.


Index: Makefile.in
===
--- Makefile.in (revision 190013)
+++ Makefile.in (working copy)
@@ -225,9 +225,6 @@ HOST_EXPORTS = \
CLOOGINC=$(HOST_CLOOGINC); export CLOOGINC; \
LIBELFLIBS=$(HOST_LIBELFLIBS) ; export LIBELFLIBS; \
LIBELFINC=$(HOST_LIBELFINC) ; export LIBELFINC; \
-@if gcc-bootstrap
-   $(RPATH_ENVVAR)=`echo $(TARGET_LIB_PATH)$$$(RPATH_ENVVAR) | sed 
's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \
-@endif gcc-bootstrap
$(RPATH_ENVVAR)=`echo $(HOST_LIB_PATH)$$$(RPATH_ENVVAR) | sed 
's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR);
 
 POSTSTAGE1_CXX_EXPORT = \
Index: Makefile.tpl
===
--- Makefile.tpl(revision 190013)
+++ Makefile.tpl(working copy)
@@ -228,9 +228,6 @@ HOST_EXPORTS = \
CLOOGINC=$(HOST_CLOOGINC); export CLOOGINC; \
LIBELFLIBS=$(HOST_LIBELFLIBS) ; export LIBELFLIBS; \
LIBELFINC=$(HOST_LIBELFINC) ; export LIBELFINC; \
-@if gcc-bootstrap
-   $(RPATH_ENVVAR)=`echo $(TARGET_LIB_PATH)$$$(RPATH_ENVVAR) | sed 
's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \
-@endif gcc-bootstrap
$(RPATH_ENVVAR)=`echo $(HOST_LIB_PATH)$$$(RPATH_ENVVAR) | sed 
's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR);
 
 POSTSTAGE1_CXX_EXPORT = \

--
This patch is available for review at http://codereview.appspot.com/6441093


[C++ patch] Allow p-~T() when T is a vector

2012-08-02 Thread Marc Glisse

Hello,

this patch allows p-~T() when T is (after substitution) a vector, which 
is necessary for use in std::vector for instance.


gcc/cp/ChangeLog
2012-08-02  Marc Glisse  marc.gli...@inria.fr

* pt.c (tsubst_copy_and_build): Handle VECTOR_TYPE like scalars.

gcc/testsuite/ChangeLog
2012-08-02  Marc Glisse  marc.gli...@inria.fr

* g++.dg/ext/vector17.C: New testcase.

--
Marc GlisseIndex: testsuite/g++.dg/ext/vector17.C
===
--- testsuite/g++.dg/ext/vector17.C (revision 0)
+++ testsuite/g++.dg/ext/vector17.C (revision 0)
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+typedef double __attribute__((vector_size(1024) )) vec;
+
+template class T
+void f (T *p)
+{
+  p-~T();
+}
+void g (vec *p)
+{
+  f(p);
+}

Property changes on: testsuite/g++.dg/ext/vector17.C
___
Added: svn:eol-style
   + native
Added: svn:keywords
   + Author Date Id Revision URL

Index: cp/pt.c
===
--- cp/pt.c (revision 190071)
+++ cp/pt.c (working copy)
@@ -13844,21 +13844,22 @@ tsubst_copy_and_build (tree t,
args, complain, in_decl);
else
  member = tsubst_copy (member, args, complain, in_decl);
if (member == error_mark_node)
  return error_mark_node;
 
if (type_dependent_expression_p (object))
  /* We can't do much here.  */;
else if (!CLASS_TYPE_P (object_type))
  {
-   if (SCALAR_TYPE_P (object_type))
+   if (SCALAR_TYPE_P (object_type)
+   || TREE_CODE (object_type) == VECTOR_TYPE)
  {
tree s = NULL_TREE;
tree dtor = member;
 
if (TREE_CODE (dtor) == SCOPE_REF)
  {
s = TREE_OPERAND (dtor, 0);
dtor = TREE_OPERAND (dtor, 1);
  }
if (TREE_CODE (dtor) == BIT_NOT_EXPR)


Re: [C++ patch] Allow p-~T() when T is a vector

2012-08-02 Thread Richard Guenther
On Thu, Aug 2, 2012 at 1:42 PM, Marc Glisse marc.gli...@inria.fr wrote:
 Hello,

 this patch allows p-~T() when T is (after substitution) a vector, which is
 necessary for use in std::vector for instance.

Why not include VECTOR_TYPE in ARITHMETIC_TYPE_P?

 gcc/cp/ChangeLog
 2012-08-02  Marc Glisse  marc.gli...@inria.fr

 * pt.c (tsubst_copy_and_build): Handle VECTOR_TYPE like scalars.

 gcc/testsuite/ChangeLog
 2012-08-02  Marc Glisse  marc.gli...@inria.fr

 * g++.dg/ext/vector17.C: New testcase.

 --
 Marc Glisse
 Index: testsuite/g++.dg/ext/vector17.C
 ===
 --- testsuite/g++.dg/ext/vector17.C (revision 0)
 +++ testsuite/g++.dg/ext/vector17.C (revision 0)
 @@ -0,0 +1,12 @@
 +/* { dg-do compile } */
 +typedef double __attribute__((vector_size(1024) )) vec;
 +
 +template class T
 +void f (T *p)
 +{
 +  p-~T();
 +}
 +void g (vec *p)
 +{
 +  f(p);
 +}

 Property changes on: testsuite/g++.dg/ext/vector17.C
 ___
 Added: svn:eol-style
+ native
 Added: svn:keywords
+ Author Date Id Revision URL

 Index: cp/pt.c
 ===
 --- cp/pt.c (revision 190071)
 +++ cp/pt.c (working copy)
 @@ -13844,21 +13844,22 @@ tsubst_copy_and_build (tree t,
 args, complain, in_decl);
 else
   member = tsubst_copy (member, args, complain, in_decl);
 if (member == error_mark_node)
   return error_mark_node;

 if (type_dependent_expression_p (object))
   /* We can't do much here.  */;
 else if (!CLASS_TYPE_P (object_type))
   {
 -   if (SCALAR_TYPE_P (object_type))
 +   if (SCALAR_TYPE_P (object_type)
 +   || TREE_CODE (object_type) == VECTOR_TYPE)
   {
 tree s = NULL_TREE;
 tree dtor = member;

 if (TREE_CODE (dtor) == SCOPE_REF)
   {
 s = TREE_OPERAND (dtor, 0);
 dtor = TREE_OPERAND (dtor, 1);
   }
 if (TREE_CODE (dtor) == BIT_NOT_EXPR)



Re: [C++ patch] Allow p-~T() when T is a vector

2012-08-02 Thread Ramana Radhakrishnan

On 08/02/12 13:08, Richard Guenther wrote:

On Thu, Aug 2, 2012 at 1:42 PM, Marc Glisse marc.gli...@inria.fr wrote:

Hello,

this patch allows p-~T() when T is (after substitution) a vector, which is
necessary for use in std::vector for instance.


Why not include VECTOR_TYPE in ARITHMETIC_TYPE_P?


Not really, because SCALAR_TYPE_P uses ARITHMETIC_TYPE_P just below in 
cp-tree.h to detect whether something is scalar or not. It would need 
more refactoring I'd suspect 


Ramana




gcc/cp/ChangeLog
2012-08-02  Marc Glisse  marc.gli...@inria.fr

 * pt.c (tsubst_copy_and_build): Handle VECTOR_TYPE like scalars.

gcc/testsuite/ChangeLog
2012-08-02  Marc Glisse  marc.gli...@inria.fr

 * g++.dg/ext/vector17.C: New testcase.

--
Marc Glisse
Index: testsuite/g++.dg/ext/vector17.C
===
--- testsuite/g++.dg/ext/vector17.C (revision 0)
+++ testsuite/g++.dg/ext/vector17.C (revision 0)
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+typedef double __attribute__((vector_size(1024) )) vec;
+
+template class T
+void f (T *p)
+{
+  p-~T();
+}
+void g (vec *p)
+{
+  f(p);
+}

Property changes on: testsuite/g++.dg/ext/vector17.C
___
Added: svn:eol-style
+ native
Added: svn:keywords
+ Author Date Id Revision URL

Index: cp/pt.c
===
--- cp/pt.c (revision 190071)
+++ cp/pt.c (working copy)
@@ -13844,21 +13844,22 @@ tsubst_copy_and_build (tree t,
 args, complain, in_decl);
 else
   member = tsubst_copy (member, args, complain, in_decl);
 if (member == error_mark_node)
   return error_mark_node;

 if (type_dependent_expression_p (object))
   /* We can't do much here.  */;
 else if (!CLASS_TYPE_P (object_type))
   {
-   if (SCALAR_TYPE_P (object_type))
+   if (SCALAR_TYPE_P (object_type)
+   || TREE_CODE (object_type) == VECTOR_TYPE)
   {
 tree s = NULL_TREE;
 tree dtor = member;

 if (TREE_CODE (dtor) == SCOPE_REF)
   {
 s = TREE_OPERAND (dtor, 0);
 dtor = TREE_OPERAND (dtor, 1);
   }
 if (TREE_CODE (dtor) == BIT_NOT_EXPR)








Re: [C++ patch] Allow p-~T() when T is a vector

2012-08-02 Thread Marc Glisse

On Thu, 2 Aug 2012, Richard Guenther wrote:


On Thu, Aug 2, 2012 at 1:42 PM, Marc Glisse marc.gli...@inria.fr wrote:

Hello,

this patch allows p-~T() when T is (after substitution) a vector, which is
necessary for use in std::vector for instance.


Why not include VECTOR_TYPE in ARITHMETIC_TYPE_P?


I often aim for the least disruptive change...

I just tried to look at the uses of ARITHMETIC_TYPE_P, and the first one I 
could find was to detect whether the type is convertible to bool :-(


--
Marc Glisse


Re: ORDERED_EXPR in invert_tree_comparison

2012-08-02 Thread Marc Glisse

On Thu, 2 Aug 2012, Richard Guenther wrote:


On Wed, Aug 1, 2012 at 9:21 PM, Marc Glisse marc.gli...@inria.fr wrote:

Hello,

an opinion on this?

(I just noticed: I'll update the list in the comment visible at the top of
the patch if this gets in).


It looks ok to me but I am no floating-point expert.  Can you add a testcase?

Ok with that change.


Here again with a testcase. The -O is not necessary for the optimization 
to happen, but it seemed wrong to me not to include it. I wondered about 
adding an explicit -ftrapping-math, for documentation purposes.


I am redoing the bootstrap+regtest, then I'll commit if I don't hear 
protests about the testcase.


gcc/ChangeLog
2012-06-15  Marc Glisse  marc.gli...@inria.fr

PR tree-optimization/53805
* fold-const.c (invert_tree_comparison): Do invert ORDERED_EXPR and
UNORDERED_EXPR for floating point.

gcc/testsuite/ChangeLog
2012-06-15  Marc Glisse  marc.gli...@inria.fr

PR tree-optimization/53805
* gcc.dg/fold-notunord.c: New testcase.

--
Marc GlisseIndex: gcc/testsuite/gcc.dg/fold-notunord.c
===
--- gcc/testsuite/gcc.dg/fold-notunord.c(revision 0)
+++ gcc/testsuite/gcc.dg/fold-notunord.c(revision 0)
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options -O -fdump-tree-optimized } */
+
+int f (double d)
+{
+  return !__builtin_isnan (d);
+}
+
+/* { dg-final { scan-tree-dump  ord  optimized } } */
+/* { dg-final { cleanup-tree-dump optimized } } */

Property changes on: gcc/testsuite/gcc.dg/fold-notunord.c
___
Added: svn:eol-style
   + native
Added: svn:keywords
   + Author Date Id Revision URL

Index: gcc/fold-const.c
===
--- gcc/fold-const.c(revision 190071)
+++ gcc/fold-const.c(working copy)
@@ -2087,26 +2087,28 @@ static tree
 pedantic_non_lvalue_loc (location_t loc, tree x)
 {
   if (pedantic_lvalues)
 return non_lvalue_loc (loc, x);
 
   return protected_set_expr_location_unshare (x, loc);
 }
 
 /* Given a tree comparison code, return the code that is the logical inverse.
It is generally not safe to do this for floating-point comparisons, except
-   for EQ_EXPR and NE_EXPR, so we return ERROR_MARK in this case.  */
+   for EQ_EXPR, NE_EXPR, ORDERED_EXPR and UNORDERED_EXPR, so we return
+   ERROR_MARK in this case.  */
 
 enum tree_code
 invert_tree_comparison (enum tree_code code, bool honor_nans)
 {
-  if (honor_nans  flag_trapping_math  code != EQ_EXPR  code != NE_EXPR)
+  if (honor_nans  flag_trapping_math  code != EQ_EXPR  code != NE_EXPR
+   code != ORDERED_EXPR  code != UNORDERED_EXPR)
 return ERROR_MARK;
 
   switch (code)
 {
 case EQ_EXPR:
   return NE_EXPR;
 case NE_EXPR:
   return EQ_EXPR;
 case GT_EXPR:
   return honor_nans ? UNLE_EXPR : LE_EXPR;


Re: PATCH: Remove redundant instructions after regcprop

2012-08-02 Thread Paulo J. Matos

Thanks for the comments, I will be sending a new patch and fixed changelog.

On 02/08/12 11:27, Richard Guenther wrote:

On Thu, Aug 2, 2012 at 12:19 PM, Paulo J. Matos pa...@matos-sorge.com wrote:

Forgot to mention: this is to fix PR 54154.

Updated changelog:

2012-08-02   Paulo Matos paulo.ma...@csr.com

 PR middle-end/54154

 * regcprop.c (copy_value): remove check for redundant moves.
 * regcprop.c (copy_value): add check for redundant moves,
 remove instructions if redundant.


That's in copyprop_hardreg_forward_1

+  gcc_assert(dr != sr);
+

space before ().

+  FOR_BB_INSNS_SAFE(bb, insn, next)
  {

Likewise.

+unsigned int dr = REGNO(SET_DEST(set));
+unsigned int sr = REGNO(SET_SRC(set));
+

Likewise.

Richard.










--
PMatos



Re: PR middle-end/53321: [4.8 Regression] LTO bootstrap failed with bootstrap-profiled

2012-08-02 Thread H.J. Lu
On Thu, Aug 2, 2012 at 3:23 AM, Jan Hubicka hubi...@ucw.cz wrote:

 This patch works passed profiledbootstrap with LTO as well as LTO -O3
 on 176.gcc in SPEC CPU 2000.  I have to add 2 inline_edge_summary_vec
 checks to avoid ICE.  OK to install?

 Thanks, it looks good. I am just concerned about...
 diff --git a/gcc/ipa-split.c b/gcc/ipa-split.c
 index 33cf7d2..7a8844f 100644
 --- a/gcc/ipa-split.c
 +++ b/gcc/ipa-split.c
 @@ -1415,7 +1415,7 @@ execute_split_functions (void)
  }
/* This can be relaxed; function might become inlinable after splitting
   away the uninlinable part.  */
 -  if (!inline_summary (node)-inlinable)
 +  if (inline_edge_summary_vec  !inline_summary (node)-inlinable)

 .. this one. spliting is executed before free_inline_summary and thus should
 not be affected. Or is it because of it gets called from process_new_functions
 because some IPA pass adds a new function?

It is called from pass_feedback_split_functions:

  NEXT_PASS (pass_all_early_optimizations);
{
   ...
}
  NEXT_PASS (pass_ipa_free_inline_summary);
  NEXT_PASS (pass_ipa_tree_profile);
{
  struct opt_pass **p = pass_ipa_tree_profile.pass.sub;
  NEXT_PASS (pass_feedback_split_functions);
}

OK to install?

Thanks.

-- 
H.J.


Re: ORDERED_EXPR in invert_tree_comparison

2012-08-02 Thread Richard Guenther
On Thu, Aug 2, 2012 at 2:48 PM, Marc Glisse marc.gli...@inria.fr wrote:
 On Thu, 2 Aug 2012, Richard Guenther wrote:

 On Wed, Aug 1, 2012 at 9:21 PM, Marc Glisse marc.gli...@inria.fr wrote:

 Hello,

 an opinion on this?

 (I just noticed: I'll update the list in the comment visible at the top
 of
 the patch if this gets in).


 It looks ok to me but I am no floating-point expert.  Can you add a
 testcase?

 Ok with that change.


 Here again with a testcase. The -O is not necessary for the optimization to
 happen, but it seemed wrong to me not to include it. I wondered about adding
 an explicit -ftrapping-math, for documentation purposes.

 I am redoing the bootstrap+regtest, then I'll commit if I don't hear
 protests about the testcase.

Yes, an explicit -ftrapping-math would be good.

Thanks,
Richard.

 gcc/ChangeLog

 2012-06-15  Marc Glisse  marc.gli...@inria.fr

 PR tree-optimization/53805
 * fold-const.c (invert_tree_comparison): Do invert ORDERED_EXPR and
 UNORDERED_EXPR for floating point.

 gcc/testsuite/ChangeLog

 2012-06-15  Marc Glisse  marc.gli...@inria.fr

 PR tree-optimization/53805
 * gcc.dg/fold-notunord.c: New testcase.

 --
 Marc Glisse
 Index: gcc/testsuite/gcc.dg/fold-notunord.c
 ===
 --- gcc/testsuite/gcc.dg/fold-notunord.c(revision 0)
 +++ gcc/testsuite/gcc.dg/fold-notunord.c(revision 0)
 @@ -0,0 +1,10 @@
 +/* { dg-do compile } */
 +/* { dg-options -O -fdump-tree-optimized } */
 +
 +int f (double d)
 +{
 +  return !__builtin_isnan (d);
 +}
 +
 +/* { dg-final { scan-tree-dump  ord  optimized } } */
 +/* { dg-final { cleanup-tree-dump optimized } } */

 Property changes on: gcc/testsuite/gcc.dg/fold-notunord.c
 ___
 Added: svn:eol-style
+ native
 Added: svn:keywords
+ Author Date Id Revision URL

 Index: gcc/fold-const.c
 ===
 --- gcc/fold-const.c(revision 190071)
 +++ gcc/fold-const.c(working copy)
 @@ -2087,26 +2087,28 @@ static tree
  pedantic_non_lvalue_loc (location_t loc, tree x)
  {
if (pedantic_lvalues)
  return non_lvalue_loc (loc, x);

return protected_set_expr_location_unshare (x, loc);
  }

  /* Given a tree comparison code, return the code that is the logical
 inverse.
 It is generally not safe to do this for floating-point comparisons,
 except
 -   for EQ_EXPR and NE_EXPR, so we return ERROR_MARK in this case.  */
 +   for EQ_EXPR, NE_EXPR, ORDERED_EXPR and UNORDERED_EXPR, so we return
 +   ERROR_MARK in this case.  */

  enum tree_code
  invert_tree_comparison (enum tree_code code, bool honor_nans)
  {
 -  if (honor_nans  flag_trapping_math  code != EQ_EXPR  code !=
 NE_EXPR)
 +  if (honor_nans  flag_trapping_math  code != EQ_EXPR  code !=
 NE_EXPR
 +   code != ORDERED_EXPR  code != UNORDERED_EXPR)
  return ERROR_MARK;

switch (code)
  {
  case EQ_EXPR:
return NE_EXPR;
  case NE_EXPR:
return EQ_EXPR;
  case GT_EXPR:
return honor_nans ? UNLE_EXPR : LE_EXPR;



Re: PATCH: Remove redundant instructions after regcprop

2012-08-02 Thread Paulo J. Matos

On 02/08/12 11:25, Steven Bosscher wrote:

Hello,

Thanks for working on this.

How did you test this?



This patch is for GCC46. The main problem is that I was not able to 
reproduce it (yet) for any upstream backends. I therefore patched GCC46 
and tested our backend (where I can easily reproduce the problem) with 
our commercial test suites and our own hand-crafted suite.


I would be eager to know if you have any suggestion on how to test this 
with upstream backends even if we can't reproduce it. One way would be 
to test trunk before and after patch and see if we introduce any 
testsuite regressions, but it feels slightly useless if this problem 
doesn't occur with x86 (maybe due to the large amount of registers, or 
how move rules are described in the backend).


 How do you account for mode differences between
 the two registers?

From what I understand about the code is that a simple move between two 
registers will always have registers with the same mode, so mode is not 
a worry. That was also the assumption of the code that was written 
before which had in copy_value:

/* Assert that SRC has been copied to DEST.  Adjust the data structures to
reflect that SRC contains an older copy of the shared value.  */

static void
copy_value (rtx dest, rtx src, struct value_data *vd)
{
  unsigned int dr = REGNO (dest);
  unsigned int sr = REGNO (src);
  unsigned int dn, sn;
  unsigned int i;

  /* ??? At present, it's possible to see noop sets.  It'd be nice if 
this were

cleaned up beforehand...  */
  if (sr == dr)
return;


Please also fix the patch (and the ChangeLog entry) to conform to the
GCC coding style requirements.



Richard already sent me a message about that.
Those problems were lack of experience with patch submission. Will sort 
that out and resend.


Thanks for your interest in the patch,

Paulo Matos


Ciao!
Steven




--
PMatos



Re: PATCH: Remove redundant instructions after regcprop

2012-08-02 Thread Paulo J. Matos

2012-08-02   Paulo Matos paulo.ma...@csr.com

PR middle-end/54154
* regcprop.c (copy_value): remove check for redundant moves.
* regcprop.c (copyprop_hardreg_forward_1): add check for redundant
moves, remove instructions if redundant.

--- //depot/bc/main/devHost/gcc46/gcc/gcc/regcprop.c	2011-09-06 14:29:15.0 0100
+++ /home/pm18/p4ws/pm18_binutils/bc/main/devHost/gcc46/gcc/gcc/regcprop.c	2011-09-06 14:29:15.0 0100
@@ -301,11 +301,8 @@
   unsigned int dn, sn;
   unsigned int i;
 
-  /* ??? At present, it's possible to see noop sets.  It'd be nice if
- this were cleaned up beforehand...  */
-  if (sr == dr)
-return;
-
+  gcc_assert (dr != sr);
+  
   /* Do not propagate copies to the stack pointer, as that can leave
  memory accesses with no scheduling dependency on the stack update.  */
   if (dr == STACK_POINTER_REGNUM)
@@ -734,9 +731,9 @@
 copyprop_hardreg_forward_1 (basic_block bb, struct value_data *vd)
 {
   bool anything_changed = false;
-  rtx insn;
+  rtx insn, next;
 
-  for (insn = BB_HEAD (bb); ; insn = NEXT_INSN (insn))
+  FOR_BB_INSNS_SAFE (bb, insn, next)
 {
   int n_ops, i, alt, predicated;
   bool is_asm, any_replacements;
@@ -755,10 +752,7 @@
 	   insn, vd);
 	}
 
-	  if (insn == BB_END (bb))
-	break;
-	  else
-	continue;
+	  continue;
 	}
 
   set = single_set (insn);
@@ -966,10 +960,19 @@
 
   /* Notice copies.  */
   if (set  REG_P (SET_DEST (set))  REG_P (SET_SRC (set)))
-	copy_value (SET_DEST (set), SET_SRC (set), vd);
-
-  if (insn == BB_END (bb))
-	break;
+  {
+unsigned int dr = REGNO (SET_DEST (set));
+unsigned int sr = REGNO (SET_SRC (set));
+
+if(dr == sr)
+{
+  /* noop set */
+  delete_insn_and_edges(insn);
+} 
+else
+  copy_value (SET_DEST (set), SET_SRC (set), vd);
+  }
+  
 }
 
   return anything_changed;


Re: ORDERED_EXPR in invert_tree_comparison

2012-08-02 Thread Nathan Froyd
On Thu, Aug 02, 2012 at 02:48:08PM +0200, Marc Glisse wrote:
 I am redoing the bootstrap+regtest, then I'll commit if I don't hear
 protests about the testcase.
 
 gcc/ChangeLog
 2012-06-15  Marc Glisse  marc.gli...@inria.fr
 
   PR tree-optimization/53805
   * fold-const.c (invert_tree_comparison): Do invert ORDERED_EXPR and
   UNORDERED_EXPR for floating point.

Minor protest about the ChangeLog: I think you mean Do _not_ invert...

-Nathan


[PATCH] Speedup into-SSA a bit

2012-08-02 Thread Richard Guenther

This removes some of the redundant hash lookups for the decl aux info.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.

Richard.

2012-08-02  Richard Guenther  rguent...@suse.de

* tree-into-ssa.c (struct common_info_d): New struct.
(struct var_info_d, struct ssa_name_info): Use it.
(get_ssa_name_ann): Adjust.
(get_phi_state, set_phi_state): Remove.
(get_common_info): New function.
(get_current_def, set_current_def): Adjust.
(get_def_blocks_for): Take a common info as param.
(set_def_block): Call get_common_info once.
(set_livein_block): Likewise.
(find_def_blocks_for): Adjust.
(insert_phi_nodes): Likewise.
(register_new_def): Call get_common_info once.
(get_reaching_def): Likewise.
(rewrite_debug_stmt_uses): Likewise.
(rewrite_leave_block): Likewise.
(dump_currdefs): Likewise.
(debug_var_infos_r): Adjust.
(register_new_update_single): Call get_common_info once.
(maybe_replace_use_in_debug_stmt): Likewise.
(rewrite_update_leave_block): Likewise.
(mark_use_interesting): Adjust.
(create_new_def_for): Likewise.
(update_ssa): Likewise.

Index: trunk/gcc/tree-into-ssa.c
===
*** trunk.orig/gcc/tree-into-ssa.c  2012-08-02 13:39:40.0 +0200
--- trunk/gcc/tree-into-ssa.c   2012-08-02 14:04:23.127792695 +0200
*** struct mark_def_sites_global_data
*** 126,150 
bitmap kills;
  };
  
! 
! /* Information stored for decls.  */
! struct var_info_d
  {
-   /* The variable.  */
-   tree var;
- 
/* This field indicates whether or not the variable may need PHI nodes.
   See the enum's definition for more detailed information about the
   states.  */
ENUM_BITFIELD (need_phi_state) need_phi_state : 2;
  
!   /* The current reaching definition replacing this SSA name.  */
tree current_def;
  
!   /* Definitions for this VAR.  */
struct def_blocks_d def_blocks;
  };
  
  /* The information associated with decls.  */
  typedef struct var_info_d *var_info_p;
  
--- 126,159 
bitmap kills;
  };
  
! /* Information stored for both SSA names and decls.  */
! struct common_info_d
  {
/* This field indicates whether or not the variable may need PHI nodes.
   See the enum's definition for more detailed information about the
   states.  */
ENUM_BITFIELD (need_phi_state) need_phi_state : 2;
  
!   /* The current reaching definition replacing this var.  */
tree current_def;
  
!   /* Definitions for this var.  */
struct def_blocks_d def_blocks;
  };
  
+ /* The information associated with decls and SSA names.  */
+ typedef struct common_info_d *common_info_p;
+ 
+ /* Information stored for decls.  */
+ struct var_info_d
+ {
+   /* The variable.  */
+   tree var;
+ 
+   /* Information stored for both SSA names and decls.  */
+   struct common_info_d info;
+ };
+ 
  /* The information associated with decls.  */
  typedef struct var_info_d *var_info_p;
  
*** struct ssa_name_info
*** 164,182 
   are assumed to be null.  */
unsigned age;
  
-   /* This field indicates whether or not the variable may need PHI nodes.
-  See the enum's definition for more detailed information about the
-  states.  */
-   ENUM_BITFIELD (need_phi_state) need_phi_state : 2;
- 
-   /* The current reaching definition replacing this SSA name.  */
-   tree current_def;
- 
/* Replacement mappings, allocated from update_ssa_obstack.  */
bitmap repl_set;
  
!   /* Definitions for this SSA name.  */
!   struct def_blocks_d def_blocks;
  };
  
  /* The information associated with names.  */
--- 173,183 
   are assumed to be null.  */
unsigned age;
  
/* Replacement mappings, allocated from update_ssa_obstack.  */
bitmap repl_set;
  
!   /* Information stored for both SSA names and decls.  */
!   struct common_info_d info;
  };
  
  /* The information associated with names.  */
*** get_ssa_name_ann (tree name)
*** 323,335 
info = VEC_index (ssa_name_info_p, info_for_ssa_name, ver);
if (info-age  current_info_for_ssa_name_age)
  {
-   info-need_phi_state = NEED_PHI_STATE_UNKNOWN;
-   info-current_def = NULL_TREE;
-   info-repl_set = NULL;
-   info-def_blocks.def_blocks = NULL;
-   info-def_blocks.phi_blocks = NULL;
-   info-def_blocks.livein_blocks = NULL;
info-age = current_info_for_ssa_name_age;
  }
  
return info;
--- 324,336 
info = VEC_index (ssa_name_info_p, info_for_ssa_name, ver);
if (info-age  current_info_for_ssa_name_age)
  {
info-age = current_info_for_ssa_name_age;
+   info-repl_set = NULL;
+   info-info.need_phi_state = NEED_PHI_STATE_UNKNOWN;
+   info-info.current_def = NULL_TREE;
+   info-info.def_blocks.def_blocks = NULL;
+   

Re: [C++ patch] Allow p-~T() when T is a vector

2012-08-02 Thread Gabriel Dos Reis
On Thu, Aug 2, 2012 at 7:08 AM, Richard Guenther
richard.guent...@gmail.com wrote:
 On Thu, Aug 2, 2012 at 1:42 PM, Marc Glisse marc.gli...@inria.fr wrote:
 Hello,

 this patch allows p-~T() when T is (after substitution) a vector, which is
 necessary for use in std::vector for instance.

 Why not include VECTOR_TYPE in ARITHMETIC_TYPE_P?

We have decided long ago that abstractions in the compiler
should use names and semantics following the standard texts
so that reading the source code should not reserve surprises
to anyone familiar with the standards, hence minimize help
subtle bugs and reduce efforts needed to understand the compiler.
Putting VECTOR_TYPE in ARITHMETIC_TYPE_P violates that
common sense principle.

-- Gaby


[Patch, fortran] LBOUND/UBOUND/SHAPE assumed rank support

2012-08-02 Thread Mikael Morin
Hello,

as promised, I submit the patch (split to 5 pieces) adding support for
assumed rank actual arguments to the LBOUND/UBOUND/SHAPE intrinsics in
the non-scalar case (without the DIM argument).

Patch 1: Disable shape setting and simplification for assumed rank.
Patch 2: Move and rename get_rank_from_desc to gfc_conv_descriptor_rank.
Patch 3: Fix set_loop_bounds #1 (optional).
Patch 4: Fix set_loop_bounds #2.
Patch 5: Properly setup the scalarizer in the {l,u}bound(assumed_rank)
cases.

More details in the patch files.

Regression tested on x86_64-unknown-linux-gnu. OK for trunk?

Mikael





the shape was incorrectly set to -1 at resolution time for those intrinsics.
This patch disables it.
Also disabled is the attempt to simplify shape in the assumed rank case.
{l,u}bound didn't need this; it was already done.


2012-08-02  Mikael Morin  mik...@gcc.gnu.org

	* iresolve.c (resolve_bound, gfc_resolve_shape):
	Don't set the shape for assumed rank arrays.
	* simplify.c (gfc_simplify_shape): Don't try to simplify if the
	argument is assumed rank.

diff --git a/iresolve.c b/iresolve.c
index 6d1e8b2..3ebf0c0 100644
--- a/iresolve.c
+++ b/iresolve.c
@@ -134,9 +134,12 @@ resolve_bound (gfc_expr *f, gfc_expr *array, gfc_expr *dim, gfc_expr *kind,
   if (dim == NULL)
 {
   f-rank = 1;
-  f-shape = gfc_get_shape (1);
-  mpz_init_set_ui (f-shape[0], coarray ? gfc_get_corank (array)
-	: array-rank);
+  if (array-rank != -1)
+	{
+	  f-shape = gfc_get_shape (1);
+	  mpz_init_set_ui (f-shape[0], coarray ? gfc_get_corank (array)
+		: array-rank);
+	}
 }
 
   f-value.function.name = xstrdup (name);
@@ -2225,8 +2228,12 @@ gfc_resolve_shape (gfc_expr *f, gfc_expr *array, gfc_expr *kind)
 f-ts.kind = gfc_default_integer_kind;
 
   f-rank = 1;
-  f-shape = gfc_get_shape (1);
-  mpz_init_set_ui (f-shape[0], array-rank);
+  if (array-rank != -1)
+{
+  f-shape = gfc_get_shape (1);
+  mpz_init_set_ui (f-shape[0], array-rank);
+}
+
   f-value.function.name = gfc_get_string (PREFIX (shape_%d), f-ts.kind);
 }
 
diff --git a/simplify.c b/simplify.c
index c12675e..e4ccddf 100644
--- a/simplify.c
+++ b/simplify.c
@@ -5470,6 +5470,9 @@ gfc_simplify_shape (gfc_expr *source, gfc_expr *kind)
   gfc_try t;
   int k = get_kind (BT_INTEGER, kind, SHAPE, gfc_default_integer_kind);
 
+  if (source-rank == -1)
+return NULL;
+
   result = gfc_get_array_expr (BT_INTEGER, k, source-where);
 
   if (source-rank == 0)

The final patch (number 5) needs to access the rank from the descriptor.
Thus, trans-intrinsic.c's get_rank_from_desc should be made public.
I took the opportunity to move it in trans-array.c and rename it in line
with other descriptor accessors (gfc_conv_descriptor_rank).


2012-08-02  Mikael Morin  mik...@gcc.gnu.org

	* trans-array.h (gfc_conv_descriptor_rank): New prototype.
	* trans-array.c (gfc_conv_descriptor_rank): New function moved and
	renamed ...
	* trans-intrinsic.c (gfc_get_rank_from_desc): ... from this one.
	(gfc_conv_intrinsic_rank, gfc_conv_intrinsic_bound,
	gfc_conv_associated): Update calls.

diff --git a/trans-array.c b/trans-array.c
index 555d696..abdb9ea 100644
--- a/trans-array.c
+++ b/trans-array.c
@@ -249,6 +249,20 @@ gfc_conv_descriptor_dtype (tree desc)
 
 
 tree
+gfc_conv_descriptor_rank (tree desc)
+{
+  tree tmp;
+  tree dtype;
+
+  dtype = gfc_conv_descriptor_dtype (desc);
+  tmp = build_int_cst (TREE_TYPE (dtype), GFC_DTYPE_RANK_MASK);
+  tmp = fold_build2_loc (input_location, BIT_AND_EXPR, TREE_TYPE (dtype),
+			 dtype, tmp);
+  return fold_convert (gfc_get_int_type (gfc_default_integer_kind), tmp);
+}
+
+
+tree
 gfc_get_descriptor_dimension (tree desc)
 {
   tree type, field;
diff --git a/trans-array.h b/trans-array.h
index b7ab806..5ad794a 100644
--- a/trans-array.h
+++ b/trans-array.h
@@ -154,6 +154,7 @@ tree gfc_conv_descriptor_data_get (tree);
 tree gfc_conv_descriptor_data_addr (tree);
 tree gfc_conv_descriptor_offset_get (tree);
 tree gfc_conv_descriptor_dtype (tree);
+tree gfc_conv_descriptor_rank (tree);
 tree gfc_get_descriptor_dimension (tree);
 tree gfc_conv_descriptor_stride_get (tree, tree);
 tree gfc_conv_descriptor_lbound_get (tree, tree);
diff --git a/trans-intrinsic.c b/trans-intrinsic.c
index 7bcfda9..fac29c7 100644
--- a/trans-intrinsic.c
+++ b/trans-intrinsic.c
@@ -1315,20 +1315,6 @@ trans_num_images (gfc_se * se)
 }
 
 
-static tree
-get_rank_from_desc (tree desc)
-{
-  tree tmp;
-  tree dtype;
-
-  dtype = gfc_conv_descriptor_dtype (desc);
-  tmp = build_int_cst (TREE_TYPE (dtype), GFC_DTYPE_RANK_MASK);
-  tmp = fold_build2_loc (input_location, BIT_AND_EXPR, TREE_TYPE (dtype),
-			 dtype, tmp);
-  return fold_convert (gfc_get_int_type (gfc_default_integer_kind), tmp);
-}
-
-
 static void
 gfc_conv_intrinsic_rank (gfc_se *se, gfc_expr *expr)
 {
@@ -1345,7 +1331,7 @@ gfc_conv_intrinsic_rank (gfc_se *se, gfc_expr *expr)
   gfc_add_block_to_block (se-pre, argse.pre);
   gfc_add_block_to_block (se-post, argse.post);
 
-  

Re: [C++ patch] Allow p-~T() when T is a vector

2012-08-02 Thread Jason Merrill

On 08/02/2012 07:42 AM, Marc Glisse wrote:

+   if (SCALAR_TYPE_P (object_type)
+   || TREE_CODE (object_type) == VECTOR_TYPE)


You can use scalarish_type_p for this test.  OK with that change.

Jason



Re: [Patch, fortran] LBOUND/UBOUND/SHAPE assumed rank support

2012-08-02 Thread Tobias Burnus

Hello Mikael,

thanks for your patch series, which not only implements missing parts of 
the assumed-rank support but also fixes some buglets such as the 
set_loop_bounds setting or the shape setting for assumed ranks. The 
patch is okay.


Tobias

On 08/02/2012 04:17 PM, Mikael Morin wrote:

Hello,

as promised, I submit the patch (split to 5 pieces) adding support for
assumed rank actual arguments to the LBOUND/UBOUND/SHAPE intrinsics in
the non-scalar case (without the DIM argument).

Patch 1: Disable shape setting and simplification for assumed rank.
Patch 2: Move and rename get_rank_from_desc to gfc_conv_descriptor_rank.
Patch 3: Fix set_loop_bounds #1 (optional).
Patch 4: Fix set_loop_bounds #2.
Patch 5: Properly setup the scalarizer in the {l,u}bound(assumed_rank)
cases.

More details in the patch files.

Regression tested on x86_64-unknown-linux-gnu. OK for trunk?

Mikael









Re: Commit: XStormy16: Add __clrsbhi2() to libgcc

2012-08-02 Thread Georg-Johann Lay
nick clifton wrote:
 Hi Johann,
 Hi, just out of curiosity: Is there a special reason to add a
 stormy16-specific implementation instead of using the code in
 libgcc2.c? t-avr for example uses the C implementation in libgcc2.c
 for HI. Are there disadvantages?
 
 Apart from not using some slightly frightening makefile magic ?  No, no
 real reason.  In fact the implementation in stormy16/lib2funcs.c is
 based directly on the code in libgcc2.c.
 
 I prefer my current approach because if it turns out that this function
 is used a lot then it will easy to replace the current C implementation
 with hand coded assembler.  But if there was a way to automate the
 detection of bit counting functions in libgcc2.c, so that when a new one
 is added we would not have to update t-avr or t-stormy16, then I would
 go with your approach.

Yes, I agree.  It would be great if the needed HI-mode built-ins were
generated automatically for the 16-bit int targets; without explicit
interaction or dreaded makefile code.

The avr mainly needs these build-ins to reduce testsuite noise
if these built-ins are missing.

Johann

 
 Cheers
   Nick



Re: ORDERED_EXPR in invert_tree_comparison

2012-08-02 Thread Marc Glisse

On Thu, 2 Aug 2012, Nathan Froyd wrote:


On Thu, Aug 02, 2012 at 02:48:08PM +0200, Marc Glisse wrote:

I am redoing the bootstrap+regtest, then I'll commit if I don't hear
protests about the testcase.

gcc/ChangeLog
2012-06-15  Marc Glisse  marc.gli...@inria.fr

PR tree-optimization/53805
* fold-const.c (invert_tree_comparison): Do invert ORDERED_EXPR and
UNORDERED_EXPR for floating point.


Minor protest about the ChangeLog: I think you mean Do _not_ invert...


No, I do mean do invert. The point of the patch is that even for floating 
point and even with trapping-math, it is still safe to invert them.


Maybe I can reformulate as: Invert ORDERED_EXPR and UNORDERED_EXPR even 
for trapping floating point. ?


--
Marc Glisse


Re: [C++ patch] Allow p-~T() when T is a vector

2012-08-02 Thread Marc Glisse

On Thu, 2 Aug 2012, Jason Merrill wrote:


On 08/02/2012 07:42 AM, Marc Glisse wrote:

+   if (SCALAR_TYPE_P (object_type)
+   || TREE_CODE (object_type) == VECTOR_TYPE)


You can use scalarish_type_p for this test.  OK with that change.


Wow, I'd missed it, a function that does exactly what I need, thanks!

--
Marc Glisse


Re: ORDERED_EXPR in invert_tree_comparison

2012-08-02 Thread Nathan Froyd
On Thu, Aug 02, 2012 at 05:20:24PM +0200, Marc Glisse wrote:
 On Thu, 2 Aug 2012, Nathan Froyd wrote:
 PR tree-optimization/53805
 * fold-const.c (invert_tree_comparison): Do invert ORDERED_EXPR and
 UNORDERED_EXPR for floating point.
 
 Minor protest about the ChangeLog: I think you mean Do _not_ invert...
 
 No, I do mean do invert. The point of the patch is that even for
 floating point and even with trapping-math, it is still safe to
 invert them.

Ahhh, yes.  I misread the patch.

 Maybe I can reformulate as: Invert ORDERED_EXPR and UNORDERED_EXPR
 even for trapping floating point. ?

That works for me.

-Nathan


Re: [RFC / RFH] Re-opened C++/51213 (access control under SFINAE)

2012-08-02 Thread Jason Merrill

On 08/01/2012 02:57 PM, Paolo Carlini wrote:

So, it is possible that when spec != NULL_TREE and we are once more in a
SFINAE context, we have to actually call perform_deferred_access_checks
(complain) and either return error_mark_node or the spec depending on
the return value?


I don't think we need to redo the access check in SFINAE context; we 
know that there's an error, so we can just return error_mark_node in 
that case.  I guess we should change the name of FNDECL_RECHECK_ACCESS_P 
to something like FNDECL_HAS_ACCESS_ERRORS to make it clearer.


Jason



Re: [RFC / RFH] Re-opened C++/51213 (access control under SFINAE)

2012-08-02 Thread Paolo Carlini

Hi,

On 08/02/2012 05:33 PM, Jason Merrill wrote:

On 08/01/2012 02:57 PM, Paolo Carlini wrote:

So, it is possible that when spec != NULL_TREE and we are once more in a
SFINAE context, we have to actually call perform_deferred_access_checks
(complain) and either return error_mark_node or the spec depending on
the return value?


I don't think we need to redo the access check in SFINAE context; we 
know that there's an error, so we can just return error_mark_node in 
that case.  I guess we should change the name of 
FNDECL_RECHECK_ACCESS_P to something like FNDECL_HAS_ACCESS_ERRORS to 
make it clearer.
Ah, very well, everything makes sense now. Thus I'm finishing testing 
the below (already past the C++ testsuite), Ok if it passes?


Thanks,
Paolo.

///
/cp
2012-08-02  Jason Merrill  ja...@redhat.com
Paolo Carlini  paolo.carl...@oracle.com

PR c++/51213 (again)
* pt.c (type_unification_real): Call push_deferring_access_checks /
pop_deferring_access_checks around the substitution of default
template args.
(instantiate_template_1): When the specialization returned by
retrieve_specialization has FNDECL_HAS_ACCESS_ERRORS set and we
are in a SFINAE context, simply return error_mark_node.
* cp-tree.h (FNDECL_RECHECK_ACCESS_P): Rename FNDECL_HAS_ACCESS_ERRORS.

/testsuite
2012-08-02  Jason Merrill  ja...@redhat.com
Paolo Carlini  paolo.carl...@oracle.com

PR c++/51213 (again)
* g++.dg/cpp0x/sfinae37.C: Extend.
Index: testsuite/g++.dg/cpp0x/sfinae37.C
===
--- testsuite/g++.dg/cpp0x/sfinae37.C   (revision 190071)
+++ testsuite/g++.dg/cpp0x/sfinae37.C   (working copy)
@@ -5,6 +5,12 @@ class C {
   typedef int type;
 };
 
+templateint
+struct I;
+
+template
+struct I2 { };
+
 templateclass T, class = typename T::type
 auto f(int) - char;
 
@@ -13,6 +19,10 @@ auto f(...) - char ()[2];
 
 static_assert(sizeof(fC(0)) == 2, Ouch);
 
+typedef int testf[sizeof(fC(0)) == 2 ? 1 : -1];
+
+Isizeof(fC(0)) vf;
+
 templateclass T
 auto g(int) - decltype(typename T::type(), char());
 
@@ -20,3 +30,7 @@ templateclass
 auto g(...) - char ()[2];
 
 static_assert(sizeof(gC(0)) == 2, Ouch);
+
+typedef int testg[sizeof(gC(0)) == 2 ? 1 : -1];
+
+Isizeof(gC(0)) vg;
Index: cp/pt.c
===
--- cp/pt.c (revision 190071)
+++ cp/pt.c (working copy)
@@ -14363,8 +14363,13 @@ instantiate_template_1 (tree tmpl, tree orig_args,
 
   if (spec != NULL_TREE)
 {
-  if (FNDECL_RECHECK_ACCESS_P (spec)  (complain  tf_error))
-   recheck_decl_substitution (spec, gen_tmpl, targ_ptr);
+  if (FNDECL_HAS_ACCESS_ERRORS (spec))
+   {
+ if (complain  tf_error)
+   recheck_decl_substitution (spec, gen_tmpl, targ_ptr);
+ else
+   return error_mark_node;
+   }
   return spec;
 }
 
@@ -14426,7 +14431,7 @@ instantiate_template_1 (tree tmpl, tree orig_args,
{
  /* Remember to reinstantiate when we're out of SFINAE so the user
 can see the errors.  */
- FNDECL_RECHECK_ACCESS_P (fndecl) = true;
+ FNDECL_HAS_ACCESS_ERRORS (fndecl) = true;
}
   return error_mark_node;
 }
@@ -15122,9 +15127,11 @@ type_unification_real (tree tparms,
  location_t save_loc = input_location;
  if (DECL_P (parm))
input_location = DECL_SOURCE_LOCATION (parm);
+ push_deferring_access_checks (dk_no_deferred);
  arg = tsubst_template_arg (arg, targs, complain, NULL_TREE);
  arg = convert_template_argument (parm, arg, targs, complain,
   i, NULL_TREE);
+ pop_deferring_access_checks ();
  input_location = save_loc;
  if (arg == error_mark_node)
return 1;
Index: cp/cp-tree.h
===
--- cp/cp-tree.h(revision 190071)
+++ cp/cp-tree.h(working copy)
@@ -729,10 +729,10 @@ DEF_VEC_ALLOC_O (qualified_typedef_usage_t,gc);
 /* Non-zero if this template specialization has access violations that
should be rechecked when the function is instantiated outside argument
deduction.  */
-#define TINFO_RECHECK_ACCESS_P(NODE) \
+#define TINFO_HAS_ACCESS_ERRORS(NODE) \
   (TREE_LANG_FLAG_0 (TEMPLATE_INFO_CHECK (NODE)))
-#define FNDECL_RECHECK_ACCESS_P(NODE) \
-  (TINFO_RECHECK_ACCESS_P (DECL_TEMPLATE_INFO (NODE)))
+#define FNDECL_HAS_ACCESS_ERRORS(NODE) \
+  (TINFO_HAS_ACCESS_ERRORS (DECL_TEMPLATE_INFO (NODE)))
 
 struct GTY(()) tree_template_info {
   struct tree_common common;


[ARM] Use UBFX for some and-immediate operations

2012-08-02 Thread Richard Earnshaw
This patch adds the ability to spot and exploit the UBFX instruction
(bit-field extract) to perform AND operations with an immediate which is
2^N - 1.  On some benchmarks this can lead to a significant win over the
existing behaviour on Cortex-A15.

Tested on arm-eabi with some additional testing on arm-linux-gnueabi
platforms.

R.

2012-08-02  Richard Earnshaw  rearn...@arm.com

* arm.c (arm_gen_constant): Use UBFX for some AND operations when
available.--- arm.c   (revision 190101)
+++ arm.c   (local)
@@ -2982,6 +2982,31 @@ arm_gen_constant (enum rtx_code code, en
   return 1;
 }
 
+  /* On targets with UXTH/UBFX, we can deal with AND (2^N)-1 in a single
+ insn.  */
+  if (code == AND  (i = exact_log2 (remainder + 1))  0
+   (arm_arch_thumb2 || (i == 16  arm_arch6  mode == SImode)))
+{
+  if (generate)
+   {
+ if (mode == SImode  i == 16)
+   /* Use UXTH in preference to UBFX, since on Thumb2 it's a 
+  smaller insn.  */
+   emit_constant_insn (cond,
+   gen_zero_extendhisi2
+   (target, gen_lowpart (HImode, source)));
+ else
+   /* Extz only supports SImode, but we can coerce the operands
+  into that mode.  */
+   emit_constant_insn (cond,
+   gen_extzv_t2 (gen_lowpart (mode, target),
+ gen_lowpart (mode, source),
+ GEN_INT (i), const0_rtx));
+   }
+
+  return 1;
+}
+
   /* Calculate a few attributes that may be useful for specific
  optimizations.  */
   /* Count number of leading zeros.  */

Re: [4.7 RFT PATCH, i386]: Backport recent LEA improvements to 4.7 branch

2012-08-02 Thread Uros Bizjak
On Wed, Jul 25, 2012 at 2:33 PM, Uros Bizjak ubiz...@gmail.com wrote:

 On Wed, Jul 25, 2012 at 1:45 PM, Richard Guenther
 richard.guent...@gmail.com wrote:
 On Tue, Jul 24, 2012 at 9:32 PM, Uros Bizjak ubiz...@gmail.com wrote:
 Hello!

 Attached patch backports recent LEA improvements to 4.7 branch.

 As in regression fixes, or wrong-code fixes?  This looks suspiciously not
 appropriate for 4.7 ...

 I consider this patch a real fix for PR target/53961. Current fix
 just papers over the problem by changing addresses, zero-extended with
 AND, with real ZERO_EXTEND addresses in expand. But, there remain
 other similar problems.

The patch was also tested on spec2000/spec2006 for i686/x86_64/x32 by
H.J. (thanks!).

Re-bootstrapped, re-tested on x86_64-pc-linux-gnu {-m32}, also with
-mx32, by H.J.

Committed to 4.7 branch.

Uros.


Re: PR middle-end/53321: [4.8 Regression] LTO bootstrap failed with bootstrap-profiled

2012-08-02 Thread Jan Hubicka
 On Thu, Aug 2, 2012 at 3:23 AM, Jan Hubicka hubi...@ucw.cz wrote:
 
  This patch works passed profiledbootstrap with LTO as well as LTO -O3
  on 176.gcc in SPEC CPU 2000.  I have to add 2 inline_edge_summary_vec
  checks to avoid ICE.  OK to install?
 
  Thanks, it looks good. I am just concerned about...
  diff --git a/gcc/ipa-split.c b/gcc/ipa-split.c
  index 33cf7d2..7a8844f 100644
  --- a/gcc/ipa-split.c
  +++ b/gcc/ipa-split.c
  @@ -1415,7 +1415,7 @@ execute_split_functions (void)
   }
 /* This can be relaxed; function might become inlinable after splitting
away the uninlinable part.  */
  -  if (!inline_summary (node)-inlinable)
  +  if (inline_edge_summary_vec  !inline_summary (node)-inlinable)
 
  .. this one. spliting is executed before free_inline_summary and thus should
  not be affected. Or is it because of it gets called from 
  process_new_functions
  because some IPA pass adds a new function?
 
 It is called from pass_feedback_split_functions:
 
   NEXT_PASS (pass_all_early_optimizations);
 {
...
 }
   NEXT_PASS (pass_ipa_free_inline_summary);
   NEXT_PASS (pass_ipa_tree_profile);
 {
   struct opt_pass **p = pass_ipa_tree_profile.pass.sub;
   NEXT_PASS (pass_feedback_split_functions);
 }
 
 OK to install?

Hmm, this is an ordering issue, but minnor one.  OK.
As comment says, this should be relaxed anyway and in fact I have path for that
in queue.

Honza
 
 Thanks.
 
 -- 
 H.J.


Re: [RFC / RFH] Re-opened C++/51213 (access control under SFINAE)

2012-08-02 Thread Jason Merrill

On 08/02/2012 12:21 PM, Paolo Carlini wrote:

+ if (complain  tf_error)
+   recheck_decl_substitution (spec, gen_tmpl, targ_ptr);
+ else
+   return error_mark_node;


I think we want to be consistent with the end of the function about 
whether we return error_mark_node or the decl after giving access errors 
in non-SFINAE context; I don't have a strong opinion either way, but 
this returns the decl, and the end of the function returns error_mark_node.


Jason



Re: [gimplefe] Patch for recognizing function declarations

2012-08-02 Thread Diego Novillo
On Tue, Jul 31, 2012 at 11:06 AM, Sandeep Soni soni.sande...@gmail.com wrote:

 +/* The syntax of a function declaration is as follows:
 +
 +   FUNCTION_DECLName, Type, Parms
 +   
 +  function body
 +   
 +
 +   Here, each of the PARMS in itself is a parameter declaration similar to a
 +   variable declaration, TYPE is the type of the variable that this
 +   function returns and FUNCTION BODY is the series of statements that define
 +   the beahavior of the function.
 +
 +   Following are some of the examples for which the syntax of the function
 +   declarations are described.
 +
 +   1. C-like function as
 +  void foo (int first, float second)
 +{
 +  first = second;
 +}
 +
 +   The corresponding gimple syntax is:
 + FUNCTION_DECL foo, VOID_TYPE,
 +PARM_DECLfirst, INTEGER_TYPE4,
 +PARM_DECLsecond, REAL_TYPE4
 + 
 +   GIMPLE_ASSIGN PARM_DECL,first, second, NULL
 + 
 +
 +   2. C-like function as
 +  int foo (int first, float second)
 +   {
 +  int local_first;
 +  float local_second;
 +
 +  local_first = first;
 +  local_second = second;
 +
 +  return local_first;
 +   }
 +
 +   The corresponding gimple syntax is:
 + FUNCTION_DECL foo, INTEGER_TYPE4,
 +PARM_DECLfirst, INTEGER_TYPE4,
 +PARM_DECLsecond, REAL_TYPE4
 + 
 +VAR_DECL local_first, INTEGER_TYPE4
 +   VAR_DECL local_second, REAL_TYPE4
 +   VAR_DECL return_var, INTEGER_TYPE4
 +
 +   gimple_assign parm_decl, local_first, first, NULL
 +   gimple_assign parm_decl, local_second, second, NULL
 +   gimple_assign parm_decl, return_var, first, NULL
 +   gimple_return return_var
 + 
 +
 +   Note: 1) The syntax closely mimics the -fdump-tree-gimple-raw option.
 +2) The function declaration tuple needs to be checked against the
 +   call of the function for order and the number of arguments.
 +3) A symbol table entry for the function should be made. The
 +   variables defined within the function should be made to have
 +   function scope.  */

Nice.  Thanks for this documentation.

 +  next_token = gl_consume_token (parser-lexer);
 +  while (!gl_at_eof(parser-lexer))

Space before '('.

 +{
 +  if (next_token-type == CPP_COMMA)
 +   {
 + next_token = gl_consume_token (parser-lexer);
 + if (gl_tree_code_for_token (next_token) == PARM_DECL)
 +gp_parse_parm_decl (parser);
 + else
 +   error_at (next_token-location,
 + Unsupported declaration of parameters);
 +  else if (next_token-type == CPP_GREATER)
 +   break;
 +}

Could you factor this into its own function? You will likely need to
parse other comma-separated lists.

Also, please add some test cases with the patch.


Diego.


Re: [RFC / RFH] Re-opened C++/51213 (access control under SFINAE)

2012-08-02 Thread Paolo Carlini

On 08/02/2012 06:53 PM, Jason Merrill wrote:

On 08/02/2012 12:21 PM, Paolo Carlini wrote:

+  if (complain  tf_error)
+recheck_decl_substitution (spec, gen_tmpl, targ_ptr);
+  else
+return error_mark_node;


I think we want to be consistent with the end of the function about 
whether we return error_mark_node or the decl after giving access 
errors in non-SFINAE context; I don't have a strong opinion either 
way, but this returns the decl, and the end of the function returns 
error_mark_node.

I see. Then, I restarted testing with this variant.

Paolo.

/
Index: testsuite/g++.dg/cpp0x/sfinae37.C
===
--- testsuite/g++.dg/cpp0x/sfinae37.C   (revision 190071)
+++ testsuite/g++.dg/cpp0x/sfinae37.C   (working copy)
@@ -5,6 +5,12 @@ class C {
   typedef int type;
 };
 
+templateint
+struct I;
+
+template
+struct I2 { };
+
 templateclass T, class = typename T::type
 auto f(int) - char;
 
@@ -13,6 +19,10 @@ auto f(...) - char ()[2];
 
 static_assert(sizeof(fC(0)) == 2, Ouch);
 
+typedef int testf[sizeof(fC(0)) == 2 ? 1 : -1];
+
+Isizeof(fC(0)) vf;
+
 templateclass T
 auto g(int) - decltype(typename T::type(), char());
 
@@ -20,3 +30,7 @@ templateclass
 auto g(...) - char ()[2];
 
 static_assert(sizeof(gC(0)) == 2, Ouch);
+
+typedef int testg[sizeof(gC(0)) == 2 ? 1 : -1];
+
+Isizeof(gC(0)) vg;
Index: cp/pt.c
===
--- cp/pt.c (revision 190071)
+++ cp/pt.c (working copy)
@@ -14363,8 +14363,12 @@ instantiate_template_1 (tree tmpl, tree orig_args,
 
   if (spec != NULL_TREE)
 {
-  if (FNDECL_RECHECK_ACCESS_P (spec)  (complain  tf_error))
-   recheck_decl_substitution (spec, gen_tmpl, targ_ptr);
+  if (FNDECL_HAS_ACCESS_ERRORS (spec))
+   {
+ if (complain  tf_error)
+   recheck_decl_substitution (spec, gen_tmpl, targ_ptr);
+ return error_mark_node;
+   }
   return spec;
 }
 
@@ -14426,7 +14430,7 @@ instantiate_template_1 (tree tmpl, tree orig_args,
{
  /* Remember to reinstantiate when we're out of SFINAE so the user
 can see the errors.  */
- FNDECL_RECHECK_ACCESS_P (fndecl) = true;
+ FNDECL_HAS_ACCESS_ERRORS (fndecl) = true;
}
   return error_mark_node;
 }
@@ -15122,9 +15126,11 @@ type_unification_real (tree tparms,
  location_t save_loc = input_location;
  if (DECL_P (parm))
input_location = DECL_SOURCE_LOCATION (parm);
+ push_deferring_access_checks (dk_no_deferred);
  arg = tsubst_template_arg (arg, targs, complain, NULL_TREE);
  arg = convert_template_argument (parm, arg, targs, complain,
   i, NULL_TREE);
+ pop_deferring_access_checks ();
  input_location = save_loc;
  if (arg == error_mark_node)
return 1;
Index: cp/cp-tree.h
===
--- cp/cp-tree.h(revision 190071)
+++ cp/cp-tree.h(working copy)
@@ -729,10 +729,10 @@ DEF_VEC_ALLOC_O (qualified_typedef_usage_t,gc);
 /* Non-zero if this template specialization has access violations that
should be rechecked when the function is instantiated outside argument
deduction.  */
-#define TINFO_RECHECK_ACCESS_P(NODE) \
+#define TINFO_HAS_ACCESS_ERRORS(NODE) \
   (TREE_LANG_FLAG_0 (TEMPLATE_INFO_CHECK (NODE)))
-#define FNDECL_RECHECK_ACCESS_P(NODE) \
-  (TINFO_RECHECK_ACCESS_P (DECL_TEMPLATE_INFO (NODE)))
+#define FNDECL_HAS_ACCESS_ERRORS(NODE) \
+  (TINFO_HAS_ACCESS_ERRORS (DECL_TEMPLATE_INFO (NODE)))
 
 struct GTY(()) tree_template_info {
   struct tree_common common;


Re: [gimplefe] Construction of individual gimple statements for gimple_cond and gimple_label

2012-08-02 Thread Diego Novillo
On Tue, Jul 10, 2012 at 10:21 PM, Sandeep Soni soni.sande...@gmail.com wrote:

 -static void
 +static tree
  gp_parse_expect_false_label (gimple_parser *parser)
  {
gl_consume_expected_token (parser-lexer, CPP_LESS);
gl_consume_expected_token (parser-lexer, CPP_NAME);
gl_consume_expected_token (parser-lexer, CPP_GREATER);
gl_consume_expected_token (parser-lexer, CPP_GREATER);
 +  return create_artificial_label (UNKNOWN_LOCATION);

You don't need to use UNKNOWN_LOCATION here. You can use the location
from gl_peek_token(parser-lexer)-location.

OK with that change.


Diego.


Re: [RFC / RFH] Re-opened C++/51213 (access control under SFINAE)

2012-08-02 Thread Jason Merrill
Looks good.

 Original Message 
 From: Paolo Carlini paolo.carl...@oracle.com
 Sent: Thu, Aug 2, 2012 01:09 PM
 To: Jason Merrill ja...@redhat.com
 CC: gcc-patches@gcc.gnu.org
 Subject: Re: [RFC / RFH] Re-opened C++/51213 (access control under SFINAE)

On 08/02/2012 06:53 PM, Jason Merrill wrote:
 On 08/02/2012 12:21 PM, Paolo Carlini wrote:
 +  if (complain  tf_error)
 +recheck_decl_substitution (spec, gen_tmpl, targ_ptr);
 +  else
 +return error_mark_node;

 I think we want to be consistent with the end of the function about 
 whether we return error_mark_node or the decl after giving access 
 errors in non-SFINAE context; I don't have a strong opinion either 
 way, but this returns the decl, and the end of the function returns 
 error_mark_node.
I see. Then, I restarted testing with this variant.

Paolo.

/


Re: PATCH: PR rtl-optimization/54157: [x32] -maddress-mode=long failures

2012-08-02 Thread H.J. Lu
On Wed, Aug 1, 2012 at 12:14 PM, H.J. Lu hjl.to...@gmail.com wrote:
 On Wed, Aug 1, 2012 at 11:58 AM, Richard Sandiford
 rdsandif...@googlemail.com wrote:
 H.J. Lu hongjiu...@intel.com writes:
 We have

 (gdb) r -fpreprocessed x.i -quiet -dumpbase x.i -mx32
 -maddress-mode=long -mtune=generic -march=x86-64 -auxbase x -O2 -version
 -ftree-vectorize -o x.s
 Starting program: /export/build/gnu/gcc-x32/build-x86_64-linux/gcc/cc1
 -fpreprocessed x.i -quiet -dumpbase x.i -mx32 -maddress-mode=long
 -mtune=generic -march=x86-64 -auxbase x -O2 -version -ftree-vectorize -o
 x.s
 GNU C (GCC) version 4.8.0 20120801 (experimental)
 (x86_64-unknown-linux-gnu)
   compiled by GNU C version 4.7.1 20120629 (Red Hat 4.7.1-1), GMP
 version 5.0.2, MPFR version 3.1.0, MPC version 0.9
 GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
 GNU C (GCC) version 4.8.0 20120801 (experimental)
 (x86_64-unknown-linux-gnu)
   compiled by GNU C version 4.7.1 20120629 (Red Hat 4.7.1-1), GMP
 version 5.0.2, MPFR version 3.1.0, MPC version 0.9
 GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
 Compiler executable checksum: 07a4e516c4e8fe4abfdafa83737d8f4a

 Breakpoint 1, fancy_abort (
 file=0x130fe68 /export/gnu/import/git/gcc/gcc/explow.c, line=88,
 function=0x131032e __FUNCTION__.39220 plus_constant)
 at /export/gnu/import/git/gcc/gcc/diagnostic.c:1011
 1011internal_error (in %s, at %s:%d, function, trim_filename
 (file), line);
 (gdb) f 1
 #1  0x00743e07 in plus_constant (mode=DImode, x=0x7106a7e0,
 c=99452) at /export/gnu/import/git/gcc/gcc/explow.c:88
 88  gcc_assert (GET_MODE (x) == VOIDmode || GET_MODE (x) == mode);
 (gdb) f 2
 #2  0x00adc4b1 in simplify_binary_operation_1 (code=PLUS,
 mode=DImode,
 op0=0x7106a7e0, op1=0x71010e80, trueop0=0x7106a7e0,
 trueop1=0x71010e80)
 at /export/gnu/import/git/gcc/gcc/simplify-rtx.c:1956
 1956  return plus_constant (mode, op0, INTVAL (op1));
 (gdb) call debug_rtx (op0)
 (symbol_ref:SI (tmp2) var_decl 0x70f06140 tmp2)
 (gdb) call debug_rtx (op1)
 (const_int 99452 [0x1847c])
 (gdb) bt
 #0  fancy_abort (file=0x130fe68
 /export/gnu/import/git/gcc/gcc/explow.c,
 line=88, function=0x131032e __FUNCTION__.39220 plus_constant)
 at /export/gnu/import/git/gcc/gcc/diagnostic.c:1011
 #1  0x00743e07 in plus_constant (mode=DImode, x=0x7106a7e0,
 c=99452) at /export/gnu/import/git/gcc/gcc/explow.c:88
 #2  0x00adc4b1 in simplify_binary_operation_1 (code=PLUS,
 mode=DImode,
 op0=0x7106a7e0, op1=0x71010e80, trueop0=0x7106a7e0,
 trueop1=0x71010e80)
 at /export/gnu/import/git/gcc/gcc/simplify-rtx.c:1956
 #3  0x00adc221 in simplify_binary_operation (code=PLUS,
 mode=DImode,
 op0=0x7106a7e0, op1=0x71010e80)
 at /export/gnu/import/git/gcc/gcc/simplify-rtx.c:1904

 Things have already gone wrong by this frame: we have a DImode
 addition of an SImode value, which isn't allowed.  Where does
 that mismatch get introduced?


 make_extraction in combine generates:

 7474  inner = force_to_mode (inner, wanted_inner_mode,
 7475 pos_rtx
 7476 || len + orig_pos = 
 HOST_BITS_PER_WIDE_INT
 7477 ? ~(unsigned HOST_WIDE_INT) 0
 7478 : unsigned HOST_WIDE_INT) 1  len) 
 - 1)
 (gdb) call debug_rtx (inner)
 (plus:SI (reg:SI 109 [ D.1765 ])
 (const:SI (plus:SI (symbol_ref:SI (tmp2) var_decl 0x70f06140 tmp2)
 (const_int 99452 [0x1847c]
 (gdb) p wanted_inner_mode
 $2 = DImode
 (gdb)


i386,md has

(define_expand extzv
  [(set (match_operand:SI 0 register_operand)
(zero_extract:SI (match_operand 1 ext_register_operand)
 (match_operand:SI 2 const8_operand)
 (match_operand:SI 3 const8_operand)))]
  

and mode_for_extraction picks word_mode for operand 1 since
its mode is VOIDmode.  This patch changes mode_for_extraction
to return the mode of operand 1 if the pattern accepts any mode.
I added *jcc_btsi_mask_2 since combine now tries a different
pattern, which leads to test failures on gcc.target/i386/bt-mask-1.c
and  gcc.target/i386/bt-mask-2.  I didn't update *jcc_btsi_mask_1
instead since I am not sure if it is used elsewhere.  Tested on
Linux/x86-64 and Linux/x32.  OK for trunk?

Thanks.

-- 
H.J.

gcc/

2012-08-02  H.J. Lu  hongjiu...@intel.com

PR rtl-optimization/54157
* combine.c (make_extraction): Pass inner_mode to mode_for_extraction
for operand 1, otherwise pass VOIDmode.
(simplify_comparison): Pass VOIDmode to mode_for_extraction.

* expmed.c (mode_for_extraction): Add a machine_mode argument
and use it instead of word_mode if it isn't VOIDmode.
(store_bit_field_1): Pass VOIDmode to mode_for_extraction.
(store_bit_field): Likewise.

   

[PATCH 2/3] Incorporate aggregate jump functions into inlining analysis

2012-08-02 Thread Martin Jambor
Hi,

this patch uses the aggregate jump functions created by the previous
patch in the series to determine benefits of inlining a particular
call graph edge.  It has not changed much since the last time I posted
it, except for the presence of by_ref flags and removal of checks
required by TBAA which we now do not use.

The patch works in fairly straightforward way.  It ads two flags to
struct condition to specify it actually refers to an aggregate passed
by value or something passed by reference, in both cases at a
particular offset, also newly stored in the structures.  Functions
which build the predicates specifying under which conditions CFG edges
will be taken or individual statements are actually executed then
simply also look whether a value comes from an aggregate passed to us
in a parameter (either by value or reference) and if so, create
appropriate conditions.  Later on, predicates are evaluated as before,
we only also look at aggregate contents of the jump functions of the
edge we are considering to inline when evaluating the predicates, and
also remap the offsets of the jump functions when remapping over an
ancestor jump function.

This patch alone makes us inline the function bar in testcase of PR
48636 in comment #4.  It also passes bootstrap and testing on
x86_64-linux.  I successfully LTO-built Firefox with it too.

Thanks for all comments and suggestions,

Martin


2012-07-31  Martin Jambor  mjam...@suse.cz

PR fortran/48636
* ipa-inline.h (condition): New fields offset, agg_contents and by_ref.
* ipa-inline-analysis.c (agg_position_info): New type.
(add_condition): New parameter aggpos, also store agg_contents, by_ref
and offset.
(dump_condition): Also dump aggregate conditions.
(evaluate_conditions_for_known_args): Also handle aggregate
conditions.  New parameter known_aggs.
(evaluate_properties_for_edge): Gather known aggregate contents.
(inline_node_duplication_hook): Pass NULL known_aggs to
evaluate_conditions_for_known_args.
(unmodified_parm): Split into unmodified_parm and unmodified_parm_1.
(unmodified_parm_or_parm_agg_item): New function.
(set_cond_stmt_execution_predicate): Handle values passed in
aggregates.
(set_switch_stmt_execution_predicate): Likewise.
(will_be_nonconstant_predicate): Likewise.
(estimate_edge_devirt_benefit): Pass new parameter known_aggs to
ipa_get_indirect_edge_target.
(estimate_calls_size_and_time): New parameter known_aggs, pass it
recrsively to itself and to estimate_edge_devirt_benefit.
(estimate_node_size_and_time): New vector known_aggs, pass it o
functions which need it.
(remap_predicate): New parameter offset_map, use it to remap aggregate
conditions.
(remap_edge_summaries): New parameter offset_map, pass it recursively
to itself and to remap_predicate.
(inline_merge_summary): Also create and populate vector offset_map.
(do_estimate_edge_time): New vector of known aggregate contents,
passed to functions which need it.
(inline_read_section): Stream new fields of condition.
(inline_write_summary): Likewise.
* ipa-cp.c (ipa_get_indirect_edge_target): Also examine the aggregate
contents.  Let all local callers pass NULL for known_aggs.

* testsuite/gfortran.dg/pr48636.f90: New test.


Index: src/gcc/ipa-inline.h
===
*** src.orig/gcc/ipa-inline.h
--- src/gcc/ipa-inline.h
*** along with GCC; see the file COPYING3.
*** 28,36 
--- 28,45 
  
  typedef struct GTY(()) condition
{
+ /* If agg_contents is set, this is the offset from which the used data was
+loaded.  */
+ HOST_WIDE_INT offset;
  tree val;
  int operand_num;
  enum tree_code code;
+ /* Set if the used data were loaded from an aggregate parameter or from
+data received by reference.  */
+ unsigned agg_contents : 1;
+ /* If agg_contents is set, this differentiates between loads from data
+passed by reference and by value.  */
+ unsigned by_ref : 1;
} condition;
  
  DEF_VEC_O (condition);
Index: src/gcc/ipa-inline-analysis.c
===
*** src.orig/gcc/ipa-inline-analysis.c
--- src/gcc/ipa-inline-analysis.c
*** not_inlined_predicate (void)
*** 203,224 
return single_cond_predicate (predicate_not_inlined_condition);
  }
  
  
! /* Add condition to condition list CONDS.  */
  
  static struct predicate
  add_condition (struct inline_summary *summary, int operand_num,
   enum tree_code code, tree val)
  {
int i;
struct condition *c;
struct condition new_cond;
  
for (i = 0; VEC_iterate (condition, summary-conds, i, c); i++)
  {
if (c-operand_num == operand_num
 

Re: [patch, fortran] Fix PR 54033, problems with -I, with test cases

2012-08-02 Thread Thomas Koenig

Hi Tobias,

 I am not sure whether it is the best solution, but one possibility would

be to ignore -fintrinsic-modules-path for the warning. (That assumes
that the warning is (almost) never needed for an installed compiler.)


I think this is the right approach.  The attached patch does this.
Regression-tested with the finclude directory from the installation.

OK for trunk?

Thomas

2012-08-02  Thomas König  tkoe...@gcc.gnu.org

PR fortran/54033
* scanner.c (add_path_to_list):  New argument warn.  Don't
warn if it is true.
(gfc_add_include_path):  Warn if directory is missing.
(gfc_add_intrinsic_modules_path):  Do not warn if directory
is missing.
* optinons.c (gfc_handle_option):  Do not add directory
for intrinsic modules to normal include path.

Index: scanner.c
===
--- scanner.c	(Revision 190054)
+++ scanner.c	(Arbeitskopie)
@@ -307,7 +307,7 @@ gfc_scanner_done_1 (void)
 
 static void
 add_path_to_list (gfc_directorylist **list, const char *path,
-		  bool use_for_modules, bool head)
+		  bool use_for_modules, bool head, bool warn)
 {
   gfc_directorylist *dir;
   const char *p;
@@ -324,8 +324,11 @@ add_path_to_list (gfc_directorylist **list, const
 	gfc_warning_now (Include directory \%s\: %s, path,
 			 xstrerror(errno));
   else
-	/* FIXME:  Also support -Wmissing-include-dirs.  */
-	gfc_warning_now (Nonexistent include directory \%s\, path);
+	{
+	  /* FIXME:  Also support -Wmissing-include-dirs.  */
+	  if (warn)
+	gfc_warning_now (Nonexistent include directory \%s\, path);
+	}
   return;
 }
   else if (!S_ISDIR (st.st_mode))
@@ -363,7 +366,7 @@ add_path_to_list (gfc_directorylist **list, const
 void
 gfc_add_include_path (const char *path, bool use_for_modules, bool file_dir)
 {
-  add_path_to_list (include_dirs, path, use_for_modules, file_dir);
+  add_path_to_list (include_dirs, path, use_for_modules, file_dir, true);
 
   /* For '#include ...' these directories are automatically searched.  */
   if (!file_dir)
@@ -374,7 +377,7 @@ gfc_add_include_path (const char *path, bool use_f
 void
 gfc_add_intrinsic_modules_path (const char *path)
 {
-  add_path_to_list (intrinsic_modules_dirs, path, true, false);
+  add_path_to_list (intrinsic_modules_dirs, path, true, false, false);
 }
 
 
Index: options.c
===
--- options.c	(Revision 189754)
+++ options.c	(Arbeitskopie)
@@ -819,7 +819,6 @@ gfc_handle_option (size_t scode, const char *arg,
   break;
 
 case OPT_fintrinsic_modules_path:
-  gfc_add_include_path (arg, false, false);
   gfc_add_intrinsic_modules_path (arg);
   break;
 


Re: [C++ patch] Allow p-~T() when T is a vector

2012-08-02 Thread Marc Glisse

On Thu, 2 Aug 2012, Jason Merrill wrote:


On 08/02/2012 07:42 AM, Marc Glisse wrote:

+   if (SCALAR_TYPE_P (object_type)
+   || TREE_CODE (object_type) == VECTOR_TYPE)


You can use scalarish_type_p for this test.  OK with that change.


That function was static, so I had to change that. I will thus commit the 
attached tomorrow:


gcc/cp/ChangeLog
2012-08-02  Marc Glisse  marc.gli...@inria.fr

* pt.c (tsubst_copy_and_build): Handle VECTOR_TYPE like scalars.
* cp-tree.h (scalarish_type_p): Declare.
* tree.c (scalarish_type_p): Make non-static.

gcc/testsuite/ChangeLog
2012-08-02  Marc Glisse  marc.gli...@inria.fr

* g++.dg/ext/vector17.C: New testcase.

--
Marc GlisseIndex: testsuite/g++.dg/ext/vector17.C
===
--- testsuite/g++.dg/ext/vector17.C (revision 0)
+++ testsuite/g++.dg/ext/vector17.C (revision 0)
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+typedef double __attribute__((vector_size(1024) )) vec;
+
+template class T
+void f (T *p)
+{
+  p-~T();
+}
+void g (vec *p)
+{
+  f(p);
+}

Property changes on: testsuite/g++.dg/ext/vector17.C
___
Added: svn:keywords
   + Author Date Id Revision URL
Added: svn:eol-style
   + native

Index: cp/tree.c
===
--- cp/tree.c   (revision 190086)
+++ cp/tree.c   (working copy)
@@ -2811,21 +2811,21 @@ is_dummy_object (const_tree ob)
 {
   if (TREE_CODE (ob) == INDIRECT_REF)
 ob = TREE_OPERAND (ob, 0);
   return (TREE_CODE (ob) == NOP_EXPR
   TREE_OPERAND (ob, 0) == void_zero_node);
 }
 
 /* Returns 1 iff type T is something we want to treat as a scalar type for
the purpose of deciding whether it is trivial/POD/standard-layout.  */
 
-static bool
+bool
 scalarish_type_p (const_tree t)
 {
   if (t == error_mark_node)
 return 1;
 
   return (SCALAR_TYPE_P (t)
  || TREE_CODE (t) == VECTOR_TYPE);
 }
 
 /* Returns true iff T requires non-trivial default initialization.  */
Index: cp/cp-tree.h
===
--- cp/cp-tree.h(revision 190086)
+++ cp/cp-tree.h(working copy)
@@ -5690,20 +5690,21 @@ extern tree stabilize_expr  (tree, 
tree
 extern void stabilize_call (tree, tree *);
 extern void stabilize_aggr_init(tree, tree *);
 extern bool stabilize_init (tree, tree *);
 extern tree add_stmt_to_compound   (tree, tree);
 extern void init_tree  (void);
 extern bool pod_type_p (const_tree);
 extern bool layout_pod_type_p  (const_tree);
 extern bool std_layout_type_p  (const_tree);
 extern bool trivial_type_p (const_tree);
 extern bool trivially_copyable_p   (const_tree);
+extern bool scalarish_type_p   (const_tree);
 extern bool type_has_nontrivial_default_init   (const_tree);
 extern bool type_has_nontrivial_copy_init  (const_tree);
 extern bool class_tmpl_impl_spec_p (const_tree);
 extern int zero_init_p (const_tree);
 extern tree strip_typedefs (tree);
 extern tree strip_typedefs_expr(tree);
 extern tree copy_binfo (tree, tree, tree,
 tree *, int);
 extern int member_p(const_tree);
 extern cp_lvalue_kind real_lvalue_p(const_tree);
Index: cp/pt.c
===
--- cp/pt.c (revision 190086)
+++ cp/pt.c (working copy)
@@ -13844,21 +13844,21 @@ tsubst_copy_and_build (tree t,
args, complain, in_decl);
else
  member = tsubst_copy (member, args, complain, in_decl);
if (member == error_mark_node)
  return error_mark_node;
 
if (type_dependent_expression_p (object))
  /* We can't do much here.  */;
else if (!CLASS_TYPE_P (object_type))
  {
-   if (SCALAR_TYPE_P (object_type))
+   if (scalarish_type_p (object_type))
  {
tree s = NULL_TREE;
tree dtor = member;
 
if (TREE_CODE (dtor) == SCOPE_REF)
  {
s = TREE_OPERAND (dtor, 0);
dtor = TREE_OPERAND (dtor, 1);
  }
if (TREE_CODE (dtor) == BIT_NOT_EXPR)


[committed] Fix rtx-sharing problem in split_insns

2012-08-02 Thread Richard Sandiford
I hit a case where we were splitting a set of (const (unspec [...]))
into something that still referred to the original expression.
We reused that same expression as a REG_EQUAL note, leading to
an rtx-sharing violation.

Tested on mips64-linux-gnu and applied.

Richard


gcc/
* recog.c (split_insn): Copy the original SET_SRC before using
it as a note.

Index: gcc/recog.c
===
--- gcc/recog.c 2012-08-02 21:19:07.321527035 +0100
+++ gcc/recog.c 2012-08-02 21:22:58.721526468 +0100
@@ -2831,7 +2831,8 @@ split_insn (rtx insn)
  if (note  CONSTANT_P (XEXP (note, 0)))
set_unique_reg_note (last, REG_EQUAL, XEXP (note, 0));
  else if (CONSTANT_P (SET_SRC (insn_set)))
-   set_unique_reg_note (last, REG_EQUAL, SET_SRC (insn_set));
+   set_unique_reg_note (last, REG_EQUAL,
+copy_rtx (SET_SRC (insn_set)));
}
 }
 


Re: [committed] PR 51931: force non-MIPS16ness for long-branch tests (NOW RFA: MIPS16 Long Branch Patch)

2012-08-02 Thread Richard Sandiford
Sorry for the late reply.  Been thinking it over a bit more.

Moore, Catherine catherine_mo...@mentor.com writes:
 Now that we are in the window for 4.8, I'd like to discuss the
 possibility of applying this patch.  Have you had a chance to think
 about it?

In the end, I think we should go for the fix originally suggested
in the PR: a sequence that saves a scratch register to $1 and restores
it in the delay slot.  I checked with the MIPS UK guys that there aren't
any known gotchas with doing that, which shows how long this has been
in the making.

The quality of the scratch sequence is clearly vastly inferior to your
version in the common case, but the point is that that case isn't
really all that common, and this way should at least be fully general.
The problem with inserting branch trampolines separately from laying out
the constant pool is that one could interfere with the other.  There are
also corner cases where we need more trampolines than we have room.

There's still the possiblity of using trampolines as an optimisation
in cases where we know its safe, but I'm not sure it's worth the effort.

Tested on mips64-linux-gnu, both with -mips16 and -mips16/-fpic.
I did a run with the patch as below, and a run with the extended
branches commented out (so that branches were either unextended
or long).  Applied.

Richard


gcc/
PR target/51931
* config/mips/mips-protos.h (mips_strip_unspec_address): Declare.
* config/mips/mips.c (mips_strip_unspec_address): Make extern.
(mips16_rewrite_pool_constant): Make a copy of the pool constant
before adding to a PC-relative table.
(mips16_lay_out_constants): Add a SPLIT_P parameter.
(mips16_load_branch_target, mips16_split_long_branches): New functions.
(mips_reorg): Update call to mips16_lay_out_constants.
Call mips16_split_long_branches.
* config/mips/predicates.md (pc_or_label_operand): Delete.
* config/mips/mips.md (length): Add a calculation for MIPS16 branches.
Move the extended_mips16 handling further down.
(*branch_equalitymode_mips16): Replace use pc_or_label_operand
with explicit label_ref and pc.  Follow the usual operand numbering.
(*branch_equalitymode_mips16_inverted): New pattern.
(*jump_mips16): Add length attribute.
(indirect_jump_and_restore_mode): New pattern.
(consttable_int): Call mips_strip_unspec_address on the operand.

gcc/testsuite/
PR target/51931
* gcc.c-torture/compile/20001226-1.c: Remove nomips16 attribute.
* g++.dg/opt/longbranch1.C: Likewise.

Index: gcc/config/mips/mips-protos.h
===
--- gcc/config/mips/mips-protos.h   2012-08-02 21:19:07.323527035 +0100
+++ gcc/config/mips/mips-protos.h   2012-08-02 21:51:23.509522298 +0100
@@ -190,6 +190,7 @@ extern rtx mips_pic_base_register (rtx);
 extern rtx mips_got_load (rtx, rtx, enum mips_symbol_type);
 extern bool mips_split_symbol (rtx, rtx, enum machine_mode, rtx *);
 extern rtx mips_unspec_address (rtx, enum mips_symbol_type);
+extern rtx mips_strip_unspec_address (rtx);
 extern void mips_move_integer (rtx, rtx, unsigned HOST_WIDE_INT);
 extern bool mips_legitimize_move (enum machine_mode, rtx, rtx);
 
Index: gcc/config/mips/mips.c
===
--- gcc/config/mips/mips.c  2012-08-02 21:19:07.322527035 +0100
+++ gcc/config/mips/mips.c  2012-08-02 21:51:23.503522297 +0100
@@ -2563,7 +2563,7 @@ mips_unspec_address (rtx address, enum m
 /* If OP is an UNSPEC address, return the address to which it refers,
otherwise return OP itself.  */
 
-static rtx
+rtx
 mips_strip_unspec_address (rtx op)
 {
   rtx base, offset;
@@ -14070,7 +14070,7 @@ mips16_rewrite_pool_constant (struct mip
   split_const (*x, base, offset);
   if (GET_CODE (base) == SYMBOL_REF  CONSTANT_POOL_ADDRESS_P (base))
 {
-  label = mips16_add_constant (pool, get_pool_constant (base),
+  label = mips16_add_constant (pool, copy_rtx (get_pool_constant (base)),
   get_pool_mode (base));
   base = gen_rtx_LABEL_REF (Pmode, label);
   *x = mips_unspec_address_offset (base, offset, SYMBOL_PC_RELATIVE);
@@ -14126,10 +14126,11 @@ mips_cfg_in_reorg (void)
  || TARGET_RELAX_PIC_CALLS);
 }
 
-/* Build MIPS16 constant pools.  */
+/* Build MIPS16 constant pools.  Split the instructions if SPLIT_P,
+   otherwise assume that they are already split.  */
 
 static void
-mips16_lay_out_constants (void)
+mips16_lay_out_constants (bool split_p)
 {
   struct mips16_constant_pool pool;
   struct mips16_rewrite_pool_refs_info info;
@@ -14138,10 +14139,13 @@ mips16_lay_out_constants (void)
   if (!TARGET_MIPS16_PCREL_LOADS)
 return;
 
-  if (mips_cfg_in_reorg ())
-split_all_insns ();
-  else
-split_all_insns_noflow ();
+  if (split_p)
+{
+  if (mips_cfg_in_reorg ())
+ 

VRP wrapping MULT_EXPR

2012-08-02 Thread Marc Glisse

Hello,

here is a patch handling multiplication of wrapping integer types in VRP. 
It passed bootstrap+testsuite limited to c,c++ and without the testcase, 
so I'll retest it better during the night. For some reason the test 
libgomp.graphite/force-parallel-6.c which used to fail passed with the 
patch.


gcc/
2012-08-03 Marc Glisse marc.gli...@inria.fr

PR tree-optimization/30318
* double-int.c (mul_double_wide_with_sign): New function.
(mul_double_with_sign): Call the new function.
* double-int.h (mul_double_wide_with_sign): Declare the new function.
* tree-vrp.c (extract_range_from_binary_expr_1) [MULT_EXPR]:
Handle integer types that wrap on overflow.
(quad_int_cmp): New helper function.
(quad_int_pair_sort): Likewise.

gcc/testsuite/
2012-08-03 Marc Glisse marc.gli...@inria.fr

PR tree-optimization/30318
* gcc.dg/tree-ssa/vrp77.c: New testcase.

--
Marc GlisseIndex: gcc/tree-vrp.c
===
--- gcc/tree-vrp.c  (revision 190103)
+++ gcc/tree-vrp.c  (working copy)
@@ -2181,20 +2181,42 @@ extract_range_from_multiplicative_op_1 (
 {
   /* If the new range has its limits swapped around (MIN  MAX),
 then the operation caused one of them to wrap around, mark
 the new range VARYING.  */
   set_value_range_to_varying (vr);
 }
   else
 set_value_range (vr, type, min, max, NULL);
 }
 
+/* Some quadruple precision helpers.  */
+static int
+quad_int_cmp (double_int l0, double_int h0,
+ double_int l1, double_int h1, bool uns)
+{
+  int c = double_int_cmp (h0, h1, uns);
+  if (c != 0) return c;
+  return double_int_ucmp (l0, l1);
+}
+
+static void
+quad_int_pair_sort (double_int *l0, double_int *h0,
+   double_int *l1, double_int *h1, bool uns)
+{
+  if (quad_int_cmp (*l0, *h0, *l1, *h1, uns)  0)
+{
+  double_int tmp;
+  tmp = *l0; *l0 = *l1; *l1 = tmp;
+  tmp = *h0; *h0 = *h1; *h1 = tmp;
+}
+}
+
 /* Extract range information from a binary operation CODE based on
the ranges of each of its operands, *VR0 and *VR1 with resulting
type EXPR_TYPE.  The resulting range is stored in *VR.  */
 
 static void
 extract_range_from_binary_expr_1 (value_range_t *vr,
  enum tree_code code, tree expr_type,
  value_range_t *vr0_, value_range_t *vr1_)
 {
   value_range_t vr0 = *vr0_, vr1 = *vr1_;
@@ -2562,20 +2584,137 @@ extract_range_from_binary_expr_1 (value_
{
  /* For operations that make the resulting range directly
 proportional to the original ranges, apply the operation to
 the same end of each range.  */
  min = vrp_int_const_binop (code, vr0.min, vr1.min);
  max = vrp_int_const_binop (code, vr0.max, vr1.max);
}
 }
   else if (code == MULT_EXPR)
 {
+  /* Fancy code so that with unsigned, [-3,-1]*[-3,-1] does not
+drop to varying.  */
+  if (range_int_cst_p (vr0)
+  range_int_cst_p (vr1)
+  TYPE_OVERFLOW_WRAPS (expr_type))
+   {
+ double_int min0, max0, min1, max1, sizem1, size;
+ double_int prod0l, prod0h, prod1l, prod1h,
+prod2l, prod2h, prod3l, prod3h;
+ bool uns0, uns1, uns;
+
+ sizem1 = double_int_max_value (TYPE_PRECISION (expr_type), true);
+ size = double_int_add (sizem1, double_int_one);
+
+ min0 = tree_to_double_int (vr0.min);
+ max0 = tree_to_double_int (vr0.max);
+ min1 = tree_to_double_int (vr1.min);
+ max1 = tree_to_double_int (vr1.max);
+
+ uns0 = TYPE_UNSIGNED (expr_type);
+ uns1 = uns0;
+
+ /* Canonicalize the intervals.  */
+ if (TYPE_UNSIGNED (expr_type))
+   {
+ double_int min2 = double_int_sub (size, min0);
+ if (double_int_cmp (min2, max0, true)  0)
+   {
+ min0 = double_int_neg (min2);
+ max0 = double_int_sub (max0, size);
+ uns0 = false;
+   }
+
+ min2 = double_int_sub (size, min1);
+ if (double_int_cmp (min2, max1, true)  0)
+   {
+ min1 = double_int_neg (min2);
+ max1 = double_int_sub (max1, size);
+ uns1 = false;
+   }
+   }
+ uns = uns0  uns1;
+
+ mul_double_wide_with_sign (min0.low, min0.high,
+min1.low, min1.high,
+prod0l.low, prod0l.high,
+prod0h.low, prod0h.high, true);
+ if (!uns0  double_int_negative_p (min0))
+   prod0h = double_int_sub (prod0h, min1);
+ if (!uns1  double_int_negative_p (min1))
+   prod0h = double_int_sub (prod0h, min0);
+
+ mul_double_wide_with_sign (min0.low, min0.high,
+

Re: Remove redundant comparison in debug mode

2012-08-02 Thread Jonathan Wakely
On 1 August 2012 20:34, François Dumont wrote:

 Ok for trunk ?

OK, thanks.


[PATCH, MIPS] clean up 24k/74k store bypasses

2012-08-02 Thread Sandra Loosemore
This patch changes the 24k/74k scheduling descriptions to use the existing 
mips_store_data_bypass_p predicate instead of treating cprestore as a special 
case.  OK for mainline?

-Sandra


2012-08-02  Sandra Loosemore  san...@codesourcery.com
Maxim Kuvyrkov  ma...@codesourcery.com
Julian Brown  jul...@codesourcery.com

gcc/
* config/mips/24k.md (r24k_unknown_store): Delete special handling
for cprestore.
(r24k_int_load, r24k_int_arith, r24k_int_mul3, r24k_int_mfhilo)
(r24k_int_cop, r24k_int_multi)
(r24kf2_1_fcvt_f2i, r24kf2_1_fxfer)
(r24kf1_1_fcvt_f2i, r24kf1_1_fxfer): Use mips_store_data_bypass_p
instead of store_data_bypass_p.
* config/mips/74k.md (r74k_int_store): Delete special handling for
cprestore.
(r74k_int_load, r74k_int_logical, r74k_int_arith, r74k_int_cmove):
Use mips_store_data_bypass_p instead of store_data_bypass_p.

Index: gcc/config/mips/24k.md
===
--- gcc/config/mips/24k.md	(revision 190052)
+++ gcc/config/mips/24k.md	(working copy)
@@ -122,18 +122,7 @@
 ;; 6. Store
 (define_insn_reservation r24k_int_store 1
   (and (eq_attr cpu 24kc,24kf2_1,24kf1_1)
-   (and (eq_attr type store)
-	(eq_attr mode !unknown)))
-  r24k_iss+r24k_ixu_arith)
-
-;; 6.1 Special case - matches the cprestore pattern which don't set the mode
-;; attrib. This avoids being set as r24k_int_store and have it checked
-;; against store_data_bypass_p, which would then fail because cprestore
-;; does not have a normal SET pattern.
-(define_insn_reservation r24k_unknown_store 1
-  (and (eq_attr cpu 24kc,24kf2_1,24kf1_1)
-   (and (eq_attr type store)
-	(eq_attr mode unknown)))
+   (eq_attr type store))
   r24k_iss+r24k_ixu_arith)
 
 
@@ -169,7 +158,7 @@
 ;; load-store base: 3 cycles
 ;; load-prefetch:   3 cycles
 (define_bypass 3 r24k_int_load r24k_int_load)
-(define_bypass 3 r24k_int_load r24k_int_store !store_data_bypass_p)
+(define_bypass 3 r24k_int_load r24k_int_store !mips_store_data_bypass_p)
 (define_bypass 3 r24k_int_load r24k_int_prefetch)
 
 ;; arith-next use :  1 cycles (Default)
@@ -177,14 +166,14 @@
 ;; arith-store base: 2 cycles
 ;; arith-prefetch:   2 cycles
 (define_bypass 2 r24k_int_arith r24k_int_load)
-(define_bypass 2 r24k_int_arith r24k_int_store !store_data_bypass_p)
+(define_bypass 2 r24k_int_arith r24k_int_store !mips_store_data_bypass_p)
 (define_bypass 2 r24k_int_arith r24k_int_prefetch)
 
 ;; mul3-next use : 5 cycles (default)
 ;; mul3-l/s base : 6 cycles
 ;; mul3-prefetch : 6 cycles
 (define_bypass 6 r24k_int_mul3 r24k_int_load)
-(define_bypass 6 r24k_int_mul3 r24k_int_store !store_data_bypass_p)
+(define_bypass 6 r24k_int_mul3 r24k_int_store !mips_store_data_bypass_p)
 (define_bypass 6 r24k_int_mul3 r24k_int_prefetch)
 
 ;; mul3-madd/msub : 1 cycle
@@ -195,20 +184,22 @@
 ;; mfhilo-prefetch  : 6 cycles
 ;; mthilo-madd/msub : 2 cycle (only for mthi/lo not mfhi/lo)
 (define_bypass 6 r24k_int_mfhilo r24k_int_load)
-(define_bypass 6 r24k_int_mfhilo r24k_int_store !store_data_bypass_p)
+(define_bypass 6 r24k_int_mfhilo r24k_int_store
+  !mips_store_data_bypass_p)
 (define_bypass 6 r24k_int_mfhilo r24k_int_prefetch)
 (define_bypass 2 r24k_int_mthilo r24k_int_madd)
 
 ;; cop-next use : 3 cycles (Default)
 ;; cop-l/s base : 4 cycles
 ;; (define_bypass 4 r24k_int_cop r24k_int_load)
-;; (define_bypass 4 r24k_int_cop r24k_int_store !store_data_bypass_p)
+;; (define_bypass 4 r24k_int_cop r24k_int_store
+;;   !mips_store_data_bypass_p)
 
 ;; multi-next use : 1 cycles (Default)
 ;; multi-l/s base : 2 cycles
 ;; multi-prefetch : 2 cycles
 (define_bypass 2 r24k_int_multi r24k_int_load)
-(define_bypass 2 r24k_int_multi r24k_int_store !store_data_bypass_p)
+(define_bypass 2 r24k_int_multi r24k_int_store !mips_store_data_bypass_p)
 (define_bypass 2 r24k_int_multi r24k_int_prefetch)
 
 
@@ -330,13 +416,14 @@
 ;; r24kf2_1_fcvt_f2i-l/s base : 11 cycles
 ;; r24kf2_1_fcvt_f2i-prefetch : 11 cycles
 (define_bypass 11 r24kf2_1_fcvt_f2i r24k_int_load)
-(define_bypass 11 r24kf2_1_fcvt_f2i r24k_int_store !store_data_bypass_p)
+(define_bypass 11 r24kf2_1_fcvt_f2i r24k_int_store
+  !mips_store_data_bypass_p)
 (define_bypass 11 r24kf2_1_fcvt_f2i r24k_int_prefetch)
 
 ;; r24kf2_1_fxfer-l/s base : 5 cycles
 ;; r24kf2_1_fxfer-prefetch : 5 cycles
 (define_bypass 5 r24kf2_1_fxfer r24k_int_load)
-(define_bypass 5 r24kf2_1_fxfer r24k_int_store !store_data_bypass_p)
+(define_bypass 5 r24kf2_1_fxfer r24k_int_store !mips_store_data_bypass_p)
 (define_bypass 5 r24kf2_1_fxfer r24k_int_prefetch)
 
 ;; --
@@ -446,12 +533,13 @@
 ;; r24kf1_1_fcvt_f2i-l/s base : 6 cycles
 ;; r24kf1_1_fcvt_f2i-prefetch : 6 cycles
 (define_bypass 6 r24kf1_1_fcvt_f2i r24k_int_load)
-(define_bypass 6 r24kf1_1_fcvt_f2i r24k_int_store !store_data_bypass_p)
+(define_bypass 6 r24kf1_1_fcvt_f2i 

Re: cleanup of CONST_DOUBLE.

2012-08-02 Thread Kenneth Zadeck

bootstrapped and regression tested on x86-64.

committed as revision 190105

2012-08-02  Kenneth Zadeck zad...@naturalbridge.com

* cfgexpand.c (expand_debug_locations):  Encapsulate test for
CONST_DOUBLE in macro.
* combine.c (try_combine, gen_lowpart_for_combine): Ditto.
* cprop.c (implicit_set_cond_p): Ditto.
* cselib.c (rtx_equal_for_cselib_1): Ditto.
* expmed.c (expand_mult): Ditto.
* expr.c (convert_modes): Ditto.
* ira-costs.c (record_reg_classes): Ditto.
* ira-lives.c (single_reg_class): Ditto.
* optabs.c (expand_copysign_absneg, expand_copysign): Ditto.
* print-rtl.c (print_rtx): Ditto.
* recog.c (simplify_while_replacing, const_double_operand)
(asm_operand_ok, constrain_operands): Ditto.
* reg-stack.c (subst_stack_regs_pat): Ditto.
* reload.c (find_reloads, find_equiv_reg): Ditto.
* rtlanal.c (replace_rtx): Remove test.
* rtlanal.c (constant_pool_constant_p, split_double): Encapsulate 
test for

CONST_DOUBLE in macro.
* simplify-rtx.c (mode_signbit_p, avoid_constant_pool_reference)
(simplify_unary_operation_1, simplify_const_unary_operation)
(simplify_binary_operation_1, simplify_const_binary_operation)
(simplify_relational_operation_1)
(simplify_const_relational_operations)
(implify_subreg): Ditto.
* varasm.c (output_constant_pool_2): Ditto.
* rtl.h (CONST_DOUBLE_AS_INT_P, CONST_DOUBLE_AS_FLOAT_P): New
macros.
* rtl.def (CONST_DOUBLE):  Updated comments.



On 07/29/2012 05:31 PM, Steven Bosscher wrote:

On Sun, Jul 29, 2012 at 6:11 PM, Kenneth Zadeck
zad...@naturalbridge.com wrote:

 * rtl.h (CONST_DOUBLE_AS_INT_P, CONST_DOUBLE_AS_FLOAT_P): New
 macros.

Hello Kenny,

Thanks for doing this!

Can you please also update the comment before CONST_DOUBLE in rtl.def?
According to rtl.def CONST_DOUBLEs are only for floating point
constants. (I only found out that CONST_DOUBLEs can be ints a few days
ago :-)

Ciao!
Steven


Index: gcc/combine.c
===
--- gcc/combine.c	(revision 190104)
+++ gcc/combine.c	(working copy)
@@ -2620,10 +2620,10 @@ try_combine (rtx i3, rtx i2, rtx i1, rtx
   if (i1 == 0
(temp = single_set (i2)) != 0
(CONST_INT_P (SET_SRC (temp))
-	  || GET_CODE (SET_SRC (temp)) == CONST_DOUBLE)
+	  || CONST_DOUBLE_AS_INT_P (SET_SRC (temp)))
GET_CODE (PATTERN (i3)) == SET
(CONST_INT_P (SET_SRC (PATTERN (i3)))
-	  || GET_CODE (SET_SRC (PATTERN (i3))) == CONST_DOUBLE)
+	  || CONST_DOUBLE_AS_INT_P (SET_SRC (PATTERN (i3
reg_subword_p (SET_DEST (PATTERN (i3)), SET_DEST (temp)))
 {
   rtx dest = SET_DEST (PATTERN (i3));
@@ -5105,8 +5105,7 @@ subst (rtx x, rtx from, rtx to, int in_d
 		return new_rtx;
 
 	  if (GET_CODE (x) == SUBREG
-		   (CONST_INT_P (new_rtx)
-		  || GET_CODE (new_rtx) == CONST_DOUBLE))
+		   (CONST_INT_P (new_rtx) || CONST_DOUBLE_AS_INT_P (new_rtx)))
 		{
 		  enum machine_mode mode = GET_MODE (x);
 
@@ -7134,8 +7133,7 @@ make_extraction (enum machine_mode mode,
   if (mode == tmode)
 	return new_rtx;
 
-  if (CONST_INT_P (new_rtx)
-	  || GET_CODE (new_rtx) == CONST_DOUBLE)
+  if (CONST_INT_P (new_rtx) || CONST_DOUBLE_AS_INT_P (new_rtx))
 	return simplify_unary_operation (unsignedp ? ZERO_EXTEND : SIGN_EXTEND,
 	 mode, new_rtx, tmode);
 
@@ -10646,9 +10644,7 @@ gen_lowpart_for_combine (enum machine_mo
   /* We can only support MODE being wider than a word if X is a
  constant integer or has a mode the same size.  */
   if (GET_MODE_SIZE (omode)  UNITS_PER_WORD
-   ! ((imode == VOIDmode
-	  (CONST_INT_P (x)
-		 || GET_CODE (x) == CONST_DOUBLE))
+   ! ((CONST_INT_P (x) || CONST_DOUBLE_AS_INT_P (x))
 	|| isize == osize))
 goto fail;
 
Index: gcc/emit-rtl.c
===
--- gcc/emit-rtl.c	(revision 190104)
+++ gcc/emit-rtl.c	(working copy)
@@ -491,7 +491,7 @@ rtx_to_double_int (const_rtx cst)
 
   if (CONST_INT_P (cst))
   r = shwi_to_double_int (INTVAL (cst));
-  else if (CONST_DOUBLE_P (cst)  GET_MODE (cst) == VOIDmode)
+  else if (CONST_DOUBLE_AS_INT_P (cst))
 {
   r.low = CONST_DOUBLE_LOW (cst);
   r.high = CONST_DOUBLE_HIGH (cst);
@@ -1244,7 +1244,7 @@ gen_lowpart_common (enum machine_mode mo
 }
   else if (GET_CODE (x) == SUBREG || REG_P (x)
 	   || GET_CODE (x) == CONCAT || GET_CODE (x) == CONST_VECTOR
-	   || GET_CODE (x) == CONST_DOUBLE || CONST_INT_P (x))
+	   || CONST_DOUBLE_P (x) || CONST_INT_P (x))
 return simplify_gen_subreg (mode, x, innermode, offset);
 
   /* Otherwise, we can't do this.  */
Index: gcc/expr.c
===
--- gcc/expr.c	(revision 190104)
+++ gcc/expr.c	(working copy)
@@ -745,7 +745,7 @@ convert_modes (enum machine_mode mode, e
 GET_MODE_PRECISION (mode) = HOST_BITS_PER_WIDE_INT)
   || (GET_MODE_CLASS (mode) == MODE_INT
 	   

[PATCH, MIPS] DSP ALU scheduling

2012-08-02 Thread Sandra Loosemore
This is another patch that has been present in our local source base for some
years now.  It originally came from MIPS; I've verified that we have legal 
permission to contribute it to the FSF.

The 74k.md parts of this patch depend on the not-yet-reviewed 74k madd 
scheduler 
tweaks patch I posted the other day:

http://gcc.gnu.org/ml/gcc-patches/2012-08/msg00062.html

Assuming that one gets approved, is this patch OK for mainline?

-Sandra


2012-08-02  Sandra Loosemore  san...@codesourcery.com
Maxim Kuvyrkov  ma...@codesourcery.com
Julian Brown  jul...@codesourcery.com
MIPS Technologies, Inc.

gcc/
* config/mips/mips.md (dspmac, dspmacsat, accext, accmod, dspalu)
(dspalusat): Add insn types.
* config/mips/mips-dsp.md (addDSPV:mode3)
(mips_addDSP:dspfmt1_s_DSP:dspfmt2)
(subDSPV:mode3, mips_subDSP:dspfmt1_s_DSP:dspfmt2, mips_addsc)
(mips_addwc, mips_modsub, mips_raddu_w_qb, mips_absq_s_DSPQ:dspfmt2)
(mips_precrq_qb_ph, mips_precrq_ph_w, mips_precrq_rs_ph_w)
(mips_precrqu_s_qb_ph, mips_preceq_w_phl, mips_preceq_w_phr)
(mips_precequ_ph_qbl, mips_precequ_ph_qbr, mips_precequ_ph_qbla)
(mips_precequ_ph_qbra, mips_preceu_ph_qbl, mips_preceu_ph_qbr)
(mips_preceu_ph_qbla, mips_preceu_ph_qbra, mips_shll_DSPV:dspfmt2)
(mips_shll_s_DSPQ:dspfmt2, mips_shll_s_DSPQ:dspfmt2, mips_shrl_qb)
(mips_shra_ph, mips_shra_r_DSPQ:dspfmt2, mips_bitrev, mips_insv)
(mips_repl_qb, mips_repl_ph, mips_cmpDSPV:dspfmt1_1_eq_DSPV:dspfmt2)
(mips_cmpDSPV:dspfmt1_1_lt_DSPV:dspfmt2)
(mips_cmpDSPV:dspfmt1_1_le_DSPV:dspfmt2, mips_cmpgu_eq_qb)
(mips_cmpgu_lt_qb, mips_cmpgu_le_qb, mips_pick_DSPV:dspfmt2)
(mips_packrl_ph, mips_wrdsp, mips_rddsp): Change type to dspalu.
(mips_dpau_h_qbl, mips_dpau_h_qbr, mips_dpsu_h_qbl, mips_dpsu_h_qbr)
(mips_dpaq_s_w_ph, mips_dpsq_s_w_ph, mips_mulsaq_s_w_ph)
(mips_maq_s_w_phl, mips_maq_s_w_phr, mips_maq_sa_w_phr): Set type to
dspmac.
(mips_dpaq_sa_l_w, mips_dpsq_sa_l_w, mips_maq_sa_w_phl): Set type to
dspmacsat.
(mips_extr_w, mips_extr_r_w, mips_extr_rs_w, mips_extp, mips_extpdp):
Set type to accext.
(mips_shilo, mips_mthlip): Set type to accmod.
* config/mips/mips-dspr2.md (mips_absq_s_qb, mips_addu_s_ph)
(mips_adduh_r_qb): Set type to dspalusat.
(mips_addu_ph, mips_adduh_qb, mips_append, mips_balign)
(mips_cmpgdu_eq_qb, mips_cmpgdu_lt_qb, mips_cmpgdu_le_qb)
(mips_precr_qb_ph, mips_precr_sra_ph_w, mips_precr_sra_r_ph_w)
(mips_prepend, mips_shra_qb, mips_shra_r_qb, mips_shrl_ph)
(mips_subu_ph, mips_subuh_qb, mips_subuh_r_qb, mips_addqh_ph)
(mips_addqh_r_ph, mips_addqh_w, mips_addqh_r_w, mips_subqh_ph)
(mips_subqh_r_ph, mips_subqh_w, mips_subqh_r_w): Set type to dspalu.
(mips_dpa_w_ph, mips_dps_w_ph, mips_mulsa_w_ph, mips_dpax_w_ph)
(mips_dpsx_w_ph, mips_dpaqx_s_w_ph, mips_dpsqx_s_w_ph): Set type to
dspmac.
(mips_subu_s_ph): Set type to dspalusat.
(mips_dpaqx_sa_w_ph, mips_dpsqx_sa_w_ph): Set type to dspmacsat.
* config/mips/mips-protos.h (mips_dspalu_bypass_p): Add prototype.
* config/mips/mips.c (dspalu_bypass_table): New.
(mips_dspalu_bypass_p): New.
* config/mips/24k.md (r24k_dsp_alu, r24k_dsp_mac, r24k_dsp_mac_sat)
(r24k_dsp_acc_ext, r24k_dsp_acc_mod): New insn reservations.
(r24k_int_mult, r24k_int_mthilo, r24k_dsp_mac, r24k_dsp_mac_sat)
(r24k_dsp_acc_ext, r24k_dsp_acc_mod, r24k_dsp_alu): New bypasses.
* config/mips/74k.md (r74k_dsp_alu, r74k_dsp_alu_sat, r74k_dsp_mac)
(r74k_dsp_mac_sat, r74k_dsp_acc_ext, r74k_dsp_acc_mod): New insn
reservations.
(r74k_dsp_mac, r74k_dsp_mac_sat, r74k_int_mult, r74k_int_mul3)
(r74k_dsp_mac, r74k_dsp_mac_sat): New bypasses.
Index: gcc/config/mips/mips.md
===
--- gcc/config/mips/mips.md	(revision 190052)
+++ gcc/config/mips/mips.md	(working copy)
@@ -326,6 +326,12 @@
 ;; frsqrt   floating point reciprocal square root
 ;; frsqrt1  floating point reciprocal square root step1
 ;; frsqrt2  floating point reciprocal square root step2
+;; dspmac   DSP MAC instructions not saturating the accumulator
+;; dspmacsatDSP MAC instructions that saturate the accumulator
+;; accext   DSP accumulator extract instructions
+;; accmod   DSP accumulator modify instructions
+;; dspalu   DSP ALU instructions not saturating the result
+;; dspalusatDSP ALU instructions that saturate the result
 ;; multi	multiword sequence (or user asm statements)
 ;; atomic	atomic memory update instruction
 ;; syncloop	memory atomic operation implemented as a sync loop
@@ -336,7 +342,8 @@

Re: [PATCH] Fix ARM constant-pool layout calculations under -falign-labels

2012-08-02 Thread Roland McGrath
On Thu, Aug 2, 2012 at 1:57 AM, Julian Brown jul...@codesourcery.com wrote:
 FWIW, I've hit this issue in the past, and used a patch as follows to
 fix it:

 @@ -12015,7 +12025,10 @@ create_fix_barrier (Mfix *fix, HOST_WIDE
gcc_assert (GET_CODE (from) != BARRIER);

/* Count the length of this insn.  */
 -  count += get_attr_length (from);
 +  if (LABEL_P (from)  (align_jumps  0 || align_loops  0))
 +count += MAX (align_jumps, align_loops);
 +  else
 +count += get_attr_length (from);


That looks like it's from a version of arm.c before get_label_padding was
added.  The existing trunk code uses get_label_padding at that spot, and
my change was to get_label_padding.

 Not sure if that's equivalent, but you might want to check
 [-falign-loops] too while you're at it.

That seems like it could overestimate, if the -falign-loops value is larger
than the -falign-labels value.  Not every label is for a loop.


Thanks,
Roland


[v3] reorder headers in memory

2012-08-02 Thread Jonathan Wakely
As suggested a few weeks ago on the libstdc++ list, this patch tweaks
the include order in memory, allowing internal library headers to
use shared_ptr and unique_ptr without depending on
backward/auto_ptr.h.

* include/std/memory: Include auto_ptr.h later.
* include/bits/shared_ptr.h (shared_ptr(auto_ptr_Up): Remove
definition.
* include/bits/shared_ptr_base.h (__shared_ptr(auto_ptr_Up):
Likewise.
* include/bits/unique_ptr.h (unique_ptr(auto_ptr_Up): Likewise.
* include/backward/auto_ptr.h (unique_ptr(auto_ptr_Up): Define.
(shared_ptr(auto_ptr_Up, __shared_ptr(auto_ptr_Up): Likewise.
* include/std/future: Reduce header dependencies.
* testsuite/20_util/default_delete/48631_neg.cc: Adjust dg-error line
numbers.
* testsuite/20_util/shared_ptr/cons/43820_neg.cc: Likewise.
* testsuite/20_util/unique_ptr/assign/48635_neg.cc: Likewise.

Tested x86_64-linux, committed to trunk.
commit 9386ced4bfd9990046d2dec6a080478c8cc01c50
Author: Jonathan Wakely jwakely@gmail.com
Date:   Fri Aug 3 01:25:19 2012 +0100

* include/std/memory: Include auto_ptr.h later.
* include/bits/shared_ptr.h (shared_ptr(auto_ptr_Up): Remove
definition.
* include/bits/shared_ptr_base.h (__shared_ptr(auto_ptr_Up):
Likewise.
* include/bits/unique_ptr.h (unique_ptr(auto_ptr_Up): Likewise.
* include/backward/auto_ptr.h (unique_ptr(auto_ptr_Up): Define.
(shared_ptr(auto_ptr_Up, __shared_ptr(auto_ptr_Up): Likewise.
* include/std/future: Reduce header dependencies.
* testsuite/20_util/default_delete/48631_neg.cc: Adjust dg-error line
numbers.
* testsuite/20_util/shared_ptr/cons/43820_neg.cc: Likewise.
* testsuite/20_util/unique_ptr/assign/48635_neg.cc: Likewise.

diff --git a/libstdc++-v3/include/backward/auto_ptr.h 
b/libstdc++-v3/include/backward/auto_ptr.h
index 3c91c08..01702f7 100644
--- a/libstdc++-v3/include/backward/auto_ptr.h
+++ b/libstdc++-v3/include/backward/auto_ptr.h
@@ -1,6 +1,6 @@
 // auto_ptr implementation -*- C++ -*-
 
-// Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+// Copyright (C) 2007-2012 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -289,6 +289,40 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   typedef void element_type;
 } _GLIBCXX_DEPRECATED;
 
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+  template_Lock_policy _Lp
+  templatetypename _Tp
+inline
+__shared_count_Lp::__shared_count(std::auto_ptr_Tp __r)
+: _M_pi(new _Sp_counted_ptr_Tp*, _Lp(__r.get()))
+{ __r.release(); }
+
+  templatetypename _Tp, _Lock_policy _Lp
+  templatetypename _Tp1
+inline
+__shared_ptr_Tp, _Lp::__shared_ptr(std::auto_ptr_Tp1 __r)
+: _M_ptr(__r.get()), _M_refcount()
+{
+  __glibcxx_function_requires(_ConvertibleConcept_Tp1*, _Tp*)
+  static_assert( sizeof(_Tp1)  0, incomplete type );
+  _Tp1* __tmp = __r.get();
+  _M_refcount = __shared_count_Lp(std::move(__r));
+  __enable_shared_from_this_helper(_M_refcount, __tmp, __tmp);
+}
+
+  templatetypename _Tp
+  templatetypename _Tp1
+inline
+shared_ptr_Tp::shared_ptr(std::auto_ptr_Tp1 __r)
+: __shared_ptr_Tp(std::move(__r)) { }
+
+  templatetypename _Tp, typename _Dp
+  templatetypename _Up, typename
+inline
+unique_ptr_Tp, _Dp::unique_ptr(auto_ptr_Up __u) noexcept
+: _M_t(__u.release(), deleter_type()) { }
+#endif
+
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace
 
diff --git a/libstdc++-v3/include/bits/shared_ptr.h 
b/libstdc++-v3/include/bits/shared_ptr.h
index 070d2d1..e1c1eb9 100644
--- a/libstdc++-v3/include/bits/shared_ptr.h
+++ b/libstdc++-v3/include/bits/shared_ptr.h
@@ -1,6 +1,6 @@
 // shared_ptr and weak_ptr implementation -*- C++ -*-
 
-// Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+// Copyright (C) 2007-2012 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -250,8 +250,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
 #if _GLIBCXX_USE_DEPRECATED
   templatetypename _Tp1
-   shared_ptr(std::auto_ptr_Tp1 __r)
-   : __shared_ptr_Tp(std::move(__r)) { }
+   shared_ptr(std::auto_ptr_Tp1 __r);
 #endif
 
   templatetypename _Tp1, typename _Del
diff --git a/libstdc++-v3/include/bits/shared_ptr_base.h 
b/libstdc++-v3/include/bits/shared_ptr_base.h
index 39449f1..1ccd5ef 100644
--- a/libstdc++-v3/include/bits/shared_ptr_base.h
+++ b/libstdc++-v3/include/bits/shared_ptr_base.h
@@ -1,7 +1,6 @@
 // shared_ptr and weak_ptr implementation details -*- C++ -*-
 
-// Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012
-// Free Software Foundation, Inc.
+// Copyright (C) 2007-2012 Free Software Foundation, Inc.
 //
 

[PATCH] [mep] delete unused constraint-related macros and functions

2012-08-02 Thread Nathan Froyd
mep uses {constraints,predicates}.md and #if 0'd out the old macro versions.
In the interest of not keeping dead code around, I'd like to delete these.
I think this falls under the obvious rule, so I'll commit this in a couple of
days after waiting to hear from DJ.

Tested by building mep-elf.

-Nathan

* config/mep/mep.h (REG_CLASS_FROM_CONSTRAINT): Delete.
(CONST_OK_FOR_LETTER_P, CONST_DOUBLE_OK_FOR_LETTER_P): Delete.
(CONSTRAINT_LEN, EXTRA_CONSTRAINT): Delete.
* config/mep/mep.c (mep_reg_class_from_constraint): Delete.
(mep_const_ok_for_letter_p, mep_extra_constraint): Delete.
* config/mep/mep-protos.h (mep_reg_class_from_constraint): Delete.
(mep_const_ok_for_letter_p, mep_extra_constraint): Delete.
---
 gcc/ChangeLog   |   10 
 gcc/config/mep/mep-protos.h |3 -
 gcc/config/mep/mep.c|  126 ---
 gcc/config/mep/mep.h|   15 -
 4 files changed, 10 insertions(+), 144 deletions(-)

diff --git a/gcc/config/mep/mep-protos.h b/gcc/config/mep/mep-protos.h
index edfbaf7..f0f3496 100644
--- a/gcc/config/mep/mep-protos.h
+++ b/gcc/config/mep/mep-protos.h
@@ -20,9 +20,6 @@ along with GCC; see the file COPYING3.  If not see
 http://www.gnu.org/licenses/.  */
 
 extern int mep_regno_reg_class (int);
-extern int mep_reg_class_from_constraint (int, const char *);
-extern bool mep_const_ok_for_letter_p (HOST_WIDE_INT, int);
-extern bool mep_extra_constraint (rtx, int);
 extern rtx mep_mulr_source (rtx, rtx, rtx, rtx);
 extern bool mep_reuse_lo_p (rtx, rtx, rtx, bool);
 extern bool mep_use_post_modify_p (rtx, rtx, rtx);
diff --git a/gcc/config/mep/mep.c b/gcc/config/mep/mep.c
index bba0327..5089e03 100644
--- a/gcc/config/mep/mep.c
+++ b/gcc/config/mep/mep.c
@@ -596,132 +596,6 @@ mep_regno_reg_class (int regno)
   return NO_REGS;
 }
 
-#if 0
-int
-mep_reg_class_from_constraint (int c, const char *str)
-{
-  switch (c)
-{
-case 'a':
-  return SP_REGS;
-case 'b':
-  return TP_REGS;
-case 'c':
-  return CONTROL_REGS;
-case 'd':
-  return HILO_REGS;
-case 'e':
-  {
-   switch (str[1])
- {
- case 'm':
-   return LOADABLE_CR_REGS;
- case 'x':
-   return mep_have_copro_copro_moves_p ? CR_REGS : NO_REGS;
- case 'r':
-   return mep_have_core_copro_moves_p ? CR_REGS : NO_REGS;
- default:
-   return NO_REGS;
- }
-  }
-case 'h':
-  return HI_REGS;
-case 'j':
-  return RPC_REGS;
-case 'l':
-  return LO_REGS;
-case 't':
-  return TPREL_REGS;
-case 'v':
-  return GP_REGS;
-case 'x':
-  return CR_REGS;
-case 'y':
-  return CCR_REGS;
-case 'z':
-  return R0_REGS;
-
-case 'A':
-case 'B':
-case 'C':
-case 'D':
-  {
-   enum reg_class which = c - 'A' + USER0_REGS;
-   return (reg_class_size[which]  0 ? which : NO_REGS);
-  }
-
-default:
-  return NO_REGS;
-}
-}
-
-bool
-mep_const_ok_for_letter_p (HOST_WIDE_INT value, int c)
-{
-  switch (c)
-{
-  case 'I': return value = -32768  value   32768;
-  case 'J': return value =  0  value   65536;
-  case 'K': return value =  0  value  0x0100;
-  case 'L': return value =-32  value  32;
-  case 'M': return value =  0  value  32;
-  case 'N': return value =  0  value  16;
-  case 'O':
-   if (value  0x)
- return false;
-   return value = -2147483647-1  value = 2147483647;
-default:
-  gcc_unreachable ();
-}
-}
-
-bool
-mep_extra_constraint (rtx value, int c)
-{
-  encode_pattern (value);
-
-  switch (c)
-{
-case 'R':
-  /* For near symbols, like what call uses.  */
-  if (GET_CODE (value) == REG)
-   return 0;
-  return mep_call_address_operand (value, GET_MODE (value));
-
-case 'S':
-  /* For signed 8-bit immediates.  */
-  return (GET_CODE (value) == CONST_INT
-  INTVAL (value) = -128
-  INTVAL (value) = 127);
-
-case 'T':
-  /* For tp/gp relative symbol values.  */
-  return (RTX_IS (u3s) || RTX_IS (u2s)
-  || RTX_IS (+u3si) || RTX_IS (+u2si));
-
-case 'U':
-  /* Non-absolute memories.  */
-  return GET_CODE (value) == MEM  ! CONSTANT_P (XEXP (value, 0));
-
-case 'W':
-  /* %hi(sym) */
-  return RTX_IS (Hs);
-
-case 'Y':
-  /* Register indirect.  */
-  return RTX_IS (mr);
-
-case 'Z':
-  return mep_section_tag (value) == 'c'  RTX_IS (ms);
-}
-
-  return false;
-}
-#endif
-
-#undef PASS
-#undef FAIL
-
 static bool
 const_in_range (rtx x, int minv, int maxv)
 {
diff --git a/gcc/config/mep/mep.h b/gcc/config/mep/mep.h
index 920120c..9a382e6 100644
--- a/gcc/config/mep/mep.h
+++ b/gcc/config/mep/mep.h
@@ -408,11 +408,6 @@ enum reg_class
 #define BASE_REG_CLASS GENERAL_REGS
 #define 

Re: [PATCH] [mep] delete unused constraint-related macros and functions

2012-08-02 Thread DJ Delorie

That's fine with me.


[PATCH,mmix] convert to constraints.md

2012-08-02 Thread Nathan Froyd
As $SUBJECT says.  There's not too much interesting here.  I did a
fairly literal-minded conversion, so it's possible there's smarter ways
to do some things.

Compiled with cross to mmix-knuth-mmixware and spot-checked by comparing
libgcc object files.  I have no idea how to set up a simulator
environment.  H-P, if you'd like to test beforehand, that'd be great.

OK to commit?

-Nathan

* config/mmix/mmix.h (REG_CLASS_FROM_LETTER): Delete.
(CONST_OK_FOR_LETTER_P, CONST_DOUBLE_OK_FOR_LETTER_P): Delete.
(EXTRA_CONSTRAINT): Delete.
* config/mmix/mmix-protos.h (mmix_intval): Declare.
(mmix_const_ok_for_letter_p, mmix_extra_constraint): Delete.
(mmix_const_double_ok_for_letter_p): Delete.
* config/mmix/constraints.md: New file.
* config/mmix/mmix.md: Include it.
(iordi3): Delete dead H constraint.
* config/mmix/predicates.md (mmix_reg_or_8bit_operand): Use
satisfies_constraint_I.
(mmix_address_operand): New predicate.
* config/mmix/mmix.c: #include tm-constrs.h.
(mmix_intval): Delete declaration.  Make non-static.
(mmix_const_ok_for_letter_p, mmix_extra_constraint): Delete.
(mmix_const_double_ok_for_letter_p): Delete.
(mmix_legitimate_address_p): Use satisfies_constraint_I.
(mmix_print_operand_address): Likewise.
---
 gcc/ChangeLog  |   21 +
 gcc/config/mmix/constraints.md |   93 
 gcc/config/mmix/mmix-protos.h  |4 +-
 gcc/config/mmix/mmix.c |   93 ++-
 gcc/config/mmix/mmix.h |   15 --
 gcc/config/mmix/mmix.md|3 +-
 gcc/config/mmix/predicates.md  |   14 --
 7 files changed, 132 insertions(+), 111 deletions(-)
 create mode 100644 gcc/config/mmix/constraints.md

diff --git a/gcc/config/mmix/constraints.md b/gcc/config/mmix/constraints.md
new file mode 100644
index 000..b8cc690
--- /dev/null
+++ b/gcc/config/mmix/constraints.md
@@ -0,0 +1,93 @@
+;; MMIX constraints
+;; Copyright (C) 2012 Free Software Foundation, Inc.
+;;
+;; This file is part of GCC.
+;;
+;; GCC is free software; you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3, or (at your option)
+;; any later version.
+;;
+;; GCC is distributed in the hope that it will be useful, but WITHOUT
+;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
+;; License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with GCC; see the file COPYING3.  If not see
+;; http://www.gnu.org/licenses/.  */
+
+(define_register_constraint x SYSTEM_REGS
+  @internal)
+
+(define_register_constraint y REMAINDER_REG
+  @internal)
+
+(define_register_constraint z HIMULT_REG
+  @internal)
+
+(define_constraint I
+  A 8-bit unsigned integer
+  (and (match_code const_int)
+   (match_test IN_RANGE (ival, 0, 255
+
+(define_constraint J
+  A 16-bit unsigned integer.
+  (and (match_code const_int)
+   (match_test IN_RANGE (ival, 0, 65535
+
+(define_constraint K
+  An integer between -255 and 0.
+  (and (match_code const_int)
+   (match_test IN_RANGE (ival, -255, 0
+
+(define_constraint L
+  @internal
+  (and (match_code const_int)
+   (match_test mmix_shiftable_wyde_value (ival
+
+(define_constraint M
+  The value 0.
+  (and (match_code const_int)
+   (match_test ival == 0)))
+
+(define_constraint N
+  @internal
+  (and (match_code const_int)
+   (match_test mmix_shiftable_wyde_value (~ival
+
+(define_constraint O
+  The value 3, 5, 9, or 17.
+  (and (match_code const_int)
+   (ior (match_test ival == 3)
+   (match_test ival == 5)
+   (match_test ival == 9)
+   (match_test ival == 17
+
+(define_constraint G
+  Floating-point zero.
+  (and (match_code const_double)
+   (match_test op == CONST0_RTX (mode
+
+(define_constraint R
+  @internal
+  (and (not (match_code const_int,const_double))
+   (match_test mmix_constant_address_p (op))
+   (ior (match_test !TARGET_BASE_ADDRESSES)
+   (match_code LABEL_REF)
+   (and (match_code SYMBOL_REF)
+(match_test SYMBOL_REF_FLAG (op))
+
+(define_constraint S
+  @internal
+  (and (match_code const_int,const_double)
+   (match_test mmix_shiftable_wyde_value (mmix_intval (op)
+
+(define_constraint T
+  @internal
+  (and (match_code const_int,const_double)
+   (match_test mmix_shiftable_wyde_value (~mmix_intval (op)
+
+(define_constraint U
+  @internal
+  (match_operand 0 mmix_address_operand))
diff --git a/gcc/config/mmix/mmix-protos.h b/gcc/config/mmix/mmix-protos.h
index 4e8c338..62cdbae 100644
--- a/gcc/config/mmix/mmix-protos.h
+++ b/gcc/config/mmix/mmix-protos.h
@@ -40,6 +40,7 @@ 

Re: [RFC] Fix pr34548 -- unnecessary alignment from alloca

2012-08-02 Thread Richard Henderson
On 2012-08-02 02:03, Alan Modra wrote:
 r190051 of a powerpc-linux bootstrap dies trying to compile garbage
 in stage2 gtype-desc.c, r190050 is OK.

It took a while, but I found the problem.  The fact that the prologue
generation code didn't use the same alignment that we applied at in
function.c.

Now that I think about it, I'm actually surprised that this *does*
work on x86_65 and ppc64.  An accident of pre-existing alignment, I assume.

I've reverted the patch til I can figure out the best way to proceed.


r~


[PATCH] Missing change from gcc/ada/system.ads

2012-08-02 Thread Andris Pavenis

Revision http://gcc.gnu.org/viewcvs?view=revisionrevision=189772
added constant Support_Atomic_Primitives to the target specific
system-*.ads files. The default system.ads was not updated.

The included patch
- adds the missing constant
- removes constants not present in other system-*.ads files any more

Andris

2012-08-03  andris.pave...@iki.fi  andris.pave...@iki.fi

* system.ads:  Support_Atomic_Primitives set to False,
Remove outdated constants

From e63ea85554db9c652070280161cd55a861d3b2db Mon Sep 17 00:00:00 2001
From: Andris Pavenis andris.pave...@iki.fi
Date: Thu, 2 Aug 2012 21:18:39 +0300
Subject: [PATCH] Add constant Support_Atomic_Primitives to system.ads

Additionally remove contants not present for target
specific versions.
---
 gcc/ada/system.ads | 12 +---
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/gcc/ada/system.ads b/gcc/ada/system.ads
index d38a533..9cca2d5 100644
--- a/gcc/ada/system.ads
+++ b/gcc/ada/system.ads
@@ -136,7 +136,6 @@ private
--  parameters is not too critical for the compiler version (e.g. we
--  do not use floating-point anyway in the compiler).
 
-   AAMP  : constant Boolean := False;
Backend_Divide_Checks : constant Boolean := False;
Backend_Overflow_Checks   : constant Boolean := False;
Command_Line_Args : constant Boolean := True;
@@ -148,13 +147,13 @@ private
Frontend_Layout   : constant Boolean := False;
Machine_Overflows : constant Boolean := False;
Machine_Rounds: constant Boolean := True;
-   OpenVMS   : constant Boolean := False;
Preallocated_Stacks   : constant Boolean := False;
Signed_Zeros  : constant Boolean := True;
Stack_Check_Default   : constant Boolean := False;
Stack_Check_Probes: constant Boolean := False;
Stack_Check_Limits: constant Boolean := False;
Support_Aggregates: constant Boolean := True;
+   Support_Atomic_Primitives : constant Boolean := False;
Support_Composite_Assign  : constant Boolean := True;
Support_Composite_Compare : constant Boolean := True;
Support_Long_Shifts   : constant Boolean := True;
@@ -163,13 +162,4 @@ private
Use_Ada_Main_Program_Name : constant Boolean := False;
ZCX_By_Default: constant Boolean := False;
 
-   --  Obsolete entries, to be removed eventually (bootstrap issues!)
-
-   Front_End_ZCX_Support : constant Boolean := False;
-   High_Integrity_Mode   : constant Boolean := False;
-   Long_Shifts_Inlined   : constant Boolean := True;
-   Functions_Return_By_DSP   : constant Boolean := False;
-   Support_64_Bit_Divides: constant Boolean := True;
-   GCC_ZCX_Support   : constant Boolean := False;
-
 end System;
-- 
1.7.11.2



Value type of map need not be default copyable

2012-08-02 Thread Ollie Wild
Patch courtesy Richard Smith at Google:

Fix bug in the implementation of std::map's operator[]. Construct an
object of type value_type, rather than using std::make_pair, so as to
allow mapped_type to have an *explicit* copy constructor.

See [map.access] (23.4.4.3)/5 for the corresponding standardese.

Tested via bootstrap + test.

Okay for trunk?

Thanks,
Ollie


2012-08-02  Ollie Wild  a...@google.com
Richard Smith  richardsm...@google.com

* include/bits/stl_map.h (operator[](key_type)): Replace
std::make_pair with value_type.
* testsuite/23_containers/map/operators/2.cc: New test.
diff --git a/libstdc++-v3/include/bits/stl_map.h 
b/libstdc++-v3/include/bits/stl_map.h
index cfd478a..a3abdd4 100644
--- a/libstdc++-v3/include/bits/stl_map.h
+++ b/libstdc++-v3/include/bits/stl_map.h
@@ -475,7 +475,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
iterator __i = lower_bound(__k);
// __i-first is greater than or equivalent to __k.
if (__i == end() || key_comp()(__k, (*__i).first))
-  __i = insert(__i, std::make_pair(std::move(__k), mapped_type()));
+  __i = insert(__i, value_type(std::move(__k), mapped_type()));
return (*__i).second;
   }
 #endif
diff --git a/libstdc++-v3/testsuite/23_containers/map/operators/2.cc 
b/libstdc++-v3/testsuite/23_containers/map/operators/2.cc
new file mode 100644
index 000..ce633d7
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/map/operators/2.cc
@@ -0,0 +1,38 @@
+// Copyright (C) 2012
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// http://www.gnu.org/licenses/.
+
+// 23.4.4 template class map
+
+// This test verifies that the value type of a map need not be default
+// copyable.
+
+// { dg-do compile }
+// { dg-options -std=gnu++11 }
+
+#include map
+
+struct Mapped {
+Mapped();
+explicit Mapped(const Mapped);
+};
+
+Mapped  foo()
+{
+  std::mapint, Mapped m;
+  return m[0];
+}


Re: PING [PATCH] Fix PR libstdc++/54036, problem negating DFP NaNs

2012-08-02 Thread Peter Bergner
On Thu, 02 Aug 2012 11:36:42 Paolo Carlini wrote:
  Also, is this ok for the 4.6 and 4.7 release branches?
 I don't think this is a regression, thus I would say 4.7 only, to be safe.

Ok.


 we don't have a separate ChangeLog in libstdc++-v3/testsuite/. Thus a 
 single ChangeLog entry for everything.

Fixed.


  Index: libstdc++-v3/testsuite/decimal/pr54036-1.cc
  ===
  --- libstdc++-v3/testsuite/decimal/pr54036-1.cc (revision 0)
  +++ libstdc++-v3/testsuite/decimal/pr54036-1.cc (revision 0)
  @@ -0,0 +1,56 @@
 Copyright blurb missing. Also, you need:
 
 // { dg-require-effective-target dfp }

Fixed.


 In the library testsuite we include:
 
 #include testsuite_hooks.h
 
 and then we use VERIFY not __builtin_abort. Also, for decimal, we 
 normally use:
 
 using namespace std::decimal.

Fixed.

Ok, once more with feeling! :)  How about the updated patched below?
...and thank you for the gentle review.  This is my first libstdc++
patch and I guess I was used to the normal gcc/testsuite/ tests
that don't include copyright headers and the like.  I'll try to
be more careful in the future.

Peter


libstdc++-v3/
PR libstdc++/54036
* include/decimal/decimal.h (_DEFINE_DECIMAL_UNARY_OP): Use _Op as
a unary operator.
* testsuite/decimal/pr54036-1.cc: New test.
* testsuite/decimal/pr54036-2.cc: Likewise.
* testsuite/decimal/pr54036-3.cc: Likewise.

Index: libstdc++-v3/include/decimal/decimal.h
===
--- libstdc++-v3/include/decimal/decimal.h  (revision 189599)
+++ libstdc++-v3/include/decimal/decimal.h  (working copy)
@@ -288,7 +288,7 @@
   inline _Tp operator _Op(_Tp __rhs)   \
   {\
 _Tp __tmp; \
-__tmp.__setval(0 _Op __rhs.__getval());\
+__tmp.__setval(_Op __rhs.__getval());  \
 return __tmp;  \
   }
 
Index: libstdc++-v3/testsuite/decimal/pr54036-1.cc
===
--- libstdc++-v3/testsuite/decimal/pr54036-1.cc (revision 0)
+++ libstdc++-v3/testsuite/decimal/pr54036-1.cc (revision 0)
@@ -0,0 +1,70 @@
+// Copyright (C) 2012 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// http://www.gnu.org/licenses/.
+
+// { dg-require-effective-target dfp }
+
+#include decimal/decimal
+#include testsuite_hooks.h
+
+using namespace std::decimal;
+
+decimal32
+__attribute__ ((noinline))
+my_nan32 (void)
+{
+  decimal32 z = 0;
+  decimal32 v = z/z;
+  return v;
+}
+
+decimal32
+__attribute__ ((noinline))
+my_inf32 (void)
+{
+  decimal32 o = 1;
+  decimal32 z = 0;
+  decimal32 v = o/z;
+  return v;
+}
+
+int
+main (void)
+{
+  decimal32 v;
+
+  v = my_nan32 ();
+
+  VERIFY (__builtin_isnand32 (v.__getval ()));
+  VERIFY (!__builtin_signbitd32 (v.__getval ()))
+
+  v = -v;
+
+  VERIFY (__builtin_isnand32 (v.__getval ()));
+  VERIFY (__builtin_signbitd32 (v.__getval ()))
+
+  v = my_inf32 ();
+
+  VERIFY (__builtin_isinfd32 (v.__getval ()));
+  VERIFY (!__builtin_signbitd32 (v.__getval ()))
+
+  v = -v;
+
+  VERIFY (__builtin_isinfd32 (v.__getval ()));
+  VERIFY (__builtin_signbitd32 (v.__getval ()))
+
+  return 0;
+}
Index: libstdc++-v3/testsuite/decimal/pr54036-2.cc
===
--- libstdc++-v3/testsuite/decimal/pr54036-2.cc (revision 0)
+++ libstdc++-v3/testsuite/decimal/pr54036-2.cc (revision 0)
@@ -0,0 +1,70 @@
+// Copyright (C) 2012 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+//