[PATCH] Adjust testcase gcc.target/i386/part-vect-copysignhf.c.

2024-01-18 Thread liuhongt
After vect_early_break is supported, more vectorization is enabled(3
COPYSIGN), so adjust testcase for that.

Commit as obvious fix.

gcc/testsuite/ChangeLog:

* gcc.target/i386/part-vect-copysignhf.c: Remove
-ftree-vectorize from dg-options.
---
 gcc/testsuite/gcc.target/i386/part-vect-copysignhf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/testsuite/gcc.target/i386/part-vect-copysignhf.c 
b/gcc/testsuite/gcc.target/i386/part-vect-copysignhf.c
index 811617bc3dd..0fdcbaea363 100644
--- a/gcc/testsuite/gcc.target/i386/part-vect-copysignhf.c
+++ b/gcc/testsuite/gcc.target/i386/part-vect-copysignhf.c
@@ -1,5 +1,5 @@
 /* { dg-do run { target avx512fp16 } } */
-/* { dg-options "-O1 -mavx512fp16 -mavx512vl -ftree-vectorize 
-fdump-tree-slp-details -fdump-tree-optimized" } */
+/* { dg-options "-O1 -mavx512fp16 -mavx512vl -fdump-tree-slp-details 
-fdump-tree-optimized" } */
 
 extern void abort ();
 
-- 
2.31.1



[PATCH] Adjust testcase for Intel GDS.

2023-08-21 Thread liuhongt via Gcc-patches
gcc/testsuite/ChangeLog:

* gcc.target/i386/avx512f-pr88464-2.c: Add -mgather to
options.
* gcc.target/i386/avx512f-pr88464-3.c: Ditto.
* gcc.target/i386/avx512f-pr88464-4.c: Ditto.
* gcc.target/i386/avx512f-pr88464-6.c: Ditto.
* gcc.target/i386/avx512f-pr88464-7.c: Ditto.
* gcc.target/i386/avx512f-pr88464-8.c: Ditto.
* gcc.target/i386/avx512vl-pr88464-10.c: Ditto.
* gcc.target/i386/avx512vl-pr88464-12.c: Ditto.
* gcc.target/i386/avx512vl-pr88464-13.c: Ditto.
* gcc.target/i386/avx512vl-pr88464-14.c: Ditto.
* gcc.target/i386/avx512vl-pr88464-15.c: Ditto.
* gcc.target/i386/avx512vl-pr88464-16.c: Ditto.
* gcc.target/i386/avx512vl-pr88464-2.c: Ditto.
* gcc.target/i386/avx512vl-pr88464-4.c: Ditto.
* gcc.target/i386/avx512vl-pr88464-5.c: Ditto.
* gcc.target/i386/avx512vl-pr88464-6.c: Ditto.
* gcc.target/i386/avx512vl-pr88464-7.c: Ditto.
* gcc.target/i386/avx512vl-pr88464-8.c: Ditto.
---
 gcc/testsuite/gcc.target/i386/avx512f-pr88464-2.c   | 2 +-
 gcc/testsuite/gcc.target/i386/avx512f-pr88464-3.c   | 2 +-
 gcc/testsuite/gcc.target/i386/avx512f-pr88464-4.c   | 2 +-
 gcc/testsuite/gcc.target/i386/avx512f-pr88464-6.c   | 2 +-
 gcc/testsuite/gcc.target/i386/avx512f-pr88464-7.c   | 2 +-
 gcc/testsuite/gcc.target/i386/avx512f-pr88464-8.c   | 2 +-
 gcc/testsuite/gcc.target/i386/avx512vl-pr88464-10.c | 2 +-
 gcc/testsuite/gcc.target/i386/avx512vl-pr88464-12.c | 2 +-
 gcc/testsuite/gcc.target/i386/avx512vl-pr88464-13.c | 2 +-
 gcc/testsuite/gcc.target/i386/avx512vl-pr88464-14.c | 2 +-
 gcc/testsuite/gcc.target/i386/avx512vl-pr88464-15.c | 2 +-
 gcc/testsuite/gcc.target/i386/avx512vl-pr88464-16.c | 2 +-
 gcc/testsuite/gcc.target/i386/avx512vl-pr88464-2.c  | 2 +-
 gcc/testsuite/gcc.target/i386/avx512vl-pr88464-4.c  | 2 +-
 gcc/testsuite/gcc.target/i386/avx512vl-pr88464-5.c  | 2 +-
 gcc/testsuite/gcc.target/i386/avx512vl-pr88464-6.c  | 2 +-
 gcc/testsuite/gcc.target/i386/avx512vl-pr88464-7.c  | 2 +-
 gcc/testsuite/gcc.target/i386/avx512vl-pr88464-8.c  | 2 +-
 18 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/gcc/testsuite/gcc.target/i386/avx512f-pr88464-2.c 
b/gcc/testsuite/gcc.target/i386/avx512f-pr88464-2.c
index 845bf509d82..28827dbd75d 100644
--- a/gcc/testsuite/gcc.target/i386/avx512f-pr88464-2.c
+++ b/gcc/testsuite/gcc.target/i386/avx512f-pr88464-2.c
@@ -1,6 +1,6 @@
 /* PR tree-optimization/88464 */
 /* { dg-do run { target { avx512f } } } */
-/* { dg-options "-O3 -mavx512f -mprefer-vector-width=512 
-mtune=skylake-avx512" } */
+/* { dg-options "-O3 -mavx512f -mprefer-vector-width=512 -mtune=skylake-avx512 
-mgather" } */
 
 #include "avx512f-check.h"
 
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-pr88464-3.c 
b/gcc/testsuite/gcc.target/i386/avx512f-pr88464-3.c
index 9eda4aa9b13..2df64bfa063 100644
--- a/gcc/testsuite/gcc.target/i386/avx512f-pr88464-3.c
+++ b/gcc/testsuite/gcc.target/i386/avx512f-pr88464-3.c
@@ -1,6 +1,6 @@
 /* PR tree-optimization/88464 */
 /* { dg-do compile } */
-/* { dg-options "-O3 -mavx512f -mprefer-vector-width=512 -mtune=skylake-avx512 
-fdump-tree-vect-details" } */
+/* { dg-options "-O3 -mavx512f -mprefer-vector-width=512 -mtune=skylake-avx512 
-fdump-tree-vect-details -mgather" } */
 /* { dg-final { scan-tree-dump-times "loop vectorized using 64 byte vectors" 4 
"vect" } } */
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 4 "vect" 
} } */
 
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-pr88464-4.c 
b/gcc/testsuite/gcc.target/i386/avx512f-pr88464-4.c
index e347e63b17a..173858aadd5 100644
--- a/gcc/testsuite/gcc.target/i386/avx512f-pr88464-4.c
+++ b/gcc/testsuite/gcc.target/i386/avx512f-pr88464-4.c
@@ -1,6 +1,6 @@
 /* PR tree-optimization/88464 */
 /* { dg-do run { target { avx512f } } } */
-/* { dg-options "-O3 -mavx512f -mprefer-vector-width=512 
-mtune=skylake-avx512" } */
+/* { dg-options "-O3 -mavx512f -mprefer-vector-width=512 -mtune=skylake-avx512 
-mgather" } */
 
 #include "avx512f-check.h"
 
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-pr88464-6.c 
b/gcc/testsuite/gcc.target/i386/avx512f-pr88464-6.c
index 9ebb72a5bae..0adf3b6726a 100644
--- a/gcc/testsuite/gcc.target/i386/avx512f-pr88464-6.c
+++ b/gcc/testsuite/gcc.target/i386/avx512f-pr88464-6.c
@@ -1,6 +1,6 @@
 /* PR tree-optimization/88464 */
 /* { dg-do run { target { avx512f } } } */
-/* { dg-options "-O3 -mavx512f -mprefer-vector-width=512 
-mtune=skylake-avx512" } */
+/* { dg-options "-O3 -mavx512f -mprefer-vector-width=512 -mtune=skylake-avx512 
-mgather" } */
 
 #include "avx512f-check.h"
 
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-pr88464-7.c 
b/gcc/testsuite/gcc.target/i386/avx512f-pr88464-7.c
index 738640c2bf5..471ebc1676d 100644
--- a/gcc/testsuite/gcc.target/i386/avx512f-pr88464-7.c
+++ b/gcc/testsuite/gcc.target/i386/avx512f-pr88464-7.c
@@ -1,6 +1,6 @@
 /* PR tree-optimization/88464 */
 /* { dg-do 

[PATCH] Adjust testcase for more optimal codegen.

2023-07-31 Thread liuhongt via Gcc-patches
After
b9d7140c80bd3c7355b8291bb46f0895dcd8c3cb is the first bad commit
commit b9d7140c80bd3c7355b8291bb46f0895dcd8c3cb
Author: Jan Hubicka 
Date:   Fri Jul 28 09:16:09 2023 +0200

loop-split improvements, part 1

Now we have
vpbroadcastd %ecx, %xmm0
vpaddd .LC3(%rip), %xmm0, %xmm0
vpextrd $3, %xmm0, %eax
vmovddup %xmm3, %xmm0
vrndscalepd $9, %xmm0, %xmm0
vunpckhpd %xmm0, %xmm0, %xmm3

for vrndscalepd, no need to insert pxor since it reuses input register
xmm0 to avoid partial sse dependece.

Pushed to trunk.

gcc/testsuite/ChangeLog:

* gcc.target/i386/pr87007-4.c: Adjust testcase.
* gcc.target/i386/pr87007-5.c: Ditto.
---
 gcc/testsuite/gcc.target/i386/pr87007-4.c | 6 +++---
 gcc/testsuite/gcc.target/i386/pr87007-5.c | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/gcc/testsuite/gcc.target/i386/pr87007-4.c 
b/gcc/testsuite/gcc.target/i386/pr87007-4.c
index e91bdcbac44..23b5c5dcc52 100644
--- a/gcc/testsuite/gcc.target/i386/pr87007-4.c
+++ b/gcc/testsuite/gcc.target/i386/pr87007-4.c
@@ -1,6 +1,6 @@
 /* { dg-do compile } */
-/* { dg-options "-Ofast -march=skylake-avx512 -mfpmath=sse" } */
-
+/* { dg-options "-O2 -march=skylake-avx512 -mfpmath=sse" } */
+/* Load of d2/d3 is hoisted out, vrndscalesd will reuse loades register to 
avoid partial dependence.  */
 
 #include
 
@@ -15,4 +15,4 @@ foo (int n, int k)
   d1 = ceil (d3);
 }
 
-/* { dg-final { scan-assembler-times "vxorps\[^\n\r\]*xmm\[0-9\]" 1 } } */
+/* { dg-final { scan-assembler-times "vxorps\[^\n\r\]*xmm\[0-9\]" 0 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr87007-5.c 
b/gcc/testsuite/gcc.target/i386/pr87007-5.c
index 20d13cf650b..b0b0a7b70ef 100644
--- a/gcc/testsuite/gcc.target/i386/pr87007-5.c
+++ b/gcc/testsuite/gcc.target/i386/pr87007-5.c
@@ -1,6 +1,6 @@
 /* { dg-do compile } */
-/* { dg-options "-Ofast -march=skylake-avx512 -mfpmath=sse" } */
-
+/* { dg-options "-O2 -march=skylake-avx512 -mfpmath=sse" } */
+/* Load of d2/d3 is hoisted out, vrndscalesd will reuse loades register to 
avoid partial dependence.  */
 
 #include
 
@@ -15,4 +15,4 @@ foo (int n, int k)
   d1 = sqrt (d3);
 }
 
-/* { dg-final { scan-assembler-times "vxorps\[^\n\r\]*xmm\[0-9\]" 1 } } */
+/* { dg-final { scan-assembler-times "vxorps\[^\n\r\]*xmm\[0-9\]" 0 } } */
-- 
2.39.1.388.g2fc9e9ca3c



[PATCH] adjust testcase for now happening epilogue vectorization

2023-07-05 Thread Richard Biener via Gcc-patches
gcc.dg/vect/slp-perm-9.c is reported to FAIL with -march=cascadelake
now which is because we now vectorize the epilogue with V2HImode
vectors after the recent change to not scrap too large vector
epilogues during transform but during analysis time.

The following adjusts the testcase to always use the existing alternate
N which avoids epilogue vectorization.

Tested on x86_64-unknown-linux-gnu, pushed.

* gcc.dg/vect/slp-perm-9.c: Always use alternate N.
---
 gcc/testsuite/gcc.dg/vect/slp-perm-9.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/gcc/testsuite/gcc.dg/vect/slp-perm-9.c 
b/gcc/testsuite/gcc.dg/vect/slp-perm-9.c
index 154c00af598..f1f5d4f95a0 100644
--- a/gcc/testsuite/gcc.dg/vect/slp-perm-9.c
+++ b/gcc/testsuite/gcc.dg/vect/slp-perm-9.c
@@ -3,11 +3,7 @@
 #include 
 #include "tree-vect.h"
 
-#if VECTOR_BITS > 512
 #define N (VECTOR_BITS * 6 / 16)
-#else
-#define N 200
-#endif
 
 void __attribute__((noinline))
 foo (unsigned short *__restrict__ pInput, unsigned short *__restrict__ pOutput)
-- 
2.35.3


[PATCH] Adjust testcase.

2022-07-21 Thread liuhongt via Gcc-patches
r13-1762-gf9d4c3b45c5ed5f45c8089c990dbd4e181929c3d lower complex type
move to scalars, but testcase pr23911 is supposed to scan __complex__
constant which is never available, so adjust testcase to scan
IMAGPART/REALPART_EXPR constants separately.

Pushed as obvious patch.

gcc/testsuite/ChangeLog

PR tree-optimization/106010
* gcc.dg/pr23911.c: Scan IMAGPART/REALPART_EXPR = ** instead
of __complex__ since COMPLEX_CST is lower to scalars.
---
 gcc/testsuite/gcc.dg/pr23911.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gcc/testsuite/gcc.dg/pr23911.c b/gcc/testsuite/gcc.dg/pr23911.c
index 3fa041222de..691f3507db2 100644
--- a/gcc/testsuite/gcc.dg/pr23911.c
+++ b/gcc/testsuite/gcc.dg/pr23911.c
@@ -16,5 +16,6 @@ test (void)
 
 /* After DCE2 which runs after FRE, the expressions should be fully
constant folded.  There should be no loads from b left.  */
-/* { dg-final { scan-tree-dump-times "__complex__ \\\(1.0e\\\+0, 0.0\\\)" 2 
"dce3" } } */
+/* { dg-final { scan-tree-dump-times {(?n)REALPART_EXPR.*= 1\.0e\+0} 2 "dce3" 
} } */
+/* { dg-final { scan-tree-dump-times {(?n)IMAGPART_EXPR.*= 0\.0} 2 "dce3" } } 
*/
 /* { dg-final { scan-tree-dump-times "= b" 0 "dce3" } } */
-- 
2.18.1



[PATCH] Adjust testcase to avoid compile failure under -m32.

2022-06-07 Thread liuhongt via Gcc-patches
Pushed as abvious patch.

gcc/testsuite/ChangeLog:

* gcc.target/i386/pr105854.c: Add target int128 and dfp.
---
 gcc/testsuite/gcc.target/i386/pr105854.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gcc/testsuite/gcc.target/i386/pr105854.c 
b/gcc/testsuite/gcc.target/i386/pr105854.c
index 28abef67915..36a8080b8a7 100644
--- a/gcc/testsuite/gcc.target/i386/pr105854.c
+++ b/gcc/testsuite/gcc.target/i386/pr105854.c
@@ -1,4 +1,5 @@
-/* { dg-do compile } */
+/* { dg-do compile { target int128 } } */
+/* { dg-require-effective-target dfp } */
 /* { dg-options "-O -fcaller-saves -mavx512vl -mno-avx512bw" } */
 
 typedef int __attribute__((__vector_size__ (8))) T;
-- 
2.18.1



[PATCH] Adjust testcase for O2 vect.

