Re: [PATCH 3/4] split-stack for powerpc64

2015-05-17 Thread Alan Modra
On Mon, May 18, 2015 at 12:24:51PM +0930, Alan Modra wrote:
> +error ("%<-fsplit-stack%> currently only supported on PowerPC64 
> GNU/Linux with glibc-2.18 or later");

I forgot to comment on this.  2.19 is actually when __private_ss
appeared in the ppc tcbhead_t, but I misread the commit date and
thought it was 2.18.  I was going to correct that, but then wondered
if glibc allocates any spare bytes, and it looks like it does.  We
have a struct pthread before tcbhead_t, and struct pthread is aligned
according to TCB_ALIGNMENT which is 16 for powerpc.  So 2.18's 56
byte tcbhead_t, which is laid out so that the end coincides with
tp-0x7000, must be preceded by 8 bytes of padding.  Enough for
__private_ss, and we don't care if it isn't initially zero.

-- 
Alan Modra
Australia Development Lab, IBM


Check canonical types in verify_type

2015-05-17 Thread Jan Hubicka
Hi,
this patch adds basic checking of TYPE_CANOINCAL. It checkes TYPE_CANONICAL
forms a tree and it moves lto's gimple_canonical_types_compatible_p back to
middle-end and uses it to check that TYPE_CANONICAL is compatible and thus none
of the FEs produce types sharing TYPE_CANONICAL that would be considered
different by LTO's TBAA.

I added trust_type_canonical argument and changed:

-  /* If the types have been previously registered and found equal
- they still are.  */
-  if (TYPE_CANONICAL (t1)
-  && TYPE_CANONICAL (t1) == TYPE_CANONICAL (t2))
-return true;

to:

+  /* If the types have been previously registered and found equal
+ they still are.  */
+  if (TYPE_CANONICAL (t1) && TYPE_CANONICAL (t2)
+  && trust_type_canonical)
+return TYPE_CANONICAL (t1) == TYPE_CANONICAL (t2);

(notice that I blocked the recursion when TYPE_CANONICAL is known to be
different).

The patch originally triggered an ICE in testsuite becuase C++ FE builds
FUNCTION_TYPE type variant with different attributes but same TYPE_CANONICAL.
I think C++ FE is correct and we may want to drop:

+  if (!comp_type_attributes (t1, t2))
+   return false;

Because I think the TBAA does not care about attribute lists.  I suppose this
is kind-of harmless because of:

+  /* For canonical type comparisons we do not want to build SCCs
+so we cannot compare pointed-to types.  But we can, for now,
+require the same pointed-to type kind and match what
+useless_type_conversion_p would do.  */
+  if (POINTER_TYPE_P (t1))
+   {
+ if (TYPE_ADDR_SPACE (TREE_TYPE (t1))
+ != TYPE_ADDR_SPACE (TREE_TYPE (t2)))
+   return false;
+
+ if (TREE_CODE (TREE_TYPE (t1)) != TREE_CODE (TREE_TYPE (t2)))
+   return false;
+   }

Is the reason for not making differences between differnt pointer types
really just lazyness to not deal with SCCs?  For that it is easy to add
set of visited type pairs, just like odr_types_equivalent_p does.

Because we now stream in SCC order anyway, most of time we won't even
need to populate it.  Shall I implement this?

Other issue I run into is that for Ada bootstrap we have variadic type whose
canonical types are having different temporary set as size.  I think this is
valid and perhaps gimple_canonical_types_compatible_p should consider
variadic arrays to be compatible with any array of compatible type?

I am not quite convinced we get variadic types right at LTO time, because
they bypass canonical type calculation anyway and their canonical type
is set by TYPE_MAIN_VARIANT in lto_read_body_or_constructor which I think
is not safe.  I will look for a testcase.

I also added check that TYPE_CANONICAL agrees for type variants.  I think it
should because few times in the middle-end uses TYPE_MAIN_VARIANT and seem to
expect this to happen:

static inline int   
same_type_for_tbaa (tree type1, tree type2) 
{   
  type1 = TYPE_MAIN_VARIANT (type1);
  type2 = TYPE_MAIN_VARIANT (type2);

  /* If we would have to do structural comparison bail out.  */ 
  if (TYPE_STRUCTURAL_EQUALITY_P (type1)
  || TYPE_STRUCTURAL_EQUALITY_P (type2))
return -1;  

  /* Compare the canonical types.  */   
  if (TYPE_CANONICAL (type1) == TYPE_CANONICAL (type2)) 
return 1;   

and some places where we look for TYPE_MAIN_VARIANT to discard qualifiers.
This check triggers for Ada, but I will look into it separately.

Bootstrapped/regtested ppc64-linux, LTO bootstrap in progress. OK?

Honza

* lto/lto.c (gimple_canonical_types_compatible_p): Move to tree.c
* tree.c (verify_type_variant): Fix #undef.
(gimple_canonical_types_compatible_p): Move here from lto.c
(verify_type): Verify TYPE_CANONICAL compatibility.
Index: lto/lto.c
===
--- lto/lto.c   (revision 223260)
+++ lto/lto.c   (working copy)
@@ -441,208 +441,6 @@ gimple_canonical_type_hash (const void *
 }
 
 
-/* The TYPE_CANONICAL merging machinery.  It should closely resemble
-   the middle-end types_compatible_p function.  It needs to avoid
-   claiming types are different for types that should be treated
-   the same with respect to TBAA.  Canonical types are also used
-   for IL consistency checks via

[PATCH] move check-gcc parallelize value into C front end

2015-05-17 Thread Jim Wilson
Every check_$lang_parallelize setting is in the language specific
Make-lang.in file except for the C front-end check_gcc_parallelize
setting which is in the toplevel Makefile.in file.  This seems to be
an oversight, as it was only 3 years ago that the c/ subdir was
created, and the check_gcc_parallelize variable looks like it might be
gcc generic, but it is actually C front end specific as it only affect
check-gcc which is a C front end target.  This patch moves the
variable into the C front end where it belongs.  This also
consolidates the change_$lang_parallelize docs, which are currently
spread across two places.  It also needs to fix two places that
directly refer to the check_gcc_parallelize setting in Makefile.in,
and change them to references to the generic docs.

Also, while looking at this, I noticed that there is no
check_gnat_parallelize set, and check-gnat seems to be the only
testsuite target that hasn't already been parallelized.  This also
looks like an oversight, but I haven't tested a patch for that yet.

Jim
gcc/
2015-05-17  Jim Wilson  

	* Makefile.in (check_gcc_parallelize): Delete.
	(lang_checks_parallelized): Update comment.

gcc/c
2015-05-17  Jim Wilson  

	* Make-lang.in (check_gcc_pallelize): Define.

gcc/cp
2015-05-17  Jim Wilson  

	* Make-lang.in (check_g++_parallelize): Update comment.

gcc/fortran
2015-05-17  Jim Wilson  

	* Make-lang.in (check_gfortran_parallelize): Update comment.

Index: gcc/Makefile.in
===
--- gcc/Makefile.in	(revision 223208)
+++ gcc/Makefile.in	(working copy)
@@ -528,10 +528,6 @@
 xm_defines=@xm_defines@
 lang_checks=
 lang_checks_parallelized=
-# Upper limit to which it is useful to parallelize this lang target.
-# It doesn't make sense to try e.g. 128 goals for small testsuites
-# like objc or go.
-check_gcc_parallelize=1
 lang_opt_files=@lang_opt_files@ $(srcdir)/c-family/c.opt $(srcdir)/common.opt
 lang_specs_files=@lang_specs_files@
 lang_tree_files=@lang_tree_files@
@@ -3743,7 +3739,9 @@
 #
 # To parallelize some language check, add the corresponding check-$lang
 # to lang_checks_parallelized variable and define check_$lang_parallelize
-# variable (see above check_gcc_parallelize description).
+# variable.  This is the upper limit to which it is useful to parallelize the
+# check-$lang target.  It doesn't make sense to try e.g. 128 goals for small
+# testsuites like objc or go.
 $(lang_checks_parallelized): check-% : site.exp
 	-rm -rf $(TESTSUITEDIR)/$*-parallel
 	@if [ "$(filter -j, $(MFLAGS))" = "-j" ]; then \
Index: gcc/c/Make-lang.in
===
--- gcc/c/Make-lang.in	(revision 223208)
+++ gcc/c/Make-lang.in	(working copy)
@@ -95,6 +95,8 @@
 # List of targets that can use the generic check- rule and its // variant.
 lang_checks += check-gcc
 lang_checks_parallelized += check-gcc
+# For description see the check_$lang_parallelize comment in gcc/Makefile.in.
+check_gcc_parallelize=1
 
 # 'make check' in gcc/ looks for check-c.  Redirect it to check-gcc.
 check-c : check-gcc
Index: gcc/cp/Make-lang.in
===
--- gcc/cp/Make-lang.in	(revision 223208)
+++ gcc/cp/Make-lang.in	(working copy)
@@ -155,7 +155,7 @@
 # List of targets that can use the generic check- rule and its // variant.
 lang_checks += check-g++
 lang_checks_parallelized += check-g++
-# For description see comment above check_gcc_parallelize in gcc/Makefile.in.
+# For description see the check_$lang_parallelize comment in gcc/Makefile.in.
 check_g++_parallelize = 1
 #
 # Install hooks:
Index: gcc/fortran/Make-lang.in
===
--- gcc/fortran/Make-lang.in	(revision 223208)
+++ gcc/fortran/Make-lang.in	(working copy)
@@ -167,7 +167,7 @@
 check-fortran-subtargets : check-gfortran-subtargets
 lang_checks += check-gfortran
 lang_checks_parallelized += check-gfortran
-# For description see comment above check_gcc_parallelize in gcc/Makefile.in.
+# For description see the check_$lang_parallelize comment in gcc/Makefile.in.
 check_gfortran_parallelize = 1
 
 # GFORTRAN documentation.


[PATCH 4/4] Split-stack arg pointer init refinement

2015-05-17 Thread Alan Modra
This small refinement to the -fsplit-stack prologue arg pointer
initialization improves code generation.  Compare the -O2
gcc/testsuite/gcc.dg/split-3.c code for down() below.

before  after
mflr 0  mflr 0
std 31,-8(1)std 31,-8(1)
std 0,16(1) mr 12,1
stdu 1,-10144(1)std 0,16(1)
addi 12,1,10144 stdu 1,-10144(1)
bge 7,.L7   bge 7,.L7
mr 12,29mr 12,29
.L7:.L7:

* config/rs6000/rs6000.c (rs6000_emit_allocate_stack): Return
stack adjusting insn.  Formatting.
(rs6000_emit_prologue): Track stack adjusting insn, and use of
r12.  If possible, emit first -fsplit-stack arg pointer insn
before stack adjust.  Don't use r12 to save cr if split-stack.

diff -urpN gcc-split-stack1/gcc/config/rs6000/rs6000.c 
gcc-split-stack2/gcc/config/rs6000/rs6000.c
--- gcc-split-stack1/gcc/config/rs6000/rs6000.c 2015-05-18 10:17:11.341628090 
+0930
+++ gcc-split-stack2/gcc/config/rs6000/rs6000.c 2015-05-18 10:16:58.758131165 
+0930
@@ -22608,7 +22608,7 @@ rs6000_emit_stack_tie (rtx fp, bool hard
If COPY_REG, make sure a copy of the old frame is left there.
The generated code may use hard register 0 as a temporary.  */
 
-static void
+static rtx_insn *
 rs6000_emit_allocate_stack (HOST_WIDE_INT size, rtx copy_reg, int copy_off)
 {
   rtx_insn *insn;
@@ -22621,7 +22621,7 @@ rs6000_emit_allocate_stack (HOST_WIDE_IN
 {
   warning (0, "stack frame too large");
   emit_insn (gen_trap ());
-  return;
+  return 0;
 }
 
   if (crtl->limit_stack)
@@ -22672,9 +22672,9 @@ rs6000_emit_allocate_stack (HOST_WIDE_IN
   
   insn = emit_insn (TARGET_32BIT
? gen_movsi_update_stack (stack_reg, stack_reg,
-   todec, stack_reg)
+ todec, stack_reg)
: gen_movdi_di_update_stack (stack_reg, stack_reg,
-  todec, stack_reg));
+todec, stack_reg));
   /* Since we didn't use gen_frame_mem to generate the MEM, grab
  it now and set the alias set/attributes. The above gen_*_update
  calls will generate a PARALLEL with the MEM set being the first
@@ -22692,6 +22692,7 @@ rs6000_emit_allocate_stack (HOST_WIDE_IN
   add_reg_note (insn, REG_FRAME_RELATED_EXPR,
gen_rtx_SET (stack_reg, gen_rtx_PLUS (Pmode, stack_reg,
  GEN_INT (-size;
+  return insn;
 }
 
 #define PROBE_INTERVAL (1 << STACK_CHECK_PROBE_INTERVAL_EXP)
@@ -23496,6 +23497,10 @@ rs6000_emit_prologue (void)
   /* Offset to top of frame for frame_reg and sp respectively.  */
   HOST_WIDE_INT frame_off = 0;
   HOST_WIDE_INT sp_off = 0;
+  /* sp_adjust is the stack adjusting instruction, tracked so that the
+ insn setting up the split-stack arg pointer can be emitted just
+ prior to it, when r12 is not used here for other purposes.  */
+  rtx_insn *sp_adjust = 0;
 
 #ifdef ENABLE_CHECKING
   /* Track and check usage of r0, r11, r12.  */
@@ -23714,7 +23719,10 @@ rs6000_emit_prologue (void)
ptr_off = info->altivec_save_offset + info->altivec_size;
  frame_off = -ptr_off;
}
-  rs6000_emit_allocate_stack (info->total_size, ptr_reg, ptr_off);
+  sp_adjust = rs6000_emit_allocate_stack (info->total_size,
+ ptr_reg, ptr_off);
+  if (REGNO (frame_reg_rtx) == 12)
+   sp_adjust = 0;
   sp_off = info->total_size;
   if (frame_reg_rtx != sp_reg_rtx)
rs6000_emit_stack_tie (frame_reg_rtx, false);
@@ -23755,7 +23763,8 @@ rs6000_emit_prologue (void)
   if (!WORLD_SAVE_P (info)
   && info->cr_save_p
   && REGNO (frame_reg_rtx) != cr_save_regno
-  && !(using_static_chain_p && cr_save_regno == 11))
+  && !(using_static_chain_p && cr_save_regno == 11)
+  && !(flag_split_stack && cr_save_regno == 12 && sp_adjust))
 {
   cr_save_rtx = gen_rtx_REG (SImode, cr_save_regno);
   START_USE (cr_save_regno);
@@ -23901,6 +23910,8 @@ rs6000_emit_prologue (void)
   int end_save = info->gp_save_offset + info->gp_size;
   int ptr_off;
 
+  if (ptr_regno == 12)
+   sp_adjust = 0;
   if (!ptr_set_up)
ptr_reg = gen_rtx_REG (Pmode, ptr_regno);
 
@@ -24219,7 +24230,10 @@ rs6000_emit_prologue (void)
}
   else if (REGNO (frame_reg_rtx) == 1)
