Re: symbolic names for processor IDs

2012-09-09 Thread Uros Bizjak
On Sun, Sep 9, 2012 at 4:53 AM, Ulrich Drepper  wrote:
> On Sat, Sep 8, 2012 at 7:17 AM, Uros Bizjak  wrote:
>> There are some other cpuid vendor signatures than AMD and Intel,
>
> How about a patch with this complete list?

Well, OK then. It won't hurt.

The patch is OK for mainline with appropriate ChangeLog.

(Please also update driver-i386.c to use new signatures).

Thanks,
Uros.


Re: [Patch contrib] check_GNU_style: remove tmp file

2012-09-09 Thread Gerald Pfeifer
On Mon, 3 Sep 2012, Christophe Lyon wrote:
> check_GNU_style.sh currently leaves a temporary file in the current 
> directory. This patch removes it upon exit.
> 
> Christophe.
> 
> 2012-09-03   Christophe Lyon  
> 
>   * check_GNU_style.sh: Remove temporay file upon exit.

Shouldn't this also be removed upon abort?

See contrib/warn_summary, for an example,

Gerald


[rtl] combine a vec_concat of 2 vec_selects from the same vector

2012-09-09 Thread Marc Glisse

Hello,

this patch lets the compiler try to rewrite:

(vec_concat (vec_select x [a]) (vec_select x [b]))

as:

vec_select x [a b]

or even just "x" if appropriate.

In a first iteration I was restricting it to b-a==1, but it seemed better 
not to: it helps for {v[1],v[0]} and doesn't change anything for unknown 
patterns.


Note that I am planning to do a similar optimization at tree level, but it 
shouldn't make this one useless because such patterns can be created 
during rtl passes. The testcase may need an additional -fno-tree-xxx to 
still be useful at that point though.



bootstrap+testsuite on x86_64-linux-gnu.

2012-09-09  Marc Glisse  

gcc/
* simplify-rtx.c (simplify_binary_operation_1): Handle vec_concat
of vec_selects from the same vector.

gcc/testsuite/
* gcc.target/i386/vect-rebuild.c: New testcase.

--
Marc GlisseIndex: simplify-rtx.c
===
--- simplify-rtx.c  (revision 191106)
+++ simplify-rtx.c  (working copy)
@@ -3357,20 +3357,38 @@ simplify_binary_operation_1 (enum rtx_co
if (!VECTOR_MODE_P (op1_mode))
  RTVEC_ELT (v, i) = trueop1;
else
  RTVEC_ELT (v, i) = CONST_VECTOR_ELT (trueop1,
   i - in_n_elts);
  }
  }
 
return gen_rtx_CONST_VECTOR (mode, v);
  }
+
+   if (GET_CODE (trueop0) == VEC_SELECT
+   && GET_CODE (trueop1) == VEC_SELECT
+   && !VECTOR_MODE_P (op0_mode)
+   && !VECTOR_MODE_P (op1_mode)
+   && rtx_equal_p (XEXP (trueop0, 0), XEXP (trueop1, 0)))
+ {
+   if (GET_MODE (XEXP (trueop0, 0)) == mode
+   && INTVAL (XVECEXP (XEXP (trueop1, 1), 0, 0))
+  - INTVAL (XVECEXP (XEXP (trueop0, 1), 0, 0)) == 1)
+ return XEXP (trueop0, 0);
+
+   rtvec vec = rtvec_alloc (2);
+   RTVEC_ELT (vec, 0) = XVECEXP (XEXP (trueop0, 1), 0, 0);
+   RTVEC_ELT (vec, 1) = XVECEXP (XEXP (trueop1, 1), 0, 0);
+   return simplify_gen_binary (VEC_SELECT, mode, XEXP (trueop0, 0),
+   gen_rtx_PARALLEL (VOIDmode, vec));
+ }
   }
   return 0;
 
 default:
   gcc_unreachable ();
 }
 
   return 0;
 }
 
Index: testsuite/gcc.target/i386/vect-rebuild.c
===
--- testsuite/gcc.target/i386/vect-rebuild.c(revision 0)
+++ testsuite/gcc.target/i386/vect-rebuild.c(revision 0)
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+/* { dg-options "-O -mavx" } */
+
+typedef double v2df __attribute__ ((__vector_size__ (16)));
+typedef double v4df __attribute__ ((__vector_size__ (32)));
+
+v2df f (v2df x)
+{
+  v2df xx = { x[0], x[1] };
+  return xx;
+}
+
+v2df g (v2df x)
+{
+  v2df xx = { x[1], x[0] };
+  return xx;
+}
+
+v2df h (v4df x)
+{
+  v2df xx = { x[2], x[3] };
+  return xx;
+}
+
+/* { dg-final { scan-assembler-not "unpck" } } */
+/* { dg-final { scan-assembler-times "\tv?permilpd\[ \t\]" 1 } } */
+/* { dg-final { scan-assembler-times "\tv?extractf128\[ \t\]" 1 } } */

Property changes on: testsuite/gcc.target/i386/vect-rebuild.c
___
Added: svn:keywords
   + Author Date Id Revision URL
Added: svn:eol-style
   + native



[SH] PR 54089 - Improve software dynamic shifts

2012-09-09 Thread Oleg Endo
Hello,

This patch does two things...

1) The dynamic shift cost is set to be the same if HW dynamic shifts are
available.  This improves code size for SH2A a little (-2 KByte on CSiBE
for -m2a-single -O2).

2) Improve code around library function calls for software dynamic
shifts (logical right + left shifts only for now).
For this I had to change the implementations of ashlsi3 and lshrsi3 in
lib1funcs.S, but  the changes are backwards compatible with older
binaries.  Due to the additional branch insn in the dyn shift functions
they might be one or two cycles slower than the original, but this
reduces the amount of clobbered regs and cuts 9.5 KByte in the CSiBE set
(-m2 -ml -O2), which seems more beneficial to do on average.

Tested on rev. 190990 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 except for this one on SH2:

FAIL: gcc.dg/pr28402.c scan-assembler-not __[a-z]*si3

The reason for this is that now the middle-end will expand DImode shifts
as SImode shifts instead of a DImode shift library call, because it sees
the new SImode dynamic library call shift patterns for SH2.  I will have
a look at this issue later to see if it is beneficial to do special
handling of DImode shifts on SH2.

OK to install?

Cheers,
Oleg

gcc/ChangeLog:

PR target/54089
* config/sh/sh.h (SH_DYNAMIC_SHIFT_COST): Set always to 1 if 
dynamic shifts are available.
(SHIFT_COUNT_TRUNCATED): Always define to 0.  Correct comment.
* config/sh/sh.c (ashl_lshr_seq, ext_ashl_lshr_seq): Add 
comments.
* config/sh/predicates.md (shift_count_operand): Allow 
arith_reg_operand even if TARGET_DYNSHIFT is false.
* config/sh/sh.md (ashlsi3, lshrsi3): Expand library call 
patterns if needed.
(ashlsi3_d_call, lshrsi3_d_call): New insns.

libgcc/ChangeLog:

PR target/54089
* config/sh/lib1funcs.S (ashlsi3): Reimplement as ashlsi3_r0.
(lshrsi3): Reimplement as lshrsi3_r0.

testsuite/ChangeLog:

PR target/54089
* gcc.target/sh/pr54089-3.c: New.

