Re: Interaction between first stage build with g++ and $PATH

2012-08-16 Thread Gary Funck
On 08/16/12 08:44:09, Jakub Jelinek wrote:
> Having . in $PATH is a serious bug (especially from security POV).
> Just never do that.
>   Jakub

Jakub, thanks.  I'm aware of the potential risks and pitfalls.
I probably should use better practice ...

- Gary


Re: Merge C++ conversion into trunk (4/6 - hash table rewrite)

2012-08-16 Thread Richard Guenther
On Wed, 15 Aug 2012, Lawrence Crowl wrote:

> On 8/15/12, Richard Henderson  wrote:
> > On 2012-08-15 07:29, Richard Guenther wrote:
> >> +   typedef typename Element::Element_t Element_t;
> >
> > Can we use something less ugly than Element_t?
> > Such as
> >
> >   typedef typename Element::T T;
> >
> > ?  Given that this name is scoped anyway...
> 
> I do not much like _t names either.

The following is what I'm testing now, it also integrates the
hashtable support functions and typedef within the existing local
data types which is IMHO cleaner.  (it also shows we can do with
a janitorial cleanup replacing typedef struct foo_d {} foo; with
struct foo {}; and the likes)

Bootstrap and regtest ongoing on x86_64-unknown-linux-gnu, ok?

Thanks,
Richard.

2012-08-16  Richard Guenther  

* hash-table.h (class hash_table): Use a descriptor template
argument instead of decomposed element type and support
functions.
(struct pointer_hash): New generic typed pointer-hash.
(struct typed_free_remove, struct typed_noop_remove): Generic
hash_table support pieces.
* coverage.c (struct counts_entry): Add hash_table support
members.
* tree-ssa-ccp.c (gimple_htab): Use pointer_hash.
* tree-ssa-coalesce.c (struct ssa_name_var_hash): New generic
SSA name by SSA_NAME_VAR hash.
(coalesce_ssa_name): Use it.
* tree-ssa-pre.c (struct pre_expr_d): Add hash_table support.
(expression_to_id): Adjust.
(struct expr_pred_trans_d): Add hash_table support.
(phi_translate_table): Adjust.
(phi_trans_lookup): Likewise.
(phi_trans_add): Likewise.
(do_regular_insertion): Likewise.
* tree-ssa-tail-merge.c (struct same_succ_def): Add hash_table
support.
(same_succ_htab): Adjust.
(find_same_succ_bb): Likewise.
(find_same_succ): Likewise.
(update_worklist): Likewise.
* tree-ssa-threadupdate.c (struct redirection_data): Add hash_table
support.
(redirection_data): Adjust.

Index: gcc/hash-table.h
===
*** gcc/hash-table.h.orig   2012-08-16 10:33:59.0 +0200
--- gcc/hash-table.h2012-08-16 11:08:36.311277498 +0200
*** xcallocator ::data_free (Type *mem
*** 83,127 
  }
  
  
! /* A common function for hashing a CANDIDATE typed pointer.  */
  
  template 
! inline hashval_t
! typed_pointer_hash (const Element *candidate)
  {
!   /* This is a really poor hash function, but it is what the current code 
uses,
!  so I am reusing it to avoid an additional axis in testing.  */
!   return (hashval_t) ((intptr_t)candidate >> 3);
! }
! 
  
! /* A common function for comparing an EXISTING and CANDIDATE typed pointers
!for equality. */
  
  template 
! inline int
! typed_pointer_equal (const Element *existing, const Element * candidate)
  {
!   return existing == candidate;
! }
  
  
! /* A common function for doing nothing on removing a RETIRED slot.  */
  
  template 
! inline void
! typed_null_remove (Element *retired ATTRIBUTE_UNUSED)
  {
! }
  
  
! /* A common function for using free on removing a RETIRED slot.  */
  
  template 
! inline void
! typed_free_remove (Element *retired)
  {
!   free (retired);
  }
  
  
--- 83,134 
  }
  
  
! /* Remove method dispatching to free.  */
  
  template 
! struct typed_free_remove
  {
!   static inline void remove (Element *p) { free (p); }
! };
  
! /* No-op remove method.  */
  
  template 
! struct typed_noop_remove
  {
!   static inline void remove (Element *) {}
! };
  
  
! /* Pointer hash with a no-op remove method.  */
  
  template 
! struct pointer_hash : typed_noop_remove 
  {
!   typedef Element T;
  
+   static inline hashval_t
+   hash (const T *);
  
!   static inline int
!   equal (const T *existing, const T * candidate);
! };
  
  template 
! inline hashval_t
! pointer_hash::hash (const T *candidate)
  {
!   /* This is a really poor hash function, but it is what the current code 
uses,
!  so I am reusing it to avoid an additional axis in testing.  */
!   return (hashval_t) ((intptr_t)candidate >> 3);
! }
! 
! template 
! inline int
! pointer_hash::equal (const T *existing,
! const T *candidate)
! {
!   return existing == candidate;
  }
  
  
*** extern hashval_t hash_table_mod2 (hashva
*** 147,157 
  
  /* Internal implementation type.  */
  
! template 
  struct hash_table_control
  {
/* Table itself.  */
!   Element **entries;
  
/* Current size (in entries) of the hash table.  */
size_t size;
--- 154,164 
  
  /* Internal implementation type.  */
  
! template 
  struct hash_table_control
  {
/* Table itself.  */
!   T **entries;
  
/* Current size (in entries) of the hash table.  */
size_t size;
*** struct hash_table_control
*** 180,194 
  
 The table stores elements of type Elem

Re: [PATCH] Set current_function_decl in {push,pop}_cfun and push_struct_function

2012-08-16 Thread Richard Guenther
On Wed, Aug 15, 2012 at 5:21 PM, Martin Jambor  wrote:
> Hi,
>
> On Fri, Aug 10, 2012 at 04:57:41PM +0200, Eric Botcazou wrote:
>> > - ada/gcc-interface/utils.c:rest_of_subprog_body_compilation calls
>> >   dump_function which in turns calls dump_function_to_file which calls
>> >   push_cfun.  But Ada front end has its idea of the
>> >   current_function_decl and there is no cfun which is an inconsistency
>> >   which makes push_cfun assert fail.  I "solved" it by temporarily
>> >   setting current_function_decl to NULL_TREE.  It's just dumping and I
>> >   thought that dump_function should be considered middle-end and thus
>> >   middle-end invariants should apply.
>>
>> If you think that calling dump_function from rest_of_subprog_body_compilation
>> is a layering violation, I don't have a problem with replacing it with a more
>> "manual" scheme like the one in c-family/c-gimplify.c:c_genericize, provided
>> that this yields roughly the same output.
>
> Richi suggested on IRC that I remove the push/pop_cfun calls from
> dump_function_to_file.  The only problem seems to be
> dump_histograms_for_stmt (buried in a dump_bb call) which needs a
> function to get the value histograms.  Richi suggested to replace the
> per function hash with one global one.  I tried that and bumped into
> two problems: First, I did not really know when to deallocate the
> global hash and all the histograms.  More importantly, the current
> gimple verifier (verify_gimple_in_cfg) checks that there are no "dead
> histograms" in the hash corresponding to statements no longer in the
> function.  With one global hash, it would be very cumbersome to do
> this check (add cfun to each histogram?  only when checking is
> enabled?).  Hash tables are now in flux anyway so I postponed that
> work until the interface settles down.  Nevertheless, I guess I need a
> confirmation from maintainers that I can remove the checking if I
> continue this way.
>
> When I looked at what would need to be changed if I added a function
> parameter to dump_bb, the work list grew very large very quickly.  It
> is probably doable, but the change will be quite big, so if anyone
> thinks it is a bad idea, please email me to stop.
>
> If I manage to change the dumping in one of the two ways, the call
> will not be a layering problem any more as it probably should not be.
> At the moment, it probably is.  We'll see.

If dumping a statement needs the containing function then we need to
either pass that down, provide a way to get from statement to function,
or stop requiring the function.  Making the hash global is choice three
(deallocating the hash would be when compilation is finished, in which
case you can double-check that it is empty and preserve above checking).
Option one is ok as well, option two is probably either unreliable (going
from gimple_block to function from function scope - but maybe who cares
for dumping?) or expensive (add a pointer from basic_block to struct
function).  I'm fine with both option three (would even save a pointer in
struct function!) or one.

Other opinions?

Thanks,
Richard.

> Thanks,
>
> Martin


Re: [patch] PR54146 - rewrite rewrite_into_loop_closed_ssa

2012-08-16 Thread Richard Guenther
On Wed, Aug 15, 2012 at 6:26 PM, Steven Bosscher  wrote:
> Hello,
>
> This patch rewrites the rewriting part of
> rewrite_into_loop_closed_ssa. This function took ~300s on the
> simplified test case for PR54146, walking around the many thousands of
> loops in the >400,000 basic blocks in the CFG, in
> compute_global_livein.
>
> For rewriting into LC-SSA, we can do better than that if we use the
> knowledge that we're actually computing livein for an SSA name "DEF",
> therefore its uses must all be dominated by the basic block where DEF
> is assigned a value. But walking up the dominator tree doesn't work
> here because we want to traverse and mark the edges in the CFG where
> DEF is live, and we may not see those edges if we walk up the
> dominator tree from a USE to DEF. We do know, however, that when we
> walk up the CFG then:
>
> 1. if we enter any loop nested in the same loop as the basic block
> containing DEF (let's call it DEF_LOOP) then we can stop walking
> because the only way in is through one of the edges we're interested
> in.
>
> 2. if we enter a loop is not in the nesting stack of DEF_LOOP, then we
> can skin straight to the header of the loop and continue looking up
> from there.
>
> 3. if we reach a basic block X as a predecessor of Y and Y dominates X
> then we don't have to look at X or any of its predecessors.
>
> Putting this all together, you end up with what looks like a poor
> man's form of structural analysis where the control tree only contains
> loop nodes, non-loop basic blocks, and irreducible regions. (Honza:
> maybe re-surrect
> http://gcc.gnu.org/ml/gcc-patches/2003-06/msg01669.html? Now that we
> can maintain the loop tree, perhaps it's also feasible to maintain the
> complete control tree and use it in places where we want to analyze
> only a sub-CFG?)
>
> The effect is that the time spent in rewrite_into_loop_closed_ssa
> drops to less than one second.
>
> Bootstrapped&tested on powerpc64-unknown-linux-gnu. OK for trunk?

Ok!

It recently occured to me that the only reason we do not have virtual
operands in loop-closed-SSA form (and thus jump through hoops dealing
with them in cfgloopmainp and elsewhere) was that we'd have so many
of them.  Today we just have a single one, so maybe we can simplify
things here (the into-lc-SSA code just skips vops, not doing that should
provide lc-SSA form even for virtuals).

Many thanks for all these speed-ups!
Richard.


> Ciao!
> Steven


Commit: Fixes for building avr-elf with g++.

2012-08-16 Thread Nick Clifton
Hi Denis, Hi Anatoly, Hi Eric,

  I am applying the patch below as an obvious fix for building the
  avr-elf port of gcc with a C++ compiler.

  There were two problems:

* t-avr was using $(CC) instead of $(COMPILER) which meant the
  targets failed to build because they included C++ style headers
  (eg vec.h).

* avr.c was using integer values in places where a specific enum was
  required.

   The patch below fixes these problems and allows avr-elf-gcc to be
   built.

Cheers
  Nick

gcc/ChangeLog
2012-08-16  Nick Clifton  

* config/avr/t-avr: Replace occurrences of $(CC) with $(COMPILER).
* config/avr/avr.c (avr_legitimize_reload_address): Add casts
for reload_type enums.
(DEF_BUILTIN): Cast the icode to enum insn_code.

Index: gcc/config/avr/avr.c
===
--- gcc/config/avr/avr.c(revision 190438)
+++ gcc/config/avr/avr.c(working copy)
@@ -1741,7 +1741,7 @@
   
   push_reload (XEXP (mem, 0), NULL_RTX, &XEXP (mem, 0), NULL,
POINTER_REGS, Pmode, VOIDmode, 0, 0,
-   1, addr_type);
+   1, (enum reload_type) addr_type);
   
   if (avr_log.legitimize_reload_address)
 avr_edump (" RCLASS.2 = %R\n IN = %r\n OUT = %r\n",
@@ -1749,7 +1749,7 @@
   
   push_reload (mem, NULL_RTX, &XEXP (x, 0), NULL,
BASE_POINTER_REGS, GET_MODE (x), VOIDmode, 0, 0,
-   opnum, type);
+   opnum, (enum reload_type) type);
   
   if (avr_log.legitimize_reload_address)
 avr_edump (" RCLASS.2 = %R\n IN = %r\n OUT = %r\n",
@@ -1763,7 +1763,7 @@
 {
   push_reload (x, NULL_RTX, px, NULL,
POINTER_REGS, GET_MODE (x), VOIDmode, 0, 0,
-   opnum, type);
+   opnum, (enum reload_type) type);
   
   if (avr_log.legitimize_reload_address)
 avr_edump (" RCLASS.3 = %R\n IN = %r\n OUT = %r\n",
@@ -10338,7 +10338,7 @@
   {
 
 #define DEF_BUILTIN(NAME, N_ARGS, ID, TYPE, ICODE)  \
-{ ICODE, NAME, N_ARGS, NULL_TREE },
+{ (enum insn_code) ICODE, NAME, N_ARGS, NULL_TREE },
 #include "builtins.def"  
 #undef DEF_BUILTIN
   };
Index: gcc/config/avr/t-avr
===
--- gcc/config/avr/t-avr(revision 190438)
+++ gcc/config/avr/t-avr(working copy)
@@ -19,20 +19,20 @@
 
 driver-avr.o: $(srcdir)/config/avr/driver-avr.c \
   $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H)
-   $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
+   $(COMPILER) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
 
 avr-devices.o: $(srcdir)/config/avr/avr-devices.c \
   $(srcdir)/config/avr/avr-mcus.def \
   $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H)
-   $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
+   $(COMPILER) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
 
 avr-c.o: $(srcdir)/config/avr/avr-c.c \
   $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(C_COMMON_H)
-   $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
+   $(COMPILER) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
 
 avr-log.o: $(srcdir)/config/avr/avr-log.c \
   $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(INPUT_H) dumpfile.h
-   $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
+   $(COMPILER) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
 
 avr.o avr-c.o: $(srcdir)/config/avr/builtins.def
 
@@ -45,7 +45,7 @@
 
 gen-avr-mmcu-texi$(build_exeext): $(srcdir)/config/avr/gen-avr-mmcu-texi.c \
   $(TM_H) $(AVR_MCUS) $(srcdir)/config/avr/avr-devices.c
-   $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< -o $@
+   $(COMPILER) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< -o $@
 
 # Make sure that the -mmcu= documentation is in sync with the compiler.
 $(srcdir)/doc/avr-mmcu.texi: s-avr-mmcu-texi; @true


Commit: BFIN: Fix use of VEC_last macro in bfin.c

2012-08-16 Thread Nick Clifton
Hi Bernd, Hi Jie,

  I am applying the patch below as an obvious fix for this problem
  whilst compiling the BFIN port of GCC:
  
gcc/config/bfin/bfin.c: In function 'bool hwloop_optimize(hwloop_info)':
gcc/config/bfin/bfin.c:3481:41: error: request for member 'flags' in 
'VEC_last_1(loop->hwloop_info_d::incoming, ((const 
char*)"/work/sources/gcc/current/gcc/config/bfin/bfin.c"), 3481u, ((const 
char*)(& __FUNCTION__)))', which is of pointer type 'edge_def*' (maybe you 
meant to use '->' ?)
gcc/config/bfin/bfin.c:3750:41: error: request for member 'flags' in 
'VEC_last_1(loop->hwloop_info_d::incoming, ((const 
char*)"/work/sources/gcc/current/gcc/config/bfin/bfin.c"), 3750u, ((const 
char*)(& __FUNCTION__)))', which is of pointer type 'edge_def*' (maybe you 
meant to use '->' ?)

  With this patch applied the bfin port now compiles correctly.

  Cheers
Nick

gcc/ChangeLog
2012-08-16  Nick Clifton  

* config/bfin/bfin.c (hwloop_optimize): Fix use of VEC_last macro.

