Re: [PR50764, PATCH] Fix for ICE in maybe_record_trace_start with -fsched2-use-superblocks

2011-10-30 Thread Tom de Vries
On 10/29/2011 09:17 PM, Tom de Vries wrote:
> Richard,
> 
> I have a tentative fix for PR50764.
> 
> In the example from the test-case, -fsched2-use-superblocks moves an insn from
> block 4 to block 3.
> 
>2
>   bar
>|
> ---+-
>/ \
>   *   *
>   5 * 3
> abortbar
>   |
>   |
>   *
>   4
> return
> 
> 
> The insn has a REG_CFA_DEF_CFA note and is frame-related.
> ...
> (insn/f 51 50 52 4 (set (reg:DI 39 r10)
> (mem/c:DI (plus:DI (reg/f:DI 6 bp)
> (const_int -8 [0xfff8])) [3 S8 A8])) pr50764.c:13
> 62 {*movdi_internal_rex64}
>  (expr_list:REG_CFA_DEF_CFA (reg:DI 39 r10)
> (nil)))
> ...
> 
> This causes the assert in maybe_record_trace_start to trigger:
> ...
>   /* We ought to have the same state incoming to a given trace no
>matter how we arrive at the trace.  Anything else means we've
>got some kind of optimization error.  */
>   gcc_checking_assert (cfi_row_equal_p (cur_row, ti->beg_row));
> ...
> 
> The assert does not occur with -fno-tree-tail-merge, but that is due to the
> following:
> - -fsched-use-superblocks does not handle dead labels explicitly
> - -freorder-blocks introduces a dead label, which is not removed until after
>   sched2
> - -ftree-tail-merge makes a difference in which block -freorder-blocks
>   introduces the dead label. In the case of -ftree-tail-merge, the dead label
>   is introduced at the start of block 3, and block 3 and 4 end up in the same
>   ebb. In the case of -fno-tree-tail-merge, the dead label is introduced at 
> the
>   start of block 4, and block 3 and 4 don't end up in the same ebb.
> 
> attached untested patch fixes PR50764 in a similar way as the patch for 
> PR49994,
> which is also about an ICE in maybe_record_trace_start with
> -fsched2-use-superblocks.
> 
> The patch for PR49994 makes sure frame-related instructions are not moved past
> the following jump.
> 
> Attached patch makes sure frame-related instructions are not moved past the
> preceding jump.
> 
> Is this the way to fix this PR?
> 

Bootstrapped and reg-tested on x86_64.

Ok for trunk?

Thanks,
- Tom

> Thanks,
> - Tom
> 
> 2011-10-29  Tom de Vries  
> 
>   PR rtl-optimization/50764
>   * (sched_analyze_insn): Make sure frame-related insns are not moved past
>   preceding jump.
> 
> 
> 



[PATCH] Properly limit backwards label scanning in reorg.

2011-10-30 Thread David Miller

My check-gcc runs are completely dominated by the time it takes to
test compile.exp=20001226-1.c

On sparc when compiling this function at -O1 the lowest hanging fruit
is some sillyness in reorg.  It is trying to test a very specific
condition within a well contained code block, but the label scanning
is not constrained properly so things go haywire for large functions.

Specifically it is looking at:

INSN SEQ (delay_insn
  delay_slot_1
  ...)
...
NEXT
LABEL:
next_active_insn (NEXT)

and wants to scan backwards to find if LABEL exists, starting at
next_active_insn (NEXT), and if so are NEXT and delay_slot_1 equal
instructions (equal meaning rtx_equal_p()).

But it just does a blind prev_label() call which will happily scan all
the way to the beginning of the function.  Compilation of this
testcase at -O1 spends 1/3 of it's time in prev_insn ().

In this specific reorg check, there is no reason to scan further back
than INSN.

So I've added a limited scanning helper function to reorg.c for this
purpose and got rid of prev_insn entirely since there are no longer
any users.

Unfortunately, at -O2 this testcase causes exponential cost problems
which are beyond my skills to fix.  Specifically,
tail_merge_optimize() applies it's clusters and
iterate_fix_dominators() hits the worst case O(n) complexity of
et_splay for a CFG structured like this. :-/  %38 of the compilation
time is spent in et_splay().

Committed to trunk.

gcc/

* reorg.c (label_before_next_insn): New function.
(relax_delay_slots): Use it instead of prev_label.
* rtl.h (prev_label): Delete declaration.
* emit-rtl.c (prev_label): Remove.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@180674 
138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/ChangeLog  |7 +++
 gcc/emit-rtl.c |   15 ---
 gcc/reorg.c|   17 -
 gcc/rtl.h  |1 -
 4 files changed, 23 insertions(+), 17 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 0eb34e5..e9bda2b 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2011-10-30  David S. Miller  
+
+   * reorg.c (label_before_next_insn): New function.
+   (relax_delay_slots): Use it instead of prev_label.
+   * rtl.h (prev_label): Delete declaration.
+   * emit-rtl.c (prev_label): Remove.
+
 2011-10-30  Revital Eres  
 
* modulo-sched.c (generate_prolog_epilog): Mark prolog and epilog
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index 8465237..c2bc56b 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -3330,21 +3330,6 @@ next_label (rtx insn)
   return insn;
 }
 
-/* Return the last CODE_LABEL before the insn INSN, or 0 if there is none.  */
-
-rtx
-prev_label (rtx insn)
-{
-  while (insn)
-{
-  insn = PREV_INSN (insn);
-  if (insn == 0 || LABEL_P (insn))
-   break;
-}
-
-  return insn;
-}
-
 /* Return the last label to mark the same position as LABEL.  Return LABEL
itself if it is null or any return rtx.  */
 
diff --git a/gcc/reorg.c b/gcc/reorg.c
index f77a3a0..40d73a7 100644
--- a/gcc/reorg.c
+++ b/gcc/reorg.c
@@ -3349,6 +3349,21 @@ delete_jump (rtx insn)
 delete_computation (insn);
 }
 