Index: libgcc/config/sh/lib1funcs.S
===
--- libgcc/config/sh/lib1funcs.S	(revision 190990)
+++ libgcc/config/sh/lib1funcs.S	(working copy)
@@ -1,5 +1,5 @@
 /* Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
-   2004, 2005, 2006, 2009
+   2004, 2005, 2006, 2009, 2012
Free Software Foundation, Inc.
 
 This file is free software; you can redistribute it and/or modify it
@@ -241,7 +241,7 @@
 ! Entry:
 !
 ! r4: Value to shift
-! r5: Shifts
+! r5: Shift count
 !
 ! Exit:
 !
@@ -249,7 +249,7 @@
 !
 ! Destroys:
 !
-! (none)
+! T bit, r5
 !
 
 	.global	GLOBAL(ashrsi3)
@@ -388,318 +388,353 @@
 
 !
 ! GLOBAL(ashlsi3)
+! (For compatibility with older binaries, not used by compiler)
 !
 ! Entry:
+!	r4: Value to shift
+!	r5: Shift count
 !
-! r4: Value to shift
-! r5: Shifts
-!
 ! Exit:
+!	r0: Result
 !
-! r0: Result
-!
 ! Destroys:
+!	T bit
 !
-! (none)
 !
+! GLOBAL(ashlsi3_r0)
+!
+! Entry:
+!	r4: Value to shift
+!	r0: Shift count
+!
+! Exit:
+!	r0: Result
+!
+! Destroys:
+!	T bit
+
 	.global	GLOBAL(ashlsi3)
+	.global GLOBAL(ashlsi3_r0)
 	HIDDEN_FUNC(GLOBAL(ashlsi3))
+	HIDDEN_FUNC(GLOBAL(ashlsi3_r0))
+GLOBAL(ashlsi3):
+	mov	r5,r0
 	.align	2
-GLOBAL(ashlsi3):
-	mov	#31,r0
-	and	r0,r5
+GLOBAL(ashlsi3_r0):
+
+#ifdef __sh1__
+	and	#31,r0
+	shll2	r0
+	mov.l	r4,@-r15
+	mov	r0,r4
 	mova	LOCAL(ashlsi3_table),r0
-	mov.b	@(r0,r5),r5
-#ifdef __sh1__
-	add	r5,r0
+	add	r4,r0
+	mov.l	@r15+,r4
 	jmp	@r0
+	mov	r4,r0
+	.align 2
 #else
-	braf	r5
+	and	#31,r0
+	shll2	r0
+	braf	r0
+	mov	r4,r0
 #endif
-	mov	r4,r0
 
-	.align	2
 LOCAL(ashlsi3_table):
-	.byte		LOCAL(ashlsi3_0)-LOCAL(ashlsi3_table)
-	.byte		LOCAL(ashlsi3_1)-LOCAL(ashlsi3_table)
-	.byte		LOCAL(ashlsi3_2)-LOCAL(ashlsi3_table)
-	.byte		LOCAL(ashlsi3_3)-LOCAL(ashlsi3_table)
-	.byte		LOCAL(ashlsi3_4)-LOCAL(ashlsi3_table)
-	.byte		LOCAL(ashlsi3_5)-LOCAL(ashlsi3_table)
-	.byte		LOCAL(ashlsi3_6)-LOCAL(ashlsi3_table)
-	.byte		LOCAL(ashlsi3_7)-LOCAL(ashlsi3_table)
-	.byte		LOCAL(ashlsi3_8)-LOCAL(ashlsi3_table)
-	.byte		LOCAL(ashlsi3_9)-LOCAL(ashlsi3_table)
-	.byte		LOCAL(ashlsi3_10)-LOCAL(ashlsi3_table)
-	.byte		LOCAL(ashlsi3_11)-LOCAL(ashlsi3_table)
-	.byte		LOCAL(ashlsi3_12)-LOCAL(ashlsi3_table)
-	.byte		LOCAL(ashlsi3_13)-LOCAL(ashlsi3_table)
-	.byte		LOCAL(ashlsi3_14)-LOCAL(ashlsi3_table)
-	.byte		LOCAL(ashlsi3_15)-LOCAL(ashlsi3_table)
-	.byte		LOCAL(ashlsi3_16)-LOCAL(ashlsi3_table)
-	.byte		LOCAL(ashlsi3_17)-LOCAL(ashlsi3_table)
-	.byte		LOCAL(ashlsi3_18)-LOCAL(ashlsi3_table)
-	.byte		LOCAL(ashlsi3_19)-LOCAL(ashlsi3_table)
-	.byte		LOCAL(ashlsi3_20)-LOCAL(ashlsi3_table)
-	.byte		LOCAL(ashlsi3_21)-LOCAL(ashlsi3_table)
-	.byte		LOCAL(ashlsi3_22)-LOCAL(ashlsi3_table)
-	.byte		LOCAL(ashlsi3_23)-LOCAL(ashlsi3_table)
-	.byte		LOCAL(ashlsi3_24)-LOCAL(ashlsi3_table)
-	.byte		LOCAL(ashlsi

Re: VxWorks Patches Back from the Dead!

2012-09-09 Thread rbmj

Just because I *love* bothering everyone with emails...

I've made a few changes and squashed everything into a single patch for 
ease of application.  The commit message is inside the patch, but here's 
the suggested ChangeLog:


configure.ac: add --enable-libstdcxx option
configure: regenerate

[gcc]
gcov-io.c (gcov_open): Pass mode to open() unconditionally

[fixincludes]
fixinc.in: Added ability to skip machine_name
inclhack.def (AAB_vxworks_assert): Added fix
inclhack.def (AAB_vxworks_regs_vxtypes): Added fix
inclhack.def (AAB_vxworks_stdint): Added fix
inclhack.def (AAB_vxworks_unistd): Added fix
inclhack.def (vxworks_ioctl_macro): Added fix
inclhack.def (vxworks_mkdir_macro): Added fix
inclhack.def (vxworks_regs): Added fix
inclhack.def (vxworks_write_const):  Added fix
fixincl.x:  Regenerate
mkfixinc.sh: Removed vxworks from list of no-op fixinc targets

[libstdc++-v3]
config/os/vxworks/os_defines.h: #define'd NOMINMAX

Thanks,

Robert Mason

>From 2ce175a3c94e6d544e27a8f936728fbec8f1f004 Mon Sep 17 00:00:00 2001
From: rbmj 
Date: Mon, 4 Jun 2012 13:18:10 -0400
Subject: [PATCH] Fix issues with VxWorks Targets

Fix 1: Added assert fixinclude hack for VxWorks.

VxWorks's assert.h relies on adjacent string tokens being joined,
and uses macros for some of the strings (e.g. __FILE__).  However,
it does not put a space after the end quote and before the macro,
so instead of replacing the macro, gcc >= 4.7.x thinks it's a
user-defined literal token, and since the lookup obviously fails,
compilation of libstdc++ dies.

This patch just replaces the assert.h header with another one that
will work.  It preserves the same format, just changes the spacing.

Fix 2: Add hack for ioctl() on VxWorks.

ioctl() is supposed to be variadic, but VxWorks only has a three
argument version with the third argument of type int.  This messes
up when the third argument is not implicitly convertible to int.
This adds a macro which wraps around ioctl() and explicitly casts
the third argument to an int.  This way, the most common use case
of ioctl (with a const char * for the third argument) will compile
in C++, where pointers must be explicitly casted to int.

Fix 3: Added vxworks_mkdir_macro fix

This adds a macro to POSIX-ify VxWorks' mkdir() function by
including a macro that wraps the function and takes an (ignored,
but still evaluated) mode argument.

Fix 4:  Add fix to prevent inclusion of regs.h on VxWorks.

VxWorks has it's own regs.h that conflicts with GCC's regs.h, so
just make any replace any references to regs.h in VxWorks with
references to arch/../regs.h, which includes the VxWorks header,
not GCC's header.

Fix 5: Add stdint.h wrapper for VxWorks.

Vxworks stdint.h doesn't have all the typedefs needed for standards
compliance, so add a hack that adds all of the needed typedefs to be
fully compliant to the standard.  Fixes broken libstdc++.

There was additional discussion of adding the necessary macros to get
gcc to have built-in recognition of the types, but I could not get that
to work.  That is also non-essential to this patch, which is primarily
to fix a bug caused by relying on types in stdint.h that vxworks does
not define.

Fix 6: Add unistd.h wrapper for VxWorks.

On VxWorks, unistd.h doesn't define everything it should, like
read/write, etc.  This wrapper adds the things it should define
so everything can be compliant and compile correctly without
manual modification.

Fix 7: Add fix to make write() const correct on VxWorks

VxWorks' write() takes its second argument as non-const, so the
compiler complains if one tries to pass a const pointer to it.
This simply changes the prototype to say it is const so everything
works.  I believe that the prototype is non-const for backwards
compatibility with old verisons of vxworks, but these versions are
not supported by modern GCC, so causing potential bugs on those
platforms is a non-issue.  Modern vxworks will not modify the string
passed to it, so just changing the prototype will work silently.

Fix 8: Make open() call more compatible in gcc/gcov-io.c

In gcc/gcov-io.c, the call to open() only has two arguments. This
is fine, as long as the system open() is standards compliant.
However, on at least one system (vxworks real time processes),
open() is a non-variadic function, so the call fails.  This adds
a third argument passed unconditionally to open for compatibility
with non-variadic open().  On systems with variadic open(), the
extra argument should just be ignored anyway.

There was talk of replacing this change with a fixincludes macro
definition of open(), but this breaks libstdc++-v3.

Fix 9: Added --enable-libstdcxx option.

This patch allows the user to force enable/disable building of
libstdc++-v3 with a --enable-libstdcxx option to be congruent
with the other runtime library options.

The side effect of this, and the main motivation for this patch

[v3] fix bootstrap/54419

2012-09-09 Thread Jonathan Wakely
I've committed the patch from
http://gcc.gnu.org/ml/gcc-patches/2012-09/msg00466.html (with some
fixes to the changelog entry)

2012-09-09  Ulrich Drepper  
Dominique d'Humieres  
Jack Howarth  

PR bootstrap/54419
* acinclude.m4: Define GLIBCXX_CHECK_X86_RDRAND.
* configure.ac: Use GLIBCXX_CHECK_X86_RDRAND to test for rdrand
support in assembler.
* src/c++11/random.cc (__x86_rdrand): Depend on _GLIBCXX_X86_RDRAND.
(random_device::_M_init): Likewise.
(random_device::_M_getval): Likewise.
* configure: Regenerated.
* config.h.in: Regenerated.

Tested x86_64-linux and committed to trunk.
commit 5202106d9ddcfd92989bfa6c11f7e9b2ea61cd10
Author: Jonathan Wakely 
Date:   Sun Sep 9 17:28:50 2012 +0100

2012-09-09  Ulrich Drepper  
Dominique d'Humieres  
Jack Howarth  

PR bootstrap/54419
* acinclude.m4: Define GLIBCXX_CHECK_X86_RDRAND.
* configure.ac: Use GLIBCXX_CHECK_X86_RDRAND to test for rdrand
support in assembler.
* src/c++11/random.cc (__x86_rdrand): Depend on _GLIBCXX_X86_RDRAND.
(random_device::_M_init): Likewise.
(random_device::_M_getval): Likewise.
* configure: Regenerated.
* config.h.in: Regenerated.

diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
index 1179407..267302d 100644
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -3360,6 +3360,26 @@ AC_DEFUN([AC_LC_MESSAGES], [
 ])
 
 dnl
+dnl Check whether rdrand is supported in the assembler.
+AC_DEFUN([GLIBCXX_CHECK_X86_RDRAND], [
+  AC_MSG_CHECKING([for rdrand support in assembler])
+  AC_CACHE_VAL($ac_cv_x86_rdrand, [
+  ac_cv_x86_rdrand=no
+  case "$target" in
+i?86-*-* | \
+x86_64-*-*)
+AC_TRY_COMPILE(, [asm("rdrand %eax");],
+   [ac_cv_x86_rdrand=yes], [ac_cv_x86_rdrand=no])
+  esac
+  ])
+  if test $ac_cv_x86_rdrand = yes; then
+AC_DEFINE(_GLIBCXX_X86_RDRAND, 1,
+   [ Defined if as can handle rdrand. ])
+  fi
+  AC_MSG_RESULT($ac_cv_x86_rdrand)
+])
+
+dnl
 dnl Check whether get_nprocs is available in , and define 
_GLIBCXX_USE_GET_NPROCS.
 dnl
 AC_DEFUN([GLIBCXX_CHECK_GET_NPROCS], [
diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac
index 5c86bb9..555f380 100644
--- a/libstdc++-v3/configure.ac
+++ b/libstdc++-v3/configure.ac
@@ -330,6 +330,9 @@ case "$target" in
 esac
 GLIBCXX_CONDITIONAL(GLIBCXX_LDBL_COMPAT, test $ac_ldbl_compat = yes)
 
+# Check if assembler supports rdrand opcode.
+GLIBCXX_CHECK_X86_RDRAND
+
 # This depends on GLIBCXX_ENABLE_SYMVERS and GLIBCXX_IS_NATIVE.
 GLIBCXX_CONFIGURE_TESTSUITE
 
diff --git a/libstdc++-v3/src/c++11/random.cc b/libstdc++-v3/src/c++11/random.cc
index 3b05318..4342df4 100644
--- a/libstdc++-v3/src/c++11/random.cc
+++ b/libstdc++-v3/src/c++11/random.cc
@@ -50,7 +50,7 @@ namespace std _GLIBCXX_VISIBILITY(default)
   return __ret;
 }
 
-#if defined __i386__ || defined __x86_64__
+#if (defined __i386__ || defined __x86_64__) && defined _GLIBCXX_X86_RDRAND
 unsigned int
 __attribute__ ((target("rdrnd")))
 __x86_rdrand(void)
@@ -75,7 +75,7 @@ namespace std _GLIBCXX_VISIBILITY(default)
 
 if (token == "default")
   {
-#if defined __i386__ || defined __x86_64__
+#if (defined __i386__ || defined __x86_64__) && defined _GLIBCXX_X86_RDRAND
unsigned int eax, ebx, ecx, edx;
// Check availability of cpuid and, for now at least, also the
// CPU signature for Intel's
@@ -118,7 +118,7 @@ namespace std _GLIBCXX_VISIBILITY(default)
   random_device::result_type
   random_device::_M_getval()
   {
-#if (defined __i386__ || defined __x86_64__)
+#if (defined __i386__ || defined __x86_64__) && defined _GLIBCXX_X86_RDRAND
 if (! _M_file)
   return __x86_rdrand();
 #endif


LTO partitioning reorg 2/n

2012-09-09 Thread Jan Hubicka
Hi,
this patch removes the duplication of boundary logic in between
lto_promote_cross_file_statics and compute_ltrans_boundary. With common
representation it is easy to compute boundaries first and the promote the
symbols that appear in some boundary.

This duplication was source of quite few bugs and issues, so hopefully
the new code will run a lot smoother ;)

Bootstrapped/regtested x86_64-linux.

* passes.c (ipa_write_summaries_1): Set state;
do not call compute_ltrans_boundary.
(ipa_write_optimization_summaries): Likewise.
(ipa_write_summaries): compute_ltrans_boundary here.
* lto-streamer.h (lto_symtab_encoder_d): NODES are allocated in heap.
(compute_ltrans_boundary): Update prototype.

* lto.c (lto_wpa_write_files): Do not delete partition encoder;
it is deleted after streaming.
* lto-partition.c (partition_symbol_p): New function.
(promote_var, promote_fn): Remove.
(promote_symbol): New function.
(lto_promote_cross_file_statics): First compute boundaries; rewrite
to lookup the actual boundaries instead of computing them ad-hoc.
Index: lto-streamer.h
===
*** lto-streamer.h  (revision 191107)
--- lto-streamer.h  (working copy)
*** DEF_VEC_ALLOC_O(lto_encoder_entry, heap)
*** 441,447 
  /* Encoder data structure used to stream callgraph nodes.  */
  struct lto_symtab_encoder_d
  {
!   VEC(lto_encoder_entry,gc) *nodes;
pointer_map_t *map;
  };
  