Index: gcc/config/bfin/bfin.c
===
--- gcc/config/bfin/bfin.c  (revision 190438)
+++ gcc/config/bfin/bfin.c  (working copy)
@@ -3478,7 +3478,7 @@
   /* If we have to insert the LSETUP before a jump, count that jump in the
 length.  */
   if (VEC_length (edge, loop->incoming) > 1
- || !(VEC_last (edge, loop->incoming).flags & EDGE_FALLTHRU))
+ || !(VEC_last (edge, loop->incoming)->flags & EDGE_FALLTHRU))
{
  gcc_assert (JUMP_P (insn));
  insn = PREV_INSN (insn);
@@ -3747,7 +3747,7 @@
 {
   rtx prev = BB_END (loop->incoming_src);
   if (VEC_length (edge, loop->incoming) > 1
- || !(VEC_last (edge, loop->incoming).flags & EDGE_FALLTHRU))
+ || !(VEC_last (edge, loop->incoming)->flags & EDGE_FALLTHRU))
{
  gcc_assert (JUMP_P (prev));
  prev = PREV_INSN (prev);


Re: [patch] speed up ifcvt:cond_move_convert_if_block

2012-08-16 Thread Richard Guenther
On Thu, Aug 16, 2012 at 1:11 AM, Steven Bosscher  wrote:
> On Mon, Aug 6, 2012 at 1:27 PM, Paolo Bonzini  wrote:
>>> 2. sparseset has the same problem of memory clearing (for valgrind,
>>> see sparseset_alloc).
>>
>> ... only the sparse array needs this clearing, but currently we do it
>> for both.
>
> And according to the fat comment before the xcalloc, it's not even
> really needed. Why can't we just tell valgrind to treat the memory as
> defined, like in this patchlet:

Indeed ... I suppose ok if it bootstraps / tests w/o valgrind checking and
if a cc1 builds with valgrind checking.

Thanks,
Richard.

> Index: sparseset.c
> ===
> --- sparseset.c (revision 190418)
> +++ sparseset.c (working copy)
> @@ -30,12 +30,14 @@ sparseset_alloc (SPARSESET_ELT_TYPE n_elms)
>unsigned int n_bytes = sizeof (struct sparseset_def)
>  + ((n_elms - 1) * 2 * sizeof (SPARSESET_ELT_TYPE));
>
> -  /* We use xcalloc rather than xmalloc to silence some valgrind 
> uninitialized
> +  sparseset set = XNEWVAR(sparseset, n_bytes);
> +
> +  /* Mark the sparseset as defined to silence some valgrind uninitialized
>   read errors when accessing set->sparse[n] when "n" is not, and never has
>   been, in the set.  These uninitialized reads are expected, by design and
> - harmless.  If this turns into a performance problem due to some future
> - additional users of sparseset, we can revisit this decision.  */
> -  sparseset set = (sparseset) xcalloc (1, n_bytes);
> + harmless.  */
> +  VALGRIND_DISCARD (VALGRIND_MAKE_MEM_DEFINED (set, n_bytes));
> +
>set->dense = &(set->elms[0]);
>set->sparse = &(set->elms[n_elms]);
>set->size = n_elms;
>
>
> I have never built GCC with valgrind checking, so I don't know if this
> is correct. But there has to be a better solution than calling
> xcalloc...
>
> Ciao!
> Steven


Re: PATCH: Replace target MEMBER_TYPE_FORCES_BLK macro with a target hook

2012-08-16 Thread Richard Guenther
On Thu, Aug 16, 2012 at 1:50 AM, H.J. Lu  wrote:
> Hi,
>
> This patch replaces MEMBER_TYPE_FORCES_BLK with a target hook.  I
> also pass the type to the target hook in addition to field, which will
> be used by i386 backend for
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20020
>
> This patch doesn't change code generation.  Tested on Linux/x86-64. I
> also tested cross compilers to ia64-hpux, powerpc-linux and xtensa-linux
> up to cc1.  OK to install?

Isn't the type just always DECL_FIELD_CONTEXT (field)?

Btw, with C++ you no longer need ATTRIBUTE_UNUSED, just give the
parameter no name.

Richard.

> Thanks.
>
>
> H.J.
> ---
> 2012-08-15  H.J. Lu  
>
> * stor-layout.c (compute_record_mode): Replace
> MEMBER_TYPE_FORCES_BLK with targetm.member_type_forces_blk.
> (layout_type): Likewise.
>
> * system.h: Poison MEMBER_TYPE_FORCES_BLK.
>
> * target.def (member_type_forces_blk): New target hook.
>
> * targhooks.c (default_member_type_forces_blk): New.
> * targhooks.h (default_member_type_forces_blk): Likewise.
>
> * doc/tm.texi.in (MEMBER_TYPE_FORCES_BLK): Renamed to ...
> (TARGET_MEMBER_TYPE_FORCES_BLK): This.
> * doc/tm.texi: Regenerated.
>
> * config/ia64/hpux.h (MEMBER_TYPE_FORCES_BLK): Removed.
>
> * config/ia64/ia64.c (ia64_member_type_forces_blk): New
> function.
> (TARGET_MEMBER_TYPE_FORCES_BLK): New macro.
>
> * config/rs6000/rs6000.c (TARGET_MEMBER_TYPE_FORCES_BLK): New
> macro.
> (rs6000_member_type_forces_blk): New function.
>
> * config/rs6000/rs6000.h (MEMBER_TYPE_FORCES_BLK): Removed.
>
> * config/xtensa/xtensa.c (xtensa_member_type_forces_blk): New
> function.
> (TARGET_MEMBER_TYPE_FORCES_BLK): New macro.
>
> * config/xtensa/xtensa.h (MEMBER_TYPE_FORCES_BLK): Removed.
>
> diff --git a/gcc/config/ia64/hpux.h b/gcc/config/ia64/hpux.h
> index ad106b4..d9ae109 100644
> --- a/gcc/config/ia64/hpux.h
> +++ b/gcc/config/ia64/hpux.h
> @@ -115,9 +115,6 @@ do {  
>   \
>  #define TARGET_DEFAULT \
>(MASK_DWARF2_ASM | MASK_BIG_ENDIAN | MASK_ILP32)
>
> -/* ??? Might not be needed anymore.  */
> -#define MEMBER_TYPE_FORCES_BLK(FIELD, MODE) ((MODE) == TFmode)
> -
>  /* ASM_OUTPUT_EXTERNAL_LIBCALL defaults to just a globalize_label call,
> but that doesn't put out the @function type information which causes
> shared library problems.  */
> diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c
> index c7fb559..f3585b1 100644
> --- a/gcc/config/ia64/ia64.c
> +++ b/gcc/config/ia64/ia64.c
> @@ -319,6 +319,8 @@ static const char *ia64_invalid_binary_op (int, 
> const_tree, const_tree);
>  static enum machine_mode ia64_c_mode_for_suffix (char);
>  static void ia64_trampoline_init (rtx, tree, rtx);
>  static void ia64_override_options_after_change (void);
> +static bool ia64_member_type_forces_blk (const_tree, const_tree,
> +enum machine_mode);
>
>  static tree ia64_builtin_decl (unsigned, bool);
>
> @@ -570,6 +572,9 @@ static const struct attribute_spec ia64_attribute_table[] 
> =
>  #undef TARGET_GET_RAW_ARG_MODE
>  #define TARGET_GET_RAW_ARG_MODE ia64_get_reg_raw_mode
>
> +#undef TARGET_MEMBER_TYPE_FORCES_BLK
> +#define TARGET_MEMBER_TYPE_FORCES_BLK ia64_member_type_forces_blk
> +
>  #undef TARGET_GIMPLIFY_VA_ARG_EXPR
>  #define TARGET_GIMPLIFY_VA_ARG_EXPR ia64_gimplify_va_arg
>
> @@ -11153,6 +11158,17 @@ ia64_get_reg_raw_mode (int regno)
>return default_get_reg_raw_mode(regno);
>  }
>
> +/* Implement TARGET_MEMBER_TYPE_FORCES_BLK.  ??? Might not be needed
> +   anymore.  */
> +
> +bool
> +ia64_member_type_forces_blk (const_tree type ATTRIBUTE_UNUSED,
> +const_tree field ATTRIBUTE_UNUSED,
> +enum machine_mode mode)
> +{
> +  return TARGET_HPUX && mode == TFmode;
> +}
> +
>  /* Always default to .text section until HP-UX linker is fixed.  */
>
>  ATTRIBUTE_UNUSED static section *
> diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
> index 34948fb..5b2d9f0 100644
> --- a/gcc/config/rs6000/rs6000.c
> +++ b/gcc/config/rs6000/rs6000.c
> @@ -1302,6 +1302,9 @@ static const struct attribute_spec 
> rs6000_attribute_table[] =
>  #undef TARGET_INIT_DWARF_REG_SIZES_EXTRA
>  #define TARGET_INIT_DWARF_REG_SIZES_EXTRA rs6000_init_dwarf_reg_sizes_extra
>
> +#undef TARGET_MEMBER_TYPE_FORCES_BLK
> +#define TARGET_MEMBER_TYPE_FORCES_BLK rs6000_member_type_forces_blk
> +
>  /* On rs6000, function arguments are promoted, as are function return
> values.  */
>  #undef TARGET_PROMOTE_FUNCTION_MODE
> @@ -7287,6 +7290,27 @@ rs6000_emit_move (rtx dest, rtx source, enum 
> machine_mode mode)
>   emit_set:
>emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
>  }
> +
> +/* Return true if TYPE containing FIELD should be accessed using
> +   `BLKMODE'.
> +
> +  

Commit: Fix i386 ASM_OUTPUT_ASCII macro for C++ compilation.

2012-08-16 Thread Nick Clifton
Hi Richard, Hi Jan, Hi Uros,

  I am applying the patch below as an obvious fix for this problem when
  building an i386-elf targeted toolchain:

gcc/dwarf2asm.c: In function 'void dw2_asm_output_nstring(const char*, 
size_t, const char*, ...)':
gcc/dwarf2asm.c:334:7: error: invalid conversion from 'const unsigned 
char*' to 'const char*' [-fpermissive]

  With the patch applied the compiler now builds correctly.

Cheers
  Nick

gcc/ChangeLog
2012-08-16  Nick Clifton  

* config/i386/i386elf.h (ASM_OUTPUT_ASCII): Cast _ascii_bytes
before passing it to ASM_OUTPUT_LIMITED_STRING.

Index: gcc/config/i386/i386elf.h
===
--- gcc/config/i386/i386elf.h   (revision 190438)
+++ gcc/config/i386/i386elf.h   (working copy)
@@ -73,7 +73,7 @@
  fputc ('\n', (FILE)); \
  bytes_in_chunk = 0;   \
}   \
- ASM_OUTPUT_LIMITED_STRING ((FILE), _ascii_bytes); \
+ ASM_OUTPUT_LIMITED_STRING ((FILE), (const char *) _ascii_bytes); \
  _ascii_bytes = p; \
}   \
  else  \


RE: [PATCH,i386] fma,fma4 and xop flags

2012-08-16 Thread Gopalasubramanian, Ganesh
> This won't work, since we have to prefer FMA3 also in case when only "-mfma 
> -mfma4" without -mtune=XX is used. 
> We can add TARGET_FMA_BOTH though, but I doubt there will ever be target that 
> implements both insn sets without preferences.

Preferring FMA3 over FMA4 might not do good always. For instance, with 
increased register pressure FMA3 can be used. 
But, when we have more registers at our disposal, fma4 if used might do good by 
avoiding extra reload.
IMO, when preference of FMA instructions is adjudged by register pressure,  we 
may need some functionality to support that.

So, ideally for bdver2, we like to have both fma and fma4 getting generated 
with options "-mfma -mfma4".

Regards
Ganesh

-Original Message-
From: Uros Bizjak [mailto:ubiz...@gmail.com] 
Sent: Tuesday, August 14, 2012 9:12 PM
To: Richard Henderson
Cc: Gopalasubramanian, Ganesh; gcc-patches@gcc.gnu.org
Subject: Re: [PATCH,i386] fma,fma4 and xop flags

On Mon, Aug 13, 2012 at 9:50 PM, Richard Henderson  wrote:
> On 08/13/2012 12:33 PM, Uros Bizjak wrote:
>> AFAIU fma3 is better than fma4 for bdver2 (the only CPU that 
>> implements both FMA sets). Current description of bdver2 doesn't even 
>> enable fma4 in processor_alias_table due to this fact.
>>
>> The change you are referring to adds preference for fma3 insn set for 
>> generic code (not FMA4 builtins!), even when fma4 is enabled. So, no 
>> matter which combination and sequence of -mfmfa -mfma4 or -mxop user 
>> passes to the compiler, only fma3 instructions will be generated.
>
> This rationale needs to appear as a comment above
>
>> +  (eq_attr "isa" "fma4")
>> +(symbol_ref "TARGET_FMA4 && !TARGET_FMA")

I plan to commit following patch:

--cut here--
Index: i386.md
===
--- i386.md (revision 190362)
+++ i386.md (working copy)
@@ -659,6 +659,9 @@
 (eq_attr "isa" "noavx2") (symbol_ref "!TARGET_AVX2")
 (eq_attr "isa" "bmi2") (symbol_ref "TARGET_BMI2")
 (eq_attr "isa" "fma") (symbol_ref "TARGET_FMA")
+;; Disable generation of FMA4 instructions for generic code
+;; since FMA3 is preferred for targets that implement both
+;; instruction sets.
 (eq_attr "isa" "fma4")
   (symbol_ref "TARGET_FMA4 && !TARGET_FMA")
]
--cut here--

> Longer term we may well require some sort of
>
>   (TARGET_FMA4 && !(TARGET_FMA && TARGET_PREFER_FMA3))
>
> with an appropriate entry in ix86_tune_features to match.

This won't work, since we have to prefer FMA3 also in case when only "-mfma 
-mfma4" without -mtune=XX is used. We can add TARGET_FMA_BOTH though, but I 
doubt there will ever be target that implements both insn sets without 
preferences.

Uros.




[bootstrap] Tentative fix for PR 54281

2012-08-16 Thread Diego Novillo
Richi, this implements your idea for fixing PR 54281.  I don't
have an old enough compiler.  Could you please test it in your
system?

I debated whether to remove the GENERATOR_FILE predicate from the
inclusion (some files include gmp.h unconditionally).  I think it
could be removed, but only a minority of files build with
GENERATOR_FILE set, so it didn't seem harmful.

OK if tests pass?


Diego.


2012-08-16  Diego Novillo  
Richard Guenther  

PR bootstrap/54281
* double-int.h: Move including of gmp.h ...
* system.h: ... here.
* realmpfr.h: Do not include gmp.h.
* tree-ssa-loop-niter.c: Do not include gmp.h.

fortran/ChangeLog
* gfortran.h: Do not include gmp.h.

diff --git a/gcc/double-int.h b/gcc/double-int.h
index 3d9aa2c..7ea0528 100644
--- a/gcc/double-int.h
+++ b/gcc/double-int.h
@@ -20,10 +20,6 @@ along with GCC; see the file COPYING3.  If not see
 #ifndef DOUBLE_INT_H
 #define DOUBLE_INT_H
 
-#ifndef GENERATOR_FILE
-#include 
-#endif
-
 /* A large integer is currently represented as a pair of HOST_WIDE_INTs.
It therefore represents a number with precision of
2 * HOST_BITS_PER_WIDE_INT bits (it is however possible that the
diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h
index 7c4c0a4..611d16d 100644
--- a/gcc/fortran/gfortran.h
+++ b/gcc/fortran/gfortran.h
@@ -1681,7 +1681,6 @@ gfc_intrinsic_sym;
EXPR_COMPCALL   Function (or subroutine) call of a procedure pointer
   component or type-bound procedure.  */
 
-#include 
 #include 
 #include 
 #define GFC_RND_MODE GMP_RNDN
diff --git a/gcc/realmpfr.h b/gcc/realmpfr.h
index ab234e9..ada876e 100644
--- a/gcc/realmpfr.h
+++ b/gcc/realmpfr.h
@@ -22,7 +22,10 @@
 #ifndef GCC_REALGMP_H
 #define GCC_REALGMP_H
 
-#include 
+/* Note that we do not include gmp.h.  It is included in system.h
+   because it wrecks intl.h when compiling in C++ mode.
+   See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54281 for details.  */
+
 #include 
 #include 
 #include "real.h"
diff --git a/gcc/system.h b/gcc/system.h
index 9e7d503..0ccd991 100644
--- a/gcc/system.h
+++ b/gcc/system.h
@@ -1037,4 +1037,8 @@ helper_const_non_const_cast (const char *p)
 #define DEBUG_VARIABLE
 #endif
 
+#ifndef GENERATOR_FILE
+#include 
+#endif
+
 #endif /* ! GCC_SYSTEM_H */
diff --git a/gcc/tree-ssa-loop-niter.c b/gcc/tree-ssa-loop-niter.c
index c719a74..4c67c26 100644
--- a/gcc/tree-ssa-loop-niter.c
+++ b/gcc/tree-ssa-loop-niter.c
@@ -38,7 +38,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "flags.h"
 #include "diagnostic-core.h"
 #include "tree-inline.h"
-#include "gmp.h"
 
 #define SWAP(X, Y) do { affine_iv *tmp = (X); (X) = (Y); (Y) = tmp; } while (0)
 


Re: Commit: BFIN: Fix use of VEC_last macro in bfin.c

2012-08-16 Thread Diego Novillo

On 12-08-16 05:49 , Nick Clifton wrote:


gcc/ChangeLog
2012-08-16  Nick Clifton  

* config/bfin/bfin.c (hwloop_optimize): Fix use of VEC_last macro.


Thanks Nick.  I made the wrong fix here, sorry about that.  I will be 
making more changes to VEC_ shortly.  What's a good way for me to test them?



Diego.


Re: [PATCH,i386] fma,fma4 and xop flags

2012-08-16 Thread Uros Bizjak
On Thu, Aug 16, 2012 at 1:43 PM, Gopalasubramanian, Ganesh
 wrote:
>> This won't work, since we have to prefer FMA3 also in case when only "-mfma 
>> -mfma4" without -mtune=XX is used.
>> We can add TARGET_FMA_BOTH though, but I doubt there will ever be target 
>> that implements both insn sets without preferences.
>
> Preferring FMA3 over FMA4 might not do good always. For instance, with 
> increased register pressure FMA3 can be used.
> But, when we have more registers at our disposal, fma4 if used might do good 
> by avoiding extra reload.
> IMO, when preference of FMA instructions is adjudged by register pressure,  
> we may need some functionality to support that.
>
> So, ideally for bdver2, we like to have both fma and fma4 getting generated 
> with options "-mfma -mfma4".

Yes, now it can also work that way. Current insn generation can be
trivially changed now, just change "fma4" condition for "enabled"
attribute in i386.md.

I will wait for your recommendation.

Uros.


Re: [PATCH] Set current_function_decl in {push,pop}_cfun and push_struct_function

2012-08-16 Thread Michael Matz
Hi,

On Thu, 16 Aug 2012, Richard Guenther wrote:

> If dumping a statement needs the containing function then we need to 
> either pass that down, provide a way to get from statement to function, 
> or stop requiring the function.  Making the hash global is choice three 
> (deallocating the hash would be when compilation is finished, in which 
> case you can double-check that it is empty and preserve above checking). 
> Option one is ok as well, option two is probably either unreliable 
> (going from gimple_block to function from function scope - but maybe who 
> cares for dumping?) or expensive (add a pointer from basic_block to 
> struct function).  I'm fine with both option three (would even save a 
> pointer in struct function!) or one.
> 
> Other opinions?

Actually I must say, that none of the above three options appeal to me 
very much, and that the current solution (passing cfun via a global 
variable) is better than any of these:

1) passing it down in arguments: uglifies interface for a very special 
   situation.
3) making the hash global is a layering violation in its own, and for 
   instance would complicate a scheme where the memory for instructions 
   (and their histograms) comes from per-function pools.
2) that's actually the most appealing one from a user interface, i.e. if 
   there's a generic way of mapping gimple -> FUNCTION_DECL.  Certainly 
   not at the cost of an additional pointer in each bb, but there are 
   other schemes that we could use, for instance:
   Every function has an ENTRY and EXIT block.  That one for certain is 
   reachable via going bb->prev_bb until you hit the end.  The entry block 
   doesn't contain much interesting things, so we for instance can reuse, 
   I don't know, the loop_father pointer to actually point to the 
   function_decl containing it.

   Looking up the function from a bb would hence be a fairly expensive 
   operation (walking the block chain), so it requires some care to use 
   it, but I think that's okay.


Ciao,
Michael.


Re: [patch] PR54146 - rewrite rewrite_into_loop_closed_ssa

2012-08-16 Thread Michael Matz
Hi,

On Wed, 15 Aug 2012, Steven Bosscher wrote:

Please convince me that this :

+/* Return the outermost superloop LOOP of USE_LOOP that is a superloop of
+   both DEF_LOOP and USE_LOOP.  */
+static inline struct loop *
+find_sibling_superloop (struct loop *use_loop, struct loop *def_loop)
+{
+  unsigned ud = loop_depth (use_loop);
+  unsigned dd = loop_depth (def_loop);
+  gcc_assert (ud > 0 && dd > 0);
+  if (ud > dd)
+use_loop = superloop_at_depth (use_loop, dd);
+  if (ud < dd)
+def_loop = superloop_at_depth (def_loop, ud);
+  while (loop_outer (use_loop) != loop_outer (def_loop))
+{
+  use_loop = loop_outer (use_loop);
+  def_loop = loop_outer (def_loop);
+  gcc_assert (use_loop && def_loop);
+}
+  return use_loop;

doesn't have the usual problem of advancing two iterators at the same time 
and expecting they'll eventually meet (which they generally don't have 
to).

Also the block comment indicates that could should just as well return the 
outermost loop of the function, because it's the "outermost superloop LOOP 
of USE_LOOP that is a superloop of both DEF_LOOP and USE_LOOP."

The implementation seems to want to return the _innermost_ superloop that 
still covers both DEF_LOOP and USE_LOOP, and in that case my concern about 
them never meeting stands.


Ciao,
Michael.


Re: [bootstrap] Tentative fix for PR 54281

2012-08-16 Thread Richard Guenther
On Thu, 16 Aug 2012, Diego Novillo wrote:

> Richi, this implements your idea for fixing PR 54281.  I don't
> have an old enough compiler.  Could you please test it in your
> system?
> 
> I debated whether to remove the GENERATOR_FILE predicate from the
> inclusion (some files include gmp.h unconditionally).  I think it
> could be removed, but only a minority of files build with
> GENERATOR_FILE set, so it didn't seem harmful.
> 
> OK if tests pass?

It fixes it.

Thus, ok from my side (if your testing succeeds).

Thanks,
Richard.

> 
> Diego.
> 
> 
> 2012-08-16  Diego Novillo  
> Richard Guenther  
> 
>   PR bootstrap/54281
>   * double-int.h: Move including of gmp.h ...
>   * system.h: ... here.
>   * realmpfr.h: Do not include gmp.h.
>   * tree-ssa-loop-niter.c: Do not include gmp.h.
> 
> fortran/ChangeLog
>   * gfortran.h: Do not include gmp.h.
> 
> diff --git a/gcc/double-int.h b/gcc/double-int.h
> index 3d9aa2c..7ea0528 100644
> --- a/gcc/double-int.h
> +++ b/gcc/double-int.h
> @@ -20,10 +20,6 @@ along with GCC; see the file COPYING3.  If not see
>  #ifndef DOUBLE_INT_H
>  #define DOUBLE_INT_H
>  
> -#ifndef GENERATOR_FILE
> -#include 
> -#endif
> -
>  /* A large integer is currently represented as a pair of HOST_WIDE_INTs.
> It therefore represents a number with precision of
> 2 * HOST_BITS_PER_WIDE_INT bits (it is however possible that the
> diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h
> index 7c4c0a4..611d16d 100644
> --- a/gcc/fortran/gfortran.h
> +++ b/gcc/fortran/gfortran.h
> @@ -1681,7 +1681,6 @@ gfc_intrinsic_sym;
> EXPR_COMPCALL   Function (or subroutine) call of a procedure pointer
>  component or type-bound procedure.  */
>  
> -#include 
>  #include 
>  #include 
>  #define GFC_RND_MODE GMP_RNDN
> diff --git a/gcc/realmpfr.h b/gcc/realmpfr.h
> index ab234e9..ada876e 100644
> --- a/gcc/realmpfr.h
> +++ b/gcc/realmpfr.h
> @@ -22,7 +22,10 @@
>  #ifndef GCC_REALGMP_H
>  #define GCC_REALGMP_H
>  
> -#include 
> +/* Note that we do not include gmp.h.  It is included in system.h
> +   because it wrecks intl.h when compiling in C++ mode.
> +   See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54281 for details.  */
> +
>  #include 
>  #include 
>  #include "real.h"
> diff --git a/gcc/system.h b/gcc/system.h
> index 9e7d503..0ccd991 100644
> --- a/gcc/system.h
> +++ b/gcc/system.h
> @@ -1037,4 +1037,8 @@ helper_const_non_const_cast (const char *p)
>  #define DEBUG_VARIABLE
>  #endif
>  
> +#ifndef GENERATOR_FILE
> +#include 
> +#endif
> +
>  #endif /* ! GCC_SYSTEM_H */
> diff --git a/gcc/tree-ssa-loop-niter.c b/gcc/tree-ssa-loop-niter.c
> index c719a74..4c67c26 100644
> --- a/gcc/tree-ssa-loop-niter.c
> +++ b/gcc/tree-ssa-loop-niter.c
> @@ -38,7 +38,6 @@ along with GCC; see the file COPYING3.  If not see
>  #include "flags.h"
>  #include "diagnostic-core.h"
>  #include "tree-inline.h"
> -#include "gmp.h"
>  
>  #define SWAP(X, Y) do { affine_iv *tmp = (X); (X) = (Y); (Y) = tmp; } while 
> (0)
>  
> 
> 

-- 
Richard Guenther 
SUSE / SUSE Labs
SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746
GF: Jeff Hawn, Jennifer Guild, Felix Imend


[PATCH] Fix memleaks obvious from PR54146

2012-08-16 Thread Richard Guenther

This fixes some memleaks which look obvious when looking at
-fmem-report of PR54146.  Most important the tree-ssa-loop-im.c leak.

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

Richard.

2012-08-16  Richard Guenther  

PR middle-end/54146
* tree-ssa-loop-niter.c (find_loop_niter_by_eval): Free the
exit vector.
* ipa-pure-const.c (analyze_function): Use FOR_EACH_LOOP_BREAK.
* cfgloop.h (FOR_EACH_LOOP_BREAK): Fix.
* tree-ssa-structalias.c (handle_lhs_call): Properly free rhsc.
* tree-into-ssa.c (get_ssa_name_ann): Allocate info only when
needed.
* tree-ssa-loop-im.c (analyze_memory_references): Adjust.
(tree_ssa_lim_finalize): Free all mem_refs.
* tree-ssa-sccvn.c (extract_and_process_scc_for_name): Free
scc when bailing out.
* modulo-sched.c (sms_schedule): Use FOR_EACH_LOOP_BREAK.
* ira-build.c (loop_with_complex_edge_p): Free loop exit vector.
* graphite-sese-to-poly.c (scop_ivs_can_be_represented): Use
FOR_EACH_LOOP_BREAK.

Index: gcc/tree-ssa-loop-niter.c
===
--- gcc/tree-ssa-loop-niter.c   (revision 190442)
+++ gcc/tree-ssa-loop-niter.c   (working copy)
@@ -2287,7 +2287,10 @@ find_loop_niter_by_eval (struct loop *lo
   /* Loops with multiple exits are expensive to handle and less important.  */
   if (!flag_expensive_optimizations
   && VEC_length (edge, exits) > 1)
-return chrec_dont_know;
+{
+  VEC_free (edge, heap, exits);
+  return chrec_dont_know;
+}
 
   FOR_EACH_VEC_ELT (edge, exits, i, ex)
 {
Index: gcc/ipa-pure-const.c
===
--- gcc/ipa-pure-const.c(revision 190442)
+++ gcc/ipa-pure-const.c(working copy)
@@ -802,7 +802,7 @@ end:
if (dump_file)
  fprintf (dump_file, "can not prove finiteness of loop 
%i\n", loop->num);
l->looping =true;
-   break;
+   FOR_EACH_LOOP_BREAK (li);
  }
  scev_finalize ();
}
Index: gcc/cfgloop.h
===
--- gcc/cfgloop.h   (revision 190442)
+++ gcc/cfgloop.h   (working copy)
@@ -649,7 +649,7 @@ fel_init (loop_iterator *li, loop_p *loo
 
 #define FOR_EACH_LOOP_BREAK(LI) \
   { \
-VEC_free (int, heap, (LI)->to_visit); \
+VEC_free (int, heap, (LI).to_visit); \
 break; \
   }
 
Index: gcc/tree-ssa-structalias.c
===
--- gcc/tree-ssa-structalias.c  (revision 190442)
+++ gcc/tree-ssa-structalias.c  (working copy)
@@ -3868,9 +3868,11 @@ handle_lhs_call (gimple stmt, tree lhs,
   tmpc.offset = 0;
   tmpc.type = ADDRESSOF;
   VEC_safe_push (ce_s, heap, rhsc, &tmpc);
+  process_all_all_constraints (lhsc, rhsc);
+  VEC_free (ce_s, heap, rhsc);
 }
-
-  process_all_all_constraints (lhsc, rhsc);
+  else
+process_all_all_constraints (lhsc, rhsc);
 
   VEC_free (ce_s, heap, lhsc);
 }
Index: gcc/tree-into-ssa.c
===
--- gcc/tree-into-ssa.c (revision 190442)
+++ gcc/tree-into-ssa.c (working copy)
@@ -312,22 +312,21 @@ get_ssa_name_ann (tree name)
   unsigned len = VEC_length (ssa_name_info_p, info_for_ssa_name);
   struct ssa_name_info *info;
 
+  /* Re-allocate the vector at most once per update/into-SSA.  */
   if (ver >= len)
-{
-  unsigned old_len = VEC_length (ssa_name_info_p, info_for_ssa_name);
-  unsigned new_len = num_ssa_names;
+VEC_safe_grow_cleared (ssa_name_info_p, heap,
+  info_for_ssa_name, num_ssa_names);
 
-  VEC_reserve (ssa_name_info_p, heap, info_for_ssa_name,
-  new_len - old_len);
-  while (len++ < new_len)
-   {
- struct ssa_name_info *info = XCNEW (struct ssa_name_info);
- info->age = current_info_for_ssa_name_age;
- VEC_quick_push (ssa_name_info_p, info_for_ssa_name, info);
-   }
+  /* But allocate infos lazily.  */
+  info = VEC_index (ssa_name_info_p, info_for_ssa_name, ver);
+  if (!info)
+{
+  info = XCNEW (struct ssa_name_info);
+  info->age = current_info_for_ssa_name_age;
+  info->info.need_phi_state = NEED_PHI_STATE_UNKNOWN;
+  VEC_replace (ssa_name_info_p, info_for_ssa_name, ver, info);
 }
 
-  info = VEC_index (ssa_name_info_p, info_for_ssa_name, ver);
   if (info->age < current_info_for_ssa_name_age)
 {
   info->age = current_info_for_ssa_name_age;
Index: gcc/tree-ssa-loop-im.c
===
--- gcc/tree-ssa-loop-im.c  (revision 190442)
+++ gcc/tree-ssa-loop-im.c  (working copy)
@@ -1486,9 +1486,8 @@ free_mem_ref_locs (mem_ref_locs_p accs)
 /* A function to free the mem_ref object OBJ.  */
 
 

Re: [PATCH] Set current_function_decl in {push,pop}_cfun and push_struct_function

2012-08-16 Thread Diego Novillo
On Thu, Aug 16, 2012 at 8:40 AM, Michael Matz  wrote:
> Hi,
>
> On Thu, 16 Aug 2012, Richard Guenther wrote:
>
>> If dumping a statement needs the containing function then we need to
>> either pass that down, provide a way to get from statement to function,
>> or stop requiring the function.  Making the hash global is choice three
>> (deallocating the hash would be when compilation is finished, in which
>> case you can double-check that it is empty and preserve above checking).
>> Option one is ok as well, option two is probably either unreliable
>> (going from gimple_block to function from function scope - but maybe who
>> cares for dumping?) or expensive (add a pointer from basic_block to
>> struct function).  I'm fine with both option three (would even save a
>> pointer in struct function!) or one.
>>
>> Other opinions?
>
> Actually I must say, that none of the above three options appeal to me
> very much, and that the current solution (passing cfun via a global
> variable) is better than any of these:
>
> 1) passing it down in arguments: uglifies interface for a very special
>situation.
> 3) making the hash global is a layering violation in its own, and for
>instance would complicate a scheme where the memory for instructions
>(and their histograms) comes from per-function pools.
> 2) that's actually the most appealing one from a user interface, i.e. if
>there's a generic way of mapping gimple -> FUNCTION_DECL.  Certainly
>not at the cost of an additional pointer in each bb, but there are
>other schemes that we could use, for instance:
>Every function has an ENTRY and EXIT block.  That one for certain is
>reachable via going bb->prev_bb until you hit the end.  The entry block
>doesn't contain much interesting things, so we for instance can reuse,
>I don't know, the loop_father pointer to actually point to the
>function_decl containing it.
>
>Looking up the function from a bb would hence be a fairly expensive
>operation (walking the block chain), so it requires some care to use
>it, but I think that's okay.

