Re: [PATCH] Fix some ICF gimple_call handling issues

2014-11-10 Thread Richard Biener
On November 10, 2014 9:45:27 PM CET, Jakub Jelinek ja...@redhat.com wrote:
Hi!

As the following two testcases shows, there are lots of issues in
ICF compare_gimple_call, in particular, it doesn't handle indirect
calls
properly (see the ipa-icf-31.c testcase), doesn't handle internal calls
properly (see ubsan/ipa-icf-1.c), didn't check gimple_call flags at
all.

As discussed with Honza, the call chain test (from Martin) is probably
insufficient, I'm open with leaving it out from the patch, but perhaps
what the patch has is better than nothing at all for now.

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

2014-11-10  Jakub Jelinek  ja...@redhat.com
   Martin Liska  mli...@suse.cz

   * ipa-icf-gimple.c (func_checker::compare_bb): Fix comment typo.
   (func_checker::compare_gimple_call): Compare gimple_call_fn,
   gimple_call_chain, gimple_call_fntype and call flags.
testsuite/
   * gcc.dg/ubsan/ipa-icf-1.c: New test.
   * gcc.dg/ipa/ipa-icf-31.c: New test.

--- gcc/ipa-icf-gimple.c.jj2014-10-30 14:42:20.0 +0100
+++ gcc/ipa-icf-gimple.c   2014-11-10 19:08:38.339986360 +0100
@@ -554,7 +554,7 @@ func_checker::parse_labels (sem_bb *bb)
 
In general, a collection of equivalence dictionaries is built for types
like SSA names, declarations (VAR_DECL, PARM_DECL, ..). This
infrastructure
-   is utilized by every statement-by-stament comparison function.  */
+   is utilized by every statement-by-statement comparison function. 
*/
 
 bool
 func_checker::compare_bb (sem_bb *bb1, sem_bb *bb2)