2021-10-31 Thread liuhongt via Gcc-patches
> (I'm assuming the difference is due to some architectural
> constraints as opposed to arbitrary limitations in the code
There're 2 difference:
1. target support unaligned store or not.
2. target support move by piece or not(which will enable block move in gimple 
level).

Updated patch.

Adjust code in check_vect_slp_store_usage to make it an exact
pattern match of the corresponding testcases.
These new target/xfail selectors are added as a temporary solution,
and should be removed after real issue is fixed for Wstringop-overflow.

gcc/ChangeLog:

* doc/sourcebuild.texi (vect_slp_v4qi_store_unalign,
vect_slp_v2hi_store_unalign, vect_slp_v4hi_store_unalign,
vect_slp_v4si_store_unalign): Document efficient target.
(vect_slp_v4qi_store_unalign_1, vect_slp_v8qi_store_unalign_1,
vect_slp_v16qi_store_unalign_1): Ditto.
(vect_slp_v2hi_store_align,vect_slp_v2qi_store_align,
vect_slp_v2si_store_align, vect_slp_v4qi_store_align): Ditto.
(struct_4char_block_move, struct_8char_block_move,
struct_16char_block_move): Ditto.

gcc/testsuite/ChangeLog:

PR testsuite/102944
* c-c++-common/Wstringop-overflow-2.c: Adjust target/xfail
selector.
* gcc.dg/Warray-bounds-48.c: Ditto.
* gcc.dg/Warray-bounds-51.c: Ditto.
* gcc.dg/Warray-parameter-3.c: Ditto.
* gcc.dg/Wstringop-overflow-14.c: Ditto.
* gcc.dg/Wstringop-overflow-21.c: Ditto.
* gcc.dg/Wstringop-overflow-68.c: Ditto
* gcc.dg/Wstringop-overflow-76.c: Ditto
* gcc.dg/Wzero-length-array-bounds-2.c: Ditto.
* lib/target-supports.exp (vect_slp_v4qi_store_unalign): New
efficient target.
(vect_slp_v4qi_store_unalign_1): Ditto.
(struct_4char_block_move): Ditto.
(struct_8char_block_move): Ditto.
(stryct_16char_block_move): Ditto.
(vect_slp_v2hi_store_align): Ditto.
(vect_slp_v2qi_store): Rename to ..
(vect_slp_v2qi_store_align): .. this.
(vect_slp_v4qi_store): Rename to ..
(vect_slp_v4qi_store_align): .. This.
(vect_slp_v8qi_store): Rename to ..
(vect_slp_v8qi_store_unalign_1): .. This.
(vect_slp_v16qi_store): Rename to ..
(vect_slp_v16qi_store_unalign_1): .. This.
(vect_slp_v2hi_store): Rename to ..
(vect_slp_v2hi_store_unalign): .. This.
(vect_slp_v4hi_store): Rename to ..
(vect_slp_v4hi_store_unalign): This.
(vect_slp_v2si_store): Rename to ..
(vect_slp_v2si_store_align): .. This.
(vect_slp_v4si_store): Rename to ..
(vect_slp_v4si_store_unalign): Ditto.
(check_vect_slp_aligned_store_usage): Rename to ..
(check_vect_slp_store_usage): .. this and adjust code to make
it an exact pattern match of corresponding testcase.
---
 gcc/doc/sourcebuild.texi  |  59 ++--
 .../c-c++-common/Wstringop-overflow-2.c   |  20 +-
 gcc/testsuite/gcc.dg/Warray-bounds-48.c   |   4 +-
 gcc/testsuite/gcc.dg/Warray-bounds-51.c   |   2 +-
 gcc/testsuite/gcc.dg/Warray-parameter-3.c |   2 +-
 gcc/testsuite/gcc.dg/Wstringop-overflow-14.c  |   4 +-
 gcc/testsuite/gcc.dg/Wstringop-overflow-21.c  |   8 +-
 gcc/testsuite/gcc.dg/Wstringop-overflow-68.c  |  10 +-
 gcc/testsuite/gcc.dg/Wstringop-overflow-76.c  |  16 +-
 .../gcc.dg/Wzero-length-array-bounds-2.c  |   2 +-
 gcc/testsuite/lib/target-supports.exp | 313 +-
 11 files changed, 302 insertions(+), 138 deletions(-)

diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi
index 6a165767630..de055d71654 100644
--- a/gcc/doc/sourcebuild.texi
+++ b/gcc/doc/sourcebuild.texi
@@ -1846,37 +1846,58 @@ Target supports loop vectorization with partial vectors 
and
 Target supports loop vectorization with partial vectors and
 @code{vect-partial-vector-usage} is nonzero.
 
-@item vect_slp_v2qi_store
+@item vect_slp_v2qi_store_align
 Target supports vectorization of 2-byte char stores with 2-byte aligned
 address at plain @option{-O2}.
 
-@item vect_slp_v4qi_store
+@item vect_slp_v4qi_store_align
 Target supports vectorization of 4-byte char stores with 4-byte aligned
 address at plain @option{-O2}.
 
-@item vect_slp_v8qi_store
-Target supports vectorization of 8-byte char stores with 8-byte aligned
-address at plain @option{-O2}.
+@item vect_slp_v4qi_store_unalign
+Target supports vectorization of 4-byte char stores with unaligned address
+at plain @option{-O2}.
 
-@item vect_slp_v16qi_store
-Target supports vectorization of 16-byte char stores with 16-byte aligned
-address at plain @option{-O2}.
+@item struct_4char_block_move
+Target supports block move for 8-byte aligned 4-byte size struct 
initialization.
+
+@item vect_slp_v4qi_store_unalign_1
+Target supports vectorization of 4-byte char stores with unaligned address
+or store them with constant pool at plain @option{-O2}.
+
+@item struct_8char_block_move
+Target supports block move 

Re: [PATCH] Adjust testcase for O2 vect.

2021-10-28 Thread Hongtao Liu via Gcc-patches
On Fri, Oct 29, 2021 at 10:34 AM Martin Sebor  wrote:
>
> On 10/28/21 7:47 PM, Hongtao Liu wrote:
> > On Fri, Oct 29, 2021 at 12:20 AM Martin Sebor via Gcc-patches
> >  wrote:
> >>
> >> On 10/28/21 1:23 AM, liuhongt via Gcc-patches wrote:
> >>> Adjust code in check_vect_slp_aligned_store_usage to make it an exact
> >>> pattern match of the corresponding testcases.
> >>> These new target/xfail selectors are added as a temporary solution,
> >>> and should be removed after real issue is fixed for Wstringop-overflow.
> >>
> >> Thanks for all the work you're putting into this!  I can't say
> >> I understand the conditions under which to use which selector
> >> in what case but hopefully we will be able to remove them all
> >> from the tests once the warnings are moved to a better pass.
> >> If that's a safe assumption I'm okay with the changes to
> >> the tests.  I do have a question/comment on the .exp changes.
> >>
> >>>
> >>> gcc/ChangeLog:
> >>>
> >>>* doc/sourcebuild.texi (vect_slp_v4qi_store_2): Document
> >>>efficient target.
> >>>(vect_slp_v4qi_store_3): Ditto.
> >>>(vect_slp_v2hi_store_2): Ditto.
> >>>
> >>> gcc/testsuite/ChangeLog:
> >>>
> >>>PR testsuite/102944
> >>>* gcc.dg/Warray-bounds-48.c: Adjust target/xfail selector.
> >>>* gcc.dg/Warray-parameter-3.c: Ditto.
> >>>* gcc.dg/Wstringop-overflow-68.c: Ditto
> >>>* gcc.dg/Wstringop-overflow-76.c: Ditto
> >>>* lib/target-supports.exp (vect_slp_v4qi_store_2): New
> >>>efficient target.
> >>>(vect_slp_v4qi_store_3): Ditto.
> >>>(vect_slp_v2hi_store_2): Ditto.
> >>>(check_vect_slp_aligned_store_usage): Adjust code to make it
> >>>an exact pattern match of corresponding testcase.
> >>> ---
> >>>gcc/doc/sourcebuild.texi |  12 ++
> >>>gcc/testsuite/gcc.dg/Warray-bounds-48.c  |   4 +-
> >>>gcc/testsuite/gcc.dg/Warray-parameter-3.c|   2 +-
> >>>gcc/testsuite/gcc.dg/Wstringop-overflow-68.c |   4 +-
> >>>gcc/testsuite/gcc.dg/Wstringop-overflow-76.c |  16 +-
> >>>gcc/testsuite/lib/target-supports.exp| 201 ++-
> >>>6 files changed, 179 insertions(+), 60 deletions(-)
> >>>
> >>> diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi
> >>> index 6a165767630..2bb3cb3a9be 100644
> >>> --- a/gcc/doc/sourcebuild.texi
> >>> +++ b/gcc/doc/sourcebuild.texi
> >>> @@ -1854,6 +1854,14 @@ address at plain @option{-O2}.
> >>>Target supports vectorization of 4-byte char stores with 4-byte aligned
> >>>address at plain @option{-O2}.
> >>>
> >>> +@item vect_slp_v4qi_store_2
> >>> +Target supports vectorization of 4-byte char stores with 4-byte aligned
> >>> +address at plain @option{-O2}.
> >>> +
> >>> +@item vect_slp_v4qi_store_3
> >>> +Target supports vectorization of 4-byte char stores with 4-byte aligned
> >>> +address at plain @option{-O2}.
> >>
> >> The description is the same for both of these targets as well
> >> as for vect_slp_v2qi_store.
> >>
> >> I think if anyone other than a vectorization expert is to have
> >> a chance of using these in the future without reverse engineering
> >> the code the descriptions need to capture the differences between
> >> them.  I.e., make it clear when vect_slp_v4qi_store is appropriate
> >> and when either vect_slp_v4qi_store_2 or vect_slp_v4qi_store_3
> >> should be used instead.
> > It's hard to describe vectorization difference like
> > vect_slp_v4qi_store
> > struct A1
> > {
> >  char n;
> >  char a[3];
> > };
> >
> > extern void sink (void*);
> > void
> > foo2 ()
> > {
> >  struct A1 a = { 0, {  } };
> >  a.a[0] = 3;
> >  a.a[1] = 4;
> >  a.a[2] = 5;
> >  sink ();
> > }
> >
> > from
> >
> > vect_slp_v4qi_store_2
> > extern char p[4];
> > void
> > foo2_2 ()
> > {
> >  p[0] = 0;
> >  p[1] = 1;
> >  p[2] = 2;
> >  p[3] = 3;
> > }
> >
> > and
> >
> > vect_slp_v4qi_store_3
> > typedef struct AC4 { char a[4]; } AC4;
> > extern char a[4];
> > void
> > foo ()
> > {
> >  *(AC4*)a = Ac4;
> > }
> >
> > They're all 4 continuous byte-stores, but with minor differences in
> > data reference.
> > Those efficient targets are an exact match of the corresponding
> > testcases, and maybe too special to be used in other places.(I have
> > tried to write them as general cases, but failed as PR102944
> > indicates)
> > The reuse of those targets do need reverse engineering.
>
> Then there must be another variable (or several) besides size
> and alignment that determines whether such stores can be
> vectorized and that reflects the minor differences.   Can you
> explain (at least roughly, in email) what it is?  I'd like to
> understand this enough not just so I have an idea what to look
> for if I have to tweak the tests, but also when I add new ones
> that might have the same issue.
>
> (I'm assuming the difference is due to some architectural
> constraints as opposed to arbitrary 

Re: [PATCH] Adjust testcase for O2 vect.

2021-10-28 Thread Martin Sebor via Gcc-patches

On 10/28/21 7:47 PM, Hongtao Liu wrote:

On Fri, Oct 29, 2021 at 12:20 AM Martin Sebor via Gcc-patches
 wrote:


On 10/28/21 1:23 AM, liuhongt via Gcc-patches wrote:

Adjust code in check_vect_slp_aligned_store_usage to make it an exact
pattern match of the corresponding testcases.
These new target/xfail selectors are added as a temporary solution,
and should be removed after real issue is fixed for Wstringop-overflow.


Thanks for all the work you're putting into this!  I can't say
I understand the conditions under which to use which selector
in what case but hopefully we will be able to remove them all
from the tests once the warnings are moved to a better pass.
If that's a safe assumption I'm okay with the changes to
the tests.  I do have a question/comment on the .exp changes.



gcc/ChangeLog:

   * doc/sourcebuild.texi (vect_slp_v4qi_store_2): Document
   efficient target.
   (vect_slp_v4qi_store_3): Ditto.
   (vect_slp_v2hi_store_2): Ditto.

gcc/testsuite/ChangeLog:

   PR testsuite/102944
   * gcc.dg/Warray-bounds-48.c: Adjust target/xfail selector.
   * gcc.dg/Warray-parameter-3.c: Ditto.
   * gcc.dg/Wstringop-overflow-68.c: Ditto
   * gcc.dg/Wstringop-overflow-76.c: Ditto
   * lib/target-supports.exp (vect_slp_v4qi_store_2): New
   efficient target.
   (vect_slp_v4qi_store_3): Ditto.
   (vect_slp_v2hi_store_2): Ditto.
   (check_vect_slp_aligned_store_usage): Adjust code to make it
   an exact pattern match of corresponding testcase.
---
   gcc/doc/sourcebuild.texi |  12 ++
   gcc/testsuite/gcc.dg/Warray-bounds-48.c  |   4 +-
   gcc/testsuite/gcc.dg/Warray-parameter-3.c|   2 +-
   gcc/testsuite/gcc.dg/Wstringop-overflow-68.c |   4 +-
   gcc/testsuite/gcc.dg/Wstringop-overflow-76.c |  16 +-
   gcc/testsuite/lib/target-supports.exp| 201 ++-
   6 files changed, 179 insertions(+), 60 deletions(-)

diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi
index 6a165767630..2bb3cb3a9be 100644
--- a/gcc/doc/sourcebuild.texi
+++ b/gcc/doc/sourcebuild.texi
@@ -1854,6 +1854,14 @@ address at plain @option{-O2}.
   Target supports vectorization of 4-byte char stores with 4-byte aligned
   address at plain @option{-O2}.

+@item vect_slp_v4qi_store_2
+Target supports vectorization of 4-byte char stores with 4-byte aligned
+address at plain @option{-O2}.
+
+@item vect_slp_v4qi_store_3
+Target supports vectorization of 4-byte char stores with 4-byte aligned
+address at plain @option{-O2}.


The description is the same for both of these targets as well
as for vect_slp_v2qi_store.

I think if anyone other than a vectorization expert is to have
a chance of using these in the future without reverse engineering
the code the descriptions need to capture the differences between
them.  I.e., make it clear when vect_slp_v4qi_store is appropriate
and when either vect_slp_v4qi_store_2 or vect_slp_v4qi_store_3
should be used instead.

It's hard to describe vectorization difference like
vect_slp_v4qi_store
struct A1
{
 char n;
 char a[3];
};

extern void sink (void*);
void
foo2 ()
{
 struct A1 a = { 0, {  } };
 a.a[0] = 3;
 a.a[1] = 4;
 a.a[2] = 5;
 sink ();
}

from

vect_slp_v4qi_store_2
extern char p[4];
void
foo2_2 ()
{
 p[0] = 0;
 p[1] = 1;
 p[2] = 2;
 p[3] = 3;
}

and

vect_slp_v4qi_store_3
typedef struct AC4 { char a[4]; } AC4;
extern char a[4];
void
foo ()
{
 *(AC4*)a = Ac4;
}

They're all 4 continuous byte-stores, but with minor differences in
data reference.
Those efficient targets are an exact match of the corresponding
testcases, and maybe too special to be used in other places.(I have
tried to write them as general cases, but failed as PR102944
indicates)
The reuse of those targets do need reverse engineering.


Then there must be another variable (or several) besides size
and alignment that determines whether such stores can be
vectorized and that reflects the minor differences.   Can you
explain (at least roughly, in email) what it is?  I'd like to
understand this enough not just so I have an idea what to look
for if I have to tweak the tests, but also when I add new ones
that might have the same issue.

(I'm assuming the difference is due to some architectural
constraints as opposed to arbitrary limitations in the code
for the various targets that keep one other other from handling
this or that IL.)

In any event, this isn't an objection to your fix (though
I do think we should try harder to capture the differences
between the selectors).  Just questions to help me understand
why and when it's needed.

Thanks
Martin





Martin


+
   @item vect_slp_v8qi_store
   Target supports vectorization of 8-byte char stores with 8-byte aligned
   address at plain @option{-O2}.
@@ -1874,6 +1882,10 @@ address at plain @option{-O2}.
   Target supports vectorization of 8-byte int stores with 8-byte aligned
   address at plain @option{-O2}.

+@item 

Re: [PATCH] Adjust testcase for O2 vect.

2021-10-28 Thread Hongtao Liu via Gcc-patches
On Fri, Oct 29, 2021 at 12:20 AM Martin Sebor via Gcc-patches
 wrote:
>
> On 10/28/21 1:23 AM, liuhongt via Gcc-patches wrote:
> > Adjust code in check_vect_slp_aligned_store_usage to make it an exact
> > pattern match of the corresponding testcases.
> > These new target/xfail selectors are added as a temporary solution,
> > and should be removed after real issue is fixed for Wstringop-overflow.
>
> Thanks for all the work you're putting into this!  I can't say
> I understand the conditions under which to use which selector
> in what case but hopefully we will be able to remove them all
> from the tests once the warnings are moved to a better pass.
> If that's a safe assumption I'm okay with the changes to
> the tests.  I do have a question/comment on the .exp changes.
>
> >
> > gcc/ChangeLog:
> >
> >   * doc/sourcebuild.texi (vect_slp_v4qi_store_2): Document
> >   efficient target.
> >   (vect_slp_v4qi_store_3): Ditto.
> >   (vect_slp_v2hi_store_2): Ditto.
> >
> > gcc/testsuite/ChangeLog:
> >
> >   PR testsuite/102944
> >   * gcc.dg/Warray-bounds-48.c: Adjust target/xfail selector.
> >   * gcc.dg/Warray-parameter-3.c: Ditto.
> >   * gcc.dg/Wstringop-overflow-68.c: Ditto
> >   * gcc.dg/Wstringop-overflow-76.c: Ditto
> >   * lib/target-supports.exp (vect_slp_v4qi_store_2): New
> >   efficient target.
> >   (vect_slp_v4qi_store_3): Ditto.
> >   (vect_slp_v2hi_store_2): Ditto.
> >   (check_vect_slp_aligned_store_usage): Adjust code to make it
> >   an exact pattern match of corresponding testcase.
> > ---
> >   gcc/doc/sourcebuild.texi |  12 ++
> >   gcc/testsuite/gcc.dg/Warray-bounds-48.c  |   4 +-
> >   gcc/testsuite/gcc.dg/Warray-parameter-3.c|   2 +-
> >   gcc/testsuite/gcc.dg/Wstringop-overflow-68.c |   4 +-
> >   gcc/testsuite/gcc.dg/Wstringop-overflow-76.c |  16 +-
> >   gcc/testsuite/lib/target-supports.exp| 201 ++-
> >   6 files changed, 179 insertions(+), 60 deletions(-)
> >
> > diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi
> > index 6a165767630..2bb3cb3a9be 100644
> > --- a/gcc/doc/sourcebuild.texi
> > +++ b/gcc/doc/sourcebuild.texi
> > @@ -1854,6 +1854,14 @@ address at plain @option{-O2}.
> >   Target supports vectorization of 4-byte char stores with 4-byte aligned
> >   address at plain @option{-O2}.
> >
> > +@item vect_slp_v4qi_store_2
> > +Target supports vectorization of 4-byte char stores with 4-byte aligned
> > +address at plain @option{-O2}.
> > +
> > +@item vect_slp_v4qi_store_3
> > +Target supports vectorization of 4-byte char stores with 4-byte aligned
> > +address at plain @option{-O2}.
>
> The description is the same for both of these targets as well
> as for vect_slp_v2qi_store.
>
> I think if anyone other than a vectorization expert is to have
> a chance of using these in the future without reverse engineering
> the code the descriptions need to capture the differences between
> them.  I.e., make it clear when vect_slp_v4qi_store is appropriate
> and when either vect_slp_v4qi_store_2 or vect_slp_v4qi_store_3
> should be used instead.
It's hard to describe vectorization difference like
vect_slp_v4qi_store
struct A1
{
char n;
char a[3];
};

extern void sink (void*);
void
foo2 ()
{
struct A1 a = { 0, {  } };
a.a[0] = 3;
a.a[1] = 4;
a.a[2] = 5;
sink ();
}

from

vect_slp_v4qi_store_2
extern char p[4];
void
foo2_2 ()
{
p[0] = 0;
p[1] = 1;
p[2] = 2;
p[3] = 3;
}

and

vect_slp_v4qi_store_3
typedef struct AC4 { char a[4]; } AC4;
extern char a[4];
void
foo ()
{
*(AC4*)a = Ac4;
}

They're all 4 continuous byte-stores, but with minor differences in
data reference.
Those efficient targets are an exact match of the corresponding
testcases, and maybe too special to be used in other places.(I have
tried to write them as general cases, but failed as PR102944
indicates)
The reuse of those targets do need reverse engineering.

>
> Martin
>
> > +
> >   @item vect_slp_v8qi_store
> >   Target supports vectorization of 8-byte char stores with 8-byte aligned
> >   address at plain @option{-O2}.
> > @@ -1874,6 +1882,10 @@ address at plain @option{-O2}.
> >   Target supports vectorization of 8-byte int stores with 8-byte aligned
> >   address at plain @option{-O2}.
> >
> > +@item vect_slp_v2si_store_2
> > +Target supports vectorization of 8-byte int stores with 8-byte aligned
> > +address at plain @option{-O2}.
> > +
> >   @item vect_slp_v4si_store
> >   Target supports vectorization of 16-byte int stores with 16-byte aligned
> >   address at plain @option{-O2}.
> > diff --git a/gcc/testsuite/gcc.dg/Warray-bounds-48.c 
> > b/gcc/testsuite/gcc.dg/Warray-bounds-48.c
> > index 19b7634c063..32c0df843d2 100644
> > --- a/gcc/testsuite/gcc.dg/Warray-bounds-48.c
> > +++ b/gcc/testsuite/gcc.dg/Warray-bounds-48.c
> > @@ -30,7 +30,7 @@ static void nowarn_ax_extern (struct AX *p)
> >
> >   static void warn_ax_local_buf (struct AX *p)
> >   {
> 

Re: [PATCH] Adjust testcase for O2 vect.

2021-10-28 Thread Martin Sebor via Gcc-patches

On 10/28/21 1:23 AM, liuhongt via Gcc-patches wrote:

Adjust code in check_vect_slp_aligned_store_usage to make it an exact
pattern match of the corresponding testcases.
These new target/xfail selectors are added as a temporary solution,
and should be removed after real issue is fixed for Wstringop-overflow.


Thanks for all the work you're putting into this!  I can't say
I understand the conditions under which to use which selector
in what case but hopefully we will be able to remove them all
from the tests once the warnings are moved to a better pass.
If that's a safe assumption I'm okay with the changes to
the tests.  I do have a question/comment on the .exp changes.



gcc/ChangeLog:

* doc/sourcebuild.texi (vect_slp_v4qi_store_2): Document
efficient target.
(vect_slp_v4qi_store_3): Ditto.
(vect_slp_v2hi_store_2): Ditto.

gcc/testsuite/ChangeLog:

PR testsuite/102944
* gcc.dg/Warray-bounds-48.c: Adjust target/xfail selector.
* gcc.dg/Warray-parameter-3.c: Ditto.
* gcc.dg/Wstringop-overflow-68.c: Ditto
* gcc.dg/Wstringop-overflow-76.c: Ditto
* lib/target-supports.exp (vect_slp_v4qi_store_2): New
efficient target.
(vect_slp_v4qi_store_3): Ditto.
(vect_slp_v2hi_store_2): Ditto.
(check_vect_slp_aligned_store_usage): Adjust code to make it
an exact pattern match of corresponding testcase.
---
  gcc/doc/sourcebuild.texi |  12 ++
  gcc/testsuite/gcc.dg/Warray-bounds-48.c  |   4 +-
  gcc/testsuite/gcc.dg/Warray-parameter-3.c|   2 +-
  gcc/testsuite/gcc.dg/Wstringop-overflow-68.c |   4 +-
  gcc/testsuite/gcc.dg/Wstringop-overflow-76.c |  16 +-
  gcc/testsuite/lib/target-supports.exp| 201 ++-
  6 files changed, 179 insertions(+), 60 deletions(-)

diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi
index 6a165767630..2bb3cb3a9be 100644
--- a/gcc/doc/sourcebuild.texi
+++ b/gcc/doc/sourcebuild.texi
@@ -1854,6 +1854,14 @@ address at plain @option{-O2}.
  Target supports vectorization of 4-byte char stores with 4-byte aligned
  address at plain @option{-O2}.
  
+@item vect_slp_v4qi_store_2

+Target supports vectorization of 4-byte char stores with 4-byte aligned
+address at plain @option{-O2}.
+
+@item vect_slp_v4qi_store_3
+Target supports vectorization of 4-byte char stores with 4-byte aligned
+address at plain @option{-O2}.


The description is the same for both of these targets as well
as for vect_slp_v2qi_store.

I think if anyone other than a vectorization expert is to have
a chance of using these in the future without reverse engineering
the code the descriptions need to capture the differences between
them.  I.e., make it clear when vect_slp_v4qi_store is appropriate
and when either vect_slp_v4qi_store_2 or vect_slp_v4qi_store_3
should be used instead.

Martin


+
  @item vect_slp_v8qi_store
  Target supports vectorization of 8-byte char stores with 8-byte aligned
  address at plain @option{-O2}.
@@ -1874,6 +1882,10 @@ address at plain @option{-O2}.
  Target supports vectorization of 8-byte int stores with 8-byte aligned
  address at plain @option{-O2}.
  
+@item vect_slp_v2si_store_2

+Target supports vectorization of 8-byte int stores with 8-byte aligned
+address at plain @option{-O2}.
+
  @item vect_slp_v4si_store
  Target supports vectorization of 16-byte int stores with 16-byte aligned
  address at plain @option{-O2}.
diff --git a/gcc/testsuite/gcc.dg/Warray-bounds-48.c 
b/gcc/testsuite/gcc.dg/Warray-bounds-48.c
index 19b7634c063..32c0df843d2 100644
--- a/gcc/testsuite/gcc.dg/Warray-bounds-48.c
+++ b/gcc/testsuite/gcc.dg/Warray-bounds-48.c
@@ -30,7 +30,7 @@ static void nowarn_ax_extern (struct AX *p)
  
  static void warn_ax_local_buf (struct AX *p)

  {
-  p->ax[0] = 4; p->ax[1] = 5;  // { dg-warning "\\\[-Wstringop-overflow" "pr102706" { 
target { vect_slp_v2hi_store &&  { ! vect_slp_v4hi_store } } } }
+  p->ax[0] = 4; p->ax[1] = 5;  // { dg-warning "\\\[-Wstringop-overflow" "pr102706" { 
target { vect_slp_v2hi_store_2 &&  { ! vect_slp_v4hi_store } } } }
  
