[PATCH] Don't bootstrap libcc1

2014-11-01 Thread Dominique Dhumieres
 Seems removing that makes the configure.ac change unneeded.
 Bootstrapped/regtested on x86_64-linux and i686-linux (libcc1
 is built after compare, by stage3 compiler), and built
 with --disable-bootstrap on i686-linux (libcc1 is built by
 the system compiler in that case).  Ok for trunk?

 2014-10-31  Jakub Jelinek  ja...@redhat.com
 ...

This (r216964) breaks bootstrap at stage3

libtool: link: sed -e 's,^,_,'  ../../work/libcc1/libcc1.sym  
.libs/libcc1-symbols.expsym
libtool: link:  /opt/gcc/build_w/./gcc/xg++ -B/opt/gcc/build_w/./gcc/ 
-nostdinc++ -nostdinc++ 
-I/opt/gcc/build_w/x86_64-apple-darwin14.0.0/libstdc++-v3/include/x86_64-apple-darwin14.0.0
 -I/opt/gcc/build_w/x86_64-apple-darwin14.0.0/libstdc++-v3/include 
-I/opt/gcc/work/libstdc++-v3/libsupc++ 
-I/opt/gcc/work/libstdc++-v3/include/backward 
-I/opt/gcc/work/libstdc++-v3/testsuite/util 
-L/opt/gcc/build_w/x86_64-apple-darwin14.0.0/libstdc++-v3/src 
-L/opt/gcc/build_w/x86_64-apple-darwin14.0.0/libstdc++-v3/src/.libs 
-L/opt/gcc/build_w/x86_64-apple-darwin14.0.0/libstdc++-v3/libsupc++/.libs 
-B/opt/gcc/gcc4.10w/x86_64-apple-darwin14.0.0/bin/ 
-B/opt/gcc/gcc4.10w/x86_64-apple-darwin14.0.0/lib/ -isystem 
/opt/gcc/gcc4.10w/x86_64-apple-darwin14.0.0/include -isystem 
/opt/gcc/gcc4.10w/x86_64-apple-darwin14.0.0/sys-include-Wl,-undefined 
-Wl,dynamic_lookup -o .libs/libcc1.0.so -bundle  .libs/findcomp.o 
.libs/libcc1.o .libs/names.o .libs/callbacks.o .libs/connection.o 
.libs/marshall.o   
-L/opt/gcc/build_w/x86_64-apple-darwin14.0.0/libstdc++-v3/src 
-L/opt/gcc/build_w/x86_64-apple-darwin14.0.0/libstdc++-v3/src/.libs 
-L/opt/gcc/build_w/x86_64-apple-darwin14.0.0/libstdc++-v3/libsupc++/.libs  
-static-libstdc++ -static-libgcc -Wl,-no_pie ../libiberty/pic/libiberty.a   
-Wl,-exported_symbols_list,.libs/libcc1-symbols.expsym
ld: file not found: libstdc++.a
collect2: error: ld returned 1 exit status
make[3]: *** [libcc1.la] Error 1
make[3]: Leaving directory `/opt/gcc/build_w/libcc1'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/opt/gcc/build_w/libcc1'
make[1]: *** [all-libcc1] Error 2
make[1]: Leaving directory `/opt/gcc/build_w'
make: *** [all] Error 2

Reverting r216964 allowed me to boostrap r216988 on x86_64-apple-darwin14.

Dominique


Re: [PATCH] Don't bootstrap libcc1