@@ -662,9 +662,49 @@ func_checker::compare_gimple_call (gimpl
   t1 = gimple_call_fndecl (s1);
   t2 = gimple_call_fndecl (s2);

Just drop these and compare gimple_call_fn only.

-  /* Function pointer variables are not supported yet.  */
   if (!compare_operand (t1, t2))
-return return_false();
+return return_false ();
+
+  if (t1 == NULL_TREE)
+{
+  t1 = gimple_call_fn (s1);
+  t2 = gimple_call_fn (s2);
+  if (!compare_operand (t1, t2))
+  return return_false ();
+}
+
+  /* Compare flags.  */
+  if (gimple_call_internal_p (s1) != gimple_call_internal_p (s2)
+  || gimple_call_ctrl_altering_p (s1) !=
gimple_call_ctrl_altering_p (s2)
+  || gimple_call_tail_p (s1) != gimple_call_tail_p (s2)
+  || gimple_call_return_slot_opt_p (s1) !=
gimple_call_return_slot_opt_p (s2)
+  || gimple_call_from_thunk_p (s1) != gimple_call_from_thunk_p
(s2)
+  || gimple_call_va_arg_pack_p (s1) != gimple_call_va_arg_pack_p
(s2)
+  || gimple_call_alloca_for_var_p (s1) !=
gimple_call_alloca_for_var_p (s2)
+  || gimple_call_with_bounds_p (s1) != gimple_call_with_bounds_p
(s2))
+return false;
+
+  if (gimple_call_internal_p (s1)
+   gimple_call_internal_fn (s1) != gimple_call_internal_fn (s2))
+return false;
+
+  tree fntype1 = gimple_call_fntype (s1);
+  tree fntype2 = gimple_call_fntype (s2);
+  if (fntype1 == NULL_TREE)
+{
+  if (fntype2)
+  return false;
+}
+  else if (fntype2 == NULL_TREE)
+return false;
+  else if (!types_compatible_p (fntype1, fntype2))
+return return_false_with_msg (call function types are not
compatible);
+
+  tree chain1 = gimple_call_chain (s1);
+  tree chain2 = gimple_call_chain (s2);
+
+  if ((chain1  !chain2) || (!chain1  chain2))
+return return_false_with_msg (Tree call chains are different);

I miss a compare_operands for the call chain.

Otherwise OK.

Thanks,
Richard.

   /* Checking of argument.  */
   for (i = 0; i  gimple_call_num_args (s1); ++i)
--- gcc/testsuite/gcc.dg/ubsan/ipa-icf-1.c.jj  2014-11-10
19:00:53.509525071 +0100
+++ gcc/testsuite/gcc.dg/ubsan/ipa-icf-1.c 2014-11-10
19:02:21.836925806 +0100
@@ -0,0 +1,23 @@
+/* { dg-do run } */
+/* { dg-skip-if  { *-*-* } { * } { -O2 } } */
+/* { dg-options -fsanitize=undefined -fipa-icf } */
+
+__attribute__ ((noinline, noclone))
+int f1 (int x, int y)
+{
+  return x + y;
+}
+
+__attribute__ ((noinline, noclone))
+int f2 (int x, int y)
+{
+  return x - y;
+}
+
+int
+main ()
+{
+  if (f1 (5, 6) != 11 || f2 (5, 6) != -1)
+__builtin_abort ();
+  return 0;
+}
--- gcc/testsuite/gcc.dg/ipa/ipa-icf-31.c.jj   2014-11-10
18:59:16.604294652 +0100
+++ gcc/testsuite/gcc.dg/ipa/ipa-icf-31.c  2014-11-10 18:59:59.690519616
+0100
@@ -0,0 +1,41 @@
+/* { dg-do run } */
+/* { dg-options -O2 -fipa-icf } */
+
+__attribute__ ((noinline, noclone))
+int f1 (int x, int (*p1) (void), int (*p2) (void))
+{
+  if (x)
+return p1 ();
+  else
+return p2 ();
+}
+
+__attribute__ ((noinline, noclone))
+int f2 (int x, int (*p1) (void), int (*p2) (void))
+{
+  if (x)
+return p2 ();
+  else
+return p1 ();
+}
+
+__attribute__ ((noinline, noclone))
+int f3 (void)
+{
+  return 1;
+}
+
+__attribute__ ((noinline, noclone))
+int f4 (void)
+{
+  return 2;
+}
+
+int
+main ()
+{
+  if (f1 (0, f3, f4) != 2 || f1 (1, f3, f4) != 1 || f2 (0, f3, f4) !=
1
+  || f2 (1, f3, f4) != 2)
+__builtin_abort ();
+  return 0;
+}

 

[PATCH][ARM] testsuite, use arm_eabi #2

2014-11-10 Thread Andreas Tobler

Hi all,

here a second chunk which uses arm_eabi instead of arm*-*-*eabi* and 
arm*-*-symbianelf*.


As I was told, arm*-*-symbianelf* should be EABI so we can use arm_eabi 
for all instead of listing each OS.


Ok for trunk?

TIA,
Andreas

2014-11-10  Andreas Tobler  andre...@gcc.gnu.org

* gcc.target/arm/eabi1.c: Replace arm*-*-*eabi* and arm*-*-symbianelf*
with arm_eabi.
* g++.dg/abi/arm_rtti1.C: Likewise.
* g++.dg/abi/key1.C: Likewise.
* g++.dg/ext/visibility/arm1.C: Likewise.
* g++.dg/ext/visibility/arm2.C: Likewise.
* g++.dg/ext/visibility/arm3.C: Likewise.



Index: g++.dg/abi/arm_rtti1.C
===
--- g++.dg/abi/arm_rtti1.C  (revision 217306)
+++ g++.dg/abi/arm_rtti1.C  (working copy)
@@ -1,4 +1,4 @@
-// { dg-do compile { target arm*-*-eabi* arm*-*-symbianelf* } }
+// { dg-do compile { target arm_eabi } }
 // { dg-options -O2 } 
 // Check that, even when optimizing, we emit an out-of-line call to
 // the type-info comparison function.
Index: g++.dg/abi/key1.C
===
--- g++.dg/abi/key1.C   (revision 217306)
+++ g++.dg/abi/key1.C   (working copy)
@@ -1,5 +1,5 @@
 // On ARM EABI platforms, key methods may never be inline.
-// { dg-do compile { target arm*-*-eabi* arm*-*-symbianelf* } }
+// { dg-do compile { target arm_eabi } }
 // { dg-final { scan-assembler-not _ZTV1S } }
 // { dg-final { scan-assembler-not _ZTV1T } }
 // { dg-final { scan-assembler _ZTV1U } }
Index: g++.dg/ext/visibility/arm1.C
===
--- g++.dg/ext/visibility/arm1.C(revision 217306)
+++ g++.dg/ext/visibility/arm1.C(working copy)
@@ -1,4 +1,4 @@
-// { dg-do compile { target arm*-*-eabi* arm*-*-symbianelf* } }
+// { dg-do compile { target arm_eabi } }
 // { dg-require-dll  }
 // { dg-options -fvisibility=hidden }
 // Most class data should be exported.
Index: g++.dg/ext/visibility/arm2.C
===
--- g++.dg/ext/visibility/arm2.C(revision 217306)
+++ g++.dg/ext/visibility/arm2.C(working copy)
@@ -1,4 +1,4 @@
-// { dg-do compile { target arm*-*-*eabi* arm*-*-symbianelf* } }
+// { dg-do compile { target arm_eabi } }
 // Class data should be exported.
 // { dg-final { scan-not-hidden _ZTV1S } }
 // { dg-final { scan-not-hidden _ZTI1S } }
Index: g++.dg/ext/visibility/arm3.C
===
--- g++.dg/ext/visibility/arm3.C(revision 217306)
+++ g++.dg/ext/visibility/arm3.C(working copy)
@@ -1,4 +1,4 @@
-// { dg-do compile { target arm*-*-*eabi* } }
+// { dg-do compile { target arm_eabi } }
 // { dg-require-dll  }
 // { dg-options -fvisibility=hidden }
 
Index: gcc.target/arm/eabi1.c
===
--- gcc.target/arm/eabi1.c  (revision 217306)
+++ gcc.target/arm/eabi1.c  (working copy)
@@ -1,4 +1,4 @@
-/* { dg-do run { target arm*-*-symbianelf* arm*-*-eabi* } } */
+/* { dg-do run { target arm_eabi } } */
 /* { dg-options  } */
 
 /* This file tests most of the non-C++ run-time helper functions


Re: [PATCH, i386]: Use std::swap

2014-11-10 Thread Richard Biener
On November 10, 2014 9:13:29 PM CET, Uros Bizjak ubiz...@gmail.com wrote:
Hello!

std::swap was recently mentioned in gcc-patches@ mailing list, so I
gave it a try. As can be seen below, a lot of code in config/i386
benefits from this conversion.

Surprisingly, I didn't have to include any header on F20 linux build.
So, is this patch OK as far as c++ is concerned?

2014-11-10  Uros Bizjak  ubiz...@gmail.com

* config/i386/i386.c (ix86_decompose_address): Replace open-coded

No extra includes required? Then certainly OK. Otherwise the required includes 
have to go to system.h in which case please drop the custom swap template from 
tree-vect-data-refs.c

Thanks,
Richard.

swap with std::swap to swap values.
(ix86_fixup_binary_operands): Ditto.
(ix86_binary_operator_ok): Ditto.
(ix86_prepare_fp_compare_args): Ditto.
(ix86_expand_branch): Ditto.
(ix86_expand_carry_flag_compare): Ditto.
(ix86_expand_int_movcc): Ditto.
(ix86_prepare_sse_fp_compare_args): Ditto.
(ix86_expand_sse_fp_minmax): Ditto.
(ix86_expand_int_vcond): Ditto.
(ix86_split_long_move): Ditto.
(ix86_expand_sse_comi): Ditto.
(ix86_expand_sse_compare_and_jump): Ditto.
(ix86_expand_sse_compare_mask): Ditto.
* config/i386/i386.md (*addmode_1): Ditto.
(addsi_1_zext): Ditto.
(*addhi_1): Ditto.
(*addqi_1): Ditto.
(*addmode_2): Ditto.
(*addsi_2_zext): Ditto.
(*addmode_3): Ditto.
(*addsi_3_zext): Ditto.
(*addmode_5): Ditto.
(absneg splitter): Ditto.

Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}.

I will wait for a day or two for possible comments from c++ side...

Uros.




Re: [PATCH, i386]: Use std::swap

2014-11-10 Thread Uros Bizjak
On Mon, Nov 10, 2014 at 10:13 PM, Richard Biener
richard.guent...@gmail.com wrote:
 On November 10, 2014 9:13:29 PM CET, Uros Bizjak ubiz...@gmail.com wrote:
Hello!

std::swap was recently mentioned in gcc-patches@ mailing list, so I
gave it a try. As can be seen below, a lot of code in config/i386
benefits from this conversion.

Surprisingly, I didn't have to include any header on F20 linux build.
So, is this patch OK as far as c++ is concerned?

2014-11-10  Uros Bizjak  ubiz...@gmail.com

* config/i386/i386.c (ix86_decompose_address): Replace open-coded

 No extra includes required? Then certainly OK. Otherwise the required 
 includes have to go to system.h in which case please drop the custom swap 
 template from tree-vect-data-refs.c

Interesting, tree-vect-data-refs.c survives bootstrap with:

--cut here--
Index: tree-vect-data-refs.c
===
--- tree-vect-data-refs.c   (revision 217303)
+++ tree-vect-data-refs.c   (working copy)
@@ -2718,14 +2718,6 @@ comp_dr_with_seg_len_pair (const void *p1_, const
   return 0;
 }

-template class T static void
-swap (T a, T b)
-{
-  T c (a);
-  a = b;
-  b = c;
-}
-
 /* Function vect_vfa_segment_size.

Create an expression that computes the size of segment
@@ -2858,7 +2850,7 @@ vect_prune_runtime_alias_test_list (loop_vec_info
   dr_with_seg_len (dr_b, segment_length_b));

   if (compare_tree (DR_BASE_ADDRESS (dr_a), DR_BASE_ADDRESS (dr_b))  0)
-   swap (dr_with_seg_len_pair.first, dr_with_seg_len_pair.second);
+   std::swap (dr_with_seg_len_pair.first, dr_with_seg_len_pair.second);

   comp_alias_ddrs.safe_push (dr_with_seg_len_pair);
 }
@@ -2908,8 +2900,8 @@ vect_prune_runtime_alias_test_list (loop_vec_info
 and DR_A1 and DR_A2 are two consecutive memrefs.  */
  if (*dr_a1 == *dr_a2)
{
- swap (dr_a1, dr_b1);
- swap (dr_a2, dr_b2);
+ std::swap (dr_a1, dr_b1);
+ std::swap (dr_a2, dr_b2);
}

  if (!operand_equal_p (DR_BASE_ADDRESS (dr_a1-dr),
--cut here--

Uros.


patch to fix PR63620 and PR63799

2014-11-10 Thread Vladimir Makarov
Uros reported that my latest patch to fix PR63620 does not fix actually 
the problem and H.J. reported that the patch resulted in 2 java test 
failures (PR63799).


  The following patch fixes PR63620 and PR63799.

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63620
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63799

   The patch was successfully tested and bootstrapped on x86/x86-64.

Committed as rev. 217320.

2014-11-10  Vladimir Makarov  vmaka...@redhat.com

PR rtl-optimization/63620
PR rtl-optimization/63799
* lra-lives.c (process_bb_lives): Do not delete EH_REGION, trapped
and setting PIC pseudo insns.
(lra_create_live_ranges): Fix the typo.


Index: lra-lives.c
===
--- lra-lives.c (revision 217288)
+++ lra-lives.c (working copy)
@@ -704,7 +704,13 @@ process_bb_lives (basic_block bb, int c
   set = single_set (curr_insn);
 
   if (set != NULL_RTX
-  REG_P (SET_DEST (set))  REGNO (SET_DEST (set)) = 
FIRST_PSEUDO_REGISTER)
+  REG_P (SET_DEST (set))  REGNO (SET_DEST (set)) = 
FIRST_PSEUDO_REGISTER
+  find_reg_note (curr_insn, REG_EH_REGION, NULL_RTX) == NULL_RTX
+  ! may_trap_p (PATTERN (curr_insn))
+ /* Don't do premature remove of pic offset pseudo as we
+can start to use it after some reload generation.  */
+  (pic_offset_table_rtx == NULL_RTX
+ || pic_offset_table_rtx != SET_DEST (set)))
{
  bool dead_insn_p = true;
 
@@ -1273,7 +1279,8 @@ lra_create_live_ranges (bool all_p)
 df_get_postorder (DF_BACKWARD), df_get_n_blocks (DF_BACKWARD));
   if (lra_dump_file != NULL)
{
- fprintf (lra_dump_file, Global pseudo live data have be updated:\n);
+ fprintf (lra_dump_file,
+  Global pseudo live data have been updated:\n);
  basic_block bb;
  FOR_EACH_BB_FN (bb, cfun)
{


Re: [PATCH 2/3] PR other/61321 - demangler crash on casts in template parameters

2014-11-10 Thread Cary Coutant
Ping. I'm getting more reports of this bug internally, and it would be
nice to have the fix upstream.

-cary


On Mon, Oct 13, 2014 at 11:43 AM, Cary Coutant ccout...@google.com wrote:
 Ping. Jason, do you still think the special-case for conversion ops is
 inappropriate?

 -cary


 On Fri, Jul 25, 2014 at 2:16 AM, Pedro Alves pal...@redhat.com wrote:
 On 07/24/2014 11:35 PM, Cary Coutant wrote:
 It seems that the problem here is more general; a template argument list is
 not in scope within that same template argument list.  Can't we fix that
 without special-casing conversion ops?

 I think conversion ops really are a special case.

 Thanks Cary.  FWIW, I agree.

 (GDB 7.8 hasn't been released yet, though it's close.  If this
 patch is approved as is, we'll be able to have the crash
 fixed there.  If this requires a significant rewrite though,
 I'm afraid I might not be able to do it myself anytime soon.)

 It's the only case
 where the template parameters refer to the template argument list from
 the cast operator's enclosing template. In a cast expression, like
 anywhere else you might have a template parameter, the template
 parameter refers to the template argument list of the immediately
 enclosing template.

 I think this note from Section 5.1.3 (Operator Encodings) of the ABI
 is what makes this a special case (it's an informative comment in the
 document, but seems to me to be normative):

 For a user-defined conversion operator the result type (i.e., the
 type to which the operator converts) is part of the mangled name of
 the function. If the conversion operator is a member template, the
 result type will appear before the template parameters. There may be
 forward references in the result type to the template parameters.


 --
 Thanks,
 Pedro Alves



Re: [Bug libstdc++/61107] stl_algo.h: std::__inplace_stable_partition() doesn't process the whole data range

2014-11-10 Thread Jonathan Wakely

On 10/11/14 21:50 +0100, François Dumont wrote:

Any news about this one ?

Here is another version with additional random tests on algos just to 
challenge other combinations of tests.


   PR libstdc++/61107
   * include/bits/stl_algo.h (__inplace_stable_partition): Delete.
   (__stable_partition_adaptive): Return __first is range length is 1.


The first is should be if.

The change to stl_algo.h looks OK.

I don't like the use of mt19937 in the tests, I know you committed a
test I wrote recently that uses mt19937, but that was only meant to
demonstrate the bug for bugzilla, not necessarily as the final test.

The PRNG produces the exact same sequence of numbers every time (when
you don't seed it) so if you can make the test fail using a few
iterations with the PRNG then you can find the input that fails and
just add that input to the testsuite. I didn't do that for the test I
put in bugzilla because I didn't have time to work out which input
caused the memory leak, only that it leaked for *some* easily
reproducible input. I wasn't trying to start a trend where we use
fixed sequences of pseudorandom numbers in lots of tests.



Re: RFC: Update ISL under gcc/infrastructure/ ? // Remove CLooG?

2014-11-10 Thread Tobias Burnus

Tobias Grosser wrote:

On 10.11.2014 20:14, Roman Gareev wrote:

Sure. We should drop the flag in these test cases.
This seems to make sense, as they now test something different and 
the flag removal would reflect this.


I personally would include this in the same patch. Would this be 
difficult?


I don’t think that it could be difficult. I just wanted to reduce the
size of a patch which can be found below.

This LGTM if it passes tests.


Seems as if the next topics would be:

* Removal of CLooG from the main configure.ac, config/cloog.m4, 
Makefile.tpl + regenation of configure and Makefile.{in,def} + syncing 
with sourceware.org's tree.


* Changes to permit using ISL 0.14.0 – with or without still supporting 
0.12.0 (the latter seems to be preferred by Richard as it permits to use 
the same system lib also with GCC 4.8/4.9). When/if 0.14 works, one can 
also put the new version at infrastructure, which fixes PR62289.


* Mentioning in gcc-5/changes.html (Caveats) that CLooG is no longer 
required for graphite. (Cf. https://gcc.gnu.org/gcc-4.8/changes.html)


* Removal of CLooG from install.texi's Prerequisites and from 
contrib/download_prerequisites – that's what the attached patch does. I 
intent to commit it tomorrow as obvious, if there are no objections.


Tobias
2014-11-11  Tobias Burnus  bur...@net-b.de

contrib/
	* download_prerequisites: Stop downloading CLooG.
gcc/
	* doc/install.texi (Prerequisites): Remove CLooG.

diff --git a/contrib/download_prerequisites b/contrib/download_prerequisites
index cc27143..a9a9f02 100755
--- a/contrib/download_prerequisites
+++ b/contrib/download_prerequisites
@@ -44,13 +44,8 @@ ln -sf $MPC mpc || exit 1
 # Necessary to build GCC with the Graphite loop optimizations.
 if [ $GRAPHITE_LOOP_OPT = yes ] ; then
   ISL=isl-0.12.2
-  CLOOG=cloog-0.18.1
 
   wget ftp://gcc.gnu.org/pub/gcc/infrastructure/$ISL.tar.bz2 || exit 1
   tar xjf $ISL.tar.bz2  || exit 1
   ln -sf $ISL isl || exit 1
-
-  wget ftp://gcc.gnu.org/pub/gcc/infrastructure/$CLOOG.tar.gz || exit 1
-  tar xzf $CLOOG.tar.gz || exit 1
-  ln -sf $CLOOG cloog || exit 1
 fi
diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
index 3df78ff..fa5fe6e 100644
--- a/gcc/doc/install.texi
+++ b/gcc/doc/install.texi
@@ -393,21 +393,6 @@ built together with GCC.  Alternatively, the @option{--with-isl} configure
 option should be used if ISL is not installed in your default library
 search path.
 
-@item CLooG 0.18.1
-
-Necessary to build GCC with the Graphite loop optimizations.  It can be
-downloaded from @uref{ftp://gcc.gnu.org/pub/gcc/infrastructure/} as
-@file{cloog-0.18.1.tar.gz}.  If a CLooG source distribution is found
-in a subdirectory of your GCC sources named @file{cloog}, it will be
-built together with GCC.  Alternatively, the @option{--with-cloog} configure
-option should be used if CLooG is not installed in your default library search
-path.
-
-If you want to install CLooG separately it needs to be built against
-ISL 0.12.2 by using the @option{--with-isl=system} to direct CLooG to pick
-up an already installed ISL.  Using the ISL library as bundled with CLooG
-is not supported.
-
 @end table
 
 @heading Tools/packages necessary for modifying GCC


Re: [PATCH] libstdc++ - Add xmethods for associative containers (ordered and unordered)

2014-11-10 Thread Jonathan Wakely

On 09/11/14 16:00 -0800, Siva Chandra wrote:

Hello,

Attached is a patch which adds xmethods for the associative containers
(set, map, multiset and multimap) and their unordered versions. I
think the GDB Python API is not rich enough to implement xmethods for
the more interesting methods like find, count etc. The attached patch
only implements xmethods for size and empty. That way, it is a fairly
straightforward patch.


This looks fine, I'll commit it soon. Thanks.


Re: [PATCH, i386]: Use std::swap

2014-11-10 Thread Marc Glisse

On Mon, 10 Nov 2014, Richard Biener wrote:


No extra includes required?


utility is already included in wide-int.h and rtl.h, should probably 
move those.


--
Marc Glisse


Re: [PATCH][ARM] testsuite, use arm_eabi #2

2014-11-10 Thread Mike Stump
On Nov 10, 2014, at 1:12 PM, Andreas Tobler andreast-l...@fgznet.ch wrote:
 As I was told, arm*-*-symbianelf* should be EABI so we can use arm_eabi for 
 all instead of listing each OS.
 
 Ok for trunk?

Ok.


[C PATCH] warn for empty struct -Wc++-compat

2014-11-10 Thread Prathamesh Kulkarni
Hi,
  For the following test-case:
struct A {};
clang -fsyntax-only -Wc++-compat gives following warning and gcc does not:
empty-struct.c:1:1: warning: empty struct has size 0 in C, size 1 in
C++ [-Wc++-compat]
struct F {};

This patch adds the above warning to the C FE.
Bootstrapped on x86_64-unknown-linux-gnu (reg-test pending).

* gcc/c/c-decl.c
  (warn_cxx_compat_finish_struct): Add new parameter of type location_t.
Warn for empty struct.
  (finish_struct): Pass loc to warn_cxx_compat_finish_struct.

* gcc/testsuite/gcc.dg/Wcxx-compat-22.c: New test-case.

Thank you,
Prathamesh
Index: gcc/c/c-decl.c
===
--- gcc/c/c-decl.c	(revision 217287)
+++ gcc/c/c-decl.c	(working copy)
@@ -7506,12 +7506,15 @@
 /* Finish up struct info used by -Wc++-compat.  */
 
 static void
-warn_cxx_compat_finish_struct (tree fieldlist)
+warn_cxx_compat_finish_struct (tree fieldlist, location_t record_loc)
 {
   unsigned int ix;
   tree x;
   struct c_binding *b;
 
+  if (fieldlist == NULL_TREE)
+warning_at (record_loc, OPT_Wc___compat, empty struct has size 0 in C, 1 in C++);
+
   /* Set the C_TYPE_DEFINED_IN_STRUCT flag for each type defined in
  the current struct.  We do this now at the end of the struct
  because the flag is used to issue visibility warnings, and we
@@ -7844,7 +7847,7 @@
 			  DECL_EXPR, build_decl (loc, TYPE_DECL, NULL, t)));
 
   if (warn_cxx_compat)
-warn_cxx_compat_finish_struct (fieldlist);
+warn_cxx_compat_finish_struct (fieldlist, loc);
 
   struct_parse_info-struct_types.release ();
   struct_parse_info-fields.release ();
Index: gcc/testsuite/gcc.dg/Wcxx-compat-22.c
===
--- gcc/testsuite/gcc.dg/Wcxx-compat-22.c	(revision 0)
+++ gcc/testsuite/gcc.dg/Wcxx-compat-22.c	(working copy)
@@ -0,0 +1,3 @@
+/* { dg-do compile } */
+/* { dg-options -Wc++-compat } */
+struct A {}; /* { dg-warning empty struct has size 0 in C } */


Re: [PATCH][ARM] testsuite, use arm_eabi #2

2014-11-10 Thread Mike Stump
[ sorry for dup, if any ]

On Nov 10, 2014, at 1:12 PM, Andreas Tobler andreast-l...@fgznet.ch wrote:
 As I was told, arm*-*-symbianelf* should be EABI so we can use arm_eabi for 
 all instead of listing each OS.
 
 Ok for trunk?

Ok.

Re: [PATCH] Fix some ICF gimple_call handling issues

2014-11-10 Thread Jan Hubicka
 Hi!
 
 As the following two testcases shows, there are lots of issues in
 ICF compare_gimple_call, in particular, it doesn't handle indirect calls
 properly (see the ipa-icf-31.c testcase), doesn't handle internal calls
 properly (see ubsan/ipa-icf-1.c), didn't check gimple_call flags at all.
 
 As discussed with Honza, the call chain test (from Martin) is probably
 insufficient, I'm open with leaving it out from the patch, but perhaps
 what the patch has is better than nothing at all for now.
 
 Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
 
 2014-11-10  Jakub Jelinek  ja...@redhat.com
   Martin Liska  mli...@suse.cz
 
   * ipa-icf-gimple.c (func_checker::compare_bb): Fix comment typo.
   (func_checker::compare_gimple_call): Compare gimple_call_fn,
   gimple_call_chain, gimple_call_fntype and call flags.
 testsuite/
   * gcc.dg/ubsan/ipa-icf-1.c: New test.
   * gcc.dg/ipa/ipa-icf-31.c: New test.

OK.
 +
 +  tree chain1 = gimple_call_chain (s1);
 +  tree chain2 = gimple_call_chain (s2);
 +
 +  if ((chain1  !chain2) || (!chain1  chain2))
 +return return_false_with_msg (Tree call chains are different);

Since gimple_call_chain is actually gimple_val, I think it needs to be compared
as operand.

Honza


Re: [C PATCH] warn for empty struct -Wc++-compat

2014-11-10 Thread Marek Polacek
On Tue, Nov 11, 2014 at 03:24:48AM +0530, Prathamesh Kulkarni wrote:
 * gcc/c/c-decl.c
   (warn_cxx_compat_finish_struct): Add new parameter of type location_t.
 Warn for empty struct.
   (finish_struct): Pass loc to warn_cxx_compat_finish_struct.
 
 * gcc/testsuite/gcc.dg/Wcxx-compat-22.c: New test-case.

No gcc/c/ and gcc/testsuite/ prefixes.

 Index: gcc/c/c-decl.c
 ===
 --- gcc/c/c-decl.c(revision 217287)
 +++ gcc/c/c-decl.c(working copy)
 @@ -7506,12 +7506,15 @@
  /* Finish up struct info used by -Wc++-compat.  */
  
  static void
 -warn_cxx_compat_finish_struct (tree fieldlist)
 +warn_cxx_compat_finish_struct (tree fieldlist, location_t record_loc)
  {
unsigned int ix;
tree x;
struct c_binding *b;
  
 +  if (fieldlist == NULL_TREE)
 +warning_at (record_loc, OPT_Wc___compat, empty struct has size 0 in C, 
 1 in C++);

This line is too long.

The patch doesn't seem to handle empty unions.

Marek


[PATCH][ARM] testsuite, use arm_eabi #3

2014-11-10 Thread Andreas Tobler

Hi all,

another one. Here I'm not really sure if there are EABI variants which 
do _not_ support these test cases.


My target succeeds with this patch.

Comments?

If no (comments), ok for trunk?

TIA,
Andreas

2014-11-10  Andreas Tobler  andre...@gcc.gnu.org

* g++.old-deja/g++.jason/enum6.C: Use arm_eabi for dg-options.
Update comment.
* g++.old-deja/g++.law/enum9.C: Likewise.
* g++.old-deja/g++.other/enum4.C: Likewise.

Index: g++.old-deja/g++.jason/enum6.C
===
--- g++.old-deja/g++.jason/enum6.C  (revision 217306)
+++ g++.old-deja/g++.jason/enum6.C  (working copy)
@@ -7,10 +7,8 @@
 // enum-size attributes should only be emitted if there are values of
 // enum type that can escape the compilation unit, gcc cannot currently
 // detect this; if this facility is added then this linker option should
-// not be needed.  arm-*-linux* should be a good approximation to
-// those platforms where the EABI supplement defines enum values to be
-// 32 bits wide.
-// { dg-options -fshort-enums -Wl,--no-enum-size-warning { target 
arm*-*-linux* } }
+// not be needed.
+// { dg-options -fshort-enums -Wl,--no-enum-size-warning { target arm_eabi } 
}
 
 #include limits.h
 
Index: g++.old-deja/g++.law/enum9.C
===
--- g++.old-deja/g++.law/enum9.C(revision 217306)
+++ g++.old-deja/g++.law/enum9.C(working copy)
@@ -7,10 +7,8 @@
 // enum-size attributes should only be emitted if there are values of
 // enum type that can escape the compilation unit, gcc cannot currently
 // detect this; if this facility is added then this linker option should
-// not be needed.  arm-*-linux* should be a good approximation to
-// those platforms where the EABI supplement defines enum values to be
-// 32 bits wide.
-// { dg-options -fshort-enums -Wl,--no-enum-size-warning { target 
arm*-*-linux* } }
+// not be needed.
+// { dg-options -fshort-enums -Wl,--no-enum-size-warning { target arm_eabi } 
}
 
 // GROUPS passed enums
   extern C int printf (const char *, ...);
Index: g++.old-deja/g++.other/enum4.C
===
--- g++.old-deja/g++.other/enum4.C  (revision 217306)
+++ g++.old-deja/g++.other/enum4.C  (working copy)
@@ -9,10 +9,8 @@
 // enum-size attributes should only be emitted if there are values of
 // enum type that can escape the compilation unit, gcc cannot currently
 // detect this; if this facility is added then this linker option should
-// not be needed.  arm-*-linux* should be a good approximation to
-// those platforms where the EABI supplement defines enum values to be
-// 32 bits wide.
-// { dg-options -fshort-enums -Wl,--no-enum-size-warning { target 
arm*-*-linux* } }
+// not be needed.
+// { dg-options -fshort-enums -Wl,--no-enum-size-warning { target arm_eabi } 
}
 
 enum E { 
   a = -312


Re: [patch] OpenACC fortran front end

2014-11-10 Thread Tobias Burnus

Cesar Philippidis wrote:

This patch adds support for OpenACC 2.0a, with some omissions, to the
fortran front end. It only contains the fortran changes from
gomp-4_0-branch, therefore the middle end and runtime changes are a
necessary prerequisite for this patch.


I'd assume that one could commit the parser changes before the 
middle-end changes, but probably waiting for the middle-end changes is 
simpler. Any idea when the FE-required ME changes will be ready?



I'll post a separate patch with the fortran tests later. If anyone wants to 
test this patch, please use gomp-4_0-branch instead. You don't need a CUDA 
accelerator to use
OpenACC, and some of the runtime tests will fail because that branch
doesn't include the nvptx backend.
Now that the first series of PTX target patches have been committed: I 
assume it is still true that nvptx doesn't work because the libgomp bits 
aren't in yes, isn't it?



Notable OpenACC omissions include support for the device_type clause and
the atomic directive. Hopefully we can get those in before 5.0 is released.
Cache seems to be also missing, if I read 
https://gcc.gnu.org/ml/fortran/2014-11/msg00025.html correctly. (Well, 
the patch itself prints sorry for it.)



All of theses changes have been approved for gomp-4_0-branch. Is this
patch OK for mainline trunk (after the runtime and middle end go in)?


Just for completeness, there are two TODO and one FIXME in the patch.


gcc/fortran/gfortran.texi:


-include OpenMP, Cray-style pointers, and several Fortran 2003 and Fortran
+include OpenACC, OpenMP, Cray-style pointers, and several Fortran 2003
+and Fortran
  2008 features, including TR 15581.  However, it is still under
  development and has a few remaining rough edges.


Not important, but I had reflown the lines after the linebreak.


I have now browsed throughg the patch and it looks good to me. Thanks to 
everyone involved for working on this.


Tobias


Re: [Bug libstdc++/61107] stl_algo.h: std::__inplace_stable_partition() doesn't process the whole data range

2014-11-10 Thread François Dumont
I introduced the random tests after Christopher Jefferson request 
to have more intensive tests on those algos. Is it the whole stuff of 
tests using random numbers that you don't like or just the usage of 
mt19937 ? If second is this new version using the usual random_device I 
used so far better ?


If it is the whole usage of random numbers that you don't like I will 
simply get rid of the new tests files.


François

On 10/11/2014 22:45, Jonathan Wakely wrote:

On 10/11/14 21:50 +0100, François Dumont wrote:

Any news about this one ?

Here is another version with additional random tests on algos just to 
challenge other combinations of tests.


   PR libstdc++/61107
   * include/bits/stl_algo.h (__inplace_stable_partition): Delete.
   (__stable_partition_adaptive): Return __first is range length is 1.


The first is should be if.

The change to stl_algo.h looks OK.

I don't like the use of mt19937 in the tests, I know you committed a
test I wrote recently that uses mt19937, but that was only meant to
demonstrate the bug for bugzilla, not necessarily as the final test.

The PRNG produces the exact same sequence of numbers every time (when
you don't seed it) so if you can make the test fail using a few
iterations with the PRNG then you can find the input that fails and
just add that input to the testsuite. I didn't do that for the test I
put in bugzilla because I didn't have time to work out which input
caused the memory leak, only that it leaked for *some* easily
reproducible input. I wasn't trying to start a trend where we use
fixed sequences of pseudorandom numbers in lots of tests.




Index: include/bits/stl_algo.h
===
--- include/bits/stl_algo.h	(revision 217320)
+++ include/bits/stl_algo.h	(working copy)
@@ -1512,34 +1512,6 @@
   // partition
 
   /// This is a helper function...
-  /// Requires __len != 0 and !__pred(*__first),
-  /// same as __stable_partition_adaptive.
-  templatetypename _ForwardIterator, typename _Predicate, typename _Distance
-_ForwardIterator
-__inplace_stable_partition(_ForwardIterator __first,
-			   _Predicate __pred, _Distance __len)
-{
-  if (__len == 1)
-	return __first;
-  _ForwardIterator __middle = __first;
-  std::advance(__middle, __len / 2);
-  _ForwardIterator __left_split =
-	std::__inplace_stable_partition(__first, __pred, __len / 2);
-  // Advance past true-predicate values to satisfy this
-  // function's preconditions.
-  _Distance __right_len = __len - __len / 2;
-  _ForwardIterator __right_split =
-	std::__find_if_not_n(__middle, __right_len, __pred);
-  if (__right_len)
-	__right_split = std::__inplace_stable_partition(__middle,
-			__pred,
-			__right_len);
-  std::rotate(__left_split, __middle, __right_split);
-  std::advance(__left_split, std::distance(__middle, __right_split));
-  return __left_split;
-}
-
-  /// This is a helper function...
   /// Requires __first != __last and !__pred(__first)
   /// and __len == distance(__first, __last).
   ///
@@ -1554,10 +1526,14 @@
 _Pointer __buffer,
 _Distance __buffer_size)
 {
+  if (__len == 1)
+	return __first;
+
   if (__len = __buffer_size)
 	{
 	  _ForwardIterator __result1 = __first;
 	  _Pointer __result2 = __buffer;
+
 	  // The precondition guarantees that !__pred(__first), so
 	  // move that element to the buffer before starting the loop.
 	  // This ensures that we only call __pred once per element.
@@ -1575,31 +1551,33 @@
 		*__result2 = _GLIBCXX_MOVE(*__first);
 		++__result2;
 	  }
+
 	  _GLIBCXX_MOVE3(__buffer, __result2, __result1);
 	  return __result1;
 	}
-  else
-	{
-	  _ForwardIterator __middle = __first;
-	  std::advance(__middle, __len / 2);
-	  _ForwardIterator __left_split =
-	std::__stable_partition_adaptive(__first, __middle, __pred,
-	 __len / 2, __buffer,
-	 __buffer_size);
-	  // Advance past true-predicate values to satisfy this
-	  // function's preconditions.
-	  _Distance __right_len = __len - __len / 2;
-	  _ForwardIterator __right_split =
-	std::__find_if_not_n(__middle, __right_len, __pred);
-	  if (__right_len)
-	__right_split =
-	  std::__stable_partition_adaptive(__right_split, __last, __pred,
-	   __right_len,
-	   __buffer, __buffer_size);
-	  std::rotate(__left_split, __middle, __right_split);
-	  std::advance(__left_split, std::distance(__middle, __right_split));
-	  return __left_split;
-	}
+
+  _ForwardIterator __middle = __first;
+  std::advance(__middle, __len / 2);
+  _ForwardIterator __left_split =
+	std::__stable_partition_adaptive(__first, __middle, __pred,
+	 __len / 2, __buffer,
+	 __buffer_size);
+
+  // Advance past true-predicate values to satisfy this
+  // function's preconditions.
+  _Distance __right_len = __len - __len / 2;
+  _ForwardIterator __right_split =
+	std::__find_if_not_n(__middle, 

Re: [Bug libstdc++/61107] stl_algo.h: std::__inplace_stable_partition() doesn't process the whole data range

2014-11-10 Thread Jonathan Wakely

On 10/11/14 23:14 +0100, François Dumont wrote:
   I introduced the random tests after Christopher Jefferson request 
to have more intensive tests on those algos. Is it the whole stuff of 
tests using random numbers that you don't like or just the usage of 
mt19937 ?


The use of random number in general.

If second is this new version using the usual random_device 
I used so far better ?


That would be much worse because failures would not be reproducible!

If it is the whole usage of random numbers that you don't like I will 
simply get rid of the new tests files.


Did the new tests fail before your fix to stl_algo.h?

If yes, you could extract the values generated in the case that fails
and add a test using those values (this is what I should have done for
the leaking set tests)

If no, they aren't really testing anything useful.



Re: [gimple-classes, committed 4/6] tree-ssa-tail-merge.c: Use gassign

2014-11-10 Thread David Malcolm
On Sat, 2014-11-08 at 14:56 +0100, Jakub Jelinek wrote:
 On Sat, Nov 08, 2014 at 01:07:28PM +0100, Richard Biener wrote:
  To be constructive here - the above case is from within a
  GIMPLE_ASSIGN case label
  and thus I'd have expected
  
  case GIMPLE_ASSIGN:
{
  gassign *a1 = as_a gassign * (s1);
  gassign *a2 = as_a gassign * (s2);
lhs1 = gimple_assign_lhs (a1);
lhs2 = gimple_assign_lhs (a2);
if (TREE_CODE (lhs1) != SSA_NAME
 TREE_CODE (lhs2) != SSA_NAME)
  return (operand_equal_p (lhs1, lhs2, 0)
   gimple_operand_equal_value_p (gimple_assign_rhs1 (a1),
   gimple_assign_rhs1 (a2)));
else if (TREE_CODE (lhs1) == SSA_NAME
  TREE_CODE (lhs2) == SSA_NAME)
  return vn_valueize (lhs1) == vn_valueize (lhs2);
return false;
}
  
  instead.  That's the kind of changes I have expected and have approved of.
 
 But even that looks like just adding extra work for all developers, with no
 gain.  You only have to add extra code and extra temporaries, in switches
 typically also have to add {} because of the temporaries and thus extra
 indentation level, and it doesn't simplify anything in the code.

The branch attempts to use the C++ typesystem to capture information
about the kinds of gimple statement we expect, both:
  (A) so that the compiler can detect type errors, and
  (B) as a comprehension aid to the human reader of the code

The ideal here is when function params and struct field can be
strengthened from gimple to a subclass ptr.  This captures the
knowledge that every use of a function or within a struct has a given
gimple code.

Examples of this for the initial patchkit were:

* the call_stmt field of a cgraph_edge becoming a gcall *,
  rather than a plain gimple.

* various variables in tree-into-ssa.c change from just
  vecgimple to being vecgphi *, capturing the phi-ness of
  the contents as a compile-time check

* tree-inline.h's struct copy_body_data, the field debug_stmts
  can be concretized from a vecgimple to a vecgdebug *.

A more recent example, from:
https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=5bd16d92b9e928b5a5a7aebd571d92f72dd517f8
The fields arr_ref_first and arr_ref_last of
tree-switch-conversion.c's struct switch_conv_info can be strengthened
from gimple to gassign *: they are always GIMPLE_ASSIGN.

I applied cleanups to do my initial patchkit, which Jeff approved (with
some provisos), and which became the first 92 commits on the branch:

[gimple-classes, committed 00/92] Initial slew of commits:
  https://gcc.gnu.org/ml/gcc-patches/2014-10/msg02791.html

followed by a merger from trunk into the branch:
[gimple-classes] Merge trunk r216157-r216746 into branch:
  https://gcc.gnu.org/ml/gcc-patches/2014-10/msg02982.html

With those commits, I was able to convert 180 accessors to taking a
concrete subclass, with 158 left taking a gimple or
const_gimple i.e. about half of them.
(My script to analyze this is gimple_typesafety.py
within https://github.com/davidmalcolm/gcc-refactoring-scripts)

I got it into my head that it was desirable to convert *all*
gimple accessors to this form, and to eliminate the GIMPLE_CHECK
macros (given that gcc development community seems to dislike
partial transitions).

I've been attempting this full conversion - convert all of the
gimple_ accessors, to require an appropriate gimple subclass
ptr, in particular focusing on the gimple_assign_ ones, but it's a *lot*
of extra work, and much more invasive than the patches
that Jeff conditionally approved.

I now suspect that it's going too far - in the initial patchkit I was
doing the clean, obvious ones, but now I'm left with the awkward ones
that would require me to uglify the code to fix.

If it's OK to only convert some of them, then I'd rather just do that.

The type-strengthening is rarely as neat as being able to simply convert
a param or field type.  Some examples:

Functions passed a gsi
==
Sometimes functions are passed a gsi, where it can be known that the gsi
currently references a stmt of known kind (although that isn't
necessarily obvious from reading the body of the function):

Example from tree-ssa-strlen.c:

handle_char_store (gimple_stmt_iterator *gsi)
 {
   int idx = -1;
   strinfo si = NULL;
-  gimple stmt = gsi_stmt (*gsi);
+  gassign *stmt = as_a gassign * (gsi_stmt (*gsi));
   tree ssaname = NULL_TREE, lhs = gimple_assign_lhs (stmt);
 
   if (TREE_CODE (lhs) == MEM_REF

from
https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=78aae552f15ad5f8f5290fb825f9ae33f4a7cad9


Only acting on one kind of gimple
=

Some functions accept any kind of gimple, but only act on e.g. a
GIMPLE_ASSIGN, immediately returning if they got a different kind.

So I make this kind of change, where:

  void
  foo (gimple stmt, other params)
  {
if (!is_gimple_assign (stmt))
   

Re: [PATCH 10/11][RS6000] Migrate reduction optabs to reduc_..._scal

2014-11-10 Thread Michael Meissner
On Fri, Oct 24, 2014 at 01:06:41PM +0100, Alan Lawrence wrote:
 This migrates the reduction patterns in altivec.md and vector.md to
 the new names. I've not touched paired.md as I wasn't really sure
 how to fix that (how do I vec_extractv2sf ?), moreover the testing I
 did didn't seem to exercise any of those patterns (iow: I'm not sure
 what would be an appropriate target machine?).
 
 I note the reduc_uplus_v16qi (which I've removed, as unsigned and
 signed addition should be equivalent) differed from
 reduc_splus_v16qi in using gen_altivec_vsum4ubs rather than
 gen_altivec_vsum4sbs.  Testcases 
 gcc.dg/vect/{slp-24-big-array.c,slp-24.c,vect-reduc-1char-big-array.c,vert-reduc-1char.c}
 thus produce assembly which differs from previously (only) in that
 vsum4ubs becomes vsum4sbs. These tests are still passing so I
 assume this is OK.
 
 The combining of signed and unsigned addition also improves 
 gcc.dg/vect/{vect-outer-4i.c,vect-reduc-1short.c,vect-reduc-dot-u8b.c,vect-reduc-pattern-1c-big-array.c,vect-reduc-pattern-1c.c}
 : these are now reduced using direct vector reduction, rather than
 with shifts as previously (because there was only a reduc_splus
 rather than the reduc_uplus these tests looked for).

I checked the integer vector add reductions, and it seems to generate the same
value with old/new code, and I like eliminating the vector shift.

 ((Side note: the RTL changes to vector.md are to match the combine
 patterns in vsx.md; now that we now longer depend upon combine to
 generate those patterns (as the optab outputs them directly), one
 might wish to remove the smaller pattern from vsx.md, and/or
 simplify the RTL. I theorize that a reduction of a two-element
 vector is just adding the first element to the second, so maybe to
 something like
 
   [(parallel [(set (match_operand:DF 0 vfloat_operand )
  (VEC_reduc:V2DF
   (vec_select:DF
(match_operand:V2DF 1 vfloat_operand )
(parallel [(const_int 1)]))
   (vec_select:DF
(match_dup 1)
(parallel [(const_int 0)]
 (clobber (match_scratch:V2DF 2 ))])]
 
 but I think it's best for me to leave that to the port maintainers.))
 
 Bootstrapped and check-gcc on powerpc64-none-linux-gnu
 (gcc110.fsffrance.org, with thanks to the GCC Compile Farm).

However, the double pattern is completely broken.  This cannot go in.

Consider this source:

#include stdio.h
#include stddef.h
#include stdlib.h
#include string.h

#ifndef TYPE
#define TYPE double
#endif

#ifndef OTYPE
#define OTYPE TYPE
#endif

#ifndef SIZE
#define SIZE 1024
#endif

#ifndef ALIGN
#define ALIGN 32
#endif

TYPE a[SIZE] __attribute__((__aligned__(ALIGN)));

OTYPE sum (void) __attribute__((__noinline__));

OTYPE
sum (void)
{
  size_t i;
  OTYPE s = (OTYPE) 0;

  for (i = 0; i  SIZE; i++)
s += a[i];

  return s;
}

If I compile with today's trunk, and -mcpu=power8 -ffast-math -O3, I get code
that I expect (though it could xxpermdi instead of xxsldwi):

sum:
.quad   .L.sum,.TOC.@tocbase,0
.previous
.type   sum, @function
.L.sum:
li 10,512
addis 9,2,.LC1@toc@ha   # gpr load fusion, type long
ld 9,.LC1@toc@l(9)
xxlxor 0,0,0
mtctr 10
.p2align 4,,15
.L2:
lxvd2x 12,0,9
addi 9,9,16
xvadddp 0,0,12
bdnz .L2
xxsldwi 12,0,0,2
xvadddp 1,12,0
xxpermdi 1,1,1,2
blr
.long 0

However, the code produced by the patches gives:

sum:
.quad   .L.sum,.TOC.@tocbase,0
.previous
.type   sum, @function
.L.sum:
xxlxor 0,0,0
addi 10,1,-16
li 8,512
addis 9,2,.LC1@toc@ha   # gpr load fusion, type long
ld 9,.LC1@toc@l(9)
mtctr 8
stxvd2x 0,0,10
.p2align 5,,31
.L2:
addi 10,1,-16
lxvd2x 0,0,9
addi 9,9,16
lxvd2x 12,0,10
xvadddp 12,12,0
stxvd2x 12,0,10
bdnz .L2
lfd 0,-16(1)
xxpermdi 1,12,12,2
fadd 1,0,1
blr
.long 0

It is unacceptable to have to do the inner loop doing a load, vector add, and
store in the loop.

-- 
Michael Meissner, IBM
IBM, M/S 2506R, 550 King Street, Littleton, MA 01460-6245, USA
email: meiss...@linux.vnet.ibm.com, phone: +1 (978) 899-4797



Re: [Bug libstdc++/61107] stl_algo.h: std::__inplace_stable_partition() doesn't process the whole data range

2014-11-10 Thread François Dumont
No the random tests didn't show any problem. I had demonstrated the 
problems with the modifications on the existing tests simulating 
constraint memory context.


So unless specified otherwise I will commit tomorrow without the tests 
using random numbers.


François


On 10/11/2014 23:20, Jonathan Wakely wrote:

On 10/11/14 23:14 +0100, François Dumont wrote:
   I introduced the random tests after Christopher Jefferson request 
to have more intensive tests on those algos. Is it the whole stuff of 
tests using random numbers that you don't like or just the usage of 
mt19937 ?


The use of random number in general.

If second is this new version using the usual random_device I used so 
far better ?


That would be much worse because failures would not be reproducible!

If it is the whole usage of random numbers that you don't like I will 
simply get rid of the new tests files.


Did the new tests fail before your fix to stl_algo.h?

If yes, you could extract the values generated in the case that fails
and add a test using those values (this is what I should have done for
the leaking set tests)

If no, they aren't really testing anything useful.






Re: [patch] OpenACC fortran front end

2014-11-10 Thread Cesar Philippidis
On 11/10/2014 02:08 PM, Tobias Burnus wrote:
 Cesar Philippidis wrote:
 This patch adds support for OpenACC 2.0a, with some omissions, to the
 fortran front end. It only contains the fortran changes from
 gomp-4_0-branch, therefore the middle end and runtime changes are a
 necessary prerequisite for this patch.
 
 I'd assume that one could commit the parser changes before the
 middle-end changes, but probably waiting for the middle-end changes is
 simpler. Any idea when the FE-required ME changes will be ready?

I'm not sure. I think Thomas wants to package all of those changes
together in one big middle end patch. He found a last minute ICE the
other day. Hopefully that won't delay things very long.

 I'll post a separate patch with the fortran tests later. If anyone
 wants to test this patch, please use gomp-4_0-branch instead. You
 don't need a CUDA accelerator to use
 OpenACC, and some of the runtime tests will fail because that branch
 doesn't include the nvptx backend.
 Now that the first series of PTX target patches have been committed: I
 assume it is still true that nvptx doesn't work because the libgomp bits
 aren't in yes, isn't it?

That's correct. The nvptx backend also depends on the offloading changes
that a team from Intel is working on for the MIC target. But Julian
should be posting the libgomp patches tomorrow, I think, since his
changes are somewhat self-contained.

 Notable OpenACC omissions include support for the device_type clause and
 the atomic directive. Hopefully we can get those in before 5.0 is
 released.
 Cache seems to be also missing, if I read
 https://gcc.gnu.org/ml/fortran/2014-11/msg00025.html correctly. (Well,
 the patch itself prints sorry for it.)

Yes, that's correct. I forgot to mention that.

 All of theses changes have been approved for gomp-4_0-branch. Is this
 patch OK for mainline trunk (after the runtime and middle end go in)?
 
 Just for completeness, there are two TODO and one FIXME in the patch.

 gcc/fortran/gfortran.texi:
 
 -include OpenMP, Cray-style pointers, and several Fortran 2003 and
 Fortran
 +include OpenACC, OpenMP, Cray-style pointers, and several Fortran 2003
 +and Fortran
   2008 features, including TR 15581.  However, it is still under
   development and has a few remaining rough edges.
 
 Not important, but I had reflown the lines after the linebreak.
 
 
 I have now browsed throughg the patch and it looks good to me. Thanks to
 everyone involved for working on this.

Thanks!
Cesar



Re: [Bug libstdc++/61107] stl_algo.h: std::__inplace_stable_partition() doesn't process the whole data range

2014-11-10 Thread Jonathan Wakely

On 10/11/14 23:39 +0100, François Dumont wrote:
No the random tests didn't show any problem. I had demonstrated the 
problems with the modifications on the existing tests simulating 
constraint memory context.


So unless specified otherwise I will commit tomorrow without the tests 
using random numbers.


OK, thanks.



Re: libstdc++ new deque failures

2014-11-10 Thread Jonathan Wakely

On 05/11/14 17:49 +, Jonathan Wakely wrote:

On 5 November 2014 14:14, David Edelsohn wrote:

Jonathan,

I still am seeing new failures in the libstdc++ deque testsuite as of
last night.  I don't know if you still are working through the fallout
from the earlier patches, but I wanted to make you aware.


Yes, those tests are meant to fail but I need to adjust the dg-error
line numbers after one of my earlier patches.

I'm working on a patch (I might make other changes to std::deque,
which would require changing the dg-error line numbers yet agan, so
I'm holding off until the other changes are ready ... or I decide not
to make them and just fix the tests.)

Sorry for the noise in the testresults.


Fixed with the attached patch.

The moved-from deque needs to allocate memory for its empty state, but
we don't want to modify the deque until after we know whether that
allocation throws or not. My solution is to make a copy of the
allocator and put that in the moved-from state, then use it to
allocate memory. If that succeeds put the object's own allocator into
the same state and exchange the pointers to transfer ownership.


And these are not related to deque, but appear to be additional issues
in the libstdc++ implementation:


I hadn't seen these ones, I'll take a look, thanks.


I haven't looked at these yet.

commit d3ffebcebad97c71887057f8155f4dbd914f2933
Author: Jonathan Wakely jwak...@redhat.com
Date:   Mon Nov 10 19:44:23 2014 +

Fix std::deque move construction with non-equal allocators.

	* include/bits/stl_deque.h (_Deque_base::_Deque_base(_Deque_base)):
	Dispatch according to whether allocators are always equal.
	(_Deque_base::_M_move_impl()): Implement move-from state.
	* testsuite/23_containers/deque/requirements/dr438/assign_neg.cc: Fix
	dg-error line number.
	* testsuite/23_containers/deque/requirements/dr438/
	constructor_1_neg.cc: Likewise.
	* testsuite/23_containers/deque/requirements/dr438/
	constructor_2_neg.cc: Likewise.
	* testsuite/23_containers/deque/requirements/dr438/insert_neg.cc:
	Likewise.

diff --git a/libstdc++-v3/include/bits/stl_deque.h b/libstdc++-v3/include/bits/stl_deque.h
index d50d3c90..c0052b3 100644
--- a/libstdc++-v3/include/bits/stl_deque.h
+++ b/libstdc++-v3/include/bits/stl_deque.h
@@ -502,14 +502,23 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
   { /* Caller must initialize map. */ }
 
 #if __cplusplus = 201103L
-  _Deque_base(_Deque_base __x)
-  : _M_impl(__x._M_get_Tp_allocator())
+  _Deque_base(_Deque_base __x, false_type)
+  : _M_impl(__x._M_move_impl())
+  { }
+
+  _Deque_base(_Deque_base __x, true_type)
+  : _M_impl(std::move(__x._M_get_Tp_allocator()))
   {
 	_M_initialize_map(0);
 	if (__x._M_impl._M_map)
 	  this-_M_impl._M_swap_data(__x._M_impl);
   }
 
+  _Deque_base(_Deque_base __x)
+  : _Deque_base(std::move(__x),
+		__gnu_cxx::__allocator_always_compares_equal_Alloc{})
+  { }
+
   _Deque_base(_Deque_base __x, const allocator_type __a, size_type __n)
   : _M_impl(__a)
   {
@@ -555,18 +564,21 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
 	{ }
 
 #if __cplusplus = 201103L
-	_Deque_impl(_Tp_alloc_type __a) _GLIBCXX_NOEXCEPT
+	_Deque_impl(_Deque_impl) = default;
+
+	_Deque_impl(_Tp_alloc_type __a) noexcept
 	: _Tp_alloc_type(std::move(__a)), _M_map(), _M_map_size(0),
 	  _M_start(), _M_finish()
 	{ }
 #endif
 
-	void _M_swap_data(_Deque_impl __x)
+	void _M_swap_data(_Deque_impl __x) _GLIBCXX_NOEXCEPT
 	{
-	  std::swap(this-_M_start, __x._M_start);
-	  std::swap(this-_M_finish, __x._M_finish);
-	  std::swap(this-_M_map, __x._M_map);
-	  std::swap(this-_M_map_size, __x._M_map_size);
+	  using std::swap;
+	  swap(this-_M_start, __x._M_start);
+	  swap(this-_M_finish, __x._M_finish);
+	  swap(this-_M_map, __x._M_map);
+	  swap(this-_M_map_size, __x._M_map_size);
 	}
   };
 
@@ -618,6 +630,28 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
   enum { _S_initial_map_size = 8 };
 
   _Deque_impl _M_impl;
+
+#if __cplusplus = 201103L
+private:
+  _Deque_impl
+  _M_move_impl()
+  {
+	if (!_M_impl._M_map)
+	  return std::move(_M_impl);
+
+	// Create a copy of the current allocator.
+	_Tp_alloc_type __alloc{_M_get_Tp_allocator()};
+	// Put that copy in a moved-from state.
+	_Tp_alloc_type __unused __attribute((__unused__)) {std::move(__alloc)};
+	// Create an empty map that allocates using the moved-from allocator.
+	_Deque_base __empty{__alloc};
+	// Now safe to modify current allocator and perform non-throwing swaps.
+	_Deque_impl __ret{std::move(_M_get_Tp_allocator())};
+	_M_impl._M_swap_data(__ret);
+	_M_impl._M_swap_data(__empty._M_impl);
+	return __ret;
+  }
+#endif
 };
 
   templatetypename _Tp, typename _Alloc
diff --git a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/assign_neg.cc b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/assign_neg.cc
index 8092ead..b38f3ae 100644
--- 

Re: [PATCH] Fix some ICF gimple_call handling issues

2014-11-10 Thread Jakub Jelinek
On Mon, Nov 10, 2014 at 10:08:54PM +0100, Richard Biener wrote:
 @@ -662,9 +662,49 @@ func_checker::compare_gimple_call (gimpl
t1 = gimple_call_fndecl (s1);
t2 = gimple_call_fndecl (s2);
 
 Just drop these and compare gimple_call_fn only.
 
 +  tree chain1 = gimple_call_chain (s1);
 +  tree chain2 = gimple_call_chain (s2);
 +
 +  if ((chain1  !chain2) || (!chain1  chain2))
 +return return_false_with_msg (Tree call chains are different);
 
 I miss a compare_operands for the call chain.
 
 Otherwise OK.

Here is what I've committed after another bootstrap/regtest.
Note, I've tried:
__attribute__ ((noinline, noclone))
int f1 (int x)
{
  int y = 3, z = 4;
  __attribute__ ((noinline, noclone)) int
  f2 (int a) { return a + x + y + z; }
  return f2 (5);
}

__attribute__ ((noinline, noclone))
int f3 (int x)
{
  int y = 3, z = 4;
  __attribute__ ((noinline, noclone)) int
  f4 (int a) { return a + x + y + z; }
  return f4 (5);
}

int
main ()
{
  if (f1 (9) != 21 || f3 (9) != 21)
__builtin_abort ();
  return 0;
}
but ICF doesn't optimize this with or without the patch,
as the structs aren't the same type (supposedly different alias set?),
even when they have the same members laid out the same.

2014-11-11  Jakub Jelinek  ja...@redhat.com
Martin Liska  mli...@suse.cz

* ipa-icf-gimple.c (func_checker::compare_bb): Fix comment typo.
(func_checker::compare_gimple_call): Compare gimple_call_fn,
gimple_call_chain, gimple_call_fntype and call flags.
testsuite/
* gcc.dg/ubsan/ipa-icf-1.c: New test.
* gcc.dg/ipa/ipa-icf-31.c: New test.

--- gcc/ipa-icf-gimple.c.jj 2014-10-30 14:42:20.0 +0100
+++ gcc/ipa-icf-gimple.c2014-11-10 19:08:38.339986360 +0100
@@ -554,7 +554,7 @@ func_checker::parse_labels (sem_bb *bb)
 
In general, a collection of equivalence dictionaries is built for types
like SSA names, declarations (VAR_DECL, PARM_DECL, ..). This infrastructure
-   is utilized by every statement-by-stament comparison function.  */
+   is utilized by every statement-by-statement comparison function.  */
 
 bool
 func_checker::compare_bb (sem_bb *bb1, sem_bb *bb2)
@@ -659,12 +659,39 @@ func_checker::compare_gimple_call (gimpl
   if (gimple_call_num_args (s1) != gimple_call_num_args (s2))
 return false;
 
-  t1 = gimple_call_fndecl (s1);
-  t2 = gimple_call_fndecl (s2);
-
-  /* Function pointer variables are not supported yet.  */
+  t1 = gimple_call_fn (s1);
+  t2 = gimple_call_fn (s2);
   if (!compare_operand (t1, t2))
-return return_false();
+return return_false ();
+
+  /* Compare flags.  */
+  if (gimple_call_internal_p (s1) != gimple_call_internal_p (s2)
+  || gimple_call_ctrl_altering_p (s1) != gimple_call_ctrl_altering_p (s2)
+  || gimple_call_tail_p (s1) != gimple_call_tail_p (s2)
+  || gimple_call_return_slot_opt_p (s1) != gimple_call_return_slot_opt_p 
(s2)
+  || gimple_call_from_thunk_p (s1) != gimple_call_from_thunk_p (s2)
+  || gimple_call_va_arg_pack_p (s1) != gimple_call_va_arg_pack_p (s2)
+  || gimple_call_alloca_for_var_p (s1) != gimple_call_alloca_for_var_p (s2)
+  || gimple_call_with_bounds_p (s1) != gimple_call_with_bounds_p (s2))
+return false;
+
+  if (gimple_call_internal_p (s1)
+   gimple_call_internal_fn (s1) != gimple_call_internal_fn (s2))
+return false;
+
+  tree fntype1 = gimple_call_fntype (s1);
+  tree fntype2 = gimple_call_fntype (s2);
+  if ((fntype1  !fntype2)
+  || (!fntype1  fntype2)
+  || (fntype1  !types_compatible_p (fntype1, fntype2)))
+return return_false_with_msg (call function types are not compatible);
+
+  tree chain1 = gimple_call_chain (s1);
+  tree chain2 = gimple_call_chain (s2);
+  if ((chain1  !chain2)
+  || (!chain1  chain2)
+  || !compare_operand (chain1, chain2))
+return return_false_with_msg (static call chains are different);
 
   /* Checking of argument.  */
   for (i = 0; i  gimple_call_num_args (s1); ++i)
--- gcc/testsuite/gcc.dg/ubsan/ipa-icf-1.c.jj   2014-11-10 19:00:53.509525071 
+0100
+++ gcc/testsuite/gcc.dg/ubsan/ipa-icf-1.c  2014-11-10 19:02:21.836925806 
+0100
@@ -0,0 +1,23 @@
+/* { dg-do run } */
+/* { dg-skip-if  { *-*-* } { * } { -O2 } } */
+/* { dg-options -fsanitize=undefined -fipa-icf } */
+
+__attribute__ ((noinline, noclone))
+int f1 (int x, int y)
+{
+  return x + y;
+}
+
+__attribute__ ((noinline, noclone))
+int f2 (int x, int y)
+{
+  return x - y;
+}
+
+int
+main ()
+{
+  if (f1 (5, 6) != 11 || f2 (5, 6) != -1)
+__builtin_abort ();
+  return 0;
+}
--- gcc/testsuite/gcc.dg/ipa/ipa-icf-31.c.jj2014-11-10 18:59:16.604294652 
+0100
+++ gcc/testsuite/gcc.dg/ipa/ipa-icf-31.c   2014-11-10 18:59:59.690519616 
+0100
@@ -0,0 +1,41 @@
+/* { dg-do run } */
+/* { dg-options -O2 -fipa-icf } */
+
+__attribute__ ((noinline, noclone))
+int f1 (int x, int (*p1) (void), int (*p2) (void))
+{
+  if (x)
+return p1 ();
+  else
+return p2 ();
+}
+
+__attribute__ ((noinline, noclone))

Re: [PATCH, i386]: Add target i?86-*-* to many tests

2014-11-10 Thread Jakub Jelinek
On Sun, Nov 02, 2014 at 08:31:43PM +0100, Uros Bizjak wrote:
 Attached (mechanical) patch adds i?86-*-* target to many tests, where
 only x86_64-*-* is listed. Please note that x86_64-*-* already
 included  lp64 for 64bit specific tests due to -m32 multilib
 testing.
 
 2014-11-02  Uros Bizjak  ubiz...@gmail.com
 
 * c-c++-common/ubsan/float-cast-overflow-6.c: Add i?86-*-* target.
...
 * gcc.dg/tm/memopt-15.c: Ditto.
 
 Tested on x86_64-linux-gnu {,-m32} and committed to mainline SVN.
 
 I will keep an eye on autotesters for possible fallout.

This regressed on i686-linux in memopt-15.c, because without -msse2
there is psABI warning.  Rather than adding -Wno-psabi, I chose to
add -msse2, the test is dg-do compile, so we don't need any extra as
or runtime support.

Committed as obvious after bootstrap/regtest on x86_64-linux and i686-linux.

2014-11-11  Jakub Jelinek  ja...@redhat.com

* gcc.dg/tm/memopt-15.c: Add -msse2 to dg-options.

--- gcc/testsuite/gcc.dg/tm/memopt-15.c.jj  2014-11-10 19:16:09.609635932 
+0100
+++ gcc/testsuite/gcc.dg/tm/memopt-15.c 2014-11-10 22:24:42.740667616 +0100
@@ -1,5 +1,5 @@
 /* { dg-do compile { target { i?86-*-linux* x86_64-*-linux* } } } */
-/* { dg-options -fgnu-tm -O } */
+/* { dg-options -fgnu-tm -O -msse2 } */
 
 /* Test the TM vector logging functions.  */
 


Jakub


Re: [C PATCH] warn for empty struct -Wc++-compat

2014-11-10 Thread Prathamesh Kulkarni
On Tue, Nov 11, 2014 at 3:35 AM, Marek Polacek pola...@redhat.com wrote:
 On Tue, Nov 11, 2014 at 03:24:48AM +0530, Prathamesh Kulkarni wrote:
 * gcc/c/c-decl.c
   (warn_cxx_compat_finish_struct): Add new parameter of type location_t.
 Warn for empty struct.
   (finish_struct): Pass loc to warn_cxx_compat_finish_struct.

 * gcc/testsuite/gcc.dg/Wcxx-compat-22.c: New test-case.

 No gcc/c/ and gcc/testsuite/ prefixes.

 Index: gcc/c/c-decl.c
 ===
 --- gcc/c/c-decl.c(revision 217287)
 +++ gcc/c/c-decl.c(working copy)
 @@ -7506,12 +7506,15 @@
  /* Finish up struct info used by -Wc++-compat.  */

  static void
 -warn_cxx_compat_finish_struct (tree fieldlist)
 +warn_cxx_compat_finish_struct (tree fieldlist, location_t record_loc)
  {
unsigned int ix;
tree x;
struct c_binding *b;

 +  if (fieldlist == NULL_TREE)
 +warning_at (record_loc, OPT_Wc___compat, empty struct has size 0 in C, 
 1 in C++);

 This line is too long.

 The patch doesn't seem to handle empty unions.
Thanks, this version handles empty unions.
Is this version okay ?

[gcc/c]
  * c-decl.c (c_struct_parse_info): Add new member code.
  (warn_cxx_compat_finish): Add new parameter record_loc.
  Warn for empty struct and unions.
  (finish_struct): Pass loc to warn_cxx_compat_finish.

[gcc/testsuite/gcc.dg]
  * Wcxx-compat-22.c: New test-case.

Thank you,
Prathamesh

 Marek
Index: gcc/c/c-decl.c
===
--- gcc/c/c-decl.c	(revision 217287)
+++ gcc/c/c-decl.c	(working copy)
@@ -606,6 +606,8 @@
   /* If warn_cxx_compat, a list of typedef names used when defining
  fields in this struct.  */
   vectree typedefs_seen;
+  /* code to distinguish between struct/union */
+  enum tree_code code;
 };
 
 /* Information for the struct or union currently being parsed, or
@@ -7234,6 +7236,7 @@
   struct_parse_info-struct_types.create (0);
   struct_parse_info-fields.create (0);
   struct_parse_info-typedefs_seen.create (0);
+  struct_parse_info-code = code;
 
   /* FIXME: This will issue a warning for a use of a type defined
  within a statement expr used within sizeof, et. al.  This is not
@@ -7506,12 +7509,19 @@
 /* Finish up struct info used by -Wc++-compat.  */
 
 static void
-warn_cxx_compat_finish_struct (tree fieldlist)
+warn_cxx_compat_finish_struct (tree fieldlist, location_t record_loc)
 {
   unsigned int ix;
   tree x;
   struct c_binding *b;
 
+  if (fieldlist == NULL_TREE)
+{
+  warning_at (record_loc, OPT_Wc___compat,
+		  empty %s has size 0 in C, 1 in C++,
+		  (struct_parse_info-code == RECORD_TYPE) ? struct : union);
+}
+
   /* Set the C_TYPE_DEFINED_IN_STRUCT flag for each type defined in
  the current struct.  We do this now at the end of the struct
  because the flag is used to issue visibility warnings, and we
@@ -7844,7 +7854,7 @@
 			  DECL_EXPR, build_decl (loc, TYPE_DECL, NULL, t)));
 
   if (warn_cxx_compat)
-warn_cxx_compat_finish_struct (fieldlist);
+warn_cxx_compat_finish_struct (fieldlist, loc);
 
   struct_parse_info-struct_types.release ();
   struct_parse_info-fields.release ();
Index: gcc/testsuite/gcc.dg/Wcxx-compat-22.c
===
--- gcc/testsuite/gcc.dg/Wcxx-compat-22.c	(revision 0)
+++ gcc/testsuite/gcc.dg/Wcxx-compat-22.c	(working copy)
@@ -0,0 +1,4 @@
+/* { dg-do compile } */
+/* { dg-options -Wc++-compat } */
+struct A {}; /* { dg-warning empty struct has size 0 in C } */
+union B {}; /* { dg-warning empty union has size 0 in C } */


Re: [PATCH x86_64] Optimize access to globals in -fpie -pie builds with copy relocations

2014-11-10 Thread Sriraman Tallam
Ping.

On Mon, Oct 6, 2014 at 1:43 PM, Sriraman Tallam tmsri...@google.com wrote:
 Ping.

 On Mon, Sep 29, 2014 at 10:57 AM, Sriraman Tallam tmsri...@google.com wrote:
 Ping.

 On Fri, Sep 19, 2014 at 2:11 PM, Sriraman Tallam tmsri...@google.com wrote:
 Hi Richard,

 I also ran the gcc testsuite with
 RUNTESTFLAGS=--tool_opts=-mcopyrelocs to check for issues.  The only
 test that failed was g++.dg/tsan/default_options.C.  It uses -fpie
 -pie and BFD ld to link. Since BFD ld does not support copy
 relocations with -pie, it does not link. I linked with gold to make
 the test pass.

 Could you please take another look at this patch?

 Thanks
 Sri

 On Mon, Sep 8, 2014 at 3:19 PM, Sriraman Tallam tmsri...@google.com wrote:
 On Tue, Sep 2, 2014 at 1:40 PM, Richard Henderson r...@redhat.com wrote:
 On 06/20/2014 05:17 PM, Sriraman Tallam wrote:
 Index: config/i386/i386.c
 ===
 --- config/i386/i386.c(revision 211826)
 +++ config/i386/i386.c(working copy)
 @@ -12691,7 +12691,9 @@ legitimate_pic_address_disp_p (rtx disp)
   return true;
   }
 else if (!SYMBOL_REF_FAR_ADDR_P (op0)
 - SYMBOL_REF_LOCAL_P (op0)
 + (SYMBOL_REF_LOCAL_P (op0)
 +|| (TARGET_64BIT  ix86_copyrelocs  flag_pie
 + !SYMBOL_REF_FUNCTION_P (op0)))
   ix86_cmodel != CM_LARGE_PIC)
   return true;
 break;

 This is the wrong place to patch.

 You ought to be adjusting SYMBOL_REF_LOCAL_P, by providing a modified
 TARGET_BINDS_LOCAL_P.

 I have done this in the new attached patch, I added a new function
 i386_binds_local_p which will check for this and call
 default_binds_local_p otherwise.


 Note in particular that I believe that you are doing the wrong thing with 
 weak
 and COMMON symbols, in that you probably ought not force a copy reloc 
 there.

 I added an extra check to not do this for WEAK symbols. I also added a
 check for DECL_EXTERNAL so I believe this will also not be called for
 COMMON symbols.


 Note the complexity of default_binds_local_p_1, and the fact that all you
 really want to modify is

   /* If PIC, then assume that any global name can be overridden by
  symbols resolved from other modules.  */
   else if (shlib)
 local_p = false;

 near the bottom of that function.

 I did not understand what you mean here? Were you suggesting an
 alternative way of doing this?

 Thanks for reviewing
 Sri



 r~


[PATCH, i386]: Revert PR 63620 workaround

2014-11-10 Thread Uros Bizjak
Hello!

Now that Vlad fixed the real problem of PR 63620 [1], we can remove
the temporary workaround. The patch also adds the testcase from PR.

2014-11-11  Uros Bizjak  ubiz...@gmail.com

Revert:
2014-10-31  Uros Bizjak  ubiz...@gmail.com

PR target/63620
* config/i386/i386-protos.h (ix86_use_pseudo_pic_reg): Declare.
* config/i386/i386.c (ix86_use_pseudo_pic_reg): Export.
* config/i386/i386.md (*pushtf): Allow only CONST_DOUBLEs that won't
be reloaded through memory.
(*pushxf): Ditto.
(*pushdf): Ditto.

testsuite/ChangeLog:

2014-11-11  Uros Bizjak  ubiz...@gmail.com
Ilya Enkovich  ilya.enkov...@intel.com

PR target/63620
* gcc.target/i386/pr63620.c: New test.

Patch was ootstrapped and regression tested on x86_64-linux-gnu
{,-m32}. Committed to mainline SVN.

[1] https://gcc.gnu.org/ml/gcc-patches/2014-11/msg00875.html

Uros.
Index: ChangeLog
===
--- ChangeLog   (revision 217320)
+++ ChangeLog   (working copy)
@@ -1,3 +1,16 @@
+2014-11-10  Uros Bizjak  ubiz...@gmail.com
+
+   Revert:
+   2014-10-31  Uros Bizjak  ubiz...@gmail.com
+
+   PR target/63620
+   * config/i386/i386-protos.h (ix86_use_pseudo_pic_reg): Declare.
+   * config/i386/i386.c (ix86_use_pseudo_pic_reg): Export.
+   * config/i386/i386.md (*pushtf): Allow only CONST_DOUBLEs that won't
+   be reloaded through memory.
+   (*pushxf): Ditto.
+   (*pushdf): Ditto.
+
 2014-11-10  Vladimir Makarov  vmaka...@redhat.com
 
PR rtl-optimization/63620
Index: config/i386/i386-protos.h
===
--- config/i386/i386-protos.h   (revision 217320)
+++ config/i386/i386-protos.h   (working copy)
@@ -42,8 +42,6 @@ extern enum calling_abi ix86_function_type_abi (co
 
 extern void ix86_reset_previous_fndecl (void);
 
-extern bool ix86_use_pseudo_pic_reg (void);
-
 #ifdef RTX_CODE
 extern int standard_80387_constant_p (rtx);
 extern const char *standard_80387_constant_opcode (rtx);
Index: config/i386/i386.c
===
--- config/i386/i386.c  (revision 217320)
+++ config/i386/i386.c  (working copy)
@@ -6184,7 +6184,7 @@ ix86_maybe_switch_abi (void)
 
 /* Return 1 if pseudo register should be created and used to hold
GOT address for PIC code.  */
-bool
+static bool
 ix86_use_pseudo_pic_reg (void)
 {
   if ((TARGET_64BIT
Index: config/i386/i386.md
===
--- config/i386/i386.md (revision 217320)
+++ config/i386/i386.md (working copy)
@@ -2779,15 +2779,10 @@
 
 ;; Floating point push instructions.
 
-;; %%% Remove CONST_DOUBLE workaround after PR63620 is fixed!
 (define_insn *pushtf
   [(set (match_operand:TF 0 push_operand =,)
(match_operand:TF 1 general_no_elim_operand x,*roF))]
-  (TARGET_64BIT || TARGET_SSE)
-(!ix86_use_pseudo_pic_reg ()
-   || !can_create_pseudo_p ()
-   || GET_CODE (operands[1]) != CONST_DOUBLE
-   || standard_sse_constant_p (operands[1]))
+  TARGET_64BIT || TARGET_SSE
 {
   /* This insn should be already split before reg-stack.  */
   gcc_unreachable ();
@@ -2809,14 +2804,10 @@
   operands[0] = replace_equiv_address (operands[0], stack_pointer_rtx);
 })
 
-;; %%% Remove CONST_DOUBLE workaround after PR63620 is fixed!
 (define_insn *pushxf
   [(set (match_operand:XF 0 push_operand =,)
(match_operand:XF 1 general_no_elim_operand f,Yx*roF))]
-  !ix86_use_pseudo_pic_reg ()
-   || !can_create_pseudo_p ()
-   || GET_CODE (operands[1]) != CONST_DOUBLE
-   || standard_80387_constant_p (operands[1])  0
+  
 {
   /* This insn should be already split before reg-stack.  */
   gcc_unreachable ();
@@ -2844,17 +2835,10 @@
   operands[0] = replace_equiv_address (operands[0], stack_pointer_rtx);
 })
 
-;; %%% Remove CONST_DOUBLE workaround after PR63620 is fixed!
 (define_insn *pushdf
   [(set (match_operand:DF 0 push_operand =,,,)
(match_operand:DF 1 general_no_elim_operand f,Yd*roF,rmF,x))]
-  !ix86_use_pseudo_pic_reg ()
-   || !can_create_pseudo_p ()
-   || GET_CODE (operands[1]) != CONST_DOUBLE
-   || (!(TARGET_SSE2  TARGET_SSE_MATH)
-standard_80387_constant_p (operands[1])  0)
-   || (TARGET_SSE2  TARGET_SSE_MATH
-standard_sse_constant_p (operands[1]))
+  
 {
   /* This insn should be already split before reg-stack.  */
   gcc_unreachable ();
Index: testsuite/gcc.target/i386/pr63620.c
===
--- testsuite/gcc.target/i386/pr63620.c (revision 0)
+++ testsuite/gcc.target/i386/pr63620.c (working copy)
@@ -0,0 +1,20 @@
+/* PR target/63620 */
+/* { dg-do compile } */
+/* { dg-require-effective-target fpic } */
+/* { dg-require-effective-target ia32 } */
+/* { dg-options -O2 -fpic -mfpmath=sse -msse } */
+
+static const __float128 cf = 0.1E+30Q;
+
+typedef __float128 (*func)(__float128 x);
+
+__float128
+test 

Re: [gimple-classes, committed 4/6] tree-ssa-tail-merge.c: Use gassign

2014-11-10 Thread Andrew Pinski
On Mon, Nov 10, 2014 at 2:27 PM, David Malcolm dmalc...@redhat.com wrote:
 On Sat, 2014-11-08 at 14:56 +0100, Jakub Jelinek wrote:
 On Sat, Nov 08, 2014 at 01:07:28PM +0100, Richard Biener wrote:
  To be constructive here - the above case is from within a
  GIMPLE_ASSIGN case label
  and thus I'd have expected
 
  case GIMPLE_ASSIGN:
{
  gassign *a1 = as_a gassign * (s1);
  gassign *a2 = as_a gassign * (s2);
lhs1 = gimple_assign_lhs (a1);
lhs2 = gimple_assign_lhs (a2);
if (TREE_CODE (lhs1) != SSA_NAME
 TREE_CODE (lhs2) != SSA_NAME)
  return (operand_equal_p (lhs1, lhs2, 0)
   gimple_operand_equal_value_p (gimple_assign_rhs1 (a1),
   gimple_assign_rhs1 (a2)));
else if (TREE_CODE (lhs1) == SSA_NAME
  TREE_CODE (lhs2) == SSA_NAME)
  return vn_valueize (lhs1) == vn_valueize (lhs2);
return false;
}
 
  instead.  That's the kind of changes I have expected and have approved of.

 But even that looks like just adding extra work for all developers, with no
 gain.  You only have to add extra code and extra temporaries, in switches
 typically also have to add {} because of the temporaries and thus extra
 indentation level, and it doesn't simplify anything in the code.

 The branch attempts to use the C++ typesystem to capture information
 about the kinds of gimple statement we expect, both:
   (A) so that the compiler can detect type errors, and
   (B) as a comprehension aid to the human reader of the code

 The ideal here is when function params and struct field can be
 strengthened from gimple to a subclass ptr.  This captures the
 knowledge that every use of a function or within a struct has a given
 gimple code.

 Examples of this for the initial patchkit were:

 * the call_stmt field of a cgraph_edge becoming a gcall *,
   rather than a plain gimple.

 * various variables in tree-into-ssa.c change from just
   vecgimple to being vecgphi *, capturing the phi-ness of
   the contents as a compile-time check

 * tree-inline.h's struct copy_body_data, the field debug_stmts
   can be concretized from a vecgimple to a vecgdebug *.

 A more recent example, from:
 https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=5bd16d92b9e928b5a5a7aebd571d92f72dd517f8
 The fields arr_ref_first and arr_ref_last of
 tree-switch-conversion.c's struct switch_conv_info can be strengthened
 from gimple to gassign *: they are always GIMPLE_ASSIGN.

 I applied cleanups to do my initial patchkit, which Jeff approved (with
 some provisos), and which became the first 92 commits on the branch:

 [gimple-classes, committed 00/92] Initial slew of commits:
   https://gcc.gnu.org/ml/gcc-patches/2014-10/msg02791.html

 followed by a merger from trunk into the branch:
 [gimple-classes] Merge trunk r216157-r216746 into branch:
   https://gcc.gnu.org/ml/gcc-patches/2014-10/msg02982.html

 With those commits, I was able to convert 180 accessors to taking a
 concrete subclass, with 158 left taking a gimple or
 const_gimple i.e. about half of them.
 (My script to analyze this is gimple_typesafety.py
 within https://github.com/davidmalcolm/gcc-refactoring-scripts)

 I got it into my head that it was desirable to convert *all*
 gimple accessors to this form, and to eliminate the GIMPLE_CHECK
 macros (given that gcc development community seems to dislike
 partial transitions).

 I've been attempting this full conversion - convert all of the
 gimple_ accessors, to require an appropriate gimple subclass
 ptr, in particular focusing on the gimple_assign_ ones, but it's a *lot*
 of extra work, and much more invasive than the patches
 that Jeff conditionally approved.

 I now suspect that it's going too far - in the initial patchkit I was
 doing the clean, obvious ones, but now I'm left with the awkward ones
 that would require me to uglify the code to fix.

 If it's OK to only convert some of them, then I'd rather just do that.

 The type-strengthening is rarely as neat as being able to simply convert
 a param or field type.  Some examples:

 Functions passed a gsi
 ==
 Sometimes functions are passed a gsi, where it can be known that the gsi
 currently references a stmt of known kind (although that isn't
 necessarily obvious from reading the body of the function):

 Example from tree-ssa-strlen.c:

 handle_char_store (gimple_stmt_iterator *gsi)
  {
int idx = -1;
strinfo si = NULL;
 -  gimple stmt = gsi_stmt (*gsi);
 +  gassign *stmt = as_a gassign * (gsi_stmt (*gsi));


Can we have something like:
gsi_assign (*gsi)
instead so there is less typing when we want an gassign rather than a
gimple stmt.  This should allow for easier converting also and puts
most of the as_a in one place.

Thanks,
Andrew Pinski

tree ssaname = NULL_TREE, lhs = gimple_assign_lhs (stmt);

if (TREE_CODE (lhs) == MEM_REF

 from
 

Re: [PATCH][ARM] testsuite, use arm_eabi #3

2014-11-10 Thread Mike Stump
On Nov 10, 2014, at 2:06 PM, Andreas Tobler andreast-l...@fgznet.ch wrote:
 another one. Here I'm not really sure if there are EABI variants which do 
 _not_ support these test cases.

I think the patch is fine, just watch for any follow-on comments from an 
eabi/arm expert.  Usually they are pretty responsive.

[google/gcc-4_9] Backport pending patch to fix demangler crash

2014-11-10 Thread Cary Coutant
Backport pending upstream patch to fix demangler crash.

https://gcc.gnu.org/ml/gcc-patches/2014-05/msg02279.html

This patch is for the google/gcc-4_9 branch.

Google ref: 17891596

-cary


2014-05-27  Pedro Alves pal...@redhat.com

include/
* demangle.h (enum demangle_component_type)
DEMANGLE_COMPONENT_CONVERSION: New value.

2014-05-27  Pedro Alves pal...@redhat.com

libiberty/
* cp-demangle.c (d_demangle_callback, d_make_comp): Handle
DEMANGLE_COMPONENT_CONVERSION.
(is_ctor_dtor_or_conversion): Handle DEMANGLE_COMPONENT_CONVERSION
instead of DEMANGLE_COMPONENT_CAST.
(d_operator_name): Return a DEMANGLE_COMPONENT_CONVERSION
component if handling a conversion.
(d_count_templates_scopes, d_print_comp_inner): Handle
DEMANGLE_COMPONENT_CONVERSION.
(d_print_comp_inner): Handle DEMANGLE_COMPONENT_CONVERSION instead
of DEMANGLE_COMPONENT_CAST.
(d_print_cast): Rename as ...
(d_print_conversion): ... this.  Adjust comments.
(d_print_cast): Rewrite - simply print the left subcomponent.
* cp-demint.c (cplus_demangle_fill_component): Handle
DEMANGLE_COMPONENT_CONVERSION.

* testsuite/demangle-expected: Add tests.

Index: include/demangle.h
===
--- include/demangle.h  (revision 217320)
+++ include/demangle.h  (working copy)
@@ -373,6 +373,10 @@ enum demangle_component_type
   /* A typecast, represented as a unary operator.  The one subtree is
  the type to which the argument should be cast.  */
   DEMANGLE_COMPONENT_CAST,
+  /* A conversion operator, represented as a unary operator.  The one
+ subtree is the type to which the argument should be converted
+ to.  */
+  DEMANGLE_COMPONENT_CONVERSION,
   /* A nullary expression.  The left subtree is the operator.  */
   DEMANGLE_COMPONENT_NULLARY,
   /* A unary expression.  The left subtree is the operator, and the
Index: libiberty/cp-demangle.c
===
--- libiberty/cp-demangle.c (revision 217320)
+++ libiberty/cp-demangle.c (working copy)
@@ -526,8 +526,10 @@ d_print_array_type (struct d_print_info
 static void
 d_print_expr_op (struct d_print_info *, int, const struct demangle_component 
*);
 
-static void
-d_print_cast (struct d_print_info *, int, const struct demangle_component *);
+static void d_print_cast (struct d_print_info *, int,
+ const struct demangle_component *);
+static void d_print_conversion (struct d_print_info *, int,
+   const struct demangle_component *);
 
 static int d_demangle_callback (const char *, int,
 demangle_callbackref, void *);
@@ -712,6 +714,9 @@ d_dump (struct demangle_component *dc, i
 case DEMANGLE_COMPONENT_CAST:
   printf (cast\n);
   break;
+case DEMANGLE_COMPONENT_CONVERSION:
+  printf (conversion operator\n);
+  break;
 case DEMANGLE_COMPONENT_NULLARY:
   printf (nullary operator\n);
   break;
@@ -918,6 +923,7 @@ d_make_comp (struct d_info *di, enum dem
 case DEMANGLE_COMPONENT_IMAGINARY:
 case DEMANGLE_COMPONENT_VENDOR_TYPE:
 case DEMANGLE_COMPONENT_CAST:
+case DEMANGLE_COMPONENT_CONVERSION:
 case DEMANGLE_COMPONENT_JAVA_RESOURCE:
 case DEMANGLE_COMPONENT_DECLTYPE:
 case DEMANGLE_COMPONENT_PACK_EXPANSION:
@@ -1209,7 +1215,7 @@ is_ctor_dtor_or_conversion (struct deman
   return is_ctor_dtor_or_conversion (d_right (dc));
 case DEMANGLE_COMPONENT_CTOR:
 case DEMANGLE_COMPONENT_DTOR:
-case DEMANGLE_COMPONENT_CAST:
+case DEMANGLE_COMPONENT_CONVERSION:
   return 1;
 }
 }
@@ -1765,11 +1771,16 @@ d_operator_name (struct d_info *di)
 {
   struct demangle_component *type;
   int was_conversion = di-is_conversion;
+  struct demangle_component *res;
 
   di-is_conversion = ! di-is_expression;
   type = cplus_demangle_type (di);
+  if (di-is_conversion)
+   res = d_make_comp (di, DEMANGLE_COMPONENT_CONVERSION, type, NULL);
+  else
+   res = d_make_comp (di, DEMANGLE_COMPONENT_CAST, type, NULL);
   di-is_conversion = was_conversion;
-  return d_make_comp (di, DEMANGLE_COMPONENT_CAST, type, NULL);
+  return res;
 }
   else
 {
@@ -3863,6 +3874,7 @@ d_count_templates_scopes (int *num_templ
 case DEMANGLE_COMPONENT_TEMPLATE_ARGLIST:
 case DEMANGLE_COMPONENT_INITIALIZER_LIST:
 case DEMANGLE_COMPONENT_CAST:
+case DEMANGLE_COMPONENT_CONVERSION:
 case DEMANGLE_COMPONENT_NULLARY:
 case DEMANGLE_COMPONENT_UNARY:
 case DEMANGLE_COMPONENT_BINARY:
@@ -4962,9 +4974,9 @@ d_print_comp (struct d_print_info *dpi,
   d_print_comp (dpi, options, dc-u.s_extended_operator.name);
   return;
 
-case DEMANGLE_COMPONENT_CAST:
+case DEMANGLE_COMPONENT_CONVERSION:
   d_append_string (dpi, operator );
- 

Re: [google/gcc-4_9] Backport pending patch to fix demangler crash

2014-11-10 Thread Sterling Augustine
On Mon, Nov 10, 2014 at 3:56 PM, Cary Coutant ccout...@google.com wrote:
 Backport pending upstream patch to fix demangler crash.

 https://gcc.gnu.org/ml/gcc-patches/2014-05/msg02279.html

 This patch is for the google/gcc-4_9 branch.

 Google ref: 17891596

 -cary

OK for Google branches.


Re: [Patch] Improving jump-thread pass for PR 54742

2014-11-10 Thread Sebastian Pop
Hi Jeff,

I have adapted the code generation part from James' patch to current trunk, and
the resulting patch gets the 30% speedup on coremark and passes bootstrap of 
GCC.

Ok for trunk?

Thanks,
Sebastian

Sebastian Pop wrote:
 Sebastian Pop wrote:
  Jeff Law wrote:
   On 08/21/14 04:30, Richard Biener wrote:
   It turns Jeff's jump-threading code in to a strange franken-pass of 
   bits and
   pieces of detection and optimisation, and would need some substantial
   reworking to fit in with Jeff's changes last Autumn, but if it is more
   likely to be acceptable for trunk then perhaps we could look to revive 
   it.
   It would be nice to reuse the path copy code Jeff added last year, but I
   don't have much intuition as to how feasible that is.
   
   Was this the sort of thing that you were imagining?
   
   Yeah, didn't look too closely though.
   It'd be pretty ugly I suspect.  But it's probably worth pondering
   since that approach would eliminate the concerns about the cost of
   detection (which is problematical for the jump threader) by using
   Steve's code for that.
   
   On the update side, I suspect most, if not all of the framework is
   in place to handle this kind of update if the right threading paths
   were passed to the updater.  I can probably cobble together that
   by-hand and see what the tree-ssa-threadupdate does with it.  But
   it'll be a week or so before I could look at it.
  
  I adapted the patch James has sent last year to use the new update paths
 
 Attached an updated version of the patch.
 
  mechanism.  I verified that the attached patch does register all the paths 
  that
  need to be threaded.  Thread updater seems to have some problems handling 
  the
  attached testcase (a simplified version of the testcase attached to the 
  bug.)
  
  Jeff, could you please have a look at why the jump-thread updater is 
  crashing?
 
 I have tried to understand why the code generation part ICEs on coremark: the
 first problem that I have seen is that tree-ssa-threadupdate.c does not handle
 more than a joiner block per path to be threaded, so we would not be able to
 jump thread accross the joiners of the if condition and the joiner of the 
 switch
 condition: i.e., these paths
 
 patch:   Registering jump thread: (7, 10) incoming edge;  (10, 25) joiner;  
 (25, 26) joiner;  (26, 4) nocopy; (4, 37) nocopy; (37, 36) nocopy; (36, 14) 
 nocopy;
 patch:   Registering jump thread: (28, 10) incoming edge;  (10, 25) joiner;  
 (25, 26) joiner;  (26, 4) nocopy; (4, 37) nocopy; (37, 36) nocopy; (36, 11) 
 nocopy;
 patch:   Registering jump thread: (8, 10) incoming edge;  (10, 25) joiner;  
 (25, 26) joiner;  (26, 4) nocopy; (4, 37) nocopy; (37, 36) nocopy; (36, 17) 
 nocopy;
 patch:   Registering jump thread: (9, 10) incoming edge;  (10, 25) joiner;  
 (25, 26) joiner;  (26, 4) nocopy; (4, 37) nocopy; (37, 36) nocopy; (36, 25) 
 nocopy;
 
 Another problem is that we attach the path to be threaded to the -aux field 
 of
 the first edge in the path, such that we would have to cancel some of the 
 paths
 because we cannot keep track of all the paths to be threaded.
 
 For coremark, we would discover some jump-thread paths from one of the switch
 cases over the loop exit condition, either to bb_27 outside the loop, or to 
 bb_4
 staying inside the loop.  Then with the patch: we would discover jump 
 threads
 that would thread switch cases to switch cases, and because these paths start
 with the same edges for which we have already assigned a path to e-aux, we
 would have to cancel the interesting threads added by the patch:
 
   Registering jump thread: (12, 25) incoming edge;  (25, 26) joiner;  (26, 4) 
 nocopy;
   Registering jump thread: (13, 25) incoming edge;  (25, 26) joiner;  (26, 
 27) nocopy;
   Registering jump thread: (29, 25) incoming edge;  (25, 26) joiner;  (26, 4) 
 nocopy;
   Registering jump thread: (31, 25) incoming edge;  (25, 26) joiner;  (26, 
 27) nocopy;
   Registering jump thread: (16, 25) incoming edge;  (25, 26) joiner;  (26, 4) 
 nocopy;
   Registering jump thread: (15, 25) incoming edge;  (25, 26) joiner;  (26, 4) 
 nocopy;
   Registering jump thread: (32, 25) incoming edge;  (25, 26) joiner;  (26, 
 27) nocopy;
   Registering jump thread: (19, 25) incoming edge;  (25, 26) joiner;  (26, 4) 
 nocopy;
   Registering jump thread: (18, 25) incoming edge;  (25, 26) joiner;  (26, 4) 
 nocopy;
   Registering jump thread: (22, 25) incoming edge;  (25, 26) joiner;  (26, 
 27) nocopy;
   Registering jump thread: (21, 25) incoming edge;  (25, 26) joiner;  (26, 4) 
 nocopy;
   Registering jump thread: (34, 25) incoming edge;  (25, 26) joiner;  (26, 
 27) nocopy;
   Registering jump thread: (33, 25) incoming edge;  (25, 26) joiner;  (26, 4) 
 nocopy;
   Registering jump thread: (35, 25) incoming edge;  (25, 26) joiner;  (26, 
 27) nocopy;
   Registering jump thread: (24, 25) incoming edge;  (25, 26) joiner;  (26, 4) 
 nocopy;
 patch:   Registering jump thread: (12, 25) 

Re: RFC: Update ISL under gcc/infrastructure/ ? // Remove CLooG?

2014-11-10 Thread Jack Howarth
On x86_64-apple-darwin14, the attached patch allows gcc trunk to
build against isl 0.14. I assume if we want to retain the...

#if defined(__cplusplus)
extern C {
#endif

#if defined(__cplusplus)
}
#endif

wrappers around the include of  isl/val_gmp.h, to continue to support
isl 0.12.2, isl.m4 will need to test for isl = 0.12.2 and set a
define in autohost.h that can be added to the conditional on
_cplusplus. The same define would have to be used in a conditional for
selecting code changes required for using...

if (isl_band_member_is_zero_distance (Band, i))

in gcc/graphite-optimize-isl.c for isl = 0.12.2 rather than...

if (isl_band_member_is_coincident (Band, i))

and the other associated changes for isl   0.12.2.
Jack
ps The changes in gcc/graphite-optimize-isl.c are modelled on those in
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=191650#c6.

pps The test suite results for make -k check
RUNTESTFLAGS=graphite.exp --target_board=unix'{-m32,-m64}' are...

LAST_UPDATED: Obtained from SVN: trunk revision 217269

Native configuration is x86_64-apple-darwin13.4.0

=== g++ tests ===

Running target unix/-m32

=== g++ Summary for unix/-m32 ===

# of expected passes 27

Running target unix/-m64

=== g++ Summary for unix/-m64 ===

# of expected passes 27

=== g++ Summary ===

# of expected passes 54
/sw/src/fink.build/gcc50-5.0.0-1000/darwin_objdir/gcc/testsuite/g++/../../xg++
 version 5.0.0 20141109 (experimental) (GCC)

=== gcc tests ===

Running target unix/-m32
FAIL: gcc.dg/graphite/vect-pr43423.c scan-tree-dump-times vect
vectorized 2 loops 1
UNRESOLVED: gcc.dg/graphite/isl-codegen-loop-dumping.c
scan-tree-dump-times graphite ISL AST generated by ISL: \\nfor
(int c1 = 0; c1  n - 1; c1 += 1)\\n  for (int c3 = 0;
c3  n; c3 += 1)\\nS_4(c1, c3); 1

=== gcc Summary for unix/-m32 ===

# of expected passes 299
# of unexpected failures 1
# of expected failures 4
# of unresolved testcases 1
# of unsupported tests 5

Running target unix/-m64
FAIL: gcc.dg/graphite/vect-pr43423.c scan-tree-dump-times vect
vectorized 2 loops 1
UNRESOLVED: gcc.dg/graphite/isl-codegen-loop-dumping.c
scan-tree-dump-times graphite ISL AST generated by ISL: \\nfor
(int c1 = 0; c1  n - 1; c1 += 1)\\n  for (int c3 = 0;
c3  n; c3 += 1)\\nS_4(c1, c3); 1

=== gcc Summary for unix/-m64 ===

# of expected passes 299
# of unexpected failures 1
# of expected failures 4
# of unresolved testcases 1
# of unsupported tests 5

=== gcc Summary ===

# of expected passes 598
# of unexpected failures 2
# of expected failures 8
# of unresolved testcases 2
# of unsupported tests 10
/sw/src/fink.build/gcc50-5.0.0-1000/darwin_objdir/gcc/xgcc  version
5.0.0 20141109 (experimental) (GCC)

=== gfortran tests ===

Running target unix/-m32

=== gfortran Summary for unix/-m32 ===

# of expected passes 112
# of expected failures 14

Running target unix/-m64

=== gfortran Summary for unix/-m64 ===

# of expected passes 110
# of expected failures 14
# of unsupported tests 2

=== gfortran Summary ===

# of expected passes 222
# of expected failures 28
# of unsupported tests 2
/sw/src/fink.build/gcc50-5.0.0-1000/darwin_objdir/gcc/testsuite/gfortran/../../gfortran
 version 5.0.0 20141109 (experimental) (GCC)

=== libgomp tests ===

Running target unix/-m32

=== libgomp Summary for unix/-m32 ===

# of expected passes 49

Running target unix/-m64

=== libgomp Summary for unix/-m64 ===

# of expected passes 49

=== libgomp Summary ===

# of expected passes 98

Compiler version: 5.0.0 20141109 (experimental) (GCC)
Platform: x86_64-apple-darwin13.4.0
configure flags: --prefix=/sw --prefix=/sw/lib/gcc5.0
--mandir=/sw/share/man --infodir=/sw/lib/gcc5.0/info
--enable-languages=c,c++,fortran,lto,objc,obj-c++,java --with-gmp=/sw
--with-libiconv-prefix=/sw --with-isl=/sw --without-cloog
--with-mpc=/sw --with-system-zlib --x-includes=/usr/X11R6/include
--x-libraries=/usr/X11R6/lib --program-suffix=-fsf-5.0


On Mon, Nov 10, 2014 at 2:27 PM, Jack Howarth howarth.at@gmail.com wrote:
  Is the current isl 0.12.2 in infrastructure entirely sufficient
 to replace cloog-isl. or should the ABI compatibility changes be made
 to graphite to allow gcc 5.0 to be transitioned to the isl 0.14
 release? Especially if any graphite changes might be made before the
 gcc 5.0 release that could leverage new functionalities in isl 0.14.
 Jack


 On Sun, Nov 9, 2014 at 12:16 PM, Roman Gareev gareevro...@gmail.com wrote:
 Hi Tobias,

 I've attached a patch which removes using of CLooG library from
 Graphite. Is it fine for trunk?


 --
 Cheers, Roman Gareev.
Index: gcc/graphite-interchange.c
===
--- gcc/graphite-interchange.c  (revision 217330)
+++ gcc/graphite-interchange.c  (working copy)
@@ -30,13 +30,7 @@ along with GCC; see the file COPYING3.  
 #include isl/union_map.h
 #include isl/ilp.h
 

[PATCH 1/2] VRP: Simplify logic for checking if any asserts need to be inserted

2014-11-10 Thread Patrick Palka
Hi,

This patch tweaks the VRP code to simply inspect the need_assert_for
bitmap when determining whether any asserts need to be inserted.
Consequently we no longer have to manually keep track of whether a call
to register_new_assert_for() was made.

This patch is an updated version of a patch that was approved a few
months ago but was never committed.  Bootstrapped and regtested on
x86_64-unknown-linux-gnu with no new regressions.  Is it OK to commit?

2014-08-13  Patrick Palka  ppa...@gcc.gnu.org

* tree-vrp.c (register_edge_assert_for_2): Change return type to
void and adjust accordingly.
(register_edge_assert_for_1): Likewise.
(register_edge_assert_for): Likewise.
(find_conditional_asserts): Likewise.
(find_switch_asserts): Likewise.
(find_assert_locations_1): Likewise.
(find_assert_locations): Likewise.
(insert_range_insertions): Inspect the need_assert_for bitmap.
---
 gcc/tree-vrp.c | 157 ++---
 1 file changed, 49 insertions(+), 108 deletions(-)

diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index 4e4ebe0..f0a4382 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -4977,32 +4977,27 @@ masked_increment (const wide_int val_in, const 
wide_int mask,
 
 /* Try to register an edge assertion for SSA name NAME on edge E for
the condition COND contributing to the conditional jump pointed to by BSI.
-   Invert the condition COND if INVERT is true.
-   Return true if an assertion for NAME could be registered.  */
+   Invert the condition COND if INVERT is true.  */
 
-static bool
+static void
 register_edge_assert_for_2 (tree name, edge e, gimple_stmt_iterator bsi,
enum tree_code cond_code,
tree cond_op0, tree cond_op1, bool invert)
 {
   tree val;
   enum tree_code comp_code;
-  bool retval = false;
 
   if (!extract_code_and_val_from_cond_with_ops (name, cond_code,
cond_op0,
cond_op1,
invert, comp_code, val))
-return false;
+return;
 
   /* Only register an ASSERT_EXPR if NAME was found in the sub-graph
  reachable from E.  */
   if (live_on_edge (e, name)
!has_single_use (name))
-{
-  register_new_assert_for (name, name, comp_code, val, NULL, e, bsi);
-  retval = true;
-}
+register_new_assert_for (name, name, comp_code, val, NULL, e, bsi);
 
   /* In the case of NAME = CST and NAME being defined as
  NAME = (unsigned) NAME2 + CST2 we can assert NAME2 = -CST2
@@ -5063,8 +5058,6 @@ register_edge_assert_for_2 (tree name, edge e, 
gimple_stmt_iterator bsi,
}
 
  register_new_assert_for (name3, tmp, comp_code, val, NULL, e, bsi);
-
- retval = true;
}
 
   /* If name2 is used later, create an ASSERT_EXPR for it.  */
@@ -5094,8 +5087,6 @@ register_edge_assert_for_2 (tree name, edge e, 
gimple_stmt_iterator bsi,
}
 
  register_new_assert_for (name2, tmp, comp_code, val, NULL, e, bsi);
-
- retval = true;
}
 }
 
@@ -5133,7 +5124,6 @@ register_edge_assert_for_2 (tree name, edge e, 
gimple_stmt_iterator bsi,
  cst = int_const_binop (code, val, cst);
  register_new_assert_for (name2, name2, comp_code, cst,
   NULL, e, bsi);
- retval = true;
}
}
 }
@@ -5197,8 +5187,6 @@ register_edge_assert_for_2 (tree name, edge e, 
gimple_stmt_iterator bsi,
 
  register_new_assert_for (name2, tmp, new_comp_code, cst, NULL,
   e, bsi);
-
- retval = true;
}
}
 
@@ -5276,7 +5264,6 @@ register_edge_assert_for_2 (tree name, edge e, 
gimple_stmt_iterator bsi,
 
  register_new_assert_for (name2, tmp, new_comp_code, new_val,
   NULL, e, bsi);
- retval = true;
}
}
 
@@ -5297,8 +5284,7 @@ register_edge_assert_for_2 (tree name, edge e, 
gimple_stmt_iterator bsi,
   TREE_CODE (TREE_TYPE (val)) == INTEGER_TYPE
   TYPE_UNSIGNED (TREE_TYPE (val))
   TYPE_PRECISION (TREE_TYPE (gimple_assign_rhs1 (def_stmt)))
- prec
-  !retval))
+ prec))
{
  name2 = gimple_assign_rhs1 (def_stmt);
  if (rhs_code == BIT_AND_EXPR)
@@ -5522,13 +5508,10 @@ register_edge_assert_for_2 (tree name, edge e, 
gimple_stmt_iterator bsi,
 
register_new_assert_for (names[i], tmp, LE_EXPR,
 new_val, NULL, e, bsi);
-   retval = true;
  }
}
}
 }
-
-  return retval;
 }
 
 /* OP is an operand of a truth value expression which is known to have
@@ -5538,18 +5521,17 @@ 

[PATCH 2/2] Simplify and extend VRP edge-assertion code

2014-11-10 Thread Patrick Palka
This patch refactors the VRP edge-assertion code to make it always
traverse SSA-name definitions in order to find suitable edge assertions
to insert.  Currently SSA-name definitions get traversed only when the
LHS of the original conditional is a bitwise AND or OR operation which
seems like a strange restriction.  We should always try to traverse
the SSA-name definitions inside the conditional, in particular for
conditionals with the form:

  int p = x COMP y;
  if (p != 0) -- edge assertion: x COMP y

To achieve this the patch merges the mutually recursive functions
register_edge_assert_for_1() and register_edge_assert_for_2() into a
single recursive function, register_edge_assert_for_1().  In doing so,
code duplication can be reduced and at the same time the more general
logic allows VRP to detect more useful edge assertions.

The recursion of the function register_edge_assert_for_1() is bounded by
a new 'limit' argument which is arbitrarily set to 4 so that at most 4
levels of SSA-name definitions will be traversed per conditional.
(Incidentally this hard recursion limit makes the related fix for PR
57685 unnecessary.)

A test in uninit-pred-9_b.c now has to be marked xfail because in it VRP
(correctly) transforms the statement

  # prephitmp_35 = PHI pretmp_9(8), _28(10)
  into
  # prephitmp_35 = PHI pretmp_9(8), 1(10)

and the uninit pass doesn't properly handle such PHIs containing a
constant value as one of its arguments -- so a bogus uninit warning is
now emitted.

Full bootstrap + regtesting on x86_64-unknown-linux-gnu is in progress.
Is it OK to commit if testing finishes with no new regressions?

2014-11-11  Patrick Palka  patr...@parcs.ath.cx

gcc/
* tree-vrp.c (extract_code_and_val_from_cond_with_ops): Ensure
that NAME always equals COND_OP0 or COND_OP1.
(register_edge_assert_for, register_edge_assert_for_1,
register_edge_assert_for_2): Refactor and consolidate
edge-assertion logic into ...
(register_edge_assert_for_2): ... here.  Add LIMIT parameter.
Rename to ...
(register_edge_assert_for_1): ... this.

gcc/testsuite/
* gcc.dg/vrp-1.c: New testcase.
* gcc.dg/vrp-2.c: New testcase.
* gcc.dg/uninit-pred-9_b.c: xfail test on line 24.
---
 gcc/testsuite/gcc.dg/uninit-pred-9_b.c |   2 +-
 gcc/testsuite/gcc.dg/vrp-1.c   |  31 
 gcc/testsuite/gcc.dg/vrp-2.c   |  78 ++
 gcc/tree-vrp.c | 261 +++--
 4 files changed, 231 insertions(+), 141 deletions(-)
 create mode 100644 gcc/testsuite/gcc.dg/vrp-1.c
 create mode 100644 gcc/testsuite/gcc.dg/vrp-2.c

diff --git a/gcc/testsuite/gcc.dg/uninit-pred-9_b.c 
b/gcc/testsuite/gcc.dg/uninit-pred-9_b.c
index d9ae75e..555ec20 100644
--- a/gcc/testsuite/gcc.dg/uninit-pred-9_b.c
+++ b/gcc/testsuite/gcc.dg/uninit-pred-9_b.c
@@ -21,7 +21,7 @@ int foo (int n, int l, int m, int r)
   blah(v); /* { dg-bogus uninitialized bogus warning } */
 
   if ( (n = 8)   (m  99)   (r  19) )
-  blah(v); /* { dg-bogus uninitialized bogus warning } */
+  blah(v); /* { dg-bogus uninitialized bogus warning { xfail *-*-* } } 
*/
 
   return 0;
 }
diff --git a/gcc/testsuite/gcc.dg/vrp-1.c b/gcc/testsuite/gcc.dg/vrp-1.c
new file mode 100644
index 000..df5334e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vrp-1.c
@@ -0,0 +1,31 @@
+/* { dg-options -O2 } */
+
+void runtime_error (void) __attribute__ ((noreturn));
+void compiletime_error (void) __attribute__ ((noreturn, error ()));
+
+static void
+compiletime_check_equals_1 (int *x, int y)
+{
+  int __p = *x != y;
+  if (__builtin_constant_p (__p)  __p)
+compiletime_error ();
+  if (__p)
+runtime_error ();
+}
+
+static void
+compiletime_check_equals_2 (int *x, int y)
+{
+  int __p = *x != y;
+  if (__builtin_constant_p (__p)  __p)
+compiletime_error (); /* { dg-error call to } */
+  if (__p)
+runtime_error ();
+}
+
+void
+foo (int *x)
+{
+  compiletime_check_equals_1 (x, 5);
+  compiletime_check_equals_2 (x, 10);
+}
diff --git a/gcc/testsuite/gcc.dg/vrp-2.c b/gcc/testsuite/gcc.dg/vrp-2.c
new file mode 100644
index 000..5757c2f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vrp-2.c
@@ -0,0 +1,78 @@
+/* { dg-options -O2 } */
+
+void runtime_error (void) __attribute__ ((noreturn));
+void compiletime_error (void) __attribute__ ((noreturn, error ()));
+
+void dummy (int x);
+
+void
+bar (int x, int y, int z)
+{
+  int p = ~(x  y  z) == 37;
+  if (p)
+{
+  if (!x || !y || !z)
+   compiletime_error (); /* { dg-bogus call to } */
+}
+}
+
+void
+baz (int x)
+{
+  int y = ~x;
+  int p = y == 37;
+  dummy (y);
+  dummy (p);
+  if (p)
+{
+  int q = x != ~37;
+  dummy (q);
+  if (q)
+   compiletime_error (); /* { dg-bogus call to } */
+}
+}
+
+void
+blah_1 (char x)
+{
+  int y = x;
+  int p = y == 10;
+  dummy (p);
+  if (p)
+{
+  int q = x != 10;
+  dummy (q);
+  if (q)
+   compiletime_error (); /* { 

Re: Add the latest C++ SD-6 additions.

2014-11-10 Thread Ed Smith-Rowland

On 11/10/2014 12:10 PM, Jason Merrill wrote:

On 11/10/2014 10:55 AM, Ed Smith-Rowland wrote:

Would a 4.9 version be accepted?


Sure.

What do you think about defining the macros for unsupported features 
to 0 rather than leaving them undefined?  The document doesn't seem to 
specify.


Jason



Jason,

1. Undefined macros evaluate to 0 so that's effectively what we have now 
- no change in behavior if we explicitly set them
2. The SD-6 document advertises direct use of macros with #if 
__cpp_foobar without #ifdef - However if people are using #ifdef rather 
than #if that might break things (I guess that's different behavior); 
OTOH those dates are there for a reason.
3. OTOH, the SD-6 document seems to suggest only adding a macro as a 
feature is implemented or allowed bycompiler flags - implying undefined 
macros for unimplemented features
4. __has_include and __has_cpp_attribute return 0 on 
non-existent/undefined so there's some precedent (though these are 
rather different structurally - function macros)


So I'm conflicted after being initially sympathetic to defining as 
zero.  Still slightly in favor.


I'll might put this to the SD-6 list because it would be nice to have 
clarity - even if it's implementation defined.


Ed



Re: [PATCH] c++ify sreal

2014-11-10 Thread Andrew Pinski
On Fri, Oct 24, 2014 at 1:55 AM, Richard Biener
richard.guent...@gmail.com wrote:
 On Fri, Oct 24, 2014 at 8:28 AM,  tsaund...@mozilla.com wrote:
 From: Trevor Saunders tsaund...@mozilla.com

 Hi,

 do $subject, and cleanup for always 64 bit hwi.


 bootstrapped + regtested x86_64-unknown-linux-gnu, ok?

 Ok.  Can you please replace remaining HOST_WIDE_INT
 vestiges in there with [u]int64_t please?


This patch breaks the build on debian 6.0:

../../gcc/sreal.c: In member function ‘int64_t sreal::to_int() const’:
../../gcc/sreal.c:159: error: ‘INT64_MAX’ was not declared in this scope

Thanks,
Andrew Pinski



 Thanks,
 Richard.

 Trev

 gcc/ChangeLog:

 2014-10-24  Trevor Saunders  tsaund...@mozilla.com

 * ipa-inline.c (edge_badness): Adjust.
 (inline_small_functions): Likewise.
 * predict.c (propagate_freq): Likewise.
 (estimate_bb_frequencies): Likewise.
 * sreal.c (sreal::dump): Rename from dump_sreal.
 (debug): Adjust.
 (copy): Remove function.
 (sreal::shift_right): Rename from sreal_sift_right.
 (sreal::normalize): Rename from normalize.
 (sreal_init): Remove function.
 (sreal::to_int): Rename from sreal_to_int.
 (sreal_compare): Remove function.
 (sreal::operator+): Rename from sreal_add.
 (sreal::operator-): Rename from sreal_sub.
 (sreal::operator*): Rename from sreal_mul.
 (sreal::operator/): Rename from sreal_div.
 * sreal.h (class sreal): Adjust.
 (inline sreal operator+=): New operator.
 (inline sreal operator-=): Likewise.
 (inline sreal operator/=): Likewise.
 (inline sreal operator*=): Likewise.
 (inline bool operator!=): Likewise.
 (inline bool operator): Likewise.
 (inline bool operator=): Likewise.
 (inline bool operator=): Likewise.
 ---
  gcc/ipa-inline.c |  25 ++-
  gcc/predict.c|  82 --
  gcc/sreal.c  | 479 
 +++
  gcc/sreal.h  |  97 ---
  4 files changed, 213 insertions(+), 470 deletions(-)

 diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c
 index e79a4dd..cca1fb3 100644
 --- a/gcc/ipa-inline.c
 +++ b/gcc/ipa-inline.c
 @@ -939,29 +939,28 @@ edge_badness (struct cgraph_edge *edge, bool dump)

else if (max_count)
  {
 -  sreal tmp, relbenefit_real, growth_real;
int relbenefit = relative_time_benefit (callee_info, edge, edge_time);
/* Capping edge-count to max_count. edge-count can be larger than
  max_count if an inline adds new edges which increase max_count
  after max_count is computed.  */
gcov_type edge_count = edge-count  max_count ? max_count : 
 edge-count;

 -  sreal_init (relbenefit_real, relbenefit, 0);
 -  sreal_init (growth_real, growth, 0);
 +  sreal relbenefit_real (relbenefit, 0);
 +  sreal growth_real (growth, 0);

/* relative_edge_count.  */
 -  sreal_init (tmp, edge_count, 0);
 -  sreal_div (tmp, tmp, max_count_real);
 +  sreal tmp (edge_count, 0);
 +  tmp /= max_count_real;

/* relative_time_benefit.  */
 -  sreal_mul (tmp, tmp, relbenefit_real);
 -  sreal_div (tmp, tmp, max_relbenefit_real);
 +  tmp *= relbenefit_real;
 +  tmp /= max_relbenefit_real;

/* growth_f_caller.  */
 -  sreal_mul (tmp, tmp, half_int_min_real);
 -  sreal_div (tmp, tmp, growth_real);
 +  tmp *= half_int_min_real;
 +  tmp /=  growth_real;

 -  badness = -1 * sreal_to_int (tmp);
 +  badness = -1 * tmp.to_int ();

if (dump)
 {
 @@ -1604,9 +1603,9 @@ inline_small_functions (void)
   if (max_count  edge-count)
 max_count = edge-count;
}
 -  sreal_init (max_count_real, max_count, 0);
 -  sreal_init (max_relbenefit_real, RELATIVE_TIME_BENEFIT_RANGE, 0);
 -  sreal_init (half_int_min_real, INT_MAX / 2, 0);
 +  max_count_real = sreal (max_count, 0);
 +  max_relbenefit_real = sreal (RELATIVE_TIME_BENEFIT_RANGE, 0);
 +  half_int_min_real = sreal (INT_MAX / 2, 0);
ipa_free_postorder_info ();
initialize_growth_caches ();

 diff --git a/gcc/predict.c b/gcc/predict.c
 index 5f5d4a5..10675c3 100644
 --- a/gcc/predict.c
 +++ b/gcc/predict.c
 @@ -2571,15 +2571,13 @@ propagate_freq (basic_block head, bitmap tovisit)
 bb-count = bb-frequency = 0;
  }

 -  memcpy (BLOCK_INFO (head)-frequency, real_one, sizeof (real_one));
 +  BLOCK_INFO (head)-frequency = real_one;
last = head;
for (bb = head; bb; bb = nextbb)
  {
edge_iterator ei;
 -  sreal cyclic_probability, frequency;
 -
 -  memcpy (cyclic_probability, real_zero, sizeof (real_zero));
 -  memcpy (frequency, real_zero, sizeof (real_zero));
 +  sreal cyclic_probability = real_zero;
 +  sreal frequency = real_zero;

nextbb = BLOCK_INFO (bb)-next;
BLOCK_INFO (bb)-next = NULL;
 @@ -2596,42 +2594,34 @@ propagate_freq 

Re: [patch] OpenACC fortran tests

2014-11-10 Thread Tobias Burnus

Cesar Philippidis wrote:

This patch contains compile-time tests for OpenACC in gfortran. Is this
patch OK for mainline trunk after the OpenACC fortran front end changes
make their way in?


I browsed the test cases – and they look okay. I didn't try hard to see 
whether every single one is valid nor whether some are missing, but my 
hope is that most of those issues were caught during the branch review.



NOTE: There is one

+!  FIXME: This causes an ICE in the gimplifier.

and for nonexpanding a builtin:

+! TODO: not working.

and

+! TODO: nested kernels are allowed in 2.0

and additionally - related to OpenACC's cache

+! TODO: These cases must fail


Unless the ICE is fixed until the commit, I would suggest to fill a PR 
for it to make sure it won't be forgotten. (One should probably add an 
openacc keyword.) And cache and nonnested kernels look like items 
for the release notes.


Thanks for the test cases to everyone involved!

Tobias


Re: [PATCH 3/4] Add libgomp plugin for Intel MIC

2014-11-10 Thread Jakub Jelinek
On Mon, Nov 10, 2014 at 05:30:38PM +0300, Ilya Verbin wrote:
 On 06 Nov 19:25, Jakub Jelinek wrote:
  Oh, one more point, if mic_lib_path is NULL, what is the point
  to do the alloca/malloc and string copying?  Can't you just
setenv (MIC_LD_LIBRARY_PATH_ENV, ld_lib_path, 1);
  in that case early?
  
  Otherwise LGTM.
 
 Done.

Ok (with appropriate ChangeLog entry).

Jakub


Re: [PATCH 4/4] OpenMP 4.0 offloading to Intel MIC: non-fallback testing

2014-11-10 Thread Jakub Jelinek
On Mon, Nov 10, 2014 at 05:34:30PM +0300, Ilya Verbin wrote:
 Done, I put them into env vars.
 
   +lappend ALWAYS_CFLAGS 
   additional_flags=${offload_additional_options}
}
  
  Perhaps add this only if offload_additional_options is non-empty?
 
 Done.

Ok (with appropriate ChangeLog entry).

Jakub


Re: [PATCH 10/11][RS6000] Migrate reduction optabs to reduc_..._scal

2014-11-10 Thread Segher Boessenkool
On Mon, Nov 10, 2014 at 05:36:24PM -0500, Michael Meissner wrote:
 However, the double pattern is completely broken.  This cannot go in.

[snip]

 It is unacceptable to have to do the inner loop doing a load, vector add, and
 store in the loop.

Before the patch, the final reduction used *vsx_reduc_splus_v2df; after
the patch, it is *vsx_reduc_plus_v2df_scalar.  The former does a vector
add, the latter a float add.  And it uses the same pseudoregister for the
accumulator throughout.  IRA decides a register is more expensive than
memory for this, I suppose because it wants both V2DF and DF?  It doesn't
seem to like the subreg very much.

The new code does look nicer otherwise :-)


Segher


Re: [patch] OpenACC fortran front end

2014-11-10 Thread Jakub Jelinek
On Mon, Nov 10, 2014 at 02:43:38PM -0800, Cesar Philippidis wrote:
  I'll post a separate patch with the fortran tests later. If anyone
  wants to test this patch, please use gomp-4_0-branch instead. You
  don't need a CUDA accelerator to use
  OpenACC, and some of the runtime tests will fail because that branch
  doesn't include the nvptx backend.
  Now that the first series of PTX target patches have been committed: I
  assume it is still true that nvptx doesn't work because the libgomp bits
  aren't in yes, isn't it?
 
 That's correct. The nvptx backend also depends on the offloading changes
 that a team from Intel is working on for the MIC target. But Julian
 should be posting the libgomp patches tomorrow, I think, since his
 changes are somewhat self-contained.

For the middle-end and libgomp changes, can you talk to the Intel folks to
update their git branch to latest trunk (so that you have the nvptx bits in
there) and send middle-end and libgomp diffs against that?
As far as I remember, most of the changes from the branch are now approved,
they are just waiting for review of the LTO related changes in the
middle-end (please, correct me if I've missed something).

Jakub


Re: [gimple-classes, committed 4/6] tree-ssa-tail-merge.c: Use gassign

2014-11-10 Thread Jakub Jelinek
On Mon, Nov 10, 2014 at 05:27:50PM -0500, David Malcolm wrote:
 On Sat, 2014-11-08 at 14:56 +0100, Jakub Jelinek wrote:
  On Sat, Nov 08, 2014 at 01:07:28PM +0100, Richard Biener wrote:
   To be constructive here - the above case is from within a
   GIMPLE_ASSIGN case label
   and thus I'd have expected
   
   case GIMPLE_ASSIGN:
 {
   gassign *a1 = as_a gassign * (s1);
   gassign *a2 = as_a gassign * (s2);
 lhs1 = gimple_assign_lhs (a1);
 lhs2 = gimple_assign_lhs (a2);
 if (TREE_CODE (lhs1) != SSA_NAME
  TREE_CODE (lhs2) != SSA_NAME)
   return (operand_equal_p (lhs1, lhs2, 0)
gimple_operand_equal_value_p (gimple_assign_rhs1 (a1),
gimple_assign_rhs1 
   (a2)));
 else if (TREE_CODE (lhs1) == SSA_NAME
   TREE_CODE (lhs2) == SSA_NAME)
   return vn_valueize (lhs1) == vn_valueize (lhs2);
 return false;
 }
   
   instead.  That's the kind of changes I have expected and have approved of.
  
  But even that looks like just adding extra work for all developers, with no
  gain.  You only have to add extra code and extra temporaries, in switches
  typically also have to add {} because of the temporaries and thus extra
  indentation level, and it doesn't simplify anything in the code.
 
 The branch attempts to use the C++ typesystem to capture information
 about the kinds of gimple statement we expect, both:
   (A) so that the compiler can detect type errors, and
   (B) as a comprehension aid to the human reader of the code
 
 The ideal here is when function params and struct field can be
 strengthened from gimple to a subclass ptr.  This captures the
 knowledge that every use of a function or within a struct has a given
 gimple code.

I just don't like all the as_a/is_a stuff enforced everywhere,
it means more typing, more temporaries, more indentation.
So, as I view it, instead of the checks being done cheaply (yes, I think
the gimple checking as we have right now is very cheap) under the
hood by the accessors (gimple_assign_{lhs,rhs1} etc.), those changes
put the burden on the developers, who has to check that manually through
the as_a/is_a stuff everywhere, more typing and uglier syntax.
I just don't see that as a step forward, instead a huge step backwards.
But perhaps I'm alone with this.
Can you e.g. compare the size of - lines in your patchset combined, and
size of + lines in your patchset?  As in, if your changes lead to less
typing or more.

Jakub


FW: [PATCH, aarch64] Add prefetch support

2014-11-10 Thread Gopalasubramanian, Ganesh
PING! I am worried if it goes in stage-1.

-Original Message-
From: Gopalasubramanian, Ganesh 
Sent: Thursday, October 30, 2014 2:24 PM
To: gcc-patches@gcc.gnu.org
Subject: [PATCH, aarch64] Add prefetch support

Hi,

Below is the patch that implements prefetching support.

This patch has been already discussed on
a) https://gcc.gnu.org/ml/gcc-patches/2014-02/msg01644.html
b) https://gcc.gnu.org/ml/gcc-patches/2014-07/msg00612.html

I have not added a test as there are ample tests in compile and execute suites.
make -k check passes. Ok for trunk?

Changelog:
2014-10-30  Ganesh Gopalasubramanian ganesh.gopalasubraman...@amd.com

    * config/aarch64/aarch64.md (define_insn prefetch): New.
    * config/arm/types.md (define_attr type): Add prefetch.

Regards
Ganesh

diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md 
index 74b554e..12a3f170 100644
--- a/gcc/config/aarch64/aarch64.md
+++ b/gcc/config/aarch64/aarch64.md
@@ -320,6 +320,38 @@
   [(set_attr type no_insn)]
)

+
+(define_insn prefetch
+  [(prefetch (match_operand:DI 0 address_operand r)
+    (match_operand:QI 1 const_int_operand )
+    (match_operand:QI 2 const_int_operand ))]
+  
+  *
+{
+  const char * pftype[2][10]
+    = { {\PLDL1STRM\, \PLDL3KEEP\, \PLDL2KEEP\, \PLDL1KEEP\},
+   {\PSTL1STRM\, \PSTL3KEEP\, \PSTL2KEEP\, \PSTL1KEEP\},
+  };
+
+  int locality = INTVAL (operands[2]);
+  char pattern[100];
+
+  gcc_assert (IN_RANGE (locality, 0, 3));
+
+  strcpy (pattern, \prfm\\t\);
+  strcat (pattern, (const char*)pftype[INTVAL(operands[1])][locality]);
+  strcat (pattern, \, %a0\);
+
+  output_asm_insn (pattern,
+   operands);
+
+  return \\;
+
+}
+  [(set_attr type prefetch)]
+)
+
(define_insn trap
   [(trap_if (const_int 1) (const_int 8))]
   
diff --git a/gcc/config/arm/types.md b/gcc/config/arm/types.md index 
c1151f5..8b4b7a1 100644
--- a/gcc/config/arm/types.md
+++ b/gcc/config/arm/types.md
@@ -118,6 +118,7 @@
; mvn_shift_reg  inverting move instruction, shifted operand by a register.
; no_insn    an insn which does not represent an instruction in the ;   
 final output, thus having no impact on scheduling.
+; prefetch   a prefetch instruction
; rbit   reverse bits.
; rev    reverse bytes.
; sdiv   signed division.
@@ -556,6 +557,7 @@
   call,\
   clz,\
   no_insn,\
+  prefetch,\
   csel,\
   crc,\


[PING^3][PATCH, AArch64] Add support for -mlong-calls option

2014-11-10 Thread Yangfei (Felix)
Hi,

  Dose anybody have time to review this?  Thanks. 


 
 Hello,
 
   Ping for https://gcc.gnu.org/ml/gcc-patches/2014-10/msg02933.html
 
   Thanks


Re: [PATCH] c++ify sreal

2014-11-10 Thread Uros Bizjak
Hello!

 do $subject, and cleanup for always 64 bit hwi.


 bootstrapped + regtested x86_64-unknown-linux-gnu, ok?

 Ok.  Can you please replace remaining HOST_WIDE_INT
 vestiges in there with [u]int64_t please?


 This patch breaks the build on debian 6.0:

 ../../gcc/sreal.c: In member function âint64_t sreal::to_int() constâ:
 ../../gcc/sreal.c:159: error: âINT64_MAXâ was not declared in this scope

Index: system.h
===
--- system.h(revision 217338)
+++ system.h(working copy)
@@ -27,6 +27,7 @@
event inttypes.h gets pulled in by another header it is already
defined.  */
 #define __STDC_FORMAT_MACROS
+#define __STDC_LIMIT_MACROS

 /* We must include stdarg.h before stdio.h.  */
 #include stdarg.h


Fix coverage inaccuracy with return in C/C++

2014-11-10 Thread Eric Botcazou
We just remarked that there is a coverage inaccuracy in C/C++ for something as 
simple as:

void
foo (int i)
{
  if (i  1)
return;

  bar ();
}

The return line is always reported as covered, even at -O0.  That's because 
the return is used as the representative return for the entire function 
and then reused for the fallthru as-is.   The interesting thing is that this 
doesn't happen in Ada for an equivalent code, because the Ada compiler always 
adds a final return to functions:

void
foo (int i)
{
  if (i  1)
return;

  bar ();
  return;
}

In this case of 2 or more returns, the machinery in gimple-low.c properly 
clears the location on the representative return:

  /* Remove the line number from the representative return statement.
 It now fills in for many such returns.  Failure to remove this
 will result in incorrect results for coverage analysis.  */
  gimple_set_location (tmp_rs.stmt, UNKNOWN_LOCATION);

Hence the attached patch, which does the same when a representative return is 
reused for the fallthru.

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


2014-11-10  Eric Botcazou  ebotca...@adacore.com

* gimple-low.c (lower_function_body): Clear the location of the first
inserted representative return if it also fills in for the fallthru.


2014-11-10  Eric Botcazou  ebotca...@adacore.com

* gcc.misc-tests/gcov-15.c: New test.


-- 
Eric BotcazouIndex: gimple-low.c
===
--- gimple-low.c	(revision 217259)
+++ gimple-low.c	(working copy)
@@ -129,7 +129,8 @@ lower_function_body (void)
   /* If the function falls off the end, we need a null return statement.
  If we've already got one in the return_statements vector, we don't
  need to do anything special.  Otherwise build one by hand.  */
-  if (gimple_seq_may_fallthru (lowered_body)
+  bool may_fallthru = gimple_seq_may_fallthru (lowered_body);
+  if (may_fallthru
(data.return_statements.is_empty ()
 	  || (gimple_return_retval (data.return_statements.last().stmt)
 	  != NULL)))
@@ -138,6 +139,7 @@ lower_function_body (void)
   gimple_set_location (x, cfun-function_end_locus);
   gimple_set_block (x, DECL_INITIAL (current_function_decl));
   gsi_insert_after (i, x, GSI_CONTINUE_LINKING);
+  may_fallthru = false;
 }
 
   /* If we lowered any return statements, emit the representative
@@ -148,6 +150,14 @@ lower_function_body (void)
   x = gimple_build_label (t.label);
   gsi_insert_after (i, x, GSI_CONTINUE_LINKING);
   gsi_insert_after (i, t.stmt, GSI_CONTINUE_LINKING);
+  if (may_fallthru)
+	{
+	  /* Remove the line number from the representative return statement.
+	 It now fills in for the fallthru too.  Failure to remove this
+	 will result in incorrect results for coverage analysis.  */
+	  gimple_set_location (t.stmt, UNKNOWN_LOCATION);
+	  may_fallthru = false;
+	}
 }
 
   /* Once the old body has been lowered, replace it with the new/* { dg-options -fprofile-arcs -ftest-coverage } */
/* { dg-do run { target native } } */

void
bar (void)
{}

void
foo (int i)
{
  if (i  1)  /* count(1) */
return;   /* count(#) */

  bar ();  /* count(1) */
}

int
main (void)
{
  foo (0);
  return 0;
}

/* { dg-final { run-gcov gcov-15.c } } */

[PATCH][14/n] Merge from match-and-simplify, more conversion patterns

2014-11-10 Thread Richard Biener

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.

Richard.

2014-11-10  Richard Biener  rguent...@suse.de

* match.pd: Move rest of the conversion combining patterns
from tree-ssa-forwprop.c.
* tree-ssa-forwprop.c (combine_conversions): Remove.
(pass_forwprop::execute): Do not call it.

Index: trunk/gcc/match.pd
===
*** trunk.orig/gcc/match.pd 2014-11-09 12:22:38.846998253 +0100
--- trunk/gcc/match.pd  2014-11-09 12:32:38.109972029 +0100
*** along with GCC; see the file COPYING3.
*** 411,414 
 ! (final_ptr  inside_prec != inter_prec)
 ! (final_prec != GET_MODE_PRECISION (TYPE_MODE (type))
   TYPE_MODE (type) == TYPE_MODE (inter_type)))
! (ocvt @0))
--- 411,433 
 ! (final_ptr  inside_prec != inter_prec)
 ! (final_prec != GET_MODE_PRECISION (TYPE_MODE (type))
   TYPE_MODE (type) == TYPE_MODE (inter_type)))
! (ocvt @0))
! 
!/* A truncation to an unsigned type (a zero-extension) should be
!   canonicalized as bitwise and of a mask.  */
!(if (final_int  inter_int  inside_int
!final_prec == inside_prec
!final_prec  inter_prec
!inter_unsignedp)
! (convert (bit_and @0 { wide_int_to_tree
!(inside_type,
! wi::mask (inter_prec, false,
!   TYPE_PRECISION (inside_type))); })))
! 
!/* If we are converting an integer to a floating-point that can
!   represent it exactly and back to an integer, we can skip the
!   floating-point conversion.  */
!(if (inside_int  inter_float  final_int 
!   (unsigned) significand_size (TYPE_MODE (inter_type))
!   = inside_prec - !inside_unsignedp)
! (convert @0))
Index: trunk/gcc/tree-ssa-forwprop.c
===
*** trunk.orig/gcc/tree-ssa-forwprop.c  2014-11-09 12:22:39.165998239 +0100
--- trunk/gcc/tree-ssa-forwprop.c   2014-11-09 12:34:28.933967179 +0100
*** out:
*** 2345,2458 
return false;
  }
  