+static rtx
+label_before_next_insn (rtx x, rtx scan_limit)
+{
+  rtx insn = next_active_insn (x);
+  while (insn)
+{
+  insn = PREV_INSN (insn);
+  if (insn == scan_limit || insn == NULL_RTX)
+   return NULL_RTX;
+  if (LABEL_P (insn))
+   break;
+}
+  return insn;
+}
+
 
 /* Once we have tried two ways to fill a delay slot, make a pass over the
code to try to improve the results and to do such things as more jump
@@ -3634,7 +3649,7 @@ relax_delay_slots (rtx first)
 identical to the one in its delay slot.  In this case, we can just
 delete the branch and the insn in its delay slot.  */
   if (next && NONJUMP_INSN_P (next)
- && prev_label (next_active_insn (next)) == target_label
+ && label_before_next_insn (next, insn) == target_label
  && simplejump_p (insn)
  && XVECLEN (pat, 0) == 2
  && rtx_equal_p (PATTERN (next), PATTERN (XVECEXP (pat, 0, 1
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 81958a5..41536be 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -1812,7 +1812,6 @@ extern rtx next_real_insn (rtx);
 extern rtx prev_active_insn (rtx);
 extern rtx next_active_insn (rtx);
 extern int active_insn_p (const_rtx);
-extern rtx prev_label (rtx);
 extern rtx next_label (rtx);
 extern rtx skip_consecutive_labels (rtx);
 extern rtx next_cc0_user (rtx);
-- 
1.7.6.401.g6a319



Re: [Patch, fortran] [06/66] inline sum and product: Prepare gfc_trans_preloop_setup

2011-10-30 Thread Paul Richard Thomas
Dear Mikael,

I intend to work my way through your patches, starting this evening.
I'll give you feedback as I go along and will OK the whole package,
rather than bits.  Is that alright with you?

Cheers

Paul

On Fri, Oct 28, 2011 at 1:29 AM, Mikael Morin  wrote:
>



-- 
The knack of flying is learning how to throw yourself at the ground and miss.
       --Hitchhikers Guide to the Galaxy


[PR50878, PATCH] Fix for verify_dominators in -ftree-tail-merge

2011-10-30 Thread Tom de Vries
Richard,

I have a fix for PR50878.

A simplified form of the problem from the test-case of the PR is shown in this
cfg. Block 12 has as direct dominator block 5.

5
   / \
  /   \
 * *
 6 7
 | |
 | |
 * *
 8 9
  \   /
   \ /
*
   12

tail_merge_optimize finds that blocks 6 and 7 are duplicates. After replacing
block 7 by block 6, the cfg looks like this:

5
|
|
*
6
   / \
  /   \
 * *
 8 9
  \   /
   \ /
*
   12

The new direct dominator of block 12 is block 6, but the current algorithm only
recalculates dominator info for blocks 6, 8 and 9.

The patch fixes this by additionally recalculating the dominator info for blocks
immediately dominated by bb2 (block 6 in the example), if bb2 has a single
predecessor after replacement.

Bootstapped and reg-tested on x86_64 and i686. Build and reg-tested on MIPS and 
ARM.

Ok for trunk?

Thanks,
- Tom

2011-10-30  Tom de Vries  

PR tree-optimization/50878
* tree-ssa-tail-merge.c (replace_block_by): Recalculate dominator info
for blocks immediately dominated by bb2, if bb2 has a single predecessor
after replacement.



Re: [PR50878, PATCH] Fix for verify_dominators in -ftree-tail-merge

2011-10-30 Thread Tom de Vries
On 10/30/2011 09:20 AM, Tom de Vries wrote:
> Richard,
> 
> I have a fix for PR50878.

Sorry, with patch this time.

Thanks,
- Tom

> 
> A simplified form of the problem from the test-case of the PR is shown in this
> cfg. Block 12 has as direct dominator block 5.
> 
> 5
>/ \
>   /   \
>  * *
>  6 7
>  | |
>  | |
>  * *
>  8 9
>   \   /
>\ /
> *
>12
> 
> tail_merge_optimize finds that blocks 6 and 7 are duplicates. After replacing
> block 7 by block 6, the cfg looks like this:
> 
> 5
> |
> |
> *
> 6
>/ \
>   /   \
>  * *
>  8 9
>   \   /
>\ /
> *
>12
> 
> The new direct dominator of block 12 is block 6, but the current algorithm 
> only
> recalculates dominator info for blocks 6, 8 and 9.
> 
> The patch fixes this by additionally recalculating the dominator info for 
> blocks
> immediately dominated by bb2 (block 6 in the example), if bb2 has a single
> predecessor after replacement.
> 
> Bootstapped and reg-tested on x86_64 and i686. Build and reg-tested on MIPS 
> and ARM.
> 
> Ok for trunk?
> 
> Thanks,
> - Tom
> 
> 2011-10-30  Tom de Vries  
> 
>   PR tree-optimization/50878
>   * tree-ssa-tail-merge.c (replace_block_by): Recalculate dominator info
>   for blocks immediately dominated by bb2, if bb2 has a single predecessor
>   after replacement.

Index: gcc/tree-ssa-tail-merge.c
===
--- gcc/tree-ssa-tail-merge.c (revision 180562)
+++ gcc/tree-ssa-tail-merge.c (working copy)
@@ -1604,7 +1604,10 @@ replace_block_by (basic_block bb1, basic
   same_succ_flush_bb (bb1);
   delete_basic_block (bb1);
 
-  fix_dom_bb = VEC_alloc (basic_block, heap, 2);
+  if (single_pred_p (bb2))
+fix_dom_bb = get_dominated_by (CDI_DOMINATORS, single_pred (bb2));
+  else
+fix_dom_bb = VEC_alloc (basic_block, heap, 2);
   VEC_safe_push (basic_block, heap, fix_dom_bb, bb2);
   FOR_EACH_EDGE (e, ei, bb2->succs)
 VEC_safe_push (basic_block, heap, fix_dom_bb, e->dest);


Re: [PATCH] Pattern recognize shifts with different rhs1/rhs2 types

2011-10-30 Thread Ira Rosen
On 28 October 2011 20:44, Jakub Jelinek  wrote:
> Hi!

Hi,

>
> This patch implements what I've talked about, with this we can now
> with -mavx2 as well as -mxop vectorize long long/unsigned long long
> shifts by int or long long/unsigned long long shifts by long long
> (where the FE casts it to int first).  Already covered by the *vshift-*
> testcases I've committed recently (eyeballed for -mxop plus link tested,
> for -mavx2 tested on sde).
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

OK.

Thanks,
Ira

>
> 2011-10-28  Jakub Jelinek  
>
>        * tree-vectorizer.h (NUM_PATTERNS): Bump to 9.
>        * tree-vect-patterns.c (vect_recog_vector_vector_shift_pattern): New
>        function.
>        (vect_vect_recog_func_ptrs): Add it.
>
> --- gcc/tree-vectorizer.h.jj    2011-10-27 08:42:51.0 +0200
> +++ gcc/tree-vectorizer.h       2011-10-28 16:26:30.0 +0200
> @@ -902,7 +902,7 @@ extern void vect_slp_transform_bb (basic
>    Additional pattern recognition functions can (and will) be added
>    in the future.  */
>  typedef gimple (* vect_recog_func_ptr) (VEC (gimple, heap) **, tree *, tree 
> *);
> -#define NUM_PATTERNS 8
> +#define NUM_PATTERNS 9
>  void vect_pattern_recog (loop_vec_info);
>
>  /* In tree-vectorizer.c.  */
> --- gcc/tree-vect-patterns.c.jj 2011-10-26 14:19:11.0 +0200
> +++ gcc/tree-vect-patterns.c    2011-10-28 17:41:26.0 +0200
> @@ -51,6 +51,8 @@ static gimple vect_recog_over_widening_p
>                                                  tree *);
>  static gimple vect_recog_widen_shift_pattern (VEC (gimple, heap) **,
>                                        tree *, tree *);
> +static gimple vect_recog_vector_vector_shift_pattern (VEC (gimple, heap) **,
> +                                                     tree *, tree *);
>  static gimple vect_recog_mixed_size_cond_pattern (VEC (gimple, heap) **,
>                                                  tree *, tree *);
>  static gimple vect_recog_bool_pattern (VEC (gimple, heap) **, tree *, tree 
> *);
> @@ -61,6 +63,7 @@ static vect_recog_func_ptr vect_vect_rec
>        vect_recog_pow_pattern,
>        vect_recog_over_widening_pattern,
>        vect_recog_widen_shift_pattern,
> +       vect_recog_vector_vector_shift_pattern,
>        vect_recog_mixed_size_cond_pattern,
>        vect_recog_bool_pattern};
>
> @@ -1439,6 +1442,133 @@ vect_recog_widen_shift_pattern (VEC (gim
>   return pattern_stmt;
>  }
>
> +/* Detect a vector by vector shift pattern that wouldn't be otherwise
> +   vectorized:
> +
> +   type a_t;
> +   TYPE b_T, res_T;
> +
> +   S1 a_t = ;
> +   S2 b_T = ;
> +   S3 res_T = b_T op a_t;
> +
> +  where type 'TYPE' is a type with different size than 'type',
> +  and op is <<, >> or rotate.
> +
> +  Also detect cases:
> +
> +   type a_t;
> +   TYPE b_T, c_T, res_T;
> +
> +   S0 c_T = ;
> +   S1 a_t = (type) c_T;
> +   S2 b_T = ;
> +   S3 res_T = b_T op a_t;
> +
> +  Input/Output:
> +
> +  * STMTS: Contains a stmt from which the pattern search begins,
> +    i.e. the shift/rotate stmt.  The original stmt (S3) is replaced
> +    with a shift/rotate which has same type on both operands, in the
> +    second case just b_T op c_T, in the first case with added cast
> +    from a_t to c_T in STMT_VINFO_PATTERN_DEF_STMT.
> +
> +  Output:
> +
> +  * TYPE_IN: The type of the input arguments to the pattern.
> +
> +  * TYPE_OUT: The type of the output of this pattern.
> +
> +  * Return value: A new stmt that will be used to replace the shift/rotate
> +    S3 stmt.  */
> +
> +static gimple
> +vect_recog_vector_vector_shift_pattern (VEC (gimple, heap) **stmts,
> +                                       tree *type_in, tree *type_out)
> +{
> +  gimple last_stmt = VEC_pop (gimple, *stmts);
> +  tree oprnd0, oprnd1, lhs, var;
> +  gimple pattern_stmt, def_stmt;
> +  enum tree_code rhs_code;
> +  stmt_vec_info stmt_vinfo = vinfo_for_stmt (last_stmt);
> +  loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_vinfo);
> +  enum vect_def_type dt;
> +  tree def;
> +
> +  if (!is_gimple_assign (last_stmt))
> +    return NULL;
> +
> +  rhs_code = gimple_assign_rhs_code (last_stmt);
> +  switch (rhs_code)
> +    {
> +    case LSHIFT_EXPR:
> +    case RSHIFT_EXPR:
> +    case LROTATE_EXPR:
> +    case RROTATE_EXPR:
> +      break;
> +    default:
> +      return NULL;
> +    }
> +
> +  if (STMT_VINFO_IN_PATTERN_P (stmt_vinfo))
> +    return NULL;
> +
> +  lhs = gimple_assign_lhs (last_stmt);
> +  oprnd0 = gimple_assign_rhs1 (last_stmt);
> +  oprnd1 = gimple_assign_rhs2 (last_stmt);
> +  if (TREE_CODE (oprnd0) != SSA_NAME
> +      || TREE_CODE (oprnd1) != SSA_NAME
> +      || TYPE_MODE (TREE_TYPE (oprnd0)) == TYPE_MODE (TREE_TYPE (oprnd1))
> +      || TYPE_PRECISION (TREE_TYPE (oprnd1))
> +        != GET_MODE_PRECISION (TYPE_MODE (TREE_TYPE (oprnd1)))
> +      || TYPE_PRECISION (TREE_TYPE (lhs))
> +        != TYPE_PRECISION (TREE_TYPE (oprnd0)))
> +    return NULL;
> +
> +  if (!vect_is_simple_use (op

Re: [PATCH] Fix early inliner inlining uninlinable functions

2011-10-30 Thread Richard Guenther
On Sat, Oct 29, 2011 at 2:36 AM, Maxim Kuvyrkov  wrote:
> On 29/10/2011, at 1:57 AM, Richard Guenther wrote:
>
>>
>> We fail to keep the cannot-inline flag up-to-date when turning
>> indirect to direct calls.  The following patch arranges to do
>> this during statement folding (which should always be called
>> when that happens).  It also makes sure to copy the updated flag
>> to the edge when iterating early inlining.
>>
>> Bootstrap and regtest running on x86_64-unknown-linux-gnu, ok?
>
> The patch looks good to me, but I'm not a reviewer.  A couple of notes below.
>
>>
>> !   /* Check whether propagating into the function address made the
>> !      call direct, and thus possibly non-inlineable.
>> !      ???  This asks for a more conservative setting of the non-inlinable
>> !      flag, namely true for all indirect calls.  But that would require
>> !      that we can re-compute the flag conservatively, thus it isn't
>> !      ever initialized from something else than return/argument type
>> !      checks .  */
>> !   callee = gimple_call_fndecl (stmt);
>> !   if (callee
>> !       && !gimple_check_call_matching_types (stmt, callee))
>> !     gimple_call_set_cannot_inline (stmt, true);
>
> Don't you need to use cgraph_function_or_thunk_node wrapper here?

No, we are looking at a call statement - all clones whould have the same
function signature.

>> Index: gcc/ipa-inline.c
>> ===
>> *** gcc/ipa-inline.c  (revision 180608)
>> --- gcc/ipa-inline.c  (working copy)
>> *** early_inliner (void)
>> *** 1949,1954 
>> --- 1949,1956 
>>               = estimate_num_insns (edge->call_stmt, &eni_size_weights);
>>             es->call_stmt_time
>>               = estimate_num_insns (edge->call_stmt, &eni_time_weights);
>> +           edge->call_stmt_cannot_inline_p
>> +             = gimple_call_cannot_inline_p (edge->call_stmt);
>
> Wouldn't ipa_make_edge_direct or cgraph_make_edge_direct be a better place 
> for this?

Not without major reorganization (thus, try to keep the cgraph intact
during scalar opts).
We never arrange to call those function during inlining.

Richard.

>
> Thank you,
>
> --
> Maxim Kuvyrkov
> CodeSourcery / Mentor Graphics
>
>
>
>
>


Re: [PATCH] Properly limit backwards label scanning in reorg.

2011-10-30 Thread Richard Guenther
On Sun, Oct 30, 2011 at 8:49 AM, David Miller  wrote:
>
> My check-gcc runs are completely dominated by the time it takes to
> test compile.exp=20001226-1.c
>
> On sparc when compiling this function at -O1 the lowest hanging fruit
> is some sillyness in reorg.  It is trying to test a very specific
> condition within a well contained code block, but the label scanning
> is not constrained properly so things go haywire for large functions.
>
> Specifically it is looking at:
>
>        INSN SEQ (delay_insn
>                  delay_slot_1
>                  ...)
>        ...
>        NEXT
> LABEL:
>        next_active_insn (NEXT)
>
> and wants to scan backwards to find if LABEL exists, starting at
> next_active_insn (NEXT), and if so are NEXT and delay_slot_1 equal
> instructions (equal meaning rtx_equal_p()).
>
> But it just does a blind prev_label() call which will happily scan all
> the way to the beginning of the function.  Compilation of this
> testcase at -O1 spends 1/3 of it's time in prev_insn ().
>
> In this specific reorg check, there is no reason to scan further back
> than INSN.
>
> So I've added a limited scanning helper function to reorg.c for this
> purpose and got rid of prev_insn entirely since there are no longer
> any users.
>
> Unfortunately, at -O2 this testcase causes exponential cost problems
> which are beyond my skills to fix.  Specifically,
> tail_merge_optimize() applies it's clusters and
> iterate_fix_dominators() hits the worst case O(n) complexity of
> et_splay for a CFG structured like this. :-/  %38 of the compilation
> time is spent in et_splay().

Yeah, iteratively re-computing dominators can be expensive.  Tom,
can't you avoid that (thus, do you know how the dominance relation
changes?)

Richard.

> Committed to trunk.
>
> gcc/
>
>        * reorg.c (label_before_next_insn): New function.
>        (relax_delay_slots): Use it instead of prev_label.
>        * rtl.h (prev_label): Delete declaration.
>        * emit-rtl.c (prev_label): Remove.
>
> git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@180674 
> 138bc75d-0d04-0410-961f-82ee72b054a4
> ---
>  gcc/ChangeLog  |    7 +++
>  gcc/emit-rtl.c |   15 ---
>  gcc/reorg.c    |   17 -
>  gcc/rtl.h      |    1 -
>  4 files changed, 23 insertions(+), 17 deletions(-)
>
> diff --git a/gcc/ChangeLog b/gcc/ChangeLog
> index 0eb34e5..e9bda2b 100644
> --- a/gcc/ChangeLog
> +++ b/gcc/ChangeLog
> @@ -1,3 +1,10 @@
> +2011-10-30  David S. Miller  
> +
> +       * reorg.c (label_before_next_insn): New function.
> +       (relax_delay_slots): Use it instead of prev_label.
> +       * rtl.h (prev_label): Delete declaration.
> +       * emit-rtl.c (prev_label): Remove.
> +
>  2011-10-30  Revital Eres  
>
>        * modulo-sched.c (generate_prolog_epilog): Mark prolog and epilog
> diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
> index 8465237..c2bc56b 100644
> --- a/gcc/emit-rtl.c
> +++ b/gcc/emit-rtl.c
> @@ -3330,21 +3330,6 @@ next_label (rtx insn)
>   return insn;
>  }
>
> -/* Return the last CODE_LABEL before the insn INSN, or 0 if there is none.  
> */
> -
> -rtx
> -prev_label (rtx insn)
> -{
> -  while (insn)
> -    {
> -      insn = PREV_INSN (insn);
> -      if (insn == 0 || LABEL_P (insn))
> -       break;
> -    }
> -
> -  return insn;
> -}
> -
>  /* Return the last label to mark the same position as LABEL.  Return LABEL
>    itself if it is null or any return rtx.  */
>
> diff --git a/gcc/reorg.c b/gcc/reorg.c
> index f77a3a0..40d73a7 100644
> --- a/gcc/reorg.c
> +++ b/gcc/reorg.c
> @@ -3349,6 +3349,21 @@ delete_jump (rtx insn)
>     delete_computation (insn);
>  }
>
> +static rtx
> +label_before_next_insn (rtx x, rtx scan_limit)
> +{
> +  rtx insn = next_active_insn (x);
> +  while (insn)
> +    {
> +      insn = PREV_INSN (insn);
> +      if (insn == scan_limit || insn == NULL_RTX)
> +       return NULL_RTX;
> +      if (LABEL_P (insn))
> +       break;
> +    }
> +  return insn;
> +}
> +
>
>  /* Once we have tried two ways to fill a delay slot, make a pass over the
>    code to try to improve the results and to do such things as more jump
> @@ -3634,7 +3649,7 @@ relax_delay_slots (rtx first)
>         identical to the one in its delay slot.  In this case, we can just
>         delete the branch and the insn in its delay slot.  */
>       if (next && NONJUMP_INSN_P (next)
> -         && prev_label (next_active_insn (next)) == target_label
> +         && label_before_next_insn (next, insn) == target_label
>          && simplejump_p (insn)
>          && XVECLEN (pat, 0) == 2
>          && rtx_equal_p (PATTERN (next), PATTERN (XVECEXP (pat, 0, 1
> diff --git a/gcc/rtl.h b/gcc/rtl.h
> index 81958a5..41536be 100644
> --- a/gcc/rtl.h
> +++ b/gcc/rtl.h
> @@ -1812,7 +1812,6 @@ extern rtx next_real_insn (rtx);
>  extern rtx prev_active_insn (rtx);
>  extern rtx next_active_insn (rtx);
>  extern int active_insn_p (const_rtx);
> -extern rtx prev_label (rtx);
>  extern rtx next_label (rtx);
>  extern rtx skip_consecut

Re: [PR50878, PATCH] Fix for verify_dominators in -ftree-tail-merge

2011-10-30 Thread Richard Guenther
On Sun, Oct 30, 2011 at 9:27 AM, Tom de Vries  wrote:
> On 10/30/2011 09:20 AM, Tom de Vries wrote:
>> Richard,
>>
>> I have a fix for PR50878.
>
> Sorry, with patch this time.

Ok for now, but see Davids mail and the complexity issue with iteratively
updating dominators.  It seems to me that we know exactly what to update
and how, and we should do that (well, if we need up-to-date dominators,
re-computing them once in the pass would be ok).

Richard.

> Thanks,
> - Tom
>
>>
>> A simplified form of the problem from the test-case of the PR is shown in 
>> this
>> cfg. Block 12 has as direct dominator block 5.
>>
>>         5
>>        / \
>>       /   \
>>      *     *
>>      6     7
>>      |     |
>>      |     |
>>      *     *
>>      8     9
>>       \   /
>>        \ /
>>         *
>>        12
>>
>> tail_merge_optimize finds that blocks 6 and 7 are duplicates. After replacing
>> block 7 by block 6, the cfg looks like this:
>>
>>         5
>>         |
>>         |
>>         *
>>         6
>>        / \
>>       /   \
>>      *     *
>>      8     9
>>       \   /
>>        \ /
>>         *
>>        12
>>
>> The new direct dominator of block 12 is block 6, but the current algorithm 
>> only
>> recalculates dominator info for blocks 6, 8 and 9.
>>
>> The patch fixes this by additionally recalculating the dominator info for 
>> blocks
>> immediately dominated by bb2 (block 6 in the example), if bb2 has a single
>> predecessor after replacement.
>>
>> Bootstapped and reg-tested on x86_64 and i686. Build and reg-tested on MIPS 
>> and ARM.
>>
>> Ok for trunk?
>>
>> Thanks,
>> - Tom
>>
>> 2011-10-30  Tom de Vries  
>>
>>       PR tree-optimization/50878
>>       * tree-ssa-tail-merge.c (replace_block_by): Recalculate dominator info
>>       for blocks immediately dominated by bb2, if bb2 has a single 
>> predecessor
>>       after replacement.
>
>


New Japanese PO file for 'gcc' (version 4.6.1)

2011-10-30 Thread Translation Project Robot
Hello, gentle maintainer.

This is a message from the Translation Project robot.

A revised PO file for textual domain 'gcc' has been submitted
by the Japanese team of translators.  The file is available at:

http://translationproject.org/latest/gcc/ja.po

(This file, 'gcc-4.6.1.ja.po', has just now been sent to you in
a separate email.)

All other PO files for your package are available in:

http://translationproject.org/latest/gcc/

Please consider including all of these in your next release, whether
official or a pretest.

Whenever you have a new distribution with a new version number ready,
containing a newer POT file, please send the URL of that distribution
tarball to the address below.  The tarball may be just a pretest or a
snapshot, it does not even have to compile.  It is just used by the
translators when they need some extra translation context.

The following HTML page has been updated:

http://translationproject.org/domain/gcc.html

If any question arises, please contact the translation coordinator.

Thank you for all your work,

The Translation Project robot, in the
name of your translation coordinator.




Re: PING: [C++-11 PATCH] Trailing comma in enum

2011-10-30 Thread Magnus Fromreide
On Sat, 2011-10-29 at 20:48 +0300, Ville Voutilainen wrote:
> >Could someone please review this?
> 
> +   if (cxx_dialect < cxx0x && !in_system_header)
> + pedwarn (input_location, OPT_pedantic,
> + "comma at end of enumerator list");
> 
> Why not use maybe_warn_cpp0x there?

maybe_warn_cpp0x seems to handle cases were C++11 extensions are used
but in this case a GNU extension is adopted by the standard so I wanted
to make a minimal change.

Attached is a variation where maybe_warn_cpp0x is used.

Please note how my new pedwarn breaks the pattern in maybe_warn_cpp0x.

One could of course imagine changing the message to something like

"comma at end of enumerator list is not a warning " \
"with -std=c++0x or -std=gnu++0x"

but it still stands out as different in that function so I do not
know...

/MF
Index: gcc/cp/error.c
===
--- gcc/cp/error.c	(revision 180672)
+++ gcc/cp/error.c	(working copy)
@@ -3255,6 +3255,10 @@
 		 "user-defined literals "
 		 "only available with -std=c++0x or -std=gnu++0x");
 	break;
+  case CPP0X_ENUM_TRAILING_COMMA:
+	pedwarn (input_location, OPT_pedantic,
+		 "comma at end of enumerator list");
+	break;
   default:
 	gcc_unreachable ();
   }
Index: gcc/cp/parser.c
===
--- gcc/cp/parser.c	(revision 180672)
+++ gcc/cp/parser.c	(working copy)
@@ -14058,6 +14058,7 @@
 
enum-specifier:
  enum-head { enumerator-list [opt] }
+ enum-head { enumerator-list , } [C++11]
 
enum-head:
  enum-key identifier [opt] enum-base [opt]
@@ -14077,6 +14078,8 @@
GNU Extensions:
  enum-key attributes[opt] identifier [opt] enum-base [opt] 
{ enumerator-list [opt] }attributes[opt]
+ enum-key attributes[opt] identifier [opt] enum-base [opt]
+   { enumerator-list , }attributes[opt] [C++11]
 
Returns an ENUM_TYPE representing the enumeration, or NULL_TREE
if the token stream isn't an enum-specifier after all.  */
@@ -14416,8 +14419,7 @@
   /* If the next token is a `}', there is a trailing comma.  */
   if (cp_lexer_next_token_is (parser->lexer, CPP_CLOSE_BRACE))
 	{
-	  if (!in_system_header)
-	pedwarn (input_location, OPT_pedantic, "comma at end of enumerator list");
+	  maybe_warn_cpp0x(CPP0X_ENUM_TRAILING_COMMA);
 	  break;
 	}
 }
Index: gcc/cp/cp-tree.h
===
--- gcc/cp/cp-tree.h	(revision 180672)
+++ gcc/cp/cp-tree.h	(working copy)
@@ -402,7 +402,9 @@
   /* non-static data member initializers */
   CPP0X_NSDMI,
   /* user defined literals */
-  CPP0X_USER_DEFINED_LITERALS
+  CPP0X_USER_DEFINED_LITERALS,
+  /* trailing comma in enumerations */
+  CPP0X_ENUM_TRAILING_COMMA
 } cpp0x_warn_str;
   
 /* The various kinds of operation used by composite_pointer_type. */
Index: gcc/testsuite/g++.dg/cpp0x/enum21a.C
===
--- gcc/testsuite/g++.dg/cpp0x/enum21a.C	(revision 0)
+++ gcc/testsuite/g++.dg/cpp0x/enum21a.C	(revision 0)
@@ -0,0 +1,4 @@
+// { dg-do compile }
+// { dg-options "-pedantic-errors -std=c++98" }
+
+enum x { y, }; // { dg-error "comma at end of enumerator list" }
Index: gcc/testsuite/g++.dg/cpp0x/enum21b.C
===
--- gcc/testsuite/g++.dg/cpp0x/enum21b.C	(revision 0)
+++ gcc/testsuite/g++.dg/cpp0x/enum21b.C	(revision 0)
@@ -0,0 +1,4 @@
+// { dg-do compile }
+// { dg-options "-pedantic-errors -std=c++0x" }
+
+enum x { y, };


Re: [PATCH, committed] Update wwwdocs for PR target/47272 fixes (altivec vec_ld/vec_st builtins)

2011-10-30 Thread Gerald Pfeifer
On Fri, 4 Feb 2011, Michael Meissner wrote:
> After updating the mainline and 4.5 trees with the fix for PR 
> target/47272 that restores vec_ld and vec_st to generate only Altivec 
> memory instructions, I added the following to the documentation:

Here are some minor editorial changes I applied on top of this.

(Note, re "On Power7 systems, there is a potential problem" I am
not sure it is clear to users what steps they need to take?)

Gerald

Index: gcc-4.5/changes.html
===
RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-4.5/changes.html,v
retrieving revision 1.102
diff -u -r1.102 changes.html
--- gcc-4.5/changes.html29 Oct 2011 19:51:21 -  1.102
+++ gcc-4.5/changes.html30 Oct 2011 12:53:23 -
@@ -877,7 +877,7 @@
 complete (that is, it is possible that some PRs that have been fixed
 are not listed here).
 
-On the PowerPC compiler, the altivec builtin functions vec_ld
+On the PowerPC compiler, the Altivec builtin functions vec_ld
 and vec_st have been modified to generate the Altivec memory
 instructions LVX and STVX, even if the
 -mvsx option is used.  In the initial GCC 4.5 release, these
Index: gcc-4.6/changes.html
===
RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-4.6/changes.html,v
retrieving revision 1.135
diff -u -r1.135 changes.html
--- gcc-4.6/changes.html29 Oct 2011 19:02:39 -  1.135
+++ gcc-4.6/changes.html30 Oct 2011 12:53:24 -
@@ -895,7 +895,7 @@
   for MODEL
   are small, medium,
   or large.
-The altivec builtin functions vec_ld and 
vec_st
+The Altivec builtin functions vec_ld and 
vec_st
   have been modified to generate the Altivec memory instructions
   LVX and STVX, even if the -mvsx
   option is used.  In the initial GCC 4.5 release, these builtin functions
@@ -1083,7 +1083,7 @@
 
 
 On Power7 systems, there is a potential problem if you build the GCC
-compiler with a host compiler using options that enables the VSX
+compiler with a host compiler using options that enable the VSX
 instruction set generation.  If the host compiler has been patched so that
 the vec_ld and vec_st builtin functions
 generate Altivec memory instructions instead of VSX memory instructions,


Re: building binutils from same directory as gcc

2011-10-30 Thread Gerald Pfeifer
I see this was not applied, and also did not get any review comments.

Let me add our build system maintainers. 

If something like this goes in, I suggest to avoid direct references
to SVN (which is a technical detail) and use something more generic
and spell GCC as opposed to gcc when it refers to the overall project.

My other note is that this is too complicated.  Why not just declare
that building from the same directory is not support and have one
simple set of instructions that always works, as opposed to "this
ought to work with snapshots but not with direct checkouts"?

Thoughts?

(If Steffen provides an updated patch based on this and/or your
feedback, I'll be happy to apply it if approved.)

Gerald

On Mon, 2 May 2011, Steffen Dettmer wrote:
>> A description of the problem/bug and how your patch addresses it.
> 
> Users of release tarballs could get confused how to build
> binutils and gcc and accidently attempt an undesired "combined
> build". The patch adds some explaining words.
> 
> 2011-05-02 Steffen Dettmer 
> 
>   * doc/install.texi (Downloading the Source): Recommended
>   not to build binutils in combined mode when using release
>   tarballs.
> 
> --- gcc-4.6.0.dist/gcc/doc/install.texi 2011-03-21 13:13:26.0 +0100
> +++ gcc-4.6.0/gcc/doc/install.texi  2011-05-02 14:39:01.0 +0200
> @@ -553,7 +553,17 @@
>  If you also intend to build binutils (either to upgrade an existing
>  installation or for use in place of the corresponding tools of your
>  OS), unpack the binutils distribution either in the same directory or
> -a separate one.  In the latter case, add symbolic links to any
> +a separate one. Using the same directory is not recommended for
> +building release tarballs of gcc, but if you obtained the sources
> +via SVN, it is reliable. Unpacking into the same directory means
> +that the contents of the (versioned) directories of binutils
> +and gcc are in one and the same directory (with subdirectories
> +like @file{gcc}, @file{binutils} and @file{gas}). Contents of the
> +directories common to and shared by gcc and binutils
> +(@file{include}, @file{libiberty} and @file{intl}) must be
> +compatible, making combined builds using standard releases hard
> +to get right.  In case you are using separate directories, which
> +is recommended, add symbolic links to any
>  components of the binutils you intend to build alongside the compiler
>  (@file{bfd}, @file{binutils}, @file{gas}, @file{gprof}, @file{ld},
>  @file{opcodes}, @dots{}) to the directory containing the GCC sources.
> 


[C++ patch] Use GNU/Linux in NEWS

2011-10-30 Thread Gerald Pfeifer
Installed based on a request by RMS.

Gerald


2011-10-25  Gerald Pfeifer  

* NEWS (GCC 2.95): Refer to GNU/Linux instead of Linux.
(EGCS 1.0): Ditto.

Index: NEWS
===
--- NEWS(revision 180677)
+++ NEWS(working copy)
@@ -168,7 +168,7 @@
 
 * Unused virtual functions can be discarded on some targets by specifying
   -ffunction-sections -fvtable-gc to the compiler and --gc-sections to the
-  linker.  Unfortunately, this only works on Linux if you're linking
+  linker.  Unfortunately, this only works on GNU/Linux if you're linking
   statically.
 
 * Lots of bugs stomped.
@@ -343,7 +343,7 @@
   translation units.
 
 * -fvtable-thunks is supported for all targets, and is the default for
-  Linux with glibc 2.x (also called libc 6.x).
+  GNU/Linux with glibc 2.x (also called libc 6.x).
 
 * bool is now always the same size as another built-in type. Previously,
   a 64-bit RISC target using a 32-bit ABI would have 32-bit pointers and a



Re: [dwarf2out, elfos] Output assembly faster

2011-10-30 Thread Dimitrios Apostolou
Hello list, I updated this patch to latest trunk and also incorporated 
apinski's suggestion to use stpcpy() instead of a custom loop. 
Bootstrapped and tested again on i386, no regressions. The comments from 
my previous email still apply, I never got a reply:


On Mon, 22 Aug 2011, Dimitrios Apostolou wrote:

Hello again,

most of this patch was posted at the beginning of my GSOC adventure and 
primarily is about replacing fprintf() calls with custom faster ones. From 
that time I changed minor things you suggested, omitted some complexities 
that offered minor speed-up, and made the code as clear as possible, while 
following more closely coding guidelines.


Bootstrapped and tested on both i386 and x86_64, showing runtime improvement 
when compiling with debug info enabled.


The only thing I am not sure is the differentiation between HOST_WIDE_INT and 
long, so I provided two versions of the same function. Please let me know if 
I should handle this differently.



Future speedup in assembly generation *is possible* but requires more 
intrusive changes, maybe making assembly hard to read by human:

* Always use hex numbers, they are much faster to produce
* Call GNU assembler with -s parameter, though it's pretty hard to be 
compliant.
* Even further in the future we could generate binary data, if we *know* the 
assembler is GAS.




Slightly more descriptive changelog:

2011-08-12  Dimitrios Apostolou  

* final.c, output.h (fprint_whex, fprint_w, fprint_ul, sprint_ul):
New functions serving as fast replacements for fprintf() integer
to string conversions. They were used in the following changes.
* final.c (sprint_ul_rev): Internal helper for the above.
(output_addr_const): case CONST_INT: don't use fprintf().
* elfos.h (ASM_GENERATE_INTERNAL_LABEL): Don't use sprintf("%u"),
use sprint_ul() and stpcpy() which are much faster.
(TARGET_ASM_INTERNAL_LABEL): Define as default_elf_internal_label.
(ELF_ASCII_ESCAPES, ELF_STRING_LIMIT): Are the old ESCAPES and
STRING_LIMIT macros.
(ASM_OUTPUT_LIMITED_STRING, ASM_OUTPUT_ASCII): Macros now just
call respective functions that provide the same
functionality. Those are default_elf_asm_output_limited_string()
and default_elf_asm_output_ascii() in varasm.c.
* varasm.c: Fixed some whitespace inconsistencies.
(default_elf_asm_output_limited_string)
(default_elf_asm_output_ascii): The above macros from elfos.h are
implemented here as these functions, avoiding superfluous calls to
fprintf().
(default_elf_internal_label): Hook for
targetm.asm_out.internal_label and ASM_OUTPUT_DEBUG_LABEL.
* i386.c: Don't call fprintf("%u") but fprint_ul() instead.
* defaults.h (ASM_OUTPUT_LABEL, ASM_OUTPUT_INTERNAL_LABEL):
Expanded the macros on multiple lines for readability.
(ASM_OUTPUT_LABELREF): Have two calls to fputs() instead of one to
asm_fprintf().
* dwarf2asm.c (dw2_assemble_integer, dw2_asm_output_data)
(dw2_asm_data_uleb128, dw2_asm_delta_uleb128)
(dw2_asm_delta_sleb128): Convert fprintf() calls to the new
faster functions.
* dwarf2out.c (dwarf2out_source_line): Convert fprintf() calls to
the new faster functions.


I had measured during the summer ([1] before, [2] after, if necessary I'll 
refresh measurements) that this gives a good 2-3% improvement, especially 
when debug info is enabled. Major obstacle was that it made code less 
readable but I think the new function names are more understandable.


[1] 
http://gcc.gnu.org/wiki/OptimisingGCC?action=AttachFile&do=view&target=4.6.0-baseline_prof.txt
[2] 
http://gcc.gnu.org/wiki/OptimisingGCC?action=AttachFile&do=view&target=4.6.0-changed1_prof.txt

Jakub, you had raised concerns that it's better to avoid this optimisation 
completely and make gcc always optimise fprintf("%d") calls, to keep the 
code readable. Do you think that's the case still?


I appreciate all comments,
Dimitris


P.S. Cc'd i386 backend maintainers=== modified file 'gcc/config/elfos.h'
--- gcc/config/elfos.h  2010-11-21 00:54:14 +
+++ gcc/config/elfos.h  2011-10-29 22:57:35 +
@@ -117,10 +117,17 @@ see the files COPYING3 and COPYING.RUNTI
 #define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM)\
   do   \
 {  \
-  sprintf (LABEL, "*.%s%u", PREFIX, (unsigned) (NUM)); \
+  char *__p;   \
+  (LABEL)[0] = '*';\
+  (LABEL)[1] = '.';\
+  __p = stpcpy (&(LABEL)[2], PREFIX);  \
+  sprint_ul (__p, (unsigned long) (NUM));  \
 }   

[libstdc++] Adjust Linux references in the libstdc++ FAQ

2011-10-30 Thread Gerald Pfeifer
Applied.  Busy work on a foggy October afternoon...

Gerald


2011-10-30  Gerald Pfeifer  

* faq.xml (Who's in charge of it?): Refer to the Linux kernel
instead of just Linux.
(How do I install libstdc++?): Refer to GNU/Linux instead of
just Linux.

Index: doc/xml/faq.xml
===
--- doc/xml/faq.xml (revision 180677)
+++ doc/xml/faq.xml (working copy)
@@ -87,7 +87,7 @@
   
 
  The libstdc++ project is contributed to by several developers
- all over the world, in the same way as GCC or Linux.
+ all over the world, in the same way as GCC or the Linux kernel.
  Benjamin Kosnik, Gabriel Dos Reis, Phil Edwards, Ulrich Drepper,
  Loren James Rittle, and Paolo Carlini are the lead maintainers of
  the SVN archive.
@@ -261,7 +261,7 @@
   
 
 Often libstdc++ comes pre-installed as an integral part of many
-existing Linux and Unix systems, as well as many embedded
+existing GNU/Linux and Unix systems, as well as many embedded
 development tools. It may be necessary to install extra
 development packages to get the headers, or the documentation, or
 the source: please consult your vendor for details.



[committed] Avoid common in some tests on hppa*-*-hpux*

2011-10-30 Thread John David Anglin
Add -fno-common to some more tests on hppa*-*-hpux* to avoid limited
alignment capabilities.

Tested on hppa2.0w-hp-hpux11.11.  Committed to trunk.

Dave
-- 
J. David Anglin  dave.ang...@nrc-cnrc.gc.ca
National Research Council of Canada  (613) 990-0752 (FAX: 952-6602)

2011-10-30  John David Anglin  

* gcc.dg/scal-to-vec2.c (dg-options): Add -fno-common to options on
hppa*-*-hpux*.
* gcc.dg/torture/vshuf-v8hi.c: Likewise.
* gcc.dg/torture/vshuf-v4si.c: Likewise.
* gcc.dg/torture/vshuf-v8si.c: Likewise.
* gcc.dg/torture/vshuf-v32qi.c: Likewise.
* gcc.dg/torture/vshuf-v4di.c: Likewise.
* gcc.dg/torture/vshuf-v2df.c: Likewise.
* gcc.dg/torture/vshuf-v16qi.c: Likewise.
* gcc.dg/torture/vshuf-v4sf.c: Likewise.
* gcc.dg/torture/vshuf-v8sf.c: Likewise.
* gcc.dg/torture/vshuf-v2di.c: Likewise.
* gcc.dg/torture/vshuf-v16hi.c: Likewise.
* gcc.dg/torture/vshuf-v4df.c: Likewise.
* gcc.dg/tree-ssa/ssa-fre-31.c: Likewise.
* gcc.dg/tree-ssa/ssa-fre-33.c: Likewise.
* gcc.dg/tree-ssa/ssa-fre-34.c: Likewise.
* gcc.dg/vector-compare-2.c: Likewise.

Index: gcc.dg/scal-to-vec2.c
===
--- gcc.dg/scal-to-vec2.c   (revision 180650)
+++ gcc.dg/scal-to-vec2.c   (working copy)
@@ -1,4 +1,5 @@
 /* { dg-do compile } */   
+/* { dg-options "-fno-common" { target hppa*-*-hpux* } } */
 
 /* Test for C_MAYBE_CONST are folded correctly when 
expanding an expression to vector.  */
Index: gcc.dg/torture/vshuf-v8hi.c
===
--- gcc.dg/torture/vshuf-v8hi.c (revision 180650)
+++ gcc.dg/torture/vshuf-v8hi.c (working copy)
@@ -1,5 +1,6 @@
 /* { dg-do run } */
 /* { dg-options "-DEXPENSIVE" { target run_expensive_tests } } */
+/* { dg-options "-fno-common" { target hppa*-*-hpux* } } */
 /* { dg-skip-if "" { ! run_expensive_tests } { "*" } { "-O2" } } */
 /* { dg-skip-if "" { ! run_expensive_tests } { "-flto" } { "" } } */
 
Index: gcc.dg/torture/vshuf-v4si.c
===
--- gcc.dg/torture/vshuf-v4si.c (revision 180650)
+++ gcc.dg/torture/vshuf-v4si.c (working copy)
@@ -1,5 +1,6 @@
 /* { dg-do run } */
 /* { dg-options "-DEXPENSIVE" { target run_expensive_tests } } */
+/* { dg-options "-fno-common" { target hppa*-*-hpux* } } */
 /* { dg-skip-if "" { ! run_expensive_tests } { "*" } { "-O2" } } */
 /* { dg-skip-if "" { ! run_expensive_tests } { "-flto" } { "" } } */
 
Index: gcc.dg/torture/vshuf-v8si.c
===
--- gcc.dg/torture/vshuf-v8si.c (revision 180650)
+++ gcc.dg/torture/vshuf-v8si.c (working copy)
@@ -1,5 +1,6 @@
 /* { dg-do run } */
 /* { dg-options "-DEXPENSIVE" { target run_expensive_tests } } */
+/* { dg-options "-fno-common" { target hppa*-*-hpux* } } */
 /* { dg-skip-if "" { ! run_expensive_tests } { "*" } { "-O2" } } */
 /* { dg-skip-if "" { ! run_expensive_tests } { "-flto" } { "" } } */
 
Index: gcc.dg/torture/vshuf-v32qi.c
===
--- gcc.dg/torture/vshuf-v32qi.c(revision 180650)
+++ gcc.dg/torture/vshuf-v32qi.c(working copy)
@@ -1,5 +1,6 @@
 /* { dg-do run } */
 /* { dg-options "-DEXPENSIVE" { target run_expensive_tests } } */
+/* { dg-options "-fno-common" { target hppa*-*-hpux* } } */
 /* { dg-skip-if "" { ! run_expensive_tests } { "*" } { "-O2" } } */
 /* { dg-skip-if "" { ! run_expensive_tests } { "-flto" } { "" } } */
 
Index: gcc.dg/torture/vshuf-v4di.c
===
--- gcc.dg/torture/vshuf-v4di.c (revision 180650)
+++ gcc.dg/torture/vshuf-v4di.c (working copy)
@@ -1,5 +1,6 @@
 /* { dg-do run } */
 /* { dg-options "-DEXPENSIVE" { target run_expensive_tests } } */
+/* { dg-options "-fno-common" { target hppa*-*-hpux* } } */
 /* { dg-skip-if "" { ! run_expensive_tests } { "*" } { "-O2" } } */
 /* { dg-skip-if "" { ! run_expensive_tests } { "-flto" } { "" } } */
 
Index: gcc.dg/torture/vshuf-v2df.c
===
--- gcc.dg/torture/vshuf-v2df.c (revision 180650)
+++ gcc.dg/torture/vshuf-v2df.c (working copy)
@@ -1,5 +1,6 @@
 /* { dg-do run } */
 /* { dg-options "-DEXPENSIVE" { target run_expensive_tests } } */
+/* { dg-options "-fno-common" { target hppa*-*-hpux* } } */
 /* { dg-skip-if "" { ! run_expensive_tests } { "*" } { "-O2" } } */
 /* { dg-skip-if "" { ! run_expensive_tests } { "-flto" } { "" } } */
 
Index: gcc.dg/torture/vshuf-v16qi.c
===
--- gcc.dg/torture/vshuf-v16qi.c(revision 180650)
+++ gcc.dg/torture/vshuf-v16qi.c(working copy)
@@ -1,5 +1,6 @@
 /* { dg-do run } */
 /* { dg-options "-DEXPENSIVE" { target run_expensive_test

[PATCH, i386]: Merge and macroize some more patterns

2011-10-30 Thread Uros Bizjak
Hello!

2011-10-30  Uros Bizjak  

* config/i386/i386.md (avx2_vec_dup): Macroize insn from
avx2_vec_dup{v8sf,v4sf} using VF1 mode iterator.
(vec_dupv4sf): Remove expander.
(vec_dupv4sf): Merge from *vec_dupv4sf and *vec_dupv4sf_avx.
(vec_dupv2df): Remove expander.
(vec_dupv2df): Merge from *vec_dupv2df and *vec_dupv2df_sse3.
(*vec_concatv2df): Merge *vec_concatv2df_sse3.
(*vec_dupv4si): Merge *vec_dupv4si_avx.
(*vec_dupv2di): Merge *vec_dupv2di_sse3.

Bootstrapped and regression tested on x86_64-pc-linux-gnu
{,-m32,-mavx}, will be committed to mainline SVN soon.

Uros.
Index: sse.md
===
--- sse.md  (revision 180676)
+++ sse.md  (working copy)
@@ -3662,19 +3662,9 @@
(set_attr "prefix" "orig,vex")
(set_attr "mode" "SF")])
 
-(define_expand "vec_dupv4sf"
-  [(set (match_operand:V4SF 0 "register_operand" "")
-   (vec_duplicate:V4SF
- (match_operand:SF 1 "nonimmediate_operand" "")))]
-  "TARGET_SSE"
-{
-  if (!TARGET_AVX)
-operands[1] = force_reg (SFmode, operands[1]);
-})
-
-(define_insn "avx2_vec_dupv4sf"
-  [(set (match_operand:V4SF 0 "register_operand" "=x")
-   (vec_duplicate:V4SF
+(define_insn "avx2_vec_dup"
+  [(set (match_operand:VF1 0 "register_operand" "=x")
+   (vec_duplicate:VF1
  (vec_select:SF
(match_operand:V4SF 1 "register_operand" "x")
(parallel [(const_int 0)]]
@@ -3682,44 +3672,24 @@
   "vbroadcastss\t{%1, %0|%0, %1}"
   [(set_attr "type" "sselog1")
 (set_attr "prefix" "vex")
-(set_attr "mode" "V4SF")])
+(set_attr "mode" "")])
 
-(define_insn "*vec_dupv4sf_avx"
-  [(set (match_operand:V4SF 0 "register_operand" "=x,x")
+(define_insn "vec_dupv4sf"
+  [(set (match_operand:V4SF 0 "register_operand" "=x,x,x")
(vec_duplicate:V4SF
- (match_operand:SF 1 "nonimmediate_operand" "x,m")))]
-  "TARGET_AVX"
+ (match_operand:SF 1 "nonimmediate_operand" "x,m,0")))]
+  "TARGET_SSE"
   "@
vshufps\t{$0, %1, %1, %0|%0, %1, %1, 0}
-   vbroadcastss\t{%1, %0|%0, %1}"
-  [(set_attr "type" "sselog1,ssemov")
-   (set_attr "length_immediate" "1,0")
-   (set_attr "prefix_extra" "0,1")
-   (set_attr "prefix" "vex")
+   vbroadcastss\t{%1, %0|%0, %1}
+   shufps\t{$0, %0, %0|%0, %0, 0}"
+  [(set_attr "isa" "avx,avx,noavx")
+   (set_attr "type" "sselog1,ssemov,sselog1")
+   (set_attr "length_immediate" "1,0,1")
+   (set_attr "prefix_extra" "0,1,*")
+   (set_attr "prefix" "vex,vex,orig")
(set_attr "mode" "V4SF")])
 
-(define_insn "avx2_vec_dupv8sf"
-  [(set (match_operand:V8SF 0 "register_operand" "=x")
-   (vec_duplicate:V8SF
- (vec_select:SF
-   (match_operand:V4SF 1 "register_operand" "x")
-   (parallel [(const_int 0)]]
-  "TARGET_AVX2"
-  "vbroadcastss\t{%1, %0|%0, %1}"
-  [(set_attr "type" "sselog1")
-   (set_attr "prefix" "vex")
-   (set_attr "mode" "V8SF")])
-
-(define_insn "*vec_dupv4sf"
-  [(set (match_operand:V4SF 0 "register_operand" "=x")
-   (vec_duplicate:V4SF
- (match_operand:SF 1 "register_operand" "0")))]
-  "TARGET_SSE"
-  "shufps\t{$0, %0, %0|%0, %0, 0}"
-  [(set_attr "type" "sselog1")
-   (set_attr "length_immediate" "1")
-   (set_attr "mode" "V4SF")])
-
 ;; Although insertps takes register source, we prefer
 ;; unpcklps with register source since it is shorter.
 (define_insn "*vec_concatv2sf_sse4_1"
@@ -4820,69 +4790,43 @@
(set_attr "prefix" "orig,vex,orig,vex,maybe_vex,orig,orig,vex,maybe_vex")
(set_attr "mode" "DF,DF,V1DF,V1DF,V1DF,V2DF,V1DF,V1DF,V1DF")])
 
-(define_expand "vec_dupv2df"
-  [(set (match_operand:V2DF 0 "register_operand" "")
+(define_insn "vec_dupv2df"
+  [(set (match_operand:V2DF 0 "register_operand" "=x,x")
(vec_duplicate:V2DF
- (match_operand:DF 1 "nonimmediate_operand" "")))]
+ (match_operand:DF 1 "nonimmediate_operand" " 0,xm")))]
   "TARGET_SSE2"
-{
-  if (!TARGET_SSE3)
-operands[1] = force_reg (DFmode, operands[1]);
-})
-
-(define_insn "*vec_dupv2df_sse3"
-  [(set (match_operand:V2DF 0 "register_operand" "=x")
-   (vec_duplicate:V2DF
- (match_operand:DF 1 "nonimmediate_operand" "xm")))]
-  "TARGET_SSE3"
-  "%vmovddup\t{%1, %0|%0, %1}"
-  [(set_attr "type" "sselog1")
-   (set_attr "prefix" "maybe_vex")
-   (set_attr "mode" "DF")])
-
-(define_insn "*vec_dupv2df"
-  [(set (match_operand:V2DF 0 "register_operand" "=x")
-   (vec_duplicate:V2DF
- (match_operand:DF 1 "register_operand" "0")))]
-  "TARGET_SSE2"
-  "unpcklpd\t%0, %0"
-  [(set_attr "type" "sselog1")
+  "@
+   unpcklpd\t%0, %0
+   %vmovddup\t{%1, %0|%0, %1}"
+  [(set_attr "isa" "noavx,sse3")
+   (set_attr "type" "sselog1")
+   (set_attr "prefix" "orig,maybe_vex")
(set_attr "mode" "V2DF")])
 
-(define_insn "*vec_concatv2df_sse3"
-  [(set (match_operand:V2DF 0 "register_operand" "=x")
-   (vec_concat:V2DF
- (match_operand:DF 1 "nonimmediate_operand" "xm"

[libstdc++, doc] Update prerequisites documentation

2011-10-30 Thread Gerald Pfeifer
At first this was only triggered by Linux vs GNU/Linux, but then I
noticed GCC being lower-cased and the Red Hat Linux reference when
we actually do not support that old version of glibc anymore at all.

Committed to mainline.

Gerald

2011-10-30  Gerald Pfeifer  
 
* prerequisites.xml: Refer to GCC (instead of gcc) and GNU/Linux.
Remove an obsolete reference to a Red Hat release we do not
support any longer.
Refer to Debian GNU/Linux.

Index: doc/xml/manual/prerequisites.xml
===
--- doc/xml/manual/prerequisites.xml(revision 180677)
+++ doc/xml/manual/prerequisites.xml(working copy)
@@ -57,9 +57,9 @@
 


- If gcc 3.1.0 or later on is being used on linux, an attempt
+ If GCC 3.1.0 or later on is being used on GNU/Linux, an attempt
  will be made to use "C" library functionality necessary for
- C++ named locale support.  For gcc 4.6.0 and later, this
+ C++ named locale support.  For GCC 4.6.0 and later, this
  means that glibc 2.3 or later is required.

 
@@ -110,32 +110,12 @@
   

  install all locales
- 
-   
- with RedHat Linux:
- 
-   export LC_ALL=C 
- 
-   rpm -e glibc-common --nodeps 
- 
- 
-rpm -i --define "_install_langs all"
-glibc-common-2.2.5-34.i386.rpm
-   
- 
-   
-
-
-  Instructions for other operating systems solicited.
-
-
- 


  install just the necessary locales
  

- with Debian Linux:
+ with Debian GNU/Linux:
   Add the above list, as shown, to the file
  /etc/locale.gen 
   run /usr/sbin/locale-gen 


Re: PING: [C++-11 PATCH] Trailing comma in enum

2011-10-30 Thread Ville Voutilainen
On 30 October 2011 12:17, Magnus Fromreide  wrote:
> Attached is a variation where maybe_warn_cpp0x is used.
> Please note how my new pedwarn breaks the pattern in maybe_warn_cpp0x.

Looks reasonable to me, but I'm not a maintainer. :) Jason?


[PING] New port for TILEPro and TILE-Gx

2011-10-30 Thread Walter Lee
Ping?  I believe I have addressed all the reviewer's (namely Joseph Myers')
comments to date.

Thanks,

Walter Lee


[PATCH] Straight-line strength reduction, stage 1

2011-10-30 Thread William J. Schmidt
Greetings,

IVOPTS handles strength reduction of induction variables, but GCC does
not currently perform strength reduction in straight-line code.  This
has been noted before in PR22586 and PR35308.  PR46556 is also a case
that could be handled with strength reduction.  This patch adds a pass
to perform strength reduction along dominator paths on the easiest
cases, where replacements are obviously profitable.

My intent is to add subsequent installments to handle more involved
cases, as described in the code commentary.  The cases not yet covered
will require target-specific cost analysis to determine profitability.
It is likely that this will leverage some of the cost function
infrastructure in tree-ssa-loop-ivopts.c.

I've bootstrapped and tested the code on powerpc64-linux with no
regressions.  I've also run SPEC CPU2006 to compare results.  32-bit
PowerPC gains about 1% on integer code.  Other results are in the noise
range.  64-bit integer code would have also shown gains, except for one
bad result (400.perlbench degraded 4%).  Initial analysis shows that
very different control flow is created for regmatch with the patch than
without.  I will be investigating further this week, but presumably some
touchy threshold was no longer met for a downstream optimization --
probably an indirect effect.

My hope is to commit this first stage as part of 4.7, with the remainder
to follow in 4.8.

Thanks for your consideration,

Bill


2011-10-30  Bill Schmidt  

gcc:

* tree-pass.h (pass_strength_reduction): New declaration.
* timevar.def (TV_TREE_SLSR): New time-var.
* tree-ssa-strength-reduction.c: New file.
* Makefile.in: New dependences.
* passes.c (init_optimization_passes): Add new pass.

gcc/testsuite:

* gcc.dg/tree-ssa/slsr-1.c: New test case.
* gcc.dg/tree-ssa/slsr-2.c: New test case.
* gcc.dg/tree-ssa/slsr-3.c: New test case.
* gcc.dg/tree-ssa/slsr-4.c: New test case.


Index: gcc/tree-pass.h
===
--- gcc/tree-pass.h (revision 180617)
+++ gcc/tree-pass.h (working copy)
@@ -449,6 +449,7 @@ extern struct gimple_opt_pass pass_tracer;
 extern struct gimple_opt_pass pass_warn_unused_result;
 extern struct gimple_opt_pass pass_split_functions;
 extern struct gimple_opt_pass pass_feedback_split_functions;
+extern struct gimple_opt_pass pass_strength_reduction;
 
 /* IPA Passes */
 extern struct simple_ipa_opt_pass pass_ipa_lower_emutls;
Index: gcc/testsuite/gcc.dg/tree-ssa/slsr-1.c
===
--- gcc/testsuite/gcc.dg/tree-ssa/slsr-1.c  (revision 0)
+++ gcc/testsuite/gcc.dg/tree-ssa/slsr-1.c  (revision 0)
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fdump-tree-optimized" } */
+
+extern void foo (int);
+
+void
+f (int *p, unsigned int n)
+{
+  foo (*(p + n * 4));
+  foo (*(p + 32 + n * 4));
+  if (n > 3)
+foo (*(p + 16 + n * 4));
+  else
+foo (*(p + 48 + n * 4));
+}
+
+/* { dg-final { scan-tree-dump-times "\\+ 128" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "\\+ 64" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "\\+ 192" 1 "optimized" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
Index: gcc/testsuite/gcc.dg/tree-ssa/slsr-2.c
===
--- gcc/testsuite/gcc.dg/tree-ssa/slsr-2.c  (revision 0)
+++ gcc/testsuite/gcc.dg/tree-ssa/slsr-2.c  (revision 0)
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fdump-tree-optimized" } */
+
+extern void foo (int);
+
+void
+f (int *p, int n)
+{
+  foo (*(p + n++ * 4));
+  foo (*(p + 32 + n++ * 4));
+  foo (*(p + 16 + n * 4));
+}
+
+/* { dg-final { scan-tree-dump-times "\\+ 144" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "\\+ 96" 1 "optimized" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
Index: gcc/testsuite/gcc.dg/tree-ssa/slsr-3.c
===
--- gcc/testsuite/gcc.dg/tree-ssa/slsr-3.c  (revision 0)
+++ gcc/testsuite/gcc.dg/tree-ssa/slsr-3.c  (revision 0)
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fdump-tree-optimized" } */
+
+int
+foo (int a[], int b[], int i)
+{
+  a[i] = b[i] + 2;
+  i++;
+  a[i] = b[i] + 2;
+  i++;
+  a[i] = b[i] + 2;
+  i++;
+  a[i] = b[i] + 2;
+  i++;
+  return i;
+}
+
+/* { dg-final { scan-tree-dump-times "\\* 4" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "\\+ 4" 2 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "\\+ 8" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "\\+ 12" 1 "optimized" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
Index: gcc/testsuite/gcc.dg/tree-ssa/slsr-4.c
===
--- gcc/testsuite/gcc.dg/tree-ssa/slsr-4.c  (revision 0)
+++ gcc/testsuite/gcc.dg/tree-

[PING] Re: [PATCH] Fix PR46556 (poor address generation)

2011-10-30 Thread William J. Schmidt
Ping.

On Mon, 2011-10-24 at 08:38 -0500, William J. Schmidt wrote:
> OK, I've removed the pointer-arithmetic case from expand, to be handled
> later by straight-line strength reduction.  Here's the patch to deal
> with just the specific pattern of PR46556 (which will also eventually be
> handled by strength reduction, but not as quickly).
> 
> (FYI, I've been thinking through the strength reduction pass, and my
> plan is to stage in some of the easiest cases first, hopefully for 4.7,
> and gradually add the more complex pieces.  Explicit multiplies in the
> IL with known constants can be done pretty easily.  More complexity is
> added when the multiplier is a variable, when conditional increments are
> present, and when multiplies are hidden in addressing expressions.)
> 
> The present patch was bootstrapped and regression-tested on
> powerpc64-linux.  OK for trunk?
> 
> Thanks,
> Bill
> 
> 
> 2011-10-24  Bill Schmidt  
> 
> gcc:
> 
>   PR rtl-optimization/46556
>   * expr.c (restructure_base_and_offset): New function.
>   (expand_expr_real_1): Replace result of get_inner_reference
>   with result of restructure_base_and_offset when applicable.
>   * Makefile.in (expr.o): Update dependencies.
> 
> gcc/testsuite:
> 
>   PR rtl-optimization/46556
>   * gcc.dg/tree-ssa-pr46556-1.c: New testcase.
>   * gcc.dg/tree-ssa-pr46556-2.c: Likewise.
>   * gcc.dg/tree-ssa-pr46556-3.c: Likewise.
> 
> 
> Index: gcc/testsuite/gcc.dg/tree-ssa/pr46556-1.c
> ===
> --- gcc/testsuite/gcc.dg/tree-ssa/pr46556-1.c (revision 0)
> +++ gcc/testsuite/gcc.dg/tree-ssa/pr46556-1.c (revision 0)
> @@ -0,0 +1,22 @@
> +/* { dg-do compile } */
> +/* { dg-options "-O2 -fdump-rtl-expand" } */
> +
> +struct x
> +{
> +  int a[16];
> +  int b[16];
> +  int c[16];
> +};
> +
> +extern void foo (int, int, int);
> +
> +void
> +f (struct x *p, unsigned int n)
> +{
> +  foo (p->a[n], p->c[n], p->b[n]);
> +}
> +
> +/* { dg-final { scan-rtl-dump-times "\\(mem/s:SI \\(plus:" 2 "expand" } } */
> +/* { dg-final { scan-rtl-dump-times "const_int 128" 1 "expand" } } */
> +/* { dg-final { scan-rtl-dump-times "const_int 64 \\\[0x40\\\]\\)\\) \\\[" 1 
> "expand" } } */
> +/* { dg-final { cleanup-rtl-dump "expand" } } */
> Index: gcc/testsuite/gcc.dg/tree-ssa/pr46556-2.c
> ===
> --- gcc/testsuite/gcc.dg/tree-ssa/pr46556-2.c (revision 0)
> +++ gcc/testsuite/gcc.dg/tree-ssa/pr46556-2.c (revision 0)
> @@ -0,0 +1,26 @@
> +/* { dg-do compile } */
> +/* { dg-options "-O2 -fdump-rtl-expand" } */
> +
> +struct x
> +{
> +  int a[16];
> +  int b[16];
> +  int c[16];
> +};
> +
> +extern void foo (int, int, int);
> +
> +void
> +f (struct x *p, unsigned int n)
> +{
> +  foo (p->a[n], p->c[n], p->b[n]);
> +  if (n > 12)
> +foo (p->a[n], p->c[n], p->b[n]);
> +  else if (n > 3)
> +foo (p->b[n], p->a[n], p->c[n]);
> +}
> +
> +/* { dg-final { scan-rtl-dump-times "\\(mem/s:SI \\(plus:" 6 "expand" } } */
> +/* { dg-final { scan-rtl-dump-times "const_int 128" 3 "expand" } } */
> +/* { dg-final { scan-rtl-dump-times "const_int 64 \\\[0x40\\\]\\)\\) \\\[" 3 
> "expand" } } */
> +/* { dg-final { cleanup-rtl-dump "expand" } } */
> Index: gcc/testsuite/gcc.dg/tree-ssa/pr46556-3.c
> ===
> --- gcc/testsuite/gcc.dg/tree-ssa/pr46556-3.c (revision 0)
> +++ gcc/testsuite/gcc.dg/tree-ssa/pr46556-3.c (revision 0)
> @@ -0,0 +1,27 @@
> +/* { dg-do compile } */
> +/* { dg-options "-O2 -fdump-rtl-expand" } */
> +struct x
> +{
> +  int a[16];
> +  int b[16];
> +  int c[16];
> +};
> +
> +extern void foo (int, int, int);
> +
> +void
> +f (struct x *p, unsigned int n)
> +{
> +  foo (p->a[n], p->c[n], p->b[n]);
> +  if (n > 3)
> +{
> +  foo (p->a[n], p->c[n], p->b[n]);
> +  if (n > 12)
> + foo (p->b[n], p->a[n], p->c[n]);
> +}
> +}
> +
> +/* { dg-final { scan-rtl-dump-times "\\(mem/s:SI \\(plus:" 6 "expand" } } */
> +/* { dg-final { scan-rtl-dump-times "const_int 128" 3 "expand" } } */
> +/* { dg-final { scan-rtl-dump-times "const_int 64 \\\[0x40\\\]\\)\\) \\\[" 3 
> "expand" } } */
> +/* { dg-final { cleanup-rtl-dump "expand" } } */
> Index: gcc/expr.c
> ===
> --- gcc/expr.c(revision 180378)
> +++ gcc/expr.c(working copy)
> @@ -56,6 +56,7 @@ along with GCC; see the file COPYING3.  If not see
>  #include "ssaexpand.h"
>  #include "target-globals.h"
>  #include "params.h"
> +#include "tree-pretty-print.h"
> 
>  /* Decide whether a function's arguments should be processed
> from first to last or from last to first.
> @@ -7648,7 +7649,66 @@ expand_constructor (tree exp, rtx target, enum exp
>return target;
>  }
> 
> +/* Given BASE, OFFSET, and BITPOS derived from EXPR, determine whether
> +   there is a profitable opportunity to restructure address arithmetic
> +   within

Re: [libstdc++, doc] Update prerequisites documentation

2011-10-30 Thread Jonathan Wakely
On 30 October 2011 15:36, Gerald Pfeifer wrote:
> At first this was only triggered by Linux vs GNU/Linux, but then I
> noticed GCC being lower-cased and the Red Hat Linux reference when
> we actually do not support that old version of glibc anymore at all.

Are those instructions not valid for Fedora though?  And RHEL?


Re: [PATCH][2/n] LTO option handling/merging rewrite

2011-10-30 Thread Joseph S. Myers
On Sat, 29 Oct 2011, Richard Guenther wrote:

> I tried to look at what we get for -fno-pic vs. -fpic and -fno-pic is 
> completely
> dropped from the decoded options list (not sure what happens on targets
> with -fpic as default).  So it seems at most one state (the non-default one)
> survives here.

I don't see where that would happening, and don't see that myself; 
-fno-pic gets included in COLLECT_GCC_OPTIONS for me if it's the last 
-fpic/-fno-pic option on the driver command line.

> But maybe I'm missing something - how can I reliably check if there is
> a negative form of an option, and if, if the option is the negative form?

The "value" field of a cl_decoded_option is 1 for a positive option, 0 for 
the negative form, for an option accepting positive and negative forms 
(not marked with RejectNegative / CL_REJECT_NEGATIVE.  (It's a bug if an 
option allows a negative form but also takes a UInteger argument, since 
such an argument also uses the "value" field.)

-- 
Joseph S. Myers
jos...@codesourcery.com


Re: [C++-11] User defined literals

2011-10-30 Thread Ed Smith-Rowland

On 10/27/2011 03:47 PM, Jason Merrill wrote:

On 10/27/2011 03:32 PM, Ed Smith-Rowland wrote:

+  if (TREE_CODE (TREE_TYPE (decl)) != LANG_TYPE)
+argtypes = TYPE_ARG_TYPES (TREE_TYPE (decl));


If you have multiple overloaded operator"" _foo, you need to iterate 
over them looking for the one (or ones, in the case of numeric 
literals) you want.



+  if (argtypes != NULL_TREE
+ && TREE_VALUE (argtypes) != TREE_TYPE (value))


I think you want

 if (argtypes == NULL_TREE
 || !same_type_p (TREE_VALUE (argtypes), TREE_TYPE (value)))


+  if (TREE_CODE (TREE_TYPE (value)) == INTEGER_TYPE)
+{
+  if (argtypes != NULL_TREE
+ && TREE_CODE (TREE_VALUE (argtypes)) == REAL_TYPE)
+{
+  error ("unable to find %qD with % 
argument",

+ name);
+  return error_mark_node;
+}
+}
+  else if (TREE_CODE (TREE_TYPE (value)) == REAL_TYPE)
+{
+  if (argtypes != NULL_TREE
+ && TREE_CODE (TREE_VALUE (argtypes)) == INTEGER_TYPE)
+{
+  error ("unable to find %qD with % argument", name);
+  return error_mark_node;
+}
+}


This looks like it will break raw operators.

Jason


Here is a new patch that I think addresses these issues.
Basically, I am looping through all operators with the required suffix 
and looking for a perfectly matching argument for the given literal.


There are two issues.  One I think is just dg.  There are two FAILs but 
the error message comes out like I think it should.  I attached the sum 
and the log.  This is in udlit-implicit-conv-neg.C.  I tried for the 
life of me to copy the exact message from the terminal.  All the others 
work.


Also, as seen in udlit-resolve.C the version of an operator brought in 
by using a namespaced operator will win.


Ed

2011-10-30  Ed Smith-Rowland  <3dw...@verizon.net>

gcc/testsuite/g++.dg/cpp0x/udlit-implicit-conv-neg.C: New.
gcc/testsuite/g++.dg/cpp0x/udlit-resolve.C: New.

gcc/cp/parser.c: (cp_parser_userdef_char_literal,
cp_parser_userdef_numeric_literal, cp_parser_userdef_string_literal):
Loop through the possible functions looking for exact argument type
matches to resolve literal operator call.  Use lookup_name instead of
lookup_function_nonclass.

libcpp/expr.c: (cpp_userdef_char_remove_type): Fix boneheaded paste-o.
Index: gcc/testsuite/g++.dg/cpp0x/udlit-implicit-conv-neg.C
===
--- gcc/testsuite/g++.dg/cpp0x/udlit-implicit-conv-neg.C(revision 0)
+++ gcc/testsuite/g++.dg/cpp0x/udlit-implicit-conv-neg.C(revision 0)
@@ -0,0 +1,59 @@
+// { dg-options -std=c++0x }
+
+#include 
+
+int operator"" _bar (long double);
+
+double operator"" _foo (long long unsigned);
+
+int i = 12_bar; // { dg-error "unable to find numeric literal 
operator|with|argument" }
+
+double d = 1.2_foo; // { dg-error "unable to find numeric literal 
operator|with|argument" }
+
+int operator"" _char(char);
+
+int operator"" _wchar_t(wchar_t);
+
+int operator"" _char16_t(char16_t);
+
+int operator"" _char32_t(char32_t);
+
+int cwc = 'c'_wchar_t; // { dg-error "unable to find character literal 
operator|with|argument" }
+int cc16 = 'c'_char16_t; // { dg-error "unable to find character literal 
operator|with|argument" }
+int cc32 = 'c'_char32_t; // { dg-error "unable to find character literal 
operator|with|argument" }
+
+int wcc = L'c'_char; // { dg-error "unable to find character literal 
operator|with|argument" }
+int wcc16 = L'c'_char16_t; // { dg-error "unable to find character literal 
operator|with|argument" }
+int wcc32 = L'c'_char32_t; // { dg-error "unable to find character literal 
operator|with|argument" }
+
+int c16c = u'c'_char; // { dg-error "unable to find character literal 
operator|with|argument" }
+int c16wc = u'c'_wchar_t; // { dg-error "unable to find character literal 
operator|with|argument" }
+int c16c32 = u'c'_char32_t; // { dg-error "unable to find character literal 
operator|with|argument" }
+
+int c32c = U'c'_char; // { dg-error "unable to find character literal 
operator|with|argument" }
+int c32wc = U'c'_wchar_t; // { dg-error "unable to find character literal 
operator|with|argument" }
+int c32c16 = U'c'_char16_t; // { dg-error "unable to find character literal 
operator|with|argument" }
+
+int operator"" _char_str(const char*, std::size_t);
+
+int operator"" _wchar_t_str(const wchar_t*, std::size_t);
+
+int operator"" _char16_t_str(const char16_t*, std::size_t);
+
+int operator"" _char32_t_str(const char32_t*, std::size_t);
+
+int strwstr = "str"_wchar_t_str; // { dg-error "unable to find string literal 
operator|with|arguments" }
+int strstr16 = "str"_char16_t_str; // { dg-error "unable to find string 
literal operator|with|arguments" }
+int strstr32 = "str"_char32_t_str; // { dg-error "unable to find string 
literal operator|with|arguments" }
+
+int wstrstr = L"str"_char_str; // { dg-error "unable to find string literal 
operator|with|arguments" }
+int ws

Re: [libstdc++, doc] Update prerequisites documentation

2011-10-30 Thread Gerald Pfeifer
On Sun, 30 Oct 2011, Jonathan Wakely wrote:
> Are those instructions not valid for Fedora though?  And RHEL?

Anything using "rpm -e --nodeps" is not valid anywhere, I'd claim.

And "rpm -i --define "_install_langs all" glibc-common-2.2.5-34.i386.rpm"
definitely won't work on anything released in the last decade or so. ;-)

That said, I did check a recent Fedora installation and found all
locales to be installed by default.  And a 2005 vintage report at
https://bugzilla.redhat.com/show_bug.cgi?id=156477 confirms this
was the case already back then.

I hope this addresses your questions?

Gerald


[C++ preview patch] PR 44277

2011-10-30 Thread Paolo Carlini

Hi,

thus I'm working on a new warning for 0 as null ptr constant, which 
should be useful for people moving to C++11' nullptr. Looks like a good 
place to check for that is cp_convert_to_pointer, then the difficulty is 
coping correctly with things like:


int* p;

if (p)
  ;

where certainly we don't want to warn, but the front-end would, 
normally, because the latter is implicitly transformed via 
cp_truthvalue_conversion to


if (p != 0)
  ;

Thus my idea: stop generating those implicit zeros and generate instead, 
internally, exactly nullptrs when pointers are involved! The idea 
appears to work pretty well, the substance of it is in very few lines in 
cp/typeck.c and cp/init.c, in particular in cp_truthvalue_conversion itself.


However, there is some complexity in the actual implementation, because 
we forward to the shared c_common_truthvalue_conversion, which does some 
non-trivial simplifications, and of course doesn't know about 
nullptr_node. To solve this I'm adding a parameter to it and passing 
nullptr_node or integer_zero_node, when appropriate. If unsharing 
c_common_truthvalue_conversion isn't an option , definitely would add a 
lot of redundant code, I don't see a neater way to accomplish the same 
result. Well, unless we could move nullptr_node from cp/ only to the 
global tree?!? In this case the patch would become tiny.


Thanks for any feedback!

(patch below passes the testsuite and does the right thing for the basic 
testcase)


Paolo.

/

Index: c-family/c.opt
===
--- c-family/c.opt  (revision 180671)
+++ c-family/c.opt  (working copy)
@@ -685,6 +685,9 @@ Wpointer-sign
 C ObjC Var(warn_pointer_sign) Init(-1) Warning
 Warn when a pointer differs in signedness in an assignment
 
+Wzero-as-null-pointer-constant
+C++ ObjC++ Var(warn_zero_as_null_pointer_constant) Warning
+
 ansi
 C ObjC C++ ObjC++
 A synonym for -std=c89 (for C) or -std=c++98 (for C++)
Index: c-family/c-common.c
===
--- c-family/c-common.c (revision 180671)
+++ c-family/c-common.c (working copy)
@@ -3898,7 +3898,7 @@ decl_with_nonnull_addr_p (const_tree expr)
The resulting type should always be `truthvalue_type_node'.  */
 
 tree
-c_common_truthvalue_conversion (location_t location, tree expr)
+c_common_truthvalue_conversion (location_t location, tree expr, tree zeronode)
 {
   switch (TREE_CODE (expr))
 {
@@ -3921,9 +3921,11 @@ tree
return expr;
   expr = build2 (TREE_CODE (expr), truthvalue_type_node,
 c_common_truthvalue_conversion (location,
-TREE_OPERAND (expr, 0)),
+TREE_OPERAND (expr, 0),
+zeronode),
 c_common_truthvalue_conversion (location,
-TREE_OPERAND (expr, 1)));
+TREE_OPERAND (expr, 1),
+zeronode));
   goto ret;
 
 case TRUTH_NOT_EXPR:
@@ -3931,7 +3933,8 @@ tree
return expr;
   expr = build1 (TREE_CODE (expr), truthvalue_type_node,
 c_common_truthvalue_conversion (location,
-TREE_OPERAND (expr, 0)));
+TREE_OPERAND (expr, 0),
+zeronode));
   goto ret;
 
 case ERROR_MARK:
@@ -3976,9 +3979,11 @@ tree
  (TREE_SIDE_EFFECTS (TREE_OPERAND (expr, 1))
   ? TRUTH_OR_EXPR : TRUTH_ORIF_EXPR),
c_common_truthvalue_conversion (location,
-   TREE_OPERAND (expr, 0)),
+   TREE_OPERAND (expr, 0),
+   zeronode),
c_common_truthvalue_conversion (location,
-   TREE_OPERAND (expr, 1)),
+   TREE_OPERAND (expr, 1),
+   zeronode),
  0);
   goto ret;
 