frame_off = info->total_size;
-  rs6000_emit_allocate_stack (info->total_size, ptr_reg, ptr_off);
+  sp_adjust = rs6000_emit_allocate_stack (info->total_size,
+ ptr_reg, ptr_off);
+  if (REGNO (frame_reg_rtx) == 12)
+   sp_adjust = 0;
   sp_off = info->total_size;
   if (frame_reg_rtx != sp_reg_rtx)
rs6000_emit_stack_tie (frame_reg_r

[PATCH 2/4] prologue and epilogue tidy and -mno-vrsave bug fix

2015-05-17 Thread Alan Modra
This patch tidies the prologue and epilogue altivec code a little.
A number of places using info->altivec_size unnecessarily also test
TARGET_ALTIVEC_ABI, when rs6000_stack_info() guarantees that
info->altivec_size is zero if !TARGET_ALTIVEC_ABI.

Similarly by inspection of rs6000_stack_info() code,
TARGET_ALTIVEC_VRSAVE && info->vrsave_mask != 0, used when deciding to
save or restore vrsave, can be replaced with info->vrsave_size.  I
also removed the TARGET_ALTIVEC test used with save/restore of vrsave.
I believe it is redundant because compute_vrsave_mask() will return 0
when no altivec registers are used (and of course you can't use then
without TARGET_ALTIVEC), except for Darwin where TARGET_ALTIVEC is
forced.  The vrsave changes make the code actually doing the save or
restore visually consistent with code that sets up a frame register
for vrsave.

Finally, I've changed two places that use info->vrsave_mask to test
whether vrsave is saved or restored, to use info->vrsave_size.  This
is a bug fix for -mno-vrsave.

* config/rs6000/rs6000.c (struct rs6000_stack): Correct comments.
(rs6000_stack_info): Don't zero offsets when not saving registers.
(debug_stack_info): Adjust to omit printing unused offsets,
as before.
(direct_return): Test vrsave_size rather than vrsave_mask.
(rs6000_emit_prologue): Likewise.  Remove redundant altivec tests.
(rs6000_emit_epilogue): Likewise.

diff -urp gcc-stack-info1/gcc/config/rs6000/rs6000.c 
gcc-stack-info2/gcc/config/rs6000/rs6000.c
--- gcc-stack-info1/gcc/config/rs6000/rs6000.c  2015-05-18 09:44:34.027608414 
+0930
+++ gcc-stack-info2/gcc/config/rs6000/rs6000.c  2015-05-16 13:33:37.170406399 
+0930
@@ -155,10 +155,9 @@ typedef struct rs6000_stack {
   int gp_size; /* size of saved GP registers */
   int fp_size; /* size of saved FP registers */
   int altivec_size;/* size of saved AltiVec registers */
-  int cr_size; /* size to hold CR if not in save_size */
-  int vrsave_size; /* size to hold VRSAVE if not in save_size */
-  int altivec_padding_size;/* size of altivec alignment padding if
-  not in save_size */
+  int cr_size; /* size to hold CR if not in fixed area */
+  int vrsave_size; /* size to hold VRSAVE */
+  int altivec_padding_size;/* size of altivec alignment padding */
   int spe_gp_size; /* size of 64-bit GPR save size for SPE */
   int spe_padding_size;
   HOST_WIDE_INT total_size;/* total bytes allocated for stack */
@@ -5206,7 +5205,7 @@ direct_return (void)
  && info->first_altivec_reg_save == LAST_ALTIVEC_REGNO + 1
  && ! info->lr_save_p
  && ! info->cr_save_p
- && info->vrsave_mask == 0
+ && info->vrsave_size == 0
  && ! info->push_p)
return 1;
 }
@@ -23637,7 +23636,7 @@ rs6000_emit_prologue (void)
   || info->first_fp_reg_save < 64
   || info->first_gp_reg_save < 32
   || info->altivec_size != 0
-  || info->vrsave_mask != 0
+  || info->vrsave_size != 0
   || crtl->calls_eh_return)
ptr_regno = 12;
   else
@@ -24185,7 +24184,7 @@ rs6000_emit_prologue (void)
 
   /* Save AltiVec registers if needed.  Save here because the red zone does
  not always include AltiVec registers.  */
-  if (!WORLD_SAVE_P (info) && TARGET_ALTIVEC_ABI
+  if (!WORLD_SAVE_P (info)
   && info->altivec_size != 0 && (strategy & SAVE_INLINE_VRS) == 0)
 {
   int end_save = info->altivec_save_offset + info->altivec_size;
@@ -24221,7 +24220,7 @@ rs6000_emit_prologue (void)
  frame_off = ptr_off;
}
 }
