Re: PATCH: PR target/50603: [x32] Unnecessary lea

2011-10-07 Thread Uros Bizjak
On Thu, Oct 6, 2011 at 11:33 PM, H.J. Lu  wrote:

>>> OTOH, x86_64 and i686 targets can also benefit from this change. If
>>> combine can't create more complex address (covered by lea), then it
>>> will simply propagate memory operand back into the add insn. It looks
>>> to me that we can't loose here, so:
>>>
>>>  /* Improve address combine.  */
>>>  if (code == PLUS && MEM_P (src2))
>>>    src2 = force_reg (mode, src2);
>>>
>>> Any opinions?
>>>
>>
>> It doesn't work with 64bit libstdc++:
>
> Yeah, yeah. ix86_output_mi_thunk has some ...  issues.
>
> Please try attached patch that introduces ix86_emit_binop and uses it
> in a bunch of places.
>>>
 I tried it on GCC.  There are no regressions.  The bugs are fixed for x32.
 Here are size comparison with GCC runtime libraries on ia32, x32 and
 x86-64:
>>>
  884093   18600   27064  929757   e2fdd old libstdc++.so
  884189   18600   27064  929853   e303d new libs/libstdc++.so

 The new code is

 mov    0xc(%edi),%eax
 mov    %eax,0x8(%esi)
 mov    -0xc(%eax),%eax
 mov    0x10(%edi),%edx
 lea    0x8(%esi,%eax,1),%eax

 The old one is

 mov    0xc(%edi),%edx
 lea    0x8(%esi),%eax
 mov    %edx,0x8(%esi)
 add    -0xc(%edx),%eax
 mov    0x10(%edi),%edx
>>>
>>> The new code merged lea+add into one lea, so it looks quite OK to me.
>>>
>>> Do you have some performance numbers?
>>>
>>
>> I will report performance numbers in a few days.
>
> The differences in SPEC CPU 2006 on ia32, x86-64 and
> x32 are within noise range.

Great.

Attached is a slightly updated patch, where we consider only
integer-mode PLUS RTXes.

2011-10-07  Uros Bizjak  
H.J. Lu  

PR target/50603
* config/i386/i386.c (ix86_fixup_binary_operands): Force src2 of
integer PLUS RTX to a register to improve address combine.

testsuite/ChangeLog:

2011-10-07  Uros Bizjak  
H.J. Lu  

PR target/50603
* gcc.target/i386/pr50603.c: New test.

Tested on x86_64-pc-linux-gnu {,-m32}, committed to mainline SVN.