- /* Combine two conversions in a row for the second conversion at *GSI.
-Returns 1 if there were any changes made, 2 if cfg-cleanup needs to
-run.  Else it returns 0.  */
-  
- static int
- combine_conversions (gimple_stmt_iterator *gsi)
- {
-   gimple stmt = gsi_stmt (*gsi);
-   gimple def_stmt;
-   tree op0, lhs;
-   enum tree_code code = gimple_assign_rhs_code (stmt);
-   enum tree_code code2;
- 
-   gcc_checking_assert (CONVERT_EXPR_CODE_P (code)
-  || code == FLOAT_EXPR
-  || code == FIX_TRUNC_EXPR);
- 
-   lhs = gimple_assign_lhs (stmt);
-   op0 = gimple_assign_rhs1 (stmt);
-   if (useless_type_conversion_p (TREE_TYPE (lhs), TREE_TYPE (op0)))
- {
-   gimple_assign_set_rhs_code (stmt, TREE_CODE (op0));
-   return 1;
- }
- 
-   if (TREE_CODE (op0) != SSA_NAME)
- return 0;
- 
-   def_stmt = SSA_NAME_DEF_STMT (op0);
-   if (!is_gimple_assign (def_stmt))
- return 0;
- 
-   code2 = gimple_assign_rhs_code (def_stmt);
- 
-   if (CONVERT_EXPR_CODE_P (code2) || code2 == FLOAT_EXPR)
- {
-   tree defop0 = gimple_assign_rhs1 (def_stmt);
-   tree type = TREE_TYPE (lhs);
-   tree inside_type = TREE_TYPE (defop0);
-   tree inter_type = TREE_TYPE (op0);
-   int inside_int = INTEGRAL_TYPE_P (inside_type);
-   unsigned int inside_prec = TYPE_PRECISION (inside_type);
-   int inside_unsignedp = TYPE_UNSIGNED (inside_type);
-   int inter_int = INTEGRAL_TYPE_P (inter_type);
-   int inter_float = FLOAT_TYPE_P (inter_type);
-   unsigned int inter_prec = TYPE_PRECISION (inter_type);
-   int inter_unsignedp = TYPE_UNSIGNED (inter_type);
-   int final_int = INTEGRAL_TYPE_P (type);
-   unsigned int final_prec = TYPE_PRECISION (type);
- 
-   /* Don't propagate ssa names that occur in abnormal phis.  */
-   if (TREE_CODE (defop0) == SSA_NAME
-  SSA_NAME_OCCURS_IN_ABNORMAL_PHI (defop0))
-   return 0;
- 
-   /* A truncation to an unsigned type should be canonicalized as
-bitwise and of a mask.  */
-   if (final_int  inter_int  inside_int
-  final_prec == inside_prec
-  final_prec  inter_prec
-  inter_unsignedp)
-   {
- tree tem;
- tem = fold_build2 (BIT_AND_EXPR, inside_type,
-defop0,
-wide_int_to_tree
-(inside_type,
- wi::mask (inter_prec, false,
-   TYPE_PRECISION (inside_type;
- if (!useless_type_conversion_p (type, inside_type))
-   {
- tem = force_gimple_operand_gsi (gsi, tem, true, NULL_TREE, true,
- GSI_SAME_STMT);
- 

Re: RFC: Update ISL under gcc/infrastructure/ ? // Remove CLooG?

2014-11-10 Thread Roman Gareev
 The patch looks great. The only piece I think we missed is the
 fgraphite-code-generator flag. I would propose to remove it as well in this
 commit, as it does not have any effect any more.

In this case, we’ll also have to change tests which use
fgraphite-code-generator flag (isl-ast-gen-blocks-1.c,
isl-ast-gen-blocks-2.c, isl-ast-gen-blocks-3.c,
isl-ast-gen-blocks-4.c, isl-ast-gen-if-1.c, isl-ast-gen-if-2.c,
isl-ast-gen-single-loop-1.c, isl-ast-gen-single-loop-2.c,
isl-ast-gen-user-1.c, isl-codegen-loop-dumping.c). Maybe we should do
this in the next patch?


-- 
Cheers, Roman Gareev.


[PATCH GCC]Fix checking on MAX_PENDING_LIST_LENGTH

2014-11-10 Thread Bin Cheng
Hi,
There is parameter max-pending-list-length in gcc scheduler, but the
parameter is checked using greater than condition.  As a result, the real
max pending list length is actually max-pending-list-length + 1.  This
patch fixes this by using = rather than  comparison operator.  Though
it is kind of nit-picking, I want to change this: a) it breaks sched-fusion
because the 33rd couldn't be paired; b) when sched-fusion tries to sort many
consecutive stores, it breaks dcache line alignment at large probability.  I
mean without cache sensitive optimizer, GCC breaks dcache line alignment
randomly, but 33 is definitely worse than 32.  Of course, this only happens
in very restricted case.

Bootstrap and test on x86_64.  Is it OK?

2014-11-10  Bin Cheng  bin.ch...@arm.com

* sched-deps.c (sched_analyze_1): Check pending list if it is not
less than MAX_PENDING_LIST_LENGTH.
(sched_analyze_2, sched_analyze_insn, deps_analyze_insn): Ditto.
Index: gcc/sched-deps.c
===
--- gcc/sched-deps.c(revision 217273)
+++ gcc/sched-deps.c(working copy)
@@ -2504,7 +2504,7 @@ sched_analyze_1 (struct deps_desc *deps, rtx x, rt
   /* Pending lists can't get larger with a readonly context.  */
   if (!deps-readonly
((deps-pending_read_list_length + 
deps-pending_write_list_length)
-   MAX_PENDING_LIST_LENGTH))
+  = MAX_PENDING_LIST_LENGTH))
{
  /* Flush all pending reads and writes to prevent the pending lists
 from getting any larger.  Insn scheduling runs too slowly when
@@ -2722,7 +2722,7 @@ sched_analyze_2 (struct deps_desc *deps, rtx x, rt
  {
if ((deps-pending_read_list_length
 + deps-pending_write_list_length)
-MAX_PENDING_LIST_LENGTH
+   = MAX_PENDING_LIST_LENGTH
 !DEBUG_INSN_P (insn))
  flush_pending_lists (deps, insn, true, true);
add_insn_mem_dependence (deps, true, insn, x);
@@ -3227,8 +3227,8 @@ sched_analyze_insn (struct deps_desc *deps, rtx x,
  EXECUTE_IF_SET_IN_REG_SET (reg_pending_clobbers, 0, i, rsi)
{
  struct deps_reg *reg_last = deps-reg_last[i];
- if (reg_last-uses_length  MAX_PENDING_LIST_LENGTH
- || reg_last-clobbers_length  MAX_PENDING_LIST_LENGTH)
+ if (reg_last-uses_length = MAX_PENDING_LIST_LENGTH
+ || reg_last-clobbers_length = MAX_PENDING_LIST_LENGTH)
{
  add_dependence_list_and_free (deps, insn, reg_last-sets, 0,
REG_DEP_OUTPUT, false);
@@ -3661,7 +3661,7 @@ deps_analyze_insn (struct deps_desc *deps, rtx_ins
 sel_insn_is_speculation_check (insn)))
 {
   /* Keep the list a reasonable size.  */
-  if (deps-pending_flush_length++  MAX_PENDING_LIST_LENGTH)
+  if (deps-pending_flush_length++ = MAX_PENDING_LIST_LENGTH)
 flush_pending_lists (deps, insn, true, true);
   else
deps-pending_jump_insns


[PATCH] Fix a few UNRESOLVEDs

2014-11-10 Thread Marek Polacek
This fixes a few UNRESOLVEDs because I forgot to skip -fno-fat-lto-objects
when I introduced the tests.

Ok for trunk?

2014-11-10  Marek Polacek  pola...@redhat.com

* c-c++-common/ubsan/align-7.c: Skip for -flto -fno-fat-lto-objects.
* c-c++-common/ubsan/align-8.c: Likewise.
* g++.dg/ubsan/null-4.C: Likewise.
* g++.dg/ubsan/null-5.C: Likewise.

diff --git gcc/testsuite/c-c++-common/ubsan/align-7.c 
gcc/testsuite/c-c++-common/ubsan/align-7.c
index 4a18d8d..68c9135 100644
--- gcc/testsuite/c-c++-common/ubsan/align-7.c
+++ gcc/testsuite/c-c++-common/ubsan/align-7.c
@@ -1,6 +1,7 @@
 /* Limit this to known non-strict alignment targets.  */
 /* { dg-do run { target { i?86-*-linux* x86_64-*-linux* } } } */
 /* { dg-options -O -fsanitize=alignment -fno-sanitize-recover=alignment 
-fdump-tree-sanopt-details } */
+/* { dg-skip-if  { *-*-* } { -flto -fno-fat-lto-objects } } */
 /* { dg-shouldfail ubsan } */
 
 struct S { int a; char b; long long c; short d[10]; };
@@ -27,6 +28,6 @@ main ()
   return 0;
 }
 
-/* { dg-output \.c:15:\[0-9]*: \[^\n\r]*member access within misaligned 
address 0x\[0-9a-fA-F]* for type 'struct S', which requires \[48] byte 
alignment.* } */
+/* { dg-output \.c:16:\[0-9]*: \[^\n\r]*member access within misaligned 
address 0x\[0-9a-fA-F]* for type 'struct S', which requires \[48] byte 
alignment.* } */
 /* { dg-final { scan-tree-dump-times Optimizing 4 sanopt} } */
 /* { dg-final { cleanup-tree-dump sanopt } } */
diff --git gcc/testsuite/c-c++-common/ubsan/align-8.c 
gcc/testsuite/c-c++-common/ubsan/align-8.c
index b930162..4e43a09 100644
--- gcc/testsuite/c-c++-common/ubsan/align-8.c
+++ gcc/testsuite/c-c++-common/ubsan/align-8.c
@@ -1,6 +1,7 @@
 /* Limit this to known non-strict alignment targets.  */
 /* { dg-do run { target { i?86-*-linux* x86_64-*-linux* } } } */
 /* { dg-options -O -fsanitize=alignment -fsanitize-undefined-trap-on-error 
-fdump-tree-sanopt-details } */
+/* { dg-skip-if  { *-*-* } { -flto -fno-fat-lto-objects } } */
 /* { dg-shouldfail ubsan } */
 
 struct S { int a; char b; long long c; short d[10]; };
diff --git gcc/testsuite/g++.dg/ubsan/null-4.C 
gcc/testsuite/g++.dg/ubsan/null-4.C
index 9cb04ef..55944a4 100644
--- gcc/testsuite/g++.dg/ubsan/null-4.C
+++ gcc/testsuite/g++.dg/ubsan/null-4.C
@@ -1,5 +1,6 @@
 // { dg-do run }
 // { dg-options -O -fsanitize=null -fno-sanitize-recover=null 
-fdump-tree-sanopt-details }
+// { dg-skip-if  { *-*-* } { -flto -fno-fat-lto-objects } }
 // { dg-shouldfail ubsan }
 
 int
diff --git gcc/testsuite/g++.dg/ubsan/null-5.C 
gcc/testsuite/g++.dg/ubsan/null-5.C
index d8e4a68..fbda96f 100644
--- gcc/testsuite/g++.dg/ubsan/null-5.C
+++ gcc/testsuite/g++.dg/ubsan/null-5.C
@@ -1,5 +1,6 @@
 // { dg-do run }
 // { dg-options -O -fsanitize=null -fsanitize-undefined-trap-on-error 
-fdump-tree-sanopt-details }
+// { dg-skip-if  { *-*-* } { -flto -fno-fat-lto-objects } }
 // { dg-shouldfail ubsan }
 
 int

Marek


Re: [PATCH] AIX: Filename-based shared library versioning for libgcc_s

2014-11-10 Thread Michael Haubenwallner

Am 2014-11-07 20:52, schrieb David Edelsohn:
 First, please explicitly copy me on AIX or PowerPC patches sent to 
 gcc-patches.
 
 I don't have a fundamental objection to including this option, but
 note that Richi, Honza and I have discovered that using AIX runtime
 linking option interacts badly with some GCC optimizations and can
 result in applications that hang in a loop.

Feels like adding the aix-soname linking procedure becomes more important:

 All code on AIX is position independent (PIC) by default.  Executables
 and shared libraries essentially are PIE.  Because of this, AIX does
 not provide separate static libraries and one can link statically
 with a shared library.
 
 Creating a library enabled for runtime linking with -G (-brtl), causes
 a lot of problems, including a newly recognized failure mode.  Without
 careful control over AIX symbol export, all global calls with use
 glink code (equivalent to ELF PLTs). This also creates a TOC entry for
 every global call, possibly overflowing the TOC.

About to define careful control over AIX symbol export:
The symbols listed in the import file are those found in the object files
only, not the ones created at linktime (like __GLOBAL*) or from the static
objects found in libc.a. While I do this in libtool from the beginning here,
I have had a helper script wrapping ld to support '--soname=' for non-libtool
packages, where creating the import file from the final shared object also
included static libc-provided symbols, which turned out as dependency pitfall.

While I haven't focussed on nor explicitly tested, I do believe that this
also solves problems with global C++ constructor/destructor call orders.

 But the main problem is GCC uses aliases and functions declared as
 weak to support some C++ features.

This is another reason why I do force runtime linking for our application,
which uses these C++ features while its main target platform is Linux.

 Functions declared weak interact
 badly with shared libraries compiled for AIX runtime linking and
 linked statically.

The aix-soname proposal does not support statically linking shared objects
built with -brtl, but provides lib.a archives either with pure static objects
only (aix-soname=svr4), or with the traditional shared object linked without
-brtl (aix-soname=both).

 This can result in the static binary binding with
 the glink code that loads its own address from the TOC instead of the
 target function, causing endless looping.  Honza made some changes to
 GCC code generation for AIX, but there still are problems and I have
 disabled building libstdc++ enabled for runtime linking.

So as long as shared objects built with -brtl actually work for /shared/ 
linking,
the aix-soname linking procedure seems /necessary/ to support all features.

 libgcc always explicitly creates a static library and uses it for
 static linking.  All shared libraries for AIX that use this scheme
 (through libtool) would have to follow the same convention to create
 both shared and static libraries.  This new option only makes sense if
 it fully emulates SVR4/ELF behavior and always creates both shared .so
 and static .a libraries.

This exactly is what I do in Gentoo Prefix/AIX, with best experience using
gcc-4.2.4 for the moment. As I do provide the complete tool-  library-chain
(like /opt/freeware/), I don't create traditional AIX shared objects at all,
but static only lib.a archives whenever --enable-static is true - which is
the --with-aix-soname=svr4 use case.

Slightly modified the patch to not create the libgcc_s.a symlink with
aix-soname=svr4 now.
And the Makefile target also has to be libgcc_s.so (via SHLIB_EXT) now.

Thanks!
/haubi/
From ab834013e504ddfbbc0a04aca2bd94ef0b49ace5 Mon Sep 17 00:00:00 2001
From: Michael Haubenwallner michael.haubenwall...@salomon.at
Date: Fri, 16 Mar 2012 14:49:20 +0100
Subject: [PATCH] AIX: Filename-based shlib versioning for libgcc_s

2014-11-10  Michael Haubenwallner michael.haubenwall...@ssi-schaefer.com

	(libgcc_s) Optional filename-based shared library versioning on AIX.
	* gcc/doc/install.texi: Describe --with-aix-soname option.
	* Makefile.in (with_aix_soname): Define.
	* config/rs6000/t-slibgcc-aix: Act upon --with-aix-soname option.
	* configure.in: Accept --with-aix-soname=aix|svr4|both option.
	* configure: Recreate.
---
 gcc/doc/install.texi   | 102 +
 libgcc/Makefile.in |   1 +
 libgcc/config/rs6000/t-slibgcc-aix |  82 +++--
 libgcc/configure   |  28 ++
 libgcc/configure.ac|  17 +++
 5 files changed, 214 insertions(+), 16 deletions(-)

diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
index 3df78ff..161f7e5 100644
--- a/gcc/doc/install.texi
+++ b/gcc/doc/install.texi
@@ -1414,6 +1414,102 @@ particularly useful if you intend to use several versions of GCC in
 parallel.  This is currently supported by @samp{libgfortran},
 

[PATCH] Fix PR63798

2014-11-10 Thread Richard Biener

The following patch fixes a latent bug uncovered by stmt folding
that expansion of FMA_EXPR didn't consider the multiplication
commutative when looking for feeding negates.

Bootstrap  regtest pending.

Richard.

2014-11-10  Richard Biener  rguent...@suse.de

PR middle-end/63798
* expr.c (expand_expr_real_2): When expanding FMA_EXPRs
properly treat the embedded multiplication as commutative
when looking for feeding negates.

Index: gcc/expr.c
===
--- gcc/expr.c  (revision 217281)
+++ gcc/expr.c  (working copy)
@@ -8621,6 +8621,19 @@ expand_expr_real_2 (sepops ops, rtx targ
  }
 
def0 = get_def_for_expr (treeop0, NEGATE_EXPR);
+   /* The multiplication is commutative - look at its 2nd operand
+  if the first isn't fed by a negate.  */
+   if (!def0)
+ {
+   def0 = get_def_for_expr (treeop1, NEGATE_EXPR);
+   /* Swap operands if the 2nd operand is fed by a negate.  */
+   if (def0)
+ {
+   tree tem = treeop0;
+   treeop0 = treeop1;
+   treeop1 = tem;
+ }
+ }
def2 = get_def_for_expr (treeop2, NEGATE_EXPR);
 
op0 = op2 = NULL;


Re: [PATCH] Fix a few UNRESOLVEDs

2014-11-10 Thread Jakub Jelinek
On Mon, Nov 10, 2014 at 10:41:36AM +0100, Marek Polacek wrote:
 This fixes a few UNRESOLVEDs because I forgot to skip -fno-fat-lto-objects
 when I introduced the tests.
 
 Ok for trunk?
 
 2014-11-10  Marek Polacek  pola...@redhat.com
 
   * c-c++-common/ubsan/align-7.c: Skip for -flto -fno-fat-lto-objects.
   * c-c++-common/ubsan/align-8.c: Likewise.
   * g++.dg/ubsan/null-4.C: Likewise.
   * g++.dg/ubsan/null-5.C: Likewise.

Ok, thanks.

Jakub


[PATCH] IPA ICF fallout: disable IPA ICF for a test

2014-11-10 Thread Martin Liška

Hello.

In gcc.dg/tree-ssa/ldist-19.c, there's a pair of functions (one with 'char' and 
second with 'unsigned char'). These two functions are merged by IPA ICF on 
targets that where 'char' == 'unsigned char'. So that it would be easier to 
disable the optimization.

Ready for trunk?

Thanks,
Martin
gcc/testsuite/ChangeLog:

2014-11-10  Martin Liska  mli...@suse.cz

* gcc.dg/tree-ssa/ldist-19.c: ICF is disabled
for the test because of default char signedness
on powerpc64 target.
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ldist-19.c b/gcc/testsuite/gcc.dg/tree-ssa/ldist-19.c
index 8ea9cea..9ab681f 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ldist-19.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ldist-19.c
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options -O3 -fdump-tree-ldist-details } */
+/* { dg-options -O3 -fno-ipa-icf -fdump-tree-ldist-details } */
 
 struct Foo
 {


[PATCH][15/n] Merge from match-and-simplify, last conversion pattern

2014-11-10 Thread Richard Biener

This merges the last conversion pattern from tree-ssa-forwprop.c.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.

Richard.

2014-11-10  Richard Biener  rguent...@suse.de

* match.pd: Implement pattern from simplify_conversion_from_bitmask.
* tree-ssa-forwprop.c (simplify_conversion_from_bitmask): Remove.
(pass_forwprop::execute): Do not call simplify_conversion_from_bitmask.

Index: trunk/gcc/match.pd
===
*** trunk.orig/gcc/match.pd 2014-11-10 10:15:49.325550358 +0100
--- trunk/gcc/match.pd  2014-11-10 10:17:12.413546722 +0100
*** along with GCC; see the file COPYING3.
*** 431,433 
--- 431,445 
(unsigned) significand_size (TYPE_MODE (inter_type))
= inside_prec - !inside_unsignedp)
  (convert @0))
+ 
+ /* If we have a narrowing conversion to an integral type that is fed by a
+BIT_AND_EXPR, we might be able to remove the BIT_AND_EXPR if it merely
+masks off bits outside the final type (and nothing else).  */
+ (simplify
+   (convert (bit_and @0 INTEGER_CST@1))
+   (if (INTEGRAL_TYPE_P (type)
+ INTEGRAL_TYPE_P (TREE_TYPE (@0))
+ TYPE_PRECISION (type) = TYPE_PRECISION (TREE_TYPE (@0))
+ operand_equal_p (@1, build_low_bits_mask (TREE_TYPE (@1),
+   TYPE_PRECISION (type)), 0))
+(convert @0)))
Index: trunk/gcc/tree-ssa-forwprop.c
===
*** trunk.orig/gcc/tree-ssa-forwprop.c  2014-11-10 10:15:49.60343 +0100
--- trunk/gcc/tree-ssa-forwprop.c   2014-11-10 10:20:47.391537314 +0100
*** bailout:
*** 1214,1291 
  }
  
  