p->ax[2] = 6; // { dg-warning "\\\[-Warray-bounds" }

p->ax[3] = 7; // { dg-warning "\\\[-Warray-bounds" }
@@ -130,7 +130,7 @@ static void warn_a0_extern (struct A0 *p)
  
  static void warn_a0_local_buf (struct A0 *p)

  {
-  p->a0[0] = 4; p->a0[1] = 5;  // { dg-warning "\\\[-Wstringop-overflow" "pr102706" { 
target { vect_slp_v2hi_store && { ! vect_slp_v4hi_store } } } }
+  p->a0[0] = 4; p->a0[1] = 5;  // { dg-warning "\\\[-Wstringop-overflow" "pr102706" { 
target { vect_slp_v2hi_store_2 && { ! vect_slp_v4hi_store } } } }
  
p->a0[2] = 6; // { dg-warning "\\\[-Warray-bounds" }

p->a0[3] = 7; // { dg-warning "\\\[-Warray-bounds" }
diff --git a/gcc/testsuite/gcc.dg/Warray-parameter-3.c 
b/gcc/testsuite/gcc.dg/Warray-parameter-3.c
index b6ed8daf51c..bbf55a40a3c 100644
--- a/gcc/testsuite/gcc.dg/Warray-parameter-3.c
+++ 

[PATCH] Adjust testcase for O2 vect.

2021-10-28 Thread liuhongt via Gcc-patches
Adjust code in check_vect_slp_aligned_store_usage to make it an exact
pattern match of the corresponding testcases.
These new target/xfail selectors are added as a temporary solution,
and should be removed after real issue is fixed for Wstringop-overflow.

gcc/ChangeLog:

* doc/sourcebuild.texi (vect_slp_v4qi_store_2): Document
efficient target.
(vect_slp_v4qi_store_3): Ditto.
(vect_slp_v2hi_store_2): Ditto.

gcc/testsuite/ChangeLog:

PR testsuite/102944
* gcc.dg/Warray-bounds-48.c: Adjust target/xfail selector.
* gcc.dg/Warray-parameter-3.c: Ditto.
* gcc.dg/Wstringop-overflow-68.c: Ditto
* gcc.dg/Wstringop-overflow-76.c: Ditto
* lib/target-supports.exp (vect_slp_v4qi_store_2): New
efficient target.
(vect_slp_v4qi_store_3): Ditto.
(vect_slp_v2hi_store_2): Ditto.
(check_vect_slp_aligned_store_usage): Adjust code to make it
an exact pattern match of corresponding testcase.
---
 gcc/doc/sourcebuild.texi |  12 ++
 gcc/testsuite/gcc.dg/Warray-bounds-48.c  |   4 +-
 gcc/testsuite/gcc.dg/Warray-parameter-3.c|   2 +-
 gcc/testsuite/gcc.dg/Wstringop-overflow-68.c |   4 +-
 gcc/testsuite/gcc.dg/Wstringop-overflow-76.c |  16 +-
 gcc/testsuite/lib/target-supports.exp| 201 ++-
 6 files changed, 179 insertions(+), 60 deletions(-)

diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi
index 6a165767630..2bb3cb3a9be 100644
--- a/gcc/doc/sourcebuild.texi
+++ b/gcc/doc/sourcebuild.texi
@@ -1854,6 +1854,14 @@ address at plain @option{-O2}.
 Target supports vectorization of 4-byte char stores with 4-byte aligned
 address at plain @option{-O2}.
 
+@item vect_slp_v4qi_store_2
+Target supports vectorization of 4-byte char stores with 4-byte aligned
+address at plain @option{-O2}.
+
+@item vect_slp_v4qi_store_3
+Target supports vectorization of 4-byte char stores with 4-byte aligned
+address at plain @option{-O2}.
+
 @item vect_slp_v8qi_store
 Target supports vectorization of 8-byte char stores with 8-byte aligned
 address at plain @option{-O2}.
@@ -1874,6 +1882,10 @@ address at plain @option{-O2}.
 Target supports vectorization of 8-byte int stores with 8-byte aligned
 address at plain @option{-O2}.
 
+@item vect_slp_v2si_store_2
+Target supports vectorization of 8-byte int stores with 8-byte aligned
+address at plain @option{-O2}.
+
 @item vect_slp_v4si_store
 Target supports vectorization of 16-byte int stores with 16-byte aligned
 address at plain @option{-O2}.
diff --git a/gcc/testsuite/gcc.dg/Warray-bounds-48.c 
b/gcc/testsuite/gcc.dg/Warray-bounds-48.c
index 19b7634c063..32c0df843d2 100644
--- a/gcc/testsuite/gcc.dg/Warray-bounds-48.c
+++ b/gcc/testsuite/gcc.dg/Warray-bounds-48.c
@@ -30,7 +30,7 @@ static void nowarn_ax_extern (struct AX *p)
 
 static void warn_ax_local_buf (struct AX *p)
 {
-  p->ax[0] = 4; p->ax[1] = 5;  // { dg-warning "\\\[-Wstringop-overflow" 
"pr102706" { target { vect_slp_v2hi_store &&  { ! vect_slp_v4hi_store } } } }
+  p->ax[0] = 4; p->ax[1] = 5;  // { dg-warning "\\\[-Wstringop-overflow" 
"pr102706" { target { vect_slp_v2hi_store_2 &&  { ! vect_slp_v4hi_store } } } }
 
   p->ax[2] = 6; // { dg-warning "\\\[-Warray-bounds" }
   p->ax[3] = 7; // { dg-warning "\\\[-Warray-bounds" }
@@ -130,7 +130,7 @@ static void warn_a0_extern (struct A0 *p)
 
 static void warn_a0_local_buf (struct A0 *p)
 {
-  p->a0[0] = 4; p->a0[1] = 5;  // { dg-warning "\\\[-Wstringop-overflow" 
"pr102706" { target { vect_slp_v2hi_store && { ! vect_slp_v4hi_store } } } }
+  p->a0[0] = 4; p->a0[1] = 5;  // { dg-warning "\\\[-Wstringop-overflow" 
"pr102706" { target { vect_slp_v2hi_store_2 && { ! vect_slp_v4hi_store } } } }
 
   p->a0[2] = 6; // { dg-warning "\\\[-Warray-bounds" }
   p->a0[3] = 7; // { dg-warning "\\\[-Warray-bounds" }
diff --git a/gcc/testsuite/gcc.dg/Warray-parameter-3.c 
b/gcc/testsuite/gcc.dg/Warray-parameter-3.c
index b6ed8daf51c..bbf55a40a3c 100644
--- a/gcc/testsuite/gcc.dg/Warray-parameter-3.c
+++ b/gcc/testsuite/gcc.dg/Warray-parameter-3.c
@@ -77,7 +77,7 @@ gia3 (int a[3])
 __attribute__ ((noipa)) void
 gcas3 (char a[static 3])
 {
-  a[0] = 0; a[1] = 1; a[2] = 2; // { dg-warning "\\\[-Wstringop-overflow" 
"pr102706" { target { vect_slp_v4qi_store } } }
+  a[0] = 0; a[1] = 1; a[2] = 2; // { dg-warning "\\\[-Wstringop-overflow" 
"pr102706" { target { vect_slp_v4qi_store_2 } } }
   a[3] = 3;   // { dg-warning "\\\[-Warray-bounds" }
 }
 
diff --git a/gcc/testsuite/gcc.dg/Wstringop-overflow-68.c 
b/gcc/testsuite/gcc.dg/Wstringop-overflow-68.c
index 04e91afb8bc..488b4a9b0c7 100644
--- a/gcc/testsuite/gcc.dg/Wstringop-overflow-68.c
+++ b/gcc/testsuite/gcc.dg/Wstringop-overflow-68.c
@@ -65,8 +65,8 @@ void warn_comp_lit (void)
   // MEM  [(char *)] = { 0, 1, 2, 3, 4, 5, 6, 7 };
   // MEM  [(char *)] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 
10, 11, 12, 13, 14, 15 };
   // and warning should be expected, refer 

[PATCH] Adjust testcase for 128/256 bit HF vector load/store

2021-10-21 Thread Hongyu Wang via Gcc-patches
Hi,

The HF vector move have been updated to align with HI vector,
adjust according testcase for _Float16 vector load and store.

Tested on x86_64-pc-linux-gnu{-m32,}, pushed as obvious fix.

gcc/testsuite/ChangeLog:

* gcc.target/i386/avx512fp16-13.c: Adjust scan-assembler for
xmm/ymm load/store.
---
 gcc/testsuite/gcc.target/i386/avx512fp16-13.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-13.c 
b/gcc/testsuite/gcc.target/i386/avx512fp16-13.c
index c3bae65da67..b73a8f44e1a 100644
--- a/gcc/testsuite/gcc.target/i386/avx512fp16-13.c
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-13.c
@@ -18,7 +18,7 @@ store256_ph (void *p, __m256h a)
   _mm256_store_ph (p, a);
 }
 
-/* { dg-final { scan-assembler-times "vmovdqa64\[ 
\\t\]+\[^\{\n\]*%ymm\[0-9\]+\[^\n\]*\\)" 1 } } */
+/* { dg-final { scan-assembler-times "vmovdqa\[ 
\\t\]+\[^\{\n\]*%ymm\[0-9\]+\[^\n\]*\\)" 1 } } */
 
 void
 __attribute__ ((noinline, noclone))
@@ -27,7 +27,7 @@ store_ph (void *p, __m128h a)
   _mm_store_ph (p, a);
 }
 
-/* { dg-final { scan-assembler-times "vmovdqa64\[ 
\\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*\\)" 1 } } */
+/* { dg-final { scan-assembler-times "vmovdqa\[ 
\\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*\\)" 1 } } */
 
 __m512h
 __attribute__ ((noinline, noclone))
@@ -45,7 +45,7 @@ load256_ph (void const *p)
   return _mm256_load_ph (p);
 }
 
-/* { dg-final { scan-assembler-times "vmovdqa64\[ 
\\t\]+\[^\{\n\]*%ymm\[0-9\]+\[^\n\]*\\)" 1 } } */
+/* { dg-final { scan-assembler-times "vmovdqa\[ 
\\t\]+\[^\{\n\]*%ymm\[0-9\]+\[^\n\]*\\)" 1 } } */
 
 __m128h
 __attribute__ ((noinline, noclone))
@@ -53,7 +53,7 @@ load_ph (void const *p)
 {
   return _mm_load_ph (p);
 }
-/* { dg-final { scan-assembler-times "vmovdqa64\[ 
\\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*\\)" 1 } } */
+/* { dg-final { scan-assembler-times "vmovdqa\[ 
\\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*\\)" 1 } } */
 
 __m512h
 __attribute__ ((noinline, noclone))
-- 
2.18.1



Re: [PATCH] Adjust testcase for O2 vectorization.

2021-10-20 Thread Hongtao Liu via Gcc-patches
On Thu, Oct 21, 2021 at 10:06 AM Hongtao Liu  wrote:
>
> On Thu, Oct 21, 2021 at 9:20 AM Hongtao Liu  wrote:
> >
> > On Wed, Oct 20, 2021 at 7:34 PM Christophe Lyon via Gcc-patches
> >  wrote:
> > >
> > > Hi,
> > >
> > >
> > > On Tue, Oct 19, 2021 at 11:03 AM liuhongt via Gcc-patches <
> > > gcc-patches@gcc.gnu.org> wrote:
> > >
> > > > updated patch:
> > > >   1. Add documents in doc/sourcebuild.texi (Effective-Target Keywords).
> > > >   2. Reduce -novec.c testcases to contain only new failed parted which
> > > > is caused by O2 vectorization.
> > > >   3. Add PR in dg-warning comment.
> > > >
> > > > As discussed in [1], this patch add xfail/target selector to those
> > > > testcases, also make a copy of them so that they can be tested w/o
> > > > vectorization.
> > > >
> > > > Newly added xfail/target selectors are used to check the vectorization
> > > > capability of continuous byte/double bytes storage, these scenarios
> > > > are exactly the part of the testcases that regressed after O2
> > > > vectorization.
> > > >
> > > > [1] https://gcc.gnu.org/pipermail/gcc-patches/2021-October/581456.html.
> > > >
> > > > gcc/ChangeLog
> > > >
> > > > * doc/sourcebuild.texi (Effective-Target Keywords): Document
> > > > vect_slp_v2qi_store, vect_slp_v4qi_store, vect_slp_v8qi_store,
> > > > vect_slp_v16qi_store, vect_slp_v2hi_store,
> > > > vect_slp_v4hi_store, vect_slp_v2si_store, vect_slp_v4si_store.
> > > >
> > > > gcc/testsuite/ChangeLog
> > > >
> > > > PR middle-end/102722
> > > > PR middle-end/102697
> > > > PR middle-end/102462
> > > > PR middle-end/102706
> > > > PR middle-end/102744
> > > > * c-c++-common/Wstringop-overflow-2.c: Adjust testcase with new
> > > > xfail/target selector.
> > > > * gcc.dg/Warray-bounds-51.c: Ditto.
> > > > * gcc.dg/Warray-parameter-3.c: Ditto.
> > > > * gcc.dg/Wstringop-overflow-14.c: Ditto.
> > > > * gcc.dg/Wstringop-overflow-21.c: Ditto.
> > > > * gcc.dg/Wstringop-overflow-68.c: Ditto.
> > > > * gcc.dg/Wstringop-overflow-76.c: Ditto.
> > > > * gcc.dg/Warray-bounds-48.c: Ditto.
> > > > * gcc.dg/Wzero-length-array-bounds-2.c: Ditto.
> > > >
> > >
> > > Some of these adjustments cause regressions on arm / aarch64, the exact
> > > list depends on the target/flags.
> > > See
> > > https://people.linaro.org/~christophe.lyon/cross-validation/gcc/trunk/r12-4525-gf36240f8c835d792f788b6724e272fc0a4a4f26f/report-build-info.html
> > > for more on details on several combinations.
> > >
> > > Can you have a look?
> > Yes.
> Testcase in target-support doesn't match real testcase, .i.e. for v4qi
> vectorization, it's
> char a[4];
> void foo ()
> {
>   a[0] = 0;
>   a[1] = 1;
>   a[2] = 2;
>   a[3] = 3;
> }
>
> vs
>
> typedef struct AC2 { char a[2]; } AC2;
> typedef struct AC4 { char a[4]; } AC4;
> #define Ac4 (AC4){ 0, 1, 2, 3 }
> extern char a2[2];
> extern char a4[4];
> void
> foo ()
> {
>   *(AC4*)a2 = Ac4;
> }
>
> The former can be vectorized by aarch64-linux-gcc, but the latter
> can't be which cause ned FAIL, similar for other XPASS cases.
>
> Guess we need exact match for testcase in target-supports.exp.
If that, those efficient target would be too special to be used by
others, maybe just as a temporary solution, and should be removed
after Martin fixed those regression.
> > >
> > > Christophe
> > >
> > > * lib/target-supports.exp (check_vect_slp_aligned_store_usage):
> > > > New function.
> > > > (check_effective_target_vect_slp_v2qi_store): Ditto.
> > > > (check_effective_target_vect_slp_v4qi_store): Ditto.
> > > > (check_effective_target_vect_slp_v8qi_store): Ditto.
> > > > (check_effective_target_vect_slp_v16qi_store): Ditto.
> > > > (check_effective_target_vect_slp_v2hi_store): Ditto.
> > > > (check_effective_target_vect_slp_v4hi_store): Ditto.
> > > > (check_effective_target_vect_slp_v2si_store): Ditto.
> > > > (check_effective_target_vect_slp_v4si_store): Ditto.
> > > > * c-c++-common/Wstringop-overflow-2-novec.c: New test.
> > > > * gcc.dg/Warray-bounds-51-novec.c: New test.
> > > > * gcc.dg/Warray-bounds-48-novec.c: New test.
> > > > * gcc.dg/Warray-parameter-3-novec.c: New test.
> > > > * gcc.dg/Wstringop-overflow-14-novec.c: New test.
> > > > * gcc.dg/Wstringop-overflow-21-novec.c: New test.
> > > > * gcc.dg/Wstringop-overflow-76-novec.c: New test.
> > > > * gcc.dg/Wzero-length-array-bounds-2-novec.c: New test.
> > > > ---
> > > >  gcc/doc/sourcebuild.texi  |  32 ++
> > > >  .../c-c++-common/Wstringop-overflow-2-novec.c | 126 ++
> > > >  .../c-c++-common/Wstringop-overflow-2.c   |  20 +-
> > > >  gcc/testsuite/gcc.dg/Warray-bounds-48-novec.c | 364 ++
> > > >  gcc/testsuite/gcc.dg/Warray-bounds-48.c   |   4 +-
> > > >  