--- 441,447 
  /* Encoder data structure used to stream callgraph nodes.  */
  struct lto_symtab_encoder_d
  {
!   VEC(lto_encoder_entry,heap) *nodes;
pointer_map_t *map;
  };
  
*** bool referenced_from_this_partition_p (s
*** 856,863 
lto_symtab_encoder_t);
  bool reachable_from_this_partition_p (struct cgraph_node *,
  lto_symtab_encoder_t);
! void compute_ltrans_boundary (struct lto_out_decl_state *state,
! lto_symtab_encoder_t encoder);
  
  
  /* In lto-symtab.c.  */
--- 856,862 
lto_symtab_encoder_t);
  bool reachable_from_this_partition_p (struct cgraph_node *,
  lto_symtab_encoder_t);
! lto_symtab_encoder_t compute_ltrans_boundary (lto_symtab_encoder_t encoder);
  
  
  /* In lto-symtab.c.  */
Index: lto-cgraph.c
===
*** lto-cgraph.c(revision 191107)
--- lto-cgraph.c(working copy)
*** output_profile_summary (struct lto_simpl
*** 588,625 
  streamer_write_uhwi_stream (ob->main_stream, 0);
  }
  
- /* Add NODE into encoder as well as nodes it is cloned from.
-Do it in a way so clones appear first.  */
- 
- static void
- add_node_to (lto_symtab_encoder_t encoder, struct cgraph_node *node,
-bool include_body)
- {
-   if (node->clone_of)
- add_node_to (encoder, node->clone_of, include_body);
-   else if (include_body)
- lto_set_symtab_encoder_encode_body (encoder, node);
-   lto_symtab_encoder_encode (encoder, (symtab_node)node);
- }
- 
- /* Add all references in LIST to encoders.  */
- 
- static void
- add_references (lto_symtab_encoder_t encoder,
-   struct ipa_ref_list *list)
- {
-   int i;
-   struct ipa_ref *ref;
-   for (i = 0; ipa_ref_list_reference_iterate (list, i, ref); i++)
- if (symtab_function_p (ref->referred))
-   add_node_to (encoder, ipa_ref_node (ref), false);
- else
-   {
-   struct varpool_node *vnode = ipa_ref_varpool_node (ref);
- lto_symtab_encoder_encode (encoder, (symtab_node)vnode);
-   }
- }
- 
  /* Output all callees or indirect outgoing edges.  EDGE must be the first such
 edge.  */
  