2014-11-01 Thread Jakub Jelinek
On Sat, Nov 01, 2014 at 10:23:24AM +0100, Dominique Dhumieres wrote:
  Seems removing that makes the configure.ac change unneeded.
  Bootstrapped/regtested on x86_64-linux and i686-linux (libcc1
  is built after compare, by stage3 compiler), and built
  with --disable-bootstrap on i686-linux (libcc1 is built by
  the system compiler in that case).  Ok for trunk?
 
  2014-10-31  Jakub Jelinek  ja...@redhat.com
  ...
 
 This (r216964) breaks bootstrap at stage3
 
 libtool: link: sed -e 's,^,_,'  ../../work/libcc1/libcc1.sym  
 .libs/libcc1-symbols.expsym
 libtool: link:  /opt/gcc/build_w/./gcc/xg++ -B/opt/gcc/build_w/./gcc/ 
 -nostdinc++ -nostdinc++ 
 -I/opt/gcc/build_w/x86_64-apple-darwin14.0.0/libstdc++-v3/include/x86_64-apple-darwin14.0.0
  -I/opt/gcc/build_w/x86_64-apple-darwin14.0.0/libstdc++-v3/include 
 -I/opt/gcc/work/libstdc++-v3/libsupc++ 
 -I/opt/gcc/work/libstdc++-v3/include/backward 
 -I/opt/gcc/work/libstdc++-v3/testsuite/util 
 -L/opt/gcc/build_w/x86_64-apple-darwin14.0.0/libstdc++-v3/src 
 -L/opt/gcc/build_w/x86_64-apple-darwin14.0.0/libstdc++-v3/src/.libs 
 -L/opt/gcc/build_w/x86_64-apple-darwin14.0.0/libstdc++-v3/libsupc++/.libs 
 -B/opt/gcc/gcc4.10w/x86_64-apple-darwin14.0.0/bin/ 
 -B/opt/gcc/gcc4.10w/x86_64-apple-darwin14.0.0/lib/ -isystem 
 /opt/gcc/gcc4.10w/x86_64-apple-darwin14.0.0/include -isystem 
 /opt/gcc/gcc4.10w/x86_64-apple-darwin14.0.0/sys-include-Wl,-undefined 
 -Wl,dynamic_lookup -o .libs/libcc1.0.so -bundle  .libs/findcomp.o 
 .libs/libcc1.o .libs/names.o .libs/callbacks.o .libs/connection.o 
 .libs/marshall.o   
 -L/opt/gcc/build_w/x86_64-apple-darwin14.0.0/libstdc++-v3/src 
 -L/opt/gcc/build_w/x86_64-apple-darwin14.0.0/libstdc++-v3/src/.libs 
 -L/opt/gcc/build_w/x86_64-apple-darwin14.0.0/libstdc++-v3/libsupc++/.libs  
 -static-libstdc++ -static-libgcc -Wl,-no_pie ../libiberty/pic/libiberty.a   
 -Wl,-exported_symbols_list,.libs/libcc1-symbols.expsym
 ld: file not found: libstdc++.a
 collect2: error: ld returned 1 exit status
 make[3]: *** [libcc1.la] Error 1
 make[3]: Leaving directory `/opt/gcc/build_w/libcc1'
 make[2]: *** [all] Error 2
 make[2]: Leaving directory `/opt/gcc/build_w/libcc1'
 make[1]: *** [all-libcc1] Error 2
 make[1]: Leaving directory `/opt/gcc/build_w'
 make: *** [all] Error 2
 
 Reverting r216964 allowed me to boostrap r216988 on x86_64-apple-darwin14.

So you don't have libstdc++.a in
/opt/gcc/build_w/x86_64-apple-darwin14.0.0/libstdc++-v3/src/.libs ?

Jakub


nvptx offloading patches [1/n]

2014-11-01 Thread Bernd Schmidt
This is one of the patches required to make offloading via the LTO path 
work when the machines involved differ.


x86 requires bigger alignments for some types than nvptx does, which 
becomes an issue when reading LTO produced by the host compiler. The 
problem with having a variable with DECL_ALIGN larger than the stack 
alignment is that gcc will try to align the variable dynamically with an 
alloca/rounding operation, and there isn't a working alloca on nvptx. 
Besides, the overhead would be pointless.


The patch below restricts the alignments to the maximum possible when 
reading in LTO data in an offload compiler. Unfortunately 
BIGGEST_ALIGNMENT isn't suitable for this, as it can vary at runtime 
with attribute((target)), and because vector modes can exceed it, so a 
limit based on BIGGEST_ALIGNMENT would be unsuitable for some ports. 
Instead I've added a hook called limit_offload_alignment which is called 
when reading LTO on an offload compiler. It does nothing anywhere except 
on ptx where it limits alignments to 64 bit.


Bootstrapped and tested on x86_64-linux. Ok?


Bernd

	* tree-streamer-in.c (unpack_ts_decl_common_value_fields,
	unpack_ts_type_common_value_fields): If ACCEL_COMPILER,
	restrict alignments to absolute_biggest_alignment.
	* config/i386/i386.c (TARGET_ABSOLUTE_BIGGEST_ALIGNMENT):
	Define.
	* doc/tm.texi.in (TARGET_ABSOLUTE_BIGGEST_ALIGNMENT): Add.
	* doc/tm.texi: Regenerate.
	* target.def (absolute_biggest_alignment): New DEFHOOKPOD.

Index: gcc/tree-streamer-in.c
===
--- gcc/tree-streamer-in.c.orig
+++ gcc/tree-streamer-in.c
@@ -217,7 +217,10 @@ unpack_ts_decl_common_value_fields (stru
   DECL_EXTERNAL (expr) = (unsigned) bp_unpack_value (bp, 1);
   DECL_GIMPLE_REG_P (expr) = (unsigned) bp_unpack_value (bp, 1);
   DECL_ALIGN (expr) = (unsigned) bp_unpack_var_len_unsigned (bp);
-
+#ifdef ACCEL_COMPILER
+  if (DECL_ALIGN (expr)  targetm.absolute_biggest_alignment)
+DECL_ALIGN (expr) = targetm.absolute_biggest_alignment;
+#endif
   if (TREE_CODE (expr) == LABEL_DECL)
 {
   EH_LANDING_PAD_NR (expr) = (int) bp_unpack_var_len_unsigned (bp);
@@ -359,6 +362,10 @@ unpack_ts_type_common_value_fields (stru
   TYPE_READONLY (expr) = (unsigned) bp_unpack_value (bp, 1);
   TYPE_PRECISION (expr) = bp_unpack_var_len_unsigned (bp);
   TYPE_ALIGN (expr) = bp_unpack_var_len_unsigned (bp);
+#ifdef ACCEL_COMPILER
+  if (TYPE_ALIGN (expr)  targetm.absolute_biggest_alignment)
+TYPE_ALIGN (expr) = targetm.absolute_biggest_alignment;
+#endif
   TYPE_ALIAS_SET (expr) = bp_unpack_var_len_int (bp);
 }
 
Index: gcc/config/i386/i386.c
===
--- gcc/config/i386/i386.c.orig
+++ gcc/config/i386/i386.c
@@ -47623,6 +47623,9 @@ ix86_atomic_assign_expand_fenv (tree *ho
 #undef TARGET_CALL_FUSAGE_CONTAINS_NON_CALLEE_CLOBBERS
 #define TARGET_CALL_FUSAGE_CONTAINS_NON_CALLEE_CLOBBERS true
 
+#undef TARGET_ABSOLUTE_BIGGEST_ALIGNMENT
+#define TARGET_ABSOLUTE_BIGGEST_ALIGNMENT 512
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 
 #include gt-i386.h
Index: gcc/config/i386/i386.h
===
--- gcc/config/i386/i386.h.orig
+++ gcc/config/i386/i386.h
@@ -784,7 +784,10 @@ extern const char *host_detect_local_cpu
rounder than this.
 
Pentium+ prefers DFmode values to be aligned to 64 bit boundary
-   and Pentium Pro XFmode values at 128 bit boundaries.  */
+   and Pentium Pro XFmode values at 128 bit boundaries.
+
+   When increasing the maximum, also update
+   TARGET_ABSOLUTE_BIGGEST_ALIGNMENT.  */
 
 #define BIGGEST_ALIGNMENT \
   (TARGET_AVX512F ? 512 : (TARGET_AVX ? 256 : 128))
Index: gcc/doc/tm.texi
===
--- gcc/doc/tm.texi.orig
+++ gcc/doc/tm.texi
@@ -1003,6 +1003,12 @@ bits.  Note that this is not the biggest
 just the biggest alignment that, when violated, may cause a fault.
 @end defmac
 
+@deftypevr {Target Hook} HOST_WIDE_INT TARGET_ABSOLUTE_BIGGEST_ALIGNMENT
+If defined, this target hook specifies the absolute biggest alignment
+that a type or variable can have on this machine, otherwise,
+@code{BIGGEST_ALIGNMENT} is used.
+@end deftypevr
+
 @defmac MALLOC_ABI_ALIGNMENT
 Alignment, in bits, a C conformant malloc implementation has to
 provide.  If not defined, the default value is @code{BITS_PER_WORD}.
Index: gcc/doc/tm.texi.in
===
--- gcc/doc/tm.texi.in.orig
+++ gcc/doc/tm.texi.in
@@ -957,6 +957,8 @@ bits.  Note that this is not the biggest
 just the biggest alignment that, when violated, may cause a fault.
 @end defmac
 
+@hook TARGET_ABSOLUTE_BIGGEST_ALIGNMENT
+
 @defmac MALLOC_ABI_ALIGNMENT
 Alignment, in bits, a C conformant malloc implementation has to
 provide.  If not defined, the default value is @code{BITS_PER_WORD}.
Index: gcc/target.def

nvptx offloading patches [2/n]

2014-11-01 Thread Bernd Schmidt
LTO has a mechanism not to stream out common nodes that are expected to 
be identical on each run. When using LTO to communicate between 
compilers for different targets, the va_list_type_node and related ones 
must be excluded from this.


Richard B mentioned in a recent mail that the i386 backend uses direct 
comparisons to va_list_type_node. After investigating a bit it seems to 
me that this is not actually a problem: what's being compared is the 
return value of ix86_canonical_va_list_type, which always chooses one of 
va_list_type_node or its ABI variants, so the comparison should hold 
even with this patch.


Bootstrapped and tested on x86_64-linux, ok?


Bernd
	* tre-streamer.c (preload_common_nodes): Skip TI_VA_LIST_TYPE and
	related nodes.

Index: gcc/tree-streamer.c
===
--- gcc/tree-streamer.c.orig
+++ gcc/tree-streamer.c
@@ -309,10 +309,14 @@ preload_common_nodes (struct streamer_tr
 record_common_node (cache, sizetype_tab[i]);
 
   for (i = 0; i  TI_MAX; i++)
-/* Skip boolean type and constants, they are frontend dependent.  */
+/* Skip boolean type and constants, they are frontend dependent.
+   Skip va_list types, target dependent and may not survive offloading.  */
 if (i != TI_BOOLEAN_TYPE
 	 i != TI_BOOLEAN_FALSE
-	 i != TI_BOOLEAN_TRUE)
+	 i != TI_BOOLEAN_TRUE
+	 i != TI_VA_LIST_TYPE
+	 i != TI_VA_LIST_GPR_COUNTER_FIELD
+	 i != TI_VA_LIST_FPR_COUNTER_FIELD)
   record_common_node (cache, global_trees[i]);
 }
 


nvptx offloading patches [3/n], RFD

2014-11-01 Thread Bernd Schmidt
This is not against current trunk; it applies to gomp-4_0-branch where 
it is one of the necessary parts to make offloading x86-nvptx work. The 
issue is that the LTO file format depends on the machine_modes enum, it 
needs to match between host and offload target. The easiest way to do 
this is to just use the host-modes.def when compiling an offload compiler.


Ports that want to be hosts for offloading may need to modify their 
modes.def. The patch below contains changes to i386-modes.def which 
modifies XFmode depending on a target switch. I'm not actually entirely 
sure what to do about this. Do we want to make this flag an error when 
offloading is enabled? Or maybe add float format support to the 
-foffload-abi option?


Thoughts? Ok for the first part of the patch once the other offloading 
patches have gone in (bootstrapped and tested on x86_64-linux)?



Bernd
	* config.gcc (offload_host_cpu_type): Compute.
	(extra_modes): Use it to pick the offload host CPU's modes.def when
	building an offload target.
	* config/i386/i386-modes.def (XF): Skip adjustments when building an
	offload compiler.

Index: gomp-4_0-branch/gcc/config.gcc
===
--- gomp-4_0-branch.orig/gcc/config.gcc
+++ gomp-4_0-branch/gcc/config.gcc
@@ -483,15 +483,26 @@ tilepro*-*-*)
 	;;
 esac
 
+offload_host_cpu_type=${cpu_type}
+if test x${enable_as_accelerator} != xno
+then
+	offload_host_cpu_type=`echo ${enable_as_accelerator_for} | sed 's/-.*$//'`
+fi
+case ${offload_host_cpu_type} in
+x86_64)
+  offload_host_cpu_type=i386
+	  ;;
+esac
+
 tm_file=${cpu_type}/${cpu_type}.h
 if test -f ${srcdir}/config/${cpu_type}/${cpu_type}-protos.h
 then
 	tm_p_file=${cpu_type}/${cpu_type}-protos.h
 fi
 extra_modes=
-if test -f ${srcdir}/config/${cpu_type}/${cpu_type}-modes.def
+if test -f ${srcdir}/config/${offload_host_cpu_type}/${offload_host_cpu_type}-modes.def
 then
-	extra_modes=${cpu_type}/${cpu_type}-modes.def
+	extra_modes=${offload_host_cpu_type}/${offload_host_cpu_type}-modes.def
 fi
 if test -f ${srcdir}/config/${cpu_type}/${cpu_type}.opt
 then
Index: gomp-4_0-branch/gcc/config/i386/i386-modes.def
===
--- gomp-4_0-branch.orig/gcc/config/i386/i386-modes.def
+++ gomp-4_0-branch/gcc/config/i386/i386-modes.def
@@ -24,6 +24,9 @@ along with GCC; see the file COPYING3.
 FRACTIONAL_FLOAT_MODE (XF, 80, 12, ieee_extended_intel_96_format);
 FLOAT_MODE (TF, 16, ieee_quad_format);
 
+/* This file may be used when building a compiler for an offload target.
+   Assume that no special floating point options are used.  */
+#ifndef ACCEL_COMPILER
 /* In ILP32 mode, XFmode has size 12 and alignment 4.
In LP64 mode, XFmode has size and alignment 16.  */
 ADJUST_FLOAT_FORMAT (XF, (TARGET_128BIT_LONG_DOUBLE
@@ -33,6 +36,7 @@ ADJUST_FLOAT_FORMAT (XF, (TARGET_128BIT_
 			  : ieee_extended_intel_96_format));
 ADJUST_BYTESIZE  (XF, TARGET_128BIT_LONG_DOUBLE ? 16 : 12);
 ADJUST_ALIGNMENT (XF, TARGET_128BIT_LONG_DOUBLE ? 16 : 4);
+#endif
 
 /* Add any extra modes needed to represent the condition code.
 


nvptx offloading patches [4/n]

2014-11-01 Thread Bernd Schmidt
I'm sending this for reference more than anything else - this is the 
patch that adds the target support for offloading to the nvptx port. It 
depends on the other offloading patches Ilya is currently submitting.


I actually expect this to change a little in the near future; the nvptx 
mkoffload duplicates some of the logic that we have in nvptx-as and I'm 
thinking of making some improvements. But I figure it would be good to 
show the entire picture, as it is as of now.



Bernd
Index: git/gcc/config/nvptx/mkoffload.c
===
--- /dev/null
+++ git/gcc/config/nvptx/mkoffload.c
@@ -0,0 +1,889 @@
+/* Offload image generation tool for ptx
+
+   Nathan Sidwell nat...@codesourcery.com
+   Bernd Schmidt ber...@codesourcery.com
+
+   Munges PTX assembly into a C source file defining the PTX code as a
+   string.
+
+   This is not a complete assembler.  We presume the source is well
+   formed from the compiler and can die horribly if it is not.  */
+
+#include config.h
+#include system.h
+#include coretypes.h
+#include intl.h
+#include libgen.h
+#include obstack.h
+#include diagnostic-core.h
+#include collect-utils.h
+
+const char tool_name[] = nvptx mkoffload;
+
+#define COMMENT_PREFIX #
+
+typedef enum Kind
+{
+  /* 0-ff used for single char tokens */
+  K_symbol = 0x100, /* a symbol */
+  K_label,  /* a label defn (i.e. symbol:) */
+  K_ident,  /* other ident */
+  K_dotted, /* dotted identifier */
+  K_number,
+  K_string,
+  K_comment
+} Kind;
+
+typedef struct Token
+{
+  unsigned short kind : 12;
+  unsigned short space : 1; /* preceded by space */
+  unsigned short end : 1;   /* succeeded by end of line */
+  /* Length of token */
+  unsigned short len;
+
+  /* Token itself */
+  char const *ptr;
+} Token;
+
+/* statement info */
+typedef enum Vis
+{
+  V_dot = 0,  /* random pseudo */
+  V_var = 1,  /* var decl/defn */
+  V_func = 2, /* func decl/defn */
+  V_insn = 3, /* random insn */
+  V_label = 4, /* label defn */
+  V_comment = 5,
+  V_pred = 6,  /* predicate */
+  V_mask = 0x7,
+  V_global = 0x08, /* globalize */
+  V_weak = 0x10,   /* weakly globalize */
+  V_no_eol = 0x20, /* no end of line */
+  V_prefix_comment = 0x40 /* prefixed comment */
+} Vis;
+
+typedef struct Stmt
+{
+  struct Stmt *next;
+  Token *tokens;
+  unsigned char vis;
+  unsigned len : 12;
+  unsigned sym : 12;
+} Stmt;
+
+struct id_map
+{
+  id_map *next;
+  char *ptx_name;
+};
+
+static const char *read_file (FILE *);
+static Token *tokenize (const char *);
+
+static void write_token (FILE *, const Token *);
+static void write_tokens (FILE *, const Token *, unsigned, int);
+
+static Stmt *alloc_stmt (unsigned, Token *, Token *, const Token *);
+#define alloc_comment(S,E) alloc_stmt (V_comment, S, E, 0)
+#define append_stmt(V, S) ((S)-next = *(V), *(V) = (S))
+static Stmt *rev_stmts (Stmt *);
+static void write_stmt (FILE *, const Stmt *);
+static void write_stmts (FILE *, const Stmt *);
+
+static Token *parse_insn (Token *);
+static Token *parse_list_nosemi (Token *);
+static Token *parse_init (Token *);
+static Token *parse_file (Token *);
+
+static Stmt *decls;
+static Stmt *vars;
+static Stmt *fns;
+
+static id_map *func_ids, **funcs_tail = func_ids;
+static id_map *var_ids, **vars_tail = var_ids;
+
+/* Files to unlink.  */
+static const char *ptx_name;
+static const char *ptx_cfile_name;
+
+/* Delete tempfiles.  */
+
+/* Unlink a temporary file unless requested otherwise.  */
+
+void
+maybe_unlink (const char *file)
+{
+  if (! debug)
+{
+  if (unlink_if_ordinary (file)
+	   errno != ENOENT)
+	fatal_error (deleting file %s: %m, file);
+}
+  else
+fprintf (stderr, [Leaving %s]\n, file);
+}
+
+void
+tool_cleanup (bool)
+{
+}
+
+/* Add or change the value of an environment variable, outputting the
+   change to standard error if in verbose mode.  */
+static void
+xputenv (const char *string)
+{
+  if (verbose)
+fprintf (stderr, %s\n, string);
+  putenv (CONST_CAST (char *, string));
+}
+
+
+static void
+record_id (const char *p1, id_map ***where)
+{
+  const char *end = strchr (p1, '\n');
+  if (!end)
+fatal_error (malformed ptx file);
+
+  id_map *v = XNEW (id_map);
+  size_t len = end - p1;
+  v-ptx_name = XNEWVEC (char, len + 1);
+  memcpy (v-ptx_name, p1, len);
+  v-ptx_name[len] = '\0';
+  v-next = NULL;
+  id_map **tail = *where;
+  *tail = v;
+  *where = v-next;
+}
+
+/* Read the whole input file.  It will be NUL terminated (but
+   remember, there could be a NUL in the file itself.  */
+
+static const char *
+read_file (FILE *stream)
+{
+  size_t alloc = 16384;
+  size_t base = 0;
+  char *buffer;
+
+  if (!fseek (stream, 0, SEEK_END))
+{
+  /* Get the file size.  */
+  long s = ftell (stream);
+  if (s = 0)
+	alloc = s + 100;
+  fseek (stream, 0, SEEK_SET);
+}
+  buffer = XNEWVEC (char, alloc);
+
+  for (;;)
+{
+  size_t n = fread (buffer + base, 1, alloc - base - 1, stream);
+
+  if (!n)
+	

Implement TARGET_ATOMIC_ASSIGN_EXPAND_FENV for powerpc*-*-linux* soft-float and e500

2014-11-01 Thread Joseph S. Myers
This patch implements support for TARGET_ATOMIC_ASSIGN_EXPAND_FENV for
powerpc*-*-linux* soft-float and e500, provided GCC is configured for
glibc 2.19 or later on the target.

New functions __atomic_feholdexcept, __atomic_feclearexcept and
__atomic_feupdateenv were added (to libc) in that glibc version (for
powerpc soft-float / e500 only) in order to support this part of C11.
For soft-float, libc functions are needed because the floating-point
exception state is in TLS variables in libc that aren't directly
accessible outside of glibc.  For e500, they are also needed because
of the prctl syscalls involved in controlling trapping for exceptions
and informing the kernel when certain exception flags have been
cleared.  The actual implementation in GCC is a straightforward matter
of calling those functions.

Tested with no regressions for cross to powerpc-linux-gnu
(soft-float); the c11-atomic-exec-5.c results go from FAIL to PASS.
OK to commit?

2014-11-01  Joseph Myers  jos...@codesourcery.com

* configure.ac (TARGET_GLIBC_MAJOR, TARGET_GLIBC_MINOR): Define
macros.
* configure, config.h.in: Regenerate.
* config/rs6000/linux.h [TARGET_GLIBC_MAJOR  2 ||
(TARGET_GLIBC_MAJOR == 2  TARGET_GLIBC_MINOR = 19)]
(RS6000_GLIBC_ATOMIC_FENV): New macro.
* config/rs6000/linux64.h [TARGET_GLIBC_MAJOR  2 ||
(TARGET_GLIBC_MAJOR == 2  TARGET_GLIBC_MINOR = 19)]
(RS6000_GLIBC_ATOMIC_FENV): New macro.
* config/rs6000/rs6000.c (atomic_hold_decl, atomic_clear_decl)
(atomic_update_decl): New static variables.
(rs6000_atomic_assign_expand_fenv) [RS6000_GLIBC_ATOMIC_FENV]:
Generate calls to __atomic_feholdexcept, __atomic_feclearexcept
and __atomic_feupdateenv for soft-float and no-FPRs.

Index: gcc/config/rs6000/linux.h
===
--- gcc/config/rs6000/linux.h   (revision 216974)
+++ gcc/config/rs6000/linux.h   (working copy)
@@ -127,3 +127,10 @@
 #undef TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P
 #define TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P \
   rs6000_linux_float_exceptions_rounding_supported_p
+
+/* Support for TARGET_ATOMIC_ASSIGN_EXPAND_FENV without FPRs depends
+   on glibc 2.19 or greater.  */
+#if TARGET_GLIBC_MAJOR  2 \
+  || (TARGET_GLIBC_MAJOR == 2  TARGET_GLIBC_MINOR = 19)
+#define RS6000_GLIBC_ATOMIC_FENV 1
+#endif
Index: gcc/config/rs6000/linux64.h
===
--- gcc/config/rs6000/linux64.h (revision 216974)
+++ gcc/config/rs6000/linux64.h (working copy)
@@ -557,3 +557,10 @@ extern int dot_symbols;
 #undef TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P
 #define TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P \
   rs6000_linux_float_exceptions_rounding_supported_p
+
+/* Support for TARGET_ATOMIC_ASSIGN_EXPAND_FENV without FPRs depends
+   on glibc 2.19 or greater.  */
+#if TARGET_GLIBC_MAJOR  2 \
+  || (TARGET_GLIBC_MAJOR == 2  TARGET_GLIBC_MINOR = 19)
+#define RS6000_GLIBC_ATOMIC_FENV 1
+#endif
Index: gcc/config/rs6000/rs6000.c
===
--- gcc/config/rs6000/rs6000.c  (revision 216974)
+++ gcc/config/rs6000/rs6000.c  (working copy)
@@ -34589,6 +34589,9 @@ make_pass_analyze_swaps (gcc::context *ctxt)
   return new pass_analyze_swaps (ctxt);
 }
 
+/* Function declarations for rs6000_atomic_assign_expand_fenv.  */
+static tree atomic_hold_decl, atomic_clear_decl, atomic_update_decl;
+
 /* Implement TARGET_ATOMIC_ASSIGN_EXPAND_FENV hook.  */
 
 static void
@@ -34595,8 +34598,58 @@ static void
 rs6000_atomic_assign_expand_fenv (tree *hold, tree *clear, tree *update)
 {
   if (!TARGET_HARD_FLOAT || !TARGET_FPRS)
-return;
+{
+#ifdef RS6000_GLIBC_ATOMIC_FENV
+  if (atomic_hold_decl == NULL_TREE)
+   {
+ atomic_hold_decl
+   = build_decl (BUILTINS_LOCATION, FUNCTION_DECL,
+ get_identifier (__atomic_feholdexcept),
+ build_function_type_list (void_type_node,
+   double_ptr_type_node,
+   NULL_TREE));
+ TREE_PUBLIC (atomic_hold_decl) = 1;
+ DECL_EXTERNAL (atomic_hold_decl) = 1;
+   }
 
+  if (atomic_clear_decl == NULL_TREE)
+   {
+ atomic_clear_decl
+   = build_decl (BUILTINS_LOCATION, FUNCTION_DECL,
+ get_identifier (__atomic_feclearexcept),
+ build_function_type_list (void_type_node,
+   NULL_TREE));
+ TREE_PUBLIC (atomic_clear_decl) = 1;
+ DECL_EXTERNAL (atomic_clear_decl) = 1;
+   }
+
+  tree const_double = build_qualified_type (double_type_node,
+   TYPE_QUAL_CONST);
+  tree const_double_ptr = build_pointer_type (const_double);
+  if (atomic_update_decl 

Re: [PARCH 1/2, x86, PR63534] Fix darwin bootstrap

2014-11-01 Thread Evgeny Stupachenko
When PIC register is pseudo there is nothing special about it's value
that setjmp can hurt. So if the pseudo register lives across
setjmp_receiver RA should care about correct allocation (in case it is
not saved/restored, it should go on stack). gcc.dg tests and specs
I've tested behave like this.

The initial problem comes from non-local goto as it tries to emit
pseudo PIC register after reload.

On Fri, Oct 31, 2014 at 11:14 PM, Jeff Law l...@redhat.com wrote:
 On 10/17/14 08:08, Evgeny Stupachenko wrote:

 Hi,

 The patch fixes 1st fail in darwin bootstarp.
 When PIC register is pseudo we don't need to init it after setjmp or
 non local goto.

 Is it ok?

 ChangeLog:

 2014-10-17  Evgeny Stupachenko  evstu...@gmail.com

  PR target/63534
  * config/i386/i386.c (builtin_setjmp_receiver): Delete.
  (nonlocal_goto_receiver): Ditto.


 Why do you think they're not needed?  The builtin setjmp/longjmp
 implementation do not behave like what you're used to in the C library.
 Specifically, they do not save/restore register state beyond SP, FP and
 possibly ARGP.

 So let's take one step back -- what precisely about these patterns was
 causing a problem?My initial inclination is that we must set the PIC
 register here in the same manner as it's set in the prologue.



 Jeff


I have been trying to reach you for an important issue.

2014-11-01 Thread Mr. David Nicodemus
Good day,

I have been trying to reach you for an important issue without success. Glad I 
could be able to get in touch with you today. Kindly reply as soon as possible 
to get back to you in regards to why i have been trying to reach you.

Regards
Mr. David Nicodemus


Re: [PARCH 1/2, x86, PR63534] Fix darwin bootstrap

2014-11-01 Thread Mike Stump
On Nov 1, 2014, at 5:39 AM, Evgeny Stupachenko evstu...@gmail.com wrote:
 When PIC register is pseudo there is nothing special about it's value
 that setjmp can hurt. So if the pseudo register lives across
 setjmp_receiver RA should care about correct allocation (in case it is
 not saved/restored, it should go on stack).

So, why is consuming more stack space beneficial?


Re: [PATCH] Don't bootstrap libcc1

2014-11-01 Thread Dominique d'Humières

 Le 1 nov. 2014 à 10:43, Jakub Jelinek ja...@redhat.com a écrit :
 
 So you don't have libstdc++.a in
 /opt/gcc/build_w/x86_64-apple-darwin14.0.0/libstdc++-v3/src/.libs ?
 
   Jakub

Indeed I have it:

[Book15] gcc/build_w% lf -l 
x86_64-apple-darwin14.0.0/libstdc++-v3/src/.libs/libstdc++.a
-rw-r--r-- 1 dominiq staff 9114784 Nov  1 18:48 
x86_64-apple-darwin14.0.0/libstdc++-v3/src/.libs/libstdc++.a

as well as for i386

[Book15] gcc/build_w% lf -l 
x86_64-apple-darwin14.0.0/i386/libstdc++-v3/src/.libs/libstdc++.a
-rw-r--r-- 1 dominiq staff 8184744 Nov  1 18:48 
x86_64-apple-darwin14.0.0/i386/libstdc++-v3/src/.libs/libstdc++.a

The working link command (r216964 reverted) is

libtool: link:  /opt/gcc/build_w/./prev-gcc/xg++ -B/opt/gcc/build_w/./prev-gcc/ 
-B/opt/gcc/gcc4.10w/x86_64-apple-darwin14.0.0/bin/ -nostdinc++ 
-B/opt/gcc/build_w/prev-x86_64-apple-darwin14.0.0/libstdc++-v3/src/.libs 
-B/opt/gcc/build_w/prev-x86_64-apple-darwin14.0.0/libstdc++-v3/libsupc++/.libs  
-I/opt/gcc/build_w/prev-x86_64-apple-darwin14.0.0/libstdc++-v3/include/x86_64-apple-darwin14.0.0
  -I/opt/gcc/build_w/prev-x86_64-apple-darwin14.0.0/libstdc++-v3/include  
-I/opt/gcc/work/libstdc++-v3/libsupc++ 
-L/opt/gcc/build_w/prev-x86_64-apple-darwin14.0.0/libstdc++-v3/src/.libs 
-L/opt/gcc/build_w/prev-x86_64-apple-darwin14.0.0/libstdc++-v3/libsupc++/.libs 
-Wl,-undefined -Wl,dynamic_lookup -o .libs/libcc1.0.so -bundle  
.libs/findcomp.o .libs/libcc1.o .libs/names.o .libs/callbacks.o 
.libs/connection.o .libs/marshall.o   
-L/opt/gcc/build_w/prev-x86_64-apple-darwin14.0.0/libstdc++-v3/src/.libs 
-L/opt/gcc/build_w/prev-x86_64-apple-darwin14.0.0/libstdc++-v3/libsupc++/.libs  
-static-libstdc++ -static-libgcc -Wl,-no_pie ../libiberty/pic/libiberty.a   
-Wl,-exported_symbols_list,.libs/libcc1-symbols.expsym

compared to the failing one

libtool: link:  /opt/gcc/build_w/./gcc/xg++ -B/opt/gcc/build_w/./gcc/ 
-nostdinc++ -nostdinc++ 
-I/opt/gcc/build_w/x86_64-apple-darwin14.0.0/libstdc++-v3/include/x86_64-apple-darwin14.0.0
 -I/opt/gcc/build_w/x86_64-apple-darwin14.0.0/libstdc++-v3/include 
-I/opt/gcc/work/libstdc++-v3/libsupc++ 
-I/opt/gcc/work/libstdc++-v3/include/backward 
-I/opt/gcc/work/libstdc++-v3/testsuite/util 
-L/opt/gcc/build_w/x86_64-apple-darwin14.0.0/libstdc++-v3/src 
-L/opt/gcc/build_w/x86_64-apple-darwin14.0.0/libstdc++-v3/src/.libs 
-L/opt/gcc/build_w/x86_64-apple-darwin14.0.0/libstdc++-v3/libsupc++/.libs 
-B/opt/gcc/gcc4.10w/x86_64-apple-darwin14.0.0/bin/ 
-B/opt/gcc/gcc4.10w/x86_64-apple-darwin14.0.0/lib/ -isystem 
/opt/gcc/gcc4.10w/x86_64-apple-darwin14.0.0/include -isystem 
/opt/gcc/gcc4.10w/x86_64-apple-darwin14.0.0/sys-include-Wl,-undefined 
-Wl,dynamic_lookup -o .libs/libcc1.0.so -bundle  .libs/findcomp.o 
.libs/libcc1.o .libs/names.o .libs/callbacks.o .libs/connection.o 
.libs/marshall.o   
-L/opt/gcc/build_w/x86_64-apple-darwin14.0.0/libstdc++-v3/src 
-L/opt/gcc/build_w/x86_64-apple-darwin14.0.0/libstdc++-v3/src/.libs 
-L/opt/gcc/build_w/x86_64-apple-darwin14.0.0/libstdc++-v3/libsupc++/.libs  
-static-libstdc++ -static-libgcc -Wl,-no_pie ../libiberty/pic/libiberty.a   
-Wl,-exported_symbols_list,.libs/libcc1-symbols.expsym

Dominique



Re: [Patch 4/7 sh] Deprecate *_BY_PIECES_P, move to hookized version

2014-11-01 Thread Kaz Kojima
James Greenhalgh james.greenha...@arm.com wrote:
 I tried building a compiler and there were no fires, but otherwise,
 I have no reasonable way to test this patch. If one of the sh
 maintainers wants to pick it up and test it, that would be much
 appreciated.

SH portion looks fine.  No new failures with the top level
make -k check on sh4-unknown-linux-gnu. 

Regards,
kaz


Re: C/C++ diagnostics guidelines

2014-11-01 Thread Manuel López-Ibáñez
On 23 October 2014 12:39, Dodji Seketeli do...@redhat.com wrote:
 To take this further, I am thinking that these guidelines would be even
 better served by standing on their own page.  If nobody objects, I can
 create a  DiagnosticsGuidelines page in the wiki with the content that you 
 added.

Since you are already extremely busy with libabigail and I'd prefer if
you spent any free time you may have on reviewing my patches (I would
appreciate your comments to
https://gcc.gnu.org/ml/gcc-patches/2014-09/msg02467.html), I went
ahead and created the new wiki page. I also added a new item about
using expansion_point_location_if_in_system_header for system macros
such as NULL.

Cheers,

Manuel.


[PATCH, C++, SD-6] Add __cpp_aggregate_nsdmi macro now that we nave them.

2014-11-01 Thread Ed Smith-Rowland

Subject says it all really.

Build and tested clean on x86_64-linux.

OK?

Ed


testsuite/

2014-11-02  Edward Smith-Rowland  3dw...@verizon.net

* g++.dg/cpp1y/feat-cxx11.C: Commentary and rearrangement of tests.
* g++.dg/cpp1y/feat-cxx11-neg.C: Add aggregate NSDMI test.
Commentary and rearrangement of tests.
* g++.dg/cpp1y/feat-cxx14.C: Enable aggregate NSDMI test.
Commentary and rearrangement of tests.
* g++.dg/cpp1y/feat-cxx98-neg.C: Ditto
* g++.dg/cpp1y/feat-cxx98.C: Commentary.

c-family/

2014-11-02  Edward Smith-Rowland  3dw...@verizon.net

* c-cppbuiltin.c: Define __cpp_aggregate_nsdmi.
Index: testsuite/g++.dg/cpp1y/feat-cxx11-neg.C
===
--- testsuite/g++.dg/cpp1y/feat-cxx11-neg.C (revision 217006)
+++ testsuite/g++.dg/cpp1y/feat-cxx11-neg.C (working copy)
@@ -1,7 +1,7 @@
 // { dg-do compile { target c++11_only } }
 // { dg-options -pedantic-errors }
 
-// These *are* defined in C++14 onwards.
+// C++14 features:
 
 #ifndef __cpp_binary_literals
 #  error __cpp_binary_literals // { dg-error error }
@@ -31,11 +31,19 @@
 #  error __cpp_digit_separators // { dg-error error }
 #endif
 
+#ifndef __cpp_aggregate_nsdmi
+#  error __cpp_aggregate_nsdmi // { dg-error error }
+#endif
+
+//  Array TS features:
+
+#ifndef __cpp_runtime_arrays
+#  error __cpp_runtime_arrays // { dg-error error }
+#endif
+
+//  Attribute checks:
+
 //  Attribute [[deprecated]] is allowed in C++11 as an extension (with 
pedwarn).
 //#ifndef __cpp_attribute_deprecated
 //#  error __cpp_attribute_deprecated
 //#endif
-
-#ifndef __cpp_runtime_arrays
-#  error __cpp_runtime_arrays // { dg-error error }
-#endif
Index: testsuite/g++.dg/cpp1y/feat-cxx11.C
===
--- testsuite/g++.dg/cpp1y/feat-cxx11.C (revision 217006)
+++ testsuite/g++.dg/cpp1y/feat-cxx11.C (working copy)
@@ -1,6 +1,8 @@
 // { dg-do compile }
 // { dg-options -std=gnu++11 }
 
+//  C++11 features:
+
 #ifndef __cpp_unicode_characters
 #  error __cpp_unicode_characters
 #elif __cpp_unicode_characters != 200704
@@ -73,7 +75,8 @@
 #  error __cpp_alias_templates != 200704
 #endif
 
-//  These C++14 features are allowed in C++11 in non-ANSI modes.
+//  C++14 features allowed in C++11 in non-ANSI modes:
+
 #ifndef __cpp_binary_literals
 #  error __cpp_binary_literals
 #elif __cpp_binary_literals != 201304
@@ -80,6 +83,9 @@
 #  error __cpp_binary_literals != 201304
 #endif
 
+//  Attribute checks:
+
+//  Attribute [[deprecated]] is allowed in C++11 as an extension (with 
pedwarn).
 #ifndef __cpp_attribute_deprecated
 #  error __cpp_attribute_deprecated
 #elif __cpp_attribute_deprecated != 201309
Index: testsuite/g++.dg/cpp1y/feat-cxx14.C
===
--- testsuite/g++.dg/cpp1y/feat-cxx14.C (revision 217006)
+++ testsuite/g++.dg/cpp1y/feat-cxx14.C (working copy)
@@ -1,7 +1,7 @@
 // { dg-do compile { target c++14 } }
 // { dg-options -I${srcdir}/g++.dg/cpp1y -I${srcdir}/g++.dg/cpp1y/testinc }
 
-// Begin C++11 tests.
+//  C++11 features:
 
 #ifndef __cpp_unicode_characters
 #  error __cpp_unicode_characters
@@ -75,7 +75,7 @@
 #  error __cpp_alias_templates != 200704
 #endif
 
-// Begin C++14 tests.
+//  C++14 features:
 
 #ifndef __cpp_binary_literals
 #  error __cpp_binary_literals
@@ -114,15 +114,10 @@
 #  error __cpp_return_type_deduction != 201304
 #endif
 
-#ifndef __cpp_runtime_arrays
-#  error __cpp_runtime_arrays
-#elif __cpp_runtime_arrays != 201304
-#  error __cpp_runtime_arrays != 201304
-#endif
-
-//  Aggregate initializers not in yet.
-#ifdef __cpp_aggregate_nsdmi
+#ifndef __cpp_aggregate_nsdmi
 #  error __cpp_aggregate_nsdmi
+#elif __cpp_aggregate_nsdmi != 201304
+#  error __cpp_aggregate_nsdmi != 201304
 #endif
 
 #ifndef __cpp_variable_templates
@@ -137,6 +132,21 @@
 #  error __cpp_digit_separators != 201309
 #endif
 
+//  Sized deallocation not in yet.
+#ifdef __cpp_sized_deallocation
+#  error __cpp_sized_deallocation
+#endif
+
+//  Array TS features:
+
+#ifndef __cpp_runtime_arrays
+#  error __cpp_runtime_arrays
+#elif __cpp_runtime_arrays != 201304
+#  error __cpp_runtime_arrays != 201304
+#endif
+
+//  Attribute checks:
+
 #ifndef __cpp_attribute_deprecated
 #  error __cpp_attribute_deprecated
 #elif __cpp_attribute_deprecated != 201309
@@ -143,13 +153,8 @@
 #  error __cpp_attribute_deprecated != 201309
 #endif
 
-//  Sized deallocation not in yet.
-#ifdef __cpp_sized_deallocation
-#  error __cpp_sized_deallocation
-#endif
+//  Include checks:
 
-// Begin include checks.
-
 //  Check for __has_include macro.
 #ifndef __has_include
 #  error __has_include
Index: testsuite/g++.dg/cpp1y/feat-cxx98-neg.C
===
--- testsuite/g++.dg/cpp1y/feat-cxx98-neg.C (revision 217006)
+++ testsuite/g++.dg/cpp1y/feat-cxx98-neg.C (working copy)
@@ -1,6 +1,8 @@
 

Re: [PATCH, C++, SD-6] Add __cpp_aggregate_nsdmi macro now that we nave them.

2014-11-01 Thread Jason Merrill

OK, thanks.

Jason