Re: [PATCH] Adjust testcase for O2 vectorization.

2021-10-20 Thread Hongtao Liu via Gcc-patches
On Thu, Oct 21, 2021 at 9:20 AM Hongtao Liu  wrote:
>
> On Wed, Oct 20, 2021 at 7:34 PM Christophe Lyon via Gcc-patches
>  wrote:
> >
> > Hi,
> >
> >
> > On Tue, Oct 19, 2021 at 11:03 AM liuhongt via Gcc-patches <
> > gcc-patches@gcc.gnu.org> wrote:
> >
> > > updated patch:
> > >   1. Add documents in doc/sourcebuild.texi (Effective-Target Keywords).
> > >   2. Reduce -novec.c testcases to contain only new failed parted which
> > > is caused by O2 vectorization.
> > >   3. Add PR in dg-warning comment.
> > >
> > > As discussed in [1], this patch add xfail/target selector to those
> > > testcases, also make a copy of them so that they can be tested w/o
> > > vectorization.
> > >
> > > Newly added xfail/target selectors are used to check the vectorization
> > > capability of continuous byte/double bytes storage, these scenarios
> > > are exactly the part of the testcases that regressed after O2
> > > vectorization.
> > >
> > > [1] https://gcc.gnu.org/pipermail/gcc-patches/2021-October/581456.html.
> > >
> > > gcc/ChangeLog
> > >
> > > * doc/sourcebuild.texi (Effective-Target Keywords): Document
> > > vect_slp_v2qi_store, vect_slp_v4qi_store, vect_slp_v8qi_store,
> > > vect_slp_v16qi_store, vect_slp_v2hi_store,
> > > vect_slp_v4hi_store, vect_slp_v2si_store, vect_slp_v4si_store.
> > >
> > > gcc/testsuite/ChangeLog
> > >
> > > PR middle-end/102722
> > > PR middle-end/102697
> > > PR middle-end/102462
> > > PR middle-end/102706
> > > PR middle-end/102744
> > > * c-c++-common/Wstringop-overflow-2.c: Adjust testcase with new
> > > xfail/target selector.
> > > * gcc.dg/Warray-bounds-51.c: Ditto.
> > > * gcc.dg/Warray-parameter-3.c: Ditto.
> > > * gcc.dg/Wstringop-overflow-14.c: Ditto.
> > > * gcc.dg/Wstringop-overflow-21.c: Ditto.
> > > * gcc.dg/Wstringop-overflow-68.c: Ditto.
> > > * gcc.dg/Wstringop-overflow-76.c: Ditto.
> > > * gcc.dg/Warray-bounds-48.c: Ditto.
> > > * gcc.dg/Wzero-length-array-bounds-2.c: Ditto.
> > >
> >
> > Some of these adjustments cause regressions on arm / aarch64, the exact
> > list depends on the target/flags.
> > See
> > https://people.linaro.org/~christophe.lyon/cross-validation/gcc/trunk/r12-4525-gf36240f8c835d792f788b6724e272fc0a4a4f26f/report-build-info.html
> > for more on details on several combinations.
> >
> > Can you have a look?
> Yes.
Testcase in target-support doesn't match real testcase, .i.e. for v4qi
vectorization, it's
char a[4];
void foo ()
{
  a[0] = 0;
  a[1] = 1;
  a[2] = 2;
  a[3] = 3;
}

vs

typedef struct AC2 { char a[2]; } AC2;
typedef struct AC4 { char a[4]; } AC4;
#define Ac4 (AC4){ 0, 1, 2, 3 }
extern char a2[2];
extern char a4[4];
void
foo ()
{
  *(AC4*)a2 = Ac4;
}

The former can be vectorized by aarch64-linux-gcc, but the latter
can't be which cause ned FAIL, similar for other XPASS cases.

Guess we need exact match for testcase in target-supports.exp.
> >
> > Christophe
> >
> > * lib/target-supports.exp (check_vect_slp_aligned_store_usage):
> > > New function.
> > > (check_effective_target_vect_slp_v2qi_store): Ditto.
> > > (check_effective_target_vect_slp_v4qi_store): Ditto.
> > > (check_effective_target_vect_slp_v8qi_store): Ditto.
> > > (check_effective_target_vect_slp_v16qi_store): Ditto.
> > > (check_effective_target_vect_slp_v2hi_store): Ditto.
> > > (check_effective_target_vect_slp_v4hi_store): Ditto.
> > > (check_effective_target_vect_slp_v2si_store): Ditto.
> > > (check_effective_target_vect_slp_v4si_store): Ditto.
> > > * c-c++-common/Wstringop-overflow-2-novec.c: New test.
> > > * gcc.dg/Warray-bounds-51-novec.c: New test.
> > > * gcc.dg/Warray-bounds-48-novec.c: New test.
> > > * gcc.dg/Warray-parameter-3-novec.c: New test.
> > > * gcc.dg/Wstringop-overflow-14-novec.c: New test.
> > > * gcc.dg/Wstringop-overflow-21-novec.c: New test.
> > > * gcc.dg/Wstringop-overflow-76-novec.c: New test.
> > > * gcc.dg/Wzero-length-array-bounds-2-novec.c: New test.
> > > ---
> > >  gcc/doc/sourcebuild.texi  |  32 ++
> > >  .../c-c++-common/Wstringop-overflow-2-novec.c | 126 ++
> > >  .../c-c++-common/Wstringop-overflow-2.c   |  20 +-
> > >  gcc/testsuite/gcc.dg/Warray-bounds-48-novec.c | 364 ++
> > >  gcc/testsuite/gcc.dg/Warray-bounds-48.c   |   4 +-
> > >  gcc/testsuite/gcc.dg/Warray-bounds-51-novec.c |  21 +
> > >  gcc/testsuite/gcc.dg/Warray-bounds-51.c   |   2 +-
> > >  .../gcc.dg/Warray-parameter-3-novec.c |  16 +
> > >  gcc/testsuite/gcc.dg/Warray-parameter-3.c |   2 +-
> > >  .../gcc.dg/Wstringop-overflow-14-novec.c  |  16 +
> > >  gcc/testsuite/gcc.dg/Wstringop-overflow-14.c  |   4 +-
> > >  .../gcc.dg/Wstringop-overflow-21-novec.c  |  34 ++
> > >  

Re: [PATCH] Adjust testcase for O2 vectorization.

2021-10-20 Thread Hongtao Liu via Gcc-patches
On Wed, Oct 20, 2021 at 7:34 PM Christophe Lyon via Gcc-patches
 wrote:
>
> Hi,
>
>
> On Tue, Oct 19, 2021 at 11:03 AM liuhongt via Gcc-patches <
> gcc-patches@gcc.gnu.org> wrote:
>
> > updated patch:
> >   1. Add documents in doc/sourcebuild.texi (Effective-Target Keywords).
> >   2. Reduce -novec.c testcases to contain only new failed parted which
> > is caused by O2 vectorization.
> >   3. Add PR in dg-warning comment.
> >
> > As discussed in [1], this patch add xfail/target selector to those
> > testcases, also make a copy of them so that they can be tested w/o
> > vectorization.
> >
> > Newly added xfail/target selectors are used to check the vectorization
> > capability of continuous byte/double bytes storage, these scenarios
> > are exactly the part of the testcases that regressed after O2
> > vectorization.
> >
> > [1] https://gcc.gnu.org/pipermail/gcc-patches/2021-October/581456.html.
> >
> > gcc/ChangeLog
> >
> > * doc/sourcebuild.texi (Effective-Target Keywords): Document
> > vect_slp_v2qi_store, vect_slp_v4qi_store, vect_slp_v8qi_store,
> > vect_slp_v16qi_store, vect_slp_v2hi_store,
> > vect_slp_v4hi_store, vect_slp_v2si_store, vect_slp_v4si_store.
> >
> > gcc/testsuite/ChangeLog
> >
> > PR middle-end/102722
> > PR middle-end/102697
> > PR middle-end/102462
> > PR middle-end/102706
> > PR middle-end/102744
> > * c-c++-common/Wstringop-overflow-2.c: Adjust testcase with new
> > xfail/target selector.
> > * gcc.dg/Warray-bounds-51.c: Ditto.
> > * gcc.dg/Warray-parameter-3.c: Ditto.
> > * gcc.dg/Wstringop-overflow-14.c: Ditto.
> > * gcc.dg/Wstringop-overflow-21.c: Ditto.
> > * gcc.dg/Wstringop-overflow-68.c: Ditto.
> > * gcc.dg/Wstringop-overflow-76.c: Ditto.
> > * gcc.dg/Warray-bounds-48.c: Ditto.
> > * gcc.dg/Wzero-length-array-bounds-2.c: Ditto.
> >
>
> Some of these adjustments cause regressions on arm / aarch64, the exact
> list depends on the target/flags.
> See
> https://people.linaro.org/~christophe.lyon/cross-validation/gcc/trunk/r12-4525-gf36240f8c835d792f788b6724e272fc0a4a4f26f/report-build-info.html
> for more on details on several combinations.
>
> Can you have a look?
Yes.
>
> Christophe
>
> * lib/target-supports.exp (check_vect_slp_aligned_store_usage):
> > New function.
> > (check_effective_target_vect_slp_v2qi_store): Ditto.
> > (check_effective_target_vect_slp_v4qi_store): Ditto.
> > (check_effective_target_vect_slp_v8qi_store): Ditto.
> > (check_effective_target_vect_slp_v16qi_store): Ditto.
> > (check_effective_target_vect_slp_v2hi_store): Ditto.
> > (check_effective_target_vect_slp_v4hi_store): Ditto.
> > (check_effective_target_vect_slp_v2si_store): Ditto.
> > (check_effective_target_vect_slp_v4si_store): Ditto.
> > * c-c++-common/Wstringop-overflow-2-novec.c: New test.
> > * gcc.dg/Warray-bounds-51-novec.c: New test.
> > * gcc.dg/Warray-bounds-48-novec.c: New test.
> > * gcc.dg/Warray-parameter-3-novec.c: New test.
> > * gcc.dg/Wstringop-overflow-14-novec.c: New test.
> > * gcc.dg/Wstringop-overflow-21-novec.c: New test.
> > * gcc.dg/Wstringop-overflow-76-novec.c: New test.
> > * gcc.dg/Wzero-length-array-bounds-2-novec.c: New test.
> > ---
> >  gcc/doc/sourcebuild.texi  |  32 ++
> >  .../c-c++-common/Wstringop-overflow-2-novec.c | 126 ++
> >  .../c-c++-common/Wstringop-overflow-2.c   |  20 +-
> >  gcc/testsuite/gcc.dg/Warray-bounds-48-novec.c | 364 ++
> >  gcc/testsuite/gcc.dg/Warray-bounds-48.c   |   4 +-
> >  gcc/testsuite/gcc.dg/Warray-bounds-51-novec.c |  21 +
> >  gcc/testsuite/gcc.dg/Warray-bounds-51.c   |   2 +-
> >  .../gcc.dg/Warray-parameter-3-novec.c |  16 +
> >  gcc/testsuite/gcc.dg/Warray-parameter-3.c |   2 +-
> >  .../gcc.dg/Wstringop-overflow-14-novec.c  |  16 +
> >  gcc/testsuite/gcc.dg/Wstringop-overflow-14.c  |   4 +-
> >  .../gcc.dg/Wstringop-overflow-21-novec.c  |  34 ++
> >  gcc/testsuite/gcc.dg/Wstringop-overflow-21.c  |   8 +-
> >  gcc/testsuite/gcc.dg/Wstringop-overflow-68.c  |  17 +-
> >  .../gcc.dg/Wstringop-overflow-76-novec.c  |  88 +
> >  gcc/testsuite/gcc.dg/Wstringop-overflow-76.c  |  18 +-
> >  .../Wzero-length-array-bounds-2-novec.c   |  45 +++
> >  .../gcc.dg/Wzero-length-array-bounds-2.c  |   2 +-
> >  gcc/testsuite/lib/target-supports.exp | 182 +
> >  19 files changed, 967 insertions(+), 34 deletions(-)
> >  create mode 100644 gcc/testsuite/c-c++-common/Wstringop-overflow-2-novec.c
> >  create mode 100644 gcc/testsuite/gcc.dg/Warray-bounds-48-novec.c
> >  create mode 100644 gcc/testsuite/gcc.dg/Warray-bounds-51-novec.c
> >  create mode 100644 gcc/testsuite/gcc.dg/Warray-parameter-3-novec.c
> >  create mode 100644 

Re: [PATCH] Adjust testcase for O2 vectorization.

2021-10-20 Thread Christophe Lyon via Gcc-patches
Hi,


On Tue, Oct 19, 2021 at 11:03 AM liuhongt via Gcc-patches <
gcc-patches@gcc.gnu.org> wrote:

> updated patch:
>   1. Add documents in doc/sourcebuild.texi (Effective-Target Keywords).
>   2. Reduce -novec.c testcases to contain only new failed parted which
> is caused by O2 vectorization.
>   3. Add PR in dg-warning comment.
>
> As discussed in [1], this patch add xfail/target selector to those
> testcases, also make a copy of them so that they can be tested w/o
> vectorization.
>
> Newly added xfail/target selectors are used to check the vectorization
> capability of continuous byte/double bytes storage, these scenarios
> are exactly the part of the testcases that regressed after O2
> vectorization.
>
> [1] https://gcc.gnu.org/pipermail/gcc-patches/2021-October/581456.html.
>
> gcc/ChangeLog
>
> * doc/sourcebuild.texi (Effective-Target Keywords): Document
> vect_slp_v2qi_store, vect_slp_v4qi_store, vect_slp_v8qi_store,
> vect_slp_v16qi_store, vect_slp_v2hi_store,
> vect_slp_v4hi_store, vect_slp_v2si_store, vect_slp_v4si_store.
>
> gcc/testsuite/ChangeLog
>
> PR middle-end/102722
> PR middle-end/102697
> PR middle-end/102462
> PR middle-end/102706
> PR middle-end/102744
> * c-c++-common/Wstringop-overflow-2.c: Adjust testcase with new
> xfail/target selector.
> * gcc.dg/Warray-bounds-51.c: Ditto.
> * gcc.dg/Warray-parameter-3.c: Ditto.
> * gcc.dg/Wstringop-overflow-14.c: Ditto.
> * gcc.dg/Wstringop-overflow-21.c: Ditto.
> * gcc.dg/Wstringop-overflow-68.c: Ditto.
> * gcc.dg/Wstringop-overflow-76.c: Ditto.
> * gcc.dg/Warray-bounds-48.c: Ditto.
> * gcc.dg/Wzero-length-array-bounds-2.c: Ditto.
>

Some of these adjustments cause regressions on arm / aarch64, the exact
list depends on the target/flags.
See
https://people.linaro.org/~christophe.lyon/cross-validation/gcc/trunk/r12-4525-gf36240f8c835d792f788b6724e272fc0a4a4f26f/report-build-info.html
for more on details on several combinations.

Can you have a look?

Christophe