--- 588,593 
*** output_refs (lto_symtab_encoder_t encode
*** 674,684 
lto_destroy_simple_output_block (ob);
  }
  
! /* Find out all cgraph and varpool nodes we want to encode in current unit
!and insert them to encoders.  */
! void
! compute_ltrans_boundary (struct lto_out_decl_state *state,
!lto_symtab_encoder_t in_encoder)
  {
struct cgraph_node *node;
struct cgraph_edge *edge;
--- 642,689 
lto_destroy_simple_output_block (ob);
  }
  
! /* Add NODE into encoder as well as nodes it is cloned from.
!Do it in a way so clones appear first.  */
! 
! static void
! add_node_to (lto_symtab_encoder_t encoder, struct cgraph_node *node,
!bool include_body)
! {
!   if (node->clone_of)
! add_node_to (encoder, node->clone_of, include_body);
!   else if (include_body)
! lto_set_symtab_encoder_encode_body (encoder, node);
!   lto_symtab_encoder_encode (encoder, (symtab_node)node);
! }
! 
! /* Add all references in LIST to encoders.  */
! 
! static void
! add_references (lto_symtab_encoder_t encoder,
!  

Re: out-of-line and arch-specific random_device

2012-09-09 Thread Jonathan Wakely
On 30 August 2012 17:33, Ulrich Drepper  wrote:
> On Thu, Aug 30, 2012 at 11:52 AM, Hans-Peter Nilsson
>  wrote:
>>> From: Ulrich Drepper 
>>> Date: Tue, 28 Aug 2012 05:57:08 +0200
>>
>> This patch (commit r190787) broke build for non-_GLIBCXX_USE_RANDOM_TR1
>> targets.  (See libstdc++-v3/configure.ac and its crossconfig.m4 for a
>> list.)
>
> Should be fixed now.

Apparently not, see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54451

Also, why does random.cc contain a non-member function called
_M_strotoul, which throws an exception claiming to be from
random_device::_M_strtoul?  Can I rename that to something like
__random_device_strtoul so it doesn't use the _M_ prefix used for
member fucntions?


Re: out-of-line and arch-specific random_device

2012-09-09 Thread Ulrich Drepper
On Sun, Sep 9, 2012 at 1:36 PM, Jonathan Wakely  wrote:
> Also, why does random.cc contain a non-member function called
> _M_strotoul,

Copy&paste.  Used to be in the class.  Should be changed now.


Fix libstdc++/54388

2012-09-09 Thread Jonathan Wakely
PR libstdc++/54388
* include/std/array (array::at() const): Ensure lvalue result.
* testsuite/23_containers/array/element_access/54388.cc: New.
* testsuite/23_containers/array/tuple_interface/get_neg.cc: Adjust
dg-error line numbers.
* testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc:
Likewise.

Tested x86_64-linux, committed to trunk, will also commit on the 4.7 branch.
commit d44580f30981e08b492030451ad3ddb90541476f
Author: Jonathan Wakely 
Date:   Sat Sep 8 11:19:15 2012 +0100

PR libstdc++/54388
* include/std/array (array::at() const): Ensure lvalue result.
* testsuite/23_containers/array/element_access/54388.cc: New.
* testsuite/23_containers/array/tuple_interface/get_neg.cc: Adjust
dg-error line numbers.
* testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc:
Likewise.

diff --git a/libstdc++-v3/include/std/array b/libstdc++-v3/include/std/array
index 58263ce..4ee2199 100644
--- a/libstdc++-v3/include/std/array
+++ b/libstdc++-v3/include/std/array
@@ -164,22 +164,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return _M_instance[__n];
   }
 
-#ifdef __EXCEPTIONS
   constexpr const_reference
   at(size_type __n) const
   {
-   return __n < _Nm ? 
-  _M_instance[__n] : throw out_of_range(__N("array::at"));
+   // Result of conditional expression must be an lvalue so use
+   // boolean ? lvalue : (throw-expr, lvalue)
+   return __n < _Nm ? _M_instance[__n]
+ : (std::__throw_out_of_range(__N("array::at")), _M_instance[0]);
   }
-#else
-  const_reference
-  at(size_type __n) const
-  {
-   if (__n >= _Nm)
- std::__throw_out_of_range(__N("array::at"));
-   return _M_instance[__n];
-  }
-#endif
 
   reference 
   front()
diff --git a/libstdc++-v3/testsuite/23_containers/array/element_access/54388.cc 
b/libstdc++-v3/testsuite/23_containers/array/element_access/54388.cc
new file mode 100644
index 000..a69a5ed
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/array/element_access/54388.cc
@@ -0,0 +1,42 @@
+// { 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 
+#include 
+
+struct A
+{
+  bool valid = true;
+  ~A() { valid = false; }
+};
+
+void
+test01()
+{
+  bool test __attribute__((unused)) = true;
+
+  const std::array a;
+  const A& aa = a.at(0);
+  VERIFY(aa.valid);
+}
+
+int main()
+{
+  test01();
+}
diff --git 
a/libstdc++-v3/testsuite/23_containers/array/tuple_interface/get_neg.cc 
b/libstdc++-v3/testsuite/23_containers/array/tuple_interface/get_neg.cc
index ecc25bf..2fc443e 100644
--- a/libstdc++-v3/testsuite/23_containers/array/tuple_interface/get_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/array/tuple_interface/get_neg.cc
@@ -29,4 +29,4 @@ int n3 = std::get<1>(ca);
 
 // { dg-error "static assertion failed" "" { target *-*-* } 275 }
 // { dg-error "static assertion failed" "" { target *-*-* } 283 }