I like this approach, particularly since it would be used in contexts
where there is no simpler scheme.  I'm not crazy about overloading
unused fields, but it's fine if we wrap it around a special accessor.
I suppose we could also make ENTRY/EXIT be a base class for
basic_block and use a real field (but that can wait).

There are other pieces of data that are "global" but
context-dependent.  I wonder if it wouldn't make sense to encapsulate
them in some class that is controlled by the pass manager and gets
updated as it moves from function to function (it would contain things
like cfun, current_function_decl, etc).

Diego.


Re: [bootstrap] Tentative fix for PR 54281

2012-08-16 Thread Diego Novillo

On 12-08-16 09:08 , Richard Guenther wrote:


It fixes it.

Thus, ok from my side (if your testing succeeds).


Worked here too.  Committed to trunk.


Diego.


[4.6] Add /lib to Solaris default library search path

2012-08-16 Thread Rainer Orth
On recent Solaris 11 Update 1 builds, the 4.6 branch failed to bootstrap
in libjava: the configure test for connect failed since libsocket.so
indirectly depends on libcryptoutil.so which only lives in /lib, not
/usr/lib:

configure:20311: checking for connect in -lsocket
configure:20339: /var/gcc/regression/gcc-4.6-branch/11-gcc/build/./gcc/xgcc 
-B/var/gcc/regression/gcc-4.6-branch/11-gcc/build/./gcc/ 
-B/vol/gcc/i386-pc-solaris2.11/bin/ -B/vol/gcc/i386-pc-solaris2.11/lib/ 
-isystem /vol/gcc/i386-pc-solaris2.11/include -isystem 
/vol/gcc/i386-pc-solaris2.11/sys-include-o conftest -g -O2   conftest.c 
-lsocket   >&5
ld: warning: file libcryptoutil.so.1: required by /usr/lib/libmd.so.1, not found
Undefined   first referenced
 symbol in file
get_fips_mode   /usr/lib/libmd.so.1
ld: fatal: symbol referencing errors. No output written to conftest

The Solaris 2 gcc configuration overrides the Sun linker default (which
includes /lib, of course) with -Y P, so we need to explicitly add it
ourselves.  The following patch does exactly that.

Bootstrapped without regressions on i386-pc-solaris2.1[01] and
sparc-sun-solaris2.1[01], installed on 4.6 branch.

The 4.7 branch and mainline are not affected since /lib has been added
there during the complete rework of the Solaris configurations.

Rainer


2012-08-06  Rainer Orth  

* config/sol2.h (LINK_ARCH32_SPEC_BASE): Add /lib to default
linker search path.
* config/sparc/sol2-bi.h (LINK_ARCH64_SPEC_BASE): Likewise for
/lib/sparcv9.

# HG changeset patch
# Parent 7415e4cf7479d1f8e0a66d3db9bd03d3b17964cf
Add /lib to Solaris default library search path

diff --git a/gcc/config/sol2.h b/gcc/config/sol2.h
--- a/gcc/config/sol2.h
+++ b/gcc/config/sol2.h
@@ -1,6 +1,6 @@
 /* Operating system specific defines to be used when targeting GCC for any
Solaris 2 system.
-   Copyright 2002, 2003, 2004, 2007, 2008, 2009, 2010, 2011
+   Copyright 2002, 2003, 2004, 2007, 2008, 2009, 2010, 2011, 2012
Free Software Foundation, Inc.
 
 This file is part of GCC.
@@ -163,12 +163,12 @@ along with GCC; see the file COPYING3.  
%{YP,*} \
%{R*} \
%{compat-bsd: \
- %{!YP,*:%{p|pg:-Y P,%R/usr/ucblib:%R/usr/ccs/lib/libp:%R/usr/lib/libp:%R/usr/ccs/lib:%R/usr/lib} \
- %{!p:%{!pg:-Y P,%R/usr/ucblib:%R/usr/ccs/lib:%R/usr/lib}}} \
+ %{!YP,*:%{p|pg:-Y P,%R/usr/ucblib:%R/usr/ccs/lib/libp:%R/usr/lib/libp:%R/usr/ccs/lib:%R/usr/lib:%R/lib} \
+ %{!p:%{!pg:-Y P,%R/usr/ucblib:%R/usr/ccs/lib:%R/usr/lib:%R/lib}}} \
  -R %R/usr/ucblib} \
%{!compat-bsd: \
- %{!YP,*:%{p|pg:-Y P,%R/usr/ccs/lib/libp:%R/usr/lib/libp:%R/usr/ccs/lib:%R/usr/lib} \
- %{!p:%{!pg:-Y P,%R/usr/ccs/lib:%R/usr/lib"
+ %{!YP,*:%{p|pg:-Y P,%R/usr/ccs/lib/libp:%R/usr/lib/libp:%R/usr/ccs/lib:%R/usr/lib:%R/lib} \
+ %{!p:%{!pg:-Y P,%R/usr/ccs/lib:%R/usr/lib:%R/lib"
 
 #undef LINK_ARCH32_SPEC
 #define LINK_ARCH32_SPEC LINK_ARCH32_SPEC_BASE
diff --git a/gcc/config/sparc/sol2-bi.h b/gcc/config/sparc/sol2-bi.h
--- a/gcc/config/sparc/sol2-bi.h
+++ b/gcc/config/sparc/sol2-bi.h
@@ -1,6 +1,6 @@
 /* Definitions of target machine for GCC, for bi-arch SPARC
running Solaris 2 using the system assembler and linker.
-   Copyright (C) 2002, 2003, 2004, 2006, 2007, 2009, 2010, 2011
+   Copyright (C) 2002, 2003, 2004, 2006, 2007, 2009, 2010, 2011, 2012
Free Software Foundation, Inc.
 
 This file is part of GCC.
@@ -191,12 +191,12 @@ see the files COPYING3 and COPYING.RUNTI
%{YP,*} \
%{R*} \
%{compat-bsd: \
- %{!YP,*:%{p|pg:-Y P,%R/usr/ucblib/sparcv9:%R/usr/lib/libp/sparcv9:%R/usr/lib/sparcv9} \
-   %{!p:%{!pg:-Y P,%R/usr/ucblib/sparcv9:%R/usr/lib/sparcv9}}} \
+ %{!YP,*:%{p|pg:-Y P,%R/usr/ucblib/sparcv9:%R/usr/lib/libp/sparcv9:%R/usr/lib/sparcv9:%R/lib/sparcv9} \
+   %{!p:%{!pg:-Y P,%R/usr/ucblib/sparcv9:%R/usr/lib/sparcv9:%R/lib/sparcv9}}} \
  -R %R/usr/ucblib/sparcv9} \
%{!compat-bsd: \
- %{!YP,*:%{p|pg:-Y P,%R/usr/lib/libp/sparcv9:%R/usr/lib/sparcv9} \
-   %{!p:%{!pg:-Y P,%R/usr/lib/sparcv9"
+ %{!YP,*:%{p|pg:-Y P,%R/usr/lib/libp/sparcv9:%R/usr/lib/sparcv9:%R/lib/sparcv9} \
+   %{!p:%{!pg:-Y P,%R/usr/lib/sparcv9:%R/lib/sparcv9"
 
 #define LINK_ARCH64_SPEC LINK_ARCH64_SPEC_BASE
 

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


Re: [PATCH 6/7] rs6000: Remove -mabi=ieeelongdouble.

2012-08-16 Thread David Edelsohn
On Wed, Aug 15, 2012 at 6:29 PM, Segher Boessenkool
 wrote:
> There are some problems with it:
> - On at least 4.6 and later, it crashes the compiler together with -m64;
> - On older versions, it generates incorrect code together with -m64;
> - Supposedly it doesn't actually work on 32-bit either, on the glibc side;
> - It isn't listed in --target-help, because the option file says
>   "undocumented", but the manual does in fact list it;
> - The Darwin header claims it is for POWER.
>
> In the spirit of the rest of this patch series, I solve these problems
> by ripping it all out.

Segher,

As we discussed on IRC, this should work but is broken.  It should not
be ripped out.

Would you please open a Bugzilla PR and include me, Meissner and Peter
Bergner on the CC list?

Thanks, David


[PATCH] Decrease integer-share-limit

2012-08-16 Thread Richard Guenther

This decreases the integer-share-limit to make sure the TREE_VEC we
allocate for the small cached integers has a reasonable size for
our GC memory allocator.  With the current value (256) and a reduced 
testcase from PR54146 we see

tree.c:1224 (build_int_cst_wide) 40: 0.0%  
0: 0.0%   35443680: 8.7%   11635920:39.0%   9305

thus 39% overhead (oops, that TREE_VEC has size 2080).  Reducing
this to 251 yields

tree.c:1224 (build_int_cst_wide) 40: 0.0%  
0: 0.0%   11698864: 3.0%  33696: 0.2%   9154

which is much nicer (size 2048 for signed ints, 1020 bytes on
32bit hosts if I counted correctly).

I'm queueing this for a bootstrap & regtest run.

Richard.

2012-08-16  Richard Guenther  

* params.def (integer-share-limit): Decrease from 256 to 251,
add rationale.

Index: gcc/params.def
===
*** gcc/params.def  (revision 190442)
--- gcc/params.def  (working copy)
*** DEFPARAM(PARAM_MAX_LAST_VALUE_RTL,
*** 638,648 
  
  /* INTEGER_CST nodes are shared for values [{-1,0} .. N) for
 {signed,unsigned} integral types.  This determines N.
!Experimentation shows 256 to be a good value.  */
  DEFPARAM (PARAM_INTEGER_SHARE_LIMIT,
  "integer-share-limit",
  "The upper bound for sharing integer constants",
! 256, 2, 2)
  
  DEFPARAM (PARAM_SSP_BUFFER_SIZE,
  "ssp-buffer-size",
--- 638,649 
  
  /* INTEGER_CST nodes are shared for values [{-1,0} .. N) for
 {signed,unsigned} integral types.  This determines N.
!Experimentation shows 251 to be a good value that generates the
!least amount of garbage for allocating the TREE_VEC storage.  */
  DEFPARAM (PARAM_INTEGER_SHARE_LIMIT,
  "integer-share-limit",
  "The upper bound for sharing integer constants",
! 251, 2, 2)
  
  DEFPARAM (PARAM_SSP_BUFFER_SIZE,
  "ssp-buffer-size",


Re: [bootstrap] Tentative fix for PR 54281

2012-08-16 Thread Diego Novillo

On 12-08-16 09:08 , Richard Guenther wrote:

On Thu, 16 Aug 2012, Diego Novillo wrote:


Richi, this implements your idea for fixing PR 54281.  I don't
have an old enough compiler.  Could you please test it in your
system?

I debated whether to remove the GENERATOR_FILE predicate from the
inclusion (some files include gmp.h unconditionally).  I think it
could be removed, but only a minority of files build with
GENERATOR_FILE set, so it didn't seem harmful.

OK if tests pass?


It fixes it.

Thus, ok from my side (if your testing succeeds).


So, I had failed to include Ada in my testing and my patch breaks it. 
In several ada/*.c files, we forcefully include system.h as a C header:


#ifdef __cplusplus
extern "C" {
#endif
...
#include "system.h"
...
#ifdef __cplusplus
}
#endif


Eric, is this really needed now?  We are including gmp.h from system.h 
due to PR 54281.  This is causing Ada builds to fail.


Would it be OK to remove all the '#ifdef __cplusplus' conditionals from 
ada/*.c or is there something I'm missing?



Thanks.  Diego.



Re: [patch] PR54146 - rewrite rewrite_into_loop_closed_ssa

2012-08-16 Thread Steven Bosscher
On Thu, Aug 16, 2012 at 2:56 PM, Michael Matz  wrote:
> Hi,
>
> On Wed, 15 Aug 2012, Steven Bosscher wrote:
>
> Please convince me that this :
>
> +/* Return the outermost superloop LOOP of USE_LOOP that is a superloop of
> +   both DEF_LOOP and USE_LOOP.  */
> +static inline struct loop *
> +find_sibling_superloop (struct loop *use_loop, struct loop *def_loop)
> +{
> +  unsigned ud = loop_depth (use_loop);
> +  unsigned dd = loop_depth (def_loop);
> +  gcc_assert (ud > 0 && dd > 0);
> +  if (ud > dd)
> +use_loop = superloop_at_depth (use_loop, dd);
> +  if (ud < dd)
> +def_loop = superloop_at_depth (def_loop, ud);
> +  while (loop_outer (use_loop) != loop_outer (def_loop))
> +{
> +  use_loop = loop_outer (use_loop);
> +  def_loop = loop_outer (def_loop);
> +  gcc_assert (use_loop && def_loop);
> +}
> +  return use_loop;
>
> doesn't have the usual problem of advancing two iterators at the same time
> and expecting they'll eventually meet (which they generally don't have
> to).

I'd think the code is clear enough, if you look at how the function is
used. But I'll talk you through it because you ask so kindly.

1. Note the context of where the function is called:

  if (! flow_loop_nested_p (use_loop, def_loop))
use_bb = find_sibling_superloop (use_loop, def_loop)->header;

so find_sibling_superloop is only called iff def_loop is not nested in use loop.


2. In find_sibling_superloop the first step is to align the loop depth:

> +  unsigned ud = loop_depth (use_loop);
> +  unsigned dd = loop_depth (def_loop);
> +  gcc_assert (ud > 0 && dd > 0);
> +  if (ud > dd)
> +use_loop = superloop_at_depth (use_loop, dd);
> +  if (ud < dd)
> +def_loop = superloop_at_depth (def_loop, ud);

So if USE_LOOP is at a deeper nesting level than DEF_LOOP, we find its
outer loop at the depth of DEF_LOOP and vice versa.


3. Now that USE_LOOP and DEF_LOOP are at the same nesting depth, we iterate:

> +  while (loop_outer (use_loop) != loop_outer (def_loop))
> +{
> +  use_loop = loop_outer (use_loop);
> +  def_loop = loop_outer (def_loop);
> +  gcc_assert (use_loop && def_loop);
> +}

This must meet at some point, because the outermost "loop" of all
loops is current_loops->tree_root at depth 0, and we count down from
the same loop depth.

Kind regards,
Steven


[PATCH] Free redirect_callers vector in tree-sra.c

2012-08-16 Thread Richard Guenther

I noticed we leak the redirect_callers vector in SRA and also noticed
we compute it and then immediately re-compute cgraph edges which
looks weird to me.

Thus the following patch which frees the vector and makes its lifetime
more obvious.

Queued for testing.

Richard.

2012-08-16  Richard Guenther  

* tree-sra.c (modify_function): Collect callers after rebuilding
cgraph edges.  Free caller vector.

Index: gcc/tree-sra.c
===
--- gcc/tree-sra.c  (revision 190442)
+++ gcc/tree-sra.c  (working copy)
@@ -4689,15 +4689,18 @@ modify_function (struct cgraph_node *nod
 {
   struct cgraph_node *new_node;
   bool cfg_changed;
-  VEC (cgraph_edge_p, heap) * redirect_callers = collect_callers_of_node 
(node);
+  VEC (cgraph_edge_p, heap) * redirect_callers;
 
   rebuild_cgraph_edges ();
   free_dominance_info (CDI_DOMINATORS);
   pop_cfun ();
   current_function_decl = NULL_TREE;
 
+  redirect_callers = collect_callers_of_node (node);
   new_node = cgraph_function_versioning (node, redirect_callers, NULL, NULL,
 false, NULL, NULL, "isra");
+  VEC_free (cgraph_edge_p, heap, redirect_callers);
+
   current_function_decl = new_node->symbol.decl;
   push_cfun (DECL_STRUCT_FUNCTION (new_node->symbol.decl));
 


Re: [PATCH] Set current_function_decl in {push,pop}_cfun and push_struct_function

2012-08-16 Thread Michael Matz
Hi,

On Thu, 16 Aug 2012, Diego Novillo wrote:

> I like this approach, particularly since it would be used in contexts 
> where there is no simpler scheme.  I'm not crazy about overloading 
> unused fields, but it's fine if we wrap it around a special accessor. I 
> suppose we could also make ENTRY/EXIT be a base class for basic_block 
> and use a real field (but that can wait).

Actually the other way around (ENTRY/EXIT be a subclass), as it would be 
an additional field to the normal basic blocks.  But for central data 
structures I'm usually of the opinion that jumping through hoops just to 
not enlarge them is quite acceptable :)

> There are other pieces of data that are "global" but context-dependent.  
> I wonder if it wouldn't make sense to encapsulate them in some class 
> that is controlled by the pass manager and gets updated as it moves from 
> function to function (it would contain things like cfun, 
> current_function_decl, etc).

And on that topic: I think it makes sense to eventually get rid of one or 
the other, current_function_decl is always (well, mostly) cfun->decl, if 
cfun happens to be set.  I know there are some roadblocks in front of that 
goal, but still.

Ciao,
Michael.


[PATCH] Add working-set size and hotness information to fdo summary (issue6465057)

2012-08-16 Thread Teresa Johnson
This is a revision of my earlier patch to add working set information to
the gcov program summary based on discussions between Honza, David and I
and approved with changes by Honza in this earlier thread on the first patch:
  http://gcc.gnu.org/ml/gcc-patches/2012-07/msg01412.html
I plan to commit this in couple days unless there are more revisions
requested.

Changes from the earlier patch are the removal of the loop unroller changes
utilizing the new summary info, and feeding back an array of working
set information for different cutoffs, as well as using a histogram to
compute the working set information to avoid expensive copying and qsorting.

Patch description:

Patch to add new summary information on counter working set sizes to gcov
profiles. The function summaries now include an array of working set data,
where each data point corresponds to a percentage of the total sum_all of
the counters and includes the number of hot counters and the minimum counter
value included in that working set.

By default, there are 128 working set data points included in the summary,
but this is controlled at runtime with the GCOV_WORKING_SET_ENTRIES
environment variable. The first GCOV_WORKING_SET_ENTRIES - 1 entries
correspond to percentages 100.0/GCOV_WORKING_SET_ENTRIES through
100.0/GCOV_WORKING_SET_ENTRIES * (GCOV_WORKING_SET_ENTRIES - 1) of sum_all.
The last entry always corresponds to 99.99% of sum_all.

A log2-based histogram is used to compute the working set information,
to avoid the need to copy all counters into a large array and invoke
qsort.

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

2012-08-16  Teresa Johnson  

* libgcc/libgcov.c (histo_index): New function.
(histogram_insert): Ditto.
(gcov_compute_working_set): Ditto.
(gcov_exit): Invoke gcov_compute_working_set, and
perform merging of new working set summary info.
* gcc/gcov.c (read_count_file): Invoke gcov_destroy_summary to
clean up allocated working set memory.
* gcc/gcov-io.c (gcov_write_summary): Include length of working
set summary info in GCOV_TAG_SUMMARY_LENGTH, and write out working
set summary.
(gcov_read_summary): Read working set summary info.
(gcov_destroy_summary): New function.
* gcc/gcov-io.h (gcov_type_unsigned): New type.
(gcov_destroy_summary): Declare.
(GCOV_TAG_SUMMARY_LENGTH): Update to include working set summary.
(struct gcov_working_set_info): New structure.
(struct gcov_ctr_summary): Include working set summary.
* gcc/coverage.c (htab_counts_entry_del): Free working sets.
(read_counts_file): Read and merge in working set summary info.
* gcc/gcov-dump.c (tag_summary): Dump out working set summary info.

Index: libgcc/libgcov.c
===
--- libgcc/libgcov.c(revision 189420)
+++ libgcc/libgcov.c(working copy)
@@ -276,6 +276,252 @@ gcov_version (struct gcov_info *ptr, gcov_unsigned
   return 1;
 }
 
+/* Structure used for each bucket of the log2 histogram of counter values.  */
+
+typedef struct
+{
+  /* The total number of BBs whose profile count falls within the bucket.  */
+  gcov_unsigned_t count;
+  /* The minimum profile count placed in this bucket.  */
+  gcov_type min_value;
+  /* This is the cumulative value of the profile counts in this histogram
+ bucket.  */
+  gcov_type cum_value;
+} bucket_type;
+
+/* For a log2 scale histogram with each range split into 4
+   linear sub-ranges, there will be at most GCOV_TYPE_SIZE - 1 log2
+   ranges since the lowest 2 log2 values share the lowest 4 linear
+   sub-range (values 0 - 3).  */
+
+#define HISTOGRAM_SIZE (GCOV_TYPE_SIZE - 1) * 4
+
+/* Determine the index into histogram for VALUE. */
+
+static unsigned
+histo_index(gcov_type value)
+{
+  gcov_type_unsigned v = (gcov_type_unsigned)value;
+  unsigned r = 0;
+  unsigned prev2bits = 0;
+
+  /* Find index into log2 scale histogram, where each of the log2
+ sized buckets is divided into 4 linear sub-buckets for better
+ focus in the higher buckets.  */
+
+  /* Find the place of the most-significant bit set.  */
+  if (v > 0)
+r = GCOV_TYPE_SIZE - 1 - __builtin_clzll (v);
+
+  /* If at most the 2 least significant bits are set (value is
+ 0 - 3) then that value is our index into the lowest set of
+ four buckets.  */
+  if (r < 2)
+return (unsigned)value;
+
+  gcc_assert (r < 64);
+
+  /* Find the two next most significant bits to determine which
+ of the four linear sub-buckets to select.  */
+  prev2bits = (v >> (r - 2)) & 0x3;
+  /* Finally, compose the final bucket index from the log2 index and
+ the next 2 bits. The minimum r value at this point is 2 since we
+ returned above if r was 2 or more, so the minimum bucket at this
+ point is 4.  */
+  return (r - 1) * 4 + prev2bits;
+}
+
+/* Insert counter VALUE into HISTOGRAM.  */
+
+static void
+hi

Re: [patch] PR54146 - rewrite rewrite_into_loop_closed_ssa

2012-08-16 Thread Michael Matz
Hi,

On Thu, 16 Aug 2012, Steven Bosscher wrote:

> 2. In find_sibling_superloop the first step is to align the loop depth:
>... 
> 3. Now that USE_LOOP and DEF_LOOP are at the same nesting depth,

Ah, that's the crucial point I missed, the while loops starts out with 
loops at the same depth; yes then the loop works.  Thanks for having a 
walk with me :)

> This must meet at some point, because the outermost "loop" of all loops 
> is current_loops->tree_root at depth 0, and we count down from the same 
> loop depth.

Btw, then the comment is still wrong.  You're returning the innermost 
common outer loop, not the outermost (which would be trivial).


Ciao,
Michael.


Re: [patch] PR54146 - rewrite rewrite_into_loop_closed_ssa

2012-08-16 Thread Steven Bosscher
On Thu, Aug 16, 2012 at 4:24 PM, Michael Matz  wrote:
> Btw, then the comment is still wrong.  You're returning the innermost
> common outer loop, not the outermost (which would be trivial).

I'll fix the comment.

Ciao!
Steven


Re: [PATCH] Set current_function_decl in {push,pop}_cfun and push_struct_function

2012-08-16 Thread Diego Novillo
On Thu, Aug 16, 2012 at 10:21 AM, Michael Matz  wrote:
> Hi,
>
> On Thu, 16 Aug 2012, Diego Novillo wrote:
>
>> I like this approach, particularly since it would be used in contexts
>> where there is no simpler scheme.  I'm not crazy about overloading
>> unused fields, but it's fine if we wrap it around a special accessor. I
>> suppose we could also make ENTRY/EXIT be a base class for basic_block
>> and use a real field (but that can wait).
>
> Actually the other way around (ENTRY/EXIT be a subclass), as it would be

Yeah, sorry.

> an additional field to the normal basic blocks.  But for central data
> structures I'm usually of the opinion that jumping through hoops just to
> not enlarge them is quite acceptable :)

Yeah, adding a full word when it's only used in a few places does not
seem like a good tradeoff.

>> There are other pieces of data that are "global" but context-dependent.
>> I wonder if it wouldn't make sense to encapsulate them in some class
>> that is controlled by the pass manager and gets updated as it moves from
>> function to function (it would contain things like cfun,
>> current_function_decl, etc).
>
> And on that topic: I think it makes sense to eventually get rid of one or
> the other, current_function_decl is always (well, mostly) cfun->decl, if
> cfun happens to be set.  I know there are some roadblocks in front of that
> goal, but still.

Agreed.


Diego.


Re: [PATCH] Decrease integer-share-limit

2012-08-16 Thread Paolo Carlini

Hi,

On 08/16/2012 03:39 PM, Richard Guenther wrote:

This decreases the integer-share-limit to make sure the TREE_VEC we
allocate for the small cached integers has a reasonable size for
our GC memory allocator.
Out of curiosity (just in case you hav two spare minutes) do you have 
any idea why this is so? I mean, naively one would think that allowing 
for any 8 bit constant would be a nice idea; puzzlingly, however the 
comment in the code says just "experimentation". I'm wondering if 
tweaking a bit the memory allocator itself could allow for the full 8 
bit range without a big memory waste...


Paolo.


Re: PATCH: Replace target MEMBER_TYPE_FORCES_BLK macro with a target hook

2012-08-16 Thread H.J. Lu
On Thu, Aug 16, 2012 at 3:09 AM, Richard Guenther
 wrote:
> On Thu, Aug 16, 2012 at 1:50 AM, H.J. Lu  wrote:
>> Hi,
>>
>> This patch replaces MEMBER_TYPE_FORCES_BLK with a target hook.  I
>> also pass the type to the target hook in addition to field, which will
>> be used by i386 backend for
>>
>> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20020
>>
>> This patch doesn't change code generation.  Tested on Linux/x86-64. I
>> also tested cross compilers to ia64-hpux, powerpc-linux and xtensa-linux
>> up to cc1.  OK to install?
>
> Isn't the type just always DECL_FIELD_CONTEXT (field)?
>
> Btw, with C++ you no longer need ATTRIBUTE_UNUSED, just give the
> parameter no name.
>

You are right.  Now I don't need to replace MEMBER_TYPE_FORCES_BLK
with a target hook for PR 20020.  Since I already made the change, here is
the updated patch.  OK to install?

If we don't want to convert MEMBER_TYPE_FORCES_BLK, I can submit a
patch to use MEMBER_TYPE_FORCES_BLK in i386 backend.

Thanks.


-- 
H.J.
---
2012-08-16  H.J. Lu  

* stor-layout.c (compute_record_mode): Replace
MEMBER_TYPE_FORCES_BLK with targetm.member_type_forces_blk.
(layout_type): Likewise.

* system.h: Poison MEMBER_TYPE_FORCES_BLK.

* target.def (member_type_forces_blk): New target hook.

* targhooks.c (default_member_type_forces_blk): New.
* targhooks.h (default_member_type_forces_blk): Likewise.

* doc/tm.texi.in (MEMBER_TYPE_FORCES_BLK): Renamed to ...
(TARGET_MEMBER_TYPE_FORCES_BLK): This.
* doc/tm.texi: Regenerated.

* config/ia64/hpux.h (MEMBER_TYPE_FORCES_BLK): Removed.

* config/ia64/ia64.c (ia64_member_type_forces_blk): New
function.
(TARGET_MEMBER_TYPE_FORCES_BLK): New macro.

* config/rs6000/rs6000.c (TARGET_MEMBER_TYPE_FORCES_BLK): New
macro.
(rs6000_member_type_forces_blk): New function.

* config/rs6000/rs6000.h (MEMBER_TYPE_FORCES_BLK): Removed.

* config/xtensa/xtensa.c (xtensa_member_type_forces_blk): New
function.
(TARGET_MEMBER_TYPE_FORCES_BLK): New macro.

* config/xtensa/xtensa.h (MEMBER_TYPE_FORCES_BLK): Removed.

diff --git a/gcc/config/ia64/hpux.h b/gcc/config/ia64/hpux.h
index ad106b4..d9ae109 100644
--- a/gcc/config/ia64/hpux.h
+++ b/gcc/config/ia64/hpux.h
@@ -115,9 +115,6 @@ do {
\
 #define TARGET_DEFAULT \
   (MASK_DWARF2_ASM | MASK_BIG_ENDIAN | MASK_ILP32)

-/* ??? Might not be needed anymore.  */
-#define MEMBER_TYPE_FORCES_BLK(FIELD, MODE) ((MODE) == TFmode)
-
 /* ASM_OUTPUT_EXTERNAL_LIBCALL defaults to just a globalize_label call,
but that doesn't put out the @function type information which causes
shared library problems.  */
diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c
index c7fb559..f2f02c8 100644
--- a/gcc/config/ia64/ia64.c
+++ b/gcc/config/ia64/ia64.c
@@ -319,6 +319,7 @@ static const char *ia64_invalid_binary_op (int,
const_tree, const_tree);
 static enum machine_mode ia64_c_mode_for_suffix (char);
 static void ia64_trampoline_init (rtx, tree, rtx);
 static void ia64_override_options_after_change (void);
+static bool ia64_member_type_forces_blk (const_tree, enum machine_mode);

 static tree ia64_builtin_decl (unsigned, bool);

@@ -570,6 +571,9 @@ static const struct attribute_spec ia64_attribute_table[] =
 #undef TARGET_GET_RAW_ARG_MODE
 #define TARGET_GET_RAW_ARG_MODE ia64_get_reg_raw_mode

+#undef TARGET_MEMBER_TYPE_FORCES_BLK
+#define TARGET_MEMBER_TYPE_FORCES_BLK ia64_member_type_forces_blk
+
 #undef TARGET_GIMPLIFY_VA_ARG_EXPR
 #define TARGET_GIMPLIFY_VA_ARG_EXPR ia64_gimplify_va_arg

@@ -11153,6 +11157,15 @@ ia64_get_reg_raw_mode (int regno)
   return default_get_reg_raw_mode(regno);
 }

+/* Implement TARGET_MEMBER_TYPE_FORCES_BLK.  ??? Might not be needed
+   anymore.  */
+
+bool
+ia64_member_type_forces_blk (const_tree, enum machine_mode mode)
+{
+  return TARGET_HPUX && mode == TFmode;
+}
+
 /* Always default to .text section until HP-UX linker is fixed.  */

 ATTRIBUTE_UNUSED static section *
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 34948fb..57c4823 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -1302,6 +1302,9 @@ static const struct attribute_spec
rs6000_attribute_table[] =
 #undef TARGET_INIT_DWARF_REG_SIZES_EXTRA
 #define TARGET_INIT_DWARF_REG_SIZES_EXTRA rs6000_init_dwarf_reg_sizes_extra

+#undef TARGET_MEMBER_TYPE_FORCES_BLK
+#define TARGET_MEMBER_TYPE_FORCES_BLK rs6000_member_type_forces_blk
+
 /* On rs6000, function arguments are promoted, as are function return
values.  */
 #undef TARGET_PROMOTE_FUNCTION_MODE
@@ -7287,6 +7290,26 @@ rs6000_emit_move (rtx dest, rtx source, enum
machine_mode mode)
  emit_set:
   emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
 }