* lib/target-supports.exp (check_vect_slp_aligned_store_usage):
> New function.
> (check_effective_target_vect_slp_v2qi_store): Ditto.
> (check_effective_target_vect_slp_v4qi_store): Ditto.
> (check_effective_target_vect_slp_v8qi_store): Ditto.
> (check_effective_target_vect_slp_v16qi_store): Ditto.
> (check_effective_target_vect_slp_v2hi_store): Ditto.
> (check_effective_target_vect_slp_v4hi_store): Ditto.
> (check_effective_target_vect_slp_v2si_store): Ditto.
> (check_effective_target_vect_slp_v4si_store): Ditto.
> * c-c++-common/Wstringop-overflow-2-novec.c: New test.
> * gcc.dg/Warray-bounds-51-novec.c: New test.
> * gcc.dg/Warray-bounds-48-novec.c: New test.
> * gcc.dg/Warray-parameter-3-novec.c: New test.
> * gcc.dg/Wstringop-overflow-14-novec.c: New test.
> * gcc.dg/Wstringop-overflow-21-novec.c: New test.
> * gcc.dg/Wstringop-overflow-76-novec.c: New test.
> * gcc.dg/Wzero-length-array-bounds-2-novec.c: New test.
> ---
>  gcc/doc/sourcebuild.texi  |  32 ++
>  .../c-c++-common/Wstringop-overflow-2-novec.c | 126 ++
>  .../c-c++-common/Wstringop-overflow-2.c   |  20 +-
>  gcc/testsuite/gcc.dg/Warray-bounds-48-novec.c | 364 ++
>  gcc/testsuite/gcc.dg/Warray-bounds-48.c   |   4 +-
>  gcc/testsuite/gcc.dg/Warray-bounds-51-novec.c |  21 +
>  gcc/testsuite/gcc.dg/Warray-bounds-51.c   |   2 +-
>  .../gcc.dg/Warray-parameter-3-novec.c |  16 +
>  gcc/testsuite/gcc.dg/Warray-parameter-3.c |   2 +-
>  .../gcc.dg/Wstringop-overflow-14-novec.c  |  16 +
>  gcc/testsuite/gcc.dg/Wstringop-overflow-14.c  |   4 +-
>  .../gcc.dg/Wstringop-overflow-21-novec.c  |  34 ++
>  gcc/testsuite/gcc.dg/Wstringop-overflow-21.c  |   8 +-
>  gcc/testsuite/gcc.dg/Wstringop-overflow-68.c  |  17 +-
>  .../gcc.dg/Wstringop-overflow-76-novec.c  |  88 +
>  gcc/testsuite/gcc.dg/Wstringop-overflow-76.c  |  18 +-
>  .../Wzero-length-array-bounds-2-novec.c   |  45 +++
>  .../gcc.dg/Wzero-length-array-bounds-2.c  |   2 +-
>  gcc/testsuite/lib/target-supports.exp | 182 +
>  19 files changed, 967 insertions(+), 34 deletions(-)
>  create mode 100644 gcc/testsuite/c-c++-common/Wstringop-overflow-2-novec.c
>  create mode 100644 gcc/testsuite/gcc.dg/Warray-bounds-48-novec.c
>  create mode 100644 gcc/testsuite/gcc.dg/Warray-bounds-51-novec.c
>  create mode 100644 gcc/testsuite/gcc.dg/Warray-parameter-3-novec.c
>  create mode 100644 gcc/testsuite/gcc.dg/Wstringop-overflow-14-novec.c
>  create mode 100644 gcc/testsuite/gcc.dg/Wstringop-overflow-21-novec.c
>  create mode 100644 gcc/testsuite/gcc.dg/Wstringop-overflow-76-novec.c
>  create mode 100644
> gcc/testsuite/gcc.dg/Wzero-length-array-bounds-2-novec.c
>
> diff --git 

[PATCH] Adjust testcase for O2 vectorization.

2021-10-19 Thread liuhongt via Gcc-patches
updated patch:
  1. Add documents in doc/sourcebuild.texi (Effective-Target Keywords).
  2. Reduce -novec.c testcases to contain only new failed parted which
is caused by O2 vectorization.
  3. Add PR in dg-warning comment.

As discussed in [1], this patch add xfail/target selector to those
testcases, also make a copy of them so that they can be tested w/o
vectorization.

Newly added xfail/target selectors are used to check the vectorization
capability of continuous byte/double bytes storage, these scenarios
are exactly the part of the testcases that regressed after O2
vectorization.

[1] https://gcc.gnu.org/pipermail/gcc-patches/2021-October/581456.html.

gcc/ChangeLog

* doc/sourcebuild.texi (Effective-Target Keywords): Document
vect_slp_v2qi_store, vect_slp_v4qi_store, vect_slp_v8qi_store,
vect_slp_v16qi_store, vect_slp_v2hi_store,
vect_slp_v4hi_store, vect_slp_v2si_store, vect_slp_v4si_store.

gcc/testsuite/ChangeLog

PR middle-end/102722
PR middle-end/102697
PR middle-end/102462
PR middle-end/102706
PR middle-end/102744
* c-c++-common/Wstringop-overflow-2.c: Adjust testcase with new
xfail/target selector.
* gcc.dg/Warray-bounds-51.c: Ditto.
* gcc.dg/Warray-parameter-3.c: Ditto.
* gcc.dg/Wstringop-overflow-14.c: Ditto.
* gcc.dg/Wstringop-overflow-21.c: Ditto.
* gcc.dg/Wstringop-overflow-68.c: Ditto.
* gcc.dg/Wstringop-overflow-76.c: Ditto.
* gcc.dg/Warray-bounds-48.c: Ditto.
* gcc.dg/Wzero-length-array-bounds-2.c: Ditto.
* lib/target-supports.exp (check_vect_slp_aligned_store_usage):
New function.
(check_effective_target_vect_slp_v2qi_store): Ditto.
(check_effective_target_vect_slp_v4qi_store): Ditto.
(check_effective_target_vect_slp_v8qi_store): Ditto.
(check_effective_target_vect_slp_v16qi_store): Ditto.
(check_effective_target_vect_slp_v2hi_store): Ditto.
(check_effective_target_vect_slp_v4hi_store): Ditto.
(check_effective_target_vect_slp_v2si_store): Ditto.
(check_effective_target_vect_slp_v4si_store): Ditto.
* c-c++-common/Wstringop-overflow-2-novec.c: New test.
* gcc.dg/Warray-bounds-51-novec.c: New test.
* gcc.dg/Warray-bounds-48-novec.c: New test.
* gcc.dg/Warray-parameter-3-novec.c: New test.
* gcc.dg/Wstringop-overflow-14-novec.c: New test.
* gcc.dg/Wstringop-overflow-21-novec.c: New test.
* gcc.dg/Wstringop-overflow-76-novec.c: New test.
* gcc.dg/Wzero-length-array-bounds-2-novec.c: New test.
---
 gcc/doc/sourcebuild.texi  |  32 ++
 .../c-c++-common/Wstringop-overflow-2-novec.c | 126 ++
 .../c-c++-common/Wstringop-overflow-2.c   |  20 +-
 gcc/testsuite/gcc.dg/Warray-bounds-48-novec.c | 364 ++
 gcc/testsuite/gcc.dg/Warray-bounds-48.c   |   4 +-
 gcc/testsuite/gcc.dg/Warray-bounds-51-novec.c |  21 +
 gcc/testsuite/gcc.dg/Warray-bounds-51.c   |   2 +-
 .../gcc.dg/Warray-parameter-3-novec.c |  16 +
 gcc/testsuite/gcc.dg/Warray-parameter-3.c |   2 +-
 .../gcc.dg/Wstringop-overflow-14-novec.c  |  16 +
 gcc/testsuite/gcc.dg/Wstringop-overflow-14.c  |   4 +-
 .../gcc.dg/Wstringop-overflow-21-novec.c  |  34 ++
 gcc/testsuite/gcc.dg/Wstringop-overflow-21.c  |   8 +-
 gcc/testsuite/gcc.dg/Wstringop-overflow-68.c  |  17 +-
 .../gcc.dg/Wstringop-overflow-76-novec.c  |  88 +
 gcc/testsuite/gcc.dg/Wstringop-overflow-76.c  |  18 +-
 .../Wzero-length-array-bounds-2-novec.c   |  45 +++
 .../gcc.dg/Wzero-length-array-bounds-2.c  |   2 +-
 gcc/testsuite/lib/target-supports.exp | 182 +
 19 files changed, 967 insertions(+), 34 deletions(-)
 create mode 100644 gcc/testsuite/c-c++-common/Wstringop-overflow-2-novec.c
 create mode 100644 gcc/testsuite/gcc.dg/Warray-bounds-48-novec.c
 create mode 100644 gcc/testsuite/gcc.dg/Warray-bounds-51-novec.c
 create mode 100644 gcc/testsuite/gcc.dg/Warray-parameter-3-novec.c
 create mode 100644 gcc/testsuite/gcc.dg/Wstringop-overflow-14-novec.c
 create mode 100644 gcc/testsuite/gcc.dg/Wstringop-overflow-21-novec.c
 create mode 100644 gcc/testsuite/gcc.dg/Wstringop-overflow-76-novec.c
 create mode 100644 gcc/testsuite/gcc.dg/Wzero-length-array-bounds-2-novec.c

diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi
index b1fffd5e90f..6a165767630 100644
--- a/gcc/doc/sourcebuild.texi
+++ b/gcc/doc/sourcebuild.texi
@@ -1845,6 +1845,38 @@ Target supports loop vectorization with partial vectors 
and
 @item vect_partial_vectors
 Target supports loop vectorization with partial vectors and
 @code{vect-partial-vector-usage} is nonzero.
+
+@item vect_slp_v2qi_store
+Target supports vectorization of 2-byte char stores with 2-byte aligned
+address at plain @option{-O2}.
+
+@item vect_slp_v4qi_store
+Target supports vectorization of 4-byte char stores with 4-byte aligned
+address at 

Re: [PATCH] Adjust testcase for O2 vectorization.

2021-10-18 Thread Martin Sebor via Gcc-patches

On 10/17/21 10:38 PM, Hongtao Liu wrote:

On Fri, Oct 15, 2021 at 11:37 PM Martin Sebor  wrote:


On 10/14/21 1:11 AM, liuhongt wrote:

Hi Kewen:
Cound you help to verify if this patch fix those regressions
for rs6000 port.

As discussed in [1], this patch add xfail/target selector to those
testcases, also make a copy of them so that they can be tested w/o
vectorization.


Just to make sure I understand what's happening with the tests:
the new -N-novec.c tests consist of just the casses xfailed due
to vectorizartion in the corresponding -N.c tests?  Or are there

Wstringop-overflow-2-novec.c is the same as Wstringop-overflow-2.c
before O2 vectorization adjustment.
Do you want me to reduce them to only contain cases for new xfail/target?


That would be helpful, thank you.  Are the others also full
copies? (If yes, then copying just the failing cases into
the new tests would be good as well.)


some other differences (e.g., new cases in them, etc.)?  I'd
hope to eventually remove the -novec.c tests once all warnings
behave as expected with vectorization as without it (maybe
keeping just one case both ways as a sanity check).

For the target-supports selectors, I confess I don't know enough
about vectorization to find their names quite intuitive enough
to know when to use each.  For instance, for vect_slp_v4qi_store:

It's 4-byte char stores with address being 4-bytes aligned.
.i.e.



+# Return the true if target support vectorization of v4qi store.
+proc check_effective_target_vect_slp_v4qi_store { } {
+set pattern {add new stmt: MEM }
+return [expr { [check_vect_slp_vnqihi_store_usage $pattern ] != 0 }]
+}

When should this selector be used?  In cases involving 4-byte
char stores?  Only naturally aligned 4-bytes stores (i.e., on
a 4 byte boundary, as the check_vect_slp_vnqihi_store_usage
suggests?) Or 4-byte stores of any types (e.g., four chars
as well as two 16-bit shorts), etc.?

Hopefully once all the warnings handle vectorization we won't
need to use them, but until then it would be good to document
this in more detail in the .exp file.

Finally, thank you for adding comments to the xfailed tests
referencing the corresponding bugs!  Can you please mention
the PR in the comment in each of the new xfails?  Like so:

index 7d29b5f48c7..cb687c69324 100644
--- a/gcc/testsuite/c-c++-common/Wstringop-overflow-2.c
+++ b/gcc/testsuite/c-c++-common/Wstringop-overflow-2.c
@@ -189,8 +189,9 @@ void ga1__ (void)

 struct A1 a = { 1 };
 a.a[0] = 0;
+  // O2 vectorization regress Wstringop-overflow case (1), refer to
pr102462.
 a.a[1] = 1;// { dg-warning
"\\\[-Wstringop-overflow" }
-  a.a[2] = 2;// { dg-warning
"\\\[-Wstringop-overflow" "" { xfail { i?86-*-* x86_64-*-* } } }
+  a.a[2] = 2;// { dg-warning
"\\\[-Wstringop-overflow" "pr102462" { xfail { vect_slp_v2qi_store } } }
 
 PR in dg-warning comment.

This should make it easier to deal with the XFAILs once
the warnings have improved to handle vectorization.

Will do.


Great, thank you!

Martin


Re: [PATCH] Adjust testcase for O2 vectorization.

2021-10-17 Thread Hongtao Liu via Gcc-patches
On Fri, Oct 15, 2021 at 3:11 PM Kewen.Lin via Gcc-patches
 wrote:
>
> on 2021/10/14 下午6:56, Kewen.Lin via Gcc-patches wrote:
> > Hi Hongtao,
> >
> > on 2021/10/14 下午3:11, liuhongt wrote:
> >> Hi Kewen:
> >>   Cound you help to verify if this patch fix those regressions
> >> for rs6000 port.
> >>
> >
> > The ppc64le run just finished, there are still some regresssions:
> >
> > NA->XPASS: c-c++-common/Wstringop-overflow-2.c  -Wc++-compat   (test for 
> > warnings, line 194)
> > NA->XPASS: c-c++-common/Wstringop-overflow-2.c  -Wc++-compat   (test for 
> > warnings, line 212)
> > NA->XPASS: c-c++-common/Wstringop-overflow-2.c  -Wc++-compat   (test for 
> > warnings, line 296)
> > NA->XPASS: c-c++-common/Wstringop-overflow-2.c  -Wc++-compat   (test for 
> > warnings, line 314)
> > NA->FAIL: gcc.dg/Wstringop-overflow-21-novec.c (test for excess errors)
> > NA->FAIL: gcc.dg/Wstringop-overflow-21-novec.c  (test for warnings, line 18)
> > NA->FAIL: gcc.dg/Wstringop-overflow-21-novec.c  (test for warnings, line 29)
> > NA->FAIL: gcc.dg/Wstringop-overflow-21-novec.c  (test for warnings, line 45)
> > NA->FAIL: gcc.dg/Wstringop-overflow-21-novec.c  (test for warnings, line 55)
> > NA->FAIL: gcc.dg/Wstringop-overflow-76-novec.c note (test for warnings, 
> > line 104)
> > NA->FAIL: gcc.dg/Wstringop-overflow-76-novec.c note (test for warnings, 
> > line 137)
> > NA->FAIL: gcc.dg/Wstringop-overflow-76-novec.c note (test for warnings, 
> > line 19)
> > NA->FAIL: gcc.dg/Wstringop-overflow-76-novec.c note (test for warnings, 
> > line 39)
> > NA->FAIL: gcc.dg/Wstringop-overflow-76-novec.c note (test for warnings, 
> > line 56)
> > NA->FAIL: gcc.dg/Wstringop-overflow-76-novec.c note (test for warnings, 
> > line 70)
> > NA->FAIL: gcc.dg/Wstringop-overflow-76-novec.c (test for excess errors)
> > NA->FAIL: gcc.dg/Wstringop-overflow-76-novec.c  (test for warnings, line 
> > 116)
> > NA->FAIL: gcc.dg/Wstringop-overflow-76-novec.c  (test for warnings, line 
> > 131)
> > NA->FAIL: gcc.dg/Wstringop-overflow-76-novec.c  (test for warnings, line 
> > 146)
> > NA->FAIL: gcc.dg/Wstringop-overflow-76-novec.c  (test for warnings, line 33)
> > NA->FAIL: gcc.dg/Wstringop-overflow-76-novec.c  (test for warnings, line 50)
> > NA->FAIL: gcc.dg/Wstringop-overflow-76-novec.c  (test for warnings, line 64)
> > NA->FAIL: gcc.dg/Wstringop-overflow-76-novec.c  (test for warnings, line 78)
> > NA->FAIL: gcc.dg/Wstringop-overflow-76-novec.c  (test for warnings, line 97)
> > PASS->FAIL: c-c++-common/Wstringop-overflow-2.c  -std=gnu++14 (test for 
> > excess errors)
> > NA->FAIL: c-c++-common/Wstringop-overflow-2.c  -std=gnu++14  (test for 
> > warnings, line 229)
> > NA->FAIL: c-c++-common/Wstringop-overflow-2.c  -std=gnu++14  (test for 
> > warnings, line 230)
> > NA->FAIL: c-c++-common/Wstringop-overflow-2.c  -std=gnu++14  (test for 
> > warnings, line 331)
> > NA->FAIL: c-c++-common/Wstringop-overflow-2.c  -std=gnu++14  (test for 
> > warnings, line 332)
> > // omitting -std=gnu++17, -std=gnu++2a, -std=gnu++98
> >
> > I'll have a look and get back to you tomorrow.
> >
>
> The failure c-c++-common/Wstringop-overflow-2.c is due to that the
> current proc check_vect_slp_vnqihi_store_usage is made as "cache"
> but it can vary for different input patterns.  For rs6000 the test
> for v2qi fails, the cached test result makes v4qi check fail
> unexpectedly (should pass).  I adjusted caching for the following users
> check_effective_target_vect_slp_v*_store, also refactored a bit.
> One trivial change is to add one new argument macro then we can just
> compile the corresponding foo* function instead of all, hope it helps
> to make the debugging outputs compact.
>
> For the failure Wstringop-overflow-76-novec.c, there is one typo
> comparing to the original Wstringop-overflow-76.c.  Guess it failed
> on x86 too?  It would be surprising if it passes on x86.
> As to the failure Wstringop-overflow-21-novec.c, I confirmed it's
> just noise, patching typos caused this failure.
Thanks for the explanation for  those failures and the typo, i'll
adjust the patch.
>
> One new round ppc64le testing just finished with below diff and all
> previous regressions are fixed without any new regressions.
>
>
> diff --git a/gcc/testsuite/gcc.dg/Wstringop-overflow-76-novec.c 
> b/gcc/testsuite/gcc.dg/Wstringop-overflow-76-novec.c
> index d000b587a65..1132348c5f4 100644
> --- a/gcc/testsuite/gcc.dg/Wstringop-overflow-76-novec.c
> +++ b/gcc/testsuite/gcc.dg/Wstringop-overflow-76-novec.c
> @@ -82,7 +82,7 @@ void max_d8_p (char *q, int i)
>  struct A3_5
>  {
>char a3[3];  // { dg-message "at offset 3 into destination object 'a3' of 
> size 3" "pr??" { xfail *-*-* } }
> -  char a5[5];
> +  char a5[5];  // { dg-message "at offset 5 into destination object 'a5' of 
> size 5" "note" }
>  };
>
>  void max_A3_A5 (int i, struct A3_5 *pa3_5)
> diff --git a/gcc/testsuite/lib/target-supports.exp 
> b/gcc/testsuite/lib/target-supports.exp
> index 530c5769614..8736b908ec7 100644
> --- 

Re: [PATCH] Adjust testcase for O2 vectorization.

