Re: [PATCH] (Partial) Implementation of simplificaiton of CSHIFT

2015-11-22 Thread Dominique d'Humières
Hi Steve,

Compiling the attached code after revision r230710 gives the ICE

f951: internal compiler error: in gfc_simplify_cshift, at 
fortran/simplify.c:1823

while it compiled before.

TIA

Dominique


mhd.f90
Description: Binary data


[Back port r227760] PR67460 [5 Regression] Spurious: f951: all warnings being treated as errors

2015-11-22 Thread Dominique d'Humières
Is it OK to back port revision r227760 to 5.3?
Tested on x86_64-apple-darwin14

Dominique

Index: gcc/ChangeLog
===
--- gcc/ChangeLog   (revision 230703)
+++ gcc/ChangeLog   (working copy)
@@ -1,3 +1,17 @@
+2015-11-22  Dominique d'Humieres  
+
+   Backport from mainline
+   2015-09-14  Manuel López-Ibáñe
+
+   PR fortran/67460
+   * diagnostic.c (diagnostic_initialize): Do not set
+   some_warnings_are_errors.
+   (diagnostic_finish): Use DK_WERROR count instead.
+   (diagnostic_report_diagnostic): Do not set
+   some_warnings_are_errors.
+   * diagnostic.h (struct diagnostic_context): Remove
+   some_warnings_are_errors.
+
 2015-11-21  Jakub Jelinek  
 
PR debug/66432
Index: gcc/diagnostic.h
===
--- gcc/diagnostic.h(revision 230703)
+++ gcc/diagnostic.h(working copy)
@@ -65,10 +65,6 @@
   /* The number of times we have issued diagnostics.  */
   int diagnostic_count[DK_LAST_DIAGNOSTIC_KIND];
 
-  /* True if we should display the "warnings are being tread as error"
- message, usually displayed once per compiler run.  */
-  bool some_warnings_are_errors;
-
   /* True if it has been requested that warnings be treated as errors.  */
   bool warning_as_error_requested;
 
Index: gcc/diagnostic.c
===
--- gcc/diagnostic.c(revision 230703)
+++ gcc/diagnostic.c(working copy)
@@ -138,7 +138,6 @@
   new (context->printer) pretty_printer ();
 
   memset (context->diagnostic_count, 0, sizeof context->diagnostic_count);
-  context->some_warnings_are_errors = false;
   context->warning_as_error_requested = false;
   context->n_opts = n_opts;
   context->classify_diagnostic = XNEWVEC (diagnostic_t, n_opts);
@@ -204,7 +203,7 @@
 diagnostic_finish (diagnostic_context *context)
 {
   /* Some of the errors may actually have been warnings.  */
-  if (context->some_warnings_are_errors)
+  if (diagnostic_kind_count (context, DK_WERROR))
 {
   /* -Werror was given.  */
   if (context->warning_as_error_requested)
@@ -811,9 +810,6 @@
return false;
 }
 
-  if (orig_diag_kind == DK_WARNING && diagnostic->kind == DK_ERROR)
-context->some_warnings_are_errors = true;
-
   context->lock++;
 
   if (diagnostic->kind == DK_ICE || diagnostic->kind == DK_ICE_NOBT)
Index: gcc/testsuite/ChangeLog
===
--- gcc/testsuite/ChangeLog (revision 230703)
+++ gcc/testsuite/ChangeLog (working copy)
@@ -1,3 +1,11 @@
+2015-11-22  Dominique d'Humieres  
+
+   Backport from mainline
+   2015-09-14  Manuel López-Ibáñe
+
+   PR fortran/67460
+   * gfortran.dg/pr67460.f90: New test.
+
 2015-11-21  Jakub Jelinek  
 
PR debug/66432
Index: gcc/testsuite/gfortran.dg/pr67460.f90
===
--- gcc/testsuite/gfortran.dg/pr67460.f90   (nonexistent)
+++ gcc/testsuite/gfortran.dg/pr67460.f90   (working copy)
@@ -0,0 +1,24 @@
+! Bogus "all warnings being treated as errors"
+! { dg-do compile }
+! { dg-options "-std=f2003 -Werror" }
+MODULE btree_i8_k_sp2d_v
+  TYPE btree_node
+ INTEGER id
+ TYPE(btree_node_p), DIMENSION(:), POINTER :: subtrees
+ TYPE(btree_node), POINTER :: parent
+  END TYPE btree_node
+  TYPE btree_node_p
+ TYPE(btree_node), POINTER :: node
+  END TYPE btree_node_p
+CONTAINS
+  RECURSIVE SUBROUTINE btree_verify_node (tree, node, level, nids, lastv,&
+   count, num_nodes, max_leaf_level, min_leaf_level, printing)
+TYPE(btree_node), INTENT(IN) :: node
+INTEGER  :: branch
+IF (ASSOCIATED (node%subtrees(branch)%node)) THEN
+   IF (node%subtrees(branch)%node%parent%id .NE. node%id) THEN
+  WRITE(*,*)'foo'
+   ENDIF
+ENDIF
+  END SUBROUTINE btree_verify_node
+END MODULE btree_i8_k_sp2d_v



[PATCH v2] Add uaddv_optab, usubv4_optab

2015-11-22 Thread Richard Henderson

The full round of testing from v1 turned up a couple of problems.

One of which I believe I've worked around in the i386 backend, but I believe to 
be a latent problem within combine.


With the following patch, disable the add3_*_overflow_2 patterns.  Then 
compile c-c++-common/torture/builtin-arith-overflow-4.c with -O2 and you'll see


 t151_2add:
   testb   %dil, %dil
   leal-1(%rdi), %eax
   jne .L644

which is incorrect.  Combine has looked through two comparisons, seen the NE in 
the second comparison, and then converted a CCCmode compare to a CCZmode compare.


I wonder if the code in combine.c simplify_set which calls SELECT_CC_MODE ought 
to be throwing away existing MODE_CC data.  Ought we verify that the newly 
selected CC mode is cc_modes_compatible with the existing?  That would 
certainly work when we begin with the "usual" fully general CCmode compare, 
optimizing to CCZmode, but would then reject moving between CCCmode and CCZmode.


That said, the addition of the new _overflow_2 patterns allows CSE to simplify 
the expressions earlier, which avoids the problem in combine.


Ok?


r~
* optabs.def (uaddv4_optab, usubv4_optab): New.
* internal-fn.c (expand_addsub_overflow): Use them.
* doc/md.texi (Standard Names): Add uaddv4, usubv4.

* config/i386/i386.c (ix86_cc_mode): Extend add overflow check
to reversed operands.
* config/i386/i386.md (uaddv4, usubv4): New.
(*add3_cconly_overflow_1): Rename *add3_cconly_overflow.
(*add3_cc_overflow_1): Rename *add3_cc_overflow.
(*addsi3_zext_cc_overflow_1): Rename *add3_zext_cc_overflow.
(*add3_cconly_overflow_2): New.
(*add3_cc_overflow_2): New.
(*addsi3_zext_cc_overflow_2): New.


diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 83749d5..cc42544 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -21137,7 +21137,8 @@ ix86_cc_mode (enum rtx_code code, rtx op0, rtx op1)
 case LTU:  /* CF=1 */
   /* Detect overflow checks.  They need just the carry flag.  */
   if (GET_CODE (op0) == PLUS
- && rtx_equal_p (op1, XEXP (op0, 0)))
+ && (rtx_equal_p (op1, XEXP (op0, 0))
+ || rtx_equal_p (op1, XEXP (op0, 1
return CCCmode;
   else
return CCmode;
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index 4c5e22a..95b598b 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -6156,6 +6156,24 @@
  (const_string "4")]
  (const_string "")))])
 
+(define_expand "uaddv4"
+  [(parallel [(set (reg:CCC FLAGS_REG)
+  (compare:CCC
+(plus:SWI
+  (match_operand:SWI 1 "nonimmediate_operand")
+  (match_operand:SWI 2 ""))
+(match_dup 1)))
+ (set (match_operand:SWI 0 "register_operand")
+  (plus:SWI (match_dup 1) (match_dup 2)))])
+   (set (pc) (if_then_else
+  (ltu (reg:CCC FLAGS_REG) (const_int 0))
+  (label_ref (match_operand 3))
+  (pc)))]
+  ""
+{
+  ix86_fixup_binary_operands_no_copy (PLUS, mode, operands);
+})
+
 ;; The lea patterns for modes less than 32 bits need to be matched by
 ;; several insns converted to real lea by splitters.
 
@@ -6461,6 +6479,22 @@
  (const_string "4")]
  (const_string "")))])
 
+(define_expand "usubv4"
+  [(parallel [(set (reg:CC FLAGS_REG)
+  (compare:CC
+(match_operand:SWI 1 "nonimmediate_operand")
+(match_operand:SWI 2 "")))
+ (set (match_operand:SWI 0 "register_operand")
+  (minus:SWI (match_dup 1) (match_dup 2)))])
+   (set (pc) (if_then_else
+  (ltu (reg:CC FLAGS_REG) (const_int 0))
+  (label_ref (match_operand 3))
+  (pc)))]
+  ""
+{
+  ix86_fixup_binary_operands_no_copy (MINUS, mode, operands);
+})
+
 (define_insn "*sub_3"
   [(set (reg FLAGS_REG)
(compare (match_operand:SWI 1 "nonimmediate_operand" "0,0")
@@ -6611,7 +6645,7 @@
   (clobber (match_scratch:QI 2))])]
   "!(MEM_P (operands[0]) && MEM_P (operands[1]))")
 