+
+/* Return true if a structure, union or array containing FIELD should be
+   accessed using `BLKMODE'.
+
+ 

Re: [PATCH 6/7] rs6000: Remove -mabi=ieeelongdouble.

2012-08-16 Thread Segher Boessenkool

There are some problems with it:
- On at least 4.6 and later, it crashes the compiler together with  
-m64;

- On older versions, it generates incorrect code together with -m64;
- Supposedly it doesn't actually work on 32-bit either, on the  
glibc side;

- It isn't listed in --target-help, because the option file says
  "undocumented", but the manual does in fact list it;
- The Darwin header claims it is for POWER.

In the spirit of the rest of this patch series, I solve these  
problems

by ripping it all out.


As we discussed on IRC, this should work but is broken.  It should not
be ripped out.


I figured as much :-)


Would you please open a Bugzilla PR and include me, Meissner and Peter
Bergner on the CC list?


Done, PR54284.

Also committed the attached as obvious, to fix the issue that made me
do this patch in the first place.

Cheers,


Segher


2012-08-16  Segher Boessenkool  

   * config/rs6000/darwin.h (TARGET_IEEE_QUAD): Fix comment.

--- gcc/config/rs6000/darwin.h  (revision 190445)
+++ gcc/config/rs6000/darwin.h  (working copy)
@@ -282,7 +282,7 @@
 #undef  TARGET_DEFAULT
 #define TARGET_DEFAULT (MASK_MULTIPLE | MASK_PPC_GFXOPT)

-/* Darwin only runs on PowerPC, so short-circuit POWER patterns.  */
+/* Darwin always uses IBM long double, never IEEE long double.  */
 #undef  TARGET_IEEEQUAD
 #define TARGET_IEEEQUAD 0




Re: [PATCH] Decrease integer-share-limit

2012-08-16 Thread Richard Guenther
On Thu, 16 Aug 2012, Paolo Carlini wrote:

> Hi,
> 
> On 08/16/2012 03:39 PM, Richard Guenther wrote:
> > This decreases the integer-share-limit to make sure the TREE_VEC we
> > allocate for the small cached integers has a reasonable size for
> > our GC memory allocator.
> Out of curiosity (just in case you hav two spare minutes) do you have any idea
> why this is so? I mean, naively one would think that allowing for any 8 bit
> constant would be a nice idea; puzzlingly, however the comment in the code
> says just "experimentation". I'm wondering if tweaking a bit the memory
> allocator itself could allow for the full 8 bit range without a big memory
> waste...

The GC memory allocator works on "pages", there are not pages of
arbitrary size but only power-of-two sizes.  It's hard to improve
the allocator here.

Richard.


Re: Merge C++ conversion into trunk (4/6 - hash table rewrite)

2012-08-16 Thread Paolo Carlini

Hi,

I have another "out of curiosity"-type question ;)

On 08/16/2012 11:19 AM, Richard Guenther wrote:


!
! template 
! inline int
! pointer_hash::equal (const T *existing,
! const T *candidate)
! {
!   return existing == candidate;
   }
are these uses in the new code of int instead of bool intended or 
"historical"? Seem weird, definitely from the C++ (but even from the C) 
point of view.


Paolo.


Re: Merge C++ conversion into trunk (4/6 - hash table rewrite)

2012-08-16 Thread Richard Guenther
On Thu, 16 Aug 2012, Paolo Carlini wrote:

> Hi,
> 
> I have another "out of curiosity"-type question ;)
> 
> On 08/16/2012 11:19 AM, Richard Guenther wrote:
> > 
> > !
> > ! template 
> > ! inline int
> > ! pointer_hash::equal (const T *existing,
> > ! const T *candidate)
> > ! {
> > !   return existing == candidate;
> >}
> are these uses in the new code of int instead of bool intended or
> "historical"? Seem weird, definitely from the C++ (but even from the C) point
> of view.

Historical, copying what libiberty htab did.

Richard.


Re: [PATCH] Decrease integer-share-limit

2012-08-16 Thread Jakub Jelinek
On Thu, Aug 16, 2012 at 04:44:03PM +0200, Richard Guenther wrote:
> On Thu, 16 Aug 2012, Paolo Carlini wrote:
> > On 08/16/2012 03:39 PM, Richard Guenther wrote:
> > > This decreases the integer-share-limit to make sure the TREE_VEC we
> > > allocate for the small cached integers has a reasonable size for
> > > our GC memory allocator.
> > Out of curiosity (just in case you hav two spare minutes) do you have any 
> > idea
> > why this is so? I mean, naively one would think that allowing for any 8 bit
> > constant would be a nice idea; puzzlingly, however the comment in the code
> > says just "experimentation". I'm wondering if tweaking a bit the memory
> > allocator itself could allow for the full 8 bit range without a big memory
> > waste...
> 
> The GC memory allocator works on "pages", there are not pages of
> arbitrary size but only power-of-two sizes.  It's hard to improve
> the allocator here.

The allocations are either power-of-two, or a couple of extra listed sizes.
So, the alternative would be to add an extra size for the default integer
share limit vector.  See extra_order_size_table in ggc-page.c.  Of course
only provided there are many of those vectors.

Jakub


[PATCH, MIPS] add new peephole for 74k dspr2

2012-08-16 Thread Sandra Loosemore
This patch adds a peephole optimization to use a clever trick to 
zero-initialize the two halves of an accumulator register with one 
instruction instead of a mtlo/mthi pair.  OK to check in?


-Sandra

2012-08-16  Sandra Loosemore  
Julian Brown  
MIPS Technologies, Inc.

gcc/
* config/mips/mips-dspr2.md (UNSPEC_ACC_INIT): Declare.
(mult peephole2): Add peephole that converts
"mtlo $ac[1-3],$0; mthi $ac[1-3],$0" into
"mult $ac[1-3],$0,$0".
(*mips_acc_init): New insn for above.


Index: gcc/config/mips/mips-dspr2.md
===
--- gcc/config/mips/mips-dspr2.md	(revision 190437)
+++ gcc/config/mips/mips-dspr2.md	(working copy)
@@ -68,6 +68,7 @@
   UNSPEC_DPAQX_SA_W_PH
   UNSPEC_DPSQX_S_W_PH
   UNSPEC_DPSQX_SA_W_PH
+  UNSPEC_ACC_INIT
 ])
 
 (define_insn "mips_absq_s_qb"
@@ -630,3 +631,33 @@
   [(set_attr "type"	"dspmacsat")
(set_attr "accum_in" "1")
(set_attr "mode"	"SI")])
+
+;; Convert  mtlo $ac[1-3],$0  =>  mult $ac[1-3],$0,$0
+;;  mthi $ac[1-3],$0
+(define_peephole2
+  [(set (match_operand:SI 0 "register_operand" "")
+	(const_int 0))
+   (set (match_operand:SI 1 "register_operand" "")
+	(const_int 0))]
+  "ISA_HAS_DSPR2
+   && !TARGET_MIPS16
+   && !TARGET_64BIT
+   && true_regnum (operands[0]) >= DSP_ACC_REG_FIRST
+   && true_regnum (operands[0]) <= DSP_ACC_REG_LAST
+   && true_regnum (operands[0]) / 2 == true_regnum (operands[1]) / 2"
+  [(parallel [(set (match_dup 0) (const_int 0))
+	  (set (match_dup 1) (const_int 0))
+	  (unspec [(const_int 0)] UNSPEC_ACC_INIT)])]
+)
+
+(define_insn "*mips_acc_init"
+  [(parallel
+[(set (match_operand:SI 0 "register_operand" "=a") (const_int 0))
+ (set (match_operand:SI 1 "register_operand" "=a") (const_int 0))
+ (unspec [(const_int 0)] UNSPEC_ACC_INIT)])]
+  "ISA_HAS_DSPR2
+   && !TARGET_MIPS16
+   && !TARGET_64BIT"
+  "mult\t%q0,$0,$0\t\t# Clear ACC HI/LO"
+  [(set_attr "type"	"imul")
+   (set_attr "mode"	"SI")])


Re: [PATCH] Free redirect_callers vector in tree-sra.c

2012-08-16 Thread Richard Guenther
On Thu, 16 Aug 2012, Richard Guenther wrote:

> 
> I noticed we leak the redirect_callers vector in SRA and also noticed
> we compute it and then immediately re-compute cgraph edges which
> looks weird to me.
> 
> Thus the following patch which frees the vector and makes its lifetime
> more obvious.
> 
> Queued for testing.

The re-ordering fails gcc.dg/ipa/ipa-sra-6.c, I'll re-do without that.

Richard.