2021-10-17 Thread Hongtao Liu via Gcc-patches
On Fri, Oct 15, 2021 at 11:37 PM Martin Sebor  wrote:
>
> On 10/14/21 1:11 AM, liuhongt wrote:
> > Hi Kewen:
> >Cound you help to verify if this patch fix those regressions
> > for rs6000 port.
> >
> > As discussed in [1], this patch add xfail/target selector to those
> > testcases, also make a copy of them so that they can be tested w/o
> > vectorization.
>
> Just to make sure I understand what's happening with the tests:
> the new -N-novec.c tests consist of just the casses xfailed due
> to vectorizartion in the corresponding -N.c tests?  Or are there
Wstringop-overflow-2-novec.c is the same as Wstringop-overflow-2.c
before O2 vectorization adjustment.
Do you want me to reduce them to only contain cases for new xfail/target?
> some other differences (e.g., new cases in them, etc.)?  I'd
> hope to eventually remove the -novec.c tests once all warnings
> behave as expected with vectorization as without it (maybe
> keeping just one case both ways as a sanity check).
>
> For the target-supports selectors, I confess I don't know enough
> about vectorization to find their names quite intuitive enough
> to know when to use each.  For instance, for vect_slp_v4qi_store:
It's 4-byte char stores with address being 4-bytes aligned.
.i.e.

>
> +# Return the true if target support vectorization of v4qi store.
> +proc check_effective_target_vect_slp_v4qi_store { } {
> +set pattern {add new stmt: MEM }
> +return [expr { [check_vect_slp_vnqihi_store_usage $pattern ] != 0 }]
> +}
>
> When should this selector be used?  In cases involving 4-byte
> char stores?  Only naturally aligned 4-bytes stores (i.e., on
> a 4 byte boundary, as the check_vect_slp_vnqihi_store_usage
> suggests?) Or 4-byte stores of any types (e.g., four chars
> as well as two 16-bit shorts), etc.?
>
> Hopefully once all the warnings handle vectorization we won't
> need to use them, but until then it would be good to document
> this in more detail in the .exp file.
>
> Finally, thank you for adding comments to the xfailed tests
> referencing the corresponding bugs!  Can you please mention
> the PR in the comment in each of the new xfails?  Like so:
>
> index 7d29b5f48c7..cb687c69324 100644
> --- a/gcc/testsuite/c-c++-common/Wstringop-overflow-2.c
> +++ b/gcc/testsuite/c-c++-common/Wstringop-overflow-2.c
> @@ -189,8 +189,9 @@ void ga1__ (void)
>
> struct A1 a = { 1 };
> a.a[0] = 0;
> +  // O2 vectorization regress Wstringop-overflow case (1), refer to
> pr102462.
> a.a[1] = 1;// { dg-warning
> "\\\[-Wstringop-overflow" }
> -  a.a[2] = 2;// { dg-warning
> "\\\[-Wstringop-overflow" "" { xfail { i?86-*-* x86_64-*-* } } }
> +  a.a[2] = 2;// { dg-warning
> "\\\[-Wstringop-overflow" "pr102462" { xfail { vect_slp_v2qi_store } } }
> 
> PR in dg-warning comment.
>
> This should make it easier to deal with the XFAILs once
> the warnings have improved to handle vectorization.
Will do.
>
> Martin



-- 
BR,
Hongtao


Re: [PATCH] Adjust testcase for O2 vectorization.

2021-10-15 Thread Martin Sebor via Gcc-patches

On 10/14/21 1:11 AM, liuhongt wrote:

Hi Kewen:
   Cound you help to verify if this patch fix those regressions
for rs6000 port.

As discussed in [1], this patch add xfail/target selector to those
testcases, also make a copy of them so that they can be tested w/o
vectorization.


Just to make sure I understand what's happening with the tests:
the new -N-novec.c tests consist of just the casses xfailed due
to vectorizartion in the corresponding -N.c tests?  Or are there
some other differences (e.g., new cases in them, etc.)?  I'd
hope to eventually remove the -novec.c tests once all warnings
behave as expected with vectorization as without it (maybe
keeping just one case both ways as a sanity check).

For the target-supports selectors, I confess I don't know enough
about vectorization to find their names quite intuitive enough
to know when to use each.  For instance, for vect_slp_v4qi_store:

+# Return the true if target support vectorization of v4qi store.
+proc check_effective_target_vect_slp_v4qi_store { } {
+set pattern {add new stmt: MEM }
+return [expr { [check_vect_slp_vnqihi_store_usage $pattern ] != 0 }]
+}

When should this selector be used?  In cases involving 4-byte
char stores?  Only naturally aligned 4-bytes stores (i.e., on
a 4 byte boundary, as the check_vect_slp_vnqihi_store_usage
suggests?) Or 4-byte stores of any types (e.g., four chars
as well as two 16-bit shorts), etc.?

Hopefully once all the warnings handle vectorization we won't
need to use them, but until then it would be good to document
this in more detail in the .exp file.

Finally, thank you for adding comments to the xfailed tests
referencing the corresponding bugs!  Can you please mention
the PR in the comment in each of the new xfails?  Like so:

index 7d29b5f48c7..cb687c69324 100644
--- a/gcc/testsuite/c-c++-common/Wstringop-overflow-2.c
+++ b/gcc/testsuite/c-c++-common/Wstringop-overflow-2.c
@@ -189,8 +189,9 @@ void ga1__ (void)

   struct A1 a = { 1 };
   a.a[0] = 0;
+  // O2 vectorization regress Wstringop-overflow case (1), refer to 
pr102462.
   a.a[1] = 1;// { dg-warning 
"\\\[-Wstringop-overflow" }
-  a.a[2] = 2;// { dg-warning 
"\\\[-Wstringop-overflow" "" { xfail { i?86-*-* x86_64-*-* } } }
+  a.a[2] = 2;// { dg-warning 
"\\\[-Wstringop-overflow" "pr102462" { xfail { vect_slp_v2qi_store } } }

   
   PR in dg-warning comment.

This should make it easier to deal with the XFAILs once
the warnings have improved to handle vectorization.

Martin


Re: [PATCH] Adjust testcase for O2 vectorization.

2021-10-15 Thread Kewen.Lin via Gcc-patches
on 2021/10/14 下午6:56, Kewen.Lin via Gcc-patches wrote:
> Hi Hongtao,
> 
> on 2021/10/14 下午3:11, liuhongt wrote:
>> Hi Kewen:
>>   Cound you help to verify if this patch fix those regressions
>> for rs6000 port.
>>
> 
> The ppc64le run just finished, there are still some regresssions:
> 
> NA->XPASS: c-c++-common/Wstringop-overflow-2.c  -Wc++-compat   (test for 
> warnings, line 194)
> NA->XPASS: c-c++-common/Wstringop-overflow-2.c  -Wc++-compat   (test for 
> warnings, line 212)
> NA->XPASS: c-c++-common/Wstringop-overflow-2.c  -Wc++-compat   (test for 
> warnings, line 296)
> NA->XPASS: c-c++-common/Wstringop-overflow-2.c  -Wc++-compat   (test for 
> warnings, line 314)
> NA->FAIL: gcc.dg/Wstringop-overflow-21-novec.c (test for excess errors)
> NA->FAIL: gcc.dg/Wstringop-overflow-21-novec.c  (test for warnings, line 18)
> NA->FAIL: gcc.dg/Wstringop-overflow-21-novec.c  (test for warnings, line 29)
> NA->FAIL: gcc.dg/Wstringop-overflow-21-novec.c  (test for warnings, line 45)
> NA->FAIL: gcc.dg/Wstringop-overflow-21-novec.c  (test for warnings, line 55)
> NA->FAIL: gcc.dg/Wstringop-overflow-76-novec.c note (test for warnings, line 
> 104)
> NA->FAIL: gcc.dg/Wstringop-overflow-76-novec.c note (test for warnings, line 
> 137)
> NA->FAIL: gcc.dg/Wstringop-overflow-76-novec.c note (test for warnings, line 
> 19)
> NA->FAIL: gcc.dg/Wstringop-overflow-76-novec.c note (test for warnings, line 
> 39)
> NA->FAIL: gcc.dg/Wstringop-overflow-76-novec.c note (test for warnings, line 
> 56)
> NA->FAIL: gcc.dg/Wstringop-overflow-76-novec.c note (test for warnings, line 
> 70)
> NA->FAIL: gcc.dg/Wstringop-overflow-76-novec.c (test for excess errors)
> NA->FAIL: gcc.dg/Wstringop-overflow-76-novec.c  (test for warnings, line 116)
> NA->FAIL: gcc.dg/Wstringop-overflow-76-novec.c  (test for warnings, line 131)
> NA->FAIL: gcc.dg/Wstringop-overflow-76-novec.c  (test for warnings, line 146)
> NA->FAIL: gcc.dg/Wstringop-overflow-76-novec.c  (test for warnings, line 33)
> NA->FAIL: gcc.dg/Wstringop-overflow-76-novec.c  (test for warnings, line 50)
> NA->FAIL: gcc.dg/Wstringop-overflow-76-novec.c  (test for warnings, line 64)
> NA->FAIL: gcc.dg/Wstringop-overflow-76-novec.c  (test for warnings, line 78)
> NA->FAIL: gcc.dg/Wstringop-overflow-76-novec.c  (test for warnings, line 97)
> PASS->FAIL: c-c++-common/Wstringop-overflow-2.c  -std=gnu++14 (test for 
> excess errors)
> NA->FAIL: c-c++-common/Wstringop-overflow-2.c  -std=gnu++14  (test for 
> warnings, line 229)
> NA->FAIL: c-c++-common/Wstringop-overflow-2.c  -std=gnu++14  (test for 
> warnings, line 230)
> NA->FAIL: c-c++-common/Wstringop-overflow-2.c  -std=gnu++14  (test for 
> warnings, line 331)
> NA->FAIL: c-c++-common/Wstringop-overflow-2.c  -std=gnu++14  (test for 
> warnings, line 332)
> // omitting -std=gnu++17, -std=gnu++2a, -std=gnu++98
> 
> I'll have a look and get back to you tomorrow.
> 

The failure c-c++-common/Wstringop-overflow-2.c is due to that the
current proc check_vect_slp_vnqihi_store_usage is made as "cache"
but it can vary for different input patterns.  For rs6000 the test
for v2qi fails, the cached test result makes v4qi check fail
unexpectedly (should pass).  I adjusted caching for the following users
check_effective_target_vect_slp_v*_store, also refactored a bit.
One trivial change is to add one new argument macro then we can just
compile the corresponding foo* function instead of all, hope it helps
to make the debugging outputs compact.

For the failure Wstringop-overflow-76-novec.c, there is one typo
comparing to the original Wstringop-overflow-76.c.  Guess it failed
on x86 too?  It would be surprising if it passes on x86.
As to the failure Wstringop-overflow-21-novec.c, I confirmed it's
just noise, patching typos caused this failure.

One new round ppc64le testing just finished with below diff and all
previous regressions are fixed without any new regressions.


diff --git a/gcc/testsuite/gcc.dg/Wstringop-overflow-76-novec.c 
b/gcc/testsuite/gcc.dg/Wstringop-overflow-76-novec.c
index d000b587a65..1132348c5f4 100644
--- a/gcc/testsuite/gcc.dg/Wstringop-overflow-76-novec.c
+++ b/gcc/testsuite/gcc.dg/Wstringop-overflow-76-novec.c
@@ -82,7 +82,7 @@ void max_d8_p (char *q, int i)
 struct A3_5
 {
   char a3[3];  // { dg-message "at offset 3 into destination object 'a3' of 
size 3" "pr??" { xfail *-*-* } }
-  char a5[5];
+  char a5[5];  // { dg-message "at offset 5 into destination object 'a5' of 
size 5" "note" }
 };

 void max_A3_A5 (int i, struct A3_5 *pa3_5)