- /* GSI_P points to a statement which performs a narrowing integral
-conversion.
- 
-Look for cases like:
- 
-  t = x  c;
-  y = (T) t;
- 
-Turn them into:
- 
-  t = x  c;
-  y = (T) x;
- 
-If T is narrower than X's type and C merely masks off bits outside
-of (T) and nothing else.
- 
-Normally we'd let DCE remove the dead statement.  But no DCE runs
-after the last forwprop/combine pass, so we remove the obviously
-dead code ourselves.
- 
-Return TRUE if a change was made, FALSE otherwise.  */
- 
- static bool 
- simplify_conversion_from_bitmask (gimple_stmt_iterator *gsi_p)
- {
-   gimple stmt = gsi_stmt (*gsi_p);
-   gimple rhs_def_stmt = SSA_NAME_DEF_STMT (gimple_assign_rhs1 (stmt));
- 
-   /* See if the input for the conversion was set via a BIT_AND_EXPR and
-  the only use of the BIT_AND_EXPR result is the conversion.  */
-   if (is_gimple_assign (rhs_def_stmt)
-gimple_assign_rhs_code (rhs_def_stmt) == BIT_AND_EXPR
-has_single_use (gimple_assign_lhs (rhs_def_stmt)))
- {
-   tree rhs_def_operand1 = gimple_assign_rhs1 (rhs_def_stmt);
-   tree rhs_def_operand2 = gimple_assign_rhs2 (rhs_def_stmt);
-   tree lhs_type = TREE_TYPE (gimple_assign_lhs (stmt));
- 
-   /* Now verify suitability of the BIT_AND_EXPR's operands.
-The first must be an SSA_NAME that we can propagate and the
-second must be an integer constant that masks out all the
-bits outside the final result's type, but nothing else.  */
-   if (TREE_CODE (rhs_def_operand1) == SSA_NAME
-  ! SSA_NAME_OCCURS_IN_ABNORMAL_PHI (rhs_def_operand1)
-  TREE_CODE (rhs_def_operand2) == INTEGER_CST
-  operand_equal_p (rhs_def_operand2,
- build_low_bits_mask (TREE_TYPE (rhs_def_operand2),
-  TYPE_PRECISION (lhs_type)),
-  0))
-   {
- /* This is an optimizable case.  Replace the source operand
-in the conversion with the first source operand of the
-BIT_AND_EXPR.  */
- gimple_assign_set_rhs1 (stmt, rhs_def_operand1);
- stmt = gsi_stmt (*gsi_p);
- update_stmt (stmt);
- 
- /* There is no DCE after the last forwprop pass.  It's
-easy to clean up the first order effects here.  */
- gimple_stmt_iterator si;
- si = gsi_for_stmt (rhs_def_stmt);
- gsi_remove (si, true);
- fwprop_invalidate_lattice (gimple_get_lhs (rhs_def_stmt));
- release_defs (rhs_def_stmt);
- return true;
-   }
- }
- 
-   return false;
- }
- 
- 
  /* Helper function for simplify_gimple_switch.  Remove case labels that
 have values outside the range of the new type.  */
  