> Richard.
> 
> 2012-08-16  Richard Guenther  
> 
>   * tree-sra.c (modify_function): Collect callers after rebuilding
>   cgraph edges.  Free caller vector.
> 
> Index: gcc/tree-sra.c
> ===
> --- gcc/tree-sra.c(revision 190442)
> +++ gcc/tree-sra.c(working copy)
> @@ -4689,15 +4689,18 @@ modify_function (struct cgraph_node *nod
>  {
>struct cgraph_node *new_node;
>bool cfg_changed;
> -  VEC (cgraph_edge_p, heap) * redirect_callers = collect_callers_of_node 
> (node);
> +  VEC (cgraph_edge_p, heap) * redirect_callers;
>  
>rebuild_cgraph_edges ();
>free_dominance_info (CDI_DOMINATORS);
>pop_cfun ();
>current_function_decl = NULL_TREE;
>  
> +  redirect_callers = collect_callers_of_node (node);
>new_node = cgraph_function_versioning (node, redirect_callers, NULL, NULL,
>false, NULL, NULL, "isra");
> +  VEC_free (cgraph_edge_p, heap, redirect_callers);
> +
>current_function_decl = new_node->symbol.decl;
>push_cfun (DECL_STRUCT_FUNCTION (new_node->symbol.decl));
>  
> 

-- 
Richard Guenther 
SUSE / SUSE Labs
SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746
GF: Jeff Hawn, Jennifer Guild, Felix Imend


Ping^2 Re: Add --no-sysroot-suffix driver option

2012-08-16 Thread Joseph S. Myers
Ping^2.  This patch 
 is still pending 
review.

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


Re: RFA: Support infinity, NaN, and denormalized numbers in floatformat.c

2012-08-16 Thread Andreas Schwab
Ian Lance Taylor  writes:

> @@ -306,8 +359,18 @@ floatformat_to_double (fmt, from, to)
>mant = get_field (ufrom, fmt->byteorder, fmt->totalsize,
>mant_off, mant_bits);
>  
> -  dto += ldexp ((double)mant, exponent - mant_bits);
> -  exponent -= mant_bits;
> +  /* Handle denormalized numbers.  FIXME: What should we do for
> +  non-IEEE formats?  */
> +  if (exponent == 0 && mant != 0)
> + dto += ldexp ((double)mant,
> +   (- fmt->exp_bias
> +- mant_bits
> +- (mant_off - fmt->man_start)
> ++ 1));
> +  else
> + dto += ldexp ((double)mant, exponent - mant_bits);
> +  if (exponent != 0)
> + exponent -= mant_bits;

That mishandles numbers between 1 and 2 (ie. where the unbiased exponent
is zero) with floating-point formats with more than 32 mantissa bits.
Also, the handling of denormal numbers can be simplified by just setting
exponent appropriately.

Andreas.

* floatformat.c (floatformat_to_double): Correctly handle numbers
between 1 and 2.  Simplify handling of denormal number.
(main): Test with 1.1.
---
 libiberty/floatformat.c | 38 ++
 1 file changed, 14 insertions(+), 24 deletions(-)

diff --git a/libiberty/floatformat.c b/libiberty/floatformat.c
index 1116c63..c58ab01 100644
--- a/libiberty/floatformat.c
+++ b/libiberty/floatformat.c
@@ -1,5 +1,5 @@
 /* IEEE floating point support routines, for GDB, the GNU Debugger.
-   Copyright 1991, 1994, 1999, 2000, 2003, 2005, 2006, 2010
+   Copyright 1991, 1994, 1999, 2000, 2003, 2005, 2006, 2010, 2012
Free Software Foundation, Inc.
 
 This file is part of GDB.
@@ -463,7 +463,6 @@ floatformat_to_double (const struct floatformat *fmt,
   unsigned long mant;
   unsigned int mant_bits, mant_off;
   int mant_bits_left;
-  int special_exponent;/* It's a NaN, denorm or zero */
 
   /* Split values are not handled specially, since the top half has
  the correctly rounded double value (in the only supported case of
@@ -503,20 +502,20 @@ floatformat_to_double (const struct floatformat *fmt,
   mant_off = fmt->man_start;
   dto = 0.0;
 
-  special_exponent = exponent == 0 || (unsigned long) exponent == fmt->exp_nan;
-
-  /* Don't bias zero's, denorms or NaNs.  */
-  if (!special_exponent)
-exponent -= fmt->exp_bias;
-
   /* Build the result algebraically.  Might go infinite, underflow, etc;
  who cares. */
 
-  /* If this format uses a hidden bit, explicitly add it in now.  Otherwise,
- increment the exponent by one to account for the integer bit.  */
-
-  if (!special_exponent)
+  /* For denorms use minimum exponent.  */
+  if (exponent == 0)
+exponent = 1 - fmt->exp_bias;
+  else
 {
+  exponent -= fmt->exp_bias;
+
+  /* If this format uses a hidden bit, explicitly add it in now.
+Otherwise, increment the exponent by one to account for the
+integer bit.  */
+
   if (fmt->intbit == floatformat_intbit_no)
dto = ldexp (1.0, exponent);
   else
@@ -530,18 +529,8 @@ floatformat_to_double (const struct floatformat *fmt,
   mant = get_field (ufrom, fmt->byteorder, fmt->totalsize,
 mant_off, mant_bits);
 
-  /* Handle denormalized numbers.  FIXME: What should we do for
-non-IEEE formats?  */
-  if (special_exponent && exponent == 0 && mant != 0)
-   dto += ldexp ((double)mant,
- (- fmt->exp_bias
-  - mant_bits
-  - (mant_off - fmt->man_start)
-  + 1));
-  else
-   dto += ldexp ((double)mant, exponent - mant_bits);
-  if (exponent != 0)
-   exponent -= mant_bits;
+  dto += ldexp ((double) mant, exponent - mant_bits);
+  exponent -= mant_bits;
   mant_off += mant_bits;
   mant_bits_left -= mant_bits;
 }
@@ -756,6 +745,7 @@ main (void)
 {
   ieee_test (0.0);
   ieee_test (0.5);
+  ieee_test (1.1);
   ieee_test (256.0);
   ieee_test (0.12345);
   ieee_test (234235.78907234);
-- 
1.7.11.5


-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


Re: Merge C++ conversion into trunk

2012-08-16 Thread Iain Sandoe

On 14 Aug 2012, at 19:59, Diego Novillo wrote:
> 
> After the merge is in, I will send an announcement and request major branch 
> merges to wait for another 24 hrs to allow testers the chance to pick up this 
> merge.

The following patch (mimicking what has been done elsewhere at r190402) 
restores bootstrap for powerpc-darwin.
OK for trunk?

Iain

gcc/

* config/rs6000/rs6000.c (macho_branch_islands): Adjust for changes to
vec.h.

Index: gcc/config/rs6000/rs6000.c
===
--- gcc/config/rs6000/rs6000.c  (revision 190417)
+++ gcc/config/rs6000/rs6000.c  (working copy)
@@ -24952,7 +24952,7 @@ macho_branch_islands (void)
 
   while (!VEC_empty (branch_island, branch_islands))
 {
-  branch_island *bi = VEC_last (branch_island, branch_islands);
+  branch_island *bi = &VEC_last (branch_island, branch_islands);
   const char *label = IDENTIFIER_POINTER (bi->label_name);
   const char *name = IDENTIFIER_POINTER (bi->function_name);
   char name_buf[512];



Re: Merge C++ conversion into trunk

2012-08-16 Thread Diego Novillo

On 12-08-16 12:50 , Iain Sandoe wrote:


On 14 Aug 2012, at 19:59, Diego Novillo wrote:


After the merge is in, I will send an announcement and request major branch 
merges to wait for another 24 hrs to allow testers the chance to pick up this 
merge.


The following patch (mimicking what has been done elsewhere at r190402) 
restores bootstrap for powerpc-darwin.
OK for trunk?

Iain

gcc/

* config/rs6000/rs6000.c (macho_branch_islands): Adjust for changes to
vec.h.


OK, thanks.


Diego.


Re: Reproducible gcc builds, gfortran, and -grecord-gcc-switches

2012-08-16 Thread Simon Baldwin
On 16 August 2012 16:40, Michael Matz  wrote:
>
> ,,,
>
> Do you have considered to use a new option flag (usable in the .opt files)
> instead of a langhook?  I.e. add a flag cl_dont_record to cl_option, a
> string Norecord for the .opt files, some handling for it in
> opt-functions.awk and the like?
>
> Adding lang-hooks used by debug producers make me twitch :)

Okay.  Below is an alternative approach.

I've moved discussion to gcc-patches, since it's now more concrete
than abstract.

--

Omit OPT_cpp_ from the DWARF producer string in gfortran.

Gfortran uses -cpp= internally, and with -grecord_gcc_switches
this command line switch is stored by default in object files.  This causes
problems with build and packaging systems that care about gcc binary
reproducibility and file checksums; the temporary file is different on each
compiler invocation.

Fixed by adding a new opt marker NoDwarfRecord and associated flag, filtering
options for this this setting when writing the producer string, and setting
this flag for fortran -cpp=

Tested for fortran (suppresses -cpp=...) and c (no effect).

gcc/ChangeLog
2012-08-16  Simon Baldwin  

* dwarf2out.c (gen_producer_string): Omit command line switch if
CL_NO_DWARF_RECORD flag set.
* opts.c (print_specific_help): Add CL_NO_DWARF_RECORD handling.
* opts.h (CL_NO_DWARF_RECORD): New.
* opt-functions.awk (switch_flags): Add NoDwarfRecord.

gcc/fortran/ChangeLog
2012-08-16  Simon Baldwin  

* lang.opt (-cpp=): Mark flag NoDwarfRecord.


Index: gcc/dwarf2out.c
===
--- gcc/dwarf2out.c (revision 190442)
+++ gcc/dwarf2out.c (working copy)
@@ -18101,6 +18101,9 @@ gen_producer_string (void)
/* Ignore these.  */
continue;
   default:
+if (cl_options[save_decoded_options[j].opt_index].flags
+   & CL_NO_DWARF_RECORD)
+ continue;
 gcc_checking_assert (save_decoded_options[j].canonical_option[0][0]
 == '-');
 switch (save_decoded_options[j].canonical_option[0][1])
Index: gcc/opts.c
===
--- gcc/opts.c  (revision 190442)
+++ gcc/opts.c  (working copy)
@@ -1186,7 +1186,9 @@ print_specific_help (unsigned int includ
 {
   if (any_flags == 0)
{
- if (include_flags & CL_UNDOCUMENTED)
+ if (include_flags & CL_NO_DWARF_RECORD)
+   description = _("The following options are not recorded by DWARF");
+  else if (include_flags & CL_UNDOCUMENTED)
description = _("The following options are not documented");
  else if (include_flags & CL_SEPARATE)
description = _("The following options take separate arguments");
@@ -1292,7 +1294,7 @@ common_handle_option (struct gcc_options
/* Walk along the argument string, parsing each word in turn.
   The format is:
   arg = [^]{word}[,{arg}]
-  word = {optimizers|target|warnings|undocumented|
+  word = {optimizers|target|warnings|undocumented|nodwarfrecord|
   params|common|}  */
while (* a != 0)
  {
@@ -1307,6 +1309,7 @@ common_handle_option (struct gcc_options
  { "target", CL_TARGET },
  { "warnings", CL_WARNING },
  { "undocumented", CL_UNDOCUMENTED },
+ { "nodwarfrecord", CL_NO_DWARF_RECORD },
  { "params", CL_PARAMS },
  { "joined", CL_JOINED },
  { "separate", CL_SEPARATE },
Index: gcc/opts.h
===
--- gcc/opts.h  (revision 190442)
+++ gcc/opts.h  (working copy)
@@ -145,6 +145,7 @@ extern const unsigned int cl_lang_count;
 #define CL_JOINED  (1U << 22) /* If takes joined argument.  */
 #define CL_SEPARATE(1U << 23) /* If takes a separate argument.  */
 #define CL_UNDOCUMENTED(1U << 24) /* Do not output with 
--help.  */
+#define CL_NO_DWARF_RECORD (1U << 25) /* Do not add to producer string.  */

 /* Flags for an enumerated option argument.  */
 #define CL_ENUM_CANONICAL  (1 << 0) /* Canonical for this value.  */
Index: gcc/fortran/lang.opt
===
--- gcc/fortran/lang.opt(revision 190442)
+++ gcc/fortran/lang.opt(working copy)
@@ -287,7 +287,7 @@ Fortran Negative(nocpp)
 Enable preprocessing

 cpp=
-Fortran Joined Negative(nocpp) Undocumented
+Fortran Joined Negative(nocpp) Undocumented NoDwarfRecord
 ; Internal option generated by specs from -cpp.

 nocpp
Index: gcc/opt-functions.awk
===
--- gcc/opt-functions.awk   (revision 190442)
+++ gcc/opt-functions.awk   (working copy)
@@ -103,6 +103,7 @@ function switch_flags (flags)
  test_flag("JoinedOrMissing", flags, " | CL_JOINED") \
 

Re: C++ PR 54197: lifetime of reference not properly extended

2012-08-16 Thread Diego Novillo
On Wed, Aug 15, 2012 at 10:52 AM, Ollie Wild  wrote:
> (Adding other C++ maintainers in case someone else wants to have a stab.)
>
> Ping?
>
> Ollie

I wonder if it wouldn't make more sense to iterate until we find the
rightmost element in a compound_expr chain, but I don't think they are
neither common nor long enough to matter.

It looks like a good fix, but I would rather have a C++ maintainer
give final approval for gcc-4_7-branch and trunk.  In the meantime,
should we install it in google/gcc-4_7?  I can deal with any merge
conflicts, in case the patch needs more work for the upstream
branches.


Thanks.  Diego.


Re: [google] Modification of gcov pmu format to reduce gcda size bloat (issue 6427063)

2012-08-16 Thread cmang

Hi David,

Could you take a look at the patch I mailed to gcc-patches when you get
a chance?

Thanks,
Chris

http://codereview.appspot.com/6427063/


PATCH: Add x32 support to config.guess

2012-08-16 Thread H.J. Lu
Hi,

GCC on Linux/x86-64 may be configured for x32:

https://sites.google.com/site/x32abi/

by default and the Linux/x32 target should be x86_64-VENDOR-linux-gnux32.
This patch adds x32 support to config.guess.  OK to install?

Thanks.


H.J.
---
2012-08-16  H.J. Lu  

* config.guess (x86_64:Linux:*:*): Append x32 if compiler is
configured for 32-bit  objects.

diff --git a/config.guess b/config.guess
index b02565c..4b0f7c2 100755
--- a/config.guess
+++ b/config.guess
@@ -984,7 +984,18 @@ EOF
echo ${UNAME_MACHINE}-dec-linux-gnu
exit ;;
 x86_64:Linux:*:*)
-   echo x86_64-unknown-linux-gnu
+   eval $set_cc_for_build
+   X86_64_ABI=
+   # If there is a compiler, see if it is configured for 32-bit objects.
+   if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+   if (echo '#ifdef __ILP32__'; echo IS_X32; echo '#endif') | \
+   (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+   grep IS_X32 >/dev/null
+   then
+   X86_64_ABI=x32
+   fi
+   fi
+   echo x86_64-unknown-linux-gnu${X86_64_ABI}
exit ;;
 xtensa*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu


PATCH: PR target/20020: 128 bit structs not targeted to TImode

2012-08-16 Thread H.J. Lu
Hi,

My email sent to gcc-patches@gcc.gnu.org was bounced as spam.  I am
resending it.  This patch defines both MAX_FIXED_MODE_SIZE and
MEMBER_TYPE_FORCES_BLK for i386.  MEMBER_TYPE_FORCES_BLK is needed so
that we always put union with XFmode field in BLKmode.  This patch
doesn't change any ABI since both MAX_FIXED_MODE_SIZE and
MEMBER_TYPE_FORCES_BLK aren't ABI macros.  They only change code
quality.  Tested on Linux/x86-64.  OK to install?

Thanks.


H.J.
---
gcc/

2012-08-16  H.J. Lu  
Gary Funck 

PR target/20020
* config/i386/i386.h (MAX_FIXED_MODE_SIZE): New macro.
(MEMBER_TYPE_FORCES_BLK): Likewise.

gcc/testsuite/

2012-08-16  H.J. Lu  
Gary Funck 

PR target/20020
* gcc.target/i386/pr20020-1.c: New test.
* gcc.target/i386/pr20020-2.c: Likewise.
* gcc.target/i386/pr20020-3.c: Likewise.

diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
index 5ff82ab..4046a9a 100644
--- a/gcc/config/i386/i386.h
+++ b/gcc/config/i386/i386.h
@@ -1816,6 +1816,16 @@ do { 
\
 #define BRANCH_COST(speed_p, predictable_p) \
   (!(speed_p) ? 2 : (predictable_p) ? 0 : ix86_branch_cost)
 
+/* An integer expression for the size in bits of the largest integer machine
+   mode that should actually be used.  We allow pairs of registers.  */
+#define MAX_FIXED_MODE_SIZE GET_MODE_BITSIZE (TARGET_64BIT ? TImode : DImode)
+
+/* Union with XFmode must be in BLKmode.  */
+#define MEMBER_TYPE_FORCES_BLK(FIELD, MODE)\
+  ((MODE) == XFmode\
+   && (TREE_CODE (DECL_FIELD_CONTEXT (FIELD)) == UNION_TYPE\
+   || TREE_CODE (DECL_FIELD_CONTEXT (FIELD)) == QUAL_UNION_TYPE))
+
 /* Define this macro as a C expression which is nonzero if accessing
less than a word of memory (i.e. a `char' or a `short') is no
faster than accessing a word of memory, i.e., if such access
diff --git a/gcc/testsuite/gcc.target/i386/pr20020-1.c 
b/gcc/testsuite/gcc.target/i386/pr20020-1.c
new file mode 100644
index 000..3f10970
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr20020-1.c
@@ -0,0 +1,26 @@
+/* Check that 128-bit struct's are represented as TImode values.  */
+/* { dg-do compile { target int128 } } */
+/* { dg-options "-O2 -fdump-rtl-expand" } */
+
+struct shared_ptr_struct
+{
+  unsigned long long phase:48;
+  unsigned short thread:16;
+  union
+{
+  void *addr;
+  unsigned long long pad;
+};
+};
+typedef struct shared_ptr_struct sptr_t;
+
+sptr_t S;
+
+sptr_t
+sptr_result (void)
+{
+  return S;
+}
+/* { dg-final { scan-rtl-dump "\\\(set \\\(reg:TI \[0-9\]* \\\[  
\\\]\\\)" "expand" } } */
+/* { dg-final { scan-rtl-dump "\\\(set \\\(reg/i:TI 0 ax\\\)" "expand" } } */
+/* { dg-final { cleanup-rtl-dump "expand" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr20020-2.c 
b/gcc/testsuite/gcc.target/i386/pr20020-2.c
new file mode 100644
index 000..e8c5b3d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr20020-2.c
@@ -0,0 +1,24 @@
+/* Check that 128-bit struct's are represented as TImode values.  */
+/* { dg-do compile { target int128 } } */
+/* { dg-options "-O2 -fdump-rtl-expand" } */
+
+struct shared_ptr_struct
+{
+  unsigned long long phase:48;
+  unsigned short thread:16;
+  union
+{
+  void *addr;
+  unsigned long long pad;
+};
+};
+typedef struct shared_ptr_struct sptr_t;
+
+void
+copy_sptr (sptr_t *dest, sptr_t src)
+{
+  *dest = src;
+}
+
+/* { dg-final { scan-rtl-dump "\\\(set \\\(reg:TI \[0-9\]*" "expand" } } */
+/* { dg-final { cleanup-rtl-dump "expand" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr20020-3.c 
b/gcc/testsuite/gcc.target/i386/pr20020-3.c
new file mode 100644
index 000..b1cc926
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr20020-3.c
@@ -0,0 +1,27 @@
+/* Check that 128-bit struct's are represented as TImode values.  */
+/* { dg-do compile { target int128 } } */
+/* { dg-options "-O2 -fdump-rtl-expand" } */
+
+struct shared_ptr_struct
+{
+  unsigned long long phase:48;
+  unsigned short thread:16;
+  union
+{
+  void *addr;
+  unsigned long long pad;
+};
+};
+typedef struct shared_ptr_struct sptr_t;
+
+sptr_t sptr_1, sptr_2;
+
+void
+copy_sptr (void)
+{
+  sptr_1 = sptr_2;  
+}
+
+/* { dg-final { scan-rtl-dump "\\\(set \\\(reg:TI \[0-9\]*" "expand" } } */
+/* { dg-final { scan-rtl-dump "\\\(set \\\(mem/c:TI" "expand" } } */
+/* { dg-final { cleanup-rtl-dump "expand" } } */


Re: [bootstrap] Tentative fix for PR 54281

2012-08-16 Thread Magnus Fromreide
On Thu, Aug 16, 2012 at 07:55:51AM -0400, Diego Novillo wrote:
> Richi, this implements your idea for fixing PR 54281.  I don't
> have an old enough compiler.  Could you please test it in your
> system?
> 
> I debated whether to remove the GENERATOR_FILE predicate from the
> inclusion (some files include gmp.h unconditionally).  I think it
> could be removed, but only a minority of files build with
> GENERATOR_FILE set, so it didn't seem harmful.
> 
> OK if tests pass?

This patch breaks building with gmp, cloog and isl in subdirectories of the
source tree.


echo timestamp > s-options
gawk -f ../../trunk/gcc/opt-functions.awk -f ../../trunk/gcc/opt-read.awk \
   -f ../../trunk/gcc/opth-gen.awk \
   < optionlist > tmp-options.h
/bin/sh ../../trunk/gcc/../move-if-change tmp-options.h options.h
echo timestamp > s-options-h
TARGET_CPU_DEFAULT="" \
HEADERS="auto-host.h ansidecl.h" DEFINES="" \
/bin/sh ../../trunk/gcc/mkconfig.sh bconfig.h
g++ -c   -g -DIN_GCC   -fno-exceptions -fno-rtti -W -Wall -Wno-narrowing 
-Wwrite-strings -Wcast-qual -Wmissing-format-attribute -pedantic -Wno-long-long 
-Wno-variadic-macros -Wno-overlength-strings -fno-common  -DHAVE_CONFIG_H 
-DGENERATOR_FILE -I. -Ibuild -I../../trunk/gcc -I../../trunk/gcc/build 
-I../../trunk/gcc/../include -I../../trunk/gcc/../libcpp/include 
-I/home/magfr/src/gcc/build/./gmp -I/home/magfr/src/gcc/trunk/gmp 
-I/home/magfr/src/gcc/build/./mpfr -I/home/magfr/src/gcc/trunk/mpfr 
-I/home/magfr/src/gcc/trunk/mpc/src  -I../../trunk/gcc/../libdecnumber 
-I../../trunk/gcc/../libdecnumber/bid -I../libdecnumber -DCLOOG_INT_GMP 
-I/home/magfr/src/gcc/build/./cloog/include 
-I/home/magfr/src/gcc/trunk/cloog/include -I../trunk/cloog/include  
-I/home/magfr/src/gcc/build/./isl/include 
-I/home/magfr/src/gcc/trunk/isl/include  \
-o build/genconstants.o ../../trunk/gcc/genconstants.c
In file included from /usr/include/sys/resource.h:25:0,
 from /usr/include/sys/wait.h:32,
 from ../../trunk/gcc/system.h:351,
 from ../../trunk/gcc/genconstants.c:29:
/usr/include/bits/resource.h:133:18: error: declaration does not declare 
anything [-fpermissive]
In file included from ../../trunk/gcc/genconstants.c:29:0:
../../trunk/gcc/system.h:443:23: error: declaration of C function `void* 
sbrk(int)' conflicts with
In file included from ../../trunk/gcc/system.h:253:0,
 from ../../trunk/gcc/genconstants.c:29:
/usr/include/unistd.h:1067:14: error: previous declaration `void* 
sbrk(intptr_t)' here
In file included from ../../trunk/gcc/genconstants.c:29:0:
../../trunk/gcc/system.h:447:48: error: new declaration `char* strstr(const 
char*, const char*)'
In file included from 
/usr/lib/gcc/x86_64-redhat-linux/4.7.0/../../../../include/c++/4.7.0/cstring:44:0,
 from ../../trunk/gcc/system.h:207,
 from ../../trunk/gcc/genconstants.c:29:
/usr/include/string.h:323:22: error: ambiguates old declaration `const char* 
strstr(const char*, const char*)'
In file included from ../../trunk/gcc/genconstants.c:29:0:
../../trunk/gcc/system.h:499:34: error: declaration of C function `const char* 
strsignal(int)' conflicts with
In file included from 
/usr/lib/gcc/x86_64-redhat-linux/4.7.0/../../../../include/c++/4.7.0/cstring:44:0,
 from ../../trunk/gcc/system.h:207,
 from ../../trunk/gcc/genconstants.c:29:
/usr/include/string.h:566:14: error: previous declaration `char* 
strsignal(int)' here
In file included from ../../trunk/gcc/system.h:639:0,
 from ../../trunk/gcc/genconstants.c:29:
../../trunk/gcc/../include/libiberty.h:110:36: error: new declaration `char* 
basename(const char*)'
In file included from 
/usr/lib/gcc/x86_64-redhat-linux/4.7.0/../../../../include/c++/4.7.0/cstring:44:0,
 from ../../trunk/gcc/system.h:207,
 from ../../trunk/gcc/genconstants.c:29:
/usr/include/string.h:603:28: error: ambiguates old declaration `const char* 
basename(const char*)'
make[3]: *** [build/genconstants.o] Error 1
make[3]: Leaving directory `/home/magfr/src/gcc/build/gcc'
make[2]: *** [all-stage1-gcc] Error 2
make[2]: Leaving directory `/home/magfr/src/gcc/build'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/home/magfr/src/gcc/build'
make: *** [all] Error 2


The problem seems to be that during configure time the test scripts include
system.h, but it fails to add the gmp include directory to the compiler flags
so the checks for sbrk, strstr and so on fails with


configure:10294: checking whether sbrk is declared
configure:10317: gcc -c -g -I../../trunk/gcc -I../../trunk/gcc/../include  
conftest.c >&5
In file included from conftest.c:125:0:
../../trunk/gcc/system.h:1041:17: fatal error: gmp.h: No such file or directory
compilation terminated.
configure:10317: $? = 1


Reverting this patch makes the compiler build.

/MF


Re: [bootstrap] Tentative fix for PR 54281

2012-08-16 Thread Diego Novillo
On Thu, Aug 16, 2012 at 1:50 PM, Magnus Fromreide  wrote:
> On Thu, Aug 16, 2012 at 07:55:51AM -0400, Diego Novillo wrote:
>> Richi, this implements your idea for fixing PR 54281.  I don't
>> have an old enough compiler.  Could you please test it in your
>> system?
>>
>> I debated whether to remove the GENERATOR_FILE predicate from the
>> inclusion (some files include gmp.h unconditionally).  I think it
>> could be removed, but only a minority of files build with
>> GENERATOR_FILE set, so it didn't seem harmful.
>>
>> OK if tests pass?
>
> This patch breaks building with gmp, cloog and isl in subdirectories of the
> source tree.

Working on a fix.  It also exposed problems in Ada.


Diego.


[SH] PR 54089

2012-08-16 Thread Oleg Endo
Hello,

This fixes the case where a dynamic shift would expand into a P27 shift
sequence that clobbers T_REG, which would result in wrong code.
Tested on rev 190396 with
make -k check RUNTESTFLAGS="--target_board=sh-sim
\{-m2/-ml,-m2/-mb,-m2a/-mb,-m4/-ml,-m4/-mb,-m4a/-ml,-m4a/-mb}"

and no new failures.
OK?

Cheers,
Oleg

ChangeLog:

PR target/54089
* config/gcc/sh/sh.md (ashlsi3_d): Do not split if it would 
result in a T_REG clobber.  Correct comment.
(ashlsi3_n): Correct comment.

Index: gcc/config/sh/sh.md
===
--- gcc/config/sh/sh.md	(revision 190396)
+++ gcc/config/sh/sh.md	(working copy)
@@ -3746,7 +3746,8 @@
 		   (match_operand:SI 2 "shift_count_operand" "r")))]
   "TARGET_DYNSHIFT"
   "shld	%2,%0"
-  "&& (CONST_INT_P (operands[2]) && ! sh_dynamicalize_shift_p (operands[2]))"
+  "&& CONST_INT_P (operands[2]) && ! sh_dynamicalize_shift_p (operands[2])
+   && ! sh_ashlsi_clobbers_t_reg_p (operands[2])"
   [(const_int 0)]
 {
   if (satisfies_constraint_P27 (operands[2]))
@@ -3759,7 +3760,9 @@
   /* This must happen before reload, otherwise the constant will be moved
 	 into a register due to the "r" constraint, after which this split
 	 cannot be done anymore.
-	 Unfortunately the move insn will not always be eliminated.  */
+	 Unfortunately the move insn will not always be eliminated.
+	 Also, here we must not create a shift sequence that clobbers the
+	 T_REG.  */
   emit_move_insn (operands[0], operands[1]);
   gen_shifty_op (ASHIFT, operands);
   DONE;
@@ -3782,8 +3785,7 @@
   if (sh_dynamicalize_shift_p (operands[2]) && can_create_pseudo_p ())
 {
   /* If this pattern was picked and dynamic shifts are supported, switch
-	 to dynamic shift pattern before reload.  However, we must not
-	 create a shift sequence that clobbers the T_REG.  */
+	 to dynamic shift pattern before reload.  */
   operands[2] = force_reg (SImode, operands[2]);
   emit_insn (gen_ashlsi3_d (operands[0], operands[1], operands[2]));
 }



Re: C++ PR 54197: lifetime of reference not properly extended

2012-08-16 Thread Ollie Wild
On Thu, Aug 16, 2012 at 12:12 PM, Diego Novillo  wrote:
>
> I wonder if it wouldn't make more sense to iterate until we find the
> rightmost element in a compound_expr chain, but I don't think they are
> neither common nor long enough to matter.

Yeah, that was my thinking.  I can certainly do whatever the maintainers want.

> It looks like a good fix, but I would rather have a C++ maintainer
> give final approval for gcc-4_7-branch and trunk.  In the meantime,
> should we install it in google/gcc-4_7?  I can deal with any merge
> conflicts, in case the patch needs more work for the upstream
> branches.

I'll go ahead and submit to google/gcc-4_7, then.

Thanks,
Ollie


[lra] patch to remove lra-equivs.c

2012-08-16 Thread Vladimir Makarov

File lra-equivs.c was removed as not used anymore.

The patch was committed as rev. 190448.

2012-08-16  Vladimir Makarov  

* lra-equivs.c: Remove.




Re: [bootstrap] Tentative fix for PR 54281

2012-08-16 Thread Diego Novillo
I have reverted my original fix and propose this one.  My fix caused 
build failures in Ada (which includes system.h inside 'extern "C"' 
blocks) and it also breaks in-tree isl/cloog.


Richi, I've tried building my own 4.1, but it doesn't build on my 
system.  Could you try this patch?  It includes libintl.h before 
undefining the names, this way the inclusion done from gmp.h turns into 
a nop.



Thanks.  Diego.

commit 96e3d8108901c6f94fa3b0f2de769370688836cb
Author: Diego Novillo 
Date:   Thu Aug 16 14:27:49 2012 -0400

2012-08-16   Diego Novillo  

PR bootstrap/54281
* intl.h: Always include libintl.h.

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index a8ff00d..5252122 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,10 @@
 2012-08-16   Diego Novillo  

+   PR bootstrap/54281
+   * intl.h: Always include libintl.h.
+
+2012-08-16   Diego Novillo  
+
Revert

PR bootstrap/54281
diff --git a/gcc/intl.h b/gcc/intl.h
index c4db354..745fefd 100644
--- a/gcc/intl.h
+++ b/gcc/intl.h
@@ -27,8 +27,8 @@
 # define setlocale(category, locale) (locale)
 #endif

-#ifdef ENABLE_NLS
 #include 
+#ifdef ENABLE_NLS
 extern void gcc_init_libintl (void);
 extern size_t gcc_gettext_width (const char *);
 #else



[SH] PR 39423

2012-08-16 Thread Oleg Endo
Hello,

This fixes the issue mentioned in the PR's comment #29.
Tested on rev 190396 with
make -k check RUNTESTFLAGS="--target_board=sh-sim
\{-m2/-ml,-m2/-mb,-m2a/-mb,-m4/-ml,-m4/-mb,-m4a/-ml,-m4a/-mb}"

and no new failures.
OK?

Cheers,
Oleg

ChangeLog:

PR target/39423
* config/sh/sh.md (*movsi_index_disp, *movhi_index_disp): 
Handle potential T_REG clobber.  Convert zero extending split 
to insn_and_split.
Index: gcc/config/sh/sh.md
===
--- gcc/config/sh/sh.md	(revision 190396)
+++ gcc/config/sh/sh.md	(working copy)
@@ -5455,16 +5455,22 @@
 ;;	mov.l	@(4,r5),r0
 ;;
 ;; See also PR 39423.
+;; Notice that these patterns have a T_REG clobber, because the shift
+;; sequence that will be split out might clobber the T_REG.  Ideally, the
+;; clobber would be added conditionally, depending on the result of
+;; sh_ashlsi_clobbers_t_reg_p.  When splitting out the shifts we must go
+;; through the ashlsi3 expander in order to get the right shift insn --
+;; a T_REG clobbering or non-clobbering shift sequence or dynamic shift.
 ;; FIXME: Fold copy pasted patterns somehow.
 ;; FIXME: Combine never tries this kind of patterns for DImode.
 (define_insn_and_split "*movsi_index_disp"
   [(set (match_operand:SI 0 "arith_reg_dest" "=r")
-	(match_operand:SI 1 "mem_index_disp_operand" "m"))]
+	(match_operand:SI 1 "mem_index_disp_operand" "m"))
+   (clobber (reg:SI T_REG))]
   "TARGET_SH1"
   "#"
   "&& can_create_pseudo_p ()"
-  [(set (match_dup 5) (ashift:SI (match_dup 1) (match_dup 2)))
-   (set (match_dup 6) (plus:SI (match_dup 5) (match_dup 3)))
+  [(set (match_dup 6) (plus:SI (match_dup 5) (match_dup 3)))
(set (match_dup 0) (match_dup 7))]
 {
   rtx mem = operands[1];
@@ -5481,16 +5487,18 @@
   operands[7] =
 replace_equiv_address (mem,
 			   gen_rtx_PLUS (SImode, operands[6], operands[4]));
+
+  emit_insn (gen_ashlsi3 (operands[5], operands[1], operands[2]));
 })
 
 (define_insn_and_split "*movhi_index_disp"
   [(set (match_operand:SI 0 "arith_reg_dest" "=r")
-	(sign_extend:SI (match_operand:HI 1 "mem_index_disp_operand" "m")))]
+	(sign_extend:SI (match_operand:HI 1 "mem_index_disp_operand" "m")))
+   (clobber (reg:SI T_REG))]
   "TARGET_SH1"
   "#"
   "&& can_create_pseudo_p ()"
-  [(set (match_dup 5) (ashift:SI (match_dup 1) (match_dup 2)))
-   (set (match_dup 6) (plus:SI (match_dup 5) (match_dup 3)))
+  [(set (match_dup 6) (plus:SI (match_dup 5) (match_dup 3)))
(set (match_dup 0) (sign_extend:SI (match_dup 7)))]
 {
   rtx mem = operands[1];
@@ -5507,13 +5515,19 @@
   operands[7] =
 replace_equiv_address (mem,
 			   gen_rtx_PLUS (SImode, operands[6], operands[4]));
+
+  emit_insn (gen_ashlsi3 (operands[5], operands[1], operands[2]));
 })
 
-(define_split
+(define_insn_and_split "*movhi_index_disp"
   [(set (match_operand:SI 0 "arith_reg_dest")
-	(zero_extend:SI (match_operand:HI 1 "mem_index_disp_operand")))]
+	(zero_extend:SI (match_operand:HI 1 "mem_index_disp_operand")))
+   (clobber (reg:SI T_REG))]
   "TARGET_SH1"
-  [(set (match_dup 0) (sign_extend:SI (match_dup 1)))
+  "#"
+  "&& 1"
+  [(parallel [(set (match_dup 0) (sign_extend:SI (match_dup 1)))
+	  (clobber (reg:SI T_REG))])
(set (match_dup 0) (zero_extend:SI (match_dup 2)))]
 {
   operands[2] = gen_lowpart (HImode, operands[0]);
@@ -5521,12 +5535,12 @@
 
 (define_insn_and_split "*movsi_index_disp"
   [(set (match_operand:SI 0 "mem_index_disp_operand" "=m")
-	(match_operand:SI 1 "arith_reg_operand" "r"))]
+	(match_operand:SI 1 "arith_reg_operand" "r"))
+   (clobber (reg:SI T_REG))]
   "TARGET_SH1"
   "#"
   "&& can_create_pseudo_p ()"
-  [(set (match_dup 5) (ashift:SI (match_dup 0) (match_dup 2)))
-   (set (match_dup 6) (plus:SI (match_dup 5) (match_dup 3)))
+ [(set (match_dup 6) (plus:SI (match_dup 5) (match_dup 3)))
(set (match_dup 7) (match_dup 1))]
 {
   rtx mem = operands[0];
@@ -5543,16 +5557,18 @@
   operands[7] =
 replace_equiv_address (mem,
 			   gen_rtx_PLUS (SImode, operands[6], operands[4]));
+
+  emit_insn (gen_ashlsi3 (operands[5], operands[0], operands[2]));
 })
 
 (define_insn_and_split "*movsi_index_disp"
   [(set (match_operand:HI 0 "mem_index_disp_operand" "=m")
-	(match_operand:HI 1 "arith_reg_operand" "r"))]
+	(match_operand:HI 1 "arith_reg_operand" "r"))
+   (clobber (reg:SI T_REG))]
   "TARGET_SH1"
   "#"
   "&& can_create_pseudo_p ()"
-  [(set (match_dup 5) (ashift:SI (match_dup 0) (match_dup 2)))
-   (set (match_dup 6) (plus:SI (match_dup 5) (match_dup 3)))
+  [(set (match_dup 6) (plus:SI (match_dup 5) (match_dup 3)))
(set (match_dup 7) (match_dup 1))]
 {
   rtx mem = operands[0];
@@ -5569,6 +5585,8 @@
   operands[7] =
 replace_equiv_address (mem,
 			   gen_rtx_PLUS (SImode, operands[6], operands[4]));
+
+  emit_insn (gen_ashlsi3 (operands[5], operands[0], operands[2]));
 })
 
 ;; Define additional pop for SH1 and SH2 so it does not get 


Re: [bootstrap] Tentative fix for PR 54281

2012-08-16 Thread Joseph S. Myers
On Thu, 16 Aug 2012, Diego Novillo wrote:

> diff --git a/gcc/intl.h b/gcc/intl.h
> index c4db354..745fefd 100644
> --- a/gcc/intl.h
> +++ b/gcc/intl.h
> @@ -27,8 +27,8 @@
>  # define setlocale(category, locale) (locale)
>  #endif
> 
> -#ifdef ENABLE_NLS
>  #include 
> +#ifdef ENABLE_NLS

I'm not sure it's safe to assume libintl.h exists on all hosts (e.g. 
MinGW) unless ENABLE_NLS.  (If ENABLE_NLS, the intl/ directory will have 
built that header if the host didn't have it.)

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


Re: [PATCH, ARM] Don't pull in unwinder for 64-bit division routines

2012-08-16 Thread Ramana Radhakrishnan

On 07/24/12 13:27, Julian Brown wrote:

On Fri, 20 Jul 2012 11:15:27 +0100
Julian Brown  wrote:


Anyway: this revised version of the patch removes the strange libgcc
Makefile-fragment changes, the equivalent of which have since been
incorporated into mainline GCC now anyway, so the patch is somewhat
more straightforward than it was previously.


Joey Ye contacted me offlist and suggested that the t-divmod-ef
fragment might be better integrated into t-bpabi instead. Doing that
makes the patch somewhat smaller/cleaner.

Minimally re-tested, looks OK.


The original submission makes no mention of testing ? The ARM specific 
portions look OK to me modulo no regressions.


Ian, can also take a quick look.

regards,
Ramana



Re: [bootstrap] Tentative fix for PR 54281

2012-08-16 Thread Diego Novillo

On 12-08-16 14:46 , Joseph S. Myers wrote:

On Thu, 16 Aug 2012, Diego Novillo wrote:


diff --git a/gcc/intl.h b/gcc/intl.h
index c4db354..745fefd 100644
--- a/gcc/intl.h
+++ b/gcc/intl.h
@@ -27,8 +27,8 @@
  # define setlocale(category, locale) (locale)
  #endif

-#ifdef ENABLE_NLS
  #include 
+#ifdef ENABLE_NLS


I'm not sure it's safe to assume libintl.h exists on all hosts (e.g.
MinGW) unless ENABLE_NLS.  (If ENABLE_NLS, the intl/ directory will have
built that header if the host didn't have it.)


I wonder if we couldn't simply '#define _LIBINTL_H 1' in the #else 
branch then.  Something like this (though it seems a bit hacky to me):


diff --git a/gcc/intl.h b/gcc/intl.h
index c4db354..3da4738 100644
--- a/gcc/intl.h
+++ b/gcc/intl.h
@@ -32,6 +32,9 @@
 extern void gcc_init_libintl (void);
 extern size_t gcc_gettext_width (const char *);
 #else
+/* Prevent libintl.h from being included, since we are truncating
+   some functions (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54281).  */
+# define _LIBINTL_H 1
 /* Stubs.  */
 # undef textdomain
 # define textdomain(domain) (domain)



Re: Merge C++ conversion into trunk (4/6 - hash table rewrite)

2012-08-16 Thread Lawrence Crowl
On 8/16/12, Richard Guenther  wrote:
> On Wed, 15 Aug 2012, Lawrence Crowl wrote:
> > On 8/15/12, Richard Henderson  wrote:
> > > On 2012-08-15 07:29, Richard Guenther wrote:
> > > > +   typedef typename Element::Element_t Element_t;
> > >
> > > Can we use something less ugly than Element_t?
> > > Such as
> > >
> > >   typedef typename Element::T T;
> > >
> > > ?  Given that this name is scoped anyway...
> >
> > I do not much like _t names either.
>
> The following is what I'm testing now, it also integrates the
> hashtable support functions and typedef within the existing local
> data types which is IMHO cleaner.  (it also shows we can do with
> a janitorial cleanup replacing typedef struct foo_d {} foo; with
> struct foo {}; and the likes)

Yes.

> Bootstrap and regtest ongoing on x86_64-unknown-linux-gnu, ok?

Looks good to me.

I would have prefered the Element->T rename in a separate patch
so that it is easier to see the core difference.

-- 
Lawrence Crowl


[SH] PR 54236 - Improve addc/subc utilization

2012-08-16 Thread Oleg Endo
Hello,

The attached patch improves the utilization of the addc and subc
instructions as mentioned in the PR.
Tested on rev 190396 with
make -k check RUNTESTFLAGS="--target_board=sh-sim
\{-m2/-ml,-m2/-mb,-m2a/-mb,-m4/-ml,-m4/-mb,-m4a/-ml,-m4a/-mb}"

and no new failures.
I've also briefly checked the CSiBE result-size for 'm4-single -ml -O2
-mpretend-cmove'.  There is a little bit of noise here and there due to
differences in insn scheduling/ordering.  Looking at some parts of
mpeg2dec, the new insn sequences seem to be beneficial for a couple of
functions.
OK?

Cheers,
Oleg

ChangeLog:

PR target/54236
* config/sh/sh.md (addc): Add commutative modifier.
(*addc, *minus_plus_one, *subc, *negc): New insns and splits.

testsuite/ChangeLog:

PR target/54236
* gcc.target/sh/pr54236-1.c: New.
Index: gcc/testsuite/gcc.target/sh/pr54236-1.c
===
--- gcc/testsuite/gcc.target/sh/pr54236-1.c	(revision 0)
+++ gcc/testsuite/gcc.target/sh/pr54236-1.c	(revision 0)
@@ -0,0 +1,76 @@
+/* Tests to check the utilization of addc, subc and negc instructions in
+   special cases.  If everything works as expected we won't see any
+   movt instructions in these cases.  */
+/* { dg-do compile { target "sh*-*-*" } } */
+/* { dg-options "-O1" } */
+/* { dg-skip-if "" { "sh*-*-*" } { "-m5*"} { "" } } */
+/* { dg-final { scan-assembler-times "addc" 3 } } */
+/* { dg-final { scan-assembler-times "subc" 3 } } */
+/* { dg-final { scan-assembler-times "sett" 4 } } */
+/* { dg-final { scan-assembler-times "negc" 1 } } */
+/* { dg-final { scan-assembler-not "movt" } } */
+
+int
+test_00 (int a, int b, int c, int d)
+{
+  /* 1x addc, 1x sett  */
+  return a + b + 1;
+}
+
+int
+test_01 (int a, int b, int c, int d)
+{
+  /* 1x addc  */
+  return a + (c == d);
+}
+
+int
+test_02 (int a, int b, int c, int d)
+{
+  /* 1x subc, 1x sett  */
+  return a - b - 1;
+}
+
+int
+test_03 (int a, int b, int c, int d)
+{
+  /* 1x subc  */
+  return a - (c == d);
+}
+
+int
+test_04 (int a, int b, int c, int d)
+{
+  /* 1x addc, 1x sett  */
+  return a + b + c + 1;
+}
+
+int
+test_05 (int a, int b, int c, int d)
+{
+  /* 1x subc, 1x sett  */
+  return a - b - c - 1;
+}
+
+int
+test_06 (int a, int b, int c, int d)
+{
+  /* 1x negc  */
+  return 0 - a - (b == c);
+}
+
+int
+test_07 (int *vec)
+{
+  /* Must not see a 'sett' or 'addc' here.
+ This is a case where combine tries to produce
+ 'a + (0 - b) + 1' out of 'a - b + 1'.  */
+  int z = vec[0];
+  int vi = vec[1];
+  int zi = vec[2];
+
+  if (zi != 0 && z < -1)
+vi -= (((vi >> 7) & 0x01) << 1) - 1;
+
+  return vi;
+}
Index: gcc/config/sh/sh.md
===
--- gcc/config/sh/sh.md	(revision 190396)
+++ gcc/config/sh/sh.md	(working copy)
@@ -1686,7 +1686,7 @@
 
 (define_insn "addc"
   [(set (match_operand:SI 0 "arith_reg_dest" "=r")
-	(plus:SI (plus:SI (match_operand:SI 1 "arith_reg_operand" "0")
+	(plus:SI (plus:SI (match_operand:SI 1 "arith_reg_operand" "%0")
 			  (match_operand:SI 2 "arith_reg_operand" "r"))
 		 (reg:SI T_REG)))
(set (reg:SI T_REG)
@@ -1695,6 +1695,76 @@
   "addc	%2,%0"
   [(set_attr "type" "arith")])
 
+;; A simplified version of the addc insn, where the exact value of the
+;; T bit doesn't matter.  This is easier for combine to pick up.
+;; We allow a reg or 0 for one of the operands in order to be able to
+;; do 'reg + T' sequences.  Reload will load the constant 0 into the reg
+;; as needed.
+(define_insn "*addc"
+  [(set (match_operand:SI 0 "arith_reg_dest" "=r")
+	(plus:SI (plus:SI (match_operand:SI 1 "arith_reg_operand" "%0")
+			  (match_operand:SI 2 "arith_reg_or_0_operand" "r"))
+		 (match_operand:SI 3 "t_reg_operand" "")))
+   (clobber (reg:SI T_REG))]
+  "TARGET_SH1"
+  "addc	%2,%0"
+  [(set_attr "type" "arith")])
+
+;; Split 'reg + reg + 1' into a sett addc sequence, as it can be scheduled
+;; better, if the sett insn can be done early.
+(define_insn_and_split "*addc"
+  [(set (match_operand:SI 0 "arith_reg_dest" "")
+	(plus:SI (plus:SI (match_operand:SI 1 "arith_reg_operand" "")
+			  (match_operand:SI 2 "arith_reg_operand" ""))
+		 (const_int 1)))
+   (clobber (reg:SI T_REG))]
+  "TARGET_SH1"
+  "#"
+  "&& 1"
+  [(set (reg:SI T_REG) (const_int 1))
+   (parallel [(set (match_dup 0) (plus:SI (plus:SI (match_dup 1) (match_dup 2))
+  (reg:SI T_REG)))
+	  (clobber (reg:SI T_REG))])])
+
+;; Sometimes combine will try to do 'reg + (0-reg) + 1' if the *addc pattern
+;; matched.  Split this up into a simple sub add sequence, as this will save
+;; us one sett insn.
+(define_insn_and_split "*minus_plus_one"
+  [(set (match_operand:SI 0 "arith_reg_dest" "")
+	(plus:SI (minus:SI (match_operand:SI 1 "arith_reg_operand" "")
+			   (match_operand:SI 2 "arith_reg_operand" ""))
+		 (const_int 1)))]
+  "TARGET_SH1"
+  "#"
+  "&& 1"
+  [(set (match_dup 0) (minus:SI (match_dup 1) (match_dup 2)))
+   (set (match_

Re: C++ PR 54197: lifetime of reference not properly extended

2012-08-16 Thread Gabriel Dos Reis
On Wed, Aug 15, 2012 at 9:52 AM, Ollie Wild  wrote:
> (Adding other C++ maintainers in case someone else wants to have a stab.)
>
> Ping?

I consider Jason to be the expert on this; so let see what he says.

-- Gaby


>
> Ollie
>
>
> On Mon, Aug 13, 2012 at 4:01 PM, Ollie Wild  wrote:
>>
>> On Mon, Aug 13, 2012 at 3:50 PM, Jakub Jelinek  wrote:
>> >
>> > The formatting doesn't match GCC coding conventions in several ways.
>> > You don't have spaces before (, and ( shouldn't be at the end of line if
>> > possible.
>>
>> Updated patch attached.
>>
>> Ollie


Re: [bootstrap] Tentative fix for PR 54281

2012-08-16 Thread Diego Novillo

On 12-08-16 15:00 , Diego Novillo wrote:

On 12-08-16 14:46 , Joseph S. Myers wrote:

On Thu, 16 Aug 2012, Diego Novillo wrote:


diff --git a/gcc/intl.h b/gcc/intl.h
index c4db354..745fefd 100644
--- a/gcc/intl.h
+++ b/gcc/intl.h
@@ -27,8 +27,8 @@
  # define setlocale(category, locale) (locale)
  #endif

-#ifdef ENABLE_NLS
  #include 
+#ifdef ENABLE_NLS


I'm not sure it's safe to assume libintl.h exists on all hosts (e.g.
MinGW) unless ENABLE_NLS.  (If ENABLE_NLS, the intl/ directory will have
built that header if the host didn't have it.)


I wonder if we couldn't simply '#define _LIBINTL_H 1' in the #else
branch then.  Something like this (though it seems a bit hacky to me):


This is the patch I'm currently testing.  I need someone with a very old 
toolchain (4.1 or earlier) to also give this a try (the original problem 
does not occur in g++ more recent than 4.1).



Thanks.  Diego.

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index a8ff00d..8798b8f 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,11 @@
 2012-08-16   Diego Novillo  

+   PR bootstrap/54281
+   * intl.h: Prevent libintl.h from being included when
+   ENABLE_NLS is not set.
+
+2012-08-16   Diego Novillo  
+
Revert

PR bootstrap/54281
diff --git a/gcc/intl.h b/gcc/intl.h
index c4db354..e10e357 100644
--- a/gcc/intl.h
+++ b/gcc/intl.h
@@ -32,6 +32,11 @@
 extern void gcc_init_libintl (void);
 extern size_t gcc_gettext_width (const char *);
 #else
+/* Prevent libintl.h from being included, since we are truncating
+   some functions (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54281).  */
+# ifndef _LIBINTL_H
+# define _LIBINTL_H 1
+# endif
 /* Stubs.  */
 # undef textdomain
 # define textdomain(domain) (domain)


Re: [PATCH, MIPS] DSP ALU scheduling

2012-08-16 Thread Richard Sandiford
Sandra Loosemore  writes:
> @@ -569,7 +569,7 @@
>  UNSPEC_DPAU_H_QBL))]
>"ISA_HAS_DSP && !TARGET_64BIT"
>"dpau.h.qbl\t%q0,%2,%3"
> -  [(set_attr "type"  "imadd")
> +  [(set_attr "type"  "dspmac")
> (set_attr "mode"  "SI")])
>  
>  (define_insn "mips_dpau_h_qbr"
> @@ -580,7 +580,7 @@
>  UNSPEC_DPAU_H_QBR))]
>"ISA_HAS_DSP && !TARGET_64BIT"
>"dpau.h.qbr\t%q0,%2,%3"
> -  [(set_attr "type"  "imadd")
> +  [(set_attr "type"  "dspmac")
> (set_attr "mode"  "SI")])
>  
>  ;; DPSU*
> @@ -592,7 +592,7 @@
>  UNSPEC_DPSU_H_QBL))]
>"ISA_HAS_DSP && !TARGET_64BIT"
>"dpsu.h.qbl\t%q0,%2,%3"
> -  [(set_attr "type"  "imadd")
> +  [(set_attr "type"  "dspmac")
> (set_attr "mode"  "SI")])
>  
>  (define_insn "mips_dpsu_h_qbr"
> @@ -603,7 +603,7 @@
>  UNSPEC_DPSU_H_QBR))]
>"ISA_HAS_DSP && !TARGET_64BIT"
>"dpsu.h.qbr\t%q0,%2,%3"
> -  [(set_attr "type"  "imadd")
> +  [(set_attr "type"  "dspmac")
> (set_attr "mode"  "SI")])
>  
>  ;; DPAQ*
> @@ -619,7 +619,7 @@
>   UNSPEC_DPAQ_S_W_PH))])]
>"ISA_HAS_DSP && !TARGET_64BIT"
>"dpaq_s.w.ph\t%q0,%2,%3"
> -  [(set_attr "type"  "imadd")
> +  [(set_attr "type"  "dspmac")
> (set_attr "mode"  "SI")])
>  
>  ;; DPSQ*
> @@ -635,7 +635,7 @@
>   UNSPEC_DPSQ_S_W_PH))])]
>"ISA_HAS_DSP && !TARGET_64BIT"
>"dpsq_s.w.ph\t%q0,%2,%3"
> -  [(set_attr "type"  "imadd")
> +  [(set_attr "type"  "dspmac")
> (set_attr "mode"  "SI")])
>  
>  ;; MULSAQ*
> @@ -651,7 +651,7 @@
>   UNSPEC_MULSAQ_S_W_PH))])]
>"ISA_HAS_DSP && !TARGET_64BIT"
>"mulsaq_s.w.ph\t%q0,%2,%3"
> -  [(set_attr "type"  "imadd")
> +  [(set_attr "type"  "dspmac")
> (set_attr "mode"  "SI")])
>  
>  ;; DPAQ*
> @@ -667,7 +667,7 @@
>   UNSPEC_DPAQ_SA_L_W))])]
>"ISA_HAS_DSP && !TARGET_64BIT"
>"dpaq_sa.l.w\t%q0,%2,%3"
> -  [(set_attr "type"  "imadd")
> +  [(set_attr "type"  "dspmacsat")
> (set_attr "mode"  "SI")])
>  
>  ;; DPSQ*
> @@ -683,7 +683,7 @@
>   UNSPEC_DPSQ_SA_L_W))])]
>"ISA_HAS_DSP && !TARGET_64BIT"
>"dpsq_sa.l.w\t%q0,%2,%3"
> -  [(set_attr "type"  "imadd")
> +  [(set_attr "type"  "dspmacsat")
> (set_attr "mode"  "SI")])
>  
>  ;; MAQ*
> @@ -699,7 +699,7 @@
>   UNSPEC_MAQ_S_W_PHL))])]
>"ISA_HAS_DSP && !TARGET_64BIT"
>"maq_s.w.phl\t%q0,%2,%3"
> -  [(set_attr "type"  "imadd")
> +  [(set_attr "type"  "dspmac")
> (set_attr "mode"  "SI")])
>  
>  (define_insn "mips_maq_s_w_phr"
> @@ -714,7 +714,7 @@
>   UNSPEC_MAQ_S_W_PHR))])]
>"ISA_HAS_DSP && !TARGET_64BIT"
>"maq_s.w.phr\t%q0,%2,%3"
> -  [(set_attr "type"  "imadd")
> +  [(set_attr "type"  "dspmac")
> (set_attr "mode"  "SI")])
>  
>  ;; MAQ_SA*
> @@ -730,7 +730,7 @@
>   UNSPEC_MAQ_SA_W_PHL))])]
>"ISA_HAS_DSP && !TARGET_64BIT"
>"maq_sa.w.phl\t%q0,%2,%3"
> -  [(set_attr "type"  "imadd")
> +  [(set_attr "type"  "dspmacsat")
> (set_attr "mode"  "SI")])
>  
>  (define_insn "mips_maq_sa_w_phr"
> @@ -745,7 +745,7 @@
>   UNSPEC_MAQ_SA_W_PHR))])]
>"ISA_HAS_DSP && !TARGET_64BIT"
>"maq_sa.w.phr\t%q0,%2,%3"
> -  [(set_attr "type"  "imadd")
> +  [(set_attr "type"  "dspmacsat")
> (set_attr "mode"  "SI")])