diff --git a/gcc/testsuite/lib/target-supports.exp 
b/gcc/testsuite/lib/target-supports.exp
index 530c5769614..8736b908ec7 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -7584,12 +7584,13 @@ proc 
check_effective_target_vect_element_align_preferred { } {
 # Return zero if the desirable pattern isn't found.
 # It's used by Warray-bounds/Wstringop-overflow testcases which are
 # regressed by O2 vectorization, refer to 

Re: [PATCH] Adjust testcase for O2 vectorization.

2021-10-14 Thread Kewen.Lin via Gcc-patches
Hi Hongtao,

on 2021/10/14 下午3:11, liuhongt wrote:
> Hi Kewen:
>   Cound you help to verify if this patch fix those regressions
> for rs6000 port.
> 

The ppc64le run just finished, there are still some regresssions:

NA->XPASS: c-c++-common/Wstringop-overflow-2.c  -Wc++-compat   (test for 
warnings, line 194)
NA->XPASS: c-c++-common/Wstringop-overflow-2.c  -Wc++-compat   (test for 
warnings, line 212)
NA->XPASS: c-c++-common/Wstringop-overflow-2.c  -Wc++-compat   (test for 
warnings, line 296)
NA->XPASS: c-c++-common/Wstringop-overflow-2.c  -Wc++-compat   (test for 
warnings, line 314)
NA->FAIL: gcc.dg/Wstringop-overflow-21-novec.c (test for excess errors)
NA->FAIL: gcc.dg/Wstringop-overflow-21-novec.c  (test for warnings, line 18)
NA->FAIL: gcc.dg/Wstringop-overflow-21-novec.c  (test for warnings, line 29)
NA->FAIL: gcc.dg/Wstringop-overflow-21-novec.c  (test for warnings, line 45)
NA->FAIL: gcc.dg/Wstringop-overflow-21-novec.c  (test for warnings, line 55)
NA->FAIL: gcc.dg/Wstringop-overflow-76-novec.c note (test for warnings, line 
104)
NA->FAIL: gcc.dg/Wstringop-overflow-76-novec.c note (test for warnings, line 
137)
NA->FAIL: gcc.dg/Wstringop-overflow-76-novec.c note (test for warnings, line 19)
NA->FAIL: gcc.dg/Wstringop-overflow-76-novec.c note (test for warnings, line 39)
NA->FAIL: gcc.dg/Wstringop-overflow-76-novec.c note (test for warnings, line 56)
NA->FAIL: gcc.dg/Wstringop-overflow-76-novec.c note (test for warnings, line 70)
NA->FAIL: gcc.dg/Wstringop-overflow-76-novec.c (test for excess errors)
NA->FAIL: gcc.dg/Wstringop-overflow-76-novec.c  (test for warnings, line 116)
NA->FAIL: gcc.dg/Wstringop-overflow-76-novec.c  (test for warnings, line 131)
NA->FAIL: gcc.dg/Wstringop-overflow-76-novec.c  (test for warnings, line 146)
NA->FAIL: gcc.dg/Wstringop-overflow-76-novec.c  (test for warnings, line 33)
NA->FAIL: gcc.dg/Wstringop-overflow-76-novec.c  (test for warnings, line 50)
NA->FAIL: gcc.dg/Wstringop-overflow-76-novec.c  (test for warnings, line 64)
NA->FAIL: gcc.dg/Wstringop-overflow-76-novec.c  (test for warnings, line 78)
NA->FAIL: gcc.dg/Wstringop-overflow-76-novec.c  (test for warnings, line 97)
PASS->FAIL: c-c++-common/Wstringop-overflow-2.c  -std=gnu++14 (test for excess 
errors)
NA->FAIL: c-c++-common/Wstringop-overflow-2.c  -std=gnu++14  (test for 
warnings, line 229)
NA->FAIL: c-c++-common/Wstringop-overflow-2.c  -std=gnu++14  (test for 
warnings, line 230)
NA->FAIL: c-c++-common/Wstringop-overflow-2.c  -std=gnu++14  (test for 
warnings, line 331)
NA->FAIL: c-c++-common/Wstringop-overflow-2.c  -std=gnu++14  (test for 
warnings, line 332)
// omitting -std=gnu++17, -std=gnu++2a, -std=gnu++98

I'll have a look and get back to you tomorrow.

BR,
Kewen

> As discussed in [1], this patch add xfail/target selector to those
> testcases, also make a copy of them so that they can be tested w/o
> vectorization.
> 
> Newly added xfail/target selectors are used to check the vectorization
> capability of continuous byte/double bytes storage, these scenarios
> are exactly the part of the testcases that regressed after O2
> vectorization.
> 
> [1] https://gcc.gnu.org/pipermail/gcc-patches/2021-October/581456.html.
> 
> gcc/testsuite/ChangeLog
> 
>   PR middle-end/102722
>   PR middle-end/102697
>   PR middle-end/102462
>   PR middle-end/102706
>   * c-c++-common/Wstringop-overflow-2.c: Adjust testcase with new
>   xfail/target selector.
>   * gcc.dg/Warray-bounds-51.c: Ditto.
>   * gcc.dg/Warray-parameter-3.c: Ditto.
>   * gcc.dg/Wstringop-overflow-14.c: Ditto.
>   * gcc.dg/Wstringop-overflow-21.c: Ditto.
>   * gcc.dg/Wstringop-overflow-68.c: Ditto.
>   * gcc.dg/Wstringop-overflow-76.c: Ditto.
>   * gcc.dg/Warray-bounds-48.c: Ditto.
>   * lib/target-supports.exp (check_vect_slp_vnqihi_store_usage):
>   New function.
>   (check_effective_target_vect_slp_v2qi_store): Ditto.
>   (check_effective_target_vect_slp_v4qi_store): Ditto.
>   (check_effective_target_vect_slp_v8qi_store): Ditto.
>   (check_effective_target_vect_slp_v16qi_store): Ditto.
>   (check_effective_target_vect_slp_v2hi_store): Ditto.
>   (check_effective_target_vect_slp_v4hi_store): Ditto.
>   * c-c++-common/Wstringop-overflow-2-novec.c: New test.
>   * gcc.dg/Warray-bounds-51-novec.c: New test.
>   * gcc.dg/Warray-bounds-48-novec.c: New test.
>   * gcc.dg/Warray-parameter-3-novec.c: New test.
>   * gcc.dg/Wstringop-overflow-14-novec.c: New test.
>   * gcc.dg/Wstringop-overflow-21-novec.c: New test.
>   * gcc.dg/Wstringop-overflow-76-novec.c: New test.
> ---
>  .../c-c++-common/Wstringop-overflow-2-novec.c | 348 +
>  .../c-c++-common/Wstringop-overflow-2.c   |  26 +-
>  gcc/testsuite/gcc.dg/Warray-bounds-48-novec.c | 364 ++
>  gcc/testsuite/gcc.dg/Warray-bounds-48.c   |   6 +-
>  gcc/testsuite/gcc.dg/Warray-bounds-51-novec.c |  61 +++
>  gcc/testsuite/gcc.dg/Warray-bounds-51.c   

Re: [PATCH] Adjust testcase for O2 vectorization.

2021-10-14 Thread Bernhard Reutner-Fischer via Gcc-patches
On Thu, 14 Oct 2021 15:11:41 +0800
liuhongt via Gcc-patches  wrote:

>   * lib/target-supports.exp (check_vect_slp_vnqihi_store_usage):
>   New function.
>   (check_effective_target_vect_slp_v2qi_store): Ditto.
>   (check_effective_target_vect_slp_v4qi_store): Ditto.
>   (check_effective_target_vect_slp_v8qi_store): Ditto.
>   (check_effective_target_vect_slp_v16qi_store): Ditto.
>   (check_effective_target_vect_slp_v2hi_store): Ditto.
>   (check_effective_target_vect_slp_v4hi_store): Ditto.

ISTM the doc bits are missing from doc/sourcebuild.texi
(Effective-Target Keywords).

thanks,


[PATCH] Adjust testcase for O2 vectorization.

2021-10-14 Thread liuhongt via Gcc-patches
Hi Kewen:
  Cound you help to verify if this patch fix those regressions
for rs6000 port.

As discussed in [1], this patch add xfail/target selector to those
testcases, also make a copy of them so that they can be tested w/o
vectorization.

Newly added xfail/target selectors are used to check the vectorization
capability of continuous byte/double bytes storage, these scenarios
are exactly the part of the testcases that regressed after O2
vectorization.

[1] https://gcc.gnu.org/pipermail/gcc-patches/2021-October/581456.html.

gcc/testsuite/ChangeLog

PR middle-end/102722
PR middle-end/102697
PR middle-end/102462
PR middle-end/102706
* c-c++-common/Wstringop-overflow-2.c: Adjust testcase with new
xfail/target selector.
* gcc.dg/Warray-bounds-51.c: Ditto.
* gcc.dg/Warray-parameter-3.c: Ditto.
* gcc.dg/Wstringop-overflow-14.c: Ditto.
* gcc.dg/Wstringop-overflow-21.c: Ditto.
* gcc.dg/Wstringop-overflow-68.c: Ditto.
* gcc.dg/Wstringop-overflow-76.c: Ditto.
* gcc.dg/Warray-bounds-48.c: Ditto.
* lib/target-supports.exp (check_vect_slp_vnqihi_store_usage):
New function.
(check_effective_target_vect_slp_v2qi_store): Ditto.
(check_effective_target_vect_slp_v4qi_store): Ditto.
(check_effective_target_vect_slp_v8qi_store): Ditto.
(check_effective_target_vect_slp_v16qi_store): Ditto.
(check_effective_target_vect_slp_v2hi_store): Ditto.
(check_effective_target_vect_slp_v4hi_store): Ditto.
* c-c++-common/Wstringop-overflow-2-novec.c: New test.
* gcc.dg/Warray-bounds-51-novec.c: New test.
* gcc.dg/Warray-bounds-48-novec.c: New test.
* gcc.dg/Warray-parameter-3-novec.c: New test.
* gcc.dg/Wstringop-overflow-14-novec.c: New test.
* gcc.dg/Wstringop-overflow-21-novec.c: New test.
* gcc.dg/Wstringop-overflow-76-novec.c: New test.
---
 .../c-c++-common/Wstringop-overflow-2-novec.c | 348 +
 .../c-c++-common/Wstringop-overflow-2.c   |  26 +-
 gcc/testsuite/gcc.dg/Warray-bounds-48-novec.c | 364 ++
 gcc/testsuite/gcc.dg/Warray-bounds-48.c   |   6 +-
 gcc/testsuite/gcc.dg/Warray-bounds-51-novec.c |  61 +++
 gcc/testsuite/gcc.dg/Warray-bounds-51.c   |   3 +-
 .../gcc.dg/Warray-parameter-3-novec.c |  89 +
 gcc/testsuite/gcc.dg/Warray-parameter-3.c |   3 +-
 .../gcc.dg/Wstringop-overflow-14-novec.c  |  56 +++
 gcc/testsuite/gcc.dg/Wstringop-overflow-14.c  |   5 +-
 .../gcc.dg/Wstringop-overflow-21-novec.c  |  59 +++
 gcc/testsuite/gcc.dg/Wstringop-overflow-21.c  |  10 +-
 gcc/testsuite/gcc.dg/Wstringop-overflow-68.c  |  17 +-
 .../gcc.dg/Wstringop-overflow-76-novec.c  | 147 +++
 gcc/testsuite/gcc.dg/Wstringop-overflow-76.c  |  26 +-
 gcc/testsuite/lib/target-supports.exp | 129 +++
 16 files changed, 1314 insertions(+), 35 deletions(-)
 create mode 100644 gcc/testsuite/c-c++-common/Wstringop-overflow-2-novec.c
 create mode 100644 gcc/testsuite/gcc.dg/Warray-bounds-48-novec.c
 create mode 100644 gcc/testsuite/gcc.dg/Warray-bounds-51-novec.c
 create mode 100644 gcc/testsuite/gcc.dg/Warray-parameter-3-novec.c
 create mode 100644 gcc/testsuite/gcc.dg/Wstringop-overflow-14-novec.c
 create mode 100644 gcc/testsuite/gcc.dg/Wstringop-overflow-21-novec.c
 create mode 100644 gcc/testsuite/gcc.dg/Wstringop-overflow-76-novec.c

diff --git a/gcc/testsuite/c-c++-common/Wstringop-overflow-2-novec.c 
b/gcc/testsuite/c-c++-common/Wstringop-overflow-2-novec.c
new file mode 100644
index 000..89e6a5c12c2
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Wstringop-overflow-2-novec.c
@@ -0,0 +1,348 @@
+/* PR middle-end/91458 - inconsistent warning for writing past the end
+   of an array member
+   { dg-do compile }
+   { dg-options "-O2 -fno-tree-vectorize -Wall -Wno-array-bounds -fno-ipa-icf" 
} */
+
+void sink (void*);
+
+// Exercise flexible array members.
+
+struct Ax
+{
+  char n;
+  char a[]; // { dg-message "destination object" "note" }
+};
+
+// Verify warning for a definition with no initializer.
+struct Ax ax_;
+
+void gax_ (void)
+{
+  ax_.a[0] = 0; // { dg-warning "\\\[-Wstringop-overflow" }
+  ax_.a[1] = 1; // { dg-warning "\\\[-Wstringop-overflow" }
+  ax_.a[2] = 2; // { dg-warning "\\\[-Wstringop-overflow" }
+}
+
+// Verify warning for access to a definition with an initializer that doesn't
+// initialize the flexible array member.
+struct Ax ax0 = { 0 };
+
+void gax0 (void)
+{
+  ax0.a[0] = 0; // { dg-warning "\\\[-Wstringop-overflow" }
+  ax0.a[1] = 1; // { dg-warning "\\\[-Wstringop-overflow" }
+  ax0.a[2] = 2; // { dg-warning "\\\[-Wstringop-overflow" }
+}
+
+// Verify warning for access to a definition with an initializer that
+// initializes the flexible array member to empty.
+struct Ax ax0_ = { 0, { } };
+

[PATCH] Adjust testcase for O2 vectorization[Wuninitialized]

2021-10-12 Thread liuhongt via Gcc-patches
As discussed in PR.
It looks like it's just the the location of the warning that's off,
the warning itself is still issued but it's swallowed by the
dg-prune-output directive.

Since the test was added to verify the fix for an ICE without
vectorization I think disabling vectorization should be fine.
Ideally, we would understand why the location is wrong so let's keep
this bug open and add a comment to the test referencing this bug.

Pushed to trunk.

gcc/testsuite/ChangeLog:

* g++.dg/warn/Wuninitialized-13.C: Add -fno-tree-vectorize.
---
 gcc/testsuite/g++.dg/warn/Wuninitialized-13.C | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/gcc/testsuite/g++.dg/warn/Wuninitialized-13.C 
b/gcc/testsuite/g++.dg/warn/Wuninitialized-13.C
index 210e74c3c3b..e92978f809a 100644
--- a/gcc/testsuite/g++.dg/warn/Wuninitialized-13.C
+++ b/gcc/testsuite/g++.dg/warn/Wuninitialized-13.C
@@ -1,11 +1,14 @@
 /* PR c/98597 - ICE in -Wuninitialized printing a MEM_REF
{ dg-do compile }
-   { dg-options "-O2 -Wall" } */
+   { dg-options "-O2 -Wall -fno-tree-vectorize" } */
 
+/* After vectorization, the location of the warning that's off,
+   the warning itself is still issued but it's swallowed by
+   the dg-prune-output directive. Refer to pr102700.  */
 struct shared_count {
   shared_count () { }
   shared_count (shared_count )
-: pi (r.pi) { } // { dg-warning "\\\[-Wuninitialized" "" { xfail { 
i?86-*-* x86_64-*-* } } }
+: pi (r.pi) { } // { dg-warning "\\\[-Wuninitialized"}
   int pi;
 };
 
-- 
2.18.1



Re: [PATCH] Adjust testcase for O2 vectorization enabling.

