Re: [RFC] costs and it's use in assign_reg_parm

2014-10-03 Thread Segher Boessenkool
On Fri, Oct 03, 2014 at 12:36:37PM -0600, Jeff Law wrote:
> rtx_cost and its friends have always been a problem and it's always felt 
> like a design problem.   The true cost of something is so context 
> dependent I'm not really sure how to build an API to do this in a sane way.

In many places it already would help if we had an rtx_insn_cost that
gets a full insn as input.  Maybe an rtx_set_src_cost for the other
cases where "cost of an RTX" makes any sense at all.


Segher


Re: [gofrontend-dev] [PATCH 5/9] Gccgo port to s390[x] -- part I

2014-10-03 Thread Ian Lance Taylor
On Tue, Sep 9, 2014 at 5:56 AM, Dominik Vogt  wrote:
> This optional cleanup patch fixes some sloppy programming in the
> x86 libgo/go/debug/elf library that had given me a very hard time
> to debug and fix when porting the code to s390[x].  See commit
> comment for details.
>
> ChangeLog
> 2014-09-05  Dominik Vogt  
>
> * libgo/go/debug/elf/file.go (applyRelocationsAMD64):
> Fix the calculation of some relocations; do not assume that the symbol
> value is always zero.

The code checks that it is using only STT_SECTION symbols.  An
STT_SECTION symbol in an object file can be reasonably expected to
have a value of zero.  Since in practice this only applies to debug
sections, I doubt it would work at all if the STT_SECTION symbol had a
non-zero value and that value were added in.  So I'm not convinced
that this patch is necessary.

I'm sorry that the code gave you a hard time, but as far as I can see
it's not sloppy and it's not wrong.

Ian


Re: [gofrontend-dev] [PATCH 4/9] Gccgo port to s390[x] -- part I

2014-10-03 Thread Ian Lance Taylor
On Tue, Sep 9, 2014 at 5:53 AM, Dominik Vogt  wrote:
>
> This patch fixes the compiler flags in libgo/mksysinfo.sh.  In one
> place, some compiler flags were missing that are consistently used
> elswhere, resulting in an error message.
>
> ChangeLog
> 2014-09-05  Dominik Vogt  
>
> * libgo/mksysinfo.sh (OUT):
> Add the same compile flags that configure uses to detect whether 
> off64_t
> is present or not when generating the go structures for the C types.
> Otherwise the go type for off64_t may not be generated.

I don't understand why this patch is necessary.  The invocation of
mksysinfo in libgo/Makefile.am sets the CC environment variable to
include $(OSCFLAGS), and OSCFLAGS should include those three options.

Trying to list the flags separately in mksysinfo.sh is going to be
incomplete on some systems--see OSCFLAGS in libgo/configure.ac.

Can you explain further why this patch is required?  Thanks.

Ian


Re: [C++] Handle && || ! for simd vectors

2014-10-03 Thread Marc Glisse

On Thu, 2 Oct 2014, Jason Merrill wrote:


OK.


Thanks. While committing, I noticed that I restricted ! to integer 
vectors, whereas it seems to work just fine with scalar floats, so it 
would make sense to extend it to float vectors. Tested on 
x86_64-linux-gnu.


2014-10-04  Marc Glisse  

gcc/cp/
* typeck.c (cp_build_unary_op) [TRUTH_NOT_EXPR]: Accept float vectors.
gcc/testsuite/
* g++.dg/ext/vector9.C: Test ! with float vectors.