Uros.
Index: config/i386/i386.c
===
--- config/i386/i386.c  (revision 179645)
+++ config/i386/i386.c  (working copy)
@@ -15798,6 +15798,12 @@ ix86_fixup_binary_operands (enum rtx_code code, en
   if (MEM_P (src1) && !rtx_equal_p (dst, src1))
 src1 = force_reg (mode, src1);
 
+  /* Improve address combine.  */
+  if (code == PLUS
+  && GET_MODE_CLASS (mode) == MODE_INT
+  && MEM_P (src2))
+src2 = force_reg (mode, src2);
+
   operands[1] = src1;
   operands[2] = src2;
   return dst;
Index: testsuite/gcc.target/i386/pr50603.c
===
--- testsuite/gcc.target/i386/pr50603.c (revision 0)
+++ testsuite/gcc.target/i386/pr50603.c (revision 0)
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+extern int *foo;
+
+int
+bar (int x)
+{
+  return foo[x];
+}
+/* { dg-final { scan-assembler-not "lea\[lq\]" } } */


Re: [Patch, fortran] PR47844 - Array stride ignored for pointer-valued function results

2011-10-07 Thread Paul Richard Thomas
Dear Steve,

Thanks - I just noticed that the { dg-do run } is missing a space.  It
seemed to run correctly during regtesting but I will set it right
anyway.

Cheers

Paul

On Fri, Oct 7, 2011 at 1:29 AM, Steve Kargl
 wrote:
> On Thu, Oct 06, 2011 at 10:22:12PM +0200, Paul Richard Thomas wrote:
>>
>> 2011-10-06  Paul Thomas  
>>
>>       PR fortran/47844
>>       * trans-array.c (gfc_conv_array_index_offset): Use descriptor
>>       stride for pointer function results.
>>
>> 2011-10-06  Paul Thomas  
>>
>>       PR fortran/47844
>>       * gfortran.dg/pointer_function_result_1.f90 : New test.
>
> OK.
>
> --
> Steve
>



-- 
The knack of flying is learning how to throw yourself at the ground and miss.
       --Hitchhikers Guide to the Galaxy


Re: [RFC] split2 vs df

2011-10-07 Thread Paolo Bonzini

On 10/07/2011 12:15 AM, Richard Henderson wrote:


diff --git a/gcc/recog.c b/gcc/recog.c
index d3ecb73..e0557c5 100644
--- a/gcc/recog.c
+++ b/gcc/recog.c
@@ -3769,20 +3769,33 @@ struct rtl_opt_pass pass_split_all_insns =
  static unsigned int
  rest_of_handle_split_after_reload (void)
  {
-  /* If optimizing, then go ahead and split insns now.  */
-#ifndef STACK_REGS
-  if (optimize>  0)
-#endif
-split_all_insns ();
+  df_live_add_problem ();
+  df_set_flags (DF_DEFER_INSN_RESCAN);
+
+  split_all_insns ();
+  df_analyze ();
+
return 0;
  }



Setting TODO_df_finish (and perhaps TODO_df_verify) should be enough. 
The idea is:


   df_finish_pass calls df_process_deferred_rescans ->
  calls df_bb_refs_record and df_insn_rescan ->
  calls df_set_bb_dirty ->
  sets df_lr->out_of_date_transfer_functions

and this in turn skips the verification when that would fail.

Paolo


Re: New warning for expanded vector operations

2011-10-07 Thread Artem Shinkarov
On Fri, Oct 7, 2011 at 6:22 AM, Artem Shinkarov
 wrote:
> On Wed, Oct 5, 2011 at 12:35 PM, Richard Guenther
>  wrote:
>> On Wed, Oct 5, 2011 at 1:28 PM, Artem Shinkarov
>>  wrote:
>>> On Wed, Oct 5, 2011 at 9:40 AM, Richard Guenther
>>>  wrote:
 On Wed, Oct 5, 2011 at 12:18 AM, Artem Shinkarov
  wrote:
> Hi
>
> Here is a patch to inform a programmer about the expanded vector 
> operation.
> Bootstrapped on x86-unknown-linux-gnu.
>
> ChangeLog:
>
>        * gcc/tree-vect-generic.c (expand_vector_piecewise): Adjust to
>          produce the warning.
>          (expand_vector_parallel): Adjust to produce the warning.

 Entries start without gcc/, they are relative to the gcc/ChangeLog file.
>>>
>>> Sure, sorry.
>>>
>          (lower_vec_shuffle): Adjust to produce the warning.
>        * gcc/common.opt: New warning Wvector-operation-expanded.
>        * gcc/doc/invoke.texi: Document the wawning.
>
>
> Ok?

 I don't like the name -Wvector-operation-expanded.  We emit a
 similar warning for missed inline expansions with -Winline, so
 maybe -Wvector-extensions (that's the name that appears
 in the C extension documentation).
>>>
>>> Hm, I don't care much about the name, unless it gets clear what the
>>> warning is used for.  I am not really sure that Wvector-extensions
>>> makes it clear.  Also, I don't see anything bad if the warning will
>>> pop up during the vectorisation. Any vector operation performed
>>> outside the SIMD accelerator looks suspicious, because it actually
>>> doesn't improve performance.  Such a warning during the vectorisation
>>> could mean that a programmer forgot some flag, or the constant
>>> propagation failed to deliver a constant, or something else.
>>>
>>> Conceptually the text I am producing is not really a warning, it is
>>> more like an information, but I am not aware of the mechanisms that
>>> would allow me to introduce a flag triggering inform () or something
>>> similar.
>>>
>>> What I think we really need to avoid is including this warning in the
>>> standard Ox.
>>>
 +  location_t loc = gimple_location (gsi_stmt (*gsi));
 +
 +  warning_at (loc, OPT_Wvector_operation_expanded,
 +             "vector operation will be expanded piecewise");

   v = VEC_alloc(constructor_elt, gc, (nunits + delta - 1) / delta);
   for (i = 0; i < nunits;
 @@ -260,6 +264,10 @@ expand_vector_parallel (gimple_stmt_iter
   tree result, compute_type;
   enum machine_mode mode;
   int n_words = tree_low_cst (TYPE_SIZE_UNIT (type), 1) / UNITS_PER_WORD;
 +  location_t loc = gimple_location (gsi_stmt (*gsi));
 +
 +  warning_at (loc, OPT_Wvector_operation_expanded,
 +             "vector operation will be expanded in parallel");

 what's the difference between 'piecewise' and 'in parallel'?
>>>
>>> Parallel is a little bit better for performance than piecewise.
>>
>> I see.  That difference should probably be documented, maybe with
>> an example.
>>
>> Richard.
>>
 @@ -301,16 +309,15 @@ expand_vector_addition (gimple_stmt_iter
  {
   int parts_per_word = UNITS_PER_WORD
                       / tree_low_cst (TYPE_SIZE_UNIT (TREE_TYPE (type)), 
 1);
 +  location_t loc = gimple_location (gsi_stmt (*gsi));

   if (INTEGRAL_TYPE_P (TREE_TYPE (type))
       && parts_per_word >= 4
       && TYPE_VECTOR_SUBPARTS (type) >= 4)
 -    return expand_vector_parallel (gsi, f_parallel,
 -                                  type, a, b, code);
 +    return expand_vector_parallel (gsi, f_parallel, type, a, b, code);
   else
 -    return expand_vector_piecewise (gsi, f,
 -                                   type, TREE_TYPE (type),
 -                                   a, b, code);
 +    return expand_vector_piecewise (gsi, f, type,
 +                                   TREE_TYPE (type), a, b, code);
  }

  /* Check if vector VEC consists of all the equal elements and

 unless i miss something loc is unused here.  Please avoid random
 whitespace changes (just review your patch yourself before posting
 and revert pieces that do nothing).
>>>
>>> Yes you are right, sorry.
>>>
 +@item -Wvector-operation-expanded
 +@opindex Wvector-operation-expanded
 +@opindex Wno-vector-operation-expanded
 +Warn if vector operation is not implemented via SIMD capabilities of the
 +architecture. Mainly useful for the performance tuning.

 I'd mention that this is for vector operations as of the C extension
 documented in "Vector Extensions".

 The vectorizer can produce some operations that will need further
 lowering - we probably should make sure to _not_ warn about those.
 Try running the vect.exp testsuite with the new warning turned on
 (eventually disabling SSE), like with

 obj/gcc> make check-gcc
 RUNTESTFLAG

Re: [C++ Patch] PR 38980

2011-10-07 Thread Jason Merrill
Instead of adding the parameter, let's have the C++ front end call a 
different function that doesn't try to pull out the value from aggregate 
variables, like C has decl_constant_value_for_optimization.


Jason


Re: [PATCH] Fix PR46556 (poor address generation)

2011-10-07 Thread Richard Guenther
On Thu, 6 Oct 2011, William J. Schmidt wrote:

> On Thu, 2011-10-06 at 16:16 +0200, Richard Guenther wrote:
> 
> 
> 
> > 
> > Doh, I thought you were matching gimple stmts that do the address
> > computation.  But now I see you are matching the tree returned from
> > get_inner_reference.  So no need to check anything for that case.
> > 
> > But that keeps me wondering what you'll do if the accesses were
> > all pointer arithmetic, not arrays.  Thus,
> > 
> > extern void foo (int, int, int);
> > 
> > void
> > f (int *p, unsigned int n)
> > {
> >  foo (p[n], p[n+64], p[n+128]);
> > }
> > 
> > wouldn't that have the same issue and you wouldn't handle it?
> > 
> > Richard.
> > 
> 
> Good point.  This indeed gets missed here, and that's more fuel for
> doing a generalized strength reduction along with the special cases like
> p->a[n] that are only exposed with get_inner_reference.
> 
> (The pointer arithmetic cases were picked up in my earlier "big-hammer"
> approach using the aff-comb machinery, but that had too many problems in
> the end, as you know.)

Yeah, I know.  It's a very tricky area ;)

> So for the long term I will look into a full strength reducer for
> non-loop code.  For the short term, what do you think about keeping this
> single transformation in reassoc to make sure it gets into 4.7?  I would
> plan to strip it back out and fold it into the strength reducer
> thereafter, which might or might not make 4.7 depending on my other
> responsibilities and how the 4.7 schedule goes.  I haven't seen anything
> official, but I'm guessing we're getting towards the end of 4.7 stage 1?

It's a reasonable plan - you'd have to introduce a late reassoc
pass though.  Can you separate out the RTL fwprop changes?  So
we can iterate over the tree parts separately.

Thanks,
Richard.


Re: [PATCH] Fix PR46556 (poor address generation)

2011-10-07 Thread Richard Guenther
On Thu, 6 Oct 2011, Jeff Law wrote:

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
> 
> On 10/06/11 04:13, Richard Guenther wrote:
> 
> > 
> > People have already commented on pieces, so I'm looking only at the
> > tree-ssa-reassoc.c pieces (did you consider piggy-backing on IVOPTs
> > instead?  The idea is to expose additional CSE opportunities,
> > right?  So it's sort-of a strength-reduction optimization on scalar
> > code (classically strength reduction in loops transforms for (i) {
> > z = i*x; } to z = 0; for (i) { z += x }). That might be worth in
> > general, even for non-address cases. So - if you rename that thing
> > to tree-ssa-strength-reduce.c you can get away without
> > piggy-backing on anything ;)  If you structure it to detect a
> > strength reduction opportunity (thus, you'd need to match
> > two/multiple of the patterns at the same time) that would be a
> > bonus ... generalizing it a little bit would be another.
> There's a variety of literature that uses PRE to detect and optimize
> straightline code strength reduction.  I poked at it at one time (RTL
> gcse framework) and it looked reasonably promising.  Never pushed it
> all the way through.

I poked at it in the tree PRE framework at some point but never
pushed it through either.  At least it didn't feel like it "fits" PRE
(and PRE should also be able to handle the loop case).

Richard.


[PATCH] Fix PR50637

2011-10-07 Thread Richard Guenther

Committed.

Richard.

2011-10-07  Richard Guenther  

PR testsuite/50637
* gcc.dg/vect/vect-align-2.c: Increase array size.

Index: gcc/testsuite/gcc.dg/vect/vect-align-2.c
===
--- gcc/testsuite/gcc.dg/vect/vect-align-2.c(revision 179647)
+++ gcc/testsuite/gcc.dg/vect/vect-align-2.c(working copy)
@@ -15,7 +15,7 @@ struct foo {
 } __attribute__ ((packed));
 
 struct foo f2;
-int z[16] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
+int z[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16};
 
 __attribute__ ((noinline))
 void fbar(struct foo *fp)


Re: [testsuite] Don't XFAIL gcc.dg/uninit-B.c etc. (PR middle-end/50125)

2011-10-07 Thread Richard Guenther
On Thu, Oct 6, 2011 at 5:57 PM, Rainer Orth  
wrote:
> After almost two months, two tests are still XPASSing everywhere:
>
> XPASS: gcc.dg/uninit-B.c uninit i warning (test for warnings, line 12)
> XPASS: gcc.dg/uninit-pr19430.c  (test for warnings, line 32)
> XPASS: gcc.dg/uninit-pr19430.c uninitialized (test for warnings, line 41)
>
> I think it's time to remove the xfail's.
>
> Tested with the appropriate runtest invocation on i386-pc-solaris2.10,
> ok for mainline?

Ok

Thanks,
Richard.

>        Rainer
>
>
> 2011-10-06  Rainer Orth  
>
>        PR middle-end/50125
>        * gcc.dg/uninit-B.c (baz): Remove xfail *-*-*.
>        * gcc.dg/uninit-pr19430.c (main): Remove xfail *-*-*.
>        (bar3): Likewise.
>
>
>
>
> --
> -
> Rainer Orth, Center for Biotechnology, Bielefeld University
>
>


Re: Builtin infrastructure change

2011-10-07 Thread Richard Guenther
On Fri, Oct 7, 2011 at 12:49 AM, Michael Meissner
 wrote:
> On Thu, Oct 06, 2011 at 10:44:03AM -0400, Michael Meissner wrote:
>> On Thu, Oct 06, 2011 at 03:23:07PM +0200, Tobias Burnus wrote:
>> > On 10/06/2011 03:02 PM, Michael Meissner wrote:
>> > >On the x86 (with Fedora 13), I built and tested the C, C++, Objective C, 
>> > >Java, Ada,
>> > >and Go languages with no regressions
>> >
>> > >On a power6 box with RHEL 6.1, I
>> > >have done the same for C, C++, Objective C, Java, and Ada languages with 
>> > >no
>> > >regressions.
>> >
>> > Any reason for not building and testing Fortran? Especially as you
>> > patch gcc/fortran/{trans*.c,f95-lang.c}?
>> >
>> > Tobias
>>
>> Brain fault on my part.  I tested the previous set of patches with Fortran.
>> Since I had to explicitly add the languages to pick up Ada and Go, I seemed 
>> to
>> have dropped Fortran.  Sigh.  Sorry about that.  I just started the powerpc
>> bootstrap, since that is a lot faster.
>
> I'm enclosing the revised patches that now provides the Fortran fixes as well.
> It passes bootstrap and make check on powerpc64-linux based on subversion id
> 179514.  The current top of the tree doesn't bootstrap on x86 if I build go 
> due
> to an issue with shrinkwrapping and split stack.

Ok.

Thanks,
Richard.


Re: [PATCH] Fix PR46556 (poor address generation)

2011-10-07 Thread Paolo Bonzini

On 10/07/2011 10:00 AM, Richard Guenther wrote:

It's a reasonable plan - you'd have to introduce a late reassoc
pass though.  Can you separate out the RTL fwprop changes?  So
we can iterate over the tree parts separately.


That's indeed better, also because they became CSE changes.

Paolo


Re: [Patch] Support DEC-C extensions

2011-10-07 Thread Tristan Gingold

On Oct 6, 2011, at 4:12 PM, Joseph S. Myers wrote:

> On Thu, 6 Oct 2011, Tristan Gingold wrote:
> 
>> So the consensus is for a dedicated option.  Which one do you prefer ?
>> 
>> -funnamed-variadic-parameter
>> -fpointless-variadic-functions
>> -fallow-parameterless-variadic-functions
> 
> I prefer -fallow-parameterless-variadic-functions.

Here is my patch with the option renamed.

Ok for trunk ?

Bootstrapped on x86_64/Darwin, va-arg retested.

Tristan.

2011-09-29  Tristan Gingold  

* doc/invoke.texi: Document -fallow-parameterless-variadic-functions.
* c-parser.c (c_parser_parms_list_declarator): Handle it.

gcc/c-family/ChangeLog
2011-09-29  Tristan Gingold  

* c.opt (fallow-parameterless-variadic-functions): New.

gcc/testsuite/ChangeLog
2011-09-29  Tristan Gingold  

* gcc.dg/va-arg-4.c: New test.
* gcc.dg/va-arg-5.c: Ditto.


diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
index e6ac5dc..79287c4 100644
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
@@ -700,6 +700,10 @@ Enforce class member access control semantics
 fall-virtual
 C++ ObjC++ Ignore Warn(switch %qs is no longer supported)
 
+fallow-parameterless-variadic-functions
+C ObjC Var(flag_allow_parameterless_variadic_functions)
+Allow variadic functions without named parameter
+
 falt-external-templates
 C++ ObjC++ Ignore Warn(switch %qs is no longer supported)
 No longer supported
diff --git a/gcc/c-parser.c b/gcc/c-parser.c
index ff376df..0ca0f04 100644
--- a/gcc/c-parser.c
+++ b/gcc/c-parser.c
@@ -3159,10 +3159,19 @@ c_parser_parms_list_declarator (c_parser *parser, tree 
attrs, tree expr)
   if (c_parser_next_token_is (parser, CPP_ELLIPSIS))
 {
   struct c_arg_info *ret = build_arg_info ();
-  /* Suppress -Wold-style-definition for this case.  */
-  ret->types = error_mark_node;
-  error_at (c_parser_peek_token (parser)->location,
-   "ISO C requires a named argument before %<...%>");
+
+  if (flag_allow_parameterless_variadic_functions)
+{
+  /* F (...) is allowed.  */
+  ret->types = NULL_TREE;
+}
+  else
+{
+  /* Suppress -Wold-style-definition for this case.  */
+  ret->types = error_mark_node;
+  error_at (c_parser_peek_token (parser)->location,
+"ISO C requires a named argument before %<...%>");
+}
   c_parser_consume_token (parser);
   if (c_parser_next_token_is (parser, CPP_CLOSE_PAREN))
{
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index e166964..d42af1d 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -170,7 +170,7 @@ in the following sections.
 @item C Language Options
 @xref{C Dialect Options,,Options Controlling C Dialect}.
 @gccoptlist{-ansi  -std=@var{standard}  -fgnu89-inline @gol
--aux-info @var{filename} @gol
+-aux-info @var{filename} -fallow-parameterless-variadic-functions @gol
 -fno-asm  -fno-builtin  -fno-builtin-@var{function} @gol
 -fhosted  -ffreestanding -fopenmp -fms-extensions -fplan9-extensions @gol
 -trigraphs  -no-integrated-cpp  -traditional  -traditional-cpp @gol
@@ -1618,6 +1618,13 @@ character).  In the case of function definitions, a 
K&R-style list of
 arguments followed by their declarations is also provided, inside
 comments, after the declaration.
 
+@item -fallow-parameterless-variadic-functions
+Accept variadic functions without named parameters.
+
+Although it is possible to define such a function, this is not very
+usefull as it is not possible to read the arguments.  This is only
+supported for C as this construct is allowed by C++.
+
 @item -fno-asm
 @opindex fno-asm
 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
diff --git a/gcc/testsuite/gcc.dg/va-arg-4.c b/gcc/testsuite/gcc.dg/va-arg-4.c
new file mode 100644
index 000..6d737c4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/va-arg-4.c
@@ -0,0 +1,3 @@
+/* { dg-do compile } */
+#include 
+extern void baz(...);  /* { dg-error "requires a named argument" } */
diff --git a/gcc/testsuite/gcc.dg/va-arg-5.c b/gcc/testsuite/gcc.dg/va-arg-5.c
new file mode 100644
index 000..a00616e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/va-arg-5.c
@@ -0,0 +1,4 @@
+/* { dg-do compile } */
+/* { dg-options "-fallow-parameterless-variadic-functions" } */
+#include 
+extern void baz(...);


Re: [Patch, Fortran, committed] PR 50585: [4.6/4.7 Regression] ICE with assumed length character array argument

2011-10-07 Thread Tobias Burnus

Hi Janus,

I completely missed that this patch is still pending review as you wrote 
"committed". However, it only applied to the ICE and not to the 
documentation and backporting.


On 10/01/2011 02:00 PM, Janus Weil wrote:

I have just committed as obvious a one-line patch to fix a regression
which is triggered by -fwhole-file:
http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=179413

Should I backport to 4.6? And also to 4.5?


Yes, please backport to 4.6. If you want, you can also backport to 4.5. 
However, I do not think that -fwhole-file gets used in 4.5 - especially, 
as it has some issues.



Moreover, I noticed that
http://gcc.gnu.org/onlinedocs/gcc-4.6.1/gfortran/Code-Gen-Options.html#Code-Gen-Options
falsely claims that -fwhole-file is not used by default (which it is
since 4.6, see http://gcc.gnu.org/gcc-4.6/changes.html). Attached is a
small documentation patch to fix this. Ok to apply to trunk and 4.6?


OK. By the way, I was thinking of completely removing that option. 
-fwhole-file avoids some wrong-code issues, generates faster code, and 
improves diagnostic. Thus, there is no real reason* of keeping 
-fno-whole-file. Thus, I would like to deprecate the option. (* = one 
reason is to see whether a bug is due to this flag, but that does not 
really help with fixing the issue.)


I think your wording is fine, I still wonder whether one should somehow 
imply more clearly that -fno-whole-file is not recommended and that the 
whole flag is deprecated.


Tobias

PS: I think except for procedure calls where the explicit interface is 
not known, gfortran generates finally the correct declaration for the 
middle end. At least I have not encountered any multiple-declaration 
issues for a long time!


RFA: Compare Elimination Pass: Fix use of dataflow info

2011-10-07 Thread Nick Clifton
Hi Richard, Hi Paulo,

  Following Paulo's suggestion, here is a patch to remove the calls to
  df_analyze from the compare-elimination pass, and to use
  df_get_live_[in/out].  I can confirm that with this patch applied PR
  49801 is fixed.

  OK to apply ?  For mainline and the 4.6 branch ?

Cheers
  Nick

gcc/ChangeLog
2011-10-07  Nick Clifton  

PR middle-end/49801
* compare-elim.c (find_comparisons_in_bb): Use df_get_live_in and
df_get_live_out instead of accessing the bitmaps directly.
(execute_compare_elim_after_reload): Remove calls to df_set_flags,
df_live_add_problem and df_analyze.

Index: gcc/compare-elim.c
===
--- gcc/compare-elim.c  (revision 179647)
+++ gcc/compare-elim.c  (working copy)
@@ -356,7 +356,7 @@
 
   /* Look to see if the flags register is live outgoing here, and
 incoming to any successor not part of the extended basic block.  */
-  if (bitmap_bit_p (&DF_LIVE_BB_INFO (bb)->out, targetm.flags_regnum))
+  if (bitmap_bit_p (df_get_live_out (bb), targetm.flags_regnum))
{
  edge e;
  edge_iterator ei;
@@ -364,7 +364,7 @@
  FOR_EACH_EDGE (e, ei, bb->succs)
{
  basic_block dest = e->dest;
- if (bitmap_bit_p (&DF_LIVE_BB_INFO (dest)->in,
+ if (bitmap_bit_p (df_get_live_in (bb),
targetm.flags_regnum)
  && !single_pred_p (dest))
{
@@ -580,10 +580,6 @@
 static unsigned int
 execute_compare_elim_after_reload (void)
 {
-  df_set_flags (DF_DEFER_INSN_RESCAN);
-  df_live_add_problem ();
-  df_analyze ();
-
   gcc_checking_assert (all_compares == NULL);
 
   /* Locate all comparisons and their uses, and eliminate duplicates.  */
@@ -602,8 +598,6 @@
 
   VEC_free (comparison_struct_p, heap, all_compares);
   all_compares = NULL;
-
-  df_analyze ();
 }
 
   return 0;


[Patch, Fortran, OOP] PR 50625: [4.6/4.7 Regression] ALLOCATABLE attribute lost for module CLASS variables

2011-10-07 Thread Janus Weil
Hi all,

here is a small patch for an OOP regression. The title of the PR is a
bit misleading, since it's actually not the ALLOCATABLE attribute
which gets lost, but the 'class_ok' attribute, which we use for
checking if a class declaration is valid. When reading class variables
from a module, we can just set this attribute to '1' (if there was an
error, it would have been caught earlier).

Moreover there was a slight problem with backend_decl's not being
present for class symbols, which is being fixed by the hunk in
trans-decl.c.

Regtested successfully on x86_64-unknown-linux-gnu (except for failure
on entry_4 and select_type_12, which are known middle-end
regressions). Ok for trunk and 4.6?

Cheers,
Janus


2011-10-07  Janus Weil  

PR fortran/50625
* class.c (gfc_build_class_symbol): Fix whitespace.
* module.c (mio_symbol): Set 'class_ok' attribute.
* trans-decl.c (gfc_get_symbol_decl): Make sure the backend_decl has
been built for class symbols.


2011-10-07  Janus Weil  

PR fortran/50625
* gfortran.dg/class_46.f03: New.
Index: gcc/fortran/class.c
===
--- gcc/fortran/class.c	(revision 179647)
+++ gcc/fortran/class.c	(working copy)
@@ -188,7 +188,7 @@ gfc_build_class_symbol (gfc_typespec *ts, symbol_a
 /* Class container has already been built.  */
 return SUCCESS;
 
-  attr->class_ok = attr->dummy || attr->pointer  || attr->allocatable;
+  attr->class_ok = attr->dummy || attr->pointer || attr->allocatable;
   
   if (!attr->class_ok)
 /* We can not build the class container yet.  */
Index: gcc/fortran/module.c
===
--- gcc/fortran/module.c	(revision 179647)
+++ gcc/fortran/module.c	(working copy)
@@ -3608,6 +3608,8 @@ mio_symbol (gfc_symbol *sym)
 
   mio_symbol_attribute (&sym->attr);
   mio_typespec (&sym->ts);
+  if (sym->ts.type == BT_CLASS)
+sym->attr.class_ok = 1;
 
   if (iomode == IO_OUTPUT)
 mio_namespace_ref (&sym->formal_ns);
Index: gcc/fortran/trans-decl.c
===
--- gcc/fortran/trans-decl.c	(revision 179647)
+++ gcc/fortran/trans-decl.c	(working copy)
@@ -1179,7 +1179,10 @@ gfc_get_symbol_decl (gfc_symbol * sym)
 {
   gfc_component *c = CLASS_DATA (sym);
   if (!c->ts.u.derived->backend_decl)
-	gfc_find_derived_vtab (c->ts.u.derived);
+	{
+	  gfc_find_derived_vtab (c->ts.u.derived);
+	  gfc_get_derived_type (sym->ts.u.derived);
+	}
 }
 
   /* All deferred character length procedures need to retain the backend


class_46.f03
Description: Binary data


Re: RFA: Compare Elimination Pass: Fix use of dataflow info

2011-10-07 Thread Paolo Bonzini

On 10/07/2011 12:06 PM, Nick Clifton wrote:

-  df_analyze ();
-
gcc_checking_assert (all_compares == NULL);



Ok except that this particular df_analyze should stay.  If it doesn't 
fix the bug, please try the parts of rth's patch that add the gate and 
the TODO_df_finish flag.


Paolo


Re: [Patch, Fortran, OOP] PR 50625: [4.6/4.7 Regression] ALLOCATABLE attribute lost for module CLASS variables

2011-10-07 Thread Tobias Burnus

On 10/07/2011 12:18 PM, Janus Weil wrote:

Regtested successfully on x86_64-unknown-linux-gnu (except for failure
on entry_4 and select_type_12, which are known middle-end
regressions). Ok for trunk and 4.6?


OK. Thanks for the patch - and for telling me that select_type_12 is a 
middle end regression (PR 50640); I already wondered why my being 
worked-on patch showed all of a sudden that failure. (I had self-caused 
select type failures before; thus, I didn't think of a ME problem.)


Tobias


2011-10-07  Janus Weil

PR fortran/50625
* class.c (gfc_build_class_symbol): Fix whitespace.
* module.c (mio_symbol): Set 'class_ok' attribute.
* trans-decl.c (gfc_get_symbol_decl): Make sure the backend_decl has
been built for class symbols.


2011-10-07  Janus Weil

PR fortran/50625
* gfortran.dg/class_46.f03: New.




[patch] Fix PR lto/50492

2011-10-07 Thread Eric Botcazou
Hi,

this is another LTO bootstrap failure with Ada enabled.  There are 2 problems:

 1. dwarf2out.c thinks that it is processing pure C++ code for gnat1 so it is 
invoking some C++-specific code paths that aren't compatible with Ada.  Fixed 
by building TRANSLATION_UNIT_DECL nodes in Ada as well.

 2. the recent change:

* gimple.c (canonicalize_cond_expr_cond): Handle cast from
boolean-type.

breaks cross-language inlining.  More specifically, it removes a necessary cast 
between an Ada boolean type and a C boolean type (hence a GIMPLE verification 
failure later) when __gnat_is_absolute_path is inlined into Is_Absolute_Path:

   extern int __gnat_is_absolute_path (char *, int);

   function Is_Absolute_Path (Name : String) return Boolean is
  function Is_Absolute_Path
(Name   : Address;
 Length : Integer) return Integer;
  pragma Import (C, Is_Absolute_Path, "__gnat_is_absolute_path");
   begin
  return Is_Absolute_Path (Name'Address, Name'Length) /= 0;
   end Is_Absolute_Path;

We start with:

  Ada_Boolean_Var = (Integer_Var != 0);

and forwprop figures out that (Integer_Var != 0) is equivalent to iftmp.xxx.
In combine_cond_expr_cond, the constant folder correctly turns this into:

  Ada_Boolean_Var = (Ada_Boolean_Type) iftmp.xxx;

but the call to canonicalize_cond_expr_cond wrongly removes the cast.

Note that changing Ada's boolean_type_node to a C-compatible type doesn't fix 
the problem as the boolean return type of Is_Absolute_Path has to be an Ada 
boolean type in any case, so a cast will be always necessary here.

Since reverting the canonicalize_cond_expr_cond change apparently has no effect 
(no regressions detected on x86 and x86-64), the proposed fix is just that.

Bootstrapped/regtested on x86_64-suse-linux, OK for mainline?


2011-10-07  Eric Botcazou  

PR lto/50492
* gimple.c (canonicalize_cond_expr_cond): Revert 2011-08-02 change.
ada/
* gcc-interface/gigi.h (gnat_pushdecl): Adjust comment.
* gcc-interface/utils.c (global_context): New variable.
(gnat_pushdecl): Initialize it and set it as the DECL_CONTEXT of DECLs
that are either public external or at top level.  Use "No" macro.
(end_subprog_body): Call decl_function_context.
(rest_of_subprog_body_compilation): Likewise.


-- 
Eric Botcazou
Index: ada/gcc-interface/utils.c
===
--- ada/gcc-interface/utils.c	(revision 179488)
+++ ada/gcc-interface/utils.c	(working copy)
@@ -200,6 +200,9 @@ static GTY(()) struct gnat_binding_level
 /* A chain of gnat_binding_level structures awaiting reuse.  */
 static GTY((deletable)) struct gnat_binding_level *free_binding_level;
 
+/* The context to be used for global declarations.  */
+static GTY(()) tree global_context;
+
 /* An array of global declarations.  */
 static GTY(()) VEC(tree,gc) *global_decls;
 
@@ -497,15 +500,19 @@ gnat_zaplevel (void)
   free_binding_level = level;
 }
 
-/* Records a ..._DECL node DECL as belonging to the current lexical scope
-   and uses GNAT_NODE for location information and propagating flags.  */
+/* Record DECL as belonging to the current lexical scope and use GNAT_NODE
+   for location information and flag propagation.  */
 
 void
 gnat_pushdecl (tree decl, Node_Id gnat_node)
 {
-  /* If this decl is public external or at toplevel, there is no context.  */
+  /* If DECL is public external or at top level, it has global context.  */
   if ((TREE_PUBLIC (decl) && DECL_EXTERNAL (decl)) || global_bindings_p ())
-DECL_CONTEXT (decl) = 0;
+{
+  if (!global_context)
+	global_context = build_translation_unit_decl (NULL_TREE);
+  DECL_CONTEXT (decl) = global_context;
+   }
   else
 {
   DECL_CONTEXT (decl) = current_function_decl;
@@ -518,11 +525,12 @@ gnat_pushdecl (tree decl, Node_Id gnat_n
 	DECL_STATIC_CHAIN (decl) = 1;
 }
 
-  TREE_NO_WARNING (decl) = (gnat_node == Empty || Warnings_Off (gnat_node));
+  TREE_NO_WARNING (decl) = (No (gnat_node) || Warnings_Off (gnat_node));
 
   /* Set the location of DECL and emit a declaration for it.  */
   if (Present (gnat_node))
 Sloc_to_locus (Sloc (gnat_node), &DECL_SOURCE_LOCATION (decl));
+
   add_decl_expr (decl, gnat_node);
 
   /* Put the declaration on the list.  The list of declarations is in reverse
@@ -1982,7 +1990,7 @@ end_subprog_body (tree body)
 
   DECL_SAVED_TREE (fndecl) = body;
 
-  current_function_decl = DECL_CONTEXT (fndecl);
+  current_function_decl = decl_function_context (fndecl);
 
   /* We cannot track the location of errors past this point.  */
   error_gnat_node = Empty;
@@ -1995,7 +2003,7 @@ end_subprog_body (tree body)
   dump_function (TDI_original, fndecl);
 
   /* ??? This special handling of nested functions is probably obsolete.  */
-  if (!DECL_CONTEXT (fndecl))
+  if (!decl_function_context (fndecl))
 cgraph_finalize_function (fndecl, false);
   else
 /* Register this function with

Re: [patch] Fix PR lto/50492

2011-10-07 Thread Richard Guenther
On Fri, Oct 7, 2011 at 12:37 PM, Eric Botcazou  wrote:
> Hi,
>
> this is another LTO bootstrap failure with Ada enabled.  There are 2 problems:
>
>  1. dwarf2out.c thinks that it is processing pure C++ code for gnat1 so it is
> invoking some C++-specific code paths that aren't compatible with Ada.  Fixed
> by building TRANSLATION_UNIT_DECL nodes in Ada as well.
>
>  2. the recent change:
>
>        * gimple.c (canonicalize_cond_expr_cond): Handle cast from
>        boolean-type.
>
> breaks cross-language inlining.  More specifically, it removes a necessary 
> cast
> between an Ada boolean type and a C boolean type (hence a GIMPLE verification
> failure later) when __gnat_is_absolute_path is inlined into Is_Absolute_Path:
>
>   extern int __gnat_is_absolute_path (char *, int);
>
>   function Is_Absolute_Path (Name : String) return Boolean is
>      function Is_Absolute_Path
>        (Name   : Address;
>         Length : Integer) return Integer;
>      pragma Import (C, Is_Absolute_Path, "__gnat_is_absolute_path");
>   begin
>      return Is_Absolute_Path (Name'Address, Name'Length) /= 0;
>   end Is_Absolute_Path;
>
> We start with:
>
>  Ada_Boolean_Var = (Integer_Var != 0);
>
> and forwprop figures out that (Integer_Var != 0) is equivalent to iftmp.xxx.
> In combine_cond_expr_cond, the constant folder correctly turns this into:
>
>  Ada_Boolean_Var = (Ada_Boolean_Type) iftmp.xxx;
>
> but the call to canonicalize_cond_expr_cond wrongly removes the cast.
>
> Note that changing Ada's boolean_type_node to a C-compatible type doesn't fix
> the problem as the boolean return type of Is_Absolute_Path has to be an Ada
> boolean type in any case, so a cast will be always necessary here.

Hm, but canonicalize_cond_expr_cond is supposed to produce a
tree that is suitable for a condition in a GIMPLE_COND, or a
COND_EXPR.  So the issue is that it is used for a tcc_comparison
on a assignment RHS?  Wouldn't the "proper" fix then be to verify
that the result from forward_propagate_into_comparison_1 in forwprop
is a suitable
replacement of the assign rhs in forward_propagate_into_comparison?

Thus,

Index: gcc/tree-ssa-forwprop.c
===
--- gcc/tree-ssa-forwprop.c (revision 179647)
+++ gcc/tree-ssa-forwprop.c (working copy)
@@ -474,7 +474,9 @@ forward_propagate_into_comparison (gimpl
 TREE_TYPE
   (gimple_assign_lhs (stmt)),
 rhs1, rhs2);
-  if (tmp)
+  if (tmp
+  && useless_type_conversion_p (TREE_TYPE (gimple_assign_lhs (stmt)),
+   TREE_TYPE (tmp)))
 {
   gimple_assign_set_rhs_from_tree (gsi, tmp);
   fold_stmt (gsi);

?

> Since reverting the canonicalize_cond_expr_cond change apparently has no 
> effect
> (no regressions detected on x86 and x86-64), the proposed fix is just that.
>
> Bootstrapped/regtested on x86_64-suse-linux, OK for mainline?
>
> 2011-10-07  Eric Botcazou  
>
>        PR lto/50492
>        * gimple.c (canonicalize_cond_expr_cond): Revert 2011-08-02 change.
> ada/
>        * gcc-interface/gigi.h (gnat_pushdecl): Adjust comment.
>        * gcc-interface/utils.c (global_context): New variable.
>        (gnat_pushdecl): Initialize it and set it as the DECL_CONTEXT of DECLs
>        that are either public external or at top level.  Use "No" macro.
>        (end_subprog_body): Call decl_function_context.
>        (rest_of_subprog_body_compilation): Likewise.
>
>
> --
> Eric Botcazou
>


[PATCH] Fix htab lookup bug in reregister_specialization (issue5190046, take 2)

2011-10-07 Thread Jakub Jelinek
On Wed, Oct 05, 2011 at 09:44:34PM -0400, Jason Merrill wrote:
> On 10/05/2011 05:15 PM, Jakub Jelinek wrote:
> >If optimize_specialization_lookup_p (tmpl) doesn't change return value in
> >between the two calls, then you are right.  But perhaps in that case
> >you could avoid the second call and use slot != NULL instead.
> 
> That makes sense too.

Here is a modified patch then, bootstrapped/regtested on x86_64-linux
and i686-linux, ok for trunk?  Would just the reregister_specialization
change be ok for 4.6 too?

2011-10-07  Jakub Jelinek  
Diego Novillo  

* pt.c (reregister_specialization): Use htab_find instead of
htab_find_slot with INSERT.
(maybe_process_partial_specialization, lookup_template_class_1): Change
slot variable type to void ** to avoid aliasing problems.
(register_specialization): Likewise.  Use slot != NULL instead of
more expensive !optimize_specialization_lookup_p (tmpl) test.

--- gcc/cp/pt.c.jj  2011-10-03 14:27:49.0 +0200
+++ gcc/cp/pt.c 2011-10-07 09:14:12.0 +0200
@@ -892,7 +892,8 @@ maybe_process_partial_specialization (tr
 instantiation.  Reassign it to the new member
 specialization template.  */
  spec_entry elt;
- spec_entry **slot;
+ spec_entry *entry;
+ void **slot;
 
  elt.tmpl = most_general_template (tmpl);
  elt.args = CLASSTYPE_TI_ARGS (inst);
@@ -903,10 +904,10 @@ maybe_process_partial_specialization (tr
  elt.tmpl = tmpl;
  elt.args = INNERMOST_TEMPLATE_ARGS (elt.args);
 
- slot = (spec_entry **)
-   htab_find_slot (type_specializations, &elt, INSERT);
- *slot = ggc_alloc_spec_entry ();
- **slot = elt;
+ slot = htab_find_slot (type_specializations, &elt, INSERT);
+ entry = ggc_alloc_spec_entry ();
+ *entry = elt;
+ *slot = entry;
}
  else if (COMPLETE_OR_OPEN_TYPE_P (inst))
/* But if we've had an implicit instantiation, that's a
@@ -1294,7 +1295,7 @@ register_specialization (tree spec, tree
 hashval_t hash)
 {
   tree fn;
-  spec_entry **slot = NULL;
+  void **slot = NULL;
   spec_entry elt;
 
   gcc_assert (TREE_CODE (tmpl) == TEMPLATE_DECL && DECL_P (spec));
@@ -1327,10 +1328,10 @@ register_specialization (tree spec, tree
   if (hash == 0)
hash = hash_specialization (&elt);
 
-  slot = (spec_entry **)
+  slot =
htab_find_slot_with_hash (decl_specializations, &elt, hash, INSERT);
   if (*slot)
-   fn = (*slot)->spec;
+   fn = ((spec_entry *) *slot)->spec;
   else
fn = NULL_TREE;
 }
@@ -1423,11 +1424,12 @@ register_specialization (tree spec, tree
   && !check_specialization_namespace (tmpl))
 DECL_CONTEXT (spec) = DECL_CONTEXT (tmpl);
 
-  if (!optimize_specialization_lookup_p (tmpl))
+  if (slot != NULL /* !optimize_specialization_lookup_p (tmpl) */)
 {
+  spec_entry *entry = ggc_alloc_spec_entry ();
   gcc_assert (tmpl && args && spec);
-  *slot = ggc_alloc_spec_entry ();
-  **slot = elt;
+  *entry = elt;
+  *slot = entry;
   if (TREE_CODE (spec) == FUNCTION_DECL && DECL_NAMESPACE_SCOPE_P (spec)
  && PRIMARY_TEMPLATE_P (tmpl)
  && DECL_SAVED_TREE (DECL_TEMPLATE_RESULT (tmpl)) == NULL_TREE)
@@ -1639,19 +1641,19 @@ iterative_hash_template_arg (tree arg, h
 bool
 reregister_specialization (tree spec, tree tinfo, tree new_spec)
 {
-  spec_entry **slot;
+  spec_entry *entry;
   spec_entry elt;
 
   elt.tmpl = most_general_template (TI_TEMPLATE (tinfo));
   elt.args = TI_ARGS (tinfo);
   elt.spec = NULL_TREE;
 
-  slot = (spec_entry **) htab_find_slot (decl_specializations, &elt, INSERT);
-  if (*slot)
+  entry = (spec_entry *) htab_find (decl_specializations, &elt);
+  if (entry != NULL)
 {
-  gcc_assert ((*slot)->spec == spec || (*slot)->spec == new_spec);
+  gcc_assert (entry->spec == spec || entry->spec == new_spec);
   gcc_assert (new_spec != NULL_TREE);
-  (*slot)->spec = new_spec;
+  entry->spec = new_spec;
   return 1;
 }
 
@@ -7042,7 +7044,7 @@ lookup_template_class_1 (tree d1, tree a
 {
   tree templ = NULL_TREE, parmlist;
   tree t;
-  spec_entry **slot;
+  void **slot;
   spec_entry *entry;
   spec_entry elt;
   hashval_t hash;
@@ -7480,10 +7482,11 @@ lookup_template_class_1 (tree d1, tree a
   SET_TYPE_TEMPLATE_INFO (t, build_template_info (found, arglist));
 
   elt.spec = t;
-  slot = (spec_entry **) htab_find_slot_with_hash (type_specializations,
-  &elt, hash, INSERT);
-  *slot = ggc_alloc_spec_entry ();
-  **slot = elt;
+  slot = htab_find_slot_with_hash (type_specializations,
+   

[Ada] Implement NRV optimization in gigi

2011-10-07 Thread Eric Botcazou
This implements a form of Named Return Value optimization in gigi.  This helps 
a lot for small functions returning array types as well as for vectorization.

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


2011-10-07  Eric Botcazou  

* gcc-interface/gigi.h (gnat_useless_type_conversion): Declare.
(rest_of_subprog_body_compilation): Likewise.
* gcc-interface/decl.c (gnat_to_gnu_entity) : For renaming,
test for useless conversions by means of gnat_useless_type_conversion.
* gcc-interface/trans.c: Include bitmap.h and cgraph.h.
(language_function): Add named_ret_val and other_ret_val.
(f_named_ret_val): New macro.
(f_other_ret_val): Likewise.
(gigi): Call rest_of_subprog_body_compilation.
(struct nrv_data): New structure.
(is_nrv_p): New predicate.
(prune_nrv_r): New helper function.
(prune_nrv_in_block): New function.
(finalize_nrv_r): New helper function.
(finalize_nrv): New function.
(return_value_ok_for_nrv_p): New predicate.
(build_return_expr): If optimization is enabled, record candidates for
the Named Return Value optimization.
(build_function_stub): Call rest_of_subprog_body_compilation.
(Subprogram_Body_to_gnu): If optimization is enabled and there are
candidates, finalize the Named Return Value optimization.
Call rest_of_subprog_body_compilation.
(call_to_gnu): At the end, if a return value is needed, simplify the
result before wrapping it up in a COMPOUND_EXPR.
* gcc-interface/utils.c (end_subprog_body): Split into...
(rest_of_subprog_body_compilation): ...this.  New function.
(gnat_useless_type_conversion): Likewise.


-- 
Eric Botcazou
Index: gcc-interface/utils.c
===
--- gcc-interface/utils.c	(revision 179488)
+++ gcc-interface/utils.c	(working copy)
@@ -1958,7 +1958,7 @@ begin_subprog_body (tree subprog_decl)
   make_decl_rtl (subprog_decl);
 }
 
-/* Finish the definition of the current subprogram BODY and finalize it.  */
+/* Finish translating the current subprogram and set its BODY.  */
 
 void
 end_subprog_body (tree body)
@@ -1983,7 +1983,13 @@ end_subprog_body (tree body)
   DECL_SAVED_TREE (fndecl) = body;
 
   current_function_decl = DECL_CONTEXT (fndecl);
+}
+
+/* Wrap up compilation of SUBPROG_DECL, a subprogram body.  */
 
+void
+rest_of_subprog_body_compilation (tree subprog_decl)
+{
   /* We cannot track the location of errors past this point.  */
   error_gnat_node = Empty;
 
@@ -1992,15 +1998,15 @@ end_subprog_body (tree body)
 return;
 
   /* Dump functions before gimplification.  */
-  dump_function (TDI_original, fndecl);
+  dump_function (TDI_original, subprog_decl);
 
   /* ??? This special handling of nested functions is probably obsolete.  */
-  if (!DECL_CONTEXT (fndecl))
-cgraph_finalize_function (fndecl, false);
+  if (!DECL_CONTEXT (subprog_decl))
+cgraph_finalize_function (subprog_decl, false);
   else
 /* Register this function with cgraph just far enough to get it
added to our parent's nested function list.  */
-(void) cgraph_get_create_node (fndecl);
+(void) cgraph_get_create_node (subprog_decl);
 }
 
 tree
@@ -2194,6 +2200,20 @@ gnat_types_compatible_p (tree t1, tree t
   return 0;
 }
 
+/* Return true if EXPR is a useless type conversion.  */
+
+bool
+gnat_useless_type_conversion (tree expr)
+{
+  if (CONVERT_EXPR_P (expr)
+  || TREE_CODE (expr) == VIEW_CONVERT_EXPR
+  || TREE_CODE (expr) == NON_LVALUE_EXPR)
+return gnat_types_compatible_p (TREE_TYPE (expr),
+TREE_TYPE (TREE_OPERAND (expr, 0)));
+
+  return false;
+}
+
 /* Return true if T, a FUNCTION_TYPE, has the specified list of flags.  */
 
 bool
Index: gcc-interface/decl.c
===
--- gcc-interface/decl.c	(revision 179488)
+++ gcc-interface/decl.c	(working copy)
@@ -949,10 +949,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entit
 	if ((TREE_CODE (gnu_expr) == COMPONENT_REF
 		 && TYPE_IS_PADDING_P (TREE_TYPE (TREE_OPERAND (gnu_expr, 0
 		/* Strip useless conversions around the object.  */
-		|| (TREE_CODE (gnu_expr) == NOP_EXPR
-		&& gnat_types_compatible_p
-		   (TREE_TYPE (gnu_expr),
-			TREE_TYPE (TREE_OPERAND (gnu_expr, 0)
+		|| gnat_useless_type_conversion (gnu_expr))
 	  {
 		gnu_expr = TREE_OPERAND (gnu_expr, 0);
 		gnu_type = TREE_TYPE (gnu_expr);
Index: gcc-interface/gigi.h
===
--- gcc-interface/gigi.h	(revision 179488)
+++ gcc-interface/gigi.h	(working copy)
@@ -479,6 +479,9 @@ extern tree gnat_signed_type (tree type_
transparently converted to each other.  */
 extern int gnat_types_compatible_p (tree t1, tree t2);
 
+/* Return true if EXPR is a useless type conversion.  */
+extern bool gnat_useless_type_conversion (tre

Re: [C++ Patch] PR 38980

2011-10-07 Thread Paolo Carlini

Hi,
Instead of adding the parameter, let's have the C++ front end call a 
different function that doesn't try to pull out the value from 
aggregate variables, like C has decl_constant_value_for_optimization.
Ok. The below lives entirely inside the C++ front-end (actually I had 
already experimented with something similar)


Note I'm using the name decl_constant_value_safe, thus I'm not 
overloading the name decl_constant_value_for_optimization, because the 
latter is only used by the C front-end but still exported by c-family. I 
could move back that decl_constant_value_for_optimization currently in 
c-common.c to the C front-end, but callers, also C front-end only, would 
remain in c-family. I'd rather not fiddle further with all of that 
(looks like long term people would like to have more shared code in 
c-common.c, seems indeed an excellent idea, but at the moment large 
chunks are actually used by the C front-end only...).


Tested x86_64-linux.

Paolo.

/


/cp
2011-10-07  Paolo Carlini  

PR c++/38980
* init.c (constant_value_1): Add bool parameter.
(decl_constant_value_safe): Add.
(integral_constant_value): Adjust.
(decl_constant_value): Adjust.
* cp-tree.h (decl_constant_value_safe): Declare.
* typeck.c (decay_conversion): Use decl_constant_value_safe.
* call.c (convert_like_real): Likewise.

/testsuite
2011-10-07  Paolo Carlini  

PR c++/38980
* g++.dg/warn/format5.C: New.
Index: testsuite/g++.dg/warn/format5.C
===
--- testsuite/g++.dg/warn/format5.C (revision 0)
+++ testsuite/g++.dg/warn/format5.C (revision 0)
@@ -0,0 +1,12 @@
+// PR c++/38980
+// { dg-options "-Wformat" }
+
+extern "C"
+int printf(const char *format, ...) __attribute__((format(printf, 1, 2) ));
+
+const char fmt1[] = "Hello, %s";
+
+void f()
+{
+  printf(fmt1, 3); // { dg-warning "expects argument" }
+}
Index: cp/typeck.c
===
--- cp/typeck.c (revision 179649)
+++ cp/typeck.c (working copy)
@@ -1827,7 +1827,7 @@ decay_conversion (tree exp)
   /* FIXME remove? at least need to remember that this isn't really a
  constant expression if EXP isn't decl_constant_var_p, like with
  C_MAYBE_CONST_EXPR.  */
-  exp = decl_constant_value (exp);
+  exp = decl_constant_value_safe (exp);
   if (error_operand_p (exp))
 return error_mark_node;
 
Index: cp/init.c
===
--- cp/init.c   (revision 179649)
+++ cp/init.c   (working copy)
@@ -1794,10 +1794,11 @@ build_offset_ref (tree type, tree member, bool add
constant initializer, return the initializer (or, its initializers,
recursively); otherwise, return DECL.  If INTEGRAL_P, the
initializer is only returned if DECL is an integral
-   constant-expression.  */
+   constant-expression.  If RETURN_AGGREGATE_CST_OK_P, it is ok to
+   return an aggregate constant.  */
 
 static tree
-constant_value_1 (tree decl, bool integral_p)
+constant_value_1 (tree decl, bool integral_p, bool return_aggregate_cst_ok_p)
 {
   while (TREE_CODE (decl) == CONST_DECL
 || (integral_p
@@ -1834,12 +1835,13 @@ static tree
   if (!init
  || !TREE_TYPE (init)
  || !TREE_CONSTANT (init)
- || (!integral_p
- /* Do not return an aggregate constant (of which
-string literals are a special case), as we do not
-want to make inadvertent copies of such entities,
-and we must be sure that their addresses are the
-same everywhere.  */
+ || (!integral_p && !return_aggregate_cst_ok_p
+ /* Unless RETURN_AGGREGATE_CST_OK_P is true, do not
+return an aggregate constant (of which string
+literals are a special case), as we do not want
+to make inadvertent copies of such entities, and
+we must be sure that their addresses are the
+same everywhere.  */
  && (TREE_CODE (init) == CONSTRUCTOR
  || TREE_CODE (init) == STRING_CST)))
break;
@@ -1856,19 +1858,29 @@ static tree
 tree
 integral_constant_value (tree decl)
 {
-  return constant_value_1 (decl, /*integral_p=*/true);
+  return constant_value_1 (decl, /*integral_p=*/true,
+  /*return_aggregate_cst_ok_p=*/false);
 }
 
 /* A more relaxed version of integral_constant_value, used by the
-   common C/C++ code and by the C++ front end for optimization
-   purposes.  */
+   common C/C++ code.  */
 
 tree
 decl_constant_value (tree decl)
 {
-  return constant_value_1 (decl,
-  /*integral_p=*/processing_template_decl);
+  return constant_value_1 (decl, /*integral_p=*/processing_template_decl,
+  /*return_aggregate_cst_ok_p=*/true);
 }
+
+/* A version of integral_const

[PATCH] Fixed a regression caused by my vect_recog_mixed_size_cond_pattern changes (PR tree-optimization/50650)

2011-10-07 Thread Jakub Jelinek
Hi!

Calling vect_is_simple_cond from the pattern recognized was a bad idea,
as it calls vect_is_simple_use_1 rather than vect_is_simple_use and the
former looks at STMT_VINFO_VECTYPE which by that time is only set
for the data ref stmts (which is why in my test it worked well, that
one did (a[i] < b[i]) ? ... :  and surprisingly nothing in the testsuite
caught that either).

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux.
Ok for trunk?

2011-10-07  Jakub Jelinek  

PR tree-optimization/50650
* tree-vect-patterns.c (vect_recog_mixed_size_cond_pattern): Don't
call vect_is_simple_cond here, instead fail if cond_expr isn't
COMPARISON_CLASS_P or if get_vectype_for_scalar_type returns NULL
for cond_expr's first operand.
* tree-vect-stmts.c (vect_is_simple_cond): Static again.
* tree-vectorizer.h (vect_is_simple_cond): Remove prototype.

* gcc.c-torture/compile/pr50650.c: New test.

--- gcc/tree-vect-patterns.c.jj 2011-10-07 10:03:28.0 +0200
+++ gcc/tree-vect-patterns.c2011-10-07 10:18:58.0 +0200
@@ -1269,8 +1269,12 @@ vect_recog_mixed_size_cond_pattern (VEC 
   || TREE_CODE (else_clause) != INTEGER_CST)
 return NULL;
 
-  if (!vect_is_simple_cond (cond_expr, loop_vinfo, &comp_vectype)
-  || !comp_vectype)
+  if (!COMPARISON_CLASS_P (cond_expr))
+return NULL;
+
+  comp_vectype
+= get_vectype_for_scalar_type (TREE_TYPE (TREE_OPERAND (cond_expr, 0)));
+  if (comp_vectype == NULL_TREE)
 return NULL;
 
   type = gimple_expr_type (last_stmt);
--- gcc/tree-vect-stmts.c.jj2011-10-07 10:03:28.0 +0200
+++ gcc/tree-vect-stmts.c   2011-10-07 10:04:45.0 +0200
@@ -4698,7 +4698,7 @@ vectorizable_load (gimple stmt, gimple_s
Returns whether a COND can be vectorized.  Checks whether
condition operands are supportable using vec_is_simple_use.  */
 
-bool
+static bool
 vect_is_simple_cond (tree cond, loop_vec_info loop_vinfo, tree *comp_vectype)
 {
   tree lhs, rhs;
--- gcc/tree-vectorizer.h.jj2011-10-07 10:03:28.0 +0200
+++ gcc/tree-vectorizer.h   2011-10-07 10:04:28.0 +0200
@@ -818,7 +818,6 @@ extern bool vect_transform_stmt (gimple,
  bool *, slp_tree, slp_instance);
 extern void vect_remove_stores (gimple);
 extern bool vect_analyze_stmt (gimple, bool *, slp_tree);
-extern bool vect_is_simple_cond (tree, loop_vec_info, tree *);
 extern bool vectorizable_condition (gimple, gimple_stmt_iterator *, gimple *,
 tree, int);
 extern void vect_get_load_cost (struct data_reference *, int, bool,
--- gcc/testsuite/gcc.c-torture/compile/pr50650.c.jj2011-10-07 
11:12:27.0 +0200
+++ gcc/testsuite/gcc.c-torture/compile/pr50650.c   2011-10-07 
11:11:30.0 +0200
@@ -0,0 +1,10 @@
+/* PR tree-optimization/50650 */
+
+unsigned int
+foo (unsigned int x, unsigned int y)
+{
+  int i;
+  for (i = 8; i--; x <<= 1)
+y ^= (x ^ y) & 0x80 ? 79U : 0U;
+  return y;
+}

Jakub


Re: [PATCH][ARM] Fix broken shift patterns

2011-10-07 Thread Andrew Stubbs

On 06/10/11 18:17, Paul Brook wrote:

I believe this patch to be nothing but an improvement over the current
state, and that a fix to the constraint problem should be a separate patch.

In that basis, am I OK to commit?


One minor nit:


(define_special_predicate "shift_operator"
...
+   (ior (match_test "GET_CODE (XEXP (op, 1)) == CONST_INT
+   &&  ((unsigned HOST_WIDE_INT) INTVAL (XEXP (op, 1)))<  
32")
+   (match_test "REG_P (XEXP (op, 1))"


We're already enforcing the REG_P elsewhere, and it's only valid in some
contexts, so I'd change this to:
 (match_test "GET_CODE (XEXP (op, 1)) != CONST_INT
|| ((unsigned HOST_WIDE_INT) INTVAL (XEXP (op, 1)))<  32")


Done, and attached.


3. Consistently accept both power-of-two and 0..31 for shifts.  Large shift
counts give undefined results[1], so replace them with an arbitrary value
(e.g. 0) during assembly output.  Argualy not an entirely "proper" fix, but I
think it'll keep everything happy.


I think we need to be careful not to change the behaviour between 
different optimization levels and/or perturbations caused by minor code 
changes. I know this isn't a hard requirement for undefined behaviour, 
but I think it's still good practice.


In this case, I believe the hardware simply shifts the the value clean 
out of the register, and always returns a zero (or maybe -1 for 
ashiftrt?). I'm not sure what it does for rotate.


Anyway, my point is that I don't think that we could insert an immediate 
that had the same effect in all cases.



For bonus points we should probably disallow MULT in the arm_shiftsi3 pattern,
stop it interacting with the regulat mulsi3 pattern in undesirable ways.


How might that be a problem? Is it not the case that canonical forms 
already deals with this?


Anyway, it's easily achieved with an extra predicate.

Andrew
2011-10-07  Andrew Stubbs  

	gcc/
	* config/arm/predicates.md (shift_amount_operand): Remove constant
	range check.
	(shift_operator): Check range of constants for all shift operators.

	gcc/testsuite/
	* gcc.dg/pr50193-1.c: New file.
	* gcc.target/arm/shiftable.c: New file.

--- a/gcc/config/arm/predicates.md
+++ b/gcc/config/arm/predicates.md
@@ -129,11 +129,12 @@
   (ior (match_operand 0 "arm_rhs_operand")
(match_operand 0 "memory_operand")))
 
+;; This doesn't have to do much because the constant is already checked
+;; in the shift_operator predicate.
 (define_predicate "shift_amount_operand"
   (ior (and (match_test "TARGET_ARM")
 	(match_operand 0 "s_register_operand"))
-   (and (match_code "const_int")
-	(match_test "((unsigned HOST_WIDE_INT) INTVAL (op)) < 32"
+   (match_operand 0 "const_int_operand")))
 
 (define_predicate "arm_add_operand"
   (ior (match_operand 0 "arm_rhs_operand")
@@ -219,13 +220,20 @@
(match_test "mode == GET_MODE (op)")))
 
 ;; True for shift operators.
+;; Notes:
+;;  * mult is only permitted with a constant shift amount
+;;  * patterns that permit register shift amounts only in ARM mode use
+;;shift_amount_operand, patterns that always allow registers do not,
+;;so we don't have to worry about that sort of thing here.
 (define_special_predicate "shift_operator"
   (and (ior (ior (and (match_code "mult")
 		  (match_test "power_of_two_operand (XEXP (op, 1), mode)"))
 		 (and (match_code "rotate")
 		  (match_test "GET_CODE (XEXP (op, 1)) == CONST_INT
    && ((unsigned HOST_WIDE_INT) INTVAL (XEXP (op, 1))) < 32")))
-	(match_code "ashift,ashiftrt,lshiftrt,rotatert"))
+	(and (match_code "ashift,ashiftrt,lshiftrt,rotatert")
+		 (match_test "GET_CODE (XEXP (op, 1)) != CONST_INT
+			  || ((unsigned HOST_WIDE_INT) INTVAL (XEXP (op, 1))) < 32")))
(match_test "mode == GET_MODE (op)")))
 
 ;; True for shift operators which can be used with saturation instructions.
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr50193-1.c
@@ -0,0 +1,10 @@
+/* PR 50193: ARM: ICE on a | (b << negative-constant) */
+/* Ensure that the compiler doesn't ICE.  */
+
+/* { dg-options "-O2" } */
+
+int
+foo(int a, int b)
+{
+  return a | (b << -3); /* { dg-warning "left shift count is negative" } */
+}
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/shiftable.c
@@ -0,0 +1,43 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-require-effective-target arm32 } */
+
+int
+plus (int a, int b)
+{
+  return (a * 64) + b;
+}
+
+/* { dg-final { scan-assembler "add.*\[al]sl #6" } } */
+
+int
+minus (int a, int b)
+{
+  return a - (b * 64);
+}
+
+/* { dg-final { scan-assembler "sub.*\[al]sl #6" } } */
+
+int
+ior (int a, int b)
+{
+  return (a * 64) | b;
+}
+
+/* { dg-final { scan-assembler "orr.*\[al]sl #6" } } */
+
+int
+xor (int a, int b)
+{
+  return (a * 64) ^ b;
+}
+
+/* { dg-final { scan-assembler "eor.*\[al]sl #6" } } */
+
+int
+and (int a, int b)
+{
+  return (a * 64) & b;
+}
+
+/* { dg-final { scan-assembler "and.*\[al]sl #6" } } */


Re: [PATCH] Fixed a regression caused by my vect_recog_mixed_size_cond_pattern changes (PR tree-optimization/50650)

2011-10-07 Thread Richard Guenther
On Fri, 7 Oct 2011, Jakub Jelinek wrote:

> Hi!
> 
> Calling vect_is_simple_cond from the pattern recognized was a bad idea,
> as it calls vect_is_simple_use_1 rather than vect_is_simple_use and the
> former looks at STMT_VINFO_VECTYPE which by that time is only set
> for the data ref stmts (which is why in my test it worked well, that
> one did (a[i] < b[i]) ? ... :  and surprisingly nothing in the testsuite
> caught that either).
> 
> Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux.
> Ok for trunk?

Ok.

Thanks,
Richard.

> 2011-10-07  Jakub Jelinek  
> 
>   PR tree-optimization/50650
>   * tree-vect-patterns.c (vect_recog_mixed_size_cond_pattern): Don't
>   call vect_is_simple_cond here, instead fail if cond_expr isn't
>   COMPARISON_CLASS_P or if get_vectype_for_scalar_type returns NULL
>   for cond_expr's first operand.
>   * tree-vect-stmts.c (vect_is_simple_cond): Static again.
>   * tree-vectorizer.h (vect_is_simple_cond): Remove prototype.
> 
>   * gcc.c-torture/compile/pr50650.c: New test.
> 
> --- gcc/tree-vect-patterns.c.jj   2011-10-07 10:03:28.0 +0200
> +++ gcc/tree-vect-patterns.c  2011-10-07 10:18:58.0 +0200
> @@ -1269,8 +1269,12 @@ vect_recog_mixed_size_cond_pattern (VEC 
>|| TREE_CODE (else_clause) != INTEGER_CST)
>  return NULL;
>  
> -  if (!vect_is_simple_cond (cond_expr, loop_vinfo, &comp_vectype)
> -  || !comp_vectype)
> +  if (!COMPARISON_CLASS_P (cond_expr))
> +return NULL;
> +
> +  comp_vectype
> += get_vectype_for_scalar_type (TREE_TYPE (TREE_OPERAND (cond_expr, 0)));
> +  if (comp_vectype == NULL_TREE)
>  return NULL;
>  
>type = gimple_expr_type (last_stmt);
> --- gcc/tree-vect-stmts.c.jj  2011-10-07 10:03:28.0 +0200
> +++ gcc/tree-vect-stmts.c 2011-10-07 10:04:45.0 +0200
> @@ -4698,7 +4698,7 @@ vectorizable_load (gimple stmt, gimple_s
> Returns whether a COND can be vectorized.  Checks whether
> condition operands are supportable using vec_is_simple_use.  */
>  
> -bool
> +static bool
>  vect_is_simple_cond (tree cond, loop_vec_info loop_vinfo, tree *comp_vectype)
>  {
>tree lhs, rhs;
> --- gcc/tree-vectorizer.h.jj  2011-10-07 10:03:28.0 +0200
> +++ gcc/tree-vectorizer.h 2011-10-07 10:04:28.0 +0200
> @@ -818,7 +818,6 @@ extern bool vect_transform_stmt (gimple,
>   bool *, slp_tree, slp_instance);
>  extern void vect_remove_stores (gimple);
>  extern bool vect_analyze_stmt (gimple, bool *, slp_tree);
> -extern bool vect_is_simple_cond (tree, loop_vec_info, tree *);
>  extern bool vectorizable_condition (gimple, gimple_stmt_iterator *, gimple *,
>  tree, int);
>  extern void vect_get_load_cost (struct data_reference *, int, bool,
> --- gcc/testsuite/gcc.c-torture/compile/pr50650.c.jj  2011-10-07 
> 11:12:27.0 +0200
> +++ gcc/testsuite/gcc.c-torture/compile/pr50650.c 2011-10-07 
> 11:11:30.0 +0200
> @@ -0,0 +1,10 @@
> +/* PR tree-optimization/50650 */
> +
> +unsigned int
> +foo (unsigned int x, unsigned int y)
> +{
> +  int i;
> +  for (i = 8; i--; x <<= 1)
> +y ^= (x ^ y) & 0x80 ? 79U : 0U;
> +  return y;
> +}
> 
>   Jakub
> 
> 

-- 
Richard Guenther 
SUSE / SUSE Labs
SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer

Re: [PATCH][ARM] Fix broken shift patterns

2011-10-07 Thread Andrew Stubbs

On 06/10/11 16:01, Andrew Stubbs wrote:

  (define_special_predicate "shift_operator"
(and (ior (ior (and (match_code "mult")
  (match_test "power_of_two_operand (XEXP (op, 1), mode)"))
 (and (match_code "rotate")
  (match_test "GET_CODE (XEXP (op, 1)) == CONST_INT
&&  ((unsigned HOST_WIDE_INT) INTVAL (XEXP (op, 
1)))<  32")))
-   (match_code "ashift,ashiftrt,lshiftrt,rotatert"))
+   (and (match_code "ashift,ashiftrt,lshiftrt,rotatert")
+(ior (match_test "GET_CODE (XEXP (op, 1)) == CONST_INT
+   &&  ((unsigned HOST_WIDE_INT) INTVAL (XEXP (op, 
1)))<  32")
+ (match_test "REG_P (XEXP (op, 1))"
 (match_test "mode == GET_MODE (op)")))


Oh, I forgot to say, I don't understand why the "rotate" operator is 
special cased?


If I understand it correctly, the effect of the (existing) rotate is 
both to check the constant range, AND to disallow registers as the shift 
amount. This difference has no effect on Thumb, but might cause ARM mode 
some troubles?


Is this likely to be deliberate, or an oversight? I can't see any reason 
in the ARM ARM why this should be the case.


Andrew


Re: [patch] Fix PR lto/50492

2011-10-07 Thread Eric Botcazou
> Hm, but canonicalize_cond_expr_cond is supposed to produce a
> tree that is suitable for a condition in a GIMPLE_COND, or a
> COND_EXPR.  So the issue is that it is used for a tcc_comparison
> on a assignment RHS?

It is called on (Ada_Boolean_Type) iftmp.xxx, which comes from the RHS of

  Ada_Boolean_Var = (Integer_Var != 0);

> Wouldn't the "proper" fix then be to verify that the result from
> forward_propagate_into_comparison_1 in forwprop is a suitable
> replacement of the assign rhs in forward_propagate_into_comparison?

Not clear whether it is the proper fix, as you explicitly pass the type in the 
call to forward_propagate_into_comparison_1 just above:

  tmp = forward_propagate_into_comparison_1 (stmt,
 gimple_assign_rhs_code (stmt),
 TREE_TYPE
   (gimple_assign_lhs (stmt)),
 rhs1, rhs2);

and then to combine_cond_expr_cond, so you would expect that both functions 
return a tree with the specified type.  But this would probably work, yes.

-- 
Eric Botcazou


[testsuite] Disable ABI warnings for gcc.c-torture/execute/vector-compare-2.c (PR tree-optimization/50575)

2011-10-07 Thread Rainer Orth
gcc.c-torture/execute/vector-compare-2.c was FAILing on Solaris 8 and
9/x86 with ABI warnings

output is:
/vol/gcc/src/hg/trunk/local/gcc/testsuite/gcc.c-torture/execute/vector-compare-2.c:
 In function 'foo':
/vol/gcc/src/hg/trunk/local/gcc/testsuite/gcc.c-torture/execute/vector-compare-2.c:7:1:
 note: The ABI for passing parameters with 16-byte alignment has changed in GCC 
4.6
In file included from :0:0:
/vol/gcc/src/hg/trunk/local/gcc/testsuite/gcc.c-torture/execute/vector-compare-2.c:
 In function 'foo':
/vol/gcc/src/hg/trunk/local/gcc/testsuite/gcc.c-torture/execute/vector-compare-2.c:7:1:
 note: The ABI for passing parameters with 16-byte alignment has changed in GCC 
4.6

FAIL: gcc.c-torture/execute/vector-compare-2.c compilation,  -O2 -flto 
-flto-partition=none 

but strangely only with -flto, although the message also appears
without.  Closer investigation revealed a mess:

* If I just run this single test with runtest, it fails for all options,
  not just -flto.

* The notes are pruned by gcc-dg-prune, but that isn't normally loaded
  by execute.exp.  If you do load it explicitly, the notes are pruned as
  during a regular testsuite run.  I suspect that some other driver is
  loaded together with execute.exp which causes this.

* The -flto tests still fail because of a single message that isn't
  pruned:

  In file included from :0:0:

  Only lto.exp (not loaded here) does prune that one.

To avoid that mess, I've simply added a .x file which adds -Wno-psabi.

Tested with the appropriate runtest invocation on i386-pc-solaris2.8 and
i386-pc-solaris2.11, installed on mainline.

Rainer


2011-10-07  Rainer Orth  

PR tree-optimization/50575
* gcc.c-torture/execute/vector-compare-2.x: New file.

# HG changeset patch
# Parent 9a920c885d78e91628abbcba90693e8bb3e6f1a0
Disable ABI warnings for gcc.c-torture/execute/vector-compare-2.c (PR tree-optimization/50575)

diff --git a/gcc/testsuite/gcc.c-torture/execute/vector-compare-2.x b/gcc/testsuite/gcc.c-torture/execute/vector-compare-2.x
new file mode 100644
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/vector-compare-2.x
@@ -0,0 +1,2 @@
+set additional_flags "-Wno-psabi"
+return 0

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


Re: [patch] Fix PR lto/50492

2011-10-07 Thread Richard Guenther
On Fri, Oct 7, 2011 at 1:37 PM, Eric Botcazou  wrote:
>> Hm, but canonicalize_cond_expr_cond is supposed to produce a
>> tree that is suitable for a condition in a GIMPLE_COND, or a
>> COND_EXPR.  So the issue is that it is used for a tcc_comparison
>> on a assignment RHS?
>
> It is called on (Ada_Boolean_Type) iftmp.xxx, which comes from the RHS of
>
>  Ada_Boolean_Var = (Integer_Var != 0);
>
>> Wouldn't the "proper" fix then be to verify that the result from
>> forward_propagate_into_comparison_1 in forwprop is a suitable
>> replacement of the assign rhs in forward_propagate_into_comparison?
>
> Not clear whether it is the proper fix, as you explicitly pass the type in the
> call to forward_propagate_into_comparison_1 just above:
>
>  tmp = forward_propagate_into_comparison_1 (stmt,
>                                             gimple_assign_rhs_code (stmt),
>                                             TREE_TYPE
>                                               (gimple_assign_lhs (stmt)),
>                                             rhs1, rhs2);
>
> and then to combine_cond_expr_cond, so you would expect that both functions
> return a tree with the specified type.  But this would probably work, yes.

Yeah, it uses the type to do

  t = fold_binary_loc (gimple_location (stmt), code, type, op0, op1);

and using the "original type" is surely the best idea for that.  It could
also simply use boolean_type_node nowadays, not sure if that
would cause more fails on the type checking that is needed in
forward_propagate_into_comparison.  I suppose at most for Ada,
so maybe you can check that.  If it doesn't make a difference
then stripping the type argument from the call chain and using
boolean_type_node in combine_cond_expr_cond would be a good
cleanup.

But the original suggested patch is ok if it bootstraps & tests if
you just want to go forward.

Thanks,
Richard.

> --
> Eric Botcazou
>


Re: [PATCH] Fix PR46556 (poor address generation)

2011-10-07 Thread William J. Schmidt
On Fri, 2011-10-07 at 11:17 +0200, Paolo Bonzini wrote:
> On 10/07/2011 10:00 AM, Richard Guenther wrote:
> > It's a reasonable plan - you'd have to introduce a late reassoc
> > pass though.  Can you separate out the RTL fwprop changes?  So
> > we can iterate over the tree parts separately.
> 
> That's indeed better, also because they became CSE changes.
> 
> Paolo
> 

Yes, I'll plan to work these two separately.

Paolo, I should be able to shepherd your suggested patch through.
Normally company policy frowns on committing other people's patches, but
in a case like this where you're no longer actively doing GCC
development, I should be able to overcome that.

BTW, Richard, whatever my former issues with update_stmt were are gone,
so I'll be able to clean up that wart.

Thanks,
Bill



Re: [PATCH][ARM] Fix broken shift patterns

2011-10-07 Thread Paul Brook
> Oh, I forgot to say, I don't understand why the "rotate" operator is
> special cased?
> 
> If I understand it correctly, the effect of the (existing) rotate is
> both to check the constant range, AND to disallow registers as the shift
> amount. This difference has no effect on Thumb, but might cause ARM mode
> some troubles?
> 
> Is this likely to be deliberate, or an oversight? I can't see any reason
> in the ARM ARM why this should be the case.

Deliberate. ARM only has rotatert (which for immediate operands can be 
substituted at assembly generation time).

Paul


Re: [PATCH][ARM] Fix broken shift patterns

2011-10-07 Thread Paul Brook
> Done, and attached.

Ok.

Two changes to the testcase that I'll pre-approve:
- Add a comment along the lines of
  /* ARM has shift-and-alu insns.  Depending on the ALU op GCC represents some
   of these as a left shift, others as a multiply.  Check that we match the
   right one.  */
- Also test (a * 64) - b [rsb] and ~(a * 64) [mvn]

> > 3. Consistently accept both power-of-two and 0..31 for shifts.  Large
> > shift counts give undefined results[1], so replace them with an
> > arbitrary value (e.g. 0) during assembly output.  Argualy not an
> > entirely "proper" fix, but I think it'll keep everything happy.
> 
> I think we need to be careful not to change the behaviour between
> different optimization levels and/or perturbations caused by minor code
> changes. I know this isn't a hard requirement for undefined behaviour,
> but I think it's still good practice.

> In this case, I believe the hardware simply shifts the the value clean
> out of the register, and always returns a zero (or maybe -1 for
> ashiftrt?).

I'm not convinced.  ARM instructions shift modulo 256
(i.e. a >> (b & 0xff).  I'm pretty sure anything that gets constant-folded by 
earlier passes will not honor these semantics.
 
> > For bonus points we should probably disallow MULT in the arm_shiftsi3
> > pattern, stop it interacting with the regular mulsi3 pattern in
> > undesirable ways.
> 
> How might that be a problem? Is it not the case that canonical forms
> already deals with this?

Mainly just general principle that having two insns with the same pattern is 
wrong - reload can't flip between them like it can different altrnatives, and 
there's obscure rules about which one wins when both match.

In this case the shiftsi variant is very restricted and should never occur in 
the first place so it probably doesn't matter.

Paul


Re: [RFC] Split -mrecip

2011-10-07 Thread Michael Matz
Hi,

On Wed, 5 Oct 2011, Uros Bizjak wrote:

> > Like so.  Currently regstrapping on x86_64-linux.  Okay if that 
> > succeeds?
> 
> OK, with a nit - I'd introduce RECIP_MASK_NONE and use it in place of 0 
> in a couple of places.

Okay.  r179608 it is.


Ciao,
Michael.

[Patch,AVR] Fix PR50652

2011-10-07 Thread Georg-Johann Lay
Fix of wrong data_section_start for ATmega164A.

Ok?

Johann

PR target/50652
* config/avr/avr-mcus.def (AVR_MCU): Set .data_section_start of
atmega164a to 0x100.


Index: config/avr/avr-mcus.def
===
--- config/avr/avr-mcus.def	(revision 179594)
+++ config/avr/avr-mcus.def	(working copy)
@@ -117,7 +117,7 @@ AVR_MCU ("atmega16a",ARCH_AV
 AVR_MCU ("atmega161",ARCH_AVR5, "__AVR_ATmega161__", 0, 0, 0x0060, "m161")
 AVR_MCU ("atmega162",ARCH_AVR5, "__AVR_ATmega162__", 0, 0, 0x0100, "m162")
 AVR_MCU ("atmega163",ARCH_AVR5, "__AVR_ATmega163__", 0, 0, 0x0060, "m163")
-AVR_MCU ("atmega164a",   ARCH_AVR5, "__AVR_ATmega164A__",0, 0, 0x0060, "m164a")
+AVR_MCU ("atmega164a",   ARCH_AVR5, "__AVR_ATmega164A__",0, 0, 0x0100, "m164a")
 AVR_MCU ("atmega164p",   ARCH_AVR5, "__AVR_ATmega164P__",0, 0, 0x0100, "m164p")
 AVR_MCU ("atmega165",ARCH_AVR5, "__AVR_ATmega165__", 0, 0, 0x0100, "m165")
 AVR_MCU ("atmega165a",   ARCH_AVR5, "__AVR_ATmega165A__",0, 0, 0x0100, "m165a")


Re: Modify gcc for use with gdb (issue5132047)

2011-10-07 Thread Tom Tromey
> "Jeff" == Jeff Law  writes:

Jeff> Presumably it hasn't been included because not all gdb's understand
Jeff> those bits and we typically don't build with -g3.

GCC is pretty much the perfect candidate for a -g3 build.  All those
macros...

The needed gdb changes have been in since right around when I added that
patch to the incremental branch.  Anybody with a > 3 year old gdb should
upgrade :-)

Tom


Re: Modify gcc for use with gdb (issue5132047)

2011-10-07 Thread Jakub Jelinek
On Fri, Oct 07, 2011 at 07:42:44AM -0600, Tom Tromey wrote:
> > "Jeff" == Jeff Law  writes:
> 
> Jeff> Presumably it hasn't been included because not all gdb's understand
> Jeff> those bits and we typically don't build with -g3.
> 
> GCC is pretty much the perfect candidate for a -g3 build.  All those
> macros...
> 
> The needed gdb changes have been in since right around when I added that
> patch to the incremental branch.  Anybody with a > 3 year old gdb should
> upgrade :-)

A > 3 years old gdb is useless for debugging gcc anyway, it won't understand
epilogue unwind info, discriminators, lots of .debug_info stuff added
in the last few years and not even the .debug_macro format.

Jakub


[Committed] S/390: Make TLS work without -fpic

2011-10-07 Thread Andreas Krebbel
Hi,

this fixes the tls testsuite fails on s390.  Calls to __tls_get_offset
require the GOT pointer to be loaded what so far only happened when
building pic code.  With the attached patch the GOT pointer is loaded
"on demand" when calling __tls_get_offset.

Committed to mainline.

Bye,

-Andreas-


2011-10-07  Andreas Krebbel  

* config/s390/s390.c (s390_emit_tls_call_insn): Remove assertion.
Load GOT pointer for non-pic builds.
(s390_load_got): Replace pic_offset_table_rtx with hardcoded r12.
(s390_emit_call): Likewise.


Index: gcc/config/s390/s390.c
===
*** gcc/config/s390/s390.c.orig
--- gcc/config/s390/s390.c
*** s390_emit_tls_call_insn (rtx result_reg,
*** 3604,3610 
  {
rtx insn;
  
!   gcc_assert (flag_pic);
  
if (!s390_tls_symbol)
  s390_tls_symbol = gen_rtx_SYMBOL_REF (Pmode, "__tls_get_offset");
--- 3604,3611 
  {
rtx insn;
  
!   if (!flag_pic)
! emit_insn (s390_load_got ());
  
if (!s390_tls_symbol)
  s390_tls_symbol = gen_rtx_SYMBOL_REF (Pmode, "__tls_get_offset");
*** s390_load_got (void)
*** 7859,7864 
--- 7860,7871 
  {
rtx insns;
  
+   /* We cannot use pic_offset_table_rtx here since we use this
+  function also for non-pic if __tls_get_offset is called and in
+  that case PIC_OFFSET_TABLE_REGNUM as well as pic_offset_table_rtx
+  aren't usable.  */
+   rtx got_rtx = gen_rtx_REG (Pmode, 12);
+ 
if (!got_symbol)
  {
got_symbol = gen_rtx_SYMBOL_REF (Pmode, "_GLOBAL_OFFSET_TABLE_");
*** s390_load_got (void)
*** 7869,7875 
  
if (TARGET_CPU_ZARCH)
  {
!   emit_move_insn (pic_offset_table_rtx, got_symbol);
  }
else
  {
--- 7876,7882 
  
if (TARGET_CPU_ZARCH)
  {
!   emit_move_insn (got_rtx, got_symbol);
  }
else
  {
*** s390_load_got (void)
*** 7880,7892 
offset = gen_rtx_CONST (Pmode, offset);
offset = force_const_mem (Pmode, offset);
  
!   emit_move_insn (pic_offset_table_rtx, offset);
  
offset = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, XEXP (offset, 0)),
   UNSPEC_LTREL_BASE);
!   offset = gen_rtx_PLUS (Pmode, pic_offset_table_rtx, offset);
  
!   emit_move_insn (pic_offset_table_rtx, offset);
  }
  
insns = get_insns ();
--- 7887,7899 
offset = gen_rtx_CONST (Pmode, offset);
offset = force_const_mem (Pmode, offset);
  
!   emit_move_insn (got_rtx, offset);
  
offset = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, XEXP (offset, 0)),
   UNSPEC_LTREL_BASE);
!   offset = gen_rtx_PLUS (Pmode, got_rtx, offset);
  
!   emit_move_insn (got_rtx, offset);
  }
  
insns = get_insns ();
*** s390_emit_call (rtx addr_location, rtx t
*** 9827,9834 
/* s390_function_ok_for_sibcall should
 have denied sibcalls in this case.  */
gcc_assert (retaddr_reg != NULL_RTX);
! 
!   use_reg (&CALL_INSN_FUNCTION_USAGE (insn), pic_offset_table_rtx);
  }
return insn;
  }
--- 9834,9840 
/* s390_function_ok_for_sibcall should
 have denied sibcalls in this case.  */
gcc_assert (retaddr_reg != NULL_RTX);
!   use_reg (&CALL_INSN_FUNCTION_USAGE (insn), gen_rtx_REG (Pmode, 12));
  }
return insn;
  }


[Patch, fortran] [00/14] PR fortran/50420 Support coarray subreferences

2011-10-07 Thread Mikael Morin
Hello, 

the following patches propose to fix bug fortran/50420:
gfortran has been rejecting coarrays as argument to the coarray intrinsics 
({l,u}cobound, image_index) if they had a subreference.
The standard, however, has:
   A subobject of a coarray is a coarray if it does not have any cosubscripts,
   vector subscripts, allocatable component selection, or pointer component
   selection.

The recent scalarizer patchset at 
http://gcc.gnu.org/ml/fortran/2011-09/msg00056.html
makes thing worse by changing a rejects-valid bug into a ice-on-valid bug.

These patches make the necessary change to accept coarray subreferences

The full patchset has passed the fortran testsuite successfully.
OK for trunk?



Patches layout

 01..04/14: Add support for non-full arrays in descriptor initialization code.

 05..09/14: Make walk_coarray initialize the scalarizer structs properly to
accept expression with subreferences.

 10..11/14: Fix corank checking

 12/14: Accept coarray subreferences in simplify_cobound

 13/14: Fix gfc_build_array_type

 14/14: Fix gfc_build_array_ref
2011-10-06  Mikael Morin  

PR fortran/50420
* gfortran.dg/coarray_subobject_1.f90: New test.
* gfortran.dg/coarray/subobject_1.f90: New test.
! { dg-do compile }
! { dg-options "-fcoarray=single" }
!
! PR fortran/50420
! Coarray subobjects were not accepted as valid coarrays
! They should still be rejected if one of the component reference is allocatable
! or pointer

type t
  integer :: i
end type t
type t2
  type(t), allocatable :: a
  type(t), pointer :: c
end type t2
type(t2) :: b[5:*]
allocate(b%a)
allocate(b%c)
b%a%i = 7
b%c%i = 13
if (b%a%i /= 7) call abort
if (any (lcobound(b%a) /= (/ 5 /))) call abort ! { dg-error 
"Expected coarray variable" }
if (ucobound(b%a, dim=1) /= this_image() + 4) call abort   ! { dg-error 
"Expected coarray variable" }
if (any (lcobound(b%a%i) /= (/ 5 /))) call abort   ! { dg-error 
"Expected coarray variable" }
if (ucobound(b%a%i, dim=1) /= this_image() + 4) call abort ! { dg-error 
"Expected coarray variable" }
if (b%c%i /= 13) call abort
if (any (lcobound(b%c) /= (/ 5 /))) call abort ! { dg-error 
"Expected coarray variable" }
if (ucobound(b%c, dim=1) /= this_image() + 4) call abort   ! { dg-error 
"Expected coarray variable" }
if (any (lcobound(b%c%i) /= (/ 5 /))) call abort   ! { dg-error 
"Expected coarray variable" }
if (ucobound(b%c%i, dim=1) /= this_image() + 4) call abort ! { dg-error 
"Expected coarray variable" }
end
! { dg-do run }
!
! PR fortran/50420
! Coarray subobjects were not accepted as valid coarrays

  integer  :: i
  integer, parameter :: la = 4, lb = 5, lc = 8
  integer, parameter :: init(la) = -4 + (/ (i, i=1,la) /)
  
  type t
integer :: i
  end type t
  type t2
type(t), allocatable :: a[:]
  end type t2
  type t3
type(t), allocatable :: a(:)[:]
  end type t3

  type(t2) :: b
  type(t3) :: c

  allocate(b%a[lb:*])
  b%a%i = 7
  if (b%a%i /= 7) call abort
  if (any (lcobound(b%a) /= (/ lb /))) call abort
  if (ucobound(b%a, dim=1) /= this_image() + lb - 1) call abort
  if (any (lcobound(b%a%i) /= (/ lb /))) call abort
  if (ucobound(b%a%i, dim=1) /= this_image() + lb - 1) call abort
  allocate(c%a(la)[lc:*])
  c%a%i = init
  if (any(c%a%i /= init)) call abort
  if (any (lcobound(c%a) /= (/ lc /))) call abort
  if (ucobound(c%a, dim=1) /= this_image() + lc - 1) call abort
  if (any (lcobound(c%a%i) /= (/ lc /))) call abort
  if (ucobound(c%a%i, dim=1) /= this_image() + lc - 1) call abort
  if (c%a(2)%i /= init(2)) call abort
  if (any (lcobound(c%a(2)) /= (/ lc /))) call abort
  if (ucobound(c%a(2), dim=1) /= this_image() + lc - 1) call abort
  if (any (lcobound(c%a(2)%i) /= (/ lc /))) call abort
  if (ucobound(c%a(2)%i, dim=1) /= this_image() + lc - 1) call abort
  deallocate(b%a, c%a)
end


[Patch, fortran] [10..11/14] Support coarray subreferences: Fix dim_corank_check

2011-10-07 Thread Mikael Morin
dim_corank_check uses gfc_find_array_ref to get coarray's array ref.
It won't work for obvious reasons for the case coarray(1,1) which is a
non-arrray (but still a coarray).
As the whole point of this is to get the corank, patch 10 replaces the call
to gfc_find_array_ref with a call to gfc_get_corank.
Then, in gfc_find_array_ref the coarray-specific code can be removed.
This is patch 11.

OK?
2011-10-06  Mikael Morin  

PR fortran/50420
* check.c (dim_corank_check): Use gfc_get_corank to get corank.
diff --git a/check.c b/check.c
index 9b8ec21..9b1e3a9 100644
--- a/check.c
+++ b/check.c
@@ -511,7 +511,6 @@ dim_check (gfc_expr *dim, int n, bool optional)
 static gfc_try
 dim_corank_check (gfc_expr *dim, gfc_expr *array)
 {
-  gfc_array_ref *ar;
   int corank;
 
   gcc_assert (array->expr_type == EXPR_VARIABLE);
@@ -519,8 +518,7 @@ dim_corank_check (gfc_expr *dim, gfc_expr *array)
   if (dim->expr_type != EXPR_CONSTANT)
 return SUCCESS;
 
-  ar = gfc_find_array_ref (array);
-  corank = ar->as->corank;
+  corank = gfc_get_corank (array);
 
   if (mpz_cmp_ui (dim->value.integer, 1) < 0
   || mpz_cmp_ui (dim->value.integer, corank) > 0)
2011-10-06  Mikael Morin  

* array.c (gfc_find_array_ref): Remove coarray-specific handling.
diff --git a/array.c b/array.c
index aa9cc0c..3e6b9d2 100644
--- a/array.c
+++ b/array.c
@@ -2296,8 +2296,7 @@ gfc_find_array_ref (gfc_expr *e)
 
   for (ref = e->ref; ref; ref = ref->next)
 if (ref->type == REF_ARRAY
-	&& (ref->u.ar.type == AR_FULL || ref->u.ar.type == AR_SECTION
-	|| (ref->u.ar.type == AR_ELEMENT && ref->u.ar.dimen == 0)))
+	&& (ref->u.ar.type == AR_FULL || ref->u.ar.type == AR_SECTION))
   break;
 
   if (ref == NULL)


[Patch, fortran] [05..09/14] Support coarray subreferences: Add support for array elements.

2011-10-07 Thread Mikael Morin

The  walk_coarray function introduced at
http://gcc.gnu.org/ml/fortran/2011-09/msg00074.html doesn't (like the code it
replaces) support subreferences after the coarray.
These patches are going to change that.

- The first step is, while looking for the coarray reference, to really look for
  it, instead of walking blindly to the last ref (patch 7).
- Then, in the code generated, an offset to the full array has to be added,
  corresponding to the subreference.
  The path taken is to reuse the scalarizer initialization handling for array
  sections subreferences in gfc_walk_variable_expr, and then let the rest
  of the scalarizer do the right thing with that (patch 9).
- For that to work, we need to skip the array ref lookup in
  gfc_walk_variable_expr, which is not valid for coarrays. A new funtion
  gfc_walk_array_ref is introduced, containing all of gfc_walk_variable_expr's 
  code but the array ref lookup (patch 5).
- Then for array elements (like coarray(1,1)), we change them from AR_ELEMENT
  to AR_SECTION so that they get the same treatment as normal arrays in
  gfc_walk_array_ref (patch 8).
- There is a small problem with the latter change; there is an assertion in
  gfc_walk_array_ref that in the AR_SECTION case, rank is non-zero.
  Patch 6 fixes that.

OK?

PS: The patch numbering is odd, because I have tried to reorder patches so that
no regression is introduced.  However, I haven't checked that it is actually the
case.  All I know is at the end, it's fine. ;-)


2011-10-06  Mikael Morin  

* trans-array.h (gfc_walk_array_ref): New prototype.
* trans-array.c (gfc_walk_array_ref): New function, containing
all but the beginning of gfc_walk_variable_expr's code.
(gfc_walk_variable_expr): Use gfc_walk_array_ref.

diff --git a/trans-array.c b/trans-array.c
index 605b356..1cfe382 100644
--- a/trans-array.c
+++ b/trans-array.c
@@ -7591,14 +7591,22 @@ static gfc_ss *
 gfc_walk_variable_expr (gfc_ss * ss, gfc_expr * expr)
 {
   gfc_ref *ref;
-  gfc_array_ref *ar;
-  gfc_ss *newss;
-  int n;
 
   for (ref = expr->ref; ref; ref = ref->next)
 if (ref->type == REF_ARRAY && ref->u.ar.type != AR_ELEMENT)
   break;
 
+  return gfc_walk_array_ref (ss, expr, ref);
+}
+
+
+gfc_ss *
+gfc_walk_array_ref (gfc_ss * ss, gfc_expr * expr, gfc_ref * ref)
+{
+  gfc_array_ref *ar;
+  gfc_ss *newss;
+  int n;
+
   for (; ref; ref = ref->next)
 {
   if (ref->type == REF_SUBSTRING)
diff --git a/trans-array.h b/trans-array.h
index 73d8c40..4d737bd 100644
--- a/trans-array.h
+++ b/trans-array.h
@@ -70,6 +70,8 @@ void gfc_trans_static_array_pointer (gfc_symbol *);
 gfc_ss *gfc_walk_expr (gfc_expr *);
 /* Workhorse for gfc_walk_expr.  */
 gfc_ss *gfc_walk_subexpr (gfc_ss *, gfc_expr *);
+/* Workhorse for gfc_walk_variable_expr.  */
+gfc_ss *gfc_walk_array_ref (gfc_ss *, gfc_expr *, gfc_ref * ref);
 /* Walk the arguments of an elemental function.  */
 gfc_ss *gfc_walk_elemental_function_args (gfc_ss *, gfc_actual_arglist *,
 	  gfc_ss_type);
2011-10-06  Mikael Morin  

PR fortran/50420
* trans-array.c (gfc_walk_array_ref): Allow zero rank arrays
if they are coarrays.
diff --git a/trans-array.c b/trans-array.c
index 1cfe382..4158a32 100644
--- a/trans-array.c
+++ b/trans-array.c
@@ -7688,8 +7688,10 @@ gfc_walk_array_ref (gfc_ss * ss, gfc_expr * expr, gfc_ref * ref)
 		  gcc_unreachable ();
 		}
 	}
-	  /* We should have at least one non-elemental dimension.  */
-	  gcc_assert (newss->data.info.dimen > 0);
+	  /* We should have at least one non-elemental dimension,
+	 unless we are creating a descriptor for a (scalar) coarray.  */
+	  gcc_assert (newss->data.info.dimen > 0
+		  || newss->data.info.ref->u.ar.as->corank > 0);
 	  ss = newss;
 	  break;
 
2011-10-06  Mikael Morin  

PR fortran/50420
* trans-intrinsic.c (walk_coarray): Allow subreferences after a
coarray object reference.
diff --git a/trans-intrinsic.c b/trans-intrinsic.c
index c47e678..7d12eb9 100644
--- a/trans-intrinsic.c
+++ b/trans-intrinsic.c
@@ -941,10 +941,16 @@ walk_coarray (gfc_expr *e)
   ss = gfc_get_array_ss (gfc_ss_terminator, e, 0, GFC_SS_SECTION);
 
   ref = e->ref;
-  while (ref->next)
-	ref = ref->next;
+  while (ref)
+	{
+	  if (ref->type == REF_ARRAY
+	  && ref->u.ar.codimen > 0)
+	break;
+
+	  ref = ref->next;
+	}
 
-  gcc_assert (ref->type == REF_ARRAY && ref->u.ar.codimen > 0);
+  gcc_assert (ref != NULL);
   ref->u.ar.type = AR_FULL;
   ss->data.info.ref = ref;
 }
2011-10-06  Mikael Morin  

PR fortran/50420
* trans-intrinsic.c (walk_coarray): Change AR_ELEMENT to AR_SECTION.
diff --git a/trans-intrinsic.c b/trans-intrinsic.c
index 7d12eb9..e4a8873 100644
--- a/trans-intrinsic.c
+++ b/trans-intrinsic.c
@@ -951,7 +951,8 @@ walk_coarray (gfc_expr *e)
 	}
 
   gcc_assert (ref != NULL);
-  ref->u.ar.type = AR_FULL;
+  if (ref->u.ar.type == AR_ELEMENT)
+	ref->u.ar

[Patch, fortran] [14/14] Support coarray subreferences: fix gfc_build_array_ref

2011-10-07 Thread Mikael Morin
This fixes a failing assertion in gfc_build_array_ref.

While array(x,:) still refers to an array, array(x,y) is a single element, 
and thus coarray(x,y) is a descriptor whose data component points to something
that is not an array.
gfc_conv_expr_descriptor, to update data pointer with subreferences, calls
gfc_get_dataptr_offset which in turn calls gfc_build_array_ref, which expects
an array.
In the non-array case, as there is no extra offset corresponding to array
element, there is nothing to do here.
This patch returns early in that case.

OK?

PS: I'm not very confident with the span stuff this function is about, so
I wouldn't mind Paul having a look.
2011-10-06  Mikael Morin  

PR fortran/50420
* trans.c (gfc_build_array_ref): If type is not an array, check that
there is nothing to do, and do nothing.
diff --git a/trans.c b/trans.c
index 764bdf4..1deff32 100644
--- a/trans.c
+++ b/trans.c
@@ -323,7 +323,14 @@ gfc_build_array_ref (tree base, tree offset, tree decl)
   return fold_convert (TYPE_MAIN_VARIANT (type), base);
 }
 
-  gcc_assert (TREE_CODE (type) == ARRAY_TYPE);
+  /* Scalar coarray, there is nothing to do.  */
+  if (TREE_CODE (type) != ARRAY_TYPE)
+{
+  gcc_assert (decl == NULL_TREE);
+  gcc_assert (integer_zerop (offset));
+  return base;
+}
+
   type = TREE_TYPE (type);
 
   if (DECL_P (base))


[Patch, fortran] [01..04/14] Support coarray subreferences: Add subreferences support in gfc_conv_expr_descriptor

2011-10-07 Thread Mikael Morin
These patches change the descriptor initialization code in
gfc_conv_expr_descriptor introduced by the recent scalarizer patchset at
http://gcc.gnu.org/ml/fortran/2011-09/msg00056.html.
It was supposing (just like the code it was replacing) that coarrays were
always full, but a subobject of a coarray is also a coarray (if 
non-allocatable, non-pointer).
Thus, if `a' is a coarray of rank 2; `a', `a(1,:)' and `a(1,2)' are all valid
coarrays.
Because of the two latter ones, we have to distinguish between the full array
rank (2 in the three cases above), and the partial reference rank (respectively
2, 1, 0).
As a result:
 - in patch 4, we use loop.dimen (partial rank) instead of ndim (full rank) for
   accessing loop and descriptor elements.
 - in patch 3, we count codimensions from 0 and add to it either ndim or
   loop.dimen depending on whether we access array ref's elements or loop
   elements.
Patches 1 and 2 are preliminary changes.

OK?

2011-10-06  Mikael Morin  

* trans-array.c (gfc_conv_expr_descriptor): Move ndim initialization
earlier.
diff --git a/trans-array.c b/trans-array.c
index 5144398..1db2186 100644
--- a/trans-array.c
+++ b/trans-array.c
@@ -5962,6 +5962,8 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss)
   tree to;
   tree base;
 
+  ndim = info->ref ? info->ref->u.ar.dimen : info->dimen;
+
   if (se->want_coarray)
 	{
 	  codim = gfc_get_corank (expr);
@@ -6034,7 +6036,6 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss)
   else
 	base = NULL_TREE;
 
-  ndim = info->ref ? info->ref->u.ar.dimen : info->dimen;
   for (n = 0; n < ndim; n++)
 	{
 	  stride = gfc_conv_array_stride (desc, n);
2011-10-06  Mikael Morin  

* trans-array.c (gfc_conv_expr_descriptor): Save some horizontal space.
diff --git a/trans-array.c b/trans-array.c
index 1db2186..034486d 100644
--- a/trans-array.c
+++ b/trans-array.c
@@ -5966,16 +5966,18 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss)
 
   if (se->want_coarray)
 	{
+	  gfc_array_ref *ar = &info->ref->u.ar;
+
 	  codim = gfc_get_corank (expr);
 	  for (n = ss->data.info.dimen; n < ss->data.info.dimen + codim - 1;
 	   n++)
 	{
 	  /* Make sure we are not lost somehow.  */
-	  gcc_assert (info->ref->u.ar.dimen_type[n] == DIMEN_THIS_IMAGE);
+	  gcc_assert (ar->dimen_type[n] == DIMEN_THIS_IMAGE);
 
 	  /* Make sure the call to gfc_conv_section_startstride won't 
 	 generate unnecessary code to calculate stride.  */
-	  gcc_assert (info->ref->u.ar.stride[n] == NULL);
+	  gcc_assert (ar->stride[n] == NULL);
 
 	  gfc_conv_section_startstride (&loop, ss, n);
 	  loop.from[n] = info->start[n];
@@ -5983,7 +5985,7 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss)
 	}
 
 	  gcc_assert (n == ss->data.info.dimen + codim - 1);
-	  evaluate_bound (&loop.pre, info->start, info->ref->u.ar.start,
+	  evaluate_bound (&loop.pre, info->start, ar->start,
 			  info->descriptor, n, true);
 	  loop.from[n] = info->start[n];
 	}
2011-10-06  Mikael Morin  

PR fortran/50420
* trans-array.c (gfc_conv_expr_descriptor): Count codimensions starting
from zero, and add then the relevant offset (either ndim or loop.dimen)
depending on context.
diff --git a/trans-array.c b/trans-array.c
index 034486d..57534e0 100644
--- a/trans-array.c
+++ b/trans-array.c
@@ -5969,25 +5969,24 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss)
 	  gfc_array_ref *ar = &info->ref->u.ar;
 
 	  codim = gfc_get_corank (expr);
-	  for (n = ss->data.info.dimen; n < ss->data.info.dimen + codim - 1;
-	   n++)
+	  for (n = 0; n < codim - 1; n++)
 	{
 	  /* Make sure we are not lost somehow.  */
-	  gcc_assert (ar->dimen_type[n] == DIMEN_THIS_IMAGE);
+	  gcc_assert (ar->dimen_type[n + ndim] == DIMEN_THIS_IMAGE);
 
 	  /* Make sure the call to gfc_conv_section_startstride won't 
 	 generate unnecessary code to calculate stride.  */
-	  gcc_assert (ar->stride[n] == NULL);
+	  gcc_assert (ar->stride[n + ndim] == NULL);
 
-	  gfc_conv_section_startstride (&loop, ss, n);
-	  loop.from[n] = info->start[n];
-	  loop.to[n]   = info->end[n];
+	  gfc_conv_section_startstride (&loop, ss, n + ndim);
+	  loop.from[n + loop.dimen] = info->start[n + ndim];
+	  loop.to[n + loop.dimen]   = info->end[n + ndim];
 	}
 
-	  gcc_assert (n == ss->data.info.dimen + codim - 1);
+	  gcc_assert (n == codim - 1);
 	  evaluate_bound (&loop.pre, info->start, ar->start,
-			  info->descriptor, n, true);
-	  loop.from[n] = info->start[n];
+			  info->descriptor, n + ndim, true);
+	  loop.from[n + loop.dimen] = info->start[n + ndim];
 	}
   else
 	codim = 0;
2011-10-06  Mikael Morin  

PR fortran/50420
* trans-array.c (gfc_conv_expr_descriptor): Use loop.dimen instead of
ndim for the descriptor's rank.
diff --git

[Patch, fortran] [12/14] Support coarray subreferences: Fix simplify_cobound

2011-10-07 Thread Mikael Morin
simplify_cobound, when it looks for the coarray reference, in the AR_ELEMENT
case, first checks that it is the last reference in the chain. 
As it is what we are trying to avoid, this patch removes that and uses the
corank field directly.

OK?
2011-10-06  Mikael Morin  

PR fortran/50420
* simplify.c (simplify_cobound): Accept non-last-in-ref-chain coarrays.
Don't set already set array ref.
diff --git a/simplify.c b/simplify.c
index 13a9c51..63689bb 100644
--- a/simplify.c
+++ b/simplify.c
@@ -3512,11 +3512,9 @@ simplify_cobound (gfc_expr *array, gfc_expr *dim, gfc_expr *kind, int upper)
 	  switch (ref->u.ar.type)
 	{
 	case AR_ELEMENT:
-	  if (ref->next == NULL)
+	  if (ref->u.ar.as->corank > 0)
 		{
-		  gcc_assert (ref->u.ar.as->corank > 0
-			  && ref->u.ar.as->rank == 0);
-		  as = ref->u.ar.as;
+		  gcc_assert (as == ref->u.ar.as);
 		  goto done;
 		}
 	  as = NULL;


[Patch, fortran] [13/14] Support coarray subreferences: don't force coarray lower bound to 1.

2011-10-07 Thread Mikael Morin
gfc_build_array_type was forcing the lower bound to zero in cases where it was
unspecified (NULL). This is wrong for deferred (allocatable) coarrays at least,
as their cobound is specified at allocation time.
This patch fixes that. 
I don't think other cases beyond AS_DEFERRED need fixing, but I wouldn't mind
a confirmation. ;-)

OK?
 2011-10-06  Mikael Morin  

PR fortran/50420
* trans-types.c (gfc_build_array_type): Don't force lower bound to one
in the deferred case.
diff --git a/trans-types.c b/trans-types.c
index 43f1a19..652c009 100644
--- a/trans-types.c
+++ b/trans-types.c
@@ -1256,7 +1256,7 @@ gfc_build_array_type (tree type, gfc_array_spec * as,
 
   for (n = as->rank; n < as->rank + as->corank; n++)
 {
-  if (as->lower[n] == NULL)
+  if (as->type != AS_DEFERRED && as->lower[n] == NULL)
 lbound[n] = gfc_index_one_node;
   else
 lbound[n] = gfc_conv_array_bound (as->lower[n]);


Re: [Patch, Fortran, OOP] PR 50625: [4.6/4.7 Regression] ALLOCATABLE attribute lost for module CLASS variables

2011-10-07 Thread Janus Weil
>> Regtested successfully on x86_64-unknown-linux-gnu (except for failure
>> on entry_4 and select_type_12, which are known middle-end
>> regressions). Ok for trunk and 4.6?
>
> OK. Thanks for the patch

Thanks for the review. Committed to trunk as r179660.


> - and for telling me that select_type_12 is a
> middle end regression (PR 50640); I already wondered why my being worked-on
> patch showed all of a sudden that failure. (I had self-caused select type
> failures before; thus, I didn't think of a ME problem.)

Yeah, at first I also thought that my local modifications were to
blame. But then I noticed that it only fails with optimization (which
is usually a very reliable sign for a middle-end problem) and that
Dominique had already filed a PR.

Cheers,
Janus



>> 2011-10-07  Janus Weil
>>
>>        PR fortran/50625
>>        * class.c (gfc_build_class_symbol): Fix whitespace.
>>        * module.c (mio_symbol): Set 'class_ok' attribute.
>>        * trans-decl.c (gfc_get_symbol_decl): Make sure the backend_decl
>> has
>>        been built for class symbols.
>>
>>
>> 2011-10-07  Janus Weil
>>
>>        PR fortran/50625
>>        * gfortran.dg/class_46.f03: New.
>
>


Re: [patch tree-optimization]: Improve handling of conditional-branches on targets with high branch costs

2011-10-07 Thread Richard Guenther
On Thu, Oct 6, 2011 at 4:25 PM, Kai Tietz  wrote:
> Hi,
>
> I modified the patch so, that it always just converts two leafs of a 
> TRUTH(AND|OR)IF chain into a TRUTH_(AND|OR) expression, if branch costs are 
> high and leafs are simple without side-effects.
>
> Additionally I added some testcases for it.
>
> 2011-10-06  Kai Tietz  
>
>        * fold-const.c (fold_truth_andor): Convert TRUTH_(AND|OR)IF_EXPR
>        to TRUTH_OR_EXPR, if suitable.
>
> 2011-10-06  Kai Tietz  
>
>        * gcc.dg/tree-ssa/ssa-ifbranch-1.c: New test.
>        * gcc.dg/tree-ssa/ssa-ifbranch-2.c: New test.
>        * gcc.dg/tree-ssa/ssa-ifbranch-3.c: New test.
>        * gcc.dg/tree-ssa/ssa-ifbranch-4.c: New test.
>
> Bootstrapped and tested for all languages (including Ada and Obj-C++) on host 
> x86_64-unknown-linux-gnu.  Ok for apply?
>
> Regards,
> Kai
>
> Index: gcc-head/gcc/testsuite/gcc.dg/tree-ssa/ssa-ifbranch-1.c
> ===
> --- /dev/null
> +++ gcc-head/gcc/testsuite/gcc.dg/tree-ssa/ssa-ifbranch-1.c
> @@ -0,0 +1,18 @@
> +/* Skip on MIPS, S/390, and AVR due LOGICAL_OP_NON_SHORT_CIRCUIT, and
> +   lower values in BRANCH_COST.  */
> +/* { dg-do compile { target { ! "mips*-*-* s390*-*-*  avr-*-* mn10300-*-*" } 
> } } */
> +/* { dg-options "-O2 -fdump-tree-gimple" } */
> +/* { dg-options "-O2 -fdump-tree-gimple -march=i586" { target { i?86-*-* && 
> ilp32 } } } */
> +
> +extern int doo1 (void);
> +extern int doo2 (void);
> +
> +int bar (int a, int b, int c)
> +{
> +  if (a && b && c)
> +    return doo1 ();
> +  return doo2 ();
> +}
> +
> +/* { dg-final { scan-tree-dump-times "if " 2 "gimple" } } */
> +/* { dg-final { cleanup-tree-dump "gimple" } } */
> Index: gcc-head/gcc/fold-const.c
> ===
> --- gcc-head.orig/gcc/fold-const.c
> +++ gcc-head/gcc/fold-const.c
> @@ -8387,6 +8387,45 @@ fold_truth_andor (location_t loc, enum t
>   if ((tem = fold_truthop (loc, code, type, arg0, arg1)) != 0)
>     return tem;
>
> +  if ((code == TRUTH_ANDIF_EXPR || code == TRUTH_ORIF_EXPR)
> +      && !TREE_SIDE_EFFECTS (arg1)
> +      && LOGICAL_OP_NON_SHORT_CIRCUIT
> +      /* floats might trap.  */
> +      && !FLOAT_TYPE_P (TREE_TYPE (arg1))

Floats don't "trap" on their own.  If possibly trapping trees don't have
TREE_SIDE_EFFECTS set then you want

&& !tree_could_trap_p (arg1)

here.

> +      && ((TREE_CODE_CLASS (TREE_CODE (arg1)) != tcc_comparison
> +           && TREE_CODE (arg1) != TRUTH_NOT_EXPR
> +           && simple_operand_p (arg1))

As I said previously simple_operand_p already rejects covers
comparisons and TRUTH_NOT_EXPR.  Also arg1 had better
TREE_SIDE_EFFECTS set if the comparison might trap, as
it might just be hidden in something more complicated - so
the simple check isn't enough anyway (and if simple_operand_p
would cover it, the check would be better placed there).

> +          || ((TREE_CODE_CLASS (TREE_CODE (arg1)) == tcc_comparison
> +               || TREE_CODE (arg1) == TRUTH_NOT_EXPR)
> +             /* Float comparison might trap.  */
> +              && !FLOAT_TYPE_P (TREE_TYPE (TREE_OPERAND (arg1, 0)))
> +              && simple_operand_p (TREE_OPERAND (arg1, 0)
> +    {
> +      /* We want to combine truth-comparison for
> +        ((W TRUTH-ANDOR X) TRUTH-ANDORIF Y) TRUTH-ANDORIF Z,
> +        if Y and Z are simple operands and have no side-effect to
> +        ((W TRUTH-ANDOR X) TRUTH-IF (Y TRUTH-ANDOR Z).  */

No we don't.  See down-thread.

> +      if (TREE_CODE (arg0) == code
> +          && !TREE_SIDE_EFFECTS (TREE_OPERAND (arg0, 1))
> +          && simple_operand_p (TREE_OPERAND (arg0, 1)))
> +       {
> +         tem = build2_loc (loc,
> +                           (code == TRUTH_ANDIF_EXPR ? TRUTH_AND_EXPR
> +                                                     : TRUTH_OR_EXPR),
> +                           type, TREE_OPERAND (arg0, 1), arg1);
> +         return build2_loc (loc, code, type, TREE_OPERAND (arg0, 0),
> +                            tem);

All trees should be folded, don't use plain build without a good reason.

> +       }
> +      /* Convert X TRUTH-ANDORIF Y to X TRUTH-ANDOR Y, if X and Y
> +        are simple operands and have no side-effects.  */
> +      if (simple_operand_p (arg0)
> +          && !TREE_SIDE_EFFECTS (arg0))

Again, the checks you do for arg0 do not match those for arg1.  OTOH
it doesn't matter whether arg0 is simple or not or has side-effects or
not for this transformation, so why check it at all?

In fold_truthop we still have the same (albeit more restricted transform),
but guarded with

 if (BRANCH_COST (optimize_function_for_speed_p (cfun),
   false) >= 2

too.  Why not here?  Please delete redundant code in fold_truthop.

It's also odd that this is only called from fold_truth_andor but has
a more generic name, so maybe rename it to fold_truth_andor_1 on the way.

Richard.

> +       return build2_loc (loc,
> +         

Re: [Patch] Support DEC-C extensions

2011-10-07 Thread Joseph S. Myers
On Fri, 7 Oct 2011, Tristan Gingold wrote:

> Here is my patch with the option renamed.
> 
> Ok for trunk ?

OK with a spelling fix:

> +@item -fallow-parameterless-variadic-functions
> +Accept variadic functions without named parameters.
> +
> +Although it is possible to define such a function, this is not very
> +usefull as it is not possible to read the arguments.  This is only

"useful"

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


Re: [PATCH][ARM] Fix broken shift patterns

2011-10-07 Thread Andrew Stubbs

On 07/10/11 13:37, Paul Brook wrote:

Done, and attached.


Ok.

Two changes to the testcase that I'll pre-approve:
- Add a comment along the lines of
   /* ARM has shift-and-alu insns.  Depending on the ALU op GCC represents some
of these as a left shift, others as a multiply.  Check that we match the
right one.  */
- Also test (a * 64) - b [rsb] and ~(a * 64) [mvn]


Thanks, I've committed the attached.


In this case, I believe the hardware simply shifts the the value clean
out of the register, and always returns a zero (or maybe -1 for
ashiftrt?).


I'm not convinced.  ARM instructions shift modulo 256
(i.e. a>>  (b&  0xff).  I'm pretty sure anything that gets constant-folded by
earlier passes will not honor these semantics.


True, but I'm still not sure what the least wrong way to do this might be.


For bonus points we should probably disallow MULT in the arm_shiftsi3
pattern, stop it interacting with the regular mulsi3 pattern in
undesirable ways.


How might that be a problem? Is it not the case that canonical forms
already deals with this?


Mainly just general principle that having two insns with the same pattern is
wrong - reload can't flip between them like it can different altrnatives, and
there's obscure rules about which one wins when both match.


OK, so we'd just need a shift_operator_that_isnt_mult predicate, 
(probably not with that name).


Andrew
2011-10-07  Andrew Stubbs  

	gcc/
	* config/arm/predicates.md (shift_amount_operand): Remove constant
	range check.
	(shift_operator): Check range of constants for all shift operators.

	gcc/testsuite/
	* gcc.dg/pr50193-1.c: New file.
	* gcc.target/arm/shiftable.c: New file.

--- a/gcc/config/arm/predicates.md
+++ b/gcc/config/arm/predicates.md
@@ -129,11 +129,12 @@
   (ior (match_operand 0 "arm_rhs_operand")
(match_operand 0 "memory_operand")))
 
+;; This doesn't have to do much because the constant is already checked
+;; in the shift_operator predicate.
 (define_predicate "shift_amount_operand"
   (ior (and (match_test "TARGET_ARM")
 	(match_operand 0 "s_register_operand"))
-   (and (match_code "const_int")
-	(match_test "((unsigned HOST_WIDE_INT) INTVAL (op)) < 32"
+   (match_operand 0 "const_int_operand")))
 
 (define_predicate "arm_add_operand"
   (ior (match_operand 0 "arm_rhs_operand")
@@ -219,13 +220,20 @@
(match_test "mode == GET_MODE (op)")))
 
 ;; True for shift operators.
+;; Notes:
+;;  * mult is only permitted with a constant shift amount
+;;  * patterns that permit register shift amounts only in ARM mode use
+;;shift_amount_operand, patterns that always allow registers do not,
+;;so we don't have to worry about that sort of thing here.
 (define_special_predicate "shift_operator"
   (and (ior (ior (and (match_code "mult")
 		  (match_test "power_of_two_operand (XEXP (op, 1), mode)"))
 		 (and (match_code "rotate")
 		  (match_test "GET_CODE (XEXP (op, 1)) == CONST_INT
    && ((unsigned HOST_WIDE_INT) INTVAL (XEXP (op, 1))) < 32")))
-	(match_code "ashift,ashiftrt,lshiftrt,rotatert"))
+	(and (match_code "ashift,ashiftrt,lshiftrt,rotatert")
+		 (match_test "GET_CODE (XEXP (op, 1)) != CONST_INT
+			  || ((unsigned HOST_WIDE_INT) INTVAL (XEXP (op, 1))) < 32")))
(match_test "mode == GET_MODE (op)")))
 
 ;; True for shift operators which can be used with saturation instructions.
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr50193-1.c
@@ -0,0 +1,10 @@
+/* PR 50193: ARM: ICE on a | (b << negative-constant) */
+/* Ensure that the compiler doesn't ICE.  */
+
+/* { dg-options "-O2" } */
+
+int
+foo(int a, int b)
+{
+  return a | (b << -3); /* { dg-warning "left shift count is negative" } */
+}
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/shiftable.c
@@ -0,0 +1,63 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-require-effective-target arm32 } */
+
+/* ARM has shift-and-alu insns.  Depending on the ALU op GCC represents some
+   of these as a left shift, others as a multiply.  Check that we match the
+right one.  */
+
+int
+plus (int a, int b)
+{
+  return (a * 64) + b;
+}
+
+/* { dg-final { scan-assembler "add.*\[al]sl #6" } } */
+
+int
+minus (int a, int b)
+{
+  return a - (b * 64);
+}
+
+/* { dg-final { scan-assembler "sub.*\[al]sl #6" } } */
+
+int
+ior (int a, int b)
+{
+  return (a * 64) | b;
+}
+
+/* { dg-final { scan-assembler "orr.*\[al]sl #6" } } */
+
+int
+xor (int a, int b)
+{
+  return (a * 64) ^ b;
+}
+
+/* { dg-final { scan-assembler "eor.*\[al]sl #6" } } */
+
+int
+and (int a, int b)
+{
+  return (a * 64) & b;
+}
+
+/* { dg-final { scan-assembler "and.*\[al]sl #6" } } */
+
+int
+rsb (int a, int b)
+{
+  return (a * 64) - b;
+}
+
+/* { dg-final { scan-assembler "rsb.*\[al]sl #6" } } */
+
+int
+mvn (int a, int b)
+{
+  return ~(a * 64);
+}
+
+/* { dg-final { scan-assembler "mvn.*\[al]sl #6" } } */


[i386] add missing --with-cpu entries

2011-10-07 Thread Richard Henderson
* config.gcc (x86_64-*): Add core-avx-i, core-avx2 for with_cpu.

diff --git a/gcc/config.gcc b/gcc/config.gcc
index 8b380ac..8099ed7 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -3302,7 +3302,7 @@ case "${target}" in
| k8 | k8-sse3 | athlon64 | athlon64-sse3 | opteron \
| opteron-sse3 | athlon-fx | bdver2 | bdver1 | btver1 \
| amdfam10 | barcelona | nocona | core2 | corei7 \
-   | corei7-avx | atom)
+   | corei7-avx | core-avx-i | core-avx2 | atom)
# OK
;;
*)


Re: Modify gcc for use with gdb (issue5132047)

2011-10-07 Thread Jeff Law
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 10/07/11 07:42, Tom Tromey wrote:
>> "Jeff" == Jeff Law  writes:
> 
> Jeff> Presumably it hasn't been included because not all gdb's 
> understand Jeff> those bits and we typically don't build with -g3.
> 
> GCC is pretty much the perfect candidate for a -g3 build.  All 
> those macros...
> 
> The needed gdb changes have been in since right around when I added
> that patch to the incremental branch.  Anybody with a > 3 year old
> gdb should upgrade :-)
Hard to argue with that :-)  Gone are the days when I'd build a binary
tool of some sort and use it for many years thereafter.  I doubt
there's any binary on my boxes older than a year...

jeff
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJOjx63AAoJEBRtltQi2kC7fXoH/13uE6l2klTOFPrAKbTszo5s
0fxtmLD9NQWyeOFuGL4P9O9J6rChdulFvY9oNlWUrJIwF7WTOp4FjqNZnhvzoIT8
zEqoT8yVO7pNS7KMyRbxJxz5iEx8pX0YW2O2Rl/qZGy/hFKatqaOgz/RuBZy4lg2
NpiKWULKRsc66FxPKhCPMqtSd338XOhC0S67D2GuK1qD93SFDEyoQbaViieMlmoo
qr5oFn1052byWd3J1cPbu5vv76YLnzPEmBybm0k/ZaoGFC/JidDghQvR9uHtBbbl
LLsFIej62rzCLWZTfbgaiAfKZv79msjhZIrhv8T9iSAolUG4KDvLCvP8SbUg6XI=
=KKKR
-END PGP SIGNATURE-


Fix PR50638 (segfault with emutls)

2011-10-07 Thread Michael Matz
Hi,

tree-emutls.c missed to called add_referenced_var for a variable that is 
referenced.  That always was a bug, but meanwhile is fatal (causing a 
segfault).  This fixes the problem.  Okay for trunk if regstrapping 
succeeds?

The related bugreport PR50640 (fortran segfaults for similar reasons) is a 
bit more involved and requires some pondering on my part.  The PR50644 
(LTO segfault) requires some analysis still, to know which variable causes 
this.


Ciao,
Michael.
-
PR middle-end/50638
* tree-emutls.c (gen_emutls_addr): Call add_referenced_var.

Index: tree-emutls.c
===
--- tree-emutls.c   (revision 179606)
+++ tree-emutls.c   (working copy)
@@ -434,6 +434,7 @@ gen_emutls_addr (tree decl, struct lower
   addr = create_tmp_var (build_pointer_type (TREE_TYPE (decl)), NULL);
   x = gimple_build_call (d->builtin_decl, 1, build_fold_addr_expr (cdecl));
   gimple_set_location (x, d->loc);
+  add_referenced_var (cdecl);
 
   addr = make_ssa_name (addr, x);
   gimple_call_set_lhs (x, addr);


[patch tree-optimization]: 0 of 6 Improve reassoc for bitwise operations

2011-10-07 Thread Kai Tietz
Hello,

This patch does rename break_up_subtract_bb to break_up_expr_bb, and it
modifies build_and_add_sum so that unary expression can be created by it, too.
The patch is a prerequisit of the following 6 additional patches.

ChangeLog

2011-10-07  Kai Tietz  

* tree-ssa-reassoc.c (break_up_subtract_bb): Rename to
(break_up_expr_bb): as function name.
(build_and_add_sum): Add support for unary statement creation.


Index: gcc/gcc/tree-ssa-reassoc.c
===
--- gcc.orig/gcc/tree-ssa-reassoc.c
+++ gcc/gcc/tree-ssa-reassoc.c
@@ -44,6 +44,9 @@ along with GCC; see the file COPYING3.
 #include "params.h"
 #include "diagnostic-core.h"

+/* Forwarders.  */
+static gimple build_and_add_sum (tree, tree, tree, enum tree_code);
+
 /*  This is a simple global reassociation pass.  It is, in part, based
 on the LLVM pass of the same name (They do some things more/less
 than we do, in different orders, etc).
@@ -1018,8 +1021,8 @@ zero_one_operation (tree *def, enum tree
   while (1);
 }

-/* Builds one statement performing OP1 OPCODE OP2 using TMPVAR for
-   the result.  Places the statement after the definition of either
+/* Builds one statement performing OP1 OPCODE OP2, or OPCODE OP1 using
+   TMPVAR for the result.  Places the statement after the definition of either
OP1 or OP2.  Returns the new statement.  */

 static gimple
@@ -1038,7 +1041,7 @@ build_and_add_sum (tree tmpvar, tree op1
   /* Find an insertion place and insert.  */
   if (TREE_CODE (op1) == SSA_NAME)
 op1def = SSA_NAME_DEF_STMT (op1);
-  if (TREE_CODE (op2) == SSA_NAME)
+  if (op2 && TREE_CODE (op2) == SSA_NAME)
 op2def = SSA_NAME_DEF_STMT (op2);
   if ((!op1def || gimple_nop_p (op1def))
   && (!op2def || gimple_nop_p (op2def)))
@@ -2777,7 +2780,7 @@ can_reassociate_p (tree op)
En passant, clear the GIMPLE visited flag on every statement.  */

 static void
-break_up_subtract_bb (basic_block bb)
+break_up_expr_bb (basic_block bb)
 {
   gimple_stmt_iterator gsi;
   basic_block son;
@@ -2812,7 +2815,7 @@ break_up_subtract_bb (basic_block bb)
   for (son = first_dom_son (CDI_DOMINATORS, bb);
son;
son = next_dom_son (CDI_DOMINATORS, son))
-break_up_subtract_bb (son);
+break_up_expr_bb (son);
 }

 /* Reassociate expressions in basic block BB and its post-dominator as
@@ -2981,7 +2984,7 @@ debug_ops_vector (VEC (operand_entry_t,
 static void
 do_reassoc (void)
 {
-  break_up_subtract_bb (ENTRY_BLOCK_PTR);
+  break_up_expr_bb (ENTRY_BLOCK_PTR);
   reassociate_bb (EXIT_BLOCK_PTR);
 }


[patch tree-optimization]: 2 of 6 Improve reassoc for bitwise operations

2011-10-07 Thread Kai Tietz
Hello,

This patch adds the repropagation of expanded bitwise-not expressions.

ChangeLog

2011-10-07  Kai Tietz  

* tree-ssa-reassoc.c (walk_bitwise_stmt_elems): Helper
to collect different kinds of operands of a bitwise-binary
expression chain.
(rebuild_vector_tree): Helper function to create out of
a vector list a bitwise-binary kind statement-chain.
(operate_bitwise_xor_stmt): Perform repropagation for a XOR
statement chain.
(operate_bitwise_stmt): Handler to repropagate a bitwise
statement-chain.
(repropagate_bitwise): Handler to repropage bitwise-binaries.
(execute_reassoc): Make use of repropagate_bitwise.


2011-10-07  Kai Tietz  

* gcc.dg/tree-ssa/reassoc-not-1.c: New file.

Bootstrapped and regression-tested for all languages plus Ada and
Obj-C++ on x86_64-pc-linux-gnu.
Ok for apply?

Regards,
Kai

Index: gcc/gcc/tree-ssa-reassoc.c
===
--- gcc.orig/gcc/tree-ssa-reassoc.c
+++ gcc/gcc/tree-ssa-reassoc.c
@@ -3110,6 +3110,366 @@ linearize_expr_tree (VEC(operand_entry_t
   add_to_ops_vec (ops, binrhs);
 }

+/* Split up a binary tree-chain of code CODE - starting at STMT - into three
+   different kinds:
+   - vector VCST stores constant values.
+   - vector VNOT stores bitwise-not expressions.
+   - vector VEXRR stores the remaining rest. */
+
+static void
+walk_bitwise_stmt_elems (gimple stmt, enum tree_code code,
+VEC(tree, heap) **vcst,
+VEC(tree, heap) **vnot,
+VEC(tree, heap) **vexpr)
+{
+  gimple s;
+  tree l;
+
+  l = gimple_assign_rhs1 (stmt);
+  if (TREE_CODE (l) == INTEGER_CST)
+VEC_safe_push (tree, heap, *vcst, l);
+  else if (TREE_CODE (l) != SSA_NAME
+  || (s = SSA_NAME_DEF_STMT (l)) == NULL
+  || !is_gimple_assign (s)
+  || !has_single_use (l))
+VEC_safe_push (tree, heap, *vexpr, l);
+  else if (gimple_assign_rhs_code (s) == code)
+walk_bitwise_stmt_elems (s, code, vcst, vnot, vexpr);
+  else if (gimple_assign_rhs_code (s) == BIT_NOT_EXPR)
+VEC_safe_push (tree, heap, *vnot, l);
+  else
+VEC_safe_push (tree, heap, *vexpr, l);
+
+  l = gimple_assign_rhs2 (stmt);
+
+  if (TREE_CODE (l) == INTEGER_CST)
+{
+  VEC_safe_push (tree, heap, *vcst, l);
+  return;
+}
+  if (TREE_CODE (l) != SSA_NAME
+  || (s = SSA_NAME_DEF_STMT (l)) == NULL
+  || !is_gimple_assign (s)
+  || !has_single_use (l))
+VEC_safe_push (tree, heap, *vexpr, l);
+  else if (gimple_assign_rhs_code (s) == code)
+walk_bitwise_stmt_elems (s, code, vcst, vnot, vexpr);
+  else if (gimple_assign_rhs_code (s) == BIT_NOT_EXPR)
+VEC_safe_push (tree, heap, *vnot, l);
+  else
+VEC_safe_push (tree, heap, *vexpr, l);
+}
+
+/* Helper function to rebuild a binary tree of CODE elements
+   from vector VEC.
+   If LASTP is NULL, then all elements are combined and the result is
+   returned.  Otherwise the last element of vector VEC is stored in LASTP
+   and all - but the last - elements are merged and returned.
+   Note: for vector with just one element, this element is returned
+   and LASTP is set to NULL, if provided.
+   If INNER_LEFT has value TRUE, then the RHS1 operand of VEC elements
+   are used for combining.  Otherwise the VEC elements itself are used.  */
+
+static tree
+rebuild_vector_tree (VEC(tree, heap) *vec,
+enum tree_code code, tree *lastp, bool inner_left)
+{
+  gimple s;
+  unsigned int i = 0;
+  tree r = NULL_TREE, x, r2 = NULL_TREE;
+
+  FOR_EACH_VEC_ELT (tree, vec, i, x)
+{
+  s = SSA_NAME_DEF_STMT (x);
+
+  if (inner_left)
+   x = gimple_assign_rhs1 (s);
+  if (!r)
+r = x;
+  else if (!r2)
+r2 = x;
+  else
+{
+ r = make_new_tmp_statement (TREE_TYPE (r), code, r, r2, s);
+ r2 = x;
+   }
+}
+  if (lastp)
+*lastp = r2;
+  else if (r && r2)
+{
+  s = SSA_NAME_DEF_STMT (r);
+  r = make_new_tmp_statement (TREE_TYPE (r), code, r, r2, s);
+}
+  return r;
+}
+
+/* Sink not-expression out of xor-expression-sequences.  This sequence
+   is made out of VNOT, VEXPR, and TCST.
+   It returns TRUE, if tree-chain PGSI - starting at STMT - was modified,
+   otherwise FALSE.  */
+
+static bool
+operate_bitwise_xor_stmt (gimple_stmt_iterator *pgsi, gimple stmt, tree tcst,
+ VEC(tree, heap) *vnot,
+ VEC(tree, heap) *vexpr)
+{
+  unsigned int i = VEC_length (tree, vnot);
+  tree l = NULL_TREE, r = NULL_TREE;
+  bool inv = false;
+
+  /* If the amount of not-expressions is odd, then we have two cases:
+ a) we have a constant, so we can sink one not into integeral constant
+as ~X ^ CST -> X ^ CST' with CST' = ~CST.
+ b) we need to add to the hole statment a bitwise-not expression.  */
+  if ((i & 1) != 0)
+{
+  if (tcst)
+{
+ 

[patch tree-optimization]: 1 of 6 Improve reassoc for bitwise operations

2011-10-07 Thread Kai Tietz
Hello,

This patch adds to the break-up pass the facility to sink bitwise-not operations
into bitwise-binary expressions.  Additionally it handles special
cases for ~(~X),
and ~(X cmp Y).

ChangeLog

2011-10-07  Kai Tietz  

* tree-ssa-reassoc.c (remove_stmt_chain): Helper function
to remove gimple-assignment tree with all arms.
(make_new_tmp_statement): Helper function to create temporary
register expression.
(expand_not_bitwise_binary): Perform bitwise-not operation on
gimple-assignment tree.
(break_up_bitwise_combined_stmt): Break-up handler for bitwise-
operations.
(break_up_expr_bb): Adjust to call break_up_bitwise_combined_stmt.

2011-10-07  Kai Tietz  

* gcc.dg/tree-ssa/reassoc-not-1.c: New file.
* gcc.dg/tree-ssa/reassoc-not-2.c: New file.
* gcc.dg/tree-ssa/reassoc-not-3.c: New file.

Bootstrapped and regression-tested for all languages plus Ada and
Obj-C++ on x86_64-pc-linux-gnu.
Ok for apply?

Regards,
Kai

Index: gcc/gcc/tree-ssa-reassoc.c
===
--- gcc.orig/gcc/tree-ssa-reassoc.c
+++ gcc/gcc/tree-ssa-reassoc.c
@@ -46,6 +46,7 @@ along with GCC; see the file COPYING3.

 /* Forwarders.  */
 static gimple build_and_add_sum (tree, tree, tree, enum tree_code);
+static void remove_stmt_chain (tree);

 /*  This is a simple global reassociation pass.  It is, in part, based
 on the LLVM pass of the same name (They do some things more/less
@@ -53,8 +54,11 @@ static gimple build_and_add_sum (tree, t

 It consists of five steps:

-1. Breaking up subtract operations into addition + negate, where
+1. Breaking up expressions
+1.1. Breaking up subtract operations into addition + negate, where
 it would promote the reassociation of adds.
+1.2. Breaking up to normalized form for bitwise-not operations
+on bitwise-binary and for bitwise-not operation on compares.

 2. Left linearization of the expression trees, so that (A+B)+(C+D)
 becomes (((A+B)+C)+D), which is easier for us to rewrite later.
@@ -560,6 +564,265 @@ get_unary_op (tree name, enum tree_code
   return NULL_TREE;
 }

+/* Create a temporary register expression with type TYPE, tree code CODE, and
+   operands OP1 and OP2.  If REF_DEF is a valid gimple statement, we use its
+   location information for new generated temporary.
+   Function returns left-hand-side of new generated temporary register.  */
+
+static tree
+make_new_tmp_statement (tree type, enum tree_code code, tree op1, tree op2,
+   gimple ref_def)
+{
+  gimple sum;
+  tree tmpvar = create_tmp_reg (type, NULL);
+  add_referenced_var (tmpvar);
+  sum = build_and_add_sum (tmpvar, op1, op2, code);
+  if (ref_def)
+gimple_set_location (sum, gimple_location (ref_def));
+  return gimple_get_lhs (sum);
+}
+
+/* Perform on tree LHS with optional definition statement EXPR
+   the logic-not operation.  TYPE is of kind boolean.  */
+
+static tree
+expand_not_bitwise_binary (tree type, tree lhs, gimple expr)
+{
+  enum tree_code code = ERROR_MARK;
+  tree op1 = NULL, op2 = NULL;
+  gimple s1 = NULL, s2 = NULL;
+
+  if (TREE_CODE (lhs) == INTEGER_CST)
+return fold_build1 (BIT_NOT_EXPR, type, lhs);
+
+  if (expr && is_gimple_assign (expr))
+code = gimple_assign_rhs_code (expr);
+
+  /* If statement lhs isn't a single-use statement,
+ we don't want to modify it. So we can do only default-case
+ operation for it.  */
+  if (code != ERROR_MARK && !has_single_use (lhs))
+code = ERROR_MARK;
+
+  if (TREE_CODE_CLASS (code) == tcc_comparison
+  || code == BIT_XOR_EXPR
+  || code == BIT_AND_EXPR
+  || code == BIT_IOR_EXPR)
+{
+  op1 = gimple_assign_rhs1 (expr);
+  op2 = gimple_assign_rhs2 (expr);
+}
+  /* ~(~X) -> X.  */
+  else if (code == BIT_NOT_EXPR)
+return gimple_assign_rhs1 (expr);
+  else
+return make_new_tmp_statement (TREE_TYPE (lhs), BIT_NOT_EXPR, lhs,
+  NULL_TREE, expr);
+
+  /* ~(X cmp Y) -> X cmp' Y, with cmp'=inverted comparison code, if allowed.
+ Otherwise fall through to default case.  */
+  if (TREE_CODE_CLASS (code) == tcc_comparison)
+{
+  enum tree_code ncode;
+  tree op1type = TREE_TYPE (op1);
+
+  ncode = invert_tree_comparison (code,
+ HONOR_NANS (TYPE_MODE (op1type)));
+  if (ncode != ERROR_MARK)
+   return make_new_tmp_statement (type, ncode, op1, op2, expr);
+}
+  /* Handle transformation for ~(A & B) -> ~A | ~B or ~(A | B) -> ~A & ~B.  */
+  else if (code == BIT_AND_EXPR || code == BIT_IOR_EXPR)
+{
+  /* See if left-hand operand is a gimple-assign, and has single-use. */
+  if (TREE_CODE (op1) != SSA_NAME
+  || !(s1 = SSA_NAME_DEF_STMT (op1))
+  || !is_gimple_assign (s1)
+  || !has_single_use (op1))
+   s1 = NULL;
+  /* See if right-hand operand is a gimple-assign, an

[patch tree-optimization]: 3 of 6 Improve reassoc for bitwise operations

2011-10-07 Thread Kai Tietz
Hello,

This patch adds to the break-up pass the facility to expand (X | Y) ==/!= 0
expression.  This enables in later reassociation pass better results.

ChangeLog

2011-10-07  Kai Tietz  

* tree-ssa-reassoc.c (expand_cmp_ior): Helper for expanding
(X | Y) ==/!= 0 statments.
(break_up_bitwise_combined_stmt): Make use of expand_cmp_ior.

2011-10-07  Kai Tietz  

* gcc.dg/tree-ssa/reassoc-cmpior-1.c: New file.
* gcc.dg/tree-ssa/reassoc-cmpior-2.c: New file.
* gcc.dg/tree-ssa/reassoc-cmpior-3.c: New file.

Bootstrapped and regression-tested for all languages plus Ada and
Obj-C++ on x86_64-pc-linux-gnu.
Ok for apply?

Regards,
Kai

Index: gcc/gcc/tree-ssa-reassoc.c
===
--- gcc.orig/gcc/tree-ssa-reassoc.c
+++ gcc/gcc/tree-ssa-reassoc.c
@@ -59,6 +59,8 @@ static void remove_stmt_chain (tree);
 it would promote the reassociation of adds.
 1.2. Breaking up to normalized form for bitwise-not operations
 on bitwise-binary and for bitwise-not operation on compares.
+1.3  Breaking up combined expression made out of boolean-typed bitwise
+expressions for improving simplification.

 2. Left linearization of the expression trees, so that (A+B)+(C+D)
 becomes (((A+B)+C)+D), which is easier for us to rewrite later.
@@ -712,8 +714,89 @@ expand_not_bitwise_binary (tree type, tr
 NULL_TREE, expr);
 }

+/* Routine to expand (X | Y) ==/!= 0 and doing
+   simplification on (X cmp Y) ==/!= 0.
+- (X | Y) == 0 to (X == 0) & (Y == 0)
+- (X | Y) != 0 to (X != 0) | (Y != 0).
+- (X cmp Y) == 0 to (X cmp' Y) with cmp'=invert of cmp.
+- (X cmp Y) != 0 to (X cmp Y).
+
+   The argument CODE can be either NE_EXPR, or EQ_EXPR.  It indicates
+   what kind of expansion is performed.  */
+
+static tree
+expand_cmp_ior (tree op, tree type, enum tree_code code)
+{
+  tree op1, op2;
+  gimple s = NULL;
+  enum tree_code hcode;
+
+  /* Handle integral constant value case.  */
+  if (TREE_CODE (op) == INTEGER_CST)
+{
+  if (code == EQ_EXPR)
+return fold_convert (type, (integer_zerop (op) ? integer_one_node
+   : integer_zero_node));
+  return fold_convert (type, (!integer_zerop (op) ? integer_one_node
+ : integer_zero_node));
+}
+
+  /* If operand OP isn't a gimple-assign, or has non-single use,
+ then simply creat a comparison != 0 for it.  */
+  if (TREE_CODE (op) != SSA_NAME
+  || !(s = SSA_NAME_DEF_STMT (op))
+  || !is_gimple_assign (s)
+  || !has_single_use (op))
+return make_new_tmp_statement (type, code, op,
+  build_zero_cst (TREE_TYPE (op)), s);
+
+  hcode = gimple_assign_rhs_code (s);
+
+  /* Operand code of OP isn't of comparison kind, and not
+ a bitwise-not, then creat a comparison != 0 for it.  */
+  if (TREE_CODE_CLASS (hcode) != tcc_comparison
+  && hcode != BIT_IOR_EXPR)
+return make_new_tmp_statement (type, code, op,
+  build_zero_cst (TREE_TYPE (op)), s);
+
+  op1 = gimple_assign_rhs1 (s);
+  op2 = gimple_assign_rhs2 (s);
+
+  /* Simplify (X cmp Y) != 0 -> (X cmp Y), and
+ (X cmp Y) == 0 -> X cnp' Y, with cmp' = inverted cmp.  */
+  if (TREE_CODE_CLASS (hcode) == tcc_comparison)
+{
+  tree op1type = TREE_TYPE (op1);
+
+  if (code == EQ_EXPR)
+{
+ enum tree_code ncode;
+ ncode = invert_tree_comparison (hcode,
+ HONOR_NANS (TYPE_MODE (op1type)));
+ if (ncode != ERROR_MARK)
+   return make_new_tmp_statement (type, ncode, op1, op2, s);
+}
+  else
+return make_new_tmp_statement (type, hcode, op1, op2, s);
+}
+
+  /* Break up (X | Y) ==/!= 0 case.  */
+  if (hcode == BIT_IOR_EXPR)
+{
+  op1 = expand_cmp_ior (op1, type, code);
+  op2 = expand_cmp_ior (op2, type, code);
+  return make_new_tmp_statement (type, (code == EQ_EXPR ? BIT_AND_EXPR
+   : BIT_IOR_EXPR),
+op1, op2, s);
+}
+  return make_new_tmp_statement (type, code, op,
+build_zero_cst (TREE_TYPE (op)), s);
+}
+
+
 /* Break up STMT if it is a combined statement made out of
-   bitwise operations.  Handle expansion of ~(A op B).  */
+   bitwise operations.  Handle expansion of ~(A op B), and
+   (A | B) !=/== 0.  */

 static bool
 break_up_bitwise_combined_stmt (gimple stmt)
@@ -728,9 +811,13 @@ break_up_bitwise_combined_stmt (gimple s
   old_op1 = op1;
   old_op2 = op2 = NULL_TREE;

+  if (code == EQ_EXPR || code == NE_EXPR)
+old_op2 = op2 = gimple_assign_rhs2 (stmt);
+
   /* Check that CODE can be handled and that left-hand operand
  is of kind SSA_NAME.  */
-  if (code != BIT_NOT_EXPR
+  if ((code != BIT_NO

[patch tree-optimization]: 5 of 6 Improve reassoc for bitwise operations

2011-10-07 Thread Kai Tietz
Hello,

This patch adds to the break-up code the conversion for X ==/!= ~0 to
~X ==/!= 0.

ChangeLog

2011-10-07  Kai Tietz  

* tree-ssa-reassoc.c (break_up_bitwise_combined_stmt): Add
handling for X !=/== 0 transformation to ~X !=/== 0.

2011-10-07  Kai Tietz  

* gcc.dg/tree-ssa/reassoc-cmpior-4.c: New file.
* gcc.dg/tree-ssa/reassoc-cmpior-5.c: New file.
* gcc.dg/tree-ssa/reassoc-cmpior-6.c: New file.

Bootstrapped and regression-tested for all languages plus Ada and
Obj-C++ on x86_64-pc-linux-gnu.
Ok for apply?

Regards,
Kai

Index: gcc/gcc/tree-ssa-reassoc.c
===
--- gcc.orig/gcc/tree-ssa-reassoc.c
+++ gcc/gcc/tree-ssa-reassoc.c
@@ -795,8 +795,8 @@ expand_cmp_ior (tree op, tree type, enum


 /* Break up STMT if it is a combined statement made out of
-   bitwise operations.  Handle expansion of ~(A op B), and
-   (A | B) !=/== 0.  */
+   bitwise operations.  Handle expansion for ~(A op B),
+   for (A | B) !=/== 0, and transform X ==/!= ~0 to ~X ==/!= 0.  */

 static bool
 break_up_bitwise_combined_stmt (gimple stmt)
@@ -821,6 +821,28 @@ break_up_bitwise_combined_stmt (gimple s
   || TREE_CODE (op1) != SSA_NAME)
 return false;

+  /* Transform X !=/== ~0 -> ~X !=/== 0.  */
+  if ((code == EQ_EXPR || code == NE_EXPR)
+  && INTEGRAL_TYPE_P (TREE_TYPE (op1))
+  && TREE_CODE (op2) == INTEGER_CST
+  && integer_all_onesp (op2))
+{
+  op1_def = SSA_NAME_DEF_STMT (op1);
+  if (!op1_def
+ || !is_gimple_assign (op1_def)
+ || !has_single_use (op1))
+   op1_def = NULL;
+  op1 = expand_not_bitwise_binary (TREE_TYPE (op1), op1, op1_def);
+  op2 = build_zero_cst (TREE_TYPE (op1));
+
+  gsi = gsi_for_stmt (stmt);
+  gimple_assign_set_rhs_with_ops (&gsi, code, op1, op2);
+  update_stmt (gsi_stmt (gsi));
+  remove_stmt_chain (old_op1);
+  remove_stmt_chain (old_op2);
+  return true;
+}
+
   /* If left-hand operand isn't a gimple-assign, or isn't single-used,
  the we can't do anything.  */
   op1_def = SSA_NAME_DEF_STMT (op1);
@@ -3216,6 +3238,8 @@ can_reassociate_p (tree op)

Break up (X | Y) != 0 into (X != 0) | (Y != 0).

+   Break up X ==/!= ~0 to ~X ==/!= 0.
+
En passant, clear the GIMPLE visited flag on every statement.  */

 static void
Index: gcc/gcc/testsuite/gcc.dg/tree-ssa/reassoc-cmpior-4.c
===
--- /dev/null
+++ gcc/gcc/testsuite/gcc.dg/tree-ssa/reassoc-cmpior-4.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized -ffast-math" } */
+
+int foo (int a, int b, int c, int d)
+{
+  int r1 = ~(a | b | c) == -1;
+  int r2 = (~(a | d | c) != -1) | (b == 0);
+  return ((~r1 == -1) | (~r2 != -1));
+}
+
+/* { dg-final { scan-tree-dump-times "return 1" 1 "optimized"} } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
+
Index: gcc/gcc/testsuite/gcc.dg/tree-ssa/reassoc-cmpior-5.c
===
--- /dev/null
+++ gcc/gcc/testsuite/gcc.dg/tree-ssa/reassoc-cmpior-5.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized -ffast-math" } */
+
+int foo (int a, int b, int c, int d)
+{
+  int r1 = a != 0 & c != 0 & b != 0;
+  int r2 = a == 0 | b != 0 | d == 0;
+  return ((~r1 == -1) | (~r2 != -1));
+}
+
+/* { dg-final { scan-tree-dump-times "return 1" 1 "optimized"} } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
+
Index: gcc/gcc/testsuite/gcc.dg/tree-ssa/reassoc-cmpior-6.c
===
--- /dev/null
+++ gcc/gcc/testsuite/gcc.dg/tree-ssa/reassoc-cmpior-6.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized -ffast-math" } */
+
+int foo (int a, int b, int c, int d)
+{
+  int r1 = a != 0 & c != 0 & b != 0;
+  int r2 = a == 0 | b != 0 | d == 0;
+  return ((~r1 != -1) & (~r2 == -1));
+}
+
+/* { dg-final { scan-tree-dump-times "return 0" 1 "optimized"} } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
+


[patch tree-optimization]: 6 of 6 Improve reassoc for bitwise operations

2011-10-07 Thread Kai Tietz
Hello,

This patch adds to the repropagation code the conversion for ~X ==/!=
CST to X ==/!= CST' (with CST' = ~ CST).
We need to do this back-conversion after initial bitwise-binary
repropagation loop, as otherwise
it would interfer.

ChangeLog

2011-10-07  Kai Tietz  

* tree-ssa-reassoc.c (repropagate_bitwise): Add handling
for ~X !=/== CST conversion.

2011-10-07  Kai Tietz  

* gcc.dg/tree-ssa/reassoc-repro_cmpior-4.c: New file.
* gcc.dg/tree-ssa/reassoc-repro_cmpior-5.c: New file.
* gcc.dg/tree-ssa/reassoc-repro_cmpior-6.c: New file.

Bootstrapped and regression-tested for all languages plus Ada and
Obj-C++ on x86_64-pc-linux-gnu.
Ok for apply?

Regards,
Kai

Index: gcc/gcc/tree-ssa-reassoc.c
===
--- gcc.orig/gcc/tree-ssa-reassoc.c
+++ gcc/gcc/tree-ssa-reassoc.c
@@ -3712,6 +3712,37 @@ repropagate_bitwise (basic_block bb)
   remove_stmt_chain (r);
 }

+  /* Now we are doing transformation ~X !=/== CST -> X !=/== ~CST.  */
+  for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+{
+  gimple sub;
+  gimple stmt = gsi_stmt (gsi);
+  enum tree_code code;
+  tree l, r;
+
+  if (!is_gimple_assign (stmt))
+   continue;
+
+  code = gimple_assign_rhs_code (stmt);
+  if (code != EQ_EXPR && code != NE_EXPR)
+   continue;
+  l = gimple_assign_rhs1 (stmt);
+  r = gimple_assign_rhs2 (stmt);
+  if (TREE_CODE (l) != SSA_NAME
+  || TREE_CODE (r) != INTEGER_CST
+  || (sub = SSA_NAME_DEF_STMT (l)) == NULL
+  || !is_gimple_assign (sub)
+  || gimple_assign_rhs_code (sub) != BIT_NOT_EXPR
+ || !INTEGRAL_TYPE_P (TREE_TYPE (l)))
+   continue;
+  gimple_assign_set_rhs_with_ops (&gsi, code, gimple_assign_rhs1 (sub),
+ fold_build1 (BIT_NOT_EXPR,
+  TREE_TYPE (l), r));
+  update_stmt (stmt);
+  remove_stmt_chain (l);
+  remove_stmt_chain (r);
+}
+
   for (son = first_dom_son (CDI_DOMINATORS, bb);
son;
son = next_dom_son (CDI_DOMINATORS, son))
Index: gcc/gcc/testsuite/gcc.dg/tree-ssa/reassoc-repro_cmpior-4.c
===
--- /dev/null
+++ gcc/gcc/testsuite/gcc.dg/tree-ssa/reassoc-repro_cmpior-4.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized -ffast-math" } */
+
+int foo (int a, int b, int c, int d)
+{
+  int r = (a == -1) & (b == -1);
+  int q = (c == -1) & (d == -1);
+  return r & q;
+}
+
+int bar (int a, int b, int c, int d)
+{
+  int r = (a != -1) | (b != -1);
+  int q = (c != -1) | (d != -1);
+  return r | q;
+}
+
+/* { dg-final { scan-tree-dump-times " == -1" 1 "optimized"} } */
+/* { dg-final { scan-tree-dump-times " != -1" 1 "optimized"} } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
+
Index: gcc/gcc/testsuite/gcc.dg/tree-ssa/reassoc-repro_cmpior-5.c
===
--- /dev/null
+++ gcc/gcc/testsuite/gcc.dg/tree-ssa/reassoc-repro_cmpior-5.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized -ffast-math" } */
+
+int foo (int a, char b, short c, long d)
+{
+  int r = (a == -1) & (b == -1);
+  int q = (c == -1) & (d == -1);
+  return r & q;
+}
+
+int bar (int a, char b, short c, long d)
+{
+  int r = (a != -1) | (b != -1);
+  int q = (c != -1) | (d != -1);
+  return r | q;
+}
+
+/* { dg-final { scan-tree-dump-times " == -1" 1 "optimized"} } */
+/* { dg-final { scan-tree-dump-times " != -1" 1 "optimized"} } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
+
Index: gcc/gcc/testsuite/gcc.dg/tree-ssa/reassoc-repro_cmpior-6.c
===
--- /dev/null
+++ gcc/gcc/testsuite/gcc.dg/tree-ssa/reassoc-repro_cmpior-6.c
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized -ffast-math" } */
+
+int foo (int a, unsigned char b, unsigned short c, unsigned long d)
+{
+  unsigned char b1 = ~0;
+  unsigned short c1 = ~0;
+  unsigned long d1 = ~0;
+  int r = (a == -1) & (b == b1);
+  int q = (c == c1) & (d == d1);
+  return r & q;
+}
+
+int bar (int a, unsigned char b, unsigned short c, unsigned long d)
+{
+  unsigned char b1 = ~0;
+  unsigned short c1 = ~0;
+  unsigned long d1 = ~0;
+  int r = (a != -1) | (b != b1);
+  int q = (c != c1) | (d != d1);
+  return r | q;
+}
+
+/* { dg-final { scan-tree-dump-times " == -1" 1 "optimized"} } */
+/* { dg-final { scan-tree-dump-times " != -1" 1 "optimized"} } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
+


[patch tree-optimization]: 4 of 6 Improve reassoc for bitwise operations

2011-10-07 Thread Kai Tietz
Hello,

This patch adds to the repropagation pass for bitwise-expression the
conversion of (X != 0) | (Y != 0) -> (X | Y) != 0, and of (X == 0) & (Y == 0)
-> (X | Y) == 0.

ChangeLog

2011-10-07  Kai Tietz  

* tree-ssa-reassoc.c (walk_bitwise_stmt_elems): Add new argument
to store compare to zero elements.
(merge_bitwise_compares): Helper to do reconstructing merged
comparison block from vector by grouping.
(operate_bitwise_stmt): Use merge_bitwise_compares.

2011-10-07  Kai Tietz  

* gcc.dg/tree-ssa/reassoc-repro_cmpior-1.c: New file.
* gcc.dg/tree-ssa/reassoc-repro_cmpior-2.c: New file.
* gcc.dg/tree-ssa/reassoc-repro_cmpior-3.c: New file.

Bootstrapped and regression-tested for all languages plus Ada and
Obj-C++ on x86_64-pc-linux-gnu.
Ok for apply?

Regards,
Kai

Index: gcc/gcc/tree-ssa-reassoc.c
===
--- gcc.orig/gcc/tree-ssa-reassoc.c
+++ gcc/gcc/tree-ssa-reassoc.c
@@ -3110,16 +3110,18 @@ linearize_expr_tree (VEC(operand_entry_t
   add_to_ops_vec (ops, binrhs);
 }

-/* Split up a binary tree-chain of code CODE - starting at STMT - into three
+/* Split up a binary tree-chain of code CODE - starting at STMT - into four
different kinds:
- vector VCST stores constant values.
- vector VNOT stores bitwise-not expressions.
+   - vector VCMP_ZERO stores comparisons to zero.
- vector VEXRR stores the remaining rest. */

 static void
 walk_bitwise_stmt_elems (gimple stmt, enum tree_code code,
 VEC(tree, heap) **vcst,
 VEC(tree, heap) **vnot,
+VEC(tree, heap) **vcmp_zero,
 VEC(tree, heap) **vexpr)
 {
   gimple s;
@@ -3134,9 +3136,19 @@ walk_bitwise_stmt_elems (gimple stmt, en
   || !has_single_use (l))
 VEC_safe_push (tree, heap, *vexpr, l);
   else if (gimple_assign_rhs_code (s) == code)
-walk_bitwise_stmt_elems (s, code, vcst, vnot, vexpr);
+walk_bitwise_stmt_elems (s, code, vcst, vnot, vcmp_zero, vexpr);
   else if (gimple_assign_rhs_code (s) == BIT_NOT_EXPR)
 VEC_safe_push (tree, heap, *vnot, l);
+  /* (A == 0) & (B == 0) -> (A | B) == 0
+ (A != 0) | (B != 0) -> (A | B) != 0.  */
+  else if (((code == BIT_AND_EXPR
+&& gimple_assign_rhs_code (s) == EQ_EXPR)
+   || (code == BIT_IOR_EXPR
+   && gimple_assign_rhs_code (s) == NE_EXPR))
+  && INTEGRAL_TYPE_P (TREE_TYPE (gimple_assign_rhs1 (s)))
+  && TREE_CODE (gimple_assign_rhs2 (s)) == INTEGER_CST
+  && integer_zerop (gimple_assign_rhs2 (s)))
+VEC_safe_push (tree, heap, *vcmp_zero, l);
   else
 VEC_safe_push (tree, heap, *vexpr, l);

@@ -3153,9 +3165,19 @@ walk_bitwise_stmt_elems (gimple stmt, en
   || !has_single_use (l))
 VEC_safe_push (tree, heap, *vexpr, l);
   else if (gimple_assign_rhs_code (s) == code)
-walk_bitwise_stmt_elems (s, code, vcst, vnot, vexpr);
+walk_bitwise_stmt_elems (s, code, vcst, vnot, vcmp_zero, vexpr);
   else if (gimple_assign_rhs_code (s) == BIT_NOT_EXPR)
 VEC_safe_push (tree, heap, *vnot, l);
+  /* (A == 0) & (B == 0) -> (A | B) == 0
+ (A != 0) | (B != 0) -> (A | B) != 0.  */
+  else if (((code == BIT_AND_EXPR
+&& gimple_assign_rhs_code (s) == EQ_EXPR)
+   || (code == BIT_IOR_EXPR
+   && gimple_assign_rhs_code (s) == NE_EXPR))
+  && INTEGRAL_TYPE_P (TREE_TYPE (gimple_assign_rhs1 (s)))
+  && TREE_CODE (gimple_assign_rhs2 (s)) == INTEGER_CST
+  && integer_zerop (gimple_assign_rhs2 (s)))
+VEC_safe_push (tree, heap, *vcmp_zero, l);
   else
 VEC_safe_push (tree, heap, *vexpr, l);
 }
@@ -3289,6 +3311,209 @@ operate_bitwise_xor_stmt (gimple_stmt_it
   return true;
 }

+/* This function merges:compares
+   It merges VCMP elements
+   - (X != 0) | (Y != 0) -> (X | Y) != 0
+   - (X == 0) & (Y == 0) -> (X | Y) == 0.
+   Additionally it sorts and merges for the new generated left-hand
+   bitwise-or tree-chain the bitwise-not expressions.
+
+   CODE specifies the final compare expression code. It can be either
+   EQ_EXPR, or NE_EXPR.
+
+   If PGSI is not NULL, then final compare instruction
+   gets assigned to the statement it points to.  Otherwise an new
+   temporary is created for the comparison and stored in VEXPR vector.
+
+   Special note:  We try to merge first elements of compatible
+   types, before doing final merge by casting up to widest type.
+   For the bitwise-and case, we need to make sure sign-expansion is
+   done always for type-expansion.  */
+
+static void
+merge_bitwise_compares (VEC(tree, heap) **vcmp, VEC(tree, heap) **vexpr,
+   enum tree_code code, gimple_stmt_iterator *pgsi)
+{
+  unsigned int i;
+  unsigned int len = VEC_length (tree, *vcmp);
+  tree l, r, x, cmp_type = NULL_TREE;
+  VEC(tree, heap) *vtmp = NULL;
+  VEC(tree, heap) *vtmp_not = NULL;
+  enum tree_code cmp_code;
+
+  

Re: [testsuite] Disable ABI warnings for gcc.c-torture/execute/vector-compare-2.c (PR tree-optimization/50575)

2011-10-07 Thread Mike Stump
On Oct 7, 2011, at 4:53 AM, Rainer Orth wrote:
> gcc.c-torture/execute/vector-compare-2.c was FAILing on Solaris 8 and
> 9/x86 with ABI warnings

> Closer investigation revealed a mess:

So, the compile testsuite does:

  gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-w"

in compile.exp.  So, to be similar, would a better fix be to add a -w to the 
execute.exp script someplace.  Not a huge fan of -w, but...  I like 
predictability and similarity.


Fix 2 avx256 test cases for avx2

2011-10-07 Thread Richard Henderson
When Jakub added the 'i' alternatives for avx2, these broke.


r~
* gcc.target/i386/avx256-unaligned-load-2.c: Tweek vinsert pattern
match for avx2.
* gcc.target/i386/avx256-unaligned-store-2.c: Similarly.


diff --git a/gcc/testsuite/gcc.target/i386/avx256-unaligned-load-2.c 
b/gcc/testsuite/gcc.target/i386/avx256-unaligned-load-2.c
index 7d188e2..f1d7979 100644
--- a/gcc/testsuite/gcc.target/i386/avx256-unaligned-load-2.c
+++ b/gcc/testsuite/gcc.target/i386/avx256-unaligned-load-2.c
@@ -26,4 +26,4 @@ avx_test (void)
 
 /* { dg-final { scan-assembler-not "\\*avx_movdqu256/1" } } */
 /* { dg-final { scan-assembler "\\*sse2_movdqu/1" } } */
-/* { dg-final { scan-assembler "vinsertf128" } } */
+/* { dg-final { scan-assembler "vinsert.128" } } */
diff --git a/gcc/testsuite/gcc.target/i386/avx256-unaligned-store-2.c 
b/gcc/testsuite/gcc.target/i386/avx256-unaligned-store-2.c
index d8ae5a9..3339cc5 100644
--- a/gcc/testsuite/gcc.target/i386/avx256-unaligned-store-2.c
+++ b/gcc/testsuite/gcc.target/i386/avx256-unaligned-store-2.c
@@ -26,4 +26,4 @@ avx_test (void)
 
 /* { dg-final { scan-assembler-not "\\*avx_movdqu256/2" } } */
 /* { dg-final { scan-assembler "vmovdqu.*\\*movv16qi_internal/3" } } */
-/* { dg-final { scan-assembler "vextractf128" } } */
+/* { dg-final { scan-assembler "vextract.128" } } */


[PATCH] Fix VIS3 assembler check and conditionalize testsuite on VIS3 support.

2011-10-07 Thread David Miller

Committed to trunk.

gcc/

PR 50655
* configure.ac: Add .register directives to VIS3 test.
* configure: Regenerate.

gcc/testsuite/

PR 50655
* gcc.target/sparc/sparc.exp: Add vis3 target test.
* gcc.target/sparc/cmask.c: Use it.
* gcc.target/sparc/fhalve.c: Likewise.
* gcc.target/sparc/fnegop.c: Likewise.
* gcc.target/sparc/fpadds.c: Likewise.
* gcc.target/sparc/fshift.c: Likewise.
* gcc.target/sparc/fucmp.c: Likewise.
* gcc.target/sparc/lzd.c: Likewise.
* gcc.target/sparc/vis3misc.c: Likewise.
* gcc.target/sparc/xmul.c: Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@179667 
138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/ChangeLog |6 ++
 gcc/configure |2 ++
 gcc/configure.ac  |2 ++
 gcc/testsuite/ChangeLog   |   16 +++-
 gcc/testsuite/gcc.target/sparc/cmask.c|2 +-
 gcc/testsuite/gcc.target/sparc/fhalve.c   |2 +-
 gcc/testsuite/gcc.target/sparc/fnegop.c   |2 +-
 gcc/testsuite/gcc.target/sparc/fpadds.c   |2 +-
 gcc/testsuite/gcc.target/sparc/fshift.c   |2 +-
 gcc/testsuite/gcc.target/sparc/fucmp.c|2 +-
 gcc/testsuite/gcc.target/sparc/lzd.c  |2 +-
 gcc/testsuite/gcc.target/sparc/sparc.exp  |   11 +++
 gcc/testsuite/gcc.target/sparc/vis3misc.c |2 +-
 gcc/testsuite/gcc.target/sparc/xmul.c |2 +-
 14 files changed, 45 insertions(+), 10 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index f840e46..573ce6e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2011-10-07  David S. Miller  
+
+   PR 50655
+   * configure.ac: Add .register directives to VIS3 test.
+   * configure: Regenerate.
+
 2011-10-07  Richard Henderson  
 
* config.gcc (x86_64-*): Add core-avx-i, core-avx2 for with_cpu.
diff --git a/gcc/configure b/gcc/configure
index ac32705..cb55dda 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -24060,6 +24060,8 @@ else
   gcc_cv_as_sparc_fmaf=no
   if test x$gcc_cv_as != x; then
 $as_echo '.text
+   .register %g2, #scratch
+   .register %g3, #scratch
.align 4
fmaddd %f0, %f2, %f4, %f6
addxccc %g1, %g2, %g3
diff --git a/gcc/configure.ac b/gcc/configure.ac
index ed52c91..a7b94e6 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -3491,6 +3491,8 @@ foo:
   gcc_cv_as_sparc_fmaf,,
   [-xarch=v9d],
   [.text
+   .register %g2, #scratch
+   .register %g3, #scratch
.align 4
fmaddd %f0, %f2, %f4, %f6
addxccc %g1, %g2, %g3
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index aff35a6..ea79b60 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,17 @@
+2011-10-07  David S. Miller  
+
+   PR 50655
+   * gcc.target/sparc/sparc.exp: Add vis3 target test.
+   * gcc.target/sparc/cmask.c: Use it.
+   * gcc.target/sparc/fhalve.c: Likewise.
+   * gcc.target/sparc/fnegop.c: Likewise.
+   * gcc.target/sparc/fpadds.c: Likewise.
+   * gcc.target/sparc/fshift.c: Likewise.
+   * gcc.target/sparc/fucmp.c: Likewise.
+   * gcc.target/sparc/lzd.c: Likewise.
+   * gcc.target/sparc/vis3misc.c: Likewise.
+   * gcc.target/sparc/xmul.c: Likewise.
+
 2011-10-07  Richard Henderson  
 
* gcc.target/i386/avx256-unaligned-load-2.c: Tweek vinsert pattern
@@ -17,7 +31,7 @@
 2011-10-06  Joern Rennecke 
 
* gcc.dg/pr47276.c (ASMNAME, ASMNAME2, STRING): Define.
-   (__EI___vsyslog_chk, __EI_syslog, __EI_vsyslog): Use ASMNAME.  
+   (__EI___vsyslog_chk, __EI_syslog, __EI_vsyslog): Use ASMNAME.
(syslog, vsyslog, __vsyslog_chk): Likewise.
 
* gcc.dg/lto/20081222_1.c (ASMNAME, ASMNAME2, STRING): Define.
diff --git a/gcc/testsuite/gcc.target/sparc/cmask.c 
b/gcc/testsuite/gcc.target/sparc/cmask.c
index b3168ec..989274c 100644
--- a/gcc/testsuite/gcc.target/sparc/cmask.c
+++ b/gcc/testsuite/gcc.target/sparc/cmask.c
@@ -1,4 +1,4 @@
-/* { dg-do compile } */
+/* { dg-do compile { target { vis3 } } } */
 /* { dg-options "-mcpu=niagara3 -mvis" } */
 
 void test_cm8 (long x)
diff --git a/gcc/testsuite/gcc.target/sparc/fhalve.c 
b/gcc/testsuite/gcc.target/sparc/fhalve.c
index 340b936..737fc71 100644
--- a/gcc/testsuite/gcc.target/sparc/fhalve.c
+++ b/gcc/testsuite/gcc.target/sparc/fhalve.c
@@ -1,4 +1,4 @@
-/* { dg-do compile } */
+/* { dg-do compile { target { vis3 } } } */
 /* { dg-options "-mcpu=niagara3 -mvis" } */
 
 float test_fhadds (float x, float y)
diff --git a/gcc/testsuite/gcc.target/sparc/fnegop.c 
b/gcc/testsuite/gcc.target/sparc/fnegop.c
index 25f8c19..3e3e72c 100644
--- a/gcc/testsuite/gcc.target/sparc/fnegop.c
+++ b/gcc/testsuite/gcc.target/sparc/fnegop.c
@@ -1,4 +1,4 @@
-/* { dg-do compile } */
+/* { dg-do compile { target { vis3 } } } */
 /* { dg-options "-O2 -mcpu=niagara3 -mvis" } */
 
 float t

Re: [Patch,AVR] Fix PR50652

2011-10-07 Thread Denis Chertykov
2011/10/7 Georg-Johann Lay :
> Fix of wrong data_section_start for ATmega164A.
>
> Ok?
>
> Johann
>
>        PR target/50652
>        * config/avr/avr-mcus.def (AVR_MCU): Set .data_section_start of
>        atmega164a to 0x100.
>

Approved.

Denis.


Fix avx2 incorrect representations of shifts

2011-10-07 Thread Richard Henderson
On 10/05/2011 12:07 PM, Uros Bizjak wrote:
> We already have V2TImode, but hidden in VIMAX_AVX2 mode iterator.
> Based on that, I would suggest that we model correct insn
> functionality and try to avoid unspec. On the related note, there is
> no move insn for V2TImode, so V2TI should be added to V16 mode
> iterator and a couple of other places (please grep for V1TImode, used
> for SSE full-register shift insns only).

Ah, so we do.  And, interestingly, we already had a pattern for
the shifts using that VIMAX_AVX2 iterator.  At the same time I
found that palignr was using the wrong mode, so I fixed that too.

Tested --with-cpu=core-avx2 on the intel sde.  Committed.


r~
+   * config/i386/i386.c (bdesc_args): Update code for
+   __builtin_ia32_palignr256.  Change type of __builtin_ia32_pslldqi256,
+   and __builtin_ia32_psrldqi256 to V4DI_FTYPE_V4DI_INT_CONVERT.
+   (ix86_expand_args_builtin): Handle V4DI_FTYPE_V4DI_INT_CONVERT.
+   * config/i386/sse.md (mode iterator V16): Add V2TI.
+   (mode iterator SSESCALARMODE): Use V2TI not V4DI.
+   (mode attr ssse3_avx2): Add V2TI.
+   (avx2_lshrqv4di3, avx2_lshlqv4di3): Remove.




diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 85dccf9..9611f1f 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -26107,7 +26107,7 @@ static const struct builtin_description bdesc_args[] =
   { OPTION_MASK_ISA_AVX2, CODE_FOR_avx2_ssaddv16hi3, 
"__builtin_ia32_paddsw256", IX86_BUILTIN_PADDSW256, UNKNOWN, (int) 
V16HI_FTYPE_V16HI_V16HI },
   { OPTION_MASK_ISA_AVX2, CODE_FOR_avx2_usaddv32qi3, 
"__builtin_ia32_paddusb256", IX86_BUILTIN_PADDUSB256, UNKNOWN, (int) 
V32QI_FTYPE_V32QI_V32QI },
   { OPTION_MASK_ISA_AVX2, CODE_FOR_avx2_usaddv16hi3, 
"__builtin_ia32_paddusw256", IX86_BUILTIN_PADDUSW256, UNKNOWN, (int) 
V16HI_FTYPE_V16HI_V16HI },
-  { OPTION_MASK_ISA_AVX2, CODE_FOR_avx2_palignrv4di, 
"__builtin_ia32_palignr256", IX86_BUILTIN_PALIGNR256, UNKNOWN, (int) 
V4DI_FTYPE_V4DI_V4DI_INT_CONVERT },
+  { OPTION_MASK_ISA_AVX2, CODE_FOR_avx2_palignrv2ti, 
"__builtin_ia32_palignr256", IX86_BUILTIN_PALIGNR256, UNKNOWN, (int) 
V4DI_FTYPE_V4DI_V4DI_INT_CONVERT },
   { OPTION_MASK_ISA_AVX2, CODE_FOR_andv4di3, "__builtin_ia32_andsi256", 
IX86_BUILTIN_AND256I, UNKNOWN, (int) V4DI_FTYPE_V4DI_V4DI },
   { OPTION_MASK_ISA_AVX2, CODE_FOR_avx2_andnotv4di3, 
"__builtin_ia32_andnotsi256", IX86_BUILTIN_ANDNOT256I, UNKNOWN, (int) 
V4DI_FTYPE_V4DI_V4DI },
   { OPTION_MASK_ISA_AVX2, CODE_FOR_avx2_uavgv32qi3, "__builtin_ia32_pavgb256", 
 IX86_BUILTIN_PAVGB256, UNKNOWN, (int) V32QI_FTYPE_V32QI_V32QI },
@@ -26171,7 +26171,7 @@ static const struct builtin_description bdesc_args[] =
   { OPTION_MASK_ISA_AVX2, CODE_FOR_avx2_psignv32qi3, 
"__builtin_ia32_psignb256", IX86_BUILTIN_PSIGNB256, UNKNOWN, (int) 
V32QI_FTYPE_V32QI_V32QI },
   { OPTION_MASK_ISA_AVX2, CODE_FOR_avx2_psignv16hi3, 
"__builtin_ia32_psignw256", IX86_BUILTIN_PSIGNW256, UNKNOWN, (int) 
V16HI_FTYPE_V16HI_V16HI },
   { OPTION_MASK_ISA_AVX2, CODE_FOR_avx2_psignv8si3 , 
"__builtin_ia32_psignd256", IX86_BUILTIN_PSIGND256, UNKNOWN, (int) 
V8SI_FTYPE_V8SI_V8SI },
-  { OPTION_MASK_ISA_AVX2, CODE_FOR_avx2_lshlqv4di3, 
"__builtin_ia32_pslldqi256", IX86_BUILTIN_PSLLDQI256, UNKNOWN, (int) 
V4DI_FTYPE_V4DI_INT },
+  { OPTION_MASK_ISA_AVX2, CODE_FOR_avx2_ashlv2ti3, 
"__builtin_ia32_pslldqi256", IX86_BUILTIN_PSLLDQI256, UNKNOWN, (int) 
V4DI_FTYPE_V4DI_INT_CONVERT },
   { OPTION_MASK_ISA_AVX2, CODE_FOR_avx2_lshlv16hi3, 
"__builtin_ia32_psllwi256", IX86_BUILTIN_PSLLWI256 , UNKNOWN, (int) 
V16HI_FTYPE_V16HI_SI_COUNT },
   { OPTION_MASK_ISA_AVX2, CODE_FOR_avx2_lshlv16hi3, "__builtin_ia32_psllw256", 
IX86_BUILTIN_PSLLW256, UNKNOWN, (int) V16HI_FTYPE_V16HI_V8HI_COUNT },
   { OPTION_MASK_ISA_AVX2, CODE_FOR_avx2_lshlv8si3, "__builtin_ia32_pslldi256", 
IX86_BUILTIN_PSLLDI256, UNKNOWN, (int) V8SI_FTYPE_V8SI_SI_COUNT },
@@ -26182,7 +26182,7 @@ static const struct builtin_description bdesc_args[] =
   { OPTION_MASK_ISA_AVX2, CODE_FOR_ashrv16hi3, "__builtin_ia32_psraw256", 
IX86_BUILTIN_PSRAW256, UNKNOWN, (int) V16HI_FTYPE_V16HI_V8HI_COUNT },
   { OPTION_MASK_ISA_AVX2, CODE_FOR_ashrv8si3, "__builtin_ia32_psradi256", 
IX86_BUILTIN_PSRADI256, UNKNOWN, (int) V8SI_FTYPE_V8SI_SI_COUNT },
   { OPTION_MASK_ISA_AVX2, CODE_FOR_ashrv8si3, "__builtin_ia32_psrad256", 
IX86_BUILTIN_PSRAD256, UNKNOWN, (int) V8SI_FTYPE_V8SI_V4SI_COUNT },
-  { OPTION_MASK_ISA_AVX2, CODE_FOR_avx2_lshrqv4di3, 
"__builtin_ia32_psrldqi256", IX86_BUILTIN_PSRLDQI256, UNKNOWN, (int) 
V4DI_FTYPE_V4DI_INT },
+  { OPTION_MASK_ISA_AVX2, CODE_FOR_avx2_lshrv2ti3, 
"__builtin_ia32_psrldqi256", IX86_BUILTIN_PSRLDQI256, UNKNOWN, (int) 
V4DI_FTYPE_V4DI_INT_CONVERT },
   { OPTION_MASK_ISA_AVX2, CODE_FOR_lshrv16hi3, "__builtin_ia32_psrlwi256", 
IX86_BUILTIN_PSRLWI256 , UNKNOWN, (int) V16HI_FTYPE_V16HI_SI_COUNT },
   { OPTION_MASK_ISA_AVX2, CODE_FOR_lshrv16hi3, "__builtin_ia32_psrlw256", 
IX86_BUILTIN_PSRLW256, UNKNOWN, (int) V16HI_FTYPE_V16HI_V8HI_COUNT },
   {

[pph] De-inline streamer functions. (issue5245043)

2011-10-07 Thread Lawrence Crowl
Move several static inline functions from pph-streamer.h to
pph-streamer-{out,in}.c.  This is part 1 of several patches,
and minimizes diffs.


Index: gcc/cp/ChangeLog.pph

2011-10-07   Lawrence Crowl  
* pph-streamer.h (pph_out_tree_array): Remove unused.
(pph_in_tree_array): Remove unused.
(pph_in_tree_VEC): Remove unused.
(pph_out_uint): Moved to pph-streamer-out.c as extern.
(pph_out_record_marker): Likewise.
(pph_out_chain): Moved to pph-streamer-out.c as static.
(pph_out_mergeable_chain): Likewise.
(pph_out_bitpack): Likewise.
(pph_in_uint): Moved to pph-streamer-in.c as extern.
(pph_in_location): Likewise.
(pph_in_tree): Likewise.
(pph_in_record_marker): Likewise.
(pph_in_uhwi): Moved to pph-streamer-in.c as static.
(pph_in_hwi): Likewise.
(pph_in_uchar): Likewise.
(pph_in_bytes): Likewise.


Index: gcc/cp/pph-streamer-in.c
===
--- gcc/cp/pph-streamer-in.c(revision 179636)
+++ gcc/cp/pph-streamer-in.c(working copy)
@@ -146,6 +146,89 @@ pph_init_read (pph_stream *stream)
 }
 
 
+/* Read an unsigned char VALUE to STREAM.  */
+static unsigned char
+pph_in_uchar (pph_stream *stream)
+{
+  unsigned char n = streamer_read_uchar (stream->encoder.r.ib);
+  if (flag_pph_tracer >= 4)
+pph_trace_uint (stream, n);
+  return n;
+}
+
+/* Read a HOST_WIDE_INT from STREAM.  */
+static inline HOST_WIDE_INT
+pph_in_hwi (pph_stream *stream)
+{
+  return streamer_read_hwi (stream->encoder.r.ib);
+}
+
+
+/* Read an unsigned HOST_WIDE_INT from STREAM.  */
+static inline unsigned HOST_WIDE_INT
+pph_in_uhwi (pph_stream *stream)
+{
+  return streamer_read_uhwi (stream->encoder.r.ib);
+}
+
+
+/* Read an unsigned integer from STREAM.  */
+unsigned int
+pph_in_uint (pph_stream *stream)
+{
+  HOST_WIDE_INT unsigned n = streamer_read_uhwi (stream->encoder.r.ib);
+  gcc_assert (n == (unsigned) n);
+  if (flag_pph_tracer >= 4)
+pph_trace_uint (stream, n);
+  return (unsigned) n;
+}
+
+
+/* Read N bytes from STREAM into P.  The caller is responsible for
+   allocating a sufficiently large buffer.  */
+static void
+pph_in_bytes (pph_stream *stream, void *p, size_t n)
+{
+  lto_input_data_block (stream->encoder.r.ib, p, n);
+  if (flag_pph_tracer >= 4)
+pph_trace_bytes (stream, p, n);
+}
+
+
+/* Read and return a string from STREAM.  */
+
+static const char *
+pph_in_string (pph_stream *stream)
+{
+  const char *s = streamer_read_string (stream->encoder.r.data_in,
+stream->encoder.r.ib);
+  if (flag_pph_tracer >= 4)
+pph_trace_string (stream, s);
+  return s;
+}
+
+
+/* Read and return a record marker from STREAM.  On return, *TAG_P will
+   contain the tag for the data type stored in this record.  */
+enum pph_record_marker
+pph_in_record_marker (pph_stream *stream, enum pph_tag *tag_p)
+{
+  enum pph_record_marker m = (enum pph_record_marker) pph_in_uchar (stream);
+  gcc_assert (m == PPH_RECORD_START
+  || m == PPH_RECORD_START_NO_CACHE
+  || m == PPH_RECORD_START_MUTATED
+  || m == PPH_RECORD_END
+  || m == PPH_RECORD_IREF
+  || m == PPH_RECORD_XREF
+  || m == PPH_RECORD_PREF);
+
+  *tag_p = (enum pph_tag) pph_in_uint (stream);
+  gcc_assert ((unsigned) *tag_p < (unsigned) PPH_NUM_TAGS);
+
+  return m;
+}
+
+
 /* Read and return a record header from STREAM.  EXPECTED_TAG indicates
the data type that should be stored in this record.  When a
PPH_RECORD_START marker is read, the next word read is an index
@@ -237,6 +320,22 @@ pph_read_location (struct lto_input_bloc
 }
 
 
+/* Read and return a location_t from STREAM.
+   FIXME pph: If pph_trace didn't depend on STREAM, we could avoid having to
+   call this function, only for it to call lto_input_location, which calls the
+   streamer hook back to pph_read_location.  */
+
+location_t
+pph_in_location (pph_stream *stream)
+{
+  location_t loc = pph_read_location (stream->encoder.r.ib,
+   stream->encoder.r.data_in);
+  if (flag_pph_tracer >= 4)
+pph_trace_location (stream, loc);
+  return loc;
+}
+
+
 /* Load the tree value associated with TOKEN from STREAM.  */
 
 static void
@@ -2280,6 +2379,16 @@ pph_read_tree (struct lto_input_block *i
 }
 
 
+/* Load an AST from STREAM.  Return the corresponding tree.  */
+tree
+pph_in_tree (pph_stream *stream)
+{
+  tree t = pph_read_any_tree (stream, NULL);
+  if (flag_pph_tracer >= 4)
+pph_trace_tree (stream, t);
+  return t;
+}
+
 /* Read a mergeable tree from STREAM into CHAIN.  */
 
 tree
Index: gcc/cp/pph-streamer.h
===
--- gcc/cp/pph-streamer.h   (revision 179636)
+++ gcc/cp/pph-streamer.h   (working copy)
@@ -439,21 +439,6 @@ pph_cache_find (pph_stream *stream, enum
   return e->data;
 }
 
-/

[testsuite] suppress warnings for powerpc for graphite vector test

2011-10-07 Thread Janis Johnson
Test gcc.dg/graphite/id-pr46845.c turns off warnings for x86 targets.
powerpc targets warn about ABI issues with vector arguments for this
test, so this patch includes powerpc*-*-* in the list of targets to
turn off warnings.  OK for trunk?

2011-10-07  Janis Johnson  

* gcc.dg/graphite/id-pr46845.c: Include powerpc for warning options.

Index: gcc/testsuite/gcc.dg/graphite/id-pr46845.c
===
--- gcc/testsuite/gcc.dg/graphite/id-pr46845.c  (revision 179667)
+++ gcc/testsuite/gcc.dg/graphite/id-pr46845.c  (working copy)
@@ -1,4 +1,4 @@
-/* { dg-options "-O2 -ffast-math -fgraphite-identity -w -Wno-psabi" { target { 
i?86-*-* x86_64-*-* } } } */
+/* { dg-options "-O2 -ffast-math -fgraphite-identity -w -Wno-psabi" { target { 
i?86-*-* x86_64-*-* powerpc*-*-* } } } */

 typedef float V2SF __attribute__ ((vector_size (128)));


Re: [testsuite] suppress warnings for powerpc for graphite vector test

2011-10-07 Thread Mike Stump
On Oct 7, 2011, at 12:50 PM, Janis Johnson wrote:
> Test gcc.dg/graphite/id-pr46845.c turns off warnings for x86 targets.
> powerpc targets warn about ABI issues with vector arguments for this
> test, so this patch includes powerpc*-*-* in the list of targets to
> turn off warnings.  OK for trunk?

I'm hoping the graphite people have an even a better idea...  If not, Ok.



Commit revisions (was: Re: [Patch, fortran] [00/21] Remove coarray support in the scalarizer)

2011-10-07 Thread Mikael Morin
On Friday 30 September 2011 18:51:21 Steve Kargl wrote:
> Mikael,
> 
> I've finally made it through the set of patches,
> and did not find anything that raised a red flag.
> I'll note that I did not study the issue/question
> you raised with patch 6.  Tobias is probably the
> best person to offer an opinion.  After pinging
> patch 6 off of Tobias, I think the code can be
> committed.

Thanks, I have (finally) committed the patches.
Here are the commit revisions:
01: 179671
02: 179672
03: 179674
04: 179675
05: 179676
06: skipped
07: 179677
08: 179679
09: 179680
10: 179681
11: 179682
12: 179683
13: 179684
14: 179685
15: 179686
16: 179689
17: 179690
18: 179691
19: 179692
20: 179693
21: 179694

Mikael


Re: [Patch, Fortran, OOP] PR 50625: [4.6/4.7 Regression] ALLOCATABLE attribute lost for module CLASS variables

2011-10-07 Thread Janus Weil
2011/10/7 Janus Weil :
>>> Regtested successfully on x86_64-unknown-linux-gnu (except for failure
>>> on entry_4 and select_type_12, which are known middle-end
>>> regressions). Ok for trunk and 4.6?
>>
>> OK. Thanks for the patch
>
> Thanks for the review. Committed to trunk as r179660.

... and to the 4.6 branch as r179696.

Cheers,
Janus



>>> 2011-10-07  Janus Weil
>>>
>>>        PR fortran/50625
>>>        * class.c (gfc_build_class_symbol): Fix whitespace.
>>>        * module.c (mio_symbol): Set 'class_ok' attribute.
>>>        * trans-decl.c (gfc_get_symbol_decl): Make sure the backend_decl
>>> has
>>>        been built for class symbols.
>>>
>>>
>>> 2011-10-07  Janus Weil
>>>
>>>        PR fortran/50625
>>>        * gfortran.dg/class_46.f03: New.
>>
>>
>


[i386, avx2] Fix representation of the 256-bit vpblendw

2011-10-07 Thread Richard Henderson
A representation with vec_merge and a 0..255 constant is incorrect.
Both 128-bit lanes are merged with the same pattern, thus the rtl-level
vec_merge operand should replicate the imm8 operand into two bytes.

I created an expander with the old name and old interface so that we
can continue using it to implement the builtin.

Tested with the intel sde.  Committed.


r~
* config/i386/predicates.md (avx2_pblendw_operand): New.
* config/i386/sse.md (sse4_1_pblendw): Un-macroize.
(avx2_pblendw, *avx2_pblendw): New expander and insn.



diff --git a/gcc/config/i386/predicates.md b/gcc/config/i386/predicates.md
index 89cc8a7..9ac3f9d 100644
--- a/gcc/config/i386/predicates.md
+++ b/gcc/config/i386/predicates.md
@@ -1210,3 +1210,12 @@
   return false;
   return true;
 })
+
+;; Return true if OP is a proper third operand to vpblendw256.
+(define_predicate "avx2_pblendw_operand"
+  (match_code "const_int")
+{
+  HOST_WIDE_INT val = INTVAL (op);
+  HOST_WIDE_INT low = val & 0xff;
+  return val == (low << 8) | low;
+})
diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md
index a7df221..9dc9b46 100644
--- a/gcc/config/i386/sse.md
+++ b/gcc/config/i386/sse.md
@@ -9417,11 +9417,11 @@
(set_attr "prefix" "orig,vex")
(set_attr "mode" "")])
 
-(define_insn "_pblendw"
-  [(set (match_operand:VI2_AVX2 0 "register_operand" "=x,x")
-   (vec_merge:VI2_AVX2
- (match_operand:VI2_AVX2 2 "nonimmediate_operand" "xm,xm")
- (match_operand:VI2_AVX2 1 "register_operand" "0,x")
+(define_insn "sse4_1_pblendw"
+  [(set (match_operand:V8HI 0 "register_operand" "=x,x")
+   (vec_merge:V8HI
+ (match_operand:V8HI 2 "nonimmediate_operand" "xm,xm")
+ (match_operand:V8HI 1 "register_operand" "0,x")
  (match_operand:SI 3 "const_0_to_255_operand" "n,n")))]
   "TARGET_SSE4_1"
   "@
@@ -9432,7 +9432,37 @@
(set_attr "prefix_extra" "1")
(set_attr "length_immediate" "1")
(set_attr "prefix" "orig,vex")
-   (set_attr "mode" "")])
+   (set_attr "mode" "TI")])
+
+;; The builtin uses an 8-bit immediate.  Expand that.
+(define_expand "avx2_pblendw"
+  [(set (match_operand:V16HI 0 "register_operand" "")
+   (vec_merge:V16HI
+ (match_operand:V16HI 2 "nonimmediate_operand" "")
+ (match_operand:V16HI 1 "register_operand" "")
+ (match_operand:SI 3 "const_0_to_255_operand" "")))]
+  "TARGET_AVX2"
+{
+  HOST_WIDE_INT val = INTVAL (operands[3]) & 0xff;
+  operands[3] = GEN_INT (val << 8 | val);
+})
+
+(define_insn "*avx2_pblendw"
+  [(set (match_operand:V16HI 0 "register_operand" "=x")
+   (vec_merge:V16HI
+ (match_operand:V16HI 2 "nonimmediate_operand" "xm")
+ (match_operand:V16HI 1 "register_operand" "x")
+ (match_operand:SI 3 "avx2_pblendw_operand" "n")))]
+  "TARGET_SSE4_1"
+{
+  operands[3] = GEN_INT (INTVAL (operands[3]) & 0xff);
+  return "vpblendw\t{%3, %2, %1, %0|%0, %1, %2, %3}";
+}
+  [(set_attr "type" "ssemov")
+   (set_attr "prefix_extra" "1")
+   (set_attr "length_immediate" "1")
+   (set_attr "prefix" "vex")
+   (set_attr "mode" "OI")])
 
 (define_insn "avx2_pblendd"
   [(set (match_operand:VI4_AVX2 0 "register_operand" "=x")


Re: [Patch, Fortran, committed] PR 50585: [4.6/4.7 Regression] ICE with assumed length character array argument

2011-10-07 Thread Janus Weil
>> I have just committed as obvious a one-line patch to fix a regression
>> which is triggered by -fwhole-file:
>> http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=179413
>>
>> Should I backport to 4.6? And also to 4.5?
>
> Yes, please backport to 4.6. If you want, you can also backport to 4.5.
> However, I do not think that -fwhole-file gets used in 4.5 - especially, as
> it has some issues.

Fixed on the 4.6 branch with r179696. It's probably not worth to
backport to 4.5 ...

Cheers,
Janus


De-inline streamer functions part 2 (issue5250042)

2011-10-07 Thread Lawrence Crowl
Move several static inline functions from pph-streamer.h to
pph-streamer-{out,in}.c.  This is part 2 of several patches,
and minimizes diffs.


Index: gcc/cp/ChangeLog.pph

2011-10-07   Lawrence Crowl  

* pph-streamer.h (pph_in_chain): Moved to pph-streamer-in.c as extern.
(pph_read_mergeable_tree): Make static in pph-streamer-in.c.
(pph_read_mergeable_chain): Likewise
(pph_in_mergeable_tree): Moved to pph-streamer-in.c as static.
(pph_in_mergeable_chain): Likewise.
(pph_in_bitpack): Likewise.
(pph_in_chain): Likewise.
(pph_out_location): Moved to pph-streamer-out.c extern.
(pph_out_tree): Likewise.
(pph_out_tree_1): Moved to pph-streamer-out.c as static.
(pph_out_mergeable_tree): Likewise.
(pph_tree_code_to_tag): Comment unused.
(pph_tag_to_tree_code): Likewise.


Index: gcc/cp/pph-streamer-in.c
===
--- gcc/cp/pph-streamer-in.c(revision 179673)
+++ gcc/cp/pph-streamer-in.c(working copy)
@@ -208,6 +208,17 @@ pph_in_string (pph_stream *stream)
 }
 
 
+/* Read a bitpack from STREAM.  */
+static struct bitpack_d
+pph_in_bitpack (pph_stream *stream)
+{
+  struct bitpack_d bp = streamer_read_bitpack (stream->encoder.r.ib);
+  if (flag_pph_tracer >= 4)
+pph_trace_bitpack (stream, &bp);
+  return bp;
+}
+
+
 /* Read and return a record marker from STREAM.  On return, *TAG_P will
contain the tag for the data type stored in this record.  */
 enum pph_record_marker
@@ -608,6 +619,29 @@ pph_in_label_binding (pph_stream *stream
 }
 
 
+/* Read a chain of ASTs from STREAM.  */
+static tree
+pph_in_chain (pph_stream *stream)
+{
+  tree t = streamer_read_chain (stream->encoder.r.ib,
+stream->encoder.r.data_in);
+  if (flag_pph_tracer >= 2)
+pph_trace_chain (stream, t);
+  return t;
+}
+
+
+static void pph_read_mergeable_chain (pph_stream *stream, tree* chain);
+
+
+/* Read and merge a chain of ASTs from STREAM into an existing CHAIN.  */
+static inline void
+pph_in_mergeable_chain (pph_stream *stream, tree* chain)
+{
+  pph_read_mergeable_chain (stream, chain);
+}
+
+
 /* Read and return an instance of cp_binding_level from STREAM.
TO_REGISTER is used when the caller wants to read a binding level,
but register a different binding level in the streaming cache.
@@ -2389,15 +2423,27 @@ pph_in_tree (pph_stream *stream)
   return t;
 }
 
+
 /* Read a mergeable tree from STREAM into CHAIN.  */
 
-tree
+static tree
 pph_read_mergeable_tree (pph_stream *stream, tree *chain)
 {
   return pph_read_any_tree (stream, chain);
 }
 
 
+/* Load an AST in an ENCLOSING_NAMESPACE from STREAM.
+   Return the corresponding tree.  */
+static void
+pph_in_mergeable_tree (pph_stream *stream, tree *chain)
+{
+  tree t = pph_read_mergeable_tree (stream, chain);
+  if (flag_pph_tracer >= 3)
+pph_trace_tree (stream, t);
+}
+
+
 /* Read a chain of tree nodes from STREAM.  */
 
 void
Index: gcc/cp/pph-streamer-out.c
===
--- gcc/cp/pph-streamer-out.c   (revision 179673)
+++ gcc/cp/pph-streamer-out.c   (working copy)
@@ -204,6 +204,17 @@ pph_write_location (struct output_block 
 }
 
 
+/* Write location LOC of length to STREAM.  */
+
+void
+pph_out_location (pph_stream *stream, location_t loc)
+{
+  if (flag_pph_tracer >= 4)
+pph_trace_location (stream, loc);
+  pph_write_location (stream->encoder.w.ob, loc);
+}
+
+
 /* Write a chain of ASTs to STREAM starting with FIRST.  */
 static void
 pph_out_chain (pph_stream *stream, tree first)
@@ -609,6 +620,37 @@ pph_out_token_cache (pph_stream *f, cp_t
 pph_out_token (f, tok);
 }
 
+
+/* Output AST T to STREAM.  If -fpph-tracer is set to TLEVEL or
+   higher, T is sent to pph_trace_tree.  */
+static void
+pph_out_tree_1 (pph_stream *stream, tree t, int tlevel)
+{
+  if (flag_pph_tracer >= tlevel)
+pph_trace_tree (stream, t);
+  pph_write_tree (stream->encoder.w.ob, t, false);
+}
+
+/* Output AST T to STREAM.  Trigger tracing at -fpph-tracer=2.  */
+void
+pph_out_tree (pph_stream *stream, tree t)
+{
+  pph_out_tree_1 (stream, t, 2);
+}
+
+static void pph_write_mergeable_tree (pph_stream *stream, tree expr);
+
+/* Output AST T from ENCLOSING_NAMESPACE to STREAM.
+   Trigger tracing at -fpph-tracer=2.  */
+static void
+pph_out_mergeable_tree (pph_stream *stream, tree t)
+{
+  if (flag_pph_tracer >= 2)
+pph_trace_tree (stream, t);
+  pph_write_mergeable_tree (stream, t);
+}
+
+
 /* Write all the fields in lang_decl_base instance LDB to OB.  */
 
 static void
Index: gcc/cp/pph-streamer.h
===
--- gcc/cp/pph-streamer.h   (revision 179673)
+++ gcc/cp/pph-streamer.h   (working copy)
@@ -336,7 +336,9 @@ unsigned pph_get_signature (tree, size_t
 void pph_flush_buffers (pph_stream *);
 void pph_init_write (pph_stream *);
 void pph_write_tree 

Re: [patch tree-optimization]: Improve handling of conditional-branches on targets with high branch costs

2011-10-07 Thread Kai Tietz
Hello,

this is the updated version with the suggestion

2011/10/7 Richard Guenther :
> On Thu, Oct 6, 2011 at 4:25 PM, Kai Tietz  wrote:
>> +      && ((TREE_CODE_CLASS (TREE_CODE (arg1)) != tcc_comparison
>> +           && TREE_CODE (arg1) != TRUTH_NOT_EXPR
>> +           && simple_operand_p (arg1))
>
> As I said previously simple_operand_p already rejects covers
> comparisons and TRUTH_NOT_EXPR.  Also arg1 had better
> TREE_SIDE_EFFECTS set if the comparison might trap, as
> it might just be hidden in something more complicated - so
> the simple check isn't enough anyway (and if simple_operand_p
> would cover it, the check would be better placed there).

I reworked simple_operand_p so that it does this special-casing and additionally
also checks for trapping.

>> +      if (TREE_CODE (arg0) == code
>> +          && !TREE_SIDE_EFFECTS (TREE_OPERAND (arg0, 1))
>> +          && simple_operand_p (TREE_OPERAND (arg0, 1)))
>> +       {
>> +         tem = build2_loc (loc,
>> +                           (code == TRUTH_ANDIF_EXPR ? TRUTH_AND_EXPR
>> +                                                     : TRUTH_OR_EXPR),
>> +                           type, TREE_OPERAND (arg0, 1), arg1);
>> +         return build2_loc (loc, code, type, TREE_OPERAND (arg0, 0),
>> +                            tem);
>
> All trees should be folded, don't use plain build without a good reason.

Ok, done

>> +       }
>> +      /* Convert X TRUTH-ANDORIF Y to X TRUTH-ANDOR Y, if X and Y
>> +        are simple operands and have no side-effects.  */
>> +      if (simple_operand_p (arg0)
>> +          && !TREE_SIDE_EFFECTS (arg0))
>
> Again, the checks you do for arg0 do not match those for arg1.  OTOH
> it doesn't matter whether arg0 is simple or not or has side-effects or
> not for this transformation, so why check it at all?

It is required.  For left-hand operand, if it isn't a logical
and/or/xor, we need to check for side-effects (and for trapping).  I
see that calling of simple_operand_p is wrong here, as it rejects too
much.  Nevertheless the check for side-effects is necessary for having
valid sequence-points.  Without that checking a simple test

int getter (void);

int foo (void)
{
  int c, r = 0;
  while ((c = getter ()) != '"' && c >= 0)
r +=c;
  return r;
}

would give a warning about sequence-points.  As left-hand operand has
side-effects, but right-hand not.  If we would combine it as AND, the
operands are exchange-able.  So right-hand operand needs to be another
ANDIF expression instead.
Same apply on trapping.

> In fold_truthop we still have the same (albeit more restricted transform),
> but guarded with
>
>  if (BRANCH_COST (optimize_function_for_speed_p (cfun),
>                   false) >= 2
>
> too.  Why not here?  Please delete redundant code in fold_truthop.
Well, in general this is the default definition of
LOGICAL_OP_NON_SHORT_CIRCUIT, so I missed that.  As for some targets
the macro LOGICAL_OP_NON_SHORT_CIRCUIT might be defined differently,
it might make sense to check for BRANCH_COST again.

> It's also odd that this is only called from fold_truth_andor but has
> a more generic name, so maybe rename it to fold_truth_andor_1 on the way.

I renamed it.

> Richard.

ChangeLog

2011-10-07  Kai Tietz  

* fold-const.c (simple_operand_p): Make argument non-const
and add floating-point trapping check, and special cases for
comparisons, and logical-not's.
(fold_truthop): Rename to
(fold_truth_andor_1): function name.
Additionally remove here TRUTH-AND|OR_EXPR generation.
(fold_truth_andor): Handle branching at one place.

Bootstrapped and regression-tested for all languages plus Ada and
Obj-C++ on x86_64-pc-linux-gnu.
Ok for apply?

Regards,
Kai

Index: gcc/gcc/fold-const.c
===
--- gcc.orig/gcc/fold-const.c
+++ gcc/gcc/fold-const.c
@@ -111,14 +111,13 @@ static tree decode_field_reference (loca
tree *, tree *);
 static int all_ones_mask_p (const_tree, int);
 static tree sign_bit_p (tree, const_tree);
-static int simple_operand_p (const_tree);
+static int simple_operand_p (tree);
 static tree range_binop (enum tree_code, tree, tree, int, tree, int);
 static tree range_predecessor (tree);
 static tree range_successor (tree);
 static tree fold_range_test (location_t, enum tree_code, tree, tree, tree);
 static tree fold_cond_expr_with_comparison (location_t, tree, tree,
tree, tree);
 static tree unextend (tree, int, int, tree);
-static tree fold_truthop (location_t, enum tree_code, tree, tree, tree);
 static tree optimize_minmax_comparison (location_t, enum tree_code,
tree, tree, tree);
 static tree extract_muldiv (tree, tree, enum tree_code, tree, bool *);
@@ -3500,7 +3499,7 @@ optimize_bit_field_compare (location_t l
   return lhs;
 }
 
-/* Subroutine for fold_truthop: decode a field reference.
+/* Subroutine for fold_truth_a

Re: [i386, avx2] Fix representation of the 256-bit vpblendw

2011-10-07 Thread Jakub Jelinek
On Fri, Oct 07, 2011 at 02:13:40PM -0700, Richard Henderson wrote:
> +(define_insn "*avx2_pblendw"
> +  [(set (match_operand:V16HI 0 "register_operand" "=x")
> + (vec_merge:V16HI
> +   (match_operand:V16HI 2 "nonimmediate_operand" "xm")
> +   (match_operand:V16HI 1 "register_operand" "x")
> +   (match_operand:SI 3 "avx2_pblendw_operand" "n")))]
> +  "TARGET_SSE4_1"

TARGET_AVX2 instead?

> +{
> +  operands[3] = GEN_INT (INTVAL (operands[3]) & 0xff);
> +  return "vpblendw\t{%3, %2, %1, %0|%0, %1, %2, %3}";
> +}
> +  [(set_attr "type" "ssemov")
> +   (set_attr "prefix_extra" "1")
> +   (set_attr "length_immediate" "1")
> +   (set_attr "prefix" "vex")
> +   (set_attr "mode" "OI")])
>  
>  (define_insn "avx2_pblendd"
>[(set (match_operand:VI4_AVX2 0 "register_operand" "=x")

Jakub


Re: [i386, avx2] Fix representation of the 256-bit vpblendw

2011-10-07 Thread Richard Henderson
On 10/07/2011 02:40 PM, Jakub Jelinek wrote:
> On Fri, Oct 07, 2011 at 02:13:40PM -0700, Richard Henderson wrote:
>> +(define_insn "*avx2_pblendw"
>> +  [(set (match_operand:V16HI 0 "register_operand" "=x")
>> +(vec_merge:V16HI
>> +  (match_operand:V16HI 2 "nonimmediate_operand" "xm")
>> +  (match_operand:V16HI 1 "register_operand" "x")
>> +  (match_operand:SI 3 "avx2_pblendw_operand" "n")))]
>> +  "TARGET_SSE4_1"
> 
> TARGET_AVX2 instead?

Blah.  Yes.  I changed the expander but not the insn.


r~


Re: patch ping: thread testing infrastructure

2011-10-07 Thread Aldy Hernandez
First, thanks so much for tackling this review.  I don't think anyone's 
overly enthusiastic about reviewing dejagnu crap^H^H^H^Hcode.




On 10/04/11 08:43, Aldy Hernandez wrote:

http://gcc.gnu.org/ml/gcc-patches/2011-09/msg01272.html

So others have already mentioned the name "memmodel" as being
unsatisfactory...  From the list, I liked simulate-thread (before
looking at your message where you voted for simulate-thread).

Done.


in memmodel-gdb-test, is there any reasonable way to detect if we're
not exactly 3 frames down from dg-test and that the local variable
"name" holds the filename of hte testcase?  Are these requirements
documented anywhere?


I have no idea.  To be honest, I just copied what every other dg* kludge 
was doing.



In the same code, don't you want to use somethign other than
GUALITY_GDB_NAME?  Clearly we've got two gcc testing frameworks that
need gdb.  A generic name might work better GDB_FOR_GCC_TESTING?  Or
something like that.


Ok, I got rid of the entire dependence on the guality infrastructure. 
It was overkill to begin with.  I just used it because it was there. 
All we really want is the path to a gdb.  And if it exists, we can fail 
the tests themselves if the gdb isn't working as expected.


I have added a generic function gdb-exists() that can test the presence 
of a gdb in the path, and then it'll be up to the consumer to determine 
if it's working as desired.  This function can use/set 
GDB_FOR_GCC_TESTING in a generic way as you have suggested.  With the 
current revamp, the tests will fail if the given gdb does not work.



In remote_expect_target, don't you need to reorder the cases to have
the too-old-gdb case first.  Otherwise you can get inconsistent
results due to the way matching works in tcl/expect.  On a larger
note, can you use the routines from gcc-gdb-test.exp rather than
duplicating it?


The order was what the guality harness had.  I have swapped them as you 
suggested.  The bits in gcc-simulate-thread.exp are sufficiently 
different to make abstracting the common bits with gcc-gdb-test.exp a 
bit uncomfortable.  If you feel strongly about it, I can think harder.



Do we have allow-store-data-races as a parameter in GCC right now?  If
not you'll need to do something about the tests themselves.


It's already there in mainline.  It was part of the original C++ memory 
model bitfield patch that has caused so much grief.  Which reminds me, I 
need to continue on that...


How do you like this approach?  It's a lot cleaner, has less 
dependencies and shorter to boot!
testsuite/
* lib/gcc-simulate-thread.exp: New.
* gcc.dg/simulate-thread/guality.h: New.
* gcc.dg/simulate-thread/simulate-thread.h: New.
* gcc.dg/simulate-thread/simulate-thread.exp: New.
* gcc.dg/simulate-thread/simulate-thread.gdb: New.
* gcc.dg/simulate-thread/README: New.
* g++.dg/simulate-thread/guality.h: New.
* g++.dg/simulate-thread/simulate-thread.h: New.
* g++.dg/simulate-thread/simulate-thread.exp: New.
* g++.dg/simulate-thread/simulate-thread.gdb: New.
* c-c++-common/cxxbitfields-2.c: Remove.
* c-c++-common/cxxbitfields.c: Remove.
* c-c++-common/cxxbitfields-4.c: Remove.
* c-c++-common/cxxbitfields-5.c: Remove.
* c-c++-common/simulate-thread/bitfields-1.c: New.
* c-c++-common/simulate-thread/bitfields-2.c: New.
* c-c++-common/simulate-thread/bitfields-3.c: New.
* c-c++-common/simulate-thread/bitfields-4.c: New.

Index: testsuite/lib/gcc-dg.exp
===
--- testsuite/lib/gcc-dg.exp(revision 178608)
+++ testsuite/lib/gcc-dg.exp(working copy)
@@ -747,4 +747,26 @@ proc dg-message { args } {
 process-message saved-dg-warning "" $args
 }
 
+# Check the existence of a gdb in the path, and return true if there
+# is one.
+#
+# Set env(GDB_FOR_GCC_TESTING) accordingly.
+
+proc gdb-exists { args } {
+if ![info exists ::env(GDB_FOR_GCC_TESTING)] {
+   global GDB
+   if ![info exists ::env(GDB_FOR_GCC_TESTING)] {
+   if [info exists GDB] {
+   setenv GDB_FOR_GCC_TESTING "$GDB"
+   } else {
+   setenv GDB_FOR_GCC_TESTING "[transform gdb]"
+   }
+   }
+}
+if { [which $::env(GDB_FOR_GCC_TESTING)] != 0 } {
+   return 1;
+}
+return 0;
+}
+
 set additional_prunes ""
Index: testsuite/lib/gcc-simulate-thread.exp
===
--- testsuite/lib/gcc-simulate-thread.exp   (revision 0)
+++ testsuite/lib/gcc-simulate-thread.exp   (revision 0)
@@ -0,0 +1,90 @@
+#   Copyright (C) 2011 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any lat

De-inline streamer functions part 3 (issue5247042)

2011-10-07 Thread Lawrence Crowl
Remove #if 0 scaffolding.  This is part 3 of several patches,
and minimizes diffs.


Index: gcc/cp/ChangeLog.pph

2011-10-07   Lawrence Crowl  

* pph-streamer.h: Remove #if 0 scaffolding.


Index: gcc/cp/pph-streamer.h
===
--- gcc/cp/pph-streamer.h   (revision 179698)
+++ gcc/cp/pph-streamer.h   (working copy)
@@ -336,9 +336,6 @@ unsigned pph_get_signature (tree, size_t
 void pph_flush_buffers (pph_stream *);
 void pph_init_write (pph_stream *);
 void pph_write_tree (struct output_block *, tree, bool);
-#if 0
-void pph_write_mergeable_tree (pph_stream *, tree);
-#endif
 void pph_write_mergeable_chain (pph_stream *, tree);
 void pph_add_decl_to_symtab (tree, enum pph_symtab_action, bool, bool);
 void pph_add_include (pph_stream *);
@@ -354,10 +351,6 @@ struct binding_table_s *pph_in_binding_t
 /* In pph-streamer-in.c.  */
 void pph_init_read (pph_stream *);
 tree pph_read_tree (struct lto_input_block *, struct data_in *);
-#if 0
-tree pph_read_mergeable_tree (pph_stream *, tree *);
-void pph_read_mergeable_chain (pph_stream *, tree *);
-#endif
 location_t pph_read_location (struct lto_input_block *, struct data_in *);
 void pph_read_file (const char *);
 void pph_reader_finish (void);
@@ -444,314 +437,21 @@ pph_cache_find (pph_stream *stream, enum
 }
 
 
-#if 0
-/* Output AST T to STREAM.  If -fpph-tracer is set to TLEVEL or
-   higher, T is sent to pph_trace_tree.  */
-static inline void
-pph_out_tree_1 (pph_stream *stream, tree t, int tlevel)
-{
-  if (flag_pph_tracer >= tlevel)
-pph_trace_tree (stream, t);
-  pph_write_tree (stream->encoder.w.ob, t, false);
-}
-
-/* Output AST T to STREAM.  Trigger tracing at -fpph-tracer=2.  */
-static inline void
-pph_out_tree (pph_stream *stream, tree t)
-{
-  pph_out_tree_1 (stream, t, 2);
-}
-
-/* Output AST T from ENCLOSING_NAMESPACE to STREAM.
-   Trigger tracing at -fpph-tracer=2.  */
-static inline void
-pph_out_mergeable_tree (pph_stream *stream, tree t)
-{
-  if (flag_pph_tracer >= 2)
-pph_trace_tree (stream, t);
-  pph_write_mergeable_tree (stream, t);
-}
-#else
 extern void pph_out_tree (pph_stream *stream, tree t);
-#endif
-
-#if 0
-/* Write an unsigned int VALUE to STREAM.  */
-static inline void
-pph_out_uint (pph_stream *stream, unsigned int value)
-{
-  if (flag_pph_tracer >= 4)
-pph_trace_uint (stream, value);
-  streamer_write_uhwi (stream->encoder.w.ob, value);
-}
-
-/* Write an unsigned HOST_WIDE_INT VALUE to STREAM.  */
-static inline void
-pph_out_uhwi (pph_stream *stream, unsigned HOST_WIDE_INT value)
-{
-  streamer_write_uhwi (stream->encoder.w.ob, value);
-}
-
-/* Write a HOST_WIDE_INT VALUE to stream.  */
-static inline void
-pph_out_hwi (pph_stream *stream, HOST_WIDE_INT value)
-{
-  streamer_write_hwi (stream->encoder.w.ob, value);
-}
-
-/* Write an unsigned char VALUE to STREAM.  */
-static inline void
-pph_out_uchar (pph_stream *stream, unsigned char value)
-{
-  if (flag_pph_tracer >= 4)
-pph_trace_uint (stream, value);
-  streamer_write_char_stream (stream->encoder.w.ob->main_stream, value);
-}
-
-/* Write N bytes from P to STREAM.  */
-static inline void
-pph_out_bytes (pph_stream *stream, const void *p, size_t n)
-{
-  if (flag_pph_tracer >= 4)
-pph_trace_bytes (stream, p, n);
-  lto_output_data_stream (stream->encoder.w.ob->main_stream, p, n);
-}
 
-/* Write string STR to STREAM.  */
-static inline void
-pph_out_string (pph_stream *stream, const char *str)
-{
-  if (flag_pph_tracer >= 4)
-pph_trace_string (stream, str);
-  streamer_write_string (stream->encoder.w.ob,
-stream->encoder.w.ob->main_stream, str, false);
-}
-
-/* Write string STR of length LEN to STREAM.  */
-static inline void
-pph_out_string_with_length (pph_stream *stream, const char *str,
-   unsigned int len)
-{
-  if (flag_pph_tracer >= 4)
-pph_trace_string_with_length (stream, str, len);
-  streamer_write_string_with_length (stream->encoder.w.ob,
-stream->encoder.w.ob->main_stream,
-str, len + 1, false);
-}
-#else
 extern void pph_out_uint (pph_stream *stream, unsigned int value);
-#endif
 
-#if 0
-/* Write location LOC of length to STREAM.  */
-static inline void
-pph_out_location (pph_stream *stream, location_t loc)
-{
-  if (flag_pph_tracer >= 4)
-pph_trace_location (stream, loc);
-  pph_write_location (stream->encoder.w.ob, loc);
-}
-#else
 extern void pph_out_location (pph_stream *stream, location_t loc);
-#endif
-
-#if 0
-/* Write a chain of ASTs to STREAM starting with FIRST.  */
-static inline void
-pph_out_chain (pph_stream *stream, tree first)
-{
-  if (flag_pph_tracer >= 2)
-pph_trace_chain (stream, first);
-  streamer_write_chain (stream->encoder.w.ob, first, false);
-}
-
-/* Write a chain of ASTs to STREAM starting with FIRST.  */
-static inline void
-pph_out_mergeable_chain (pph_stream *stream, tree first)
-{
-  if (flag

PATCH RFA: New configure option --with-native-system-header-dir

2011-10-07 Thread Ian Lance Taylor
I would like to bring Simon's patch for the
--with-native-system-header-dir configure option from the
google/integration branch into gcc mainline.  This patch permits
changing the system header directory from /usr/include to something
else.  It's mainly useful in conjunction with sysroot, so that the
header files don't have to live in usr/include under the sysroot.

Simon's original patch:
http://gcc.gnu.org/ml/gcc-patches/2011-01/msg01811.html

Bootstrapped and tested on x86_64-unknown-linux-gnu.  OK for mainline?

Ian


2011-10-07  Simon Baldwin  

* configure.ac: Add --with-native-system-header-dir option.
* configure: Rebuild from configure.ac.
* Makefile.in: Support --with-native-system-header-dir.
* doc/install.texi: Document --with-native-system-header-dir.


Index: configure.ac
===
--- configure.ac	(revision 179665)
+++ configure.ac	(working copy)
@@ -725,6 +725,23 @@ AC_ARG_ENABLE(shared,
 ], [enable_shared=yes])
 AC_SUBST(enable_shared)
 
+# The use of native_system_header_dir here is for the value (optionally)
+# configured here.  Uses of NATIVE_SYSTEM_HEADER_DIR in this file refer
+# to the make variable defined in Makefile or in target make fragments.
+AC_ARG_WITH([native-system-header-dir],
+  [  --with-native-system-header-dir=dir
+  use dir as the directory to look for standard
+  system header files in.  Defaults to /usr/include.],
+[
+ case ${with_native_system_header_dir} in
+ yes|no) AC_MSG_ERROR([bad value ${withval} given for native system include directory]) ;;
+ /*) ;;
+ *) AC_MSG_ERROR([${withval} should be an absolute directory]) ;;
+ esac
+ native_system_header_dir="${withval}"
+], [native_system_header_dir=/usr/include])
+AC_SUBST(NATIVE_SYSTEM_HEADER_DIR, $native_system_header_dir)
+
 AC_ARG_WITH(build-sysroot, 
   [AS_HELP_STRING([--with-build-sysroot=sysroot],
   [use sysroot as the system root during the build])],
@@ -4515,14 +4532,14 @@ if test x$host != x$target || test "x$TA
   elif test "x$with_sysroot" = x; then
 target_header_dir="${exec_prefix}/${target_noncanonical}/sys-include"
   elif test "x$with_build_sysroot" != "x"; then
-target_header_dir="${with_build_sysroot}/usr/include"
+target_header_dir="${with_build_sysroot}${native_system_header_dir}"
   elif test "x$with_sysroot" = xyes; then
-target_header_dir="${exec_prefix}/${target_noncanonical}/sys-root/usr/include"
+target_header_dir="${exec_prefix}/${target_noncanonical}/sys-root${native_system_header_dir}"
   else
-target_header_dir="${with_sysroot}/usr/include"
+target_header_dir="${with_sysroot}${native_system_header_dir}"
   fi
 else
-  target_header_dir=/usr/include
+  target_header_dir=${native_system_header_dir}
 fi
 
 # Test for stack protector support in target C library.
Index: Makefile.in
===
--- Makefile.in	(revision 179665)
+++ Makefile.in	(working copy)
@@ -455,7 +455,7 @@ LINKER_PLUGIN_API_H = $(srcdir)/../inclu
 LTO_SYMTAB_H = $(srcdir)/../include/lto-symtab.h
 
 # Default native SYSTEM_HEADER_DIR, to be overridden by targets.
-NATIVE_SYSTEM_HEADER_DIR = /usr/include
+NATIVE_SYSTEM_HEADER_DIR = @NATIVE_SYSTEM_HEADER_DIR@
 # Default cross SYSTEM_HEADER_DIR, to be overridden by targets.
 CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@
 
Index: doc/install.texi
===
--- doc/install.texi	(revision 179665)
+++ doc/install.texi	(working copy)
@@ -903,6 +903,18 @@ ideas of what it is for.  People use it 
 install part of GCC@.  Perhaps they make this assumption because
 installing GCC creates the directory.
 
+@item --with-native-system-header-dir=@var{dirname}
+Specifies that @var{dirname} is the directory that contains native system
+header files, rather than @file{/usr/include}. This option is most useful
+if you are creating a compiler that should be isolated from the system
+as much as possible.  It is most commonly used with the
+@option{--with-sysroot} option and will cause GCC to search
+@var{dirname} inside the system root specified by that option.
+
+Please note that for certain targets, such as DJGPP, this value is
+ignored. If the target specifies a default value for native system
+header files then this option is ignored.
+
 @item --enable-shared[=@var{package}[,@dots{}]]
 Build shared versions of libraries, if shared libraries are supported on
 the target platform.  Unlike GCC 2.95.x and earlier, shared libraries
@@ -1736,6 +1748,10 @@ target libraries (which runs on the buil
 installed with @code{make install}; it does not affect the compiler which is
 used to build GCC itself.
 
+If you specify the @option{--with-native-system-header-dir=@var{dirname}}
+option then the compiler will search that directory within @var{dirname} for
+native system headers rather than the defaul

Re: PATCH RFA: New configure option --with-native-system-header-dir

2011-10-07 Thread Joseph S. Myers
On Fri, 7 Oct 2011, Ian Lance Taylor wrote:

> 2011-10-07  Simon Baldwin  
> 
>   * configure.ac: Add --with-native-system-header-dir option.
>   * configure: Rebuild from configure.ac.
>   * Makefile.in: Support --with-native-system-header-dir.
>   * doc/install.texi: Document --with-native-system-header-dir.

How does this end up affecting the paths in cppdefault.c, and which of the 
macros there does it affect?  (I don't see how STANDARD_INCLUDE_DIR, the 
normal /usr/include path, gets affected by this patch; I can only see how 
it affects the paths used to find inputs to fixincludes.)

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


Rename vshuffle/vec_shuffle to vec_perm

2011-10-07 Thread Richard Henderson
Our existing vector permutation support uses the name vec_perm.
The new support added for __builtin_shuffle used a variety of
names.  This brings all the internals into line with vec_perm.

I've added documentation for the (existing) variable permute
rtl named pattern (vec_perm).  I've also added documentation for
the (intended) constant permute rtl named pattern (vec_perm_const).
I've not actually added the support for vec_perm_const yet, but
plan to do so shortly.  It was just easiest to do the docs for
both at the same time.

The builtin is still named shuffle in honor of the OpenCL primitive
on which this feature is based.  I've improved the documentation
for the builtin a bit to make it clear that the selector modulus
is part of the interface.

Tested on x86_64-linux.


r~
 
+   * doc/extend.texi (__builtin_shuffle): Improve the description to
+   include the modulus of the selector.  Mention OpenCL.
+   * doc/md.texi (vec_perm, vec_perm_const): Document named patterns.
+
+   * tree.def (VEC_PERM_EXPR): Rename from VEC_SHUFFLE_EXPR.
+   * genopinit.c (optabs): Rename vshuffle to vec_perm.
+   * c-typeck.c (c_build_vec_perm_expr): Rename from
+   c_build_vec_shuffle_expr.  Update for name changes.
+   * optabs.c (expand_vec_perm_expr_p): Rename from
+   expand_vec_shuffle_expr_p.
+   (expand_vec_perm_expr): Rename from expand_vec_shuffle_expr.
+   * optabs.h (OTI_vec_perm): Rename from DOI_vshuffle.
+   (vec_perm_optab): Rename from vshuffle_optab.
+   * expr.c, gimple-pretty-print.c, gimple.c, gimplify.c,
+   c-tree.h, c-parser.c, tree-cfg.c, tree-inline.c, tree-pretty-print.c,
+   tree-ssa-operands.c, tree-vect-generic.c: Update for name changes.
+
+   * config/i386/i386.c (ix86_expand_vec_perm): Rename from
+   ix86_expand_vshuffle.
+   * config/i386/i386-protos.h: Update.
+   * config/i386/sse.md (VEC_PERM_AVX2): Rename from VSHUFFLE_AVX2.
+   (vec_perm): Rename from vshuffle.



diff --git a/gcc/c-parser.c b/gcc/c-parser.c
index a1ed48d..c948b80 100644
--- a/gcc/c-parser.c
+++ b/gcc/c-parser.c
@@ -5990,7 +5990,7 @@ c_parser_alignof_expression (c_parser *parser)
 }
 
 /* Helper function to read arguments of builtins which are interfaces
-   for the middle-end nodes like COMPLEX_EXPR, VEC_SHUFFLE_EXPR and
+   for the middle-end nodes like COMPLEX_EXPR, VEC_PERM_EXPR and
others.  The name of the builtin is passed using BNAME parameter.
Function returns true if there were no errors while parsing and
stores the arguments in CEXPR_LIST.  */
@@ -6534,13 +6534,13 @@ c_parser_postfix_expression (c_parser *parser)
 
if (VEC_length (c_expr_t, cexpr_list) == 2)
  expr.value =
-   c_build_vec_shuffle_expr
+   c_build_vec_perm_expr
  (loc, VEC_index (c_expr_t, cexpr_list, 0)->value,
   NULL_TREE, VEC_index (c_expr_t, cexpr_list, 1)->value);
 
else if (VEC_length (c_expr_t, cexpr_list) == 3)
  expr.value =
-   c_build_vec_shuffle_expr
+   c_build_vec_perm_expr
  (loc, VEC_index (c_expr_t, cexpr_list, 0)->value,
   VEC_index (c_expr_t, cexpr_list, 1)->value,
   VEC_index (c_expr_t, cexpr_list, 2)->value);
diff --git a/gcc/c-tree.h b/gcc/c-tree.h
index 0e46525..b3e756c 100644
--- a/gcc/c-tree.h
+++ b/gcc/c-tree.h
@@ -595,7 +595,7 @@ extern tree c_begin_omp_task (void);
 extern tree c_finish_omp_task (location_t, tree, tree);
 extern tree c_finish_omp_clauses (tree);
 extern tree c_build_va_arg (location_t, tree, tree);
-extern tree c_build_vec_shuffle_expr (location_t, tree, tree, tree);
+extern tree c_build_vec_perm_expr (location_t, tree, tree, tree);
 
 /* Set to 0 at beginning of a function definition, set to 1 if
a return statement that specifies a return value is seen.  */
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index e7528a7..6dc0210 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -2846,7 +2846,7 @@ build_function_call_vec (location_t loc, tree function, 
VEC(tree,gc) *params,
   return require_complete_type (result);
 }
 
-/* Build a VEC_SHUFFLE_EXPR if V0, V1 and MASK are not error_mark_nodes
+/* Build a VEC_PERM_EXPR if V0, V1 and MASK are not error_mark_nodes
and have vector types, V0 has the same type as V1, and the number of
elements of V0, V1, MASK is the same.
 
@@ -2857,9 +2857,9 @@ build_function_call_vec (location_t loc, tree function, 
VEC(tree,gc) *params,
an implementation accident and this semantics is not guaranteed to
the user.  */
 tree
-c_build_vec_shuffle_expr (location_t loc, tree v0, tree v1, tree mask)
+c_build_vec_perm_expr (location_t loc, tree v0, tree v1, tree mask)
 {
-  tree vec_shuffle;
+  tree ret;
   bool wrap = true;
   bool maybe_const = false;
   bool two_arguments = false;
@@ -2915,7 +2915,7 @@ c_build_vec_shuffle_expr (location_t loc, tree v0, tree 
v1, tree mask)
   return e

Re: patch ping: thread testing infrastructure

2011-10-07 Thread Mike Stump
On Oct 7, 2011, at 2:52 PM, Aldy Hernandez wrote:
> First, thanks so much for tackling this review.  I don't think anyone's 
> overly enthusiastic about reviewing dejagnu crap^H^H^H^Hcode.

I'll review it.  :-)  The last version looks fine to me, watch out for failures.

> How do you like this approach?

Ok.


Patch committed: Fix -fsplit-stack with very large parameters

2011-10-07 Thread Ian Lance Taylor
The -fsplit-stack runtime support code has a bug reported in PR 46093:
if the size of the stack parameters is exceptionally large, the
parameters can overrun the entire newly allocated stack segment.  This
patch fixes the problem.  Bootstrapped and tested on
x86_64-unknown-linux-gnu.  Committed to mainline.

Ian


2011-10-07  Ian Lance Taylor  

PR target/46093
* generic-morestack.c (__generic_morestack): Make sure the segment
is large enough for both the stack frame and the copied
parameters.


Index: generic-morestack.c
===
--- generic-morestack.c	(revision 179665)
+++ generic-morestack.c	(working copy)
@@ -512,7 +512,7 @@ __generic_morestack (size_t *pframe_size
   current = *pp;
 
   if (current == NULL)
-current = allocate_segment (frame_size);
+current = allocate_segment (frame_size + param_size);
 
   current->old_stack = old_stack;
 


Patch committed: #include in generic-morestack-thread.c

2011-10-07 Thread Ian Lance Taylor
The file libgcc/generic-morestack-thread.c refers to EAGAIN, so for
cleanliness it should really #include .  This does not
introduce any new build problems, as generic-morestack.c already
#includes  anyhow.  This patch adds the #include.  Bootstrapped
and tested on x86_64-unknown-linux-gnu.  Committed to mainline.

Ian


2011-10-07  Ian Lance Taylor  

* generic-morestack-thread.c: #include .


Index: generic-morestack-thread.c
===
--- generic-morestack-thread.c	(revision 179665)
+++ generic-morestack-thread.c	(working copy)
@@ -1,5 +1,5 @@
 /* Thread library support for -fsplit-stack.  */
-/* Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+/* Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc.
Contributed by Ian Lance Taylor .
 
 This file is part of GCC.
@@ -36,6 +36,7 @@ see the files COPYING3 and COPYING.RUNTI
 
 #ifndef inhibit_libc
 
+#include 
 #include 
 
 #include "generic-morestack.h"


[C++ Patch] PR 34927

2011-10-07 Thread Paolo Carlini

Hi,

this diagnostic PR is about duplicate inform messages for this kind of 
testcase, where C has a cloned destructor:


class A {};

struct C : A
{
  virtual ~C () = 0;
} c;

The fix seems easy: output a cloned destructor only once (+ output any 
other member functions normally). Patch tested x86_64-linux for regressions.


Ok?

Thanks,
Paolo.

///
2011-10-07  Paolo Carlini  

PR c++/34927
* typeck2.c (abstract_virtuals_error_sfinae): Don't produce duplicate
inform messages in case of cloned destructor.
Index: typeck2.c
===
--- typeck2.c   (revision 179660)
+++ typeck2.c   (working copy)
@@ -340,7 +340,17 @@ abstract_virtuals_error_sfinae (tree decl, tree ty
  type);
 
   FOR_EACH_VEC_ELT (tree, pure, ix, fn)
-   inform (input_location, "\t%+#D", fn);
+   {
+ static bool done_cloned_dest = false;
+
+ bool is_cloned_dest = DECL_CLONED_FUNCTION_P (fn);
+ if (! is_cloned_dest || ! done_cloned_dest)
+   inform (input_location, "\t%+#D", fn);
+
+ if (is_cloned_dest)
+   done_cloned_dest = true;
+   }
+
   /* Now truncate the vector.  This leaves it non-null, so we know
 there are pure virtuals, but empty so we don't list them out
 again.  */


Re: PATCH RFA: New configure option --with-native-system-header-dir

2011-10-07 Thread Ian Lance Taylor
"Joseph S. Myers"  writes:

> On Fri, 7 Oct 2011, Ian Lance Taylor wrote:
>
>> 2011-10-07  Simon Baldwin  
>> 
>>  * configure.ac: Add --with-native-system-header-dir option.
>>  * configure: Rebuild from configure.ac.
>>  * Makefile.in: Support --with-native-system-header-dir.
>>  * doc/install.texi: Document --with-native-system-header-dir.
>
> How does this end up affecting the paths in cppdefault.c, and which of the 
> macros there does it affect?  (I don't see how STANDARD_INCLUDE_DIR, the 
> normal /usr/include path, gets affected by this patch; I can only see how 
> it affects the paths used to find inputs to fixincludes.)

Hmmm, you're quite right.  Simon's patch works because of a subsequent
patch of his, which adds a --with-runtime-root-prefix configure option.

It looks like we currently have NATIVE_SYSTEM_HEADER_DIR in Makefile
fragments and STANDARD_INCLUDE_DIR and SYSTEM_INCLUDE_DIR in tm.h files.

The documentation for NATIVE_SYSTEM_HEADER_DIR says that it should match
SYSTEM_INCLUDE_DIR.  However, in fact, nothing in the tree defines
SYSTEM_INCLUDE_DIR.

NATIVE_SYSTEM_HEADER_DIR is defined by five Makefile fragments:
  config/i386/t-djgpp
  config/i386/t-mingw-w64
  config/i386/t-mingw-w32
  config/i386/t-mingw32
  config/t-gnu
  config/spu/t-spu-elf

STANDARD_INCLUDE_DIR is defined by:
  config/i386/djgpp.h
  config/i386/mingw32.h
  config/spu/spu-elf.h
  config/gnu.h
  config/vms/xm-vms.h

The uses in DJGPP and Mingw support all match.  config/gnu.h is only
used on i[34567]86-*-gnu* while config/t-gnu is used on *-*-gnu*; this
mismatch appears to be an error.  The use of STANDARD_INCLUDE_DIR in
config/vms/xm-vms.h without defining NATIVE_SYSTEM_HEADER_DIR appears to
be an error.

The configure script uses "/usr/include" when setting
target_header_dir.  This is incorrect when NATIVE_SYSTEM_HEADER_DIR is
defined by a Makefile fragment.

So, it seems to me that we should:

  * Remove SYSTEM_INCLUDE_DIR, which is undefined and unnecessary.

  * Move the definition of NATIVE_SYSTEM_HEADER_DIR into config.gcc
(named native_system_header_dir).  The default is /usr/include.
This appears to be necessary since the configure script itself needs
to know this value.

  * Have the configure script use NATIVE_SYSTEM_HEADER_DIR when setting
target_header_dir.

  * Arrange for Makefile to define NATIVE_SYSTEM_HEADER_DIR when
compiling cppdefault.c (i.e., add it to PREPROCESSOR_DEFINES in
Makefile.in).

  * Replace STANDARD_INCLUDE_DIR in cppdefault.c with
NATIVE_SYSTEM_HEADER_DIR.

  * Remove STANDARD_INCLUDE_DIR.

  * Add the --with-native-system-header-dir option.

This will remove the setting in vms/xm-vms.h; people using VMS as a host
should be advised to use --with-sysroot instead.

I think this will get us to a consistent state where the name of the
header file directory is defined in one place and is used everywhere it
is appropriate.

Ian


patch ping: Dump the "degree of overlap" to compare static profile with instrumentation profile

2011-10-07 Thread Dehao Chen
http://gcc.gnu.org/ml/gcc-patches/2011-09/msg01293.html


Re: patch ping: Dump the "degree of overlap" to compare static profile with instrumentation profile

2011-10-07 Thread Xinliang David Li
Yes, this is useful for static prediction tuning.

David

On Fri, Oct 7, 2011 at 6:40 PM, Dehao Chen  wrote:
>
> http://gcc.gnu.org/ml/gcc-patches/2011-09/msg01293.html


[pph] Make pph.h _the_ interface header. (issue5247044)

2011-10-07 Thread Lawrence Crowl
This patch makes pph.h the single interface header for PPH.
The pph-streamer.h header is now an internal header for use
within the pph*.c files.  Some declarations have moved from
one header to the other to make that possible.


Index: gcc/cp/ChangeLog.pph

2011-10-07   Lawrence Crowl  

* pph-streamer.h (typedef pph_stream): Move to pph.h.
(enum pph_symtab_action): Likewise.
(enum pph_record_marker): Likewise.
(enum pph_tag): Likewise.
(extern pph_out_uint): Liekwise.
(extern pph_out_location): Likewise.
(extern pph_out_tree): Likewise.
(extern pph_out_record_marker): Likewise.
(extern pph_add_decl_to_symtab): Likewise.
(extern pph_in_uint): Likewise.
(extern pph_in_location): Likewise.
(extern pph_in_tree): Likewise.
(extern pph_record_marker): Likewise.
(extern struct binding_table_s): Likewise.
(extern pph_out_binding_table): Likewise.
(extern pph_in_binding_table): Likewise.
(extern pph_out_pending_templates_list): Likewise.
(extern pph_out_spec_entry_tables): Likewise.
(extern pph_in_pending_templates_list): Likewise.
(extern pph_in_spec_entry_tables): Likewise.
(pph_writer_enabled_p): Likewise.
(pph_enabled_p): Likewise.

* pph.h (cp_token_hunk): Remove unused.
(cp_token_hunk_ptr): Likewise.
(DEF_VEC_P (cp_token_hunk_ptr)): Likewise.
(DEF_VEC_ALLOC_P (cp_token_hunk_ptr,gc)): Likewise.
(#error diagnostic): Likewise.
(extern pph_tree_code_text): Move to pph-streamer.h.
(extern pph_dump_min_decl): Likewise.
(extern pph_dump_namespace): Likewise.

* pph.h: Remove includes for hashtab.h, line-map.h, parser.h, and
timevar.h.
* pph-streamer.h: Add include pph.h.
* pph-streamer-in.c: Add include parser.h.
* pph-streamer-out.c: Likewise.
* decl.c: Include pph.h instead of pph-streamer.h.
* semantics.c: Likewise.
* parser.c: Remove include of pph-streamer.h.
* name-lookup.c: Likewise.
* Make-lang.in: Adjust dependences to reflect the above.


Index: gcc/cp/decl.c
===
--- gcc/cp/decl.c   (revision 179580)
+++ gcc/cp/decl.c   (working copy)
@@ -33,6 +33,7 @@ along with GCC; see the file COPYING3.  
 #include "coretypes.h"
 #include "tm.h"
 #include "tree.h"
+#include "pph.h"
 #include "flags.h"
 #include "cp-tree.h"
 #include "tree-iterator.h"
@@ -54,7 +55,6 @@ along with GCC; see the file COPYING3.  
 #include "pointer-set.h"
 #include "splay-tree.h"
 #include "plugin.h"
-#include "pph-streamer.h"
 
 /* Possible cases of bad specifiers type used by bad_specifiers. */
 enum bad_spec_place {
Index: gcc/cp/Make-lang.in
===
--- gcc/cp/Make-lang.in (revision 179580)
+++ gcc/cp/Make-lang.in (working copy)
@@ -265,10 +265,9 @@ CXX_TREE_H = $(TREE_H) cp/name-lookup.h 
$(srcdir)/../include/hashtab.h
 CXX_PARSER_H = tree.h c-family/c-pragma.h cp/parser.h
 CXX_PRETTY_PRINT_H = cp/cxx-pretty-print.h $(C_PRETTY_PRINT_H)
-CXX_PPH_H = $(srcdir)/../libcpp/include/line-map.h $(HASHTAB_H) \
-   $(CXX_PARSER_H) $(TIMEVAR_H) $(CXX_TREE_H) cp/pph.h
-CXX_PPH_STREAMER_H = $(LTO_STREAMER_H) cp/pph-streamer.h $(TREE_H) \
-   $(DATA_STREAMER_H) $(TREE_STREAMER_H)
+CXX_PPH_H = $(CXX_TREE_H) cp/pph.h
+CXX_PPH_STREAMER_H = $(LTO_STREAMER_H) $(DATA_STREAMER_H) $(TREE_STREAMER_H) \
+   $(TREE_H) $(CXX_PPH_H) cp/pph-streamer.h
 
 cp/lex.o: cp/lex.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) \
   $(C_PRAGMA_H) output.h input.h cp/operators.def $(TM_P_H) \
@@ -281,7 +280,7 @@ cp/decl.o: cp/decl.c $(CXX_TREE_H) $(TM_
   cp/operators.def $(TM_P_H) $(TREE_INLINE_H) $(DIAGNOSTIC_H) $(C_PRAGMA_H) \
   debug.h gt-cp-decl.h $(TIMEVAR_H) $(TARGET_H) $(PLUGIN_H) \
   intl.h tree-iterator.h pointer-set.h $(SPLAY_TREE_H) \
-  c-family/c-objc.h $(CXX_PPH_STREAMER_H)
+  c-family/c-objc.h $(CXX_PPH_H)
 cp/decl2.o: cp/decl2.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) cp/decl.h \
   output.h toplev.h $(C_COMMON_H) gt-cp-decl2.h $(CGRAPH_H) \
   $(C_PRAGMA_H) $(TREE_DUMP_H) intl.h $(TARGET_H) $(GIMPLE_H) pointer-set.h \
@@ -301,7 +300,7 @@ cp/class.o: cp/class.c $(CXX_TREE_H) $(T
   $(SPLAY_TREE_H) pointer-set.h
 cp/call.o: cp/call.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) toplev.h \
   $(DIAGNOSTIC_CORE_H) intl.h gt-cp-call.h convert.h $(TARGET_H) langhooks.h \
-  $(TIMEVAR_H) $(CXX_PPH_H) c-family/c-objc.h
+  $(TIMEVAR_H) c-family/c-objc.h
 cp/friend.o: cp/friend.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H)
 cp/init.o: cp/init.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) \
   $(EXCEPT_H) $(TARGET_H)
@@ -332,7 +331,7 @@ cp/repo.o: cp/repo.c $(CXX_TREE_H) $(TM_
 cp/semantics.o: cp/semantics.c $(CXX_TREE_H) $(TM_H) toplev.h \
   $(FLAGS_H) output.h $(RTL_H) $(TIMEVAR_H) \
   $(TREE_INLINE_H) $(CGRAPH_H) $(TARGET_H) $(C_COMMON_H) $(GIMPLE_H

Re: [Patch, Fortran, committed] PR 50585: [4.6/4.7 Regression] ICE with assumed length character array argument

2011-10-07 Thread Tobias Burnus

On 07.10.2011 23:19, Janus Weil wrote:
Yes, please backport to 4.6. If you want, you can also backport to 
4.5. However, I do not think that -fwhole-file gets used in 4.5 - 
especially, as it has some issues. 

Fixed on the 4.6 branch with r179696. It's probably not worth to
backport to 4.5 ...


Thanks! What's about the .texi change for -fwhole-file?

Tobias