RE: [Ping] RE: CR16 Port addition

2012-02-19 Thread Gerald Pfeifer
On Tue, 14 Feb 2012, Jayant R. Sonar wrote:
> I have not worked on these changes before. Therefore, can you please 
> review the attached patch and let me know if any changes are required
> to be done in it.

Index: wwwdocs/htdocs/gcc-4.7/changes.html
===
RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-4.7/changes.html,v
retrieving revision 1.79
diff -r1.79 changes.html
587a588,592
> CR16
>   
> Support has been added for the National Semiconductor's CR16 
> architecture.

This line is too long (try not to exceed about 76 columns) and 
omit either "the" or "'s".

The whole patchset is fine with these changes.

Thanks,
Gerald

PS: Next step: gcc/doc/contrib.texi if you like. :-)


Re: [patch, testsuite] PR 52229, testsuite failure

2012-02-19 Thread Dominique Dhumieres
>  Ping?
> > ...
> > * gfortran.dg/vect/pr32380.f: XFAIL on PowerPC and ia-64.

This fixes the failure on powerpc-apple-darwin9 (see
http://gcc.gnu.org/ml/gcc-testresults/2012-02/msg01809.html ).

The fix is a little bit brutal since two loops are vectorized
on powerpc-apple-darwin9, but I don't think a refined test
is worth the trouble.

Unless someone complains in the coming day, I think you can
consider your patch as approved.

Thanks,

Dominique



[MIPS, committed] Add CFI information to mips16 fpret stubs

2012-02-19 Thread Richard Sandiford
Richard Henderson  writes:
> On 02/16/2012 10:58 AM, Richard Sandiford wrote:
>>> As a workaround for 4.7, you can try this hack:
>>>
>>> .cfi_startproc simple
>>> .cfi_def_cfa29, -1  # fake cfa one byte below sp
>>> .cfi_register   29, 29  # "save" sp in itself so we don't use 
>>> the fake cfa
>>> move$18,$31
>>> .cfi_register 31, 18
>>> ...
>> 
>> Ooh, nice (if that's the word).  It certainly fixes the testcase,
>> although I had to use -4 rather than -1 in order to defeat
>> DWARF2_CIE_DATA_ALIGNMENT.  That should still be OK, since the
>> stack is 8-byte aligned.
>> 
>> GDB doesn't seem to be able to backtrace through this, but that
>> has to come second to correctness.  I'll aim to get a tested fix
>> in this weekend.
>
> Hmm.  I wonder if GDB would be happier with a val_expression,
> rather than the "odd" .cfi_register:
>
>   // DW_CFA_val_expression r29, { DW_OP_reg29 }
>   .cfi_escape 0x16,29,1,0x6d

In the end I went for this version.  Although the plain .cfi_register
thing seemed to work for the reduced testcase, it caused the original
one to segfault.  The unwinder was copying the sp's GRPtr from the old
context to the new one, but since there was no "real" sp save slot
to use, this GRPtr ended up being the local tmp_sp variable from
uw_update_context_1.  We'd then end up using tmp_sp after the
function had exited.

The .cfi_escape is safe because we're forced to calculate a value
rather than a pointer.  (Which I guess is why you suggested it --
was a bit slow on the uptake.)

As mentioned on the gcc@ thread, gdb can't currently handle this.
But (a) it can't handle the current situation either and
(b) it sounds from Tom's message that later gdbs will cope,
so I think this patch is a strict improvement.

Tested on mips64-linux-gnu, mips-sde-elf and various other mips*-elf targets.
Applied.  I'll get back to the unwinder patch once 4.8 is open.

Richard


gcc/
* config/mips/mips.c (mips16_build_call_stub): Add CFI information
to stubs with non-sibling calls.

libgcc/
* config/mips/mips16.S (CALL_STUB_RET): Add CFI information.

Index: gcc/config/mips/mips.c
===
--- gcc/config/mips/mips.c  2012-02-18 09:15:10.285775771 +
+++ gcc/config/mips/mips.c  2012-02-18 18:11:13.120840632 +
@@ -6387,7 +6387,20 @@ mips16_build_call_stub (rtx retval, rtx
   assemble_start_function (stubdecl, stubname);
   mips_start_function_definition (stubname, false);
 
-  if (!fp_ret_p)
+  if (fp_ret_p)
+   {
+ fprintf (asm_out_file, "\t.cfi_startproc\n");
+
+ /* Create a fake CFA 4 bytes below the stack pointer.
+This works around unwinders (like libgcc's) that expect
+the CFA for non-signal frames to be unique.  */
+ fprintf (asm_out_file, "\t.cfi_def_cfa 29,-4\n");
+
+ /* "Save" $sp in itself so we don't use the fake CFA.
+This is: DW_CFA_val_expression r29, { DW_OP_reg29 }.  */
+ fprintf (asm_out_file, "\t.cfi_escape 0x16,29,1,0x6d\n");
+   }
+  else
{
  /* Load the address of the MIPS16 function into $25.  Do this
 first so that targets with coprocessor interlocks can use
@@ -6405,12 +6418,7 @@ mips16_build_call_stub (rtx retval, rtx
 registers.  */
   mips_output_args_xfer (fp_code, 't');
 
-  if (!fp_ret_p)
-   {
- /* Jump to the previously-loaded address.  */
- output_asm_insn ("jr\t%^", NULL);
-   }
-  else
+  if (fp_ret_p)
{
  /* Save the return address in $18 and call the non-MIPS16 function.
 The stub's caller knows that $18 might be clobbered, even though
@@ -6418,6 +6426,7 @@ mips16_build_call_stub (rtx retval, rtx
  fprintf (asm_out_file, "\tmove\t%s,%s\n",
   reg_names[GP_REG_FIRST + 18], reg_names[RETURN_ADDR_REGNUM]);
  output_asm_insn (MIPS_CALL ("jal", &fn, 0, -1), &fn);
+ fprintf (asm_out_file, "\t.cfi_register 31,18\n");
 
  /* Move the result from floating-point registers to
 general registers.  */
@@ -6470,6 +6479,12 @@ mips16_build_call_stub (rtx retval, rtx
  gcc_unreachable ();
}
  fprintf (asm_out_file, "\tjr\t%s\n", reg_names[GP_REG_FIRST + 18]);
+ fprintf (asm_out_file, "\t.cfi_endproc\n");
+   }
+  else
+   {
+ /* Jump to the previously-loaded address.  */
+ output_asm_insn ("jr\t%^", NULL);
}
 
 #ifdef ASM_DECLARE_FUNCTION_SIZE
Index: libgcc/config/mips/mips16.S
===
--- libgcc/config/mips/mips16.S 2012-02-18 09:15:10.284775771 +
+++ libgcc/config/mips/mips16.S 2012-02-18 18:10:40.371841584 +
@@ -566,15 +566,23 @@ CALL_STUB_NO_RET (__mips16_call_stub_10,
being called is 16 bits, in which case the copy is unnecessary;
  

Re: [PATCH] MIPS16 TLS support for GCC

2012-02-19 Thread Richard Sandiford
Richard Henderson  writes:
> On 02/04/2012 02:06 AM, Richard Sandiford wrote:
>>> >  Actually I had that idea of a link-once function too, but it turned out 
>>> > quite complicated to do without rewriting some generic parts of GCC as it 
>>> > is currently not prepared to emit link-once functions outside C++ 
>>> > compilations.  It's been a while and I did lots of other stuff meanwhile, 
>>> > so please excuse me if I got anything wrong here.
>> Hmm, OK, I wouldn't have expected that.  But if you've tried making
>> __mips16_rdhwr link-once and had a bad experience with it, then yeah,
>> let's go with the hidden libgcc function.  It's just a shame that we're
>> having to force static linking of libgcc for this one case.
>
> The i386 target does it all the time for its __x86.get_pc_thunk.?x thingys.

Thanks for the pointer.  Here's a patch that takes the same approach.
There's no problem relying on comdat groups here, since MIPS16 TLS
requires 2.22 gas and ld anyway.

Tested on mips64-linux-gnu, mips-sde-elf and various other mips*-elf targets.
Applied.

Richard


gcc/
* config/mips/mips.c (mips_need_mips16_rdhwr_p): New variable.
(mips_get_tp): Set it.  Record that __mips16_rdhwr binds locally.
(mips_start_unique_function, mips_output_mips16_rdhwr)
(mips_code_end): New functions.
(TARGET_ASM_CODE_END): Define.

libgcc/
* config.host (mips64*-*-linux*, mipsisa64*-*-linux*)
(mips*-*-linux*): Remove t-slibgcc-libgcc.
* config/mips/t-mips16 (LIB1ASMFUNCS): Remove __mips16_rdhwr.
* config/mips/mips16.S (__mips16_rdhwr): Delete.

Index: gcc/config/mips/mips.c
===
--- gcc/config/mips/mips.c  2012-02-18 18:11:13.0 +
+++ gcc/config/mips/mips.c  2012-02-19 16:27:26.198924095 +
@@ -592,6 +592,9 @@ struct target_globals *mips16_globals;
and returned from mips_sched_reorder2.  */
 static int cached_can_issue_more;
 
+/* True if the output uses __mips16_rdhwr.  */
+static bool mips_need_mips16_rdhwr_p;
+
 /* Index R is the smallest register class that contains register R.  */
 const enum reg_class mips_regno_to_class[FIRST_PSEUDO_REGISTER] = {
   LEA_REGS,LEA_REGS,   M16_REGS,   V1_REG,
@@ -2842,7 +2845,9 @@ mips_get_tp (void)
   tp = gen_reg_rtx (Pmode);
   if (TARGET_MIPS16)
 {
+  mips_need_mips16_rdhwr_p = true;
   fn = mips16_stub_function ("__mips16_rdhwr");
+  SYMBOL_REF_FLAGS (fn) |= SYMBOL_FLAG_LOCAL;
   if (!call_insn_operand (fn, VOIDmode))
fn = force_reg (Pmode, fn);
   emit_insn (PMODE_INSN (gen_tls_get_tp_mips16, (tp, fn)));
@@ -5827,6 +5832,33 @@ mips_gimplify_va_arg_expr (tree valist,
   return addr;
 }
 
+/* Declare a unique, locally-binding function called NAME, then start
+   its definition.  */
+
+static void
+mips_start_unique_function (const char *name)
+{
+  tree decl;
+
+  decl = build_decl (BUILTINS_LOCATION, FUNCTION_DECL,
+get_identifier (name),
+build_function_type_list (void_type_node, NULL_TREE));
+  DECL_RESULT (decl) = build_decl (BUILTINS_LOCATION, RESULT_DECL,
+  NULL_TREE, void_type_node);
+  TREE_PUBLIC (decl) = 1;
+  TREE_STATIC (decl) = 1;
+
+  DECL_COMDAT_GROUP (decl) = DECL_ASSEMBLER_NAME (decl);
+
+  targetm.asm_out.unique_section (decl, 0);
+  switch_to_section (get_named_section (decl, NULL, 0));
+
+  targetm.asm_out.globalize_label (asm_out_file, name);
+  fputs ("\t.hidden\t", asm_out_file);
+  assemble_name (asm_out_file, name);
+  putc ('\n', asm_out_file);
+}
+
 /* Start a definition of function NAME.  MIPS16_P indicates whether the
function contains MIPS16 code.  */
 
@@ -5865,6 +5897,26 @@ mips_end_function_definition (const char
 }
 }
 
+/* Output a definition of the __mips16_rdhwr function.  */
+
+static void
+mips_output_mips16_rdhwr (void)
+{
+  const char *name;
+
+  name = "__mips16_rdhwr";
+  mips_start_unique_function (name);
+  mips_start_function_definition (name, false);
+  fprintf (asm_out_file,
+  "\t.set\tpush\n"
+  "\t.set\tmips32r2\n"
+  "\t.set\tnoreorder\n"
+  "\trdhwr\t$3,$29\n"
+  "\t.set\tpop\n"
+  "\tj\t$31\n");
+  mips_end_function_definition (name);
+}
+
 /* Return true if calls to X can use R_MIPS_CALL* relocations.  */
 
 static bool
@@ -8467,6 +8519,15 @@ mips_file_start (void)
 ASM_COMMENT_START,
 mips_small_data_threshold, mips_arch_info->name, mips_isa);
 }
+
+/* Implement TARGET_ASM_CODE_END.  */
+
+static void
+mips_code_end (void)
+{
+  if (mips_need_mips16_rdhwr_p)
+mips_output_mips16_rdhwr ();
+}
 
 /* Make the last instruction frame-related and note that it performs
the operation described by FRAME_PATTERN.  */
@@ -17357,6 +17418,8 @@ #define TARGET_PREFERRED_RELOAD_CLASS mi
 #define TARGET_ASM_FILE_START mips_file_start
 #undef TARGET_ASM_FILE_START_FILE_DIRECTIVE
 #def

Re: [PR52001] too many cse reverse equiv exprs (take2)

2012-02-19 Thread Richard Sandiford
Alexandre Oliva  writes:
> On Feb 15, 2012, Richard Sandiford  wrote:
>
>> I'm fine with putting it in and seeing what breaks.  But I'd really
>> prefer if we knew in theory. :-)
>
> Ok, I dove into the problem without a testcase, and I managed to trigger
> it on other platforms after tweaking get_addr a bit so as use loc lists
> form canonical values, and to avoid returning other VALUEs if other
> alternatives exist.
>
>> Like I say, my understanding before this patch series went in was that
>> cselib values weren't supposed to be cyclic.  Now that they are, what
>> should consumers like memrefs_conflict_p do to avoid getting stuck?
>
> I'm now testing the following heuristic: only use an expr instead of a
> value if the expr doesn't reference any value whose uid is greater than
> that of the value.  This worked for libgcc so far; regstrapping now.
>
> Here's the revised patch that addresses Jakub's and your comments, that
> regstrapped on x86_64-linux-gnu and i686-linux-gnu, followed by the
> patch I'm testing now on both platforms.

Thanks for tackling this.  I agree it looks like the patch should work.

I have to admit I still don't like these changes, and it still isn't
obvious to me when canonical_cselib_val is supposed to be used.
I'd much rather we kept to the original dag.  But I realise that
probably isn't a useful attitude to take, and I don't know
vartracking well enough to understand the constraints,
so I'll shut up now.

Richard


[v3] libstdc++/52309

2012-02-19 Thread Paolo Carlini

Hi,

this is what I'm going to apply. Seems straightforward enough to go in now.

Tested x86_64-linux.

Thanks,
Paolo.

///
2012-02-19  Paolo Carlini  

PR libstdc++/52309
* include/bits/hashtable_policy.h (_Equality_base<, true,>::
_M_equal(const _Hashtable&)): Compare values with operator==.
* testsuite/23_containers/unordered_set/operators/52309.cc: New.

Index: include/bits/hashtable_policy.h
===
--- include/bits/hashtable_policy.h (revision 184380)
+++ include/bits/hashtable_policy.h (working copy)
@@ -1113,7 +1113,7 @@
   for (auto __itx = __this->begin(); __itx != __this->end(); ++__itx)
{
  const auto __ity = __other.find(_ExtractKey()(*__itx));
- if (__ity == __other.end() || *__ity != *__itx)
+ if (__ity == __other.end() || !(*__ity == *__itx))
return false;
}
   return true;
Index: testsuite/23_containers/unordered_set/operators/52309.cc
===
--- testsuite/23_containers/unordered_set/operators/52309.cc(revision 0)
+++ testsuite/23_containers/unordered_set/operators/52309.cc(revision 0)
@@ -0,0 +1,28 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2012 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// .
+
+#include 
+
+// libstdc++/52309
+struct value {};
+struct hash { std::size_t operator()(const value&) const; };
+bool operator==(value const&, value const&);
+std::unordered_set set;
+bool z = (set == set);


New Swedish PO file for 'gcc' (version 4.7-b20120128)

2012-02-19 Thread Translation Project Robot
Hello, gentle maintainer.

This is a message from the Translation Project robot.

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

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

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

All other PO files for your package are available in:

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

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

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

The following HTML page has been updated:

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

If any question arises, please contact the translation coordinator.

Thank you for all your work,

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




Re: [committed] invoke.texi: fix hyphenation of "floating point" and related terms

2012-02-19 Thread Gerald Pfeifer
On Sun, 19 Feb 2012, Gerald Pfeifer wrote:
> I know when ahead and committed this patch

Ahem, make this: I now went ahead...

Gerald


Re: [google/gcc-4_6_2-mobile] PATCH: PR other/46770: Replace .ctors/.dtors with .init_array/.fini_array on targets supporting them

2012-02-19 Thread Ollie Wild
Hey, Jing, you broke the google/gcc-4_6 branch by checking the new
header file into the wrong directory.

Fixed via r184386.

Ollie

On Fri, Feb 17, 2012 at 10:25 PM, Jing Yu  wrote:
>
> OK. Thanks for porting the patch.
> I will commit the patch into google/gcc-4_6_2-mobile for you.
>
> I would also like to commit it into google/gcc-4_6 branch if all tests
> pass. This patch is almost the same as Google Ref 47894.
>
> Thanks,
> Jing
>
> On Fri, Feb 17, 2012 at 5:20 PM, H.J. Lu  wrote:
> > Hi,
> >
> > This patch backports the fix from trunk:
> >
> > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46770
> >
> > for google/gcc-4_6_2-mobile branch.  This is needed to support C++
> > global constructors/destructiors on Android/x86.  OK for
> > google/gcc-4_6_2-mobile branch?
> >
> > Thanks.
> >
> > H.J.
> > ---
> > 2011-08-20  H.J. Lu  
> >
> >        PR other/46770
> >        * config.gcc (tm_file): Add initfini-array.h if
> >        .init_arrary/.fini_array are supported.
> >
> >        * crtstuff.c: Don't generate .ctors nor .dtors sections if
> >        USE_INITFINI_ARRAY is defined.
> >
> >        * output.h (default_elf_init_array_asm_out_constructor): New.
> >        (default_elf_fini_array_asm_out_destructor): Likewise.
> >        * varasm.c (elf_init_array_section): Likewise.
> >        (elf_fini_array_section): Likewise.
> >        (get_elf_initfini_array_priority_section): Likewise.
> >        (default_elf_init_array_asm_out_constructor): Likewise.
> >        (default_elf_fini_array_asm_out_destructor): Likewise.
> >
> >        * config/initfini-array.h: New.
> >
> > git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@177933 
> > 138bc75d-0d04-0410-961f-82ee72b054a4
> >
> > Conflicts:
> >
> >        gcc/ChangeLog
> > ---
> >  gcc/ChangeLog.hjl           |   21 +++
> >  gcc/config.gcc              |    5 +++
> >  gcc/config/initfini-array.h |   37 +++
> >  gcc/crtstuff.c              |   11 +++-
> >  gcc/output.h                |    2 +
> >  gcc/varasm.c                |   58 
> > +++
> >  6 files changed, 133 insertions(+), 1 deletions(-)
> >  create mode 100644 gcc/ChangeLog.hjl
> >  create mode 100644 gcc/config/initfini-array.h
> >
> > diff --git a/gcc/ChangeLog.hjl b/gcc/ChangeLog.hjl
> > new file mode 100644
> > index 000..3527b27
> > --- /dev/null
> > +++ b/gcc/ChangeLog.hjl
> > @@ -0,0 +1,21 @@
> > +2011-12-07  H.J. Lu  
> > +
> > +       Backport from mainline
> > +       2011-08-20  H.J. Lu  
> > +
> > +       PR other/46770
> > +       * config.gcc (tm_file): Add initfini-array.h if
> > +       .init_arrary/.fini_array are supported.
> > +
> > +       * crtstuff.c: Don't generate .ctors nor .dtors sections if
> > +       USE_INITFINI_ARRAY is defined.
> > +
> > +       * output.h (default_elf_init_array_asm_out_constructor): New.
> > +       (default_elf_fini_array_asm_out_destructor): Likewise.
> > +       * varasm.c (elf_init_array_section): Likewise.
> > +       (elf_fini_array_section): Likewise.
> > +       (get_elf_initfini_array_priority_section): Likewise.
> > +       (default_elf_init_array_asm_out_constructor): Likewise.
> > +       (default_elf_fini_array_asm_out_destructor): Likewise.
> > +
> > +       * config/initfini-array.h: New.
> > diff --git a/gcc/config.gcc b/gcc/config.gcc
> > index d9ac0fa..b386424 100644
> > --- a/gcc/config.gcc
> > +++ b/gcc/config.gcc
> > @@ -3176,6 +3176,11 @@ if test x$with_schedule = x; then
> >        esac
> >  fi
> >
> > +# Support --enable-initfini-array.
> > +if test x$enable_initfini_array = xyes; then
> > +  tm_file="${tm_file} initfini-array.h"
> > +fi
> > +
> >  # Validate and mark as valid any --with options supported
> >  # by this target.  In order to use a particular --with option
> >  # you must list it in supported_defaults; validating the value
> > diff --git a/gcc/config/initfini-array.h b/gcc/config/initfini-array.h
> > new file mode 100644
> > index 000..8aaadf6
> > --- /dev/null
> > +++ b/gcc/config/initfini-array.h
> > @@ -0,0 +1,37 @@
> > +/* Definitions for ELF systems with .init_array/.fini_array section
> > +   support.
> > +   Copyright (C) 2011
> > +   Free Software Foundation, Inc.
> > +
> > +   This file is part of GCC.
> > +
> > +   GCC is free software; you can redistribute it and/or modify it
> > +   under the terms of the GNU General Public License as published
> > +   by the Free Software Foundation; either version 3, or (at your
> > +   option) any later version.
> > +
> > +   GCC is distributed in the hope that it will be useful, but WITHOUT
> > +   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
> > +   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
> > +   License for more details.
> > +
> > +   You should have received a copy of the GNU General Public License
> > +   along with GCC; see the file COPYING3.  If not see
> > +   .  */
> > +
> > +#define USE_INITFINI_A