[Patch, i386] Separate Intel processor with expanded ISA

2013-12-28 Thread Allan Sandfeld Jensen
The function dispatcher might currently choose functions declared with 
target("arch=ivybridge") on a Sandy Bridge CPU. This happens because the 
function is only detected as sandybridge when generated. The attached patch 
detects Westmere, Ivybridge and Broadwell processors based on new ISAs they 
support.

Regards
`Allan
Index: gcc/ChangeLog
===
--- gcc/ChangeLog	(revision 206233)
+++ gcc/ChangeLog	(working copy)
@@ -1,3 +1,9 @@
+2013-12-29  Allan Sandfeld Jensen  
+
+	* config/i386/i386.c (get_builtin_code_for_version): Separate
+	Westmere from Nehalem, Ivy Bridge from Sandy Bridge and
+	Broadwell from Haswell. 
+
 2013-12-28  Eric Botcazou  
 
 	* doc/invoke.texi (output file options): Document -fada-spec-parent.
Index: gcc/config/i386/i386.c
===
--- gcc/config/i386/i386.c	(revision 206233)
+++ gcc/config/i386/i386.c	(working copy)
@@ -30030,18 +30005,27 @@
 	  priority = P_PROC_SSSE3;
 	  break;
 	case PROCESSOR_NEHALEM:
-	  /* We translate "arch=corei7" and "arch=nehelam" to
-		 "corei7" so that it will be mapped to M_INTEL_COREI7
-		 as cpu type to cover all M_INTEL_COREI7_XXXs.  */
-	  arg_str = "corei7";
+	  if (new_target->x_ix86_isa_flags & OPTION_MASK_ISA_AES)
+		arg_str = "westmere";
+	  else
+		/* We translate "arch=corei7" and "arch=nehelam" to
+		   "corei7" so that it will be mapped to M_INTEL_COREI7
+		   as cpu type to cover all M_INTEL_COREI7_XXXs.  */
+		arg_str = "corei7";
 	  priority = P_PROC_SSE4_2;
 	  break;
 	case PROCESSOR_SANDYBRIDGE:
-	  arg_str = "sandybridge";
+	  if (new_target->x_ix86_isa_flags & OPTION_MASK_ISA_F16C)
+		arg_str = "ivybridge";
+	  else
+		arg_str = "sandybridge";
 	  priority = P_PROC_AVX;
 	  break;
 	case PROCESSOR_HASWELL:
-	  arg_str = "haswell";
+	  if (new_target->x_ix86_isa_flags & OPTION_MASK_ISA_ADX)
+		arg_str = "broadwell";
+	  else
+		arg_str = "haswell";
 	  priority = P_PROC_AVX2;
 	  break;
 	case PROCESSOR_BONNELL:


Re: [PATCH i386 7/8] [AVX-512] Add tests.

2013-12-28 Thread Kirill Yukhin
Hello,
On 18 Dec 17:08, Uros Bizjak wrote:
> Whoa.
> 
> --- a/gcc/config/i386/sse.md
> +++ b/gcc/config/i386/sse.md
> 
> No, not in this patch.
Okay, moved it to 5/8 patch.

--
Thanks, K


libgo patch committed: Work around Solaris oddity

2013-12-28 Thread Ian Lance Taylor
If one thread does a connect to localhost on a non-blocking socket such
that the connect fails with EINPROGRESS, and then another thread accepts
the connection and closes the accepted socket, and then the first thread
does the connect again, that connect should succeed and return a socket
whose other end is closed.  For some reason, on Solaris, the second
connect fails with an error of EINVAL, a possibility that is not
documented on the connect man page.  This case arises in some of the
libgo testsuite.  This patch works around the problem by testing for
this possibility on Solaris.  The same patch has been applied to the
master Go repository.  Bootstrapped and ran Go testsuite on
x86_64-unknown-linux-gnu, which I admit proves little for a
Solaris-specific patch.  I also tested the specific patch on
i386-pc-solaris2.11, where it fixes a testsuite failure.  Committed to
mainline and 4.8 branch.

Ian

diff -r 0d4f83bb938b src/pkg/net/fd_unix.go
--- a/src/pkg/net/fd_unix.go	Sat Dec 28 20:33:05 2013 +1100
+++ b/src/pkg/net/fd_unix.go	Sat Dec 28 09:37:28 2013 -0800
@@ -80,6 +80,16 @@
 		if err == nil || err == syscall.EISCONN {
 			break
 		}
+
+		// On Solaris we can see EINVAL if the socket has
+		// already been accepted and closed by the server.
+		// Treat this as a successful connection--writes to
+		// the socket will see EOF.  For details and a test
+		// case in C see http://golang.org/issue/6828.
+		if runtime.GOOS == "solaris" && err == syscall.EINVAL {
+			break
+		}
+
 		if err != syscall.EINPROGRESS && err != syscall.EALREADY && err != syscall.EINTR {
 			return err
 		}


Re: PATCH: PR target/59605: Create jump_around_label only if it doesn't exist

2013-12-28 Thread Jakub Jelinek
On Thu, Dec 26, 2013 at 06:31:10PM -0800, H.J. Lu wrote:
> 2013-12-26   H.J. Lu  
> 
>   PR target/59605
>   * config/i386/i386.c (ix86_expand_set_or_movmem): Create
>   jump_around_label only if it doesn't exist.
> 
> gcc/testsuite/
> 
> 2013-12-26   H.J. Lu  
> 
>   PR target/59605
>   * gcc.dg/pr59605.c: New test.

This is ok, thanks.

Jakub


Document -fada-spec-parent

2013-12-28 Thread Eric Botcazou
Tested on x86_64-suse-linux, applied on the mainline and 4.8 branch.


2013-12-28  Eric Botcazou  

* doc/invoke.texi (output file options): Document -fada-spec-parent.


-- 
Eric Botcazou
Index: doc/invoke.texi
===
--- doc/invoke.texi	(revision 206166)
+++ doc/invoke.texi	(working copy)
@@ -161,7 +161,7 @@ in the following sections.
 -pipe  -pass-exit-codes  @gol
 -x @var{language}  -v  -###  --help@r{[}=@var{class}@r{[},@dots{}@r{]]}  --target-help  @gol
 --version -wrapper @@@var{file} -fplugin=@var{file} -fplugin-arg-@var{name}=@var{arg}  @gol
--fdump-ada-spec@r{[}-slim@r{]} -fada-spec-parent=@var{arg} -fdump-go-spec=@var{file}}
+-fdump-ada-spec@r{[}-slim@r{]} -fada-spec-parent=@var{unit} -fdump-go-spec=@var{file}}
 
 @item C Language Options
 @xref{C Dialect Options,,Options Controlling C Dialect}.
@@ -1518,10 +1518,15 @@ for the plugin called @var{name}.
 
 @item -fdump-ada-spec@r{[}-slim@r{]}
 @opindex fdump-ada-spec
-For C and C++ source and include files, generate corresponding Ada
-specs. @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
+For C and C++ source and include files, generate corresponding Ada specs.
+@xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
 GNAT User's Guide}, which provides detailed documentation on this feature.
 
+@item -fada-spec-parent=@var{unit}
+@opindex fada-spec-parent
+In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
+Ada specs as child units of parent @var{unit}.
+
 @item -fdump-go-spec=@var{file}
 @opindex fdump-go-spec
 For input files in any language, generate corresponding Go


Adjust -fdump-ada-spec after C++ decloning patch

2013-12-28 Thread Eric Botcazou
The C++ decloning patch revealed that the -fdump-ada-spec code handling 
constructors and destructors was too fragile.  This patch revamps it.

Tested on x86_64-suse-linux, applied on the mainline.


2013-12-28  Eric Botcazou  

c-family/
* c-ada-spec.c (print_constructor): New function.
(print_destructor): Retrieve the origin of the destructor.
(print_ada_declaration): Revamp handling of constructors/destructors.


-- 
Eric Botcazou
Index: c-family/c-ada-spec.c
===
--- c-family/c-ada-spec.c	(revision 206166)
+++ c-family/c-ada-spec.c	(working copy)
@@ -2521,20 +2521,34 @@ dump_nested_types (pretty_printer *buffe
   TREE_VISITED (t) = 1;
 }
 
+/* Dump in BUFFER constructor spec corresponding to T.  */
+
+static void
+print_constructor (pretty_printer *buffer, tree t)
+{
+  tree decl_name = DECL_NAME (DECL_ORIGIN (t));
+
+  pp_string (buffer, "New_");
+  pp_ada_tree_identifier (buffer, decl_name, t, false);
+}
+
 /* Dump in BUFFER destructor spec corresponding to T.  */
 
 static void
 print_destructor (pretty_printer *buffer, tree t)
 {
-  const char *s = IDENTIFIER_POINTER (DECL_NAME (t));
+  tree decl_name = DECL_NAME (DECL_ORIGIN (t));
+  const char *s = IDENTIFIER_POINTER (decl_name);
 
   if (*s == '_')
-for (s += 2; *s != ' '; s++)
-  pp_character (buffer, *s);
+{
+  for (s += 2; *s != ' '; s++)
+	pp_character (buffer, *s);
+}
   else
 {
   pp_string (buffer, "Delete_");
-  pp_ada_tree_identifier (buffer, DECL_NAME (t), t, false);
+  pp_ada_tree_identifier (buffer, decl_name, t, false);
 }
 }
 
@@ -2785,7 +2799,7 @@ print_ada_declaration (pretty_printer *b
 }
   else if (TREE_CODE (t) == FUNCTION_DECL)
 {
-  bool is_function = true, is_abstract_class = false;
+  bool is_function, is_abstract_class = false;
   bool is_method = TREE_CODE (TREE_TYPE (t)) == METHOD_TYPE;
   tree decl_name = DECL_NAME (t);
   int prev_in_function = in_function;
@@ -2805,24 +2819,21 @@ print_ada_declaration (pretty_printer *b
 	  is_copy_constructor = cpp_check (t, IS_COPY_CONSTRUCTOR);
 	}
 
-  /* Skip __comp_dtor destructor which is redundant with the '~class()'
-	 destructor.  */
-  if (is_destructor
-	  && !strncmp (IDENTIFIER_POINTER (decl_name), "__comp", 6))
-	return 0;
-
   /* Skip copy constructors: some are internal only, and those that are
 	 not cannot be called easily from Ada anyway.  */
   if (is_copy_constructor)
 	return 0;
 
-  /* If this function has an entry in the dispatch table, we cannot
-	 omit it.  */
-  if (!DECL_VINDEX (t) && *IDENTIFIER_POINTER (decl_name) == '_')
+  if (is_constructor || is_destructor)
 	{
-	  if (IDENTIFIER_POINTER (decl_name)[1] == '_')
+	  /* Only consider constructors/destructors for complete objects.  */
+	  if (strncmp (IDENTIFIER_POINTER (decl_name), "__comp", 6) != 0)
 	return 0;
+	}
 
+  /* If this function has an entry in the vtable, we cannot omit it.  */
+  else if (!DECL_VINDEX (t) && *IDENTIFIER_POINTER (decl_name) == '_')
+	{
 	  INDENT (spc);
 	  pp_string (buffer, "--  skipped func ");
 	  pp_string (buffer, IDENTIFIER_POINTER (decl_name));
@@ -2832,19 +2843,22 @@ print_ada_declaration (pretty_printer *b
   if (need_indent)
 	INDENT (spc);
 
-  if (is_constructor)
-	pp_string (buffer, "function New_");
-  else if (VOID_TYPE_P (TREE_TYPE (TREE_TYPE (t
+  if (VOID_TYPE_P (TREE_TYPE (TREE_TYPE (t))) && !is_constructor)
 	{
-	  is_function = false;
 	  pp_string (buffer, "procedure ");
+	  is_function = false;
 	}
   else
-	pp_string (buffer, "function ");
+	{
+	  pp_string (buffer, "function ");
+	  is_function = true;
+	}
 
   in_function = is_function;
 
-  if (is_destructor)
+  if (is_constructor)
+	print_constructor (buffer, t);
+  else if (is_destructor)
 	print_destructor (buffer, t);
   else
 	dump_ada_decl_name (buffer, t, false);
@@ -2856,16 +2870,9 @@ print_ada_declaration (pretty_printer *b
   if (is_function)
 	{
 	  pp_string (buffer, " return ");
-
-	  if (is_constructor)
-	{
-	  dump_ada_decl_name (buffer, t, false);
-	}
-	  else
-	{
-	  dump_generic_ada_node
-		(buffer, TREE_TYPE (TREE_TYPE (t)), type, spc, false, true);
-	}
+	  tree ret_type
+	= is_constructor ? DECL_CONTEXT (t) : TREE_TYPE (TREE_TYPE (t));
+	  dump_generic_ada_node (buffer, ret_type, type, spc, false, true);
 	}
 
   if (is_constructor
@@ -2877,7 +2884,7 @@ print_ada_declaration (pretty_printer *b
 	  for (tmp = TYPE_METHODS (type); tmp; tmp = TREE_CHAIN (tmp))
 	if (cpp_check (tmp, IS_ABSTRACT))
 	  {
-		is_abstract_class = 1;
+		is_abstract_class = true;
 		break;
 	  }
 	}
@@ -2896,8 +2903,8 @@ print_ada_declaration (pretty_printer *b
 
   if (is_constructor)
 	{
-	  pp_string (buffer, "pragma CPP_Constructor (New_");
-	  dump_ada_decl_name (buffer, t, false);
+	  pp_string (buffer, "pragma