--- 1214,1219 
*** pass_forwprop::execute (function *fun)
*** 2940,2963 
 maybe_clean_or_replace_eh_stmt (stmt, stmt))
  bitmap_set_bit (to_purge, bb-index);
  }
-   else if (CONVERT_EXPR_CODE_P (code)
-|| code == FLOAT_EXPR
-|| code == FIX_TRUNC_EXPR)
- {

Re: PATCH: PR bootstrap/63784: [5 Regression] profiledbootstrap failure with bootstrap-lto

2014-11-10 Thread Richard Biener
On Sun, Nov 9, 2014 at 5:46 PM, H.J. Lu hongjiu...@intel.com wrote:
 Hi,

 r216964 disables bootstrap for libcc1 which exposed 2 things:

 1. libcc1 isn't compiled with LTO even when GCC is configured with
 --with-build-config=bootstrap-lto.  It may be intentional since
 libcc1 is disabled for bootstrap.
 2. -fPIC isn't used to created libcc1.so, which is OK if libcc1 is
 compiled with LTO which remembers PIC option.

Why is this any special to LTO?  If it is then it looks like a LTO
(driver) issue to me?  Why are we linking the pic libibterty into
a non-pic libcc1?

Richard.

 libiberty is bootstrapped with LTO.  When libcc1 isn't compiled with
 LTO, we are creating libcc1.so without -fPIC, which leads to linker
 failure when linking with slim-lto libiberty.  This patch from

 https://gcc.gnu.org/ml/gcc-patches/2012-09/msg00991.html

 adds -fPIC to -shared so that -fPIC is always used to create shared
 object.  Tested on Linux/x86-64.  OK for trunk?

 Thanks.


 H.J.
 ---
 2014-11-09  Markus Trippelsdorf  mar...@trippelsdorf.de

 PR bootstrap/63784
 * libtool.m4: Add $pic_flag with -shared.

 boehm-gc/

 2014-11-09  H.J. Lu  hongjiu...@intel.com

 PR bootstrap/63784
 * configure: Regenerated.

 gcc/

 2014-11-09  H.J. Lu  hongjiu...@intel.com

 PR bootstrap/63784
 * configure: Regenerated.

 libatomic/

 2014-11-09  H.J. Lu  hongjiu...@intel.com

 PR bootstrap/63784
 * configure: Regenerated.

 libbacktrace/

 2014-11-09  H.J. Lu  hongjiu...@intel.com

 PR bootstrap/63784
 * configure: Regenerated.

 libcc1/

 2014-11-09  H.J. Lu  hongjiu...@intel.com

 PR bootstrap/63784
 * configure: Regenerated.

 libcilkrts/

 2014-11-09  H.J. Lu  hongjiu...@intel.com

 PR bootstrap/63784
 * configure: Regenerated.

 libffi/

 2014-11-09  H.J. Lu  hongjiu...@intel.com

 PR bootstrap/63784
 * configure: Regenerated.

 libgfortran/

 2014-11-09  H.J. Lu  hongjiu...@intel.com

 PR bootstrap/63784
 * configure: Regenerated.

 libgomp/

 2014-11-09  H.J. Lu  hongjiu...@intel.com

 PR bootstrap/63784
 * configure: Regenerated.

 libitm/

 2014-11-09  H.J. Lu  hongjiu...@intel.com

 PR bootstrap/63784
 * configure: Regenerated.

 libjava/

 2014-11-09  H.J. Lu  hongjiu...@intel.com

 PR bootstrap/63784
 * configure: Regenerated.

 libjava/classpath/

 2014-11-09  H.J. Lu  hongjiu...@intel.com

 PR bootstrap/63784
 * configure: Regenerated.

 libobjc/

 2014-11-09  H.J. Lu  hongjiu...@intel.com

 PR bootstrap/63784
 * configure: Regenerated.

 libquadmath/

 2014-11-09  H.J. Lu  hongjiu...@intel.com

 PR bootstrap/63784
 * configure: Regenerated.

 libsanitizer/

 2014-11-09  H.J. Lu  hongjiu...@intel.com

 PR bootstrap/63784
 * configure: Regenerated.

 libssp/

 2014-11-09  H.J. Lu  hongjiu...@intel.com

 PR bootstrap/63784
 * configure: Regenerated.

 libstdc++-v3/

 2014-11-09  H.J. Lu  hongjiu...@intel.com

 PR bootstrap/63784
 * configure: Regenerated.

 libvtv/

 2014-11-09  H.J. Lu  hongjiu...@intel.com

 PR bootstrap/63784
 * configure: Regenerated.

 lto-plugin/

 2014-11-09  H.J. Lu  hongjiu...@intel.com

 PR bootstrap/63784
 * configure: Regenerated.

 diff --git a/ChangeLog b/ChangeLog
 index 5c7f649..25bc026 100644
 --- a/ChangeLog
 +++ b/ChangeLog
 @@ -1,3 +1,8 @@
 +2014-11-09  Markus Trippelsdorf  mar...@trippelsdorf.de
 +
 +   PR bootstrap/63784
 +   * libtool.m4: Add $pic_flag with -shared.
 +
  2014-10-31  Jakub Jelinek  ja...@redhat.com

 * Makefile.def (libcc1): Remove bootstrap=true;.
 diff --git a/boehm-gc/ChangeLog b/boehm-gc/ChangeLog
 index 1c8cbda..7a2750f 100644
 --- a/boehm-gc/ChangeLog
 +++ b/boehm-gc/ChangeLog
 @@ -1,3 +1,8 @@
 +2014-11-09  H.J. Lu  hongjiu...@intel.com
 +
 +   PR bootstrap/63784
 +   * configure: Regenerated.
 +
  2014-10-23  Rainer Orth  r...@cebitec.uni-bielefeld.de

 * include/gc.h [(sparc || __sparc)  sun] (GC_INIT): Remove
 diff --git a/boehm-gc/configure b/boehm-gc/configure
 index 025003c..efaf7b8 100755
 --- a/boehm-gc/configure
 +++ b/boehm-gc/configure
 @@ -9081,7 +9081,7 @@ _LT_EOF
if $LD --help 21 | $EGREP ': supported targets:.* elf'  /dev/null \
   test $tmp_diet = no
then
 -   tmp_addflag=
 +   tmp_addflag=' $pic_flag'
 tmp_sharedflag='-shared'
 case $cc_basename,$host_cpu in
  pgcc*) # Portland Group C compiler
 @@ -12019,8 +12019,8 @@ with_gnu_ld=$lt_cv_prog_gnu_ld
# Check if GNU C++ uses GNU ld as the underlying linker, since the
# archiving commands below assume that GNU ld is being used.
if test $with_gnu_ld = yes; then
 -archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs 
 $deplibs 

Re: [PATCH][Revisedx2] Fix PR63750

2014-11-10 Thread Richard Biener
On Sun, Nov 9, 2014 at 5:57 PM, Jack Howarth howarth.at@gmail.com wrote:
 Iain,
  It doesn't look like it will be that simple. If I replace the
 proposed patches with a change like...

 Index: gcc/system.h
 ===
 --- gcc/system.h(revision 217238)
 +++ gcc/system.h(working copy)
 @@ -194,6 +194,13 @@ extern int fprintf_unlocked (FILE *, con
  #undef fread_unlocked
  #undef fwrite_unlocked

 +/* Include string before safe-ctype.h to avoid avoid GCC poisoning
 +the ctype macros through safe-ctype.h */
 +
 +#ifdef __cplusplus
 +# include string
 +#endif
 +

Indeed string is a system header and should not have been included
from tree-chkp.c but system.h.

Richard.

  /* There are an extraordinary number of issues with ctype.h.
 The last straw is that it varies with the locale.  Use libiberty's
 replacement instead.  */

 The bootstrap fails at a new place with...

 make[3]: Entering directory
 '/sw/src/fink.build/gcc50-5.0.0-1000/darwin_objdir/gcc'
 g++ -c   -g  -DIN_GCC-fno-exceptions -fno-rtti
 -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings
 -Wcast-qual -Wno-format -Wmissing-format-attribute
 -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros
 -Wno-overlength-strings -fno-common  -DHAVE_CONFIG_H -I. -I.
 -I../../gcc-5.0-20141107/gcc -I../../gcc-5.0-20141107/gcc/.
 -I../../gcc-5.0-20141107/gcc/../include
 -I../../gcc-5.0-20141107/gcc/../libcpp/include -I/sw/include
 -I/sw/include  -I../../gcc-5.0-20141107/gcc/../libdecnumber
 -I../../gcc-5.0-20141107/gcc/../libdecnumber/dpd -I../libdecnumber
 -I../../gcc-5.0-20141107/gcc/../libbacktrace -DCLOOG_INT_GMP
 -I/sw/include -DCLOOG_INT_GMP -I/sw/include -I/sw/include -o
 simplify-rtx.o -MT simplify-rtx.o -MMD -MP -MF
 ./.deps/simplify-rtx.TPo ../../gcc-5.0-20141107/gcc/simplify-rtx.c
 clang: warning: treating 'c' input as 'c++' when in C++ mode, this
 behavior is deprecated
 In file included from ../../gcc-5.0-20141107/gcc/simplify-rtx.c:23:
 ../../gcc-5.0-20141107/gcc/coretypes.h:62:1: warning: class 'rtx_def'
 was previously declared as a struct [-Wmismatched-tags]
 class rtx_def;
 ^
 ../../gcc-5.0-20141107/gcc/coretypes.h:55:8: note: previous use is here
 struct rtx_def;
^
 In file included from ../../gcc-5.0-20141107/gcc/simplify-rtx.c:25:
 In file included from ../../gcc-5.0-20141107/gcc/rtl.h:27:
 In file included from ../../gcc-5.0-20141107/gcc/real.h:25:
 ../../gcc-5.0-20141107/gcc/wide-int.h:370:3: warning: extraneous
 template parameter list in template specialization
   template 
   ^~~
 ../../gcc-5.0-20141107/gcc/wide-int.h:377:3: warning: extraneous
 template parameter list in template specialization
   template 
   ^~~
 ../../gcc-5.0-20141107/gcc/wide-int.h:384:3: warning: extraneous
 template parameter list in template specialization
   template 
   ^~~
 ../../gcc-5.0-20141107/gcc/wide-int.h:394:3: warning: extraneous
 template parameter list in template specialization
   template 
   ^~~
 ../../gcc-5.0-20141107/gcc/wide-int.h:401:3: warning: extraneous
 template parameter list in template specialization
   template 
   ^~~
 ../../gcc-5.0-20141107/gcc/wide-int.h:411:3: warning: extraneous
 template parameter list in template specialization
   template 
   ^~~
 ../../gcc-5.0-20141107/gcc/wide-int.h:422:3: warning: extraneous
 template parameter list in template specialization
   template 
   ^~~
 ../../gcc-5.0-20141107/gcc/wide-int.h:886:3: warning: extraneous
 template parameter list in template specialization
   template 
   ^~~
 ../../gcc-5.0-20141107/gcc/wide-int.h:965:3: warning: extraneous
 template parameter list in template specialization
   template 
   ^~~
 ../../gcc-5.0-20141107/gcc/wide-int.h:1127:1: warning:
 'fixed_wide_int_storage' defined as a class template here but
 previously declared as a struct template
   [-Wmismatched-tags]
 class GTY(()) fixed_wide_int_storage
 ^
 ../../gcc-5.0-20141107/gcc/wide-int.h:286:18: note: did you mean class here?
 template int N struct fixed_wide_int_storage;
  ^~
  class
 ../../gcc-5.0-20141107/gcc/wide-int.h:1152:3: warning: extraneous
 template parameter list in template specialization
   template 
   ^~~
 In file included from ../../gcc-5.0-20141107/gcc/simplify-rtx.c:25:
 In file included from ../../gcc-5.0-20141107/gcc/rtl.h:28:
 In file included from ../../gcc-5.0-20141107/gcc/vec.h:44:
 ../../gcc-5.0-20141107/gcc/ggc.h:315:15: warning: struct 'rtx_def' was
 previously declared as a class [-Wmismatched-tags]
 static inline struct rtx_def *
   ^
 ../../gcc-5.0-20141107/gcc/coretypes.h:62:7: note: previous use is here
 class rtx_def;
   ^
 In file included from ../../gcc-5.0-20141107/gcc/simplify-rtx.c:25:
 In file included from ../../gcc-5.0-20141107/gcc/rtl.h:28:
 In file included from 

Re: RFC: Update ISL under gcc/infrastructure/ ? // Remove CLooG?

2014-11-10 Thread Tobias Grosser

On 10.11.2014 10:03, Roman Gareev wrote:

The patch looks great. The only piece I think we missed is the
fgraphite-code-generator flag. I would propose to remove it as well in this
commit, as it does not have any effect any more.


In this case, we’ll also have to change tests which use
fgraphite-code-generator flag (isl-ast-gen-blocks-1.c,
isl-ast-gen-blocks-2.c, isl-ast-gen-blocks-3.c,
isl-ast-gen-blocks-4.c, isl-ast-gen-if-1.c, isl-ast-gen-if-2.c,
isl-ast-gen-single-loop-1.c, isl-ast-gen-single-loop-2.c,
isl-ast-gen-user-1.c, isl-codegen-loop-dumping.c). Maybe we should do
this in the next patch?


Sure. We should drop the flag in these test cases.

This seems to make sense, as they now test something different and the 
flag removal would reflect this.


I personally would include this in the same patch. Would this be difficult?

Cheers,
Tobias



Re: [PATCH] Fix PR 63748

2014-11-10 Thread Richard Biener
On Mon, Nov 10, 2014 at 2:33 AM, Patrick Palka patr...@parcs.ath.cx
wrote:
 PR 63748 reports a false-positive uninitialized warning under the
 presence of abnormal edges.  The statements for which the uninitialized
 warnings are emitted all look like:

   buf_117(ab) = buf_317(D)(ab);

 This PR is similar to PR 57287 which also reports false-positive
 uninitialized warnings under the presence of abnormal edges.  That PR
 fixed the reported issue by allowing to propagate default definitions
 which appear in abnormal PHI nodes.  That is, it allowed propagating the
 following kinds of copies:

   buf_24 = buf_16(D)(ab);

 But it still did not allow propagating copies whose destination operand
 occurs in an abnormal PHI node.  To fix PR 63748, this patch extends the
 fix to PR 57287 to allow propagating such copies too.

Thus you allow

   buf_24(ab) = buf_16(D)(ab);

to be propagated.

This is only valid if you propagate into all uses of buf_24(ab) as otherwise
you create overlapping life-ranges with the default definition.  Which
may be a moot issue now as Marcs patch to ignore undefined SSA names
in the out-of-SSA live compute, thus ...

 Full bootstrap + regtesting on x86_64-unknown-linux-gnu is in progress.
 Is this patch OK if testing succeeds with no new regressions?

... ok.  But please watch for fallout.

Thanks,
Richard.

 2014-11-10  Patrick Palka  ppa...@gcc.gnu.org

 gcc/
 PR middle-end/63748
 * tree-ssa-propagate.c (may_propagate_copy): Allow propagating
 SSA copies whose source and destination names both occur in
 abnormal edges.

 gcc/testsuite/
 PR middle-end/63748
 * gcc.dg/pr63748.c: New testcase.
 ---
  gcc/testsuite/gcc.dg/pr63748.c | 36 
  gcc/tree-ssa-propagate.c   | 27 +++
  2 files changed, 51 insertions(+), 12 deletions(-)
  create mode 100644 gcc/testsuite/gcc.dg/pr63748.c

 diff --git a/gcc/testsuite/gcc.dg/pr63748.c b/gcc/testsuite/gcc.dg/pr63748.c
 new file mode 100644
 index 000..2e50445
 --- /dev/null
 +++ b/gcc/testsuite/gcc.dg/pr63748.c
 @@ -0,0 +1,36 @@
 +/* { dg-do compile } */
 +/* { dg-options -O2 -Wall } */
 +
 +#include setjmp.h
 +
 +jmp_buf *alloc_jmp_buf ();
 +int foo (void *);
 +
 +int
 +test (int op, int noside)
 +{
 +  void *argvec = 0;
 +
 +  if (op)
 +{
 +  jmp_buf *buf = alloc_jmp_buf (); /* { dg-bogus uninitialized } */
 +  setjmp (*buf);
 +
 +  if (noside)
 +goto nosideret;
 +
 +do_call_it:
 +
 +  if (noside)
 +goto nosideret;
 +
 +  return foo (argvec);
 +}
 +
 +  argvec = __builtin_alloca (1);
 +  goto do_call_it;
 +
 +nosideret:
 +  return 1;
 +}
 +
 diff --git a/gcc/tree-ssa-propagate.c b/gcc/tree-ssa-propagate.c
 index 9f4d381..9e61baf 100644
 --- a/gcc/tree-ssa-propagate.c
 +++ b/gcc/tree-ssa-propagate.c
 @@ -1275,21 +1275,24 @@ may_propagate_copy (tree dest, tree orig)
tree type_d = TREE_TYPE (dest);
tree type_o = TREE_TYPE (orig);

 -  /* If ORIG flows in from an abnormal edge, it cannot be propagated.  */
 +  /* If ORIG is a default definition which flows in from an abnormal edge
 + then the copy can be propagated.  It is important that we do so to avoid
 + uninitialized regular copies.  */
if (TREE_CODE (orig) == SSA_NAME
 SSA_NAME_OCCURS_IN_ABNORMAL_PHI (orig)
 -  /* If it is the default definition and an automatic variable then
 - we can though and it is important that we do to avoid
 -uninitialized regular copies.  */
 -   !(SSA_NAME_IS_DEFAULT_DEF (orig)
 -   (SSA_NAME_VAR (orig) == NULL_TREE
 -  || TREE_CODE (SSA_NAME_VAR (orig)) == VAR_DECL)))
 +   SSA_NAME_IS_DEFAULT_DEF (orig)
 +   (SSA_NAME_VAR (orig) == NULL_TREE
 + || TREE_CODE (SSA_NAME_VAR (orig)) == VAR_DECL))
 +;
 +  /* Otherwise if ORIG just flows in from an abnormal edge then the copy 
 cannot
 + be propagated.  */
 +  else if (TREE_CODE (orig) == SSA_NAME
 +   SSA_NAME_OCCURS_IN_ABNORMAL_PHI (orig))
  return false;
 -
 -  /* If DEST is an SSA_NAME that flows from an abnormal edge, then it
 - cannot be replaced.  */
 -  if (TREE_CODE (dest) == SSA_NAME
 -   SSA_NAME_OCCURS_IN_ABNORMAL_PHI (dest))
 +  /* Similarly if DEST flows in from an abnormal edge then the copy cannot be
 + propagated.  */
 +  else if (TREE_CODE (dest) == SSA_NAME
 +   SSA_NAME_OCCURS_IN_ABNORMAL_PHI (dest))
  return false;