I think all these want (set_attr "accum_in" "1") too.

Richard


Re: [PATCH, ARM] Don't pull in unwinder for 64-bit division routines

2012-08-16 Thread Julian Brown
On Thu, 16 Aug 2012 19:56:52 +0100
Ramana Radhakrishnan  wrote:

> On 07/24/12 13:27, Julian Brown wrote:
> > On Fri, 20 Jul 2012 11:15:27 +0100
> > Julian Brown  wrote:
> >
> >> Anyway: this revised version of the patch removes the strange
> >> libgcc Makefile-fragment changes, the equivalent of which have
> >> since been incorporated into mainline GCC now anyway, so the patch
> >> is somewhat more straightforward than it was previously.
> >
> > Joey Ye contacted me offlist and suggested that the t-divmod-ef
> > fragment might be better integrated into t-bpabi instead. Doing that
> > makes the patch somewhat smaller/cleaner.
> >
> > Minimally re-tested, looks OK.
> 
> The original submission makes no mention of testing ? The ARM
> specific portions look OK to me modulo no regressions.

Thanks -- I'm sure I did test the patch, but just omitted to mention
that fact in the mail :-O. We've also been carrying a version of this
patch in our local source base for many years now.

> Ian, can also take a quick look.

Cheers,

Julian


Re: Reproducible gcc builds, gfortran, and -grecord-gcc-switches

