Re: [RS6000] Don't be too clever with dg-do run and dg-do compile

2020-10-29 Thread Segher Boessenkool
On Thu, Oct 29, 2020 at 09:09:13AM +1030, Alan Modra wrote:
> On Wed, Oct 28, 2020 at 12:16:00PM -0500, Segher Boessenkool wrote:
> > On Wed, Oct 28, 2020 at 09:20:56PM +1030, Alan Modra wrote:
> > > Otherwise some versions of dejagnu go ahead and run the vsx tests
> > > below when they should not.  To best cope with older dejagnu, put
> > > "run" before "compile", the idea being that if the second dg-do always
> > > wins then that won't cause fails.
> > 
> > If they are mutually exclusive, does the order still matter?  (Just FMI.)
> 
> Yes, it does.  Older dejagnu takes the last action regardless of the
> target selector success.  Newer dejagnu uses the last action of a line
> with a successful target selector.
> 
> commit 569f8718b534a2cd9511a7d640352eb0126ff492
> Author: Dominik Vogt 
> Date:   Mon Mar 28 17:31:07 2016 +1100
> 
> * dg.exp (dg-do): Do not change the previously selected action if
> a de-selected dg-do is encountered.
> 
> Signed-off-by: Ben Elliston 

So fixed in 1.6 and later.  Thanks!


Segher


Re: [RS6000] Don't be too clever with dg-do run and dg-do compile

2020-10-28 Thread Alan Modra via Gcc-patches
On Wed, Oct 28, 2020 at 12:16:00PM -0500, Segher Boessenkool wrote:
> On Wed, Oct 28, 2020 at 09:20:56PM +1030, Alan Modra wrote:
> > Otherwise some versions of dejagnu go ahead and run the vsx tests
> > below when they should not.  To best cope with older dejagnu, put
> > "run" before "compile", the idea being that if the second dg-do always
> > wins then that won't cause fails.
> 
> If they are mutually exclusive, does the order still matter?  (Just FMI.)

Yes, it does.  Older dejagnu takes the last action regardless of the
target selector success.  Newer dejagnu uses the last action of a line
with a successful target selector.

commit 569f8718b534a2cd9511a7d640352eb0126ff492
Author: Dominik Vogt 
Date:   Mon Mar 28 17:31:07 2016 +1100

* dg.exp (dg-do): Do not change the previously selected action if
a de-selected dg-do is encountered.

Signed-off-by: Ben Elliston 

-- 
Alan Modra
Australia Development Lab, IBM


Re: [RS6000] Don't be too clever with dg-do run and dg-do compile

2020-10-28 Thread Segher Boessenkool
On Wed, Oct 28, 2020 at 09:20:56PM +1030, Alan Modra wrote:
> Otherwise some versions of dejagnu go ahead and run the vsx tests
> below when they should not.  To best cope with older dejagnu, put
> "run" before "compile", the idea being that if the second dg-do always
> wins then that won't cause fails.

If they are mutually exclusive, does the order still matter?  (Just FMI.)

> The altivec tests also need -save-temps for the scan-assembler test to
> occur when vms_hw.

> Regression tested powerpc64le-linux and powerpc64-linux.  OK?
> 
>   * gcc.target/powerpc/vsx-load-element-extend-char.c: Put "dg-do run"
>   before "dg-do compile", and make them mutually exclusive.
>   * gcc.target/powerpc/vsx-load-element-extend-int.c: Likewise.
>   * gcc.target/powerpc/vsx-load-element-extend-longlong.c: Likewise.
>   * gcc.target/powerpc/vsx-load-element-extend-short.c: Likewise.
>   * gcc.target/powerpc/vsx-store-element-truncate-char.c: Likewise.
>   * gcc.target/powerpc/vsx-store-element-truncate-int.c: Likewise.
>   * gcc.target/powerpc/vsx-store-element-truncate-longlong.c: Likewise.
>   * gcc.target/powerpc/vsx-store-element-truncate-short.c: Likewise.
>   * gcc.target/powerpc/altivec-consts.c: Likewise, add -save-temps.
>   * gcc.target/powerpc/le-altivec-consts.c: Likewise.

Okay for trunk.  Thanks!


Segher


Re: [RS6000] Don't be too clever with dg-do run and dg-do compile