-(define_insn "*add3_cconly_overflow"
+(define_insn "*add3_cconly_overflow_1"
   [(set (reg:CCC FLAGS_REG)
(compare:CCC
  (plus:SWI
@@ -6624,7 +6658,20 @@
   [(set_attr "type" "alu")
(set_attr "mode" "")])
 
-(define_insn "*add3_cc_overflow"
+(define_insn "*add3_cconly_overflow_2"
+  [(set (reg:CCC FLAGS_REG)
+   (compare:CCC
+ (plus:SWI
+   (match_operand:SWI 1 "nonimmediate_operand" "%0")
+   (match_operand:SWI 2 "" ""))
+ (match_dup 2)))
+   (clobber (match_scratch:SWI 0 "="))]
+  "!(MEM_P (operands[1]) && MEM_P (operands[2]))"
+  "add{}\t{%2, %0|%0, %2}"
+  [(set_attr "type" "alu")
+   (set_attr "mode" "")])
+
+(define_insn "*add3_cc_overflow_1"
   [(set (reg:CCC FLAGS_R

Re: GCC 5.3 Status Report (2015-11-20)

2015-11-22 Thread Paolo Bonzini


On 20/11/2015 14:14, David Edelsohn wrote:
> On Fri, Nov 20, 2015 at 7:53 AM, Richard Biener  wrote:
>>
>> Status
>> ==
>>
>> We plan to do a GCC 5.3 release candidate at the end of next week
>> followed by the actual release a week after that.
>>
>> So now is the time to look at your regression bugs in bugzilla and
>> do some backporting for things already fixed on trunk.
> 
> I'm still waiting for approval of the libtool change to support AIX
> TLS symbols (PR 68192).  There has been no response on Libtool patches
> mailing list.
> 
> I again request permission to apply the patches to GCC trunk and 5-branch.

Let me look around for a libtool committer tomorrow, I'll get back to you.

Paolo


[PATCH] Add TARGET_FUNCTION_INCOMING_ARG_RTL

2015-11-22 Thread H.J. Lu
On Sat, Nov 21, 2015 at 11:19:57AM -0800, H.J. Lu wrote:
> When implementing interrupt attribute for x86 interrupt handlers, we
> have a difficult time to access interrupt data passed down by x86
> processors.  On x86, interrupt handlers are only called by processors
> which push interrupt data onto stack at the address where the normal
> return address is.  Interrupt handlers must access interrupt data via
> pointers so that they can update interrupt data.
> 
> TARGET_FUNCTION_ARG_ADVANCE is skipped by interrupt handlers since they
> are only called by processors.  Since interrupt data is at one word
> below the normal argument location on stack and must be accessed via
> pointer, we changed TARGET_FUNCTION_ARG to return a fake hard register
> for interrupt handlers and updated expander to covert the fake register
> to its address on stack.
> 
> However, we run into problems with
> 
> /* For PARM_DECL, holds an RTL for the stack slot or register
>where the data was actually passed.  */
> #define DECL_INCOMING_RTL(NODE) \
>(PARM_DECL_CHECK (NODE)->parm_decl.incoming_rtl)
> 
> >From what I can tell, DECL_INCOMING_RTL is a constant after it is set up.
> For interrupt handlers, DECL_INCOMING_RTL contains a fake register,
> which isn't a problem in codegen since it is covered by expander.  But
> DECL_INCOMING_RTL is also used to generate debug information and debug
> output never expects a fake register in DECL_INCOMING_RTL.  To work around
> it, we changed x86 prologue expander to update DECL_INCOMING_RTL with the
> fake register in interrupt handlers to its address on stack.
> 
> We are asking middle-end maintainers, is this a correct solution?  If not,
> what other approaches should we try?
> 
> 

A target machine may have a special DECL_INCOMING_RTL which must be
converted for the correct location.  This patch adds a target hook
to get the location where the argument will appear to the callee.  The
default is DECL_INCOMING_RTL.  It replaces DECL_INCOMING_RTL with
get_decl_incoming_rtl when DECL_INCOMING_RTL is used to get the
location.  Only DWARF debug output is updated since DBX and SDB debug
formats can't handle "(plus:DI (reg/f:DI 16 argp) (const_int -8))" for
a pointer argument.

Does it make sense?

Thanks.

H.J.

* combine.c (setup_incoming_promotions): Replace
DECL_INCOMING_RTL with get_decl_incoming_rtl.
* dwarf2out.c (add_var_loc_to_decl): Likewise.
(rtl_for_decl_location): Likewise.
* var-tracking.c (add_stores): Likewise.
(vt_add_function_parameter): Likewise.
* emit-rtl.c (get_decl_incoming_rtl): New function.
* targhooks.c (default_function_incoming_arg_rtl): Likewise.
* emit-rtl.h (get_decl_incoming_rtl): New prototype.
* targhooks.h (default_function_incoming_arg_rtl): Likewise.
* target.def (function_incoming_arg_rtl): New hook.
* doc/tm.texi.in: Add TARGET_FUNCTION_INCOMING_ARG_RTL.
* doc/tm.texi: Updated.
---
 gcc/combine.c  |  2 +-
 gcc/doc/tm.texi|  8 
 gcc/doc/tm.texi.in |  2 ++
 gcc/dwarf2out.c| 21 -
 gcc/emit-rtl.c |  8 
 gcc/emit-rtl.h |  1 +
 gcc/target.def | 12 
 gcc/targhooks.c|  6 ++
 gcc/targhooks.h|  1 +
 gcc/var-tracking.c | 19 +++
 10 files changed, 62 insertions(+), 18 deletions(-)

diff --git a/gcc/combine.c b/gcc/combine.c
index 2a66fd5..01c43a2 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -1543,7 +1543,7 @@ setup_incoming_promotions (rtx_insn *first)
   for (arg = DECL_ARGUMENTS (current_function_decl); arg;
arg = DECL_CHAIN (arg))
 {
-  rtx x, reg = DECL_INCOMING_RTL (arg);
+  rtx x, reg = get_decl_incoming_rtl (arg);
   int uns1, uns3;
   machine_mode mode1, mode2, mode3, mode4;
 
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index bde808b..b727f20 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -3953,6 +3953,14 @@ If @code{TARGET_FUNCTION_INCOMING_ARG} is not defined,
 @code{TARGET_FUNCTION_ARG} serves both purposes.
 @end deftypefn
 
+@deftypefn {Target Hook} rtx TARGET_FUNCTION_INCOMING_ARG_RTL (const_tree 
@var{parmdecl})
+Define this hook if the target machine has a special @code{DECL_INCOMING_RTL}
+which must be converted for the correct location.
+
+If @code{TARGET_FUNCTION_INCOMING_ARG_RTL} is not defined,
+@code{DECL_INCOMING_RTL} of the input @var{parmdecl} will be used.
+@end deftypefn
+
 @deftypefn {Target Hook} bool TARGET_USE_PSEUDO_PIC_REG (void)
 This hook should return 1 in case pseudo register should be created
 for pic_offset_table_rtx during function expand.
diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in
index 0677fc1..dbd1f0b 100644
--- a/gcc/doc/tm.texi.in
+++ b/gcc/doc/tm.texi.in
@@ -3369,6 +3369,8 @@ the stack.
 
 @hook TARGET_FUNCTION_INCOMING_ARG
 
+@hook TARGET_FUNCTION_INCOMING_ARG_RTL
+
 @hook TARGET_USE_PSEUDO_PIC_REG
 
 @hook TARGET_INIT_PIC_REG
diff --git a/gcc/dwarf2out.c b/gcc/

Re: [PATCH] lround for PowerPC

2015-11-22 Thread David Edelsohn
On Sun, Nov 22, 2015 at 2:34 AM, Richard Biener
 wrote:
> On November 22, 2015 2:52:53 AM GMT+01:00, David Edelsohn  
> wrote:
>>PowerPC was missing a definition of the lroundMN pattern, which can be
>>implemented with  VSX instructions available in Power7.  Below is a
>>first draft.

> Why unsafe-math?

It's a first draft.  I want to re-confirm that the combined
instructions set all of the correct flags.

The patterns should work in SF and DF modes, but currently trigger a
reload failure in SFmode.

Thanks, David


Re: Fix lto-symtab ICE during Ada LTO bootstrap

2015-11-22 Thread Eric Botcazou
> this patch fixes an ICE seen with Ada LTO bootstrap in reporting type
> mismatches and it also makes us to stop complaining about C++ ODR
> violation.  The warnings are however correct.  I looked at few:
> 
> ../../libiberty/xstrerror.c:40:14: warning: type of �strerror� does not
> match original declaration [-Wlto-type-mismatch] extern char *strerror
> (int);
>   ^
> 
> ../../gcc/ada/s-os_lib.adb:1007:16: note: return value type mismatch
>function strerror (errnum : Integer) return System.Address;
> ^
> 
> ../../gcc/ada/s-os_lib.adb:1007:16: note:
> �system__os_lib__errno_message__strerror� was previously declared here
> 
> Here we have function returning pointer WRT function returning integer:

This one is on purpose and cannot be easily changed.  Pointer types (or access 
types as called in Ada) are avoided as much as possible in the runtime because 
they drag the accessibility machinery, which is the machinery present in the 
language to eliminate dangling references and is heavy; so they are usually 
imported as System.Address instead.

> : warning: type of �__builtin_strlen� does not match original
> declaration [-Wlto-type-mismatch] ../../gcc/ada/osint.adb:422:19: note:
> return value type mismatch
> ../../gcc/ada/osint.adb:422:19: note: type �integer� should match type �long
> unsigned int�
> 
> Here the signedness of integer does not match:

Yes, it's clearly incorrect on the Ada side and should be fixed in osint.adb.

> ../../gcc/ada/s-os_lib.ads:1053:4: warning: type of
> �system__os_lib__directory_separator� does not match original declaration
> [-Wlto-type-mismatch] Directory_Separator : constant Character;
> ^
> 
> ../../gcc/ada/adaint.c:225:6: note: type �char� should match type �volatile
> character� char __gnat_dir_separator = DIR_SEPARATOR;
>   ^
> 
> Here we get difference in  signedness and volatility:

The signedness issue for Character is known and we plan to address it; the 
volatility issue was overlooked but looks fixable too.

> All those types will lead to wrong code if ever written to same memory
> location because of TBAA.  Eric, does Ada need all this types to be TBAA
> compatible? If so, we need to implement more strict globbing as we did for
> Fortran and we probably finally need to make the globbing aware of
> languages involved (we definitly don't want to glob pointers and integers
> for C/C++ programs)

I think that we can fix all the problems on the Ada side except for the 
pointer/System.Address duality (which can be even more problematic on 
architectures that use different calling conventions for them).

> Eric, it would be great to have a stand alone testcases in style of
> gcc/testsuite/gfortran.dg/lto/bind_c-*
> which stores and reads the same memory location in same alias set and thus
> trigger the undefined behvaiour.

OK, I'll think about that, thanks.

-- 
Eric Botcazou


Re: Fix lto-symtab ICE during Ada LTO bootstrap

2015-11-22 Thread Arnaud Charlet
> > ../../gcc/ada/s-os_lib.adb:1007:16: note: return value type
> > mismatch
> >function strerror (errnum : Integer) return System.Address;
> > ^
> > 
> > ../../gcc/ada/s-os_lib.adb:1007:16: note:
> > ???system__os_lib__errno_message__strerror??? was previously
> > declared here
> > 
> > Here we have function returning pointer WRT function returning integer:
> 
> This one is on purpose and cannot be easily changed.  Pointer types (or access
> types as called in Ada) are avoided as much as possible in the runtime because
> they drag the accessibility machinery, which is the machinery present in
> the
> language to eliminate dangling references and is heavy; so they are usually
> imported as System.Address instead.

This particular instance can probably be fixed, I'll give it a shot when I
get a chance. But you're right that the general issue is that System.Address
is often used as a void*

Arno


Re: [AARCH64][PATCH 2/3] Implementing vmulx_lane NEON intrinsic variants

2015-11-22 Thread James Greenhalgh
On Mon, Nov 09, 2015 at 11:03:28AM +, Bilyan Borisov wrote:
> 
> 
> On 03/11/15 11:16, James Greenhalgh wrote:
> >On Fri, Oct 30, 2015 at 09:31:08AM +, Bilyan Borisov wrote:
> >>In this patch from the series, all vmulx_lane variants have been 
> >>implemented as
> >>a vdup followed by a vmulx. Existing implementations of intrinsics were
> >>refactored to use this new approach.
> >>
> >>Several new nameless md patterns are added that will enable the combine 
> >>pass to
> >>pick up the dup/fmulx combination and replace it with a proper fmulx[lane]
> >>instruction.
> >>
> >>In addition, test cases for all new intrinsics were added. Tested on targets
> >>aarch64-none-elf and aarch64_be-none-elf.
> >Hi,
> >
> >I have a small style comment below.
> >
> >>gcc/
> >>
> >>2015-XX-XX  Bilyan Borisov  
> >>
> >>* config/aarch64/arm_neon.h (vmulx_lane_f32): New.
> >>(vmulx_lane_f64): New.
> >>(vmulxq_lane_f32): Refactored & moved.
> >>(vmulxq_lane_f64): Refactored & moved.
> >>(vmulx_laneq_f32): New.
> >>(vmulx_laneq_f64): New.
> >>(vmulxq_laneq_f32): New.
> >>(vmulxq_laneq_f64): New.
> >>(vmulxs_lane_f32): New.
> >>(vmulxs_laneq_f32): New.
> >>(vmulxd_lane_f64): New.
> >>(vmulxd_laneq_f64): New.
> >>* config/aarch64/aarch64-simd.md (*aarch64_combine_dupfmulx1,
> >>VDQSF): New pattern.
> >>(*aarch64_combine_dupfmulx2, VDQF): New pattern.
> >>(*aarch64_combine_dupfmulx3): New pattern.
> >>(*aarch64_combine_vgetfmulx1, VDQF_DF): New pattern.
> >I'm not sure I like the use of 1,2,3 for this naming scheme. Elsewhere in
> >the file, this convention points to the number of operands a pattern
> >requires (for example add3).
> >
> >I think elsewhere in the file we use:
> >
> >
> >   "*aarch64_mul3_elt"
> >   "*aarch64_mul3_elt_"
> >   "*aarch64_mul3_elt_to_128df"
> >   "*aarch64_mul3_elt_to_64v2df"
> >
> >Is there a reason not to follow that pattern?
> >
> >Thanks,
> >James
> >
> Hi,
> 
> I've made the changes you've requested - the pattern names have been
> changed to follow better the naming conventions elsewhere in the
> file.

This is OK with a reformatting of some comments.

> +;; fmulxs_lane_f32, fmulxs_laneq_f32, fmulxd_lane_f64 ==  fmulx_lane_f64,
> +;; fmulxd_laneq_f64 == fmulx_laneq_f64

I'd rewrite this as so:

  ;; fmulxs_lane_f32, fmulxs_laneq_f32
  ;; fmulxd_lane_f64 ==  fmulx_lane_f64
  ;; fmulxd_laneq_f64 == fmulx_laneq_f64

The way you have it I was parsing it as all of {fmulxs_lane_f32,
fmulxs_laneq_f32, fmulxd_lane_f64} are the same as fmulx_lane_f64 - which
is not accurate.

Additionally, with all these comments I'd use the intrinsic name
(vmulx_lane_f32 rather than fmulx_lane_f32).

Sorry for the long wait for review.

I've committed it on your behalf as revision r230720.

Thanks,
James



Re: [AARCH64][PATCH 3/3] Adding tests to check proper error reporting of out of bounds accesses to vmulx_lane* NEON intrinsics

2015-11-22 Thread James Greenhalgh
On Fri, Oct 30, 2015 at 09:32:07AM +, Bilyan Borisov wrote:
> Implementing vmulx_* and vmulx_lane* NEON intrinsics
> 
> Hi all,
> 
> This series of patches focuses on the different vmulx_ and vmulx_lane NEON
> intrinsics variants. All of the existing inlined assembly block 
> implementations
> are replaced with newly defined __builtin functions, and the missing 
> intrinsics
> are implemented with __builtins as well.
> 
> The rationale for the change from assembly to __builtin is that the compiler
> would be able to do more optimisations like instruction scheduling. A new 
> named
> md pattern was added for the new fmulx __builtin.
> 
> Most vmulx_lane variants have been implemented as a combination of a vdup
> followed by a vmulx_, rather than as separate __builtins.  The remaining
> vmulx_lane intrinsics (vmulx(s|d)_lane*) were implemented using
> __aarch64_vget_lane_any () and an appropriate vmulx. Four new nameless md
> patterns were added to replace all the different types of RTL generated from 
> the
> combination of these intrinsics during the combine pass.
> 
> The rationale for this change is that in this way we would be able to optimise
> away all uses of a dup followed by a fmulx to the appropriate fmulx lane 
> variant
> instruction.
> 
> New test cases were added for all the implemented intrinsics. Also new tests
> were added for the proper error reporting of out-of-bounds accesses to _lane
> intrinsics.
> 
> Tested on targets aarch64-none-elf and aarch64_be-none-elf.
> 

> diff --git 
> a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vmulx_lane_f32_indices_1.c
>  
> b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vmulx_lane_f32_indices_1.c
> new file mode 100644
> index 
> ..5681d5d21bc62e54e308c0a7c171f6f1b8969b71
> --- /dev/null
> +++ 
> b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vmulx_lane_f32_indices_1.c
> @@ -0,0 +1,16 @@
> +#include 
> +
> +/* { dg-do compile } */
> +/* { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } } */
> +/* { dg-skip-if "" { arm*-*-* } } */
> +
> +float32x2_t
> +f_vmulx_lane_f32 (float32x2_t v1, float32x2_t v2)
> +{
> +  float32x2_t res;
> +  /* { dg-error "lane -1 out of range 0 - 1" "" { xfail arm*-*-* } 0 } */
> +  res = vmulx_lane_f32 (v1, v2, -1);
> +  /* { dg-error "lane 2 out of range 0 - 1" "" { xfail arm*-*-* } 0 } */

Given the dg-skip-if directive, do we really need the cfail directive for
arm*-*-*, surely the whole test is skipped regardless?

Could you respin this patch without the xfails?

Thanks,
James



Re: [Aarch64] Use vector wide add for mixed-mode adds

2015-11-22 Thread James Greenhalgh
On Sun, Nov 08, 2015 at 11:51:47PM -0700, Michael Collison wrote:
> 2015-11-06  Michael Collison 
> * config/aarch64/aarch64-simd.md (widen_ssum, widen_usum)
> (aarch64_w_internal): New patterns
> * config/aarch64/iterators.md (Vhalf, VDBLW): New mode attributes.
> * gcc.target/aarch64/saddw-1.c: New test.
> * gcc.target/aarch64/saddw-2.c: New test.
> * gcc.target/aarch64/uaddw-1.c: New test.
> * gcc.target/aarch64/uaddw-2.c: New test.
> * gcc.target/aarch64/uaddw-3.c: New test.
> * lib/target-support.exp
> (check_effective_target_vect_widen_sum_hi_to_si_pattern):
> Add aarch64 to list of support targets.


These hunks are all OK (with the minor style comments below applied).

As we understand what's happening here, let's take the regressions below
for now and add AArch64 to the targets affected by pr68333.

> * gcc.dg/vect/slp-multitypes-4.c: Disable test for
> targets with widening adds from V8HI=>V4SI.
> * gcc.dg/vect/slp-multitypes-5.c: Ditto.
> * gcc.dg/vect/vect-125.c: Ditto.

Let's leave these for now, while we wait for pr68333.

> diff --git a/gcc/config/aarch64/aarch64-simd.md 
> b/gcc/config/aarch64/aarch64-simd.md
> index 65a2b6f..acb7cf0 100644
> --- a/gcc/config/aarch64/aarch64-simd.md
> +++ b/gcc/config/aarch64/aarch64-simd.md
> @@ -2750,6 +2750,60 @@
>  
>  ;; w.
>  
> +(define_expand "widen_ssum3"
> +  [(set (match_operand: 0 "register_operand" "")
> + (plus: (sign_extend: (match_operand:VQW 1 
> "register_operand" ""))

Split this line (more than 80 characters).

> +   (match_operand: 2 "register_operand" "")))]
> +  "TARGET_SIMD"
> +  {
> +rtx p = aarch64_simd_vect_par_cnst_half (mode, false);
> +rtx temp = gen_reg_rtx (GET_MODE (operands[0]));
> +
> +emit_insn (gen_aarch64_saddw_internal (temp, operands[2],
> + operands[1], p));
> +emit_insn (gen_aarch64_saddw2 (operands[0], temp, operands[1]));
> +DONE;
> +  }
> +)
> +
> +(define_expand "widen_ssum3"
> +  [(set (match_operand: 0 "register_operand" "")
> + (plus: (sign_extend:
> +(match_operand:VD_BHSI 1 "register_operand" ""))
> +   (match_operand: 2 "register_operand" "")))]
> +  "TARGET_SIMD"
> +{
> +  emit_insn (gen_aarch64_saddw (operands[0], operands[2], 
> operands[1]));
> +  DONE;
> +})
> +
> +(define_expand "widen_usum3"
> +  [(set (match_operand: 0 "register_operand" "")
> + (plus: (zero_extend: (match_operand:VQW 1 
> "register_operand" ""))

Split this line (more than 80 characters).

> +   (match_operand: 2 "register_operand" "")))]
> +  "TARGET_SIMD"
> +  {
> +rtx p = aarch64_simd_vect_par_cnst_half (mode, false);
> +rtx temp = gen_reg_rtx (GET_MODE (operands[0]));
> +
> +emit_insn (gen_aarch64_uaddw_internal (temp, operands[2],
> +  operands[1], p));
> +emit_insn (gen_aarch64_uaddw2 (operands[0], temp, operands[1]));
> +DONE;
> +  }
> +)
> +
> +(define_expand "widen_usum3"
> +  [(set (match_operand: 0 "register_operand" "")
> + (plus: (zero_extend:
> +(match_operand:VD_BHSI 1 "register_operand" ""))
> +   (match_operand: 2 "register_operand" "")))]
> +  "TARGET_SIMD"
> +{
> +  emit_insn (gen_aarch64_uaddw (operands[0], operands[2], 
> operands[1]));
> +  DONE;
> +})
> +
>  (define_insn "aarch64_w"
>[(set (match_operand: 0 "register_operand" "=w")
>  (ADDSUB: (match_operand: 1 "register_operand" "w")
> @@ -2760,6 +2814,18 @@
>[(set_attr "type" "neon__widen")]
>  )
>  
> +(define_insn "aarch64_w_internal"
> +  [(set (match_operand: 0 "register_operand" "=w")
> +(ADDSUB: (match_operand: 1 "register_operand" "w")
> + (ANY_EXTEND:
> +   (vec_select:
> +(match_operand:VQW 2 "register_operand" "w")
> +(match_operand:VQW 3 "vect_par_cnst_lo_half" "")]
> +  "TARGET_SIMD"
> +  "w\\t%0., %1., %2."
> +  [(set_attr "type" "neon__widen")]
> +)
> +
>  (define_insn "aarch64_w2_internal"
>[(set (match_operand: 0 "register_operand" "=w")
>  (ADDSUB: (match_operand: 1 "register_operand" "w")

> diff --git a/gcc/testsuite/gcc.target/aarch64/saddw-1.c 
> b/gcc/testsuite/gcc.target/aarch64/saddw-1.c
> new file mode 100644
> index 000..9db5d00
> --- /dev/null
> +++ b/gcc/testsuite/gcc.target/aarch64/saddw-1.c
> @@ -0,0 +1,20 @@
> +/* { dg-do compile } */
> +/* { dg-options "-O3" } */
> +
> +

Extra newline.

> +int 
> +t6(int len, void * dummy, short * __restrict x)
> +{
> +  len = len & ~31;
> +  int result = 0;
> +  __asm volatile ("");
> +  for (int i = 0; i < len; i++)
> +result += x[i];
> +  return result;
> +}
> +
> +/* { dg-final { scan-assembler "saddw" } } */
> +/* { dg-final { scan-assembler "saddw2" } } */
> +
> +
> +

Trailing newlines.

> diff --git a/gcc/testsuite/gcc.target/aarch64/saddw-2.c 
> b/gc

Re: [PATCH] Fix PR objc/68438 (uninitialized source ranges)

2015-11-22 Thread David Malcolm
On Fri, 2015-11-20 at 23:28 +, Joseph Myers wrote:
> On Fri, 20 Nov 2015, David Malcolm wrote:
> 
> > The source ranges are verified using the same unit-testing plugin used
> > for C expressions.  This leads to a wart, which is that it means having
> > a .m test file lurking below gcc.dg/plugin.  A workaround would be to
> > create an objc.dg/plugin subdirectory, with a new plugin.exp for testing
> > Objective C plugins, and having it reference the existing plugin below
> > gcc.dg/plugin.  That seemed like excessive complication, so I went for
> > the simpler approach of simply putting the .m file below gcc.dg/plugin.
> 
> Have you made sure that this test is quietly not run if the 
> --enable-languages configuration does not build the ObjC compiler?

Good point; sadly, it does introduce FAILs for that configuration.

Is there (or could there be) a precanned dg- directive to ask if ObjC is
available?  

Otherwise I can look at creating an objc.dg/plugin subdirectory.

Thanks
Dave



Re: [PATCH] (Partial) Implementation of simplificaiton of CSHIFT

2015-11-22 Thread Steve Kargl
On Sun, Nov 22, 2015 at 09:51:09AM +0100, Dominique d'Humi??res wrote:
> 
> Compiling the attached code after revision r230710 gives the ICE
> 
> f951: internal compiler error: in gfc_simplify_cshift, at 
> fortran/simplify.c:1823
> 
> while it compiled before.
> 

File a bug report, then fix rank > 2.

-- 
Steve


Re: [PATCH v2] Add uaddv_optab, usubv4_optab

2015-11-22 Thread Segher Boessenkool
Hi Richard,

On Sun, Nov 22, 2015 at 11:38:31AM +0100, Richard Henderson wrote:
> One of which I believe I've worked around in the i386 backend, but I 
> believe to be a latent problem within combine.
> 
> With the following patch, disable the add3_*_overflow_2 patterns.  
> Then compile c-c++-common/torture/builtin-arith-overflow-4.c with -O2 and 
> you'll see
> 
>  t151_2add:
>testb   %dil, %dil
>leal-1(%rdi), %eax
>jne .L644
> 
> which is incorrect.  Combine has looked through two comparisons, seen the 
> NE in the second comparison, and then converted a CCCmode compare to a 
> CCZmode compare.

It sees the *first* comparison, and its use, and has simplified that.
As far as I see, anyway.  (It will never look outside a basic block,
combine isn't *that* scary!)

0xff + x < 0xff  (everything as unsigned char) is the same as  x != 0 .


Segher


Re: [PATCH] (Partial) Implementation of simplificaiton of CSHIFT

2015-11-22 Thread Dominique d'Humières

> Le 22 nov. 2015 à 17:21, Steve Kargl  a 
> écrit :
> 
> On Sun, Nov 22, 2015 at 09:51:09AM +0100, Dominique d'Humi??res wrote:
>> 
>> Compiling the attached code after revision r230710 gives the ICE
>> 
>> f951: internal compiler error: in gfc_simplify_cshift, at 
>> fortran/simplify.c:1823
>> 
>> while it compiled before.
>> 
> File a bug report, then fix rank > 2.

Already done by H.J. Lu (pr68486), see also my comment 2.

Dominique

> 
> -- 
> Steve



Re: Fix lto-symtab ICE during Ada LTO bootstrap

2015-11-22 Thread Jan Hubicka
> > this patch fixes an ICE seen with Ada LTO bootstrap in reporting type
> > mismatches and it also makes us to stop complaining about C++ ODR
> > violation.  The warnings are however correct.  I looked at few:
> > 
> > ../../libiberty/xstrerror.c:40:14: warning: type of �strerror� does not
> > match original declaration [-Wlto-type-mismatch] extern char *strerror
> > (int);
> >   ^
> > 
> > ../../gcc/ada/s-os_lib.adb:1007:16: note: return value type mismatch
> >function strerror (errnum : Integer) return System.Address;
> > ^
> > 
> > ../../gcc/ada/s-os_lib.adb:1007:16: note:
> > �system__os_lib__errno_message__strerror� was previously declared here
> > 
> > Here we have function returning pointer WRT function returning integer:
> 
> This one is on purpose and cannot be easily changed.  Pointer types (or 
> access 
> types as called in Ada) are avoided as much as possible in the runtime 
> because 
> they drag the accessibility machinery, which is the machinery present in the 
> language to eliminate dangling references and is heavy; so they are usually 
> imported as System.Address instead.

Yep, I read the specification yesterday.

It seems to me that the only way to handle this is to put the integer type
used to represent pointers to the same alias set as void_ptr_type.
This is doable by simply making gimple_canonical_types_compatible_p and
lto.c handle this type specially as "pointer".

I can implement this; but I woul dlike to enable this kind of globing only
when there is an union in Ada.

> 
> > : warning: type of �__builtin_strlen� does not match original
> > declaration [-Wlto-type-mismatch] ../../gcc/ada/osint.adb:422:19: note:
> > return value type mismatch
> > ../../gcc/ada/osint.adb:422:19: note: type �integer� should match type �long
> > unsigned int�
> > 
> > Here the signedness of integer does not match:
> 
> Yes, it's clearly incorrect on the Ada side and should be fixed in osint.adb.

Great!
> 
> > ../../gcc/ada/s-os_lib.ads:1053:4: warning: type of
> > �system__os_lib__directory_separator� does not match original declaration
> > [-Wlto-type-mismatch] Directory_Separator : constant Character;
> > ^
> > 
> > ../../gcc/ada/adaint.c:225:6: note: type �char� should match type �volatile
> > character� char __gnat_dir_separator = DIR_SEPARATOR;
> >   ^
> > 
> > Here we get difference in  signedness and volatility:
> 
> The signedness issue for Character is known and we plan to address it; the 
> volatility issue was overlooked but looks fixable too.

Actually the volatility is not a big deal: we ignore it for canonical type
computation anyway (probably we don't, but in general we do not need
to care much about optimizing volatile memory accesses, so we lose nothing by
handling this safely)
> 
> > All those types will lead to wrong code if ever written to same memory
> > location because of TBAA.  Eric, does Ada need all this types to be TBAA
> > compatible? If so, we need to implement more strict globbing as we did for
> > Fortran and we probably finally need to make the globbing aware of
> > languages involved (we definitly don't want to glob pointers and integers
> > for C/C++ programs)
> 
> I think that we can fix all the problems on the Ada side except for the 
> pointer/System.Address duality (which can be even more problematic on 
> architectures that use different calling conventions for them).

That sounds good.  I can try to cook up the prototype patch for pointers.
I fixed issues that breaks Ada bootstrap, but I still get an ICE in LTO
built gnat1 in Ada code.  I am not quite sure what is wrong (it fails
early setting some flags in atree, but that is as far as I can read the code)

Honza
> 
> > Eric, it would be great to have a stand alone testcases in style of
> > gcc/testsuite/gfortran.dg/lto/bind_c-*
> > which stores and reads the same memory location in same alias set and thus
> > trigger the undefined behvaiour.
> 
> OK, I'll think about that, thanks.
> 
> -- 
> Eric Botcazou


Fix tree-ssa-dce Ada LTO bootstrap ice

2015-11-22 Thread Jan Hubicka
Hi,
this patch fixes tree-ssa-dce ICE seen during Ada bootstrap.  It is updated
version of https://gcc.gnu.org/ml/gcc-patches/2015-05/msg02876.html for
current mainline

Bootstrapped/regtested x86_64-linux, OK?

PR middle-end/65337
* tree-ssa-dce.c (bb_postorder): New static var.
(forward_edge_to_pdom): Remove.
(remove_dead_stmt): Instead of redirecting edges only keep an edge
on a path to nearest live BB.
(eliminate_unnecessary_stmts): Free bb_postorder.
* cfganal.c (dfs_find_deadend): Add START_POINTES.
* cfganal.h (inverted_post_order_compute): Update prototype.
Index: tree-ssa-dce.c
===
--- tree-ssa-dce.c  (revision 230718)
+++ tree-ssa-dce.c  (working copy)
@@ -112,6 +112,9 @@ static sbitmap visited_control_parents;
to be recomputed.  */
 static bool cfg_altered;
 
+/* When non-NULL holds map from basic block index into the postorder.  */
+static int *bb_postorder;
+
 
 /* If STMT is not already marked necessary, mark it, and add it to the
worklist if ADD_TO_WORKLIST is true.  */
@@ -997,65 +1000,6 @@ remove_dead_phis (basic_block bb)
   return something_changed;
 }
 
-/* Forward edge E to respective POST_DOM_BB and update PHIs.  */
-
-static edge
-forward_edge_to_pdom (edge e, basic_block post_dom_bb)
-{
-  gphi_iterator gsi;
-  edge e2 = NULL;
-  edge_iterator ei;
-
-  if (dump_file && (dump_flags & TDF_DETAILS))
-fprintf (dump_file, "Redirecting edge %i->%i to %i\n", e->src->index,
-e->dest->index, post_dom_bb->index);
-
-  e2 = redirect_edge_and_branch (e, post_dom_bb);
-  cfg_altered = true;
-
-  /* If edge was already around, no updating is necessary.  */
-  if (e2 != e)
-return e2;
-
-  if (!gimple_seq_empty_p (phi_nodes (post_dom_bb)))
-{
-  /* We are sure that for every live PHI we are seeing control dependent 
BB.
- This means that we can pick any edge to duplicate PHI args from.  */
-  FOR_EACH_EDGE (e2, ei, post_dom_bb->preds)
-   if (e2 != e)
- break;
-  for (gsi = gsi_start_phis (post_dom_bb); !gsi_end_p (gsi);)
-   {
- gphi *phi = gsi.phi ();
- tree op;
- source_location locus;
-
- /* PHIs for virtuals have no control dependency relation on them.
-We are lost here and must force renaming of the symbol.  */
- if (virtual_operand_p (gimple_phi_result (phi)))
-   {
- mark_virtual_phi_result_for_renaming (phi);
- remove_phi_node (&gsi, true);
- continue;
-   }
-
- /* Dead PHI do not imply control dependency.  */
-  if (!gimple_plf (phi, STMT_NECESSARY))
-   {
- gsi_next (&gsi);
- continue;
-   }
-
- op = gimple_phi_arg_def (phi, e2->dest_idx);
- locus = gimple_phi_arg_location (phi, e2->dest_idx);
- add_phi_arg (phi, op, e, locus);
- /* The resulting PHI if not dead can only be degenerate.  */
- gcc_assert (degenerate_phi_p (phi));
- gsi_next (&gsi);
-   }
-}
-  return e;
-}
 
 /* Remove dead statement pointed to by iterator I.  Receives the basic block BB
containing I so that we don't have to look it up.  */
@@ -1075,38 +1019,48 @@ remove_dead_stmt (gimple_stmt_iterator *
   stats.removed++;
 
   /* If we have determined that a conditional branch statement contributes
- nothing to the program, then we not only remove it, but we also change
- the flow graph so that the current block will simply fall-thru to its
- immediate post-dominator.  The blocks we are circumventing will be
- removed by cleanup_tree_cfg if this change in the flow graph makes them
- unreachable.  */
+ nothing to the program, then we not only remove it, but we need to update
+ the CFG.  We can chose any of edges out of BB as long as we are sure to 
not
+ close infinite loops.  This is done by always choosing the edge closer to
+ exit in inverted_post_order_compute order.  */
   if (is_ctrl_stmt (stmt))
 {
-  basic_block post_dom_bb;
-  edge e, e2;
   edge_iterator ei;
+  edge e = NULL, e2;
 
-  post_dom_bb = get_immediate_dominator (CDI_POST_DOMINATORS, bb);
-
-  e = find_edge (bb, post_dom_bb);
-
-  /* If edge is already there, try to use it.  This avoids need to update
- PHI nodes.  Also watch for cases where post dominator does not exists
-or is exit block.  These can happen for infinite loops as we create
-fake edges in the dominator tree.  */
-  if (e)
-;
-  else if (! post_dom_bb || post_dom_bb == EXIT_BLOCK_PTR_FOR_FN (cfun))
-   e = EDGE_SUCC (bb, 0);
-  else
-e = forward_edge_to_pdom (EDGE_SUCC (bb, 0), post_dom_bb);
+  /* See if there is only one non-abnormal edge.  */
+  if (single_succ_p (bb))
+e = single_succ_edge (bb);
+  /* Otherwise chose one that 

[PATCH] fortran/openmp.c -- Fix bootstrap

2015-11-22 Thread Steve Kargl
I have no idea if this is actually correct, but it restores bootstrap.
OK to commit?

2015-11-22  Steven G. Kargl  

* openmp.c (match_oacc_clause_gang): Fix bootstrap.


Index: openmp.c
===
--- openmp.c(revision 230723)
+++ openmp.c(working copy)
@@ -415,7 +415,8 @@ match_oacc_clause_gang (gfc_omp_clauses 
 static match
 gfc_match_oacc_clause_link (const char *str, gfc_omp_namelist **list)
 {
-  gfc_omp_namelist *head, *tail, *p;
+  gfc_omp_namelist *head = NULL;
+  gfc_omp_namelist *tail, *p;
   locus old_loc;
   char n[GFC_MAX_SYMBOL_LEN+1];
   gfc_symbol *sym;
@@ -4821,7 +4822,7 @@ gfc_resolve_oacc_declare (gfc_namespace 
 
   for (oc = ns->oacc_declare; oc; oc = oc->next)
 {
-  for (list = 0; list <= OMP_LIST_NUM; list++)
+  for (list = 0; list < OMP_LIST_NUM; list++)
for (n = oc->clauses->lists[list]; n; n = n->next)
  {
n->sym->mark = 0;
@@ -4846,7 +4847,7 @@ gfc_resolve_oacc_declare (gfc_namespace 
 
   for (oc = ns->oacc_declare; oc; oc = oc->next)
 {
-  for (list = 0; list <= OMP_LIST_NUM; list++)
+  for (list = 0; list < OMP_LIST_NUM; list++)
for (n = oc->clauses->lists[list]; n; n = n->next)
  {
if (n->sym->mark)
@@ -4862,7 +4863,7 @@ gfc_resolve_oacc_declare (gfc_namespace 
 
   for (oc = ns->oacc_declare; oc; oc = oc->next)
 {
-  for (list = 0; list <= OMP_LIST_NUM; list++)
+  for (list = 0; list < OMP_LIST_NUM; list++)
for (n = oc->clauses->lists[list]; n; n = n->next)
  n->sym->mark = 0;
 }
-- 
Steve


Re: [Back port r227760] PR67460 [5 Regression] Spurious: f951: all warnings being treated as errors

2015-11-22 Thread Jerry DeLisle
On 11/22/2015 01:14 AM, Dominique d'Humières wrote:
> Is it OK to back port revision r227760 to 5.3?
> Tested on x86_64-apple-darwin14
> 
> Dominique
> 

I think its OK.

Jerry


Re: [PATCH] fortran/openmp.c -- Fix bootstrap

2015-11-22 Thread Jerry DeLisle
On 11/22/2015 10:59 AM, Steve Kargl wrote:
> I have no idea if this is actually correct, but it restores bootstrap.
> OK to commit?
> 

This looks correct to me. There should be no more in the lists than
OMP_LIST_NUM. Was there a PR for this and do we know when it broke?

Jerry





Re: [PATCH] fortran/openmp.c -- Fix bootstrap

2015-11-22 Thread James Norris

Hi,

Patch committed to trunk as obvious. Thanks to Dominique and Steve.

Jim


On 11/22/2015 12:59 PM, Steve Kargl wrote:

I have no idea if this is actually correct, but it restores bootstrap.
OK to commit?

2015-11-22  Steven G. Kargl  

* openmp.c (match_oacc_clause_gang): Fix bootstrap.


Index: openmp.c
===
--- openmp.c(revision 230723)
+++ openmp.c(working copy)
@@ -415,7 +415,8 @@ match_oacc_clause_gang (gfc_omp_clauses
  static match
  gfc_match_oacc_clause_link (const char *str, gfc_omp_namelist **list)
  {
-  gfc_omp_namelist *head, *tail, *p;
+  gfc_omp_namelist *head = NULL;
+  gfc_omp_namelist *tail, *p;
locus old_loc;
char n[GFC_MAX_SYMBOL_LEN+1];
gfc_symbol *sym;
@@ -4821,7 +4822,7 @@ gfc_resolve_oacc_declare (gfc_namespace

for (oc = ns->oacc_declare; oc; oc = oc->next)
  {
-  for (list = 0; list <= OMP_LIST_NUM; list++)
+  for (list = 0; list < OMP_LIST_NUM; list++)
for (n = oc->clauses->lists[list]; n; n = n->next)
  {
n->sym->mark = 0;
@@ -4846,7 +4847,7 @@ gfc_resolve_oacc_declare (gfc_namespace

for (oc = ns->oacc_declare; oc; oc = oc->next)
  {
-  for (list = 0; list <= OMP_LIST_NUM; list++)
+  for (list = 0; list < OMP_LIST_NUM; list++)
for (n = oc->clauses->lists[list]; n; n = n->next)
  {
if (n->sym->mark)
@@ -4862,7 +4863,7 @@ gfc_resolve_oacc_declare (gfc_namespace

for (oc = ns->oacc_declare; oc; oc = oc->next)
  {
-  for (list = 0; list <= OMP_LIST_NUM; list++)
+  for (list = 0; list < OMP_LIST_NUM; list++)
for (n = oc->clauses->lists[list]; n; n = n->next)
  n->sym->mark = 0;
  }





Re: [PATCH] lround for PowerPC

2015-11-22 Thread David Edelsohn
v2 of the patch.  Seems to pass the GCC testsuite, although the
testsuite doesn't stress FP.

There is something wrong with current VSX SFmode constraints.

Index: rs6000.md
===
--- rs6000.md (revision 230723)
+++ rs6000.md (working copy)
@@ -77,6 +77,7 @@
UNSPEC_FRIN
UNSPEC_FRIP
UNSPEC_FRIZ
+   UNSPEC_XSRDPI
UNSPEC_LD_MPIC ; load_macho_picbase
UNSPEC_RELD_MPIC ; re-load_macho_picbase
UNSPEC_MPIC_CORRECT ; macho_correct_pic
@@ -5500,6 +5501,27 @@
   [(set_attr "type" "fp")
(set_attr "fp_type" "fp_addsub_")])

+(define_insn "*xsrdpi2"
+  [(set (match_operand:SFDF 0 "gpc_reg_operand" "=wa")
+   (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "wa")]
+UNSPEC_XSRDPI))]
+  "TARGET__FPR && TARGET_POPCNTD"
+  "xsrdpi %x0,%x1"
+  [(set_attr "type" "fp")
+   (set_attr "fp_type" "fp_addsub_")])
+
+(define_expand "lrounddi2"
+  [(set (match_dup 2)
+   (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "wa")]
+UNSPEC_XSRDPI))
+   (set (match_operand:DI 0 "gpc_reg_operand" "=d")
+   (unspec:DI [(match_dup 2)]
+  UNSPEC_FCTID))]
+  "TARGET__FPR && TARGET_POPCNTD"
+{
+  operands[2] = gen_reg_rtx (mode);
+})
+
 ; An UNSPEC is used so we don't have to support SImode in FP registers.
 (define_insn "stfiwx"
   [(set (match_operand:SI 0 "memory_operand" "=Z")


Re: [PATCH v2] Add uaddv_optab, usubv4_optab

2015-11-22 Thread Uros Bizjak
On Sun, Nov 22, 2015 at 11:38 AM, Richard Henderson  wrote:
> The full round of testing from v1 turned up a couple of problems.
>
> One of which I believe I've worked around in the i386 backend, but I believe
> to be a latent problem within combine.
>
> With the following patch, disable the add3_*_overflow_2 patterns.
> Then compile c-c++-common/torture/builtin-arith-overflow-4.c with -O2 and
> you'll see
>
>  t151_2add:
>testb   %dil, %dil
>leal-1(%rdi), %eax
>jne .L644
>
> which is incorrect.  Combine has looked through two comparisons, seen the NE
> in the second comparison, and then converted a CCCmode compare to a CCZmode
> compare.
>
> I wonder if the code in combine.c simplify_set which calls SELECT_CC_MODE
> ought to be throwing away existing MODE_CC data.  Ought we verify that the
> newly selected CC mode is cc_modes_compatible with the existing?  That would
> certainly work when we begin with the "usual" fully general CCmode compare,
> optimizing to CCZmode, but would then reject moving between CCCmode and
> CCZmode.
>
> That said, the addition of the new _overflow_2 patterns allows CSE to
> simplify the expressions earlier, which avoids the problem in combine.
>
> Ok?

> * optabs.def (uaddv4_optab, usubv4_optab): New.
> * internal-fn.c (expand_addsub_overflow): Use them.
> * doc/md.texi (Standard Names): Add uaddv4, usubv4.
>
> * config/i386/i386.c (ix86_cc_mode): Extend add overflow check
> to reversed operands.
> * config/i386/i386.md (uaddv4, usubv4): New.
> (*add3_cconly_overflow_1): Rename *add3_cconly_overflow.
> (*add3_cc_overflow_1): Rename *add3_cc_overflow.
> (*addsi3_zext_cc_overflow_1): Rename *add3_zext_cc_overflow.
> (*add3_cconly_overflow_2): New.
> (*add3_cc_overflow_2): New.
> (*addsi3_zext_cc_overflow_2): New.

x86 parts are OK with a small change, see below.

+(define_expand "usubv4"
+  [(parallel [(set (reg:CC FLAGS_REG)
+   (compare:CC
+ (match_operand:SWI 1 "nonimmediate_operand")
+ (match_operand:SWI 2 "")))
+  (set (match_operand:SWI 0 "register_operand")
+   (minus:SWI (match_dup 1) (match_dup 2)))])
+   (set (pc) (if_then_else
+   (ltu (reg:CC FLAGS_REG) (const_int 0))
+   (label_ref (match_operand 3))
+   (pc)))]
+  ""
+{
+  ix86_fixup_binary_operands_no_copy (MINUS, mode, operands);
+})

Please use quotes instead of braces in the one-line preparation
statement here and in the other place.

Thanks,
Uros.


[COMMITTED] libitm: Fix recent changes to allocations log.

2015-11-22 Thread Torvald Riegel
This fixes an oversight in the recent changes to the allocations log for
supporting sized delete.

Tested libitm on x86_64-linux.  COmmitted as obvious.

libitm/
* libitm_i.h (gtm_alloc_action): Remove union.
* testsuite/libitm.c/alloc-1.c: New.

commit 74c5fd924fe3e8d6bececce209d00bf0523bb4dc
Author: Torvald Riegel 
Date:   Sun Nov 22 21:54:24 2015 +0100

libitm: Fix recent changes to allocations log.

	libitm/
	* libitm_i.h (gtm_alloc_action): Remove union.
	* testsuite/libitm.c/alloc-1.c: New.

diff --git a/libitm/libitm_i.h b/libitm/libitm_i.h
index f01a1ab..4b72348 100644
--- a/libitm/libitm_i.h
+++ b/libitm/libitm_i.h
@@ -106,12 +106,10 @@ namespace GTM HIDDEN {
 // the template used inside gtm_thread can instantiate.
 struct gtm_alloc_action
 {
-  // Iff free_fn_sz is nonzero, it must be used instead of free_fn.
-  union
-  {
-void (*free_fn)(void *);
-void (*free_fn_sz)(void *, size_t);
-  };
+  // Iff free_fn_sz is nonzero, it must be used instead of free_fn, and vice
+  // versa.
+  void (*free_fn)(void *);
+  void (*free_fn_sz)(void *, size_t);
   size_t sz;
   // If true, this is an allocation; we discard the log entry on outermost
   // commit, and deallocate on abort.  If false, this is a deallocation and
diff --git a/libitm/testsuite/libitm.c/alloc-1.c b/libitm/testsuite/libitm.c/alloc-1.c
new file mode 100644
index 000..49faab5
--- /dev/null
+++ b/libitm/testsuite/libitm.c/alloc-1.c
@@ -0,0 +1,17 @@
+// Test that rolling back allocations works.
+#include 
+
+void __attribute((transaction_pure,noinline)) dont_optimize(void* p)
+{
+  *(volatile char *) p;
+}
+
+int main()
+{
+  __transaction_atomic {
+void *p = malloc (23);
+dont_optimize (p);
+__transaction_cancel;
+  }
+  return 0;
+}


[PATCH] Fix leading zero with g0 editing

2015-11-22 Thread Jerry DeLisle
This minor patch brings the leading zero to emitting floats with g0 editing by
moving the block of code up a little before the g0 is handled.  This has been
lurking in my trunk for several moths and I would like to get it out of the way.
Updated Test case also.

Regression tested on x86-64-linux.

OK for trunk?

Jerry

2015-11-22  Jerry DeLisle  

* io/write_float.def (output_float): Move block determining
room for leading zero to before checkng g0 formatting.


Index: fmt_g0_1.f08
===
--- fmt_g0_1.f08(revision 230725)
+++ fmt_g0_1.f08(working copy)
@@ -8,9 +8,9 @@
 write(buffer, string) ':',0,':'
 if (buffer.ne.":0:") call abort
 write(buffer, string) ':',1.0_8/3.0_8,':'
-if (buffer.ne.":.1:") call abort
+if (buffer.ne.":0.1:") call abort
 write(buffer, '(1x,a,g0,a)') ':',1.0_8/3.0_8,':'
-if (buffer.ne." :.1:") call abort
+if (buffer.ne." :0.1:") call abort
 write(buffer, string) ':',"hello",':'
 if (buffer.ne.":hello:") call abort
 write(buffer, "(g0,g0,g0,g0)") ':',.true.,.false.,':'
Index: write_float.def
===
--- write_float.def	(revision 230709)
+++ write_float.def	(working copy)
@@ -514,12 +514,21 @@ output_float (st_parameter_dt *dtp, const fnode *f
 	  w = w == 1 ? 2 : w;
 	}
 }
-  
+
   /* Work out how much padding is needed.  */
   nblanks = w - (nbefore + nzero + nafter + edigits + 1);
   if (sign != S_NONE)
 nblanks--;
 
+  /* See if we have space for a zero before the decimal point.  */
+  if (nbefore == 0 && nblanks > 0)
+{
+  leadzero = 1;
+  nblanks--;
+}
+  else
+leadzero = 0;
+
   if (dtp->u.p.g0_no_blanks)
 {
   w -= nblanks;
@@ -544,15 +553,6 @@ output_float (st_parameter_dt *dtp, const fnode *f
   return false;
 }
 
-  /* See if we have space for a zero before the decimal point.  */
-  if (nbefore == 0 && nblanks > 0)
-{
-  leadzero = 1;
-  nblanks--;
-}
-  else
-leadzero = 0;
-
   /* For internal character(kind=4) units, we duplicate the code used for
  regular output slightly modified.  This needs to be maintained
  consistent with the regular code that follows this block.  */


Re: [PATCH] Fix leading zero with g0 editing

2015-11-22 Thread Steve Kargl
On Sun, Nov 22, 2015 at 01:32:56PM -0800, Jerry DeLisle wrote:
> This minor patch brings the leading zero to emitting floats with g0 editing by
> moving the block of code up a little before the g0 is handled.  This has been
> lurking in my trunk for several moths and I would like to get it out of the 
> way.
> Updated Test case also.
> 
> Regression tested on x86-64-linux.
> 
> OK for trunk?
> 

OK.  Thanks for the patch.

-- 
Steve


Re: Short-cut generation of simple built-in functions

2015-11-22 Thread H.J. Lu
On Sat, Nov 7, 2015 at 5:31 AM, Richard Sandiford
 wrote:
> This patch short-circuits the builtins.c expansion code for a particular
> gimple call if:
>
> - the function has an associated internal function
> - the target implements that internal function
> - the call has no side effects
>
> This allows a later patch to remove the builtins.c code, once calls with
> side effects have been handled.
>
> Tested on x86_64-linux-gnu, aarch64-linux-gnu and arm-linux-gnueabi.
> OK to install?
>
> Thanks,
> Richard
>
>
> gcc/
> * builtins.h (called_as_built_in): Declare.
> * builtins.c (called_as_built_in): Make external.
> * internal-fn.h (expand_internal_call): Define a variant that
> specifies the internal function explicitly.
> * internal-fn.c (expand_load_lanes_optab_fn)
> (expand_store_lanes_optab_fn, expand_ANNOTATE, expand_GOMP_SIMD_LANE)
> (expand_GOMP_SIMD_VF, expand_GOMP_SIMD_LAST_LANE)
> (expand_GOMP_SIMD_ORDERED_START, expand_GOMP_SIMD_ORDERED_END)
> (expand_UBSAN_NULL, expand_UBSAN_BOUNDS, expand_UBSAN_VPTR)
> (expand_UBSAN_OBJECT_SIZE, expand_ASAN_CHECK, expand_TSAN_FUNC_EXIT)
> (expand_UBSAN_CHECK_ADD, expand_UBSAN_CHECK_SUB)
> (expand_UBSAN_CHECK_MUL, expand_ADD_OVERFLOW, expand_SUB_OVERFLOW)
> (expand_MUL_OVERFLOW, expand_LOOP_VECTORIZED)
> (expand_mask_load_optab_fn, expand_mask_store_optab_fn)
> (expand_ABNORMAL_DISPATCHER, expand_BUILTIN_EXPECT, expand_VA_ARG)
> (expand_UNIQUE, expand_GOACC_DIM_SIZE, expand_GOACC_DIM_POS)
> (expand_GOACC_LOOP, expand_GOACC_REDUCTION, expand_direct_optab_fn)
> (expand_unary_optab_fn, expand_binary_optab_fn): Add an internal_fn
> argument.
> (internal_fn_expanders): Update prototype.
> (expand_internal_call): Define a variant that specifies the
> internal function explicitly. Use it to implement the previous
> interface.
> * cfgexpand.c (expand_call_stmt): Try to expand calls to built-in
> functions as calls to internal functions.
>

This caused:

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


H.J.


Re: [PATCH] Fix leading zero with g0 editing

2015-11-22 Thread Jerry DeLisle
On 11/22/2015 01:44 PM, Steve Kargl wrote:
> On Sun, Nov 22, 2015 at 01:32:56PM -0800, Jerry DeLisle wrote:
>> This minor patch brings the leading zero to emitting floats with g0 editing 
>> by
>> moving the block of code up a little before the g0 is handled.  This has been
>> lurking in my trunk for several moths and I would like to get it out of the 
>> way.
>> Updated Test case also.
>>
>> Regression tested on x86-64-linux.
>>
>> OK for trunk?
>>
> 
> OK.  Thanks for the patch.
> 

Thanks Steve.

Committed revision 230728 and revision 230729 for the test case.

Jerry


[PATCH] PR52251

2015-11-22 Thread Jerry DeLisle
Another old patch I forgot about.  This one is fairly self explanatory.  We were
not handling pending spaces for ADVANCE_NO and T editing.

Regression tested x86-64-linux.  New test case.

OK for trunk?

Jerry


2015-11-22  Jerry DeLisle  

PR libfortran/52251
* io/transfer.c (formatted_transfer_scalar_write): Reset skips count.
(finalize_transfer): For ADVANCE_NO, emit pending spaces and reset the
skip count.

--- transfer.c	(revision 225410)
+++ transfer.c	(working copy)
@@ -1641,6 +1641,7 @@ formatted_transfer_scalar_write (st_parameter_dt *
 			  - dtp->u.p.current_unit->bytes_left);
 	  dtp->u.p.max_pos = 
 		dtp->u.p.max_pos > tmp ? dtp->u.p.max_pos : tmp;
+	  dtp->u.p.skips = 0;
 	}
 	  if (dtp->u.p.skips < 0)
 	{
@@ -3600,6 +3601,16 @@ finalize_transfer (st_parameter_dt *dtp)
  next I/O operation if needed.  */
   if (dtp->u.p.advance_status == ADVANCE_NO)
 {
+  if (dtp->u.p.skips > 0)
+	{
+	  int tmp;
+	  write_x (dtp, dtp->u.p.skips, dtp->u.p.pending_spaces);
+	  tmp = (int)(dtp->u.p.current_unit->recl
+		  - dtp->u.p.current_unit->bytes_left);
+	  dtp->u.p.max_pos = 
+	dtp->u.p.max_pos > tmp ? dtp->u.p.max_pos : tmp;
+	  dtp->u.p.skips = 0;
+	}
   int bytes_written = (int) (dtp->u.p.current_unit->recl
 	- dtp->u.p.current_unit->bytes_left);
   dtp->u.p.current_unit->saved_pos =
! { dg-do run }
! PR52251 Tabs with advance = 'no'
write( *, '( t25 )', advance = 'no' )
write( *, '( "hello" )' ) ! { dg-output "   hello(\n|\r\n|\r)" }
end



Re: [PATCH] PR52251

2015-11-22 Thread Steve Kargl
On Sun, Nov 22, 2015 at 02:35:01PM -0800, Jerry DeLisle wrote:
> Another old patch I forgot about.  This one is fairly self
> explanatory.  We were not handling pending spaces for
> ADVANCE_NO and T editing.
> 
> Regression tested x86-64-linux.  New test case.
> 
> OK for trunk?
> 

Looks ok to me.

-- 
Steve


Re: Enable pointer TBAA for LTO

2015-11-22 Thread Jan Hubicka
Hi,
here is updated patch which I finally comitted today.  It addresses all the 
comments
and also fixes one nasty bug that really cost me a lot of time to understand. 

+ /* LTO type merging does not make any difference between 
+component pointer types.  We may have
+
+struct foo {int *a;};
+
+as TYPE_CANONICAL of 
+
+struct bar {float *a;};
+
+Because accesses to int * and float * do not alias, we would get
+false negative when accessing the same memory location by
+float ** and bar *. We thus record the canonical type as:
+
+struct {void *a;};
+
+void * is special cased and works as a universal pointer type.
+Accesses to it conflicts with accesses to any other pointer
+type.  */

This problem manifested itself only as a lto-bootstrap miscompare on 32bit
build and I spent a lot of time localizing the wrong code since it reproduces
only in quite large programs where we get conficts in canonical type merging
like this.

The patch thus updates record_component_aliases to substitute void_ptr_type for
all pointer types. I re-did the stats.  Now the improvement on dealII is 14%
that is quite a bit lower than earlier, but still substantial.  Since we have
voidptr globing counter, I know that the number of disambiguations would go at
least 19% up if we did not do it.

THere is a lot of low hanging fruit in that area now, but the real solution is 
to
track types that needs to be merge by fortran rules and don't do all this fancy
globing for C/C++ types.  I will open branch for IPA work and try to prepare 
this
for next stage 1.

bootstrapped/regtested x86_64-linux and ppc64-linux, earlier version tested on 
i386-linux
and also on some bigger apps, committed

Note that we still have bootstrap miscompare with LTO build and 
--disable-checking,
I am looking for that now.  Additoinally after fixing the ICEs preventing us to 
build
the gnat1 binary, gnat1 aborts. Both these are independent of the patch.

Honza
* lto.c (iterative_hash_canonical_type): Always recurse for pointers.
(gimple_register_canonical_type_1): Check that pointers do not get
canonical types.
(gimple_register_canonical_type): Do not register pointers.

* tree.c (build_pointer_type_for_mode,build_reference_type_for_mode):
In LTO we do not compute TYPE_CANONICAL of pointers.
(gimple_canonical_types_compatible_p): Improve coments; sanity check
that pointers do not have canonical type that would make us believe
they are different.
* alias.c (get_alias_set): Do structural type equality on pointers;
enable pointer path for LTO; also glob pointer to vector with pointer
to vector element; glob pointers and references for LTO; do more strict
sanity checking about build_pointer_type returning the canonical type
which is also the main variant.
(record_component_aliases): When component type is pointer and we
do LTO; record void_type_node alias set.
Index: tree.c
===
--- tree.c  (revision 230714)
+++ tree.c  (working copy)
@@ -7919,7 +7919,8 @@ build_pointer_type_for_mode (tree to_typ
   TYPE_NEXT_PTR_TO (t) = TYPE_POINTER_TO (to_type);
   TYPE_POINTER_TO (to_type) = t;
 
-  if (TYPE_STRUCTURAL_EQUALITY_P (to_type))
+  /* During LTO we do not set TYPE_CANONICAL of pointers and references.  */
+  if (TYPE_STRUCTURAL_EQUALITY_P (to_type) || in_lto_p)
 SET_TYPE_STRUCTURAL_EQUALITY (t);
   else if (TYPE_CANONICAL (to_type) != to_type || could_alias)
 TYPE_CANONICAL (t)
@@ -7987,7 +7988,8 @@ build_reference_type_for_mode (tree to_t
   TYPE_NEXT_REF_TO (t) = TYPE_REFERENCE_TO (to_type);
   TYPE_REFERENCE_TO (to_type) = t;
 
-  if (TYPE_STRUCTURAL_EQUALITY_P (to_type))
+  /* During LTO we do not set TYPE_CANONICAL of pointers and references.  */
+  if (TYPE_STRUCTURAL_EQUALITY_P (to_type) || in_lto_p)
 SET_TYPE_STRUCTURAL_EQUALITY (t);
   else if (TYPE_CANONICAL (to_type) != to_type || could_alias)
 TYPE_CANONICAL (t)
@@ -13224,7 +13226,9 @@ type_with_interoperable_signedness (cons
TBAA is concerned.  
This function is used both by lto.c canonical type merging and by the
verifier.  If TRUST_TYPE_CANONICAL we do not look into structure of types
-   that have TYPE_CANONICAL defined and assume them equivalent.  */
+   that have TYPE_CANONICAL defined and assume them equivalent.  This is useful
+   only for LTO because only in these cases TYPE_CANONICAL equivalence
+   correspond to one defined by gimple_canonical_types_compatible_p.  */
 
 bool
 gimple_canonical_types_compatible_p (const_tree t1, const_tree t2,
@@ -13265,9 +13269,19 @@ gimple_canonical_types_compatible_p (con
  || (type_with_alias_set_p (t1) && type_with_alias_set_p (t2)));
   /* If the types have been previously registered and fo

Re: Enable pointer TBAA for LTO

2015-11-22 Thread Eric Botcazou
> + tree t = TREE_TYPE (field);
> + if (in_lto_p)
> +   {
> + /* VECTOR_TYPE and ARRAY_TYPE share the alias set with their
> +element type and that type has to be normalized to void *,
> +too, in the case it is a pointer. */
> + while ((TREE_CODE (t) == ARRAY_TYPE
> + && (!COMPLETE_TYPE_P (t)
> + || TYPE_NONALIASED_COMPONENT (t)))
> +|| TREE_CODE (t) == VECTOR_TYPE)
> +   t = TREE_TYPE (t);
> + if (POINTER_TYPE_P (t))
> +   t = ptr_type_node;
> +   }
> +
> + record_alias_subset (superset, get_alias_set (t));
> +   }
>break;

Are you sure that it's not !TYPE_NONALIASED_COMPONENT (t) here?

-- 
Eric Botcazou


[PATCH] Check NULL loop->latch in verify_loop_structure

2015-11-22 Thread Tom de Vries

Hi,

In verify_loop_structure, we stop checking the latch once we find that 
it's NULL.


This patch tries a bit harder:
- if !LOOPS_MAY_HAVE_MULTIPLE_LATCHES, we don't allow a NULL latch
- if LOOPS_MAY_HAVE_MULTIPLE_LATCHES, we check that indeed there's no
  single loop latch.

As a consequence of adding this check, I needed to fix 
expand_omp_for_generic, which missed an initialization of a loop latch.


Bootstrapped and reg-tested on x86_64.

OK for stage3 trunk?

Thanks,
- Tom
Check NULL loop->latch in verify_loop_structure

2015-11-22  Tom de Vries  

	* cfgloop.c (find_single_latch): New function, factored out of ...
	(flow_loops_find): ... here.
	(verify_loop_structure): Verify validity of a NULL loop->latch.
	* cfgloop.h (find_single_latch): Declare.
	* omp-low.c (expand_omp_for_generic): Initialize latch of orig_loop.

---
 gcc/cfgloop.c | 65 +--
 gcc/cfgloop.h |  1 +
 gcc/omp-low.c |  1 +
 3 files changed, 47 insertions(+), 20 deletions(-)

diff --git a/gcc/cfgloop.c b/gcc/cfgloop.c
index bf00e0e..b610860 100644
--- a/gcc/cfgloop.c
+++ b/gcc/cfgloop.c
@@ -388,6 +388,33 @@ bb_loop_header_p (basic_block header)
   return false;
 }
 
+/* Return the latch block for this header block, if it has just a single one.
+   Otherwise, return NULL.  */
+
+basic_block
+find_single_latch (struct loop* loop)
+{
+  basic_block header = loop->header;
+  edge_iterator ei;
+  edge e;
+  basic_block latch = NULL;
+
+  FOR_EACH_EDGE (e, ei, header->preds)
+{
+  basic_block cand = e->src;
+  if (!flow_bb_inside_loop_p (loop, cand))
+	continue;
+
+  if (latch != NULL)
+	/* More than one latch edge.  */
+	return NULL;
+
+  latch = cand;
+}
+
+  return latch;
+}
+
 /* Find all the natural loops in the function and save in LOOPS structure and
recalculate loop_father information in basic block structures.
If LOOPS is non-NULL then the loop structures for already recorded loops
@@ -482,29 +509,10 @@ flow_loops_find (struct loops *loops)
 {
   struct loop *loop = larray[i];
   basic_block header = loop->header;
-  edge_iterator ei;
-  edge e;
 
   flow_loop_tree_node_add (header->loop_father, loop);
   loop->num_nodes = flow_loop_nodes_find (loop->header, loop);
-
-  /* Look for the latch for this header block, if it has just a
-	 single one.  */
-  FOR_EACH_EDGE (e, ei, header->preds)
-	{
-	  basic_block latch = e->src;
-
-	  if (flow_bb_inside_loop_p (loop, latch))
-	{
-	  if (loop->latch != NULL)
-		{
-		  /* More than one latch edge.  */
-		  loop->latch = NULL;
-		  break;
-		}
-	  loop->latch = latch;
-	}
-	}
+  loop->latch = find_single_latch (loop);
 }
 
   return loops;
@@ -1440,6 +1448,23 @@ verify_loop_structure (void)
 	  err = 1;
 	}
 	}
+  else
+	{
+	  if (loops_state_satisfies_p (LOOPS_MAY_HAVE_MULTIPLE_LATCHES))
+	{
+	  if (find_single_latch (loop) != NULL)
+		{
+		  error ("loop %d%'s latch is missing", i);
+		  err = 1;
+		}
+	}
+	  else
+	{
+	  error ("loop %d%'s latch is missing, and loops may not have"
+		 " multiple latches", i);
+	  err = 1;
+	}
+	}
   if (loops_state_satisfies_p (LOOPS_HAVE_SIMPLE_LATCHES))
 	{
 	  if (!single_succ_p (loop->latch))
diff --git a/gcc/cfgloop.h b/gcc/cfgloop.h
index ee73bf9..7faf591 100644
--- a/gcc/cfgloop.h
+++ b/gcc/cfgloop.h
@@ -270,6 +270,7 @@ bool mark_irreducible_loops (void);
 void release_recorded_exits (function *);
 void record_loop_exits (void);
 void rescan_loop_exit (edge, bool, bool);
+basic_block find_single_latch (struct loop*);
 
 /* Loop data structure manipulation/querying.  */
 extern void flow_loop_tree_node_add (struct loop *, struct loop *);
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index b47864e..00e314d6 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -8900,6 +8900,7 @@ expand_omp_for_generic (struct omp_region *region,
 	  orig_loop->header = l1_bb;
 	  /* The loop may have multiple latches.  */
 	  add_loop (orig_loop, new_loop);
+	  orig_loop->latch = find_single_latch (orig_loop);
 	}
 }
 }


[PATCH] Don't reapply loops flags if unnecessary in loop_optimizer_init

2015-11-22 Thread Tom de Vries

[ was: Re: [PATCH, 10/16] Add pass_oacc_kernels pass group in passes.def ]

On 20/11/15 11:37, Richard Biener wrote:

I'd rather make loop_optimizer_init do nothing
if requested flags are already set and no fixup is needed and
call the above unconditionally.  Thus sth like

Index: gcc/loop-init.c
===
--- gcc/loop-init.c (revision 230649)
+++ gcc/loop-init.c (working copy)
@@ -103,7 +103,11 @@ loop_optimizer_init (unsigned flags)
calculate_dominance_info (CDI_DOMINATORS);

if (!needs_fixup)
-   checking_verify_loop_structure ();
+   {
+ checking_verify_loop_structure ();
+ if (loops_state_satisfies_p (flags))
+   goto out;
+   }

/* Clear all flags.  */
if (recorded_exits)
@@ -122,11 +126,12 @@ loop_optimizer_init (unsigned flags)
/* Apply flags to loops.  */
apply_loop_flags (flags);

+  checking_verify_loop_structure ();
+
+out:
/* Dump loops.  */
flow_loops_dump (dump_file, NULL, 1);

-  checking_verify_loop_structure ();
-
timevar_pop (TV_LOOP_INIT);
  }


This patch implements that approach, but the patch is slightly more 
complicated because of the need to handle 
LOOPS_MAY_HAVE_MULTIPLE_LATCHES differently than the rest of the flags.


Bootstrapped and reg-tested on x86_64.

OK for stage3 trunk?

Thanks,
- Tom

Don't reapply loops flags if unnecessary in loop_optimizer_init

2015-11-22  Tom de Vries  

	* loop-init.c (loop_optimizer_init): Don't reapply loops flags if
	unnecessary.

---
 gcc/loop-init.c | 19 ---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/gcc/loop-init.c b/gcc/loop-init.c
index e32c94a..4b72cab 100644
--- a/gcc/loop-init.c
+++ b/gcc/loop-init.c
@@ -85,6 +85,8 @@ loop_optimizer_init (unsigned flags)
 {
   timevar_push (TV_LOOP_INIT);
 
+  gcc_checking_assert ((flags & (LOOP_CLOSED_SSA | LOOPS_NEED_FIXUP)) == 0);
+
   if (!current_loops)
 {
   gcc_assert (!(cfun->curr_properties & PROP_loops));
@@ -103,7 +105,17 @@ loop_optimizer_init (unsigned flags)
   calculate_dominance_info (CDI_DOMINATORS);
 
   if (!needs_fixup)
-	checking_verify_loop_structure ();
+	{
+	  checking_verify_loop_structure ();
+
+	  bool need_reapply
+	= (!loops_state_satisfies_p (flags
+	 & (~LOOPS_MAY_HAVE_MULTIPLE_LATCHES))
+	   || (loops_state_satisfies_p (LOOPS_MAY_HAVE_MULTIPLE_LATCHES)
+		   && ((flags & LOOPS_MAY_HAVE_MULTIPLE_LATCHES) == 0)));
+	  if (!need_reapply)
+	goto out;
+	}
 
   /* Clear all flags.  */
   if (recorded_exits)
@@ -122,11 +134,12 @@ loop_optimizer_init (unsigned flags)
   /* Apply flags to loops.  */
   apply_loop_flags (flags);
 
+  checking_verify_loop_structure ();
+
+ out:
   /* Dump loops.  */
   flow_loops_dump (dump_file, NULL, 1);
 
-  checking_verify_loop_structure ();
-
   timevar_pop (TV_LOOP_INIT);
 }
 


Re: Enable pointer TBAA for LTO

2015-11-22 Thread Jan Hubicka
> > +   tree t = TREE_TYPE (field);
> > +   if (in_lto_p)
> > + {
> > +   /* VECTOR_TYPE and ARRAY_TYPE share the alias set with their
> > +  element type and that type has to be normalized to void *,
> > +  too, in the case it is a pointer. */
> > +   while ((TREE_CODE (t) == ARRAY_TYPE
> > +   && (!COMPLETE_TYPE_P (t)
> > +   || TYPE_NONALIASED_COMPONENT (t)))
> > +  || TREE_CODE (t) == VECTOR_TYPE)
> > + t = TREE_TYPE (t);
> > +   if (POINTER_TYPE_P (t))
> > + t = ptr_type_node;
> > + }
> > +
> > +   record_alias_subset (superset, get_alias_set (t));
> > + }
> >break;
> 
> Are you sure that it's not !TYPE_NONALIASED_COMPONENT (t) here?

You are right, TYPE_NONALIASED_COMPONENT is the wrong way.  I will fix it and 
try to come up
with a testcase (TYPE_NONALIASED_COMPONENT is quite rarely used beast)

Honza
> 
> -- 
> Eric Botcazou


Re: Fix lto-symtab ICE during Ada LTO bootstrap

2015-11-22 Thread Jan Hubicka
> > > ../../gcc/ada/s-os_lib.adb:1007:16: note: return value type
> > > mismatch
> > >function strerror (errnum : Integer) return System.Address;
> > > ^
> > > 
> > > ../../gcc/ada/s-os_lib.adb:1007:16: note:
> > > ???system__os_lib__errno_message__strerror??? was previously
> > > declared here
> > > 
> > > Here we have function returning pointer WRT function returning integer:
> > 
> > This one is on purpose and cannot be easily changed.  Pointer types (or 
> > access
> > types as called in Ada) are avoided as much as possible in the runtime 
> > because
> > they drag the accessibility machinery, which is the machinery present in
> > the
> > language to eliminate dangling references and is heavy; so they are usually
> > imported as System.Address instead.
> 
> This particular instance can probably be fixed, I'll give it a shot when I
> get a chance. But you're right that the general issue is that System.Address
> is often used as a void*

Hi,
I updated the warning to actually check if the TBAA information is in conflict
and silence warnings on allowed type transtions that are not 
useless_type_conversion_p
(which is needed for Fortran, too). This is list of warnings I get which I 
suppose will
need to be adressed.


../../libiberty/xstrerror.c:40:14: warning: type of ‘strerror’ does not match 
original declaration [-Wlto-type-mismatch]
 extern char *strerror (int);
  ^

../../gcc/ada/s-os_lib.adb:1007:16: note: return value type mismatch
   function strerror (errnum : Integer) return System.Address;
^

../../libiberty/xstrerror.c:40:14: note: code may be misoptimized unless 
-fno-strict-aliasing is used
 extern char *strerror (int);
  ^

../../gcc/ada/s-os_lib.adb:1007:16: note: 
‘system__os_lib__errno_message__strerror’ was previously declared here
   function strerror (errnum : Integer) return System.Address;
^

../../gcc/ada/s-os_lib.adb:1207:7: warning: type of ‘target_object_ext_ptr’ 
does not match original declaration [-Wlto-type-mismatch]
   Target_Object_Ext_Ptr : Address;
   ^

../../gcc/ada/s-os_lib.adb:1207:7: note: code may be misoptimized unless 
-fno-strict-aliasing is used
../../gcc/ada/targext.c:60:13: note: ‘__gnat_target_object_extension’ was 
previously declared here
 const char *__gnat_target_object_extension = TARGET_OBJECT_SUFFIX;
 ^

../../gcc/ada/s-os_lib.adb:1183:7: warning: type of ‘target_exec_ext_ptr’ does 
not match original declaration [-Wlto-type-mismatch]
   Target_Exec_Ext_Ptr : Address;
   ^

../../gcc/ada/s-os_lib.adb:1183:7: note: code may be misoptimized unless 
-fno-strict-aliasing is used
../../gcc/ada/targext.c:61:13: note: ‘__gnat_target_executable_extension’ was 
previously declared here
 const char *__gnat_target_executable_extension = TARGET_EXECUTABLE_SUFFIX;
 ^

../../gcc/ada/s-os_lib.adb:1159:7: warning: type of ‘target_exec_ext_ptr’ does 
not match original declaration [-Wlto-type-mismatch]
   Target_Exec_Ext_Ptr : Address;
   ^

../../gcc/ada/s-os_lib.adb:1159:7: note: code may be misoptimized unless 
-fno-strict-aliasing is used
../../gcc/ada/targext.c:62:13: note: ‘__gnat_target_debuggable_extension’ was 
previously declared here
 const char *__gnat_target_debuggable_extension = TARGET_EXECUTABLE_SUFFIX;
 ^

../../gcc/ada/osint.adb:3214:16: warning: type of 
‘osint__update_path__c_update_path’ does not match original declaration 
[-Wlto-type-mismatch]
   function C_Update_Path (Path, Component : Address) return Address;
^

../../gcc/prefix.c:247:1: note: return value type mismatch
 update_path (const char *path, const char *key)
 ^

../../gcc/ada/osint.adb:3214:16: note: code may be misoptimized unless 
-fno-strict-aliasing is used
   function C_Update_Path (Path, Component : Address) return Address;
^

../../gcc/prefix.c:247:1: note: ‘update_path’ was previously declared here
 update_path (const char *path, const char *key)
 ^

../../gcc/ada/s-os_lib.adb:2717:17: warning: type of 
‘system__os_lib__setenv__set_env_value’ does not match original declaration 
[-Wlto-type-mismatch]
   procedure Set_Env_Value (Name, Value : System.Address);
 ^

../../gcc/ada/env.c:116:1: note: type mismatch in parameter 1
 __gnat_setenv (char *name, char *value)
 ^

../../gcc/ada/s-os_lib.adb:2717:17: note: code may be misoptimized unless 
-fno-strict-aliasing is used
   procedure Set_Env_Value (Name, Value : System.Address);
 ^

../../gcc/ada/env.c:116:1: note: ‘__gnat_setenv’ was previously declared here
 __gnat_setenv (char *name, char *value)
 ^

../../gcc/ada/s-os_lib.adb:1231:17: warning: type of 
‘system__os_lib__getenv__get_env_value_ptr’ does not match original declaration 
[-Wlto-type-mismatch]
   procedure Get_Env_Value_Ptr (Name, Length, Ptr : Address);
 ^

../../gcc/ada/env.c:91:1: note: type mismatch in parameter 1
 _

Re: [Aarch64] Use vector wide add for mixed-mode adds

2015-11-22 Thread Michael Collison



On 11/22/2015 8:48 AM, James Greenhalgh wrote:

On Sun, Nov 08, 2015 at 11:51:47PM -0700, Michael Collison wrote:

2015-11-06  Michael Collison 
 * config/aarch64/aarch64-simd.md (widen_ssum, widen_usum)
(aarch64_w_internal): New patterns
 * config/aarch64/iterators.md (Vhalf, VDBLW): New mode attributes.
 * gcc.target/aarch64/saddw-1.c: New test.
 * gcc.target/aarch64/saddw-2.c: New test.
 * gcc.target/aarch64/uaddw-1.c: New test.
 * gcc.target/aarch64/uaddw-2.c: New test.
 * gcc.target/aarch64/uaddw-3.c: New test.
 * lib/target-support.exp
 (check_effective_target_vect_widen_sum_hi_to_si_pattern):
 Add aarch64 to list of support targets.


These hunks are all OK (with the minor style comments below applied).


Okay I will update with your comments.


As we understand what's happening here, let's take the regressions below
for now and add AArch64 to the targets affected by pr68333.


 * gcc.dg/vect/slp-multitypes-4.c: Disable test for
 targets with widening adds from V8HI=>V4SI.
 * gcc.dg/vect/slp-multitypes-5.c: Ditto.
 * gcc.dg/vect/vect-125.c: Ditto.

Let's leave these for now, while we wait for pr68333.


To clarify you would like me to exclude these bits from the patch?




diff --git a/gcc/config/aarch64/aarch64-simd.md 
b/gcc/config/aarch64/aarch64-simd.md
index 65a2b6f..acb7cf0 100644
--- a/gcc/config/aarch64/aarch64-simd.md
+++ b/gcc/config/aarch64/aarch64-simd.md
@@ -2750,6 +2750,60 @@
  
  ;; w.
  
+(define_expand "widen_ssum3"

+  [(set (match_operand: 0 "register_operand" "")
+   (plus: (sign_extend: (match_operand:VQW 1 "register_operand" 
""))

Split this line (more than 80 characters).


+ (match_operand: 2 "register_operand" "")))]
+  "TARGET_SIMD"
+  {
+rtx p = aarch64_simd_vect_par_cnst_half (mode, false);
+rtx temp = gen_reg_rtx (GET_MODE (operands[0]));
+
+emit_insn (gen_aarch64_saddw_internal (temp, operands[2],
+   operands[1], p));
+emit_insn (gen_aarch64_saddw2 (operands[0], temp, operands[1]));
+DONE;
+  }
+)
+
+(define_expand "widen_ssum3"
+  [(set (match_operand: 0 "register_operand" "")
+   (plus: (sign_extend:
+  (match_operand:VD_BHSI 1 "register_operand" ""))
+ (match_operand: 2 "register_operand" "")))]
+  "TARGET_SIMD"
+{
+  emit_insn (gen_aarch64_saddw (operands[0], operands[2], operands[1]));
+  DONE;
+})
+
+(define_expand "widen_usum3"
+  [(set (match_operand: 0 "register_operand" "")
+   (plus: (zero_extend: (match_operand:VQW 1 "register_operand" 
""))

Split this line (more than 80 characters).


+ (match_operand: 2 "register_operand" "")))]
+  "TARGET_SIMD"
+  {
+rtx p = aarch64_simd_vect_par_cnst_half (mode, false);
+rtx temp = gen_reg_rtx (GET_MODE (operands[0]));
+
+emit_insn (gen_aarch64_uaddw_internal (temp, operands[2],
+operands[1], p));
+emit_insn (gen_aarch64_uaddw2 (operands[0], temp, operands[1]));
+DONE;
+  }
+)
+
+(define_expand "widen_usum3"
+  [(set (match_operand: 0 "register_operand" "")
+   (plus: (zero_extend:
+  (match_operand:VD_BHSI 1 "register_operand" ""))
+ (match_operand: 2 "register_operand" "")))]
+  "TARGET_SIMD"
+{
+  emit_insn (gen_aarch64_uaddw (operands[0], operands[2], operands[1]));
+  DONE;
+})
+
  (define_insn "aarch64_w"
[(set (match_operand: 0 "register_operand" "=w")
  (ADDSUB: (match_operand: 1 "register_operand" "w")
@@ -2760,6 +2814,18 @@
[(set_attr "type" "neon__widen")]
  )
  
+(define_insn "aarch64_w_internal"

+  [(set (match_operand: 0 "register_operand" "=w")
+(ADDSUB: (match_operand: 1 "register_operand" "w")
+   (ANY_EXTEND:
+ (vec_select:
+  (match_operand:VQW 2 "register_operand" "w")
+  (match_operand:VQW 3 "vect_par_cnst_lo_half" "")]
+  "TARGET_SIMD"
+  "w\\t%0., %1., %2."
+  [(set_attr "type" "neon__widen")]
+)
+
  (define_insn "aarch64_w2_internal"
[(set (match_operand: 0 "register_operand" "=w")
  (ADDSUB: (match_operand: 1 "register_operand" "w")
diff --git a/gcc/testsuite/gcc.target/aarch64/saddw-1.c 
b/gcc/testsuite/gcc.target/aarch64/saddw-1.c
new file mode 100644
index 000..9db5d00
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/saddw-1.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-O3" } */
+
+

Extra newline.


+int
+t6(int len, void * dummy, short * __restrict x)
+{
+  len = len & ~31;
+  int result = 0;
+  __asm volatile ("");
+  for (int i = 0; i < len; i++)
+result += x[i];
+  return result;
+}
+
+/* { dg-final { scan-assembler "saddw" } } */
+/* { dg-final { scan-assembler "saddw2" } } */
+
+
+

Trailing newlines.


diff --git a/gcc/testsuite/gcc.target/aarch64/saddw-2.c 
b/gcc/testsuite/gcc.target/aarch64/saddw-2.c

Re: [PATCH] Improve BB vectorization dependence analysis

2015-11-22 Thread H.J. Lu
On Mon, Nov 9, 2015 at 4:55 AM, Richard Biener  wrote:
>
> Currently BB vectorization computes all dependences inside a BB
> region and fails all vectorization if it cannot handle some of them.
>
> This is obviously not needed - BB vectorization can restrict the
> dependence tests to those that are needed to apply the load/store
> motion effectively performed by the vectorization (sinking all
> participating loads/stores to the place of the last one).
>
> With restructuring it that way it's also easy to not give up completely
> but only for the SLP instance we cannot vectorize (this gives
> a slight bump in my SPEC CPU 2006 testing to 756 vectorized basic
> block regions).
>
> But first and foremost this patch is to reduce the dependence analysis
> cost and somewhat mitigate the compile-time effects of the first patch.
>
> For fixing PR56118 only a cost model issue remains.
>
> Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.
>
> Richard.
>
> 2015-11-09  Richard Biener  
>
> PR tree-optimization/56118
> * tree-vectorizer.h (vect_find_last_scalar_stmt_in_slp): Declare.
> * tree-vect-slp.c (vect_find_last_scalar_stmt_in_slp): Export.
> * tree-vect-data-refs.c (vect_slp_analyze_node_dependences): New
> function.
> (vect_slp_analyze_data_ref_dependences): Instead of computing
> all dependences of the region DRs just analyze the code motions
> SLP vectorization will perform.  Remove SLP instances that
> cannot have their store/load motions applied.
> (vect_analyze_data_refs): Allow DRs without a vectype
> in BB vectorization.
>

This caused:

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


H.J.


update zlib to 1.2.8

2015-11-22 Thread Matthias Klose
In GCC zlib is only used for libjava; for binutils and gdb it is used when 
building without --with-system-zlib.  This just updates zlib from 1.2.7 to 1.2.8 
(released in 2013).  Applies cleanly, libjava still builds and doesn't show any 
regressions in the testsuite.  Ok to apply (even if we already are in stage3)?


Matthias

zlib/ChangeLog.gcj

+2015-11-23  Matthias Klose  
+
+   * Imported zlib 1.2.8; merged local changes.

zlib/ChangeLog

+Changes in 1.2.8 (28 Apr 2013)
+- Update contrib/minizip/iowin32.c for Windows RT [Vollant]
+- Do not force Z_CONST for C++
+- Clean up contrib/vstudio [Ro]
+- Correct spelling error in zlib.h
+- Fix mixed line endings in contrib/vstudio
+
+Changes in 1.2.7.3 (13 Apr 2013)
+- Fix version numbers and DLL names in contrib/vstudio/*/zlib.rc
+
+Changes in 1.2.7.2 (13 Apr 2013)
+- Change check for a four-byte type back to hexadecimal
+- Fix typo in win32/Makefile.msc
+- Add casts in gzwrite.c for pointer differences
+
+Changes in 1.2.7.1 (24 Mar 2013)
+- Replace use of unsafe string functions with snprintf if available
+- Avoid including stddef.h on Windows for Z_SOLO compile [Niessink]
+- Fix gzgetc undefine when Z_PREFIX set [Turk]
+- Eliminate use of mktemp in Makefile (not always available)
+- Fix bug in 'F' mode for gzopen()
+- Add inflateGetDictionary() function
+- Correct comment in deflate.h
+- Use _snprintf for snprintf in Microsoft C
+- On Darwin, only use /usr/bin/libtool if libtool is not Apple
+- Delete "--version" file if created by "ar --version" [Richard G.]
+- Fix configure check for veracity of compiler error return codes
+- Fix CMake compilation of static lib for MSVC2010 x64
+- Remove unused variable in infback9.c
+- Fix argument checks in gzlog_compress() and gzlog_write()
+- Clean up the usage of z_const and respect const usage within zlib
+- Clean up examples/gzlog.[ch] comparisons of different types
+- Avoid shift equal to bits in type (caused endless loop)
+- Fix unintialized value bug in gzputc() introduced by const patches
+- Fix memory allocation error in examples/zran.c [Nor]
+- Fix bug where gzopen(), gzclose() would write an empty file
+- Fix bug in gzclose() when gzwrite() runs out of memory
+- Check for input buffer malloc failure in examples/gzappend.c
+- Add note to contrib/blast to use binary mode in stdio
+- Fix comparisons of differently signed integers in contrib/blast
+- Check for invalid code length codes in contrib/puff
+- Fix serious but very rare decompression bug in inftrees.c
+- Update inflateBack() comments, since inflate() can be faster
+- Use underscored I/O function names for WINAPI_FAMILY
+- Add _tr_flush_bits to the external symbols prefixed by --zprefix
+- Add contrib/vstudio/vc10 pre-build step for static only
+- Quote --version-script argument in CMakeLists.txt
+- Don't specify --version-script on Apple platforms in CMakeLists.txt
+- Fix casting error in contrib/testzlib/testzlib.c
+- Fix types in contrib/minizip to match result of get_crc_table()
+- Simplify contrib/vstudio/vc10 with 'd' suffix
+- Add TOP support to win32/Makefile.msc
+- Suport i686 and amd64 assembler builds in CMakeLists.txt
+- Fix typos in the use of _LARGEFILE64_SOURCE in zconf.h
+- Add vc11 and vc12 build files to contrib/vstudio
+- Add gzvprintf() as an undocumented function in zlib
+- Fix configure for Sun shell
+- Remove runtime check in configure for four-byte integer type
+- Add casts and consts to ease user conversion to C++
+- Add man pages for minizip and miniunzip
+- In Makefile uninstall, don't rm if preceding cd fails
+- Do not return Z_BUF_ERROR if deflateParam() has nothing to write


zlib.diff.gz
Description: application/gzip


Re: RFC: C++ delayed folding merge

2015-11-22 Thread Thomas Schwinge
Hi Jason!

On Mon, 9 Nov 2015 01:30:34 -0500, Jason Merrill  wrote:
> I'm planning to merge the C++ delayed folding branch this week [...]

Would be nice to get rid of the two following UNRESOLVEDs:

> --- a/gcc/testsuite/g++.dg/init/self1.C
> +++ b/gcc/testsuite/g++.dg/init/self1.C
> @@ -10,7 +10,7 @@ void f(__SIZE_TYPE__) {
>  
>  int main()
>  {
> -  int* const savepos = sizeof(*savepos) ? 0 : 0;
> +  int* const savepos = sizeof(*savepos) ? 0 : 0;  /* { dg-error "invalid 
> conversion" "convert" { target c++11 }  } */
>  
>f (sizeof (*savepos));

PASS: g++.dg/init/self1.C  -std=c++98 (test for excess errors)
PASS: g++.dg/init/self1.C  -std=c++98 execution test
{+PASS: g++.dg/init/self1.C  -std=c++11 convert (test for errors, line 13)+}
PASS: g++.dg/init/self1.C  -std=c++11 (test for excess errors)
[-PASS:-]{+UNRESOLVED:+} g++.dg/init/self1.C  -std=c++11 [-execution 
test-]{+compilation failed to produce executable+}
{+PASS: g++.dg/init/self1.C  -std=c++14 convert (test for errors, line 13)+}
PASS: g++.dg/init/self1.C  -std=c++14 (test for excess errors)
[-PASS:-]{+UNRESOLVED:+} g++.dg/init/self1.C  -std=c++14 [-execution 
test-]{+compilation failed to produce executable+}


Grüße
 Thomas


signature.asc
Description: PGP signature


[PATCH 0/2] Libsanitizer merge from upstream r253555.

2015-11-22 Thread Maxim Ostapenko

Hi!

Following recent discussion 
(https://gcc.gnu.org/ml/gcc-patches/2015-11/msg02310.html), I would like 
to merge recent sanitizer library to GCC to make available new useful 
features from upstream in GCC 6:


* The shadow offset for ASan was unified on Aarch64 for 39 and 42 VMAs 
(http://reviews.llvm.org/D13782). This change would not require any new 
code into compiler side.
* Optional ASan recovery functionality was merged to sanitizer library 
(http://reviews.llvm.org/D12318). This feature requires some minimal 
compiler changes that I'll post below.
* LSan was finally fixed and enabled for AArch64 
(http://reviews.llvm.org/rL250898).


The first patch is the library merge itself. I've also applied 3 GCC 
specific patches here (I don't post them separately to avoid polluting 
ChangeLog):


* Patch for SPARC by David S. Miller 
(https://gcc.gnu.org/ml/gcc-patches/2015-10/msg01855.html).
* Disable ODR violation detection 
(https://gcc.gnu.org/ml/gcc-patches/2015-10/msg01856.html).
* Adjust the fix for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61771 
to extract the last PC from the stack frame if no valid FP is available 
for ARM (https://gcc.gnu.org/ml/gcc-patches/2015-10/msg01857.html).


The second one reflects to corresponding compiler changes. In 
particular, it just enables -fsanitize-recover=address switch and 
migrates two small testcases from upstream.


Regtested and bootstrapped on {x86_64, aarch64}-unknown-linux-gnu and 
arm-linux-gnueabi. Is it OK for mainline?


Re: [ptx] partitioning optimization

2015-11-22 Thread Thomas Schwinge
Hi!

On Fri, 13 Nov 2015 21:22:11 +0100, Bernd Schmidt  wrote:
> On 11/13/2015 09:06 PM, Nathan Sidwell wrote:
> > On 11/11/15 09:19, Bernd Schmidt wrote:
> >> On 11/11/2015 02:59 PM, Nathan Sidwell wrote:
> >>> That's not the problem.  How to conditionally enable the test is the
> >>> difficulty.  I suspect porting something concerning accel_compiler from
> >>> the libgomp testsuite is needed?
> >>
> >> Maybe a check_effective_target_offload_nvptx which tries to see if
> >> -foffload=nvptx gives an error (I would hope it does if it's
> >> unsupported).
> >
> > This patch seems to do the trick.  tested on  an offload-aware build
> > (passes), and a regular x86_64-linux build (skipped as unsupported).

Thanks for adding such tests!

> I think this is fine.

I may have pointed this out before a few times... ;-) --

-- this doesn't work for build-tree testing ("make check"), if GCC has
not yet been installed ("make install"), which is still the default
testing procedure as far as I know.

spawn [...]/build-gcc/gcc/xgcc -B[...]/build-gcc/gcc/ 
[...]/source-gcc/gcc/testsuite/gcc.dg/goacc/nvptx-merged-loop.c 
-fno-diagnostics-show-caret -fdiagnostics-color=never -fopenacc -O2 
-foffload=-fdump-rtl-mach -dumpbase nvptx-merged-loop.c -Wa,--no-verify 
-ffat-lto-objects -lm -o nvptx-merged-loop.exe
xgcc: error: libgomp.spec: No such file or directory
compiler exited with status 1
[...]
FAIL: gcc.dg/goacc/nvptx-merged-loop.c (test for excess errors)
[...]
UNRESOLVED: gcc.dg/goacc/nvptx-merged-loop.c scan-rtl-dump mach "Merging 
loop .* into "

Here, -fopenacc induces -lgomp.  So, we'll either need a (dummy?) libgomp
available to link against in gcc/testsuite/, or come up with a way to do
LTO/offloading compilation without actually linking (libgomp into) the
final executable, or move such tests into libgomp/testsuite/.  (Jakub?)


Grüße
 Thomas


signature.asc
Description: PGP signature


[PATCH 2/2] Libsanitizer merge from upstream r253555.

2015-11-22 Thread Maxim Ostapenko
This patch reflects to corresponding compiler changes. In particular, it 
just enables -fsanitize-recover=address switch and migrates two small 
testcases from upstream. I don't backport other stress tests because 
they are heavy and have unstable output.


-Maxim
gcc/testsuite/ChangeLog:

2015-11-23  Maxim Ostapenko  

	* c-c++-common/asan/halt_on_error-1.c: New test.
	* c-c++-common/asan/halt_on_error-2.c: Likewise.

gcc/ChangeLog:

2015-11-23  Maxim Ostapenko  

	* opts.c (finish_options): Allow -fsanitize-recover=address for
	userspace sanitization.
	* asan.c (asan_expand_check_ifn): Redefine recover_p.
	* doc/invoke.texi (fsanitize-recover): Update documentation.

Index: gcc/asan.c
===
--- gcc/asan.c	(revision 230597)
+++ gcc/asan.c	(working copy)
@@ -2533,10 +2533,12 @@
 {
   gimple *g = gsi_stmt (*iter);
   location_t loc = gimple_location (g);
+  bool recover_p;
+  if (flag_sanitize & SANITIZE_USER_ADDRESS)
+recover_p = (flag_sanitize_recover & SANITIZE_USER_ADDRESS) != 0;
+  else
+recover_p = (flag_sanitize_recover & SANITIZE_KERNEL_ADDRESS) != 0;
 
-  bool recover_p
-= (flag_sanitize & flag_sanitize_recover & SANITIZE_KERNEL_ADDRESS) != 0;
-
   HOST_WIDE_INT flags = tree_to_shwi (gimple_call_arg (g, 0));
   gcc_assert (flags < ASAN_CHECK_LAST);
   bool is_scalar_access = (flags & ASAN_CHECK_SCALAR_ACCESS) != 0;
Index: gcc/doc/invoke.texi
===
--- gcc/doc/invoke.texi	(revision 230597)
+++ gcc/doc/invoke.texi	(working copy)
@@ -6111,8 +6111,10 @@
 
 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
-@option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero} and
-@option{-fsanitize=kernel-address}.  For these sanitizers error recovery is turned on by default.
+@option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
+@option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
+For these sanitizers error recovery is turned on by default, except @option{-fsanitize=address},
+for which this feature is experimental.
 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
 accepted, the former enables recovery for all sanitizers that support it,
 the latter disables recovery for all sanitizers that support it.
Index: gcc/opts.c
===
--- gcc/opts.c	(revision 230597)
+++ gcc/opts.c	(working copy)
@@ -941,11 +941,8 @@
 	  "-fsanitize=address and -fsanitize=kernel-address "
 	  "are incompatible with -fsanitize=thread");
 
-  /* Error recovery is not allowed for ASan and TSan.  */
+  /* Error recovery is not allowed for LSan and TSan.  */
 
-  if (opts->x_flag_sanitize_recover & SANITIZE_USER_ADDRESS)
-error_at (loc, "-fsanitize-recover=address is not supported");
-
   if (opts->x_flag_sanitize_recover & SANITIZE_THREAD)
 error_at (loc, "-fsanitize-recover=thread is not supported");
 
Index: gcc/testsuite/c-c++-common/asan/halt_on_error-1.c
===
--- gcc/testsuite/c-c++-common/asan/halt_on_error-1.c	(revision 0)
+++ gcc/testsuite/c-c++-common/asan/halt_on_error-1.c	(working copy)
@@ -0,0 +1,23 @@
+/* Test recovery mode.  */
+/* { dg-do run } */
+/* { dg-options "-fsanitize-recover=address" } */
+/* { dg-set-target-env-var ASAN_OPTIONS "halt_on_error=false" } */
+
+#include 
+
+volatile int ten = 10;
+
+int main() {
+  char x[10];
+  memset(x, 0, 11);
+  asm volatile ("" : : : "memory");
+  volatile int res = x[ten];
+  x[ten] = res + 3;
+  res = x[ten];
+  return 0;
+}
+
+/* { dg-output "WRITE of size 11 at 0x\[0-9a-f\]+ thread T0\[^\n\r]*(\n|\r\n|\r).*" } */
+/* { dg-output "\[^\n\r]*READ of size 1 at 0x\[0-9a-f\]+ thread T0\[^\n\r]*(\n|\r\n|\r).*" } */
+/* { dg-output "\[^\n\r]*WRITE of size 1 at 0x\[0-9a-f\]+ thread T0\[^\n\r]*(\n|\r\n|\r).*" } */
+/* { dg-output "\[^\n\r]*READ of size 1 at 0x\[0-9a-f\]+ thread T0\[^\n\r]*(\n|\r\n|\r).*" } */
Index: gcc/testsuite/c-c++-common/asan/halt_on_error-2.c
===
--- gcc/testsuite/c-c++-common/asan/halt_on_error-2.c	(revision 0)
+++ gcc/testsuite/c-c++-common/asan/halt_on_error-2.c	(working copy)
@@ -0,0 +1,24 @@
+/* Test recovery mode.  */
+/* { dg-do run } */
+/* { dg-options "-fsanitize-recover=address" } */
+/* { dg-set-target-env-var ASAN_OPTIONS "halt_on_error=true" } */
+/* { dg-shouldfail "asan" } */
+
+#include 
+
+volatile int ten = 10;
+
+int main() {
+  char x[10];
+  memset(x, 0, 11);
+  asm volatile ("" : : : "memory");
+  volatile int res = x[ten];
+  x[ten] = res + 3;
+  res = x[ten];
+  return 0;
+}
+
+/* { dg-output "WRITE of size 11 at 0x\[0-9a-f\]+ thread T0\[^\n\r]*(\n|\r\n|\r).*" } */
+/* { dg-prune-output "\[^\n\r