2021-10-11 Thread H.J. Lu via Gcc-patches
On Sun, Oct 10, 2021 at 10:19 PM liuhongt  wrote:
>
> gcc/testsuite/ChangeLog:
>
> PR middle-end/102669
> * gnat.dg/unroll1.adb: Add -fno-tree-vectorize.
> ---
>  gcc/testsuite/gnat.dg/unroll1.adb | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/gcc/testsuite/gnat.dg/unroll1.adb 
> b/gcc/testsuite/gnat.dg/unroll1.adb
> index 34d8a8f3f38..8b732dd8f44 100644
> --- a/gcc/testsuite/gnat.dg/unroll1.adb
> +++ b/gcc/testsuite/gnat.dg/unroll1.adb
> @@ -1,5 +1,5 @@
>  -- { dg-do compile }
> --- { dg-options "-O2 -funroll-all-loops -fdump-rtl-loop2_unroll-details 
> -fdump-tree-cunrolli-details" }
> +-- { dg-options "-O2 -funroll-all-loops -fno-tree-vectorize 
> -fdump-rtl-loop2_unroll-details -fdump-tree-cunrolli-details" }
>
>  package body Unroll1 is

Should no-unroll pragma work with -ftree-vectorize?


-- 
H.J.


[PATCH] Adjust testcase for O2 vectorization enabling.

2021-10-10 Thread liuhongt via Gcc-patches
gcc/testsuite/ChangeLog:

PR middle-end/102669
* gnat.dg/unroll1.adb: Add -fno-tree-vectorize.
---
 gcc/testsuite/gnat.dg/unroll1.adb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/testsuite/gnat.dg/unroll1.adb 
b/gcc/testsuite/gnat.dg/unroll1.adb
index 34d8a8f3f38..8b732dd8f44 100644
--- a/gcc/testsuite/gnat.dg/unroll1.adb
+++ b/gcc/testsuite/gnat.dg/unroll1.adb
@@ -1,5 +1,5 @@
 -- { dg-do compile }
--- { dg-options "-O2 -funroll-all-loops -fdump-rtl-loop2_unroll-details 
-fdump-tree-cunrolli-details" }
+-- { dg-options "-O2 -funroll-all-loops -fno-tree-vectorize 
-fdump-rtl-loop2_unroll-details -fdump-tree-cunrolli-details" }
 
 package body Unroll1 is
 
-- 
2.18.1



Re: [PATCH] Adjust testcase for O2 vectorization enabling

2021-10-10 Thread Hongtao Liu via Gcc-patches
On Mon, Oct 11, 2021 at 10:23 AM Kewen.Lin via Gcc-patches
 wrote:
>
> Hi Hongtao,
>
> on 2021/10/11 上午10:10, liuhongt via Gcc-patches wrote:
> > libgomp/ChangeLog:
> >
> >   * testsuite/libgomp.graphite/force-parallel-8.c: Add 
> > -fno-tree-vectorize.
> > ---
> >  libgomp/testsuite/libgomp.graphite/force-parallel-8.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/libgomp/testsuite/libgomp.graphite/force-parallel-8.c 
> > b/libgomp/testsuite/libgomp.graphite/force-parallel-8.c
> > index f9e07039172..0f3d138cebd 100644
> > --- a/libgomp/testsuite/libgomp.graphite/force-parallel-8.c
> > +++ b/libgomp/testsuite/libgomp.graphite/force-parallel-8.c
> > @@ -1,4 +1,4 @@
> > -/* { dg-additional-options "-fdisable-tree-thread1 
> > -fdisable-tree-vrp-thread1" } */
> > +/* { dg-additional-options "-fdisable-tree-thread1 
> > -fdisable-tree-vrp-thread1 -fno-tree-vectorize" } */
> >
> >  #define N 1500
> >
> >
>
> Thanks for doing this!
>
> This issue was observed in rs6000 specific PR102658 as well.
>
> I've looked into it a bit, it's caused by the "conditional store replacement" 
> which
> is originally disabled without vectorization as below code.
>
>   /* If either vectorization or if-conversion is disabled then do
>  not sink any stores.  */
>   if (param_max_stores_to_sink == 0
>   || (!flag_tree_loop_vectorize && !flag_tree_slp_vectorize)
>   || !flag_tree_loop_if_convert)
> return false;
>
> The new change makes the innermost loop look like
>
> for (int c1 = 0; c1 <= 1499; c1 += 1) {
>   if (c1 <= 500) {
>  S_10(c0, c1);
>   } else {
>   S_9(c0, c1);
>   }
>   S_11(c0, c1);
> }
>
> and can not be splitted as:
>
> for (int c1 = 0; c1 <= 500; c1 += 1)
>   S_10(c0, c1);
>
> for (int c1 = 501; c1 <= 1499; c1 += 1)
>   S_9(c0, c1);
>
> So instead of disabling vectorization, could we just disable this cs 
> replacement
> with parameter "--param max-stores-to-sink=0"?
>
> I tested this proposal on ppc64le, it should work as well.
>
> What do you think of it?
I can confirm it also works for x86, I'll adjust the patch.
Thank you for the analysis.
>
> BR,
> Kewen



-- 
BR,
Hongtao


Re: [PATCH] Adjust testcase for O2 vectorization enabling

2021-10-10 Thread Kewen.Lin via Gcc-patches
Hi Hongtao,

on 2021/10/11 上午10:10, liuhongt via Gcc-patches wrote:
> libgomp/ChangeLog:
> 
>   * testsuite/libgomp.graphite/force-parallel-8.c: Add 
> -fno-tree-vectorize.
> ---
>  libgomp/testsuite/libgomp.graphite/force-parallel-8.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libgomp/testsuite/libgomp.graphite/force-parallel-8.c 
> b/libgomp/testsuite/libgomp.graphite/force-parallel-8.c
> index f9e07039172..0f3d138cebd 100644
> --- a/libgomp/testsuite/libgomp.graphite/force-parallel-8.c
> +++ b/libgomp/testsuite/libgomp.graphite/force-parallel-8.c
> @@ -1,4 +1,4 @@
> -/* { dg-additional-options "-fdisable-tree-thread1 
> -fdisable-tree-vrp-thread1" } */
> +/* { dg-additional-options "-fdisable-tree-thread1 
> -fdisable-tree-vrp-thread1 -fno-tree-vectorize" } */
>  
>  #define N 1500
>  
> 

Thanks for doing this!

This issue was observed in rs6000 specific PR102658 as well.

I've looked into it a bit, it's caused by the "conditional store replacement" 
which
is originally disabled without vectorization as below code.

  /* If either vectorization or if-conversion is disabled then do
 not sink any stores.  */
  if (param_max_stores_to_sink == 0
  || (!flag_tree_loop_vectorize && !flag_tree_slp_vectorize)
  || !flag_tree_loop_if_convert)
return false;

The new change makes the innermost loop look like

for (int c1 = 0; c1 <= 1499; c1 += 1) {
  if (c1 <= 500) {
 S_10(c0, c1);
  } else {
  S_9(c0, c1);
  }
  S_11(c0, c1);
} 

and can not be splitted as:

for (int c1 = 0; c1 <= 500; c1 += 1)
  S_10(c0, c1);

for (int c1 = 501; c1 <= 1499; c1 += 1)
  S_9(c0, c1);

So instead of disabling vectorization, could we just disable this cs replacement
with parameter "--param max-stores-to-sink=0"?

I tested this proposal on ppc64le, it should work as well.

What do you think of it?

BR,
Kewen


[PATCH] Adjust testcase for O2 vectorization enabling

2021-10-10 Thread liuhongt via Gcc-patches
libgomp/ChangeLog:

* testsuite/libgomp.graphite/force-parallel-8.c: Add 
-fno-tree-vectorize.
---
 libgomp/testsuite/libgomp.graphite/force-parallel-8.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libgomp/testsuite/libgomp.graphite/force-parallel-8.c 
b/libgomp/testsuite/libgomp.graphite/force-parallel-8.c
index f9e07039172..0f3d138cebd 100644
--- a/libgomp/testsuite/libgomp.graphite/force-parallel-8.c
+++ b/libgomp/testsuite/libgomp.graphite/force-parallel-8.c
@@ -1,4 +1,4 @@
-/* { dg-additional-options "-fdisable-tree-thread1 -fdisable-tree-vrp-thread1" 
} */
+/* { dg-additional-options "-fdisable-tree-thread1 -fdisable-tree-vrp-thread1 
-fno-tree-vectorize" } */
 
 #define N 1500
 
-- 
2.18.1



Re: [PATCH] Adjust testcase

2020-09-02 Thread Hongtao Liu via Gcc-patches
On Mon, Aug 31, 2020 at 2:19 PM Hongtao Liu  wrote:
>
> Hi:
>   This patch is to adjust testcases which failed the regression test
> when gcc is built with -march=skylake-avx512.
>   Also add runtime check for AVX512 tests.
>
> gcc/testsuite/ChangeLog:
> PR target/96246
> PR target/96855
> PR target/96856
> PR target/96857
> * g++.target/i386/avx512bw-pr96246-2.C: Add runtime check for
> AVX512BW.
> * g++.target/i386/avx512vl-pr96246-2.C: Add runtime check for
> AVX512BW and AVX512VL
> * g++.target/i386/avx512f-helper.h: New header.
> * gcc.target/i386/pr92658-avx512f.c: Add
> -mprefer-vector-width=512 to avoid impact of different default
> mtune which gcc is built with.
> * gcc.target/i386/avx512bw-pr95488-1.c: Ditto.
> * gcc.target/i386/pr92645-4.c: Add -mno-avx512f to avoid
> impact of different default march which gcc is built with.
>
>
> --
> BR,
> Hongtao

I am going to check in this patch, the patch only touches the
testcases, and wouldn't affect any functionality of GCC.

-- 
BR,
Hongtao


[PATCH] Adjust testcase

2020-08-31 Thread Hongtao Liu via Gcc-patches
Hi:
  This patch is to adjust testcases which failed the regression test
when gcc is built with -march=skylake-avx512.
  Also add runtime check for AVX512 tests.

gcc/testsuite/ChangeLog:
PR target/96246
PR target/96855
PR target/96856
PR target/96857
* g++.target/i386/avx512bw-pr96246-2.C: Add runtime check for
AVX512BW.
* g++.target/i386/avx512vl-pr96246-2.C: Add runtime check for
AVX512BW and AVX512VL
* g++.target/i386/avx512f-helper.h: New header.
* gcc.target/i386/pr92658-avx512f.c: Add
-mprefer-vector-width=512 to avoid impact of different default
mtune which gcc is built with.
* gcc.target/i386/avx512bw-pr95488-1.c: Ditto.
* gcc.target/i386/pr92645-4.c: Add -mno-avx512f to avoid
impact of different default march which gcc is built with.


-- 
BR,
Hongtao
From 80effa00835d53962608a3607ef79da243a6dc5a Mon Sep 17 00:00:00 2001
From: liuhongt 
Date: Mon, 31 Aug 2020 10:54:13 +0800
Subject: [PATCH] Adjust testcase.

gcc/testsuite/ChangeLog:
	PR target/96246
	PR target/96855
	PR target/96856
	PR target/96857
	* g++.target/i386/avx512bw-pr96246-2.C: Add runtime check for
	AVX512BW.
	* g++.target/i386/avx512vl-pr96246-2.C: Add runtime check for
	AVX512BW and AVX512VL
	* g++.target/i386/avx512f-helper.h: New header.
	* gcc.target/i386/pr92658-avx512f.c: Add
	-mprefer-vector-width=512 to avoid impact of different default
	mtune which gcc is built with.
	* gcc.target/i386/avx512bw-pr95488-1.c: Ditto.
	* gcc.target/i386/pr92645-4.c: Add -mno-avx512f to avoid
	impact of different default march which gcc is built with.
---
 .../g++.target/i386/avx512bw-pr96246-2.C  |  9 +---
 .../g++.target/i386/avx512f-helper.h  |  1 +
 .../g++.target/i386/avx512vl-pr96246-2.C  | 21 +--
 .../gcc.target/i386/avx512bw-pr95488-1.c  |  2 +-
 gcc/testsuite/gcc.target/i386/pr92645-4.c |  2 +-
 .../gcc.target/i386/pr92658-avx512f.c |  2 +-
 6 files changed, 25 insertions(+), 12 deletions(-)
 create mode 100644 gcc/testsuite/g++.target/i386/avx512f-helper.h

diff --git a/gcc/testsuite/g++.target/i386/avx512bw-pr96246-2.C b/gcc/testsuite/g++.target/i386/avx512bw-pr96246-2.C
index b96b7c7c932..30a1b959573 100644
--- a/gcc/testsuite/g++.target/i386/avx512bw-pr96246-2.C
+++ b/gcc/testsuite/g++.target/i386/avx512bw-pr96246-2.C
@@ -3,6 +3,10 @@
 /* { dg-require-effective-target avx512bw } */
 /* { dg-options "-O2 -std=c++14 -mavx512bw" } */
 
+#define AVX512BW
+
+#include "avx512f-helper.h"
+
 #include "avx512bw-pr96246-1.C"
 
 #define RUNTIME_TEST(vtype, num)			\
@@ -24,8 +28,8 @@
 }			\
   while (0)
 
-int
-main (void)
+void
+test_512 (void)
 {
   RUNTIME_TEST (v64qi, 64);
   RUNTIME_TEST (v32hi, 32);
@@ -33,5 +37,4 @@ main (void)
   RUNTIME_TEST (v8di, 8);
   RUNTIME_TEST (v16sf, 16);
   RUNTIME_TEST (v8df, 8);
-  return 0;
 }
diff --git a/gcc/testsuite/g++.target/i386/avx512f-helper.h b/gcc/testsuite/g++.target/i386/avx512f-helper.h
new file mode 100644
index 000..09b6bcbf77a
--- /dev/null
+++ b/gcc/testsuite/g++.target/i386/avx512f-helper.h
@@ -0,0 +1 @@
+#include "../../gcc.target/i386/avx512f-helper.h"
diff --git a/gcc/testsuite/g++.target/i386/avx512vl-pr96246-2.C b/gcc/testsuite/g++.target/i386/avx512vl-pr96246-2.C
index 9a16f0d2c9e..db9dce2caef 100644
--- a/gcc/testsuite/g++.target/i386/avx512vl-pr96246-2.C
+++ b/gcc/testsuite/g++.target/i386/avx512vl-pr96246-2.C
@@ -4,6 +4,11 @@
 /* { dg-require-effective-target avx512vl } */
 /* { dg-options "-O2 -std=c++14 -mavx512bw -mavx512vl" } */
 
+#define AVX512VL
+#define AVX512BW
+
+#include "avx512f-helper.h"
+
 #include "avx512vl-pr96246-1.C"
 
 #define RUNTIME_TEST(vtype, num)			\
@@ -25,17 +30,21 @@
 }			\
   while (0)
 
-int
-main (void)
+void
+test_256 (void)
 {
-  RUNTIME_TEST (v16qi, 16);
   RUNTIME_TEST (v32qi, 32);
   RUNTIME_TEST (v16hi, 16);
-  RUNTIME_TEST (v4si, 4);
   RUNTIME_TEST (v8si, 8);
-  RUNTIME_TEST (v4sf, 4);
   RUNTIME_TEST (v8sf, 8);
   RUNTIME_TEST (v4di, 4);
   RUNTIME_TEST (v4df, 4);
-  return 0;
+}
+
+void
+test_128 (void)
+{
+  RUNTIME_TEST (v16qi, 16);
+  RUNTIME_TEST (v4si, 4);
+  RUNTIME_TEST (v4sf, 4);
 }
diff --git a/gcc/testsuite/gcc.target/i386/avx512bw-pr95488-1.c b/gcc/testsuite/gcc.target/i386/avx512bw-pr95488-1.c
index 594e511868d..e6e0ac2fd82 100644
--- a/gcc/testsuite/gcc.target/i386/avx512bw-pr95488-1.c
+++ b/gcc/testsuite/gcc.target/i386/avx512bw-pr95488-1.c
@@ -1,6 +1,6 @@
 /* PR target/95488  */
 /* { dg-do compile } */
-/* { dg-options "-O2 -mavx512bw" }  */
+/* { dg-options "-O2 -mavx512bw -mprefer-vector-width=512" }  */
 /* { dg-final { scan-assembler-times "vpmovzxbw" 4 } } */
 /* { dg-final { scan-assembler-times "vpmullw\[^\n\]*zmm" 2 } } */
 /* { dg-final { scan-assembler-times "vpmovwb" 2 } } */
diff --git a/gcc/testsuite

Re: [PATCH]Adjust testcase.

2020-08-25 Thread Jeff Law via Gcc-patches
On Tue, 2020-08-25 at 22:01 +0200, Jakub Jelinek wrote:
> On Tue, Aug 25, 2020 at 01:45:01PM -0600, Jeff Law via Gcc-patches wrote:
> > On Tue, 2020-08-18 at 15:18 +0800, Hongtao Liu via Gcc-patches wrote:
> > > Hi:
> > >   Rewriting testcase with cpp source file, then compare operator could
> > > be used directly for vector, this would avoid impact of vectorizer.
> > > 
> > > gcc/testsuite/ChangeLog:
> > > PR target/96667
> > > * gcc.target/i386/avx512bw-pr96246-1.c: Moved to...
> > > * g++.target/i386/avx512bw-pr96246-1.C: ...here.
> > > * gcc.target/i386/avx512bw-pr96246-2.c: Moved to...
> > > * g++.target/i386/avx512bw-pr96246-2.C: ...here.
> > > * gcc.target/i386/avx512vl-pr96246-1.c: Moved to...
> > > * g++.target/i386/avx512vl-pr96246-1.C: ...here.
> > > * gcc.target/i386/avx512vl-pr96246-2.c: Moved to...
> > > * g++.target/i386/avx512vl-pr96246-2.C: ...here.
> > 
> > Shouldn't these go into g++.target/i386?
> 
> They should, but the patch is moving them there and the ChangeLog entry says
> that.
Good grief.  I missed that.  This patch is OK ;-)

jeff



Re: [PATCH]Adjust testcase.

2020-08-25 Thread Jakub Jelinek via Gcc-patches
On Tue, Aug 25, 2020 at 01:45:01PM -0600, Jeff Law via Gcc-patches wrote:
> On Tue, 2020-08-18 at 15:18 +0800, Hongtao Liu via Gcc-patches wrote:
> > Hi:
> >   Rewriting testcase with cpp source file, then compare operator could
> > be used directly for vector, this would avoid impact of vectorizer.
> > 
> > gcc/testsuite/ChangeLog:
> > PR target/96667
> > * gcc.target/i386/avx512bw-pr96246-1.c: Moved to...
> > * g++.target/i386/avx512bw-pr96246-1.C: ...here.
> > * gcc.target/i386/avx512bw-pr96246-2.c: Moved to...
> > * g++.target/i386/avx512bw-pr96246-2.C: ...here.
> > * gcc.target/i386/avx512vl-pr96246-1.c: Moved to...
> > * g++.target/i386/avx512vl-pr96246-1.C: ...here.
> > * gcc.target/i386/avx512vl-pr96246-2.c: Moved to...
> > * g++.target/i386/avx512vl-pr96246-2.C: ...here.
> 
> Shouldn't these go into g++.target/i386?

They should, but the patch is moving them there and the ChangeLog entry says
that.

Jakub



Re: [PATCH]Adjust testcase.

2020-08-25 Thread Jeff Law via Gcc-patches
On Tue, 2020-08-18 at 15:18 +0800, Hongtao Liu via Gcc-patches wrote:
> Hi:
>   Rewriting testcase with cpp source file, then compare operator could
> be used directly for vector, this would avoid impact of vectorizer.
> 
> gcc/testsuite/ChangeLog:
> PR target/96667
> * gcc.target/i386/avx512bw-pr96246-1.c: Moved to...
> * g++.target/i386/avx512bw-pr96246-1.C: ...here.
> * gcc.target/i386/avx512bw-pr96246-2.c: Moved to...
> * g++.target/i386/avx512bw-pr96246-2.C: ...here.
> * gcc.target/i386/avx512vl-pr96246-1.c: Moved to...
> * g++.target/i386/avx512vl-pr96246-1.C: ...here.
> * gcc.target/i386/avx512vl-pr96246-2.c: Moved to...
> * g++.target/i386/avx512vl-pr96246-2.C: ...here.

Shouldn't these go into g++.target/i386?

jeff



[PATCH]Adjust testcase.

2020-08-18 Thread Hongtao Liu via Gcc-patches
Hi:
  Rewriting testcase with cpp source file, then compare operator could
be used directly for vector, this would avoid impact of vectorizer.

gcc/testsuite/ChangeLog:
PR target/96667
* gcc.target/i386/avx512bw-pr96246-1.c: Moved to...
* g++.target/i386/avx512bw-pr96246-1.C: ...here.
* gcc.target/i386/avx512bw-pr96246-2.c: Moved to...
* g++.target/i386/avx512bw-pr96246-2.C: ...here.
* gcc.target/i386/avx512vl-pr96246-1.c: Moved to...
* g++.target/i386/avx512vl-pr96246-1.C: ...here.
* gcc.target/i386/avx512vl-pr96246-2.c: Moved to...
* g++.target/i386/avx512vl-pr96246-2.C: ...here.

-- 
BR,
Hongtao
From 51395137a777c1f9562ac7b0258acf5edf9d360d Mon Sep 17 00:00:00 2001
From: liuhongt 
Date: Tue, 18 Aug 2020 15:06:01 +0800
Subject: [PATCH] Adjust testcase.

gcc/testsuite/ChangeLog:
	PR target/96667
	* gcc.target/i386/avx512bw-pr96246-1.c: Moved to...
	* g++.target/i386/avx512bw-pr96246-1.C: ...here.
	* gcc.target/i386/avx512bw-pr96246-2.c: Moved to...
	* g++.target/i386/avx512bw-pr96246-2.C: ...here.
	* gcc.target/i386/avx512vl-pr96246-1.c: Moved to...
	* g++.target/i386/avx512vl-pr96246-1.C: ...here.
	* gcc.target/i386/avx512vl-pr96246-2.c: Moved to...
	* g++.target/i386/avx512vl-pr96246-2.C: ...here.
---
 .../i386/avx512bw-pr96246-1.C}| 11 --
 .../i386/avx512bw-pr96246-2.C}| 20 +--
 .../i386/avx512vl-pr96246-1.C}| 11 --
 .../i386/avx512vl-pr96246-2.C}| 20 +--
 4 files changed, 18 insertions(+), 44 deletions(-)
 rename gcc/testsuite/{gcc.target/i386/avx512bw-pr96246-1.c => g++.target/i386/avx512bw-pr96246-1.C} (68%)
 rename gcc/testsuite/{gcc.target/i386/avx512bw-pr96246-2.c => g++.target/i386/avx512bw-pr96246-2.C} (74%)
 rename gcc/testsuite/{gcc.target/i386/avx512vl-pr96246-1.c => g++.target/i386/avx512vl-pr96246-1.C} (73%)
 rename gcc/testsuite/{gcc.target/i386/avx512vl-pr96246-2.c => g++.target/i386/avx512vl-pr96246-2.C} (76%)

diff --git a/gcc/testsuite/gcc.target/i386/avx512bw-pr96246-1.c b/gcc/testsuite/g++.target/i386/avx512bw-pr96246-1.C
similarity index 68%
rename from gcc/testsuite/gcc.target/i386/avx512bw-pr96246-1.c
rename to gcc/testsuite/g++.target/i386/avx512bw-pr96246-1.C
index 2bfcc840a91..eec844460f1 100644
--- a/gcc/testsuite/gcc.target/i386/avx512bw-pr96246-1.c
+++ b/gcc/testsuite/g++.target/i386/avx512bw-pr96246-1.C
@@ -1,8 +1,8 @@
 /* PR target/96246 */
 /* { dg-do compile } */
-/* { dg-options "-O2 -ftree-vectorize -mavx512bw" } */
-/* { dg-final { scan-assembler-times "vpblendm\[bwdq\]\[\t ]" 4 } } */
-/* { dg-final { scan-assembler-times "vblendmp\[sd\]\[\t ]" 2 } } */
+/* { dg-options "-O2 -std=c++14 -mavx512bw" } */
+/* { dg-final { scan-assembler-times "vpblendm\[bwdq\]\[\t \]" 4 } } */
+/* { dg-final { scan-assembler-times "vblendmp\[sd\]\[\t \]" 2 } } */
 
 typedef char v64qi __attribute__((vector_size (64)));
 typedef short v32hi __attribute__((vector_size (64)));
@@ -16,10 +16,7 @@ typedef double v8df __attribute__((vector_size (64)));
   __attribute__ ((noipa))\
   foo_##vtype (vtype a, vtype b, vtype c, vtype d)	\
   {			\
-vtype e;		\
-for (int i = 0; i != num; i++)			\
-  e[i] = a[i] > b[i] ? c[i] : d[i];			\
-return e;		\
+return a > b ? c : d;\
   }
 
 COMPILE_TEST (v64qi, 64);
diff --git a/gcc/testsuite/gcc.target/i386/avx512bw-pr96246-2.c b/gcc/testsuite/g++.target/i386/avx512bw-pr96246-2.C
similarity index 74%
rename from gcc/testsuite/gcc.target/i386/avx512bw-pr96246-2.c
rename to gcc/testsuite/g++.target/i386/avx512bw-pr96246-2.C
index 422fcfe4ea8..b96b7c7c932 100644
--- a/gcc/testsuite/gcc.target/i386/avx512bw-pr96246-2.c
+++ b/gcc/testsuite/g++.target/i386/avx512bw-pr96246-2.C
@@ -1,19 +1,9 @@
 /* PR target/96246 */
 /* { dg-do run } */
 /* { dg-require-effective-target avx512bw } */
-/* { dg-options "-Ofast -mavx512bw" } */
+/* { dg-options "-O2 -std=c++14 -mavx512bw" } */
 
-#ifndef CHECK
-#define CHECK "avx512f-helper.h"
-#endif
-
-#include CHECK
-
-#ifndef TEST
-#define TEST avx512bw_test
-#endif
-
-#include "avx512bw-pr96246-1.c"
+#include "avx512bw-pr96246-1.C"
 
 #define RUNTIME_TEST(vtype, num)			\
   do			\
@@ -34,9 +24,8 @@
 }			\
   while (0)
 
-static void
-__attribute__ ((optimize (0)))
-TEST (void)
+int
+main (void)
 {
   RUNTIME_TEST (v64qi, 64);
   RUNTIME_TEST (v32hi, 32);
@@ -44,4 +33,5 @@ TEST (void)
   RUNTIME_TEST (v8di, 8);
   RUNTIME_TEST (v16sf, 16);
   RUNTIME_TEST (v8df, 8);
+  return 0;
 }
diff --git a/gcc/testsuite/gcc.target/i386/avx512vl-pr96246-1.c b/gcc/testsuite/g++.target/i386/avx512vl-pr96246-1.C
similarity index 73%
rename from gcc/testsuite/gcc.target/i386/avx512vl-pr96246-1.c
rename to gcc/testsuite/g++.target/i386/avx512vl-pr96246-1.C
index 95357d6fc84..66eb9d25f1e 

[PATCH] Adjust testcase gcc.target/i386/pr92865-1.c

2020-08-16 Thread Hongtao Liu via Gcc-patches
Hi:
  Since This testcase is used to check generation of AVX512 vector
comparison, scan-assembler for vmov instruction could be deleted, also
-mprefer-vector-width=512 is added to avoid impact of different
default arch/tune of GCC.
  Sorry for the inaccuracy of the testcase.

ChangeLog
gcc/testsuite
PR target/96574
* gcc.target/i386/pr92685-1.c: Adjust testcase.

  diff --git a/gcc/testsuite/gcc.target/i386/pr92865-1.c
b/gcc/testsuite/gcc.target/i386/pr92865-1.c
index 49b5778a067..2da6fb90b0c 100644
--- a/gcc/testsuite/gcc.target/i386/pr92865-1.c
+++ b/gcc/testsuite/gcc.target/i386/pr92865-1.c
@@ -1,12 +1,8 @@
 /* PR target/92865 */
 /* { dg-do compile } */
-/* { dg-options "-Ofast -mavx512f -mavx512bw -mxop" } */
-/* { dg-final { scan-assembler-times "vpcmp\[bwdq\]\[\t ]" 4 } } */
-/* { dg-final { scan-assembler-times "vpcmpu\[bwdq\]\[\t ]" 4 } } */
-/* { dg-final { scan-assembler-times "vmovdq\[au\]8\[\t ]" 4 } } */
-/* { dg-final { scan-assembler-times "vmovdq\[au\]16\[\t ]" 4 } } *
-/* { dg-final { scan-assembler-times "vmovdq\[au\]32\[\t ]" 4 } } */
-/* { dg-final { scan-assembler-times "vmovdq\[au\]64\[\t ]" 4 } } */
+/* { dg-options "-Ofast -mavx512f -mavx512bw -mxop
-mprefer-vector-width=512" } */
+/* { dg-final { scan-assembler-times "vpcmp\[bwdq\]\[\t
]\[^\n\{\]*zmm\[^\n\{\]*k\[0-7\](?:\n|\[ \t\]+#)" 4 } } */
+/* { dg-final { scan-assembler-times "vpcmpu\[bwdq\]\[\t
]\[^\n\{\]*zmm\[^\n\{\]*k\[0-7\](?:\n|\[ \t\]+#)" 4 } } */


--
BR,
Hongtao