2020-10-28 Thread Segher Boessenkool
On Wed, Oct 28, 2020 at 10:05:14AM -0500, will schmidt wrote:
> On Wed, 2020-10-28 at 21:20 +1030, Alan Modra via Gcc-patches wrote:
> > Otherwise some versions of dejagnu go ahead and run the vsx tests
> > below when they should not.  To best cope with older dejagnu, put
> > "run" before "compile", the idea being that if the second dg-do always
> > wins then that won't cause fails.
> > 
> > The altivec tests also need -save-temps for the scan-assembler test to
> > occur when vms_hw.
> 
> vmx_hw ? :)

For vms_hw it needs a lot more ;-)

> Ok.   These are from some tests I recently committed,   I obviously
> missed this combo (testing with older dejagnu).. I think I've updated
> my dejagnu versions all over the place for other reasons.  Do you
> consider this a non-typical corner case with older dejagnu, or should I
> try to explicitly check for this in the future?

I don't know what version of dejagnu introduced the fix, but probably
newer than our minimum required version.

Thanks,


Segher


Re: [RS6000] Don't be too clever with dg-do run and dg-do compile

2020-10-28 Thread will schmidt via Gcc-patches
On Wed, 2020-10-28 at 21:20 +1030, Alan Modra via Gcc-patches wrote:
> Otherwise some versions of dejagnu go ahead and run the vsx tests
> below when they should not.  To best cope with older dejagnu, put
> "run" before "compile", the idea being that if the second dg-do always
> wins then that won't cause fails.
> 
> The altivec tests also need -save-temps for the scan-assembler test to
> occur when vms_hw.

vmx_hw ? :)

> 
> Regression tested powerpc64le-linux and powerpc64-linux.  OK?
> 
>   * gcc.target/powerpc/vsx-load-element-extend-char.c: Put "dg-do run"
>   before "dg-do compile", and make them mutually exclusive.
>   * gcc.target/powerpc/vsx-load-element-extend-int.c: Likewise.
>   * gcc.target/powerpc/vsx-load-element-extend-longlong.c: Likewise.
>   * gcc.target/powerpc/vsx-load-element-extend-short.c: Likewise.
>   * gcc.target/powerpc/vsx-store-element-truncate-char.c: Likewise.
>   * gcc.target/powerpc/vsx-store-element-truncate-int.c: Likewise.
>   * gcc.target/powerpc/vsx-store-element-truncate-longlong.c: Likewise.
>   * gcc.target/powerpc/vsx-store-element-truncate-short.c: Likewise.
>   * gcc.target/powerpc/altivec-consts.c: Likewise, add -save-temps.
>   * gcc.target/powerpc/le-altivec-consts.c: Likewise.
> 
> diff --git a/gcc/testsuite/gcc.target/powerpc/altivec-consts.c 
> b/gcc/testsuite/gcc.target/powerpc/altivec-consts.c
> index d59f9b4cf1c..c68c68125d1 100644
> --- a/gcc/testsuite/gcc.target/powerpc/altivec-consts.c
> +++ b/gcc/testsuite/gcc.target/powerpc/altivec-consts.c
> @@ -1,7 +1,7 @@
>  /* { dg-do run { target vmx_hw } } */
> -/* { dg-do compile } */
> +/* { dg-do compile { target { ! vmx_hw } } } */
>  /* { dg-require-effective-target powerpc_altivec_ok } */
> -/* { dg-options "-maltivec -mabi=altivec -O2" } */
> +/* { dg-options "-maltivec -mabi=altivec -O2 -save-temps" } */
> 
>  /* Check that "easy" AltiVec constants are correctly synthesized.  */
> 
> diff --git a/gcc/testsuite/gcc.target/powerpc/le-altivec-consts.c 
> b/gcc/testsuite/gcc.target/powerpc/le-altivec-consts.c
> index f48ef44e676..a1db5e92f87 100644
> --- a/gcc/testsuite/gcc.target/powerpc/le-altivec-consts.c
> +++ b/gcc/testsuite/gcc.target/powerpc/le-altivec-consts.c
> @@ -1,7 +1,7 @@
>  /* { dg-do run { target vmx_hw } } */
> -/* { dg-do compile } */
> +/* { dg-do compile { target { ! vmx_hw } } } */
>  /* { dg-require-effective-target powerpc_altivec_ok } */
> -/* { dg-options "-maltivec -mabi=altivec -O2" } */
> +/* { dg-options "-maltivec -mabi=altivec -O2 -save-temps" } */
> 
>  /* Check that "easy" AltiVec constants are correctly synthesized.  */
> 
> diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-load-element-extend-char.c 
> b/gcc/testsuite/gcc.target/powerpc/vsx-load-element-extend-char.c
> index f386346e059..c23a9128680 100644
> --- a/gcc/testsuite/gcc.target/powerpc/vsx-load-element-extend-char.c
> +++ b/gcc/testsuite/gcc.target/powerpc/vsx-load-element-extend-char.c
> @@ -2,8 +2,9 @@
> Test of vec_xl_sext and vec_xl_zext (load into rightmost
> vector element and zero/sign extend). */
> 
> -/* { dg-do compile {target power10_ok} } */
> -/* { dg-do run {target power10_hw} } */
> +/* { dg-do run { target power10_hw } } */
> +/* { dg-do compile { target { ! power10_hw } } } */
> +/* { dg-require-effective-target power10_ok } */
>  /* { dg-require-effective-target int128 } */
>  /* { dg-options "-mdejagnu-cpu=power10 -O3 -save-temps" } */


