Re: [RFA] adjust src-release following the renaming of gdb/common/ to gdb/gdbsupport/

2019-07-13 Thread Joel Brobecker
> >ChangeLog:
> >
> >* src-release (getver): If $tool/gdbsupport/create-version.sh
> >exists, use that to determine the version number.
> >
> >Tested on x86_64-linux, by running the src-release script with "gdb"
> >as the argument, and verifying that the name of the tarball is now
> >correct.
> 
> Ok. 

Thanks Richard. Pushed to the master branch in binutils-gdb. I looked at
the GCC repository, and couldn't find it there, so synchronization to do
between the two, after all!

-- 
Joel


Re: [patch, fortran] Pr87233 Constraint C1279 still followed after f2008 standard revision

2019-07-13 Thread Steve Kargl
On Sat, Jul 13, 2019 at 04:54:07PM -0700, Jerry DeLisle wrote:
> Hi all,
> 
> The attached patch removes the subject constraint for gfortran default
> and -std=f2008/f2018. I had issues with repetitious errors. I tried
> to get rid of it using the e->error = 1 method useded later in the
> function, but that did not work, so I resorted to gfc_error_now which
> does the job.

You can suppress the error by looking at the error count with
gfc_get_error(_cnt, _cnt).  If error_cnt == 0,
then issue the error; otherwise, simply return.

> 2019-07-13  Jerry DeLisle  
> 
>   PR fortran/87233
>   * gfortran.dg/initialization_14.f90: Modify to now pass by
>   remiving two dg-error commands. Added comments.

remiving?


OK.

-- 
Steve


[patch, fortran] Pr87233 Constraint C1279 still followed after f2008 standard revision

2019-07-13 Thread Jerry DeLisle

Hi all,

The attached patch removes the subject constraint for gfortran default and 
-std=f2008/f2018. I had issues with repetitious errors. I tried to get rid of it 
using the e->error = 1 method useded later in the function, but that did not 
work, so I resorted to gfc_error_now which does the job.


Also modified one test case and added a new to cover this in the testsuite.

Regression tested on x86_64-pc-linux-gnu.

OK for trunk?

Regards,

Jerry

2019-07-13  Jerry DeLisle  

PR fortran/87233
* expr.c (check_restricted): Relax constraint C1279 which was
removed from F2008 and above.

and

2019-07-13  Jerry DeLisle  

PR fortran/87233
* gfortran.dg/initialization_14.f90: Modify to now pass by
remiving two dg-error commands. Added comments.
* gfortran.dg/initialization_30.f90: New test that includes the
two tests removed above with the 'dg-options -std=f95'.

diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c
index ec9e3288b48..3b64b196c1b 100644
--- a/gcc/fortran/expr.c
+++ b/gcc/fortran/expr.c
@@ -3305,11 +3305,13 @@ check_restricted (gfc_expr *e)
 	 restricted expression in an elemental procedure, it will have
 	 already been simplified away once we get here.  Therefore we
 	 don't need to jump through hoops to distinguish valid from
