Re: Make timevar phases mutually exclusive. (issue6302064)

2012-06-14 Thread Jason Merrill

OK.

Jason


Re: [PATCH] Fix ICE in expand_cse_reciprocals (PR tree-optimization/42078)

2012-06-14 Thread Alexandre Oliva
On Apr 12, 2012, Richard Guenther richard.guent...@gmail.com wrote:

 +  /* If the conditions in which this function uses VALUE change,
 + adjust gimple_replace_lhs_wants_value().  */
 +  gcc_assert (gimple_replace_lhs_wants_value ()
 + == MAY_HAVE_DEBUG_STMTS);
 +
 if (MAY_HAVE_DEBUG_STMTS)
   {

 that looks ... odd.

Indeed, it does.  Does this look any better?

  bool save_value = MAY_HAVE_DEBUG_STMTS;
  /* If the condition above, in which this function uses VALUE change,
 adjust gimple_replace_lhs_wants_value() to match.  The assert
 below helps enforce this.  */
  gcc_checking_assert (gimple_replace_lhs_wants_value () == save_value);

  if (save_value)
{


-- 
Alexandre Oliva, freedom fighterhttp://FSFLA.org/~lxoliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/   FSF Latin America board member
Free Software Evangelist  Red Hat Brazil Compiler Engineer


Re: [PATCH, ARM] New CPU support for Marvell PJ4 cores

2012-06-14 Thread Chung-Lin Tang
On 2012/6/14 02:18 AM, Ramana Radhakrishnan wrote:
 On 29 May 2012 10:07, Yi-Hsiu Hsu a...@marvell.com wrote:
 Hi,

 This patch maintains Marvell PJ4 cores pipeline description.
 Run arm testsuite on arm-linux-gnueabi and no extra regressions are found.

* config/arm/marvell-pj4.md: New marvell-pj4 pipeline description.
* config/arm/arm.c (arm_issue_rate): Add marvell_pj4.
* config/arm/arm-cores.def: Add core marvell-pj4.
* config/arm/arm-tune.md: Regenerated.
* config/arm/arm-tables.opt: Regenerated.
* doc/invoke.texi: Added entry for marvell-pj4.
 
 This command line option should also be added to BE8_LINK_SPEC similar
 to what's done for the other v7-a cores.
 
 Ok with that change.

I take the blame for not doing this back then, but I suggest the
resource names be properly qualified, similar to most recently added
pipeline descriptions, e.g. prepend resource/reservation names with
pj4_  (is to pj4_is, etc.)

Chung-Lin


Re: [PATCH] Add option for dumping to stderr (issue6190057)

2012-06-14 Thread Sharad Singhai
Thanks for your comments. Responses inline.

On Wed, Jun 13, 2012 at 4:48 AM, Richard Guenther
richard.guent...@gmail.com wrote:
 On Fri, Jun 8, 2012 at 7:16 AM, Sharad Singhai sing...@google.com wrote:
 Okay, I have updated the attached patch so that the output from
 -ftree-vectorizer-verbose is considered diagnostic information and is
 always
 sent to stderr. Other functionality remains unchanged. Here is some
 more context about this patch.

 This patch improves the dump infrastructure and public interfaces so
 that the existing private pass-specific dump stream is separated from
 the diagnostic dump stream (typically stderr).  The optimization
 passes can output information on the two streams independently.

 The newly defined interfaces are:

 Individual passes do not need to access the dump file directly. Thus Instead
 of doing

   if (dump_file  (flags  dump_flags))
      fprintf (dump_file, ...);

 they can do

     dump_printf (flags, ...);

 If the current pass has FLAGS enabled then the information gets
 printed into the dump file otherwise not.

 Similar to the dump_printf (), another function is defined, called

        diag_printf (dump_flags, ...)

 This prints information only onto the diagnostic stream, typically
 standard error. It is useful for separating pass-specific dump
 information from
 the diagnostic information.

 Currently, as a proof of concept, I have converted vectorizer passes
 to use the new dump format. For this, I have considered
 information printed in vect_dump file as diagnostic. Thus 'fprintf'
 calls are changed to 'diag_printf'. Some other information printed to
 dump_file is sent to the regular dump file via 'dump_printf ()'. It
 helps to separate the two streams because they might serve different
 purposes and might have different formatting requirements.

 For example, using the trunk compiler, the following invocation

 g++ -S v.cc -ftree-vectorize -fdump-tree-vect -ftree-vectorizer-verbose=2

 prints tree vectorizer dump into a file named 'v.cc.113t.vect'.
 However, the verbose diagnostic output is silently
 ignored. This is not desirable as the two types of dump should not interfere.

 After this patch, the vectorizer dump is available in 'v.cc.113t.vect'
 as before, but the verbose vectorizer diagnostic is additionally
 printed on stderr. Thus both types of dump information are output.

 An additional feature of this patch is that individual passes can
 print dump information into command-line named files instead of auto
 numbered filename. For example,

 I'd wish you'd leave out this part for a followup.

I thought you wanted all parts together. Anyway, I can remove this part.



 g++ -S -O2 v.cc -ftree-vectorize -fdump-tree-vect=foo.vect
     -ftree-vectorizer-verbose=2
     -fdump-tree-pre=foo.pre

 This prints the tree vectorizer dump into 'foo.vect', PRE dump into
 'foo.pre', and the vectorizer verbose diagnostic dump onto stderr.

 Please take another look.

 --- tree-vect-loop-manip.c      (revision 188325)
 +++ tree-vect-loop-manip.c      (working copy)
 @@ -789,14 +789,11 @@ slpeel_make_loop_iterate_ntimes (struct loop *loop
   gsi_remove (loop_cond_gsi, true);

   loop_loc = find_loop_location (loop);
 -  if (dump_file  (dump_flags  TDF_DETAILS))
 -    {
 -      if (loop_loc != UNKNOWN_LOC)
 -        fprintf (dump_file, \nloop at %s:%d: ,
 +  if (loop_loc != UNKNOWN_LOC)
 +    dump_printf (TDF_DETAILS, \nloop at %s:%d: ,
                  LOC_FILE (loop_loc), LOC_LINE (loop_loc));
 -      print_gimple_stmt (dump_file, cond_stmt, 0, TDF_SLIM);
 -    }
 -
 +  if (dump_flags  TDF_DETAILS)
 +    dump_gimple_stmt (TDF_SLIM, cond_stmt, 0);
   loop-nb_iterations = niters;

 I'm confused by this.  Why is this not simply

  if (loop_loc != UNKNOWN_LOC)
    dump_printf (dump_flags, \nloop at %s:%d: ,
                       LOC_FILE (loop_loc), LOC_LINE (loop_loc));
  dump_gimple_stmt (dump_flags | TDF_SLIM, cond_stmt, 0);

 for example.  I notice that you maybe mis-understood the message 
 classification
 I asked you to add (maybe I confused you by mentioning to eventually re-use
 the TDF_* flags).  I think you basically provided this message classification
 by adding two classes by providing both dump_gimple_stmt and diag_gimple_stmt.
 But still in the above you keep a dump_flags test _and_ you pass in
 (altered) dump_flags to the dump/diag_gimple_stmt routines.  Let me quote 
 them:

 +void
 +dump_gimple_stmt (int flags, gimple gs, int spc)
 +{
 +  if (dump_file)
 +    print_gimple_stmt (dump_file, gs, spc, flags);
 +}

 +void
 +diag_gimple_stmt (int flags, gimple gs, int spc)
 +{
 +  if (alt_dump_file)
 +    print_gimple_stmt (alt_dump_file, gs, spc, flags);
 +}

 I'd say it should have been a single function:

 void
 dump_gimple_stmt (enum msg_classification, int additional_flags,
 gimple gs, int spc)
 {
  if (msg_classification  go-to-dumpfile
       dump_file)
    print_gimple_stmt (dump_file, gs, spc, dump_flags | additional_flags);
  if 

Re: [PATCH] Some vector cost model cleanup

2012-06-14 Thread Richard Guenther
On Wed, 13 Jun 2012, William J. Schmidt wrote:

 This is just some general maintenance to the vectorizer's cost model
 code:
 
  * Corrects a typo in a function name;
  * Eliminates an unnecessary function;
  * Combines some duplicate inline functions.
 
 Bootstrapped and tested on powerpc64-unknown-linux-gnu, no new
 regressions.  Ok for trunk?

Ok.

Thanks for doing this,
Richard.

 Thanks,
 Bill
 
 
 2012-06-13  Bill Schmidt  wschm...@linux.ibm.com
 
   * tree-vectorizer.h (vect_get_stmt_cost): Move from tree-vect-stmts.c.
   (cost_for_stmt): Remove decl.
   (vect_get_single_scalar_iteration_cost): Correct typo in name.
   * tree-vect-loop.c (vect_get_cost): Remove.
   (vect_get_single_scalar_iteration_cost): Correct typo in name; use
   vect_get_stmt_cost rather than vect_get_cost.
   (vect_get_known_peeling_cost): Use vect_get_stmt_cost rather than
   vect_get_cost.
   (vect_estimate_min_profitable_iters): Correct typo in call to
   vect_get_single_scalar_iteration_cost; use vect_get_stmt_cost rather
   than vect_get_cost.
   (vect_model_reduction_cost): Use vect_get_stmt_cost rather than
   vect_get_cost.
   (vect_model_induction_cost): Likewise.
   * tree-vect-data-refs.c (vect_peeling_hash_get_lowest_cost): Correct
   typo in call to vect_get_single_scalar_iteration_cost.
   * tree-vect-stmts.c (vect_get_stmt_cost): Move to tree-vectorizer.h.
   (cost_for_stmt): Remove unnecessary function.
   * Makefile.in (TREE_VECTORIZER_H): Update dependencies.
 
 
 Index: gcc/tree-vectorizer.h
 ===
 --- gcc/tree-vectorizer.h (revision 188507)
 +++ gcc/tree-vectorizer.h (working copy)
 @@ -23,6 +23,7 @@ along with GCC; see the file COPYING3.  If not see
  #define GCC_TREE_VECTORIZER_H
  
  #include tree-data-ref.h
 +#include target.h
  
  typedef source_location LOC;
  #define UNKNOWN_LOC UNKNOWN_LOCATION
 @@ -769,6 +770,18 @@ vect_pow2 (int x)
return res;
  }
  
 +/* Get cost by calling cost target builtin.  */
 +
 +static inline
 +int vect_get_stmt_cost (enum vect_cost_for_stmt type_of_cost)
 +{
 +  tree dummy_type = NULL;
 +  int dummy = 0;
 +
 +  return targetm.vectorize.builtin_vectorization_cost (type_of_cost,
 +   dummy_type, dummy);
 +}
 +
  /*-*/
  /* Info on data references alignment.  */
  /*-*/
 @@ -843,7 +856,6 @@ extern void vect_model_load_cost (stmt_vec_info, i
  extern void vect_finish_stmt_generation (gimple, gimple,
   gimple_stmt_iterator *);
  extern bool vect_mark_stmts_to_be_vectorized (loop_vec_info);
 -extern int cost_for_stmt (gimple);
  extern tree vect_get_vec_def_for_operand (tree, gimple, tree *);
  extern tree vect_init_vector (gimple, tree, tree,
gimple_stmt_iterator *);
 @@ -919,7 +931,7 @@ extern int vect_estimate_min_profitable_iters (loo
  extern tree get_initial_def_for_reduction (gimple, tree, tree *);
  extern int vect_min_worthwhile_factor (enum tree_code);
  extern int vect_get_known_peeling_cost (loop_vec_info, int, int *, int);
 -extern int vect_get_single_scalar_iteraion_cost (loop_vec_info);
 +extern int vect_get_single_scalar_iteration_cost (loop_vec_info);
  
  /* In tree-vect-slp.c.  */
  extern void vect_free_slp_instance (slp_instance);
 Index: gcc/tree-vect-loop.c
 ===
 --- gcc/tree-vect-loop.c  (revision 188507)
 +++ gcc/tree-vect-loop.c  (working copy)
 @@ -1201,19 +1201,6 @@ vect_analyze_loop_form (struct loop *loop)
  }
  
  
 -/* Get cost by calling cost target builtin.  */
 -
 -static inline int
 -vect_get_cost (enum vect_cost_for_stmt type_of_cost)
 -{
 -  tree dummy_type = NULL;
 -  int dummy = 0;
 -
 -  return targetm.vectorize.builtin_vectorization_cost (type_of_cost,
 -   dummy_type, dummy);
 -}
 -
 - 
  /* Function vect_analyze_loop_operations.
  
 Scan the loop stmts and make sure they are all vectorizable.  */
 @@ -2385,7 +2372,7 @@ vect_force_simple_reduction (loop_vec_info loop_in
  
  /* Calculate the cost of one scalar iteration of the loop.  */
  int
 -vect_get_single_scalar_iteraion_cost (loop_vec_info loop_vinfo)
 +vect_get_single_scalar_iteration_cost (loop_vec_info loop_vinfo)
  {
struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
basic_block *bbs = LOOP_VINFO_BBS (loop_vinfo);
 @@ -2434,12 +2421,12 @@ int
if (STMT_VINFO_DATA_REF (vinfo_for_stmt (stmt)))
  {
if (DR_IS_READ (STMT_VINFO_DATA_REF (vinfo_for_stmt (stmt
 -   stmt_cost = vect_get_cost (scalar_load);
 +   stmt_cost = vect_get_stmt_cost (scalar_load);
 

Re: [SH] PR 53568 - Add support for bswap built-ins

2012-06-14 Thread Richard Guenther
On Thu, Jun 14, 2012 at 4:39 AM, Kaz Kojima kkoj...@rr.iij4u.or.jp wrote:
 Oleg Endo oleg.e...@t-online.de wrote:
 The attached patch improves code generated for byte swap expressions
 such as ((x  0xFF)  8) | ((x  8)  0xFF).
 It seems that currently the tree optimizers only detect bswap32 and
 bswap64 but not bswap16 patterns.  The patch adds detection for bswap16
 patterns by playing along with the combine pass.

 Tested with
 make -k -j8 check RUNTESTFLAGS=--target_board=sh-sim
 \{-m2/-ml,-m2/-mb,-m2a/-mb,-m2a-single/-mb,-m4/-ml,
 -m4/-mb,-m4-single/-ml,-m4-single/-mb,-m4a-single/-ml,
 -m4a-single/-mb}

 and no new failures.
 Test cases for this patch and the previous bswap32 patch will follow
 shortly.

 The patch looks fine to me.  OK for trunk.

 I guess that tree optimizers handle bswap32/64 with its cost
 because they are more frequent and critical in the real working
 set like network codes than bswap16, though I could be wrong
 about it.

I think the bswap16 builtin simply post-dates the bswap recognition code.

Richard.

 Regards,
        kaz


Re: [PATCH] Add option for dumping to stderr (issue6190057)

2012-06-14 Thread Richard Guenther
On Thu, Jun 14, 2012 at 8:58 AM, Sharad Singhai sing...@google.com wrote:
 Thanks for your comments. Responses inline.

 On Wed, Jun 13, 2012 at 4:48 AM, Richard Guenther
 richard.guent...@gmail.com wrote:
 On Fri, Jun 8, 2012 at 7:16 AM, Sharad Singhai sing...@google.com wrote:
 Okay, I have updated the attached patch so that the output from
 -ftree-vectorizer-verbose is considered diagnostic information and is
 always
 sent to stderr. Other functionality remains unchanged. Here is some
 more context about this patch.

 This patch improves the dump infrastructure and public interfaces so
 that the existing private pass-specific dump stream is separated from
 the diagnostic dump stream (typically stderr).  The optimization
 passes can output information on the two streams independently.

 The newly defined interfaces are:

 Individual passes do not need to access the dump file directly. Thus Instead
 of doing

   if (dump_file  (flags  dump_flags))
      fprintf (dump_file, ...);

 they can do

     dump_printf (flags, ...);

 If the current pass has FLAGS enabled then the information gets
 printed into the dump file otherwise not.

 Similar to the dump_printf (), another function is defined, called

        diag_printf (dump_flags, ...)

 This prints information only onto the diagnostic stream, typically
 standard error. It is useful for separating pass-specific dump
 information from
 the diagnostic information.

 Currently, as a proof of concept, I have converted vectorizer passes
 to use the new dump format. For this, I have considered
 information printed in vect_dump file as diagnostic. Thus 'fprintf'
 calls are changed to 'diag_printf'. Some other information printed to
 dump_file is sent to the regular dump file via 'dump_printf ()'. It
 helps to separate the two streams because they might serve different
 purposes and might have different formatting requirements.

 For example, using the trunk compiler, the following invocation

 g++ -S v.cc -ftree-vectorize -fdump-tree-vect -ftree-vectorizer-verbose=2

 prints tree vectorizer dump into a file named 'v.cc.113t.vect'.
 However, the verbose diagnostic output is silently
 ignored. This is not desirable as the two types of dump should not 
 interfere.

 After this patch, the vectorizer dump is available in 'v.cc.113t.vect'
 as before, but the verbose vectorizer diagnostic is additionally
 printed on stderr. Thus both types of dump information are output.

 An additional feature of this patch is that individual passes can
 print dump information into command-line named files instead of auto
 numbered filename. For example,

 I'd wish you'd leave out this part for a followup.

 I thought you wanted all parts together. Anyway, I can remove this part.



 g++ -S -O2 v.cc -ftree-vectorize -fdump-tree-vect=foo.vect
     -ftree-vectorizer-verbose=2
     -fdump-tree-pre=foo.pre

 This prints the tree vectorizer dump into 'foo.vect', PRE dump into
 'foo.pre', and the vectorizer verbose diagnostic dump onto stderr.

 Please take another look.

 --- tree-vect-loop-manip.c      (revision 188325)
 +++ tree-vect-loop-manip.c      (working copy)
 @@ -789,14 +789,11 @@ slpeel_make_loop_iterate_ntimes (struct loop *loop
   gsi_remove (loop_cond_gsi, true);

   loop_loc = find_loop_location (loop);
 -  if (dump_file  (dump_flags  TDF_DETAILS))
 -    {
 -      if (loop_loc != UNKNOWN_LOC)
 -        fprintf (dump_file, \nloop at %s:%d: ,
 +  if (loop_loc != UNKNOWN_LOC)
 +    dump_printf (TDF_DETAILS, \nloop at %s:%d: ,
                  LOC_FILE (loop_loc), LOC_LINE (loop_loc));
 -      print_gimple_stmt (dump_file, cond_stmt, 0, TDF_SLIM);
 -    }
 -
 +  if (dump_flags  TDF_DETAILS)
 +    dump_gimple_stmt (TDF_SLIM, cond_stmt, 0);
   loop-nb_iterations = niters;

 I'm confused by this.  Why is this not simply

  if (loop_loc != UNKNOWN_LOC)
    dump_printf (dump_flags, \nloop at %s:%d: ,
                       LOC_FILE (loop_loc), LOC_LINE (loop_loc));
  dump_gimple_stmt (dump_flags | TDF_SLIM, cond_stmt, 0);

 for example.  I notice that you maybe mis-understood the message 
 classification
 I asked you to add (maybe I confused you by mentioning to eventually re-use
 the TDF_* flags).  I think you basically provided this message classification
 by adding two classes by providing both dump_gimple_stmt and 
 diag_gimple_stmt.
 But still in the above you keep a dump_flags test _and_ you pass in
 (altered) dump_flags to the dump/diag_gimple_stmt routines.  Let me quote 
 them:

 +void
 +dump_gimple_stmt (int flags, gimple gs, int spc)
 +{
 +  if (dump_file)
 +    print_gimple_stmt (dump_file, gs, spc, flags);
 +}

 +void
 +diag_gimple_stmt (int flags, gimple gs, int spc)
 +{
 +  if (alt_dump_file)
 +    print_gimple_stmt (alt_dump_file, gs, spc, flags);
 +}

 I'd say it should have been a single function:

 void
 dump_gimple_stmt (enum msg_classification, int additional_flags,
 gimple gs, int spc)
 {
  if (msg_classification  go-to-dumpfile
       dump_file)
    

Re: [PATCH, i386]: Back port Fix PR 52908 - xop-mul-1:f9 miscompiled on bulldozer (-mxop) to 4.7

2012-06-14 Thread Uros Bizjak
On Thu, Jun 7, 2012 at 1:33 PM, Jakub Jelinek ja...@redhat.com wrote:
 On Thu, Jun 07, 2012 at 06:07:18AM -0500, venkataramanan.ku...@amd.com wrote:
 Please find the patch below that backports PR target/52908 to GCC 4.7.

 The patch passed bootstrap and regression test.

 Ok to commit?

 Please wait with it until 4.7.1 is released.

 +2012-06-07  Venkataramanan Kumar venkataramanan.ku...@amd.com
 +

 The common way is to use:
        Backport from mainline
        2012-05-09  Uros Bizjak  ubiz...@gmail.com
 instead of the following line:
 +     Backport from  2012-05-09 mainline r187354
 +
 +     PR target/52908
 +     * config/i386/sse.md (vec_widen_smult_hi_v4si): Expand using
 +     xop_pmacsdqh insn pattern instead of xop_mulv2div2di3_high.
 +     (vec_widen_smult_lo_v4si): Expand using xop_pmacsdql insn pattern
 +     instead of xop_mulv2div2di3_low.
 +     (xop_pmacsdql): Fix vec_select selector.
 +     (xop_pmacsdqh): Ditto.
 +     (xop_mulv2div2di3_low): Remove insn_and_split pattern.
 +     (xop_mulv2div2di3_high): Ditto.

OK with above change.

Thanks,
Uros.


long long availability in host compiler (Re: constant that doesn't fit in 32bits in alpha.c)

2012-06-14 Thread Pedro Alves
On 06/13/2012 10:35 PM, Richard Henderson wrote:

 On 2012-06-13 02:13, Pedro Alves wrote:
 Related, does gcc forbid long long / ULL ?
 
 
 Normally, yes.  The vmsdbgout.c file seems to use it all over though.


And git blame shows:

8d60d2bc (kenner   2001-12-02 14:38:07 +   41) /* Difference in seconds 
between the VMS Epoch and the Unix Epoch */
8d60d2bc (kenner   2001-12-02 14:38:07 +   42) static const long long 
vms_epoch_offset = 3506716800ll;
   ^^

That's my point.  We've been using long long / ll for a while now without
noticing (I least I hadn't noticed the libdecnumber uses before), and nobody
seems to have tripped on any host compiler that doesn't support it.  Is it
justifiable nowadays to not assume it's available?

 Cleaning that up is independent of this thread though.


Of course.

-- 
Pedro Alves


Re: long long availability in host compiler (Re: constant that doesn't fit in 32bits in alpha.c)

2012-06-14 Thread Tristan Gingold

On Jun 14, 2012, at 11:12 AM, Pedro Alves wrote:

 On 06/13/2012 10:35 PM, Richard Henderson wrote:
 
 On 2012-06-13 02:13, Pedro Alves wrote:
 Related, does gcc forbid long long / ULL ?
 
 
 Normally, yes.  The vmsdbgout.c file seems to use it all over though.
 
 
 And git blame shows:
 
 8d60d2bc (kenner   2001-12-02 14:38:07 +   41) /* Difference in seconds 
 between the VMS Epoch and the Unix Epoch */
 8d60d2bc (kenner   2001-12-02 14:38:07 +   42) static const long long 
 vms_epoch_offset = 3506716800ll;
   ^^
 
 That's my point.  We've been using long long / ll for a while now without
 noticing (I least I hadn't noticed the libdecnumber uses before), and nobody
 seems to have tripped on any host compiler that doesn't support it.  Is it
 justifiable nowadays to not assume it's available?

OTOH, this file is compiled only for alpha-vms target, so I doubt it is 
commonly compiled.

Tristan.



[arm] Remove obsolete FPA support (2/n): Remove command-line options

2012-06-14 Thread Richard Earnshaw
This patch removes the command line options that enabled generation of
FPA and maverick instructions, along with their associated documentation.

* arm.opt (mfp=2, mfp=3, mfpe, mfpe=2, mfpe=3): Delete options.
* arm-fpus.def (fpa, fpe2, fpe3, maverick): Delete FPU types.
* arm-tables.opt: Regenerated.
* doc/invoke.texi: Remove references to deleted options.

R.Index: doc/invoke.texi
===
--- doc/invoke.texi (revision 188510)
+++ doc/invoke.texi (working copy)
@@ -479,7 +479,7 @@ Objective-C and Objective-C++ Dialects}.
 -mapcs-reentrant  -mno-apcs-reentrant @gol
 -msched-prolog  -mno-sched-prolog @gol
 -mlittle-endian  -mbig-endian  -mwords-little-endian @gol
--mfloat-abi=@var{name}  -mfpe @gol
+-mfloat-abi=@var{name} @gol
 -mfp16-format=@var{name}
 -mthumb-interwork  -mno-thumb-interwork @gol
 -mcpu=@var{name}  -march=@var{name}  -mfpu=@var{name}  @gol
@@ -10823,20 +10823,12 @@ Linux, and not all architectures are rec
 unsuccessful the option has no effect.
 
 @item -mfpu=@var{name}
-@itemx -mfpe=@var{number}
-@itemx -mfp=@var{number}
 @opindex mfpu
-@opindex mfpe
-@opindex mfp
 This specifies what floating-point hardware (or hardware emulation) is
-available on the target.  Permissible names are: @samp{fpa}, @samp{fpe2},
-@samp{fpe3}, @samp{maverick}, @samp{vfp}, @samp{vfpv3}, @samp{vfpv3-fp16},
-@samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd}, @samp{vfpv3xd-fp16},
-@samp{neon}, @samp{neon-fp16}, @samp{vfpv4}, @samp{vfpv4-d16},
-@samp{fpv4-sp-d16} and @samp{neon-vfpv4}.
-@option{-mfp} and @option{-mfpe} are synonyms for
-@option{-mfpu}=@samp{fpe}@var{number}, for compatibility with older versions
-of GCC@.
+available on the target.  Permissible names are: @samp{vfp}, @samp{vfpv3},
+@samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
+@samp{vfpv3xd-fp16}, @samp{neon}, @samp{neon-fp16}, @samp{vfpv4},
+@samp{vfpv4-d16}, @samp{fpv4-sp-d16} and @samp{neon-vfpv4}.
 
 If @option{-msoft-float} is specified this specifies the format of
 floating-point values.
Index: config/arm/arm-tables.opt
===
--- config/arm/arm-tables.opt   (revision 188510)
+++ config/arm/arm-tables.opt   (working copy)
@@ -360,56 +360,44 @@ Name(arm_fpu) Type(int)
 Known ARM FPUs (for use with the -mfpu= option):
 
 EnumValue
-Enum(arm_fpu) String(fpa) Value(0)
+Enum(arm_fpu) String(vfp) Value(0)
 
 EnumValue
-Enum(arm_fpu) String(fpe2) Value(1)
+Enum(arm_fpu) String(vfpv3) Value(1)
 
 EnumValue
-Enum(arm_fpu) String(fpe3) Value(2)
+Enum(arm_fpu) String(vfpv3-fp16) Value(2)
 
 EnumValue
-Enum(arm_fpu) String(maverick) Value(3)
+Enum(arm_fpu) String(vfpv3-d16) Value(3)
 
 EnumValue
-Enum(arm_fpu) String(vfp) Value(4)
+Enum(arm_fpu) String(vfpv3-d16-fp16) Value(4)
 
 EnumValue
-Enum(arm_fpu) String(vfpv3) Value(5)
+Enum(arm_fpu) String(vfpv3xd) Value(5)
 
 EnumValue
-Enum(arm_fpu) String(vfpv3-fp16) Value(6)
+Enum(arm_fpu) String(vfpv3xd-fp16) Value(6)
 
 EnumValue
-Enum(arm_fpu) String(vfpv3-d16) Value(7)
+Enum(arm_fpu) String(neon) Value(7)
 
 EnumValue
-Enum(arm_fpu) String(vfpv3-d16-fp16) Value(8)
+Enum(arm_fpu) String(neon-fp16) Value(8)
 
 EnumValue
-Enum(arm_fpu) String(vfpv3xd) Value(9)
+Enum(arm_fpu) String(vfpv4) Value(9)
 
 EnumValue
-Enum(arm_fpu) String(vfpv3xd-fp16) Value(10)
+Enum(arm_fpu) String(vfpv4-d16) Value(10)
 
 EnumValue
-Enum(arm_fpu) String(neon) Value(11)
+Enum(arm_fpu) String(fpv4-sp-d16) Value(11)
 
 EnumValue
-Enum(arm_fpu) String(neon-fp16) Value(12)
+Enum(arm_fpu) String(neon-vfpv4) Value(12)
 
 EnumValue
-Enum(arm_fpu) String(vfpv4) Value(13)
-
-EnumValue
-Enum(arm_fpu) String(vfpv4-d16) Value(14)
-
-EnumValue
-Enum(arm_fpu) String(fpv4-sp-d16) Value(15)
-
-EnumValue
-Enum(arm_fpu) String(neon-vfpv4) Value(16)
-
-EnumValue
-Enum(arm_fpu) String(vfp3) Value(17)
+Enum(arm_fpu) String(vfp3) Value(13)
 
Index: config/arm/arm.opt
===
--- config/arm/arm.opt  (revision 188510)
+++ config/arm/arm.opt  (working copy)
@@ -126,12 +126,6 @@ Enum(float_abi_type) String(softfp) Valu
 EnumValue
 Enum(float_abi_type) String(hard) Value(ARM_FLOAT_ABI_HARD)
 
-mfp=2
-Target RejectNegative Undocumented Alias(mfpu=, fpe2)
-
-mfp=3
-Target RejectNegative Undocumented Alias(mfpu=, fpe3)
-
 mfp16-format=
 Target RejectNegative Joined Enum(arm_fp16_format_type) Var(arm_fp16_format) 
Init(ARM_FP16_FORMAT_NONE)
 Specify the __fp16 floating-point format
@@ -149,16 +143,6 @@ Enum(arm_fp16_format_type) String(ieee) 
 EnumValue
 Enum(arm_fp16_format_type) String(alternative) 
Value(ARM_FP16_FORMAT_ALTERNATIVE)
 
-;; Now ignored.
-mfpe
-Target RejectNegative Mask(FPE) Undocumented
-
-mfpe=2
-Target RejectNegative Undocumented Alias(mfpu=, fpe2)
-
-mfpe=3
-Target RejectNegative Undocumented Alias(mfpu=, fpe3)
-
 mfpu=
 Target RejectNegative Joined Enum(arm_fpu) Var(arm_fpu_index)
 

[PATCH] Testcase for VRP range-anti-range merging

2012-06-14 Thread Richard Guenther

Tested on x86_64-unknown-linux-gnu, applied.

Richard.

2012-06-14  Richard Guenther  rguent...@suse.de

* gcc.dg/tree-ssa/vrp.h: New testcase.
* gcc.dg/tree-ssa/vrp68.c: Likewise.

Index: gcc/testsuite/gcc.dg/tree-ssa/vrp.h
===
--- gcc/testsuite/gcc.dg/tree-ssa/vrp.h (revision 0)
+++ gcc/testsuite/gcc.dg/tree-ssa/vrp.h (revision 0)
@@ -0,0 +1,27 @@
+extern void link_error(void);
+
+#define RANGE(name, min, max) \
+  if (name  min || name  max) \
+return;
+#define ANTI_RANGE(name, min, max) \
+  if (name = min  name = max) \
+return;
+#define MERGE(cond, name1, name2) \
+  if (cond) \
+name1 = name2;
+#define CHECK_RANGE(expr, min, max) \
+  do { \
+ __typeof__ (expr) v = (expr); \
+ if (v  min) link_error(); \
+ if (v  max) link_error(); \
+ if (v  min || v  max) link_error (); \
+  } while (0) 
+#define CHECK_ANTI_RANGE(expr, min, max) \
+  do { \
+__typeof__ (expr) v = (expr); \
+if (v = min) \
+  if (v = max) \
+link_error(); \
+if (v = min  v = max) \
+  link_error(); \
+  } while (0)
Index: gcc/testsuite/gcc.dg/tree-ssa/vrp68.c
===
--- gcc/testsuite/gcc.dg/tree-ssa/vrp68.c   (revision 0)
+++ gcc/testsuite/gcc.dg/tree-ssa/vrp68.c   (revision 0)
@@ -0,0 +1,24 @@
+/* { dg-do link } */
+/* { dg-options -O2 -fdump-tree-vrp1 } */
+
+#include vrp.h
+
+void test1 (int i, int j, int b)
+{
+  RANGE(i, 2, 6);
+  ANTI_RANGE(j, 1, 7);
+  MERGE(b, i, j);
+  CHECK_ANTI_RANGE(i, 7, 7);
+  CHECK_ANTI_RANGE(i, 1, 1);
+  /* If we swap the anti-range tests the ~[6, 6] test is never eliminated.  */
+}
+int main() { }
+
+/* While subsequent VRP/DOM passes manage to even recognize the ~[6, 6]
+   test as redundant a single VRP run will arbitrarily choose ~[0, 0] when
+   merging [1, 5] with ~[0, 6] so the first VRP pass can only eliminate
+   the ~[0, 0] check as redundant.  */
+
+/* { dg-final { scan-tree-dump-times vrp1 0 link_error { xfail *-*-* } } } 
*/
+/* { dg-final { scan-tree-dump-times vrp1 1 link_error } } */
+/* { dg-final { cleanup-tree-dump vrp1 } } */


Re: long long availability in host compiler (Re: constant that doesn't fit in 32bits in alpha.c)

2012-06-14 Thread Pedro Alves
On 06/14/2012 10:20 AM, Tristan Gingold wrote:

 
 On Jun 14, 2012, at 11:12 AM, Pedro Alves wrote:


 And git blame shows:

 8d60d2bc (kenner   2001-12-02 14:38:07 +   41) /* Difference in seconds 
 between the VMS Epoch and the Unix Epoch */
 8d60d2bc (kenner   2001-12-02 14:38:07 +   42) static const long long 
 vms_epoch_offset = 3506716800ll;
   ^^

 That's my point.  We've been using long long / ll for a while now without
 noticing (I least I hadn't noticed the libdecnumber uses before), and nobody
 seems to have tripped on any host compiler that doesn't support it.  Is it
 justifiable nowadays to not assume it's available?
 
 OTOH, this file is compiled only for alpha-vms target, so I doubt it is 
 commonly compiled.


Ah, the presence of gcc/vmsdbgout.o on my AMD64 GNU/Linux native build make me
believe otherwise.  It's guarded by VMS_DEBUGGING_INFO.

But note that in libdecnumber we have:

10de71e1 (meissner 2007-03-24 17:04:47 + 25) typedef unsigned int UINT32;
10de71e1 (meissner 2007-03-24 17:04:47 + 26) typedef unsigned long long 
UINT64;
10de71e1 (meissner 2007-03-24 17:04:47 + 27) typedef struct { UINT64 w[2]; 
} UINT128;
...
10de71e1 (meissner 2007-03-24 17:04:47 +28)   { { 
0x3b645a1cac083127ull, 0x0083126e978d4fdfull } }, /* 3 extra digits */
10de71e1 (meissner 2007-03-24 17:04:47 +29)   { { 
0x4af4f0d844d013aaULL, 0x00346dc5d6388659ULL } }, /*  10^(-4) * 2^131 */
   ^^

-- 
Pedro Alves


[PATCH, GCC][AArch64] Fix bound check diagnostics.

2012-06-14 Thread Sofiane Naci
Hi,

This patch improves bound check diagnostics code.

Thanks
Sofiane

-

2012-06-13  Sofiane Naci sofiane.n...@arm.com

[AArch64] Fix bound check diagnostics.

* gcc/config/aarch64/aarch64.c
(bounds_check): Remove.
(aarch64_simd_lane_bounds): Replace call to bounds_check with
function
body.
(aarch64_simd_const_bounds): Likewise.


aarch64-bound-check-diagnostics.patch
Description: Binary data


Fix PR c++/19351 (operator new[] overflow)

2012-06-14 Thread Florian Weimer
This is another attempt at ensuring that operator new[] always returns a 
block of sufficient size.


This is on top of my previous patch rejecting VLA allocations:
http://gcc.gnu.org/ml/gcc-patches/2012-06/msg00616.html

Bootstrapped and tested on x86_64-linux-gnu.

--
Florian Weimer / Red Hat Product Security Team

2012-06-14  Florian Weimer  fwei...@redhat.com

	PR c++/19351
	* call.c (build_operator_new_call): Add size_check argument and
	evaluate it.
	* cp-tree.h (build_operator_new_call): Adjust declaration.
	* init.c (build_new_1): Compute array size check and apply it.

2012-06-14  Florian Weimer  fwei...@redhat.com

	* g++.dg/init/new37.C: New test.
	* g++.dg/init/new38.C: New test.
	* g++.dg/init/new39.C: New test.

diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 09965b3..806e0ba 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -3943,15 +3943,19 @@ build_new_function_call (tree fn, VEC(tree,gc) **args, bool koenig_p,
total number of bytes required by the allocation, and is updated if
that is changed here.  *COOKIE_SIZE is non-NULL if a cookie should
be used.  If this function determines that no cookie should be
-   used, after all, *COOKIE_SIZE is set to NULL_TREE.  If FN is
-   non-NULL, it will be set, upon return, to the allocation function
-   called.  */
+   used, after all, *COOKIE_SIZE is set to NULL_TREE.  If SIZE_CHECK
+   is not NULL_TREE, it is evaluated before calculating the final
+   array size, and if it fails, the array size is replaced with
+   (size_t)-1 (usually triggering a std::bad_alloc exception).  If FN
+   is non-NULL, it will be set, upon return, to the allocation
+   function called.  */
 
 tree
 build_operator_new_call (tree fnname, VEC(tree,gc) **args,
-			 tree *size, tree *cookie_size,
+			 tree *size, tree *cookie_size, tree size_check,
 			 tree *fn, tsubst_flags_t complain)
 {
+  tree original_size = *size;
   tree fns;
   struct z_candidate *candidates;
   struct z_candidate *cand;
@@ -3959,6 +3963,10 @@ build_operator_new_call (tree fnname, VEC(tree,gc) **args,
 
   if (fn)
 *fn = NULL_TREE;
+  /* Set to (size_t)-1 if the size check fails.  */
+  if (size_check != NULL_TREE)
+*size = fold_build3 (COND_EXPR, sizetype, size_check,
+			 original_size, TYPE_MAX_VALUE (sizetype));
   VEC_safe_insert (tree, gc, *args, 0, *size);
   *args = resolve_args (*args, complain);
   if (*args == NULL)
@@ -4022,7 +4030,11 @@ build_operator_new_call (tree fnname, VEC(tree,gc) **args,
if (use_cookie)
 	 {
 	   /* Update the total size.  */
-	   *size = size_binop (PLUS_EXPR, *size, *cookie_size);
+	   *size = size_binop (PLUS_EXPR, original_size, *cookie_size);
+	   /* Set to (size_t)-1 if the size check fails.  */
+	   gcc_assert (size_check != NULL_TREE);
+	   *size = fold_build3 (COND_EXPR, sizetype, size_check,
+*size, TYPE_MAX_VALUE (sizetype));
 	   /* Update the argument list to reflect the adjusted size.  */
 	   VEC_replace (tree, *args, 0, *size);
 	 }
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index a4b7ae3..9033108 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -4879,7 +4879,7 @@ extern tree build_user_type_conversion		(tree, tree, int,
 extern tree build_new_function_call		(tree, VEC(tree,gc) **, bool, 
 		 tsubst_flags_t);
 extern tree build_operator_new_call		(tree, VEC(tree,gc) **, tree *,
-		 tree *, tree *,
+		 tree *, tree, tree *,
 		 tsubst_flags_t);
 extern tree build_new_method_call		(tree, tree, VEC(tree,gc) **,
 		 tree, int, tree *,
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index bdca799..5103ed9 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -2175,7 +2175,10 @@ build_new_1 (VEC(tree,gc) **placement, tree type, tree nelts,
   tree pointer_type;
   tree non_const_pointer_type;
   tree outer_nelts = NULL_TREE;
+  /* For arrays, a bounds checks on the NELTS parameter. */
+  tree outer_nelts_check = NULL_TREE;
   bool outer_nelts_from_type = false;
+  double_int inner_nelts_count = double_int_one;
   tree alloc_call, alloc_expr;
   /* The address returned by the call to operator new.  This node is
  a VAR_DECL and is therefore reusable.  */
@@ -2228,7 +2231,22 @@ build_new_1 (VEC(tree,gc) **placement, tree type, tree nelts,
 {
   tree inner_nelts = array_type_nelts_top (elt_type);
   tree inner_nelts_cst = maybe_constant_value (inner_nelts);
-  if (!TREE_CONSTANT (inner_nelts_cst))
+  if (TREE_CONSTANT (inner_nelts_cst)
+	   TREE_CODE (inner_nelts_cst) == INTEGER_CST)
+	{
+	  double_int result;
+	  if (mul_double (TREE_INT_CST_LOW (inner_nelts_cst),
+			  TREE_INT_CST_HIGH (inner_nelts_cst),
+			  inner_nelts_count.low, inner_nelts_count.high,
+			  result.low, result.high))
+	{
+	  if (complain  tf_error)
+		error (integer overflow in array size);
+	  nelts = error_mark_node;
+	}
+	  inner_nelts_count = result;
+	}
+  else
 	{
 	  if (complain  tf_error)
 	error_at (EXPR_LOC_OR_HERE (inner_nelts),
@@ -2256,8 +2274,8 @@ build_new_1 

[PATCH][AARCH64]: Add missing AdvSIMD intrinsics - vmlsq_laneq_*.

2012-06-14 Thread Tejas Belagod


Hi,

This patch adds missing AdvSIMD intrinsics vmlsq_laneq_suf16,32  to
arm_neon.h. OK?

Thanks,
Tejas Belagod
ARM.

Changelog:

2012-06-14  Tejas Belagod  tejas.bela...@arm.com

gcc/
* config/aarch64/arm_neon.h (vmlsq_laneq_f32, vmlsq_laneq_s16,
vmlsq_laneq_u16, vmlsq_laneq_s32, vmlsq_laneq_u32): New.

testsuite/
* gcc.target/aarch64/vmlsq_laneq.c: New.diff --git a/gcc/config/aarch64/arm_neon.h b/gcc/config/aarch64/arm_neon.h
index 58976cc..3b581bd 100644
--- a/gcc/config/aarch64/arm_neon.h
+++ b/gcc/config/aarch64/arm_neon.h
@@ -11151,6 +11151,77 @@ vmlsl_u32 (uint64x2_t a, uint32x2_t b, uint32x2_t c)
result;  \
  })
 
+#define vmlsq_laneq_f32(__a, __b, __c, __d)\
+  __extension__
\
+({ \
+   float32x4_t __c_ = (__c);   \
+   float32x4_t __b_ = (__b);   \
+   float32x4_t __a_ = (__a);   \
+   float32x4_t __result;   \
+   float32x4_t __t1;   \
+   __asm__ (fmul %1.4s, %3.4s, %4.s[%5]; fsub %0.4s, %0.4s, %1.4s
\
+: =w(__result), =w(__t1)   \
+: 0(__a_), w(__b_), w(__c_), i(__d)\
+: /* No clobbers */);  \
+   __result;   \
+ })
+
+#define vmlsq_laneq_s16(__a, __b, __c, __d)\
+  __extension__
\
+({ \
+   int16x8_t __c_ = (__c); \
+   int16x8_t __b_ = (__b); \
+   int16x8_t __a_ = (__a); \
+   int16x8_t __result; \
+   __asm__ (mls %0.8h, %2.8h, %3.h[%4]   \
+: =w(__result)   \
+: 0(__a_), w(__b_), w(__c_), i(__d)\
+: /* No clobbers */);  \
+   __result;   \
+ })
+
+#define vmlsq_laneq_s32(__a, __b, __c, __d)\
+  __extension__
\
+({ \
+   int32x4_t __c_ = (__c); \
+   int32x4_t __b_ = (__b); \
+   int32x4_t __a_ = (__a); \
+   int32x4_t __result; \
+   __asm__ (mls %0.4s, %2.4s, %3.s[%4]   \
+: =w(__result)   \
+: 0(__a_), w(__b_), w(__c_), i(__d)\
+: /* No clobbers */);  \
+   __result;   \
+ })
+
+#define vmlsq_laneq_u16(__a, __b, __c, __d)\
+  __extension__
\
+({ \
+   uint16x8_t __c_ = (__c);
\
+   uint16x8_t __b_ = (__b);
\
+   uint16x8_t __a_ = (__a);
\
+   uint16x8_t __result;\
+   __asm__ (mls %0.8h, %2.8h, %3.h[%4]   \
+: =w(__result)   \
+: 0(__a_), w(__b_), w(__c_), i(__d)\
+: /* No clobbers */);  \
+   __result;   \
+ })
+
+#define vmlsq_laneq_u32(__a, __b, __c, __d)\
+  __extension__
\
+({ \
+   uint32x4_t __c_ = (__c);
\
+   uint32x4_t __b_ = (__b);
\
+   uint32x4_t __a_ = (__a);
\
+   uint32x4_t __result;\
+   __asm__ (mls %0.4s, 

[PATCH][AARCH64]: Remove vpadd_f64 from arm_neon.h.

2012-06-14 Thread Tejas Belagod


Hi,

This patch removes vpadd_f64 from arm_neon.h because the definition is incorrect 
and it should be vpaddq_f64 which is defined elsewhere in the same header. OK?


Thanks,
Tejas.

Changelog:

2012-06-14  Tejas Belagod  tejas.bela...@arm.com

gcc/
* config/aarch64/arm_neon.h (vpadd_f64): Remove.diff --git a/gcc/config/aarch64/arm_neon.h b/gcc/config/aarch64/arm_neon.h
index 58976cc..c6ffd27 100644
--- a/gcc/config/aarch64/arm_neon.h
+++ b/gcc/config/aarch64/arm_neon.h
@@ -13175,17 +13175,6 @@ vpadd_f32 (float32x2_t a, float32x2_t b)
   return result;
 }
 
-__extension__ static __inline float64x2_t __attribute__ ((__always_inline__))
-vpadd_f64 (float64x2_t a, float64x2_t b)
-{
-  float64x2_t result;
-  __asm__ (faddp %0.2d,%1.2d,%2.2d
-   : =w(result)
-   : w(a), w(b)
-   : /* No clobbers */);
-  return result;
-}
-
 __extension__ static __inline int8x8_t __attribute__ ((__always_inline__))
 vpadd_s8 (int8x8_t __a, int8x8_t __b)
 {

Re: [PATCH][AARCH64]: Remove vpadd_f64 from arm_neon.h.

2012-06-14 Thread Marcus Shawcroft

On 14/06/12 11:15, Tejas Belagod wrote:


Hi,

This patch removes vpadd_f64 from arm_neon.h because the definition is incorrect
and it should be vpaddq_f64 which is defined elsewhere in the same header. OK?

Thanks,
Tejas.

Changelog:

2012-06-14  Tejas Belagodtejas.bela...@arm.com

gcc/
  * config/aarch64/arm_neon.h (vpadd_f64): Remove.


OK



[Ada] Funalization of controlled function results in conditional expression

2012-06-14 Thread Arnaud Charlet
This patch adds logic to postpone the finalization of temporary controlled
function results in the context of conditional expressions because the results
are finalized too early.


-- Source --


--  types.ads

with Ada.Finalization; use Ada.Finalization;

package Types is
   type Ctrl is new Controlled with record
  Id : Natural;
   end record;

   procedure Adjust (Obj : in out Ctrl);
   procedure Finalize (Obj : in out Ctrl);
   procedure Initialize (Obj : in out Ctrl);

   type Root is tagged null record;
   type Ctrl_Rec is new Root with record
  Comp : Ctrl;
   end record;

   function Make_Ctrl_Rec (Flag : Boolean) return Ctrl_Rec;
end Types;

--  types.adb

with Ada.Text_IO; use Ada.Text_IO;

package body Types is
   Id_Gen : Natural := 0;

   procedure Adjust (Obj : in out Ctrl) is
  New_Id : constant Natural := Obj.Id * 100;
   begin
  Put_Line (  adj  Obj.Id'Img   -  New_Id'Img);
  Obj.Id := New_Id;
   end Adjust;

   procedure Finalize (Obj : in out Ctrl) is
   begin
  Put_Line (  fin  Obj.Id'Img);
   end Finalize;

   procedure Initialize (Obj : in out Ctrl) is
   begin
  Id_Gen := Id_Gen + 1;
  Obj.Id := Id_Gen;
  Put_Line (  ini  Obj.Id'Img);
   end Initialize;

   function Make_Ctrl_Rec (Flag : Boolean) return Ctrl_Rec is
  Result : Ctrl_Rec;
   begin
  return Result;
   end Make_Ctrl_Rec;
end Types;

--  main.adb

with Ada.Text_IO; use Ada.Text_IO;
with Types;   use Types;

procedure Main is
   function Factorial (N : Natural) return Natural is
   begin
  if N = 0 then
 return 0;
  else
 return N * Factorial (N - 1);
  end if;
   end Factorial;

   Empty : Ctrl_Rec;

begin
   Put_Line (Main);
   declare
  Obj : Root'Class := Empty;

   begin
  Put_Line (Function);
  Obj := (if Factorial (3)  2 then
 Make_Ctrl_Rec (True)
  else
 Make_Ctrl_Rec (False));
  Put_Line (Function end);
   end;
   Put_Line (Main end);
end Main;


-- Compilation and output --


$ gnatmake -q -gnat12 main.adb
$ ./main
$   ini 1
$ Main
$   adj 1 - 100
$ Function
$   ini 2
$   adj 2 - 200
$   fin 2
$   fin 100
$   adj 200 - 2
$   fin 200
$ Function end
$   fin 2
$ Main end
$   fin 1

Tested on x86_64-pc-linux-gnu, committed on trunk

2012-06-14  Hristian Kirtchev  kirtc...@adacore.com

* einfo.adb: Update the usage of Node15.
(Return_Flag_Or_Transient_Decl): Removed.
(Set_Return_Flag_Or_Transient_Decl): Removed.
(Set_Status_Flag_Or_Transient_Decl): New routine.
(Status_Flag_Or_Transient_Decl): New routine.
(Write_Field15_Name): Update the output for variables and constants.
* einfo.ads: Remove attribute
Return_Flag_Or_Transient_Decl along with occurrences in nodes.
(Return_Flag_Or_Transient_Decl): Removed along with pragma Inline.
(Set_Return_Flag_Or_Transient_Decl): Removed along with pragma Inline.
(Set_Status_Flag_Or_Transient_Decl): New routine along with pragma
Inline.
(Status_Flag_Or_Transient_Decl): New routine along with pragma Inline.
* exp_ch4.adb (Create_Alternative): New routine.
(Expand_N_Conditional_Expression): Handle the case
where at least one of the conditional expression
alternatives prodices a controlled temporary by means of a function
call.
(Is_Controlled_Function_Call): New routine.
(Process_Transient_Object): Update the call to
Set_Return_Flag_Or_Transient_Decl.
* exp_ch6.adb (Enclosing_Context): New routine.
(Expand_N_Extended_Return_Statement): Update all calls to
Set_Return_Flag_Or_Transient_Decl.
(Expand_Ctrl_Function_Call): Prohibit the finalization of a controlled
function result when the context is a conditional expression.
* exp_ch7.adb (Process_Declarations): Update all calls to
Return_Flag_Or_Transient_Decl. Add processing for intermediate
results of conditional expressions where one of the alternatives
uses a controlled function call.
(Process_Object_Declaration): Update all calls to
Return_Flag_Or_Transient_Decl and rearrange the logic to process
hook objects first.
(Process_Transient_Objects): Update the call to
Set_Return_Flag_Or_Transient_Decl.
* exp_util.adb (Requires_Cleanup_Actions (List_Id, Boolean,
Boolean)): Update all calls to Return_Flag_Or_Transient_Decl. Add
detection for intermediate results of conditional expressions
where one of the alternatives uses a controlled function call.

Index: exp_ch7.adb
===
--- exp_ch7.adb (revision 188605)
+++ exp_ch7.adb (working copy)
@@ -1884,14 +1884,27 @@
--  transients declared inside an Expression_With_Actions.
 
   

[Ada] Delay of aspect specification evaluation

2012-06-14 Thread Arnaud Charlet
This patch restores the original error messages for duplicated pragma and
attribute definition clause and cleans up the ??? comments. 

Tested on x86_64-pc-linux-gnu, committed on trunk

2012-06-14  Vincent Pucci  pu...@adacore.com

* einfo.adb einfo.ads (Get_Rep_Item): Removed.
(Get_Rep_Item_For_Entity): Removed.
(Get_Rep_Pragma): Removed.
(Get_Rep_Pragma_For_Entity): Removed.
(Has_Rep_Item): Removed.
(Has_Rep_Pragma): Removed.
(Has_Rep_Pragma_For_Entity): Removed.
* exp_ch9.adb (Expand_N_Task_Type_Declaration):
Has_Rep_Pragma_For_Entity replaced by Has_Rep_Pragma
and Get_Rep_Pragma_For_Entity replaced by Get_Rep_Pragma.
(Make_Task_Create_Call): Has_Rep_Pragma_For_Entity replaced
by Has_Rep_Pragma and Get_Rep_Pragma_For_Entity replaced by
Get_Rep_Pragma.
* exp_intr.adb: Dependency to Sem_Aux added for call to Get_Rep_Pragma.
* sem_aux.adb (Get_Rep_Item): New routine.
(Get_Rep_Pragma): New routine.
(Has_Rep_Item): New routine.
(Has_Rep_Pragma): New routine.
(Nearest_Ancestor): Minor reformatting.
* sem_aux.ads (Get_Rep_Item): New routine.
(Get_Rep_Pragma): New routine.
(Has_Rep_Item): New routine.
(Has_Rep_Pragma): New routine.
* sem_ch13.adb (Duplicate_Clause): Restore original error messages.
* sem_eval.adb (Subtypes_Statically_Match): Get_Rep_Item_For_Entity
replaced by Get_Rep_Item.
* sem_prag.adb (Analyze_Pragma): Restore original error messages.
(Check_Duplicate_Pragma): Restore original error messages.

Index: sem_aux.adb
===
--- sem_aux.adb (revision 188605)
+++ sem_aux.adb (working copy)
@@ -32,7 +32,6 @@
 
 with Atree;  use Atree;
 with Einfo;  use Einfo;
-with Namet;  use Namet;
 with Sinfo;  use Sinfo;
 with Snames; use Snames;
 with Stand;  use Stand;
@@ -418,6 +417,155 @@
   return Empty;
end First_Tag_Component;
 
+   --
+   -- Get_Rep_Item --
+   --
+
+   function Get_Rep_Item
+ (E : Entity_Id;
+  Nam   : Name_Id;
+  Check_Parents : Boolean := True) return Node_Id
+   is
+  N : Node_Id;
+
+   begin
+  N := First_Rep_Item (E);
+  while Present (N) loop
+ if Nkind (N) = N_Pragma
+   and then
+ (Pragma_Name (N) = Nam
+   or else (Nam = Name_Priority
+ and then Pragma_Name (N) = Name_Interrupt_Priority))
+ then
+if Check_Parents then
+   return N;
+
+--  If Check_Parents is False, return N if the pragma doesn't
+--  appear in the Rep_Item chain of the parent.
+
+else
+   declare
+  Par : constant Entity_Id := Nearest_Ancestor (E);
+  --  This node represents the parent type of type E (if any)
+
+   begin
+  if No (Par) then
+ return N;
+
+  elsif not Present_In_Rep_Item (Par, N) then
+ return N;
+  end if;
+   end;
+end if;
+
+ elsif Nkind (N) = N_Attribute_Definition_Clause
+   and then
+ (Chars (N) = Nam
+or else (Nam = Name_Priority
+  and then Chars (N) = Name_Interrupt_Priority))
+ then
+if Check_Parents then
+   return N;
+
+elsif Entity (N) = E then
+   return N;
+end if;
+
+ elsif Nkind (N) = N_Aspect_Specification
+   and then
+ (Chars (Identifier (N)) = Nam
+or else (Nam = Name_Priority
+  and then Chars (Identifier (N)) =
+ Name_Interrupt_Priority))
+ then
+if Check_Parents then
+   return N;
+
+elsif Entity (N) = E then
+   return N;
+end if;
+ end if;
+
+ Next_Rep_Item (N);
+  end loop;
+
+  return Empty;
+   end Get_Rep_Item;
+
+   
+   -- Get_Rep_Pragma --
+   
+
+   function Get_Rep_Pragma
+ (E : Entity_Id;
+  Nam   : Name_Id;
+  Check_Parents : Boolean := True) return Node_Id
+   is
+  N : Node_Id;
+
+   begin
+  N := First_Rep_Item (E);
+  while Present (N) loop
+ if Nkind (N) = N_Pragma
+   and then
+ (Pragma_Name (N) = Nam
+   or else (Nam = Name_Interrupt_Priority
+ and then Pragma_Name (N) = Name_Priority))
+ then
+if Check_Parents then
+   return N;
+
+--  If Check_Parents is False, return N if the pragma doesn't
+--  appear in the Rep_Item chain of the parent.
+
+else
+ 

[Ada] Fix crash in gnatname due to uninitialized variable

2012-06-14 Thread Arnaud Charlet
No functional change.

Tested on x86_64-pc-linux-gnu, committed on trunk

2012-06-14  Tristan Gingold  ging...@adacore.com

* gnatname.adb (Gnatname): Make sure that dynamic table
argument_data is initialized.

Index: gnatname.adb
===
--- gnatname.adb(revision 188605)
+++ gnatname.adb(working copy)
@@ -6,7 +6,7 @@
 --  --
 -- B o d y  --
 --  --
---  Copyright (C) 2001-2011, Free Software Foundation, Inc. --
+--  Copyright (C) 2001-2012, Free Software Foundation, Inc. --
 --  --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
@@ -575,7 +575,15 @@
--  Initialize tables
 
Arguments.Set_Last (0);
-   Arguments.Increment_Last;
+   declare
+  New_Arguments : Argument_Data;
+  pragma Warnings (Off, New_Arguments);
+  --  Declaring this defaulted initialized object ensures
+  --  that the new allocated component of table Arguments
+  --  is correctly initialized.
+   begin
+  Arguments.Append (New_Arguments);
+   end;
Patterns.Init (Arguments.Table (1).Directories);
Patterns.Set_Last (Arguments.Table (1).Directories, 0);
Patterns.Init (Arguments.Table (1).Name_Patterns);


[Ada] Attribute and pragma for lock-free implementation

2012-06-14 Thread Arnaud Charlet
This patch implements a Lock_Free pragma for Ada2005 usage and a Lock_Free
attribute for user query.

The test provided below illustrates the usage of both Lock_Free pragma and
attribute.

-
--  Source --
-

with Text_IO; use Text_IO;

procedure Main is
   protected type Counter is
  pragma Lock_Free;
  procedure Increment;
   private
  Count : Natural := 0;
   end Counter;

   protected body Counter is
  procedure Increment is
  begin
 Count := Count + 1;
  end Increment;
   end Counter;

   C : Counter;

begin
   if C'Lock_Free then
  Put_Line (Lock_Free : ON);

   else
  Put_Line (Lock_Free : OFF);
   end if;
end Main;

---
-- Compilation and Execution --
---

gnatmake -q main.adb
$./main


-- Output --


$Lock_Free : ON

Tested on x86_64-pc-linux-gnu, committed on trunk

2012-06-14  Vincent Pucci  pu...@adacore.com

* exp_attr.adb (Expand_N_Attribute_Reference): Lock_Free
attribute case added.
* par-prag.adb (Prag): Lock_Free pragma case added.
* sem_attr.adb (Analyze_Attribute_Reference): Lock_Free attribute
case added.
* sem_ch13.adb (Analyze_Aspect_Specifications): Record_Rep_Item
call added for Aspect_Lock_Free.
* sem_ch9.adb (Allows_Lock_Free_Implementation): New Lock_Free
error messages for subprogram bodies.
(Lock_Free_Disabled): New routine.
(Analyze_Protected_Body): Call to Lock_Free_Disabled added.
* sem_prag.adb (Analyze_Pragma): Lock_Free pragma case added.
* snames.adb-tmpl (Get_Pragma_Id): Name_Lock_Free case added.
(Is_Pragma_Name): Name_Lock_Free case added.
* snames.ads-tmpl: Attribute_Lock_Free and Pragma_Lock_Free added.

Index: exp_attr.adb
===
--- exp_attr.adb(revision 188605)
+++ exp_attr.adb(working copy)
@@ -3065,6 +3065,29 @@
  end if;
   end;
 
+  ---
+  -- Lock_Free --
+  ---
+
+  --  Rewrite the attribute reference with the value of Uses_Lock_Free
+
+  when Attribute_Lock_Free = Lock_Free : declare
+ Val : Entity_Id;
+
+  begin
+ if Uses_Lock_Free (Ptyp) then
+Val := Standard_True;
+
+ else
+Val := Standard_False;
+ end if;
+
+ Rewrite (N,
+   New_Occurrence_Of (Val, Loc));
+
+ Analyze_And_Resolve (N, Standard_Boolean);
+  end Lock_Free;
+
   -
   -- Machine --
   -
Index: sem_ch9.adb
===
--- sem_ch9.adb (revision 188605)
+++ sem_ch9.adb (working copy)
@@ -23,7 +23,6 @@
 --  --
 --
 
-with Aspects;  use Aspects;
 with Atree;use Atree;
 with Checks;   use Checks;
 with Debug;use Debug;
@@ -263,18 +262,43 @@
begin
   --  Function calls and attribute references must be static
 
-  if Nkind_In (N, N_Attribute_Reference, N_Function_Call)
+  if Nkind (N) = N_Attribute_Reference
 and then not Is_Static_Expression (N)
   then
+ if Complain then
+Error_Msg_N
+  (non-static attribute reference not allowed,
+   N);
+ end if;
+
  return Abandon;
 
+  elsif Nkind (N) = N_Function_Call
+and then not Is_Static_Expression (N)
+  then
+ if Complain then
+Error_Msg_N (non-static function call not allowed,
+ N);
+ end if;
+
+ return Abandon;
+
   --  Loop statements and procedure calls are prohibited
 
-  elsif Nkind_In (N, N_Loop_Statement,
- N_Procedure_Call_Statement)
-  then
+  elsif Nkind (N) = N_Loop_Statement then
+ if Complain then
+Error_Msg_N (loop not allowed, N);
+ end if;
+
  return Abandon;
 
+  elsif Nkind (N) = N_Procedure_Call_Statement then
+ if Complain then
+Error_Msg_N (procedure call not allowed, N);
+ end if;
+
+ return Abandon;
+
   --  References
 
   elsif Nkind (N) = N_Identifier
@@ -295,6 +319,12 @@
   and then not Scope_Within_Or_Same (Scope (Id),
  

[Ada] Mode conformance for Ada 2012 aliased formal parameters

2012-06-14 Thread Arnaud Charlet
In Ada 2012 formal parameters can be declared explicitly aliased. Mode
conformance now requires that both or neither formal be aliased.

Compiling alias.adb must yield:

alias.adb:7:13: not fully conformant with declaration at line 6
alias.adb:7:13: aliased parameter mismatch
alias.ads:7:24: not subtype conformant with operation inherited at line 5
alias.ads:7:24: aliased parameter mismatch

---
package Alias is
   type R is tagged null record;
   procedure Change (Obj : R);

   type R2 is new R with null record;
   overriding
 procedure Change (Obj : aliased R2);   --  ERROR
end Alias;
---
package body Alias is
   procedure Change (Obj : R) is begin null; end;
   
   procedure Change (Obj : aliased R2) is begin null; end;

   function check (Obj : R) return Integer;
   function check (Obj : aliased R) return Integer is   -- ERROR
   begin
  return R'Size;
   end;
end Alias;

Tested on x86_64-pc-linux-gnu, committed on trunk

2012-06-14  Ed Schonberg  schonb...@adacore.com

* sem_ch6.adb (Check_Conformance): Add Ada 2012 check on mode
conformance: aliased must apply to both or neither formal
parameters.

Index: sem_ch6.adb
===
--- sem_ch6.adb (revision 188605)
+++ sem_ch6.adb (working copy)
@@ -5503,6 +5503,18 @@
 end if;
  end if;
 
+ --  Ada 2012:  mode conformance also requires that formal parameters
+ --  be both aliased, or neither.
+
+ if Ctype = Mode_Conformant
+   and then Ada_Version = Ada_2012
+ then
+if Is_Aliased (Old_Formal) /= Is_Aliased (New_Formal) then
+   Conformance_Error
+ (\aliased parameter mismatch!, New_Formal);
+end if;
+ end if;
+
  if Ctype = Fully_Conformant then
 
 --  Names must match. Error message is more accurate if we do


[Ada] Freezing nodes placement fixed with quantified expression inside an expression function.

2012-06-14 Thread Arnaud Charlet
This patch implements the correct freezing actions in the context of a
quantified expression inside an expression function.

Tested on x86_64-pc-linux-gnu, committed on trunk

2012-06-14  Vincent Pucci  pu...@adacore.com

* freeze.adb (In_Exp_Body): Expression function case added.
(Freeze_Expression): Insert the Freeze_Nodes
list before the correct current scope in case of a quantified
expression.

Index: freeze.adb
===
--- freeze.adb  (revision 188609)
+++ freeze.adb  (working copy)
@@ -4698,13 +4698,15 @@
 Id := Defining_Unit_Name (Specification (P));
 
 if Nkind (Id) = N_Defining_Identifier
-  and then (Is_Init_Proc (Id)  or else
-Is_TSS (Id, TSS_Stream_Input)  or else
-Is_TSS (Id, TSS_Stream_Output) or else
-Is_TSS (Id, TSS_Stream_Read)   or else
-Is_TSS (Id, TSS_Stream_Write)  or else
+  and then (Is_Init_Proc (Id)or else
+Is_TSS (Id, TSS_Stream_Input)or else
+Is_TSS (Id, TSS_Stream_Output)   or else
+Is_TSS (Id, TSS_Stream_Read) or else
+Is_TSS (Id, TSS_Stream_Write)or else
 Nkind (Original_Node (P)) =
-  N_Subprogram_Renaming_Declaration)
+  N_Subprogram_Renaming_Declaration  or else
+Nkind (Original_Node (P)) =
+  N_Expression_Function)
 then
return True;
 else
@@ -5091,9 +5093,9 @@
 or else Ekind (Current_Scope) = E_Void
   then
  declare
-N: constant Node_Id:= Current_Scope;
-Freeze_Nodes : List_Id := No_List;
-Pos  : Int := Scope_Stack.Last;
+N: constant Node_Id := Current_Scope;
+Freeze_Nodes : List_Id  := No_List;
+Pos  : Int  := Scope_Stack.Last;
 
  begin
 if Present (Desig_Typ) then
@@ -5109,13 +5111,18 @@
 end if;
 
 --  The current scope may be that of a constrained component of
---  an enclosing record declaration, which is above the current
---  scope in the scope stack.
+--  an enclosing record declaration, or of a loop of an enclosing
+--  quantified expression, which is above the current scope in the
+--  scope stack. Indeed in the context of a quantified expression,
+--  a scope is created and pushed above the current scope in order
+--  to emulate the loop-like behavior of the quantified expression.
 --  If the expression is within a top-level pragma, as for a pre-
 --  condition on a library-level subprogram, nothing to do.
 
 if not Is_Compilation_Unit (Current_Scope)
-  and then Is_Record_Type (Scope (Current_Scope))
+  and then (Is_Record_Type (Scope (Current_Scope))
+ or else Nkind (Parent (Current_Scope)) =
+   N_Quantified_Expression)
 then
Pos := Pos - 1;
 end if;


[Ada] Checking for eliminated subprograms

2012-06-14 Thread Arnaud Charlet
A reference to a subprogram that appears in a pragma Eliminate is not an error
if it appears within a default expression: the enclosing subprogram may itself
be eliminated. Previous to this patch, the check for default expressions was
performed when resolving a call, but not for attribute references.

Given the following gnat.adc file:

   pragma Eliminate (Elim, Default_Dispatch, Source_Location = elim.ads:6);
   pragma Eliminate (Elim, G_Source_Type_New, Source_Location = elim.ads:8);

the following must compile quietly:

   gnatmake -q -f a

---
with Elim;
procedure A is
begin
   null;
end;
---
package Elim is
   type Source_Dispatch_Func is access
 function return Boolean;

   function Default_Dispatch return Boolean;

   function G_Source_Type_New
 (Dispatch : Source_Dispatch_Func := Default_Dispatch'Access)
   return Boolean;

end Elim;
---
package body Elim is

   function Default_Dispatch return Boolean is
   begin
  return True;
   end Default_Dispatch;

   function G_Source_Type_New
 (Dispatch : Source_Dispatch_Func := Default_Dispatch'Access)
  return Boolean
   is
   begin
  return True;
   end G_Source_Type_New;
end Elim;

Tested on x86_64-pc-linux-gnu, committed on trunk

2012-06-14  Ed Schonberg  schonb...@adacore.com

* sem_elim.adb (Check_For_Eliminated_Subprogram): Do not check within
a default expression.
* sem_res.adb (Resolve_Call): simplify code.

Index: sem_res.adb
===
--- sem_res.adb (revision 188605)
+++ sem_res.adb (working copy)
@@ -5839,14 +5839,11 @@
  Check_Restriction (No_Relative_Delay, N);
   end if;
 
-  --  Issue an error for a call to an eliminated subprogram. We skip this
-  --  in a spec expression, e.g. a call in a default parameter value, since
-  --  we are not really doing a call at this time. That's important because
-  --  the spec expression may itself belong to an eliminated subprogram.
+  --  Issue an error for a call to an eliminated subprogram.
+  --  The routine will not perform the check if the call appears within
+  --  a default expression.
 
-  if not In_Spec_Expression then
- Check_For_Eliminated_Subprogram (Subp, Nam);
-  end if;
+  Check_For_Eliminated_Subprogram (Subp, Nam);
 
   --  In formal mode, the primitive operations of a tagged type or type
   --  extension do not include functions that return the tagged type.
Index: sem_elim.adb
===
--- sem_elim.adb(revision 188605)
+++ sem_elim.adb(working copy)
@@ -6,7 +6,7 @@
 --  --
 -- B o d y  --
 --  --
---  Copyright (C) 1997-2010, Free Software Foundation, Inc. --
+--  Copyright (C) 1997-2012, Free Software Foundation, Inc. --
 --  --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
@@ -724,6 +724,14 @@
   Enclosing_Subp : Entity_Id;
 
begin
+  --  No check needed within a default expression for a formal, since this
+  --  is not really a use, and the expression (a call or attribute) may
+  --  never be used if the enclosing subprogram is itself eliminated.
+
+  if In_Spec_Expression then
+ return;
+  end if;
+
   if Is_Eliminated (Ultimate_Subp)
 and then not Inside_A_Generic
 and then not Is_Generic_Unit (Cunit_Entity (Current_Sem_Unit))
@@ -823,10 +831,10 @@
   Arg_Uname : Node_Id;
 
   function OK_Selected_Component (N : Node_Id) return Boolean;
-  --  Test if N is a selected component with all identifiers, or a
-  --  selected component whose selector is an operator symbol. As a
-  --  side effect if result is True, sets Num_Names to the number
-  --  of names present (identifiers and operator if any).
+  --  Test if N is a selected component with all identifiers, or a selected
+  --  component whose selector is an operator symbol. As a side effect if
+  --  result is True, sets Num_Names to the number of names present
+  --  (identifiers, and operator if any).
 
   ---
   -- OK_Selected_Component --


GCC 4.7.2 Status Report (2012-06-14)

2012-06-14 Thread Richard Guenther

Status
==

The GCC 4.7.1 release tarballs have been created and are being uploaded
to ftp.gnu.org right now.  The GCC 4.7 branch is thus open again for
regression and documentation fixes.


Quality Data


Priority  #   Change from Last Report
---   ---
P10
P2   74   - 11
P3   14   +  9 
---   ---
Total88   -  2


Previous Report
===

http://gcc.gnu.org/ml/gcc/2012-06/msg00060.html



[Patch] Propagate vector constants into VEC_PERM_EXPR while lowering.

2012-06-14 Thread Ramana Radhakrishnan
Hi,

This patch allows propagation of vector constants into VEC_PERM_EXPRs
in lower_vec_perm, motivation explained in
http://gcc.gnu.org/ml/gcc-patches/2012-06/msg00615.html

Bootstrapped and regression tested on gcc110.fsffrance.org .

Ok ?

regards,
Ramana

   * tree-vect-generic.c (lower_vec_perm): Propagate vector constants
into VEC_PERM_EXPR..

diff --git a/gcc/tree-vect-generic.c b/gcc/tree-vect-generic.c
index 06334bb..3b9f561 100644
--- a/gcc/tree-vect-generic.c
+++ b/gcc/tree-vect-generic.c
@@ -628,6 +628,14 @@ lower_vec_perm (gimple_stmt_iterator *gsi)
   location_t loc = gimple_location (gsi_stmt (*gsi));
   unsigned i;

+  if (TREE_CODE (mask) == SSA_NAME)
+{
+  gimple def_stmt = SSA_NAME_DEF_STMT (mask);
+  if (is_gimple_assign (def_stmt)
+  gimple_assign_rhs_code (def_stmt) == VECTOR_CST)
+   mask = gimple_assign_rhs1 (def_stmt);
+}
+
   if (TREE_CODE (mask) == VECTOR_CST)
 {
   unsigned char *sel_int = XALLOCAVEC (unsigned char, elements);
@@ -637,7 +645,11 @@ lower_vec_perm (gimple_stmt_iterator *gsi)
   (2 * elements - 1));

   if (can_vec_perm_p (TYPE_MODE (vect_type), false, sel_int))
-   return;
+   {
+ gimple_assign_set_rhs3 (stmt, mask);
+ update_stmt (stmt);
+ return;
+   }
 }
   else if (can_vec_perm_p (TYPE_MODE (vect_type), true, NULL))
 return;


Re: [Patch] Propagate vector constants into VEC_PERM_EXPR while lowering.

2012-06-14 Thread Richard Guenther
On Thu, Jun 14, 2012 at 1:26 PM, Ramana Radhakrishnan
ramana.radhakrish...@linaro.org wrote:
 Hi,

 This patch allows propagation of vector constants into VEC_PERM_EXPRs
 in lower_vec_perm, motivation explained in
 http://gcc.gnu.org/ml/gcc-patches/2012-06/msg00615.html

 Bootstrapped and regression tested on gcc110.fsffrance.org .

 Ok ?

Ok.

Thanks,
Richard.

 regards,
 Ramana

   * tree-vect-generic.c (lower_vec_perm): Propagate vector constants
 into VEC_PERM_EXPR..

 diff --git a/gcc/tree-vect-generic.c b/gcc/tree-vect-generic.c
 index 06334bb..3b9f561 100644
 --- a/gcc/tree-vect-generic.c
 +++ b/gcc/tree-vect-generic.c
 @@ -628,6 +628,14 @@ lower_vec_perm (gimple_stmt_iterator *gsi)
   location_t loc = gimple_location (gsi_stmt (*gsi));
   unsigned i;

 +  if (TREE_CODE (mask) == SSA_NAME)
 +    {
 +      gimple def_stmt = SSA_NAME_DEF_STMT (mask);
 +      if (is_gimple_assign (def_stmt)
 +          gimple_assign_rhs_code (def_stmt) == VECTOR_CST)
 +       mask = gimple_assign_rhs1 (def_stmt);
 +    }
 +
   if (TREE_CODE (mask) == VECTOR_CST)
     {
       unsigned char *sel_int = XALLOCAVEC (unsigned char, elements);
 @@ -637,7 +645,11 @@ lower_vec_perm (gimple_stmt_iterator *gsi)
                       (2 * elements - 1));

       if (can_vec_perm_p (TYPE_MODE (vect_type), false, sel_int))
 -       return;
 +       {
 +         gimple_assign_set_rhs3 (stmt, mask);
 +         update_stmt (stmt);
 +         return;
 +       }
     }
   else if (can_vec_perm_p (TYPE_MODE (vect_type), true, NULL))
     return;


Ping: [PATCH] Add implicit C linkage for win32-specific entry points

2012-06-14 Thread NightStrike
Eric,

Jacek Caban sent this:

http://gcc.gnu.org/ml/gcc-patches/2012-03/msg01987.html

in response to this:

http://gcc.gnu.org/ml/gcc-patches/2012-03/msg01986.html

But it never got reviewed.  Could you review and commit?


[PATCH, GCC][AArch64] Update LINK_SPEC

2012-06-14 Thread Sofiane Naci
Hi,

This patch updates LINK_SPEC in the AArch64 port.

Thanks
Sofiane

-

2012-06-14  Sofiane Naci sofiane.n...@arm.com

[AArch64] Update LINK_SPEC.

* config/aarch64/aarch64-linux.h (LINUX_TARGET_LINK_SPEC): Remove
%{version:-v}, %{b} and %{!dynamic-linker}.


aarch64-linux-specs.patch
Description: Binary data


[Ada] Add support for --program-prefix

2012-06-14 Thread Arnaud Charlet
Take into account the prefix specified with --program-prefix when installing
and uninstalling the Ada tools.

Tested on x86_64-pc-linux-gnu, committed on trunk

2012-06-14  Jose Ruiz  r...@adacore.com

* gcc-interface/Make-lang.in (ada.install-common, ada.uninstall):
Use the prefix specified with the --program-prefix configure option
to determine the install name of the Ada tools.
(ada.all.cross): Use a for loop to iterate over the set of Ada tools
instead of duplicate the same processing.

Index: gcc-interface/Make-lang.in
===
--- gcc-interface/Make-lang.in  (revision 188605)
+++ gcc-interface/Make-lang.in  (working copy)
@@ -1,6 +1,6 @@
 # Top level -*- makefile -*- fragment for GNU Ada (GNAT).
 #   Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-#   2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
+#   2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
 #   Free Software Foundation, Inc.
 
 #This file is part of GCC.
@@ -79,6 +79,10 @@
INSTALL_DATA=$(INSTALL_DATA)  \
INSTALL_PROGRAM=$(INSTALL_PROGRAM)
 
+# List of Ada tools to build and install
+ADA_TOOLS=gnatbind gnatchop gnat gnatkr gnatlink gnatls gnatmake \
+  gnatname gnatprep gnatxref gnatfind gnatclean gnatsym
+
 # Say how to compile Ada programs.
 .SUFFIXES: .ada .adb .ads
 
@@ -586,58 +590,12 @@
 # Build hooks:
 
 ada.all.cross:
-   -if [ -f gnatbind$(exeext) ] ; \
-   then \
- $(MV) gnatbind$(exeext)  gnatbind-cross$(exeext); \
-   fi
-   -if [ -f gnatchop$(exeext) ] ; \
-   then \
- $(MV) gnatchop$(exeext)   gnatchop-cross$(exeext); \
-   fi
-   -if [ -f gnat$(exeext) ] ; \
-   then \
-  $(MV) gnat$(exeext)  gnat-cross$(exeext); \
-   fi
-   -if [ -f gnatkr$(exeext) ] ; \
-   then \
- $(MV) gnatkr$(exeext)gnatkr-cross$(exeext); \
-   fi
-   -if [ -f gnatlink$(exeext) ] ; \
-   then \
-  $(MV) gnatlink$(exeext)  gnatlink-cross$(exeext); \
-   fi
-   -if [ -f gnatls$(exeext) ] ; \
-   then \
- $(MV) gnatls$(exeext)gnatls-cross$(exeext); \
-   fi
-   -if [ -f gnatmake$(exeext) ] ; \
-   then \
-  $(MV) gnatmake$(exeext)  gnatmake-cross$(exeext); \
-   fi
-   -if [ -f gnatname$(exeext) ] ; \
-   then \
-  $(MV) gnatname$(exeext)  gnatname-cross$(exeext); \
-   fi
-   -if [ -f gnatprep$(exeext) ] ; \
-   then \
-  $(MV) gnatprep$(exeext)  gnatprep-cross$(exeext); \
-   fi
-   -if [ -f gnatxref$(exeext) ] ; \
-   then \
-  $(MV) gnatxref$(exeext)  gnatxref-cross$(exeext); \
-   fi
-   -if [ -f gnatfind$(exeext) ] ; \
-   then \
-  $(MV) gnatfind$(exeext)  gnatfind-cross$(exeext); \
-   fi
-   -if [ -f gnatclean$(exeext) ] ; \
-   then \
-  $(MV) gnatclean$(exeext)  gnatclean-cross$(exeext); \
-   fi
-   -if [ -f gnatsym$(exeext) ] ; \
-   then \
-  $(MV) gnatsym$(exeext)  gnatsym-cross$(exeext); \
-   fi
+   for tool in $(ADA_TOOLS) ; do \
+ if [ -f $$tool$(exeext) ] ; \
+ then \
+   $(MV) $$tool$(exeext) $$tool-cross$(exeext); \
+ fi; \
+   done
 
 ada.start.encap:
 ada.rest.encap:
@@ -756,205 +714,33 @@
 # Install hooks:
 # gnat1 is installed elsewhere as part of $(COMPILERS).
 
-# Install the binder program as $(target_noncanonical)-gnatbind
-# and also as either gnatbind (if native) or $(tooldir)/bin/gnatbind
-# likewise for gnatf, gnatchop, and gnatlink, gnatkr, gnatmake, gnat,
-# gnatprep, gnatls, gnatxref, gnatfind, gnatname, gnatclean,
-# gnatsym
+# Install the binder program as gnatbind (native) or $(prefix)gnatbind
+# (cross). $(prefix) comes from the --program-prefix configure option,
+# or from the --target option if the former is not specified.
+# Do the same for the rest of the Ada tools (gnatchop, gnat, gnatkr,
+# gnatlink, gnatls, gnatmake, gnatname, gnatprep, gnatxref, gnatfind,
+# gnatclean, gnatsym).
+# gnatsym is only built on some platforms, including VMS.
+# gnatdll is only used on Windows.
+# vxaddr2line is only used for cross VxWorks ports (it calls the underlying
+# cross addr2line).
 ada.install-common:
$(MKDIR) $(DESTDIR)$(bindir)
-if [ -f gnat1$(exeext) ] ; \
-then \
- if [ -f gnatbind-cross$(exeext) ] ; \
- then \
-   $(RM) $(DESTDIR)$(bindir)/$(target_noncanonical)-gnatbind$(exeext); 
\
-   $(INSTALL_PROGRAM) gnatbind-cross$(exeext) 
$(DESTDIR)$(bindir)/$(target_noncanonical)-gnatbind$(exeext); \
-   if [ -d $(DESTDIR)$(tooldir)/bin/. ] ; then \
- rm -f $(DESTDIR)$(tooldir)/bin/gnatbind$(exeext); \
- $(INSTALL_PROGRAM) gnatbind-cross$(exeext) 
$(DESTDIR)$(tooldir)/bin/gnatbind$(exeext); \
-   fi; \
- else \
-   $(RM) 

[arm] Remove obsolete FPA support (3/n): Remove FPA patterns from MD files

2012-06-14 Thread Richard Earnshaw
This patch removes the define_insn and define_expand support for the FPA.

Tested on arm-eabi and committed to trunk.

* arm.md (divsf3, divdf3): Remove FPA support.
(negsf2, negdf2): Likewise.
(sqrtsf2, sqrtdf2): Likewise.
(movdfcc): Likewise.
(modsf3, moddf3, movxf): Delete.
(push_fp_multi): Delete.
(fpa.md): Don't include it.
* fpa.md: Delete file.
* t-arm (MD_INCLUDES): Remove fpa.md.

R.Index: config/arm/t-arm
===
--- config/arm/t-arm(revision 188602)
+++ config/arm/t-arm(working copy)
@@ -46,7 +46,6 @@ MD_INCLUDES=  $(srcdir)/config/arm/arm102
$(srcdir)/config/arm/fa626te.md \
$(srcdir)/config/arm/fa726te.md \
$(srcdir)/config/arm/fmp626.md \
-   $(srcdir)/config/arm/fpa.md \
$(srcdir)/config/arm/iterators.md \
$(srcdir)/config/arm/iwmmxt.md \
$(srcdir)/config/arm/iwmmxt2.md \
Index: config/arm/arm.md
===
--- config/arm/arm.md   (revision 188602)
+++ config/arm/arm.md   (working copy)
@@ -1967,30 +1967,14 @@ (define_expand divsf3
   [(set (match_operand:SF 0 s_register_operand )
(div:SF (match_operand:SF 1 arm_float_rhs_operand )
(match_operand:SF 2 arm_float_rhs_operand )))]
-  TARGET_32BIT  TARGET_HARD_FLOAT  (TARGET_FPA || TARGET_VFP)
+  TARGET_32BIT  TARGET_HARD_FLOAT  TARGET_VFP
   )
 
 (define_expand divdf3
   [(set (match_operand:DF 0 s_register_operand )
(div:DF (match_operand:DF 1 arm_float_rhs_operand )
(match_operand:DF 2 arm_float_rhs_operand )))]
-  TARGET_32BIT  TARGET_HARD_FLOAT  (TARGET_FPA || TARGET_VFP_DOUBLE)
-  )
-
-;; Modulo insns
-
-(define_expand modsf3
-  [(set (match_operand:SF 0 s_register_operand )
-   (mod:SF (match_operand:SF 1 s_register_operand )
-   (match_operand:SF 2 arm_float_rhs_operand )))]
-  TARGET_32BIT  TARGET_HARD_FLOAT  TARGET_FPA
-  )
-
-(define_expand moddf3
-  [(set (match_operand:DF 0 s_register_operand )
-   (mod:DF (match_operand:DF 1 s_register_operand )
-   (match_operand:DF 2 arm_float_rhs_operand )))]
-  TARGET_32BIT  TARGET_HARD_FLOAT  TARGET_FPA
+  TARGET_32BIT  TARGET_HARD_FLOAT  TARGET_VFP_DOUBLE
   )
 
 ;; Boolean and,ior,xor insns
@@ -4216,14 +4200,14 @@ (define_insn *thumb1_negsi2
 (define_expand negsf2
   [(set (match_operand:SF 0 s_register_operand )
(neg:SF (match_operand:SF 1 s_register_operand )))]
-  TARGET_32BIT  TARGET_HARD_FLOAT  (TARGET_FPA || TARGET_VFP)
+  TARGET_32BIT  TARGET_HARD_FLOAT  TARGET_VFP
   
 )
 
 (define_expand negdf2
   [(set (match_operand:DF 0 s_register_operand )
(neg:DF (match_operand:DF 1 s_register_operand )))]
-  TARGET_32BIT  TARGET_HARD_FLOAT  (TARGET_FPA || TARGET_VFP_DOUBLE)
+  TARGET_32BIT  TARGET_HARD_FLOAT  TARGET_VFP_DOUBLE
   )
 
 ;; abssi2 doesn't really clobber the condition codes if a different register
@@ -4315,13 +4299,13 @@ (define_expand absdf2
 (define_expand sqrtsf2
   [(set (match_operand:SF 0 s_register_operand )
(sqrt:SF (match_operand:SF 1 s_register_operand )))]
-  TARGET_32BIT  TARGET_HARD_FLOAT  (TARGET_FPA || TARGET_VFP)
+  TARGET_32BIT  TARGET_HARD_FLOAT  TARGET_VFP
   )
 
 (define_expand sqrtdf2
   [(set (match_operand:DF 0 s_register_operand )
(sqrt:DF (match_operand:DF 1 s_register_operand )))]
-  TARGET_32BIT  TARGET_HARD_FLOAT  (TARGET_FPA || TARGET_VFP_DOUBLE)
+  TARGET_32BIT  TARGET_HARD_FLOAT  TARGET_VFP_DOUBLE
   )
 
 (define_insn_and_split one_cmpldi2
@@ -6821,17 +6805,6 @@ (define_insn *thumb_movdf_insn
(set_attr insn *,*,*,*,*,mov)
(set_attr pool_range *,*,*,1020,*,*)]
 )
-
-(define_expand movxf
-  [(set (match_operand:XF 0 general_operand )
-   (match_operand:XF 1 general_operand ))]
-  TARGET_32BIT  TARGET_HARD_FLOAT  TARGET_FPA
-  
-  if (GET_CODE (operands[0]) == MEM)
-operands[1] = force_reg (XFmode, operands[1]);
-  
-)
-
 
 
 ;; load- and store-multiple insns
@@ -8199,7 +8172,7 @@ (define_expand movdfcc
(if_then_else:DF (match_operand 1 expandable_comparison_operator )
 (match_operand:DF 2 s_register_operand )
 (match_operand:DF 3 arm_float_add_operand )))]
-  TARGET_32BIT  TARGET_HARD_FLOAT  (TARGET_FPA || TARGET_VFP_DOUBLE)
+  TARGET_32BIT  TARGET_HARD_FLOAT  TARGET_VFP_DOUBLE
   
   {
 enum rtx_code code = GET_CODE (operands[1]);
@@ -11002,24 +10975,6 @@ (define_insn stack_tie
   [(set_attr length 0)]
 )
 
-;; Similarly for the floating point registers
-(define_insn *push_fp_multi
-  [(match_parallel 2 multi_register_push
-[(set (match_operand:BLK 0 memory_operand =m)
- (unspec:BLK [(match_operand:XF 1 f_register_operand )]
- UNSPEC_PUSH_MULT))])]
-  TARGET_32BIT  TARGET_HARD_FLOAT  TARGET_FPA
-  *
-  {
-char 

Re: [PR49888, VTA] don't keep VALUEs bound to modified MEMs

2012-06-14 Thread H.J. Lu
On Tue, Jun 12, 2012 at 1:42 PM, Richard Henderson r...@redhat.com wrote:
 On 2012-06-05 12:33, Alexandre Oliva wrote:
 for  gcc/ChangeLog
 from  Alexandre Oliva  aol...@redhat.com

       PR debug/49888
       * var-tracking.c: Include alias.h.
       (overlapping_mems): New struct.
       (drop_overlapping_mem_locs): New.
       (clobber_overlapping_mems): New.
       (var_mem_delete_and_set, var_mem_delete): Call it.
       (val_bind): Likewise, but only if modified.
       (compute_bb_dataflow, emit_notes_in_bb): Call it on MEMs.
       * Makefile.in (var-tracking.o): Depend in $(ALIAS_H).

 for  gcc/testsuite/ChangeLog
 from  Alexandre Oliva  aol...@redhat.com

       PR debug/49888
       * gcc.dg/guality/pr49888.c: New.

 Ok.



It caused:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53671


-- 
H.J.


Re: RFA: better gimplification of compound literals

2012-06-14 Thread Michael Matz
Hi,

[Honza, for you a question below]

On Wed, 13 Jun 2012, Richard Guenther wrote:

  Was a non-implemented optimization.  If the compound literal value 
  isn't used as lvalue and doesn't have its address taken (and generally 
  fits the current predicate) we can as well subst it in place instead 
  of going over an intermediate statement.
 
  Regstrapping on x86_64-linux in progress.  Okay if that passes?
 
 Ok.

It doesn't due to a missed folding that nobody else is doing either 
(pr44214-[13].c).  Formerly we had:

   D.1712 = { 2.0e+0, 2.0e+0 };
   *a = *b / D.1712;

which ccp (!) finally folded into

   *a = *b * { 0.5, 0.5 };

Now we start right away with

   *a = *b / { 2.0e+0, 2.0e+0 };

Nothing currently folds this (fold doesn't because it still sees the 
compound literal, and the tree optimizers never change something on that 
statement again, so there's no reason to re-fold).

So, let's finally fold statements in the gimplifier like in the below 
patch.  If you prefer I can conditionalize the folding also on being 
in the generic-gimple lowering, in difference to the other calls into the 
gimplifier from the optimizers.

This exposes some regressions in the testsuite, two of them easily fixed 
in the testcase and the third because we fold before the symtab is ready,
hence this line was crashing:

if (!from_decl
...
|| (symtab_get_node (from_decl)-symbol.in_other_partition))
  return true;

in can_refer_decl_in_current_unit_p.  Honza: I don't understand this 
particular condition.  If we have a from_decl (i.e. the decl we're 
concerned about stems from the initializer of it) and it is in another 
partition, then this says that we can freely refer to the decl itself?  
That doesn't make sense to me.  That decl might for instance also be in 
that other partition and be hidden.  Hence I'm unsure what to return if 
the symtab isn't ready yet.  In the patch below I'm returning false as in 
don't know.  But I think the current behaviour is wrong?

In any case, this patch is currently in regstrapping on x86-64.  Okay if 
it passes (modulo changes for the above symtab_get_node() issue)?


Ciao,
Michael.
* gimplify.c (gimplify_modify_expr): Fold generated statements.
* gimple-fold.c (can_refer_decl_in_current_unit_p): Check
symtab node existence before access.

testsuite/
* gcc.dg/debug/dwarf2/inline3.c: Adjust.
* gcc.dg/tree-ssa/foldstring-1.c: Adjust.

Index: gimplify.c
===
*** gimplify.c  (revision 188500)
--- gimplify.c  (working copy)
*** gimplify_modify_expr (tree *expr_p, gimp
*** 4772,4777 
--- 4786,4792 
enum gimplify_status ret = GS_UNHANDLED;
gimple assign;
location_t loc = EXPR_LOCATION (*expr_p);
+   gimple_stmt_iterator gsi;
  
gcc_assert (TREE_CODE (*expr_p) == MODIFY_EXPR
  || TREE_CODE (*expr_p) == INIT_EXPR);
*** gimplify_modify_expr (tree *expr_p, gimp
*** 4912,4919 
gimple_set_location (assign, EXPR_LOCATION (*expr_p));
  }
  
-   gimplify_seq_add_stmt (pre_p, assign);
- 
if (gimplify_ctxp-into_ssa  is_gimple_reg (*to_p))
  {
/* If we've somehow already got an SSA_NAME on the LHS, then
--- 4927,4932 
*** gimplify_modify_expr (tree *expr_p, gimp
*** 4923,4928 
--- 4936,4945 
gimple_set_lhs (assign, *to_p);
  }
  
+   gimplify_seq_add_stmt (pre_p, assign);
+   gsi = gsi_last (*pre_p);
+   fold_stmt (gsi);
+ 
if (want_value)
  {
*expr_p = TREE_THIS_VOLATILE (*to_p) ? *from_p : unshare_expr (*to_p);
Index: gimple-fold.c
===
*** gimple-fold.c   (revision 188500)
--- gimple-fold.c   (working copy)
*** can_refer_decl_in_current_unit_p (tree d
*** 61,79 
struct cgraph_node *node;
symtab_node snode;
  
!   /* We will later output the initializer, so we can reffer to it.
   So we are concerned only when DECL comes from initializer of
   external var.  */
if (!from_decl
|| TREE_CODE (from_decl) != VAR_DECL
!   || !DECL_EXTERNAL (from_decl)
!   || (symtab_get_node (from_decl)-symbol.in_other_partition))
  return true;
!   /* We are concerned ony about static/external vars and functions.  */
if ((!TREE_STATIC (decl)  !DECL_EXTERNAL (decl))
|| (TREE_CODE (decl) != VAR_DECL  TREE_CODE (decl) != FUNCTION_DECL))
  return true;
!   /* Weakrefs have somewhat confusing DECL_EXTERNAL flag set; they are always 
safe.  */
if (DECL_EXTERNAL (decl)
 lookup_attribute (weakref, DECL_ATTRIBUTES (decl)))
  return true;
--- 61,85 
struct cgraph_node *node;
symtab_node snode;
  
!   /* We will later output the initializer, so we can refer to it.
   So we are concerned only when DECL comes from initializer of
   external var.  */
if (!from_decl
|| TREE_CODE 

Re: RFA: better gimplification of compound literals

2012-06-14 Thread Jan Hubicka
 
 if (!from_decl
 ...
 || (symtab_get_node (from_decl)-symbol.in_other_partition))
   return true;
 
 in can_refer_decl_in_current_unit_p.  Honza: I don't understand this 
 particular condition.  If we have a from_decl (i.e. the decl we're 
 concerned about stems from the initializer of it) and it is in another 
 partition, then this says that we can freely refer to the decl itself?  
 That doesn't make sense to me.  That decl might for instance also be in 
 that other partition and be hidden.  Hence I'm unsure what to return if 
 the symtab isn't ready yet.  In the patch below I'm returning false as in 
 don't know.  But I think the current behaviour is wrong?

If the initializers is from other partition, we know that var promoting will 
make it
part of the boundary so we can reffer to it.
This is really about external constructor that is in different DSO.  WHOPR 
partitions
are all in one DSO at the end.

Honza


Re: RFA: better gimplification of compound literals

2012-06-14 Thread Michael Matz
Hi,

On Thu, 14 Jun 2012, Jan Hubicka wrote:

  if (!from_decl
  ...
  || (symtab_get_node (from_decl)-symbol.in_other_partition))
return true;
  
  in can_refer_decl_in_current_unit_p.  Honza: I don't understand this 
  particular condition.  If we have a from_decl (i.e. the decl we're 
  concerned about stems from the initializer of it) and it is in another 
  partition, then this says that we can freely refer to the decl itself?  
  That doesn't make sense to me.  That decl might for instance also be in 
  that other partition and be hidden.  Hence I'm unsure what to return if 
  the symtab isn't ready yet.  In the patch below I'm returning false as in 
  don't know.  But I think the current behaviour is wrong?
 
 If the initializers is from other partition, we know that var promoting 
 will make it part of the boundary so we can reffer to it.

Hmm, but why only when it's in a different partition?  And what's it?  
The initializer or the element we're concerned about (decl)?  You're 
saying that if the initializer is in a different partition we don't need 
further checks for a certain reason, but we _do_ need further checks if 
it's in the current partition?


Ciao,
Michael.


Re: [Ada] Add support for --program-prefix

2012-06-14 Thread Joseph S. Myers
On Thu, 14 Jun 2012, Arnaud Charlet wrote:

 Take into account the prefix specified with --program-prefix when installing
 and uninstalling the Ada tools.
 
 Tested on x86_64-pc-linux-gnu, committed on trunk
 
 2012-06-14  Jose Ruiz  r...@adacore.com
 
   * gcc-interface/Make-lang.in (ada.install-common, ada.uninstall):
   Use the prefix specified with the --program-prefix configure option
   to determine the install name of the Ada tools.
   (ada.all.cross): Use a for loop to iterate over the set of Ada tools
   instead of duplicate the same processing.

Does this fix bug 864?  If so, you should mention

PR ada/864

in the ChangeLog entry, and resolve that bug as fixed.

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


Re: RFA: better gimplification of compound literals

2012-06-14 Thread Michael Matz
Hi,

On Thu, 14 Jun 2012, Michael Matz wrote:

 In any case, this patch is currently in regstrapping on x86-64.  Okay if 
 it passes (modulo changes for the above symtab_get_node() issue)?

After discussion with Honza, consider the patch changed like so:

   if (!from_decl
   || TREE_CODE (from_decl) != VAR_DECL
   || !DECL_EXTERNAL (from_decl)
-  || (symtab_get_node (from_decl)-symbol.in_other_partition))
+  || (flag_ltrans
+  symtab_get_node (from_decl)-symbol.in_other_partition))
 return true;

Restarted regstrapping the thing on x86_64 again.  Okay if that passes?


Ciao,
Michael.


Re: RFA: better gimplification of compound literals

2012-06-14 Thread Jan Hubicka
 Hi,
 
 On Thu, 14 Jun 2012, Michael Matz wrote:
 
  In any case, this patch is currently in regstrapping on x86-64.  Okay if 
  it passes (modulo changes for the above symtab_get_node() issue)?
 
 After discussion with Honza, consider the patch changed like so:
 
if (!from_decl
|| TREE_CODE (from_decl) != VAR_DECL
|| !DECL_EXTERNAL (from_decl)
 -  || (symtab_get_node (from_decl)-symbol.in_other_partition))
 +  || (flag_ltrans
 +  symtab_get_node (from_decl)-symbol.in_other_partition))
  return true;
 
 Restarted regstrapping the thing on x86_64 again.  Okay if that passes?

This change is fine with me ;)

Thanks,
Honza
 
 
 Ciao,
 Michael.


Re: [Ada] fix use of PICFLAG for Ada library variants

2012-06-14 Thread Jakub Jelinek
On Mon, Jun 11, 2012 at 04:50:37PM +0200, Olivier Hainque wrote:
 2012-06-10  Olivier Hainque  hain...@adacore.com
 
 * Makefile.in (GNATLIBCFLAGS_FOR_C): Remove $(PIC_FLAG_FOR_TARGET).
 (gnatlib-shared-default): Add $(PIC_FLAG_FOR_TARGET) to
 GNATLIBCFLAGS_FOR_C passed to gnatlib.
 (gnatlib-shared-win32): Likewise.
 (gnatlib-shared-darwin): Likewise.
 (gnatlib-shared-dual-win32): Pass PIC_FLAG_FOR_TARGET to 
 gnatlib-shared-win32.
 
 libada/
 * Makefile.in (GNATLIBCFLAGS_FOR_C): Remove $(PICFLAG).

You've apparently committed during 4.7 branch freeze a variant of this
patch to the 4.7 branch as well, unfortunately it breaks ada bootstrap
completely on x86_64-linux.
While r188390 (trunk version) has in gnatlib-shared-default:
GNATLIBCFLAGS_FOR_C=$(GNATLIBCFLAGS_FOR_C) $(PICFLAG_FOR_TARGET) \
r188462 (4.7 version) doesn't have there $(PICFLAG_FOR_TARGET). 

Jakub


Re: [Ada] Add support for --program-prefix

2012-06-14 Thread Arnaud Charlet
  Take into account the prefix specified with --program-prefix when
  installing
  and uninstalling the Ada tools.
  
  Tested on x86_64-pc-linux-gnu, committed on trunk
  
  2012-06-14  Jose Ruiz  r...@adacore.com
  
  * gcc-interface/Make-lang.in (ada.install-common,
  ada.uninstall):
  Use the prefix specified with the --program-prefix configure option
  to determine the install name of the Ada tools.
  (ada.all.cross): Use a for loop to iterate over the set of Ada tools
  instead of duplicate the same processing.
 
 Does this fix bug 864?  If so, you should mention
 
   PR ada/864
 
 in the ChangeLog entry, and resolve that bug as fixed.

This was fixed independently of PR 864 (or we would have mentioned it),
but it's indeed related. I suspect there are still issues with the PR (such as
make check not working) though.

Also, the comment 20 still needs to be addressed AFAIK, so clearly PR 864
isn't done yet.

Arno


Web patch committed: Clarify GCC 4.7.1 and Go 1

2012-06-14 Thread Ian Lance Taylor
I committed this patch to the web site to clarify that GCC 4.7.1
supports Go 1.

Ian

Index: changes.html
===
RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-4.7/changes.html,v
retrieving revision 1.117
diff -u -r1.117 changes.html
--- changes.html	14 Jun 2012 11:11:00 -	1.117
+++ changes.html	14 Jun 2012 16:40:38 -
@@ -633,8 +633,9 @@
 liGCC 4.7 implements
   the a href=http://weekly.golang.org/doc/go1.html;Go 1
   language standard./a  The library support in 4.7.0 is not
-  quite complete, due to release timing.  Release 4.7.1 is
-  expected to include complete support./li
+  quite complete, due to release timing.  Release 4.7.1 includes
+  complete support for Go 1.  The Go library is from the Go 1.0.1
+  release./li
 liGo has been tested on GNU/Linux and Solaris platforms.  It may
   work on other platforms as well./li
   /ul


[arm] Remove obsolete FPA support (4/n): Remove Maverick patterns from MD files

2012-06-14 Thread Richard Earnshaw
This patch removes the define_insn and define_expand support for the
obsolete Maverick co-processor.

There's some necessary purging of code in arm.c as well (though the
major cleanups here are still to come).

Tested on arm-eabi and committed to trunk.

* arm.c (arm_cirrus_insn_p): Delete.
(cirrus_reorg): Delete.
(arm_reorg): Don't call cirrus_reorg.
(arm_final_prescan_insn_p): Don't check for cirrus insns.
* arm.md (define_attr type): Remove mav_farith and mav_dmult.
(adddi3, subdi3): Remove Maverick support.
(arm_adddi3): Likewise.
(adddi_sesidi_di, adddi_zesidi_di): Likewise.
(addsf3, adddf3): Likewise.
(subsf3, subdf3): Likewise.
(mulsf3, muldf3): Likewise.
(ashldi3, ashrdi3, lshrdi3): Likewise.
(floatsisf2, floatsidf2): Likewise.
(fix_truncsfsi2, fix_truncdfsi2): Likewise.
(arm_movdi, thumb1_movdi_insn): Likewise.
(arm_cmpdi_insn): Likewise.
(cirrus_cmpsf, cirrus_cmpdf, cirrus_cmpdi): Likewise.
(cirrus.md): Don't include.
* cirrus.md: Delete file.
* t-arm (MD_INCLUDES): Remove cirrus.md.
Index: config/arm/arm.c
===
--- config/arm/arm.c(revision 188614)
+++ config/arm/arm.c(working copy)
@@ -167,8 +167,6 @@ static int arm_address_cost (rtx, bool);
 static int arm_register_move_cost (enum machine_mode, reg_class_t, 
reg_class_t);
 static int arm_memory_move_cost (enum machine_mode, reg_class_t, bool);
 static bool arm_memory_load_p (rtx);
-static bool arm_cirrus_insn_p (rtx);
-static void cirrus_reorg (rtx);
 static void arm_init_builtins (void);
 static void arm_init_iwmmxt_builtins (void);
 static rtx safe_vector_operand (rtx, enum machine_mode);
@@ -9821,144 +9819,6 @@ arm_memory_load_p (rtx insn)
  || note_invalid_constants (insn, -1, false));
 }
 
-/* Return TRUE if INSN is a Cirrus instruction.  */
-static bool
-arm_cirrus_insn_p (rtx insn)
-{
-  enum attr_cirrus attr;
-
-  /* get_attr cannot accept USE or CLOBBER.  */
-  if (!insn
-  || GET_CODE (insn) != INSN
-  || GET_CODE (PATTERN (insn)) == USE
-  || GET_CODE (PATTERN (insn)) == CLOBBER)
-return 0;
-
-  attr = get_attr_cirrus (insn);
-
-  return attr != CIRRUS_NOT;
-}
-
-/* Cirrus reorg for invalid instruction combinations.  */
-static void
-cirrus_reorg (rtx first)
-{
-  enum attr_cirrus attr;
-  rtx body = PATTERN (first);
-  rtx t;
-  int nops;
-
-  /* Any branch must be followed by 2 non Cirrus instructions.  */
-  if (GET_CODE (first) == JUMP_INSN  GET_CODE (body) != RETURN)
-{
-  nops = 0;
-  t = next_nonnote_insn (first);
-
-  if (arm_cirrus_insn_p (t))
-   ++ nops;
-
-  if (arm_cirrus_insn_p (next_nonnote_insn (t)))
-   ++ nops;
-
-  while (nops --)
-   emit_insn_after (gen_nop (), first);
-
-  return;
-}
-
-  /* (float (blah)) is in parallel with a clobber.  */
-  if (GET_CODE (body) == PARALLEL  XVECLEN (body, 0)  0)
-body = XVECEXP (body, 0, 0);
-
-  if (GET_CODE (body) == SET)
-{
-  rtx lhs = XEXP (body, 0), rhs = XEXP (body, 1);
-
-  /* cfldrd, cfldr64, cfstrd, cfstr64 must
-be followed by a non Cirrus insn.  */
-  if (get_attr_cirrus (first) == CIRRUS_DOUBLE)
-   {
- if (arm_cirrus_insn_p (next_nonnote_insn (first)))
-   emit_insn_after (gen_nop (), first);
-
- return;
-   }
-  else if (arm_memory_load_p (first))
-   {
- unsigned int arm_regno;
-
- /* Any ldr/cfmvdlr, ldr/cfmvdhr, ldr/cfmvsr, ldr/cfmv64lr,
-ldr/cfmv64hr combination where the Rd field is the same
-in both instructions must be split with a non Cirrus
-insn.  Example:
-
-ldr r0, blah
-nop
-cfmvsr mvf0, r0.  */
-
- /* Get Arm register number for ldr insn.  */
- if (GET_CODE (lhs) == REG)
-   arm_regno = REGNO (lhs);
- else
-   {
- gcc_assert (GET_CODE (rhs) == REG);
- arm_regno = REGNO (rhs);
-   }
-
- /* Next insn.  */
- first = next_nonnote_insn (first);
-
- if (! arm_cirrus_insn_p (first))
-   return;
-
- body = PATTERN (first);
-
-  /* (float (blah)) is in parallel with a clobber.  */
-  if (GET_CODE (body) == PARALLEL  XVECLEN (body, 0))
-   body = XVECEXP (body, 0, 0);
-
- if (GET_CODE (body) == FLOAT)
-   body = XEXP (body, 0);
-
- if (get_attr_cirrus (first) == CIRRUS_MOVE
-  GET_CODE (XEXP (body, 1)) == REG
-  arm_regno == REGNO (XEXP (body, 1)))
-   emit_insn_after (gen_nop (), first);
-
- return;
-   }
-}
-
-  /* get_attr cannot accept USE or CLOBBER.  */
-  if (!first
-  || GET_CODE (first) != INSN
-  || GET_CODE (PATTERN (first)) == USE
-  || GET_CODE (PATTERN (first)) == CLOBBER)
-

Re: [Ada] fix use of PICFLAG for Ada library variants

2012-06-14 Thread Olivier Hainque
Hello Jakub,

On Jun 14, 2012, at 18:22 , Jakub Jelinek wrote:

 2012-06-10  Olivier Hainque  hain...@adacore.com
 
* Makefile.in (GNATLIBCFLAGS_FOR_C): Remove $(PIC_FLAG_FOR_TARGET).

 You've apparently committed during 4.7 branch freeze a variant of this
 patch to the 4.7 branch as well, unfortunately it breaks ada bootstrap
 completely on x86_64-linux.

 Ug. Procedural mistake :-( Really, really sorry.

 While r188390 (trunk version) has in gnatlib-shared-default:
   GNATLIBCFLAGS_FOR_C=$(GNATLIBCFLAGS_FOR_C) $(PICFLAG_FOR_TARGET) \
 r188462 (4.7 version) doesn't have there $(PICFLAG_FOR_TARGET). 

 Indeed, and it should as soon as picflag is not in the other variable.

 How do you want me to proceed: 

 Simply revert and leave the original problem in, or fix things up ?

 I'll double checking that bootstrap unbreaks in either case, of course.




Re: debug insns in SMS

2012-06-14 Thread Ayal Zaks
Thanks for the duplicate ping. This is fine.
So this indeed solves the discrepancy between running SMS w/ and w/o debugging?
Please include a comment next to the code stating why it's important
not to create such deps.
You may also want to store the result of DEP_PRO (dep) in
src_something and use it twice, for clarity.
Thanks,
Ayal.


On Thu, Jun 14, 2012 at 1:00 AM, Alexandre Oliva aol...@redhat.com wrote:

 Apologies for the duplicate ping, this one is now properly addressed to
 the pass maintainer.

 On Apr  9, 2012, Alexandre Oliva aol...@redhat.com wrote:

  On May  4, 2011, Revital1 Eres e...@il.ibm.com wrote:
  Hello Alexandre
  I think this will restore proper functioning to SMS in the presence of
  debug insns.  A while ago, we'd never generate deps of non-debug insns
  on debug insns.  I introduced them to enable sched to adjust (reset)
  debug insns when non-debug insns were moved before them.  I believe it
  is safe to leave them out of the SCCs.  Even though this will end up
  causing some loss of debug info, that's probably unavoidable, and the
  end result after this change is pobably the best we can hope for.
   Your
  thoughts?

  Thanks for the patch!

  I actually discussed this issue with Ayal yesterday.
  Ayal also suggested to reconsider the edges that are created in
  the DDG between real instructions and debug_insns. Currently, we create
  bidirectional anti deps edges between them. This leads to the problem
  you
  were trying to solve in the current patch (described below) where these
  extra edges influence the construction of the strongly connected
  component
  and the code generated with and w\o -g. Your patch seems to solve this
  problem.
  However I can not approve it as I'm not the maintainer (Ayal is).

  Ping?

  (Retested on x86_64-linux-gnu and i686-pc-linux-gnu)


  for  gcc/ChangeLog
  from  Alexandre Oliva  aol...@redhat.com

        * ddg.c (build_intra_loop_deps): Discard deps of nondebug on
  debug.

 Ping?  http://gcc.gnu.org/ml/gcc-patches/2012-04/msg00419.html

 --
 Alexandre Oliva, freedom fighter    http://FSFLA.org/~lxoliva/
 You must be the change you wish to see in the world. -- Gandhi
 Be Free! -- http://FSFLA.org/   FSF Latin America board member
 Free Software Evangelist      Red Hat Brazil Compiler Engineer


Re: [Ada] fix use of PICFLAG for Ada library variants

2012-06-14 Thread Jakub Jelinek
On Thu, Jun 14, 2012 at 06:53:46PM +0200, Olivier Hainque wrote:
 On Jun 14, 2012, at 18:22 , Jakub Jelinek wrote:
 
  2012-06-10  Olivier Hainque  hain...@adacore.com
  
 * Makefile.in (GNATLIBCFLAGS_FOR_C): Remove $(PIC_FLAG_FOR_TARGET).
 
  You've apparently committed during 4.7 branch freeze a variant of this
  patch to the 4.7 branch as well, unfortunately it breaks ada bootstrap
  completely on x86_64-linux.
 
  Ug. Procedural mistake :-( Really, really sorry.
 
  While r188390 (trunk version) has in gnatlib-shared-default:
  GNATLIBCFLAGS_FOR_C=$(GNATLIBCFLAGS_FOR_C) $(PICFLAG_FOR_TARGET) \
  r188462 (4.7 version) doesn't have there $(PICFLAG_FOR_TARGET). 
 
  Indeed, and it should as soon as picflag is not in the other variable.
 
  How do you want me to proceed: 
 
  Simply revert and leave the original problem in, or fix things up ?

For reverting it is too late, 4.7.1 has been released already with the bug.

  I'll double checking that bootstrap unbreaks in either case, of course.

I'm already bootstrapping/regtesting the simple one-liner, if it works, will
post it.

Jakub


Re: RFA: better gimplification of compound literals

2012-06-14 Thread Richard Guenther
On Thu, Jun 14, 2012 at 5:33 PM, Michael Matz m...@suse.de wrote:
 Hi,

 On Thu, 14 Jun 2012, Michael Matz wrote:

 In any case, this patch is currently in regstrapping on x86-64.  Okay if
 it passes (modulo changes for the above symtab_get_node() issue)?

 After discussion with Honza, consider the patch changed like so:

   if (!from_decl
       || TREE_CODE (from_decl) != VAR_DECL
       || !DECL_EXTERNAL (from_decl)
 -      || (symtab_get_node (from_decl)-symbol.in_other_partition))
 +      || (flag_ltrans
 +          symtab_get_node (from_decl)-symbol.in_other_partition))
     return true;

 Restarted regstrapping the thing on x86_64 again.  Okay if that passes?

Ok.

But I wonder how the symtab cannot be ready when we gimplify - after all
we gimplify only from after cgraph_finalize_compilation_unit ...

Thanks,
Richard.


 Ciao,
 Michael.


Re: Web patch committed: Clarify GCC 4.7.1 and Go 1

2012-06-14 Thread Richard Guenther
On Thu, Jun 14, 2012 at 6:41 PM, Ian Lance Taylor i...@google.com wrote:
 I committed this patch to the web site to clarify that GCC 4.7.1
 supports Go 1.

Can you move that/add it to the sub-section for changes in 4.7.1?

Thanks,
Richard.

 Ian



[PATCH] ARM: exclude fixed_regs for stack-alignment save/restore

2012-06-14 Thread Roland McGrath
When the ARM compiler needs to ensure the stack pointer stays aligned
and it's already doing a multi-register push/pop in the prologue and
epilogue, it chooses some arbitrary register to add to the register set
in that push and pop just to increase the size of the stack used by 4
bytes.  This is presumed to be harmless, since some register that is
either call-clobbered or not touched by the function at all is just
getting pushed and then the same value popped into it.  

But if e.g. I use -ffixed-r9 then I think it's a reasonable expectation
that no code is generated that touches r9 in any way, shape, or form.
(My actual concern is a variant target port still in progress, where
the ABI specifies that r9 is reserved, and the system enforces that no
instruction may modify r9.)

I haven't managed to come up with an isolated test case to demonstrate
the bug.  Apparently I just don't understand the stack and register
pressure requirements that make the compiler get into the situation
where it wants to add a random register for alignment padding purposes.

I don't have a setup where I can do a proper regression test for ARM.
(My system has a /usr/arm-linux-gnueabi/include/ but configuring with
--target=arm-linux-gnueabi --with-headers=/usr/arm-linux-gnueabi/include
did not succeed in building libgcc.)

But the change seems pretty obviously correct IMHO.


Thanks,
Roland


gcc/
2012-06-14  Roland McGrath  mcgra...@google.com

* config/arm/arm.c (arm_get_frame_offsets): Never use a fixed register
as the extra register to save/restore for stack-alignment padding.

diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 092e202..bcfef3e 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -16752,7 +16752,12 @@ arm_get_frame_offsets (void)
  else
for (i = 4; i = (TARGET_THUMB1 ? LAST_LO_REGNUM : 11); i++)
  {
-   if ((offsets-saved_regs_mask  (1  i)) == 0)
+   /* While the gratuitous register save/restore is ordinarily
+  harmless, if a register is marked as fixed it may be
+  entirely forbidden by the system ABI to touch it, so we
+  should avoid those registers.  */
+   if (!fixed_regs[i]
+(offsets-saved_regs_mask  (1  i)) == 0)
  {
reg = i;
break;


Re: [Ada] fix use of PICFLAG for Ada library variants

2012-06-14 Thread Olivier Hainque

On Jun 14, 2012, at 19:00 , Jakub Jelinek wrote:
 For reverting it is too late, 4.7.1 has been released already with the bug.

 I'm already bootstrapping/regtesting the simple one-liner, if it works, will
 post it.

 Thanks. So sorry again :-(

 Olivier



Re: [PATCH, MIPS] Add most common atomic patterns

2012-06-14 Thread Richard Sandiford
Richard Henderson r...@redhat.com writes:
 On 2012-06-12 22:50, Maxim Kuvyrkov wrote:
 The third patch is a small optimization to alleviate
 __atomic_compare_exchange[_n] builtins being a use-one-for-all
 solutions.  These builtins return both boolean success and oldval
 results.  As most cases use only one of the results, this
 optimizations looks at REG_UNUSED notes to determine if instructions
 to set these results can be omitted.

 If you split the pattern, similar to how it's handled on Alpha,
 and normal dead-code elimination will handle this.

One hitch with that is that we need a branch-likely instruction for
-mfix-r1.  I suppose we could fudge it with a special (probably
unspec_volatile) branch pattern, but I'm nervous about doing something
so unusual for such a corner case.

Richard


[Dwarf Patch] Improve pubnames and pubtypes generation. (issue6197069)

2012-06-14 Thread Sterling Augustine
This is a revised edition of the fix pubnames patch discussed earlier; it
addresses all the earlier comments made.

This edition of the patch has three changes from the earlier one:

1. Fix a typo (anoymous - anonymous).
2. Move enumerator names to pubnames from pubtypes.
3. Switch to using the comdat_type_p field.

It sticks with -gpubnames as earlier discussed.

Anything else?

Sterling

2012-06-14   Sterling Augustine  saugust...@google.com
Cary Coutant  ccout...@google.com

* dwarf2out.c (is_cu_die, is_namespace_die, is_class_die,
add_AT_pubnames, add_enumerator_pubname, want_pubnames): New functions.
(comdat_type_struct): New field 'skeleton_die'.
(breakout_comdat_types): Update it.
(add_pubname): Rework logic.  Call is_class_die, is_cu_die and
is_namespace_die.  Fix minor style violation.  Call want_pubnames.
(add_pubname_string): Call want_pubnames.
(add_pubtype): Rework logic for calculating type name.  Call
is_namespace_die.  Call want_pubnames.
(output_pubnames): Move conditional logic deciding when to produce the
section from dwarf2out_finish.  Use new skeleton_die field.
(base_type_die): Call add_pubtype.
(gen_enumeration_type_die): Unconditionally call add_pubtype.
(gen_subprogram_die): Adjust calls to add_pubname.
(gen_namespace_die): Call add_pubname_string.
(dwarf2out_finish): Call add_AT_pubnames; Move logic on when to
produce pubnames and pubtypes sections to output_pubnames.
(common.opt): New option '-gpubnames'.
(invoke.texi): Document it.



Index: gcc/doc/invoke.texi
===
--- gcc/doc/invoke.texi (revision 188622)
+++ gcc/doc/invoke.texi (working copy)
@@ -4795,6 +4795,10 @@
 if neither of those are supported), including GDB extensions if at all
 possible.
 
+@item -gpubnames
+@opindex gpubnames
+Generate dwarf .debug_pubnames and .debug_pubtypes sections.
+
 @item -gstabs
 @opindex gstabs
 Produce debugging information in stabs format (if that is supported),
Index: gcc/dwarf2out.c
===
--- gcc/dwarf2out.c (revision 188622)
+++ gcc/dwarf2out.c (working copy)
@@ -2539,6 +2539,7 @@
 {
   dw_die_ref root_die;
   dw_die_ref type_die;
+  dw_die_ref skeleton_die;
   char signature[DWARF_TYPE_SIGNATURE_SIZE];
   struct comdat_type_struct *next;
 }
@@ -3013,6 +3014,7 @@
 static void output_comdat_type_unit (comdat_type_node *);
 static const char *dwarf2_name (tree, int);
 static void add_pubname (tree, dw_die_ref);
+static void add_enumerator_pubname (const char *, dw_die_ref);
 static void add_pubname_string (const char *, dw_die_ref);
 static void add_pubtype (tree, dw_die_ref);
 static void output_pubnames (VEC (pubname_entry,gc) *);
@@ -3142,6 +3144,7 @@
 const char *, const char *);
 static void output_loc_list (dw_loc_list_ref);
 static char *gen_internal_sym (const char *);
+static bool want_pubnames (void);
 
 static void prune_unmark_dies (dw_die_ref);
 static void prune_unused_types_mark_generic_parms_dies (dw_die_ref);
@@ -5982,6 +5985,23 @@
   || c-die_tag == DW_TAG_type_unit);
 }
 
+/* Returns true iff C is a namespace DIE.  */
+
+static inline bool
+is_namespace_die (dw_die_ref c)
+{
+  return c  c-die_tag == DW_TAG_namespace;
+}
+
+/* Returns true iff C is a class or structure DIE.  */
+
+static inline bool
+is_class_die (dw_die_ref c)
+{
+  return c  (c-die_tag == DW_TAG_class_type
+   || c-die_tag == DW_TAG_structure_type);
+}
+
 static char *
 gen_internal_sym (const char *prefix)
 {
@@ -6568,6 +6588,7 @@
declaration into the new type unit DIE, then remove this DIE
   from the main CU (or replace it with a skeleton if necessary).  */
replacement = remove_child_or_replace_with_skeleton (unit, c, prev);
+   type_node-skeleton_die = replacement;
 
 /* Break out nested types into their own type units.  */
 break_out_comdat_types (c);
@@ -8041,6 +8062,27 @@
 }
 }
 
+/* Whether to generate the DWARF accelerator tables in .debug_pubnames
+   and .debug_pubtypes.  This is configured per-target, but can be
+   overridden by the -gpubnames or -gno-pubnames options.  */
+
+static inline bool
+want_pubnames (void)
+{
+  return (debug_generate_pub_sections != -1
+ ? debug_generate_pub_sections
+ : targetm.want_debug_pub_sections);
+}
+
+/* Add the DW_AT_GNU_pubnames and DW_AT_GNU_pubtypes attributes.  */
+
+static void
+add_AT_pubnames (dw_die_ref die)
+{
+  if (want_pubnames ())
+add_AT_flag (die, DW_AT_GNU_pubnames, 1);
+}
+
 /* Output a comdat type unit DIE and its children.  */
 
 static void
@@ -8111,7 +8153,7 @@
 static void
 add_pubname_string (const char *str, dw_die_ref die)
 {
-  if (targetm.want_debug_pub_sections)
+  if (want_pubnames ())
 {
   

Re: [Ada] fix use of PICFLAG for Ada library variants

2012-06-14 Thread Jakub Jelinek
On Thu, Jun 14, 2012 at 07:17:24PM +0200, Olivier Hainque wrote:
 
 On Jun 14, 2012, at 19:00 , Jakub Jelinek wrote:
  For reverting it is too late, 4.7.1 has been released already with the bug.
 
  I'm already bootstrapping/regtesting the simple one-liner, if it works, will
  post it.
 
  Thanks. So sorry again :-(

Here is what I've committed as obvious after bootstrap/regtest on
x86_64-linux.

2012-06-14  Jakub Jelinek  ja...@redhat.com

* gcc-interface/Makefile.in (gnatlib-shared-default): Append
$(PICFLAG_FOR_TARGET) to GNATLIBCFLAGS_FOR_C passed to submake.

--- gcc/ada/gcc-interface/Makefile.in.jj2012-06-14 15:41:05.0 
+0200
+++ gcc/ada/gcc-interface/Makefile.in   2012-06-14 18:23:03.540294763 +0200
@@ -2597,7 +2597,7 @@ gnatlib-shared-default:
$(MAKE) $(FLAGS_TO_PASS) \
  GNATLIBFLAGS=$(GNATLIBFLAGS) \
 GNATLIBCFLAGS=$(GNATLIBCFLAGS) $(PICFLAG_FOR_TARGET) \
-GNATLIBCFLAGS_FOR_C=$(GNATLIBCFLAGS_FOR_C) \
+GNATLIBCFLAGS_FOR_C=$(GNATLIBCFLAGS_FOR_C) $(PICFLAG_FOR_TARGET) 
\
 MULTISUBDIR=$(MULTISUBDIR) \
 THREAD_KIND=$(THREAD_KIND) \
  gnatlib

Jakub


4.7 backports committed

2012-06-14 Thread Jakub Jelinek
Hi!

I've committed following 3 backports to 4.7 branch after
bootstrapping/regtesting it on x86_64-linux and i686-linux.

Jakub
2012-06-14  Jakub Jelinek  ja...@redhat.com

Backported from mainline
2012-06-06  Jakub Jelinek  ja...@redhat.com

PR libgomp/52993
* config/linux/lock.c (gomp_init_nest_lock_25): Fix up last
argument to memset call.

--- libgomp/config/linux/lock.c (revision 188275)
+++ libgomp/config/linux/lock.c (revision 188276)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005, 2008, 2009, 2011 Free Software Foundation, Inc.
+/* Copyright (C) 2005, 2008, 2009, 2011, 2012 Free Software Foundation, Inc.
Contributed by Richard Henderson r...@redhat.com.
 
This file is part of the GNU OpenMP Library (libgomp).
@@ -175,7 +175,7 @@ static inline int gomp_tid (void)
 void
 gomp_init_nest_lock_25 (omp_nest_lock_25_t *lock)
 {
-  memset (lock, 0, sizeof (lock));
+  memset (lock, 0, sizeof (*lock));
 }
 
 void
2012-06-14  Jakub Jelinek  ja...@redhat.com

Backported from mainline
2012-06-07  Jakub Jelinek  ja...@redhat.com

PR middle-end/53580
* omp-low.c (scan_omp_1_stmt): If check_omp_nesting_restrictions
returns false, replace stmt with GIMPLE_NOP.
(check_omp_nesting_restrictions): Instead of issuing warnings,
issue errors and return false if any errors were reported.

* gcc.dg/gomp/nesting-1.c: Expect errors rather than warnings.
* gcc.dg/gomp/critical-4.c: Likewise.
* gfortran.dg/gomp/appendix-a/a.35.1.f90: Likewise.
* gfortran.dg/gomp/appendix-a/a.35.3.f90: Likewise.
* gfortran.dg/gomp/appendix-a/a.35.4.f90: Likewise.
* gfortran.dg/gomp/appendix-a/a.35.6.f90: Likewise.
* c-c++-common/gomp/pr53580.c: New test.

* testsuite/libgomp.c/pr26943-2.c: Remove #pragma omp barrier,
use GOMP_barrier () call instead.
* testsuite/libgomp.c/pr26943-3.c: Likewise.
* testsuite/libgomp.c/pr26943-4.c: Likewise.
* testsuite/libgomp.fortran/vla4.f90: Remove !$omp barrier,
call GOMP_barrier instead.
* testsuite/libgomp.fortran/vla5.f90: Likewise.

--- libgomp/testsuite/libgomp.fortran/vla4.f90  (revision 188297)
+++ libgomp/testsuite/libgomp.fortran/vla4.f90  (revision 188298)
@@ -10,6 +10,10 @@ contains
 
   subroutine foo (c, d, e, f, g, h, i, j, k, n)
 use omp_lib
+interface
+  subroutine GOMP_barrier () bind(c, name=GOMP_barrier)
+  end subroutine
+end interface
 integer :: n
 character (len = *) :: c
 character (len = n) :: d
@@ -94,7 +98,7 @@ contains
 forall (p = 1:2, q = 3:7, r = 1:7) u(p, q, r) = 30 - x - p + q - 2 * r
 forall (p = 1:5, q = 3:7, p + q .le. 8) v(p, q) = w(1:7)
 forall (p = 1:5, q = 3:7, p + q .gt. 8) v(p, q) = w(20:26)
-!$omp barrier  ! { dg-warning may not be closely nested }
+call GOMP_barrier
 y = ''
 if (x .eq. 0) y = '0'
 if (x .eq. 1) y = '1'
--- libgomp/testsuite/libgomp.fortran/vla5.f90  (revision 188297)
+++ libgomp/testsuite/libgomp.fortran/vla5.f90  (revision 188298)
@@ -10,6 +10,10 @@ contains
 
   subroutine foo (c, d, e, f, g, h, i, j, k, n)
 use omp_lib
+interface
+  subroutine GOMP_barrier () bind(c, name=GOMP_barrier)
+  end subroutine
+end interface
 integer :: n
 character (len = *) :: c
 character (len = n) :: d
@@ -66,7 +70,7 @@ contains
 forall (p = 1:2, q = 3:7, r = 1:7) u(p, q, r) = 30 - x - p + q - 2 * r
 forall (p = 1:5, q = 3:7, p + q .le. 8) v(p, q) = w(1:7)
 forall (p = 1:5, q = 3:7, p + q .gt. 8) v(p, q) = w(20:26)
-!$omp barrier  ! { dg-warning may not be closely nested }
+call GOMP_barrier
 y = ''
 if (x .eq. 0) y = '0'
 if (x .eq. 1) y = '1'
--- libgomp/testsuite/libgomp.c/pr26943-2.c (revision 188297)
+++ libgomp/testsuite/libgomp.c/pr26943-2.c (revision 188298)
@@ -3,6 +3,7 @@
 
 extern int omp_set_dynamic (int);
 extern void abort (void);
+extern void GOMP_barrier (void);
 
 int a = 8, b = 12, c = 16, d = 20, j = 0;
 char e[10] = a, f[10] = b, g[10] = c, h[10] = d;
@@ -20,7 +21,7 @@ main (void)
 {
   if (a != 8 || b != 12 || e[0] != 'a' || f[0] != 'b')
j++;
-#pragma omp barrier/* { dg-warning may not be closely nested } */
+  GOMP_barrier ();
 #pragma omp atomic
   a += i;
   b += i;
@@ -31,7 +32,7 @@ main (void)
   f[0] += i;
   g[0] = 'g' + i;
   h[0] = 'h' + i;
-#pragma omp barrier/* { dg-warning may not be closely nested } */
+  GOMP_barrier ();
   if (a != 8 + 6 || b != 12 + i || c != i || d != i)
j += 8;
   if (e[0] != 'a' + 6 || f[0] != 'b' + i || g[0] != 'g' + i)
--- libgomp/testsuite/libgomp.c/pr26943-3.c (revision 188297)
+++ libgomp/testsuite/libgomp.c/pr26943-3.c (revision 188298)
@@ -4,6 +4,7 @@
 extern int omp_set_dynamic (int);
 extern int omp_get_thread_num (void);
 extern void abort (void);
+extern void 

Re: Web patch committed: Clarify GCC 4.7.1 and Go 1

2012-06-14 Thread Ian Lance Taylor
Richard Guenther richard.guent...@gmail.com writes:

 On Thu, Jun 14, 2012 at 6:41 PM, Ian Lance Taylor i...@google.com wrote:
 I committed this patch to the web site to clarify that GCC 4.7.1
 supports Go 1.

 Can you move that/add it to the sub-section for changes in 4.7.1?

Done like so.

Ian

Index: changes.html
===
RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-4.7/changes.html,v
retrieving revision 1.118
diff -u -r1.118 changes.html
--- changes.html	14 Jun 2012 16:41:04 -	1.118
+++ changes.html	14 Jun 2012 17:56:59 -
@@ -945,5 +945,9 @@
 complete (that is, it is possible that some PRs that have been fixed
 are not listed here)./p
 
+pThe Go frontend in the 4.7.1 release fully supports
+the a href=http://weekly.golang.org/doc/go1.html;Go 1 language
+standard./a/p
+
 /body
 /html


Re: divide 64-bit by constant for 32-bit target machines

2012-06-14 Thread Dinar Temirbulatov
Hi,
OK for trunk?
thanks, Dinar.

On Tue, Jun 12, 2012 at 11:00 AM, Paolo Bonzini bonz...@gnu.org wrote:
 Il 12/06/2012 08:52, Dinar Temirbulatov ha scritto:
 is safe?  That is, that the underflows cannot produce a wrong result?

 [snip]

 Thanks very much!

 Paolo
2012-06-14  Dinar Temirbulatov  dtemirbula...@gmail.com
Alexey Kravets  mr.kayr...@gmail.com
Paolo Bonzini  bonz...@gnu.org
  
* config/arm/arm.c (arm_rtx_costs_1): Add cost estimate for the integer
double-word division operation.
* config/mips/mips.c (mips_rtx_costs): Extend cost estimate for the 
integer
double-word division operation for 32-bit targets.
* gcc/expmed.c (expand_mult_highpart_optab): Allow to generate the 
higher multipilcation
product for unsigned double-word integers using 32-bit wide registers.


30.patch
Description: Binary data


[PATCH. i386]: movd in zero_extend RTX is SSE2 instruction.

2012-06-14 Thread Uros Bizjak
Hello!

movd to/from MMX or SSE registers is SSE2 instruction. Also, remove
wrong x,x alternative.

2012-06-14  Uros Bizjak  ubiz...@gmail.com

* config/i386/i386.md (*zero_extendsidi2): Mark movd alternatives
SSE2 only.  Remove x,x alternative.
(*zero_extendsidi2_rex64): Ditto.

Bootstrapped and regression tested on x86_64-pc-linux-gnu, committed
to mainline SVN. Patch will be backported to other release branches.

Uros.
Index: i386.md
===
--- i386.md (revision 188622)
+++ i386.md (working copy)
@@ -3467,10 +3467,10 @@
 
 (define_insn *zero_extendsidi2_rex64
   [(set (match_operand:DI 0 nonimmediate_operand
-   =r  ,o,?*Ym,?*y,?*Yi,!*x)
+   =r  ,o,?*Ym,?*y,?*Yi,?*x)
(zero_extend:DI
 (match_operand:SI 1 x86_64_zext_general_operand
-   rmWz,0,r   ,m  ,r   ,m*x)))]
+   rmWz,0,r   ,m  ,r   ,m)))]
   TARGET_64BIT
   @
mov{l}\t{%1, %k0|%k0, %1}
@@ -3479,7 +3479,7 @@
movd\t{%1, %0|%0, %1}
%vmovd\t{%1, %0|%0, %1}
%vmovd\t{%1, %0|%0, %1}
-  [(set_attr isa *,*,*,*,*,sse2)
+  [(set_attr isa *,*,sse2,sse2,sse2,sse2)
(set_attr type imovx,multi,mmxmov,mmxmov,ssemov,ssemov)
(set_attr prefix orig,*,orig,orig,maybe_vex,maybe_vex)
(set_attr prefix_0f 0,*,*,*,*,*)
@@ -3487,9 +3487,9 @@
 
 (define_insn *zero_extendsidi2
   [(set (match_operand:DI 0 nonimmediate_operand
-   =ro,?r,?o,?*Ym,?*y,?*Yi,!*x)
+   =ro,?r,?o,?*Ym,?*y,?*Yi,?*x)
(zero_extend:DI (match_operand:SI 1 nonimmediate_operand
-   0  ,rm,r ,r   ,m  ,r   ,m*x)))]
+   0  ,rm,r ,r   ,m  ,r   ,m)))]
   !TARGET_64BIT
   @
#
@@ -3499,7 +3499,7 @@
movd\t{%1, %0|%0, %1}
%vmovd\t{%1, %0|%0, %1}
%vmovd\t{%1, %0|%0, %1}
-  [(set_attr isa *,*,*,*,*,*,sse2)
+  [(set_attr isa *,*,*,sse2,sse2,sse2,sse2)
(set_attr type multi,multi,multi,mmxmov,mmxmov,ssemov,ssemov)
(set_attr prefix *,*,*,orig,orig,maybe_vex,maybe_vex)
(set_attr mode SI,SI,SI,DI,DI,TI,TI)])


Re: [Ada] fix use of PICFLAG for Ada library variants

2012-06-14 Thread Olivier Hainque

On Jun 14, 2012, at 19:50 , Jakub Jelinek wrote:
 Here is what I've committed as obvious after bootstrap/regtest on
 x86_64-linux.
 
 2012-06-14  Jakub Jelinek  ja...@redhat.com
 
   * gcc-interface/Makefile.in (gnatlib-shared-default): Append
   $(PICFLAG_FOR_TARGET) to GNATLIBCFLAGS_FOR_C passed to submake.

Thanks.

Olivier




Re: [PATCH. i386]: movd in zero_extend RTX is SSE2 instruction.

2012-06-14 Thread Uros Bizjak
On Thu, Jun 14, 2012 at 8:47 PM, Uros Bizjak ubiz...@gmail.com wrote:

 movd to/from MMX or SSE registers is SSE2 instruction. Also, remove
 wrong x,x alternative.

 2012-06-14  Uros Bizjak  ubiz...@gmail.com

        * config/i386/i386.md (*zero_extendsidi2): Mark movd alternatives
        SSE2 only.  Remove x,x alternative.
        (*zero_extendsidi2_rex64): Ditto.

 Bootstrapped and regression tested on x86_64-pc-linux-gnu, committed
 to mainline SVN. Patch will be backported to other release branches.

Actually, the SDM is wrong here! movd is perfectly valid MMX
instruction. This part of the patch is reverted.

Uros.


Go patch committed: Commit bug fixes to 4.7 branch

2012-06-14 Thread Ian Lance Taylor
I committed this patch to the 4.7 branch to bring in the accumulated bug
fixes to the Go frontend and to libgo.

This corresponds to these revisions on mainline: 188548 188547 188545
188496 188494 188482.

Ian

Index: gcc/go/gofrontend/gogo.cc
===
--- gcc/go/gofrontend/gogo.cc	(revision 188631)
+++ gcc/go/gofrontend/gogo.cc	(working copy)
@@ -339,9 +339,14 @@ Gogo::set_package_name(const std::string
   // symbol names.
   if (!this-pkgpath_set_)
 {
-  if (!this-prefix_from_option_)
-	this-prefix_ = go;
-  this-pkgpath_ = this-prefix_ + '.' + package_name;
+  if (!this-prefix_from_option_  package_name == main)
+	this-pkgpath_ = package_name;
+  else
+	{
+	  if (!this-prefix_from_option_)
+	this-prefix_ = go;
+	  this-pkgpath_ = this-prefix_ + '.' + package_name;
+	}
   this-pkgpath_set_ = true;
 }
 
Index: gcc/go/gofrontend/expressions.h
===
--- gcc/go/gofrontend/expressions.h	(revision 188631)
+++ gcc/go/gofrontend/expressions.h	(working copy)
@@ -1888,6 +1888,10 @@ class Field_reference_expression : publi
   do_is_addressable() const
   { return this-expr_-is_addressable(); }
 
+  void
+  do_address_taken(bool escapes)
+  { this-expr_-address_taken(escapes); }
+
   tree
   do_get_tree(Translate_context*);
 
Index: gcc/go/gofrontend/types.cc
===
--- gcc/go/gofrontend/types.cc	(revision 188631)
+++ gcc/go/gofrontend/types.cc	(working copy)
@@ -8337,14 +8337,23 @@ Named_type::do_reflection(Gogo* gogo, st
 {
   // We handle -fgo-prefix and -fgo-pkgpath differently here for
   // compatibility with how the compiler worked before
-  // -fgo-pkgpath was introduced.
+  // -fgo-pkgpath was introduced.  When -fgo-pkgpath is specified,
+  // we use it to make a unique reflection string, so that the
+  // type canonicalization in the reflect package will work.  In
+  // order to be compatible with the gc compiler, we put tabs into
+  // the package path, so that the reflect methods can discard it.
   const Package* package = this-named_object_-package();
   if (gogo-pkgpath_from_option())
-	ret-append(package != NULL ? package-pkgpath() : gogo-pkgpath());
-  else
-	ret-append(package != NULL
-		? package-package_name()
-		: gogo-package_name());
+	{
+	  ret-push_back('\t');
+	  ret-append(package != NULL
+		  ? package-pkgpath_symbol()
+		  : gogo-pkgpath_symbol());
+	  ret-push_back('\t');
+	}
+  ret-append(package != NULL
+		  ? package-package_name()
+		  : gogo-package_name());
   ret-push_back('.');
 }
   if (this-in_function_ != NULL)
Index: gcc/go/gofrontend/expressions.cc
===
--- gcc/go/gofrontend/expressions.cc	(revision 188631)
+++ gcc/go/gofrontend/expressions.cc	(working copy)
@@ -168,7 +168,8 @@ Expression::convert_for_assignment(Trans
   if (lhs_type_tree == error_mark_node)
 return error_mark_node;
 
-  if (lhs_type != rhs_type  lhs_type-interface_type() != NULL)
+  if (lhs_type-forwarded() != rhs_type-forwarded()
+   lhs_type-interface_type() != NULL)
 {
   if (rhs_type-interface_type() == NULL)
 	return Expression::convert_type_to_interface(context, lhs_type,
@@ -179,7 +180,8 @@ Expression::convert_for_assignment(Trans
 			  rhs_type, rhs_tree,
 			  false, location);
 }
-  else if (lhs_type != rhs_type  rhs_type-interface_type() != NULL)
+  else if (lhs_type-forwarded() != rhs_type-forwarded()
+	rhs_type-interface_type() != NULL)
 return Expression::convert_interface_to_type(context, lhs_type, rhs_type,
 		 rhs_tree, location);
   else if (lhs_type-is_slice_type()  rhs_type-is_nil_type())
Index: libgo/runtime/go-traceback.c
===
--- libgo/runtime/go-traceback.c	(revision 188631)
+++ libgo/runtime/go-traceback.c	(working copy)
@@ -35,8 +35,8 @@ runtime_printtrace (uintptr *pcbuf, int3
   if (__go_file_line (pcbuf[i], fn, file, line)
 	   runtime_showframe (fn.__data))
 	{
-	  runtime_printf (%s\n, fn.__data);
-	  runtime_printf (\t%s:%d\n, file.__data, line);
+	  runtime_printf (%S\n, fn);
+	  runtime_printf (\t%S:%d\n, file, line);
 	}
 }
 }
Index: libgo/go/os/dir.go
===
--- libgo/go/os/dir.go	(revision 188631)
+++ libgo/go/os/dir.go	(working copy)
@@ -42,7 +42,11 @@ func (file *File) readdirnames(n int) (n
 	if file.dirinfo == nil {
 		file.dirinfo = new(dirInfo)
 		file.dirinfo.buf = make([]byte, elen)
-		file.dirinfo.dir = libc_opendir(syscall.StringBytePtr(file.name))
+		p := syscall.StringBytePtr(file.name)
+		syscall.Entersyscall()
+		r := libc_opendir(p)
+		syscall.Exitsyscall()
+		file.dirinfo.dir = r
 	}
 
 	entry_dirent := 

[RFA] dwarf2.def (DW_OP): Add DW_OP_GNU_const_index.

2012-06-14 Thread Doug Evans
Hi.

Ok to commit?

2012-06-14  Doug Evans  d...@google.com

* dwarf2.def (DW_OP): Add DW_OP_GNU_const_index.

Index: dwarf2.def
===
--- dwarf2.def  (revision 188634)
+++ dwarf2.def  (working copy)
@@ -588,6 +588,7 @@
 DW_OP (DW_OP_GNU_parameter_ref, 0xfa)
 /* Extension for Fission.  See http://gcc.gnu.org/wiki/DebugFission.  */
 DW_OP (DW_OP_GNU_addr_index, 0xfb)
+DW_OP (DW_OP_GNU_const_index, 0xfc)
 /* HP extensions.  */
 DW_OP_DUP (DW_OP_HP_unknown, 0xe0) /* Ouch, the same as GNU_push_tls_address.  
*/
 DW_OP (DW_OP_HP_is_value, 0xe1)


Re: [PATCH] ARM: exclude fixed_regs for stack-alignment save/restore

2012-06-14 Thread Mike Stump
On Jun 14, 2012, at 10:16 AM, Roland McGrath wrote:
 But if e.g. I use -ffixed-r9 then I think it's a reasonable expectation
 that no code is generated that touches r9 in any way, shape, or form.

Also,  I can't help but wonder if global_regs is respected.  In theory, people 
are allowed to declare global registers, and nothing should be stopping them, 
though, this is abi breaking, and one does need to recompile the world as I 
recall to use it, so, most people don't use it and can't use it, but the bare 
metal people can.

Your change looks good to me.

I'll note in passing that cse.c does:

/* Determine whether register number N is considered a fixed register for the   
  
   purpose of approximating register costs. 
  
   It is desirable to replace other regs with fixed regs, to reduce need for
  
   non-fixed hard regs. 
  
   A reg wins if it is either the frame pointer or designated as fixed.  */
#define FIXED_REGNO_P(N)  \
  ((N) == FRAME_POINTER_REGNUM || (N) == HARD_FRAME_POINTER_REGNUM \
   || fixed_regs[N] || global_regs[N])


Re: User directed Function Multiversioning via Function Overloading (issue5752064)

2012-06-14 Thread Sriraman Tallam
+cc c++ front-end maintainers

Hi,

   C++ Frontend maintainers, Could you please take a look at the
front-end part when you find the time?

   Honza, your thoughts on the callgraph part?

   Richard, any further comments/feedback?

   Additionally, I am working on generating better mangled names for
function versions, along the lines of C++ thunks.

Thanks,
-Sri.

On Mon, Jun 4, 2012 at 11:59 AM, Sriraman Tallam tmsri...@google.com wrote:
 Hi,

   Attaching updated patch for function multiversioning which brings
 in plenty of changes.

 * As suggested by Richard earlier, I have made cgraph aware of
 function versions. All nodes of function versions are chained and the
 dispatcher bodies are created on demand while building cgraph edges.
 The dispatcher body will be created if and only if there is a call or
 reference to a versioned function. Previously, I was maintaining the
 list of versions separately in a hash map, all that is gone now.
 * Now, the file multiverison.c has some helper routines that are used
 in the context of function versioning. There are no new passes and no
 new globals.
 * More tests, updated existing tests.
 * Fixed lots of bugs.
 * Updated patch description.

 Patch attached. Patch also available for review at
 http://codereview.appspot.com/5752064

 Please let me know what you think,

 Thanks,
 -Sri.


 On Mon, May 14, 2012 at 11:28 AM, Sriraman Tallam tmsri...@google.com wrote:
 Hi H.J,

   Attaching new patch with 2 test cases, mv2.C checks ISAs only and
 mv1.C checks ISAs and arches mixed. Right now, checking only arches is
 not needed as they are mutually exclusive, any order should be fine.

 Patch also available for review here:  http://codereview.appspot.com/5752064

 Thanks,
 -Sri.

 On Sat, May 12, 2012 at 6:37 AM, H.J. Lu hjl.to...@gmail.com wrote:
 On Fri, May 11, 2012 at 7:04 PM, Sriraman Tallam tmsri...@google.com 
 wrote:
 Hi H.J.,

   I have updated the patch to improve the dispatching method like we
 discussed. Each feature gets a priority now, and the dispatching is
 done in priority order. Please see i386.c for the changes.

 Patch also available for review here:  
 http://codereview.appspot.com/5752064


 I think you need 3 tests:

 1.  Only with ISA.
 2.  Only with arch
 3.  Mixed with ISA and arch

 since test mixed ISA and arch may hide issues with ISA only or arch only.

 --
 H.J.


Re: [PATCH] ARM: exclude fixed_regs for stack-alignment save/restore

2012-06-14 Thread Roland McGrath
On Thu, Jun 14, 2012 at 1:13 PM, Mike Stump mikest...@comcast.net wrote:
 On Jun 14, 2012, at 10:16 AM, Roland McGrath wrote:
 But if e.g. I use -ffixed-r9 then I think it's a reasonable expectation
 that no code is generated that touches r9 in any way, shape, or form.

 Also, I can't help but wonder if global_regs is respected.

It's clearly not.  Making the added condition !fixed_regs[i]  !global_regs[i]
seems sensible to me.


Thanks,
Roland


[v3] Update C++11 status table.

2012-06-14 Thread Jonathan Wakely
Another small patch to add some omissions to the C++11 status table.

Tested x86_64-linux, committed to trunk.
commit e6df5f90c8804a513c8790e1b5288b1398014f85
Author: redi redi@138bc75d-0d04-0410-961f-82ee72b054a4
Date:   Thu Jun 14 20:32:11 2012 +

* doc/xml/manual/status_cxx2011.xml: Correct C++11 status table.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@188635 
138bc75d-0d04-0410-961f-82ee72b054a4

diff --git a/libstdc++-v3/doc/xml/manual/status_cxx2011.xml 
b/libstdc++-v3/doc/xml/manual/status_cxx2011.xml
index 15d1337..adef5ae 100644
--- a/libstdc++-v3/doc/xml/manual/status_cxx2011.xml
+++ b/libstdc++-v3/doc/xml/manual/status_cxx2011.xml
@@ -1037,7 +1037,7 @@ particular release.
   entry20.12.4/entry
   entryScoped allocator adaptor members/entry
   entryPartial/entry
-  entry/
+  entryMissing std::pair piecewise construction./entry
 /row
 row
   entry20.12.5/entry
@@ -1231,10 +1231,12 @@ particular release.
   entry/
 /row
 row
+  ?dbhtml bgcolor=#B0B0B0 ?
   entry22.4.1/entry
   entryThe codectype/code category/entry
-  entryY/entry
-  entry/
+  entryPartial/entry
+  entryMissing codecodecvtlt;char16_t/code and
+ codecodecvtlt;char32_t/code/entry
 /row
 row
   entry22.4.2/entry
@@ -2314,10 +2316,9 @@ particular release.
   entry/
 /row
 row
-  ?dbhtml bgcolor=#C8B0B0 ?
   entry29.8/entry
   entryFences/entry
-  entryN/entry
+  entryY/entry
   entry/
 /row
 row


Re: [PATCH 1/3] Add atomic_compare_and_swap, atomic_exchange and atomic_fetch_add patterns.

2012-06-14 Thread Hans-Peter Nilsson
On Thu, 14 Jun 2012, Maxim Kuvyrkov wrote:
 On 14/06/2012, at 6:33 AM, Richard Sandiford wrote:
  Maxim Kuvyrkov ma...@codesourcery.com writes:
  +/* Subroutines of the mips_process_sync_loop.
  +   Emit barriers as needed for the memory MODEL.  */
  +
  +static bool
  +mips_emit_pre_atomic_barrier_p (enum memmodel model)
  +{
  Comment is a bit misleading because we don't emit anything here.

 Yeap, forgot to update the comment after stealing the code from Alpha's port.

All this copy-pasting...  :(  I ranted the other day exactly
about this copy-pasted function.

While you're editing in these parts, how about making this
bool emit_atomic_barrier_p (enum memmodel, bool pre) and move it to
the middle-end, say emit-rtl.c?

You don't have to change other ports, but you get the privilege
of taunting them. :]

brgds, H-P


[PATCH] Improve pattern recognizer for division by constant (PR tree-optimization/51581)

2012-06-14 Thread Jakub Jelinek
Hi!

This patch performs some of the expand_divmod tricks to expand
integer division by constant using widening vector multiplication,
some shifts and/or additions/subtractions.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2012-06-14  Jakub Jelinek  ja...@redhat.com

PR tree-optimization/51581
* expr.h (choose_multiplier): New prototype.
* expmed.c (choose_multiplier): No longer static.
Change multiplier_ptr from rtx * to UHWI *.
(expand_divmod): Adjust callers.
* tree-vect-patterns.c (vect_recog_sdivmod_pow2_pattern):
Renamed to...
(vect_recog_divmod_pattern): ... this.  Pass bb_vinfo as last
argument to new_stmt_vec_info.  Attempt to optimize also divisions
by non-pow2 constants if integer vector division isn't supported.
* tree-vect-stmts.c (vect_analyze_stmt): If node != NULL,
don't look at pattern stmts and sequences.

* gcc.c-torture/execute/pr51581-1.c: New test.
* gcc.c-torture/execute/pr51581-2.c: New test.
* gcc.dg/vect/pr51581-1.c: New test.
* gcc.dg/vect/pr51581-2.c: New test.
* gcc.dg/vect/pr51581-3.c: New test.
* gcc.target/i386/avx-pr51581-1.c: New test.
* gcc.target/i386/avx-pr51581-2.c: New test.
* gcc.target/i386/avx2-pr51581-1.c: New test.
* gcc.target/i386/avx2-pr51581-2.c: New test.
* gcc.dg/vect/slp-26.c (main1): Divide by 0x8031 instead of 3.

--- gcc/expr.h.jj   2012-01-02 20:39:59.0 +0100
+++ gcc/expr.h  2012-06-13 12:02:26.498269223 +0200
@@ -243,6 +243,13 @@ extern rtx emit_store_flag (rtx, enum rt
 /* Like emit_store_flag, but always succeeds.  */
 extern rtx emit_store_flag_force (rtx, enum rtx_code, rtx, rtx,
  enum machine_mode, int, int);
+
+/* Choose a minimal N + 1 bit approximation to 1/D that can be used to
+   replace division by D, and put the least significant N bits of the result
+   in *MULTIPLIER_PTR and return the most significant bit.  */
+extern unsigned HOST_WIDE_INT choose_multiplier (unsigned HOST_WIDE_INT, int,
+int, unsigned HOST_WIDE_INT *,
+int *, int *);
 
 /* Functions from builtins.c:  */
 extern rtx expand_builtin (tree, rtx, rtx, enum machine_mode, int);
--- gcc/expmed.c.jj 2012-06-04 11:18:44.0 +0200
+++ gcc/expmed.c2012-06-13 14:51:52.343232937 +0200
@@ -2363,8 +2363,6 @@ static bool choose_mult_variant (enum ma
 struct algorithm *, enum mult_variant *, int);
 static rtx expand_mult_const (enum machine_mode, rtx, HOST_WIDE_INT, rtx,
  const struct algorithm *, enum mult_variant);
-static unsigned HOST_WIDE_INT choose_multiplier (unsigned HOST_WIDE_INT, int,
-int, rtx *, int *, int *);
 static unsigned HOST_WIDE_INT invert_mod2n (unsigned HOST_WIDE_INT, int);
 static rtx extract_high_half (enum machine_mode, rtx);
 static rtx expand_mult_highpart (enum machine_mode, rtx, rtx, rtx, int, int);
@@ -3293,10 +3291,10 @@ ceil_log2 (unsigned HOST_WIDE_INT x)
Using this function, x/D will be equal to (x * m)  (*POST_SHIFT_PTR),
where m is the full HOST_BITS_PER_WIDE_INT + 1 bit multiplier.  */
 
-static
 unsigned HOST_WIDE_INT
 choose_multiplier (unsigned HOST_WIDE_INT d, int n, int precision,
-  rtx *multiplier_ptr, int *post_shift_ptr, int *lgup_ptr)
+  unsigned HOST_WIDE_INT *multiplier_ptr,
+  int *post_shift_ptr, int *lgup_ptr)
 {
   HOST_WIDE_INT mhigh_hi, mlow_hi;
   unsigned HOST_WIDE_INT mhigh_lo, mlow_lo;
@@ -3368,12 +3366,12 @@ choose_multiplier (unsigned HOST_WIDE_IN
   if (n  HOST_BITS_PER_WIDE_INT)
 {
   unsigned HOST_WIDE_INT mask = ((unsigned HOST_WIDE_INT) 1  n) - 1;
-  *multiplier_ptr = GEN_INT (mhigh_lo  mask);
+  *multiplier_ptr = mhigh_lo  mask;
   return mhigh_lo = mask;
 }
   else
 {
-  *multiplier_ptr = GEN_INT (mhigh_lo);
+  *multiplier_ptr = mhigh_lo;
   return mhigh_hi;
 }
 }
@@ -4053,10 +4051,9 @@ expand_divmod (int rem_flag, enum tree_c
  {
if (unsignedp)
  {
-   unsigned HOST_WIDE_INT mh;
+   unsigned HOST_WIDE_INT mh, ml;
int pre_shift, post_shift;
int dummy;
-   rtx ml;
unsigned HOST_WIDE_INT d = (INTVAL (op1)
 GET_MODE_MASK (compute_mode));
 
@@ -4118,7 +4115,8 @@ expand_divmod (int rem_flag, enum tree_c
  = (shift_cost[speed][compute_mode][post_shift - 1]
 + shift_cost[speed][compute_mode][1]
 + 2 * add_cost[speed][compute_mode]);
-   t1 = expand_mult_highpart (compute_mode, op0, ml,
+

[PATCH] Small tree-vect-pattern.c cleanup

2012-06-14 Thread Jakub Jelinek
Hi!

While looking at pattern recognizer, I've noticed that we needlessly
allocate a single member array from heap.  An automatic variable for that
would be fine, but BB_VINFO_BB is also addressable.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2012-06-14  Jakub Jelinek  ja...@redhat.com

* tree-vect-patterns.c (vect_pattern_recog): Don't unnecessarily
allocate and free bbs array for the SLP case.

--- gcc/tree-vect-patterns.c.jj 2012-06-14 13:22:27.0 +0200
+++ gcc/tree-vect-patterns.c2012-06-14 15:33:16.335453016 +0200
@@ -2983,7 +2983,7 @@ void
 vect_pattern_recog (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo)
 {
   struct loop *loop;
-  basic_block *bbs, bb;
+  basic_block *bbs;
   unsigned int nbbs;
   gimple_stmt_iterator si;
   unsigned int i, j;
@@ -3002,10 +3002,8 @@ vect_pattern_recog (loop_vec_info loop_v
 }
   else
 {
-  bb = BB_VINFO_BB (bb_vinfo);
+  bbs = BB_VINFO_BB (bb_vinfo);
   nbbs = 1;
-  bbs = XNEW (basic_block);
-  bbs[0] = bb;
 }
 
   /* Scan through the loop stmts, applying the pattern recognition
@@ -3031,6 +3029,4 @@ vect_pattern_recog (loop_vec_info loop_v
 }
 
   VEC_free (gimple, heap, stmts_to_replace);
-  if (bb_vinfo)
-free (bbs);
 }

Jakub


[v3] fix PR 53648

2012-06-14 Thread Jonathan Wakely
Using the empty base-class optimization in std::tuple can result in
ambiguous base classes when you have a tuple of tuples. This patch
disables the EBO for tuple elements that are themselves tuples, with
tuple_size  1 (because for a zero-size tuple the base class will be
_Tuple_impl1 and the tuple that contains it must have _Tuple_implN
where N1, because it contains at least one element, the zero-sized
tuple).

PR libstdc++/53648
* include/std/tuple (__empty_not_final): Do not use EBO for tuples.
* testsuite/20_util/tuple/53648.cc: New.
* testsuite/20_util/uses_allocator/cons_neg.cc: Adjust dg-error line
number.

Tested x86_64-linux, committed to trunk.  Although I think it would be
safe I have no plans to apply it to release branches.
commit b069e0d58ce0c4d54d67aa5c85e88022a317817a
Author: Jonathan Wakely jwakely@gmail.com
Date:   Thu Jun 14 22:02:26 2012 +0100

PR libstdc++/53648
* include/std/tuple (__empty_not_final): Do not use EBO for tuples.
* testsuite/20_util/tuple/53648.cc: New.
* testsuite/20_util/uses_allocator/cons_neg.cc: Adjust dg-error line
number.

diff --git a/libstdc++-v3/include/std/tuple b/libstdc++-v3/include/std/tuple
index 4d4691f..fb9e09f 100644
--- a/libstdc++-v3/include/std/tuple
+++ b/libstdc++-v3/include/std/tuple
@@ -1,6 +1,7 @@
 // tuple -*- C++ -*-
 
-// Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+// Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012
+// Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -201,10 +202,18 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   void _M_swap(_Tuple_impl) noexcept { /* no-op */ }
 };
 
+  templatetypename _Tp
+struct __is_empty_non_tuple : is_empty_Tp { };
+
+  // Using EBO for elements that are tuples causes ambiguous base errors.
+  templatetypename _El0, typename... _El
+struct __is_empty_non_tupletuple_El0, _El... : false_type { };
+
   // Use the Empty Base-class Optimization for empty, non-final types.
   templatetypename _Tp
 using __empty_not_final
-  = typename conditional__is_final(_Tp), false_type, is_empty_Tp::type;
+= typename conditional__is_final(_Tp), false_type,
+  __is_empty_non_tuple_Tp::type;
 
   /**
* Recursive tuple implementation. Here we store the @c Head element
diff --git a/libstdc++-v3/testsuite/20_util/tuple/53648.cc 
b/libstdc++-v3/testsuite/20_util/tuple/53648.cc
new file mode 100644
index 000..5671e44
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/tuple/53648.cc
@@ -0,0 +1,44 @@
+// { dg-options -std=gnu++0x }
+// { dg-do compile }
+
+// Copyright (C) 2012 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// http://www.gnu.org/licenses/.
+
+// libstdc++/53648
+
+#include tuple
+#include type_traits
+
+using std::tuple;
+
+struct A { };
+
+template class tupletuple;
+template class tupletupletuple;
+template class tupleA, tupleA, tupleA, tupleA;
+template class tupletupletupleA, A, A, A;
+
+// Verify the following QoI properties are preserved
+
+static_assert( std::is_emptytuple::value, tuple is empty );
+
+static_assert( std::is_emptytupletuple::value,
+   tupletuple is empty );
+
+static_assert( sizeof(tuplechar, tuple) == sizeof(char),
+   tuple is eligible for EBO );
+
diff --git a/libstdc++-v3/testsuite/20_util/uses_allocator/cons_neg.cc 
b/libstdc++-v3/testsuite/20_util/uses_allocator/cons_neg.cc
index 73a0d0f..d81dd35 100644
--- a/libstdc++-v3/testsuite/20_util/uses_allocator/cons_neg.cc
+++ b/libstdc++-v3/testsuite/20_util/uses_allocator/cons_neg.cc
@@ -44,4 +44,4 @@ void test01()
 
   tupleType t(allocator_arg, a, 1);
 }
-// { dg-error no matching function  { target *-*-* } 112 }
+// { dg-error no matching function  { target *-*-* } 113 }


[v3] PR 53270 fix hppa-linux bootstrap regression

2012-06-14 Thread Jonathan Wakely
We've known for ages that it's not portable to do:

__gthread_mutex_t tmp = __GTHREAD_MUTEX_INIT;
_M_mutex = __tmp;

As PR 53270 shows, the copy assignment now actually fails in C++11
mode on platforms using LinuxThreads, because the mutex has a volatile
member so in C++11 mode the copy assignment operator is deleted.

This patch changes ext/concurrence.h to use a
brace-or-equals-initializer for the mutexes and condition variable in
C++11 mode, allowing hppa-linux to bootstrap again and avoiding the
non-portable construct everywhere (this is already the approach we
take for std::mutex etc. in mutex). It also makes the same change to
the mutex used in ext/rope and fixes a resource leak in that header
by ensuring the mutex is destroyed when it was initialized by
__gthread_mutex_init_function.

PR libstdc++/53270
* include/ext/concurrence.h (__mutex, __recursive_mutex, __cond): Use
NSDMI in C++11 mode.
* include/ext/rope (_Refcount_Base): Likewise. Destroy mutex in
destructor when initialized by function.

Tested x86_64-linux, powerpc64-linux, hppa-linux and x86_64-netbsd (on
the 4.7 branch instead, as netbsd doesn't bootstrap at the moment.)
Committed to trunk.

For 4.6.4 and 4.7.2 I plan to make a less intrusive change, #undef'ing
the __GTHREAD_MUTEX_INIT, _GTHREAD_RECURSIVE_MUTEX_INIT and
__GTHREAD_COND_INIT macros on hppa-linux in C++11 mode, so that the
init functions are used instead.  This fixes the bootstrap regression
on hppa-linux without affecting other targets.
commit 62d49cd435f56bc7c433b40bdec010a5e037712b
Author: Jonathan Wakely jwakely@gmail.com
Date:   Sat Jun 9 13:10:13 2012 +0100

PR libstdc++/53270
* include/ext/concurrence.h (__mutex, __recursive_mutex, __cond): Use
NSDMI in C++11 mode.
* include/ext/rope (_Refcount_Base): Likewise. Destroy mutex in
destructor when initialized by function.

diff --git a/libstdc++-v3/include/ext/concurrence.h 
b/libstdc++-v3/include/ext/concurrence.h
index fc8f63f..22c433b 100644
--- a/libstdc++-v3/include/ext/concurrence.h
+++ b/libstdc++-v3/include/ext/concurrence.h
@@ -143,7 +143,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   class __mutex 
   {
   private:
+#if __GTHREADS  defined __GTHREAD_MUTEX_INIT \
+ defined __GXX_EXPERIMENTAL_CXX0X__
+__gthread_mutex_t _M_mutex = __GTHREAD_MUTEX_INIT;
+#else
 __gthread_mutex_t _M_mutex;
+#endif
 
 __mutex(const __mutex);
 __mutex operator=(const __mutex);
@@ -155,8 +160,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   if (__gthread_active_p())
{
 #if defined __GTHREAD_MUTEX_INIT
+# ifndef __GXX_EXPERIMENTAL_CXX0X__
  __gthread_mutex_t __tmp = __GTHREAD_MUTEX_INIT;
  _M_mutex = __tmp;
+# endif
 #else
  __GTHREAD_MUTEX_INIT_FUNCTION(_M_mutex); 
 #endif
@@ -201,7 +208,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   class __recursive_mutex 
   {
   private:
+#if __GTHREADS  defined __GTHREAD_RECURSIVE_MUTEX_INIT \
+ defined __GXX_EXPERIMENTAL_CXX0X__
+__gthread_recursive_mutex_t _M_mutex = __GTHREAD_RECURSIVE_MUTEX_INIT;
+#else
 __gthread_recursive_mutex_t _M_mutex;
+#endif
 
 __recursive_mutex(const __recursive_mutex);
 __recursive_mutex operator=(const __recursive_mutex);
@@ -213,8 +225,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   if (__gthread_active_p())
{
 #if defined __GTHREAD_RECURSIVE_MUTEX_INIT
+# ifndef __GXX_EXPERIMENTAL_CXX0X__
  __gthread_recursive_mutex_t __tmp = __GTHREAD_RECURSIVE_MUTEX_INIT;
  _M_mutex = __tmp;
+# endif
 #else
  __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION(_M_mutex); 
 #endif
@@ -319,7 +333,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   class __cond
   {
   private:
+#if __GTHREADS  defined __GTHREAD_COND_INIT \
+ defined __GXX_EXPERIMENTAL_CXX0X__
+__gthread_cond_t _M_cond = __GTHREAD_COND_INIT;
+#else
 __gthread_cond_t _M_cond;
+#endif
 
 __cond(const __cond);
 __cond operator=(const __cond);
@@ -331,8 +350,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   if (__gthread_active_p())
{
 #if defined __GTHREAD_COND_INIT
+# ifndef __GXX_EXPERIMENTAL_CXX0X__
  __gthread_cond_t __tmp = __GTHREAD_COND_INIT;
  _M_cond = __tmp;
+# endif
 #else
  __GTHREAD_COND_INIT_FUNCTION(_M_cond);
 #endif
diff --git a/libstdc++-v3/include/ext/rope b/libstdc++-v3/include/ext/rope
index 5e82811..15cb423 100644
--- a/libstdc++-v3/include/ext/rope
+++ b/libstdc++-v3/include/ext/rope
@@ -458,13 +458,19 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 volatile _RC_t _M_ref_count;
 
 // Constructor
+#if defined __GTHREAD_MUTEX_INIT  defined __GXX_EXPERIMENTAL_CXX0X__
+__gthread_mutex_t _M_ref_count_lock = __GTHREAD_MUTEX_INIT;
+#else
 __gthread_mutex_t _M_ref_count_lock;
+#endif
 
 _Refcount_Base(_RC_t __n) : _M_ref_count(__n), _M_ref_count_lock()
 {
 #ifdef __GTHREAD_MUTEX_INIT
+# ifndef __GXX_EXPERIMENTAL_CXX0X__
   __gthread_mutex_t __tmp = __GTHREAD_MUTEX_INIT;
   

[PATCH] Add a new option -fstack-protector-strong (issue 6303078)

2012-06-14 Thread shenhan

Reviewers: ,

Message:
Hi, this is to port the patch from google/main to trunk, which provides
a new stack protection option - fstack-protector-strong.

Previous review for google trunk is here -
http://codereview.appspot.com/5461043

Status - it has been used in google/main for 2 quarters, building the
whole chromiumos with no securiy degradation.

Benefit - gain big performance while sacrificing little security (for
scenarios using -fstack-protector-all)

Background - some times stack-protector is too-simple while
stack-protector-all over-kills, for example, to build one of our core
systems, we forcibly add -fstack-protector-all to all compile
commands, which brings big performance penalty (due to extra stack
guard/check insns on function prologue and epilogue) on both atom and
arm. To use -fstack-protector is just regarded as not secure enough
(only protects 2% functions) by the system secure team. So I'd like
to add the option -fstack-protector-strong, that hits the balance
between -fstack-protector and -fstack-protector-all.

Detail -
https://docs.google.com/a/google.com/document/d/1xXBH6rRZue4f296vGt9YQcuLVQHeE516stHwt8M9xyU/edit?hl=en_US

Tested - dejagnu, building chromiumos from scratch.

Ok for trunk?

Thank,
-Han


Description:
This is to port the patch from google/main to trunk, which provides a
new stack protection option - fstack-protector-strong.

Previous review for google trunk is here -
http://codereview.appspot.com/5461043

Status - it has been used in google/main for 2 quarters, building the
whole chromiumos with no securiy degradation.

Benefit - gain big performance while sacrificing little security (for
scenarios using -fstack-protector-all)

Background - some times stack-protector is too-simple while
stack-protector-all over-kills, for example, to build one of our core
systems, we forcibly add -fstack-protector-all to all compile
commands, which brings big performance penalty (due to extra stack
guard/check insns on function prologue and epilogue) on both atom and
arm. To use -fstack-protector is just regarded as not secure enough
(only protects 2% functions) by the system secure team. So I'd like
to add the option -fstack-protector-strong, that hits the balance
between -fstack-protector and -fstack-protector-all.

Detail -
https://docs.google.com/a/google.com/document/d/1xXBH6rRZue4f296vGt9YQcuLVQHeE516stHwt8M9xyU/edit?hl=en_US

Tested - building chromiumos from scratch.



Please review this at http://codereview.appspot.com/6303078/

Affected files:
  M gcc/cfgexpand.c
  M gcc/common.opt
  gcc/doc/invoke.texi
  A gcc/testsuite/g++.dg/fstack-protector-strong.C
  A gcc/testsuite/gcc.dg/fstack-protector-strong.c




Re: [PATCH] Add a new option -fstack-protector-strong (issue 6303078)

2012-06-14 Thread Joseph S. Myers
On Thu, 14 Jun 2012, shen...@google.com wrote:

 Hi, this is to port the patch from google/main to trunk, which provides
 a new stack protection option - fstack-protector-strong.

If you are proposing a patch for trunk, please include the whole patch in 
the gcc-patches posting.

 Detail -
 https://docs.google.com/a/google.com/document/d/1xXBH6rRZue4f296vGt9YQcuLVQHeE516stHwt8M9xyU/edit?hl=en_US

Please include the full description in the patch submission so that it is 
self-contained.  That document does not appear to be so long that this 
should be a problem.

Please resubmit a self-contained patch submission to gcc-patches.

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


[PATCH, TileGX] Committed fix for a typo bug

2012-06-14 Thread Maxim Kuvyrkov
Walter,

While working on atomics for a different target, I've noticed below typo bug in 
TileGX.

Patch checked in as obvious.

Thank you,

--
Maxim Kuvyrkov
CodeSourcery / Mentor Graphics




fsf-gcc-tile-sync.patch
Description: Binary data


[patch committed libjava] Update sysdep/sh/locks.h with atomic builtins

2012-06-14 Thread Kaz Kojima
Hi,

I've applied the attached patch which updates libjava/sysdep/sh/locks.h
with new atomic builtins.  Tested on sh4-unknown-linux-gnu with no new
failures.

Regards,
kaz
--
2012-06-14  Kaz Kojima  kkoj...@gcc.gnu.org

* sysdep/sh/locks.h (__cas_lock): Remove.
(__cas_start_atomic, __cas_end_atomic): Likewise.
(compare_and_swap): Call __sync_bool_compare_and_swap.

--- ORIG/trunk/libjava/sysdep/sh/locks.h2007-01-13 09:53:55.0 
+0900
+++ trunk/libjava/sysdep/sh/locks.h 2012-06-14 19:18:34.0 +0900
@@ -14,45 +14,11 @@ details.  */
 typedef size_t obj_addr_t; /* Integer type big enough for object   */
/* address. */
 
-static unsigned char __cas_lock = 0;
-
-inline static void
-__cas_start_atomic (void)
-{
-  unsigned int val;
-
-  do
-__asm__ __volatile__ (tas.b @%1; movt %0
- : =r (val)
- : r (__cas_lock)
- : memory);
-  while (val == 0);
-}
-
-inline static void
-__cas_end_atomic (void)
-{
-  __asm__ __volatile__ (  : : : memory);
-  __cas_lock = 0;
-}
-
 inline static bool
 compare_and_swap (volatile obj_addr_t *addr, obj_addr_t old,
  obj_addr_t new_val)
 {
-  bool ret;
-
-  __cas_start_atomic ();
-  if (*addr != old)
-ret = false;
-  else
-{
-  *addr = new_val;
-  ret = true;
-}
-  __cas_end_atomic ();
-
-  return ret;
+  return __sync_bool_compare_and_swap (addr, old, new_val);
 }
 
 inline static void


[PATCH] Unify emit_{pre,post}_atomic_barrier across Alpha, ARM, MIPS and TileGX

2012-06-14 Thread Maxim Kuvyrkov
As suggested by Hans-Peter this patch unifies logic for emitting pre- and 
post-barriers for atomic operations across Alpha, ARM, MIPS and TileGX.  
Currently these targets use copy-pasted switch statements and this patch cleans 
that up.

I'm going to test this patch on MIPS, and I would appreciate target maintainers 
to cast a close look at the changes for their targets.  The changes are simple, 
but you can never eliminate typo mistakes.

Thank you,

--
Maxim Kuvyrkov
CodeSourcery / Mentor Graphics




0001-Unify-emit_-pre-post-_atomic_barrier-across-Alpha-AR.patch
Description: Binary data


Re: [PATCH 1/3] Add atomic_compare_and_swap, atomic_exchange and atomic_fetch_add patterns.

2012-06-14 Thread Maxim Kuvyrkov
On 15/06/2012, at 8:51 AM, Hans-Peter Nilsson wrote:

 On Thu, 14 Jun 2012, Maxim Kuvyrkov wrote:
 On 14/06/2012, at 6:33 AM, Richard Sandiford wrote:
 Maxim Kuvyrkov ma...@codesourcery.com writes:
 +/* Subroutines of the mips_process_sync_loop.
 +   Emit barriers as needed for the memory MODEL.  */
 +
 +static bool
 +mips_emit_pre_atomic_barrier_p (enum memmodel model)
 +{
 Comment is a bit misleading because we don't emit anything here.
 
 Yeap, forgot to update the comment after stealing the code from Alpha's port.
 
 All this copy-pasting...  :(  I ranted the other day exactly
 about this copy-pasted function.
 
 While you're editing in these parts, how about making this
 bool emit_atomic_barrier_p (enum memmodel, bool pre) and move it to
 the middle-end, say emit-rtl.c?
 
 You don't have to change other ports, but you get the privilege
 of taunting them. :]

I've posted a separate patch to unify code for several targets.

--
Maxim Kuvyrkov
CodeSourcery / Mentor Graphics




[PATCH] Add a new option -fstack-protector-strong (patch / doc inside)

2012-06-14 Thread 沈涵
Hi,

This is to port the patch from google/main to trunk, which provides a new stack
protection option - fstack-protector-strong.

Previous review for google trunk is here -
http://codereview.appspot.com/5461043

Status - it has been used in google/main for 2 quarters, building the whole
chromiumos with no securiy degradation.

Benefit - gain big performance while sacrificing little security (for scenarios
using -fstack-protector-all)

Background - some times stack-protector is too-simple while stack-protector-all
over-kills, for example, to build one of our core systems, we forcibly add
-fstack-protector-all to all compile commands, which brings big performance
penalty (due to extra stack guard/check insns on function prologue and epilogue)
on both atom and arm. To use -fstack-protector is just regarded as not secure
enough (only protects 2% functions) by the system secure team. So I'd like to
add the option -fstack-protector-strong, that hits the balance between
-fstack-protector and -fstack-protector-all.

Tested - building chromiumos from scratch.

Changelog -

gcc/ChangeLog:
   * cfgexpand.c (expand_used_vars): Add logic handling
stack-protector-strong.
   (record_or_union_type_has_array_p): New, tests if a record or
union type contains an array.
   * common.opt (fstack-protector-all): New option.
   * doc/invoke.texi: Added reference to -fstack-protector-strong.

gcc/testsuite/ChangeLog
   * gcc.dg/fstack-protector-strong.c: New.
   * g++.dg/fstack-protector-strong.C: New.



Patch -

diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index 8a31a9f..0911b6c 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -1511,15 +1511,39 @@ estimated_stack_frame_size (struct cgraph_node *node)
   return size;
 }

+/* Helper routine to check if a record or union contains an array field. */
+
+static int
+record_or_union_type_has_array_p (const_tree tree_type)
+{
+  tree fields = TYPE_FIELDS (tree_type);
+  tree f;
+
+  for (f = fields; f; f = DECL_CHAIN (f))
+{
+  if (TREE_CODE (f) == FIELD_DECL)
+   {
+ tree field_type = TREE_TYPE (f);
+ if (RECORD_OR_UNION_TYPE_P (field_type))
+   return record_or_union_type_has_array_p (field_type);
+ if (TREE_CODE (field_type) == ARRAY_TYPE)
+   return 1;
+   }
+}
+  return 0;
+}
+
 /* Expand all variables used in the function.  */

 static void
 expand_used_vars (void)
 {
   tree var, outer_block = DECL_INITIAL (current_function_decl);
+  referenced_var_iterator rvi;
   VEC(tree,heap) *maybe_local_decls = NULL;
   unsigned i;
   unsigned len;
+  int gen_stack_protect_signal = 0;

   /* Compute the phase of the stack frame for this function.  */
   {
@@ -1552,6 +1576,23 @@ expand_used_vars (void)
}
 }

+  FOR_EACH_REFERENCED_VAR (cfun, var, rvi)
+if (!is_global_var (var))
+  {
+   tree var_type = TREE_TYPE (var);
+   /* Examine local referenced variables that have their addresses taken,
+  contain an array, or are arrays.  */
+   if (TREE_CODE (var) == VAR_DECL
+(TREE_CODE (var_type) == ARRAY_TYPE
+   || TREE_ADDRESSABLE (var)
+   || (RECORD_OR_UNION_TYPE_P (var_type)
+record_or_union_type_has_array_p (var_type
+ {
+   ++gen_stack_protect_signal;
+   break;
+ }
+  }
+
   /* At this point all variables on the local_decls with TREE_USED
  set are not associated with any block scope.  Lay them out.  */

@@ -1642,11 +1683,18 @@ expand_used_vars (void)
dump_stack_var_partition ();
 }

-  /* There are several conditions under which we should create a
- stack guard: protect-all, alloca used, protected decls present.  */
-  if (flag_stack_protect == 2
-  || (flag_stack_protect
-  (cfun-calls_alloca || has_protected_decls)))
+  /* Create stack guard, if
+ a) -fstack-protector-all - always;
+ b) -fstack-protector-strong - if there are arrays, memory
+ references to local variables, alloca used, or protected decls present;
+ c) -fstack-protector - if alloca used, or protected decls present  */
+  if (flag_stack_protect == 3  /* -fstack-protector-all  */
+  || (flag_stack_protect == 2  /* -fstack-protector-strong  */
+  (gen_stack_protect_signal || cfun-calls_alloca
+ || has_protected_decls))
+  || (flag_stack_protect == 1  /* -fstack-protector  */
+  (cfun-calls_alloca
+ || has_protected_decls)))
 create_stack_guard ();

   /* Assign rtl to each variable based on these partitions.  */
diff --git a/gcc/common.opt b/gcc/common.opt
index 5b1b4d8..7f6 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -1846,8 +1846,12 @@ fstack-protector
 Common Report Var(flag_stack_protect, 1)
 Use propolice as a stack protection method

-fstack-protector-all
+fstack-protector-strong
 Common Report RejectNegative Var(flag_stack_protect, 2)
+Use a smart stack protection method for certain 

Re: [PATCH] Unify emit_{pre,post}_atomic_barrier across Alpha, ARM, MIPS and TileGX

2012-06-14 Thread Richard Henderson
On 2012-06-14 16:06, Maxim Kuvyrkov wrote:
 2012-06-15  Maxim Kuvyrkov  ma...@codesourcery.com
 
   * emit-rtl.c (need_atomic_barrier_p): New function.
   * emit-rtl.h (need_atomic_barrier_p): Declare it.
   * config/alpha/alpha.c (alpha_{pre,post}_atomic_barrier): Remove, use
   generic version instead.
   * config/arm/arm.c (arm_{pre,post}_atomic_barrier): Remove, use
   generic version instead.
   * config/mips/mips.c (mips_{pre,post}_atomic_barrier_p): Remove, use
   generic version instead.
   * config/tilegx/tilegx.c, config/tilegx/tilegx-protos.h,
   * config/tilegx/sync.md (tilegx_{pre,post}_atomic_barrier): Remove, use
   generic version instead.


Ok.


r~


Re: [PATCH] ARM: exclude fixed_regs for stack-alignment save/restore

2012-06-14 Thread Roland McGrath
Here's the version of the change that incorporates Mike's suggestion.


Thanks,
Roland


gcc/
2012-06-14  Roland McGrath  mcgra...@google.com

* config/arm/arm.c (arm_get_frame_offsets): Never use a fixed register
as the extra register to save/restore for stack-alignment padding.

diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 092e202..13771d9 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -16752,7 +16752,12 @@ arm_get_frame_offsets (void)
  else
for (i = 4; i = (TARGET_THUMB1 ? LAST_LO_REGNUM : 11); i++)
  {
-   if ((offsets-saved_regs_mask  (1  i)) == 0)
+   /* While the gratuitous register save/restore is ordinarily
+  harmless, if a register is marked as fixed or global it
+  may be entirely forbidden by the system ABI to touch it,
+  so we should avoid those registers.  */
+   if (!fixed_regs[i]  !global_regs[i]
+(offsets-saved_regs_mask  (1  i)) == 0)
  {
reg = i;
break;


[v3] fix PR 53578 invalid narrowing conversion

2012-06-14 Thread Jonathan Wakely
This fixes an invalid narrowing conversion that causes problems when
libstdc++ is used with clang++ on non-pthreads targets.

PR libstdc++/53578
* include/ext/concurrence.h (__recursive_mutex::_S_destroy): Fix
narrowing conversion.
* include/std/mutex (__recursive_mutex_base::_S_destroy): Likewise.

Tested x86_64-linux with _GTHREAD_USE_RECURSIVE_MUTEX_INIT_FUNC
defined so the code is executed. Committed to trunk.
commit 583eb7d9fdcf5365c286fd85c0b43406a9ce46ef
Author: Jonathan Wakely jwakely@gmail.com
Date:   Fri Jun 15 01:01:03 2012 +0100

PR libstdc++/53578
* include/ext/concurrence.h (__recursive_mutex::_S_destroy): Fix
narrowing conversion.
* include/std/mutex (__recursive_mutex_base::_S_destroy): Likewise.

diff --git a/libstdc++-v3/include/ext/concurrence.h 
b/libstdc++-v3/include/ext/concurrence.h
index 22c433b..25e218b 100644
--- a/libstdc++-v3/include/ext/concurrence.h
+++ b/libstdc++-v3/include/ext/concurrence.h
@@ -284,7 +284,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
 // matches a gthr-win32.h recursive mutex
 templatetypename _Rm
-  static typename __enable_ifsizeof(_Rm::sema), void::__type
+  static typename __enable_if(bool)sizeof(_Rm::sema), void::__type
   _S_destroy(_Rm* __mx)
   {
 __gthread_mutex_t __tmp;
@@ -293,7 +293,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
 // matches a recursive mutex with a member 'actual'
 templatetypename _Rm
-  static typename __enable_ifsizeof(_Rm::actual), void::__type
+  static typename __enable_if(bool)sizeof(_Rm::actual), void::__type
   _S_destroy(_Rm* __mx)
   { __gthread_mutex_destroy(__mx-actual); }
 
diff --git a/libstdc++-v3/include/std/mutex b/libstdc++-v3/include/std/mutex
index a7ebace..34d64c5 100644
--- a/libstdc++-v3/include/std/mutex
+++ b/libstdc++-v3/include/std/mutex
@@ -116,13 +116,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
 // matches a recursive mutex with a member 'actual'
 templatetypename _Rm
-  static typename enable_ifsizeof(_Rm::actual), void::type
+  static typename enable_if(bool)sizeof(_Rm::actual), void::type
   _S_destroy(_Rm* __mx)
   { __gthread_mutex_destroy(__mx-actual); }
 
 // matches a gthr-win32.h recursive mutex
 templatetypename _Rm
-  static typename enable_ifsizeof(_Rm::sema), void::type
+  static typename enable_if(bool)sizeof(_Rm::sema), void::type
   _S_destroy(_Rm* __mx)
   {
 __gthread_mutex_t __tmp;


Re: [RFC C++] Turn on builtin_shuffle for C++.

2012-06-14 Thread Jason Merrill

OK.

Jason


Change the ordering of cdce pass

2012-06-14 Thread Easwaran Raman
The conditional dead call elimination pass shrink wraps certain dead
calls to math functions. It doesn't handle case like this:

D.142420_139 = powD.549 (D.142421_138, D.142419_132);
 fooD.120935.barD.113815 = D.142420_139;
# foo.bar is dead here.

This code gets cleaned up by DCE and leaves only pow, which can then
be shrink-wrapped by cdce. So it seems reasonable to do this
reordering. Bootstraps on x86_64 on linux with no test regression. OK
for trunk?

- Easwaran

--

2012-06-14   Easwaran Raman  era...@google.com

* gcc/passes.c (init_optimization_passes): Remove pass_call_cdce
from its current position and insert after pass_dce.

Index: gcc/passes.c
===
--- gcc/passes.c(revision 188535)
+++ gcc/passes.c(working copy)
@@ -1374,7 +1374,6 @@ init_optimization_passes (void)
   NEXT_PASS (pass_complete_unrolli);
   NEXT_PASS (pass_ccp);
   NEXT_PASS (pass_forwprop);
-  NEXT_PASS (pass_call_cdce);
   /* pass_build_alias is a dummy pass that ensures that we
 execute TODO_rebuild_alias at this point.  Re-building
 alias information also rewrites no longer addressed
@@ -1387,6 +1386,7 @@ init_optimization_passes (void)
   NEXT_PASS (pass_merge_phi);
   NEXT_PASS (pass_vrp);
   NEXT_PASS (pass_dce);
+  NEXT_PASS (pass_call_cdce);
   NEXT_PASS (pass_cselim);
   NEXT_PASS (pass_tree_ifcombine);
   NEXT_PASS (pass_phiopt);


Re: Change the ordering of cdce pass

2012-06-14 Thread Easwaran Raman
ChangeLog entry has a gcc/ prefix that shouldn't be there. Here is the
revised entry:

2012-06-14   Easwaran Raman  era...@google.com

* passes.c (init_optimization_passes): Remove pass_call_cdce
from its current position and insert after pass_dce.



On Thu, Jun 14, 2012 at 6:38 PM, Easwaran Raman era...@google.com wrote:
 The conditional dead call elimination pass shrink wraps certain dead
 calls to math functions. It doesn't handle case like this:

 D.142420_139 = powD.549 (D.142421_138, D.142419_132);
  fooD.120935.barD.113815 = D.142420_139;
 # foo.bar is dead here.

 This code gets cleaned up by DCE and leaves only pow, which can then
 be shrink-wrapped by cdce. So it seems reasonable to do this
 reordering. Bootstraps on x86_64 on linux with no test regression. OK
 for trunk?

 - Easwaran

 --

 2012-06-14   Easwaran Raman  era...@google.com

        * gcc/passes.c (init_optimization_passes): Remove pass_call_cdce
        from its current position and insert after pass_dce.

 Index: gcc/passes.c
 ===
 --- gcc/passes.c        (revision 188535)
 +++ gcc/passes.c        (working copy)
 @@ -1374,7 +1374,6 @@ init_optimization_passes (void)
       NEXT_PASS (pass_complete_unrolli);
       NEXT_PASS (pass_ccp);
       NEXT_PASS (pass_forwprop);
 -      NEXT_PASS (pass_call_cdce);
       /* pass_build_alias is a dummy pass that ensures that we
         execute TODO_rebuild_alias at this point.  Re-building
         alias information also rewrites no longer addressed
 @@ -1387,6 +1386,7 @@ init_optimization_passes (void)
       NEXT_PASS (pass_merge_phi);
       NEXT_PASS (pass_vrp);
       NEXT_PASS (pass_dce);
 +      NEXT_PASS (pass_call_cdce);
       NEXT_PASS (pass_cselim);
       NEXT_PASS (pass_tree_ifcombine);
       NEXT_PASS (pass_phiopt);


Re: [PATCH 1/3] Add atomic_compare_and_swap, atomic_exchange and atomic_fetch_add patterns.

2012-06-14 Thread Hans-Peter Nilsson
On Fri, 15 Jun 2012, Maxim Kuvyrkov wrote:
 On 15/06/2012, at 8:51 AM, Hans-Peter Nilsson wrote:
  While you're editing in these parts, how about making this
  bool emit_atomic_barrier_p (enum memmodel, bool pre) and move it to
  the middle-end, say emit-rtl.c?
 I've posted a separate patch to unify code for several targets.

Great, thanks!  (And yes BTW, I'll move the CRIS port to use this.)

brgds, H-P


Ping*2: [RFA:] fix bug in configure header-probing for stack protector support in target C library

2012-06-14 Thread Hans-Peter Nilsson
 From: Hans-Peter Nilsson h...@axis.com
 Date: Fri, 8 Jun 2012 02:31:10 +0200
  From: Hans-Peter Nilsson h...@axis.com
  Date: Fri, 1 Jun 2012 01:38:22 +0200
 
  gcc:
  Fix configure test for stack protector support in target C library.
  * configure.ac (test_prefix, test_exec_prefix): Move setting from
  inside sysroot handling to before and outside it.
  * configure: Regenerate.
 
 Ping, http://gcc.gnu.org/ml/gcc-patches/2012-05/msg02137.html.

and a ping (this will look pretty after a few weeks).

brgds, H-P


[RFA:] Caveat for ARM in gcc-4.7/changes.html: unaligned accesses, take 2

2012-06-14 Thread Hans-Peter Nilsson
Y is 28 for introduction of the quoted code in
arch/arm/mm/alignment.c, AFAICT, so how about this one, ok now?

Index: changes.html
===
RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-4.7/changes.html,v
retrieving revision 1.113
diff -p -u -r1.113 changes.html
--- changes.html5 Jun 2012 11:03:53 -   1.113
+++ changes.html15 Jun 2012 02:04:46 -
@@ -43,6 +43,19 @@
 
 /li
 
+liOn ARM, when compiling for ARMv6 (but not ARMv6-M), ARMv7-A,
+ARMv7-R, or ARMv7-M, the new option
+code-munaligned-access/code is active by default, which for
+some source codes generates code that accesses memory on unaligned
+adresses.  This will require the kernel of those systems to enable
+such accesses (controlled by CP15 register codec1/code, refer
+to ARM documentation).  Alternatively or for compatibility with
+kernels where unaligned accesses are not supported, all code has
+to be compiled with code-mno-unaligned-access/code.
+Linux/ARM in official releases has automatically and
+unconditionally supported unaligned accesses as emitted by GCC due
+to this option being active since Linux version 2.6.28./li
+
 liSupport on ARM for the legacy floating-point accelerator (FPA) and
 the mixed-endian floating-point format that it used has been obsoleted.
 The ports that still use this format have been obsoleted as well.

brgds, H-P


Re: C++ PATCHes for core 1358, 1360, c++/50248 (constexpr, templates, default constructor)

2012-06-14 Thread H.J. Lu
On Mon, Sep 5, 2011 at 12:07 PM, H.J. Lu hjl.to...@gmail.com wrote:
 On Sun, Sep 4, 2011 at 9:29 PM, Jason Merrill ja...@redhat.com wrote:
 At the Bloomington C++ meeting we discussed some issues with the constexpr
 specification that the clang team encountered while trying to implement it.
  Among the issues was a problem that also came up recently for us as BZ
 50248: if the constexpr-ness of a template instantiation depends on its
 body, we need to instantiate it in order to decide whether or not an
 implicitly-declared function that uses it is constexpr.  The resolution of
 DR 1358 is that an instantiation of a constexpr template is constexpr even
 if it can never produce a constant expression.

 The second patch is related to DR 1360, where the clang team was complaining
 that deciding whether or not a class is literal requires the implicit
 declaration of the default constructor, which they would like to do lazily.
  We seem to have agreed that it can be avoided in the cases where doing such
 is useful, but while looking at this I noticed a bug in our handling of this
 stuff: the function synthesized_default_constructor_is_constexpr was only
 right for trivial constructors.  So now I've renamed it accordingly, and
 force the implicit declaration for the non-trivial case.

 Tested x86_64-pc-linux-gnu, applying to trunk.


 This caused:

 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50296


This also caused:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53202

-- 
H.J.


[PATCH][Cilkplus] Capturing Cilk Sync across templates

2012-06-14 Thread Iyer, Balaji V
Hello Everyone,
This patch is for the Cilkplus branch affecting the C++ compler. The 
compiler was dropping the Cilk_sync across templates. This patch will preserve 
this.

Thanking You,

Yours sincerely,

Balaji V. Iyer.


RE: [PATCH][Cilkplus] Capturing Cilk Sync across templates

2012-06-14 Thread Iyer, Balaji V
This time with the patch :-).

-Balaji V. Iyer.

From: Iyer, Balaji V
Sent: Thursday, June 14, 2012 11:40 PM
To: gcc-patches@gcc.gnu.org
Subject: [PATCH][Cilkplus] Capturing Cilk Sync across templates

Hello Everyone,
This patch is for the Cilkplus branch affecting the C++ compler. The 
compiler was dropping the Cilk_sync across templates. This patch will preserve 
this.

Thanking You,

Yours sincerely,

Balaji V. Iyer.
Index: gcc/cp/pt.c
===
--- gcc/cp/pt.c (revision 188641)
+++ gcc/cp/pt.c (working copy)
@@ -12866,6 +12866,10 @@
   do_using_directive (USING_STMT_NAMESPACE (t));
   break;
 
+case SYNC_STMT:
+  finish_sync_stmt (false);
+  break;
+
 case DECL_EXPR:
   {
tree decl, pattern_decl;
Index: gcc/cp/ChangeLog.cilk
===
--- gcc/cp/ChangeLog.cilk   (revision 188641)
+++ gcc/cp/ChangeLog.cilk   (working copy)
@@ -1,3 +1,7 @@
+2012-06-14  Balaji V. Iyer  balaji.v.i...@intel.com
+
+   * pt.c (tsubst_expr): Added a check for CILK_SYNC statement.
+
 2012-06-12  Balaji V. Iyer  balaji.v.i...@intel.com
 
* cilk.c (callable): Removed a check to add LOOKUP_COMPLAIN.


Re: Change the ordering of cdce pass

2012-06-14 Thread Xinliang David Li
It looks reasonable to move it after DCE which exposes more opportunities.

David

On Thu, Jun 14, 2012 at 6:38 PM, Easwaran Raman era...@google.com wrote:
 The conditional dead call elimination pass shrink wraps certain dead
 calls to math functions. It doesn't handle case like this:

 D.142420_139 = powD.549 (D.142421_138, D.142419_132);
  fooD.120935.barD.113815 = D.142420_139;
 # foo.bar is dead here.

 This code gets cleaned up by DCE and leaves only pow, which can then
 be shrink-wrapped by cdce. So it seems reasonable to do this
 reordering. Bootstraps on x86_64 on linux with no test regression. OK
 for trunk?

 - Easwaran

 --

 2012-06-14   Easwaran Raman  era...@google.com

        * gcc/passes.c (init_optimization_passes): Remove pass_call_cdce
        from its current position and insert after pass_dce.

 Index: gcc/passes.c
 ===
 --- gcc/passes.c        (revision 188535)
 +++ gcc/passes.c        (working copy)
 @@ -1374,7 +1374,6 @@ init_optimization_passes (void)
       NEXT_PASS (pass_complete_unrolli);
       NEXT_PASS (pass_ccp);
       NEXT_PASS (pass_forwprop);
 -      NEXT_PASS (pass_call_cdce);
       /* pass_build_alias is a dummy pass that ensures that we
         execute TODO_rebuild_alias at this point.  Re-building
         alias information also rewrites no longer addressed
 @@ -1387,6 +1386,7 @@ init_optimization_passes (void)
       NEXT_PASS (pass_merge_phi);
       NEXT_PASS (pass_vrp);
       NEXT_PASS (pass_dce);
 +      NEXT_PASS (pass_call_cdce);
       NEXT_PASS (pass_cselim);
       NEXT_PASS (pass_tree_ifcombine);
       NEXT_PASS (pass_phiopt);


Re: [PATCH 2/3] Add XLP-specific atomic instructions and tweaks.

2012-06-14 Thread Maxim Kuvyrkov
On 14/06/2012, at 7:01 AM, Richard Sandiford wrote:

 Maxim Kuvyrkov ma...@codesourcery.com writes:
 
...
 After a chat with Bernd Schmidt, this is not a bug.  I've already fixed the 
 patch per yours and Bernd's instructions.  Do you want to look through an 
 updated patch or should I just commit it after retesting?
 
 Yeah, please send the revised patch.

Updated patch attached.  Any further comments?

Thank you,

--
Maxim Kuvyrkov
CodeSourcery / Mentor Graphics



0002-Add-XLP-specific-atomic-instructions-and-tweaks.patch
Description: Binary data


Re: [PATCH] Add option for dumping to stderr (issue6190057)

2012-06-14 Thread Sharad Singhai
On Wed, Jun 13, 2012 at 4:48 AM, Richard Guenther
richard.guent...@gmail.com wrote:
 On Fri, Jun 8, 2012 at 7:16 AM, Sharad Singhai sing...@google.com wrote:
 Okay, I have updated the attached patch so that the output from
 -ftree-vectorizer-verbose is considered diagnostic information and is
 always
 sent to stderr. Other functionality remains unchanged. Here is some
 more context about this patch.

 This patch improves the dump infrastructure and public interfaces so
 that the existing private pass-specific dump stream is separated from
 the diagnostic dump stream (typically stderr).  The optimization
 passes can output information on the two streams independently.

 The newly defined interfaces are:

 Individual passes do not need to access the dump file directly. Thus Instead
 of doing

   if (dump_file  (flags  dump_flags))
      fprintf (dump_file, ...);

 they can do

     dump_printf (flags, ...);

 If the current pass has FLAGS enabled then the information gets
 printed into the dump file otherwise not.

 Similar to the dump_printf (), another function is defined, called

        diag_printf (dump_flags, ...)

 This prints information only onto the diagnostic stream, typically
 standard error. It is useful for separating pass-specific dump
 information from
 the diagnostic information.

 Currently, as a proof of concept, I have converted vectorizer passes
 to use the new dump format. For this, I have considered
 information printed in vect_dump file as diagnostic. Thus 'fprintf'
 calls are changed to 'diag_printf'. Some other information printed to
 dump_file is sent to the regular dump file via 'dump_printf ()'. It
 helps to separate the two streams because they might serve different
 purposes and might have different formatting requirements.

 For example, using the trunk compiler, the following invocation

 g++ -S v.cc -ftree-vectorize -fdump-tree-vect -ftree-vectorizer-verbose=2

 prints tree vectorizer dump into a file named 'v.cc.113t.vect'.
 However, the verbose diagnostic output is silently
 ignored. This is not desirable as the two types of dump should not interfere.

 After this patch, the vectorizer dump is available in 'v.cc.113t.vect'
 as before, but the verbose vectorizer diagnostic is additionally
 printed on stderr. Thus both types of dump information are output.

 An additional feature of this patch is that individual passes can
 print dump information into command-line named files instead of auto
 numbered filename. For example,

 I'd wish you'd leave out this part for a followup.


 g++ -S -O2 v.cc -ftree-vectorize -fdump-tree-vect=foo.vect
     -ftree-vectorizer-verbose=2
     -fdump-tree-pre=foo.pre

 This prints the tree vectorizer dump into 'foo.vect', PRE dump into
 'foo.pre', and the vectorizer verbose diagnostic dump onto stderr.

 Please take another look.

 --- tree-vect-loop-manip.c      (revision 188325)
 +++ tree-vect-loop-manip.c      (working copy)
 @@ -789,14 +789,11 @@ slpeel_make_loop_iterate_ntimes (struct loop *loop
   gsi_remove (loop_cond_gsi, true);

   loop_loc = find_loop_location (loop);
 -  if (dump_file  (dump_flags  TDF_DETAILS))
 -    {
 -      if (loop_loc != UNKNOWN_LOC)
 -        fprintf (dump_file, \nloop at %s:%d: ,
 +  if (loop_loc != UNKNOWN_LOC)
 +    dump_printf (TDF_DETAILS, \nloop at %s:%d: ,
                  LOC_FILE (loop_loc), LOC_LINE (loop_loc));
 -      print_gimple_stmt (dump_file, cond_stmt, 0, TDF_SLIM);
 -    }
 -
 +  if (dump_flags  TDF_DETAILS)
 +    dump_gimple_stmt (TDF_SLIM, cond_stmt, 0);
   loop-nb_iterations = niters;

 I'm confused by this.  Why is this not simply

  if (loop_loc != UNKNOWN_LOC)
    dump_printf (dump_flags, \nloop at %s:%d: ,
                       LOC_FILE (loop_loc), LOC_LINE (loop_loc));
  dump_gimple_stmt (dump_flags | TDF_SLIM, cond_stmt, 0);

 for example.  I notice that you maybe mis-understood the message 
 classification
 I asked you to add (maybe I confused you by mentioning to eventually re-use
 the TDF_* flags).  I think you basically provided this message classification
 by adding two classes by providing both dump_gimple_stmt and diag_gimple_stmt.
 But still in the above you keep a dump_flags test _and_ you pass in
 (altered) dump_flags to the dump/diag_gimple_stmt routines.  Let me quote 
 them:

 +void
 +dump_gimple_stmt (int flags, gimple gs, int spc)
 +{
 +  if (dump_file)
 +    print_gimple_stmt (dump_file, gs, spc, flags);
 +}

 +void
 +diag_gimple_stmt (int flags, gimple gs, int spc)
 +{
 +  if (alt_dump_file)
 +    print_gimple_stmt (alt_dump_file, gs, spc, flags);
 +}

 I'd say it should have been a single function:

 void
 dump_gimple_stmt (enum msg_classification, int additional_flags,
 gimple gs, int spc)
 {
  if (msg_classification  go-to-dumpfile
       dump_file)
    print_gimple_stmt (dump_file, gs, spc, dump_flags | additional_flags);
  if (msg_classification  go-to-alt-dump-file
       alt_dump_file  (alt_dump_flags  msg_classification))
    print_gimple_stmt