Ok.   These are from some tests I recently committed,   I obviously
missed this combo (testing with older dejagnu).. I think I've updated
my dejagnu versions all over the place for other reasons.  Do you
consider this a non-typical corner case with older dejagnu, or should I
try to explicitly check for this in the future?

Similar/same changes below.  These changes all seem reasonable.

lgtm, 
thanks
-Will



> 
> diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-load-element-extend-int.c 
> b/gcc/testsuite/gcc.target/powerpc/vsx-load-element-extend-int.c
> index ea737466a58..c40e1a3a0f7 100644
> --- a/gcc/testsuite/gcc.target/powerpc/vsx-load-element-extend-int.c
> +++ b/gcc/testsuite/gcc.target/powerpc/vsx-load-element-extend-int.c
> @@ -2,8 +2,9 @@
> Test of vec_xl_sext and vec_xl_zext (load into rightmost
> vector element and zero/sign extend). */
> 
> -/* { dg-do compile {target power10_ok} } */
> -/* { dg-do run {target power10_hw} } */
> +/* { dg-do run { target power10_hw } } */
> +/* { dg-do compile { target { ! power10_hw } } } */
> +/* { dg-require-effective-target power10_ok } */
>  /* { dg-require-effective-target int128 } */
> 
>  /* Deliberately set optization to zero for this test to confirm
> diff --git 
> a/gcc/testsuite/gcc.target/powerpc/vsx-load-element-extend-longlong.c 
> b/gcc/testsuite/gcc.target/powerpc/vsx-load-element-extend-longlong.c
> index cd155c2013d..405b4245f8e 100644
> --- a/gcc/testsuite/gcc.target/powerpc/vsx-load-element-extend-longlong.c
> +++ b/gcc/testsuite/

[RS6000] Don't be too clever with dg-do run and dg-do compile

2020-10-28 Thread Alan Modra via Gcc-patches
Otherwise some versions of dejagnu go ahead and run the vsx tests
below when they should not.  To best cope with older dejagnu, put
"run" before "compile", the idea being that if the second dg-do always
wins then that won't cause fails.

The altivec tests also need -save-temps for the scan-assembler test to
occur when vms_hw.

Regression tested powerpc64le-linux and powerpc64-linux.  OK?

* gcc.target/powerpc/vsx-load-element-extend-char.c: Put "dg-do run"
before "dg-do compile", and make them mutually exclusive.
* gcc.target/powerpc/vsx-load-element-extend-int.c: Likewise.
* gcc.target/powerpc/vsx-load-element-extend-longlong.c: Likewise.
* gcc.target/powerpc/vsx-load-element-extend-short.c: Likewise.
* gcc.target/powerpc/vsx-store-element-truncate-char.c: Likewise.
* gcc.target/powerpc/vsx-store-element-truncate-int.c: Likewise.
* gcc.target/powerpc/vsx-store-element-truncate-longlong.c: Likewise.
* gcc.target/powerpc/vsx-store-element-truncate-short.c: Likewise.
* gcc.target/powerpc/altivec-consts.c: Likewise, add -save-temps.
* gcc.target/powerpc/le-altivec-consts.c: Likewise.

diff --git a/gcc/testsuite/gcc.target/powerpc/altivec-consts.c 
b/gcc/testsuite/gcc.target/powerpc/altivec-consts.c
index d59f9b4cf1c..c68c68125d1 100644
--- a/gcc/testsuite/gcc.target/powerpc/altivec-consts.c
+++ b/gcc/testsuite/gcc.target/powerpc/altivec-consts.c
@@ -1,7 +1,7 @@
 /* { dg-do run { target vmx_hw } } */