/* Do not copy between types for which we *do* need a conversion.  */
 --
 2.2.0.rc0.18.ga1ad247



Re: [PATCH GCC]Fix checking on MAX_PENDING_LIST_LENGTH

2014-11-10 Thread Richard Biener
On Mon, Nov 10, 2014 at 10:16 AM, Bin Cheng bin.ch...@arm.com wrote:
 Hi,
 There is parameter max-pending-list-length in gcc scheduler, but the
 parameter is checked using greater than condition.  As a result, the real
 max pending list length is actually max-pending-list-length + 1.  This
 patch fixes this by using = rather than  comparison operator.  Though
 it is kind of nit-picking, I want to change this: a) it breaks sched-fusion
 because the 33rd couldn't be paired; b) when sched-fusion tries to sort many
 consecutive stores, it breaks dcache line alignment at large probability.  I
 mean without cache sensitive optimizer, GCC breaks dcache line alignment
 randomly, but 33 is definitely worse than 32.  Of course, this only happens
 in very restricted case.

 Bootstrap and test on x86_64.  Is it OK?

Ok.

Thanks,
Richard.

 2014-11-10  Bin Cheng  bin.ch...@arm.com

 * sched-deps.c (sched_analyze_1): Check pending list if it is not
 less than MAX_PENDING_LIST_LENGTH.
 (sched_analyze_2, sched_analyze_insn, deps_analyze_insn): Ditto.


Re: [PATCH] IPA ICF fallout: disable IPA ICF for a test

2014-11-10 Thread Richard Biener
On Mon, Nov 10, 2014 at 11:51 AM, Martin Liška mli...@suse.cz wrote:
 Hello.

 In gcc.dg/tree-ssa/ldist-19.c, there's a pair of functions (one with 'char'
 and second with 'unsigned char'). These two functions are merged by IPA ICF
 on targets that where 'char' == 'unsigned char'. So that it would be easier
 to disable the optimization.

 Ready for trunk?

Ok.

Thanks,
Richard.

 Thanks,
 Martin


Re: [PATCH] Fix PR 63748

2014-11-10 Thread Eric Botcazou
  Full bootstrap + regtesting on x86_64-unknown-linux-gnu is in progress.
  Is this patch OK if testing succeeds with no new regressions?
 
 ... ok.  But please watch for fallout.

I'd do a bootstrap with Ada enabled, the Ada compiler is the only serious user 
of abnormal edges in GIMPLE on Linux platforms.

-- 
Eric Botcazou


Re: [PATCH] Fix PR63798

2014-11-10 Thread Václav Zeman
On 10 November 2014 10:55, Richard Biener wrote:


 The following patch fixes a latent bug uncovered by stmt folding
 that expansion of FMA_EXPR didn't consider the multiplication
 commutative when looking for feeding negates.

 Bootstrap  regtest pending.

 Richard.

 2014-11-10  Richard Biener  rguent...@suse.de

 PR middle-end/63798
 * expr.c (expand_expr_real_2): When expanding FMA_EXPRs
 properly treat the embedded multiplication as commutative
 when looking for feeding negates.

 Index: gcc/expr.c
 ===
 --- gcc/expr.c  (revision 217281)
 +++ gcc/expr.c  (working copy)
 @@ -8621,6 +8621,19 @@ expand_expr_real_2 (sepops ops, rtx targ
   }

 def0 = get_def_for_expr (treeop0, NEGATE_EXPR);
 +   /* The multiplication is commutative - look at its 2nd operand
 +  if the first isn't fed by a negate.  */
 +   if (!def0)
 + {
 +   def0 = get_def_for_expr (treeop1, NEGATE_EXPR);
 +   /* Swap operands if the 2nd operand is fed by a negate.  */
 +   if (def0)
 + {
 +   tree tem = treeop0;
 +   treeop0 = treeop1;
 +   treeop1 = tem;

What about using std::swap() maybe?

 + }
 + }
 def2 = get_def_for_expr (treeop2, NEGATE_EXPR);

 op0 = op2 = NULL;


-- 
VZ


Re: [RFC] Elimination of zext/sext - type promotion pass

2014-11-10 Thread Richard Biener
On Mon, Nov 10, 2014 at 12:29 AM, Kugan
kugan.vivekanandara...@linaro.org wrote:

 Well - the best way would be to expose the target specifics to GIMPLE
 at some point in the optimization pipeline.  My guess would be that it's
 appropriate after loop optimizations (but maybe before induction variable
 optimization).

 That is, have a pass that applies register promotion to all SSA names
 in the function, inserting appropriate truncations and extensions.  That
 way you'd never see (set (subreg...) on RTL.  The VRP and DOM
 passes running after that pass would then be able to aggressively
 optimize redundant truncations and extensions.

 Effects on debug information are to be considered.  You can change
 the type of SSA names in-place but you don't want to do that for
 user DECLs (and we can't have the SSA name type and its DECL
 type differ - and not sure if we might want to lift that restriction).


 Thanks for the comments. Here is a prototype patch that implements a
 type promotion pass. This pass records SSA variables that will have
 values in higher bits (than the original type precision) if promoted and
 uses this information in inserting appropriate truncations and
 extensions. This pass also classifies some of the stmts that sets ssa's
 to be unsafe to promote. Here is a gimple difference for the type
 promotion as compared to previous dump for a testcase.

Note that while GIMPLE has a way to zero-extend (using BIT_AND_EXPR)
it has no convenient way to sign-extend other than truncating to a signed
(non-promoted) type and then extending to the promoted type.  Thus
I think such pass should be accompanied with a new tree code,
SEXT_EXPR.  Otherwise we end up with spurious un-promoted
signed types which later optimizations may be confused about.

Not sure if that is the actual issue though.

Instead op prmt and prmtn I'd spell out promote and tree-type-prmtn
should be gimple-ssa-type-promote.c.  In the end all targets with
non-trivial PROMOTE_MODE should run the pass as a lowering step
so it should be enabled even at -O0 (and not disablable).

I'd definitely run the pass _after_ pass_lower_vector_ssa (and in the
end I'd like to run it before IVOPTs ... which means moving IVOPTs
later, after VRP which should be the pass optimizing away some of
the extensions).

In get_promoted_type I don't understand why you preserve qualifiers.
Also even for targets without PROMOTE_MODE it may be
beneficial to expose truncations required by expanding bit-precision
arithmetic earlier (that is, if !PROMOTE_MODE at least promote
to GET_MODE_PRECISION (TYPE_MODE (type))).  A testcase
for that is for example

struct { long i : 33; long j : 33; } a;
return a.i + a.j;

where bitfields of type  int do not promote so you get a
33 bit add which we expand to a 64bit add plus a sign-extension
(and nothing optimizes that later usually).

insert_next_bb sounds like you want to use insert_on_edge
somewhere.

in assign_rhs_promotable_p you handle comparisons special
but the ternary COND_EXPR and VEC_COND_EXPR can have
comparisons embedded in their first operand.  The comment
confuses me though - with proper sign- or zero-extensions inserted
you should be able to promote them anyway?

You seem to miss that a GIMPLE_ASSIGN can have 3 operands
in promote_cst_in_stmt as well.

In promote_assign_stmt_use I consider a default: case that ends
up doing nothing dangerous ;)  Please either use gcc_unreachable ()
or do the safe thing (fix = true;?).  You seem to be working with
a lattice of some kind - fixing up stmt uses the way you do - walking
over immediate uses - is not very cache friendly.  Why not use
a lattice for this - record promoted vars to be used for old SSA names
and walk over all stmts instead, replacing SSA uses on them?
Btw, you don't need to call update_stmt if you SET_USE and not
replace an SSA name with a constant.

You seem to fix with a single stmt but I don't see where you insert
zero- or sign-extensions for ssa_overflows_p cases?

Note that at least for SSA names with !SSA_NAME_VAR (thus
anonymous vars) you want to do a cheaper promotion by not
allocating a new SSA name but simply fixing its type by
assigning to its TREE_TYPE.   For SSA names with SSA_NAME_VAR
there is of course debug-info to consider and thus doing what you
do is better (but probably still will wreck debuginfo?).

GIMPLE_NOPs are not only used for parameters but also uninitialized
uses - for non-parameters you should simply adjust their type.  No
need to fixup their value.

The pass needs more comments.

It looks like you are not promoting all variables but only those
where compensation code (zero-/sign-extensions) is not necessary?