@@ -3987,7 +3992,8 @@ tree
 case FLOAT_EXPR:
 case EXCESS_PRECISION_EXPR:
   /* These don't change whether an object is nonzero or zero.  */
-  return c_common_truthvalue_conversion (location, TREE_OPERAND (expr, 0));
+  return c_common_truthvalue_conversion (location, TREE_OPERAND (expr, 0),
+zeronode);
 
 case LROTATE_EXPR:
 case RROTATE_EXPR:
@@ -3998,12 +4004,13 @@ tree
  expr = build2 (COMPOUND_EXPR, truthvalue_type_node,
 TREE_OPERAND (expr, 1),
   

Re: [libstdc++, doc] Update prerequisites documentation

2011-10-30 Thread Jonathan Wakely
On 30 October 2011 17:16, Gerald Pfeifer wrote:
> I hope this addresses your questions?

It certainly does - thanks.


Re: addition to http://gcc.gnu.org/faq.html

2011-10-30 Thread Gerald Pfeifer
On Sun, 17 Apr 2011, Axel Freyn wrote:
> I propose to add a phrase to the "rpath"-section (Dynamic linker is
> unable to find GCC libraries), which explains how to use "-R" as
> compiler-option (by using "-Wl,")

This is a good idea, thank you.  I applied the small variation of
your original patch below (and sorry for the delay in following up).

Gerald

Index: faq.html
===
RCS file: /cvs/gcc/wwwdocs/htdocs/faq.html,v
retrieving revision 1.212
diff -u -r1.212 faq.html
--- faq.html8 May 2011 13:01:44 -   1.212
+++ faq.html30 Oct 2011 19:00:20 -
@@ -204,6 +204,9 @@
 platform and linker, to the *link or *lib
 specs.
 
+Alternately the syntax -Wl,option can be used to ask
+GCC to transfer the flag option to the linker.
+
 Another alternative is to install a wrapper script around gcc, g++
 or ld that adds the appropriate directory to the environment variable
 LD_RUN_PATH or equivalent (again, it's


Re: [Patch, fortran] [06/66] inline sum and product: Prepare gfc_trans_preloop_setup

2011-10-30 Thread Mikael Morin
On Sunday 30 October 2011 09:16:09 Paul Richard Thomas wrote:
> Dear Mikael,
> 
> I intend to work my way through your patches, starting this evening.
> I'll give you feedback as I go along and will OK the whole package,
> rather than bits.  Is that alright with you?
Sure.

Mikael


[wwwdocs] Simplify FAQ around rpath

2011-10-30 Thread Gerald Pfeifer
While looking into Axel Freyn's suggestion, I noticed how that
answer really is too long winded.  This cuts down things quite
a bit, making this more digestable hopefully.

Applied.

Gerald

Index: faq.html
===
RCS file: /cvs/gcc/wwwdocs/htdocs/faq.html,v
retrieving revision 1.213
diff -u -r1.213 faq.html
--- faq.html30 Oct 2011 19:00:34 -  1.213
+++ faq.html30 Oct 2011 19:12:50 -
@@ -176,25 +176,20 @@
 Dynamic linker is unable to find GCC libraries
 
 This problem manifests itself by programs not finding shared
-libraries they depend on when the programs are started.  Note this
-problem often manifests itself with failures in the libio/libstdc++
-tests after configuring with --enable-shared and building GCC.
+libraries they depend on when the programs are started.  (This
+often shows around libstdc++.)
 
 GCC does not specify a runpath so that the dynamic linker can find
 dynamic libraries at runtime.
 
 The short explanation is that if you always pass a -R option to the
-linker, then your programs become dependent on directories which
-may be NFS mounted, and programs may hang unnecessarily when an
-NFS server goes down.
-
-The problem is not programs that do require the directories; those
-programs are going to hang no matter what you do.  The problem is
-programs that do not require the directories.
-
-SunOS effectively always passed a -R option for every
--L option; this was a bad idea, and so it was removed for
-Solaris.  We should not recreate it.
+linker, your programs become dependent on directories which
+may be NFS mounted, and programs — even those which do not
+require these directories — may hang unnecessarily when an
+NFS server goes down.
+(SunOS effectively always passed a -R option for every
+-L option; this was a bad idea, and it was removed for
+Solaris.)
 
 However, if you feel you really need such an option to be passed
 automatically to the linker, you may add it to a GCC specs file.
@@ -212,12 +207,6 @@
 LD_RUN_PATH or equivalent (again, it's
 platform-dependent).
 
-Yet another option, that works on a few platforms, is to hard-code
-the full pathname of the library into its soname.  This can only be
-accomplished by modifying the appropriate .ml file within
-libstdc++/config (and also libg++/config, if you are
-building libg++), so that $(libdir)/ appears just before
-the library name in -soname or -h options.
 
 
 GCC can not find GNU as/GNU ld


Re: [patch, Fortran] Fix PR 50690

2011-10-30 Thread Mikael Morin
On Tuesday 25 October 2011 07:39:44 Thomas Koenig wrote:
> Ping ** 0.571428
> 
Let's keep Jakub CC-ed for mixes of OpenMP and frontend optimizations. ;-)

There are two commented lines in the testcase. Is it expected?
Otherwise doesn't look too bad...

Mikael

> > Jakub Jelinek wrote:
> >> Though, what could be done is just special case OpenMP workshare
> >> regions, insert everything into BLOCK local vars unless in OpenMP
> >> workshare, in that
> >> case put the BLOCK with the temporary around the workshare rather than
> >> inside of it. In the case of omp parallel workshare it would need
> >> to go in between omp parallel and omp workshare.
> > 
> > Well, here's a patch which implements this concept. I chose to insert
> > the BLOCK in a separate pass because it was the cleanest way to avoid
> > infinite recursion when inserting a block.
> > 
> > Regression-tested. OK for trunk?
> > 
> > Thomas
> > 
> > 2011-10-21 Thomas Koenig 
> > 
> > PR fortran/50690
> > * frontend-passes.c (workshare_level): New variable.
> > (create_var): Put the newly created variable into the block
> > around the WORKSHARE.
> > (enclose_workshare): New callback function to enclose
> > WORKSHAREs in blocks.
> > (optimize_namespace): Use it.
> > (gfc_code_walker): Save/restore current namespace when
> > following a BLOCK. Keep track of workshare level.
> > 
> > 2011-10-21 Thomas Koenig 
> > 
> > PR fortran/50690
> > * gfortran.dg/gomp/workshare2.f90: New test.


[PATCH] Fix AIX breakage from gcc-ar/nm/ranlib wrappers

2011-10-30 Thread David Edelsohn
This patch breaks bootstrap on AIX because it includes 
before "config.h".  "config.h" header can affect system headers.  I am
not sure why stdio.h should be included because system.h itself
includes .  The appended patch moves stdio.h after config.h,
but maybe gcc-ar.h should not include stdio.h explicitly.

Thanks, David

* gcc-ar.c: Include stdio.h after config.h

Index: gcc-ar.c
===
--- gcc-ar.c(revision 180685)
+++ gcc-ar.c(working copy)
@@ -18,9 +18,9 @@
 along with GCC; see the file COPYING3.  If not see
 .  */

-#include 
 #include "config.h"
+#include 
 #include "system.h"
 #include "libiberty.h"

 #ifndef PERSONALITY


Re: [4.5.1,PR42776] Backport LTO-COFF implementation.

2011-10-30 Thread Gerald Pfeifer
On Mon, 14 Jun 2010, Dave Korn wrote:
>   * htdocs/gcc-4.5/changes.html: Remove explicit mentions of ELF
>   format from LTO documentation.

Ouch, I noticed this patch of yours never was applied, perhaps
some misunderstanding between Richi and you (him assuming you'd
go ahead and you waiting for his approval)?

The patch still applies and looks good to me, so I went ahead and
applied it on your behalf.

Gerald


Re: [PATCH][2/n] LTO option handling/merging rewrite

2011-10-30 Thread Richard Guenther
On Fri, Oct 28, 2011 at 4:48 PM, Diego Novillo  wrote:
> Isn't this the same patch as
> http://gcc.gnu.org/ml/gcc-patches/2011-10/msg02348.html?

No, it's updated to do exactly what we do now.  Changes to behavior to be split
to 3/n (like warning about mismatches or fixing the way we handle fPIC).

Richard.

>
> Diego.
>


Re: [PATCH] Fix AIX breakage from gcc-ar/nm/ranlib wrappers

2011-10-30 Thread Richard Guenther
On Sun, Oct 30, 2011 at 9:39 PM, David Edelsohn  wrote:
> This patch breaks bootstrap on AIX because it includes 
> before "config.h".  "config.h" header can affect system headers.  I am
> not sure why stdio.h should be included because system.h itself
> includes .  The appended patch moves stdio.h after config.h,
> but maybe gcc-ar.h should not include stdio.h explicitly.

It should indeed not, system headers are supposed to be included from system.h.

A patch that simply removes the include is ok

Thanks,
Richard.

> Thanks, David
>
>        * gcc-ar.c: Include stdio.h after config.h
>
> Index: gcc-ar.c
> ===
> --- gcc-ar.c    (revision 180685)
> +++ gcc-ar.c    (working copy)
> @@ -18,9 +18,9 @@
>  along with GCC; see the file COPYING3.  If not see
>  .  */
>
> -#include 
>  #include "config.h"
> +#include 
>  #include "system.h"
>  #include "libiberty.h"
>
>  #ifndef PERSONALITY
>


Re: [PATCH] PR fortran/50573 -- Fix checking of dshift{lr} arguments

2011-10-30 Thread Steve Kargl
On Fri, Oct 28, 2011 at 07:43:58AM +0200, Tobias Burnus wrote:
> Am 28.10.2011 01:27, schrieb Steve Kargl:
> >The attached patch tightens the checking of the arguments
> >of the dshiftl and dshiftr argument.  It also does a kind
> >type conversion when either I or J is a BOZ to the kind
> >type of the non-BOZ I or J.
> >
> >OK for trunk?
> 
> OK with a changelog entry for the NEAREST change. And thanks for the patch.
> 
> Could you also update the manual?
> http://gcc.gnu.org/onlinedocs/gfortran/DSHIFTL.html
> 

Here's the patch I committed.  The NEAREST stuff was committed 
in a prevous commit, and I've updated the docs.


2011-10-30  Steven G. Kargl  

PR fortran/50573
* check.c (gfc_check_dshift): Update argument checking for BOZ.
Update checking SHIFT against BITSIZE of I or J.
* intrinsic.texi: Update docs for DSHIFTL and DSHIFTR.

2011-10-30  Steven G. Kargl  

PR fortran/50573
* gfortran.dg/dshift_3.f90: New test.

-- 
Steve
Index: fortran/check.c
===
--- fortran/check.c	(revision 180622)
+++ fortran/check.c	(working copy)
@@ -1483,7 +1483,14 @@ gfc_check_dshift (gfc_expr *i, gfc_expr 
   if (type_check (j, 1, BT_INTEGER) == FAILURE)
 return FAILURE;
 
-  if (same_type_check (i, 0, j, 1) == FAILURE)
+  if (i->is_boz && j->is_boz)
+{
+  gfc_error ("'I' at %L and 'J' at %L cannot both be BOZ literal "
+		 "constants", &i->where, &j->where);
+  return FAILURE;
+}
+
+  if (!i->is_boz && !j->is_boz && same_type_check (i, 0, j, 1) == FAILURE)
 return FAILURE;
 
   if (type_check (shift, 2, BT_INTEGER) == FAILURE)
@@ -1492,8 +1499,18 @@ gfc_check_dshift (gfc_expr *i, gfc_expr 
   if (nonnegative_check ("SHIFT", shift) == FAILURE)
 return FAILURE;
 
-  if (less_than_bitsize1 ("I", i, "SHIFT", shift, true) == FAILURE)
-return FAILURE;
+  if (i->is_boz)
+{
+  if (less_than_bitsize1 ("J", j, "SHIFT", shift, true) == FAILURE)
+	return FAILURE;
+  i->ts.kind = j->ts.kind;
+}
+  else
+{
+  if (less_than_bitsize1 ("I", i, "SHIFT", shift, true) == FAILURE)
+	return FAILURE;
+  j->ts.kind = i->ts.kind;
+}
 
   return SUCCESS;
 }
Index: fortran/intrinsic.texi
===
--- fortran/intrinsic.texi	(revision 180622)
+++ fortran/intrinsic.texi	(working copy)
@@ -3794,22 +3794,27 @@ Elemental function
 
 @item @emph{Arguments}:
 @multitable @columnfractions .15 .70
-@item @var{I} @tab Shall be of type @code{INTEGER}.
-@item @var{J} @tab Shall be of type @code{INTEGER}, and of the same kind
-as @var{I}.
-@item @var{SHIFT} @tab Shall be of type @code{INTEGER}.
+@item @var{I} @tab Shall be of type @code{INTEGER} or a BOZ constant.
+@item @var{J} @tab Shall be of type @code{INTEGER} or a BOZ constant.
+If both @var{I} and @var{J} have integer type, then they shall have
+the same kind type parameter. @var{I} and @var{J} shall not both be
+BOZ constants.
+@item @var{SHIFT} @tab Shall be of type @code{INTEGER}. It shall
+be nonnegative.  If @var{I} is not a BOZ constant, then @var{SHIFT}
+shall be less than or equal to @code{BIT_SIZE(I)}; otherwise,
+@var{SHIFT} shall be less than or equal to @code{BIT_SIZE(J)}.
 @end multitable
 
 @item @emph{Return value}:
-The return value has same type and kind as @var{I}.
+If either @var{I} or @var{J} is a BOZ constant, it is first converted
+as if by the intrinsic function @code{INT} to an integer type with the
+kind type parameter of the other.
 
 @item @emph{See also}:
 @ref{DSHIFTR}
-
 @end table
 
 
-
 @node DSHIFTR
 @section @code{DSHIFTR} --- Combined right shift
 @fnindex DSHIFTR
@@ -3834,22 +3839,27 @@ Elemental function
 
 @item @emph{Arguments}:
 @multitable @columnfractions .15 .70
-@item @var{I} @tab Shall be of type @code{INTEGER}.
-@item @var{J} @tab Shall be of type @code{INTEGER}, and of the same kind
-as @var{I}.
-@item @var{SHIFT} @tab Shall be of type @code{INTEGER}.
+@item @var{I} @tab Shall be of type @code{INTEGER} or a BOZ constant.
+@item @var{J} @tab Shall be of type @code{INTEGER} or a BOZ constant.
+If both @var{I} and @var{J} have integer type, then they shall have
+the same kind type parameter. @var{I} and @var{J} shall not both be
+BOZ constants.
+@item @var{SHIFT} @tab Shall be of type @code{INTEGER}. It shall
+be nonnegative.  If @var{I} is not a BOZ constant, then @var{SHIFT}
+shall be less than or equal to @code{BIT_SIZE(I)}; otherwise,
+@var{SHIFT} shall be less than or equal to @code{BIT_SIZE(J)}.
 @end multitable
 
 @item @emph{Return value}:
-The return value has same type and kind as @var{I}.
+If either @var{I} or @var{J} is a BOZ constant, it is first converted
+as if by the intrinsic function @code{INT} to an integer type with the
+kind type parameter of the other.
 
 @item @emph{See also}:
 @ref{DSHIFTL}
-
 @end table
 
 
-
 @node DTIME
 @section @code{DTIME} --- Execution time subroutine (or function)
 @fninde

Factor mangled id computation (issue5311075)

2011-10-30 Thread Diego Novillo

This factors the computation of mangled names so it can be called
without actually setting the assembler name on the DECL.  It is used
in the pph branch for merging symbols that are replicated in multiple
images.

On trunk, it changes nothing, but it sets it up for when we are ready
to merge the pph branch.  OK for trunk?


Thanks.  Diego.


* mangle.c (get_mangled_id): Factor from ...
(mangle_decl): ... here.
Call get_mangled_id.

diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c
index 8bc26d8..69fe147 100644
--- a/gcc/cp/mangle.c
+++ b/gcc/cp/mangle.c
@@ -3177,13 +3177,21 @@ mangle_decl_string (const tree decl)
   return result;
 }
 
+/* Return an identifier for the external mangled name of DECL.  */
+
+static tree
+get_mangled_id (tree decl)
+{
+  tree id = mangle_decl_string (decl);
+  return targetm.mangle_decl_assembler_name (decl, id);
+}
+
 /* Create an identifier for the external mangled name of DECL.  */
 
 void
 mangle_decl (const tree decl)
 {
-  tree id = mangle_decl_string (decl);
-  id = targetm.mangle_decl_assembler_name (decl, id);
+  tree id = get_mangled_id (decl);
   SET_DECL_ASSEMBLER_NAME (decl, id);
 
   if (G.need_abi_warning)
-- 
1.7.3.1


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


[lto] Also stream TYPE_ADDR_SPACE. (issue5308067)

2011-10-30 Thread Diego Novillo

I found this on the PPH branch.  We were not handling TYPE_ADDR_SPACE
in the streamer.

Fixed with this patch.  Richi, I will apply it on trunk unless you
remember some reason why we never streamed this?  It does not seem to
affect any LTO tests.

Tested with lto profiledbootstrap on x86_64.


Diego.


* tree-streamer-out.c (pack_ts_base_value_fields): Emit
TYPE_ADDR_SPACE.
* tree-streamer-in.c (unpack_ts_base_value_fields): Read
TYPE_ADDR_SPACE.

diff --git a/gcc/tree-streamer-in.c b/gcc/tree-streamer-in.c
index db2bb37..86eb9ce 100644
--- a/gcc/tree-streamer-in.c
+++ b/gcc/tree-streamer-in.c
@@ -130,7 +130,10 @@ unpack_ts_base_value_fields (struct bitpack_d *bp, tree 
expr)
   TREE_PROTECTED (expr) = (unsigned) bp_unpack_value (bp, 1);
   TREE_DEPRECATED (expr) = (unsigned) bp_unpack_value (bp, 1);
   if (TYPE_P (expr))
-TYPE_SATURATING (expr) = (unsigned) bp_unpack_value (bp, 1);
+{
+  TYPE_SATURATING (expr) = (unsigned) bp_unpack_value (bp, 1);
+  TYPE_ADDR_SPACE (expr) = (unsigned) bp_unpack_value (bp, 8);
+}
   else if (TREE_CODE (expr) == SSA_NAME)
 SSA_NAME_IS_DEFAULT_DEF (expr) = (unsigned) bp_unpack_value (bp, 1);
   else
diff --git a/gcc/tree-streamer-out.c b/gcc/tree-streamer-out.c
index 58be0a3..c46859f 100644
--- a/gcc/tree-streamer-out.c
+++ b/gcc/tree-streamer-out.c
@@ -100,7 +100,10 @@ pack_ts_base_value_fields (struct bitpack_d *bp, tree expr)
   bp_pack_value (bp, TREE_PROTECTED (expr), 1);
   bp_pack_value (bp, TREE_DEPRECATED (expr), 1);
   if (TYPE_P (expr))
-bp_pack_value (bp, TYPE_SATURATING (expr), 1);
+{
+  bp_pack_value (bp, TYPE_SATURATING (expr), 1);
+  bp_pack_value (bp, TYPE_ADDR_SPACE (expr), 8);
+}
   else if (TREE_CODE (expr) == SSA_NAME)
 bp_pack_value (bp, SSA_NAME_IS_DEFAULT_DEF (expr), 1);
   else
-- 
1.7.3.1


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


RFA: Enable multi-step transformation in peephole2

2011-10-30 Thread Joern Rennecke

Where there can be multiple things wrong with a pattern sequence,
performance-wise, and multiple things might be fixed up, depending
on factors like available registers, providing patterns for every
combination leads to combinatorial explosion.
It is simpler to describe the available transformations in simpler steps
that can be chained.  However, the peephole2 pass currently makes only a
single pass over a basic block.  With the attached patch, a peephole2 pattern
can set a new variable, peep2_rescan, to request that the current basic block
is re-scanned.
Bootstrapped and regtested on i686-pc-linux-gnu.

I've been using this mechanism for the Epiphany port to transform add
instructions generated by reload or later passes, which require expensive
flag register save/restore operations, and often have an unnecessary constant
load, into variants which are cheaper.
2011-10-30  Joern Rennecke 

* recog.c (peep2_rescan): New variable.
(peephole2_optimize): Clear peep2_rescan at the start of each block.
Loop if peep2_rescan is set at the end of processing a block.
* recog.h (peep2_rescan): Declare.
* doc/md.texi: Document peep2_rescan.

Index: doc/md.texi
===
--- doc/md.texi (revision 180683)
+++ doc/md.texi (working copy)
@@ -6872,6 +6872,20 @@ If we had not added the @code{(match_dup
 sequence, it might have been the case that the register we chose at the
 beginning of the sequence is killed by the first or second @code{set}.
 
+The @code{peephole2} pass usually scans each basic block only once.  If you
+have a @code{peephole2} pattern that, once applied, might enable other
+@code{peephole2} patterns to be matched, you can request to re-run the
+scan over the current basic block by setting the variable
+@code{peep2_rescan} to @code{true} in the @var{preparation-statements}
+of the @code{peephole2} pattern.
+You should be careful not to create infinite loops by doing this.
+E.g.  one technique to avoid loops is to have a cost function (as a concept
+to describe the pattern sequences, not necessarily actual code - although
+for complex designs, implementing it as actual code might help debugging
+ and/or implementation), and make sure that any @code{peephole2} pattern
+that sets @code{peep2_rescan} lowers this cost function, and no
+@code{peephole2} pattern increases this cost function.
+
 @end ifset
 @ifset INTERNALS
 @node Insn Attributes
Index: recog.c
===
--- recog.c (revision 180683)
+++ recog.c (working copy)
@@ -1,6 +1,6 @@
 /* Subroutines used by or related to instruction recognition.
Copyright (C) 1987, 1988, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998
-   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
Free Software Foundation, Inc.
 
 This file is part of GCC.
@@ -3467,6 +3467,8 @@ peep2_fill_buffer (basic_block bb, rtx i
   return true;
 }
 
+bool peep2_rescan;
+
 /* Perform the peephole2 optimization pass.  */
 
 static void
@@ -3491,9 +3493,14 @@ peephole2_optimize (void)
 
   FOR_EACH_BB_REVERSE (bb)
 {
-  bool past_end = false;
+  bool past_end;
   int pos;
 
+rescan_block:
+  peep2_rescan = false;
+
+  past_end = false;
+
   rtl_profile_for_bb (bb);
 
   /* Start up propagation.  */
@@ -3546,6 +3553,8 @@ peephole2_optimize (void)
  peep2_current = peep2_buf_position (peep2_current + 1);
  peep2_current_count--;
}
+  if (peep2_rescan)
+   goto rescan_block;
 }
 
   default_rtl_profile ();
Index: recog.h
===
--- recog.h (revision 180683)
+++ recog.h (working copy)
@@ -1,6 +1,6 @@
 /* Declarations for interface to insn recognizer and insn-output.c.
Copyright (C) 1987, 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004,
-   2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+   2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -311,5 +311,6 @@ struct insn_data_d
 
 extern const struct insn_data_d insn_data[];
 extern int peep2_current_count;
+extern bool peep2_rescan;
 
 #endif /* GCC_RECOG_H */


[COMMITTED,fortran] small whitespace patch

2011-10-30 Thread Steve Kargl
I've committed the following small whitespace patch
that allows one to do 'grep -E ^gfc_free' to find
functions starting with this pattern.


2011-10-30  Steven G. Kargl  

* symbol.c (gfc_free_charlen): Whitespace.


Index: symbol.c
===
--- symbol.c(revision 180686)
+++ symbol.c(working copy)
@@ -3209,7 +3209,8 @@ gfc_new_charlen (gfc_namespace *ns, gfc_
 /* Free the charlen list from cl to end (end is not freed). 
Free the whole list if end is NULL.  */
 
-void gfc_free_charlen (gfc_charlen *cl, gfc_charlen *end)
+void
+gfc_free_charlen (gfc_charlen *cl, gfc_charlen *end)
 {
   gfc_charlen *cl2;
 
-- 
Steve


Re: [patch, Fortran] Fix PR 50690

2011-10-30 Thread Tobias Burnus

Mikael Morin wrote:

Let's keep Jakub CC-ed for mixes of OpenMP and frontend optimizations. ;-)

There are two commented lines in the testcase. Is it expected?
Otherwise doesn't look too bad...


I had also a glance at the patch - and it looks reasonable; in 
particular, I failed to generate a failing test case.


Besides the
  !$omp parallel
  !$omp workshare
one should also add a test for - it can also be in the same file -:
  !$omp parallel workshare

Regarding the test case: You cannot place a "dg-do run" OpenMP test case 
into gcc/testsuite/gfortran.dg/gomp/workshare2.f90; you have to use 
libgomp/testsuite/libgomp.fortran. The former directory only allows 
"dg-do compile" test cases. (By the way, running "make check" for 
libgomp does never harm.)


Jakub, what do you think?

Tobias


Jakub Jelinek wrote:

Though, what could be done is just special case OpenMP workshare
regions, insert everything into BLOCK local vars unless in OpenMP
workshare, in that
case put the BLOCK with the temporary around the workshare rather than
inside of it. In the case of omp parallel workshare it would need
to go in between omp parallel and omp workshare.

Well, here's a patch which implements this concept. I chose to insert
the BLOCK in a separate pass because it was the cleanest way to avoid
infinite recursion when inserting a block.

Regression-tested. OK for trunk?

Thomas

2011-10-21 Thomas Koenig

PR fortran/50690
* frontend-passes.c (workshare_level): New variable.
(create_var): Put the newly created variable into the block
around the WORKSHARE.
(enclose_workshare): New callback function to enclose
WORKSHAREs in blocks.
(optimize_namespace): Use it.
(gfc_code_walker): Save/restore current namespace when
following a BLOCK. Keep track of workshare level.

2011-10-21 Thomas Koenig

PR fortran/50690
* gfortran.dg/gomp/workshare2.f90: New test.




[PATCH] PR fortran/50404 -- CLOSE requires unit number

2011-10-30 Thread Steve Kargl
I've had this patch in my i386-*-freebsd and x86_64-*-freebsd
for more than a week.  Several 'gmake check-gfortran' have 
been run during that time without a regression.

OK for trunk?

2011-10-30  Steven G. Kargl  

PR fortran/50404
* io.c (gfc_resolve_close): A CLOSE statement requires a unit number.

2011-10-30  Steven G. Kargl  

PR fortran/50404
* gfortran.dg/no_unit_error_2.f90: New test.

-- 
Steve
Index: fortran/io.c
===
--- fortran/io.c	(revision 180687)
+++ fortran/io.c	(working copy)
@@ -2295,6 +2295,12 @@ gfc_resolve_close (gfc_close *close)
   if (gfc_reference_st_label (close->err, ST_LABEL_TARGET) == FAILURE)
 return FAILURE;
 
+  if (close->unit == NULL)
+{
+  gfc_error ("CLOSE statement at %C requires a UNIT number");
+  return FAILURE;
+}
+
   if (close->unit->expr_type == EXPR_CONSTANT
   && close->unit->ts.type == BT_INTEGER
   && mpz_sgn (close->unit->value.integer) < 0)
Index: testsuite/gfortran.dg/no_unit_error_2.f90
===
--- testsuite/gfortran.dg/no_unit_error_2.f90	(revision 0)
+++ testsuite/gfortran.dg/no_unit_error_2.f90	(revision 0)
@@ -0,0 +1,4 @@
+! { dg-do compile }
+! PR fortran/50404
+close(iostat=i)   ! { dg-error "requires a UNIT number" }
+end


[PATCH] Handle many consecutive location notes more efficiently in dwarf2.

2011-10-30 Thread David Miller

Tests such as limits-fndefn.c spend %97 of their time in
next_real_insn() when -g is on the command line.

It's the invocation from dwarf2out_var_location().  These test cases
are basically 100,000 consecutive var location notes, followed by a
real instruction.

This is similar to the reorg issue I dealt with yesterday, we
basically scan the entire function over and over again.

How I handle this here is if we see that the next insn is yet another
var location note we cache the next_real_insn() result.

Now limits-fndefn.c with "-O3 -g" takes about 20 seconds instead of
several minutes on my Niagara-T3 box.

Committed to trunk.

gcc/

* dwarf2out.c (dwarf2out_var_location): When processing several
consecutive location notes, cache the result of next_real_insn().

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@180695 
138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/ChangeLog   |5 +
 gcc/dwarf2out.c |   34 --
 2 files changed, 37 insertions(+), 2 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 26bb1a9..037138a 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2011-10-30  David S. Miller  
+
+   * dwarf2out.c (dwarf2out_var_location): When processing several
+   consecutive location notes, cache the result of next_real_insn().
+
 2011-10-30  Uros Bizjak  
 
* config/i386/i386.md (avx2_vec_dup): Macroize insn from
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 8d5a9f0..478952f 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -20127,10 +20127,12 @@ dwarf2out_var_location (rtx loc_note)
 {
   char loclabel[MAX_ARTIFICIAL_LABEL_BYTES + 2];
   struct var_loc_node *newloc;
-  rtx next_real;
+  rtx next_real, next_note;
   static const char *last_label;
   static const char *last_postcall_label;
   static bool last_in_cold_section_p;
+  static rtx expected_next_loc_note;
+  static rtx cached_next_real_insn;
   tree decl;
   bool var_loc_p;
 
@@ -20149,7 +20151,35 @@ dwarf2out_var_location (rtx loc_note)
   if (var_loc_p && !DECL_P (NOTE_VAR_LOCATION_DECL (loc_note)))
 return;
 
-  next_real = next_real_insn (loc_note);
+  /* Optimize processing a large consecutive sequence of location
+ notes so we don't spend too much time in next_real_insn.  If the
+ next insn is another location note, remember the next_real_insn
+ calculation for next time.  */
+  next_real = cached_next_real_insn;
+  if (next_real)
+{
+  if (expected_next_loc_note != loc_note)
+   next_real = NULL_RTX;
+}
+
+  next_note = NEXT_INSN (loc_note);
+  if (! next_note
+  || INSN_DELETED_P (next_note)
+  || GET_CODE (next_note) != NOTE
+  || (NOTE_KIND (next_note) != NOTE_INSN_VAR_LOCATION
+ && NOTE_KIND (next_note) != NOTE_INSN_CALL_ARG_LOCATION))
+next_note = NULL_RTX;
+
+  if (! next_real)
+next_real = next_real_insn (loc_note);
+
+  if (next_note)
+{
+  expected_next_loc_note = next_note;
+  cached_next_real_insn = next_real;
+}
+  else
+cached_next_real_insn = NULL_RTX;
 
   /* If there are no instructions which would be affected by this note,
  don't do anything.  */
-- 
1.7.6.401.g6a319



Re: [PATCH] PR fortran/50404 -- CLOSE requires unit number

2011-10-30 Thread Jerry DeLisle

On 10/30/2011 07:50 PM, Steve Kargl wrote:

I've had this patch in my i386-*-freebsd and x86_64-*-freebsd
for more than a week.  Several 'gmake check-gfortran' have
been run during that time without a regression.

OK for trunk?


OK, thanks for patch.

Jerry


Re: [C++ preview patch] PR 44277

2011-10-30 Thread Paolo Carlini
... this is another option: use an 'integer_zero_or_nullptr_node (tree)' 
defined differently for C and C++. Certainly the whole thing becomes 
smaller.


Paolo.


Index: c-family/c.opt
===
--- c-family/c.opt  (revision 180690)
+++ c-family/c.opt  (working copy)
@@ -685,6 +685,9 @@ Wpointer-sign
 C ObjC Var(warn_pointer_sign) Init(-1) Warning
 Warn when a pointer differs in signedness in an assignment
 
+Wzero-as-null-pointer-constant
+C++ ObjC++ Var(warn_zero_as_null_pointer_constant) Warning
+
 ansi
 C ObjC C++ ObjC++
 A synonym for -std=c89 (for C) or -std=c++98 (for C++)
Index: c-family/c-common.c
===
--- c-family/c-common.c (revision 180690)
+++ c-family/c-common.c (working copy)
@@ -4093,7 +4093,8 @@ c_common_truthvalue_conversion (location_t locatio
   return build_binary_op (location, NE_EXPR, expr, fixed_zero_node, 1);
 }
   else
-return build_binary_op (location, NE_EXPR, expr, integer_zero_node, 1);
+return build_binary_op (location, NE_EXPR, expr,
+   integer_zero_or_nullptr_node (expr), 1);
 
  ret:
   protected_set_expr_location (expr, location);
Index: c-family/c-common.h
===
--- c-family/c-common.h (revision 180690)
+++ c-family/c-common.h (working copy)
@@ -889,6 +889,8 @@ extern tree common_type (tree, tree);
 
 extern tree decl_constant_value (tree);
 
+extern tree integer_zero_or_nullptr_node (tree);
+
 /* Handle increment and decrement of boolean types.  */
 extern tree boolean_increment (enum tree_code, tree);
 
Index: cp/typeck.c
===
--- cp/typeck.c (revision 180690)
+++ cp/typeck.c (working copy)
@@ -4058,7 +4058,9 @@ cp_build_binary_op (location_t location,
  else 
{
  op0 = build_ptrmemfunc_access_expr (op0, pfn_identifier);
- op1 = cp_convert (TREE_TYPE (op0), integer_zero_node); 
+ op1 = cp_convert (TREE_TYPE (op0),
+   NULLPTR_TYPE_P (TREE_TYPE (op1))
+   ? nullptr_node : integer_zero_node);
}
  result_type = TREE_TYPE (op0);
}
@@ -4658,6 +4660,16 @@ build_x_unary_op (enum tree_code code, tree xarg,
   return exp;
 }
 
+/*
+ */
+tree
+integer_zero_or_nullptr_node (tree expr)
+{
+  tree type = TREE_TYPE (expr);
+  return (TYPE_PTR_P (type) || TYPE_PTRMEMFUNC_P (type)
+ ? nullptr_node : integer_zero_node);
+}
+
 /* Like c_common_truthvalue_conversion, but handle pointer-to-member
constants, where a null value is represented by an INTEGER_CST of
-1.  */
@@ -4668,7 +4680,7 @@ cp_truthvalue_conversion (tree expr)
   tree type = TREE_TYPE (expr);
   if (TYPE_PTRMEM_P (type))
 return build_binary_op (EXPR_LOCATION (expr),
-   NE_EXPR, expr, integer_zero_node, 1);
+   NE_EXPR, expr, nullptr_node, 1);
   else
 return c_common_truthvalue_conversion (input_location, expr);
 }
Index: cp/init.c
===
--- cp/init.c   (revision 180690)
+++ cp/init.c   (working copy)
@@ -176,6 +176,8 @@ build_zero_init_1 (tree type, tree nelts, bool sta
items with static storage duration that are not otherwise
initialized are initialized to zero.  */
 ;
+  else if (TYPE_PTR_P (type) || TYPE_PTR_TO_MEMBER_P (type))
+init = convert (type, nullptr_node);
   else if (SCALAR_TYPE_P (type))
 init = convert (type, integer_zero_node);
   else if (CLASS_TYPE_P (type))
Index: cp/cvt.c
===
--- cp/cvt.c(revision 180690)
+++ cp/cvt.c(working copy)
@@ -198,6 +198,10 @@ cp_convert_to_pointer (tree type, tree expr)
 
   if (null_ptr_cst_p (expr))
 {
+  if (!NULLPTR_TYPE_P (TREE_TYPE (expr)))
+   warning (OPT_Wzero_as_null_pointer_constant,
+"zero as null pointer constant");
+
   if (TYPE_PTRMEMFUNC_P (type))
return build_ptrmemfunc (TYPE_PTRMEMFUNC_FN_TYPE (type), expr, 0,
 /*c_cast_p=*/false, tf_warning_or_error);
Index: c-typeck.c
===
--- c-typeck.c  (revision 180690)
+++ c-typeck.c  (working copy)
@@ -9510,6 +9510,15 @@ scalar_to_vector (location_t loc, enum tree_code c
 
   return stv_nothing;
 }
+
+/*
+ */
+tree
+integer_zero_or_nullptr_node (tree type ATTRIBUTE_UNUSED)
+{
+  return integer_zero_node;
+}
+
 
 /* Build a binary-operation expression without default conversions.
CODE is the kind of expression to build.


Re: Factor mangled id computation (issue5311075)

2011-10-30 Thread Jason Merrill

OK.

Jason


Re: C++ PATCH to add -std=c++11 ??

2011-10-30 Thread Jason Merrill
Here's my start at adjusting things to use the C++11 name; feel free to 
run with it.


Looking at it again, I think adding __GXX_EXPERIMENTAL_CXX11__ is a 
mistake, we should just set __cplusplus to the C++11 value.


Jason
commit 9c331b6de02e796fa25b04ed206b8570c83ee237
Author: Jason Merrill 
Date:   Fri Aug 12 17:09:47 2011 -0400

	* c-common.h (cxx_dialect): Add cxx11 and cxx03.
	* c.opt: Add -std=c++11, -std=gnu++11, -std=gnu++03,
	and -Wc++11-compat.
	* c-opts.c (set_std_cxx11): Rename from set_std_cxx0x.
	* c-cppbuiltin.c (c_cpp_builtins): Also define
	__GXX_EXPERIMENTAL_CXX11__.

diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h
index be9d729..71746a9 100644
--- a/gcc/c-family/c-common.h
+++ b/gcc/c-family/c-common.h
@@ -643,11 +643,12 @@ extern int flag_use_repository;
 /* The supported C++ dialects.  */
 
 enum cxx_dialect {
-  /* C++98  */
+  /* C++98 with TC1  */
   cxx98,
-  /* Experimental features that are likely to become part of
- C++0x.  */
-  cxx0x
+  cxx03 = cxx98,
+  /* C++11  */
+  cxx0x,
+  cxx11 = cxx0x
 };
 
 /* The C++ dialect being used. C++98 is the default.  */
diff --git a/gcc/c-family/c-cppbuiltin.c b/gcc/c-family/c-cppbuiltin.c
index bb9893a..f6075d9 100644
--- a/gcc/c-family/c-cppbuiltin.c
+++ b/gcc/c-family/c-cppbuiltin.c
@@ -598,8 +598,11 @@ c_cpp_builtins (cpp_reader *pfile)
 	cpp_define (pfile, "__DEPRECATED");
   if (flag_rtti)
 	cpp_define (pfile, "__GXX_RTTI");
-  if (cxx_dialect == cxx0x)
-cpp_define (pfile, "__GXX_EXPERIMENTAL_CXX0X__");
+  if (cxx_dialect == cxx11)
+	{
+	  cpp_define (pfile, "__GXX_EXPERIMENTAL_CXX0X__");
+	  cpp_define (pfile, "__GXX_EXPERIMENTAL_CXX11__");
+	}
 }
   /* Note that we define this for C as well, so that we know if
  __attribute__((cleanup)) will interface with EH.  */
diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c
index 6869d5c..b15dcb4 100644
--- a/gcc/c-family/c-opts.c
+++ b/gcc/c-family/c-opts.c
@@ -110,7 +110,7 @@ static size_t include_cursor;
 
 static void handle_OPT_d (const char *);
 static void set_std_cxx98 (int);
-static void set_std_cxx0x (int);
+static void set_std_cxx11 (int);
 static void set_std_c89 (int, int);
 static void set_std_c99 (int);
 static void set_std_c1x (int);
@@ -775,10 +775,10 @@ c_common_handle_option (size_t scode, const char *arg, int value,
 	set_std_cxx98 (code == OPT_std_c__98 /* ISO */);
   break;
 
-case OPT_std_c__0x:
-case OPT_std_gnu__0x:
+case OPT_std_c__11:
+case OPT_std_gnu__11:
   if (!preprocessing_asm_p)
-	set_std_cxx0x (code == OPT_std_c__0x /* ISO */);
+	set_std_cxx11 (code == OPT_std_c__11 /* ISO */);
   break;
 
 case OPT_std_c90:
@@ -1501,18 +1501,18 @@ set_std_cxx98 (int iso)
   cxx_dialect = cxx98;
 }
 
-/* Set the C++ 0x working draft "standard" (without GNU extensions if ISO).  */
+/* Set the C++ 2011 standard (without GNU extensions if ISO).  */
 static void
-set_std_cxx0x (int iso)
+set_std_cxx11 (int iso)
 {
   cpp_set_lang (parse_in, iso ? CLK_CXX0X: CLK_GNUCXX0X);
   flag_no_gnu_keywords = iso;
   flag_no_nonansi_builtin = iso;
   flag_iso = iso;
-  /* C++0x includes the C99 standard library.  */
+  /* C++11 includes the C99 standard library.  */
   flag_isoc94 = 1;
   flag_isoc99 = 1;
-  cxx_dialect = cxx0x;
+  cxx_dialect = cxx11;
 }
 
 /* Args to -d specify what to dump.  Silently ignore
diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
index 693f191..336a75a 100644
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
@@ -289,7 +289,11 @@ Warn about C constructs that are not in the common subset of C and C++
 
 Wc++0x-compat
 C++ ObjC++ Var(warn_cxx0x_compat) Warning
-Warn about C++ constructs whose meaning differs between ISO C++ 1998 and ISO C++ 200x
+Deprecated in favor of -Wc++11-compat
+
+Wc++11-compat
+C++ ObjC++ Warning Alias(Wc++0x-compat)
+Warn about C++ constructs whose meaning differs between ISO C++ 1998 and ISO C++ 2011
 
 Wcast-qual
 C ObjC C++ ObjC++ Var(warn_cast_qual) Warning
@@ -1175,12 +1179,13 @@ std=c++03
 C++ ObjC++ Alias(std=c++98)
 Conform to the ISO 1998 C++ standard revised by the 2003 technical corrigendum
 
-std=c++0x
+std=c++11
 C++ ObjC++
-Conform to the ISO 1998 C++ standard, with extensions that are likely to
-become a part of the upcoming ISO C++ standard, dubbed C++0x. Note that the
-extensions enabled by this mode are experimental and may be removed in
-future releases of GCC.
+Conform to the ISO 2011 C++ standard (experimental and incomplete support)
+
+std=c++0x
+C++ ObjC++ Alias(std=c++11)
+Deprecated in favor of -std=c++11
 
 std=c1x
 C ObjC
@@ -1204,14 +1209,21 @@ Deprecated in favor of -std=c99
 
 std=gnu++98
 C++ ObjC++
-Conform to the ISO 1998 C++ standard with GNU extensions
+Conform to the ISO 1998 C++ standard revised by the 2003 technical
+corrigendum with GNU extensions
 
-std=gnu++0x
+std=gnu++03
+C++ ObjC++ Alias(std=gnu++98)
+Conform to the ISO 1998 C++ standard revised by the 2003 technical
+corrigendum wi

Re: [google] ThreadSanitizer instrumentation pass (issue 5303083)

2011-10-30 Thread davidxl

Have not done with reviewing. This is the first batch.

David


http://codereview.appspot.com/5303083/diff/1/gcc/passes.c
File gcc/passes.c (right):

http://codereview.appspot.com/5303083/diff/1/gcc/passes.c#newcode1423
gcc/passes.c:1423: NEXT_PASS (pass_tsan);
Move this to the same place as asan. Otherwise TARGET_MEM_REF won't be
handled.

http://codereview.appspot.com/5303083/diff/1/gcc/tree-tsan.c
File gcc/tree-tsan.c (right):

http://codereview.appspot.com/5303083/diff/1/gcc/tree-tsan.c#newcode56
gcc/tree-tsan.c:56: The instrumentation module mainintains shadow call
stacks
s/mainitains/maintains/

http://codereview.appspot.com/5303083/diff/1/gcc/tree-tsan.c#newcode60
gcc/tree-tsan.c:60: Instrumentation for shadow stack maintainance is as
follows:
s/maintainance/maintenance/

http://codereview.appspot.com/5303083/diff/1/gcc/tree-tsan.c#newcode94
gcc/tree-tsan.c:94: #define RTL_STACK "__tsan_shadow_stack"
Please change RTL_ prefix to TSAN_. It is confusing to use RTL_

http://codereview.appspot.com/5303083/diff/1/gcc/tree-tsan.c#newcode100
gcc/tree-tsan.c:100: enum tsan_ignore_e
better to be tsan_ignore_type or tsan_ignore_kind.

http://codereview.appspot.com/5303083/diff/1/gcc/tree-tsan.c#newcode110
gcc/tree-tsan.c:110: enum bb_state_e
A new empty line is needed. Same for other comments leading a decl, or
function.

http://codereview.appspot.com/5303083/diff/1/gcc/tree-tsan.c#newcode110
gcc/tree-tsan.c:110: enum bb_state_e
bb_state_e -->bb_state

http://codereview.appspot.com/5303083/diff/1/gcc/tree-tsan.c#newcode119
gcc/tree-tsan.c:119: struct bb_data_t
_t suffix is better removed. Same for other types with _t suffix.

http://codereview.appspot.com/5303083/diff/1/gcc/tree-tsan.c#newcode161
gcc/tree-tsan.c:161: tree __attribute__((weak))
Explain this.

http://codereview.appspot.com/5303083/diff/1/gcc/tree-tsan.c#newcode169
gcc/tree-tsan.c:169: extern __thread void **__tsan_shadow_stack; */
Need two white space before */.  Same for other instances.

http://codereview.appspot.com/5303083/diff/1/gcc/tree-tsan.c#newcode182
gcc/tree-tsan.c:182:
Better use varpool_get_node interface.

http://codereview.appspot.com/5303083/diff/1/gcc/tree-tsan.c#newcode186
gcc/tree-tsan.c:186: TREE_STATIC (def) = 1;
Why mark TREE_STATIC (def) = 1? Should the variable be defined in tsan
library?

http://codereview.appspot.com/5303083/diff/1/gcc/tree-tsan.c#newcode189
gcc/tree-tsan.c:189: DECL_TLS_MODEL (def) = decl_default_tls_model
(def);
Check if targetm.have_tls -- though for those target, tsan won't be
used.

http://codereview.appspot.com/5303083/diff/1/gcc/tree-tsan.c#newcode200
gcc/tree-tsan.c:200: {
Refactor the code so that it can be shared with the above one.

http://codereview.appspot.com/5303083/diff/1/gcc/tree-tsan.c#newcode228
gcc/tree-tsan.c:228: {
The name of the function is very confusing. Change it to
get_tsan_mop_handler_decl or something like that.

http://codereview.appspot.com/5303083/diff/1/gcc/tree-tsan.c#newcode251
gcc/tree-tsan.c:251: /* Adds new ignore definition to the global list */
Add documentation on function parameters (in upper case) such as " TYPE
is the ignore type, and NAME is the name of the function to be ignored.
If there is return value, document it too.

http://codereview.appspot.com/5303083/diff/1/gcc/tree-tsan.c#newcode257
gcc/tree-tsan.c:257: desc = (struct tsan_ignore_desc_t*)xmalloc (sizeof
(*desc));
Use XCNEW to clear.

http://codereview.appspot.com/5303083/diff/1/gcc/tree-tsan.c#newcode264
gcc/tree-tsan.c:264: /* Checks as to whether identifier 'str' matches
template 'templ'.
Use STR instead of 'str'. 'templ' --> TEMPL.

http://codereview.appspot.com/5303083/diff/1/gcc/tree-tsan.c#newcode291
gcc/tree-tsan.c:291: if (spos == NULL)
Move the check up right after spos is computed.

http://codereview.appspot.com/5303083/diff/1/gcc/tree-tsan.c#newcode349
gcc/tree-tsan.c:349: printf ("failed to open ignore file '%s'\n",
flag_tsan_ignore);
Use error (..)

http://codereview.appspot.com/5303083/diff/1/gcc/tree-tsan.c#newcode360
gcc/tree-tsan.c:360: if (line [sz-1] == '\r' || line [sz-1] == '\n')
sz-1 --> sz - 1

Change other instances

http://codereview.appspot.com/5303083/diff/1/gcc/tree-tsan.c#newcode391
gcc/tree-tsan.c:391: src_name =
expand_location(cfun->function_start_locus).file;
space before (

http://codereview.appspot.com/5303083/diff/1/gcc/tree-tsan.c#newcode413
gcc/tree-tsan.c:413: static const char *
Missing documentation.

http://codereview.appspot.com/5303083/diff/1/gcc/tree-tsan.c#newcode443
gcc/tree-tsan.c:443: tree rtl_stack;
Do not use rtl_ prefix. Same for other instances.

http://codereview.appspot.com/5303083/diff/1/gcc/tree-tsan.c#newcode459
gcc/tree-tsan.c:459: s = NULL;
MODIFY_EXPR?  directly use gimple_build_assign.

http://codereview.appspot.com/5303083/diff/1/gcc/tree-tsan.c#newcode725
gcc/tree-tsan.c:725:
This is wrong. SSA_NAME expr should be skipped.

http://codereview.appspot.com/5303083/diff/1/gcc/tree-tsan.c#newcode730
gcc/tree-tsan.c:730: {
remove {} Same

[PATCH] Slight improvements to vec_init code gen on sparc.

2011-10-30 Thread David Miller

There is definitely more than can be done in this area, but at least
this is a start.

Next we can start trying to use the ASI_FL{8,16,32}_P short floating
point loads which zero extend a 8, 16, or 32 bit integer value into a
double precision float register.

gcc/

* config/sparc/sparc.c (vector_init_bshuffle): New function.
(vector_init_fpmerge): New function.
(sparc_expand_vector_init): Use them to improve non-const cases.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@180696 
138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/ChangeLog|4 ++
 gcc/config/sparc/sparc.c |  105 ++
 2 files changed, 109 insertions(+), 0 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 037138a..a851ba1 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,9 @@
 2011-10-30  David S. Miller  
 
+   * config/sparc/sparc.c (vector_init_bshuffle): New function.
+   (vector_init_fpmerge): New function.
+   (sparc_expand_vector_init): Use them to improve non-const cases.
+
* dwarf2out.c (dwarf2out_var_location): When processing several
consecutive location notes, cache the result of next_real_insn().
 
diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
index 3883dbd..fd1b190 100644
--- a/gcc/config/sparc/sparc.c
+++ b/gcc/config/sparc/sparc.c
@@ -11279,6 +11279,67 @@ output_v8plus_mult (rtx insn, rtx *operands, const 
char *name)
 }
 }
 
+static void
+vector_init_bshuffle (rtx target, rtx elt, enum machine_mode mode,
+ enum machine_mode inner_mode)
+{
+  rtx t1, final_insn;
+  int bmask;
+
+  t1 = gen_reg_rtx (mode);
+
+  elt = convert_modes (SImode, inner_mode, elt, true);
+  emit_move_insn (gen_lowpart(SImode, t1), elt);
+
+  switch (mode)
+   {
+   case V2SImode:
+ final_insn = gen_bshufflev2si_vis (target, t1, t1);
+ bmask = 0x45674567;
+ break;
+   case V4HImode:
+ final_insn = gen_bshufflev4hi_vis (target, t1, t1);
+ bmask = 0x67676767;
+ break;
+   case V8QImode:
+ final_insn = gen_bshufflev8qi_vis (target, t1, t1);
+ bmask = 0x;
+ break;
+   default:
+ gcc_unreachable ();
+   }
+
+  emit_insn (gen_bmasksi_vis (gen_reg_rtx (SImode), CONST0_RTX (SImode),
+ force_reg (SImode, GEN_INT (bmask;
+  emit_insn (final_insn);
+}
+
+static void
+vector_init_fpmerge (rtx target, rtx elt, enum machine_mode inner_mode)
+{
+  rtx t1, t2, t3, t3_low;
+
+  t1 = gen_reg_rtx (V4QImode);
+  elt = convert_modes (SImode, inner_mode, elt, true);
+  emit_move_insn (gen_lowpart (SImode, t1), elt);
+
+  t2 = gen_reg_rtx (V4QImode);
+  emit_move_insn (t2, t1);
+
+  t3 = gen_reg_rtx (V8QImode);
+  t3_low = gen_lowpart (V4QImode, t3);
+
+  emit_insn (gen_fpmerge_vis (t3, t1, t2));
+  emit_move_insn (t1, t3_low);
+  emit_move_insn (t2, t3_low);
+
+  emit_insn (gen_fpmerge_vis (t3, t1, t2));
+  emit_move_insn (t1, t3_low);
+  emit_move_insn (t2, t3_low);
+
+  emit_insn (gen_fpmerge_vis (gen_lowpart (V8QImode, target), t1, t2));
+}
+
 void
 sparc_expand_vector_init (rtx target, rtx vals)
 {
@@ -11286,13 +11347,18 @@ sparc_expand_vector_init (rtx target, rtx vals)
   enum machine_mode inner_mode = GET_MODE_INNER (mode);
   int n_elts = GET_MODE_NUNITS (mode);
   int i, n_var = 0;
+  bool all_same;
   rtx mem;
 
+  all_same = true;
   for (i = 0; i < n_elts; i++)
 {
   rtx x = XVECEXP (vals, 0, i);
   if (!CONSTANT_P (x))
n_var++;
+
+  if (i > 0 && !rtx_equal_p (x, XVECEXP (vals, 0, 0)))
+   all_same = false;
 }
 
   if (n_var == 0)
@@ -11301,6 +11367,45 @@ sparc_expand_vector_init (rtx target, rtx vals)
   return;
 }
 
+  if (GET_MODE_SIZE (inner_mode) == GET_MODE_SIZE (mode))
+{
+  if (GET_MODE_SIZE (inner_mode) == 4)
+   {
+ emit_move_insn (gen_lowpart (SImode, target),
+ gen_lowpart (SImode, XVECEXP (vals, 0, 0)));
+ return;
+   }
+  else if (GET_MODE_SIZE (inner_mode) == 8)
+   {
+ emit_move_insn (gen_lowpart (DImode, target),
+ gen_lowpart (DImode, XVECEXP (vals, 0, 0)));
+ return;
+   }
+}
+  else if (GET_MODE_SIZE (inner_mode) == GET_MODE_SIZE (word_mode)
+  && GET_MODE_SIZE (mode) == 2 * GET_MODE_SIZE (word_mode))
+{
+  emit_move_insn (gen_highpart (word_mode, target),
+ gen_lowpart (word_mode, XVECEXP (vals, 0, 0)));
+  emit_move_insn (gen_lowpart (word_mode, target),
+ gen_lowpart (word_mode, XVECEXP (vals, 0, 1)));
+  return;
+}
+
+  if (all_same && GET_MODE_SIZE (mode) == 8)
+{
+  if (TARGET_VIS2)
+   {
+ vector_init_bshuffle (target, XVECEXP (vals, 0, 0), mode, inner_mode);
+ return;
+   }
+  if (mode == V8QImode)
+   {
+ vector_init_fpmerge (t