-/* { dg-do compile } */
+/* { dg-do compile { target { ! vmx_hw } } } */
 /* { dg-require-effective-target powerpc_altivec_ok } */
-/* { dg-options "-maltivec -mabi=altivec -O2" } */
+/* { dg-options "-maltivec -mabi=altivec -O2 -save-temps" } */
 
 /* Check that "easy" AltiVec constants are correctly synthesized.  */
 
diff --git a/gcc/testsuite/gcc.target/powerpc/le-altivec-consts.c 
b/gcc/testsuite/gcc.target/powerpc/le-altivec-consts.c
index f48ef44e676..a1db5e92f87 100644
--- a/gcc/testsuite/gcc.target/powerpc/le-altivec-consts.c
+++ b/gcc/testsuite/gcc.target/powerpc/le-altivec-consts.c
@@ -1,7 +1,7 @@
 /* { dg-do run { target vmx_hw } } */
-/* { dg-do compile } */
+/* { dg-do compile { target { ! vmx_hw } } } */
 /* { dg-require-effective-target powerpc_altivec_ok } */
-/* { dg-options "-maltivec -mabi=altivec -O2" } */
+/* { dg-options "-maltivec -mabi=altivec -O2 -save-temps" } */
 
 /* Check that "easy" AltiVec constants are correctly synthesized.  */
 
diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-load-element-extend-char.c 
b/gcc/testsuite/gcc.target/powerpc/vsx-load-element-extend-char.c
index f386346e059..c23a9128680 100644
--- a/gcc/testsuite/gcc.target/powerpc/vsx-load-element-extend-char.c
+++ b/gcc/testsuite/gcc.target/powerpc/vsx-load-element-extend-char.c
@@ -2,8 +2,9 @@
Test of vec_xl_sext and vec_xl_zext (load into rightmost
vector element and zero/sign extend). */
 
-/* { dg-do compile {target power10_ok} } */
-/* { dg-do run {target power10_hw} } */
+/* { dg-do run { target power10_hw } } */
+/* { dg-do compile { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
 /* { dg-require-effective-target int128 } */
 /* { dg-options "-mdejagnu-cpu=power10 -O3 -save-temps" } */
 
diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-load-element-extend-int.c 
b/gcc/testsuite/gcc.target/powerpc/vsx-load-element-extend-int.c
index ea737466a58..c40e1a3a0f7 100644
--- a/gcc/testsuite/gcc.target/powerpc/vsx-load-element-extend-int.c
+++ b/gcc/testsuite/gcc.target/powerpc/vsx-load-element-extend-int.c
@@ -2,8 +2,9 @@
Test of vec_xl_sext and vec_xl_zext (load into rightmost
vector element and zero/sign extend). */
 
-/* { dg-do compile {target power10_ok} } */
-/* { dg-do run {target power10_hw} } */
+/* { dg-do run { target power10_hw } } */
+/* { dg-do compile { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
 /* { dg-require-effective-target int128 } */
 
 /* Deliberately set optization to zero for this test to confirm
diff --git 
a/gcc/testsuite/gcc.target/powerpc/vsx-load-element-extend-longlong.c 
b/gcc/testsuite/gcc.target/powerpc/vsx-load-element-extend-longlong.c
index cd155c2013d..405b4245f8e 100644
--- a/gcc/testsuite/gcc.target/powerpc/vsx-load-element-extend-longlong.c
+++ b/gcc/testsuite/gcc.target/powerpc/vsx-load-element-extend-longlong.c
@@ -2,8 +2,9 @@
Test of vec_xl_sext and vec_xl_zext (load into rightmost
vector element and zero/sign extend). */
 
-/* { dg-do compile {target power10_ok} } */
-/* { dg-do run {target power10_hw} } */
+/* { dg-do run { target power10_hw } } */
+/* { dg-do compile { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
 /* { dg-require-effective-target int128 } */
 /* { dg-options "-mdejagnu-cpu=power10 -O3 -save-temps" } */
 
diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-load-element-extend-short.c 
b/gcc/testsuite/gcc.target/powerpc/vsx-load-element-e