-	 invalid cases.  */
-  if (sym->attr.dummy && sym->ns == gfc_current_ns
+	 invalid cases.  Allowed in F2018.  */
+  if (gfc_notification_std (GFC_STD_F2008)
+	  && sym->attr.dummy && sym->ns == gfc_current_ns
 	  && sym->ns->proc_name && sym->ns->proc_name->attr.elemental)
 	{
-	  gfc_error ("Dummy argument %qs not allowed in expression at %L",
+	  gfc_error_now ("Dummy argument %qs not "
+		 "allowed in expression at %L",
 		 sym->name, >where);
 	  break;
 	}
diff --git a/gcc/testsuite/gfortran.dg/initialization_14.f90 b/gcc/testsuite/gfortran.dg/initialization_14.f90
index 4d5b6856cf0..aa1437719ac 100644
--- a/gcc/testsuite/gfortran.dg/initialization_14.f90
+++ b/gcc/testsuite/gfortran.dg/initialization_14.f90
@@ -3,18 +3,18 @@
 ! Dummy arguments are disallowed in initialization expressions in
 ! elemental functions except as arguments to the intrinsic functions
 ! BIT_SIZE, KIND, LEN, or to the numeric inquiry functions listed
-! in 13.11.8
+! in 13.11.8 F95, likewise not allowed in F2003, now allowed in F2008.
 MODULE TT
 INTEGER M
 CONTAINS
ELEMENTAL REAL FUNCTION two(N)
  INTEGER, INTENT(IN) :: N
- INTEGER, DIMENSION(N) :: scr ! { dg-error "Dummy argument 'n' not allowed in expression" }
+ INTEGER, DIMENSION(N) :: scr ! Now valid under F2008
END FUNCTION
 
ELEMENTAL REAL FUNCTION twopointfive(N)
  INTEGER, INTENT(IN) :: N
- INTEGER, DIMENSION(MAX(N,2)) :: scr ! { dg-error "Dummy argument 'n' not allowed in expression" }
+ INTEGER, DIMENSION(MAX(N,2)) :: scr ! Now valid under F2008
end FUNCTION twopointfive
 
REAL FUNCTION three(N)
diff --git a/gcc/testsuite/gfortran.dg/initialization_30.f90 b/gcc/testsuite/gfortran.dg/initialization_30.f90
new file mode 100644
index 000..ff8436bc7c9
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/initialization_30.f90
@@ -0,0 +1,21 @@
+! { dg-do compile }
+! { dg-options "-std=f95" }
+! PR 20851
+! Dummy arguments are disallowed in initialization expressions in
+! elemental functions except as arguments to the intrinsic functions
+! BIT_SIZE, KIND, LEN, or to the numeric inquiry functions listed
+! in 13.11.8
+MODULE TT
+INTEGER M
+CONTAINS
+   ELEMENTAL REAL FUNCTION two(N)
+ INTEGER, INTENT(IN) :: N
+ INTEGER, DIMENSION(N) :: scr ! { dg-error "Dummy argument 'n' not allowed in expression" }
+   END FUNCTION
+
+   ELEMENTAL REAL FUNCTION twopointfive(N)
+ INTEGER, INTENT(IN) :: N
+ INTEGER, DIMENSION(MAX(N,2)) :: scr ! { dg-error "Dummy argument 'n' not allowed in expression" }
+   end FUNCTION twopointfive
+END MODULE
+END


[Darwin, PPC, testsuite, committed] Require stabs support for a test.

2019-07-13 Thread Iain Sandoe
Another in my queue of minor test fixups.
The test fails if the assembler doesn't support stabs (and I have at least one
assembler under test that doesn’t).  Solution is to require stabs support
tested on powerpc-darwin9
applied to mainline
thanks
Iain

2019-07-13  Iain Sandoe  

* gcc.target/powerpc/stabs-attrib-vect-darwin.c: Require stabs
support.

diff --git a/gcc/testsuite/gcc.target/powerpc/stabs-attrib-vect-darwin.c 
b/gcc/testsuite/gcc.target/powerpc/stabs-attrib-vect-darwin.c
index 3c52287..5c7acf1 100644
--- a/gcc/testsuite/gcc.target/powerpc/stabs-attrib-vect-darwin.c
+++ b/gcc/testsuite/gcc.target/powerpc/stabs-attrib-vect-darwin.c
@@ -1,5 +1,6 @@
 /* Test Attribute Vector associated with vector type stabs.  */
 /* { dg-do compile { target powerpc*-*-darwin* } } */
+/* { dg-require-effective-target stabs } */
 /* { dg-options "-gstabs+ -fno-eliminate-unused-debug-types -faltivec" } */
 



Avoid code duplication in aliasing_component_refs_p

2019-07-13 Thread Jan Hubicka
Hi,
this refactors the code a bit to avoid doing everything twice.

Bootstrapped/regtested x86_64-linux, comitted.

Honza

* tree-ssa-alias.c (component_ref_to_zero_sized_trailing_array_p):
Break out from ...
(aliasing_component_refs_walk): Break out from ...
(aliasing_component_refs_p): ... here.
Index: tree-ssa-alias.c
===
--- tree-ssa-alias.c(revision 273451)
+++ tree-ssa-alias.c(working copy)
@@ -895,6 +895,97 @@ aliasing_matching_component_refs_p (tree
   return true;
 }
 
+/* Return true if REF is reference to zero sized trailing array. I.e.
+   struct foo {int bar; int array[0];} *fooptr;
+   fooptr->array.  */
+
+static bool
+component_ref_to_zero_sized_trailing_array_p (tree ref)
+{
+  return (TREE_CODE (ref) == COMPONENT_REF
+ && TREE_CODE (TREE_TYPE (TREE_OPERAND (ref, 1))) == ARRAY_TYPE
+ && (!TYPE_SIZE (TREE_TYPE (TREE_OPERAND (ref, 1)))
+ || integer_zerop (TYPE_SIZE (TREE_TYPE (TREE_OPERAND (ref, 1)
+ && array_at_struct_end_p (ref));
+}
+
+/* Worker for aliasing_component_refs_p. Most parameters match parameters of
+   aliasing_component_refs_p.
+
+   Walk access path REF2 and try to find type matching TYPE1
+   (which is a start of possibly aliasing access path REF1).
+   If match is found, try to disambiguate.
+
+   Return 0 for sucessful disambiguation.
+   Return 1 if match was found but disambiguation failed
+   Return -1 if there is no match.
+   In this case MAYBE_MATCH is set to 0 if there is no type matching TYPE1
+   in access patch REF2 and -1 if we are not sure.  */
+
+static int
+aliasing_component_refs_walk (tree ref1, tree type1, tree base1,
+ poly_int64 offset1, poly_int64 max_size1,
+ tree end_struct_ref1,
+ tree ref2, tree base2,
+ poly_int64 offset2, poly_int64 max_size2,
+ bool *maybe_match)
+{
+  tree ref = ref2;
+  int same_p;
+
+  while (true)
+{
+  /* We walk from inner type to the outer types. If type we see is
+already too large to be part of type1, terminate the search.  */
+  int cmp = compare_type_sizes (type1, TREE_TYPE (ref));
+
+  if (cmp < 0
+ && (!end_struct_ref1
+ || compare_type_sizes (TREE_TYPE (end_struct_ref1),
+TREE_TYPE (ref)) < 0))
+   break;
+  /* If types may be of same size, see if we can decide about their
+equality.  */
+  if (cmp == 0)
+   {
+ same_p = same_type_for_tbaa (TREE_TYPE (ref), type1);
+ if (same_p == 1)
+   break;
+ /* In case we can't decide whether types are same try to
+continue looking for the exact match.
+Remember however that we possibly saw a match
+to bypass the access path continuations tests we do later.  */
+ if (same_p == -1)
+   *maybe_match = true;
+   }
+  if (!handled_component_p (ref))
+   break;
+  ref = TREE_OPERAND (ref, 0);
+}
+  if (same_p == 1)
+{
+  /* We assume that arrays can overlap by multiple of their elements
+size as tested in gcc.dg/torture/alias-2.c.
+This partial overlap happen only when both arrays are bases of
+the access and not contained within another component ref.
+To be safe we also assume partial overlap for VLAs. */
+  if (TREE_CODE (TREE_TYPE (base1)) == ARRAY_TYPE
+ && (!TYPE_SIZE (TREE_TYPE (base1))
+ || TREE_CODE (TYPE_SIZE (TREE_TYPE (base1))) != INTEGER_CST
+ || ref == base2))
+   /* Setting maybe_match to true triggers
+  nonoverlapping_component_refs_p test later that still may do
+  useful disambiguation.  */
+   *maybe_match = true;
+  else
+   return aliasing_matching_component_refs_p (base1, ref1,
+  offset1, max_size1,
+  ref, ref2,
+  offset2, max_size2);
+}
+  return -1;
+}
+
 /* Determine if the two component references REF1 and REF2 which are
based on access types TYPE1 and TYPE2 and of which at least one is based
on an indirect reference may alias.  
@@ -919,7 +1010,6 @@ aliasing_component_refs_p (tree ref1,
  disambiguating q->i and p->a.j.  */
   tree base1, base2;
   tree type1, type2;
-  int same_p1 = 0, same_p2 = 0;
   bool maybe_match = false;
   tree end_struct_ref1 = NULL, end_struct_ref2 = NULL;
 
@@ -938,11 +1028,7 @@ aliasing_component_refs_p (tree ref1,
 
 Because we compare sizes of arrays just by sizes of their elements,
 we only need to care about zero sized array fields here.  */
-  if (TREE_CODE (base1) == COMPONENT_REF
- && TREE_CODE (TREE_TYPE (TREE_OPERAND (base1, 1))) == 

Re: [PATCH] rs6000: Shut up -Wformat-diag somewhat

2019-07-13 Thread Segher Boessenkool
On Sat, Jul 13, 2019 at 05:26:04PM +0100, Richard Sandiford wrote:
> Segher Boessenkool  writes:
> > We currently get lot of build warnings like
> > /home/segher/src/gcc/gcc/config/rs6000/rs6000-c.c:7039:12: warning: 
> > misspelled term 'builtin function' in format; use 'built-in function' 
> > instead [-Wformat-diag]
> >  7039 |error ("builtin function %qs not supported in this compiler "
> >   |^~~~
> >
> > That would print something like
> >   builtin function '__builtin_example' not supported in this compiler
> >
> > Changing that to "built-in" as suggested only makes this worse.
> > Instead, let's just remove the whole "builtin function" phrase.

> Sounded from the above like there was supposed to be a rs6000-c.c
> change as well.  Just saying because IMO "X not supported..." seems
> unnecessarily awkward compared to...

This patch only handles this one block, to shut up the majority of the
warnings in PR91148.  It doesn't attempt to handle everything, not even
all those where the warning is pedantic but valid.

The torrent of useless warnings is hampering more important work.

But yes I'll fix that rs6000-c.c one, I like verbs as well :-)


Segher


Re: [PATCH] rs6000: Shut up -Wformat-diag somewhat

2019-07-13 Thread Richard Sandiford
Segher Boessenkool  writes:
> We currently get lot of build warnings like
> /home/segher/src/gcc/gcc/config/rs6000/rs6000-c.c:7039:12: warning: 
> misspelled term 'builtin function' in format; use 'built-in function' instead 
> [-Wformat-diag]
>  7039 |error ("builtin function %qs not supported in this compiler "
>   |^~~~
>
> That would print something like
>   builtin function '__builtin_example' not supported in this compiler
>
> Changing that to "built-in" as suggested only makes this worse.
> Instead, let's just remove the whole "builtin function" phrase.
>
> Tested on powerpc64-linux {-m32,-m64}; committing.
>
>
> Segher
>
>
> 2019-07-13  Segher Boessenkool  
>
>   PR target/91148
>   * config/rs6000/rs6000.c (rs6000_invalid_builtin): Remove superfluous
>   "builtin function" phrasing.

Sounded from the above like there was supposed to be a rs6000-c.c
change as well.  Just saying because IMO "X not supported..." seems
unnecessarily awkward compared to...

> diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
> index 65df8d6..e199748 100644
> --- a/gcc/config/rs6000/rs6000.c
> +++ b/gcc/config/rs6000/rs6000.c
> @@ -14744,62 +14744,53 @@ rs6000_invalid_builtin (enum rs6000_builtins fncode)
>  
>gcc_assert (name != NULL);
>if ((fnmask & RS6000_BTM_CELL) != 0)
> -error ("builtin function %qs is only valid for the cell processor", 
> name);
> +error ("%qs is only valid for the cell processor", name);
>else if ((fnmask & RS6000_BTM_VSX) != 0)
> -error ("builtin function %qs requires the %qs option", name, "-mvsx");
> +error ("%qs requires the %qs option", name, "-mvsx");
>else if ((fnmask & RS6000_BTM_HTM) != 0)
> -error ("builtin function %qs requires the %qs option", name, "-mhtm");
> +error ("%qs requires the %qs option", name, "-mhtm");
>else if ((fnmask & RS6000_BTM_ALTIVEC) != 0)
> -error ("builtin function %qs requires the %qs option", name, 
> "-maltivec");
> +error ("%qs requires the %qs option", name, "-maltivec");
>else if ((fnmask & (RS6000_BTM_DFP | RS6000_BTM_P8_VECTOR))
>  == (RS6000_BTM_DFP | RS6000_BTM_P8_VECTOR))
> -error ("builtin function %qs requires the %qs and %qs options",
> -name, "-mhard-dfp", "-mpower8-vector");
> -  else if ((fnmask & RS6000_BTM_DFP) != 0)
> -error ("builtin function %qs requires the %qs option", name, 
> "-mhard-dfp");
> -  else if ((fnmask & RS6000_BTM_P8_VECTOR) != 0)
> -error ("builtin function %qs requires the %qs option", name,
> +error ("%qs requires the %qs and %qs options", name, "-mhard-dfp",
>  "-mpower8-vector");
> +  else if ((fnmask & RS6000_BTM_DFP) != 0)
> +error ("%qs requires the %qs option", name, "-mhard-dfp");
> +  else if ((fnmask & RS6000_BTM_P8_VECTOR) != 0)
> +error ("%qs requires the %qs option", name, "-mpower8-vector");
>else if ((fnmask & (RS6000_BTM_P9_VECTOR | RS6000_BTM_64BIT))
>  == (RS6000_BTM_P9_VECTOR | RS6000_BTM_64BIT))
> -error ("builtin function %qs requires the %qs and %qs options",
> -name, "-mcpu=power9", "-m64");
> +error ("%qs requires the %qs and %qs options", name, "-mcpu=power9",
> +"-m64");
>else if ((fnmask & RS6000_BTM_P9_VECTOR) != 0)
> -error ("builtin function %qs requires the %qs option", name,
> -"-mcpu=power9");
> +error ("%qs requires the %qs option", name, "-mcpu=power9");
>else if ((fnmask & (RS6000_BTM_P9_MISC | RS6000_BTM_64BIT))
>  == (RS6000_BTM_P9_MISC | RS6000_BTM_64BIT))
> -error ("builtin function %qs requires the %qs and %qs options",
> -name, "-mcpu=power9", "-m64");
> +error ("%qs requires the %qs and %qs options", name, "-mcpu=power9",
> +"-m64");
>else if ((fnmask & RS6000_BTM_P9_MISC) == RS6000_BTM_P9_MISC)
> -error ("builtin function %qs requires the %qs option", name,
> -"-mcpu=power9");
> +error ("%qs requires the %qs option", name, "-mcpu=power9");
>else if ((fnmask & RS6000_BTM_LDBL128) == RS6000_BTM_LDBL128)
>  {
>if (!TARGET_HARD_FLOAT)
> - error ("builtin function %qs requires the %qs option", name,
> -"-mhard-float");
> + error ("%qs requires the %qs option", name, "-mhard-float");
>else
> - error ("builtin function %qs requires the %qs option", name,
> + error ("%qs requires the %qs option", name,
>  TARGET_IEEEQUAD ? "-mabi=ibmlongdouble" : "-mlong-double-128");
>  }
>else if ((fnmask & RS6000_BTM_HARD_FLOAT) != 0)
> -error ("builtin function %qs requires the %qs option", name,
> -"-mhard-float");
> +error ("%qs requires the %qs option", name, "-mhard-float");
>else if ((fnmask & RS6000_BTM_FLOAT128_HW) != 0)
> -error ("builtin function %qs requires ISA 3.0 IEEE 128-bit floating 
> point",
> -name);
> +error ("%qs requires ISA 3.0 IEEE 128-bit floating point", name);
>else if ((fnmask & 

[PATCH] rs6000: Shut up -Wformat-diag somewhat

2019-07-13 Thread Segher Boessenkool
We currently get lot of build warnings like
/home/segher/src/gcc/gcc/config/rs6000/rs6000-c.c:7039:12: warning: misspelled 
term 'builtin function' in format; use 'built-in function' instead 
[-Wformat-diag]
 7039 |error ("builtin function %qs not supported in this compiler "
  |^~~~

That would print something like
  builtin function '__builtin_example' not supported in this compiler

Changing that to "built-in" as suggested only makes this worse.
Instead, let's just remove the whole "builtin function" phrase.

Tested on powerpc64-linux {-m32,-m64}; committing.


Segher


2019-07-13  Segher Boessenkool  

PR target/91148
* config/rs6000/rs6000.c (rs6000_invalid_builtin): Remove superfluous
"builtin function" phrasing.

gcc/testsuite/
* gcc.target/powerpc/bfp/scalar-cmp-exp-eq-2.c: Adjust.
* gcc.target/powerpc/bfp/scalar-cmp-exp-gt-2.c: Adjust.
* gcc.target/powerpc/bfp/scalar-cmp-exp-lt-2.c: Adjust.
* gcc.target/powerpc/bfp/scalar-cmp-exp-unordered-2.c: Adjust.
* gcc.target/powerpc/bfp/scalar-extract-exp-1.c: Adjust.
* gcc.target/powerpc/bfp/scalar-extract-exp-2.c: Adjust.
* gcc.target/powerpc/bfp/scalar-extract-exp-4.c: Adjust.
* gcc.target/powerpc/bfp/scalar-extract-sig-1.c: Adjust.
* gcc.target/powerpc/bfp/scalar-extract-sig-2.c: Adjust.
* gcc.target/powerpc/bfp/scalar-extract-sig-4.c: Adjust.
* gcc.target/powerpc/bfp/scalar-insert-exp-1.c: Adjust.
* gcc.target/powerpc/bfp/scalar-insert-exp-10.c: Adjust.
* gcc.target/powerpc/bfp/scalar-insert-exp-2.c: Adjust.
* gcc.target/powerpc/bfp/scalar-insert-exp-4.c: Adjust.
* gcc.target/powerpc/bfp/scalar-insert-exp-5.c: Adjust.
* gcc.target/powerpc/bfp/scalar-insert-exp-7.c: Adjust.
* gcc.target/powerpc/bfp/scalar-insert-exp-8.c: Adjust.
* gcc.target/powerpc/bfp/scalar-test-data-class-11.c: Adjust.
* gcc.target/powerpc/bfp/scalar-test-data-class-6.c: Adjust.
* gcc.target/powerpc/bfp/scalar-test-data-class-7.c: Adjust.
* gcc.target/powerpc/bfp/scalar-test-neg-2.c: Adjust.
* gcc.target/powerpc/bfp/scalar-test-neg-3.c: Adjust.
* gcc.target/powerpc/bfp/scalar-test-neg-5.c: Adjust.
* gcc.target/powerpc/bfp/vec-extract-exp-2.c: Adjust.
* gcc.target/powerpc/bfp/vec-extract-exp-3.c: Adjust.
* gcc.target/powerpc/bfp/vec-extract-sig-2.c: Adjust.
* gcc.target/powerpc/bfp/vec-extract-sig-3.c: Adjust.
* gcc.target/powerpc/bfp/vec-insert-exp-2.c: Adjust.
* gcc.target/powerpc/bfp/vec-insert-exp-3.c: Adjust.
* gcc.target/powerpc/bfp/vec-insert-exp-6.c: Adjust.
* gcc.target/powerpc/bfp/vec-insert-exp-7.c: Adjust.
* gcc.target/powerpc/bfp/vec-test-data-class-2.c: Adjust.
* gcc.target/powerpc/bfp/vec-test-data-class-3.c: Adjust.
* gcc.target/powerpc/byte-in-either-range-1.c: Adjust.
* gcc.target/powerpc/byte-in-range-1.c: Adjust.
* gcc.target/powerpc/byte-in-set-1.c: Adjust.
* gcc.target/powerpc/byte-in-set-2.c: Adjust.
* gcc.target/powerpc/cmpb-3.c: Adjust.
* gcc.target/powerpc/crypto-builtin-2.c: Adjust.
* gcc.target/powerpc/dfp/dtstsfi-1.c: Adjust.
* gcc.target/powerpc/dfp/dtstsfi-11.c: Adjust.
* gcc.target/powerpc/dfp/dtstsfi-16.c: Adjust.
* gcc.target/powerpc/dfp/dtstsfi-21.c: Adjust.
* gcc.target/powerpc/dfp/dtstsfi-26.c: Adjust.
* gcc.target/powerpc/dfp/dtstsfi-31.c: Adjust.
* gcc.target/powerpc/dfp/dtstsfi-36.c: Adjust.
* gcc.target/powerpc/dfp/dtstsfi-41.c: Adjust.
* gcc.target/powerpc/dfp/dtstsfi-46.c: Adjust.
* gcc.target/powerpc/dfp/dtstsfi-51.c: Adjust.
* gcc.target/powerpc/dfp/dtstsfi-56.c: Adjust.
* gcc.target/powerpc/dfp/dtstsfi-6.c: Adjust.
* gcc.target/powerpc/dfp/dtstsfi-61.c: Adjust.
* gcc.target/powerpc/dfp/dtstsfi-66.c: Adjust.
* gcc.target/powerpc/dfp/dtstsfi-71.c: Adjust.
* gcc.target/powerpc/dfp/dtstsfi-76.c: Adjust.
* gcc.target/powerpc/vsu/vec-all-nez-7.c: Adjust.
* gcc.target/powerpc/vsu/vec-any-eqz-7.c: Adjust.
* gcc.target/powerpc/vsu/vec-cmpnez-7.c: Adjust.
* gcc.target/powerpc/vsu/vec-cntlz-lsbb-2.c: Adjust.
* gcc.target/powerpc/vsu/vec-cnttz-lsbb-2.c: Adjust.
* gcc.target/powerpc/vsu/vec-xl-len-12.c: Adjust.
* gcc.target/powerpc/vsu/vec-xl-len-13.c: Adjust.
* gcc.target/powerpc/vsu/vec-xlx-7.c: Adjust.
* gcc.target/powerpc/vsu/vec-xrx-7.c: Adjust.
* gcc.target/powerpc/vsu/vec-xst-len-12.c: Adjust.
* gcc.target/powerpc/vsu/vec-xst-len-13.c: Adjust.

---
 gcc/config/rs6000/rs6000.c | 53 +-
 .../gcc.target/powerpc/bfp/scalar-cmp-exp-eq-2.c   |  2 +-
 .../gcc.target/powerpc/bfp/scalar-cmp-exp-gt-2.c   |  2 +-
 

[PATCH] i386: Expand roundeven for SSE4.1+

2019-07-13 Thread Tejas Joshi
Hi.
This patch is for expanding roundeven inline for SSE4.1 and later.
Note that this patch is to be applied on top of
. The patch
is bootstrapped and regression tested on x86_64-linux-gnu.

Thanks,
Tejas

gcc/ChangeLog:

2019-07-13  Tejas Joshi  

* builtins.c (mathfn_built_in_2): Changed a CASE_MATHFN to
CASE_MATHFN_FLOATN for roundeven.
* config/i386/i386.md: Define UNSPEC_ROUNDEVEN.
(define_constant): Define ROUND_ROUNDEVEN rounding mode.
(roundeven2): New define_expand.
* internal-fn.def (ROUNDEVEN): New builtin function.
* optabs.def (roundeven_optab): New optab.

gcc/testsuite/ChangeLog:

2019-07-13  Tejas Joshi  

* gcc.target/i386/avx-vround-roundeven-1.c: New test.
* gcc.target/i386/avx-vround-roundeven-2.c: New test.
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 8ceb077b0bf..f61f10422fd 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -2056,7 +2056,7 @@ mathfn_built_in_2 (tree type, combined_fn fn)
 CASE_MATHFN (REMQUO)
 CASE_MATHFN_FLOATN (RINT)
 CASE_MATHFN_FLOATN (ROUND)
-CASE_MATHFN (ROUNDEVEN)
+CASE_MATHFN_FLOATN (ROUNDEVEN)
 CASE_MATHFN (SCALB)
 CASE_MATHFN (SCALBLN)
 CASE_MATHFN (SCALBN)
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index db5fa9ae3ca..bd5d6335f2b 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -169,6 +169,9 @@
   ;; For ROUND support
   UNSPEC_ROUND
 
+  ;;for SSE 4.1+ rounding
+  UNSPEC_ROUNDEVEN
+
   ;; For CRC32 support
   UNSPEC_CRC32
 
@@ -303,7 +306,8 @@
 
 ;; Constants to represent rounding modes in the ROUND instruction
 (define_constants
-  [(ROUND_FLOOR			0x1)
+  [(ROUND_ROUNDEVEN		0x0)
+   (ROUND_FLOOR			0x1)
(ROUND_CEIL			0x2)
(ROUND_TRUNC			0x3)
(ROUND_MXCSR			0x4)
@@ -16328,6 +16332,20 @@
   "TARGET_USE_FANCY_MATH_387
&& (flag_fp_int_builtin_inexact || !flag_trapping_math)")
 
+(define_expand "roundeven2"
+  [(parallel [(set (match_operand:MODEF 0 "register_operand")
+		   (unspec:MODEF [(match_operand:MODEF 1 "register_operand")]
+ UNSPEC_ROUNDEVEN))
+	  (clobber (reg:CC FLAGS_REG))])]
+  "(SSE_FLOAT_MODE_P (mode) && TARGET_SSE_MATH && TARGET_SSE4_1)"
+{
+  gcc_assert (TARGET_SSE4_1);
+  emit_insn (gen_sse4_1_round2
+	 (operands[0], operands[1], GEN_INT (ROUND_ROUNDEVEN
+		| ROUND_NO_EXC)));
+  DONE;
+})
+
 (define_expand "2"
   [(parallel [(set (match_operand:MODEF 0 "register_operand")
 		   (unspec:MODEF [(match_operand:MODEF 1 "register_operand")]
diff --git a/gcc/internal-fn.def b/gcc/internal-fn.def
index 906d74b1d08..15f019b9b49 100644
--- a/gcc/internal-fn.def
+++ b/gcc/internal-fn.def
@@ -234,6 +234,7 @@ DEF_INTERNAL_FLT_FLOATN_FN (FLOOR, ECF_CONST, floor, unary)
 DEF_INTERNAL_FLT_FLOATN_FN (NEARBYINT, ECF_CONST, nearbyint, unary)
 DEF_INTERNAL_FLT_FLOATN_FN (RINT, ECF_CONST, rint, unary)
 DEF_INTERNAL_FLT_FLOATN_FN (ROUND, ECF_CONST, round, unary)
+DEF_INTERNAL_FLT_FLOATN_FN (ROUNDEVEN, ECF_CONST, roundeven, unary)
 DEF_INTERNAL_FLT_FLOATN_FN (TRUNC, ECF_CONST, btrunc, unary)
 
 /* Binary math functions.  */
diff --git a/gcc/optabs.def b/gcc/optabs.def
index 4ffd0f35a40..065e3f64dda 100644
--- a/gcc/optabs.def
+++ b/gcc/optabs.def
@@ -268,6 +268,7 @@ OPTAB_D (fnms_optab, "fnms$a4")
 
 OPTAB_D (rint_optab, "rint$a2")
 OPTAB_D (round_optab, "round$a2")
+OPTAB_D (roundeven_optab, "roundeven$a2")
 OPTAB_D (floor_optab, "floor$a2")
 OPTAB_D (ceil_optab, "ceil$a2")
 OPTAB_D (btrunc_optab, "btrunc$a2")
diff --git a/gcc/testsuite/gcc.target/i386/avx-vround-roundeven-1.c b/gcc/testsuite/gcc.target/i386/avx-vround-roundeven-1.c
new file mode 100644
index 000..072d0f0e73a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx-vround-roundeven-1.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx" } */
+
+__attribute__((noinline, noclone)) double
+f1 (double x)
+{
+  return __builtin_roundeven (x);
+}
+
+__attribute__((noinline, noclone)) float
+f2 (float x)
+{
+  return __builtin_roundevenf (x);
+}
+
+/* { dg-final { scan-assembler-times "vroundsd\[^\n\r\]*xmm" 1 } } */
+/* { dg-final { scan-assembler-times "vroundss\[^\n\r\]*xmm" 1 } } */
diff --git a/gcc/testsuite/gcc.target/i386/avx-vround-roundeven-2.c b/gcc/testsuite/gcc.target/i386/avx-vround-roundeven-2.c
new file mode 100644
index 000..211758d026a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx-vround-roundeven-2.c
@@ -0,0 +1,21 @@
+/* { dg-do run } */
+/* { dg-require-effective-target avx } */
+/* { dg-options "-mavx" } */
+
+#ifndef CHECK_H
+#define CHECK_H "avx-check.h"
+#define TEST avx_test
+#define SRC "avx-vround-roundeven-1.c"
+#endif
+
+#include CHECK_H
+#include SRC
+
+static void
+TEST (void)
+{
+  if (f1 (0.5) != 0.0 || f1 (1.5) != 2.0 || f1 (-0.5) != 0.0 || f1 (-1.5) != -2.0)
+abort ();
+  if (f2 (0.5f) != 0.0f || f2 (1.5f) != 2.0f || f2 (-0.5f) != 0.0f || f2 (-1.5f) != -2.0f)
+abort ();
+}


Re: r273212 - in /trunk/gcc/ada: ChangeLog Makefile...

2019-07-13 Thread Arnaud Charlet
> > 2019-07-08  Dmitriy Anisimkov  
> >
> > gcc/ada/
> >
> > * Makefile.rtl: Use g-sercom__linux.adb for all linuxes.
> 
> ln: failed to create symbolic link 'rts/g-sercom.adb': File exists
> make[7]: *** [/daten/riscv64/gcc/gcc-20190713/gcc/ada/Makefile.rtl:2676: 
> setup-rts] Error 1
> 
> Andreas.
> 
> diff --git a/gcc/ada/Makefile.rtl b/gcc/ada/Makefile.rtl
> index 80ba46dd104..daee19a4ba5 100644
> --- a/gcc/ada/Makefile.rtl
> +++ b/gcc/ada/Makefile.rtl
> @@ -2460,7 +2460,6 @@ ifeq ($(strip $(filter-out riscv% linux%,$(target_cpu) 
> $(target_os))),)
>s-tasinf.adbs-taspri.adss-tpopsp.adb -  g-sercom.adbsystem.ads  
>TOOLS_TARGET_PAIRS = indepsw.adb

Re: r273212 - in /trunk/gcc/ada: ChangeLog Makefile...

2019-07-13 Thread Andreas Schwab
On Jul 08 2019, pmdero...@gcc.gnu.org wrote:

> 2019-07-08  Dmitriy Anisimkov  
>
> gcc/ada/
>
>   * Makefile.rtl: Use g-sercom__linux.adb for all linuxes.

ln: failed to create symbolic link 'rts/g-sercom.adb': File exists
make[7]: *** [/daten/riscv64/gcc/gcc-20190713/gcc/ada/Makefile.rtl:2676: 
setup-rts] Error 1

Andreas.

diff --git a/gcc/ada/Makefile.rtl b/gcc/ada/Makefile.rtl
index 80ba46dd104..daee19a4ba5 100644
--- a/gcc/ada/Makefile.rtl
+++ b/gcc/ada/Makefile.rtl
@@ -2460,7 +2460,6 @@ ifeq ($(strip $(filter-out riscv% linux%,$(target_cpu) 
$(target_os))),)
   s-tasinf.adb

Re: Rewrite some jump.c routines to use flags

2019-07-13 Thread Eric Botcazou
> AIUI, neither ORDERED nor UNEQ trap on signalling NaNs.  Without this,
> the follow-on patch would fold
> 
>(and (ordered x y) (uneq x y)) -> (eq x y)
> 
> which is the same thing for quiet NaNs but not for signalling NaNs.

I see, thanks for explaining.

-- 
Eric Botcazou


Re: PR90723

2019-07-13 Thread Prathamesh Kulkarni
On Thu, 11 Jul 2019 at 13:39, Richard Sandiford
 wrote:
>
> Prathamesh Kulkarni  writes:
> > @@ -186,6 +186,23 @@ skip_alternative (const char *p)
> >  /* Nonzero means volatile operands are recognized.  */
> >  extern int volatile_ok;
> >
> > +/* RAII class for temporarily setting volatile_ok.  */
> > +
> > +class temporary_volatile_ok
> > +{
> > +public:
> > +  temporary_volatile_ok (int value): save_volatile_ok (volatile_ok)
>
> Missing space before the ":".
>
> > +  {
> > +volatile_ok = value;
> > +  }
> > +
> > +  ~temporary_volatile_ok () { volatile_ok = save_volatile_ok; }
> > +
> > +private:
> > +  temporary_volatile_ok (const temporary_volatile_ok&);
>
> Missing space before the "&".
Oops, sorry about that.
>
> OK with those changes, thanks.
Thanks, committed as r273466.

Thanks,
Prathamesh
>
> Richard
>
>
> > +  int save_volatile_ok;
> > +};
> > +
> >  /* Set by constrain_operands to the number of the alternative that
> > matched.  */
> >  extern int which_alternative;


[Patch] Make x86-64 a generic architecture as documented

2019-07-13 Thread Allan Sandfeld Jensen
Hello

Changing -march=x86-64 behaviour to match documentation and common usage.

Question: Is this also good for -m32 -march=x86-64 or will generic then mean 
something else?

Thank
Allan

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 364466b6b6f..90f9cbc3c35 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2019-07-13  Allan Sandfeld Jensen 
+
+   * gcc/common/config/i386/i386-common.c (processor_alias_table): Change
+   x86-64 architecture to use generic tuning and scheduling instead of 
K8.
+
 2019-07-11  Jakub Jelinek  

PR target/91124
diff --git a/gcc/common/config/i386/i386-common.c b/gcc/common/config/i386/
i386-common.c
index a394f874fe4..19ace226190 100644
--- a/gcc/common/config/i386/i386-common.c
+++ b/gcc/common/config/i386/i386-common.c
@@ -1673,7 +1673,7 @@ const pta processor_alias_table[] =
 PTA_MMX | PTA_3DNOW | PTA_3DNOW_A | PTA_SSE | PTA_FXSR},
   {"athlon-mp", PROCESSOR_ATHLON, CPU_ATHLON,
 PTA_MMX | PTA_3DNOW | PTA_3DNOW_A | PTA_SSE | PTA_FXSR},
-  {"x86-64", PROCESSOR_K8, CPU_K8,
+  {"x86-64", PROCESSOR_GENERIC, CPU_GENERIC,
 PTA_64BIT | PTA_MMX | PTA_SSE | PTA_SSE2 | PTA_NO_SAHF | PTA_FXSR},
   {"eden-x2", PROCESSOR_K8, CPU_K8,
 PTA_64BIT | PTA_MMX | PTA_SSE | PTA_SSE2 | PTA_SSE3 | PTA_FXSR},





[PATCH] Fix OpenMP target parallel reduction (task, ...) (PR c/91149)

2019-07-13 Thread Jakub Jelinek
Hi!

I've discovered a pasto, which breaks the following testcase.

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux,
committed to trunk, will backport to 9.2 too.

2019-07-13  Jakub Jelinek  

PR c/91149
* c-omp.c (c_omp_split_clauses): Fix a pasto in
OMP_CLAUSE_REDUCTION_TASK handling.

* c-c++-common/gomp/reduction-task-3.c: New test.

--- gcc/c-family/c-omp.c.jj 2019-07-12 09:46:35.824602187 +0200
+++ gcc/c-family/c-omp.c2019-07-12 16:07:14.494672183 +0200
@@ -1667,7 +1667,7 @@ c_omp_split_clauses (location_t loc, enu
}
  else if (code != OMP_SECTIONS
   && (mask & (OMP_CLAUSE_MASK_1
-  << PRAGMA_OMP_CLAUSE_SCHEDULE)) == 0
+  << PRAGMA_OMP_CLAUSE_NUM_THREADS)) == 0
   && (mask & (OMP_CLAUSE_MASK_1
   << PRAGMA_OMP_CLAUSE_SCHEDULE)) == 0)
{
--- gcc/testsuite/c-c++-common/gomp/reduction-task-3.c.jj   2019-07-12 
16:22:44.005562884 +0200
+++ gcc/testsuite/c-c++-common/gomp/reduction-task-3.c  2019-07-12 
16:16:24.447324301 +0200
@@ -0,0 +1,12 @@
+/* PR c/91149 */
+
+int r;
+
+void
+foo (void)
+{
+  #pragma omp parallel reduction(task, +: r)
+  r++;
+  #pragma omp target parallel reduction(task, +: r)
+  r++;
+}

Jakub


[committed] Add some further restrictions for order(concurrent)

2019-07-13 Thread Jakub Jelinek
Hi!

The constructs with order(concurrent) clause have some extra restrictions,
this patch diagnoses those that are easy to diagnose.

Bootstrapped/regtested on x86_64-linux and i686-linux, committed to trunk.

2019-07-13  Jakub Jelinek  

* gimplify.c (struct gimplify_omp_ctx): Add order_concurrent member.
(omp_notice_threadprivate_variable): Diagnose threadprivate variable
uses inside of order(concurrent) constructs.
(gimplify_scan_omp_clauses): Set ctx->order_concurrent if
OMP_CLAUSE_ORDER is seen.
* omp-low.c (struct omp_context): Add order_concurrent member.
(scan_sharing_clauses): Set ctx->order_concurrent if
OMP_CLAUSE_ORDER is seen.
(check_omp_nesting_restrictions): Diagnose ordered or atomic inside
of simd order(concurrent).  Diagnose constructs not allowed inside of
for order(concurrent).
(setjmp_or_longjmp_p): Add a context and TREE_PUBLIC check to avoid
complaining about static double setjmp (double); or class static
methods or non-global namespace setjmps.
(omp_runtime_api_call): New function.
(scan_omp_1_stmt): Diagnose OpenMP runtime API calls inside of
order(concurrent) loops.

* c-c++-common/gomp/order-3.c: New test.
* c-c++-common/gomp/order-4.c: New test.

--- gcc/gimplify.c.jj   2019-07-12 09:46:35.784602797 +0200
+++ gcc/gimplify.c  2019-07-12 11:00:21.200038178 +0200
@@ -222,6 +222,7 @@ struct gimplify_omp_ctx
   bool distribute;
   bool target_firstprivatize_array_bases;
   bool add_safelen1;
+  bool order_concurrent;
   int defaultmap[4];
 };
 
@@ -7025,14 +7026,24 @@ omp_notice_threadprivate_variable (struc
   struct gimplify_omp_ctx *octx;
 
   for (octx = ctx; octx; octx = octx->outer_context)
-if ((octx->region_type & ORT_TARGET) != 0)
+if ((octx->region_type & ORT_TARGET) != 0
+   || octx->order_concurrent)
   {
n = splay_tree_lookup (octx->variables, (splay_tree_key)decl);
if (n == NULL)
  {
-   error ("threadprivate variable %qE used in target region",
-  DECL_NAME (decl));
-   error_at (octx->location, "enclosing target region");
+   if (octx->order_concurrent)
+ {
+   error ("threadprivate variable %qE used in a region with"
+  " % clause", DECL_NAME (decl));
+   error_at (octx->location, "enclosing region");
+ }
+   else
+ {
+   error ("threadprivate variable %qE used in target region",
+  DECL_NAME (decl));
+   error_at (octx->location, "enclosing target region");
+ }
splay_tree_insert (octx->variables, (splay_tree_key)decl, 0);
  }
if (decl2)
@@ -9263,11 +9274,14 @@ gimplify_scan_omp_clauses (tree *list_p,
case OMP_CLAUSE_NOGROUP:
case OMP_CLAUSE_THREADS:
case OMP_CLAUSE_SIMD:
-   case OMP_CLAUSE_ORDER:
case OMP_CLAUSE_IF_PRESENT:
case OMP_CLAUSE_FINALIZE:
  break;
 
+   case OMP_CLAUSE_ORDER:
+ ctx->order_concurrent = true;
+ break;
+
case OMP_CLAUSE_DEFAULTMAP:
  enum gimplify_defaultmap_kind gdmkmin, gdmkmax;
  switch (OMP_CLAUSE_DEFAULTMAP_CATEGORY (c))
--- gcc/omp-low.c.jj2019-07-12 09:46:35.786602766 +0200
+++ gcc/omp-low.c   2019-07-12 13:15:44.566151747 +0200
@@ -150,6 +150,9 @@ struct omp_context
 
   /* True in the second simd loop of for simd with inscan reductions.  */
   bool for_simd_scan_phase;
+
+  /* True if there is order(concurrent) clause on the construct.  */
+  bool order_concurrent;
 };
 
 static splay_tree all_contexts;
@@ -1390,6 +1393,10 @@ scan_sharing_clauses (tree clauses, omp_
}
  break;
 
+   case OMP_CLAUSE_ORDER:
+ ctx->order_concurrent = true;
+ break;
+
case OMP_CLAUSE_NOWAIT:
case OMP_CLAUSE_ORDERED:
case OMP_CLAUSE_COLLAPSE:
@@ -1402,7 +1409,6 @@ scan_sharing_clauses (tree clauses, omp_
case OMP_CLAUSE_SIMD:
case OMP_CLAUSE_NOGROUP:
case OMP_CLAUSE_DEFAULTMAP:
-   case OMP_CLAUSE_ORDER:
case OMP_CLAUSE_ASYNC:
case OMP_CLAUSE_WAIT:
case OMP_CLAUSE_GANG:
@@ -2669,9 +2675,20 @@ check_omp_nesting_restrictions (gimple *
  && gimple_code (ctx->outer->stmt) == GIMPLE_OMP_FOR)
ctx = ctx->outer;
   if (gimple_code (ctx->stmt) == GIMPLE_OMP_FOR
- && gimple_omp_for_kind (ctx->stmt) & GF_OMP_FOR_SIMD)
+ && gimple_omp_for_kind (ctx->stmt) == GF_OMP_FOR_KIND_SIMD)
{
  c = NULL_TREE;
+ if (ctx->order_concurrent
+ && (gimple_code (stmt) == GIMPLE_OMP_ORDERED
+ || gimple_code (stmt) == GIMPLE_OMP_ATOMIC_LOAD
+ || gimple_code (stmt) == GIMPLE_OMP_ATOMIC_STORE))
+   {
+ error_at (gimple_location (stmt),
+