Thanks for trying to work on this.
Richard.

  crc2 (short unsigned int crc, unsigned char data)
  {
unsigned char carry;
unsigned char x16;
unsigned char i;
 -  unsigned char ivtmp_5;
 +  unsigned int _2;
 +  unsigned char _3;
 +  unsigned int _4;
 +  unsigned int _5;
unsigned char _9;
 -  unsigned char 

[PATCH] Plug SSA stmt operand leak

2014-11-10 Thread Richard Biener

The following patch plugs a leak in SSA stmt operands.  finalize_ssa_uses
always frees all old operands and then allocates new ones - but in
freeing the old operands it only inserts the first freed one into
the freelist.  The following patch makes us use the same trick
as free_stmt_operands to link all old uses to the freelist.

As the stmt operands have their own allocator and we dispose
of its memory in one-go (per function) it may not be a too
big deal - but SSA form is live for a lot of functions at the
same time.

I was of course working on sth else here that requires not
throwing away the old uses unconditionally for efficiency
but the patch applies to active branches as well which is
why I am testing the fix anyway.

Bootstrap and regtest running on x86_64-unknown-linux-gnu.

Richard.

2014-11-10  Richard Biener  rguent...@suse.de

* tree-ssa-operands.c (finalize_ssa_uses): Properly put
released operands on the free list.

Index: gcc/tree-ssa-operands.c
===
--- gcc/tree-ssa-operands.c (revision 216973)
+++ gcc/tree-ssa-operands.c (working copy)
@@ -409,9 +410,10 @@ finalize_ssa_uses (struct function *fn,
   /* If there is anything in the old list, free it.  */
   if (old_ops)
 {
-  for (ptr = old_ops; ptr; ptr = ptr-next)
+  for (ptr = old_ops; ptr-next; ptr = ptr-next)
delink_imm_use (USE_OP_PTR (ptr));
-  old_ops-next = gimple_ssa_operands (fn)-free_uses;
+  delink_imm_use (USE_OP_PTR (ptr));
+  ptr-next = gimple_ssa_operands (fn)-free_uses;
   gimple_ssa_operands (fn)-free_uses = old_ops;
 }
 



Re: [PATCH][Revisedx2] Fix PR63750

2014-11-10 Thread Ilya Enkovich
2014-11-10 14:53 GMT+03:00 Richard Biener richard.guent...@gmail.com:
 On Sun, Nov 9, 2014 at 5:57 PM, Jack Howarth howarth.at@gmail.com wrote:
 Iain,
  It doesn't look like it will be that simple. If I replace the
 proposed patches with a change like...

 Index: gcc/system.h
 ===
 --- gcc/system.h(revision 217238)
 +++ gcc/system.h(working copy)
 @@ -194,6 +194,13 @@ extern int fprintf_unlocked (FILE *, con
  #undef fread_unlocked
  #undef fwrite_unlocked

 +/* Include string before safe-ctype.h to avoid avoid GCC poisoning
 +the ctype macros through safe-ctype.h */
 +
 +#ifdef __cplusplus
 +# include string
 +#endif
 +

 Indeed string is a system header and should not have been included
 from tree-chkp.c but system.h.

Since attempt to put it into system.h causes such errors I may just
get rid of string usage in ipa-chkp.c at all.  It's not hardly used.

Ilya


 Richard.

  /* There are an extraordinary number of issues with ctype.h.
 The last straw is that it varies with the locale.  Use libiberty's
 replacement instead.  */

 The bootstrap fails at a new place with...

 make[3]: Entering directory
 '/sw/src/fink.build/gcc50-5.0.0-1000/darwin_objdir/gcc'
 g++ -c   -g  -DIN_GCC-fno-exceptions -fno-rtti
 -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings
 -Wcast-qual -Wno-format -Wmissing-format-attribute
 -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros
 -Wno-overlength-strings -fno-common  -DHAVE_CONFIG_H -I. -I.
 -I../../gcc-5.0-20141107/gcc -I../../gcc-5.0-20141107/gcc/.
 -I../../gcc-5.0-20141107/gcc/../include
 -I../../gcc-5.0-20141107/gcc/../libcpp/include -I/sw/include
 -I/sw/include  -I../../gcc-5.0-20141107/gcc/../libdecnumber
 -I../../gcc-5.0-20141107/gcc/../libdecnumber/dpd -I../libdecnumber
 -I../../gcc-5.0-20141107/gcc/../libbacktrace -DCLOOG_INT_GMP
 -I/sw/include -DCLOOG_INT_GMP -I/sw/include -I/sw/include -o
 simplify-rtx.o -MT simplify-rtx.o -MMD -MP -MF
 ./.deps/simplify-rtx.TPo ../../gcc-5.0-20141107/gcc/simplify-rtx.c
 clang: warning: treating 'c' input as 'c++' when in C++ mode, this
 behavior is deprecated
 In file included from ../../gcc-5.0-20141107/gcc/simplify-rtx.c:23:
 ../../gcc-5.0-20141107/gcc/coretypes.h:62:1: warning: class 'rtx_def'
 was previously declared as a struct [-Wmismatched-tags]
 class rtx_def;
 ^
 ../../gcc-5.0-20141107/gcc/coretypes.h:55:8: note: previous use is here
 struct rtx_def;
^
 In file included from ../../gcc-5.0-20141107/gcc/simplify-rtx.c:25:
 In file included from ../../gcc-5.0-20141107/gcc/rtl.h:27:
 In file included from ../../gcc-5.0-20141107/gcc/real.h:25:
 ../../gcc-5.0-20141107/gcc/wide-int.h:370:3: warning: extraneous
 template parameter list in template specialization
   template 
   ^~~
 ../../gcc-5.0-20141107/gcc/wide-int.h:377:3: warning: extraneous
 template parameter list in template specialization
   template 
   ^~~
 ../../gcc-5.0-20141107/gcc/wide-int.h:384:3: warning: extraneous
 template parameter list in template specialization
   template 
   ^~~
 ../../gcc-5.0-20141107/gcc/wide-int.h:394:3: warning: extraneous
 template parameter list in template specialization
   template 
   ^~~
 ../../gcc-5.0-20141107/gcc/wide-int.h:401:3: warning: extraneous
 template parameter list in template specialization
   template 
   ^~~
 ../../gcc-5.0-20141107/gcc/wide-int.h:411:3: warning: extraneous
 template parameter list in template specialization
   template 
   ^~~
 ../../gcc-5.0-20141107/gcc/wide-int.h:422:3: warning: extraneous
 template parameter list in template specialization
   template 
   ^~~
 ../../gcc-5.0-20141107/gcc/wide-int.h:886:3: warning: extraneous
 template parameter list in template specialization
   template 
   ^~~
 ../../gcc-5.0-20141107/gcc/wide-int.h:965:3: warning: extraneous
 template parameter list in template specialization
   template 
   ^~~
 ../../gcc-5.0-20141107/gcc/wide-int.h:1127:1: warning:
 'fixed_wide_int_storage' defined as a class template here but
 previously declared as a struct template
   [-Wmismatched-tags]
 class GTY(()) fixed_wide_int_storage
 ^
 ../../gcc-5.0-20141107/gcc/wide-int.h:286:18: note: did you mean class here?
 template int N struct fixed_wide_int_storage;
  ^~
  class
 ../../gcc-5.0-20141107/gcc/wide-int.h:1152:3: warning: extraneous
 template parameter list in template specialization
   template 
   ^~~
 In file included from ../../gcc-5.0-20141107/gcc/simplify-rtx.c:25:
 In file included from ../../gcc-5.0-20141107/gcc/rtl.h:28:
 In file included from ../../gcc-5.0-20141107/gcc/vec.h:44:
 ../../gcc-5.0-20141107/gcc/ggc.h:315:15: warning: struct 'rtx_def' was
 previously declared as a class [-Wmismatched-tags]
 static inline struct rtx_def *
   ^
 ../../gcc-5.0-20141107/gcc/coretypes.h:62:7: note: previous use 

Re: [PATCH 7/8] Model cache auto-prefetcher in scheduler

2014-11-10 Thread Maxim Kuvyrkov
On Oct 21, 2014, at 8:06 AM, Maxim Kuvyrkov maxim.kuvyr...@linaro.org wrote:

 Hi,
 
 This patch adds auto-prefetcher modeling to GCC scheduler.  The 
 auto-prefetcher model is currently enabled only for ARM Cortex-A15, since 
 this is the only CPU that I know of to have the hardware auto-prefetcher unit.
 
 The documentation on the auto-prefetcher is very sparse, and all I have are 
 my empirical studies and a short note in Cortex-A15 manual (search for L2 
 cache auto-prefether).  This patch, therefore, implements a very abstract 
 model that makes scheduler prefer mem_op (base+8); mem_op (base+12) over 
 mem_op (base+12); mem_op (base+8).  In other words, memory operations are 
 tried to be issued in order of increasing memory offsets.
 
 The auto-prefetcher model implementation is based on max_issue mutlipass 
 lookahead scheduling, and its guard hook.  The guard hook examines contents 
 of the ready list and the queue, and, if it finds instructions with lower 
 memory offsets, marks instructions with higher memory offset as unavailable 
 for immediate scheduling.
 
 This patch has been in works since beginning of the year, and many of my 
 previous scheduler cleanup patches were to prepare the infrastructure for 
 this feature. 
 
 Ramana, this change requires benchmarking, which I can't easily do at the 
 moment.  I would appreciate any benchmarking results that you can share.  In 
 particular, the value of PARAM_SCHED_AUTOPREF_QUEUE_DEPTH needs to be 
 tuned/confirmed for Cortex-A15.
 
 At the moment the parameter is set to 2, which means that the autopref 
 model will look through ready list and 1-stall queue in search of relevant 
 instructions.  Values of -1 (disable autopref), 0 (use autopref only in 
 rank_for_schedule), 1 (look through ready list), 2 (look through ready list 
 and 1-stall queue), and 3 (look through ready list and 2-stall queue) should 
 be considered and benchmarked.
 
 Bootstrapped on x86_64-linux-gnu and regtested on arm-linux-gnueaihf and 
 aarch64-linux-gnu.  OK to apply, provided no performance or correctness 
 regressions?
 
 [ChangeLog is part of the git patch]

Ping?

All prerequisite patches for this one are now approved and [mostly] checked in. 
 This is the last outstanding item from my patch series to improve scheduling.

Thank you,

--
Maxim Kuvyrkov
www.linaro.org



Re: Fix libgomp crash without TLS (PR42616)

2014-11-10 Thread Varvara Rainchik
*Ping*

2014-10-13 14:48 GMT+04:00 Varvara Rainchik varvara.s.rainc...@gmail.com:
 Now, I wonder on which OS and why does config/tls.m4 CHECK_GCC_TLS
 actually fail?  Can you figure that out?


 On Android check passes with --disable-tls (standard while building
 gcc for Android as TLS is not supported in bionic) and fails with
 --enable-tls (i686-linux-android/libgomp/conftest.c:32: undefined
 reference to `___tls_get_addr'). So, HAVE_TLS is not defined in both
 cases.

 If we get rid of HAVE_TLS code altogether, we might lose support of
 some very old OSes, e.g. some Linux distros with a recent gcc and binutils
 (so that emutls isn't used), but very old glibc (that doesn't support
 TLS or supports it incorrectly, think of pre-2002 glibc).  So, if we get
 rid of !HAVE_TLS code in libgomp, it would be nice if config/tls.m4 detected
 it properly and we'd just fail at configure time.

 How can we check this in config/tls.m4? Can we just combine tests on
 TLS and emutls? E.g. check whether HAVE_TLS and USE_EMUTLS are both
 defined.

 And if we don't, just make sure that on Android, Darwin and/or M$Win (or
 whatever other OS you had in mind which does support pthreads, but doesn't
 support native TLS) find out why HAVE_AS_TLS is not defined (guess
 config.log should explain that).

 HAVE_AS_TLS is also not defined for Android as it depends on --enable-tls.


Re: PATCH: PR bootstrap/63784: [5 Regression] profiledbootstrap failure with bootstrap-lto

2014-11-10 Thread H.J. Lu
On Mon, Nov 10, 2014 at 4:05 AM, Jakub Jelinek ja...@redhat.com wrote:
 On Mon, Nov 10, 2014 at 12:50:44PM +0100, Richard Biener wrote:
 On Sun, Nov 9, 2014 at 5:46 PM, H.J. Lu hongjiu...@intel.com wrote:
  Hi,
 
  r216964 disables bootstrap for libcc1 which exposed 2 things:
 
  1. libcc1 isn't compiled with LTO even when GCC is configured with
  --with-build-config=bootstrap-lto.  It may be intentional since
  libcc1 is disabled for bootstrap.
  2. -fPIC isn't used to created libcc1.so, which is OK if libcc1 is
  compiled with LTO which remembers PIC option.

 Why is this any special to LTO?  If it is then it looks like a LTO
 (driver) issue to me?  Why are we linking the pic libibterty into
 a non-pic libcc1?

 I admit I haven't tried LTO bootstrap, but from normal bootstrap logs,
 libcc1 is built normally using libtool using -fPIC only, and linked into
 libcc1.so.0.0.0 and libcc1plugin.so.0.0.0, and of course against the
 pic/libiberty.a, because we need PIC code in the shared libraries.
 So, I don't understand the change at all.

 Jakub

This is the command line to build libcc1.la:

/bin/sh ./libtool --tag=CXX   --mode=link
/export/project/git/gcc-regression-bootstrap/master/216981/bld/./gcc/xg++
-B/export/project/git/gcc-regression-bootstrap/master/216981/bld/./gcc/
-nostdinc++ `if test -f
/export/project/git/gcc-regression-bootstrap/master/216981/bld/x86_64-unknown-linux-gnu/libstdc++-v3/scripts/testsuite_flags;
then /bin/sh 
/export/project/git/gcc-regression-bootstrap/master/216981/bld/x86_64-unknown-linux-gnu/libstdc++-v3/scripts/testsuite_flags
--build-includes; else echo -funconfigured-libstdc++-v3 ; fi`
-L/export/project/git/gcc-regression-bootstrap/master/216981/bld/x86_64-unknown-linux-gnu/libstdc++-v3/src
-L/export/project/git/gcc-regression-bootstrap/master/216981/bld/x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs
-L/export/project/git/gcc-regression-bootstrap/master/216981/bld/x86_64-unknown-linux-gnu/libstdc++-v3/libsupc++/.libs
-B/export/project/git/gcc-regression-bootstrap/master/216981/usr/x86_64-unknown-linux-gnu/bin/
-B/export/project/git/gcc-regression-bootstrap/master/216981/usr/x86_64-unknown-linux-gnu/lib/
-isystem 
/export/project/git/gcc-regression-bootstrap/master/216981/usr/x86_64-unknown-linux-gnu/include
-isystem 
/export/project/git/gcc-regression-bootstrap/master/216981/usr/x86_64-unknown-linux-gnu/sys-include
   -W -Wall  -fvisibility=hidden -g -O2 -D_GNU_SOURCE -module
-export-symbols
/export/project/git/gcc-regression/gcc/libcc1/libcc1.sym  -Xcompiler
'-static-libstdc++' -Xcompiler '-static-libgcc' -o libcc1.la -rpath
/export/project/git/gcc-regression-bootstrap/master/216981/usr/lib/../lib64
findcomp.lo libcc1.lo names.lo callbacks.lo connection.lo marshall.lo
-Wc,../libiberty/pic/libiberty.a

There are no -fPIC nor any other options, like -O2.  Since *.lo aren't
compiled with LTO
and libiberty/pic/libiberty.a is compiled with LTO, linker uses
libtool command line to
compile libiberty/pic/libiberty.a  LTO IR into regular object.   Since
libtool command line
doesn't have -fPIC, it fails to create shared object.  Since it
doesn't have -O2, it isn't
optimized and misses other options.

Both ld and gold pull the compiler options from the first .o file with
LTO IR.  We can
argue if linker should pull compiler option from the first LTO IR in
.o and .a.  But it
doesn't happen today and may not be desirable at all.

-- 
H.J.


[match-and-simplify] operator-lists in expression

2014-11-10 Thread Prathamesh Kulkarni
Hi,
  This patch adds support for operator-lists to be used in expression.

I reuse operator-list as the iterator. This is not really valid since
user-defined operator-lists cannot be iterator in 'for', but it was
convenient to reuse operator-list as a 'for' iterator
and lower_for doesn't care about that.
eg:
(define_operator_list  list1 plus minus)

(simplify
  (list1 @x integer_zerop)
  (non_lvalue @x))

is wrapped into 'for' as: (lower_operator_list):
(for list1 (plus minus)
  (simplify
(list1 @x integer_zerop)
(non_lvalue @x)))

this is not really valid since we reject list1 to be used as iterator if
it were written by user.

Is this okay or should I introduce an explicit temporary iterator ?
so it gets lowered to something like:
(for tmp1 (list1)
  (simplify
(tmp1 @x integer_zerop)
(non_lvalue @x)))

* genmatch.c
  (fatal_at): New overloaded function.
  (simplify::oper_lists): New member.
  (simplify::simplify): Add default argument.
  (lower_commutative): Adjust call to simplify::simplify.
  (lower_opt_convert): Likewise.
  (lower_operator_list): New function.
  (lower): Call lower_operator_list.
  (parser::parsing_for_p): New member function.
  (parser::oper_lists): New member.
  (parser::parse_operation): Check for operator-list.
  (parser::parse_c_expr): Likewise.
  (parser::parse_simplify): Reset parser::oper_lists.
Adjust call to simplify::simplify.
  (parser::parser): Initialize parser::oper_lists.

* match-builtin.pd:
  Adjust patten to use SQRTs and POWs.

Thanks,
Prathamesh
Index: gcc/genmatch.c
===
--- gcc/genmatch.c	(revision 217284)
+++ gcc/genmatch.c	(working copy)
@@ -110,6 +110,18 @@
 #if GCC_VERSION = 4001
 __attribute__((format (printf, 2, 3)))
 #endif
+fatal_at (source_location loc, const char *msg, ...)
+{
+  va_list ap;
+  va_start (ap, msg);
+  error_cb (NULL, CPP_DL_FATAL, 0, loc, 0, msg, ap);
+  va_end (ap);
+}
+
+static void
+#if GCC_VERSION = 4001
+__attribute__((format (printf, 2, 3)))
+#endif
 warning_at (const cpp_token *tk, const char *msg, ...)
 {
   va_list ap;
@@ -549,11 +561,11 @@
   simplify (operand *match_, source_location match_location_,
 	struct operand *result_, source_location result_location_,
 	vecif_or_with ifexpr_vec_, vecvecuser_id *  for_vec_,
-	cid_map_t *capture_ids_)
+	cid_map_t *capture_ids_, vecuser_id * oper_lists_ = vNULL)
   : match (match_), match_location (match_location_),
   result (result_), result_location (result_location_),
   ifexpr_vec (ifexpr_vec_), for_vec (for_vec_),
-  capture_ids (capture_ids_), capture_max (capture_ids_-elements () - 1) {}
+  capture_ids (capture_ids_), capture_max (capture_ids_-elements () - 1), oper_lists (oper_lists_) {}
 
   /* The expression that is matched against the GENERIC or GIMPLE IL.  */
   operand *match;
@@ -572,6 +584,8 @@
   /* A map of capture identifiers to indexes.  */
   cid_map_t *capture_ids;
   int capture_max;
+  /* collected operator-list used in expression */
+  vecuser_id * oper_lists;
 };
 
 /* Debugging routines for dumping the AST.  */
@@ -721,7 +735,7 @@
 {
   simplify *ns = new simplify (matchers[i], s-match_location,
    s-result, s-result_location, s-ifexpr_vec,
-   s-for_vec, s-capture_ids);
+   s-for_vec, s-capture_ids, s-oper_lists);
   simplifiers.safe_push (ns);
 }
 }
@@ -837,7 +851,7 @@
 {
   simplify *ns = new simplify (matchers[i], s-match_location,
    s-result, s-result_location, s-ifexpr_vec,
-   s-for_vec, s-capture_ids);
+   s-for_vec, s-capture_ids, s-oper_lists);
   simplifiers.safe_push (ns);
 }
 }
@@ -934,6 +948,38 @@
 simplifiers.safe_push (worklist[i]);
 }
 
+static void
+lower_operator_list (simplify *s, vecsimplify * simplifiers)
+{
+  vecuser_id * oper_lists = s-oper_lists;
+  if (oper_lists == vNULL)
+{
+  simplifiers.safe_push (s);
+  return;
+} 
+
+  unsigned min = oper_lists[0]-substitutes.length ();
+  for (unsigned i = 1; i  oper_lists.length (); ++i)
+if (min  oper_lists[i]-substitutes.length ())
+  min = oper_lists[i]-substitutes.length ();
+
+  for (unsigned i = 0; i  oper_lists.length (); ++i)
+if (oper_lists[i]-substitutes.length () % min != 0)
+  fatal_at (s-match_location, All user-defined identifiers must have a multiple number 
+   of operator substittions of the smallest number of substitutions);
+
+  vec vecuser_id *  for_vec = vNULL;
+  for_vec.safe_push (oper_lists);
+
+  simplify ns (s-match, s-match_location,
+	   s-result, s-result_location,
+	   s-ifexpr_vec, for_vec,
+	   s-capture_ids);
+
+  lower_for (ns, simplifiers);
+}
+
+
 /* Lower the AST for everything in SIMPLIFIERS.  */
 
 static void
@@ -947,14 +993,15 @@
   for (unsigned i = 0; i  out_simplifiers0.length (); ++i)
 lower_commutative (out_simplifiers0[i], out_simplifiers1);
 
+  auto_vecsimplify * out_simplifiers2;
+  for (unsigned i = 0;  i  

Re: PATCH: PR bootstrap/63784: [5 Regression] profiledbootstrap failure with bootstrap-lto

2014-11-10 Thread Jakub Jelinek
On Mon, Nov 10, 2014 at 05:32:32AM -0800, H.J. Lu wrote:
 On Mon, Nov 10, 2014 at 4:05 AM, Jakub Jelinek ja...@redhat.com wrote:
  On Mon, Nov 10, 2014 at 12:50:44PM +0100, Richard Biener wrote:
  On Sun, Nov 9, 2014 at 5:46 PM, H.J. Lu hongjiu...@intel.com wrote:
   Hi,
  
   r216964 disables bootstrap for libcc1 which exposed 2 things:
  
   1. libcc1 isn't compiled with LTO even when GCC is configured with
   --with-build-config=bootstrap-lto.  It may be intentional since
   libcc1 is disabled for bootstrap.
   2. -fPIC isn't used to created libcc1.so, which is OK if libcc1 is
   compiled with LTO which remembers PIC option.
 
  Why is this any special to LTO?  If it is then it looks like a LTO
  (driver) issue to me?  Why are we linking the pic libibterty into
  a non-pic libcc1?
 
  I admit I haven't tried LTO bootstrap, but from normal bootstrap logs,
  libcc1 is built normally using libtool using -fPIC only, and linked into
  libcc1.so.0.0.0 and libcc1plugin.so.0.0.0, and of course against the
  pic/libiberty.a, because we need PIC code in the shared libraries.
  So, I don't understand the change at all.
 
  Jakub
 
 This is the command line to build libcc1.la:

Sure, but there was -fPIC used to compile all the *.o files that are being
linked into libcc1.so, so LTO should know that.

Jakub


Re: PATCH: PR bootstrap/63784: [5 Regression] profiledbootstrap failure with bootstrap-lto

2014-11-10 Thread Richard Biener
On Mon, Nov 10, 2014 at 2:43 PM, Jakub Jelinek ja...@redhat.com wrote:
 On Mon, Nov 10, 2014 at 05:32:32AM -0800, H.J. Lu wrote:
 On Mon, Nov 10, 2014 at 4:05 AM, Jakub Jelinek ja...@redhat.com wrote:
  On Mon, Nov 10, 2014 at 12:50:44PM +0100, Richard Biener wrote:
  On Sun, Nov 9, 2014 at 5:46 PM, H.J. Lu hongjiu...@intel.com wrote:
   Hi,
  
   r216964 disables bootstrap for libcc1 which exposed 2 things:
  
   1. libcc1 isn't compiled with LTO even when GCC is configured with
   --with-build-config=bootstrap-lto.  It may be intentional since
   libcc1 is disabled for bootstrap.
   2. -fPIC isn't used to created libcc1.so, which is OK if libcc1 is
   compiled with LTO which remembers PIC option.
 
  Why is this any special to LTO?  If it is then it looks like a LTO
  (driver) issue to me?  Why are we linking the pic libibterty into
  a non-pic libcc1?
 
  I admit I haven't tried LTO bootstrap, but from normal bootstrap logs,
  libcc1 is built normally using libtool using -fPIC only, and linked into
  libcc1.so.0.0.0 and libcc1plugin.so.0.0.0, and of course against the
  pic/libiberty.a, because we need PIC code in the shared libraries.
  So, I don't understand the change at all.
 
  Jakub

 This is the command line to build libcc1.la:

 Sure, but there was -fPIC used to compile all the *.o files that are being
 linked into libcc1.so, so LTO should know that.

And it does.  If not please file a bug with a smaller testcase than libcc1
and libiberty.

Richard.

 Jakub


Re: [PATCH] Fix PR 63748

2014-11-10 Thread Patrick Palka
On Mon, Nov 10, 2014 at 7:22 AM, Eric Botcazou ebotca...@adacore.com wrote:
  Full bootstrap + regtesting on x86_64-unknown-linux-gnu is in progress.
  Is this patch OK if testing succeeds with no new regressions?

 ... ok.  But please watch for fallout.

 I'd do a bootstrap with Ada enabled, the Ada compiler is the only serious user
 of abnormal edges in GIMPLE on Linux platforms.

 --
 Eric Botcazou

Bootstrap (with --enable-languages=all,ada) + regtesting has finished
with no new regressions.  I will commit this later today when I have
more free time ahead of me.  Thanks for reviewing.


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

2014-11-10 Thread Dominik Vogt
 I'd still like to avoid the rampant duplication if possible.  One
 approach would be to put most of the test in something like
 nilptr_tests.go marked with // skip.  Then we can have top-level
 nilptrXX.go tests with +build lines that use // run nilptr_tests.go.

I fail to see how that could be done with // run.  There is one
example use, namely cmplxdivide.go.  That is not run in gcc
because the run line does not match anything in go-test.exp.  If
I add a rule for that, how does that help me to compile a test
that consists of multiple files?

At the moment, I've no idea how to tackle the multi file problem
with the existing go-test.exp.

Ciao

Dominik ^_^  ^_^

-- 

Dominik Vogt
IBM Germany



Re: PATCH: PR bootstrap/63784: [5 Regression] profiledbootstrap failure with bootstrap-lto

2014-11-10 Thread Jakub Jelinek
On Mon, Nov 10, 2014 at 02:44:55PM +0100, Richard Biener wrote:
   I admit I haven't tried LTO bootstrap, but from normal bootstrap logs,
   libcc1 is built normally using libtool using -fPIC only, and linked into
   libcc1.so.0.0.0 and libcc1plugin.so.0.0.0, and of course against the
   pic/libiberty.a, because we need PIC code in the shared libraries.
   So, I don't understand the change at all.
  
   Jakub
 
  This is the command line to build libcc1.la:
 
  Sure, but there was -fPIC used to compile all the *.o files that are being
  linked into libcc1.so, so LTO should know that.
 
 And it does.  If not please file a bug with a smaller testcase than libcc1
 and libiberty.

Ah, supposedly we should add $(POSTSTAGE1_HOST_EXPORTS) after $(HOST_EXPORTS)
to the libcc1 rules iff the libcc1 module is built by the newly built
bootstrapped compiler (but not when the compiler is not bootstrapped and
thus it is built by the host compiler), because if we first bootstrap the
compiler and build libcc1 by stage3, it is really post-stage1 building.

Paolo, any thoughts how to arrange that?

Jakub


[PATCH] Fix PR63800

2014-11-10 Thread Richard Biener

This fixes PR63800 which shows that PRE eliminate() avail handling
is too simplistic with the code to avoid vectorization regressions.
The following patch makes it properly restore old availability.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.

Richard.

2014-11-10  Richard Biener  rguent...@suse.de

PR tree-optimization/63800
* tree-ssa-pre.c (eliminate_push_avail): Push in a way so
we can restore the previous availability in after_dom_children.
(eliminate_dom_walker::after_dom_children): Restore
previous availability.

* gcc.dg/torture/pr63800.c: New testcase.

Index: gcc/tree-ssa-pre.c
===
--- gcc/tree-ssa-pre.c  (revision 216973)
+++ gcc/tree-ssa-pre.c  (working copy)
@@ -3904,8 +3926,11 @@ eliminate_push_avail (tree op)
 {
   if (el_avail.length () = SSA_NAME_VERSION (valnum))
el_avail.safe_grow_cleared (SSA_NAME_VERSION (valnum) + 1);
+  tree pushop = op;
+  if (el_avail[SSA_NAME_VERSION (valnum)])
+   pushop = el_avail[SSA_NAME_VERSION (valnum)];
+  el_avail_stack.safe_push (pushop);
   el_avail[SSA_NAME_VERSION (valnum)] = op;
-  el_avail_stack.safe_push (op);
 }
 }
 
@@ -4449,7 +4468,14 @@ eliminate_dom_walker::after_dom_children
 {
   tree entry;
   while ((entry = el_avail_stack.pop ()) != NULL_TREE)
-el_avail[SSA_NAME_VERSION (VN_INFO (entry)-valnum)] = NULL_TREE;
+{
+  tree valnum = VN_INFO (entry)-valnum;
+  tree old = el_avail[SSA_NAME_VERSION (valnum)];
+  if (old == entry)
+   el_avail[SSA_NAME_VERSION (valnum)] = NULL_TREE;
+  else
+   el_avail[SSA_NAME_VERSION (valnum)] = entry;
+}
 }
 
 /* Eliminate fully redundant computations.  */
Index: gcc/testsuite/gcc.dg/torture/pr63800.c
===
--- gcc/testsuite/gcc.dg/torture/pr63800.c  (revision 0)
+++ gcc/testsuite/gcc.dg/torture/pr63800.c  (working copy)
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+
+int a, b, c, d[2];
+
+int
+fn1 ()
+{
+  int f = 0;
+  d[1] = b = 1; 
+  for (; b; b--)
+{
+  for (c = 0; c  2; c++)
+   {
+ d[b]  1  b;
+ if (d[0])
+   f = d[b] * a;
+ if (f)
+   return 0;
+   }
+  d[b]  (d[0] = 0);
+}
+  return 0;
+}


Re: [PATCH 3/4] Add libgomp plugin for Intel MIC

2014-11-10 Thread Ilya Verbin
On 06 Nov 19:25, Jakub Jelinek wrote:
 Oh, one more point, if mic_lib_path is NULL, what is the point
 to do the alloca/malloc and string copying?  Can't you just
   setenv (MIC_LD_LIBRARY_PATH_ENV, ld_lib_path, 1);
 in that case early?
 
 Otherwise LGTM.

Done.

Thanks,
  -- Ilya


---

diff --git a/liboffloadmic/configure.ac b/liboffloadmic/configure.ac
index fb575b3..81fae8f 100644
--- a/liboffloadmic/configure.ac
+++ b/liboffloadmic/configure.ac
@@ -42,6 +42,7 @@ AC_PROG_CC
 AC_PROG_CXX
 AC_CONFIG_FILES([Makefile liboffloadmic_host.spec liboffloadmic_target.spec])
 AM_ENABLE_MULTILIB(, ..)
+AC_CONFIG_SUBDIRS(plugin)
 AC_FUNC_ALLOCA
 AC_CHECK_HEADERS([mm_malloc.h], [], [AC_MSG_ERROR([Couldn't find 
mm_malloc.h])])
 AC_CHECK_FUNCS([__secure_getenv secure_getenv])
diff --git a/liboffloadmic/plugin/Makefile.am b/liboffloadmic/plugin/Makefile.am
new file mode 100644
index 000..0baf70d
--- /dev/null
+++ b/liboffloadmic/plugin/Makefile.am
@@ -0,0 +1,123 @@
+# Plugin for offload execution on Intel MIC devices.
+#
+# Copyright (C) 2014 Free Software Foundation, Inc.
+#
+# Contributed by Ilya Verbin ilya.ver...@intel.com and
+# Andrey Turetskiy andrey.turets...@intel.com.
+#
+# This file is part of the GNU OpenMP Library (libgomp).
+#
+# Libgomp is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+# more details.
+#
+# Under Section 7 of GPL version 3, you are granted additional
+# permissions described in the GCC Runtime Library Exception, version
+# 3.1, as published by the Free Software Foundation.
+#
+# You should have received a copy of the GNU General Public License and
+# a copy of the GCC Runtime Library Exception along with this program;
+# see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+# http://www.gnu.org/licenses/.
+
+
+AUTOMAKE_OPTIONS = foreign
+ACLOCAL_AMFLAGS = -I ../.. -I ../../config
+
+# Directories
+build_dir = $(top_builddir)
+source_dir = $(top_srcdir)
+coi_inc_dir = $(top_srcdir)/../include/coi
+myo_inc_dir = $(top_srcdir)/../include/myo
+libgomp_src_dir = $(top_srcdir)/../../libgomp
+libgomp_dir = $(build_dir)/../../libgomp
+liboffload_src_dir = $(top_srcdir)/../runtime
+liboffload_dir = $(top_builddir)/..
+
+# May be used by toolexeclibdir.
+gcc_version := $(shell cat $(top_srcdir)/../../gcc/BASE-VER)
+libsubincludedir = 
$(libdir)/gcc/$(target_alias)/$(gcc_version)$(MULTISUBDIR)/include
+# Search for main_target_image.h in these directories
+target_prefix_dir = $(libdir)/gcc/$(accel_target)/$(gcc_version)$(MULTISUBDIR)
+target_build_dir = 
$(accel_search_dir)/$(accel_target)$(MULTISUBDIR)/liboffloadmic/plugin
+target_install_dir = 
$(accel_search_dir)/lib/gcc/$(accel_target)/$(gcc_version)$(MULTISUBDIR)
+
+if PLUGIN_HOST
+  toolexeclib_LTLIBRARIES = libgomp-plugin-intelmic.la
+  libgomp_plugin_intelmic_la_SOURCES = libgomp-plugin-intelmic.cpp
+  libgomp_plugin_intelmic_la_CPPFLAGS = $(CPPFLAGS) -DLINUX 
-DCOI_LIBRARY_VERSION=2 -DMYO_SUPPORT -DOFFLOAD_DEBUG=1 -DSEP_SUPPORT 
-DTIMING_SUPPORT -DHOST_LIBRARY=1 -I$(coi_inc_dir) -I$(myo_inc_dir) 
-I$(liboffload_src_dir) -I$(libgomp_src_dir) -I$(libgomp_dir) 
-I$(target_prefix_dir)/include -I$(target_build_dir) 
-I$(target_install_dir)/include
+  libgomp_plugin_intelmic_la_LDFLAGS = -L$(liboffload_dir)/.libs 
-loffloadmic_host -version-info 1:0:0
+else # PLUGIN_TARGET
+  plugin_includedir = $(libsubincludedir)
+  plugin_include_HEADERS = main_target_image.h
+  AM_CPPFLAGS = $(CPPFLAGS) -DLINUX -DCOI_LIBRARY_VERSION=2 -DMYO_SUPPORT 
-DOFFLOAD_DEBUG=1 -DSEP_SUPPORT -DTIMING_SUPPORT -DHOST_LIBRARY=0 
-I$(coi_inc_dir) -I$(myo_inc_dir) -I$(liboffload_src_dir) -I$(libgomp_dir)
+  AM_CXXFLAGS = $(CXXFLAGS)
+  AM_LDFLAGS = -L$(liboffload_dir)/.libs -L$(libgomp_dir)/.libs 
-loffloadmic_target -lcoi_device -lmyo-service -lgomp -rdynamic
+endif
+
+main_target_image.h: offload_target_main
+   @echo -n const int image_size =   $@
+   @stat -c '%s' $  $@
+   @echo ;  $@
+   @echo struct MainTargetImage {  $@
+   @echo   int64_t size;  $@
+   @echo   char name[sizeof \offload_target_main\];  $@
+   @echo   char data[image_size];  $@
+   @echo };  $@
+   @echo extern \C\ const MainTargetImage main_target_image = {  $@
+   @echo   image_size, \offload_target_main\,  $@
+   @cat $ | xxd -include  $@
+   @echo };  $@
+
+offload_target_main: $(liboffload_dir)/ofldbegin.o offload_target_main.o 
$(liboffload_dir)/ofldend.o
+   $(CXX) $(AM_LDFLAGS) $^ -o $@
+
+offload_target_main.o: offload_target_main.cpp
+   $(CXX) $(AM_CXXFLAGS) $(AM_CPPFLAGS) -c $ -o $@
+
+# Work around what appears to be a 

Re: Ping: FR-V rtx iterator patches

2014-11-10 Thread Nicholas Clifton

Hi Richard,


Ping for these FR-V patches:

https://gcc.gnu.org/ml/gcc-patches/2014-10/msg02645.html
https://gcc.gnu.org/ml/gcc-patches/2014-10/msg02646.html
https://gcc.gnu.org/ml/gcc-patches/2014-10/msg02647.html
https://gcc.gnu.org/ml/gcc-patches/2014-10/msg02648.html

which convert callers of for_each_rtx to the new rtx iterators in
rtl-iter.h.  (These are the only uses of for_each_rtx left -- thanks
for all the reviews to get this far.)


Sorry for missing these.  The patches are fine - please apply.

Cheers
  Nick




Re: [PATCH 4/4] OpenMP 4.0 offloading to Intel MIC: non-fallback testing

2014-11-10 Thread Ilya Verbin
On 06 Nov 18:55, Jakub Jelinek wrote:
 Looks mostly good, but:
 
  +# We need more things in site.exp, but automake completely controls the
  +# creation of that file; there's no way to append to it without messing up
  +# the dependancy chains.  So we overrule automake.  This rule is exactly
  +# what it would have generated, plus our own additions.
  +site.exp: Makefile
  +   @echo 'Making a new site.exp file...'
  +   @echo '## these variables are automatically generated by make ##' 
  site.tmp
  +   @echo '# Do not edit here.  If you wish to override these values' 
  site.tmp
  +   @echo '# edit the last section' site.tmp
  +   @echo 'set srcdir $(srcdir)' site.tmp
  +   @echo set objdir `pwd` site.tmp
  +   @echo 'set build_alias $(build_alias)' site.tmp
  +   @echo 'set build_triplet $(build_triplet)' site.tmp
  +   @echo 'set host_alias $(host_alias)' site.tmp
  +   @echo 'set host_triplet $(host_triplet)' site.tmp
  +   @echo 'set target_alias $(target_alias)' site.tmp
  +   @echo 'set target_triplet $(target_triplet)' site.tmp
  +   @echo 'set offload_targets $(offload_targets)' site.tmp
  +   @echo 'set offload_additional_options $(offload_additional_options)' 
  site.tmp
  +   @echo 'set offload_additional_lib_paths 
  $(offload_additional_lib_paths)' site.tmp
  +   @echo '## All variables above are generated by configure. Do Not Edit 
  ##' site.tmp
  +   @test ! -f site.exp || \
  + sed '1,/^## All variables above are.*##/ d' site.exp  site.tmp
  +   @-rm -f site.bak
  +   @test ! -f site.exp || mv site.exp site.bak
  +   @mv site.tmp site.exp
 
 I don't like this, that is too fragile.  If automake is changed, we'll
 forget to update this.
 If all you are about are the 3 additional variables, can't you instead
 put them into env vars and query them in the tcl code using getenv?
 Or append them into AM_RUNTESTFLAGS ?
 AM_RUNTESTFLAGS += @something@

Done, I put them into env vars.

  +lappend ALWAYS_CFLAGS additional_flags=${offload_additional_options}
   }
 
 Perhaps add this only if offload_additional_options is non-empty?

Done.

Thanks,
  -- Ilya


---

diff --git a/libgomp/Makefile.in b/libgomp/Makefile.in
index 5cd666f..8e4774f 100644
--- a/libgomp/Makefile.in
+++ b/libgomp/Makefile.in
@@ -268,6 +268,9 @@ lt_host_flags = @lt_host_flags@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 multi_basedir = @multi_basedir@
+offload_additional_lib_paths = @offload_additional_lib_paths@
+offload_additional_options = @offload_additional_options@
+offload_targets = @offload_targets@
 oldincludedir = @oldincludedir@
 pdfdir = @pdfdir@
 prefix = @prefix@
diff --git a/libgomp/configure b/libgomp/configure
index 97c9be6..aabf25f 100755
--- a/libgomp/configure
+++ b/libgomp/configure
@@ -616,6 +616,9 @@ OMP_LOCK_SIZE
 USE_FORTRAN_FALSE
 USE_FORTRAN_TRUE
 link_gomp
+offload_additional_lib_paths
+offload_additional_options
+offload_targets
 XLDFLAGS
 XCFLAGS
 config_path
@@ -11094,7 +11097,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat  conftest.$ac_ext _LT_EOF
-#line 11097 configure
+#line 11100 configure
 #include confdefs.h
 
 #if HAVE_DLFCN_H
@@ -11200,7 +11203,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat  conftest.$ac_ext _LT_EOF
-#line 11203 configure
+#line 11206 configure
 #include confdefs.h
 
 #if HAVE_DLFCN_H
@@ -16207,9 +16210,13 @@ else
   multilib_arg=
 fi
 
+# Get accel target and path to install tree of accel compiler
+offload_additional_options=
+offload_additional_lib_paths=
 offload_targets=
 if test x$enable_offload_targets != x; then
   for tgt in `echo $enable_offload_targets | sed -e 's#,# #g'`; do
+tgt_dir=`echo $tgt | grep '=' | sed 's/.*=//'`
 tgt=`echo $tgt | sed 's/=.*//'`
 case $tgt in
   *-intelmic-* | *-intelmicemul-*)
@@ -16222,6 +16229,13 @@ if test x$enable_offload_targets != x; then
 else
   offload_targets=$offload_targets,$tgt_name
 fi
+if test x$tgt_dir != x; then
+  offload_additional_options=$offload_additional_options 
-B$tgt_dir/libexec/gcc/\$(target_alias)/\$(gcc_version) -B$tgt_dir/bin
+  
offload_additional_lib_paths=$offload_additional_lib_paths:$tgt_dir/lib64:$tgt_dir/lib
+else
+  offload_additional_options=$offload_additional_options 
-B\$(libexecdir)/gcc/\$(target_alias)/\$(gcc_version) -B\$(bindir)
+  
offload_additional_lib_paths=$offload_additional_lib_paths:$toolexeclibdir
+fi
   done
 fi
 
@@ -16230,6 +16244,9 @@ cat confdefs.h _ACEOF
 _ACEOF
 
 
+
+
+
 # Set up the set of libraries that we need to link against for libgomp.
 # Note that the GOMP_SELF_SPEC in gcc.c may force -pthread,
 # which will force linkage against -lpthread (or equivalent for the system).
diff --git a/libgomp/configure.ac b/libgomp/configure.ac
index 3f34ff8..cea6366 100644
--- a/libgomp/configure.ac
+++ b/libgomp/configure.ac
@@ -280,9 +280,13 @@ else
   multilib_arg=
 fi
 
+# Get accel target and path to install tree 

Re: [PATCH][Revisedx2] Fix PR63750

2014-11-10 Thread FX
 Indeed string is a system header and should not have been included from 
 tree-chkp.c but system.h

Indeed.
My knowledge of C++ is limited, but I think this additional patch to wide-int.h 
is the proper fix to the issue reported by Jack, no?
I’m bootstrapping it right now, it already passed stage 2.

Richard, I’d appreciate if you could review it.

Cheers,
FX




string.diff
Description: Binary data


string.ChangeLog
Description: Binary data


Re: [PATCH][Revisedx2] Fix PR63750

2014-11-10 Thread FX
 My knowledge of C++ is limited, but I think this additional patch to 
 wide-int.h is the proper fix to the issue reported by Jack, no?
 I’m bootstrapping it right now, it already passed stage 2.

Boostrapped succeeded on x86_64-apple-darwin14.
OK to commit to trunk?



string.diff
Description: Binary data


string.ChangeLog
Description: Binary data


Re: [testsuite,ARM] PR61153 Fix vbic and vorn tests

2014-11-10 Thread Christophe Lyon
On 30 October 2014 23:02, Christophe Lyon christophe.l...@linaro.org wrote:
 On 29 October 2014 16:28, Ramana Radhakrishnan
 ramana@googlemail.com wrote:
 On Wed, Oct 29, 2014 at 3:26 PM, Christophe Lyon
 christophe.l...@linaro.org wrote:
 Hi,

 In PR61153, the vbic and vorn tests fail because when compiled at -O0
 the expected Neon instructions are not generated, making
 scan-assembler fail.

 This patch:
 - replaces -O0 by -O2
 - moves the declaration of local variables used as intrinsics
 parameters and results to global declarations, to prevent the compiler
 from optimizing the whole test away.

 OK?


 If you really want to do it , do it in neon-testgen.ml and do it for
 the whole lot.


 I thought it wasn't used anymore.

 At -O2 I have many more failures :-(

 (vdup, vget_lane, vget_low, vmov, vset_lane)

 And -O1 doesn't do the trick either...

 Christophe.

Hi Ramana,

Based on your request and on my above comment, I have modified
neon-testgen.ml so that it sets -O2 in some testcases and -O0 by
default.

I've achieved this by adding a new value in the 'features' list in
neon.ml, and set it to -O2 for vbic and vorn cases. neon-testgen.ml
parses this value, and defaults to -O0.
When not -O0, it also moves the input/output variables to global scope
to avoid the whole test to be optimized out.

I also fixed 3 warnings about 'or' being deprecated in neon.ml.

OK?

Christophe.

2014-11-10  Christophe Lyon  christophe.l...@linaro.org

gcc/
* config/arm/neon-testgen.ml (emit_prologue): Handle new
compile_test_optim argument.
(emit_automatics): Rename to emit_variables. Support variable
indentation of its output.
(compile_test_optim): New function.
(test_intrinsic): Call compile_test_optim.
* config/arm/neon.ml (features): Add Compiler_optim.
(ops): Add Compiler_optim feature to Vbic and Vorn.
(type_in_crypto_only): Replace 'or' by '||'.
(reinterp): Likewise.
(reinterpq): Likewise.

testsuite/
* gcc.target/arm/neon/vbicQs16.c: Regenerate.
* gcc.target/arm/neon/vbicQs32.c: Likewise.
* gcc.target/arm/neon/vbicQs64.c: Likewise.
* gcc.target/arm/neon/vbicQs8.c: Likewise.
* gcc.target/arm/neon/vbicQu16.c: Likewise.
* gcc.target/arm/neon/vbicQu32.c: Likewise.
* gcc.target/arm/neon/vbicQu64.c: Likewise.
* gcc.target/arm/neon/vbicQu8.c: Likewise.
* gcc.target/arm/neon/vbics16.c: Likewise.
* gcc.target/arm/neon/vbics32.c: Likewise.
* gcc.target/arm/neon/vbics64.c: Likewise.
* gcc.target/arm/neon/vbics8.c: Likewise.
* gcc.target/arm/neon/vbicu16.c: Likewise.
* gcc.target/arm/neon/vbicu32.c: Likewise.
* gcc.target/arm/neon/vbicu64.c: Likewise.
* gcc.target/arm/neon/vbicu8.c: Likewise.
* gcc.target/arm/neon/vornQs16.c: Likewise.
* gcc.target/arm/neon/vornQs32.c: Likewise.
* gcc.target/arm/neon/vornQs64.c: Likewise.
* gcc.target/arm/neon/vornQs8.c: Likewise.
* gcc.target/arm/neon/vornQu16.c: Likewise.
* gcc.target/arm/neon/vornQu32.c: Likewise.
* gcc.target/arm/neon/vornQu64.c: Likewise.
* gcc.target/arm/neon/vornQu8.c: Likewise.
* gcc.target/arm/neon/vorns16.c: Likewise.
* gcc.target/arm/neon/vorns32.c: Likewise.
* gcc.target/arm/neon/vorns64.c: Likewise.
* gcc.target/arm/neon/vorns8.c: Likewise.
* gcc.target/arm/neon/vornu16.c: Likewise.
* gcc.target/arm/neon/vornu32.c: Likewise.
* gcc.target/arm/neon/vornu64.c: Likewise.
* gcc.target/arm/neon/vornu8.c: Likewise.

 regards
 Ramana
 Christophe.

 2014-10-29  Christophe Lyon  christophe.l...@linaro.org

 PR target/61153
 * gcc.target/arm/neon/vbicQs16.c: Compile at O2 and move variables
 declarations from local to global.
 * gcc.target/arm/neon/vbicQs16.c: Likewise.
 * gcc.target/arm/neon/vbicQs32.c: Likewise.
 * gcc.target/arm/neon/vbicQs64.c: Likewise.
 * gcc.target/arm/neon/vbicQs8.c: Likewise.
 * gcc.target/arm/neon/vbicQu16.c: Likewise.
 * gcc.target/arm/neon/vbicQu32.c: Likewise.
 * gcc.target/arm/neon/vbicQu64.c: Likewise.
 * gcc.target/arm/neon/vbicQu8.c: Likewise.
 * gcc.target/arm/neon/vbics16.c: Likewise.
 * gcc.target/arm/neon/vbics32.c: Likewise.
 * gcc.target/arm/neon/vbics64.c: Likewise.
 * gcc.target/arm/neon/vbics8.c: Likewise.
 * gcc.target/arm/neon/vbicu16.c: Likewise.
 * gcc.target/arm/neon/vbicu32.c: Likewise.
 * gcc.target/arm/neon/vbicu64.c: Likewise.
 * gcc.target/arm/neon/vbicu8.c: Likewise.
 * gcc.target/arm/neon/vornQs16.c: Likewise.
 * gcc.target/arm/neon/vornQs32.c: Likewise.
 * gcc.target/arm/neon/vornQs64.c: Likewise.
 * gcc.target/arm/neon/vornQs8.c: Likewise.
 * gcc.target/arm/neon/vornQu16.c: Likewise.
 * gcc.target/arm/neon/vornQu32.c: Likewise.
 * gcc.target/arm/neon/vornQu64.c: Likewise.
 * gcc.target/arm/neon/vornQu8.c: Likewise.
 * gcc.target/arm/neon/vorns16.c: Likewise.
 * gcc.target/arm/neon/vorns32.c: Likewise.
 * 

[PATCH] c++98/mt_allcoator.cc: Fix assumption sizeof(void *) == sizeof(size_t)

2014-11-10 Thread Joel Sherrill
2014-11-10  Joel Sherrill joel.sherr...@oarcorp.com

* src/c++98/mt_allocator.cc: Fix assumption that sizeof(void *) is
equal to sizeof(size_t). The m32c breaks this assumption.
---
 libstdc++-v3/src/c++98/mt_allocator.cc | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libstdc++-v3/src/c++98/mt_allocator.cc 
b/libstdc++-v3/src/c++98/mt_allocator.cc
index 38e17df..04dd8ad 100644
--- a/libstdc++-v3/src/c++98/mt_allocator.cc
+++ b/libstdc++-v3/src/c++98/mt_allocator.cc
@@ -30,6 +30,7 @@
 #include ext/concurrence.h
 #include ext/mt_allocator.h
 #include cstring
+#include stdint.h
 
 namespace
 {
@@ -74,7 +75,7 @@ namespace
 __freelist freelist = get_freelist();
 {
   __gnu_cxx::__scoped_lock sentry(get_freelist_mutex());
-  size_t _M_id = reinterpret_castsize_t(__id);
+  uintptr_t _M_id = reinterpret_castuintptr_t(__id);
   
   typedef __gnu_cxx::__pooltrue::_Thread_record _Thread_record;
   _Thread_record* __tr = freelist._M_thread_freelist_array[_M_id - 1];
@@ -627,7 +628,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   {
__freelist freelist = get_freelist();
void* v = __gthread_getspecific(freelist._M_key);
-   size_t _M_id = (size_t)v;
+   uintptr_t _M_id = (uintptr_t)v;
if (_M_id == 0)
  {
{
-- 
1.9.3



[match-and-simplify] Remove supposedly dead code

2014-11-10 Thread Richard Biener

supposedly because there are a few regressions.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.

Richard.

2014-11-10  Richard Biener  rguent...@suse.de

* tree-ssa-forwprop.c (simplify_conversion_from_bitmask): Remove.
(associate_plusminus): Likewise.
(combine_conversions): Likewise.
(simplify_mult): Likewise.
(pass_forwprop::execute): Adjust.
* gimple-fold.c (fold_gimple_assign): Remove dispatches to
fold_binary_loc and fold_ternary_loc.
(gimple_fold_stmt_to_constant_1): Likewise.

Index: gcc/tree-ssa-forwprop.c
===
--- gcc/tree-ssa-forwprop.c (revision 217279)
+++ gcc/tree-ssa-forwprop.c (working copy)
@@ -1214,78 +1214,6 @@ bailout:
 }
 
 
-/* GSI_P points to a statement which performs a narrowing integral
-   conversion.
-
-   Look for cases like:
-
- t = x  c;
- y = (T) t;
-
-   Turn them into:
-
- t = x  c;
- y = (T) x;
-
-   If T is narrower than X's type and C merely masks off bits outside
-   of (T) and nothing else.
-
-   Normally we'd let DCE remove the dead statement.  But no DCE runs
-   after the last forwprop/combine pass, so we remove the obviously
-   dead code ourselves.
-
-   Return TRUE if a change was made, FALSE otherwise.  */
-
-static bool 
-simplify_conversion_from_bitmask (gimple_stmt_iterator *gsi_p)
-{
-  gimple stmt = gsi_stmt (*gsi_p);
-  gimple rhs_def_stmt = SSA_NAME_DEF_STMT (gimple_assign_rhs1 (stmt));
-
-  /* See if the input for the conversion was set via a BIT_AND_EXPR and
- the only use of the BIT_AND_EXPR result is the conversion.  */
-  if (is_gimple_assign (rhs_def_stmt)
-   gimple_assign_rhs_code (rhs_def_stmt) == BIT_AND_EXPR
-   has_single_use (gimple_assign_lhs (rhs_def_stmt)))
-{
-  tree rhs_def_operand1 = gimple_assign_rhs1 (rhs_def_stmt);
-  tree rhs_def_operand2 = gimple_assign_rhs2 (rhs_def_stmt);
-  tree lhs_type = TREE_TYPE (gimple_assign_lhs (stmt));
-
-  /* Now verify suitability of the BIT_AND_EXPR's operands.
-The first must be an SSA_NAME that we can propagate and the
-second must be an integer constant that masks out all the
-bits outside the final result's type, but nothing else.  */
-  if (TREE_CODE (rhs_def_operand1) == SSA_NAME
-  ! SSA_NAME_OCCURS_IN_ABNORMAL_PHI (rhs_def_operand1)
-  TREE_CODE (rhs_def_operand2) == INTEGER_CST
-  operand_equal_p (rhs_def_operand2,
- build_low_bits_mask (TREE_TYPE (rhs_def_operand2),
-  TYPE_PRECISION (lhs_type)),
-  0))
-   {
- /* This is an optimizable case.  Replace the source operand
-in the conversion with the first source operand of the
-BIT_AND_EXPR.  */
- gimple_assign_set_rhs1 (stmt, rhs_def_operand1);
- stmt = gsi_stmt (*gsi_p);
- update_stmt (stmt);
-
- /* There is no DCE after the last forwprop pass.  It's
-easy to clean up the first order effects here.  */
- gimple_stmt_iterator si;
- si = gsi_for_stmt (rhs_def_stmt);
- gsi_remove (si, true);
- fwprop_invalidate_lattice (gimple_get_lhs (rhs_def_stmt));
- release_defs (rhs_def_stmt);
- return true;
-   }
-}
-
-  return false;
-}
-
-
 /* Helper function for simplify_gimple_switch.  Remove case labels that
have values outside the range of the new type.  */
 
@@ -1992,467 +1920,6 @@ simplify_rotate (gimple_stmt_iterator *g
   return true;
 }
 
-/* Perform re-associations of the plus or minus statement STMT that are
-   always permitted.  Returns true if the CFG was changed.  */
-
-static bool
-associate_plusminus (gimple_stmt_iterator *gsi)
-{
-  gimple stmt = gsi_stmt (*gsi);
-  tree rhs1 = gimple_assign_rhs1 (stmt);
-  tree rhs2 = gimple_assign_rhs2 (stmt);
-  enum tree_code code = gimple_assign_rhs_code (stmt);
-  bool changed;
-
-  /* We can't reassociate at all for saturating types.  */
-  if (TYPE_SATURATING (TREE_TYPE (rhs1)))
-return false;
-
-  /* First contract negates.  */
-  do
-{
-  changed = false;
-
-  /* A +- (-B) - A -+ B.  */
-  if (TREE_CODE (rhs2) == SSA_NAME)
-   {
- gimple def_stmt = SSA_NAME_DEF_STMT (rhs2);
- if (is_gimple_assign (def_stmt)
-  gimple_assign_rhs_code (def_stmt) == NEGATE_EXPR
-  can_propagate_from (def_stmt))
-   {
- code = (code == MINUS_EXPR) ? PLUS_EXPR : MINUS_EXPR;
- gimple_assign_set_rhs_code (stmt, code);
- rhs2 = gimple_assign_rhs1 (def_stmt);
- gimple_assign_set_rhs2 (stmt, rhs2);
- gimple_set_modified (stmt, true);
- changed = true;
-   }
-   }
-
-  /* (-A) + B - B - A.  */
-  if (TREE_CODE (rhs1) == SSA_NAME
-  code == 

[PATCH][16/n] Merge from match-and-simplify, simplify_mult pattern

2014-11-10 Thread Richard Biener

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.

Richard.

2014-11-10  Richard Biener  rguent...@suse.de

* match.pd: Implement pattern from simplify_mult.
* tree-ssa-forwprop.c (simplify_mult): Remove.
(pass_forwprop::execute): Do not call simplify_mult.

Index: trunk/gcc/match.pd
===
*** trunk.orig/gcc/match.pd 2014-11-10 12:12:11.603244811 +0100
--- trunk/gcc/match.pd  2014-11-10 12:13:09.013242299 +0100
*** along with GCC; see the file COPYING3.
*** 443,445 
--- 443,453 
  operand_equal_p (@1, build_low_bits_mask (TREE_TYPE (@1),
TYPE_PRECISION (type)), 0))
 (convert @0)))
+ 
+ 
+ /* (X /[ex] A) * A - X.  */
+ (simplify
+   (mult (convert? (exact_div @0 @1)) @1)
+   /* Look through a sign-changing conversion.  */
+   (if (TYPE_PRECISION (TREE_TYPE (@0)) == TYPE_PRECISION (type))
+(convert @0)))
Index: trunk/gcc/tree-ssa-forwprop.c
===
*** trunk.orig/gcc/tree-ssa-forwprop.c  2014-11-10 12:12:11.636244810 +0100
--- trunk/gcc/tree-ssa-forwprop.c   2014-11-10 12:14:33.640238595 +0100
*** simplify_vector_constructor (gimple_stmt
*** 2588,2641 
return true;
  }
  
- /* Simplify multiplications.
-Return true if a transformation applied, otherwise return false.  */
- 
- static bool
- simplify_mult (gimple_stmt_iterator *gsi)
- {
-   gimple stmt = gsi_stmt (*gsi);
-   tree arg1 = gimple_assign_rhs1 (stmt);
-   tree arg2 = gimple_assign_rhs2 (stmt);
- 
-   if (TREE_CODE (arg1) != SSA_NAME)
- return false;
- 
-   gimple def_stmt = SSA_NAME_DEF_STMT (arg1);
-   if (!is_gimple_assign (def_stmt))
- return false;
- 
-   /* Look through a sign-changing conversion.  */
-   if (CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (def_stmt)))
- {
-   if (TYPE_PRECISION (TREE_TYPE (gimple_assign_lhs (def_stmt)))
- != TYPE_PRECISION (TREE_TYPE (gimple_assign_rhs1 (def_stmt)))
- || TREE_CODE (gimple_assign_rhs1 (def_stmt)) != SSA_NAME)
-   return false;
-   def_stmt = SSA_NAME_DEF_STMT (gimple_assign_rhs1 (def_stmt));
-   if (!is_gimple_assign (def_stmt))
-   return false;
- }
- 
-   if (gimple_assign_rhs_code (def_stmt) == EXACT_DIV_EXPR)
- {
-   if (operand_equal_p (gimple_assign_rhs2 (def_stmt), arg2, 0))
-   {
- tree res = gimple_assign_rhs1 (def_stmt);
- if (useless_type_conversion_p (TREE_TYPE (arg1), TREE_TYPE (res)))
-   gimple_assign_set_rhs_with_ops (gsi, TREE_CODE (res), res,
-   NULL_TREE);
- else
-   gimple_assign_set_rhs_with_ops (gsi, NOP_EXPR, res, NULL_TREE);
- gcc_assert (gsi_stmt (*gsi) == stmt);
- update_stmt (stmt);
- return true;
-   }
- }
- 
-   return false;
- }
- 
  
  /* Primitive lattice function for gimple_simplify.  */
  
--- 2588,2593 
*** pass_forwprop::execute (function *fun)
*** 2853,2865 
  || code == BIT_XOR_EXPR)
  simplify_rotate (gsi))
  changed = true;
-   else if (code == MULT_EXPR)
- {
-   changed = simplify_mult (gsi);
-   if (changed
-maybe_clean_or_replace_eh_stmt (stmt, stmt))
- bitmap_set_bit (to_purge, bb-index);
- }
else if (code == PLUS_EXPR
 || code == MINUS_EXPR)
  {
--- 2805,2810 


Re: [PATCH] Reset contexts in possible_polymorphic_call_targets properly

2014-11-10 Thread Jan Hubicka
 Hi
 
 in a patch I work on I store ipa_polymorphic_call_contexts in a vector
 and thus they do not get properly constructed, merely memset to zero.
 This means that I happen to be using know nothing contexts which
 have their outer_type set to NULL but the various flags are also
 false, unlike in the properly constructed ones.
 
 When I pass such context to possible_polymorphic_call_targets, I get
 wrong complete results of size one because it sets the outer_type to
 otr_type but leaves the maybe_derived_type flag cleared.  So I changed
 the function to reset the context using clear_outer_type(otr_type)
 instead, which I believe is the proper way of doing it.  However, I
 had to make that method public to do so.
 
 Bootstrapped and tested on x86_64-linux.  OK for trunk?
 
 Thanks,
 
 Martin
 
 
 2014-11-08  Martin Jambor  mjam...@suse.cz
 
   * cgraph.h (clear_outer_type): Make public.  Fix comment.
   * ipa-devirt.c (possible_polymorphic_call_targets): Use

Hmm, it is kind of hack (it would be better to avoid using malformed contextes 
around)
but OK.

Honza


[PATCH] Fix for PR63766 (handle removed functions in do_per_function_toporder)

2014-11-10 Thread Ilya Enkovich
Hi,

Here is a fix for PR63766.  Currently all functions are transformed into SSA 
before local optimizations and it allows function to be inlined and removed 
before it goes through local optimzations.  But this requires removal of these 
functions from working queue.

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

Thanks,
Ilya
--
gcc/

2014-11-10  Ilya Enkovich  ilya.enkov...@intel.com

* passes.c (remove_cgraph_node_from_order): New.
(do_per_function_toporder): Register cgraph removal
hook.

gcc/testsuite/

2014-11-10  Ilya Enkovich  ilya.enkov...@intel.com

* g++.dg/pr63766.C: New.


diff --git a/gcc/passes.c b/gcc/passes.c
index 5e91a79..b6a0b0c 100644
--- a/gcc/passes.c
+++ b/gcc/passes.c
@@ -1609,6 +1609,24 @@ do_per_function (void (*callback) (function *, void 
*data), void *data)
 static int nnodes;
 static GTY ((length (nnodes))) cgraph_node **order;
 
+/* Hook called when NODE is removed and therefore should be
+   excluded from order vector.  DATA is an array of integers.
+   DATA[0] holds max index it may be accessed by.  For cgraph
+   node DATA[node-uid + 1] holds index of this node in order
+   vector.  */
+static void
+remove_cgraph_node_from_order (cgraph_node *node, void *data)
+{
+  int *order_idx = (int *)data;
+
+  if (node-uid = order_idx[0])
+return;
+
+  int idx = order_idx[node-uid + 1];
+  if (idx = 0  idx  nnodes  order[idx] == node)
+order[idx] = NULL;
+}
+
 /* If we are in IPA mode (i.e., current_function_decl is NULL), call
function CALLBACK for every function in the call graph.  Otherwise,
call CALLBACK on the current function.
@@ -1622,13 +1640,29 @@ do_per_function_toporder (void (*callback) (function *, 
void *data), void *data)
 callback (cfun, data);
   else
 {
+  cgraph_node_hook_list *hook;
+  int *order_idx;
   gcc_assert (!order);
   order = ggc_vec_alloccgraph_node * (symtab-cgraph_count);
+
+  order_idx = (int *)xmalloc (sizeof(int) * (symtab-cgraph_max_uid + 1));
+  memset (order_idx + 1, -1, sizeof (int) * symtab-cgraph_max_uid);
+  order_idx[0] = symtab-cgraph_max_uid;
+
   nnodes = ipa_reverse_postorder (order);
   for (i = nnodes - 1; i = 0; i--)
-order[i]-process = 1;
+   {
+ order[i]-process = 1;
+ order_idx[order[i]-uid + 1] = i;
+   }
+  hook = symtab-add_cgraph_removal_hook (remove_cgraph_node_from_order,
+ order_idx);
   for (i = nnodes - 1; i = 0; i--)
{
+ /* Function could be inlined and removed as unreachable.  */
+ if (!order[i])
+   continue;
+
  struct cgraph_node *node = order[i];
 
  /* Allow possibly removed nodes to be garbage collected.  */
@@ -1637,6 +1671,8 @@ do_per_function_toporder (void (*callback) (function *, 
void *data), void *data)
  if (node-has_gimple_body_p ())
callback (DECL_STRUCT_FUNCTION (node-decl), data);
}
+  symtab-remove_cgraph_removal_hook (hook);
+  free (order_idx);
 }
   ggc_free (order);
   order = NULL;
diff --git a/gcc/testsuite/g++.dg/pr63766.C b/gcc/testsuite/g++.dg/pr63766.C
new file mode 100644
index 000..1414fbe
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pr63766.C
@@ -0,0 +1,48 @@
+/* { dg-do compile } */
+/* { dg-options -std=c++11 -O2 } */
+
+class A
+{
+ public:
+  void
+getValueType ()
+  {
+  }
+  void getTypeClass ();
+};
+template typename ImplClass class B
+{
+ public:
+  void
+Visit (A *p1)
+  {
+p1-getTypeClass ();
+static_castImplClass * (0)-VisitAtomicType (0);
+  }
+};
+class C : BC
+{
+  template typename Fn
+  void
+dumpChild (Fn p1)
+{
+  p1 ();
+}
+
+ public:
+  void dumpTypeAsChild (int);
+  void
+VisitAtomicType (A *p1)
+  {
+p1-getValueType ();
+dumpTypeAsChild (0);
+  }
+};
+void
+C::dumpTypeAsChild (int)
+{
+  dumpChild ([=]
+ {
+   Visit (0);
+ });
+}


Re: Add the latest C++ SD-6 additions.

2014-11-10 Thread Ed Smith-Rowland

On 11/09/2014 11:45 PM, Jason Merrill wrote:

On 11/09/2014 08:33 PM, Ed Smith-Rowland wrote:

+  //cpp_hashnode *node = 0;
+  //node = token-val.node.node;
+  //if (node)
+  //  pfile-mi_ind_cmacro = node;


Remove this commented-out code?

The patch is OK.

Jason


Here is the committed patch.  It has those comments removed and has some 
test case cleanup.


Would a 4.9 version be accepted?

Thanks,

Ed

Index: libcpp/include/cpplib.h
===
--- libcpp/include/cpplib.h (revision 217269)
+++ libcpp/include/cpplib.h (working copy)
@@ -580,6 +580,9 @@
  Second argument is the location of the start of the current expansion.  */
   void (*used) (cpp_reader *, source_location, cpp_hashnode *);
 
+  /* Callback to identify whether an attribute exists.  */
+  int (*has_attribute) (cpp_reader *);
+
   /* Callback that can change a user builtin into normal macro.  */
   bool (*user_builtin_macro) (cpp_reader *, cpp_hashnode *);
 };
Index: libcpp/internal.h
===
--- libcpp/internal.h   (revision 217269)
+++ libcpp/internal.h   (working copy)
@@ -261,6 +261,9 @@
   /* Nonzero if in a __has_include__ or __has_include_next__ statement.  */
   unsigned char in__has_include__;
 
+  /* Nonzero if in a __has_attribute__ statement.  */
+  unsigned char in__has_attribute__;
+
   /* Nonzero if prevent_expansion is true only because output is
  being discarded.  */
   unsigned char discarding_output;
@@ -284,6 +287,7 @@
   cpp_hashnode *n__VA_ARGS__;  /* C99 vararg macros */
   cpp_hashnode *n__has_include__;  /* __has_include__ operator */
   cpp_hashnode *n__has_include_next__; /* __has_include_next__ operator */
+  cpp_hashnode *n__has_attribute__;/* __has_attribute__ operator */
 };
 
 typedef struct _cpp_line_note _cpp_line_note;
Index: libcpp/directives.c
===
--- libcpp/directives.c (revision 217269)
+++ libcpp/directives.c (working copy)
@@ -571,6 +571,10 @@
 || node == pfile-spec_nodes.n__has_include_next__))
cpp_error (pfile, CPP_DL_ERROR,
   \__has_include__\ cannot be used as a macro name);
+  else if (is_def_or_undef
+node == pfile-spec_nodes.n__has_attribute__)
+   cpp_error (pfile, CPP_DL_ERROR,
+  \__has_attribute__\ cannot be used as a macro name);
   else if (! (node-flags  NODE_POISONED))
return node;
 }
Index: libcpp/expr.c
===
--- libcpp/expr.c   (revision 217269)
+++ libcpp/expr.c   (working copy)
@@ -65,6 +65,7 @@
 static void check_promotion (cpp_reader *, const struct op *);
 
 static cpp_num parse_has_include (cpp_reader *, enum include_type);
+static cpp_num parse_has_attribute (cpp_reader *);
 
 /* Token type abuse to create unary plus and minus operators.  */
 #define CPP_UPLUS ((enum cpp_ttype) (CPP_LAST_CPP_OP + 1))
@@ -1054,6 +1055,8 @@
return parse_has_include (pfile, IT_INCLUDE);
   else if (token-val.node.node == pfile-spec_nodes.n__has_include_next__)
return parse_has_include (pfile, IT_INCLUDE_NEXT);
+  else if (token-val.node.node == pfile-spec_nodes.n__has_attribute__)
+   return parse_has_attribute (pfile);
   else if (CPP_OPTION (pfile, cplusplus)
(token-val.node.node == pfile-spec_nodes.n_true
   || token-val.node.node == pfile-spec_nodes.n_false))
@@ -2147,3 +2150,21 @@
 
   return result;
 }
+
+/* Handle meeting __has_attribute__ in a preprocessor expression.  */
+static cpp_num
+parse_has_attribute (cpp_reader *pfile)
+{
+  pfile-state.in__has_attribute__++;
+
+  cpp_num result;
+  result.unsignedp = false;
+  result.high = 0;
+  result.overflow = false;
+
+  result.low = pfile-cb.has_attribute (pfile);
+
+  pfile-state.in__has_attribute__--;
+
+  return result;
+}
Index: libcpp/identifiers.c
===
--- libcpp/identifiers.c(revision 217269)
+++ libcpp/identifiers.c(working copy)
@@ -72,6 +72,7 @@
   s-n__VA_ARGS__-flags |= NODE_DIAGNOSTIC;
   s-n__has_include__   = cpp_lookup (pfile, DSC(__has_include__));
   s-n__has_include_next__ = cpp_lookup (pfile, DSC(__has_include_next__));
+  s-n__has_attribute__   = cpp_lookup (pfile, DSC(__has_attribute__));
 }
 
 /* Tear down the identifier hash table.  */
Index: libcpp/pch.c
===
--- libcpp/pch.c(revision 217269)
+++ libcpp/pch.c(working copy)
@@ -835,6 +835,7 @@
 s-n__VA_ARGS__ = cpp_lookup (r, DSC(__VA_ARGS__));
 s-n__has_include__ = cpp_lookup (r, DSC(__has_include__));
 s-n__has_include_next__ = cpp_lookup (r, DSC(__has_include_next__));
+s-n__has_attribute__ = cpp_lookup (r, DSC(__has_attribute__));
   }
 
   old_state 

Re: [PATCH] AIX: Filename-based shared library versioning for libgcc_s

2014-11-10 Thread David Edelsohn
On Mon, Nov 10, 2014 at 4:59 AM, Michael Haubenwallner
michael.haubenwall...@ssi-schaefer.com wrote:

 Am 2014-11-07 20:52, schrieb David Edelsohn:
 First, please explicitly copy me on AIX or PowerPC patches sent to 
 gcc-patches.

 I don't have a fundamental objection to including this option, but
 note that Richi, Honza and I have discovered that using AIX runtime
 linking option interacts badly with some GCC optimizations and can
 result in applications that hang in a loop.

 Feels like adding the aix-soname linking procedure becomes more important:

 All code on AIX is position independent (PIC) by default.  Executables
 and shared libraries essentially are PIE.  Because of this, AIX does
 not provide separate static libraries and one can link statically
 with a shared library.

 Creating a library enabled for runtime linking with -G (-brtl), causes
 a lot of problems, including a newly recognized failure mode.  Without
 careful control over AIX symbol export, all global calls with use
 glink code (equivalent to ELF PLTs). This also creates a TOC entry for
 every global call, possibly overflowing the TOC.

 About to define careful control over AIX symbol export:
 The symbols listed in the import file are those found in the object files
 only, not the ones created at linktime (like __GLOBAL*) or from the static
 objects found in libc.a. While I do this in libtool from the beginning here,
 I have had a helper script wrapping ld to support '--soname=' for non-libtool
 packages, where creating the import file from the final shared object also
 included static libc-provided symbols, which turned out as dependency pitfall.

AIX added ELF-like visibility support to XCOFF, which would be
preferred.  Except it was not added in a formal release, like AIX 8.1
and apparently was back-ported to at least AIX 6.1, so its difficult
to phase in the support. One would need to add a configure test for
the feature and not all users are upgrading the system. So one cannot
build and distribute GCC for AIX 7.1 and know the feature is
available in the system tools.  GCC builds would be incompatible and
object files, libraries, executables created by GCC would be
incompatible.  Basically, a mess.

 While I haven't focussed on nor explicitly tested, I do believe that this
 also solves problems with global C++ constructor/destructor call orders.

Why? There still is the problem of the AIX kernel runtime loader
ordering dependent shared objects.

 But the main problem is GCC uses aliases and functions declared as
 weak to support some C++ features.

 This is another reason why I do force runtime linking for our application,
 which uses these C++ features while its main target platform is Linux.

You have not explained how this has any fix / benefit affecting the
problem, other than separate shared and static libraries.  Forcing
runtime linking seems irrelevant.  It was linking shared before and
linking shared after your patch (with runtime linking) so the net
effect is zero.

Again, runtime linking of all global symbols affects performance and
bloats the TOC, making TOC overflow more likely.

I don't have a fundamental objection to the patch, but you have not
really responded to the potential problems and any motivation for this
feature other than greater SVR4 emulation.  For better or worse, AIX
is not SVR4.  Every library built with this option hurts performance
on AIX and potentially causes mysterious TOC overflow errors, which
confuse users unfamiliar with AIX and whose workarounds hurt
performance even more.

Thanks, David


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

2014-11-10 Thread Ian Taylor
On Mon, Nov 10, 2014 at 6:00 AM, Dominik Vogt v...@linux.vnet.ibm.com wrote:
 I'd still like to avoid the rampant duplication if possible.  One
 approach would be to put most of the test in something like
 nilptr_tests.go marked with // skip.  Then we can have top-level
 nilptrXX.go tests with +build lines that use // run nilptr_tests.go.

 I fail to see how that could be done with // run.  There is one
 example use, namely cmplxdivide.go.  That is not run in gcc
 because the run line does not match anything in go-test.exp.  If
 I add a rule for that, how does that help me to compile a test
 that consists of multiple files?

That test is run (all tests are run or explicitly skipped or marked
unsupported).  In go-test.exp look for
$test_line == // run cmplxdivide1.go

Ian


Re: [2/6] nvptx testsuite patches: typed assembly

2014-11-10 Thread Bernd Schmidt

On 10/21/2014 05:32 PM, Bernd Schmidt wrote:

On 10/21/2014 05:16 PM, Jeff Law wrote:

On 10/21/14 14:15, Bernd Schmidt wrote:

Since everything in ptx assembly is typed, KR C is problematic. There
are a number of testcases that call functions with the wrong number of
arguments, or arguments of the wrong type. I've added a new feature,
untyped_assembly, which these tests now require. I've also used this for
tests using builtin_apply/builtin_return.

I'd kind of prefer to see the tests fixed, but I can live with this.


Most of these are quite old, and it seems likely that they should be
kept as they are for test coverage - it's desirable to know that the
compiler doesn't crash when a KR function is called with varying
numbers of arguments for example.


Just a note that I'm assuming that your mail was an approval and 
checking this in.



Bernd



Re: The nvptx port [10/11+] Target files

2014-11-10 Thread Bernd Schmidt

On 10/30/2014 12:35 AM, Jeff Law wrote:

A nit -- Richard S. recently removed the need to include the enum
for enum machine_mode.  I believe he had a script to handle the
mundane parts of that change.  Please make sure to update the nvptx port
to conform to that new convention, obviously feel free to use the script
if you want.

You may need to update with James Greenhalgh's changes to
MOVE_BY_PIECES_P and friends.

With those two issues addressed as needed, this is OK for the trunk.


I've now committed it, in the following form. Other than the enum thing, 
this also adds some atomic instructions.


The scripts (11/11) I've put up on github, along with a hacked up 
newlib. These are at


https://github.com/bernds/nvptx-tools
https://github.com/bernds/nvptx-newlib

They are likely to migrate to MentorEmbedded from bernds, but that had 
some permissions problems last week.



Bernd

commit 659744a99d815b168716b4460e32f6a21593e494
Author: Bernd Schmidt ber...@codesourcery.com
Date:   Thu Nov 6 19:03:57 2014 +0100

Add the nvptx port.

	* configure.ac: Handle nvptx-*-*.
	* configure: Regenerate.

	gcc/
	* config/nvptx/nvptx.c: New file.
	* config/nvptx/nvptx.h: New file.
	* config/nvptx/nvptx-protos.h: New file.
	* config/nvptx/nvptx.md: New file.
	* config/nvptx/t-nvptx: New file.
	* config/nvptx/nvptx.opt: New file.
	* common/config/nvptx/nvptx-common.c: New file.
	* config.gcc: Handle nvptx-*-*.

	libgcc/
	* config.host: Handle nvptx-*-*.
	* shared-object.mk (as-flags-$o): Define.
	($(base)$(objext), $(base)_s$(objext)): Use it instead of
	-xassembler-with-cpp.
	* static-object.mk: Identical changes.
	* config/nvptx/t-nvptx: New file.
	* config/nvptx/crt0.s: New file.
	* config/nvptx/free.asm: New file.
	* config/nvptx/malloc.asm: New file.
	* config/nvptx/realloc.c: New file.

diff --git a/ChangeLog b/ChangeLog
index fd6172a..e83d1e6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2014-11-06  Bernd Schmidt  ber...@codesourcery.com
+
+	* configure.ac: Handle nvptx-*-*.
+	* configure: Regenerate.
+
 2014-11-06  Prachi Godbole  prachi.godb...@imgtec.com
 
 	* MAINTAINERS (Write After Approval): Add myself.
diff --git a/configure b/configure
index d0c760b..0e014a3 100755
--- a/configure
+++ b/configure
@@ -3779,6 +3779,10 @@ case ${target} in
   mips*-*-*)
 noconfigdirs=$noconfigdirs gprof
 ;;
+  nvptx*-*-*)
+# nvptx is just a compiler
+noconfigdirs=$noconfigdirs target-libssp target-libstdc++-v3 target-libobjc
+;;
   sh-*-* | sh64-*-*)
 case ${target} in
   sh*-*-elf)
diff --git a/configure.ac b/configure.ac
index 2f0af4a..b1ef069 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1138,6 +1138,10 @@ case ${target} in
   mips*-*-*)
 noconfigdirs=$noconfigdirs gprof
 ;;
+  nvptx*-*-*)
+# nvptx is just a compiler
+noconfigdirs=$noconfigdirs target-libssp target-libstdc++-v3 target-libobjc
+;;
   sh-*-* | sh64-*-*)
 case ${target} in
   sh*-*-elf)
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 731a7bc8b..c170e69 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,14 @@
+2014-11-10  Bernd Schmidt  ber...@codesourcery.com
+
+	* config/nvptx/nvptx.c: New file.
+	* config/nvptx/nvptx.h: New file.
+	* config/nvptx/nvptx-protos.h: New file.
+	* config/nvptx/nvptx.md: New file.
+	* config/nvptx/t-nvptx: New file.
+	* config/nvptx/nvptx.opt: New file.
+	* common/config/nvptx/nvptx-common.c: New file.
+	* config.gcc: Handle nvptx-*-*.
+
 2014-11-10  Richard Biener  rguent...@suse.de
 
 	* tree-ssa-operands.c (finalize_ssa_uses): Properly put
diff --git a/gcc/common/config/nvptx/nvptx-common.c b/gcc/common/config/nvptx/nvptx-common.c
new file mode 100644
index 000..80ab076
--- /dev/null
+++ b/gcc/common/config/nvptx/nvptx-common.c
@@ -0,0 +1,38 @@
+/* NVPTX common hooks.
+   Copyright (C) 2014 Free Software Foundation, Inc.
+   Contributed by Bernd Schmidt ber...@codesourcery.com
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3.  If not see
+http://www.gnu.org/licenses/.  */
+
+#include config.h
+#include system.h
+#include coretypes.h
+#include diagnostic-core.h
+#include tm.h
+#include tm_p.h
+#include common/common-target.h
+#include common/common-target-def.h
+#include opts.h
+#include flags.h
+
+#undef TARGET_HAVE_NAMED_SECTIONS
+#define TARGET_HAVE_NAMED_SECTIONS false
+
+#undef TARGET_DEFAULT_TARGET_FLAGS

[C++ Patch] PR 63265

2014-11-10 Thread Paolo Carlini

Hi,

as far as I can see this 4.9/5 regression, where we spuriously warn 
about the left shifts in the templates, has to do with r208183, where 
Jason replaced c_inhibit_evaluation_warnings fiddling in 
tsubst_copy_and_build with two warning_sentinels, on warn_type_limits 
and warn_div_by_zero. In the present testcase, the triggering warning is 
the one about left shift count = width of type, which currently doesn't 
have a name. Thus I think we can easily solve the issue by giving the 
warning a name (likewise for the negative count warning) and using again 
warning_sentinel. The names I picked are the same already used by clang.


Tested x86_64-linux. In case, what about 4.9?

Thanks,
Paolo.

//


2014-11-10  Paolo Carlini  paolo.carl...@oracle.com

PR c++/63265
* c-family/c.opt ([Wshift-count-negative, Wshift-count-overflow]): Add.
* doc/invoke.texi: Document the latter.

/cp
2014-11-10  Paolo Carlini  paolo.carl...@oracle.com

PR c++/63265
* pt.c (tsubst_copy_and_build, case LSHIFT_EXPR): Use warning_sentinels
on warn_shift_count_negative and warn_shift_count_overflow.
* typeck.c (cp_build_binary_op): Use OPT_Wshift_count_negative and
OPT_Wshift_count_overflow in the warnings.

/c
2014-11-10  Paolo Carlini  paolo.carl...@oracle.com

PR c++/63265
* c-typeck.c (build_binary_op): Use OPT_Wshift_count_negative and
OPT_Wshift_count_overflow in the warnings.

/testsuite
2014-11-10  Paolo Carlini  paolo.carl...@oracle.com

PR c++/63265
* g++.dg/cpp0x/constexpr-63265.C: New.
Index: c/c-typeck.c
===
--- c/c-typeck.c(revision 217282)
+++ c/c-typeck.c(working copy)
@@ -10545,7 +10545,8 @@ build_binary_op (location_t location, enum tree_co
{
  int_const = false;
  if (c_inhibit_evaluation_warnings == 0)
-   warning_at (location, 0, left shift count is negative);
+   warning_at (location, OPT_Wshift_count_negative,
+   left shift count is negative);
}
 
  else if (compare_tree_int (op1, TYPE_PRECISION (type0)) = 0)
@@ -10552,8 +10553,8 @@ build_binary_op (location_t location, enum tree_co
{
  int_const = false;
  if (c_inhibit_evaluation_warnings == 0)
-   warning_at (location, 0, left shift count = width of 
-   type);
+   warning_at (location, OPT_Wshift_count_overflow,
+   left shift count = width of type);
}
}
 
Index: c-family/c.opt
===
--- c-family/c.opt  (revision 217282)
+++ c-family/c.opt  (working copy)
@@ -760,14 +760,22 @@ Wselector
 ObjC ObjC++ Var(warn_selector) Warning
 Warn if a selector has multiple methods
 
+Wsequence-point
+C ObjC C++ ObjC++ Var(warn_sequence_point) Warning LangEnabledBy(C ObjC C++ 
ObjC++,Wall)
+Warn about possible violations of sequence point rules
+
 Wshadow-ivar
 ObjC ObjC++ Var(warn_shadow_ivar) EnabledBy(Wshadow) Init(1) Warning
 Warn if a local declaration hides an instance variable
 
-Wsequence-point
-C ObjC C++ ObjC++ Var(warn_sequence_point) Warning LangEnabledBy(C ObjC C++ 
ObjC++,Wall)
-Warn about possible violations of sequence point rules
+Wshift-count-negative
+C ObjC C++ ObjC++ Var(warn_shift_count_negative) Init(1) Warning
+Warn if left shift count is negative
 
+Wshift-count-overflow
+C ObjC C++ ObjC++ Var(warn_shift_count_overflow) Init(1) Warning
+Warn if left shift count = width of type
+
 Wsign-compare
 C ObjC C++ ObjC++ Var(warn_sign_compare) Warning LangEnabledBy(C++ ObjC++,Wall)
 Warn about signed-unsigned comparisons
Index: cp/pt.c
===
--- cp/pt.c (revision 217282)
+++ cp/pt.c (working copy)
@@ -14680,6 +14680,8 @@ tsubst_copy_and_build (tree t,
   {
warning_sentinel s1(warn_type_limits);
warning_sentinel s2(warn_div_by_zero);
+   warning_sentinel s3(warn_shift_count_negative);
+   warning_sentinel s4(warn_shift_count_overflow);
tree op0 = RECUR (TREE_OPERAND (t, 0));
tree op1 = RECUR (TREE_OPERAND (t, 1));
tree r = build_x_binary_op
Index: cp/typeck.c
===
--- cp/typeck.c (revision 217282)
+++ cp/typeck.c (working copy)
@@ -4328,7 +4328,8 @@ cp_build_binary_op (location_t location,
{
  if ((complain  tf_warning)
   c_inhibit_evaluation_warnings == 0)
-   warning (0, left shift count is negative);
+   warning (OPT_Wshift_count_negative,
+left shift count is negative);
}

Re: [C++ Patch] PR 63265

2014-11-10 Thread Jakub Jelinek
On Mon, Nov 10, 2014 at 05:32:49PM +0100, Paolo Carlini wrote:
   PR c++/63265
   * c-family/c.opt ([Wshift-count-negative, Wshift-count-overflow]): Add.

Note, c-family/ has its own ChangeLog.

Jakub


Re: [PING][PATCH][AARCH64]Fix PR63424 by adding sumaxminv2di3 pattern

2014-11-10 Thread Renlin Li

On 06/11/14 15:00, Renlin Li wrote:

Hi all,

Dose anybody have time to review this?

Kind regards,
Renlin Li

On 31/10/14 14:51, Renlin Li wrote:

Hi all,

This is a patch which will fix PR63424.

It implements signed/unsigned max/min pattern for V2DI mode in terms 
of vcondv2div2di pattern.


In this particular case, VEC_COND_EXPR (V2DImode) is generated as 
aarch64 target supports it (vcondmodemode for VALL). The 
VEC_COND_EXPR will further folded into MIN_EXPR/MAX_EXPR in dom pass 
unconditionally. Later in expand pass, the compiler tries to expand 
min_expr using standard RTL operation. It fails, because aarch64 
target don't have minv2di3 pattern implemented. It then tries to 
generate conditional move and comparebranch sequence, all fails. At 
last it falls into libfunc call, no luck either. An ICE to complain 
about this.


aarch64-none-elf toolchain has been tested on the model, no regressions.

Is it Okay for trunk?

gcc/ChangeLog:

2014-10-31  Renlin Li  renlin...@arm.com
PR target/63424
* config/aarch64/aarch64-simd.md (sumaxminv2di3): New.

gcc/testsuite/ChangeLog:

2014-10-31  Renlin Li  renlin...@arm.com
PR target/63424
* gcc.target/aarch64/pr63424.c: New.



Hi,

Dose anybody have time to review this?

Thank you so much!

Regards,
Renlin Li



[PING][PATCH]Partially fix PR61529, bound basic block frequency

2014-11-10 Thread Renlin Li

On 06/11/14 18:07, Renlin Li wrote:

On 06/11/14 17:59, Teresa Johnson wrote:

Thanks for fixing the test case. Can you also add the comment I
suggested to the source change?

Please add a comment that this is needed due to insane incoming 
frequencies.




Sorry, I mistakenly add it to the ChangeLog. Should be correct now.


x86_64-unknown-linux-gnu bootstrap and regression test have been done, 
no new issue.

aarch64-none-elf toolchain has been test on the model. No new regression.

gcc/ChangeLog:

2014-11-06  Renlin Li renlin...@arm.com
PR middle-end/61529
* tree-ssa-threadupdate.c (compute_path_counts): Bound path_in_freq.

gcc/testsuite/ChangeLog:

2014-11-06  Renlin Li renlin...@arm.com
PR middle-end/61529
* gcc.dg/pr61529.c: New.


Hi,

Can anybody help to review or approve this?

Kind regards,
Renlin Li




  1   2   >