-// { dg-error "static assertion failed" "" { target *-*-* } 291 }
+// { dg-error "static assertion failed" "" { target *-*-* } 267 }
diff --git 
a/libstdc++-v3/testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc
 
b/libstdc++-v3/testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc
index 7263813..97938ba 100644
--- 
a/libstdc++-v3/testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc
+++ 
b/libstdc++-v3/testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc
@@ -22,4 +22,4 @@
 
 typedef std::tuple_element<1, std::array>::type type;
 
-// { dg-error "static assertion failed" "" { target *-*-* } 267 }
+// { dg-error "static assertion failed" "" { target *-*-* } 259 }


[C++ Patch] for c++/54537

2012-09-09 Thread Fabien Chêne
Hi,

The problem here is the misused of the OVL_USED macro. It should only
be applied on OVERLOAD, this patch forces that by checking the
OVL_USED macro. As a result, we need to make sure that we have an
overload by checking its tree code.

Tested x86_64-unknown-linux-gnu. OK to commit ?


2012-09-09  Fabien Chêne  
PR c++/54537
* cp-tree.h: Check OVL_USED with OVERLOAD_CHECK.
* name-lookup.c (do_nonmember_using_decl): Make sure we have an
OVERLOAD before calling OVL_USED.

2012-09-09  Fabien Chêne  

PR c++/54537
* g++.dg/overload/using3.C: New.


-- 
Fabien


54537.patch
Description: Binary data


[PATCH] Use -lgcc in libgcc_so linker script

2012-09-09 Thread Andreas Schwab
The libgcc_s.so linker script (as used by targets using
t-slibgcc-libgcc) refers to libgcc.a, which causes the linker to search
in cwd first, where it might find a completely unrelated libgcc.a
(eg. while building a cross gcc).  Use -lgcc instead so that it is
searched on the library path.

Andreas.

PR target/46191
* config/t-slibgcc-libgcc (SHLIB_MAKE_SOLINK): Use -lgcc instead
of libgcc.a.

---
 libgcc/config/t-slibgcc-libgcc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libgcc/config/t-slibgcc-libgcc b/libgcc/config/t-slibgcc-libgcc
index ec36b27..0668226 100644
--- a/libgcc/config/t-slibgcc-libgcc
+++ b/libgcc/config/t-slibgcc-libgcc
@@ -25,7 +25,7 @@ SHLIB_MAKE_SOLINK = \
(echo "/* GNU ld script"; \
 echo "   Use the shared library, but some functions are only in"; \
 echo "   the static library.  */"; \
-echo "GROUP ( $(SHLIB_SONAME) libgcc.a )" \
+echo "GROUP ( $(SHLIB_SONAME) -lgcc )" \
) > $(SHLIB_DIR)/$(SHLIB_SOLINK)
 SHLIB_INSTALL_SOLINK = \
$(INSTALL_DATA) $(SHLIB_DIR)/$(SHLIB_SOLINK) \
-- 
1.7.12

-- 
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: [v3] fix bootstrap/54419

2012-09-09 Thread Gerald Pfeifer
On Sun, 9 Sep 2012, Jonathan Wakely wrote:
> I've committed the patch from
> http://gcc.gnu.org/ml/gcc-patches/2012-09/msg00466.html (with some
> fixes to the changelog entry)
> 
> 2012-09-09  Ulrich Drepper  
> Dominique d'Humieres  
> Jack Howarth  
> 
> PR bootstrap/54419
> * acinclude.m4: Define GLIBCXX_CHECK_X86_RDRAND.
> * configure.ac: Use GLIBCXX_CHECK_X86_RDRAND to test for rdrand
> support in assembler.
> * src/c++11/random.cc (__x86_rdrand): Depend on _GLIBCXX_X86_RDRAND.
> (random_device::_M_init): Likewise.
> (random_device::_M_getval): Likewise.
> * configure: Regenerated.
> * config.h.in: Regenerated.

amd64-unknown-freebsd8.3 doesn't like this, I'm afraid:

configure: visibility supported: yes
checking for rdrand support in assembler... eval: ${+...}: Bad substitution
gmake[2]: *** [configure-stage1-target-libstdc++-v3] Error 2

Note, this is BSD sh, not bash.  I'll admit that I had a look, and
did not find the culprit right away.

Geraldcommit 5202106d9ddcfd92989bfa6c11f7e9b2ea61cd10
Author: Jonathan Wakely 
Date:   Sun Sep 9 17:28:50 2012 +0100

2012-09-09  Ulrich Drepper  
Dominique d'Humieres  
Jack Howarth  

PR bootstrap/54419
* acinclude.m4: Define GLIBCXX_CHECK_X86_RDRAND.
* configure.ac: Use GLIBCXX_CHECK_X86_RDRAND to test for rdrand
support in assembler.
* src/c++11/random.cc (__x86_rdrand): Depend on _GLIBCXX_X86_RDRAND.
(random_device::_M_init): Likewise.
(random_device::_M_getval): Likewise.
* configure: Regenerated.
* config.h.in: Regenerated.

diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
index 1179407..267302d 100644
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -3360,6 +3360,26 @@ AC_DEFUN([AC_LC_MESSAGES], [
 ])
 
 dnl
+dnl Check whether rdrand is supported in the assembler.
+AC_DEFUN([GLIBCXX_CHECK_X86_RDRAND], [
+  AC_MSG_CHECKING([for rdrand support in assembler])
+  AC_CACHE_VAL($ac_cv_x86_rdrand, [
+  ac_cv_x86_rdrand=no
+  case "$target" in
+i?86-*-* | \
+x86_64-*-*)
+AC_TRY_COMPILE(, [asm("rdrand %eax");],
+   [ac_cv_x86_rdrand=yes], [ac_cv_x86_rdrand=no])
+  esac
+  ])
+  if test $ac_cv_x86_rdrand = yes; then
+AC_DEFINE(_GLIBCXX_X86_RDRAND, 1,
+   [ Defined if as can handle rdrand. ])
+  fi
+  AC_MSG_RESULT($ac_cv_x86_rdrand)
+])
+
+dnl
 dnl Check whether get_nprocs is available in , and define 