2012-08-16 Thread Jakub Jelinek
On Thu, Aug 16, 2012 at 06:59:09PM +0200, Simon Baldwin wrote:
> On 16 August 2012 16:40, Michael Matz  wrote:
> >
> > ,,,
> >
> > Do you have considered to use a new option flag (usable in the .opt files)
> > instead of a langhook?  I.e. add a flag cl_dont_record to cl_option, a
> > string Norecord for the .opt files, some handling for it in
> > opt-functions.awk and the like?
> >
> > Adding lang-hooks used by debug producers make me twitch :)
> 
> Okay.  Below is an alternative approach.
> 
> I've moved discussion to gcc-patches, since it's now more concrete
> than abstract.

You could have just added
  case OPT_cpp_:
to the switch in gen_producer_string, instead of all this.

> --- gcc/dwarf2out.c   (revision 190442)
> +++ gcc/dwarf2out.c   (working copy)
> @@ -18101,6 +18101,9 @@ gen_producer_string (void)
>   /* Ignore these.  */
>   continue;
>default:
> +if (cl_options[save_decoded_options[j].opt_index].flags
> + & CL_NO_DWARF_RECORD)
> +   continue;
>  gcc_checking_assert (save_decoded_options[j].canonical_option[0][0]
>== '-');
>  switch (save_decoded_options[j].canonical_option[0][1])

Jakub


Re: LEA-splitting improvement patch.

2012-08-16 Thread Uros Bizjak
On Wed, Aug 15, 2012 at 12:58 PM, Yuri Rumyantsev  wrote:

> I send you new patch with fixed space/tab alignments.
>
> About your comment.
>
> It is more optimal to put adding of constant before adding of the
> register only for case when 3 instructions must be generated to split
> lea. In all other cases it does not matter and I left code
> unchangeable.

I have cleaned patch a bit and committed the patch to mainline SVN.

Thanks,
Uros.


[committed] TILE-Gx/TILEPro: add stub header file

2012-08-16 Thread Walter Lee

This patch adds a stub header file "feedback.h," needed to compile
glibc and linux.

Walter

Index: gcc/config.gcc
===
--- gcc/config.gcc  (revision 190448)
+++ gcc/config.gcc  (working copy)
@@ -2440,6 +2440,7 @@ tilegx-*-linux*)
extra_objs="mul-tables.o"
c_target_objs="tilegx-c.o"
cxx_target_objs="tilegx-c.o"
+   extra_headers="feedback.h"
;;
 tilepro-*-linux*)
tm_file="elfos.h gnu-user.h linux.h glibc-stdint.h tilepro/linux.h 
${tm_file}"
@@ -2447,6 +2448,7 @@ tilepro-*-linux*)
extra_objs="mul-tables.o"
c_target_objs="tilepro-c.o"
cxx_target_objs="tilepro-c.o"
+   extra_headers="feedback.h"
;;
 v850-*-rtems*)
target_cpu_default="TARGET_CPU_generic"
Index: gcc/config/tilegx/feedback.h
===
--- gcc/config/tilegx/feedback.h(revision 0)
+++ gcc/config/tilegx/feedback.h(revision 0)
@@ -0,0 +1 @@
+/* This file is currently empty and serves as a placeholder.  */
Index: gcc/config/tilepro/feedback.h
===
--- gcc/config/tilepro/feedback.h   (revision 0)
+++ gcc/config/tilepro/feedback.h   (revision 0)
@@ -0,0 +1 @@
+/* This file is currently empty and serves as a placeholder.  */


Re: [C PATCH] -Wsizeof-pointer-memaccess warning

2012-08-16 Thread Joseph S. Myers
On Thu, 16 Aug 2012, Jakub Jelinek wrote:

> Hi!
> 
> On Wed, Aug 15, 2012 at 04:29:55PM +, Joseph S. Myers wrote:
> > On Wed, 15 Aug 2012, Jakub Jelinek wrote:
> > 
> > > I was mainly interested in whether such an approach is acceptable, or
> > > whether I need to stop evaluating sizeof right away, create SIZEOF_EXPR
> > > and only fold it during fully_fold*.  I've briefly looked at that today,
> > 
> > The approach is fine.  Delaying evaluating sizeof is hard simply because 
> > of the expectation that integer constant expressions in general are 
> > evaluated early.
> 
> Ok, thanks.  Here is an updated patch, which gets away just with one global
> variable (location_t computed from token after sizeof keyword in the
> caller).  Bootstrapped/regtested on x86_64-linux and i686-linux, ok for
> trunk?

This version is OK.

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


Re: [RFA:] fix PR54261, reverse operator emitted for compare_and_swap-libfunc targets

2012-08-16 Thread Hans-Peter Nilsson
> From: Hans-Peter Nilsson 
> Date: Wed, 15 Aug 2012 02:20:37 +0200

> I looked around and it seems only cris{v32,}-axis-linux-gnu is
> affected.  Still, besides that target, for a 4.7/r189762 import
> and c/c++ testing, boot+regtest in progress for x86_64-linux and
> cross-test for cris-axis-elf.  The test-case is spot-checked to
> pass for a target not implementing any atomics whatsoever,
> i.e. mmix-knuth-mmixware.

(clean test-results)

> Ok for trunk, assuming clean test-results?  Maybe 4.7 too, it
> being somewhat trivial?
> 
> gcc:
>   PR middle-end/54261
>   * optabs.c (expand_atomic_fetch_op): Save and restore code when
>   retrying after failed attempt.
> 
> gcc/testsuite:
>   PR middle-end/54261
>   * gcc.dg/torture/pr54261-1.c: New test.

Approved on IRC by dnovillo, committed.  A backport to 4.7 is
trivial but AFAIK not affecting any FSF target so I'll drop
that; affected private ports have to have maintainers skilled
enough to find this post.

brgds, H-P


Re: [SH] PR 54089

2012-08-16 Thread Kaz Kojima
Oleg Endo  wrote:
> This fixes the case where a dynamic shift would expand into a P27 shift
> sequence that clobbers T_REG, which would result in wrong code.
> Tested on rev 190396 with
> make -k check RUNTESTFLAGS="--target_board=sh-sim
> \{-m2/-ml,-m2/-mb,-m2a/-mb,-m4/-ml,-m4/-mb,-m4a/-ml,-m4a/-mb}"
> 
> and no new failures.
> OK?

OK.

Regards,
kaz


Re: [SH] PR 39423

2012-08-16 Thread Kaz Kojima
Oleg Endo  wrote:
> This fixes the issue mentioned in the PR's comment #29.
> Tested on rev 190396 with
> make -k check RUNTESTFLAGS="--target_board=sh-sim
> \{-m2/-ml,-m2/-mb,-m2a/-mb,-m4/-ml,-m4/-mb,-m4a/-ml,-m4a/-mb}"
> 
> and no new failures.
> OK?

OK.

Regards,
kaz


Re: [SH] PR 54236 - Improve addc/subc utilization

2012-08-16 Thread Kaz Kojima
Oleg Endo  wrote:
> The attached patch improves the utilization of the addc and subc
> instructions as mentioned in the PR.
> Tested on rev 190396 with
> make -k check RUNTESTFLAGS="--target_board=sh-sim
> \{-m2/-ml,-m2/-mb,-m2a/-mb,-m4/-ml,-m4/-mb,-m4a/-ml,-m4a/-mb}"
> 
> and no new failures.
> I've also briefly checked the CSiBE result-size for 'm4-single -ml -O2
> -mpretend-cmove'.  There is a little bit of noise here and there due to
> differences in insn scheduling/ordering.  Looking at some parts of
> mpeg2dec, the new insn sequences seem to be beneficial for a couple of
> functions.
> OK?

OK.

Regards,
kaz


[PATCH] PR c++/53540 - using fails to be equivalent to typedef

2012-08-16 Thread Dodji Seketeli
Hello,

In the example of this problem report, during the substituting of int
into 'function', tsubst_aggr_type fails for the alias ctxt1.  This is
because TYPE_TEMPLATE_INFO looks for the TEMPLATE_INFO of the ctxt1
alias at the wrong place and was wrongly finding it to be NULL.
Namely, it was looking for it in the DECL_TEMPLATE_INFO of the
declaration of the type -- as if ctxt1 was an alias template
specialization -- rather than looking of it in its
CLASSTYPE_TEMPLATE_INFO.

Fixed thus.  The second hunk of the patch is just to prevent the
compiler from crashing when primary_template_instantiation_p is passed
an alias of a class template instantiation.

Bootstrapped and tested on x86_64-unknown-linux-gnu against trunk.

gcc/cp

* cp-tree.h (TYPE_TEMPLATE_INFO): For an alias that is not an
instance of alias template, don't look for its TEMPLATE_INFO in
its declaration.
* pt.c (primary_template_instantiation_p): Don't crash on an alias
that is not an instance of a template.

gcc/testsuite/

* g++.dg/cpp0x/alias-decl-21.C: New test.
---
 gcc/cp/cp-tree.h   |4 ++--
 gcc/cp/pt.c|1 +
 gcc/testsuite/g++.dg/cpp0x/alias-decl-21.C |   24 
 3 files changed, 27 insertions(+), 2 deletions(-)
 create mode 100644 gcc/testsuite/g++.dg/cpp0x/alias-decl-21.C

diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 44f3ac1..64a8830 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -2634,8 +2634,8 @@ extern void decl_shadowed_for_var_insert (tree, tree);
template info for the alias template, not the one (if any) for the
template of the underlying type.  */
 #define TYPE_TEMPLATE_INFO(NODE)   \