--
Marc GlisseIndex: gcc/cp/typeck.c
===
--- gcc/cp/typeck.c (revision 215876)
+++ gcc/cp/typeck.c (working copy)
@@ -5716,21 +5716,21 @@ cp_build_unary_op (enum tree_code code,
errstring = _("wrong type argument to conjugation");
   else if (!noconvert)
{
  arg = cp_default_conversion (arg, complain);
  if (arg == error_mark_node)
return error_mark_node;
}
   break;
 
 case TRUTH_NOT_EXPR:
-  if (VECTOR_INTEGER_TYPE_P (TREE_TYPE (arg)))
+  if (VECTOR_TYPE_P (TREE_TYPE (arg)))
return cp_build_binary_op (input_location, EQ_EXPR, arg,
   build_zero_cst (TREE_TYPE (arg)), complain);
   arg = perform_implicit_conversion (boolean_type_node, arg,
 complain);
   val = invert_truthvalue_loc (input_location, arg);
   if (arg != error_mark_node)
return val;
   errstring = _("in argument to unary !");
   break;
 
Index: gcc/testsuite/g++.dg/ext/vector9.C
===
--- gcc/testsuite/g++.dg/ext/vector9.C  (revision 215876)
+++ gcc/testsuite/g++.dg/ext/vector9.C  (working copy)
@@ -1,10 +1,11 @@
 // PR c++/34891
 
 typedef float v4f __attribute__((vector_size(8)));
 typedef int   v4i __attribute__((vector_size(8)));
 
 void foo()
 {
   v4f v;
   !(v4i)v;
+  !v;
 }


Add testcases for new devirtualization code paths; fix merging of speculative devirt

2014-10-03 Thread Jan Hubicka
Hi,
this patch add basic testcaes for new devirtualization features (more to come) 
and
also fixes bug I introduced while refactoring the speculative context merging
code - that most likely explains why I observed number of speculative devirt
to drop considerably after finishing the patch.

Jason, can you, please, double check the second FIXME in testcases?

Will commit it once bootstrap/regtest of x86_64-linux finishes.

* testsuite/g++.dg/ipa/devirt-42.C: New testcase.
* testsuite/g++.dg/ipa/devirt-43.C: New testcase.
* testsuite/g++.dg/ipa/devirt-44.C: New testcase.
* testsuite/g++.dg/ipa/devirt-45.C: New testcase.
* ipa-polymorphic-call.c
(ipa_polymorphic_call_context::ipa_polymorphic_call_context): Fix
code determining speculative type.
(ipa_polymorphic_call_context::combine_with): Fix speculation merge.

Index: testsuite/g++.dg/ipa/devirt-42.C
===
--- testsuite/g++.dg/ipa/devirt-42.C(revision 0)
+++ testsuite/g++.dg/ipa/devirt-42.C(revision 0)
@@ -0,0 +1,42 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fno-ipa-cp -fdump-ipa-inline-details -fno-early-inlining 
-fdump-tree-optimized" } */
+struct A {
+  virtual int foo () {return 1;}
+  int bar () {return foo();}
+  int barbar ();
+};
+namespace {
+  struct B:A {virtual int foo () {return 2;}
+ int barbar () {return bar();}};
+}
+
+int
+A::barbar()
+{
+  return static_cast(this)->barbar();
+}
+
+main()
+{
+  struct B b;
+  struct A *a = &b;
+  return a->barbar ();
+}
+
+/* Inlining everything into main makes type clear from type of variable b.
+   However devirtualization is also possible for offline copy of A::barbar. 
Invoking
+   B's barbar makes it clear the type is at least B and B is an anonymous
+   namespace type and therefore we know it has no derivations.
+   FIXME: Currently we devirtualize speculatively only because we do not track
+   dynamic type changes well.  */
+/* { dg-final { scan-ipa-dump-times "First type is base of second" 1 "inline"  
} } */
+/* { dg-final { scan-ipa-dump-times "Outer types match, merging flags" 2 
"inline"  } } */
+/* { dg-final { scan-ipa-dump-times "Discovered a virtual call to a known 
target" 1 "inline"  } } */
+/* { dg-final { scan-ipa-dump-times "Discovered a virtual call to a 
speculative target" 1 "inline"  } } */
+
+/* Verify that speculation is optimized by late optimizers.  */
+/* { dg-final { scan-ipa-dump-times "return 2" 2 "optimized"  } } */
+/* { dg-final { scan-ipa-dump-not "OBJ_TYPE_REF" "optimized"  } } */
+
+/* { dg-final { cleanup-ipa-dump "inline" } } */
+/* { dg-final { cleanup-ipa-dump "optimized" } } */
Index: testsuite/g++.dg/ipa/devirt-44.C
===
--- testsuite/g++.dg/ipa/devirt-44.C(revision 0)
+++ testsuite/g++.dg/ipa/devirt-44.C(revision 0)
@@ -0,0 +1,33 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fno-ipa-cp -fdump-ipa-inline-details -fno-early-inlining 
-fdump-tree-optimized" } */
+struct A {
+  virtual int foo () {return 1;}
+  int wrapfoo () {foo();}
+  A() {wrapfoo();}
+};
+struct B:A {virtual int foo () {return 2;}};
+
+void dostuff(struct A *);
+
+static void
+test (struct A *a)
+{
+  dostuff (a);
+  if (a->foo ()!= 2)
+__builtin_abort ();
+}
+
+main()
+{
+  struct B a;
+  dostuff (&a);
+  test (&a);
+}
+/* Here one invocation of foo is while type is in construction, while other is 
not.
+   Check that we handle that.  */
+
+/* { dg-final { scan-ipa-dump-times "First type is base of second" 1 "inline"  
} } */
+/* { dg-final { scan-ipa-dump "(maybe in construction)" "inline"  } } */
+/* { dg-final { scan-ipa-dump-times "Discovered a virtual call to a known 
target\[^\\n\]*A::foo" 1 "inline"  } } */
+/* { dg-final { scan-ipa-dump-times "Discovered a virtual call to a known 
target\[^\\n\]*B::foo" 1 "inline"  } } */
+/* { dg-final { cleanup-ipa-dump "inline" } } */
Index: testsuite/g++.dg/ipa/devirt-41.C
===
--- testsuite/g++.dg/ipa/devirt-41.C(revision 0)
+++ testsuite/g++.dg/ipa/devirt-41.C(revision 0)
@@ -0,0 +1,31 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fdump-ipa-inline-details -fno-early-inlining 
-fno-ipa-cp" } */
+struct A {virtual int foo () {return 1;}};
+struct B:A {virtual int foo () {return 2;}};
+
+void dostuff(struct A *);
+
+static void
+test (struct A *a)
+{
+  dostuff (a);
+  if (a->foo ()!= 2)
+__builtin_abort ();
+}
+
+main()
+{
+  struct B a;
+  dostuff (&a);
+  test (&a);
+}
+/* Inlining of dostuff into main should combine polymorphic context
+   specifying Outer type:struct B offset 0
+   with Outer type (dynamic):struct A (or a derived type) offset 0
+   and enable devirtualization.
+
+   Because the type is in static storage, we know it won't change type in 
dostuff
+   and from callstack we can tell that is is not in construction/destructio

Re: [PATCH 2/2] PR debug/63240 Add DWARF representation for C++11 defaulted member function.

2014-10-03 Thread Siva Chandra
On Fri, Oct 3, 2014 at 12:45 PM, Jason Merrill  wrote:
> On 10/03/2014 02:41 PM, Cary Coutant wrote:
>>>
>>> O. Then I was indeed wrong and defaulted does not impact ABI at all.
>>> At least that is one worry less for the abi checkers :)
>>
>>
>> As Siva mentioned, it does in fact impact the ABI. A class with a
>> non-trivial destructor is not a POD, and affects the calling
>> convention, so the debugger needs to know the difference.
>
>
> Yes, but defaulted does not imply trivial (though the converse is true), so
> knowing whether a declaration is defaulted is neither necessary nor
> sufficient to determine the parameter passing ABI.

I understand that knowing whether a copy-ctor or a d-tor has been
explicitly defaulted is not sufficient to determine the parameter
passing ABI. However, why is it not necessary? I could be wrong, but
doesn't the example I have given show that it is necessary?

Thanks,
Siva Chandra


Re: [PATCH 2/2] PR debug/63240 Add DWARF representation for C++11 defaulted member function.

2014-10-03 Thread Siva Chandra
On Fri, Oct 3, 2014 at 12:00 PM, Mark Wielaard  wrote:
> Thanks for that reference. I was just stepping through gdb's
> gdbarch_return_in_first_hidden_param_p to understand why Siva's example
> did indeed seem to go wrong under GDB. That code is a little hairy with
> all the arch specific indirections, so I am happy I can stop now :)

I agree that GDB's code here is a spaghetti. The function
gdbarch_return_in_first_hidden_param_p seems like an arch related
function, but on most arch's it defaults to the language specific
function language_pass_by_reference via
default_return_in_first_hidden_param_p.

> I can adjust my patch so that it does mark the declaration with
> DW_AT_artificial if it is DECL_COPY_CONSTRUCTOR_P or DECL_DESTRUCTOR_P.
> But maybe that is probably better done as a separate patch.

I have been meaning to send a patch to mark members declared default
with DW_AT_artificial. I have attached what I had in mind with this
mail. If you think it is reasonable, I can send it formally in a
different thread.

> Or does it make sense to mark all defaulted special function members as
> artificial instead of having a separate attribute for it? The (small)
> advantage of having a separate attribute is that the consumer knows
> whether it was explicitly defaulted.

It might still be of value, may be to answer questions like "why is
the member marked as artificial?".

gcc/cp/ChangeLog:

2014-10-03  Siva Chandra Reddy  

* decl2.c (grokfield): Mark special methods declared as default
to be artificial.

gcc/testsuite/ChangeLog:

2014-10-03  Siva Chandra Reddy  

* g++.dg/dwarf2/default-ctor-dtor.C: New test.
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index 4be4847..6a9a047 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -957,6 +957,7 @@ grokfield (const cp_declarator *declarator,
  DECL_DEFAULTED_FN (value) = 1;
  DECL_INITIALIZED_IN_CLASS_P (value) = 1;
  DECL_DECLARED_INLINE_P (value) = 1;
+ DECL_ARTIFICIAL (value) = 1;
}
}
  else if (TREE_CODE (init) == DEFAULT_ARG)
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/default-ctor-dtor.C 
b/gcc/testsuite/g++.dg/debug/dwarf2/default-ctor-dtor.C
new file mode 100644
index 000..82c5e8d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/debug/dwarf2/default-ctor-dtor.C
@@ -0,0 +1,22 @@
+// { dg-do compile }
+// { dg-options "-gdwarf-2 -dA -O0 -std=c++11 -fno-merge-debug-strings" }
+
+class A
+{
+public:
+  A () {}
+  A (const A &) = default;
+  ~A () = default;
+
+  int a;
+};
+
+int
+main ()
+{
+  A a;
+
+  return a.a;
+}
+
+// { dg-final { scan-assembler-times 
"DW_TAG_subprogram.*DW_AT_artificial.*DW_TAG_formal_parameter.*DW_TAG_formal_parameter.*DW_TAG_subprogram.*DW_AT_artificial.*DW_TAG_formal_parameter.*DW_TAG_formal_parameter"
 1 } }


[PATCH Fortran] move more diagnostics to the common machinery

2014-10-03 Thread Manuel López-Ibáñez
The following patch adds two new functions. One of them is an overload
of gfc_warning_cmdline() that takes an option. Thus now we get:

f951: Warning: Nonexistent include directory
'C:\msys\1.0.10\home\FX\ibin\i586-pc-mingw32\libgfortran/../../../trunk/libgfortran/generated'
[-Wmissing-include-dirs]

plus colors!

and of course, with -Werror=missing-include-dirs you get:

f951: Error: Nonexistent include directory
'C:\msys\1.0.10\home\FX\ibin\i586-pc-mingw32\libgfortran/../../../trunk/libgfortran/generated'
[-Werror=missing-include-dirs]
f951: some warnings being treated as errors

The other new function is for errors instead of warnings. Perhaps
there are more places where these functions can be used.

Bootstrapped and regression tested on x86_64-linux-gnu.

OK?

gcc/fortran/ChangeLog:

2014-10-03  Manuel López-Ibáñez  

* gfortran.h (gfc_warning_cmdline): Add overload variant taking an
option.
(gfc_error_cmdline): Declare.
* error.c (gfc_warning_cmdline): New
(gfc_error_cmdline): New.
* scanner.c (add_path_to_list): Use them.
(load_file): Likewise.
Index: gcc/fortran/gfortran.h
===
--- gcc/fortran/gfortran.h  (revision 214251)
+++ gcc/fortran/gfortran.h  (working copy)
@@ -2690,16 +2690,18 @@ void gfc_buffer_error (int);
 
 const char *gfc_print_wide_char (gfc_char_t);
 
 void gfc_warning (const char *, ...) ATTRIBUTE_GCC_GFC(1,2);
 void gfc_warning_now (const char *, ...) ATTRIBUTE_GCC_GFC(1,2);
-void gfc_warning_cmdline (const char *gmsgid, ...) ATTRIBUTE_GCC_GFC(1,2);
+bool gfc_warning_cmdline (const char *gmsgid, ...) ATTRIBUTE_GCC_GFC(1,2);
+bool gfc_warning_cmdline (int opt, const char *gmsgid, ...) 
ATTRIBUTE_GCC_GFC(2,3);
 
 void gfc_clear_warning (void);
 void gfc_warning_check (void);
 
 void gfc_error (const char *, ...) ATTRIBUTE_GCC_GFC(1,2);
+void gfc_error_cmdline (const char *gmsgid, ...) ATTRIBUTE_GCC_GFC(1,2);
 void gfc_error_now (const char *, ...) ATTRIBUTE_GCC_GFC(1,2);
 void gfc_fatal_error (const char *, ...) ATTRIBUTE_NORETURN 
ATTRIBUTE_GCC_GFC(1,2);
 void gfc_internal_error (const char *, ...) ATTRIBUTE_NORETURN 
ATTRIBUTE_GCC_GFC(1,2);
 void gfc_clear_error (void);
 int gfc_error_check (void);
Index: gcc/fortran/error.c
===
--- gcc/fortran/error.c (revision 214251)
+++ gcc/fortran/error.c (working copy)
@@ -1050,25 +1050,61 @@ gfc_diagnostic_finalizer (diagnostic_con
 {
   pp_destroy_prefix (context->printer);
   pp_newline_and_flush (context->printer);
 }
 
 /* Give a warning about the command-line.  */
 
-void
+bool
+gfc_warning_cmdline (int opt, const char *gmsgid, ...)
+{
+  va_list argp;
+  diagnostic_info diagnostic;
+  bool ret;
+
+  va_start (argp, gmsgid);
+  diagnostic_set_info (&diagnostic, gmsgid, &argp, UNKNOWN_LOCATION,
+  DK_WARNING);
+  diagnostic.option_index = opt;
+  ret = report_diagnostic (&diagnostic);
+  va_end (argp);
+  return ret;
+}
+
+
+/* Give a warning about the command-line.  */
+
+bool
 gfc_warning_cmdline (const char *gmsgid, ...)
 {
   va_list argp;
   diagnostic_info diagnostic;
+  bool ret;
 
   va_start (argp, gmsgid);
   diagnostic_set_info (&diagnostic, gmsgid, &argp, UNKNOWN_LOCATION,
   DK_WARNING);
+  ret = report_diagnostic (&diagnostic);
+  va_end (argp);
+  return ret;
+}
+
+
+/* Give an error about the command-line.  */
+
+void
+gfc_error_cmdline (const char *gmsgid, ...)
+{
+  va_list argp;
+  diagnostic_info diagnostic;
+
+  va_start (argp, gmsgid);
+  diagnostic_set_info (&diagnostic, gmsgid, &argp, UNKNOWN_LOCATION, DK_ERROR);
   report_diagnostic (&diagnostic);
   va_end (argp);
 }
 
 /* Clear the warning flag.  */
 
 void
 gfc_clear_warning (void)
 {
Index: gcc/fortran/scanner.c
===
--- gcc/fortran/scanner.c   (revision 214251)
+++ gcc/fortran/scanner.c   (working copy)
@@ -322,23 +322,20 @@ add_path_to_list (gfc_directorylist **li
 q[i--] = '\0';
 
   if (stat (q, &st))
 {
   if (errno != ENOENT)
-   gfc_warning_now ("Include directory \"%s\": %s", path,
-xstrerror(errno));
-  else
-   {
- /* FIXME:  Also support -Wmissing-include-dirs.  */
- if (warn)
-   gfc_warning_now ("Nonexistent include directory \"%s\"", path);
-   }
+   gfc_warning_cmdline ("Include directory %qs: %s", path,
+xstrerror(errno));
+  else if (warn)
+   gfc_warning_cmdline (OPT_Wmissing_include_dirs,
+"Nonexistent include directory %qs", path);
   return;
 }
   else if (!S_ISDIR (st.st_mode))
 {
-  gfc_warning_now ("\"%s\" is not a directory", path);
+  gfc_warning_cmdline ("%qs is not a directory", path);
   return;
 }
 
   if (head || *list == NULL)
 {
@@ -1923,11 +1920,11 @@ load_file (const char *realfilena

Re: [PATCH 1/2] Error out for Cilk_spawn or array expression in forbidden places

2014-10-03 Thread Bernhard Reutner-Fischer
On 3 October 2014 16:08:57 CEST, Andi Kleen  wrote:
>From: Andi Kleen 

>   (check_no_cilk): Dito.

I'm just curious, but isn't the english term "ditto" (im österreichischen ugs. 
"detto", think latin "idem") ?



Re: [PATCH] Power/GCC: Fix e500 vs non-e500 register save slot issue

2014-10-03 Thread Maciej W. Rozycki
On Wed, 24 Sep 2014, Joseph S. Myers wrote:

> > > * config/rs6000/e500.h (HARD_REGNO_CALLER_SAVE_MODE): Remove
> > > macro.
> > > * config/rs6000/rs6000.h (HARD_REGNO_CALLER_SAVE_MODE): Handle
> > > TARGET_E500_DOUBLE case here.
> > 
> > This patch is okay.  The repeated testing of E500 seems like it could
> > have been refactored.  The macro is becoming a little overly
> > complicated as a CASE statement.

 I tried avoiding obfuscation, but I agree there's potential for 
improvement here.  I have committed the change now, thanks for your 
review.

> > Are you avoiding the special cases for TFmode and TDmode on e500 for a
> > specific reason or simply matching current behavior?

 I just wanted to fix the rather grave and obscure configuration-induced 
ABI discrepancy bug and otherwise preserved the current behaviour.

> I don't know what's right in the context of the present patch, but the 
> general principle for e500 is that TDmode is much like TImode and DDmode 
> is much like DImode, but TFmode is much like two of DFmode; that was what 
> I concluded when making DFP work for e500 
> .

 Joseph, thanks for your input, my understanding of the subtleties of the 
Power ABI is still lacking.

  Maciej


Re: __intN patch 3/5: main __int128 -> __intN conversion.

2014-10-03 Thread DJ Delorie

Note that there is a separate __int128_t type that isn't part of the
"standard" extension.  Maybe it's there for that type?

Otherwise, I don't see what moving the test would accomplish.  If
"long" is never 128 bits, it doesn't matter if the int128 test is
before or after it, and the other intN are never the same size as
standard types, and we already have code to prefer unsigned for intN
types.


Re: [PATCH] middle-end: use dump_location instead of copy-pasted code

2014-10-03 Thread Jeff Law

On 10/03/14 12:39, Manuel López-Ibáñez wrote:

There are some inconsistencies in the middle-end about how to dump a
location. The following patch makes all places (that I found) use
dump_location, and makes that function print also the column number.

While searching for possible callers, I noticed two cases where we use
expanded_location for no good reason.

Bootstrapped and regression tested on x86_64-linux-gnu.

OK?

gcc/ChangeLog:

2014-10-03  Manuel López-Ibáñez  

 * tree-pretty-print.c (dump_location): Make it extern. Dump also
 the column.
 * tree-pretty-print.h (dump_location): Declare.
 * gimple-pretty-print.c (dump_gimple_phi): Use dump_location.
 (pp_gimple_stmt_1): Likewise.
 (dump_implicit_edges): Likewise.
 * gimplify.c (gimplify_call_expr): Use LOCATION_FILE and
 LOCATION_LINE.


gcc/testsuite/ChangeLog:

2014-10-03  Manuel López-Ibáñez  

 * gcc.dg/tm/debug-1.c: Update regex.
 * c-c++-common/raw-string-18.c: Update regex.
 * c-c++-common/raw-string-19.c: Update regex.

OK.
jeff



Re: [PATCH] Fix build on darwin (was Re: [PATCH] gcc.c: Split up the driver's "main" into smaller functions)

2014-10-03 Thread Jeff Law

On 10/03/14 13:15, David Malcolm wrote:

On Fri, 2014-10-03 at 11:02 -0400, David Malcolm wrote:

The "main" function for the driver in gcc.c has grown from ~200 lines
in its original form (way back in r262) to ~1000 lines today, with a
dozen locals (if we include the params).

The following patch splits it up into 15 smaller functions, moving the
various locals into the places where they're needed, so we can easily
see e.g where argc/argv get read vs written.

The functions are private methods of a new "driver" class to give an
extra level of encapsualation beyond just being static in gcc.c, and so
that we can hide some state as member data inside the driver instance.

Turning them into named functions/methods also makes it easier to talk
about the different phases of "main", and put breakpoints on them.

Bootstrapped®rtested on x86_64-unknown-linux-gnu (Fedora 20).

OK for trunk?

gcc/ChangeLog:
* gcc.c (class driver): New class.
(main): Reimplement in terms of driver::main, moving most of the
locals to be locals within individual methods of class driver.
The remaining locals "explicit_link_files", "decoded_options" and
"decoded_options_count" are used by multiple driver:: methods, and
so become member data.  Doing so isolates the argc/argv reads and
writes.  Replace "goto out" with a special exit code from
new method driver::prepare_infiles.  Split out the old
implementation of main into the following...
(driver::main): New function, corresponding to the old "main"
implementation.
(driver::set_progname): New function, taken from the old
"main" implementation.
(driver::expand_at_files): Likewise.
(driver::decode_argv): Likewise.
(driver::global_initializations): Likewise.
(driver::build_multilib_strings): Likewise.
(driver::set_up_specs): Likewise.
(driver::putenv_COLLECT_GCC): Likewise.
(driver::maybe_putenv_COLLECT_LTO_WRAPPER): Likewise.
(driver::handle_unrecognized_options): Likewise.
(driver::maybe_print_and_exit): Likewise.
(driver::prepare_infiles): Likewise.
(driver::do_spec_on_infiles): Likewise.
(driver::maybe_run_linker): Likewise.
(driver::final_actions): Likewise.
(driver::get_exit_code): Likewise.


I committed this as r215861 after the approval, but it turns out to
break the build of trunk's gcc.c on darwin, due to the "const" on
driver::global_initializations preventing GCC_DRIVER_HOST_INITIALIZATION
from modifying decoded_options_count and decoded_options:

In file included from ./tm.h:16:0,
  from ../../src/gcc/gcc.c:34:
../../src/gcc/gcc.c: In member function ‘void driver::global_initializations() 
const’:
../../src/gcc/config/darwin.h:911:63: error: invalid conversion from ‘const 
unsigned int*’ to ‘unsigned int*’ [-fpermissive]
darwin_driver_init (&decoded_options_count, &decoded_options)
^
../../src/gcc/gcc.c:6862:3: note: in expansion of macro 
‘GCC_DRIVER_HOST_INITIALIZATION’
GCC_DRIVER_HOST_INITIALIZATION;
^
../../src/gcc/config/darwin.h:911:63: error: invalid conversion from 
‘cl_decoded_option* const*’ to ‘cl_decoded_option**’ [-fpermissive]
darwin_driver_init (&decoded_options_count, &decoded_options)
^
../../src/gcc/gcc.c:6862:3: note: in expansion of macro 
‘GCC_DRIVER_HOST_INITIALIZATION’
GCC_DRIVER_HOST_INITIALIZATION;
^

The attached patch appears to fix it; with it, gcc.c compiles (in a
simple smoketest of "make gcc.o" in stage1 with
--target=powerpc64-darwin).

Am bootstrapping it on x86_64, fwiw; iains [CCed] said on IRC that he's
attempting a bootstrap with it.

Sorry about the breakage.

gcc/ChangeLog:
* gcc.c (driver::global_initializations): Remove "const" so
that GCC_DRIVER_HOST_INITIALIZATION can modify decoded_options
and decoded_options_count.

OK.
jeff


Re: [PATCH] Fix build on darwin (was Re: [PATCH] gcc.c: Split up the driver's "main" into smaller functions)

2014-10-03 Thread Iain Sandoe
Hi David,

On 3 Oct 2014, at 20:15, David Malcolm wrote:

> On Fri, 2014-10-03 at 11:02 -0400, David Malcolm wrote:
>> The "main" function for the driver in gcc.c has grown from ~200 lines
>> in its original form (way back in r262) to ~1000 lines today, with a
>> dozen locals (if we include the params).
>> 
>> The following patch splits it up into 15 smaller functions, moving the
>> various locals into the places where they're needed, so we can easily
>> see e.g where argc/argv get read vs written.
>> 
>> The functions are private methods of a new "driver" class to give an
>> extra level of encapsualation beyond just being static in gcc.c, and so
>> that we can hide some state as member data inside the driver instance.
>> 
>> Turning them into named functions/methods also makes it easier to talk
>> about the different phases of "main", and put breakpoints on them.
>> 
>> Bootstrapped®rtested on x86_64-unknown-linux-gnu (Fedora 20).
>> 
>> OK for trunk?
>> 
>> gcc/ChangeLog:
>>  * gcc.c (class driver): New class.
>>  (main): Reimplement in terms of driver::main, moving most of the
>>  locals to be locals within individual methods of class driver.
>>  The remaining locals "explicit_link_files", "decoded_options" and
>>  "decoded_options_count" are used by multiple driver:: methods, and
>>  so become member data.  Doing so isolates the argc/argv reads and
>>  writes.  Replace "goto out" with a special exit code from
>>  new method driver::prepare_infiles.  Split out the old
>>  implementation of main into the following...
>>  (driver::main): New function, corresponding to the old "main"
>>  implementation.
>>  (driver::set_progname): New function, taken from the old
>>  "main" implementation.
>>  (driver::expand_at_files): Likewise.
>>  (driver::decode_argv): Likewise.
>>  (driver::global_initializations): Likewise.
>>  (driver::build_multilib_strings): Likewise.
>>  (driver::set_up_specs): Likewise.
>>  (driver::putenv_COLLECT_GCC): Likewise.
>>  (driver::maybe_putenv_COLLECT_LTO_WRAPPER): Likewise.
>>  (driver::handle_unrecognized_options): Likewise.
>>  (driver::maybe_print_and_exit): Likewise.
>>  (driver::prepare_infiles): Likewise.
>>  (driver::do_spec_on_infiles): Likewise.
>>  (driver::maybe_run_linker): Likewise.
>>  (driver::final_actions): Likewise.
>>  (driver::get_exit_code): Likewise.
> 
> I committed this as r215861 after the approval, but it turns out to
> break the build of trunk's gcc.c on darwin, due to the "const" on
> driver::global_initializations preventing GCC_DRIVER_HOST_INITIALIZATION
> from modifying decoded_options_count and decoded_options:
> 
> In file included from ./tm.h:16:0,
> from ../../src/gcc/gcc.c:34:
> ../../src/gcc/gcc.c: In member function ‘void 
> driver::global_initializations() const’:
> ../../src/gcc/config/darwin.h:911:63: error: invalid conversion from ‘const 
> unsigned int*’ to ‘unsigned int*’ [-fpermissive]
>   darwin_driver_init (&decoded_options_count, &decoded_options)
>   ^
> ../../src/gcc/gcc.c:6862:3: note: in expansion of macro 
> ‘GCC_DRIVER_HOST_INITIALIZATION’
>   GCC_DRIVER_HOST_INITIALIZATION;
>   ^
> ../../src/gcc/config/darwin.h:911:63: error: invalid conversion from 
> ‘cl_decoded_option* const*’ to ‘cl_decoded_option**’ [-fpermissive]
>   darwin_driver_init (&decoded_options_count, &decoded_options)
>   ^
> ../../src/gcc/gcc.c:6862:3: note: in expansion of macro 
> ‘GCC_DRIVER_HOST_INITIALIZATION’
>   GCC_DRIVER_HOST_INITIALIZATION;
>   ^
> 
> The attached patch appears to fix it; with it, gcc.c compiles (in a
> simple smoketest of "make gcc.o" in stage1 with
> --target=powerpc64-darwin).
> 
> Am bootstrapping it on x86_64, fwiw; iains [CCed] said on IRC that he's
> attempting a bootstrap with it.

Works for me (and seems, as you said on irc, retrospectively obvious)
thanks!
Iain

> 
> Sorry about the breakage.
> 
> gcc/ChangeLog:
>   * gcc.c (driver::global_initializations): Remove "const" so
>   that GCC_DRIVER_HOST_INITIALIZATION can modify decoded_options
>   and decoded_options_count.
> 
> 



Re: [PATCH, Pointer Bounds Checker 19/x] Support bounds in expand

2014-10-03 Thread Jeff Law

On 10/02/14 08:03, Ilya Enkovich wrote:


Here is an updated version.

Thanks,
Ilya
--
2014-10-02  Ilya Enkovich  

* calls.c: Include tree-chkp.h, rtl-chkp.h, bitmap.h.
(arg_data): Add fields special_slot, pointer_arg and
pointer_offset.
(store_bounds): New.
(emit_call_1): Propagate instrumentation flag for CALL.
(initialize_argument_information): Compute pointer_arg,
pointer_offset and special_slot for pointer bounds arguments.
(finalize_must_preallocate): Preallocate when storing bounds
in bounds table.
(compute_argument_addresses): Skip pointer bounds.
(expand_call): Store bounds into tables separately.  Return
result joined with resulting bounds.
* cfgexpand.c: Include tree-chkp.h, rtl-chkp.h.
(expand_call_stmt): Propagate bounds flag for CALL_EXPR.
(expand_return): Add returned bounds arg.  Handle returned bounds.
(expand_gimple_stmt_1): Adjust to new expand_return signature.
(gimple_expand_cfg): Reset rtx bounds map.
* expr.c: Include tree-chkp.h, rtl-chkp.h.
(expand_assignment): Handle returned bounds.
(store_expr_with_bounds): New.  Replaces store_expr with new bounds
target argument.  Handle bounds returned by calls.
(store_expr): Now wraps store_expr_with_bounds.
* expr.h (store_expr_with_bounds): New.
* function.c: Include tree-chkp.h, rtl-chkp.h.
(bounds_parm_data): New.
(use_register_for_decl): Do not registerize decls used for bounds
stores and loads.
(assign_parms_augmented_arg_list): Add bounds of the result
structure pointer as the second argument.
(assign_parm_find_entry_rtl): Mark bounds are never passed on
the stack.
(assign_parm_is_stack_parm): Likewise.
(assign_parm_load_bounds): New.
(assign_bounds): New.
(assign_parms): Load bounds and determine a location for
returned bounds.
(diddle_return_value_1): New.
(diddle_return_value): Handle returned bounds.
* function.h (rtl_data): Add field for returned bounds.
* target.def (TARGET_FUNCTION_ARG): Update hook description with new
possible return value CONST_INT.
* doc/tm.texi: Regenerate.



OK  Thanks for your patience with my questions/concerns.

jeff


Re: [C PATCH] Don't warn about gnu_inline functions without definitions (PR c/63453)

2014-10-03 Thread Joseph S. Myers
On Fri, 3 Oct 2014, Marek Polacek wrote:

> While looking into something else I noticed that we produce C99ish
> "inline function declared but never defined" warning even for functions
> marked as gnu_inline, if not in GNU89 or if -fgnu89-inline is not
> in effect, because the warning was guarded only by !flag_gnu89_inline.
> 
> Bootstrapped/regtested on x86_64-linux, ok for trunk?

OK.

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


Re: [PATCH, Pointer Bounds Checker 14/x] Pointer Bounds Checker passes

2014-10-03 Thread Jeff Law

On 10/03/14 02:50, Ilya Enkovich wrote:

Attached is an updated version of the patch.  It has disabled instrumenttation 
for builtin calls.

Thanks,
Ilya
--
gcc/

2014-10-02  Ilya Enkovich

* tree-chkp.c: New.
* tree-chkp.h: New.
* rtl-chkp.c: New.
* rtl-chkp.h: New.
* Makefile.in (OBJS): Add tree-chkp.o, rtl-chkp.o.
(GTFILES): Add tree-chkp.c.
* c-family/c.opt (fchkp-check-incomplete-type): New.
(fchkp-zero-input-bounds-for-main): New.
(fchkp-first-field-has-own-bounds): New.
(fchkp-narrow-bounds): New.
(fchkp-narrow-to-innermost-array): New.
(fchkp-optimize): New.
(fchkp-use-fast-string-functions): New.
(fchkp-use-nochk-string-functions): New.
(fchkp-use-static-bounds): New.
(fchkp-use-static-const-bounds): New.
(fchkp-treat-zero-dynamic-size-as-infinite): New.
(fchkp-check-read): New.
(fchkp-check-write): New.
(fchkp-store-bounds): New.
(fchkp-instrument-calls): New.
(fchkp-instrument-marked-only): New.
* cppbuiltin.c (define_builtin_macros_for_compilation_flags): Add
__CHKP__ macro when Pointer Bounds Checker is on.
* passes.def (pass_ipa_chkp_versioning): New.
(pass_early_local_passes): Removed.
(pass_build_ssa_passes): New.
(pass_fixup_cfg): Moved to pass_chkp_instrumentation_passes.
(pass_chkp_instrumentation_passes): New.
(pass_ipa_chkp_produce_thunks): New.
(pass_local_optimization_passes): New.
(pass_chkp_opt): New.
* toplev.c: include tree-chkp.h.
(compile_file): Add chkp_finish_file call.
* tree-pass.h (make_pass_ipa_chkp_versioning): New.
(make_pass_ipa_chkp_produce_thunks): New.
(make_pass_chkp): New.
(make_pass_chkp_opt): New.
(make_pass_early_local_passes): Removed.
(make_pass_build_ssa_passes): New.
(make_pass_chkp_instrumentation_passes): New.
(make_pass_local_optimization_passes): New.
* tree.h (called_as_built_in): New.
* builtins.c (called_as_built_in): Not static anymore.
* passes.c (pass_manager::execute_early_local_passes): Execute
early passes in three steps.
(execute_all_early_local_passes): Removed.
(pass_data_early_local_passes): Removed.
(pass_early_local_passes): Removed.
(execute_build_ssa_passes): New.
(pass_data_build_ssa_passes): New.
(pass_build_ssa_passes): New.
(pass_data_chkp_instrumentation_passes): New.
(pass_chkp_instrumentation_passes): New.
(pass_data_local_optimization_passes): New.
(pass_local_optimization_passes): New.
(make_pass_early_local_passes): Removed.
(make_pass_build_ssa_passes): New.
(make_pass_chkp_instrumentation_passes): New.
(make_pass_local_optimization_passes): New.

gcc/testsuite

2014-10-02  Ilya Enkovich

* gcc.dg/pr37858.c: Replace early_local_cleanups pass name
with build_ssa_passes.
General question.  At the RTL level you represent the bounds with an RTX 
which is perfectly reasonable.  What are the structure sharing 
assumptions of those values?  Do they follow the existing RTL structure 
sharing assumptions?


Minor nit 2014 in the copyright year for all these files ;-)

So, for example if there are two references to the same bounds in RTL, 
are they distinct RTXs with the same underlying values?  Or is it a 
single rtx object that is shared?  It looks like you generally create 
new RTXs, but I'm a bit concerned that you might shove those things into 
a hash table and return them and embed a single reference into multiple 
hunks of parent RTL.










mpx-9-pass.patch


diff --git a/gcc/builtins.c b/gcc/builtins.c
index 17754e5..78ac91f 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -255,7 +255,7 @@ is_builtin_fn (tree decl)
 of the optimization level.  This means whenever a function is invoked with
 its "internal" name, which normally contains the prefix "__builtin".  */

-static bool
+bool
  called_as_built_in (tree node)
  {
/* Note that we must use DECL_NAME, not DECL_ASSEMBLER_NAME_SET_P since
Is there some reason you put the new prototype in tree.h rather than 
builtins.h?



+void
+chkp_emit_bounds_store (rtx bounds, rtx value, rtx mem)
+{

[ ... ]

+ else
+   ptr = gen_rtx_SUBREG (Pmode, value, INTVAL (offs));
I'm a bit concerned about the SUBREG use here.  Are you really trying to 
look at a different part of a REG expression here?   ISTM at the least 
you want to use one of the simplify routines to collapse this down in 
cases where it's useful to do so.


I see a fair amount of "tree" things in rtl-chkp.c.  We're trying to 
untangle trees from the rest of the compiler.  Can you look at see if 
any of that stuff could be rewritten to avoid a tree interface? 
chkp_copy_bounds_for_stack_parm comes to mind he

Update construction tracking in ipa-prop for new code

2014-10-03 Thread Jan Hubicka
Hi,
this patch adds basic tracking of what types may be in construction because the
call appears in a polymorphic cdtor.

Bootstrapped/regtested x86_64-linux, comitted.

Honza
* cgraph.h (struct indirect_call_info): Add IN_POLYMORPHIC_CDTOR
* lto-cgraph.c (lto_output_edge, input_edge): Stream
in_polymorphic_cdtor
* cgraph.c (symbol_table::create_edge): Compute in_polymorphic_cdtor.
(cgraph_edge::make_speculative): Copy in_polymorphic_cdtor.
* cgraphclones.c (cgraph_edge::clone): Likewise.
* ipa-prop.c (update_jump_functions_after_inlining, 
try_make_edge_direct_virtual_call): Pass in_polymorphic_cdtor
to possible_dynamic_type_change.
(decl_maybe_in_construction_p): Allow empty OUTER_TYPE and BASE.
(ipa_polymorphic_call_context::possible_dynamic_type_change): Add
IN_POLY_CDOTR argument.

Index: cgraph.h
===
--- cgraph.h(revision 215870)
+++ cgraph.h(working copy)
@@ -1333,7 +1333,7 @@ public:
   void offset_by (HOST_WIDE_INT);
   /* Use when we can not track dynamic type change.  This speculatively assume
  type change is not happening.  */
-  void possible_dynamic_type_change (tree otr_type = NULL);
+  void possible_dynamic_type_change (bool, tree otr_type = NULL);
   /* Assume that both THIS and a given context is valid and strenghten THIS
  if possible.  Return true if any strenghtening was made.
  If actual type the context is being used in is known, OTR_TYPE should be
@@ -1512,6 +1512,9 @@ struct GTY((chain_next ("%h.next_caller"
  Optimizers may later redirect direct call to clone, so 1) and 3)
  do not need to necesarily agree with destination.  */
   unsigned int speculative : 1;
+  /* Set to true when caller is a constructor or destructor of polymorphic
+ type.  */
+  unsigned in_polymorphic_cdtor : 1;
 
 private:
   /* Remove the edge from the list of the callers of the callee.  */
Index: lto-cgraph.c
===
--- lto-cgraph.c(revision 215870)
+++ lto-cgraph.c(working copy)
@@ -284,6 +284,7 @@ lto_output_edge (struct lto_simple_outpu
   bp_pack_value (&bp, edge->speculative, 1);
   bp_pack_value (&bp, edge->call_stmt_cannot_inline_p, 1);
   bp_pack_value (&bp, edge->can_throw_external, 1);
+  bp_pack_value (&bp, edge->in_polymorphic_cdtor, 1);
   if (edge->indirect_unknown_callee)
 {
   int flags = edge->indirect_info->ecf_flags;
@@ -1366,6 +1367,7 @@ input_edge (struct lto_input_block *ib,
   edge->inline_failed = inline_failed;
   edge->call_stmt_cannot_inline_p = bp_unpack_value (&bp, 1);
   edge->can_throw_external = bp_unpack_value (&bp, 1);
+  edge->in_polymorphic_cdtor = bp_unpack_value (&bp, 1);
   if (indirect)
 {
   if (bp_unpack_value (&bp, 1))
Index: cgraph.c
===
--- cgraph.c(revision 215870)
+++ cgraph.c(working copy)
@@ -819,6 +819,12 @@ symbol_table::create_edge (cgraph_node *
   edge->indirect_inlining_edge = 0;
   edge->speculative = false;
   edge->indirect_unknown_callee = indir_unknown_callee;
+  if (flag_devirtualize && call_stmt && DECL_STRUCT_FUNCTION (caller->decl))
+edge->in_polymorphic_cdtor
+  = decl_maybe_in_construction_p (NULL, NULL, call_stmt,
+ caller->decl);
+  else
+edge->in_polymorphic_cdtor = caller->thunk.thunk_p;
   if (call_stmt && caller->call_site_hash)
 cgraph_add_edge_to_call_site_hash (edge);
 
@@ -1033,6 +1039,7 @@ cgraph_edge::make_speculative (cgraph_no
   else
 e2->can_throw_external = can_throw_external;
   e2->lto_stmt_uid = lto_stmt_uid;
+  e2->in_polymorphic_cdtor = in_polymorphic_cdtor;
   count -= e2->count;
   frequency -= e2->frequency;
   symtab->call_edge_duplication_hooks (this, e2);
Index: cgraphclones.c
===
--- cgraphclones.c  (revision 215870)
+++ cgraphclones.c  (working copy)
@@ -159,6 +159,7 @@ cgraph_edge::clone (cgraph_node *n, gimp
   new_edge->can_throw_external = can_throw_external;
   new_edge->call_stmt_cannot_inline_p = call_stmt_cannot_inline_p;
   new_edge->speculative = speculative;
+  new_edge->in_polymorphic_cdtor = in_polymorphic_cdtor;
   if (update_original)
 {
   count -= new_edge->count;
Index: ipa-prop.c
===
--- ipa-prop.c  (revision 215870)
+++ ipa-prop.c  (working copy)
@@ -2652,7 +2652,7 @@ update_jump_functions_after_inlining (st
 
  /* TODO: Make type preserved safe WRT contexts.  */
  if (!dst->value.ancestor.agg_preserved)
-   ctx.possible_dynamic_type_change ();
+   ctx.possible_dynamic_type_change (e->in_polymorphic_cdtor);
  ctx.offset_by (dst->value.ancestor.offset);
  if (!ctx.useless_p (

Re: [PATCH 2/2] PR debug/63240 Add DWARF representation for C++11 defaulted member function.

2014-10-03 Thread Jason Merrill

On 10/03/2014 02:41 PM, Cary Coutant wrote:

O. Then I was indeed wrong and defaulted does not impact ABI at all.
At least that is one worry less for the abi checkers :)


As Siva mentioned, it does in fact impact the ABI. A class with a
non-trivial destructor is not a POD, and affects the calling
convention, so the debugger needs to know the difference.


Yes, but defaulted does not imply trivial (though the converse is true), 
so knowing whether a declaration is defaulted is neither necessary nor 
sufficient to determine the parameter passing ABI.  It would be good to 
represent trivial_fn_p in the DWARF.


Jason



[PATCH] Fix build on darwin (was Re: [PATCH] gcc.c: Split up the driver's "main" into smaller functions)

2014-10-03 Thread David Malcolm
On Fri, 2014-10-03 at 11:02 -0400, David Malcolm wrote:
> The "main" function for the driver in gcc.c has grown from ~200 lines
> in its original form (way back in r262) to ~1000 lines today, with a
> dozen locals (if we include the params).
> 
> The following patch splits it up into 15 smaller functions, moving the
> various locals into the places where they're needed, so we can easily
> see e.g where argc/argv get read vs written.
> 
> The functions are private methods of a new "driver" class to give an
> extra level of encapsualation beyond just being static in gcc.c, and so
> that we can hide some state as member data inside the driver instance.
> 
> Turning them into named functions/methods also makes it easier to talk
> about the different phases of "main", and put breakpoints on them.
> 
> Bootstrapped®rtested on x86_64-unknown-linux-gnu (Fedora 20).
> 
> OK for trunk?
> 
> gcc/ChangeLog:
>   * gcc.c (class driver): New class.
>   (main): Reimplement in terms of driver::main, moving most of the
>   locals to be locals within individual methods of class driver.
>   The remaining locals "explicit_link_files", "decoded_options" and
>   "decoded_options_count" are used by multiple driver:: methods, and
>   so become member data.  Doing so isolates the argc/argv reads and
>   writes.  Replace "goto out" with a special exit code from
>   new method driver::prepare_infiles.  Split out the old
>   implementation of main into the following...
>   (driver::main): New function, corresponding to the old "main"
>   implementation.
>   (driver::set_progname): New function, taken from the old
>   "main" implementation.
>   (driver::expand_at_files): Likewise.
>   (driver::decode_argv): Likewise.
>   (driver::global_initializations): Likewise.
>   (driver::build_multilib_strings): Likewise.
>   (driver::set_up_specs): Likewise.
>   (driver::putenv_COLLECT_GCC): Likewise.
>   (driver::maybe_putenv_COLLECT_LTO_WRAPPER): Likewise.
>   (driver::handle_unrecognized_options): Likewise.
>   (driver::maybe_print_and_exit): Likewise.
>   (driver::prepare_infiles): Likewise.
>   (driver::do_spec_on_infiles): Likewise.
>   (driver::maybe_run_linker): Likewise.
>   (driver::final_actions): Likewise.
>   (driver::get_exit_code): Likewise.

I committed this as r215861 after the approval, but it turns out to
break the build of trunk's gcc.c on darwin, due to the "const" on
driver::global_initializations preventing GCC_DRIVER_HOST_INITIALIZATION
from modifying decoded_options_count and decoded_options:

In file included from ./tm.h:16:0,
 from ../../src/gcc/gcc.c:34:
../../src/gcc/gcc.c: In member function ‘void driver::global_initializations() 
const’:
../../src/gcc/config/darwin.h:911:63: error: invalid conversion from ‘const 
unsigned int*’ to ‘unsigned int*’ [-fpermissive]
   darwin_driver_init (&decoded_options_count, &decoded_options)
   ^
../../src/gcc/gcc.c:6862:3: note: in expansion of macro 
‘GCC_DRIVER_HOST_INITIALIZATION’
   GCC_DRIVER_HOST_INITIALIZATION;
   ^
../../src/gcc/config/darwin.h:911:63: error: invalid conversion from 
‘cl_decoded_option* const*’ to ‘cl_decoded_option**’ [-fpermissive]
   darwin_driver_init (&decoded_options_count, &decoded_options)
   ^
../../src/gcc/gcc.c:6862:3: note: in expansion of macro 
‘GCC_DRIVER_HOST_INITIALIZATION’
   GCC_DRIVER_HOST_INITIALIZATION;
   ^

The attached patch appears to fix it; with it, gcc.c compiles (in a
simple smoketest of "make gcc.o" in stage1 with
--target=powerpc64-darwin).

Am bootstrapping it on x86_64, fwiw; iains [CCed] said on IRC that he's
attempting a bootstrap with it.

Sorry about the breakage.

gcc/ChangeLog:
* gcc.c (driver::global_initializations): Remove "const" so
that GCC_DRIVER_HOST_INITIALIZATION can modify decoded_options
and decoded_options_count.

Index: gcc/gcc.c
===
diff --git a/trunk/gcc/gcc.c b/trunk/gcc/gcc.c
--- a/trunk/gcc/gcc.c	(revision 215861)
+++ b/trunk/gcc/gcc.c	(working copy)
@@ -6737,7 +6737,7 @@
   void set_progname (const char *argv0) const;
   void expand_at_files (int *argc, char ***argv) const;
   void decode_argv (int argc, const char **argv);
-  void global_initializations () const;
+  void global_initializations ();
   void build_multilib_strings () const;
   void set_up_specs () const;
   void putenv_COLLECT_GCC (const char *argv0) const;
@@ -6848,7 +6848,7 @@
 /* Perform various initializations and setup.  */
 
 void
-driver::global_initializations () const
+driver::global_initializations ()
 {
   /* Unlock the stdio streams.  */
   unlock_std_streams ();


RE: [jit] Fix memory leak within diagnostic.c

2014-10-03 Thread Manuel López-Ibáñez
> gcc/ChangeLog.jit:
> * diagnostic.c (diagnostic_finish): Free the memory for
> context->classify_diagnostic and context->printer, running the
> destructor for the latter.

It would be easier to review and merge your branch if you directly
propose these self-contained and generally useful patches directly to
trunk, no?

Cheers,

Manuel.


Re: [PATCH 2/2] PR debug/63240 Add DWARF representation for C++11 defaulted member function.

2014-10-03 Thread Mark Wielaard
On Fri, 2014-10-03 at 11:41 -0700, Cary Coutant wrote:
> > O. Then I was indeed wrong and defaulted does not impact ABI at all.
> > At least that is one worry less for the abi checkers :)
> 
> As Siva mentioned, it does in fact impact the ABI. A class with a
> non-trivial destructor is not a POD, and affects the calling
> convention, so the debugger needs to know the difference. C++ ABI
> reference here:
> 
>http://mentorembedded.github.io/cxx-abi/abi.html#return-value
> 
> I've submitted a DWARF proposal to document the use of the
> DW_AT_artificial attribute on a default copy constructor or
> destructor.

Thanks for that reference. I was just stepping through gdb's
gdbarch_return_in_first_hidden_param_p to understand why Siva's example
did indeed seem to go wrong under GDB. That code is a little hairy with
all the arch specific indirections, so I am happy I can stop now :)

I can adjust my patch so that it does mark the declaration with
DW_AT_artificial if it is DECL_COPY_CONSTRUCTOR_P or DECL_DESTRUCTOR_P.
But maybe that is probably better done as a separate patch.

Or does it make sense to mark all defaulted special function members as
artificial instead of having a separate attribute for it? The (small)
advantage of having a separate attribute is that the consumer knows
whether it was explicitly defaulted.

Thanks,

Mark


Re: [PATCHv3][PING] Enable -fsanitize-recover for KASan

2014-10-03 Thread Alexey Samsonov
On Wed, Oct 1, 2014 at 10:58 PM, Jakub Jelinek  wrote:
> On Wed, Oct 01, 2014 at 04:21:29PM -0700, Alexey Samsonov wrote:
>> Speaking of plain -f(no-)sanitize-recover - it would probably be
>> better to change the semantics of this flag,
>> so that "-f(no-)?sanitize-recover" means "enable(disable) recovery for
>> all sanitizers enabled at this point".
>> That is, it would be pretty much like -Werror flag.
>>
>> For example,
>> "-fsanitize=undefined -fsanitize=address -fno-sanitize-recover"
>> would mean "run UBSan and ASan and don't recover from errors".
>
> That would change behavior, e.g. for
> -fsanitize=undefined,address -fsanitize-recover
> would suddenly enable recovery from asan errors while previously
> they wouldn't be recovering.
>
> GCC has not shipped with the -fsanitize-recover flag yet (we have just
> vendor backport of it), so if you don't mind changing behavior for clang
> users, I can live with that.

Yes, I think so. -fsanitize-recover was not documented in Clang user manual.

>  Would the default still be
> -fsanitize-recover=undefined,kernel-address -fno-sanitize-recover=address ?

Yes.

-- 
Alexey Samsonov, Mountain View, CA


Re: [PATCH 2/2] PR debug/63240 Add DWARF representation for C++11 defaulted member function.

2014-10-03 Thread Cary Coutant
> O. Then I was indeed wrong and defaulted does not impact ABI at all.
> At least that is one worry less for the abi checkers :)

As Siva mentioned, it does in fact impact the ABI. A class with a
non-trivial destructor is not a POD, and affects the calling
convention, so the debugger needs to know the difference. C++ ABI
reference here:

   http://mentorembedded.github.io/cxx-abi/abi.html#return-value

I've submitted a DWARF proposal to document the use of the
DW_AT_artificial attribute on a default copy constructor or
destructor.

-cary


[PATCH] middle-end: use dump_location instead of copy-pasted code

2014-10-03 Thread Manuel López-Ibáñez
There are some inconsistencies in the middle-end about how to dump a
location. The following patch makes all places (that I found) use
dump_location, and makes that function print also the column number.

While searching for possible callers, I noticed two cases where we use
expanded_location for no good reason.

Bootstrapped and regression tested on x86_64-linux-gnu.

OK?

gcc/ChangeLog:

2014-10-03  Manuel López-Ibáñez  

* tree-pretty-print.c (dump_location): Make it extern. Dump also
the column.
* tree-pretty-print.h (dump_location): Declare.
* gimple-pretty-print.c (dump_gimple_phi): Use dump_location.
(pp_gimple_stmt_1): Likewise.
(dump_implicit_edges): Likewise.
* gimplify.c (gimplify_call_expr): Use LOCATION_FILE and
LOCATION_LINE.


gcc/testsuite/ChangeLog:

2014-10-03  Manuel López-Ibáñez  

* gcc.dg/tm/debug-1.c: Update regex.
* c-c++-common/raw-string-18.c: Update regex.
* c-c++-common/raw-string-19.c: Update regex.
Index: gcc/tree-pretty-print.c
===
--- gcc/tree-pretty-print.c (revision 215841)
+++ gcc/tree-pretty-print.c (working copy)
@@ -675,22 +675,24 @@ dump_omp_clauses (pretty_printer *buffer
 }
 
 
 /* Dump location LOC to BUFFER.  */
 
-static void
+void
 dump_location (pretty_printer *buffer, location_t loc)
 {
   expanded_location xloc = expand_location (loc);
 
   pp_left_bracket (buffer);
   if (xloc.file)
 {
   pp_string (buffer, xloc.file);
-  pp_string (buffer, " : ");
+  pp_string (buffer, ":");
 }
   pp_decimal_int (buffer, xloc.line);
+  pp_colon (buffer);
+  pp_decimal_int (buffer, xloc.column);
   pp_string (buffer, "] ");
 }
 
 
 /* Dump lexical block BLOCK.  BUFFER, SPC and FLAGS are as in
Index: gcc/tree-pretty-print.h
===
--- gcc/tree-pretty-print.h (revision 215841)
+++ gcc/tree-pretty-print.h (working copy)
@@ -48,7 +48,8 @@ extern const char *op_symbol_code (enum
 extern void print_call_name (pretty_printer *, tree, int);
 extern void percent_K_format (text_info *);
 extern void pp_tree_identifier (pretty_printer *, tree);
 extern void dump_function_header (FILE *, tree, int);
 extern void pp_double_int (pretty_printer *pp, double_int d, bool uns);
+extern void dump_location (pretty_printer *buffer, location_t loc);
 
 #endif /* ! GCC_TREE_PRETTY_PRINT_H */
Index: gcc/testsuite/gcc.dg/tm/debug-1.c
===
--- gcc/testsuite/gcc.dg/tm/debug-1.c   (revision 215841)
+++ gcc/testsuite/gcc.dg/tm/debug-1.c   (working copy)
@@ -17,10 +17,10 @@ int main() {
testing();
}
return 0;
 }
 
-/* { dg-final { scan-tree-dump-times ": 13:.*b = 9898" 1 "tmmark" } } */
-/* { dg-final { scan-tree-dump-times ": 14:.*_ITM_beginTransaction" 1 "tmmark" 
} } */
-/* { dg-final { scan-tree-dump-times ": 15:.*ITM_WU. \\(&z" 1 "tmmark" } } */
-/* { dg-final { scan-tree-dump-times ": 16:.*ITM_WU. \\(&a" 1 "tmmark" } } */
+/* { dg-final { scan-tree-dump-times ":13:.*b = 9898" 1 "tmmark" } } */
+/* { dg-final { scan-tree-dump-times ":14:.*_ITM_beginTransaction" 1 "tmmark" 
} } */
+/* { dg-final { scan-tree-dump-times ":15:.*ITM_WU. \\(&z" 1 "tmmark" } } */
+/* { dg-final { scan-tree-dump-times ":16:.*ITM_WU. \\(&a" 1 "tmmark" } } */
 /* { dg-final { cleanup-tree-dump "tmmark" } } */
Index: gcc/testsuite/c-c++-common/raw-string-18.c
===
--- gcc/testsuite/c-c++-common/raw-string-18.c  (revision 215841)
+++ gcc/testsuite/c-c++-common/raw-string-18.c  (working copy)
@@ -15,7 +15,7 @@ main ()
   extern void foo (); foo ();
   return 0;
 }
 
 /* Verify call to foo is on line 15.  */
-/* { dg-final { scan-tree-dump ": 15\[]:]\[^\n\r]*foo" "optimized" } } */
+/* { dg-final { scan-tree-dump "c:15:\[^\n\r\]*foo" "optimized" } } */
 /* { dg-final { cleanup-tree-dump "optimized" } } */
Index: gcc/testsuite/c-c++-common/raw-string-19.c
===
--- gcc/testsuite/c-c++-common/raw-string-19.c  (revision 215841)
+++ gcc/testsuite/c-c++-common/raw-string-19.c  (working copy)
@@ -15,8 +15,8 @@ main ()
   extern void foo (); foo ();
   return 0;
 }
 
 /* Verify call to foo is on line 15.  */
-/* { dg-final { scan-tree-dump ": 15\[]:]\[^\n\r]*foo" "optimized" } } */
+/* { dg-final { scan-tree-dump "c:15:\[^\n\r\]*foo" "optimized" } } */
 /* { dg-final { cleanup-tree-dump "optimized" } } */
 /* { dg-final { cleanup-saved-temps } } */
Index: gcc/gimple-pretty-print.c
===
--- gcc/gimple-pretty-print.c   (revision 215841)
+++ gcc/gimple-pretty-print.c   (working copy)
@@ -1832,25 +1832,11 @@ dump_gimple_phi (pretty_printer *buffer,
   pp_string (buffer, " = PHI <");
 }
   for (i = 0; i < gimple_phi_num_args (phi); i++)
 {
   if ((

[jit] Fix memory leak within diagnostic.c

2014-10-03 Thread David Malcolm
Committed to branch dmalcolm/jit:

Running e.g. test-factorial.exe under valgrind shows that libgccjit.so
was leaking ~13.5KB of RAM per invocation of the compiler here:

==57074== 21,440 bytes in 4 blocks are definitely lost in loss record 896 of 907
==57074==at 0x4A0645D: malloc (in 
/usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==57074==by 0x58EFFC7: xmalloc (xmalloc.c:147)
==57074==by 0x58A9256: diagnostic_initialize(diagnostic_context*, int) 
(diagnostic.c:129)
==57074==by 0x4DF6062: toplev::main(int, char**) (toplev.c:1120)
==57074==by 0x4E09E13: gcc::jit::playback::context::compile() 
(internal-api.c:4987)
==57074==by 0x4E015C2: gcc::jit::recording::context::compile() 
(internal-api.c:878)
==57074==by 0x401CA4: test_jit (harness.h:188)
==57074==by 0x401D88: main (harness.h:230)
==57074==
==57074== 34,112 (256 direct, 33,856 indirect) bytes in 4 blocks are definitely 
lost in loss record 902 of 907
==57074==at 0x4A0645D: malloc (in 
/usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==57074==by 0x58EFFC7: xmalloc (xmalloc.c:147)
==57074==by 0x58A91D4: diagnostic_initialize(diagnostic_context*, int) 
(diagnostic.c:122)
==57074==by 0x4DF6062: toplev::main(int, char**) (toplev.c:1120)
==57074==by 0x4E09E13: gcc::jit::playback::context::compile() 
(internal-api.c:4987)
==57074==by 0x4E015C2: gcc::jit::recording::context::compile() 
(internal-api.c:878)
==57074==by 0x401CA4: test_jit (harness.h:188)
==57074==by 0x401D88: main (harness.h:230)

Fix it.

gcc/ChangeLog.jit:
* diagnostic.c (diagnostic_finish): Free the memory for
context->classify_diagnostic and context->printer, running the
destructor for the latter.
---
 gcc/diagnostic.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c
index b1b6366..642cbe3 100644
--- a/gcc/diagnostic.c
+++ b/gcc/diagnostic.c
@@ -177,6 +177,15 @@ diagnostic_finish (diagnostic_context *context)
 }
 
   diagnostic_file_cache_fini ();
+
+  XDELETEVEC (context->classify_diagnostic);
+  context->classify_diagnostic = NULL;
+
+  /* diagnostic_initialize allocates context->printer using XNEW
+ and placement-new.  */
+  context->printer->~pretty_printer ();
+  XDELETE (context->printer);
+  context->printer = NULL;
 }
 
 /* Initialize DIAGNOSTIC, where the message MSG has already been
-- 
1.7.11.7



Re: [RFC] costs and it's use in assign_reg_parm

2014-10-03 Thread Jeff Law

On 10/02/14 02:31, Ramana Radhakrishnan wrote:


And a couple of items caught my attention.

For one the backend doesn't set the costs of a reg-reg move to be the
same as a reg-const move. In the AArch64 backend the approach appears to
be in line with the documentation which is to set the costs of various
instructions relative to a fast integer instruction. The hack to
aarch64.c in the attached patch is for setting the cost properly for a
reg-reg move of the appropriate mode and is only for demonstration
purposes. I expect this to be replaced by an equivalent bit of code in
the backend to achieve the same thing.
rtx_cost and its friends have always been a problem and it's always felt 
like a design problem.   The true cost of something is so context 
dependent I'm not really sure how to build an API to do this in a sane way.



Regardless, the first thing I see when I look at the aarch64 rtx costing 
bits is that it rarely looks at modes.  So it's entirely possible that 
if floats/doubles have a higher cost than integers that it needs a bit 
of hacking to bring the result into line for non-integer modes.






However the code in precompute_register_parameters assumes that the
value is forced into a register if the set_src_cost of a constant is  >
COSTS_N_INSNS(1). Now this appears to be checking the cost of a set of
an FP immediate constant to a register and the backend not unreasonably
sets it to an appropriate cost. Now to assume that this number should
always be less than 1 is really not appropriate.
Agreed. Also note there's a bit of a break in the model -- namely that 
we're comparing the cost of a particular operand vs the cost of insns. 
I've always found this to be, umm lame and a source of confusion when 
folks have been doing backend tuning.




Instead of putting in what's effectively a lie in the backend, should we
just be moving the midend to a world where all such numbers are compared
to costs from the backend rather than relying on magic numbers. The
costs comparison logic is similar to whats used in lower-subreg. The
thought was to move this to a common area (Richard Sandiford suggested
expmed.h in a private conversation) so that we had common APIs to check
the cost of a SET in this form rather than relying on the rtx_cost
interface.

Agreed.

Jeff


Re: [gofrontend-dev] [PATCH 3/9] Gccgo port to s390[x] -- part I

2014-10-03 Thread Ian Lance Taylor
On Tue, Sep 9, 2014 at 5:51 AM, Dominik Vogt  wrote:
> The current Gccgo cannot handle 64 bit symbol tables on s390[x].
> The attached patch fixes that.
>
> gcc/go/ChangeLog
> 2014-09-05  Dominik Vogt  
>
> * gofrontend/import-archive.cc (interpret_header): Recognize 64-bit
> symbol tables ("/SYM64/ ").

Thanks.  Committed.

Ian


Re: [PATCH, rs6000] Warn for deprecated use of vec_lvsl and vec_lvsr for little endian

2014-10-03 Thread David Edelsohn
On Mon, Sep 29, 2014 at 5:53 PM, Bill Schmidt
 wrote:
> Hi,
>
> The vec_lvsl and vec_lvsr interfaces are deprecated for little endian in
> the ELFv2 ABI document.  At the moment, these interfaces will produce
> incorrect code, and the only indication a programmer has of this is that
> his or her code does not function correctly.  This patch adds a warning
> message to inform the little endian programmer of the deprecated usage.
>
> The patch described in
> https://gcc.gnu.org/ml/gcc-patches/2014-09/msg02580.html is a
> prerequisite for this patch, as otherwise the deprecation message causes
> bootstrap failure due to -Werror in the later stages.
>
> I feel the deprecation message is needed because, in a future patch, we
> plan to make vec_lvsl and vec_lvsr work so that BE code will run on LE
> without requiring code modifications.  However, code modifications are
> still desirable because the LE code, while correct, will be pretty poor.
> The deprecation message will encourage programmers to rewrite their code
> that makes use of vec_lvsl/lvsr.
>
> I've added a new test to demonstrate the message, and updated a number
> of tests to use -Wno-deprecated so the new message doesn't disturb them.
>
> Bootstrapped and tested on powerpc64le-unknown-linux-gnu with no
> regressions.  Is this ok for trunk?
>
> Thanks,
> Bill
>
>
> [gcc]
>
> 2014-09-29  Bill Schmidt  
>
> * config/rs6000/rs6000-c.c (altivec_resolve_overloaded_builtin):
> Issue a warning message when vec_lvsl or vec_lvsr is used with a
> little endian target.
>
> [gcc/testsuite]
>
> 2014-09-29  Bill Schmidt  
>
> * g++.dg/ext/altivec-2.C: Compile with -Wno-deprecated to avoid
> failing with the new warning message.
> * gcc.dg/vmx/3c-01a.c: Likewise.
> * gcc.dg/vmx/ops-long-1.c: Likewise.
> * gcc.dg/vmx/ops.c: Likewise.
> * gcc.target/powerpc/altivec-20.c: Likewise.
> * gcc.target/powerpc/altivec-6.c: Likewise.
> * gcc.target/powerpc/altivec-vec-merge.c: Likewise.
> * gcc.target/powerpc/vsx-builtin-8.c: Likewise.
> * gcc.target/powerpc/warn-lvsl-lvsr.c: New test.

Okay.

Thanks, David


Re: [PATCH, rs6000] Generate LE code for vec_lvsl and vec_lvsr that is compatible with BE code

2014-10-03 Thread David Edelsohn
On Thu, Oct 2, 2014 at 3:20 PM, Bill Schmidt
 wrote:
> Hi,
>
> Here's a revised version of the patch that addresses Segher's comments.
> Bootstrapped and tested on powerpc64le-unknown-linux-gnu.  Ok for trunk?
>
> Thanks,
> Bill
>
>
> [gcc]
>
> 2014-10-02  Bill Schmidt  
>
> * altivec.md (altivec_lvsl): New define_expand.
> (altivec_lvsl_direct): Rename define_insn from altivec_lvsl.
> (altivec_lvsr): New define_expand.
> (altivec_lvsr_direct): Rename define_insn from altivec_lvsr.
> * rs6000.c (rs6000_expand_builtin): Change to use
> altivec_lvs[lr]_direct; remove commented-out code.
>
> [gcc/testsuite]
>
> 2014-10-02  Bill Schmidt  
>
> * gcc.target/powerpc/lvsl-lvsr.c: New test.

Okay.

Thanks, Segher, for providing a second set of eyes.

Thanks, David


Re: [PATCH 2/2] Add illegal cilk checks to C++ front.

2014-10-03 Thread Paolo Carlini

Hi,

On 10/03/2014 07:50 PM, Andi Kleen wrote:

I have no idea, but there are lots of error_at() all over while
don't use _.  So I just follow precedence.

The problem is, you are *not* calling error_at directly, you are

According to Joseph it's ok because I named the arguments _msgid.

Ok then, I didn't notice that. Sorry for the false alarm.

Paolo.


Re: [PATCH] 512-bit gcc.dg/torture/vshuf*.c

2014-10-03 Thread Mike Stump
On Oct 3, 2014, at 9:40 AM, Uros Bizjak  wrote:
>> Ok for trunk?
>> 
>> 2014-10-03  Jakub Jelinek  

> That said, the patch is OK from x86 side, but a testsuite maintainer
> should OK it.

Ok.


[PATCH, RTX]: Additional fix for PR 57003

2014-10-03 Thread Uros Bizjak
Hello!

My r215428 change exposed another PR 57003 problem on x86_64. When
compiling gcc.target/i386/pr57003.c we refer to clobbered %rdi
register after the call to memcpy:

--- pr57003.s   2014-10-03 15:08:24.0 +0200
+++ pr57003_.s  2014-10-03 15:08:19.0 +0200
@@ -78,7 +78,7 @@
leaq-20(%rbx), %rdx
movq%rax, %rdi
callmemcpy
-   movq%rdi, c(%rip)
+   movq%rax, c(%rip)
 .L8:
movaps  (%rsp), %xmm6
movaps  16(%rsp), %xmm7
@@ -321,5 +321,5 @@
.byte   0xb
.align 8
 .LEFDE7:
-   .ident  "GCC: (GNU) 5.0.0 20141002 (experimental) [trunk
revision 215797]"
+   .ident  "GCC: (GNU) 4.9.2 20141001 (prerelease)
[gcc-4_9-branch revision 215749]"
.section.note.GNU-stack,"",@progbits

The runtime failure happens only on CentOS5 (and not in Fedora20),
which supports findings in Comment #17 of the PR.

The difference is, that now we emit memcpy for MS_ABI->ELF_ABI
cross-ABI call as:

#(call_insn:TI 24 23 27 3 (set (reg:DI 0 ax)
#(call (mem:QI (symbol_ref:DI ("memcpy") [flags 0x41]
) [0 memcpy S1 A8])
#(const_int 0 [0]))) pr57003.c:32 661 {*call_value}
# (expr_list:REG_DEAD (reg:DI 5 di)
#(expr_list:REG_DEAD (reg:DI 4 si)
#(expr_list:REG_DEAD (reg:DI 1 dx)
#(expr_list:REG_UNUSED (reg:DI 0 ax)
#(expr_list:REG_RETURNED (reg/v/f:DI 2 cx [orig:87 e ] [87])
#(expr_list:REG_CALL_DECL (symbol_ref:DI
("memcpy") [flags 0x41] )
#(expr_list:REG_EH_REGION (const_int 0 [0])
#(nil
#(expr_list (clobber (reg:TI 52 xmm15))
#(expr_list (clobber (reg:TI 51 xmm14))
#(expr_list (clobber (reg:TI 50 xmm13))
#(expr_list (clobber (reg:TI 49 xmm12))
#(expr_list (clobber (reg:TI 48 xmm11))
#(expr_list (clobber (reg:TI 47 xmm10))
#(expr_list (clobber (reg:TI 46 xmm9))
#(expr_list (clobber (reg:TI 45 xmm8))
#(expr_list (clobber (reg:TI 28 xmm7))
#(expr_list (clobber (reg:TI 27 xmm6))
#(expr_list (clobber (reg:DI 5 di))
#(expr_list (clobber
(reg:DI 4 si))
#(expr_list:DI
(set (reg:DI 0 ax)
#(reg:DI 5 di))
#(expr_list:DI
(use (reg:DI 5 di))
#
(expr_list:DI (use (reg:DI 4 si))
#
(expr_list:DI (use (reg:DI 1 dx))
#
(nil))

which is alternate, but equivalent form of what was generated previously:

#(call_insn:TI 24 23 27 3 (parallel [
#(set (reg:DI 0 ax)
#(call (mem:QI (symbol_ref:DI ("memcpy") [flags 0x41]
) [0 memcpy S1 A8])
#(const_int 0 [0])))
#(unspec [
#(const_int 0 [0])
#] UNSPEC_MS_TO_SYSV_CALL)
#(clobber (reg:DI 4 si))
#(clobber (reg:DI 5 di))
#(clobber (reg:TI 27 xmm6))
#(clobber (reg:TI 28 xmm7))
#(clobber (reg:TI 45 xmm8))
#(clobber (reg:TI 46 xmm9))
#(clobber (reg:TI 47 xmm10))
#(clobber (reg:TI 48 xmm11))
#(clobber (reg:TI 49 xmm12))
#(clobber (reg:TI 50 xmm13))
#(clobber (reg:TI 51 xmm14))
#(clobber (reg:TI 52 xmm15))
#]) pr57003.c:32 652 {*call_value_rex64_ms_sysv}
# (expr_list:REG_DEAD (reg:DI 5 di)
#(expr_list:REG_DEAD (reg:DI 4 si)
#(expr_list:REG_DEAD (reg:DI 1 dx)
#(expr_list:REG_RETURNED (reg/v/f:DI 2 cx [orig:87 e ] [87])
#(expr_list:REG_EH_REGION (const_int 0 [0])
#(nil))
#(expr_list:DI (set (reg:DI 0 ax)
#(reg:DI 5 di))
#(expr_list:DI (use (reg:DI 5 di))
#(expr_list:DI (use (reg:DI 4 si))
#(expr_list:DI (use (reg:DI 1 dx))
#(nil))

It looks that Jakub's patch, proposed in Comment #21 doesn't cover
alternative form, so it doesn't record clobbers properly.

Attached patch fixes this omission.

2014-10-03  Uros Bizjak  

PR rtl-optimization/57003
* regcprop.c (copyprop_hardreg_forward_1): If ksvd.ignore_set_reg,
also check CALL_INSN_FUNCTION_USAGE for clobbers again after
killing regs_invalidated_by_call.

Tested on x86_64-linux-gnu {,-m32}.

OK for mainline and release branches?

Uros.
Index: regcprop.c
===
--- regcprop.c  (revision 215861)
+++ regcprop.c  (working copy)
@@ -1029,7 +1029,17 @@ copyprop_hardreg_forward_1 (basic_block bb, struct
 but instead among CLOBB

Re: [PATCH 2/2] Add illegal cilk checks to C++ front.

2014-10-03 Thread Andi Kleen
> >I have no idea, but there are lots of error_at() all over while
> >don't use _.  So I just follow precedence.
> The problem is, you are *not* calling error_at directly, you are

According to Joseph it's ok because I named the arguments _msgid.

-Andi


Re: [PATCH, rs6000, libcpp] Revise search_line_fast to avoid old unaligned load sequences

2014-10-03 Thread David Edelsohn
On Mon, Sep 29, 2014 at 4:15 PM, Bill Schmidt
 wrote:
> Hi,
>
> The vec_lvsl and vec_lvsr interfaces are deprecated for little-endian
> Power, and really should not be used on big-endian Power either when the
> target CPU is power8 or above.  The lexer in libcpp currently makes use
> of these interfaces in search_line_fast().  This patch provides a new
> version of search_line_fast() that allows unaligned loads to be handled
> by the hardware.
>
> The new version is used when _ARCH_PWR8 and __ALTIVEC__ are defined.
> Otherwise, the older version may be used; however it is now restricted
> for use only on big-endian systems.  If we are targeting little-endian
> (which requires P8 or higher) and either Altivec support or Power8
> architecture support has been disabled, then we revert to a slower
> search routine.  This prevents ever using the deprecated instructions
> for little-endian code generation.
>
> I haven't added a new test case, as bootstrapping GCC is an excellent
> test of search_line_fast(), and that appears to be all we do at present
> for the existing implementations.
>
> Bootstrapped and tested on powerpc64le-unknown-linux-gnu and
> powerpc64-unknown-linux-gnu with no new regressions.  Is this ok for
> trunk?
>
> Thanks,
> Bill
>
>
> 2014-09-29  Bill Schmidt  
>
> * lex.c (search_line_fast): Add new version to be used for Power8
> and later targets when Altivec is enabled.  Restrict the existing
> Altivec version to big-endian systems so that lvsr is not used on
> little endian, where it is deprecated.  Remove LE-specific code
> from the now-BE-only version.

The code is POWER-specific.  It's okay with me.  The GCC front-end
maintainers do not seem to have any concerns or objections.

Thanks, David


[C PATCH] Don't warn about gnu_inline functions without definitions (PR c/63453)

2014-10-03 Thread Marek Polacek
While looking into something else I noticed that we produce C99ish
"inline function declared but never defined" warning even for functions
marked as gnu_inline, if not in GNU89 or if -fgnu89-inline is not
in effect, because the warning was guarded only by !flag_gnu89_inline.

Bootstrapped/regtested on x86_64-linux, ok for trunk?

2014-10-03  Marek Polacek  

PR c/63453
* c-decl.c (pop_scope): Don't warn about "inline function declared
but never defined" for functions marked with gnu_inline attribute.

* gcc.dg/pr63453.c: New test.

diff --git gcc/c/c-decl.c gcc/c/c-decl.c
index b4995a6..ce5a8de 100644
--- gcc/c/c-decl.c
+++ gcc/c/c-decl.c
@@ -1177,7 +1177,8 @@ pop_scope (void)
  /* C99 6.7.4p6: "a function with external linkage... declared
 with an inline function specifier ... shall also be defined
 in the same translation unit."  */
- if (!flag_gnu89_inline)
+ if (!flag_gnu89_inline
+ && !lookup_attribute ("gnu_inline", DECL_ATTRIBUTES (p)))
pedwarn (input_location, 0,
 "inline function %q+D declared but never defined", p);
  DECL_EXTERNAL (p) = 1;
diff --git gcc/testsuite/gcc.dg/pr63453.c gcc/testsuite/gcc.dg/pr63453.c
index e69de29..e6337aa 100644
--- gcc/testsuite/gcc.dg/pr63453.c
+++ gcc/testsuite/gcc.dg/pr63453.c
@@ -0,0 +1,8 @@
+/* PR c/63453 */
+/* { dg-do compile } */
+/* { dg-options "-std=gnu11" } */
+
+inline int fn1 (void); /* { dg-warning "declared but never defined" } */
+extern inline int fn2 (void); /* { dg-warning "declared but never defined" } */
+inline int __attribute__ ((gnu_inline)) fn3 (void);
+extern inline int __attribute__ ((gnu_inline)) fn4 (void);

Marek


Re: [PATCH 2/2] PR debug/63240 Add DWARF representation for C++11 defaulted member function.

2014-10-03 Thread Mark Wielaard
On Fri, 2014-10-03 at 10:54 -0400, Jason Merrill wrote:
> "user-declared" includes declarations that are defaulted in the class 
> body.  "user-provided" is the category that does not include such 
> declarations.

O. Then I was indeed wrong and defaulted does not impact ABI at all.
At least that is one worry less for the abi checkers :)

In that case I think we should indeed not distinguish between
DECL_DEFAULTED_IN_CLASS_P and DECL_DEFAULTED_OUTSIDE_CLASS_P and just
use DECL_DEFAULTED_FN. Then the information provided is just that the
source indicates that the special member function has the default
implementation. Which still is useful to know for a consumer. If only to
show the debug users what the intention of the original source code was.

The following variant of the patch does that (and removes any mention of
"out of class" definitions).

Thanks,

Mark
From f72525e11d08ad49d208ab75c806326871d881d7 Mon Sep 17 00:00:00 2001
From: Mark Wielaard 
Date: Fri, 3 Oct 2014 14:44:27 +0200
Subject: [PATCH] PR debug/63240 Add DWARF representation for C++11 defaulted
 member function.

gcc/ChangeLog

	* dwarf2out.c (gen_subprogram_die): When a member function is
	declared default then add a DW_AT_GNU_defaulted attribute.
	* langhooks.h (struct lang_hooks_for_decls): Add
	function_decl_defaulted_p langhook.
	* langhooks-def.h (LANG_HOOKS_FUNCTION_DECL_DEFAULTED_P): Define.
	(LANG_HOOKS_DECLS): Add LANG_HOOKS_FUNCTION_DECL_DEFAULTED_P.

gcc/cp/ChangeLog

	* cp-objcp-common.h (LANG_HOOKS_FUNCTION_DECL_DEFAULTED_P): Define.
	(cp_function_decl_defaulted_p): New prototype.
	* cp-objcp-common.c (cp_function_defaulted_p): New function.

gcc/testsuite/ChangeLog

	* g++.dg/debug/dwarf2/defaulted-member-function.C: New testcase.

include/ChangeLog

	* dwarf2.def (DW_AT_GNU_defaulted): New attribute.
---
 gcc/ChangeLog   | 10 ++
 gcc/cp/ChangeLog|  7 +++
 gcc/cp/cp-objcp-common.c| 10 ++
 gcc/cp/cp-objcp-common.h|  3 +++
 gcc/dwarf2out.c |  6 ++
 gcc/langhooks-def.h |  2 ++
 gcc/langhooks.h |  3 +++
 gcc/testsuite/ChangeLog |  5 +
 .../g++.dg/debug/dwarf2/defaulted-member-function.C | 17 +
 include/ChangeLog   |  5 +
 include/dwarf2.def  |  2 ++
 11 files changed, 70 insertions(+)
 create mode 100644 gcc/testsuite/g++.dg/debug/dwarf2/defaulted-member-function.C

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index dc3287b..255b1b6 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,13 @@
+2014-10-03  Mark Wielaard  
+
+	PR debug/63240
+	* dwarf2out.c (gen_subprogram_die): When a member function is
+	declared default then add a DW_AT_GNU_defaulted attribute.
+	* langhooks.h (struct lang_hooks_for_decls): Add
+	function_decl_defaulted_p langhook.
+	* langhooks-def.h (LANG_HOOKS_FUNCTION_DECL_DEFAULTED_P): Define.
+	(LANG_HOOKS_DECLS): Add LANG_HOOKS_FUNCTION_DECL_DEFAULTED_P.
+
 2014-10-02  Mark Wielaard  
 
 	PR debug/63239
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 921f95c..d88bcd8 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,10 @@
+2014-10-03  Mark Wielaard  
+
+	PR debug/63240
+	* cp-objcp-common.h (LANG_HOOKS_FUNCTION_DECL_DEFAULTED_P): Define.
+	(cp_function_decl_defaulted_p): New prototype.
+	* cp-objcp-common.c (cp_function_defaulted_p): New function.
+
 2014-10-02  Mark Wielaard  
 
 	PR debug/63239
diff --git a/gcc/cp/cp-objcp-common.c b/gcc/cp/cp-objcp-common.c
index 0d144ef..e668183 100644
--- a/gcc/cp/cp-objcp-common.c
+++ b/gcc/cp/cp-objcp-common.c
@@ -178,6 +178,16 @@ cp_function_decl_deleted_p (tree decl)
 	  && DECL_DELETED_FN (decl));
 }
 
+/* Return true if DECL is defaulted special member function.  */
+
+bool
+cp_function_decl_defaulted_p (tree decl)
+{
+  return (decl
+	  && DECL_LANG_SPECIFIC (STRIP_TEMPLATE (decl))
+	  && DECL_DEFAULTED_FN (decl));
+}
+
 /* Stubs to keep c-opts.c happy.  */
 void
 push_file_scope (void)
diff --git a/gcc/cp/cp-objcp-common.h b/gcc/cp/cp-objcp-common.h
index c289774..348874f 100644
--- a/gcc/cp/cp-objcp-common.h
+++ b/gcc/cp/cp-objcp-common.h
@@ -28,6 +28,7 @@ extern tree objcp_tsubst_copy_and_build (tree, tree, tsubst_flags_t,
 
 extern bool cp_function_decl_explicit_p (tree decl);
 extern bool cp_function_decl_deleted_p (tree decl);
+extern bool cp_function_decl_defaulted_p (tree decl);
 extern void cp_common_init_ts (void);
 
 /* Lang hooks that are shared between C++ and ObjC++ are defined here.  Hooks
@@ -134,6 +135,8 @@ extern void cp_common_init_ts (void);
 #define LANG_HOOKS_FUNCTION_DECL_EXPLICIT_P cp_function_decl_explicit_p
 #undef LANG_HOOKS_FUNCTION_DECL_DELETED_P
 #define LANG_HOOKS_FUNCTION_DECL_DELETED_P cp_functio

Re: [PATCH 2/2] Add illegal cilk checks to C++ front.

2014-10-03 Thread Paolo Carlini

Hi,

On 10/03/2014 07:13 PM, Andi Kleen wrote:

On Fri, Oct 03, 2014 at 07:10:05PM +0200, Paolo Carlini wrote:

Hi,

On 10/03/2014 04:08 PM, Andi Kleen wrote:

+  if (check_no_cilk (destination,
+"Cilk array notation cannot be used as a computed goto expression",
+"%<_Cilk_spawn%> statement cannot be used as a computed goto 
expression"))
+   destination = error_mark_node;

Are you sure this kind of error messages will be automatically
translated without helping the machinery by wrapping the string
literals in G_() ?

I have no idea, but there are lots of error_at() all over while
don't use _.  So I just follow precedence.
The problem is, you are *not* calling error_at directly, you are using 
check_no_cilk and passing pointers. In fact, I think you actually do 
need G_, as in many other places of the front-end. If unsure, double check:


https://gcc.gnu.org/translation.html

Paolo.


Re: [PATCH 2/2] PR debug/63240 Add DWARF representation for C++11 defaulted member function.

2014-10-03 Thread Siva Chandra
On Fri, Oct 3, 2014 at 10:13 AM, Siva Chandra  wrote:
> On Fri, Oct 3, 2014 at 7:17 AM, Jason Merrill  wrote:
>> On 10/03/2014 09:12 AM, Mark Wielaard wrote:
>>>
>>> A debugger not knowing whether a special member function was explicitly
>>> defaulted, implicitly declared or explicitly defined seems less confusion
>>> than not knowing whether it was deleted. But there are some subtle cases
>>> where knowing whether a constructor was user defined or explicitly
>>> defaulted do matter for whether the default constructor might have been
>>> implicitly generated.
>>
>>
>> Can you elaborate?
>>
>>> So like the deleted case this patch introduces
>>> a new attribute DW_AT_GNU_defaulted that gets attached to the function
>>> declaration. Note that since this is for declarations we explicitly
>>> test for DECL_DEFAULTED_IN_CLASS_P and ignore any implementation
>>> definitions that use = default; outside the class body.
>>
>>
>> Hmm, I'm dubious about this choice.  How do you expect a consumer to use
>> this information?
>
> I apologize for gate crashing here...
>
> Currently, there is no special attribute to indicate that a special
> member function is declared = default. So, if you have a class
> definition like this:
>
> class A
> {
> public:
>   A () {}
>   ~A () = default;
>   int a;
> };
>
> then, GDB sees the declaration of the destructor with no special
> attributes (like DW_AT_artificial or similar) and thinks that the copy
> constructor is user defined.

Aww, sorry. I should have said destructor instead of copy constructor.


Re: [PATCH 2/2] Add illegal cilk checks to C++ front.

2014-10-03 Thread Andi Kleen
On Fri, Oct 03, 2014 at 07:10:05PM +0200, Paolo Carlini wrote:
> Hi,
> 
> On 10/03/2014 04:08 PM, Andi Kleen wrote:
> >+  if (check_no_cilk (destination,
> >+ "Cilk array notation cannot be used as a computed goto expression",
> >+ "%<_Cilk_spawn%> statement cannot be used as a computed goto 
> >expression"))
> >+destination = error_mark_node;
> Are you sure this kind of error messages will be automatically
> translated without helping the machinery by wrapping the string
> literals in G_() ?

I have no idea, but there are lots of error_at() all over while
don't use _.  So I just follow precedence.

-Andi


Re: [PATCH 2/2] PR debug/63240 Add DWARF representation for C++11 defaulted member function.

2014-10-03 Thread Siva Chandra
On Fri, Oct 3, 2014 at 7:17 AM, Jason Merrill  wrote:
> On 10/03/2014 09:12 AM, Mark Wielaard wrote:
>>
>> A debugger not knowing whether a special member function was explicitly
>> defaulted, implicitly declared or explicitly defined seems less confusion
>> than not knowing whether it was deleted. But there are some subtle cases
>> where knowing whether a constructor was user defined or explicitly
>> defaulted do matter for whether the default constructor might have been
>> implicitly generated.
>
>
> Can you elaborate?
>
>> So like the deleted case this patch introduces
>> a new attribute DW_AT_GNU_defaulted that gets attached to the function
>> declaration. Note that since this is for declarations we explicitly
>> test for DECL_DEFAULTED_IN_CLASS_P and ignore any implementation
>> definitions that use = default; outside the class body.
>
>
> Hmm, I'm dubious about this choice.  How do you expect a consumer to use
> this information?

I apologize for gate crashing here...

Currently, there is no special attribute to indicate that a special
member function is declared = default. So, if you have a class
definition like this:

class A
{
public:
  A () {}
  ~A () = default;
  int a;
};

then, GDB sees the declaration of the destructor with no special
attributes (like DW_AT_artificial or similar) and thinks that the copy
constructor is user defined. Consequently, if there is a function
defined as:

A
make_a (int i)
{
  A a;
  a.a = i;

  return a;
}

Then, if a user invokes make_a at the GDB prompt, then GDB will
wrongly pass the pointer to the return value as a hidden first
parameter.

Question: Should special member functions declared = default be marked
DW_AT_artificial?

Thanks,
Siva Chandra


Re: [PATCH 2/2] Add illegal cilk checks to C++ front.

2014-10-03 Thread Paolo Carlini

Hi,

On 10/03/2014 04:08 PM, Andi Kleen wrote:

+  if (check_no_cilk (destination,
+"Cilk array notation cannot be used as a computed goto expression",
+"%<_Cilk_spawn%> statement cannot be used as a computed goto 
expression"))
+   destination = error_mark_node;
Are you sure this kind of error messages will be automatically 
translated without helping the machinery by wrapping the string literals 
in G_() ?


Paolo.


Re: [PATCH 1/2] Error out for Cilk_spawn or array expression in forbidden places

2014-10-03 Thread Jeff Law

On 10/03/14 08:08, Andi Kleen wrote:

From: Andi Kleen 

_Cilk_spawn or Cilk array expressions are only allowed on their own,
but not in for(), if(), switch, do, while, goto, etc.
The C parser didn't always check for that, which lead to ICEs earlier
for invalid code.

Add a generic helper that checks this and call it where needed
in the C frontend.

I chose to allow spawn/array for for init and increment expressions.
While the Cilk spec could be interpreted to forbid it there too
there didn't seem any reason to not allow it.

One dark corner is spawn, array in statement expressions not at
the end. Right now that's forbidden too.

gcc/c-family/:

2014-09-30  Andi Kleen  

PR c/60804
* c-common.h (check_no_cilk): Declare.
* cilk.c (get_error_location): New function.
(check_no_cilk): Dito.

gcc/c/:

2014-09-30  Andi Kleen  

PR c/60804
* c-parser.c (c_parser_statement_after_labels): Call
check_no_cilk.
(c_parser_if_statement): Dito.
(c_parser_switch_statement): Dito.
(c_parser_while_statement): Dito.
(c_parser_do_statement): Dito.
(c_parser_for_statement): Dito.
* c-typeck.c (c_finish_loop): Dito.

OK.
Jeff



Re: [GOOGLE] Skip fake LIPO edges when replacing calls with local alias

2014-10-03 Thread Xinliang David Li
oops -- misread it :)

Ok.

David

On Fri, Oct 3, 2014 at 9:45 AM, Teresa Johnson  wrote:
> On Fri, Oct 3, 2014 at 9:31 AM, Xinliang David Li  wrote:
>> The name 'e' is used for both outer scope edge and inner scope one.
>
> No, the declaration was moved from the inner scope to the outer scope.
>
> Teresa
>
>> This is confusing.
>>
>> David
>>
>>
>> On Fri, Oct 3, 2014 at 9:27 AM, Teresa Johnson  wrote:
>>> Adds handling in this block of code (new in gcc/4_9 and therefore
>>> google/4_9) for LIPO fake edges for indirect calls, which don't have a
>>> call_stmt set and cannot be redirected.
>>>
>>> Passes regression tests, ok for google/4_9 branch?
>>>
>>> Teresa
>>>
>>> 2014-10-03  Teresa Johnson  
>>>
>>> Google ref b/17378050
>>> * ipa.c (function_and_variable_visibility): Skip LIPO fake indirect
>>> call edges.
>>>
>>> Index: ipa.c
>>> ===
>>> --- ipa.c   (revision 215830)
>>> +++ ipa.c   (working copy)
>>> @@ -1146,12 +1146,15 @@ function_and_variable_visibility (bool whole_progr
>>>if (node->callers && can_replace_by_local_alias (node))
>>> {
>>>   struct cgraph_node *alias = cgraph
>>> (symtab_nonoverwritable_alias (node));
>>> + struct cgraph_edge *e, *next_caller;
>>>
>>>   if (alias && alias != node)
>>> {
>>> - while (node->callers)
>>> +  for (e = node->callers; e; e = next_caller)
>>> {
>>> - struct cgraph_edge *e = node->callers;
>>> +  next_caller = e->next_caller;
>>> + if (L_IPO_COMP_MODE && cgraph_is_fake_indirect_call_edge 
>>> (e))
>>> +   continue;
>>>
>>>   cgraph_redirect_edge_callee (e, alias);
>>>   if (gimple_has_body_p (e->caller->decl))
>>>
>>>
>>> --
>>> Teresa Johnson | Software Engineer | tejohn...@google.com | 408-460-2413
>
>
>
> --
> Teresa Johnson | Software Engineer | tejohn...@google.com | 408-460-2413


C++ PATCH to start C++14 constexpr support

2014-10-03 Thread Jason Merrill

These patches implement a couple bits of the C++14 constexpr enhancements.

The first patch adds support for local variables in a constexpr function 
with intializers that can just be substituted into the return expression.


The second patch adds diagnostics for things that are still not 
permitted in a constexpr function.


Tested x86_64-pc-linux-gnu, applying to trunk.
commit 9bf3eee3ac0225c7aea376d85e51e5da987fc401
Author: Jason Merrill 
Date:   Thu Oct 2 15:51:03 2014 -0400

	* semantics.c (constexpr_fn_retval): Ignore declarations in C++14.
	(var_in_constexpr_fn): New.
	(cxx_eval_constant_expression): Look into DECL_INITIAL.
	(potential_constant_expression_1): Allow constexpr-local vars.

diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index fe1651e..857af76 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -5833,6 +5833,7 @@ extern tree maybe_constant_value (tree);
 extern tree maybe_constant_init (tree);
 extern bool is_sub_constant_expr (tree);
 extern bool reduced_constant_expression_p (tree);
+extern bool var_in_constexpr_fn (tree);
 extern void explain_invalid_constexpr_fn (tree);
 extern vec cx_error_context (void);
 extern bool is_this_parameter (tree);
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 7569826..6c6a5c8 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -8018,6 +8018,8 @@ constexpr_fn_retval (tree body)
 case DECL_EXPR:
   if (TREE_CODE (DECL_EXPR_DECL (body)) == USING_DECL)
 	return NULL_TREE;
+  if (cxx_dialect >= cxx14)
+	return NULL_TREE;
   return error_mark_node;
 
 case CLEANUP_POINT_EXPR:
@@ -9596,6 +9598,14 @@ cxx_eval_trinary_expression (const constexpr_call *call, tree t,
   return val;
 }
 
+bool
+var_in_constexpr_fn (tree t)
+{
+  tree ctx = DECL_CONTEXT (t);
+  return (cxx_dialect >= cxx14 && ctx && TREE_CODE (ctx) == FUNCTION_DECL
+	  && DECL_DECLARED_CONSTEXPR_P (ctx));
+}
+
 /* Attempt to reduce the expression T to a constant value.
On failure, issue diagnostic and return error_mark_node.  */
 /* FIXME unify with c_fully_fold */
@@ -9635,6 +9645,11 @@ cxx_eval_constant_expression (const constexpr_call *call, tree t,
   if (TREE_CODE (r) == TARGET_EXPR
 	  && TREE_CODE (TARGET_EXPR_INITIAL (r)) == CONSTRUCTOR)
 	r = TARGET_EXPR_INITIAL (r);
+  if (DECL_P (r) && var_in_constexpr_fn (r)
+	  && DECL_INITIAL (r))
+	r = cxx_eval_constant_expression (call, DECL_INITIAL (r),
+	  allow_non_constant, false,
+	  non_constant_p, overflow_p);
   if (DECL_P (r))
 	{
 	  if (!allow_non_constant)
@@ -10320,6 +10335,7 @@ potential_constant_expression_1 (tree t, bool want_rval, tsubst_flags_t flags)
 
 case VAR_DECL:
   if (want_rval && !decl_constant_var_p (t)
+	  && !var_in_constexpr_fn (t)
 	  && !dependent_type_p (TREE_TYPE (t)))
 {
   if (flags & tf_error)
diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-local1.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-local1.C
new file mode 100644
index 000..39c3ee8
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-local1.C
@@ -0,0 +1,9 @@
+// { dg-do compile { target c++14 } }
+
+constexpr int f(int i) { int j = i+1; return j; }
+
+constexpr int i = f(41);
+
+#define SA(X) static_assert((X),#X)
+
+SA(i==42);

commit 239f96028401a2836208f21f3432c4be91265740
Author: Jason Merrill 
Date:   Fri Oct 3 06:15:02 2014 -0400

	* decl.c (start_decl): Complain about static/thread_local vars
	in constexpr function.
	(check_for_uninitialized_const_var): Also uninitialized vars.
	* parser.c (cp_parser_jump_statement): And gotos.
	(cp_parser_asm_operand_list): And asm.
	(cp_parser_try_block): And try.
	* semantics.c (ensure_literal_type_for_constexpr_object): And
	non-literal.

diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 7856dd8..9c8ecc0 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -4767,6 +4767,16 @@ start_decl (const cp_declarator *declarator,
   DECL_THIS_STATIC (decl) = 1;
 }
 
+  if (current_function_decl && VAR_P (decl)
+  && DECL_DECLARED_CONSTEXPR_P (current_function_decl))
+{
+  if (DECL_THREAD_LOCAL_P (decl))
+	error ("%qD declared % in % function",
+	   decl);
+  else if (TREE_STATIC (decl))
+	error ("%qD declared % in % function", decl);
+}
+
   if (!processing_template_decl && VAR_P (decl))
 start_decl_1 (decl, initialized);
 
@@ -5135,15 +5145,20 @@ check_for_uninitialized_const_var (tree decl)
  7.1.6 */
   if (VAR_P (decl)
   && TREE_CODE (type) != REFERENCE_TYPE
-  && CP_TYPE_CONST_P (type)
+  && (CP_TYPE_CONST_P (type) || var_in_constexpr_fn (decl))
   && !DECL_INITIAL (decl))
 {
   tree field = default_init_uninitialized_part (type);
   if (!field)
 	return;
 
-  permerror (DECL_SOURCE_LOCATION (decl),
-		 "uninitialized const %qD", decl);
+  if (CP_TYPE_CONST_P (type))
+	permerror (DECL_SOURCE_LOCATION (decl),
+		   "uninitialized const %qD", decl);
+  else
+	error_at (DECL_SOURCE_LOCATION (dec

Re: [GOOGLE] Skip fake LIPO edges when replacing calls with local alias

2014-10-03 Thread Teresa Johnson
On Fri, Oct 3, 2014 at 9:31 AM, Xinliang David Li  wrote:
> The name 'e' is used for both outer scope edge and inner scope one.

No, the declaration was moved from the inner scope to the outer scope.

Teresa

> This is confusing.
>
> David
>
>
> On Fri, Oct 3, 2014 at 9:27 AM, Teresa Johnson  wrote:
>> Adds handling in this block of code (new in gcc/4_9 and therefore
>> google/4_9) for LIPO fake edges for indirect calls, which don't have a
>> call_stmt set and cannot be redirected.
>>
>> Passes regression tests, ok for google/4_9 branch?
>>
>> Teresa
>>
>> 2014-10-03  Teresa Johnson  
>>
>> Google ref b/17378050
>> * ipa.c (function_and_variable_visibility): Skip LIPO fake indirect
>> call edges.
>>
>> Index: ipa.c
>> ===
>> --- ipa.c   (revision 215830)
>> +++ ipa.c   (working copy)
>> @@ -1146,12 +1146,15 @@ function_and_variable_visibility (bool whole_progr
>>if (node->callers && can_replace_by_local_alias (node))
>> {
>>   struct cgraph_node *alias = cgraph
>> (symtab_nonoverwritable_alias (node));
>> + struct cgraph_edge *e, *next_caller;
>>
>>   if (alias && alias != node)
>> {
>> - while (node->callers)
>> +  for (e = node->callers; e; e = next_caller)
>> {
>> - struct cgraph_edge *e = node->callers;
>> +  next_caller = e->next_caller;
>> + if (L_IPO_COMP_MODE && cgraph_is_fake_indirect_call_edge 
>> (e))
>> +   continue;
>>
>>   cgraph_redirect_edge_callee (e, alias);
>>   if (gimple_has_body_p (e->caller->decl))
>>
>>
>> --
>> Teresa Johnson | Software Engineer | tejohn...@google.com | 408-460-2413



-- 
Teresa Johnson | Software Engineer | tejohn...@google.com | 408-460-2413


Re: [google gcc-4_9] fix undefined references in debug_info

2014-10-03 Thread Teresa Johnson
Yes, this needs to be fixed on trunk too. I looked at the history and
it has been this way (overwriting the footer) for years. It must be
uncommon to have this confluence of events.

Thanks,
Teresa

On Fri, Oct 3, 2014 at 9:28 AM, Xinliang David Li  wrote:
> This patch should be targeting trunk gcc?
>
> David
>
> On Fri, Oct 3, 2014 at 9:23 AM, Rong Xu  wrote:
>> Hi,
>>
>> This patch fixed a bug exposed in build kernel with fdo.
>>
>> We cannot simply overwrite the bb footer in  emit_barrier_after_bb as
>> the bb may already have a footer (in this case, a deleted label stmt).
>> We need to output this label because it's a user label and debug_info
>> has a reference to it.
>>
>> Tested with problematic file and regression test.
>> Trunk may also have the same issue, but I need to work on a testcase.
>>
>> Thanks,
>>
>> -Rong



-- 
Teresa Johnson | Software Engineer | tejohn...@google.com | 408-460-2413


Re: [PING] Enhance array types debug info. for Ada

2014-10-03 Thread Jason Merrill

On 09/17/2014 10:38 AM, Pierre-Marie de Rodat wrote:

Patches 1-4 are OK.


+  bool pell_conversions = true;


I don't understand "pell".  Do you mean "strip"?

Jason



Re: [PATCH] 512-bit gcc.dg/torture/vshuf*.c

2014-10-03 Thread Uros Bizjak
On Fri, Oct 3, 2014 at 4:25 PM, Jakub Jelinek  wrote:

> This patch extends the gcc.dg/torture/ testsuite for
> 512-bit vectors.  Tested with
> GCC_TEST_RUN_EXPENSIVE=1 make -j32 check-gcc \
> RUNTESTFLAGS='--target_board=unix\{-mavx2,-mavx,-mavx512f,-mavx512bw/-mavx512vl\}
>  dg-torture.exp=vshuf*.c'
> (of course with expected AVX512* execution test failures,
> as I don't have hw and didn't bother with simulator).
>
> As before in vshuf-{8,16,32}.inc, some of the permutations
> are hand written (subset in the TESTS portion), the rest
> are random permutations.
>
> Ok for trunk?
>
> 2014-10-03  Jakub Jelinek  
>
> * gcc.dg/torture/vshuf-v8df.c: New test.
> * gcc.dg/torture/vshuf-v8di.c: New test.
> * gcc.dg/torture/vshuf-v16sf.c: New test.
> * gcc.dg/torture/vshuf-v16si.c: New test.
> * gcc.dg/torture/vshuf-v32hi.c: New test.
> * gcc.dg/torture/vshuf-v64qi.c: New test.
> * gcc.dg/torture/vshuf-64.inc: New file.

Please note that -mavx512{bw,vl} are moving target ATM, quite some
patches are still pending.

That said, the patch is OK from x86 side, but a testsuite maintainer
should OK it.

Uros.


Re: [GOOGLE] Skip fake LIPO edges when replacing calls with local alias

2014-10-03 Thread Xinliang David Li
The name 'e' is used for both outer scope edge and inner scope one.
This is confusing.

David


On Fri, Oct 3, 2014 at 9:27 AM, Teresa Johnson  wrote:
> Adds handling in this block of code (new in gcc/4_9 and therefore
> google/4_9) for LIPO fake edges for indirect calls, which don't have a
> call_stmt set and cannot be redirected.
>
> Passes regression tests, ok for google/4_9 branch?
>
> Teresa
>
> 2014-10-03  Teresa Johnson  
>
> Google ref b/17378050
> * ipa.c (function_and_variable_visibility): Skip LIPO fake indirect
> call edges.
>
> Index: ipa.c
> ===
> --- ipa.c   (revision 215830)
> +++ ipa.c   (working copy)
> @@ -1146,12 +1146,15 @@ function_and_variable_visibility (bool whole_progr
>if (node->callers && can_replace_by_local_alias (node))
> {
>   struct cgraph_node *alias = cgraph
> (symtab_nonoverwritable_alias (node));
> + struct cgraph_edge *e, *next_caller;
>
>   if (alias && alias != node)
> {
> - while (node->callers)
> +  for (e = node->callers; e; e = next_caller)
> {
> - struct cgraph_edge *e = node->callers;
> +  next_caller = e->next_caller;
> + if (L_IPO_COMP_MODE && cgraph_is_fake_indirect_call_edge 
> (e))
> +   continue;
>
>   cgraph_redirect_edge_callee (e, alias);
>   if (gimple_has_body_p (e->caller->decl))
>
>
> --
> Teresa Johnson | Software Engineer | tejohn...@google.com | 408-460-2413


Re: [google gcc-4_9] fix undefined references in debug_info

2014-10-03 Thread Xinliang David Li
This patch should be targeting trunk gcc?

David

On Fri, Oct 3, 2014 at 9:23 AM, Rong Xu  wrote:
> Hi,
>
> This patch fixed a bug exposed in build kernel with fdo.
>
> We cannot simply overwrite the bb footer in  emit_barrier_after_bb as
> the bb may already have a footer (in this case, a deleted label stmt).
> We need to output this label because it's a user label and debug_info
> has a reference to it.
>
> Tested with problematic file and regression test.
> Trunk may also have the same issue, but I need to work on a testcase.
>
> Thanks,
>
> -Rong


[GOOGLE] Skip fake LIPO edges when replacing calls with local alias

2014-10-03 Thread Teresa Johnson
Adds handling in this block of code (new in gcc/4_9 and therefore
google/4_9) for LIPO fake edges for indirect calls, which don't have a
call_stmt set and cannot be redirected.

Passes regression tests, ok for google/4_9 branch?

Teresa

2014-10-03  Teresa Johnson  

Google ref b/17378050
* ipa.c (function_and_variable_visibility): Skip LIPO fake indirect
call edges.

Index: ipa.c
===
--- ipa.c   (revision 215830)
+++ ipa.c   (working copy)
@@ -1146,12 +1146,15 @@ function_and_variable_visibility (bool whole_progr
   if (node->callers && can_replace_by_local_alias (node))
{
  struct cgraph_node *alias = cgraph
(symtab_nonoverwritable_alias (node));
+ struct cgraph_edge *e, *next_caller;

  if (alias && alias != node)
{
- while (node->callers)
+  for (e = node->callers; e; e = next_caller)
{
- struct cgraph_edge *e = node->callers;
+  next_caller = e->next_caller;
+ if (L_IPO_COMP_MODE && cgraph_is_fake_indirect_call_edge (e))
+   continue;

  cgraph_redirect_edge_callee (e, alias);
  if (gimple_has_body_p (e->caller->decl))


-- 
Teresa Johnson | Software Engineer | tejohn...@google.com | 408-460-2413


[google gcc-4_9] fix undefined references in debug_info

2014-10-03 Thread Rong Xu
Hi,

This patch fixed a bug exposed in build kernel with fdo.

We cannot simply overwrite the bb footer in  emit_barrier_after_bb as
the bb may already have a footer (in this case, a deleted label stmt).
We need to output this label because it's a user label and debug_info
has a reference to it.

Tested with problematic file and regression test.
Trunk may also have the same issue, but I need to work on a testcase.

Thanks,

-Rong
2014-10-02  Rong Xu  

* gcc/cfgrtl.c (emit_barrier_after_bb): Append footer instead of
overwriting.

Index: gcc/cfgrtl.c
===
--- gcc/cfgrtl.c(revision 215823)
+++ gcc/cfgrtl.c(working copy)
@@ -1453,7 +1453,20 @@ emit_barrier_after_bb (basic_block bb)
   gcc_assert (current_ir_type () == IR_RTL_CFGRTL
   || current_ir_type () == IR_RTL_CFGLAYOUT);
   if (current_ir_type () == IR_RTL_CFGLAYOUT)
-BB_FOOTER (bb) = unlink_insn_chain (barrier, barrier);
+{
+  rtx insn = unlink_insn_chain (barrier, barrier);
+
+  if (BB_FOOTER (bb))
+   {
+  rtx footer_tail = BB_FOOTER (bb);
+  while (NEXT_INSN(footer_tail))
+footer_tail = NEXT_INSN (insn);
+ NEXT_INSN (footer_tail) = insn;
+ PREV_INSN (insn) = footer_tail;
+   }
+  else
+BB_FOOTER (bb) = insn;
+}
 }
 
 /* Like force_nonfallthru below, but additionally performs redirection


[gomp4] reduction bug fix

2014-10-03 Thread Cesar Philippidis
There is a reduction bug exposed in the following parallel block.

#pragma acc parallel copy(b[0:3][0:3]) copy(l)
{
#pragma acc loop collapse(2) reduction(+:l)
for (int i = 0; i < 2; i++)
  for (int j = 0; j < 2; j++)
if (b[i][j] != 16)
  l += 1;
}

Because i and j are local, the collapsed loop is lowered into something
as follows

#pragma acc parallel ...
{
  int i
  {
 int j
 {
#pragma acc loop ...

This is a problem because initialize_reduction_data originally expected
a GIMPLE_BIND at the very beginning of a parallel block. I also made the
assumption that collapse would create a single bind.

Looking at this some more, I may need revise initialize_reduction_data
to scan for multiple acc loops within a parallel block. E.g.,

#pragma acc parallel
{
#pragma acc loop reduction (+:foo)
  {
  }
...
#pragma acc loop reduction (-:bar)
  {
  }
}

I'll address this issue in a follow up patch.

This patch also includes a runtime test case. I won't apply it to
gomp-4_0-branch just yet. But I wanted to demonstrate a test case
nonetheless. Also, note that part of this patch also changes a comment.
I found some typos in the original comment, so I took the opportunity to
fix them, I hope.

Is this OK for gomp-4_0-branch?

Thanks,
Cesar
2014-10-02  Cesar Philippidis  

	gcc/
	* omp-low.c (lower_reduction_clauses): Clarify comment.
	(process_reduction_data): Scan for nonempty bind statements at
	the beginning of parallel blocks.

	libgomp/
	* testsuite/libgomp.oacc-c/collapse-4.c: New test.


diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 3bb6a24..5c452c6 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -4434,10 +4434,10 @@ lower_reduction_clauses (tree clauses, gimple_seq *stmt_seqp, omp_context *ctx)
 	  else
 	{
 	  /* The atomic add at the end of the sum creates unnecessary
-	 write contention on accelerators.  To work around that,
-	 create an array or vector_length and assign an element to
-	 each thread.  Later, in lower_omp_for (for openacc), the
-	 values of array will be combined.  */
+	 write contention on accelerators.  To work around this,
+	 create an array to store the partial reductions. Later, in
+	 lower_omp_for (for openacc), the values of array will be
+	 combined.  */
 
 	  tree t = NULL_TREE, array, nthreads;
 	  tree type = get_base_type (var);
@@ -10140,11 +10140,20 @@ process_reduction_data (gimple_seq *body, gimple_seq *in_stmt_seqp,
   gimple stmt;
 
   /* A collapse clause may have inserted a new bind block.  */
-  stmt = gimple_seq_first (*body);
-  if (stmt && gimple_code (stmt) == GIMPLE_BIND)
+  gsi = gsi_start (*body);
+  while (!gsi_end_p (gsi))
 {
-  inner = gimple_bind_body (gimple_seq_first (*body));
-  body = &inner;
+  stmt = gsi_stmt (gsi);
+  if (gimple_code (stmt) == GIMPLE_BIND)
+	{
+	  inner = gimple_bind_body (stmt);
+	  body = &inner;
+	  gsi = gsi_start (*body);
+	}
+  else if (gimple_code (stmt) == GIMPLE_OMP_FOR)
+	break;
+  else
+	gsi_next (&gsi);
 }
 
   for (gsi = gsi_start (*body); !gsi_end_p (gsi); gsi_next (&gsi))
diff --git a/libgomp/testsuite/libgomp.oacc-c/collapse-4.c b/libgomp/testsuite/libgomp.oacc-c/collapse-4.c
new file mode 100644
index 000..b08115a
--- /dev/null
+++ b/libgomp/testsuite/libgomp.oacc-c/collapse-4.c
@@ -0,0 +1,34 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -std=c99" } */
+
+#include 
+#include 
+#include 
+
+int
+main (void)
+{
+  int i2, l = 0, r = 0;
+  int a[3][3][3];
+  int b[3][3];
+
+printf("&a %p\n", &a[0][0][0]);
+printf("&i2 %p\n", &i2);
+printf("&l %p\n", &l);
+printf("&r %p\n", &r);
+
+  memset (a, '\0', sizeof (a));
+  memset (b, '\0', sizeof (b));
+
+
+#pragma acc parallel copy(b[0:3][0:3]) copy(l)
+{
+#pragma acc loop collapse(2) reduction(+:l)
+	for (int i = 0; i < 2; i++)
+	  for (int j = 0; j < 2; j++)
+	if (b[i][j] != 16)
+		  l += 1;
+}
+
+  return 0;
+}


Re: [PATCH] gcc.c: Split up the driver's "main" into smaller functions

2014-10-03 Thread Joseph S. Myers
On Fri, 3 Oct 2014, David Malcolm wrote:

> The "main" function for the driver in gcc.c has grown from ~200 lines
> in its original form (way back in r262) to ~1000 lines today, with a
> dozen locals (if we include the params).
> 
> The following patch splits it up into 15 smaller functions, moving the
> various locals into the places where they're needed, so we can easily
> see e.g where argc/argv get read vs written.
> 
> The functions are private methods of a new "driver" class to give an
> extra level of encapsualation beyond just being static in gcc.c, and so
> that we can hide some state as member data inside the driver instance.
> 
> Turning them into named functions/methods also makes it easier to talk
> about the different phases of "main", and put breakpoints on them.
> 
> Bootstrapped®rtested on x86_64-unknown-linux-gnu (Fedora 20).
> 
> OK for trunk?

OK, minus the if (0) code:

> +  if (0)
> +{
> +  int i;
> +  for (i = 0; i < argc; i++)
> + printf ("argc[%i]: %s\n", i, argv[i]);
> +}

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


Re: [PATCH] Fix dupplicate declaration of ggc_realloc in gencondmd PR63429

2014-10-03 Thread Jeff Law

On 10/02/14 19:53, tsaund...@mozilla.com wrote:

From: Trevor Saunders 

Hi,

If vec.h is included before ggc.h it forward declares ggc_realloc with
defaulted arguments.  This means ggc.h can not be included later because
it would lead to a second declaration of ggc_realloc with defaulted
arguments.  In generator programs vec.h can not include ggc.h because it
may not exist yet.  So generator programs must make sure they include
ggc.h before anything that includes vec.h.

bootstrapped + regtested x86_64-unknown-linux-gnu, and bootstrapped with
--enable-gather-detailed-mem-stats, ok?

Trev

gcc/ChangeLog:

2014-10-02  Trevor Saunders  

* genconditions.c: Directly include ggc.h before rtl.h.

OK.
jeff



Re: [PATCH, i386, Pointer Bounds Checker 18/x] Expand instrumented builtin function calls

2014-10-03 Thread Jeff Law

On 10/03/14 02:47, Ilya Enkovich wrote:

Since we still don't have a final decision about how instrumented builtin 
functions would look like, I replace this patch with a new one which assumes we 
don't instrument them for now.  It only has an additional init for va_start and 
also makes sure there is no instrumented builtin calls.  All instrumented 
builtins related codes will go into a separate series.

Thanks,
Ilya
--
2014-10-03  Ilya Enkovich  

* builtins.c: Include tree-chkp.h and rtl-chkp.h.
(std_expand_builtin_va_start): Init bounds for va_list.
(expand_builtin): Do not allow instrumented calls.
OK.  Obviously we'll want to return to the builtins at some point in the 
relatively new future ;-)


jeff



libgo patch committed: Fix reflection of variadic methods

2014-10-03 Thread Ian Lance Taylor
This patch from Michael Hudson-Doyle fixes PR 61877 which is about using
reflection to get a variadic method value.  Bootstrapped and ran Go
testsuite on x86_64-unknown-linux-gnu.  Committed to mainline.

Ian

diff -r 9a2ca32c libgo/go/reflect/all_test.go
--- a/libgo/go/reflect/all_test.go	Fri Oct 03 08:13:20 2014 -0700
+++ b/libgo/go/reflect/all_test.go	Fri Oct 03 08:50:04 2014 -0700
@@ -1543,7 +1543,17 @@
 	fv := MakeFunc(TypeOf(fn), func(in []Value) []Value { return in[1:2] })
 	ValueOf(&fn).Elem().Set(fv)
 
-	r := fv.Call([]Value{ValueOf(1), ValueOf(2), ValueOf(3)})[0].Interface().([]int)
+	r := fn(1, 2, 3)
+	if r[0] != 2 || r[1] != 3 {
+		t.Errorf("Call returned [%v, %v]; want 2, 3", r[0], r[1])
+	}
+
+	r = fn(1, []int{2, 3}...)
+	if r[0] != 2 || r[1] != 3 {
+		t.Errorf("Call returned [%v, %v]; want 2, 3", r[0], r[1])
+	}
+
+	r = fv.Call([]Value{ValueOf(1), ValueOf(2), ValueOf(3)})[0].Interface().([]int)
 	if r[0] != 2 || r[1] != 3 {
 		t.Errorf("Call returned [%v, %v]; want 2, 3", r[0], r[1])
 	}
@@ -1552,6 +1562,17 @@
 	if r[0] != 2 || r[1] != 3 {
 		t.Errorf("Call returned [%v, %v]; want 2, 3", r[0], r[1])
 	}
+
+	f := fv.Interface().(func(int, ...int) []int)
+
+	r = f(1, 2, 3)
+	if r[0] != 2 || r[1] != 3 {
+		t.Errorf("Call returned [%v, %v]; want 2, 3", r[0], r[1])
+	}
+	r = f(1, []int{2, 3}...)
+	if r[0] != 2 || r[1] != 3 {
+		t.Errorf("Call returned [%v, %v]; want 2, 3", r[0], r[1])
+	}
 }
 
 type Point struct {
@@ -1569,6 +1590,24 @@
 	return p.x*p.x*scale + p.y*p.y*scale
 }
 
+// This will be index 2.
+func (p Point) GCMethod(k int) int {
+	runtime.GC()
+	return k + p.x
+}
+
+// This will be index 3.
+func (p Point) TotalDist(points ...Point) int {
+	tot := 0
+	for _, q := range points {
+		dx := q.x - p.x
+		dy := q.y - p.y
+		tot += dx*dx + dy*dy // Should call Sqrt, but it's just a test.
+
+	}
+	return tot
+}
+
 func TestMethod(t *testing.T) {
 	// Non-curried method of type.
 	p := Point{3, 4}
@@ -1751,6 +1790,37 @@
 	}
 }
 
+func TestVariadicMethodValue(t *testing.T) {
+	p := Point{3, 4}
+	points := []Point{{20, 21}, {22, 23}, {24, 25}}
+	want := int64(p.TotalDist(points[0], points[1], points[2]))
+
+	// Curried method of value.
+	tfunc := TypeOf((func(...Point) int)(nil))
+	v := ValueOf(p).Method(3)
+	if tt := v.Type(); tt != tfunc {
+		t.Errorf("Variadic Method Type is %s; want %s", tt, tfunc)
+	}
+	i := ValueOf(v.Interface()).Call([]Value{ValueOf(points[0]), ValueOf(points[1]), ValueOf(points[2])})[0].Int()
+	if i != want {
+		t.Errorf("Variadic Method returned %d; want %d", i, want)
+	}
+	i = ValueOf(v.Interface()).CallSlice([]Value{ValueOf(points)})[0].Int()
+	if i != want {
+		t.Errorf("Variadic Method CallSlice returned %d; want %d", i, want)
+	}
+
+	f := v.Interface().(func(...Point) int)
+	i = int64(f(points[0], points[1], points[2]))
+	if i != want {
+		t.Errorf("Variadic Method Interface returned %d; want %d", i, want)
+	}
+	i = int64(f(points...))
+	if i != want {
+		t.Errorf("Variadic Method Interface Slice returned %d; want %d", i, want)
+	}
+}
+
 // Reflect version of $GOROOT/test/method5.go
 
 // Concrete types implementing M method.
@@ -3718,11 +3788,6 @@
 	f.Call([]Value{})
 }
 
-func (p Point) GCMethod(k int) int {
-	runtime.GC()
-	return k + p.x
-}
-
 func TestReflectMethodTraceback(t *testing.T) {
 	p := Point{3, 4}
 	m := ValueOf(p).MethodByName("GCMethod")
diff -r 9a2ca32c libgo/go/reflect/makefunc.go
--- a/libgo/go/reflect/makefunc.go	Fri Oct 03 08:13:20 2014 -0700
+++ b/libgo/go/reflect/makefunc.go	Fri Oct 03 08:50:04 2014 -0700
@@ -117,29 +117,21 @@
 	ftyp := (*funcType)(unsafe.Pointer(t))
 	method := int(v.flag) >> flagMethodShift
 
-	var code uintptr
-	var ffi *ffiData
+	fv := &makeFuncImpl{
+		typ:ftyp,
+		method: method,
+		rcvr:   rcvr,
+	}
+
 	switch runtime.GOARCH {
 	case "amd64", "386":
 		// Indirect Go func value (dummy) to obtain actual
 		// code address. (A Go func value is a pointer to a C
 		// function pointer. http://golang.org/s/go11func.)
 		dummy := makeFuncStub
-		code = **(**uintptr)(unsafe.Pointer(&dummy))
+		fv.code = **(**uintptr)(unsafe.Pointer(&dummy))
 	default:
-		code, ffi = makeFuncFFI(ftyp,
-			func(in []Value) []Value {
-m := rcvr.Method(method)
-return m.Call(in)
-			})
-	}
-
-	fv := &makeFuncImpl{
-		code:   code,
-		typ:ftyp,
-		method: method,
-		rcvr:   rcvr,
-		ffi:ffi,
+		fv.code, fv.ffi = makeFuncFFI(ftyp, fv.call)
 	}
 
 	return Value{ft, unsafe.Pointer(&fv), v.flag&flagRO | flag(Func)

Re: [PATCH, Pointer Bounds Checker 39/x] Avoid instrumented __builtin_unreachable calls

2014-10-03 Thread Jeff Law

On 10/03/14 03:01, Ilya Enkovich wrote:

Hi,

This patch avoids generation of __builtin_unreachable calls marked as 
instrumented.  It follows paradigma of no instrumented builtin calls (and 
passes corresponding assert in expand_builtin from patch #18).

Thanks,
Ilya
--
2014-10-01  Ilya Enkovich  

* cgraphunit.c (walk_polymorphic_call_targets): Do not mark
generated call to __builtin_unreachable as with_bounds.
* ipa.c (walk_polymorphic_call_targets): Likewise.
OK.  However, if we find many more generated calls to builtins that need 
to be marked this way, then we'll probably want to put the logic into 
the expander code rather than hacking up each instance individually.


jeff



Re: [PATCH] remove score-* support

2014-10-03 Thread Jeff Law

On 10/03/14 08:50, tsaund...@mozilla.com wrote:

From: Trevor Saunders 

Hi,

It was obsoleted back in 2011, so we're good to remove it.

bootstrapped + regtested x86_64-unknown-linux-gnu, and checked configure 
doesn't recognize score-elf. Ok?

Trev

libgcc/ChangeLog:

2014-09-10  Trevor Saunders  

* config.host: Remove support for score-*.

contrib/ChangeLog:

2014-09-10  Trevor Saunders  

* compare-all-tests: Don't test score-*.
* config-list.mk: Likewise.

gcc/ChangeLog:

2014-09-10  Trevor Saunders  

* common/config/score/score-common.c: Remove.
* config.gcc: Remove support for score-*.
* config/score/constraints.md: Remove.
* config/score/elf.h: Remove.
* config/score/predicates.md: Remove.
* config/score/score-conv.h: Remove.
* config/score/score-generic.md: Remove.
* config/score/score-modes.def: Remove.
* config/score/score-protos.h: Remove.
* config/score/score.c: Remove.
* config/score/score.h: Remove.
* config/score/score.md: Remove.
* config/score/score.opt: Remove.
* doc/md.texi: Don't document score-*.

OK.
Jeff



Re: [patch] Use abi_tag attribute on std::list

2014-10-03 Thread Marc Glisse

On Fri, 3 Oct 2014, Jonathan Wakely wrote:


Marc, this is the relative diff to go back to what I had earlier, with
the size in the _List_impl in case you want to aply it locally (the
dg-error tests are off-by-one with this patch)


Thanks. For PR 61347, to avoid offsetof, I will actually need to 
change:


- __detail::_List_node_base _M_node;
- size_t _M_size;
+ _List_node _M_node;

and store the size in _M_node._M_data. Since I will have to touch it 
anyway, don't feel forced to move it to _M_impl.


--
Marc Glisse


Re: [patch] Use abi_tag attribute on std::list

2014-10-03 Thread Jonathan Wakely

On 03/10/14 15:49 +0100, Jonathan Wakely wrote:

On 03/10/14 16:25 +0200, Marc Glisse wrote:
Do you mind if I move (in a future patch once yours is committed) 
_M_size into _M_impl::_M_node as suggested in PR 61347?


Gah, that's where I had it until earlier this week, and I looked at it
and wondered why it was in the _List_impl class (because you only need
one member in there to benefit from the empty base-class
optimisation).

I will move it back there, since I already have that code on another
branch, so there's no point making you change the code to match
something I've already got!


Marc, this is the relative diff to go back to what I had earlier, with
the size in the _List_impl in case you want to aply it locally (the
dg-error tests are off-by-one with this patch)

diff --git a/libstdc++-v3/include/bits/stl_list.h 
b/libstdc++-v3/include/bits/stl_list.h
index 3a56daf..4dbdaf0 100644
--- a/libstdc++-v3/include/bits/stl_list.h
+++ b/libstdc++-v3/include/bits/stl_list.h
@@ -333,6 +333,17 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
   : public _Node_alloc_type
   {
__detail::_List_node_base _M_node;
+#if _GLIBCXX_USE_CXX11_ABI
+   size_t_M_size;
+
+   // return the stored size
+   size_t _M_node_count() const { return _M_size; }
+#else
+   // count the number of nodes
+   size_t _M_node_count() const
+   { return _S_distance(_M_node._M_next, std::__addressof(_M_node)); }
+#endif
+
_List_impl()
: _Node_alloc_type(), _M_node()
{ }
@@ -350,24 +361,27 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
 
   _List_impl _M_impl;
 
-#if _GLIBCXX_USE_CXX11_ABI
-  size_t_M_size;
+  _List_node<_Tp>*
+  _M_get_node()
+  { return _M_impl._Node_alloc_type::allocate(1); }
+
+  void
+  _M_put_node(_List_node<_Tp>* __p) _GLIBCXX_NOEXCEPT
+  { _M_impl._Node_alloc_type::deallocate(__p, 1); }
 
-  size_t _M_get_size() const { return _M_size; }
+#if _GLIBCXX_USE_CXX11_ABI
+  size_t _M_get_size() const { return _M_impl._M_size; }
 
-  void _M_set_size(size_t __n) { _M_size = __n; }
+  void _M_set_size(size_t __n) { _M_impl._M_size = __n; }
 
-  void _M_inc_size(size_t __n) { _M_size += __n; }
+  void _M_inc_size(size_t __n) { _M_impl._M_size += __n; }
 
-  void _M_dec_size(size_t __n) { _M_size -= __n; }
+  void _M_dec_size(size_t __n) { _M_impl._M_size -= __n; }
 
   size_t
   _M_distance(const __detail::_List_node_base* __first,
  const __detail::_List_node_base* __last) const
   { return _S_distance(__first, __last); }
-
-  // return the stored size
-  size_t _M_node_count() const { return _M_size; }
 #else
   // dummy implementations used when the size is not stored
   size_t _M_get_size() const { return 0; }
@@ -375,23 +389,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
   void _M_inc_size(size_t) { }
   void _M_dec_size(size_t) { }
   size_t _M_distance(const void*, const void*) const { return 0; }
-
-  // count the number of nodes
-  size_t _M_node_count() const
-  {
-   return _S_distance(_M_impl._M_node._M_next,
-  std::__addressof(_M_impl._M_node));
-  }
 #endif
 
-  _List_node<_Tp>*
-  _M_get_node()
-  { return _M_impl._Node_alloc_type::allocate(1); }
-
-  void
-  _M_put_node(_List_node<_Tp>* __p) _GLIBCXX_NOEXCEPT
-  { _M_impl._Node_alloc_type::deallocate(__p, 1); }
-
   public:
   typedef _Alloc allocator_type;
 
@@ -941,7 +940,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
   /**  Returns the number of elements in the %list.  */
   size_type
   size() const _GLIBCXX_NOEXCEPT
-  { return this->_M_node_count(); }
+  { return this->_M_impl._M_node_count(); }
 
   /**  Returns the size() of the largest possible %list.  */
   size_type


Go patch committed: Don't confuse fields and promoted methods

2014-10-03 Thread Ian Lance Taylor
This patch from Tim Shen fixes a bug in the Go frontend in which a
promoted method could be used even if there was a field of the same
name.  This fixes http://golang.org/issue/4365 .  Bootstrapped and ran
Go testsuite on x86_64-unknown-linux-gnu.  Committed to mainline.

Ian

diff -r c9d064a071c9 go/types.cc
--- a/go/types.cc	Fri Oct 03 08:11:52 2014 -0700
+++ b/go/types.cc	Fri Oct 03 08:12:08 2014 -0700
@@ -9387,9 +9387,14 @@
 Type::finalize_methods(Gogo* gogo, const Type* type, Location location,
 		   Methods** all_methods)
 {
-  *all_methods = NULL;
+  *all_methods = new Methods();
   std::vector seen;
-  Type::add_methods_for_type(type, NULL, 0, false, false, &seen, all_methods);
+  Type::add_methods_for_type(type, NULL, 0, false, false, &seen, *all_methods);
+  if ((*all_methods)->empty())
+{
+  delete *all_methods;
+  *all_methods = NULL;
+}
   Type::build_stub_methods(gogo, type, *all_methods, location);
 }
 
@@ -9408,7 +9413,7 @@
 			   bool is_embedded_pointer,
 			   bool needs_stub_method,
 			   std::vector* seen,
-			   Methods** methods)
+			   Methods* methods)
 {
   // Pointer types may not have methods.
   if (type->points_to() != NULL)
@@ -9457,15 +9462,12 @@
  unsigned int depth,
  bool is_embedded_pointer,
  bool needs_stub_method,
- Methods** methods)
+ Methods* methods)
 {
   const Bindings* local_methods = nt->local_methods();
   if (local_methods == NULL)
 return;
 
-  if (*methods == NULL)
-*methods = new Methods();
-
   for (Bindings::const_declarations_iterator p =
 	 local_methods->begin_declarations();
p != local_methods->end_declarations();
@@ -9476,7 +9478,7 @@
 			  || !Type::method_expects_pointer(no));
   Method* m = new Named_method(no, field_indexes, depth, is_value_method,
    (needs_stub_method || depth > 0));
-  if (!(*methods)->insert(no->name(), m))
+  if (!methods->insert(no->name(), m))
 	delete m;
 }
 }
@@ -9492,7 +9494,7 @@
 bool is_embedded_pointer,
 bool needs_stub_method,
 std::vector* seen,
-Methods** methods)
+Methods* methods)
 {
   // Look for anonymous fields in TYPE.  TYPE has fields if it is a
   // struct.
@@ -9530,13 +9532,35 @@
   sub_field_indexes->next = field_indexes;
   sub_field_indexes->field_index = i;
 
+  Methods tmp_methods;
   Type::add_methods_for_type(fnt, sub_field_indexes, depth + 1,
  (is_embedded_pointer || is_pointer),
  (needs_stub_method
   || is_pointer
   || i > 0),
  seen,
- methods);
+ &tmp_methods);
+  // Check if there are promoted methods that conflict with field names and
+  // don't add them to the method map.
+  for (Methods::const_iterator p = tmp_methods.begin();
+	   p != tmp_methods.end();
+	   ++p)
+	{
+	  bool found = false;
+	  for (Struct_field_list::const_iterator fp = fields->begin();
+	   fp != fields->end();
+	   ++fp)
+	{
+	  if (fp->field_name() == p->first)
+		{
+		  found = true;
+		  break;
+		}
+	}
+	  if (!found &&
+	  !methods->insert(p->first, p->second))
+	delete p->second;
+	}
 }
 }
 
@@ -9548,7 +9572,7 @@
 Type::add_interface_methods_for_type(const Type* type,
  const Method::Field_indexes* field_indexes,
  unsigned int depth,
- Methods** methods)
+ Methods* methods)
 {
   const Interface_type* it = type->interface_type();
   if (it == NULL)
@@ -9558,9 +9582,6 @@
   if (imethods == NULL)
 return;
 
-  if (*methods == NULL)
-*methods = new Methods();
-
   for (Typed_identifier_list::const_iterator pm = imethods->begin();
pm != imethods->end();
++pm)
@@ -9576,7 +9597,7 @@
   fntype = fntype->copy_with_receiver(const_cast(type));
   Method* m = new Interface_method(pm->name(), pm->location(), fntype,
    field_indexes, depth);
-  if (!(*methods)->insert(pm->name(), m))
+  if (!methods->insert(pm->name(), m))
 	delete m;
 }
 }
diff -r c9d064a071c9 go/types.h
--- a/go/types.h	Fri Oct 03 08:11:52 2014 -0700
+++ b/go/types.h	Fri Oct 03 08:12:08 2014 -0700
@@ -384,6 +384,10 @@
   find(const std::string& name) const
   { return this->methods_.find(name); }
 
+  bool
+  empty() const
+  { return this->methods_.empty(); }
+
  private:
   Method_map methods_;
 };
@@ -1228,24 +1232,24 @@
   add_methods_for_type(const Type* type, const Method::Field_indexes*,
 		   unsigned int depth, bool, bool,
 		   std::vector*,
-		   Methods**);
+		   Methods*);
 
   static void
   add_local_methods_for_type(const Named_type* type,
 			 const Method::Field_indexes*,
-			 unsigned int depth, bool, bool, Methods**);
+			 unsigned int depth, bool, bool, Methods*);
 
   static void
   add_embedded_methods_for_type(const Type* type,
 const Method::Field_indexes*,
 unsigned int depth, bool, bool,
 std::vector*,
-Methods**);
+Methods*);
 
   static void
   add_interface_methods_for_type(const 

[PATCH] gcc.c: Split up the driver's "main" into smaller functions

2014-10-03 Thread David Malcolm
The "main" function for the driver in gcc.c has grown from ~200 lines
in its original form (way back in r262) to ~1000 lines today, with a
dozen locals (if we include the params).

The following patch splits it up into 15 smaller functions, moving the
various locals into the places where they're needed, so we can easily
see e.g where argc/argv get read vs written.

The functions are private methods of a new "driver" class to give an
extra level of encapsualation beyond just being static in gcc.c, and so
that we can hide some state as member data inside the driver instance.

Turning them into named functions/methods also makes it easier to talk
about the different phases of "main", and put breakpoints on them.

Bootstrapped®rtested on x86_64-unknown-linux-gnu (Fedora 20).

OK for trunk?

gcc/ChangeLog:
* gcc.c (class driver): New class.
(main): Reimplement in terms of driver::main, moving most of the
locals to be locals within individual methods of class driver.
The remaining locals "explicit_link_files", "decoded_options" and
"decoded_options_count" are used by multiple driver:: methods, and
so become member data.  Doing so isolates the argc/argv reads and
writes.  Replace "goto out" with a special exit code from
new method driver::prepare_infiles.  Split out the old
implementation of main into the following...
(driver::main): New function, corresponding to the old "main"
implementation.
(driver::set_progname): New function, taken from the old
"main" implementation.
(driver::expand_at_files): Likewise.
(driver::decode_argv): Likewise.
(driver::global_initializations): Likewise.
(driver::build_multilib_strings): Likewise.
(driver::set_up_specs): Likewise.
(driver::putenv_COLLECT_GCC): Likewise.
(driver::maybe_putenv_COLLECT_LTO_WRAPPER): Likewise.
(driver::handle_unrecognized_options): Likewise.
(driver::maybe_print_and_exit): Likewise.
(driver::prepare_infiles): Likewise.
(driver::do_spec_on_infiles): Likewise.
(driver::maybe_run_linker): Likewise.
(driver::final_actions): Likewise.
(driver::get_exit_code): Likewise.
---
 gcc/gcc.c | 243 +-
 1 file changed, 208 insertions(+), 35 deletions(-)

diff --git a/gcc/gcc.c b/gcc/gcc.c
index 47c4e28..9139263 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -6724,49 +6724,139 @@ compare_files (char *cmpfile[])
   return ret;
 }
 
-extern int main (int, char **);
+/* The top-level "main" within the driver would be ~1000 lines long.
+   This class breaks it up into smaller functions and contains some
+   state shared by them.  */
 
-int
-main (int argc, char **argv)
+class driver
 {
-  size_t i;
-  int value;
-  int linker_was_run = 0;
-  int lang_n_infiles = 0;
-  int num_linker_inputs = 0;
+ public:
+  int main (int argc, char **argv);
+
+ private:
+  void set_progname (const char *argv0) const;
+  void expand_at_files (int *argc, char ***argv) const;
+  void decode_argv (int argc, const char **argv);
+  void global_initializations () const;
+  void build_multilib_strings () const;
+  void set_up_specs () const;
+  void putenv_COLLECT_GCC (const char *argv0) const;
+  void maybe_putenv_COLLECT_LTO_WRAPPER () const;
+  void handle_unrecognized_options () const;
+  int maybe_print_and_exit () const;
+  bool prepare_infiles ();
+  void do_spec_on_infiles () const;
+  void maybe_run_linker (const char *argv0) const;
+  void final_actions () const;
+  int get_exit_code () const;
+
+ private:
   char *explicit_link_files;
-  char *specs_file;
-  char *lto_wrapper_file;
-  const char *p;
-  struct user_specs *uptr;
-  char **old_argv = argv;
   struct cl_decoded_option *decoded_options;
   unsigned int decoded_options_count;
+};
+
+/* Implement the top-level "main" within the driver in terms of
+   driver::main.  */
+
+extern int main (int, char **);
 
-  p = argv[0] + strlen (argv[0]);
-  while (p != argv[0] && !IS_DIR_SEPARATOR (p[-1]))
+int
+main (int argc, char **argv)
+{
+  driver d;
+
+  if (0)
+{
+  int i;
+  for (i = 0; i < argc; i++)
+   printf ("argc[%i]: %s\n", i, argv[i]);
+}
+
+  return d.main (argc, argv);
+}
+
+/* driver::main is implemented as a series of driver:: method calls.  */
+
+int
+driver::main (int argc, char **argv)
+{
+  bool early_exit;
+
+  set_progname (argv[0]);
+  expand_at_files (&argc, &argv);
+  decode_argv (argc, const_cast  (argv));
+  global_initializations ();
+  build_multilib_strings ();
+  set_up_specs ();
+  putenv_COLLECT_GCC (argv[0]);
+  maybe_putenv_COLLECT_LTO_WRAPPER ();
+  handle_unrecognized_options ();
+
+  if (!maybe_print_and_exit ())
+return 0;
+
+  early_exit = prepare_infiles ();
+  if (early_exit)
+return get_exit_code ();
+
+  do_spec_on_infiles ();
+  maybe_run_linker (argv[0]);
+  final_actions ();
+  return get_exit_code

Re: [PATCH 2/2] PR debug/63240 Add DWARF representation for C++11 defaulted member function.

2014-10-03 Thread Jason Merrill

On 10/03/2014 10:35 AM, Mark Wielaard wrote:

Say you have a user defined copy constructor. The DWARF consumer will
see the declaration and can assume the class won't have a default
constructor (unless that one is explicitly declared too). But currently
the DWARF consumer cannot know whether that move constructor was really
a user defined. If it was declared with = default; then it will see the
move constructor and erroneously conclude that it was user defined and
so the class won't have a default constructor generated for it.


That's not erroneous, a declaration with =default still suppresses the 
default constructor.  "If there is no user-declared constructor for 
class X, a constructor having no parameters is implicitly declared as 
defaulted."


"user-declared" includes declarations that are defaulted in the class 
body.  "user-provided" is the category that does not include such 
declarations.


Jason



Re: [PATCH,i386] Fix adxintrin on mingw.

2014-10-03 Thread H.J. Lu
On Fri, Oct 3, 2014 at 6:46 AM, Ilya Tocar  wrote:
> On 02 Oct 07:41, H.J. Lu wrote:
>> On Thu, Oct 2, 2014 at 7:29 AM, Ilya Tocar  wrote:
>> > Hi,
>> >
>> > sizeof (long) == 4 on windows, so we should use long long as param type.
>> > Patch below does it.
>>
>> The same is true for x32.  Can you add a testcase to show it
>> fails on x32 without the fix?
>>
>
> This could only be done with runtime test.
> I've had troubles running sde (emulator) on x32 enabled system,
> but replacing long long with int in intrinsic signature will cause
> adx-addcarryx64-2.c to fail under sde on 64 bits. I believe it will
> also fail on sde+{win,x32} or real hardware, when it's available.
>

Can we scan the assembly output for the wrong instruction?

-- 
H.J.


Re: [patch] Use abi_tag attribute on std::list

2014-10-03 Thread Jonathan Wakely

On 03/10/14 16:25 +0200, Marc Glisse wrote:

On Fri, 3 Oct 2014, Jonathan Wakely wrote:


This is the patch I intend to commit to make std::list::size() O(1) as
required by C++11.

This is an ABI change, so std::list will get tagged with
abi_tag("cxx11") so that it mangles differently.


Assuming a future where we have both _GLIBCXX_ABI_TAG_CXX11 and 
_GLIBCXX_ABI_TAG_CXX17, I don't really see how 
_GLIBCXX_DEFAULT_ABI_TAG
is supposed to work. We don't want to define _GLIBCXX_DEFAULT_ABI_TAG 
to _GLIBCXX_ABI_TAG_CXX17 and suddenly have std::list change mangling. 


True.

Should it be called _GLIBCXX_DEFAULT_ABI_TAG_CXX11, meaning 
_GLIBCXX_ABI_TAG_CXX11_IF_ENABLED_AND_NOTHING_OTHERWISE?


I suppose so ... or _GLIBCXX_MAYBE_ABI_TAG_CXX11 ?

Defining a dummy _M_distance in the old abi case is a bit strange (we 
could protect the single use with #if _GLIBCXX_USE_CXX11_ABI), but why 
not...


Yeah, I was trying to minimise the preprocessor conditionals, but
maybe that's one step too far.

Do you mind if I move (in a future patch once yours is committed) 
_M_size into _M_impl::_M_node as suggested in PR 61347?


Gah, that's where I had it until earlier this week, and I looked at it
and wondered why it was in the _List_impl class (because you only need
one member in there to benefit from the empty base-class
optimisation).

I will move it back there, since I already have that code on another
branch, so there's no point making you change the code to match
something I've already got!

Thanks for your useful comments (as always).


Re: [PATCH]Add aarch64 to list of targets that support gold

2014-10-03 Thread Diego Novillo
On Thu, Sep 18, 2014 at 7:05 PM, Jing Yu  wrote:

> 2014-09-18  Jing Yu  
>   * configure.ac: Add aarch64 to list of targets that support gold.
>   * configure: Regenerate.

OK.

Thanks. Diego.


[RFC PATCH] Enable V32HI/V64QI const permutations

2014-10-03 Thread Jakub Jelinek
Hi!

Just to stress the new testcases some more, I've enabled the
vec_perm_const{32hi,64qi} patterns.
Got several ICEs in expand_vec_perm_broadcast_1,
on the final gcc_unreachable () in the function.  That function
is only called if it couldn't be broadcasted in a single insn,
which I believe for TARGET_AVX512BW must be always possible.
Shall I look at this, or do you plan to address this in the near future?

2014-10-03  Jakub Jelinek  

* config/i386/sse.md (VEC_PERM_CONST): Add V32HI and V64QI
for TARGET_AVX512BW.

--- gcc/config/i386/sse.md.jj   2014-09-26 10:33:18.0 +0200
+++ gcc/config/i386/sse.md  2014-10-03 15:03:44.170446452 +0200
@@ -10386,7 +10386,8 @@ (define_mode_iterator VEC_PERM_CONST
(V8SI "TARGET_AVX") (V4DI "TARGET_AVX")
(V32QI "TARGET_AVX2") (V16HI "TARGET_AVX2")
(V16SI "TARGET_AVX512F") (V8DI "TARGET_AVX512F")
-   (V16SF "TARGET_AVX512F") (V8DF "TARGET_AVX512F")])
+   (V16SF "TARGET_AVX512F") (V8DF "TARGET_AVX512F")
+   (V32HI "TARGET_AVX512BW") (V64QI "TARGET_AVX512BW")])
 
 (define_expand "vec_perm_const"
   [(match_operand:VEC_PERM_CONST 0 "register_operand")

Jakub


Re: [PATCH 2/2] PR debug/63240 Add DWARF representation for C++11 defaulted member function.

2014-10-03 Thread Mark Wielaard
On Fri, 2014-10-03 at 10:17 -0400, Jason Merrill wrote:
> On 10/03/2014 09:12 AM, Mark Wielaard wrote:
> > A debugger not knowing whether a special member function was explicitly
> > defaulted, implicitly declared or explicitly defined seems less confusion
> > than not knowing whether it was deleted. But there are some subtle cases
> > where knowing whether a constructor was user defined or explicitly
> > defaulted do matter for whether the default constructor might have been
> > implicitly generated.
> 
> Can you elaborate?

Say you have a user defined copy constructor. The DWARF consumer will
see the declaration and can assume the class won't have a default
constructor (unless that one is explicitly declared too). But currently
the DWARF consumer cannot know whether that move constructor was really
a user defined. If it was declared with = default; then it will see the
move constructor and erroneously conclude that it was user defined and
so the class won't have a default constructor generated for it. Having
the defaulted attribute on the declaration makes clear that the special
function member wasn't in fact user defined. This is because gcc doesn't
output implicit special member function declarations.

> > So like the deleted case this patch introduces
> > a new attribute DW_AT_GNU_defaulted that gets attached to the function
> > declaration. Note that since this is for declarations we explicitly
> > test for DECL_DEFAULTED_IN_CLASS_P and ignore any implementation
> > definitions that use = default; outside the class body.
> 
> Hmm, I'm dubious about this choice.  How do you expect a consumer to use 
> this information?

In two ways. First simply to let the debugger more accurately show the
declaration of the class. Just like one uses = default; in their source
code to be explicit about the fact that the special member function was
really desired. It would be nice if the debugger could provide the same
source information.

Secondly, as described above. There is a difference between = default;
on the declaration and on the implementation definition. If the out of
class definition of a special member function has an = default; then the
in class declaration cannot have it. That means that a = default; on the
out of class definition actually means that the function is user defined
(it just happens to be defined by the default implementation). While a =
default; on the in class declaration means it explicitly isn't user
defined. The consumer can use this information to deduce which implicit
member functions are available.

Cheers,

Mark


Re: [PATCH] Small pre-AVX512F optimization

2014-10-03 Thread Uros Bizjak
On Fri, Oct 3, 2014 at 4:32 PM, Jakub Jelinek  wrote:
> Hi!
>
> I've noticed that expand_vec_perm_1 completely uselessly builds GC garbage
> (CONST_VECTOR at least) when AVX512F isn't enabled at all.
>
> Ok to just call it for AVX512F?

OK.

> Even better would be to check the modes first too depending on target
> (AVX512F will only handle V{8D,16S}{I,F}mode, AVX512BW would handle
> also V32HImode (not yet implemented?), AVX512VL could handle
> V{2D,4D,4S,8S}{I,F}mode (not yet implemented?, though is there any
> const permutation not handled yet earlier?), and AVX512VL+AVX512BW
> could handle V{8,16}HImode (not yet implemented?) before creating a
> CONST_VECTOR.

AVX512BW and AVX512VL are currently moving targets, I propose to look
at this issue once all changes are committed to the repository.

> 2014-10-03  Jakub Jelinek  
>
> * config/i386/i386.c (ix86_expand_vec_perm_vpermi2): Fix up 
> formatting.
> (ix86_expand_vec_perm): Only call ix86_expand_vec_perm_vpermi2 if
> TARGET_AVX512F.
> (expand_vec_perm_1): Likewise.

OK.

Thanks,
Uros.


Re: [gomp4] OpenACC wait directive

2014-10-03 Thread Cesar Philippidis
On 09/24/2014 12:18 AM, Ilmir Usmanov wrote:
> Hi Cesar!
> 
> Thank you for the patch!
> 
> On 24.09.2014 02:29, Cesar Philippidis wrote:
>> This patch adds support for the async clause in the wait directive in
>> fortran. It should be pretty straight forward. The fortran FE already
>> supports the wait directive, but the async clause was introduced to the
>> wait directive in OpenACC 2.0 and that was missing in gomp-4_0-branch.
> Yes, I've mostly focused on spec. ver. 1.0.
> 
>> Is this OK for gomp-4_0-branch?
> No, it isn't. According to the spec and this presentation:
> http://www.pgroup.com/lit/presentations/cea-3.pdf (See slide 1-35)
> it is possible to write construction like:
> !$acc wait(1) async(2)
> However, your patch doesn't support this. Also, don't forget to check
> whether a queue waits itself (for example, wait(1) async(1)).
> In addition, it breaks current support of the directive (for example,
> wait(1)).

Sorry for the delay. I encountered some problems with the runtime in our
internal branch, and that slowed things down a bit.

Anyway, you are correct, I broke the optional argument to wait in the
previous patch. This new patch addresses that and it also make the wait
construct conform with OpenACC 2.0. Specifically,

  !$acc wait (1, 2) async (3)

should behave as ex[ected.

If you look at gfc_trans_oacc_wait_directive, you'll note that a call to
GOACC_wait is emitted for the wait directive. Since I had to add a
runtime library stub for that builtin function, I decided to go ahead an
include the c front end bits.

Is this patch OK for gomp-4_0-branch? Julian is working on working on a
more complete implementation of the runtime. The runtime stub that I
included is only temporary.

Cesar

2014-10-02  Cesar Philippidis  
	James Norris  
	Thomas Schwinge  

	gcc/
	* builtin-types.def (BT_FN_VOID_INT_PTR_INT): Define.
	* oacc-builtins.def (DEF_GOACC_BUILTIN): Define.
	* omp-low.c (scan_sharing_clauses): Update handling of
	OMP_CLAUSE_ASYNC and OMP_CLAUSE_WAIT.
	(expand_oacc_offload): Likewise.
	(expand_omp_target): Likewise.

	gcc/c-family/
	* c-common.h (c_finish_oacc_wait): Declare.
	* c-omp.c (c_finish_oacc_wait): New function.
	* c-pragma.c (oacc_pragmas): Add an entry for "wait".
	* c-pragma.h (enum pragma_kind): Add PRAGMA_OACC_WAIT.
	(enum pragma_omp_clause): Add PRAGMA_OMP_CLAUSE_ASYNC and
	PRAGMA_OMP_CLAUSE_WAIT.

	gcc/c/
	* c-parser.c (c_parser_omp_clause_name): Handle async and wait.
	(c_parser_oacc_integer_list): New function.
	(c_parser_oacc_int_list_parens): New function.
	(c_parser_oacc_clause_async): New function.
	(c_parser_oacc_clause_wait): New function.
	(c_parser_oacc_all_clauses): Handle PRAGMA_OMP_CLAUSE_ASYNC and
	PRAGMA_OMP_CLAUSE_WAIT.
	(OACC_KERNELS_CLAUSE_MASK): Add async and wait clauses.
	(OACC_PARALLEL_CLAUSE_MASK): Likewise.
	(OACC_UPDATE_CLAUSE_MASK): Likewise.
	(OACC_WAIT_CLAUSE_MASK): New define.
	(c_parser_oacc_wait): New function.
	(c_parser_omp_construct): Handle PRAGMA_OACC_WAIT.
	* c-typeck.c (c_finish_omp_clauses): Handle OMP_CLAUSE_ASYNC and
	OMP_CLAUSE_WAIT.

	gcc/fortran/
	* gfortran.h (struct gfc_omp_clauses): Remove non_clause_wait_expr.
	* dump-parse-tree.c (show_omp_clauses): Likewise.
	* openmp.c (gfc_free_omp_clauses): Likewise.
	(gfc_match_omp_clauses): Update handling of async.
	(OACC_WAIT_CLAUSE_MASK): New define.
	(gfc_match_oacc_wait): Make the wait directive comply with OpenACC 2.0.
	(resolve_omp_clauses): Use resolve_oacc_scalar_in_expr inspect
	arguments to the wait clause.
	(resolve_oacc_wait): Remove.
	(gfc_resolve_oacc_directive): Handle EXEC_OACC_WAIT with
	resolve_omp_clauses.
	* trans-openmp.c (gfc_trans_omp_clauses): Update handling of OpenACC
	wait arguments.
	(gfc_trans_oacc_wait_directive): New function.
	(gfc_trans_oacc_directive): Use it.
	* types.def (BT_FN_VOID_INT_PTR_INT): Define.

	gcc/testsuite/
	* c-c++-common/goacc/asyncwait-1.c: New test.
	* gfortran.dg/goacc/asyncwait-1.f95: New test.
	* gfortran.dg/goacc/asyncwait-2.f95: New test.
	* gfortran.dg/goacc/asyncwait-3.f95: New test.
	* gfortran.dg/goacc/asyncwait-4.f95: New test.

	libgomp/
	* libgomp.map (GOACC_2.0): Add GOACC_wait.
	* libgomp_g.h (GOACC_wait): Declare.
	* oacc-parallel.c (GOACC_wait): Define.


diff --git a/gcc/builtin-types.def b/gcc/builtin-types.def
index 7c294af..094b3a8 100644
--- a/gcc/builtin-types.def
+++ b/gcc/builtin-types.def
@@ -358,6 +358,8 @@ DEF_FUNCTION_TYPE_3 (BT_FN_VOID_PTR_INT_SIZE,
 		 BT_VOID, BT_PTR, BT_INT, BT_SIZE)
 DEF_FUNCTION_TYPE_3 (BT_FN_VOID_PTR_INT_INT,
 		 BT_VOID, BT_PTR, BT_INT, BT_INT)
+DEF_FUNCTION_TYPE_3 (BT_FN_VOID_INT_PTR_INT,
+		 BT_VOID, BT_INT, BT_PTR, BT_INT)
 DEF_FUNCTION_TYPE_3 (BT_FN_VOID_CONST_PTR_PTR_SIZE,
 		 BT_VOID, BT_CONST_PTR, BT_PTR, BT_SIZE)
 DEF_FUNCTION_TYPE_3 (BT_FN_INT_STRING_CONST_STRING_VALIST_ARG,
diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h
index 5ec79a0..a03b3ab 100644
--- a/gcc/c-family/c-common.h
+++ b/gcc/c-family/c-common.h
@@ -1211,6 +12

[PATCH] Small pre-AVX512F optimization

2014-10-03 Thread Jakub Jelinek
Hi!

I've noticed that expand_vec_perm_1 completely uselessly builds GC garbage
(CONST_VECTOR at least) when AVX512F isn't enabled at all.

Ok to just call it for AVX512F?

Even better would be to check the modes first too depending on target
(AVX512F will only handle V{8D,16S}{I,F}mode, AVX512BW would handle
also V32HImode (not yet implemented?), AVX512VL could handle
V{2D,4D,4S,8S}{I,F}mode (not yet implemented?, though is there any
const permutation not handled yet earlier?), and AVX512VL+AVX512BW
could handle V{8,16}HImode (not yet implemented?) before creating a
CONST_VECTOR.

2014-10-03  Jakub Jelinek  

* config/i386/i386.c (ix86_expand_vec_perm_vpermi2): Fix up formatting.
(ix86_expand_vec_perm): Only call ix86_expand_vec_perm_vpermi2 if
TARGET_AVX512F.
(expand_vec_perm_1): Likewise.

--- gcc/config/i386/i386.c.jj   2014-10-03 12:39:24.0 +0200
+++ gcc/config/i386/i386.c  2014-10-03 15:21:11.697445333 +0200
@@ -21373,21 +21373,23 @@ ix86_expand_vec_perm_vpermi2 (rtx target
 {
 case V16SImode:
   emit_insn (gen_avx512f_vpermi2varv16si3 (target, op0,
- force_reg (V16SImode, mask),
- op1));
+  force_reg (V16SImode, mask),
+  op1));
   return true;
 case V16SFmode:
   emit_insn (gen_avx512f_vpermi2varv16sf3 (target, op0,
- force_reg (V16SImode, mask),
- op1));
+  force_reg (V16SImode, mask),
+  op1));
   return true;
 case V8DImode:
   emit_insn (gen_avx512f_vpermi2varv8di3 (target, op0,
-force_reg (V8DImode, mask), op1));
+ force_reg (V8DImode, mask),
+ op1));
   return true;
 case V8DFmode:
   emit_insn (gen_avx512f_vpermi2varv8df3 (target, op0,
-force_reg (V8DImode, mask), op1));
+ force_reg (V8DImode, mask),
+ op1));
   return true;
 default:
   return false;
@@ -21414,7 +21416,8 @@ ix86_expand_vec_perm (rtx operands[])
   e = GET_MODE_UNIT_SIZE (mode);
   gcc_assert (w <= 64);
 
-  if (ix86_expand_vec_perm_vpermi2 (target, op0, mask, op1))
+  if (TARGET_AVX512F
+  && ix86_expand_vec_perm_vpermi2 (target, op0, mask, op1))
 return;
 
   if (TARGET_AVX2)
@@ -43231,17 +43234,20 @@ expand_vec_perm_1 (struct expand_vec_per
 return true;
 
   /* Try the AVX512F vpermi2 instructions.  */
-  rtx vec[64];
-  enum machine_mode mode = d->vmode;
-  if (mode == V8DFmode)
-mode = V8DImode;
-  else if (mode == V16SFmode)
-mode = V16SImode;
-  for (i = 0; i < nelt; ++i)
-vec[i] = GEN_INT (d->perm[i]);
-  rtx mask = gen_rtx_CONST_VECTOR (mode, gen_rtvec_v (nelt, vec));
-  if (ix86_expand_vec_perm_vpermi2 (d->target, d->op0, mask, d->op1))
-return true;
+  if (TARGET_AVX512F)
+{
+  rtx vec[64];
+  enum machine_mode mode = d->vmode;
+  if (mode == V8DFmode)
+   mode = V8DImode;
+  else if (mode == V16SFmode)
+   mode = V16SImode;
+  for (i = 0; i < nelt; ++i)
+   vec[i] = GEN_INT (d->perm[i]);
+  rtx mask = gen_rtx_CONST_VECTOR (mode, gen_rtvec_v (nelt, vec));
+  if (ix86_expand_vec_perm_vpermi2 (d->target, d->op0, mask, d->op1))
+   return true;
+}
 
   return false;
 }

Jakub


Re: [gomp4] Offload option handling

2014-10-03 Thread Andrey Turetskiy
On Wed, Sep 17, 2014 at 5:11 PM, Andrey Turetskiy
 wrote:
> On Wed, Sep 17, 2014 at 3:19 PM, Bernd Schmidt  
> wrote:
>> I have no objections to supporting a -ftarget-options switch. I had posted a
>> patch a while ago that looked somewhat similar, but also contained an
>> automatic translation step from things like -march=x86_64 to a generic
>> -foffload-abi=lp64. I still think such a mechanism is desirable.
>
> I'm going to apply your patch on '-ftarget-options' stuff and check if
> it works together.

I've applied your option patch on our offload branch (w/o
'-ftarget-options' switch yet) and it seems to be working fine.
However the patch looks a bit unfinished:

@@ -440,7 +554,11 @@ access_check (const char *name, int mode

 static char*
 prepare_target_image (const char *target, const char *compiler_path,
-  unsigned in_argc, char *in_argv[])
+  unsigned in_argc, char *in_argv[],
+  struct cl_decoded_option *compiler_opts,
+  unsigned int compiler_opt_count,
+  struct cl_decoded_option * /*linker_opts */,
+  unsigned int /*linker_opt_count*/)
 {
   const char **argv;
   struct obstack argv_obstack;
@@ -469,8 +587,6 @@ prepare_target_image (const char *target
   /* Generate temp file name.  */
   filename = make_temp_file (".target.o");

-  /* --  */
-  /* Run gcc for target.  */
   obstack_init (&argv_obstack);
   obstack_ptr_grow (&argv_obstack, compiler);
   obstack_ptr_grow (&argv_obstack, "-o");
@@ -479,6 +595,8 @@ prepare_target_image (const char *target
   for (i = 1; i < in_argc; ++i)
 if (strncmp (in_argv[i], "-fresolution=", sizeof ("-fresolution=") - 1))
   obstack_ptr_grow (&argv_obstack, in_argv[i]);
+
+  append_compiler_options (&argv_obstack, compiler_opts, compiler_opt_count);
   obstack_ptr_grow (&argv_obstack, NULL);

   argv = XOBFINISH (&argv_obstack, const char **);

   argv = XOBFINISH (&argv_obstack, char **);

What do you suppose to do with 'linker_opts'?
Do you want to call 'append_linker_options (&argv_obstack,
linker_opts, linker_opt_count, false)'? That would explain why you
have 'include_target_options' argument in the function.

-- 
Best regards,
Andrey Turetskiy


Re: [patch] libstdc++/63449 remove outdated documentation

2014-10-03 Thread Jonathan Wakely

On 03/10/14 14:36 +0100, Jonathan Wakely wrote:

I think after 12 years it's safe to say that alternative version ain't
gonna happen.

Committed to trunk.


Here's the patch for the 4.8 and 4.9 branches, which also updates the
notes on std::list::size() being O(N) (in the words of Whitney
Houston, it's not right but it's okay).

commit d7a5af3dfd44681e8073209a87d8376496dd647f
Author: Jonathan Wakely 
Date:   Fri Oct 3 15:21:09 2014 +0100

	PR libstdc++/63449
	* doc/xml/manual/containers.xml: Remove outdated section. Update
	std::list notes.
	* doc/html/*: Regenerate.

diff --git a/libstdc++-v3/doc/xml/manual/containers.xml b/libstdc++-v3/doc/xml/manual/containers.xml
index 9fea0f7..ba8b087 100644
--- a/libstdc++-v3/doc/xml/manual/containers.xml
+++ b/libstdc++-v3/doc/xml/manual/containers.xml
@@ -25,8 +25,9 @@
   list::size() is O(n)
 

- Yes it is, and that's okay.  This is a decision that we preserved
- when we imported SGI's STL implementation.  The following is
+ Yes it is, and that was okay until the 2011 edition of the C++ standard.
+ In future GCC will change it to O(1) but O(N) was a decision that we
+ preserved when we imported SGI's STL implementation.  The following is
  quoted from http://www.w3.org/1999/xlink"; xlink:href="http://www.sgi.com/tech/stl/FAQ.html";>their FAQ:


@@ -72,26 +73,6 @@
   
 
 
-vector
-
-  
-  
-  
-  Space Overhead Management
-
-   
- In http://www.w3.org/1999/xlink"; xlink:href="http://gcc.gnu.org/ml/libstdc++/2002-04/msg00105.html";>this
- message to the list, Daniel Kostecky announced work on an
- alternate form of std::vector that would support
- hints on the number of elements to be over-allocated.  The design
- was also described, along with possible implementation choices.
-   
-   
- The first two alpha releases were announced http://www.w3.org/1999/xlink"; xlink:href="http://gcc.gnu.org/ml/libstdc++/2002-07/msg00048.html";>here
- and http://www.w3.org/1999/xlink"; xlink:href="http://gcc.gnu.org/ml/libstdc++/2002-07/msg00111.html";>here.
-   
-
-  
 
 
 


Re: [patch] Use abi_tag attribute on std::list

2014-10-03 Thread Marc Glisse

On Fri, 3 Oct 2014, Jonathan Wakely wrote:


This is the patch I intend to commit to make std::list::size() O(1) as
required by C++11.

This is an ABI change, so std::list will get tagged with
abi_tag("cxx11") so that it mangles differently.


Assuming a future where we have both _GLIBCXX_ABI_TAG_CXX11 and 
_GLIBCXX_ABI_TAG_CXX17, I don't really see how _GLIBCXX_DEFAULT_ABI_TAG
is supposed to work. We don't want to define _GLIBCXX_DEFAULT_ABI_TAG to 
_GLIBCXX_ABI_TAG_CXX17 and suddenly have std::list change mangling. Should 
it be called _GLIBCXX_DEFAULT_ABI_TAG_CXX11, meaning 
_GLIBCXX_ABI_TAG_CXX11_IF_ENABLED_AND_NOTHING_OTHERWISE?


Defining a dummy _M_distance in the old abi case is a bit strange (we 
could protect the single use with #if _GLIBCXX_USE_CXX11_ABI), but why 
not...


Do you mind if I move (in a future patch once yours is committed) _M_size 
into _M_impl::_M_node as suggested in PR 61347?


--
Marc Glisse


[PATCH] 512-bit gcc.dg/torture/vshuf*.c

2014-10-03 Thread Jakub Jelinek
Hi!

This patch extends the gcc.dg/torture/ testsuite for
512-bit vectors.  Tested with
GCC_TEST_RUN_EXPENSIVE=1 make -j32 check-gcc \
RUNTESTFLAGS='--target_board=unix\{-mavx2,-mavx,-mavx512f,-mavx512bw/-mavx512vl\}
 dg-torture.exp=vshuf*.c'
(of course with expected AVX512* execution test failures,
as I don't have hw and didn't bother with simulator).

As before in vshuf-{8,16,32}.inc, some of the permutations
are hand written (subset in the TESTS portion), the rest
are random permutations.

Ok for trunk?

2014-10-03  Jakub Jelinek  

* gcc.dg/torture/vshuf-v8df.c: New test.
* gcc.dg/torture/vshuf-v8di.c: New test.
* gcc.dg/torture/vshuf-v16sf.c: New test.
* gcc.dg/torture/vshuf-v16si.c: New test.
* gcc.dg/torture/vshuf-v32hi.c: New test.
* gcc.dg/torture/vshuf-v64qi.c: New test.
* gcc.dg/torture/vshuf-64.inc: New file.

--- gcc/testsuite/gcc.dg/torture/vshuf-v8df.c.jj2014-10-03 
13:18:43.426977162 +0200
+++ gcc/testsuite/gcc.dg/torture/vshuf-v8df.c   2014-10-03 13:19:47.434750993 
+0200
@@ -0,0 +1,15 @@
+/* { dg-do run } */
+/* { dg-options "-DEXPENSIVE" { target run_expensive_tests } } */
+/* { dg-options "-fno-common" { target hppa*-*-hpux* } } */
+/* { dg-skip-if "" { ! run_expensive_tests } { "*" } { "-O2" } } */
+/* { dg-skip-if "" { ! run_expensive_tests } { "-flto" } { "" } } */
+
+#if __SIZEOF_DOUBLE__ == 8 && __SIZEOF_LONG_LONG__ == 8
+typedef double V __attribute__((vector_size(64)));
+typedef unsigned long long VI __attribute__((vector_size(64)));
+#else
+#define UNSUPPORTED
+#endif
+
+#include "vshuf-8.inc"
+#include "vshuf-main.inc"
--- gcc/testsuite/gcc.dg/torture/vshuf-v8di.c.jj2014-10-03 
13:18:46.672915313 +0200
+++ gcc/testsuite/gcc.dg/torture/vshuf-v8di.c   2014-10-03 13:18:57.098712816 
+0200
@@ -0,0 +1,15 @@
+/* { dg-do run } */
+/* { dg-options "-DEXPENSIVE" { target run_expensive_tests } } */
+/* { dg-options "-fno-common" { target hppa*-*-hpux* } } */
+/* { dg-skip-if "" { ! run_expensive_tests } { "*" } { "-O2" } } */
+/* { dg-skip-if "" { ! run_expensive_tests } { "-flto" } { "" } } */
+
+#if __SIZEOF_LONG_LONG__ == 8
+typedef unsigned long long V __attribute__((vector_size(64)));
+typedef V VI;
+#else
+#define UNSUPPORTED
+#endif
+
+#include "vshuf-8.inc"
+#include "vshuf-main.inc"
--- gcc/testsuite/gcc.dg/torture/vshuf-v16sf.c.jj   2014-10-03 
13:17:33.941306619 +0200
+++ gcc/testsuite/gcc.dg/torture/vshuf-v16sf.c  2014-10-03 13:18:12.593567509 
+0200
@@ -0,0 +1,21 @@
+/* { dg-do run } */
+/* { dg-options "-DEXPENSIVE" { target run_expensive_tests } } */
+/* { dg-options "-fno-common" { target hppa*-*-hpux* } } */
+/* { dg-skip-if "" { ! run_expensive_tests } { "*" } { "-O2" } } */
+/* { dg-skip-if "" { ! run_expensive_tests } { "-flto" } { "" } } */
+
+#if __SIZEOF_FLOAT__ == 4
+typedef float V __attribute__((vector_size(64)));
+# if __SIZEOF_INT__ == 4
+typedef unsigned int VI __attribute__((vector_size(64)));
+# elif __SIZEOF_LONG__ == 4
+typedef unsigned long VI __attribute__((vector_size(64)));
+# else
+#  define UNSUPPORTED
+# endif
+#else
+# define UNSUPPORTED
+#endif
+
+#include "vshuf-16.inc"
+#include "vshuf-main.inc"
--- gcc/testsuite/gcc.dg/torture/vshuf-v16si.c.jj   2014-10-03 
13:17:02.140916184 +0200
+++ gcc/testsuite/gcc.dg/torture/vshuf-v16si.c  2014-10-03 13:17:21.690538486 
+0200
@@ -0,0 +1,18 @@
+/* { dg-do run } */
+/* { dg-options "-DEXPENSIVE" { target run_expensive_tests } } */
+/* { dg-options "-fno-common" { target hppa*-*-hpux* } } */
+/* { dg-skip-if "" { ! run_expensive_tests } { "*" } { "-O2" } } */
+/* { dg-skip-if "" { ! run_expensive_tests } { "-flto" } { "" } } */
+
+#if __SIZEOF_INT__ == 4
+typedef unsigned int V __attribute__((vector_size(64)));
+typedef V VI;
+#elif __SIZEOF_LONG__ == 4
+typedef unsigned long V __attribute__((vector_size(64)));
+typedef V VI;
+#else
+# define UNSUPPORTED
+#endif
+
+#include "vshuf-16.inc"
+#include "vshuf-main.inc"
--- gcc/testsuite/gcc.dg/torture/vshuf-v32hi.c.jj   2014-10-03 
13:16:01.866074615 +0200
+++ gcc/testsuite/gcc.dg/torture/vshuf-v32hi.c  2014-10-03 13:16:22.112685369 
+0200
@@ -0,0 +1,11 @@
+/* { dg-do run } */
+/* { dg-options "-DEXPENSIVE" { target run_expensive_tests } } */
+/* { dg-options "-fno-common" { target hppa*-*-hpux* } } */
+/* { dg-skip-if "" { ! run_expensive_tests } { "*" } { "-O2" } } */
+/* { dg-skip-if "" { ! run_expensive_tests } { "-flto" } { "" } } */
+
+typedef unsigned short V __attribute__((vector_size(64)));
+typedef V VI;
+
+#include "vshuf-32.inc"
+#include "vshuf-main.inc"
--- gcc/testsuite/gcc.dg/torture/vshuf-v64qi.c.jj   2014-10-03 
14:11:11.961659185 +0200
+++ gcc/testsuite/gcc.dg/torture/vshuf-v64qi.c  2014-10-03 14:11:21.0 
+0200
@@ -0,0 +1,11 @@
+/* { dg-do run } */
+/* { dg-options "-DEXPENSIVE" { target run_expensive_tests } } */
+/* { dg-options "-fno-common" { target hppa*-*-hpux* } } */
+/* { dg-skip-if "" { ! run_expensive_tests } { "*" } { "-O2" } } */
+/* { 

Re: [PATCH 2/2] PR debug/63240 Add DWARF representation for C++11 defaulted member function.

2014-10-03 Thread Jason Merrill

On 10/03/2014 09:12 AM, Mark Wielaard wrote:

A debugger not knowing whether a special member function was explicitly
defaulted, implicitly declared or explicitly defined seems less confusion
than not knowing whether it was deleted. But there are some subtle cases
where knowing whether a constructor was user defined or explicitly
defaulted do matter for whether the default constructor might have been
implicitly generated.


Can you elaborate?


So like the deleted case this patch introduces
a new attribute DW_AT_GNU_defaulted that gets attached to the function
declaration. Note that since this is for declarations we explicitly
test for DECL_DEFAULTED_IN_CLASS_P and ignore any implementation
definitions that use = default; outside the class body.


Hmm, I'm dubious about this choice.  How do you expect a consumer to use 
this information?


Jason



Re: [PATCH] SPARC: add mcpu=leon3v7 target

2014-10-03 Thread Daniel Hellstrom

Hi,


On 10/02/2014 11:22 PM, Eric Botcazou wrote:

[Sorry for the long delay]


The LEON3/4 soft-core CPU has support for both SPARCv7 and SPARCv8 that
is configurable at design time. The majority of the LEON3 ASICs are v8
compatible, however when designing an as small LEON3 as possible, v7
without FPU is frequently used.

The current GCC leon3 support implies the SPARCv8 instruction set
which is not compatible with SPARCv7. Relying on the standard SPARCv7
(-mcpu=v7) target for a LEON3-V7 is not feasible since the atomic
instruction (CAS) can not be generated by standard v7 target. This
is also a problem for binaries aiming to be compatible with all LEON3/4
processors.

  * config.gcc (sparc*-*-*): Accept mcpu=leon3v7 processor
  * doc/invoke.texi (SPARC options): add mcpu=leon3v7 comment
  * config/sparc/leon.md (leon3_load, leon_store, leon_fp_*):
handle leon3v7 as leon3
  * config/sparc/sparc-opts.h (enum processor_type): Add PROCESSOR_LEON3V7
  * config/sparc/sparc.c (sparc_option_override): add leon3v7 support
  * config/sparc/sparc.h (TARGET_CPU_leon3v7): new define
  * config/sparc/sparc.md (cpu): add leon3v7
  * config/sparc/sparc.opt (enum processor_type): Add leon3v7

OK for all branches (it should apply everywhere I think).


I have sent an updated patch just now. In case -Aleon does not exist it should 
select -Av7 instead of -Av8.


I don't remember if I already asked... does Aeroflex/Gaisler have a copyright
assignment on file for GCC?  If so, do you also want to have SVN write access?

Yes, we have. Just verified that with the FSF. It would be a nice for us to 
have write access to the sparc parts.

Thanks!
Daniel



Re: [PATCH 1/2] PR debug/63239 Add DWARF representation for C++11 deleted member function.

2014-10-03 Thread Jason Merrill

OK.

Jason


[PATCH v2] SPARC: add mcpu=leon3v7 target

2014-10-03 Thread Daniel Hellstrom
The LEON3/4 soft-core CPU has support for both SPARCv7 and SPARCv8 that
is configurable at design time. The majority of the LEON3 ASICs are v8
compatible, however when designing an as small LEON3 as possible, v7
without FPU is frequently used.

The current GCC leon3 support implies the SPARCv8 instruction set
which is not compatible with SPARCv7. Relying on the standard SPARCv7
(-mcpu=v7) target for a LEON3-V7 is not feasible since the atomic
instruction (CAS) can not be generated by standard v7.

 * config.gcc (sparc*-*-*): Accept mcpu=leon3v7 processor
 * doc/invoke.texi (SPARC options): add mcpu=leon3v7 comment
 * config/sparc/leon.md (leon3_load, leon_store, leon_fp_*):
   handle leon3v7 as leon3
 * config/sparc/sparc-opts.h (enum processor_type): Add PROCESSOR_LEON3V7
 * config/sparc/sparc.c (sparc_option_override): add leon3v7 support
 * config/sparc/sparc.h (TARGET_CPU_leon3v7): new define
 * config/sparc/sparc.md (cpu): add leon3v7
 * config/sparc/sparc.opt (enum processor_type): Add leon3v7
---
 gcc/config.gcc|5 +++-
 gcc/config/sparc/leon.md  |   14 ++--
 gcc/config/sparc/sparc-opts.h |1 +
 gcc/config/sparc/sparc.c  |3 ++
 gcc/config/sparc/sparc.h  |   44 +++--
 gcc/config/sparc/sparc.md |1 +
 gcc/config/sparc/sparc.opt|3 ++
 gcc/doc/invoke.texi   |   16 +++---
 8 files changed, 56 insertions(+), 31 deletions(-)

diff --git a/gcc/config.gcc b/gcc/config.gcc
index 605efc0..199e387 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -3065,6 +3065,9 @@ if test x$with_cpu = x ; then
*-leon[3-9]*)
  with_cpu=leon3
  ;;
+   *-leon[3-9]v7*)
+ with_cpu=leon3v7
+ ;;
*)
  with_cpu="`echo ${target} | sed 's/-.*$//'`"
  ;;
@@ -3749,7 +3752,7 @@ case "${target}" in
case ${val} in
"" | sparc | sparcv9 | sparc64 \
| v7 | cypress \
-   | v8 | supersparc | hypersparc | leon | leon3 \
+   | v8 | supersparc | hypersparc | leon | leon3 | leon3v7 
\
| sparclite | f930 | f934 | sparclite86x \
| sparclet | tsc701 \
| v9 | ultrasparc | ultrasparc3 | niagara | niagara2 \
diff --git a/gcc/config/sparc/leon.md b/gcc/config/sparc/leon.md
index b511397..e8050fa 100644
--- a/gcc/config/sparc/leon.md
+++ b/gcc/config/sparc/leon.md
@@ -29,11 +29,11 @@
 
 ;; Use a double reservation to work around the load pipeline hazard on UT699.
 (define_insn_reservation "leon3_load" 1
-  (and (eq_attr "cpu" "leon3") (eq_attr "type" "load,sload"))
+  (and (eq_attr "cpu" "leon3,leon3v7") (eq_attr "type" "load,sload"))
   "leon_memory*2")
 
 (define_insn_reservation "leon_store" 2
-  (and (eq_attr "cpu" "leon,leon3") (eq_attr "type" "store"))
+  (and (eq_attr "cpu" "leon,leon3,leon3v7") (eq_attr "type" "store"))
   "leon_memory*2")
 
 ;; This describes Gaisler Research's FPU
@@ -44,21 +44,21 @@
 (define_cpu_unit "grfpu_ds" "grfpu")
 
 (define_insn_reservation "leon_fp_alu" 4
-  (and (eq_attr "cpu" "leon,leon3") (eq_attr "type" "fp,fpcmp,fpmul"))
+  (and (eq_attr "cpu" "leon,leon3,leon3v7") (eq_attr "type" "fp,fpcmp,fpmul"))
   "grfpu_alu, nothing*3")
 
 (define_insn_reservation "leon_fp_divs" 16
-  (and (eq_attr "cpu" "leon,leon3") (eq_attr "type" "fpdivs"))
+  (and (eq_attr "cpu" "leon,leon3,leon3v7") (eq_attr "type" "fpdivs"))
   "grfpu_ds*14, nothing*2")
 
 (define_insn_reservation "leon_fp_divd" 17
-  (and (eq_attr "cpu" "leon,leon3") (eq_attr "type" "fpdivd"))
+  (and (eq_attr "cpu" "leon,leon3,leon3v7") (eq_attr "type" "fpdivd"))
   "grfpu_ds*15, nothing*2")
 
 (define_insn_reservation "leon_fp_sqrts" 24
-  (and (eq_attr "cpu" "leon,leon3") (eq_attr "type" "fpsqrts"))
+  (and (eq_attr "cpu" "leon,leon3,leon3v7") (eq_attr "type" "fpsqrts"))
   "grfpu_ds*22, nothing*2")
 
 (define_insn_reservation "leon_fp_sqrtd" 25
-  (and (eq_attr "cpu" "leon,leon3") (eq_attr "type" "fpsqrtd"))
+  (and (eq_attr "cpu" "leon,leon3,leon3v7") (eq_attr "type" "fpsqrtd"))
   "grfpu_ds*23, nothing*2")
diff --git a/gcc/config/sparc/sparc-opts.h b/gcc/config/sparc/sparc-opts.h
index b5e9761..c35bee4 100644
--- a/gcc/config/sparc/sparc-opts.h
+++ b/gcc/config/sparc/sparc-opts.h
@@ -31,6 +31,7 @@ enum processor_type {
   PROCESSOR_HYPERSPARC,
   PROCESSOR_LEON,
   PROCESSOR_LEON3,
+  PROCESSOR_LEON3V7,
   PROCESSOR_SPARCLITE,
   PROCESSOR_F930,
   PROCESSOR_F934,
diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
index e9b2bcf..7f3c43e 100644
--- a/gcc/config/sparc/sparc.c
+++ b/gcc/config/sparc/sparc.c
@@ -1125,6 +1125,7 @@ sparc_option_override (void)
 { TARGET_CPU_hypersparc, PROCESSOR_HYPERSPARC },
 { TARGET_CPU_leon, PROCESSOR_LEON },
 { TARGET_CPU_leon3, PROCESSOR_LEON3 },
+{ TARGET_CPU_leon3v7, PROCESSOR_LEON3V7 },
 { TARGET_CPU_sparclite, PROCESSOR_F930 },
 { 

Re: [debug-early] C++: emit early debug info for all globals, not just statics

2014-10-03 Thread Jason Merrill

On 10/02/2014 02:21 PM, Aldy Hernandez wrote:

Actually, I think we/I need to rethink this whole globals thing.
Currently we're early dumping global *_DECLs, and hoping dwarf2out
recursion will also pick up types and any derivatives from the *_DECLs,
but taking a closer look I've noticed a lot of things are not being
dumped early.

For instance:


 foo()
 {
   typedef int ITYPE;
   ITYPE var = 5;
 }

For the above code, var's DIE gets outputted _after_ the compilation
proper has been run here:

   if (! declaration && outer_scope && TREE_CODE (outer_scope) !=
ERROR_MARK
   && (!DECL_STRUCT_FUNCTION (decl)
   || DECL_STRUCT_FUNCTION (decl)->gimple_df))
 ...
 ...
 decls_for_scope (outer_scope, subr_die, 0);

I think we should be outputting DIEs for locals at the end of parsing,
so my patch going through level->names IMO is wrong.  We should be
dumping all *_DECLs created by the FE, not just globally scoped ones.


The way to dump locals is by recursion.  If the current process isn't 
hitting these, that's a bug, but I don't think it means we need to 
fundamentally change the approach.  Why aren't we hitting that 
decls_for_scope when we early dump foo?



Another example currently not being dumped early is...

 function()
 {
   class Local {
   public:
 void loc_foo (void) { }
   };

   Local l;
   l.loc_foo ();
 }

...since loc_foo() is not in level->names.


Again, dumping function() should imply dumping Local and its members.

Jason



Re: [debug-early] do not add location info/etc to abstract instances

2014-10-03 Thread Aldy Hernandez
I know It just makes me feel better to know we're in agreement. Old habits 
die hard I guess ;-).

On Oct 3, 2014 7:08 AM, Jason Merrill  wrote:
>
> On 10/02/2014 03:24 PM, Aldy Hernandez wrote: 
> > If you aOn 10/02/2014 03:24 PM, Aldy Hernandez wrote:
> If you are ok with this incremental patch, I will push it to the branch.

Looks good.  In general I don't think you need to wait for approval 
before checking something in on your own branch.  :)

Jason



[PATCH 1/2] Error out for Cilk_spawn or array expression in forbidden places

2014-10-03 Thread Andi Kleen
From: Andi Kleen 

_Cilk_spawn or Cilk array expressions are only allowed on their own,
but not in for(), if(), switch, do, while, goto, etc.
The C parser didn't always check for that, which lead to ICEs earlier
for invalid code.

Add a generic helper that checks this and call it where needed
in the C frontend.

I chose to allow spawn/array for for init and increment expressions.
While the Cilk spec could be interpreted to forbid it there too
there didn't seem any reason to not allow it.

One dark corner is spawn, array in statement expressions not at
the end. Right now that's forbidden too.

gcc/c-family/:

2014-09-30  Andi Kleen  

PR c/60804
* c-common.h (check_no_cilk): Declare.
* cilk.c (get_error_location): New function.
(check_no_cilk): Dito.

gcc/c/:

2014-09-30  Andi Kleen  

PR c/60804
* c-parser.c (c_parser_statement_after_labels): Call
check_no_cilk.
(c_parser_if_statement): Dito.
(c_parser_switch_statement): Dito.
(c_parser_while_statement): Dito.
(c_parser_do_statement): Dito.
(c_parser_for_statement): Dito.
* c-typeck.c (c_finish_loop): Dito.
---
 gcc/c-family/c-common.h |  2 ++
 gcc/c-family/cilk.c | 39 
 gcc/c/c-parser.c| 67 -
 gcc/c/c-typeck.c|  8 ++
 4 files changed, 82 insertions(+), 34 deletions(-)

diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h
index 1e3477f..bd47860 100644
--- a/gcc/c-family/c-common.h
+++ b/gcc/c-family/c-common.h
@@ -1395,4 +1395,6 @@ extern tree cilk_install_body_pedigree_operations (tree);
 extern void cilk_outline (tree, tree *, void *);
 extern bool contains_cilk_spawn_stmt (tree);
 extern tree cilk_for_number_of_iterations (tree);
+extern bool check_no_cilk (tree, const char *, const char *,
+  location_t loc = UNKNOWN_LOCATION);
 #endif /* ! GCC_C_COMMON_H */
diff --git a/gcc/c-family/cilk.c b/gcc/c-family/cilk.c
index 5b6684a..d7f1bb7 100644
--- a/gcc/c-family/cilk.c
+++ b/gcc/c-family/cilk.c
@@ -1312,3 +1312,42 @@ contains_cilk_spawn_stmt (tree expr)
   return walk_tree (&expr, contains_cilk_spawn_stmt_walker, NULL, NULL)
 != NULL_TREE;
 }
+
+/* Return a error location for EXPR if LOC is not set.  */
+
+static location_t
+get_error_location (tree expr, location_t loc)
+{
+  if (loc == UNKNOWN_LOCATION)
+{
+  if (TREE_CODE (expr) == MODIFY_EXPR)
+expr = TREE_OPERAND (expr, 0);
+  loc = EXPR_LOCATION (expr);
+}
+  return loc;
+}
+
+/* Check that no array notation or spawn statement is in EXPR.
+   If not true generate an error at LOC for ARRAY_GMSGID or
+   SPAWN_MSGID.  */
+
+bool
+check_no_cilk (tree expr, const char *array_msgid, const char *spawn_msgid,
+ location_t loc)
+{
+  if (!flag_cilkplus)
+return false;
+  if (contains_array_notation_expr (expr))
+{
+  loc = get_error_location (expr, loc);
+  error_at (loc, array_msgid);
+  return true;
+}
+  if (walk_tree (&expr, contains_cilk_spawn_stmt_walker, NULL, NULL))
+{
+  loc = get_error_location (expr, loc);
+  error_at (loc, spawn_msgid);
+  return true;
+}
+  return false;
+}
diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c
index 0d159fd..6c45d6a 100644
--- a/gcc/c/c-parser.c
+++ b/gcc/c/c-parser.c
@@ -4926,6 +4926,11 @@ c_parser_statement_after_labels (c_parser *parser)
 
  c_parser_consume_token (parser);
  val = c_parser_expression (parser);
+ if (check_no_cilk (val.value,
+"Cilk array notation cannot be used as a 
computed goto expression",
+"%<_Cilk_spawn%> statement cannot be used as a 
computed goto expression",
+loc))
+   val.value = error_mark_node;
  val = convert_lvalue_to_rvalue (loc, val, false, true);
  stmt = c_finish_goto_ptr (loc, val.value);
}
@@ -4979,8 +4984,15 @@ c_parser_statement_after_labels (c_parser *parser)
{
  struct c_expr expr = c_parser_expression (parser);
  expr = convert_lvalue_to_rvalue (loc, expr, false, false);
- expr.value = c_fully_fold (expr.value, false, NULL);
- stmt = objc_build_throw_stmt (loc, expr.value);
+ if (check_no_cilk (expr.value,
+"Cilk array notation cannot be used for a throw expression",
+"%<_Cilk_spawn%> statement cannot be used for a throw 
expression"))
+   expr.value = error_mark_node;
+ else
+   {
+ expr.value = c_fully_fold (expr.value, false, NULL);
+ stmt = objc_build_throw_stmt (loc, expr.value);
+   }
  goto expect_semicolon;
}
  break;
@@ -5163,6 +5175,11 @@ c_parser_if_statement (c_parser *parser)
   block = c_begin_com

Updated cilk error patches

2014-10-03 Thread Andi Kleen
This version addresses the localization problem pointed out by Joseph.
No other changes. I only reposted the two changed patches in the patchkit,
the others have already been approved.

Passes bootstrap and test suite on x86_64-linux.

-Andi



[PATCH 2/2] Add illegal cilk checks to C++ front.

2014-10-03 Thread Andi Kleen
From: Andi Kleen 

Add calls for several illegal Cilk cases to the C++ frontend.
C++ usually doesn't ICE unlike C on illegal cilk, but it's
better to match C in what is allowed and what is not.

if (_Cilk_spawn ...) is still not errored, but at least it doesn't ICE.

gcc/cp/:

2014-09-30  Andi Kleen  

* semantics.c (finish_goto_stmt): Call check_no_cilk.
(finish_while_stmt_cond): Dito.
(finish_do_stmt): Dito.
(finish_for_cond): Dito.
(finish_switch_cond): Dito.
---
 gcc/cp/semantics.c | 22 ++
 1 file changed, 22 insertions(+)

diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 7569826..e7ff223 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -621,6 +621,10 @@ finish_goto_stmt (tree destination)
 TREE_USED (destination) = 1;
   else
 {
+  if (check_no_cilk (destination,
+"Cilk array notation cannot be used as a computed goto expression",
+"%<_Cilk_spawn%> statement cannot be used as a computed goto 
expression"))
+   destination = error_mark_node;
   destination = mark_rvalue_use (destination);
   if (!processing_template_decl)
{
@@ -792,6 +796,10 @@ begin_while_stmt (void)
 void
 finish_while_stmt_cond (tree cond, tree while_stmt, bool ivdep)
 {
+  if (check_no_cilk (cond,
+  "Cilk array notation cannot be used as a condition for while statement",
+  "%<_Cilk_spawn%> statement cannot be used as a condition for while 
statement"))
+cond = error_mark_node;
   cond = maybe_convert_cond (cond);
   finish_cond (&WHILE_COND (while_stmt), cond);
   begin_maybe_infinite_loop (cond);
@@ -847,6 +855,10 @@ finish_do_body (tree do_stmt)
 void
 finish_do_stmt (tree cond, tree do_stmt, bool ivdep)
 {
+  if (check_no_cilk (cond,
+  "Cilk array notation cannot be used as a condition for a do-while statement",
+  "%<_Cilk_spawn%> statement cannot be used as a condition for a do-while 
statement"))
+cond = error_mark_node;
   cond = maybe_convert_cond (cond);
   end_maybe_infinite_loop (cond);
   if (ivdep && cond != error_mark_node)
@@ -956,6 +968,10 @@ finish_for_init_stmt (tree for_stmt)
 void
 finish_for_cond (tree cond, tree for_stmt, bool ivdep)
 {
+  if (check_no_cilk (cond,
+"Cilk array notation cannot be used in a condition for a for-loop",
+"%<_Cilk_spawn%> statement cannot be used in a condition for a 
for-loop"))
+cond = error_mark_node;
   cond = maybe_convert_cond (cond);
   finish_cond (&FOR_COND (for_stmt), cond);
   begin_maybe_infinite_loop (cond);
@@ -1118,6 +1134,12 @@ void
 finish_switch_cond (tree cond, tree switch_stmt)
 {
   tree orig_type = NULL;
+
+  if (check_no_cilk (cond,
+   "Cilk array notation cannot be used as a condition for switch 
statement",
+   "%<_Cilk_spawn%> statement cannot be used as a condition for switch 
statement"))
+cond = error_mark_node;
+
   if (!processing_template_decl)
 {
   /* Convert the condition to an integer or enumeration type.  */
-- 
2.1.1



Re: [debug-early] do not add location info/etc to abstract instances

2014-10-03 Thread Jason Merrill

On 10/02/2014 03:24 PM, Aldy Hernandez wrote:

If you are ok with this incremental patch, I will push it to the branch.


Looks good.  In general I don't think you need to wait for approval 
before checking something in on your own branch.  :)


Jason



Re: __intN patch 3/5: main __int128 -> __intN conversion.

2014-10-03 Thread Jason Merrill

On 10/02/2014 02:00 PM, DJ Delorie wrote:

Ah, good point.  In which case I don't see what this code is trying to
accomplish relative to falling through to the "prefer the unsigned one"
code below.  Shall we just remove it?


I don't know for sure.  There was __int128 code there, I replaced it
with the "same" code, so as to avoid any functional differences on
mainstream targets.

I imagine the code is there for when __int128 is the same size as some
other types besides long long.


But if __int128 happened to be the same size as long the code was wrong. 
 Well, I suppose it could be there to prefer __int128 to 
intTI_type_node.  I guess let's move the intN handling below the code 
for (u)long and add support for unsigned extended integers like there is 
for both long and long long.


Jason



Re: [PATCH,i386] Fix adxintrin on mingw.

2014-10-03 Thread Ilya Tocar
On 02 Oct 07:41, H.J. Lu wrote:
> On Thu, Oct 2, 2014 at 7:29 AM, Ilya Tocar  wrote:
> > Hi,
> >
> > sizeof (long) == 4 on windows, so we should use long long as param type.
> > Patch below does it.
> 
> The same is true for x32.  Can you add a testcase to show it
> fails on x32 without the fix?
>

This could only be done with runtime test.
I've had troubles running sde (emulator) on x32 enabled system,
but replacing long long with int in intrinsic signature will cause
adx-addcarryx64-2.c to fail under sde on 64 bits. I believe it will
also fail on sde+{win,x32} or real hardware, when it's available.

> > Ok for trunk?
> >
> > 2014-10-02  Ilya Tocar  
> >
> > * config/i386/adxintrin.h (_subborrow_u64): Use long long for param
> > type.
> > (_addcarry_u64): Ditto.
> > (_addcarryx_u64): Ditto.
> >
> > ---
> >  gcc/config/i386/adxintrin.h | 12 ++--
> >  1 file changed, 6 insertions(+), 6 deletions(-)
> >
> > diff --git a/gcc/config/i386/adxintrin.h b/gcc/config/i386/adxintrin.h
> > index 8f2c01a..00a9b86 100644
> > --- a/gcc/config/i386/adxintrin.h
> > +++ b/gcc/config/i386/adxintrin.h
> > @@ -55,24 +55,24 @@ _addcarryx_u32 (unsigned char __CF, unsigned int __X,
> >  #ifdef __x86_64__
> >  extern __inline unsigned char
> >  __attribute__((__gnu_inline__, __always_inline__, __artificial__))
> > -_subborrow_u64 (unsigned char __CF, unsigned long __X,
> > -   unsigned long __Y, unsigned long long *__P)
> > +_subborrow_u64 (unsigned char __CF, unsigned long long __X,
> > +   unsigned long long __Y, unsigned long long *__P)
> >  {
> >  return __builtin_ia32_sbb_u64 (__CF, __Y, __X, __P);
> >  }
> >
> >  extern __inline unsigned char
> >  __attribute__((__gnu_inline__, __always_inline__, __artificial__))
> > -_addcarry_u64 (unsigned char __CF, unsigned long __X,
> > -  unsigned long __Y, unsigned long long *__P)
> > +_addcarry_u64 (unsigned char __CF, unsigned long long __X,
> > +  unsigned long long __Y, unsigned long long *__P)
> >  {
> >  return __builtin_ia32_addcarryx_u64 (__CF, __X, __Y, __P);
> >  }
> >
> >  extern __inline unsigned char
> >  __attribute__((__gnu_inline__, __always_inline__, __artificial__))
> > -_addcarryx_u64 (unsigned char __CF, unsigned long __X,
> > -   unsigned long __Y, unsigned long long *__P)
> > +_addcarryx_u64 (unsigned char __CF, unsigned long long __X,
> > +   unsigned long long __Y, unsigned long long *__P)
> >  {
> >  return __builtin_ia32_addcarryx_u64 (__CF, __X, __Y, __P);
> >  }
> > --
> > 1.8.3.1
> >
> 
> 
> 
> -- 
> H.J.


[patch] libstdc++/63449 remove outdated documentation

2014-10-03 Thread Jonathan Wakely

I think after 12 years it's safe to say that alternative version ain't
gonna happen.

Committed to trunk.


commit 14a8726815925137217b4282cf89460c547e7248
Author: Jonathan Wakely 
Date:   Fri Oct 3 14:28:44 2014 +0100

	PR libstdc++/63449
	* doc/xml/manual/containers.xml: Remove outdated section.
	* doc/html/*: Regenerate.

index ec2cb21..434a306 100644
--- a/libstdc++-v3/doc/xml/manual/containers.xml
+++ b/libstdc++-v3/doc/xml/manual/containers.xml
@@ -72,26 +72,6 @@
   
 
 
-vector
-
-  
-  
-  
-  Space Overhead Management
-
-   
- In http://www.w3.org/1999/xlink"; xlink:href="http://gcc.gnu.org/ml/libstdc++/2002-04/msg00105.html";>this
- message to the list, Daniel Kostecky announced work on an
- alternate form of std::vector that would support
- hints on the number of elements to be over-allocated.  The design
- was also described, along with possible implementation choices.
-   
-   
- The first two alpha releases were announced http://www.w3.org/1999/xlink"; xlink:href="http://gcc.gnu.org/ml/libstdc++/2002-07/msg00048.html";>here
- and http://www.w3.org/1999/xlink"; xlink:href="http://gcc.gnu.org/ml/libstdc++/2002-07/msg00111.html";>here.
-   
-
-  
 
 
 


[PATCH 1/2] PR debug/63239 Add DWARF representation for C++11 deleted member function.

2014-10-03 Thread Mark Wielaard
Currently we output a declaration of the explicitly deleted function
in DWARF. That seems wrong. An alternative to adding an attribute would
be to just not output the declaration. But that is also confusing since
then it looks precisely the same as an class that has that special
function implicitly defined, since we don't output a declaration for
such implicitly defined special functions either. So this implementation
defines a new attribute DW_AT_GNU_deleted that gets added to the
declaration.

include/ChangeLog

* dwarf2.def (DW_AT_GNU_deleted): New attribute.

gcc/ChangeLog

* dwarf2out.c (gen_subprogram_die): When a member function is
explicitly deleted then add a DW_AT_GNU_deleted attribute.
* langhooks.h (struct lang_hooks_for_decls): Add
function_decl_deleted_p langhook.
* langhooks-def.h (LANG_HOOKS_FUNCTION_DECL_DELETED_P): Define.
(LANG_HOOKS_DECLS): Add LANG_HOOKS_FUNCTION_DECL_DELETED_P.

gcc/cp/ChangeLog

* cp-objcp-common.h (LANG_HOOKS_FUNCTION_DECL_DELETED_P): Define.
(cp_function_decl_deleted_p): New prototype.
* cp-objcp-common.c (cp_function_deleted_p): New function.

gcc/testsuite/ChangeLog

* g++.dg/debug/dwarf2/deleted-member-function.C: New testcase.
---
 gcc/ChangeLog   | 10 ++
 gcc/cp/ChangeLog|  7 +++
 gcc/cp/cp-objcp-common.c| 10 ++
 gcc/cp/cp-objcp-common.h|  3 +++
 gcc/dwarf2out.c |  6 ++
 gcc/langhooks-def.h |  2 ++
 gcc/langhooks.h |  3 +++
 gcc/testsuite/ChangeLog |  5 +
 .../g++.dg/debug/dwarf2/deleted-member-function.C   | 17 +
 include/ChangeLog   |  5 +
 include/dwarf2.def  |  2 ++
 11 files changed, 70 insertions(+)
 create mode 100644 gcc/testsuite/g++.dg/debug/dwarf2/deleted-member-function.C

diff --git a/gcc/cp/cp-objcp-common.c b/gcc/cp/cp-objcp-common.c
index 0c50f40..0d144ef 100644
--- a/gcc/cp/cp-objcp-common.c
+++ b/gcc/cp/cp-objcp-common.c
@@ -168,6 +168,16 @@ cp_function_decl_explicit_p (tree decl)
  && DECL_NONCONVERTING_P (decl));
 }
 
+/* Return true if DECL is deleted special member function.  */
+
+bool
+cp_function_decl_deleted_p (tree decl)
+{
+  return (decl
+ && DECL_LANG_SPECIFIC (STRIP_TEMPLATE (decl))
+ && DECL_DELETED_FN (decl));
+}
+
 /* Stubs to keep c-opts.c happy.  */
 void
 push_file_scope (void)
diff --git a/gcc/cp/cp-objcp-common.h b/gcc/cp/cp-objcp-common.h
index 246800e..c289774 100644
--- a/gcc/cp/cp-objcp-common.h
+++ b/gcc/cp/cp-objcp-common.h
@@ -27,6 +27,7 @@ extern tree objcp_tsubst_copy_and_build (tree, tree, 
tsubst_flags_t,
 tree, bool);
 
 extern bool cp_function_decl_explicit_p (tree decl);
+extern bool cp_function_decl_deleted_p (tree decl);
 extern void cp_common_init_ts (void);
 
 /* Lang hooks that are shared between C++ and ObjC++ are defined here.  Hooks
@@ -131,6 +132,8 @@ extern void cp_common_init_ts (void);
 #define LANG_HOOKS_GIMPLIFY_EXPR cp_gimplify_expr
 #undef LANG_HOOKS_FUNCTION_DECL_EXPLICIT_P
 #define LANG_HOOKS_FUNCTION_DECL_EXPLICIT_P cp_function_decl_explicit_p
+#undef LANG_HOOKS_FUNCTION_DECL_DELETED_P
+#define LANG_HOOKS_FUNCTION_DECL_DELETED_P cp_function_decl_deleted_p
 #undef LANG_HOOKS_OMP_PREDETERMINED_SHARING
 #define LANG_HOOKS_OMP_PREDETERMINED_SHARING cxx_omp_predetermined_sharing
 #undef LANG_HOOKS_OMP_CLAUSE_DEFAULT_CTOR
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index b5fcfa4..11544d8 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -18299,6 +18299,12 @@ gen_subprogram_die (tree decl, dw_die_ref context_die)
  && (dwarf_version >= 3 || !dwarf_strict))
add_AT_flag (subr_die, DW_AT_explicit, 1);
 
+ /* If this is a C++11 deleted special function member then generate
+a DW_AT_GNU_deleted attribute.  */
+ if (lang_hooks.decls.function_decl_deleted_p (decl)
+ && (! dwarf_strict))
+   add_AT_flag (subr_die, DW_AT_GNU_deleted, 1);
+
  /* The first time we see a member function, it is in the context of
 the class to which it belongs.  We make sure of this by emitting
 the class first.  The next time is the definition, which is
diff --git a/gcc/langhooks-def.h b/gcc/langhooks-def.h
index e77d2d9..e5ae3e3 100644
--- a/gcc/langhooks-def.h
+++ b/gcc/langhooks-def.h
@@ -203,6 +203,7 @@ extern tree lhd_make_node (enum tree_code);
 #define LANG_HOOKS_PUSHDECLpushdecl
 #define LANG_HOOKS_GETDECLSgetdecls
 #define LANG_HOOKS_FUNCTION_DECL_EXPLICIT_P hook_bool_tree_false
+#define LANG_HOOKS_FUNCTION_DECL_DELETED_P hook_bool_tree_false

[PATCH 2/2] PR debug/63240 Add DWARF representation for C++11 defaulted member function.

2014-10-03 Thread Mark Wielaard
A debugger not knowing whether a special member function was explicitly
defaulted, implicitly declared or explicitly defined seems less confusion
than not knowing whether it was deleted. But there are some subtle cases
where knowing whether a constructor was user defined or explicitly
defaulted do matter for whether the default constructor might have been
implicitly generated. So like the deleted case this patch introduces
a new attribute DW_AT_GNU_defaulted that gets attached to the function
declaration. Note that since this is for declarations we explicitly
test for DECL_DEFAULTED_IN_CLASS_P and ignore any implementation
definitions that use = default; outside the class body.

gcc/ChangeLog

* dwarf2out.c (gen_subprogram_die): When a member function is
declared default then add a DW_AT_GNU_defaulted attribute.
* langhooks.h (struct lang_hooks_for_decls): Add
function_decl_defaulted_p langhook.
* langhooks-def.h (LANG_HOOKS_FUNCTION_DECL_DEFAULTED_P): Define.
(LANG_HOOKS_DECLS): Add LANG_HOOKS_FUNCTION_DECL_DEFAULTED_P.

gcc/cp/ChangeLog

* cp-objcp-common.h (LANG_HOOKS_FUNCTION_DECL_DEFAULTED_P): Define.
(cp_function_decl_defaulted_p): New prototype.
* cp-objcp-common.c (cp_function_defaulted_p): New function.

gcc/testsuite/ChangeLog

* g++.dg/debug/dwarf2/defaulted-member-function.C: New testcase.

include/ChangeLog

* dwarf2.def (DW_AT_GNU_defaulted): New attribute.
---
 gcc/ChangeLog   | 10 ++
 gcc/cp/ChangeLog|  7 +++
 gcc/cp/cp-objcp-common.c| 10 ++
 gcc/cp/cp-objcp-common.h|  3 +++
 gcc/dwarf2out.c |  6 ++
 gcc/langhooks-def.h |  2 ++
 gcc/langhooks.h |  3 +++
 gcc/testsuite/ChangeLog |  5 +
 .../g++.dg/debug/dwarf2/defaulted-member-function.C | 17 +
 include/ChangeLog   |  5 +
 include/dwarf2.def  |  2 ++
 11 files changed, 70 insertions(+)
 create mode 100644 
gcc/testsuite/g++.dg/debug/dwarf2/defaulted-member-function.C

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index dc3287b..255b1b6 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,13 @@
+2014-10-03  Mark Wielaard  
+
+   PR debug/63240
+   * dwarf2out.c (gen_subprogram_die): When a member function is
+   declared default then add a DW_AT_GNU_defaulted attribute.
+   * langhooks.h (struct lang_hooks_for_decls): Add
+   function_decl_defaulted_p langhook.
+   * langhooks-def.h (LANG_HOOKS_FUNCTION_DECL_DEFAULTED_P): Define.
+   (LANG_HOOKS_DECLS): Add LANG_HOOKS_FUNCTION_DECL_DEFAULTED_P.
+
 2014-10-02  Mark Wielaard  
 
PR debug/63239
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 921f95c..d88bcd8 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,10 @@
+2014-10-03  Mark Wielaard  
+
+   PR debug/63240
+   * cp-objcp-common.h (LANG_HOOKS_FUNCTION_DECL_DEFAULTED_P): Define.
+   (cp_function_decl_defaulted_p): New prototype.
+   * cp-objcp-common.c (cp_function_defaulted_p): New function.
+
 2014-10-02  Mark Wielaard  
 
PR debug/63239
diff --git a/gcc/cp/cp-objcp-common.c b/gcc/cp/cp-objcp-common.c
index 0d144ef..5516671 100644
--- a/gcc/cp/cp-objcp-common.c
+++ b/gcc/cp/cp-objcp-common.c
@@ -178,6 +178,16 @@ cp_function_decl_deleted_p (tree decl)
  && DECL_DELETED_FN (decl));
 }
 
+/* Return true if DECL is defaulted in the class body.  */
+
+bool
+cp_function_decl_defaulted_p (tree decl)
+{
+  return (decl
+ && DECL_LANG_SPECIFIC (STRIP_TEMPLATE (decl))
+ && DECL_DEFAULTED_IN_CLASS_P (decl));
+}
+
 /* Stubs to keep c-opts.c happy.  */
 void
 push_file_scope (void)
diff --git a/gcc/cp/cp-objcp-common.h b/gcc/cp/cp-objcp-common.h
index c289774..348874f 100644
--- a/gcc/cp/cp-objcp-common.h
+++ b/gcc/cp/cp-objcp-common.h
@@ -28,6 +28,7 @@ extern tree objcp_tsubst_copy_and_build (tree, tree, 
tsubst_flags_t,
 
 extern bool cp_function_decl_explicit_p (tree decl);
 extern bool cp_function_decl_deleted_p (tree decl);
+extern bool cp_function_decl_defaulted_p (tree decl);
 extern void cp_common_init_ts (void);
 
 /* Lang hooks that are shared between C++ and ObjC++ are defined here.  Hooks
@@ -134,6 +135,8 @@ extern void cp_common_init_ts (void);
 #define LANG_HOOKS_FUNCTION_DECL_EXPLICIT_P cp_function_decl_explicit_p
 #undef LANG_HOOKS_FUNCTION_DECL_DELETED_P
 #define LANG_HOOKS_FUNCTION_DECL_DELETED_P cp_function_decl_deleted_p
+#undef LANG_HOOKS_FUNCTION_DECL_DEFAULTED_P
+#define LANG_HOOKS_FUNCTION_DECL_DEFAULTED_P cp_function_decl_defaulted_p
 #undef LANG_HOOKS_OMP_PREDETERMINED_SHARING
 #define LANG_HOOKS_OMP_PREDETERMINED_SHARING cxx_o

Re: [PATCH] Disable __asan_init for KASan

2014-10-03 Thread Dmitry Vyukov
Looks good to me

On Fri, Oct 3, 2014 at 5:07 PM, Yury Gribov  wrote:
> Hi all,
>
> This patch disables generation of asan_init calls for KASan as discussed in
> https://lkml.org/lkml/2014/9/26/711
>
> Bootstrapped and regtested no x64. Ok to commit?
>
> -Y
>
> commit 91c015e54687666f4abf6745f33c2eee8e569d17
> Author: Yury Gribov 
> Date:   Fri Oct 3 11:53:38 2014 +0400
>
> 2014-10-03  Yury Gribov  
>
> gcc/
> * asan.c (asan_finish_file): Disable __asan_init calls for KASan;
> don't emit empty ctors.
>
> diff --git a/gcc/asan.c b/gcc/asan.c
> index f520eab..247661a 100644
> --- a/gcc/asan.c
> +++ b/gcc/asan.c
> @@ -2400,8 +2400,11 @@ asan_finish_file (void)
>   nor after .LASAN* array.  */
>flag_sanitize &= ~SANITIZE_ADDRESS;
>
> -  tree fn = builtin_decl_implicit (BUILT_IN_ASAN_INIT);
> -  append_to_statement_list (build_call_expr (fn, 0),
> &asan_ctor_statements);
> +  if (flag_sanitize & SANITIZE_USER_ADDRESS)
> +{
> +  tree fn = builtin_decl_implicit (BUILT_IN_ASAN_INIT);
> +  append_to_statement_list (build_call_expr (fn, 0),
> &asan_ctor_statements);
> +}
>FOR_EACH_DEFINED_VARIABLE (vnode)
>  if (TREE_ASM_WRITTEN (vnode->decl)
> && asan_protect_global (vnode->decl))
> @@ -2438,7 +2441,7 @@ asan_finish_file (void)
>DECL_INITIAL (var) = ctor;
>varpool_node::finalize_decl (var);
>
> -  fn = builtin_decl_implicit (BUILT_IN_ASAN_REGISTER_GLOBALS);
> +  tree fn = builtin_decl_implicit (BUILT_IN_ASAN_REGISTER_GLOBALS);
>tree gcount_tree = build_int_cst (pointer_sized_int_node, gcount);
>append_to_statement_list (build_call_expr (fn, 2,
>  build_fold_addr_expr (var),
> @@ -2453,8 +2456,9 @@ asan_finish_file (void)
>cgraph_build_static_cdtor ('D', dtor_statements,
>  MAX_RESERVED_INIT_PRIORITY - 1);
>  }
> -  cgraph_build_static_cdtor ('I', asan_ctor_statements,
> -MAX_RESERVED_INIT_PRIORITY - 1);
> +  if (asan_ctor_statements)
> +cgraph_build_static_cdtor ('I', asan_ctor_statements,
> +  MAX_RESERVED_INIT_PRIORITY - 1);
>flag_sanitize |= SANITIZE_ADDRESS;
>  }
>
>


Re: [PATCH] Disable __asan_init for KASan

2014-10-03 Thread Jakub Jelinek
On Fri, Oct 03, 2014 at 05:07:01PM +0400, Yury Gribov wrote:
> Hi all,
> 
> This patch disables generation of asan_init calls for KASan as discussed in
> https://lkml.org/lkml/2014/9/26/711
> 
> Bootstrapped and regtested no x64. Ok to commit?

Ok, thanks.

> commit 91c015e54687666f4abf6745f33c2eee8e569d17
> Author: Yury Gribov 
> Date:   Fri Oct 3 11:53:38 2014 +0400
> 
> 2014-10-03  Yury Gribov  
> 
> gcc/
>   * asan.c (asan_finish_file): Disable __asan_init calls for KASan;
>   don't emit empty ctors.

Jakub


[PATCH] Disable __asan_init for KASan

2014-10-03 Thread Yury Gribov

Hi all,

This patch disables generation of asan_init calls for KASan as discussed 
in https://lkml.org/lkml/2014/9/26/711


Bootstrapped and regtested no x64. Ok to commit?

-Y
commit 91c015e54687666f4abf6745f33c2eee8e569d17
Author: Yury Gribov 
Date:   Fri Oct 3 11:53:38 2014 +0400

2014-10-03  Yury Gribov  

gcc/
	* asan.c (asan_finish_file): Disable __asan_init calls for KASan;
	don't emit empty ctors.

diff --git a/gcc/asan.c b/gcc/asan.c
index f520eab..247661a 100644
--- a/gcc/asan.c
+++ b/gcc/asan.c
@@ -2400,8 +2400,11 @@ asan_finish_file (void)
  nor after .LASAN* array.  */
   flag_sanitize &= ~SANITIZE_ADDRESS;
 
-  tree fn = builtin_decl_implicit (BUILT_IN_ASAN_INIT);
-  append_to_statement_list (build_call_expr (fn, 0), &asan_ctor_statements);
+  if (flag_sanitize & SANITIZE_USER_ADDRESS)
+{
+  tree fn = builtin_decl_implicit (BUILT_IN_ASAN_INIT);
+  append_to_statement_list (build_call_expr (fn, 0), &asan_ctor_statements);
+}
   FOR_EACH_DEFINED_VARIABLE (vnode)
 if (TREE_ASM_WRITTEN (vnode->decl)
 	&& asan_protect_global (vnode->decl))
@@ -2438,7 +2441,7 @@ asan_finish_file (void)
   DECL_INITIAL (var) = ctor;
   varpool_node::finalize_decl (var);
 
-  fn = builtin_decl_implicit (BUILT_IN_ASAN_REGISTER_GLOBALS);
+  tree fn = builtin_decl_implicit (BUILT_IN_ASAN_REGISTER_GLOBALS);
   tree gcount_tree = build_int_cst (pointer_sized_int_node, gcount);
   append_to_statement_list (build_call_expr (fn, 2,
 		 build_fold_addr_expr (var),
@@ -2453,8 +2456,9 @@ asan_finish_file (void)
   cgraph_build_static_cdtor ('D', dtor_statements,
  MAX_RESERVED_INIT_PRIORITY - 1);
 }
-  cgraph_build_static_cdtor ('I', asan_ctor_statements,
-			 MAX_RESERVED_INIT_PRIORITY - 1);
+  if (asan_ctor_statements)
+cgraph_build_static_cdtor ('I', asan_ctor_statements,
+			   MAX_RESERVED_INIT_PRIORITY - 1);
   flag_sanitize |= SANITIZE_ADDRESS;
 }
 


[patch] Use abi_tag attribute on std::list

2014-10-03 Thread Jonathan Wakely

This is the patch I intend to commit to make std::list::size() O(1) as
required by C++11.

This is an ABI change, so std::list will get tagged with
abi_tag("cxx11") so that it mangles differently.

I took a different approach to the way O(1) size() was implemented
(and then reverted) for GCC 4.7.0, because I didn't like updating the
size when node are (de)allocated. Instead this patch adjusts the size
when nodes are added or removed from the list, rather then when
they're allocated.

Instead of littering the code with #if checks I added new
_M_xxx_size() members that can be called unconditionally when
modifying the list, but they do nothing when there's no size member.
This means there's only a single #if condition added to std::list by
this patch.

There will be another patch coming soon to add C++11 allocator support
to std::list, and another to add a non-COW std::string using abi_tag.

I don't yet know what we should do about the
--enable-symvers=gnu-versioned-namespace configuration, maybe we
should move the soname for that option to libstdc++.so.8 and have
_GLIBCXX_USE_CXX11_ABI=1 and _GLIBCXX_DEFAULT_ABI_TAG= set always,
so that the versioned-namespace configuration always gets the new ABI
and doesn't need to use the tag (because using that configuration
already implies you're not interested in ABI compatibility). I'd
prefer not to have versioned-namespace-with-new-abi and
versioned-namespace-without-new-abi configurations, given that we don't
know if anyone's even using versioned namespaces for anything serious.

Tested x86_64-linux, with --disable-libstdcxx-cxx11-abi and without.
commit 160dfb8b15ca20581634c235c75293712072f622
Author: Jonathan Wakely 
Date:   Thu Aug 7 01:13:17 2014 +0100

	* acinclude.m4 (GLIBCXX_ENABLE_LIBSTDCXX_CXX11_ABI): Define.
	* configure.ac: Use GLIBCXX_ENABLE_LIBSTDCXX_CXX11_ABI.
	* configure: Regenerate.
	* include/Makefile.am (stamp-cxx11-abi): New target.
	(c++config.h): Set _GLIBCXX_USE_CXX11_ABI macro.
	* include/Makefile.in: Regenerate.
	* include/bits/c++config: Add _GLIBCXX_USE_CXX11_ABI placeholder and
	define _GLIBCXX_DEFAULT_ABI_TAG.
	* include/bits/list.tcc (list::emplace(const_iterator, _Args&...)):
	Increment size.
	(list::emplace(const_iterator, const value_type&)): Likewise.
	(list::merge(list&), list::merge(list&, _StrictWeakOrdering)): Adjust
	list sizes.
	* include/bits/stl_list.h (_List_base, list): Add ABI tag macro.
	(_List_base::_M_size): New data member in cxx11 ABI mode.
	(_List_base::_S_distance(_List_node_base*, _List_node_base*)): New
	function.
	(_List_base::_M_get_size(), _List_base::_M_set_size(size_t),
	_List_base::_M_inc_size(size_t), _List_base::_M_dec_size(size_t),
	_List_base::_M_distance, _List_base::_M_node_count): New functions for
	accessing list size correctly for the ABI mode.
	(_List_base::_List_base(_List_base&&)): Copy size and reset source.
	(_List_base::_M_init()): Initialize size member.
	(list::size()): Use _List_base::_M_node_count.
	(list::swap(list&)): Swap sizes.
	(list::splice(iterator, list&)): Update sizes.
	(list::splice(iterator, list&, iterator)): Likewise.
	(list::insert(iterator, const value_type&)): Update size.
	(list::insert(iterator, _Args&&...)): Likewise.
	(list::_M_erase(iterator)): Likewise.
	* testsuite/23_containers/list/requirements/dr438/assign_neg.cc:
	Adjust.
	* testsuite/23_containers/list/requirements/dr438/insert_neg.cc:
	Adjust.
	* testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc:
	Adjust.
	* testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc:
	Adjust.
	* testsuite/ext/profile/mutex_extensions_neg.cc: Adjust.

diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
index 2650a5a..0229609 100644
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -3831,6 +3831,25 @@ AC_DEFUN([GLIBCXX_CHECK_SDT_H], [
   AC_MSG_RESULT($glibcxx_cv_sys_sdt_h)
 ])
 
+dnl
+dnl Check if the user wants the new C++11-conforming ABI.
+dnl
+dnl --disable-libstdcxx-cxx11-abi will use old ABI for all types.
+dnl
+dnl Defines:
+dnl  _GLIBCXX_USE_ABI_TAG (always defined, either to 1 or 0)
+dnl
+AC_DEFUN([GLIBCXX_ENABLE_LIBSTDCXX_CXX11_ABI], [
+  AC_ARG_ENABLE([libstdcxx-cxx11-abi],
+AC_HELP_STRING([--disable-libstdcxx-cxx11-abi],
+		   [disable the C++11-conforming ABI]),,
+		   [enable_libstdcxx_cxx11_abi=yes])
+  if test x"$enable_libstdcxx_cxx11_abi" != xyes; then
+AC_MSG_NOTICE([C++11-conforming ABI is disabled])
+  fi
+  GLIBCXX_CONDITIONAL(ENABLE_CXX11_ABI, test $enable_libstdcxx_cxx11_abi = yes)
+])
+
 # Macros from the top-level gcc directory.
 m4_include([../config/gc++filt.m4])
 m4_include([../config/tls.m4])
diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac
index 1de0f6c..eb826e4 100644
--- a/libstdc++-v3/configure.ac
+++ b/libstdc++-v3/configure.ac
@@ -365,6 +365,8 @@ AC_SU

Re: [RFC, RFH PATCH, i386] Fix gcc.target/i386/pr61403.c FAIL with -mavx2

2014-10-03 Thread Uros Bizjak
On Fri, Oct 3, 2014 at 1:11 PM, Jakub Jelinek  wrote:
> On Thu, Oct 02, 2014 at 08:34:40PM +0200, Uros Bizjak wrote:
>> Index: i386.c
>> ===
>> --- i386.c  (revision 215802)
>> +++ i386.c  (working copy)
>> @@ -43407,8 +43407,10 @@ expand_vec_perm_pblendv (struct expand_vec_perm_d
>>   AVX and AVX2 as they require more than 2 instructions.  */
>>if (d->one_operand_p)
>>  return false;
>> -  if (TARGET_SSE4_1 && GET_MODE_SIZE (vmode) == 16)
>> +  if (TARGET_AVX2 && GET_MODE_SIZE (vmode) == 32)
>>  ;
>> +  else if (TARGET_SSE4_1 && GET_MODE_SIZE (vmode) == 16)
>> +;
>>else
>>  return false;
>>
>> --cut here--
>>
>> The comment above expand_vec_perm_pblendv claims that:
>>
>>   /* Use the same checks as in expand_vec_perm_blend, but skipping
>>  AVX and AVX2 as they require more than 2 instructions.  */
>
> The comment is mostly right though, I'd say "as they sometimes require
> more than 2 instructions".
>
>> BTW: I have no access to avx2 target, so I can't test the patch with a
>> runtime tests. OTOH, it doesn't ICE for "GCC_TEST_RUN_EXPENSIVE=1 make
>> check-gcc RUNTESTFLAGS='--target_board=unix/-mavx2
>> dg-torture.exp=vshuf*.c'".
>
> Even the expensive testsuite has very limited coverage.
> As I wanted to prove your patch will ICE, I wrote following generator:
>
> #ifndef ITYPE
> #define ITYPE TYPE
> #endif
> #define S2(X) #X
> #define S(X) S2(X)
>
> int
> main ()
> {
>   int i, j, nelt = 32 / sizeof (TYPE);
>   printf (
> "typedef " S(TYPE) " V __attribute__ ((vector_size (32)));\n"
> "typedef " S(ITYPE) " VI __attribute__ ((vector_size (32)));\n"
> "V a, b, c;\n"
> "\n"
> "#define T(n, m...) void foo##n (void) { c = __builtin_shuffle (a, b, (VI) 
> m); }\n"
> "#define S(n, m...) T(n, m)\n");
>   for (i = 0; i < 10; i++)
> {
>   printf ("S (__LINE__, { ");
>   for (j = 0; j < nelt; j++)
> {
>   int k = random () & 3;
>   int v = j;
>   if (k & 1)
> v = ((k & 2) ? nelt : 0) + (random () & (nelt - 1));
>   printf ("%d%s", v, j < (nelt - 1) ? ", " : " })\n");
> }
> }
> }
>
> which can be compiled e.g. with
> -DTYPE=char
> -DTYPE=short
> -DTYPE=int
> -DTYPE=long
> -DTYPE=float -DITYPE=int
> -DTYPE=double -DITYPE=long
> and then in each case generate 10 tests (sort -u on it plus manual fixup
> can decrease that, for the V4DI/V4DF cases substantially).  The first one
> triggered almost immediately an ICE, added to vshuf-32.inc (non-expensive).
>
> With the following updated patch all those generated testcases don't ICE
> (-mavx2 for the first four, -mavx for the last two).
>
> Also tested with
> GCC_TEST_RUN_EXPENSIVE=1 make check-gcc 
> RUNTESTFLAGS='--target_board=unix/-mavx2 dg-torture.exp=vshuf*.c'

I have had some problems testing with TARGET_AVX part of the change
and /-mavx tests. I assume that your patch survives these tests.
>
> The pr61403.c testcase can be simplified into:
> typedef float V __attribute__ ((vector_size (32)));
> typedef int VI __attribute__ ((vector_size (32)));
> V a, b, c;
>
> #define T(n, m...) void foo##n (void) { c = __builtin_shuffle (a, b, (VI) m); 
> }
> T (0, { 0, 1, 2, 3, 4, 5, 10, 13 })
> T (1, { 0, 1, 2, 3, 4, 8, 11, 14 })
> T (2, { 0, 1, 2, 3, 4, 9, 12, 15 })
> T (3, { 0, 13, 2, 3, 14, 5, 6, 15 })
> T (4, { 0, 1, 8, 3, 4, 9, 6, 7 })
> T (5, { 0, 3, 11, 0, 4, 12, 0, 5 })
> T (6, { 0, 3, 6, 9, 12, 15, 0, 0 })
> T (7, { 0, 8, 0, 1, 9, 0, 2, 10 })
> T (8, { 10, 1, 2, 11, 4, 5, 12, 7 })
> T (9, { 13, 0, 6, 14, 0, 7, 15, 0 })
> T (10, { 1, 4, 7, 10, 13, 0, 0, 0 })
> T (11, { 2, 5, 8, 11, 14, 0, 0, 0 })
> permutations, where both your and my patch optimize
> foo{0,1,2,3,4,8}.
>
> 2014-10-03  Jakub Jelinek  
> Uros Bizjak  
>
> PR tree-optimization/61403
> * config/i386/i386.c (expand_vec_perm_palignr): Fix a spelling
> error in comment.  Also optimize 256-bit vectors for AVX2
> or AVX (floating vectors only), provided the first permutation
> can be performed in one insn.
>
> * gcc.dg/torture/vshuf-32.inc: Add a new test 29.

OK if the patch bootstraps and regtests without problems.

Thanks,
Uros.


[PATCH] gcc.dg/gomp/ cleanup

2014-10-03 Thread Marek Polacek
This patch is a cleanup of tests in gcc.dg/gomp/ directory.
See https://gcc.gnu.org/ml/gcc-patches/2014-09/msg02656.html for more info.

Tested on x86_64-linux: vanilla results == results with this patch ==
results with this patch and gnu11 as a default.

Applying to trunk.

2014-10-03  Marek Polacek  

* gcc.dg/gomp/appendix-a/a.35.4.c: Fix implicit declarations.
* gcc.dg/gomp/appendix-a/a.35.5.c: Likewise.
* gcc.dg/gomp/appendix-a/a.35.6.c: Likewise.
* gcc.dg/gomp/asm-1.c: Likewise.
* gcc.dg/gomp/for-1.c: Likewise.
* gcc.dg/gomp/empty.c: Fix defaulting to int.
* gcc.dg/gomp/sharing-3.c: Likewise.
* gcc.dg/gomp/udr-3.c: Use -std=gnu89.

diff --git gcc/gcc/testsuite/gcc.dg/gomp/appendix-a/a.35.4.c 
gcc/gcc/testsuite/gcc.dg/gomp/appendix-a/a.35.4.c
index 5bb6b80..8562fca 100644
--- gcc/gcc/testsuite/gcc.dg/gomp/appendix-a/a.35.4.c
+++ gcc/gcc/testsuite/gcc.dg/gomp/appendix-a/a.35.4.c
@@ -1,5 +1,7 @@
 /* { dg-do compile } */
 
+void work (int, int);
+
 void
 wrong4 (int n)
 {
diff --git gcc/gcc/testsuite/gcc.dg/gomp/appendix-a/a.35.5.c 
gcc/gcc/testsuite/gcc.dg/gomp/appendix-a/a.35.5.c
index 7b4aee1..90d2966 100644
--- gcc/gcc/testsuite/gcc.dg/gomp/appendix-a/a.35.5.c
+++ gcc/gcc/testsuite/gcc.dg/gomp/appendix-a/a.35.5.c
@@ -1,5 +1,7 @@
 /* { dg-do compile } */
 
+void work (int, int);
+
 void
 wrong5 (int n)
 {
diff --git gcc/gcc/testsuite/gcc.dg/gomp/appendix-a/a.35.6.c 
gcc/gcc/testsuite/gcc.dg/gomp/appendix-a/a.35.6.c
index d18188b..6260be7 100644
--- gcc/gcc/testsuite/gcc.dg/gomp/appendix-a/a.35.6.c
+++ gcc/gcc/testsuite/gcc.dg/gomp/appendix-a/a.35.6.c
@@ -1,5 +1,7 @@
 /* { dg-do compile } */
 
+void work (int, int);
+
 void
 wrong6 (int n)
 {
diff --git gcc/gcc/testsuite/gcc.dg/gomp/asm-1.c 
gcc/gcc/testsuite/gcc.dg/gomp/asm-1.c
index ced31f3..2b428c0 100644
--- gcc/gcc/testsuite/gcc.dg/gomp/asm-1.c
+++ gcc/gcc/testsuite/gcc.dg/gomp/asm-1.c
@@ -2,6 +2,8 @@
 /* { dg-do compile } */
 /* { dg-options "-O2 -fopenmp" } */
 
+extern int omp_get_thread_num (void);
+
 void
 foo (void)
 {
diff --git gcc/gcc/testsuite/gcc.dg/gomp/empty.c 
gcc/gcc/testsuite/gcc.dg/gomp/empty.c
index 6a21c04..c7aba8f 100644
--- gcc/gcc/testsuite/gcc.dg/gomp/empty.c
+++ gcc/gcc/testsuite/gcc.dg/gomp/empty.c
@@ -1,6 +1,7 @@
 /* { dg-do compile } */
 /* { dg-options "-O -fopenmp -fdump-tree-ompexp" } */
 
+int
 main()
 {
 #pragma omp parallel
diff --git gcc/gcc/testsuite/gcc.dg/gomp/for-1.c 
gcc/gcc/testsuite/gcc.dg/gomp/for-1.c
index 384293e..80e0d0b 100644
--- gcc/gcc/testsuite/gcc.dg/gomp/for-1.c
+++ gcc/gcc/testsuite/gcc.dg/gomp/for-1.c
@@ -1,6 +1,8 @@
 /* { dg-do compile } */
 /* { dg-options "-fopenmp -fshow-column" } */
 
+void baz (int);
+
 void foo (int j, int k)
 {
   int i;
diff --git gcc/gcc/testsuite/gcc.dg/gomp/sharing-3.c 
gcc/gcc/testsuite/gcc.dg/gomp/sharing-3.c
index 36f72e3..4a30198 100644
--- gcc/gcc/testsuite/gcc.dg/gomp/sharing-3.c
+++ gcc/gcc/testsuite/gcc.dg/gomp/sharing-3.c
@@ -3,6 +3,7 @@
 #define N   50
 #define CHUNKSIZE   5
 
+int
 main ()
 {
   int i, chunk;
diff --git gcc/gcc/testsuite/gcc.dg/gomp/udr-3.c 
gcc/gcc/testsuite/gcc.dg/gomp/udr-3.c
index bdfcce1..96450cd 100644
--- gcc/gcc/testsuite/gcc.dg/gomp/udr-3.c
+++ gcc/gcc/testsuite/gcc.dg/gomp/udr-3.c
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-fopenmp" } */
+/* { dg-options "-fopenmp -std=gnu89" } */
 
 struct S { int s; };
 struct T { int t; };

Marek


Re: [RFC, RFH PATCH, i386] Fix gcc.target/i386/pr61403.c FAIL with -mavx2

2014-10-03 Thread Jakub Jelinek
On Thu, Oct 02, 2014 at 08:34:40PM +0200, Uros Bizjak wrote:
> Index: i386.c
> ===
> --- i386.c  (revision 215802)
> +++ i386.c  (working copy)
> @@ -43407,8 +43407,10 @@ expand_vec_perm_pblendv (struct expand_vec_perm_d
>   AVX and AVX2 as they require more than 2 instructions.  */
>if (d->one_operand_p)
>  return false;
> -  if (TARGET_SSE4_1 && GET_MODE_SIZE (vmode) == 16)
> +  if (TARGET_AVX2 && GET_MODE_SIZE (vmode) == 32)
>  ;
> +  else if (TARGET_SSE4_1 && GET_MODE_SIZE (vmode) == 16)
> +;
>else
>  return false;
> 
> --cut here--
> 
> The comment above expand_vec_perm_pblendv claims that:
> 
>   /* Use the same checks as in expand_vec_perm_blend, but skipping
>  AVX and AVX2 as they require more than 2 instructions.  */

The comment is mostly right though, I'd say "as they sometimes require
more than 2 instructions".

> BTW: I have no access to avx2 target, so I can't test the patch with a
> runtime tests. OTOH, it doesn't ICE for "GCC_TEST_RUN_EXPENSIVE=1 make
> check-gcc RUNTESTFLAGS='--target_board=unix/-mavx2
> dg-torture.exp=vshuf*.c'".

Even the expensive testsuite has very limited coverage.
As I wanted to prove your patch will ICE, I wrote following generator:

#ifndef ITYPE
#define ITYPE TYPE
#endif
#define S2(X) #X
#define S(X) S2(X)

int
main ()
{
  int i, j, nelt = 32 / sizeof (TYPE);
  printf (
"typedef " S(TYPE) " V __attribute__ ((vector_size (32)));\n"
"typedef " S(ITYPE) " VI __attribute__ ((vector_size (32)));\n"
"V a, b, c;\n"
"\n"
"#define T(n, m...) void foo##n (void) { c = __builtin_shuffle (a, b, (VI) m); 
}\n"
"#define S(n, m...) T(n, m)\n");
  for (i = 0; i < 10; i++)
{
  printf ("S (__LINE__, { ");
  for (j = 0; j < nelt; j++)
{
  int k = random () & 3;
  int v = j;
  if (k & 1)
v = ((k & 2) ? nelt : 0) + (random () & (nelt - 1));
  printf ("%d%s", v, j < (nelt - 1) ? ", " : " })\n");
}
}
}

which can be compiled e.g. with
-DTYPE=char
-DTYPE=short
-DTYPE=int
-DTYPE=long
-DTYPE=float -DITYPE=int
-DTYPE=double -DITYPE=long
and then in each case generate 10 tests (sort -u on it plus manual fixup
can decrease that, for the V4DI/V4DF cases substantially).  The first one
triggered almost immediately an ICE, added to vshuf-32.inc (non-expensive).

With the following updated patch all those generated testcases don't ICE
(-mavx2 for the first four, -mavx for the last two).

Also tested with
GCC_TEST_RUN_EXPENSIVE=1 make check-gcc 
RUNTESTFLAGS='--target_board=unix/-mavx2 dg-torture.exp=vshuf*.c'

The pr61403.c testcase can be simplified into:
typedef float V __attribute__ ((vector_size (32)));
typedef int VI __attribute__ ((vector_size (32)));
V a, b, c;

#define T(n, m...) void foo##n (void) { c = __builtin_shuffle (a, b, (VI) m); }
T (0, { 0, 1, 2, 3, 4, 5, 10, 13 })
T (1, { 0, 1, 2, 3, 4, 8, 11, 14 })
T (2, { 0, 1, 2, 3, 4, 9, 12, 15 })
T (3, { 0, 13, 2, 3, 14, 5, 6, 15 })
T (4, { 0, 1, 8, 3, 4, 9, 6, 7 })
T (5, { 0, 3, 11, 0, 4, 12, 0, 5 })
T (6, { 0, 3, 6, 9, 12, 15, 0, 0 })
T (7, { 0, 8, 0, 1, 9, 0, 2, 10 })
T (8, { 10, 1, 2, 11, 4, 5, 12, 7 })
T (9, { 13, 0, 6, 14, 0, 7, 15, 0 })
T (10, { 1, 4, 7, 10, 13, 0, 0, 0 })
T (11, { 2, 5, 8, 11, 14, 0, 0, 0 })
permutations, where both your and my patch optimize
foo{0,1,2,3,4,8}.

2014-10-03  Jakub Jelinek  
Uros Bizjak  

PR tree-optimization/61403
* config/i386/i386.c (expand_vec_perm_palignr): Fix a spelling
error in comment.  Also optimize 256-bit vectors for AVX2
or AVX (floating vectors only), provided the first permutation
can be performed in one insn.

* gcc.dg/torture/vshuf-32.inc: Add a new test 29.

--- gcc/config/i386/i386.c.jj   2014-10-03 09:26:14.0 +0200
+++ gcc/config/i386/i386.c  2014-10-03 12:39:24.040185310 +0200
@@ -43422,7 +43422,7 @@ expand_vec_perm_palignr (struct expand_v
 
 /* A subroutine of ix86_expand_vec_perm_const_1.  Try to simplify
the permutation using the SSE4_1 pblendv instruction.  Potentially
-   reduces permutaion from 2 pshufb and or to 1 pshufb and pblendv.  */
+   reduces permutation from 2 pshufb and or to 1 pshufb and pblendv.  */
 
 static bool
 expand_vec_perm_pblendv (struct expand_vec_perm_d *d)
@@ -43432,11 +43432,14 @@ expand_vec_perm_pblendv (struct expand_v
   enum machine_mode vmode = d->vmode;
   bool ok;
 
-  /* Use the same checks as in expand_vec_perm_blend, but skipping
- AVX and AVX2 as they require more than 2 instructions.  */
+  /* Use the same checks as in expand_vec_perm_blend.  */
   if (d->one_operand_p)
 return false;
-  if (TARGET_SSE4_1 && GET_MODE_SIZE (vmode) == 16)
+  if (TARGET_AVX2 && GET_MODE_SIZE (vmode) == 32)
+;
+  else if (TARGET_AVX && (vmode == V4DFmode || vmode == V8SFmode))
+;
+  else if (TARGET_SSE4_1 && GET_MODE_SIZE (vmode) == 16)
 ;
   else
 return false;
@@ -43458,7 +

Re: [PATCH i386 AVX512] [62/n] Add vpmaddubsw,vdbpsadbw insn patterns.

2014-10-03 Thread Uros Bizjak
On Fri, Oct 3, 2014 at 1:03 PM, Kirill Yukhin  wrote:
> Hello Uroš,
> On 29 Sep 10:08, Uros Bizjak wrote:
>> On Fri, Sep 26, 2014 at 4:09 PM, Kirill Yukhin  
>> wrote:
>> > +(define_insn "avx512bw_pmaddubsw512"
>> > +  [(set (match_operand:VI2_AVX512VL 0 "register_operand" "=v")
>> > +  (unspec:VI2_AVX512VL
>> > +[(match_operand: 1 "register_operand" "v")
>> > + (match_operand: 2 "nonimmediate_operand" "vm")]
>> > + UNSPEC_PMADDUBSW512))]
>> > +   "TARGET_AVX512BW"
>> > +   "vpmaddubsw\t{%2, %1, %0|%0, %1, %2}";
>> > +  [(set_attr "type" "sseiadd")
>> > +   (set_attr "prefix" "evex")
>> > +   (set_attr "mode" "XI")])
>> > +
>> Can the one above be described using standard RTX, perhaps something
>> similar to avx2_pmaddubsw256?
> Definetely, it can. We didn't do that because final pattern will be
> twice as long as 256-bit variant resulting to 96 (!) lines and I think
> in near future auto-vect won't pick MADD at all.
> But if you think that it will be better to have explicit RTX, I ready to do 
> that!

Uh, no. Let's be reasonable, and put only a comment explaining the
situation, as in case of _psadbw.

Uros.


  1   2   >