_GLIBCXX_USE_GET_NPROCS.
 dnl
 AC_DEFUN([GLIBCXX_CHECK_GET_NPROCS], [
diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac
index 5c86bb9..555f380 100644
--- a/libstdc++-v3/configure.ac
+++ b/libstdc++-v3/configure.ac
@@ -330,6 +330,9 @@ case "$target" in
 esac
 GLIBCXX_CONDITIONAL(GLIBCXX_LDBL_COMPAT, test $ac_ldbl_compat = yes)
 
+# Check if assembler supports rdrand opcode.
+GLIBCXX_CHECK_X86_RDRAND
+
 # This depends on GLIBCXX_ENABLE_SYMVERS and GLIBCXX_IS_NATIVE.
 GLIBCXX_CONFIGURE_TESTSUITE
 
diff --git a/libstdc++-v3/src/c++11/random.cc b/libstdc++-v3/src/c++11/random.cc
index 3b05318..4342df4 100644
--- a/libstdc++-v3/src/c++11/random.cc
+++ b/libstdc++-v3/src/c++11/random.cc
@@ -50,7 +50,7 @@ namespace std _GLIBCXX_VISIBILITY(default)
   return __ret;
 }
 
-#if defined __i386__ || defined __x86_64__
+#if (defined __i386__ || defined __x86_64__) && defined _GLIBCXX_X86_RDRAND
 unsigned int
 __attribute__ ((target("rdrnd")))
 __x86_rdrand(void)
@@ -75,7 +75,7 @@ namespace std _GLIBCXX_VISIBILITY(default)
 
 if (token == "default")
   {
-#if defined __i386__ || defined __x86_64__
+#if (defined __i386__ || defined __x86_64__) && defined _GLIBCXX_X86_RDRAND
unsigned int eax, ebx, ecx, edx;
// Check availability of cpuid and, for now at least, also the
// CPU signature for Intel's
@@ -118,7 +118,7 @@ namespace std _GLIBCXX_VISIBILITY(default)
   random_device::result_type
   random_device::_M_getval()
   {
-#if (defined __i386__ || defined __x86_64__)
+#if (defined __i386__ || defined __x86_64__) && defined _GLIBCXX_X86_RDRAND
 if (! _M_file)
   return __x86_rdrand();
 #endif


Re: [v3] fix bootstrap/54419

2012-09-09 Thread Jonathan Wakely
On 9 September 2012 20:43, Gerald Pfeifer  wrote:
> On Sun, 9 Sep 2012, Jonathan Wakely wrote:
>> I've committed the patch from
>> http://gcc.gnu.org/ml/gcc-patches/2012-09/msg00466.html (with some
>> fixes to the changelog entry)
>>
>> 2012-09-09  Ulrich Drepper  
>> Dominique d'Humieres  
>> Jack Howarth  
>>
>> PR bootstrap/54419
>> * acinclude.m4: Define GLIBCXX_CHECK_X86_RDRAND.
>> * configure.ac: Use GLIBCXX_CHECK_X86_RDRAND to test for rdrand
>> support in assembler.
>> * src/c++11/random.cc (__x86_rdrand): Depend on _GLIBCXX_X86_RDRAND.
>> (random_device::_M_init): Likewise.
>> (random_device::_M_getval): Likewise.
>> * configure: Regenerated.
>> * config.h.in: Regenerated.
>
> amd64-unknown-freebsd8.3 doesn't like this, I'm afraid:
>
> configure: visibility supported: yes
> checking for rdrand support in assembler... eval: ${+...}: Bad substitution
> gmake[2]: *** [configure-stage1-target-libstdc++-v3] Error 2
>
> Note, this is BSD sh, not bash.  I'll admit that I had a look, and
> did not find the culprit right away.

Yes, I don't know why it didn't show up in testing, but that patch was
not correct, it failed on netbsd too.

Fixed by this patch.  Tested x86_64-linux and x86_64-netbsd, committed to trunk.

Also, Jack, why is the variable called ac_cv_x86_rdrand rather than
glibcxx_x86_rdrand to be consistent with every other variable in
libstdc++-v3/acinclude.m4?  And why _GLIBCXX_X86_RDRAND not something
like _GLIBCXX_HAVE_AS_X86_RDRAND?  The bootstrap failure is fixed, but
I think we should change those names.
commit 1594fd2acc7453aeed22cec16dff41e0dc490eee
Author: Jonathan Wakely 
Date:   Sun Sep 9 20:00:16 2012 +0100

PR bootstrap/54419
* acinclude.m4 (GLIBCXX_CHECK_X86_RDRAND): Remove stray character.
* configure: Regenerated.

diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
index 267302d..c9b8d37 100644
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -3363,7 +3363,7 @@ dnl
 dnl Check whether rdrand is supported in the assembler.
 AC_DEFUN([GLIBCXX_CHECK_X86_RDRAND], [
   AC_MSG_CHECKING([for rdrand support in assembler])
-  AC_CACHE_VAL($ac_cv_x86_rdrand, [
+  AC_CACHE_VAL(ac_cv_x86_rdrand, [
   ac_cv_x86_rdrand=no
   case "$target" in
 i?86-*-* | \


Re: [v3] fix bootstrap/54419

2012-09-09 Thread Gerald Pfeifer
On Sun, 9 Sep 2012, Gerald Pfeifer wrote:
> amd64-unknown-freebsd8.3 doesn't like this, I'm afraid:
> 
> configure: visibility supported: yes
> checking for rdrand support in assembler... eval: ${+...}: Bad substitution
> gmake[2]: *** [configure-stage1-target-libstdc++-v3] Error 2
> 
> Note, this is BSD sh, not bash.  I'll admit that I had a look, and
> did not find the culprit right away.

Actually, I did just after sending that mail.  If my bootstrap
procedes beyond the point of failure, I guess I'll go ahead and
commit.

:

Well, I see our mails crossed and you found the same. ;-)  Thanks.

Gerald


2012-09-09  Gerald Pfeifer  

* acinclude.m4 (GLIBCXX_CHECK_X86_RDRAND): Fix invocation of
AC_CACHE_VAL.
* configure: Regenerated.

Index: acinclude.m4
===
--- acinclude.m4(revision 191118)
+++ acinclude.m4(working copy)
@@ -3363,7 +3363,7 @@
 dnl Check whether rdrand is supported in the assembler.
 AC_DEFUN([GLIBCXX_CHECK_X86_RDRAND], [
   AC_MSG_CHECKING([for rdrand support in assembler])
-  AC_CACHE_VAL($ac_cv_x86_rdrand, [
+  AC_CACHE_VAL(ac_cv_x86_rdrand, [
   ac_cv_x86_rdrand=no
   case "$target" in
 i?86-*-* | \


Re: [PATCH, libstdc++] Add proper OpenBSD support

2012-09-09 Thread Jonathan Wakely
Oops, forgot to correct the gcc-patches email address...

On 9 September 2012 21:07, Jonathan Wakely wrote:
> On 4 September 2012 20:26, Mark Kettenis wrote:
>> Fixes a few testcases.  Mostly based on the existing
>> NetBSD/FreeBSD/Darwin code.
>>
>> 2012-09-04  Mark Kettenis  
>>
>> * configure.host (*-*-openbsd*) Set cpu_include_dir.
>> * config/os/bsd/openbsd/ctype_base.h: New file.
>> * config/os/bsd/openbsd/ctype_configure_char.cc: New file.
>> * config/os/bsd/openbsd/ctype_inline.h: New file.
>> * config/os/bsd/openbsd/os_defines.h: New file.
>
> This patch is OK, thanks.  Do you want me to commit it for you?
>
> It shouoldn't stop the patch going in, but I assume that this test
> fails on OpenBSD even with your patch applied?
>
> #include 
> #include 
>
> class gnu_ctype: public std::ctype { };
>
> int main()
> {
>   gnu_ctype gctype;
>
>   assert(gctype.is(std::ctype_base::xdigit, L'a'));
> }


Re: [v3] fix bootstrap/54419

2012-09-09 Thread Dominique Dhumieres
> Also, Jack, why is the variable called ac_cv_x86_rdrand rather than
> glibcxx_x86_rdrand to be consistent with every other variable in
> libstdc++-v3/acinclude.m4?  And why _GLIBCXX_X86_RDRAND not something
> like _GLIBCXX_HAVE_AS_X86_RDRAND?  The bootstrap failure is fixed, but

Although I cannot answer for Jack, let me note that this was so in the
original non-working patch at

http://gcc.gnu.org/bugzilla/attachment.cgi?id=28127

Aren't the "c++ runtime libs" maintainers know what they are doing?

> I think we should change those names.

You are on the driver seat;-)

Dominique



Re: [PATCH] Further OpenBSD/amd64 and OpenBSD/i386 improvements

2012-09-09 Thread Gerald Pfeifer
Hi Mark,

On Tue, 4 Sep 2012, Mark Kettenis wrote:
> Here are some additional fixes for OpenBSD that fix a fair number of
> failing testcases.  I can split this up in smaller patches if that's
> preferred.

in general having one patch per issue is preferred, and it makes it
easier and quicker to get things reviewed.

Also, can you note how you tested things as part of patch submission?

For example, "tested on i386-unknown-openbsd83.2 without regressions",
and ideally submitting those results to gcc-testresu...@gcc.gnu.org
via $GCC_SOURCE/contrib/test_summary.

(Ideally, a before/after test submitted there will nicely reflect the
improvements your patch provides.  For some FreeBSD targets I am running
a nightly tester, and run special one-off tests in between for patches.
All these appear on gcc-testresults.)

> I believe I submitted the openbsd-stdint.h bit before.  We consistenly
> use "long long" types for the *max_t types, on both 32-bit and 64-bit
> platforms wheras GCC defaults to using "long" on 32-bit platforms and
> "long long" on 64-bit platforms.  Hence the need for overrides.

Yes, you did.  I went ahead an applied this per the patch below,
since by definition it can only affect OpenBSD is looks straighforward.

Gerald


2012-09-09  Mark Kettenis  

* config/openbsd-stdint.h (INTMAX_TYPE, UINTMAX_TYPE): Define.

Index: config/openbsd-stdint.h
===
--- config/openbsd-stdint.h (revision 191119)
+++ config/openbsd-stdint.h (working copy)
@@ -26,6 +26,9 @@
 #define UINT_FAST16_TYPE   "unsigned int"
 #define UINT_FAST32_TYPE   "unsigned int"
 #define UINT_FAST64_TYPE   "long long unsigned int"
+
+#define INTMAX_TYPE"long long int"
+#define UINTMAX_TYPE   "long long unsigned int"
  
 #define INTPTR_TYPE"long int"
 #define UINTPTR_TYPE   "long unsigned int"


[wwwdocs] gcc-3.1/changes.html, adjust Adacore link

2012-09-09 Thread Gerald Pfeifer
Applied.

Gerald

Index: htdocs/gcc-3.1/changes.html
===
RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-3.1/changes.html,v
retrieving revision 1.64
diff -u -3 -p -r1.64 changes.html
--- htdocs/gcc-3.1/changes.html 27 Nov 2010 20:24:33 -  1.64
+++ htdocs/gcc-3.1/changes.html 9 Sep 2012 22:06:42 -
@@ -242,7 +242,7 @@ documentation.
 
 Ada
 
-http://www.adacore.com/home/";>Ada Core Technologies, Inc,
+http://www.adacore.com/";>Ada Core Technologies, Inc,
 has contributed 
 its GNAT Ada 95 front end and associated tools. The GNAT compiler fully 
 implements the Ada language as defined by the ISO/IEC 8652 standard.


Re: PR 43852: new configure option --disable-libstdcxx-verbose

2012-09-09 Thread Jonathan Wakely
On 27 August 2012 18:15, Jonathan Wakely wrote:
> Unless anyone has objections I'm going to commit this to trunk,
> implementing Sebastian's idea to disable the verbose terminate handler
> and the "pure virtual function called" message, which write to stderr
> when a process terminates. This allows embedded systems to avoid
> pulling in the demangler and I/O code, reducing the footprint of
> libstdc++.
>
> 2012-08-27  Sebastian Huber  
> Jonathan Wakely  
>
> * acinclude.m4 (GLIBCXX_ENABLE_VERBOSE): Define.
> * configure.ac (GLIBCXX_ENABLE_VERBOSE): Use it.
> * config.h.in: Regenerate.
> * configure: Likewise.
> * libsupc++/eh_term_handler.cc (_GLIBCXX_VERBOSE): Check new macro.
> * libsupc++/pure.cc (_GLIBCXX_VERBOSE): Likewise.
> * doc/xml/manual/configure.xml (--disable-libstdcxx-verbose): 
> Document.
> * doc/html/manual/configure.html: Regenerate.
>
> Tested on x86_64-linux.

I've committed this to trunk now.
commit 80c2524507ac793cf601934345a6183baf63a5d6
Author: Jonathan Wakely 
Date:   Sun Aug 26 15:45:08 2012 +0100

2012-08-27  Sebastian Huber  
Jonathan Wakely  

* acinclude.m4 (GLIBCXX_ENABLE_VERBOSE): Define.
* configure.ac (GLIBCXX_ENABLE_VERBOSE): Use it.
* config.h.in: Regenerate.
* configure: Likewise.
* libsupc++/eh_term_handler.cc (_GLIBCXX_VERBOSE): Check new macro.
* libsupc++/pure.cc (_GLIBCXX_VERBOSE): Likewise.
* doc/xml/manual/configure.xml (--disable-libstdcxx-verbose): Document.
* doc/html/manual/configure.html: Regenerate.

diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
index 1179407..48d932c 100644
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -2317,6 +2317,31 @@ AC_DEFUN([GLIBCXX_ENABLE_HOSTED], [
 
 
 dnl
+dnl Check if the user wants a non-verbose library implementation.
+dnl
+dnl --disable-libstdcxx-verbose will turn off descriptive messages to
+dnl standard error on termination.
+dnl
+dnl Defines:
+dnl  _GLIBCXX_VERBOSE (always defined, either to 1 or 0)
+dnl
+AC_DEFUN([GLIBCXX_ENABLE_VERBOSE], [
+  AC_ARG_ENABLE([libstdcxx-verbose],
+AC_HELP_STRING([--disable-libstdcxx-verbose],
+  [disable termination messages to standard error]),,
+  [enable_libstdcxx_verbose=yes])
+  if test x"$enable_libstdcxx_verbose" = xyes; then
+verbose_define=1
+  else
+AC_MSG_NOTICE([verbose termination messages are disabled])
+verbose_define=0
+  fi
+  AC_DEFINE_UNQUOTED(_GLIBCXX_VERBOSE, $verbose_define,
+[Define to 1 if a verbose library is built, or 0 otherwise.])
+])
+
+
+dnl
 dnl Check for template specializations for the 'long long' type.
 dnl The result determines only whether 'long long' I/O is enabled; things
 dnl like numeric_limits<> specializations are always available.
diff --git a/libstdc++-v3/libsupc++/eh_term_handler.cc 
b/libstdc++-v3/libsupc++/eh_term_handler.cc
index 52a0745..f4bf2a3 100644
--- a/libstdc++-v3/libsupc++/eh_term_handler.cc
+++ b/libstdc++-v3/libsupc++/eh_term_handler.cc
@@ -1,5 +1,5 @@
 // -*- C++ -*- std::terminate handler
-// Copyright (C) 2002, 2003, 2009 Free Software Foundation
+// Copyright (C) 2002-2012 Free Software Foundation
 //
 // This file is part of GCC.
 //
@@ -28,19 +28,17 @@
 /* We default to the talkative, informative handler in a normal hosted
library.  This pulls in the demangler, the dyn-string utilities, and
elements of the I/O library.  For a low-memory environment, you can return
-   to the earlier "silent death" handler by including , initializing
-   to "std::abort", and rebuilding the library.  In a freestanding mode, we
-   default to this latter approach.  */
-
-#if ! _GLIBCXX_HOSTED
-# include 
-#endif
+   to the earlier "silent death" handler by configuring GCC with
+   --disable-libstdcxx-verbose and rebuilding the library.
+   In a freestanding environment, we default to this latter approach.  */
 
+#if _GLIBCXX_HOSTED && _GLIBCXX_VERBOSE
 /* The current installed user handler.  */
 std::terminate_handler __cxxabiv1::__terminate_handler =
-#if _GLIBCXX_HOSTED
__gnu_cxx::__verbose_terminate_handler;
 #else
-   std::abort;
+# include 
+/* The current installed user handler.  */
+std::terminate_handler __cxxabiv1::__terminate_handler = std::abort;
 #endif
 
diff --git a/libstdc++-v3/libsupc++/pure.cc b/libstdc++-v3/libsupc++/pure.cc
index 4879e59..a774597 100644
--- a/libstdc++-v3/libsupc++/pure.cc
+++ b/libstdc++-v3/libsupc++/pure.cc
@@ -1,5 +1,5 @@
 // -*- C++ -*- 
-// Copyright (C) 2000, 2001, 2009, 2011 Free Software Foundation
+// Copyright (C) 2000-2012 Free Software Foundation
 //
 // This file is part of GCC.
 //
@@ -26,7 +26,7 @@
 #include 
 #include "unwind-cxx.h"
 
-#if _GLIBCXX_HOSTED
+#if _GLIBCXX_HOSTED && _GLIBCXX_VERBOSE
 #ifdef _GLIBCXX_HAVE_UNISTD_H
 # include 
 # define writestr(str) write(2, str, sizeof(str) - 1)
diff --git a/libstdc++-v3/doc/xml

Re: [C++ Patch] for c++/54537

2012-09-09 Thread Jason Merrill

OK.

Jason


RE: [PATCH,i386] fma4 addition for bdver2

2012-09-09 Thread Gopalasubramanian, Ganesh
Hi,

The second change (done in config/i386/driver-i386.c (host_detect_local_cpu)) 
is not reflected in svn revision 191109.
Since we are handling the fma instruction selection in i386.c\i386.md, we need 
not disable the flag in driver.

Let me know your opinion.

Regards
Ganesh

-Original Message-
From: Gopalasubramanian, Ganesh 
Sent: Wednesday, September 05, 2012 3:41 PM
To: gcc-patches@gcc.gnu.org
Cc: Uros Bizjak (ubiz...@gmail.com)
Subject: [PATCH,i386] fma4 addition for bdver2 

Hello,

FMA4 and FMA3 ISA are implemented in bdver2 target.
FMA3 is selected by default. 
This patch supports the use of FMA4 intrinsics for bdver2 targets.

Is it OK for trunk?

Regards
Ganesh

2012-09-05  Ganesh Gopalasubramanian  

* config/i386/i386.md : Comments on fma4 instruction 
selection reflect requirement on register pressure based
cost model.
   
* config/i386/driver-i386.c (host_detect_local_cpu): fma4
flag is set-reset as informed by the cpuid flag.

* config/i386/i386.c (processor_alias_table): fma4
flag is enabled for bdver2.

Index: gcc/config/i386/i386.md
===
--- gcc/config/i386/i386.md (revision 190830)
+++ gcc/config/i386/i386.md (working copy)
@@ -659,9 +659,11 @@
 (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.
+;; Fma instruction selection has to be done based on
+;; register pressure. For generating fma4, a cost model
+;; based on register pressure is required. Till then,
+;; fma4 instruction is disabled for targets that implement
+;; both fma and fma4 instruction sets.
 (eq_attr "isa" "fma4")
   (symbol_ref "TARGET_FMA4 && !TARGET_FMA")
]
Index: gcc/config/i386/driver-i386.c
===
--- gcc/config/i386/driver-i386.c   (revision 190830)
+++ gcc/config/i386/driver-i386.c   (working copy)
@@ -483,8 +483,6 @@
   has_abm = ecx & bit_ABM;
   has_lwp = ecx & bit_LWP;
   has_fma4 = ecx & bit_FMA4;
-  if (vendor == SIG_AMD && has_fma4 && has_fma)
-   has_fma4 = 0;
   has_xop = ecx & bit_XOP;
   has_tbm = ecx & bit_TBM;
   has_lzcnt = ecx & bit_LZCNT;
Index: gcc/config/i386/i386.c
===
--- gcc/config/i386/i386.c  (revision 190830)
+++ gcc/config/i386/i386.c  (working copy)
@@ -3164,7 +3164,7 @@
   {"bdver2", PROCESSOR_BDVER2, CPU_BDVER2,
PTA_64BIT | PTA_MMX | PTA_SSE | PTA_SSE2 | PTA_SSE3
| PTA_SSE4A | PTA_CX16 | PTA_ABM | PTA_SSSE3 | PTA_SSE4_1
-   | PTA_SSE4_2 | PTA_AES | PTA_PCLMUL | PTA_AVX
+   | PTA_SSE4_2 | PTA_AES | PTA_PCLMUL | PTA_AVX | PTA_FMA4
| PTA_XOP | PTA_LWP | PTA_BMI | PTA_TBM | PTA_F16C
| PTA_FMA},
   {"btver1", PROCESSOR_BTVER1, CPU_GENERIC64,

Regards
Ganesh



Re: [PATCH 5/6] Thread pointer built-in functions, xtensa [PING]

2012-09-09 Thread Chung-Lin Tang
On 2012/8/28 下午 04:15, Chung-Lin Tang wrote:
> On 12/7/12 下午2:52, Chung-Lin Tang wrote:
> Xtensa parts updated to use MD pattern.
> 
> Thanks,
> Chung-Lin
> 
> * config/xtensa/xtensa.md (get_thread_pointersi): Renamed from
> load_tp.
> (set_thread_pointersi): Renamed from set_tp.
> * config/xtensa/xtensa.c
> (xtensa_legitimize_tls_address): Change gen_load_tp calls to
> gen_get_thread_pointersi.
> (xtensa_builtin): Remove XTENSA_BUILTIN_THREAD_POINTER and
> XTENSA_BUILTIN_SET_THREAD_POINTER.
> (xtensa_init_builtins): Remove __builtin_thread_pointer,
> __builtin_set_thread_pointer machine-specific builtins.
> (xtensa_fold_builtin): Remove XTENSA_BUILTIN_THREAD_POINTER,
> XTENSA_BUILTIN_SET_THREAD_POINTER cases.
> (xtensa_expand_builtin): Remove XTENSA_BUILTIN_THREAD_POINTER,
> XTENSA_BUILTIN_SET_THREAD_POINTER cases.
> 

Ping.



Re: [PATCH 3/6] Thread pointer built-in functions, arm [PING]

2012-09-09 Thread Chung-Lin Tang
On 2012/8/28 下午 04:14, Chung-Lin Tang wrote:
> On 12/7/12 5:47 PM, Ramana Radhakrishnan wrote:
>> On 12 July 2012 07:52, Chung-Lin Tang  wrote:
>>> ARM parts, no further notes.
>>>
>>
>> ARM parts are ok, modulo approval for generic parts  and no
>> regressions with testing on arm-linux-gnueabi.
> 
> ARM parts updated to use MD patterns.
> 
> Thanks,
> Chung-Lin
> 
> * config/arm/arm.md (get_thread_pointersi): New pattern.
> * config/arm/arm-protos.h (arm_load_tp): Add extern declaration.
> * config/arm/arm.c (arm_load_tp): Remove static.
> (arm_builtins): Remove ARM_BUILTIN_THREAD_POINTER.
> (arm_init_tls_builtins): Remove function.
> (arm_init_builtins): Remove call to arm_init_tls_builtins().
> (arm_expand_builtin): Remove ARM_BUILTIN_THREAD_POINTER case.

Ping.




Re: [PATCH, libstdc++] Add proper OpenBSD support

2012-09-09 Thread Mark Kettenis
> Date: Sun, 9 Sep 2012 21:07:39 +0100
> From: Jonathan Wakely 
> 
> On 4 September 2012 20:26, Mark Kettenis wrote:
> > Fixes a few testcases.  Mostly based on the existing
> > NetBSD/FreeBSD/Darwin code.
> >
> > 2012-09-04  Mark Kettenis  
> >
> > * configure.host (*-*-openbsd*) Set cpu_include_dir.
> > * config/os/bsd/openbsd/ctype_base.h: New file.
> > * config/os/bsd/openbsd/ctype_configure_char.cc: New file.
> > * config/os/bsd/openbsd/ctype_inline.h: New file.
> > * config/os/bsd/openbsd/os_defines.h: New file.
> 
> This patch is OK, thanks.  Do you want me to commit it for you?

Yes please.

> It shouoldn't stop the patch going in, but I assume that this test
> fails on OpenBSD even with your patch applied?
> 
> #include 
> #include 
> 
> class gnu_ctype: public std::ctype { };
> 
> int main()
> {
>   gnu_ctype gctype;
> 
>   assert(gctype.is(std::ctype_base::xdigit, L'a'));
> }

Interestingly enough, it doesn't fail without my diff.  But it does
fail for OpenBSD's system compiler (GCC 4.2.1 with a lot of local
modifications).  As far as I can determine this is the result of
ctype_base::mask being an 8-bit integer type which doesn't go well
with the generic ctype_members.cc implementation.  Probably need to
have an OpenBSD-specific implementation just like newlib.  Looking
into that now.

Thanks again,

Mark