-  else if (!WORLD_SAVE_P (info) && TARGET_ALTIVEC_ABI
+  else if (!WORLD_SAVE_P (info)
   && info->altivec_size != 0)
 {
   int i;
@@ -24263,9 +24262,7 @@ rs6000_emit_prologue (void)
  epilogue.  */
 
   if (!WORLD_SAVE_P (info)
-  && TARGET_ALTIVEC
-  && TARGET_ALTIVEC_VRSAVE
-  && info->vrsave_mask != 0)
+  && info->vrsave_size != 0)
 {
   rtx reg, vrsave;
   int offset;
@@ -24827,8 +24824,7 @@ rs6000_emit_epilogue (int sibcall)
 
   /* Restore AltiVec registers if we must do so before adjusting the
  stack.  */
-  if (TARGET_ALTIVEC_ABI
-  && info->altivec_size != 0
+  if (info->altivec_size != 0
   && (ALWAYS_RESTORE_ALTIVEC_BEFORE_POP
  || (DEFAULT_ABI != ABI_V4
  && offset_below_red_zone_p (info->altivec_save_offset
@@ -24915,9 +24911,7 @@ rs6000_emit_epilogue (int sibcall)
 }
 
   /* Restore VRSAVE if we must do so before adjusting the stack.  */
-  if (TARGET_ALTIVEC
-  && TARGET_ALTIVEC_VRSAVE
-  && info->vrsave_mask != 0
+  if (info->vrsave_size != 0
   && (ALWAYS_RESTORE_ALTIVEC_BEFORE_POP
  || (DEFAULT_ABI != ABI_V4
  && offset_below_red_zone_p (info->vrsave_save_offset)

[PATCH 1/4] rs6000_stack_info changes for -fsplit-stack

2015-05-17 Thread Alan Modra
This patch changes rs6000_stack_info to keep save areas offsets even
when not used.  I need lr_save_offset valid for split-stack, and it
seemed reasonable to treat the other offsets the same.  Not zeroing
the offsets requires just one change in code that uses them, the
use_backchain_to_restore_sp expression in rs6000_emit_epilogue, not
counting the debug_stack_info changes.

* config/rs6000/rs6000.c (rs6000_stack_info): Don't zero offsets
when not saving registers.
(debug_stack_info): Adjust to omit printing unused offsets,
as before.
(rs6000_emit_epilogue): Adjust use_backchain_to_restore_sp
expression.

diff -urp gcc-virgin/gcc/config/rs6000/rs6000.c 
gcc-stack-info1/gcc/config/rs6000/rs6000.c
--- gcc-virgin/gcc/config/rs6000/rs6000.c   2015-05-15 14:15:38.157244403 
+0930
+++ gcc-stack-info1/gcc/config/rs6000/rs6000.c  2015-05-18 09:44:34.027608414 
+0930
@@ -22014,31 +22014,6 @@ rs6000_stack_info (void)
   else
 info_ptr->push_p = non_fixed_size > (TARGET_32BIT ? 220 : 288);
 
-  /* Zero offsets if we're not saving those registers.  */
-  if (info_ptr->fp_size == 0)
-info_ptr->fp_save_offset = 0;
-
-  if (info_ptr->gp_size == 0)
-info_ptr->gp_save_offset = 0;
-
-  if (! TARGET_ALTIVEC_ABI || info_ptr->altivec_size == 0)
-info_ptr->altivec_save_offset = 0;
-
-  /* Zero VRSAVE offset if not saved and restored.  */
-  if (! TARGET_ALTIVEC_VRSAVE || info_ptr->vrsave_mask == 0)
-info_ptr->vrsave_save_offset = 0;
-
-  if (! TARGET_SPE_ABI
-  || info_ptr->spe_64bit_regs_used == 0
-  || info_ptr->spe_gp_size == 0)
-info_ptr->spe_gp_save_offset = 0;
-
-  if (! info_ptr->lr_save_p)
-info_ptr->lr_save_offset = 0;
-
-  if (! info_ptr->cr_save_p)
-info_ptr->cr_save_offset = 0;
-
   return info_ptr;
 }
 
@@ -22144,28 +22119,28 @@ debug_stack_info (rs6000_stack_t *info)
   if (info->calls_p)
 fprintf (stderr, "\tcalls_p = %5d\n", info->calls_p);
 
-  if (info->gp_save_offset)
+  if (info->gp_size)
 fprintf (stderr, "\tgp_save_offset  = %5d\n", info->gp_save_offset);
 
-  if (info->fp_save_offset)
+  if (info->fp_size)
 fprintf (stderr, "\tfp_save_offset  = %5d\n", info->fp_save_offset);
 
-  if (info->altivec_save_offset)
+  if (info->altivec_size)
 fprintf (stderr, "\taltivec_save_offset = %5d\n",
 info->altivec_save_offset);
 
-  if (info->spe_gp_save_offset)
+  if (info->spe_gp_size == 0)
 fprintf (stderr, "\tspe_gp_save_offset  = %5d\n",
 info->spe_gp_save_offset);
 
-  if (info->vrsave_save_offset)
+  if (info->vrsave_size)
 fprintf (stderr, "\tvrsave_save_offset  = %5d\n",
 info->vrsave_save_offset);
 
-  if (info->lr_save_offset)
+  if (info->lr_save_p)
 fprintf (stderr, "\tlr_save_offset  = %5d\n", info->lr_save_offset);
 
-  if (info->cr_save_offset)
+  if (info->cr_save_p)
 fprintf (stderr, "\tcr_save_offset  = %5d\n", info->cr_save_offset);
 
   if (info->varargs_save_offset)
@@ -24736,7 +24711,9 @@ rs6000_emit_epilogue (int sibcall)
  here will not trigger at the moment;  We don't actually need a
  frame pointer for alloca, but the generic parts of the compiler
  give us one anyway.  */
-  use_backchain_to_restore_sp = (info->total_size > 32767 - 
info->lr_save_offset
+  use_backchain_to_restore_sp = (info->total_size + (info->lr_save_p
+? info->lr_save_offset
+: 0) > 32767
 || (cfun->calls_alloca
 && !frame_pointer_needed));
   restore_lr = (info->lr_save_p

-- 
Alan Modra
Australia Development Lab, IBM


[Patch 0/4] PowerPC64 Linux split stack support

2015-05-17 Thread Alan Modra
The following series of patches add -fsplit-stack support for
powerpc64-linux.  Each was cumulatively bootstrapped and regression
tested powerpc64-linux and powerpc64le-linux.

-- 
Alan Modra
Australia Development Lab, IBM


Remove splay_tree from gimplify.c

2015-05-17 Thread Aditya K
The function `splay_tree_node splay_tree_lookup (splay_tree, splay_tree_key);'
updates the nodes every time a lookup is done.

IIUC, There are places where we call this function in a loop i.e., we lookup 
different elements every time.
e.g.,
In this exaple we are looking for a different `t' in each iteration.

gcc/gimplify.c:1096: splay_tree_lookup (ctx->variables, (splay_tree_key) t) == 
NULL)

Here, we change the tree itself `ctx'
gcc/gimplify.c:5532: n = splay_tree_lookup (ctx->variables, 
(splay_tree_key)decl);


I think we don't need to update the tree in these cases at least.

I have pasted the patch which removes splay_tree with hash_map. Another patch 
(attached) removes splay_tree with std::map.
Please review the patches.


Thanks,
-Aditya

gcc/ChangeLog:

2015-05-17  hiraditya  
    Remove splay_tree from gimplify.c

        * gimplify.c (struct gimplify_omp_ctx): Replaced splay_tree with 
hash_map
        (splay_tree_compare_decl_uid): Likewise
        (new_omp_context): Likewise
        (delete_omp_context): Likewise
        (gimplify_bind_expr): Likewise
        (omp_firstprivatize_variable): Likewise
        (omp_add_variable): Likewise
        (omp_notice_threadprivate_variable): Likewise
        (omp_notice_variable): Likewise
        (omp_is_private): Likewise
        (omp_check_private): Likewise
        (gimplify_adjust_omp_clauses_1): Likewise
        (gimplify_adjust_omp_clauses): Likewise
        (gimplify_omp_for): Likewise
        * hash-map.h: Added typedefs.

diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index 4846478..4454ec4 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -92,6 +92,20 @@ along with GCC; see the file COPYING3.  If not see
 #include "tree-pass.h"         /* FIXME: only for PROP_gimple_any */
 #include "builtins.h"

+struct tree_compare_decl_uid : default_hashmap_traits {
+  static inline hashval_t hash(tree t)
+  {
+    return iterative_hash_expr(t, 0);
+  }
+
+  static inline bool equal_keys(const tree &xa, const tree &xb)
+  {
+    return DECL_UID (xa) == DECL_UID (xb);
+  }
+};
+
+typedef hash_map gimplify_tree_t;
+
 enum gimplify_omp_var_data
 {
   GOVD_SEEN = 1,
@@ -166,7 +180,7 @@ struct gimplify_ctx
 struct gimplify_omp_ctx
 {
   struct gimplify_omp_ctx *outer_context;
-  splay_tree variables;
+  gimplify_tree_t *variables;
   hash_set *privatized_types;
   location_t location;
   enum omp_clause_default_kind default_kind;
@@ -364,17 +378,6 @@ gimple_pop_condition (gimple_seq *pre_p)
     }
 }

-/* A stable comparison routine for use with splay trees and DECLs.  */
-
-static int
-splay_tree_compare_decl_uid (splay_tree_key xa, splay_tree_key xb)
-{
-  tree a = (tree) xa;
-  tree b = (tree) xb;
-
-  return DECL_UID (a) - DECL_UID (b);
-}
-
 /* Create a new omp construct that deals with variable remapping.  */

 static struct gimplify_omp_ctx *
@@ -384,7 +387,7 @@ new_omp_context (enum omp_region_type region_type)

   c = XCNEW (struct gimplify_omp_ctx);
   c->outer_context = gimplify_omp_ctxp;
-  c->variables = splay_tree_new (splay_tree_compare_decl_uid, 0, 0);
+  c->variables = new gimplify_tree_t;
   c->privatized_types = new hash_set;
   c->location = input_location;
   c->region_type = region_type;
@@ -401,7 +404,7 @@ new_omp_context (enum omp_region_type region_type)
 static void
 delete_omp_context (struct gimplify_omp_ctx *c)
 {
-  splay_tree_delete (c->variables);
+  delete c->variables;
   delete c->privatized_types;
   XDELETE (c);
 }
@@ -1093,8 +1096,7 @@ gimplify_bind_expr (tree *expr_p, gimple_seq *pre_p)
          /* Mark variable as local.  */
          if (ctx && !DECL_EXTERNAL (t)
              && (! DECL_SEEN_IN_BIND_EXPR_P (t)
-                 || splay_tree_lookup (ctx->variables,
-                                       (splay_tree_key) t) == NULL))
+                 || ctx->variables->get(t) == NULL))
            {
              if (ctx->region_type == ORT_SIMD
                  && TREE_ADDRESSABLE (t)
@@ -5550,20 +5552,20 @@ gimplify_stmt (tree *stmt_p, gimple_seq *seq_p)
 void
 omp_firstprivatize_variable (struct gimplify_omp_ctx *ctx, tree decl)
 {
-  splay_tree_node n;
+  gimplify_tree_t::data_type *n;

   if (decl == NULL || !DECL_P (decl))
     return;

   do
     {
-      n = splay_tree_lookup (ctx->variables, (splay_tree_key)decl);
+      n = ctx->variables->get(decl);
       if (n != NULL)
        {
-         if (n->value & GOVD_SHARED)
-           n->value = GOVD_FIRSTPRIVATE | (n->value & GOVD_SEEN);
-         else if (n->value & GOVD_MAP)
-           n->value |= GOVD_MAP_TO_ONLY;
+         if (*n & GOVD_SHARED)
+           *n = GOVD_FIRSTPRIVATE | (*n & GOVD_SEEN);
+         else if (*n & GOVD_MAP)
+           *n |= GOVD_MAP_TO_ONLY;
          else
            return;
        }
@@ -5640,7 +5642,7 @@ omp_firstprivatize_type_sizes (struct gimplify_omp_ctx 
*ctx, tree type)
 static void
 omp_add_variable (struct gimplify_omp_ctx *ctx, tree decl, unsigned int flags)
 {
-  splay_tree_node n;
+  gimplify_tree_t::data_type *n;
 

[patch, fortran] Inline matmul with conjugate complex numbers

2015-05-17 Thread Thomas Koenig
Hello world,

this patch extends the inline matmul functionality to conjugate
complex numbers.

Regression-tested. OK for trunk?

Regards

Thomas

2015-05-17  Thomas Koenig  

PR fortran/66176
* frontend-passes.c (check_conjg_variable):  New function.
(inline_matmul_assign):  Use it to keep track of conjugated
variables.

2015-05-17  Thomas Koenig  

PR fortran/66176
* gfortran.dg/inline_matmul_11.f90:  New test.
Index: frontend-passes.c
===
--- frontend-passes.c	(Revision 223202)
+++ frontend-passes.c	(Arbeitskopie)
@@ -2700,6 +2700,45 @@ has_dimen_vector_ref (gfc_expr *e)
   return false;
 }
 
+/* If handed an expression of the form
+
+   CONJG(A)
+
+   check if A can be handled by matmul and return if there is an uneven number
+   of CONJG calls.  Return a pointer to the array when everything is OK, NULL
+   otherwise. The caller has to check for the correct rank.  */
+
+static gfc_expr*
+check_conjg_variable (gfc_expr *e, bool *conjg)
+{
+  *conjg = false;
+
+  do
+{
+  if (e->expr_type == EXPR_VARIABLE)
+	{
+	  gcc_assert (e->rank == 1 || e->rank == 2);
+	  return e;
+	}
+  else if (e->expr_type == EXPR_FUNCTION)
+	{
+	  if (e->value.function.isym == NULL)
+	return NULL;
+
+	  if (e->value.function.isym->id == GFC_ISYM_CONJG)
+	*conjg = !*conjg;
+	  else return NULL;
+	}
+  else
+	return NULL;
+
+  e = e->value.function.actual->expr;
+}
+  while(1);
+
+  return NULL;
+}
+
 /* Inline assignments of the form c = matmul(a,b).
Handle only the cases currently where b and c are rank-two arrays.
 
@@ -2744,6 +2783,7 @@ inline_matmul_assign (gfc_code **c, int *walk_subt
   int i;
   gfc_code *if_limit = NULL;
   gfc_code **next_code_point;
+  bool conjg_a, conjg_b;
 
   if (co->op != EXEC_ASSIGN)
 return 0;
@@ -2760,15 +2800,13 @@ inline_matmul_assign (gfc_code **c, int *walk_subt
   changed_statement = NULL;
 
   a = expr2->value.function.actual;
-  matrix_a = a->expr;
+  matrix_a = check_conjg_variable (a->expr, &conjg_a);
+  if (matrix_a == NULL)
+return 0;
+
   b = a->next;
-  matrix_b = b->expr;
-
-  /* Currently only handling direct variables.  Transpose etc. will come
- later.  */
-
-  if (matrix_a->expr_type != EXPR_VARIABLE
-  || matrix_b->expr_type != EXPR_VARIABLE)
+  matrix_b = check_conjg_variable (b->expr, &conjg_b);
+  if (matrix_b == NULL)
 return 0;
 
   if (has_dimen_vector_ref (expr1) || has_dimen_vector_ref (matrix_a)
@@ -2775,15 +2813,16 @@ inline_matmul_assign (gfc_code **c, int *walk_subt
   || has_dimen_vector_ref (matrix_b))
 return 0;
 
+  /* We do not handle data dependencies yet.  */
+  if (gfc_check_dependency (expr1, matrix_a, true)
+  || gfc_check_dependency (expr1, matrix_b, true))
+return 0;
+
   if (matrix_a->rank == 2)
 m_case = matrix_b->rank == 1 ? A2B1 : A2B2;
   else
 m_case = A1B2;
 
-  /* We do not handle data dependencies yet.  */
-  if (gfc_check_dependency (expr1, matrix_a, true)
-  || gfc_check_dependency (expr1, matrix_b, true))
-return 0;
 
   ns = insert_block ();
 
@@ -3056,6 +3095,14 @@ inline_matmul_assign (gfc_code **c, int *walk_subt
   gcc_unreachable();
 }
 
+  if (conjg_a)
+ascalar = gfc_build_intrinsic_call (ns, GFC_ISYM_CONJG, "conjg", matrix_a->where,
+	1, ascalar);
+
+  if (conjg_b)
+bscalar = gfc_build_intrinsic_call (ns, GFC_ISYM_CONJG, "conjg", matrix_a->where,
+	1, bscalar);
+
   /* First loop comes after the zero assignment.  */
   assign_zero->next = do_1;
 
! { dg-do  run }
! { dg-additional-options "-ffrontend-optimize -fdump-tree-original" }
! PR fortran/66176 - inline conjg for matml.
program main
  complex, dimension(3,2) :: a
  complex, dimension(2,4) :: b, b2
  complex, dimension(3,4) :: c,c2
  complex, dimension(3,4) :: res1, res2, res3

  data a/(2.,-3.),(-5.,-7.),(11.,-13.),(-17.,-19.),(23.,-29.),(-31.,-37.) /
  data b/(41.,-43.),(-47.,-53.),(59.,-61.),(-67.,-71.),(73.,-79.),&
   & (-83.,-89.),(97.,-101.), (-103.,-107.)/

  data res1 /  (-255.,1585.),(-3124.,72.),(-612.,2376.),(-275.,2181.), &
   & (-4322.,202.),(-694.,3242.),(-371.,2713.),( -5408.,244.),(-944.,4012.),&
   & (-391.,3283.),(-6664.,352.),(-1012.,4756.)/

  data res2 / (2017.,-45.),(552.,2080.),(4428.,36.),(2789.,11.),(650.,2858.),&
   & (6146.,182.),(3485.,3.),(860.,3548.),(7696.,232.),(4281.,49.),&
   & (956.,4264.),(9532.,344.)/

  c = matmul(a,b)
  if (any(res1 /= c)) call abort
  b2 = conjg(b)
  c = matmul(a,conjg(b2))
  if (any(res1 /= c)) call abort
  c = matmul(a,conjg(b))
  if (any(res2 /= c)) call abort
  c = matmul(conjg(a), b)
  if (any(conjg(c) /= res2)) call abort
end program main
! { dg-final { scan-tree-dump-times "_gfortran_matmul" 0 "original" } }
! { dg-final { cleanup-tree-dump "original" } }


Re: Mostly rewrite genrecog

2015-05-17 Thread Richard Sandiford
Andreas Krebbel  writes:
> Hi Richard,
>
> I see regressions with the current IBM z13 vector patchset which appear to be 
> related to the new
> genrecog.
>
> The following two insn definitions only differ in the mode and predicate of 
> the shift count operand.
>
> (define_insn "lshr3"
>   [(set (match_operand:VI  0 "register_operand" "=v")
> (lshiftrt:VI (match_operand:VI 1 "register_operand"  "v")
>  (match_operand:SI 2 "shift_count_or_setmem_operand" 
> "Y")))]
>   "TARGET_VX"
>   "vesrl\t%v0,%v1,%Y2"
>   [(set_attr "op_type" "VRS")])
>
> (define_insn "vlshr3"
>   [(set (match_operand:VI  0 "register_operand" "=v")
> (lshiftrt:VI (match_operand:VI 1 "register_operand"  "v")
>  (match_operand:VI 2 "register_operand"  "v")))]
>   "TARGET_VX"
>   "vesrlv\t%v0,%v1,%v2"
>   [(set_attr "op_type" "VRR")])
>
>
> However, the insn-recog.c code only seem to check the predicate. This is a 
> problem since
> shift_count_or_setmem_operand does not check the mode.

Yeah, it's a bug if a "non-special" predicate doesn't check the mode.
Even old genreog relied on that:

/* After factoring, try to simplify the tests on any one node.
   Tests that are useful for switch statements are recognizable
   by having only a single test on a node -- we'll be manipulating
   nodes with multiple tests:

   If we have mode tests or code tests that are redundant with
   predicates, remove them.  */

although it sounds like the old optimisation didn't trigger for your case.

genpreds.c:mark_mode_tests is supposed to add these tests automatically
if needed.  I suppose it isn't doing so here because the predicate
accepts const_int and because of:

/* Given an RTL expression EXP, find all subexpressions which we may
   assume to perform mode tests.  Normal MATCH_OPERAND does;
   MATCH_CODE does if it applies to the whole expression and accepts
   CONST_INT or CONST_DOUBLE; and we have to assume that MATCH_TEST
   does not.  [...]
*/
static void
mark_mode_tests (rtx exp)
{
  switch (GET_CODE (exp))
{
[...]
case MATCH_CODE:
  if (XSTR (exp, 1)[0] != '\0'
|| (!strstr (XSTR (exp, 0), "const_int")
  && !strstr (XSTR (exp, 0), "const_double")))
  NO_MODE_TEST (exp) = 1;
  break;

The code matches the comment, but it doesn't look right.  Perhaps it
was supposed to mean match_codes that _only_ contain const_int and
const_double?  Knowing that the rtx is one of those codes guarantees
that the mode is VOIDmode, but a match_code that includes other rtxes
as well doesn't itself test the mode of those rtxes.

Even then, a predicate that matches const_ints and is passed SImode
mustn't accept const_ints outside the SImode range.  I suppose we
just rely on all predicates to perform some kind of range check.
(The standard ones do of course.)

As a quick workaround, try replacing the case above with:

case MATCH_CODE:
  if (XSTR (exp, 1)[0] != '\0')
NO_MODE_TEST (exp) = 1;
  break;

I'll try to come up with a better fix in the meantime.

Thanks,
Richard



[SH][committed] Fix gcc.target/sh/pr54236-1.c failures

2015-05-17 Thread Oleg Endo
Hi,

Since the recent changes in combine w.r.t. canonical forms of ashift and
mult outside mems, some of the SH patterns stopped working.  The
attached patch fixes the failures in gcc.target/sh/pr54236-1.c.

Tested briefly with
make -k check-gcc RUNTESTFLAGS="sh.exp --target_board=sh-sim
\{-m2/-ml,-m2/-mb,-m2a/-mb,-m4/-ml,-m4/-mb,-m4a/-ml,-m4a/-mb}"

Committed as r223274.

Cheers,
Oleg

gcc/ChangeLog:
PR target/54236
* config/sh/sh.md (*addc_2r_t): Use ashift instead of mult.
Index: gcc/config/sh/sh.md
===
--- gcc/config/sh/sh.md	(revision 223270)
+++ gcc/config/sh/sh.md	(working copy)
@@ -2040,8 +2040,8 @@
 (define_insn_and_split "*addc_2r_t"
   [(set (match_operand:SI 0 "arith_reg_dest")
 	(plus:SI (match_operand 1 "treg_set_expr")
-		 (mult:SI (match_operand:SI 2 "arith_reg_operand")
-			  (const_int 2
+		 (ashift:SI (match_operand:SI 2 "arith_reg_operand")
+			(const_int 1
(clobber (reg:SI T_REG))]
   "TARGET_SH1 && can_create_pseudo_p ()"
   "#"
@@ -2052,8 +2052,8 @@
 
 (define_insn_and_split "*addc_2r_t"
   [(set (match_operand:SI 0 "arith_reg_dest")
-	(plus:SI (mult:SI (match_operand:SI 1 "arith_reg_operand")
-			  (const_int 2))
+	(plus:SI (ashift:SI (match_operand:SI 1 "arith_reg_operand")
+			(const_int 1))
 		 (match_operand 2 "treg_set_expr")))
(clobber (reg:SI T_REG))]
   "TARGET_SH1 && can_create_pseudo_p ()"


Re: [PATCH] FreeBSD add functionality to build PIE executables.

2015-05-17 Thread Andreas Tobler

Ping?!

Thanks,
Andreas

On 11.05.15 22:34, Andreas Tobler wrote:

All,

this patch adds the ability to build PIE executables for FreeBSD. The
core is since a longer time in the code base of FreeBSD itself and is
working fine.

This patch makes it available for all FreeBSD targets.
Tested on x86_64-*-freebsd11.0 and armv6/hf-*-freebsd11.0,
i386-*-freebsd11.0 is progress.

In the same turn I removed the STARTFILE/ENDFILE_SPEC from
config/i386/freebsd.h and use the ones from config/freebsd-spec.h.

Here the results before the patch:

https://gcc.gnu.org/ml/gcc-testresults/2015-05/msg01267.html

and with the patch:

https://gcc.gnu.org/ml/gcc-testresults/2015-05/msg01324.html

Is this ok for trunk and for 5.1X?

Thanks,
Andreas

2015-05-11  Andreas Tobler  

* config/freebsd-spec.h (FBSD_STARTFILE_SPEC): Add the bits to build
pie executables.
(FBSD_ENDFILE_SPEC): Likewise.
* config/i386/freebsd.h (STARTFILE_SPEC): Remove and use the one from
config/freebsd-spec.h.
(ENDFILE_SPEC): Likewise.

2015-05-11  Andreas Tobler  

* lib/target-supports.exp (check_effective_target_pie): Add *-*-freebsd*
to the familiy of pie capable targets.





Re: [patch] libstdc++/66055 add missing constructors to unordered containers

2015-05-17 Thread François Dumont
Ok, I just commit fixing some other lines length except those having a 
long hyperlink, I didn't want to break those.


François


On 16/05/2015 21:32, Jonathan Wakely wrote:

On 16/05/15 11:39 +0200, François Dumont wrote:

On 14/05/2015 15:47, Jonathan Wakely wrote:

Reported by Nathan and fixed by his patch. I added the tests.

Tested powerpc64le-linux, committed to trunk. This should be
backported too.


While backporting to debug and profile mode I noticed that those 
constructors were not the only missing ones. So here is a patch to 
complete them with debug and profile modes.


Great, thanks.


@@ -233,6 +222,41 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
: _M_h(__l, __n, __hf, __eql, __a)
  { }

+  unordered_map(size_type __n, const allocator_type& __a)
+  : unordered_map(__n, hasher(), key_equal(), __a)
+  { }
+
+  unordered_map(size_type __n, const hasher& __hf,
+const allocator_type& __a)
+  : unordered_map(__n, __hf, key_equal(), __a)
+  { }
+
+  template
+unordered_map(_InputIterator __first, _InputIterator __last,
+  size_type __n,
+  const allocator_type& __a)
+  : unordered_map(__first, __last, __n, hasher(), key_equal(), __a)


The indentation is inconsistent here, the ctor-initializer-list is
indented further than necessary


@@ -891,7 +941,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
   *  in the initializer list @a __l.
   *
   *  Note that the assignment completely changes the 
%unordered_multiset
-   *  and that the resulting %unordered_set's size is the same 
as the number
+   *  and that the resulting %unordered_multiset's size is the 
same as the number

   *  of elements assigned.  Old data may be lost.


Please reformat this to stay below 80 columns.

OK with those two tiny adjustments, thanks!






PRE and uninitialized variables

2015-05-17 Thread Marc Glisse

Hello,

first, this patch is not ready (it doesn't even bootstrap), I am posting 
it for comments. The idea is, when we do value numbering, while looking 
for the current value of a local variable, we may hit a clobber or reach 
the beginning of the function. In both cases, it seems to me that we could 
use a default definition as the value of the variable. This later allows 
the uninit pass to warn about the use of an uninitialized or clobbered 
variable (some passes can also optimize the code better). The part about 
clobbers passed regtesting, but the part about reaching the entry of the 
function fails bootstrap with:


Existing SSA name for symbol marked for renaming: __d_14(D)
internal compiler error: SSA corruption

when execute_update_addresses_taken is called after SRA. In the case I 
looked at, the new code was called on the lhs of an assignment (to check 
if both sides had the same value number). Creating new ssa_names in the 
middle of sccvn is probably a bad idea, although it doesn't help if I 
create them beforehand, maybe creating the default definition and leaving 
it unused means that no one feels responsible for cleaning it up? 
(TODO_update_ssa doesn't help)


I am quite restrictive in the conditions for the code to apply: 
is_gimple_reg_type, useless_type_conversion_p (uh? I forgot that one in 
the "reached entry" case...), I am not sure what I can do if the local 
variable is an aggregate and we are reading one field, maybe create an 
artificial variable just for the purpose of using its default definition?


Mostly, I would like to know if the approach makes sense. Is storing the 
default definition in SSA_VAL ok, or is there some way to use VN_TOP to 
mark undefinedness? Any pointer would be welcome...


* tree-ssa-sccvn.c (vn_reference_lookup_2): Handle function entry.
(vn_reference_lookup_3): Handle clobbers.
(init_scc_vn): Default definitions are their own definition.

PS: the testsuite for libgomp is looong, it almost doubles the time for 
the whole testsuite to complete on gcc112. It would be great if someone 
could split it into a few pieces that run in parallel.


--
Marc GlisseIndex: gcc/testsuite/gcc.dg/uninit-clob.c
===
--- gcc/testsuite/gcc.dg/uninit-clob.c  (revision 0)
+++ gcc/testsuite/gcc.dg/uninit-clob.c  (working copy)
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-O -Wuninitialized" } */
+
+int *p;
+
+int f(){
+  {
+int q = 42;
+p = &q;
+  }
+  return *p; /* { dg-warning "uninitialized" "warning" } */
+}
+
Index: gcc/testsuite/gcc.dg/uninit-sccvn.c
===
--- gcc/testsuite/gcc.dg/uninit-sccvn.c (revision 0)
+++ gcc/testsuite/gcc.dg/uninit-sccvn.c (working copy)
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-O -Wuninitialized" } */
+
+int g, h;
+void *p;
+int f(int x){
+  int a;
+  g = 42;
+  h = a;
+  p = &a;
+  return h; /* { dg-warning "uninitialized" "warning" } */
+}
Index: gcc/tree-ssa-sccvn.c
===
--- gcc/tree-ssa-sccvn.c(revision 223269)
+++ gcc/tree-ssa-sccvn.c(working copy)
@@ -1553,26 +1553,33 @@ vn_reference_lookup_1 (vn_reference_t vr
*vnresult = (vn_reference_t)*slot;
   return ((vn_reference_t)*slot)->result;
 }
 
   return NULL_TREE;
 }
 
 static tree *last_vuse_ptr;
 static vn_lookup_kind vn_walk_kind;
 static vn_lookup_kind default_vn_walk_kind;
+static vn_reference_t
+vn_reference_lookup_or_insert_for_pieces (tree vuse,
+ alias_set_type set,
+ tree type,
+ vec operands,
+ tree value);
 
 /* Callback for walk_non_aliased_vuses.  Adjusts the vn_reference_t VR_
with the current VUSE and performs the expression lookup.  */
 
 static void *
-vn_reference_lookup_2 (ao_ref *op ATTRIBUTE_UNUSED, tree vuse,
+vn_reference_lookup_2 (ao_ref *ref, tree vuse,
   unsigned int cnt, void *vr_)
 {
   vn_reference_t vr = (vn_reference_t)vr_;
   vn_reference_s **slot;
   hashval_t hash;
 
   /* This bounds the stmt walks we perform on reference lookups
  to O(1) instead of O(N) where N is the number of dominating
  stores.  */
   if (cnt > (unsigned) PARAM_VALUE (PARAM_SCCVN_MAX_ALIAS_QUERIES_PER_ACCESS))
@@ -1587,20 +1594,39 @@ vn_reference_lookup_2 (ao_ref *op ATTRIB
   vr->vuse = vuse_ssa_val (vuse);
   if (vr->vuse)
 vr->hashcode = vr->hashcode + SSA_NAME_VERSION (vr->vuse);
 
   hash = vr->hashcode;
   slot = current_info->references->find_slot_with_hash (vr, hash, NO_INSERT);
   if (!slot && current_info == optimistic_info)
 slot = valid_info->references->find_slot_with_hash (vr, hash, NO_INSERT);
   if (slot)
 return *slot;
+  if (gimple_nop_p (SSA_NAME_DEF_STMT (vuse)))
+{
+  

PR fortran/44054 Convert all gfc_error_1 calls to gfc_error

2015-05-17 Thread Manuel López-Ibáñez
Hi,

This patch finishes the conversion of Fortran diagnostics to use the
common diagnostics by removing all gfc_error*_1 variants.

I noticed that whether some buffered gfc_error_1() end up printed may
depend on whether a gfc_error_now is given or not, and not only on
whether there is any output buffered. Thus, I reintroduced a new
error_buffer of type gfc_buffer_error.

The rest is mostly mechanic.

I did not make an attempt in this patch to remove all code that has
become obsolete now:

gfc_get_terminal_width (already implemented in diagnostics.c)
error_char (already empty, but used by other obsolete functions)
error_string (obsolete, just use %s)
error_uinteger (obsolete, just use %lu)
error_integer (obsolete, just use %ld)
gfc_widechar_display_length, gfc_wide_display_length,
print_wide_char_into_buffer, gfc_print_wide_char (I'm not sure how
this functionality differs from what the common diagnostics already
do, perhaps some of it should be moved to the common code)
show_locus (obsolete, except "Included at" handling should be moved to
the common diagnostics, no testcase is testing this).
show_loci (obsolete, except "During initialization" handling should be
moved to the common diagnostics, no testcase is testing this)
error_print, error_printf (obsolete)

Bootstrapped and regression tested on x86_64-linux-gnu.

OK?

gcc/fortran/ChangeLog:

2015-05-17  Manuel López-Ibáñez  

PR fortran/44054
* gfortran.h (struct gfc_error_buf): Rename as
gfc_error_buffer. Move closer to push, pop and free
methods. Reimplement using an output_buffer.
* error.c (errors, warnings, warning_buffer, cur_error_buffer):
Delete everywhere in this file.
(error_char): Delete all contents.
(gfc_increment_error_count): Delete.
(gfc_error_now): Update comment. Set error_buffer.flag.
(gfc_warning_check): Do not handle warning_buffer.
(gfc_error_1): Delete.
(gfc_error_now_1): Delete.
(gfc_error_check): Simplify.
(gfc_move_error_buffer_from_to): Renamed from
gfc_move_output_buffer_from_to.
(gfc_push_error): Handle only gfc_error_buffer.
(gfc_pop_error): Likewise.
(gfc_free_error): Likewise.
(gfc_get_errors): Remove warnings and errors.
(gfc_diagnostics_init): Use static error_buffer.
(gfc_error_1,gfc_error_now_1): Delete declarations.
* symbol.c, decl.c, trans-common.c, data.c, expr.c, expr.c,
frontend-passes.c, resolve.c, match.c, parse.c: Replace
gfc_error_1 with gfc_error and gfc_error_now_1 with gfc_error_1
everywhere.
* f95-lang.c (gfc_be_parse_file): Do not update errorcount and
warningcount here.
* primary.c (match_complex_constant): Replace gfc_error_buf and
output_buffer with gfc_error_buffer.
Index: gcc/fortran/symbol.c
===
--- gcc/fortran/symbol.c(revision 223238)
+++ gcc/fortran/symbol.c(working copy)
@@ -1699,11 +1699,11 @@ gfc_add_type (gfc_symbol *sym, gfc_types
 type = sym->ns->proc_name->ts.type;
 
   if (type != BT_UNKNOWN && !(sym->attr.function && sym->attr.implicit_type))
 {
   if (sym->attr.use_assoc)
-   gfc_error_1 ("Symbol '%s' at %L conflicts with symbol from module '%s', 
"
+   gfc_error ("Symbol %qs at %L conflicts with symbol from module %qs, "
   "use-associated at %L", sym->name, where, sym->module,
   &sym->declared_at);
   else
gfc_error ("Symbol %qs at %L already has basic type of %s", sym->name,
 where, gfc_basic_typename (type));
@@ -1893,22 +1893,22 @@ gfc_add_component (gfc_symbol *sym, cons
 
   for (p = sym->components; p; p = p->next)
 {
   if (strcmp (p->name, name) == 0)
{
- gfc_error_1 ("Component '%s' at %C already declared at %L",
+ gfc_error ("Component %qs at %C already declared at %L",
 name, &p->loc);
  return false;
}
 
   tail = p;
 }
 
   if (sym->attr.extension
&& gfc_find_component (sym->components->ts.u.derived, name, true, true))
 {
-  gfc_error_1 ("Component '%s' at %C already in the parent type "
+  gfc_error ("Component %qs at %C already in the parent type "
 "at %L", name, &sym->components->ts.u.derived->declared_at);
   return false;
 }
 
   /* Allocate a new component.  */
@@ -2216,11 +2216,11 @@ gfc_define_st_label (gfc_st_label *lp, g
   int labelno;
 
   labelno = lp->value;
 
   if (lp->defined != ST_LABEL_UNKNOWN)
-gfc_error_1 ("Duplicate statement label %d at %L and %L", labelno,
+gfc_error ("Duplicate statement label %d at %L and %L", labelno,
   &lp->where, label_locus);
   else
 {
   lp->where = *label_locus;
 
@@ -3893,34 +3893,34 @@ verify_bind_c_derived_type (gfc_symbol *
 {
   /* The components cannot be pointers (fortran sense).  
  J3/04-007, Section 15.2.3, C1505. */
   if (curr_comp->attr.pointer != 0)
 {
-  

Re: Work around PR65873

2015-05-17 Thread Jan Hubicka
Hi,
this is a variant of patch I backported to GCC 4.9.  It also includes the 
earlier
for for -fstrict-aliasing boundary.

Honza

Index: ChangeLog
===
--- ChangeLog   (revision 223269)
+++ ChangeLog   (working copy)
@@ -1,3 +1,10 @@
+2015-04-16  Jan Hubicka  
+
+   PR ipa/65873
+   * ipa-inline.c (can_inline_edge_p): Allow early inlining of always
+   inlines across optimization boundary; be tolerant about COMDAT;
+   allow inlining across -fstrict-aliasing boundary.
+
 2015-05-16  Segher Boessenkool  
 
Backport from mainline
Index: ipa-inline.c
===
--- ipa-inline.c(revision 223252)
+++ ipa-inline.c(working copy)
@@ -427,49 +427,55 @@ can_inline_edge_p (struct cgraph_edge *e
  && lookup_attribute ("always_inline",
   DECL_ATTRIBUTES (callee->decl)));
 
+ /* Until GCC 4.9 we did not check the semantics alterning flags
+   bellow and inline across optimization boundry.
+   Enabling checks bellow breaks several packages by refusing
+   to inline library always_inline functions. See PR65873.
+   Disable the check for early inlining for now until better solution
+   is found.  */
+ if (always_inline && early)
+   ;
   /* There are some options that change IL semantics which means
  we cannot inline in these cases for correctness reason.
 Not even for always_inline declared functions.  */
   /* Strictly speaking only when the callee contains signed integer
  math where overflow is undefined.  */
-  if ((check_maybe_up (flag_strict_overflow)
-  /* this flag is set by optimize.  Allow inlining across
- optimize boundary.  */
-  && (!opt_for_fn (caller->decl, optimize)
-  == !opt_for_fn (callee->decl, optimize) || !always_inline))
- || check_match (flag_wrapv)
- || check_match (flag_trapv)
- /* Strictly speaking only when the callee contains memory
-accesses that are not using alias-set zero anyway.  */
- || check_maybe_down (flag_strict_aliasing)
- /* Strictly speaking only when the callee uses FP math.  */
- || check_maybe_up (flag_rounding_math)
- || check_maybe_up (flag_trapping_math)
- || check_maybe_down (flag_unsafe_math_optimizations)
- || check_maybe_down (flag_finite_math_only)
- || check_maybe_up (flag_signaling_nans)
- || check_maybe_down (flag_cx_limited_range)
- || check_maybe_up (flag_signed_zeros)
- || check_maybe_down (flag_associative_math)
- || check_maybe_down (flag_reciprocal_math)
- /* We do not want to make code compiled with exceptions to be brought
-into a non-EH function unless we know that the callee does not
-throw.  This is tracked by DECL_FUNCTION_PERSONALITY.  */
- || (check_match (flag_non_call_exceptions)
- /* TODO: We also may allow bringing !flag_non_call_exceptions
-to flag_non_call_exceptions function, but that may need
-extra work in tree-inline to add the extra EH edges.  */
- && (!opt_for_fn (callee->decl, flag_non_call_exceptions)
- || DECL_FUNCTION_PERSONALITY (callee->decl)))
- || (check_maybe_up (flag_exceptions)
- && DECL_FUNCTION_PERSONALITY (callee->decl))
- /* Strictly speaking only when the callee contains function
-calls that may end up setting errno.  */
- || check_maybe_up (flag_errno_math)
- /* When devirtualization is diabled for callee, it is not safe
-to inline it as we possibly mangled the type info.
-Allow early inlining of always inlines.  */
- || (!early && check_maybe_down (flag_devirtualize)))
+ else if ((check_maybe_up (flag_strict_overflow)
+  /* this flag is set by optimize.  Allow inlining across
+ optimize boundary.  */
+  && (!opt_for_fn (caller->decl, optimize)
+  == !opt_for_fn (callee->decl, optimize) || !always_inline))
+ || check_match (flag_wrapv)
+ || check_match (flag_trapv)
+ /* Strictly speaking only when the callee uses FP math.  */
+ || check_maybe_up (flag_rounding_math)
+ || check_maybe_up (flag_trapping_math)
+ || check_maybe_down (flag_unsafe_math_optimizations)
+ || check_maybe_down (flag_finite_math_only)
+ || check_maybe_up (flag_signaling_nans)
+ || check_maybe_down (flag_cx_limited_range)
+ || check_maybe_up (flag_signed_zeros)
+ || check_maybe_down (flag_associative_math)
+ || check_maybe_down (flag_reciprocal_math)
+ /* We do not want to make code compiled with exceptions to be
+ 

RE: Refactor gimple_expr_type

2015-05-17 Thread Aditya K



> Date: Sat, 16 May 2015 11:53:57 -0400
> From: tbsau...@tbsaunde.org
> To: hiradi...@msn.com
> CC: gcc-patches@gcc.gnu.org
> Subject: Re: Refactor gimple_expr_type
>
> On Fri, May 15, 2015 at 07:13:35AM +, Aditya K wrote:
>> Hi,
>> I have tried to refactor gimple_expr_type to make it more readable. Removed 
>> the switch block and redundant if.
>>
>> Please review this patch.
>
> for some reason your mail client seems to be inserting non breaking
> spaces all over the place. Please either configure it to not do that,
> or use git send-email for patches.

Please see the updated patch.
gcc/ChangeLog:

2015-05-15  hiraditya  

    * gimple.h (gimple_expr_type): Refactor to make it concise. Remove 
redundant if.

diff --git a/gcc/gimple.h b/gcc/gimple.h
index 95e4fc8..3a83e8f 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -5717,36 +5717,26 @@ static inline tree
 gimple_expr_type (const_gimple stmt)
 {
   enum gimple_code code = gimple_code (stmt);
-
-  if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL)
+  /* In general we want to pass out a type that can be substituted
+ for both the RHS and the LHS types if there is a possibly
+ useless conversion involved.  That means returning the
+ original RHS type as far as we can reconstruct it.  */
+  if (code == GIMPLE_CALL)
 {
-  tree type;
-  /* In general we want to pass out a type that can be substituted
- for both the RHS and the LHS types if there is a possibly
-    useless conversion involved.  That means returning the
-    original RHS type as far as we can reconstruct it.  */
-  if (code == GIMPLE_CALL)
-   {
- const gcall *call_stmt = as_a  (stmt);
- if (gimple_call_internal_p (call_stmt)
- && gimple_call_internal_fn (call_stmt) == IFN_MASK_STORE)
-   type = TREE_TYPE (gimple_call_arg (call_stmt, 3));
- else
-   type = gimple_call_return_type (call_stmt);
-   }
+  const gcall *call_stmt = as_a  (stmt);
+  if (gimple_call_internal_p (call_stmt)
+  && gimple_call_internal_fn (call_stmt) == IFN_MASK_STORE)
+    return TREE_TYPE (gimple_call_arg (call_stmt, 3));
+  else
+    return gimple_call_return_type (call_stmt);
+    }
+  else if (code == GIMPLE_ASSIGN)
+    {
+  if (gimple_assign_rhs_code (stmt) == POINTER_PLUS_EXPR)
+    return TREE_TYPE (gimple_assign_rhs1 (stmt));
   else
-   switch (gimple_assign_rhs_code (stmt))
- {
- case POINTER_PLUS_EXPR:
-   type = TREE_TYPE (gimple_assign_rhs1 (stmt));
-   break;
-
- default:
-   /* As fallback use the type of the LHS.  */
-   type = TREE_TYPE (gimple_get_lhs (stmt));
-   break;
- }
-  return type;
+    /* As fallback use the type of the LHS.  */
+    return TREE_TYPE (gimple_get_lhs (stmt));
 }
   else if (code == GIMPLE_COND)
 return boolean_type_node;


Thanks,
-Aditya





>
>>
>> Thanks,
>> -Aditya
>>
>>
>> gcc/ChangeLog:
>>
>> 2015-05-15  hiraditya  
>>
>> * gimple.h (gimple_expr_type): Refactor to make it concise. Remove 
>> redundant if.
>>
>> diff --git a/gcc/gimple.h b/gcc/gimple.h
>> index 95e4fc8..168d3ba 100644
>> --- a/gcc/gimple.h
>> +++ b/gcc/gimple.h
>> @@ -5717,35 +5717,28 @@ static inline tree
>>  gimple_expr_type (const_gimple stmt)
>>  {
>>enum gimple_code code = gimple_code (stmt);
>> -
>> -  if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL)
>> +  tree type;
>> +  /* In general we want to pass out a type that can be substituted
>> + for both the RHS and the LHS types if there is a possibly
>> + useless conversion involved.  That means returning the
>> + original RHS type as far as we can reconstruct it.  */
>> +  if (code == GIMPLE_CALL)
>>  {
>> -  tree type;
>> -  /* In general we want to pass out a type that can be substituted
>> - for both the RHS and the LHS types if there is a possibly
>> -useless conversion involved.  That means returning the
>> -original RHS type as far as we can reconstruct it.  */
>> -  if (code == GIMPLE_CALL)
>> -   {
>> - const gcall *call_stmt = as_a  (stmt);
>> - if (gimple_call_internal_p (call_stmt)
>> - && gimple_call_internal_fn (call_stmt) == IFN_MASK_STORE)
>> -   type = TREE_TYPE (gimple_call_arg (call_stmt, 3));
>> - else
>> -   type = gimple_call_return_type (call_stmt);
>> -   }
>> +  const gcall *call_stmt = as_a  (stmt);
>> +  if (gimple_call_internal_p (call_stmt)
>> +  && gimple_call_internal_fn (call_stmt) == IFN_MASK_STORE)
>> +type = TREE_TYPE (gimple_call_arg (call_stmt, 3));
>> +  else
>> +type = gimple_call_return_type (call_stmt);
>> +  return type;
>
> You might as well return the value directly and not use the variable.
>
>> +}
>> +  else if (code == GIMPLE_ASSIGN)
>
> else after retur

[PATCH, i386]: Fix PR66174: ICE: in extract_insn with -ftree-vectorize -mavx512f

2015-05-17 Thread Uros Bizjak
Attached patch fixes PR 66174.  We have to push an immediate mask
operand in expand_vec_perm_blend to a mask register for AVX512F modes.

The patch also enables AVX512BW modes in the above function.

2015-05-17  Uros Bizjak  

PR target/66174
* config/i386/i386.c (expand_vec_perm_blend): Enable HImode and
QImode inner modes for TARGET_AVX512BW.  Force mask operand
to a register for AVX512F modes.

testsuite/ChangeLog:

2015-05-17  Uros Bizjak  

PR target/66174
* gcc.target/i386/pr66174.c: New test.

Tested on x86_64-linux-gnu{,-m32} non-AVX512F target and committed to
mainline SVN.

I plan to backport the patch to a release branches in a couple of
days, so a runtime test would be much appreciated.

Uros.
Index: config/i386/i386.c
===
--- config/i386/i386.c  (revision 223248)
+++ config/i386/i386.c  (working copy)
@@ -46777,15 +46777,16 @@ expand_vselect_vconcat (rtx target, rtx op0, rtx o
 static bool
 expand_vec_perm_blend (struct expand_vec_perm_d *d)
 {
-  machine_mode vmode = d->vmode;
+  machine_mode mmode, vmode = d->vmode;
   unsigned i, mask, nelt = d->nelt;
-  rtx target, op0, op1, x;
+  rtx target, op0, op1, maskop, x;
   rtx rperm[32], vperm;
 
   if (d->one_operand_p)
 return false;
   if (TARGET_AVX512F && GET_MODE_SIZE (vmode) == 64
-  && GET_MODE_SIZE (GET_MODE_INNER (vmode)) >= 4)
+  && (TARGET_AVX512BW
+ || GET_MODE_SIZE (GET_MODE_INNER (vmode)) >= 4))
 ;
   else if (TARGET_AVX2 && GET_MODE_SIZE (vmode) == 32)
 ;
@@ -46959,8 +46960,33 @@ expand_vec_perm_blend (struct expand_vec_perm_d *d
   gcc_unreachable ();
 }
 
+  switch (vmode)
+{
+case V8DFmode:
+case V8DImode:
+  mmode = QImode;
+  break;
+case V16SFmode:
+case V16SImode:
+  mmode = HImode;
+  break;
+case V32HImode:
+  mmode = SImode;
+  break;
+case V64QImode:
+  mmode = DImode;
+  break;
+default:
+  mmode = VOIDmode;
+}
+
+  if (mmode != VOIDmode)
+maskop = force_reg (mmode, gen_int_mode (mask, mmode));
+  else
+maskop = GEN_INT (mask);
+
   /* This matches five different patterns with the different modes.  */
-  x = gen_rtx_VEC_MERGE (vmode, op1, op0, GEN_INT (mask));
+  x = gen_rtx_VEC_MERGE (vmode, op1, op0, maskop);
   x = gen_rtx_SET (target, x);
   emit_insn (x);
   if (target != d->target)
Index: testsuite/gcc.target/i386/pr66174.c
===
--- testsuite/gcc.target/i386/pr66174.c (revision 0)
+++ testsuite/gcc.target/i386/pr66174.c (working copy)
@@ -0,0 +1,30 @@
+/* { dg-do compile } */
+/* { dg-options "-O -ftree-vectorize -mavx512f" } */
+
+extern void abort (void);
+
+typedef struct {
+   unsigned int a;
+   unsigned int b;
+} ii;
+
+void foo (unsigned short *arr, ii *iarr)
+{
+  ii *iptr = iarr;
+  unsigned short res[128];
+  ii ires[128];
+  int i;
+  for (i = 0; i < 128; i++)
+{
+  ires[i].a = iptr->b - iptr->a;
+  ires[i].b = iptr->b + iptr->a;
+  iptr++;
+}
+  for (i = 0; i < 128; i++)
+{
+  if (res[i] != arr[i]
+  || ires[i].a != iarr[i].b - iarr[i].a
+  || ires[i].b != iarr[i].b + iarr[i].a)
+abort ();
+}
+}


Re: [patch, fortran] [5/6 Regression] Line continuation followed by comment character in string fails to compile

2015-05-17 Thread Jerry DeLisle
On 05/16/2015 12:58 PM, Jerry DeLisle wrote:
> On 05/16/2015 10:45 AM, Jerry DeLisle wrote:
> --- snip ---
> 
>> Thanks Steve,
>>
>> Committed revision 223248.
>>
>>
> 
> I had some time to play with this a little more this afternoon.
> 
> I am going to commit the following little patchlet that gives us the nice
> warning we should have. (After full regression testing of course)

I changed my mind.  Adding this warning affects 22 test cases. Question for the
team.

Do we want this warning? If so, I will have to adjust each of the 22.

Jerry

> 
> gfc -Wall continuation_13.f90
> continuation_13.f90:22:4: Warning: Missing ‘&’ in continued character constant
> at (1) [-Wampersand]
> continuation_13.f90:24:4: Warning: Missing ‘&’ in continued character constant
> at (1) [-Wampersand]
> 
> 
> Index: scanner.c
> ===
> --- scanner.c (revision 223250)
> +++ scanner.c (working copy)
> @@ -1383,7 +1383,12 @@
>"constant at %C");
>   }
> else if (!in_string && (c == '\'' || c == '"'))
> + {
> +   gfc_warning (OPT_Wampersand,
> +  "Missing %<&%> in continued character "
> +  "constant at %C");
> goto done;
> + }
> /* Both !$omp and !$ -fopenmp continuation lines have & on the
>continuation line only optionally.  */
> else if (openmp_flag || openacc_flag || openmp_cond_flag)
> 
> 
> 
> 
> 


[patch, fortran] Committed two additional test cases

2015-05-17 Thread Thomas Koenig
Hello world,

I have committed the two test cases below as obviously
correct after testing.

They stress bounds checking on matmul by having an argument
whose size cannot be predicted at compile-time.

Regards

Thomas

2015-05-17  Thomas Koenig  

PR fortran/37131
* gfortran.dg/matmul_bounds_6.f90:  New test.
* gfortran.dg/matmul_bounds_7.f90:  New test.
! { dg-do run }
program main
  real, dimension(3,2) :: a
  real, dimension(6) :: b
  real, dimension(3) :: res1
  real, dimension(:), allocatable :: c1, c2,c3
  real, dimension(2) :: res2

  data a /-2., 3., -5., 7., -11., 13./
  data b /17., -23., 29., -31., 37., -41./
  data res1 /201., -320., 336./
  data res2 /158., -353./

  c1 = matmul(a,[29.,37.])
  if (size(c1,1) /= 3) call abort
  if (any(c1/=res1)) call abort

  c2 = matmul(a,pack(b,[b>20.]))
  if (size(c1,1) /= 3) call abort
  if (any(c1/=res1)) call abort

  c3 = matmul(pack(b,[b<0.]),a)
  if (size(c3,1) /= 2) call abort
  if (any(c3 /= res2)) call abort

end program main
! { dg-do run }
! { dg-additional-options "-fcheck=bounds" }
! { dg-shouldfail "Fortran runtime error: dimension of array B incorrect in MATMUL intrinsic" }

program main
  real, dimension(3,2) :: a
  real, dimension(6) :: b
  real, dimension(:), allocatable :: c

  data a /-2., 3., -5., 7., -11., 13./
  data b /17., -23., 29., -31., 37., -41./

  c = matmul(pack(b,[b<20.]),a)
  print *,sum(c)

end program main


Re: [RFC]: Remove Mem/address type assumption in combiner

2015-05-17 Thread Hans-Peter Nilsson
On Sun, 17 May 2015, Segher Boessenkool wrote:
> I used ; it has
> a README.  I see that doc is a little out of date, I'll update.

("git:" not "http:" for cloning)  Thanks, looks useful.
Hm, maybe we already mention this in the wiki...

> > - add a preferred canonicalization function to do conversion
> > to/from memory-address-canonical RTL.  Like
> > fwprop.c:canonicalize_address (just not static :) and maybe also
> > a canonicalize_nonaddress.  At the moment, ports call
> > replace_equiv_address (family of functions) when changing
> > address RTL, but that code-path (at a glance) doesn't
> > canonicalize whatever non-address-canonical RTL you throw at it.
> > Maybe it should?
>
> Maybe validize_mem is nicer?  It depends much what you really
> want to change.

I'd had made use of a function that'd automatically rewrite an
ASHIFT into a MULT.  No, validize_mem is kind-of a sibling to
replace_equiv_address with just the containing MEM and will just
call it, says the code.  A call to replace_equiv_address (& Co.)
will *break out* invalid expressions like an ASHIFT - or at
least is supposed to do that.

But that'd be mostly for convenience of other ports; I've coped
now, I think.

> Does simplify_rtx not do what you want for "nonaddress"?

Oh, right, that's already what we have, thanks.

brgds, H-P


Re: [RFC]: Remove Mem/address type assumption in combiner

2015-05-17 Thread Segher Boessenkool
On Sat, May 16, 2015 at 09:55:08PM -0400, Hans-Peter Nilsson wrote:
> > With a plus or minus combine would always write it as a mult.
> > I don't think any other pass would create this combination.  I
> > haven't tested it though.
> 
> Ports probably also generate that internally at various RTL
> passes, something that takes a bit more than an at-a-glance code
> inspection.

Yeah, true.  Hopefully port maintainers will know about what the
port does, or at least notice the ICEs.

> > > I've been trying to come up with valid reasons there'd be ever
> > > be canonicalization by multiplication, but failed so I guess
> > > I'll rip it out.
> >
> > The "unreachable" thing should quickly tell you if that guess is wrong.
> > Not something you want to leave in a production compiler, of course.
> 
> I think you misunderstood; I mean that I pondered
> "philosophical" reasons to change the canonical representation;
> if there was some reasoning, current or looking forward, where
> we'd "add back" mult as non-address-canonical RTL.

Ah.  Yes, same here -- I don't see any situation where having
mult instead of shift outside of a mem would be more convenient.

> Actually, there are two things you could help with:
> 
> - (pointer-to) step-by-step instructions to recreate the Linux
> (kernel :) build, as those you did before for a multiple of
> targets.  I'd like to know I fixed your observations.

I used ; it has
a README.  I see that doc is a little out of date, I'll update.

> - add a preferred canonicalization function to do conversion
> to/from memory-address-canonical RTL.  Like
> fwprop.c:canonicalize_address (just not static :) and maybe also
> a canonicalize_nonaddress.  At the moment, ports call
> replace_equiv_address (family of functions) when changing
> address RTL, but that code-path (at a glance) doesn't
> canonicalize whatever non-address-canonical RTL you throw at it.
> Maybe it should?

Maybe validize_mem is nicer?  It depends much what you really
want to change.

Does simplify_rtx not do what you want for "nonaddress"?


Segher


New Swedish PO file for 'gcc' (version 5.1.0)

2015-05-17 Thread Translation Project Robot
Hello, gentle maintainer.

This is a message from the Translation Project robot.

A revised PO file for textual domain 'gcc' has been submitted
by the Swedish team of translators.  The file is available at:

http://translationproject.org/latest/gcc/sv.po

(This file, 'gcc-5.1.0.sv.po', has just now been sent to you in
a separate email.)

All other PO files for your package are available in:

http://translationproject.org/latest/gcc/

Please consider including all of these in your next release, whether
official or a pretest.

Whenever you have a new distribution with a new version number ready,
containing a newer POT file, please send the URL of that distribution
tarball to the address below.  The tarball may be just a pretest or a
snapshot, it does not even have to compile.  It is just used by the
translators when they need some extra translation context.

The following HTML page has been updated:

http://translationproject.org/domain/gcc.html

If any question arises, please contact the translation coordinator.

Thank you for all your work,

The Translation Project robot, in the
name of your translation coordinator.




Re: Improve LTO type checking during symtab merging

2015-05-17 Thread Andreas Schwab
Jan Hubicka  writes:

>   * gfortran.dg/lto/pr41576_1.f90: Add interface.
>   * gfortran.dg/lto/pr41521_0.f90: Disable lto-type-mismatch

FAIL: gfortran.dg/lto/pr41521 f_lto_pr41521_0.o assemble, -g -O -flto 
-Wno-lto-type-mismatch
FAIL: gfortran.dg/lto/pr41576 f_lto_pr41576_1.o assemble,  -O2 -flto -Werror 
-Wno-lto-type-mismatch