-  (TYPE_ALIAS_P (NODE) \
-   ? ((TYPE_NAME (NODE) && DECL_LANG_SPECIFIC (TYPE_NAME (NODE)))  \
+  ((TYPE_ALIAS_P (NODE) && DECL_LANG_SPECIFIC (TYPE_NAME (NODE)))  \
+   ? (DECL_LANG_SPECIFIC (TYPE_NAME (NODE))\
   ? DECL_TEMPLATE_INFO (TYPE_NAME (NODE))  \
   : NULL_TREE) \
: ((TREE_CODE (NODE) == ENUMERAL_TYPE)  \
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index ad81bab..3163bd4 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -2854,6 +2854,7 @@ primary_template_instantiation_p (const_tree t)
   else if (TYPE_P (t)
   && TYPE_TEMPLATE_INFO (t)
   && PRIMARY_TEMPLATE_P (TYPE_TI_TEMPLATE (t))
+  && DECL_LANG_SPECIFIC (TYPE_NAME (t))
   && DECL_TEMPLATE_INSTANTIATION (TYPE_NAME (t)))
 return true;
   return false;
diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-21.C 
b/gcc/testsuite/g++.dg/cpp0x/alias-decl-21.C
new file mode 100644
index 000..b68fa93
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-21.C
@@ -0,0 +1,24 @@
+// Origin: PR c++/53540
+// { dg-do compile { target c++11 } }
+
+template 
+struct context
+{
+  typedef int type;
+};
+
+template 
+void function()
+{
+  using ctx1 = context;
+  typename ctx1::type f1;
+
+  typedef context ctx2;
+  typename ctx2::type f2;
+}
+
+int main()
+{
+  function();
+}
+
-- 
Dodji


Re: [PATCH] Set correct source location for deallocator calls

2012-08-16 Thread Dehao Chen
ping.

Thanks,
Dehao

On Fri, Aug 10, 2012 at 8:38 PM, Dehao Chen  wrote:
> New patch attached.
>
> Bootstrapped and passed GCC regression tests.
>
> Ok for trunk?
>
> Thanks,
> Dehao
>
> gcc/ChangeLog
> 2012-08-07  Dehao Chen  
>
>  * tree-eh.c (goto_queue_node): New field.
> (record_in_goto_queue): New parameter.
> (record_in_goto_queue_label): New parameter.
> (lower_try_finally_dup_block): New parameter.
> (maybe_record_in_goto_queue): Update source location.
> (lower_try_finally_copy): Likewise.
> (honor_protect_cleanup_actions): Likewise.
> * gimplify.c (gimplify_expr): Reset the location to unknown.
>
> gcc/testsuite/ChangeLog
> 2012-08-07  Dehao Chen  
>
> * g++.dg/guality/deallocator.C: New test.
> Index: gcc/testsuite/g++.dg/guality/deallocator.C
> ===
> *** gcc/testsuite/g++.dg/guality/deallocator.C  (revision 0)
> --- gcc/testsuite/g++.dg/guality/deallocator.C  (revision 0)
> ***
> *** 0 
> --- 1,33 
> + // Test that debug info generated for auto-inserted deallocator is
> + // correctly attributed.
> + // This patch scans for the lineno directly from assembly, which may
> + // differ between different architectures. Because it mainly tests
> + // FE generated debug info, without losing generality, only x86
> + // assembly is scanned in this test.
> + // { dg-do compile { target { i?86-*-* x86_64-*-* } } }
> + // { dg-options "-O2 -fno-exceptions -g" }
> +
> + struct t {
> +   t ();
> +   ~t ();
> +   void foo();
> +   void bar();
> + };
> +
> + int bar();
> +
> + void foo(int i)
> + {
> +   for (int j = 0; j < 10; j++)
> + {
> +   t test;
> +   test.foo();
> +   if (i + j)
> +   {
> + test.bar();
> + return;
> +   }
> + }
> +   return;
> + }
> + // { dg-final { scan-assembler "1 28 0" } }
> Index: gcc/tree-eh.c
> ===
> *** gcc/tree-eh.c   (revision 190209)
> --- gcc/tree-eh.c   (working copy)
> *** static bitmap eh_region_may_contain_thro
> *** 321,326 
> --- 321,327 
>   struct goto_queue_node
>   {
> treemple stmt;
> +   location_t location;
> gimple_seq repl_stmt;
> gimple cont_stmt;
> int index;
> *** static void
> *** 560,566 
>   record_in_goto_queue (struct leh_tf_state *tf,
> treemple new_stmt,
> int index,
> !   bool is_label)
>   {
> size_t active, size;
> struct goto_queue_node *q;
> --- 561,568 
>   record_in_goto_queue (struct leh_tf_state *tf,
> treemple new_stmt,
> int index,
> !   bool is_label,
> ! location_t location)
>   {
> size_t active, size;
> struct goto_queue_node *q;
> *** record_in_goto_queue (struct leh_tf_stat
> *** 583,588 
> --- 585,591 
> memset (q, 0, sizeof (*q));
> q->stmt = new_stmt;
> q->index = index;
> +   q->location = location;
> q->is_label = is_label;
>   }
>
> *** record_in_goto_queue (struct leh_tf_stat
> *** 590,596 
>  TF is not null.  */
>
>   static void
> ! record_in_goto_queue_label (struct leh_tf_state *tf, treemple stmt,
> tree label)
>   {
> int index;
> treemple temp, new_stmt;
> --- 593,600 
>  TF is not null.  */
>
>   static void
> ! record_in_goto_queue_label (struct leh_tf_state *tf, treemple stmt,
> tree label,
> !   location_t location)
>   {
> int index;
> treemple temp, new_stmt;
> *** record_in_goto_queue_label (struct leh_t
> *** 629,635 
>since with a GIMPLE_COND we have an easy access to the then/else
>labels. */
> new_stmt = stmt;
> !   record_in_goto_queue (tf, new_stmt, index, true);
>   }
>
>   /* For any GIMPLE_GOTO or GIMPLE_RETURN, decide whether it leaves a
> try_finally
> --- 633,639 
>since with a GIMPLE_COND we have an easy access to the then/else
>labels. */
> new_stmt = stmt;
> !   record_in_goto_queue (tf, new_stmt, index, true, location);
>   }
>
>   /* For any GIMPLE_GOTO or GIMPLE_RETURN, decide whether it leaves a
> try_finally
> *** maybe_record_in_goto_queue (struct leh_s
> *** 649,667 
>   {
>   case GIMPLE_COND:
> new_stmt.tp = gimple_op_ptr (stmt, 2);
> !   record_in_goto_queue_label (tf, new_stmt,
> gimple_cond_true_label (stmt));
> new_stmt.tp = gimple_op_ptr (stmt, 3);
> !   record_in_goto_queue_label (tf, new_stmt,
> gimple_cond_false_label (stmt));
> break;
>   case GIMPLE_GOTO:
> new_stmt.g = stmt;
> !   record_in_goto_queue_label (tf, new_stmt, gimple_goto_dest (stmt));
> break;
>
>   case GIMPLE_RETURN:
> tf->may_return = true;
> new_stmt.g = s

Committed: add cris-* and crisv32-* to lists in sync_int_long and sync_char_short

2012-08-16 Thread Hans-Peter Nilsson
See also PR54261 and gcc.dg/torture/pr54261-1.c.

I was about to also add an #elif defined (__CRIS__) in cas_int
(which commendably uses __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 but
nevertheless needs to be manually enabled because of PR54266),
but cas_int only guards test-cases that grep dumps for
tree/gimple things that for some reason are absent in absence of
MD patterns, so I'm dropping that; there's little point in
enabling cas_int and xfailing all tests using it.

Committed, all now enabled test-cases pass for cris-elf and FWIW
the local 4.7 import for crisv32-axis-linux-gnu.

gcc/testsuite:
* lib/target-supports.exp (check_effective_target_sync_int_long)
(check_effective_target_sync_char_short): Enable for crisv32-*
and cris-*.

diff --git a/gcc/testsuite/lib/target-supports.exp 
b/gcc/testsuite/lib/target-supports.exp
index e286e64..968d6e7 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -4033,6 +4033,7 @@ proc check_effective_target_sync_int_long { } {
 || [istarget hppa*-*linux*]
 || [istarget s390*-*-*] 
 || [istarget powerpc*-*-*]
+|| [istarget crisv32-*-*] || [istarget cris-*-*]
 || ([istarget sparc*-*-*] && [check_effective_target_sparc_v9])
 || [check_effective_target_mips_llsc] } {
set et_sync_int_long_saved 1
@@ -4062,6 +4063,7 @@ proc check_effective_target_sync_char_short { } {
 || [istarget hppa*-*linux*]
 || [istarget s390*-*-*] 
 || [istarget powerpc*-*-*]
+|| [istarget crisv32-*-*] || [istarget cris-*-*]
 || ([istarget sparc*-*-*] && [check_effective_target_sparc_v9])
 || [check_effective_target_mips_llsc] } {
set et_sync_char_short_saved 1

brgds, H-P


Re: Interaction between first stage build with g++ and $PATH

2012-08-16 Thread Mike Stump
On Aug 15, 2012, at 10:17 PM, Gary Funck wrote:
> 1. I have "." on $PATH.

Yeah, the problem is we build up g++ instead of xg++; gcc builds up as xgcc for 
a reason.  Search xgcc, and g++, and modify g++ to look like xgcc.

. is never a security problem, if you never cd to a directory that you don't 
own.  :-)


[Google 4.7] Generate pubnames compatible with gdb-index version 7. (issue6459099)

2012-08-16 Thread Sterling Augustine
The enclosed patch adds a new option -ggnu-pubnames to solve the problem that
current pubnames don't supply enough information for Gold to generate a version
7 gdb index.

The patch encodes the flag byte from gdb-index version 7, and saves it between
the offset and name in the pubtype. We can't generate the index entry directly
because the cu_index is calculated during the link, but we can generate the
flag byte.

Of particular note is the fact that this patch adds include/gdb/gdb-index.h
from the gdb and binutils trees.

OK for google 4.7?

Sterling


2012-08-16  Sterling Augustine  

gcc/ChangeLog
* dwarf2out.c (DEBUG_PUBNAMES_SECTION, DEBUG_PUBTYPES_SECTION): Adjust
macros.
(is_java, include_pubname_in_output): New functions.
(size_of_pubnames): Call include_pubname_in_output.  New variable
space_for_flags.
(output_pubnames): Refactor, moving most of the logic to...
(output_pubname): ... here.  New function.
(dwarf2out_finish): Move output pubtable logic to...
(output_pubtables): ... here.  New function.
* common.opt (ggnu-pubnames):  New option.
* doc/invoke.texi: Document it.

include/ChangeLog:
* gdb/gdb-index.h: Check in from src.

Index: dwarf2out.c
===
--- dwarf2out.c (revision 190448)
+++ dwarf2out.c (working copy)
@@ -96,6 +96,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "cfglayout.h"
 #include "opts.h"
 #include "l-ipo.h"
+#include "gdb/gdb-index.h"
 
 static void dwarf2out_source_line (unsigned int, const char *, int, bool);
 static rtx last_var_location_insn;
@@ -3634,10 +3635,14 @@ new_addr_loc_descr (rtx addr, int dtprel)
 #define DEBUG_DWO_LOC_SECTION  ".debug_loc.dwo"
 #endif
 #ifndef DEBUG_PUBNAMES_SECTION
-#define DEBUG_PUBNAMES_SECTION ".debug_pubnames"
+#define DEBUG_PUBNAMES_SECTION \
+  ((debug_generate_pub_sections == 2) \
+   ? ".debug_gnu_pubnames" : ".debug_pubnames")
 #endif
 #ifndef DEBUG_PUBTYPES_SECTION
-#define DEBUG_PUBTYPES_SECTION ".debug_pubtypes"
+#define DEBUG_PUBTYPES_SECTION \
+  ((debug_generate_pub_sections == 2) \
+   ? ".debug_gnu_pubtypes" : ".debug_pubtypes")
 #endif
 #define DEBUG_NORM_STR_OFFSETS_SECTION ".debug_str_offsets"
 #define DEBUG_DWO_STR_OFFSETS_SECTION ".debug_str_offsets.dwo"
@@ -5148,6 +5153,16 @@ is_cxx (void)
   return lang == DW_LANG_C_plus_plus || lang == DW_LANG_ObjC_plus_plus;
 }
 
+/* Return TRUE if the language is Java.  */
+
+static inline bool
+is_java (void)
+{
+  unsigned int lang = get_AT_unsigned (comp_unit_die (), DW_AT_language);
+
+  return lang == DW_LANG_Java;
+}
+
 /* Return TRUE if the language is Fortran.  */
 
 static inline bool
@@ -8257,22 +8272,32 @@ unmark_all_dies (dw_die_ref die)
   unmark_all_dies (AT_ref (a));
 }
 
+/* Calculate if the entry should appear in the final output file.  It may be
+   from a pruned a type.  */
+
+static bool
+include_pubname_in_output (VEC (pubname_entry, gc) *table, pubname_entry *p)
+{
+  return (table != pubtype_table
+  || p->die->die_offset != 0
+  || !flag_eliminate_unused_debug_types);
+}
+
 /* Return the size of the .debug_pubnames or .debug_pubtypes table
generated for the compilation unit.  */
 
 static unsigned long
-size_of_pubnames (VEC (pubname_entry, gc) * names)
+size_of_pubnames (VEC (pubname_entry, gc) *names)
 {
   unsigned long size;
   unsigned i;
   pubname_ref p;
+  int space_for_flags = (debug_generate_pub_sections == 2) ? 1 : 0;
 
   size = DWARF_PUBNAMES_HEADER_SIZE;
   FOR_EACH_VEC_ELT (pubname_entry, names, i, p)
-if (names != pubtype_table
-   || p->die->die_offset != 0
-   || !flag_eliminate_unused_debug_types)
-  size += strlen (p->name) + DWARF_OFFSET_SIZE + 1;
+if (include_pubname_in_output (names, p))
+  size += strlen (p->name) + DWARF_OFFSET_SIZE + 1 + space_for_flags;
 
   size += DWARF_OFFSET_SIZE;
   return size;
@@ -9395,6 +9420,71 @@ add_pubtype (tree decl, dw_die_ref die)
 }
 }
 
+/* Output a single entry in the pubnames table.  */
+
+static void
+output_pubname (dw_offset die_offset, pubname_entry *entry)
+{
+  dw_die_ref die = entry->die;
+  int is_static = get_AT_flag (die, DW_AT_external) ? 1 : 0;
+
+  dw2_asm_output_data (DWARF_OFFSET_SIZE, die_offset, "DIE offset");
+
+  if (debug_generate_pub_sections == 2)
+{
+  uint32_t flags = GDB_INDEX_SYMBOL_KIND_NONE;
+  switch (die->die_tag)
+  {
+case DW_TAG_typedef:
+case DW_TAG_base_type:
+case DW_TAG_subrange_type:
+  GDB_INDEX_SYMBOL_KIND_SET_VALUE(flags, GDB_INDEX_SYMBOL_KIND_TYPE);
+  GDB_INDEX_SYMBOL_STATIC_SET_VALUE(flags, 1);
+  break;
+case DW_TAG_enumerator:
+  GDB_INDEX_SYMBOL_KIND_SET_VALUE(flags,
+  GDB_INDEX_SYMBOL_KIND_VARIABLE);
+  if (!is_cxx () && !is_java ())
+GDB_INDEX_SYMBOL_STATIC_SET_VALUE(flags, 1);
+   

Re: [bootstrap] Tentative fix for PR 54281

2012-08-16 Thread Ian Lance Taylor
On Thu, Aug 16, 2012 at 12:12 PM, Diego Novillo  wrote:
>
> This is the patch I'm currently testing.  I need someone with a very old
> toolchain (4.1 or earlier) to also give this a try (the original problem
> does not occur in g++ more recent than 4.1).
>
>
> Thanks.  Diego.
>
> diff --git a/gcc/ChangeLog b/gcc/ChangeLog
> index a8ff00d..8798b8f 100644
> --- a/gcc/ChangeLog
> +++ b/gcc/ChangeLog
> @@ -1,5 +1,11 @@
>
>  2012-08-16   Diego Novillo  
>
> +   PR bootstrap/54281
> +   * intl.h: Prevent libintl.h from being included when
> +   ENABLE_NLS is not set.

It's hard to convince myself that this patch is portable.  I don't
think we can assume that every system that provides  uses
_LIBINTL_H as the preprocessor guard.

The issue is that we must not #include  after #defining
those macros.  So the fix is to #include  in all cases
before #defining those macros.  Your proposal of unconditionally doing
#include  is not a good idea, because  is not
available on every system.  But we are compiling host files here, so
we can just use autoconf.  I recommend that you add libintl.h to the
AC_CHECK_HEADERS list in gcc/configure.ac, and then change intl.h to
do

#ifdef HAVE_LIBINTL_H
#include 
#endif

before the #ifdef ENABLE_NLS test.

Ian


Re: [Google 4.7] Generate pubnames compatible with gdb-index version 7. (issue6459099)

2012-08-16 Thread Cary Coutant
> +/* Output a single entry in the pubnames table.  */
> +
> +static void
> +output_pubname (dw_offset die_offset, pubname_entry *entry)

For this function, I'd suggest a comment to the effect that the logic
is lifted from GDB.

> @@ -2424,6 +2424,10 @@ gpubnames
>  Common RejectNegative Var(debug_generate_pub_sections, 1)
>  Generate DWARF pubnames and pubtypes sections.
>
> +ggnu-pubnames
> +Common RejectNegative Var(debug_generate_pub_sections, 2)
> +Generate DWARF pubnames and pubtypes sections.

Instead of "RejectNegative", I think these three options should now
use "Negative(...)" flags (each one naming the next, circularly). Not
sure about that, though. (See the treatment of -gdwarf-, -gstabs,
etc.)

OK for google/gcc-4_7 branch.

-cary


Re: [PATCH, MIPS] DSP ALU scheduling

2012-08-16 Thread Sandra Loosemore

On 08/16/2012 01:27 PM, Richard Sandiford wrote:

Sandra Loosemore  writes:

@@ -569,7 +569,7 @@
   UNSPEC_DPAU_H_QBL))]
"ISA_HAS_DSP&&  !TARGET_64BIT"
"dpau.h.qbl\t%q0,%2,%3"
-  [(set_attr "type"  "imadd")
+  [(set_attr "type"  "dspmac")
 (set_attr "mode" "SI")])

  (define_insn "mips_dpau_h_qbr"
[etc]


I think all these want (set_attr "accum_in" "1") too.


Eeek, you are right.  I have checked in the obvious patch to correct this.

-Sandra

2012-08-16  Sandra Loosemore  

gcc/
* config/mips/mips-dsp.md (mips_dpau_h_qbl, mips_dpau_h_qbr)
(mips_dpsu_h_qbl, mips_dpsu_h_qbr, mips_dpaq_s_w_ph)
(mips_dpsq_s_w_ph, mips_mulsaq_s_w_ph, mips_dpaq_sa_l_w)
(mips_dpsq_sa_l_w, mips_maq_s_w_phl, mips_maq_s_w_phr)
(mips_maq_sa_w_phl, mips_maq_sa_w_phr): Add accum_in attribute.
Index: gcc/config/mips/mips-dsp.md
===
--- gcc/config/mips/mips-dsp.md	(revision 190453)
+++ gcc/config/mips/mips-dsp.md	(working copy)
@@ -570,6 +570,7 @@
   "ISA_HAS_DSP && !TARGET_64BIT"
   "dpau.h.qbl\t%q0,%2,%3"
   [(set_attr "type"	"dspmac")
+   (set_attr "accum_in" "1")
(set_attr "mode"	"SI")])
 
 (define_insn "mips_dpau_h_qbr"
@@ -581,6 +582,7 @@
   "ISA_HAS_DSP && !TARGET_64BIT"
   "dpau.h.qbr\t%q0,%2,%3"
   [(set_attr "type"	"dspmac")
+   (set_attr "accum_in" "1")
(set_attr "mode"	"SI")])
 
 ;; DPSU*
@@ -593,6 +595,7 @@
   "ISA_HAS_DSP && !TARGET_64BIT"
   "dpsu.h.qbl\t%q0,%2,%3"
   [(set_attr "type"	"dspmac")
+   (set_attr "accum_in" "1")
(set_attr "mode"	"SI")])
 
 (define_insn "mips_dpsu_h_qbr"
@@ -604,6 +607,7 @@
   "ISA_HAS_DSP && !TARGET_64BIT"
   "dpsu.h.qbr\t%q0,%2,%3"
   [(set_attr "type"	"dspmac")
+   (set_attr "accum_in" "1")
(set_attr "mode"	"SI")])
 
 ;; DPAQ*
@@ -620,6 +624,7 @@
   "ISA_HAS_DSP && !TARGET_64BIT"
   "dpaq_s.w.ph\t%q0,%2,%3"
   [(set_attr "type"	"dspmac")
+   (set_attr "accum_in" "1")
(set_attr "mode"	"SI")])
 
 ;; DPSQ*
@@ -636,6 +641,7 @@
   "ISA_HAS_DSP && !TARGET_64BIT"
   "dpsq_s.w.ph\t%q0,%2,%3"
   [(set_attr "type"	"dspmac")
+   (set_attr "accum_in" "1")
(set_attr "mode"	"SI")])
 
 ;; MULSAQ*
@@ -652,6 +658,7 @@
   "ISA_HAS_DSP && !TARGET_64BIT"
   "mulsaq_s.w.ph\t%q0,%2,%3"
   [(set_attr "type"	"dspmac")
+   (set_attr "accum_in" "1")
(set_attr "mode"	"SI")])
 
 ;; DPAQ*
@@ -668,6 +675,7 @@
   "ISA_HAS_DSP && !TARGET_64BIT"
   "dpaq_sa.l.w\t%q0,%2,%3"
   [(set_attr "type"	"dspmacsat")
+   (set_attr "accum_in" "1")
(set_attr "mode"	"SI")])
 
 ;; DPSQ*
@@ -684,6 +692,7 @@
   "ISA_HAS_DSP && !TARGET_64BIT"
   "dpsq_sa.l.w\t%q0,%2,%3"
   [(set_attr "type"	"dspmacsat")
+   (set_attr "accum_in" "1")
(set_attr "mode"	"SI")])
 
 ;; MAQ*
@@ -700,6 +709,7 @@
   "ISA_HAS_DSP && !TARGET_64BIT"
   "maq_s.w.phl\t%q0,%2,%3"
   [(set_attr "type"	"dspmac")
+   (set_attr "accum_in" "1")
(set_attr "mode"	"SI")])
 
 (define_insn "mips_maq_s_w_phr"
@@ -715,6 +725,7 @@
   "ISA_HAS_DSP && !TARGET_64BIT"
   "maq_s.w.phr\t%q0,%2,%3"
   [(set_attr "type"	"dspmac")
+   (set_attr "accum_in" "1")
(set_attr "mode"	"SI")])
 
 ;; MAQ_SA*
@@ -731,6 +742,7 @@
   "ISA_HAS_DSP && !TARGET_64BIT"
   "maq_sa.w.phl\t%q0,%2,%3"
   [(set_attr "type"	"dspmacsat")
+   (set_attr "accum_in" "1")
(set_attr "mode"	"SI")])
 
 (define_insn "mips_maq_sa_w_phr"
@@ -746,6 +758,7 @@
   "ISA_HAS_DSP && !TARGET_64BIT"
   "maq_sa.w.phr\t%q0,%2,%3"
   [(set_attr "type"	"dspmacsat")
+   (set_attr "accum_in" "1")
(set_attr "mode"	"SI")])
 
 ;; Table 2-4. MIPS DSP ASE Instructions: General Bit/Manipulation


Re: [PATCH, ARM] Don't pull in unwinder for 64-bit division routines

2012-08-16 Thread Ian Lance Taylor
On Thu, Aug 16, 2012 at 11:56 AM, Ramana Radhakrishnan  wrote:
> On 07/24/12 13:27, Julian Brown wrote:
>>
>> On Fri, 20 Jul 2012 11:15:27 +0100
>> Julian Brown  wrote:
>>
>>> Anyway: this revised version of the patch removes the strange libgcc
>>> Makefile-fragment changes, the equivalent of which have since been
>>> incorporated into mainline GCC now anyway, so the patch is somewhat
>>> more straightforward than it was previously.
>>
>>
>> Joey Ye contacted me offlist and suggested that the t-divmod-ef
>> fragment might be better integrated into t-bpabi instead. Doing that
>> makes the patch somewhat smaller/cleaner.
>>
>> Minimally re-tested, looks OK.
>
>
> The original submission makes no mention of testing ? The ARM specific
> portions look OK to me modulo no regressions.
>
> Ian, can also take a quick look.

Looks fine to me.

Ian


[PATCH] AIX libgcc.map missing symbols

2012-08-16 Thread David Edelsohn
When libgcc was moved to its own directory, reorganized and
refactored, the tmakefile fragment for AIX was broken.  t-ibm-ldouble
must come after t-slibgcc-aix because t-ibm-ldouble appends to
SHLIB_MAPFILES Makefile variable and t-slibgcc-aix.  This omitted
ibm-ldouble support symbols from the libgcc.map and export file.

Bootstrapped and regression tested on powerpc-ibm-aix5.3.0.0.

Committed.

This also will be back-ported to GCC 4.7.

Thanks, David

* config.host (*-*-aix*): Move rs6000/t-ibm-ldouble after
rs6000/t-slibgcc-aix.

Index: config.host
===
--- config.host (revision 190464)
+++ config.host (working copy)
@@ -898,15 +898,15 @@
;;
 rs6000-ibm-aix4.[3456789]* | powerpc-ibm-aix4.[3456789]*)
md_unwind_header=rs6000/aix-unwind.h
-   tmake_file="t-fdpbit rs6000/t-ppc64-fp rs6000/t-ibm-ldouble
rs6000/t-slibgcc-aix"
+   tmake_file="t-fdpbit rs6000/t-ppc64-fp rs6000/t-slibgcc-aix
rs6000/t-ibm-ldouble"
;;
 rs6000-ibm-aix5.1.* | powerpc-ibm-aix5.1.*)
md_unwind_header=rs6000/aix-unwind.h
-   tmake_file="t-fdpbit rs6000/t-ppc64-fp rs6000/t-ibm-ldouble
rs6000/t-slibgcc-aix"
+   tmake_file="t-fdpbit rs6000/t-ppc64-fp rs6000/t-slibgcc-aix
rs6000/t-ibm-ldouble"
;;
 rs6000-ibm-aix[56789].* | powerpc-ibm-aix[56789].*)
md_unwind_header=rs6000/aix-unwind.h
-   tmake_file="t-fdpbit rs6000/t-ppc64-fp rs6000/t-ibm-ldouble
rs6000/t-slibgcc-aix"
+   tmake_file="t-fdpbit rs6000/t-ppc64-fp rs6000/t-slibgcc-aix
rs6000/t-ibm-ldouble"
;;
 rl78-*-elf)
tmake_file="$tm_file t-fdpbit rl78/t-rl78"


Re: combine permutations in gimple

2012-08-16 Thread Hans-Peter Nilsson
On Wed, 15 Aug 2012, Richard Guenther wrote:
> On Wed, Aug 15, 2012 at 1:56 PM, Ramana Radhakrishnan
>  wrote:
> > Of-course, the problem here is this change of semantics with the hook
> > TARGET_VEC_PERM_CONST_OK. Targets were expanding to generic permutes
> > with constants in the *absence* of being able to deal with them with
> > the specialized permutes.  fwprop will now leave us at a point where
> > each target has to now grow more knowledge with respect to how best to
> > expand a generic constant permute with a sequence of permutes rather
> > than just using the generic permute.
> >
> > Generating a sequence of permutes from a single constant permute will
> > be a  harder problem than (say) dealing with immediate expansions so
> > you are pushing more complexity into the target but in the short term
> > target maintainers should definitely have a heads up that folks using
> > vector permute intrinsics could actually have performance regressions
> > on their targets.
>
> It's of course the same with the user input containing such a non-optimal
> handled constant permute.  So I'm less convinced that it's too much burden
> on the target side.  OTOH if there is a generic kind of shuffles that targets
> do not implement directly but can be simulated by two that are directly
> implemented pushing the logic to the expander (and adjusting the target
> hook semantic) would be ok.

There's a wonderful knapsack-class problem in there, something
for next year's GSoC?

(Given a constant permutation, synthesize it with a set of
simpler operations with total cost < constant_shuffle, where the
"simpler operation" and "costs" are target-specific (query for
presence by TARGET_VEC_PERM_CONST_OK and cost hooks; decompose
to "simpler operation" by generic heuristics).  A similar but
simpler problem is to synthesize a constant vector instead of
loading it from memory (though a load may be cheap enough for
most SIMD targets that this may be uninteresting to generalize).

brgds, H-P


Re: [bootstrap] Tentative fix for PR 54281

2012-08-16 Thread Hans-Peter Nilsson
> From: Diego Novillo 
> Date: Thu, 16 Aug 2012 21:12:56 +0200

> On 12-08-16 15:00 , Diego Novillo wrote:

> This is the patch I'm currently testing.  I need someone with a very old
> toolchain (4.1 or earlier) to also give this a try (the original problem
> does not occur in g++ more recent than 4.1).

> +   PR bootstrap/54281
> +   * intl.h: Prevent libintl.h from being included when
> +   ENABLE_NLS is not set.

Regtested on a x86_64 F 8 system with "gcc-4.1.2-33", no
regressions at r190450 (with --disable-nls) compared to results
at r190381 (without).

brgds, H-P