[PATCH v1] testsuite: Split out known-misaligned V2QI store target [PR124342] [PR124619]

Torbjörn Svensson via Sourceware Forge <[email protected]>
Newsgroups gmane.comp.gcc.patches
Message-ID <[email protected]>
From: Torbjörn SVENSSON <[email protected]>

vect_slp_v2qi_store_unalign tests whether the vectorizer handles a V2QI
store through a byte-aligned base, but some -Wstringop-overflow tests
instead depend on a V2QI store at a known one-byte misalignment from a
defined object.

These two variants are not the same on armv7ve with -mfloat-abi=hard.
Add a separate effective target for the latter case.

	PR testsuite/124342
	PR testsuite/124619

gcc/ChangeLog:

	* doc/sourcebuild.texi (vect_slp_v2qi_store_unalign): Document.
	(vect_slp_v2qi_store_misalign): Likewise.

gcc/testsuite/ChangeLog:

	* lib/target-supports.exp (check_vect_slp_store_usage): Add
	TEST_V2QI_MISALIGN.
	(check_effective_target_vect_slp_v2qi_store_misalign): New proc.
	* c-c++-common/Wstringop-overflow-2.c: Use it.
	* g++.dg/warn/Wstringop-overflow-3.C: Likewise.

Signed-off-by: Torbjörn SVENSSON <[email protected]>
---
I've tested this change on top of r17-2833-g32657f29f91871 and r16-9480-g967a69a03886ebd6.

Ok for trunk and releases/gcc-16?

--

vect_slp_v2qi_store_unalign tests whether the vectorizer handles a V2QI
store through a byte-aligned base, but some -Wstringop-overflow tests
instead depend on a V2QI store at a known one-byte misalignment from a
defined object.

These two variants are not the same on armv7ve with -mfloat-abi=hard.
Add a separate effective target for the latter case.

	PR testsuite/124342
	PR testsuite/124619

gcc/ChangeLog:

	* doc/sourcebuild.texi (vect_slp_v2qi_store_unalign): Document.
	(vect_slp_v2qi_store_misalign): Likewise.

gcc/testsuite/ChangeLog:

	* lib/target-supports.exp (check_vect_slp_store_usage): Add
	TEST_V2QI_MISALIGN.
	(check_effective_target_vect_slp_v2qi_store_misalign): New proc.
	* c-c++-common/Wstringop-overflow-2.c: Use it.
	* g++.dg/warn/Wstringop-overflow-3.C: Likewise.

Signed-off-by: Torbjörn SVENSSON <[email protected]>

--



This is a forge pull request published on the gcc-patches mailing list mailing list
as requested by Torbjörn Svensson via Sourceware Forge <[email protected]>.
Forge discussion: https://forge.sourceware.org/gcc/gcc/pulls/215

Get it locally using:
```
git fetch forge-upstream "+refs/versioned_pull/215/*:refs/versioned_pull/215/*"
git switch -c "pr-215-v1" "refs/versioned_pull/215/1/head"
```
Or, download the patch at: https://forge.sourceware.org/gcc/gcc/pulls/215.diff
Created on: 2026-08-10 17:42:02+00:00
Latest update: 2026-08-10 18:03:02+00:00
Changes: 4 changed files, 77 additions, 47 deletions
Head revision: azoff/gcc ref pr/Wstringop-overflow commit 1a3f4342b3ffa28514704ca226fdef1fda46a477 
Base revision: gcc/gcc ref trunk commit 32657f29f918712ad7110bd54d8ebb3bf6b0a2a8 r17-2833-g32657f29f91871
Merge base: 32657f29f918712ad7110bd54d8ebb3bf6b0a2a8
Requested Reviewers: 

Changed files:
- M: gcc/doc/sourcebuild.texi
- M: gcc/testsuite/c-c++-common/Wstringop-overflow-2.c
- M: gcc/testsuite/g++.dg/warn/Wstringop-overflow-3.C
- M: gcc/testsuite/lib/target-supports.exp

 gcc/doc/sourcebuild.texi                      |  8 +++
 .../c-c++-common/Wstringop-overflow-2.c       | 50 +++++++++----------
 .../g++.dg/warn/Wstringop-overflow-3.C        | 44 ++++++++--------
 gcc/testsuite/lib/target-supports.exp         | 22 ++++++++
 4 files changed, 77 insertions(+), 47 deletions(-)

diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi
index 2c41583ced51e..a0e78a7ca3395 100644
--- a/gcc/doc/sourcebuild.texi
+++ b/gcc/doc/sourcebuild.texi
@@ -1946,6 +1946,14 @@ Target supports loop vectorization with partial vectors and
 Target supports vectorization of 2-byte char stores with 2-byte aligned
 address at plain @option{-O2}.
 
+@item vect_slp_v2qi_store_unalign
+Target supports vectorization of 2-byte char stores with an unaligned
+address at plain @option{-O2}.
+
+@item vect_slp_v2qi_store_misalign
+Target supports vectorization of 2-byte char stores at a known one-byte
+misaligned address at plain @option{-O2}.
+
 @item vect_slp_v4qi_store_align
 Target supports vectorization of 4-byte char stores with 4-byte aligned
 address at plain @option{-O2}.
diff --git a/gcc/testsuite/c-c++-common/Wstringop-overflow-2.c b/gcc/testsuite/c-c++-common/Wstringop-overflow-2.c
index 3f9171947c252..4b0e443f28852 100644
--- a/gcc/testsuite/c-c++-common/Wstringop-overflow-2.c
+++ b/gcc/testsuite/c-c++-common/Wstringop-overflow-2.c
@@ -19,7 +19,7 @@ struct Ax ax_;
 void gax_ (void)
 {
   ax_.a[0] = 0;                 // { dg-warning "\\\[-Wstringop-overflow" }
-  ax_.a[1] = 1;                 // { dg-warning "\\\[-Wstringop-overflow" "" { xfail { vect_slp_v2qi_store_unalign } } }
+  ax_.a[1] = 1;                 // { dg-warning "\\\[-Wstringop-overflow" "" { xfail { vect_slp_v2qi_store_misalign } } }
   ax_.a[2] = 2;                 // { dg-warning "\\\[-Wstringop-overflow" }
 }
 
@@ -30,7 +30,7 @@ struct Ax ax0 = { 0 };
 void gax0 (void)
 {
   ax0.a[0] = 0;                 // { dg-warning "\\\[-Wstringop-overflow" }
-  ax0.a[1] = 1;                 // { dg-warning "\\\[-Wstringop-overflow" "" { xfail { vect_slp_v2qi_store_unalign } } }
+  ax0.a[1] = 1;                 // { dg-warning "\\\[-Wstringop-overflow" "" { xfail { vect_slp_v2qi_store_misalign } } }
   ax0.a[2] = 2;                 // { dg-warning "\\\[-Wstringop-overflow" }
 }
 
@@ -41,7 +41,7 @@ struct Ax ax0_ = { 0, { } };
 void gax0_ (void)
 {
   ax0_.a[0] = 0;                // { dg-warning "\\\[-Wstringop-overflow" }
-  ax0_.a[1] = 1;                // { dg-warning "\\\[-Wstringop-overflow" "" { xfail { vect_slp_v2qi_store_unalign } } }
+  ax0_.a[1] = 1;                // { dg-warning "\\\[-Wstringop-overflow" "" { xfail { vect_slp_v2qi_store_misalign } } }
   ax0_.a[2] = 2;                // { dg-warning "\\\[-Wstringop-overflow" }
 }
 
@@ -51,8 +51,8 @@ struct Ax ax1 = { 1, { 0 } };
 
 void gax1 (void)
 {
-  ax1.a[0] = 0;                 // { dg-warning "\\\[-Wstringop-overflow" "" { target { vect_slp_v2qi_store_unalign } } }
-  ax1.a[1] = 1;                 // { dg-warning "\\\[-Wstringop-overflow" "" { xfail { vect_slp_v2qi_store_unalign } } }
+  ax1.a[0] = 0;                 // { dg-warning "\\\[-Wstringop-overflow" "" { target { vect_slp_v2qi_store_misalign } } }
+  ax1.a[1] = 1;                 // { dg-warning "\\\[-Wstringop-overflow" "" { xfail { vect_slp_v2qi_store_misalign } } }
   ax1.a[2] = 2;                 // { dg-warning "\\\[-Wstringop-overflow" }
 }
 
@@ -100,7 +100,7 @@ struct A0 a0_;
 void ga0_ (void)
 {
   a0_.a[0] = 0;                 // { dg-warning "\\\[-Wstringop-overflow" }
-  a0_.a[1] = 1;                 // { dg-warning "\\\[-Wstringop-overflow" "" { xfail { vect_slp_v2qi_store_unalign } } }
+  a0_.a[1] = 1;                 // { dg-warning "\\\[-Wstringop-overflow" "" { xfail { vect_slp_v2qi_store_misalign } } }
   a0_.a[2] = 2;                 // { dg-warning "\\\[-Wstringop-overflow" }
 }
 
@@ -111,7 +111,7 @@ struct A0 a00 = { 0 };
 void ga00 (void)
 {
   a00.a[0] = 0;                 // { dg-warning "\\\[-Wstringop-overflow" }
-  a00.a[1] = 1;                 // { dg-warning "\\\[-Wstringop-overflow" "" { xfail { vect_slp_v2qi_store_unalign } } }
+  a00.a[1] = 1;                 // { dg-warning "\\\[-Wstringop-overflow" "" { xfail { vect_slp_v2qi_store_misalign } } }
   a00.a[2] = 2;                 // { dg-warning "\\\[-Wstringop-overflow" }
 }
 
@@ -122,7 +122,7 @@ struct A0 a00_ = { 0, { } };
 void ga00_ (void)
 {
   a00_.a[0] = 0;                // { dg-warning "\\\[-Wstringop-overflow" }
-  a00_.a[1] = 1;                // { dg-warning "\\\[-Wstringop-overflow" "" { xfail { vect_slp_v2qi_store_unalign } } }
+  a00_.a[1] = 1;                // { dg-warning "\\\[-Wstringop-overflow" "" { xfail { vect_slp_v2qi_store_misalign } } }
   a00_.a[2] = 2;                // { dg-warning "\\\[-Wstringop-overflow" }
 }
 
@@ -166,13 +166,13 @@ struct A1 a1_;
 
 void ga1_ (void)
 {
-  a1_.a[0] = 0;                 // { dg-warning "\\\[-Wstringop-overflow" "" { target { vect_slp_v2qi_store_unalign } } }
-  a1_.a[1] = 1;                 // { dg-warning "\\\[-Wstringop-overflow" "" { xfail { vect_slp_v2qi_store_unalign } } }
+  a1_.a[0] = 0;                 // { dg-warning "\\\[-Wstringop-overflow" "" { target { vect_slp_v2qi_store_misalign } } }
+  a1_.a[1] = 1;                 // { dg-warning "\\\[-Wstringop-overflow" "" { xfail { vect_slp_v2qi_store_misalign } } }
   a1_.a[2] = 2;                 // { dg-warning "\\\[-Wstringop-overflow" }
 
   struct A1 a;
-  a.a[0] = 0;                   // { dg-warning "\\\[-Wstringop-overflow" "" { target { vect_slp_v2qi_store_unalign } } }
-  a.a[1] = 1;                   // { dg-warning "\\\[-Wstringop-overflow" "" { xfail { vect_slp_v2qi_store_unalign } } }
+  a.a[0] = 0;                   // { dg-warning "\\\[-Wstringop-overflow" "" { target { vect_slp_v2qi_store_misalign } } }
+  a.a[1] = 1;                   // { dg-warning "\\\[-Wstringop-overflow" "" { xfail { vect_slp_v2qi_store_misalign } } }
   a.a[2] = 2;                   // { dg-warning "\\\[-Wstringop-overflow" }
   sink (&a);
 }
@@ -183,8 +183,8 @@ struct A1 a1__ = { 0 };
 
 void ga1__ (void)
 {
-  a1__.a[0] = 0;                 // { dg-warning "\\\[-Wstringop-overflow" "" { target { vect_slp_v2qi_store_unalign } } }
-  a1__.a[1] = 1;                 // { dg-warning "\\\[-Wstringop-overflow" "" { xfail { vect_slp_v2qi_store_unalign } } }
+  a1__.a[0] = 0;                 // { dg-warning "\\\[-Wstringop-overflow" "" { target { vect_slp_v2qi_store_misalign } } }
+  a1__.a[1] = 1;                 // { dg-warning "\\\[-Wstringop-overflow" "" { xfail { vect_slp_v2qi_store_misalign } } }
   a1__.a[2] = 2;                 // { dg-warning "\\\[-Wstringop-overflow" }
 
   struct A1 a = { 1 };
@@ -200,8 +200,8 @@ struct A1 a1_0 = { 0, { } };
 
 void ga1_0_ (void)
 {
-  a1_0.a[0] = 0;                // { dg-warning "\\\[-Wstringop-overflow" "" { target { vect_slp_v2qi_store_unalign } } }
-  a1_0.a[1] = 1;                // { dg-warning "\\\[-Wstringop-overflow" "" { xfail { vect_slp_v2qi_store_unalign } } }
+  a1_0.a[0] = 0;                // { dg-warning "\\\[-Wstringop-overflow" "" { target { vect_slp_v2qi_store_misalign } } }
+  a1_0.a[1] = 1;                // { dg-warning "\\\[-Wstringop-overflow" "" { xfail { vect_slp_v2qi_store_misalign } } }
   a1_0.a[2] = 2;                // { dg-warning "\\\[-Wstringop-overflow" }
 
   struct A1 a = { 1, { } };
@@ -217,8 +217,8 @@ struct A1 a1_1 = { 0, { 1 } };
 
 void ga1_1 (void)
 {
-  a1_1.a[0] = 0;                // { dg-warning "\\\[-Wstringop-overflow" "" { target { vect_slp_v2qi_store_unalign } } }
-  a1_1.a[1] = 1;                // { dg-warning "\\\[-Wstringop-overflow" "" { xfail { vect_slp_v2qi_store_unalign } } }
+  a1_1.a[0] = 0;                // { dg-warning "\\\[-Wstringop-overflow" "" { target { vect_slp_v2qi_store_misalign } } }
+  a1_1.a[1] = 1;                // { dg-warning "\\\[-Wstringop-overflow" "" { xfail { vect_slp_v2qi_store_misalign } } }
   a1_1.a[2] = 2;                // { dg-warning "\\\[-Wstringop-overflow" }
 
   struct A1 a = { 0, { 1 } };   // { dg-warning "\\\[-Wstringop-overflow" "pr102706" { target { vect_slp_v4qi_store_align } } }
@@ -266,12 +266,12 @@ struct A1i a1i_;
 void ga1i_ (void)
 {
   a1i_.a[0] = 0;
-  a1i_.a[1] = 1;                // { dg-warning "\\\[-Wstringop-overflow" "" { xfail { vect_slp_v2qi_store_unalign } } }
+  a1i_.a[1] = 1;                // { dg-warning "\\\[-Wstringop-overflow" "" { xfail { vect_slp_v2qi_store_misalign } } }
   a1i_.a[2] = 2;                // { dg-warning "\\\[-Wstringop-overflow" }
 
   struct A1i a;
   a.a[0] = 1;
-  a.a[1] = 2;                   // { dg-warning "\\\[-Wstringop-overflow" "" { xfail { vect_slp_v2qi_store_unalign } } }
+  a.a[1] = 2;                   // { dg-warning "\\\[-Wstringop-overflow" "" { xfail { vect_slp_v2qi_store_misalign } } }
   a.a[2] = 3;                   // { dg-warning "\\\[-Wstringop-overflow" }
   sink (&a);
 }
@@ -283,7 +283,7 @@ struct A1i a1i__ = { 0 };
 void ga1i__ (void)
 {
   a1i__.a[0] = 0;
-  a1i__.a[1] = 1;                // { dg-warning "\\\[-Wstringop-overflow" "" { xfail { vect_slp_v2qi_store_unalign } } }
+  a1i__.a[1] = 1;                // { dg-warning "\\\[-Wstringop-overflow" "" { xfail { vect_slp_v2qi_store_misalign } } }
   a1i__.a[2] = 2;                // { dg-warning "\\\[-Wstringop-overflow" }
 
   struct A1i a = { 0 };
@@ -299,8 +299,8 @@ struct A1 a1i_0 = { 0, { } };
 
 void ga1i_0_ (void)
 {
-  a1i_0.a[0] = 0;               // { dg-warning "\\\[-Wstringop-overflow" "" { target { vect_slp_v2qi_store_unalign } } }
-  a1i_0.a[1] = 1;               // { dg-warning "\\\[-Wstringop-overflow" "" { xfail { vect_slp_v2qi_store_unalign } } }
+  a1i_0.a[0] = 0;               // { dg-warning "\\\[-Wstringop-overflow" "" { target { vect_slp_v2qi_store_misalign } } }
+  a1i_0.a[1] = 1;               // { dg-warning "\\\[-Wstringop-overflow" "" { xfail { vect_slp_v2qi_store_misalign } } }
   a1i_0.a[2] = 2;               // { dg-warning "\\\[-Wstringop-overflow" }
 
   struct A1 a = { 0, { } };
@@ -316,8 +316,8 @@ struct A1 a1i_1 = { 0, { 1 } };
 
 void ga1i_1 (void)
 {
-  a1i_1.a[0] = 0;               // { dg-warning "\\\[-Wstringop-overflow" "" { target { vect_slp_v2qi_store_unalign } } }
-  a1i_1.a[1] = 1;               // { dg-warning "\\\[-Wstringop-overflow" "" { xfail { vect_slp_v2qi_store_unalign } } }
+  a1i_1.a[0] = 0;               // { dg-warning "\\\[-Wstringop-overflow" "" { target { vect_slp_v2qi_store_misalign } } }
+  a1i_1.a[1] = 1;               // { dg-warning "\\\[-Wstringop-overflow" "" { xfail { vect_slp_v2qi_store_misalign } } }
   a1i_1.a[2] = 2;               // { dg-warning "\\\[-Wstringop-overflow" }
 
   struct A1 a = { 0, { 1 } };   // { dg-warning "\\\[-Wstringop-overflow" "pr102462" { target { vect_slp_v4qi_store_align } } }
diff --git a/gcc/testsuite/g++.dg/warn/Wstringop-overflow-3.C b/gcc/testsuite/g++.dg/warn/Wstringop-overflow-3.C
index e1d547fe4d40c..0e8523b8ed182 100644
--- a/gcc/testsuite/g++.dg/warn/Wstringop-overflow-3.C
+++ b/gcc/testsuite/g++.dg/warn/Wstringop-overflow-3.C
@@ -21,7 +21,7 @@ Ax ax_;
 NOIPA void gax_ ()
 {
   ax_.a[0] = 0;                 // { dg-warning "\\\[-Wstringop-overflow" }
-  ax_.a[1] = 0;                 // { dg-warning "\\\[-Wstringop-overflow" "" { xfail { vect_slp_v2qi_store_unalign } } }
+  ax_.a[1] = 0;                 // { dg-warning "\\\[-Wstringop-overflow" "" { xfail { vect_slp_v2qi_store_misalign } } }
   ax_.a[2] = 0;                 // { dg-warning "\\\[-Wstringop-overflow" }
 }
 
@@ -32,7 +32,7 @@ Ax ax0 = { 0 };
 NOIPA void gax0 ()
 {
   ax0.a[0] = 0;                 // { dg-warning "\\\[-Wstringop-overflow" }
-  ax0.a[1] = 0;                 // { dg-warning "\\\[-Wstringop-overflow" "" { xfail { vect_slp_v2qi_store_unalign } } }
+  ax0.a[1] = 0;                 // { dg-warning "\\\[-Wstringop-overflow" "" { xfail { vect_slp_v2qi_store_misalign } } }
   ax0.a[2] = 0;                 // { dg-warning "\\\[-Wstringop-overflow" }
 }
 
@@ -43,7 +43,7 @@ Ax ax0_ = { 0, { } };
 NOIPA void gax0_ ()
 {
   ax0_.a[0] = 0;                // { dg-warning "\\\[-Wstringop-overflow" }
-  ax0_.a[1] = 0;                // { dg-warning "\\\[-Wstringop-overflow" "" { xfail { vect_slp_v2qi_store_unalign } } }
+  ax0_.a[1] = 0;                // { dg-warning "\\\[-Wstringop-overflow" "" { xfail { vect_slp_v2qi_store_misalign } } }
   ax0_.a[2] = 0;                // { dg-warning "\\\[-Wstringop-overflow" }
 }
 
@@ -53,8 +53,8 @@ Ax ax1 = { 1, { 0 } };
 
 NOIPA void gax1 ()
 {
-  ax1.a[0] = 0;                 // { dg-warning "\\\[-Wstringop-overflow" "" { target { vect_slp_v2qi_store_unalign } } }
-  ax1.a[1] = 0;                 // { dg-warning "\\\[-Wstringop-overflow" "" { xfail { vect_slp_v2qi_store_unalign } } }
+  ax1.a[0] = 0;                 // { dg-warning "\\\[-Wstringop-overflow" "" { target { vect_slp_v2qi_store_misalign } } }
+  ax1.a[1] = 0;                 // { dg-warning "\\\[-Wstringop-overflow" "" { xfail { vect_slp_v2qi_store_misalign } } }
   ax1.a[2] = 0;                 // { dg-warning "\\\[-Wstringop-overflow" }
 }
 
@@ -102,7 +102,7 @@ A0 a0_;
 NOIPA void ga0_ ()
 {
   a0_.a[0] = 0;                 // { dg-warning "\\\[-Wstringop-overflow" }
-  a0_.a[1] = 0;                 // { dg-warning "\\\[-Wstringop-overflow" "" { xfail { vect_slp_v2qi_store_unalign } } }
+  a0_.a[1] = 0;                 // { dg-warning "\\\[-Wstringop-overflow" "" { xfail { vect_slp_v2qi_store_misalign } } }
   a0_.a[2] = 0;                 // { dg-warning "\\\[-Wstringop-overflow" }
 }
 
@@ -113,7 +113,7 @@ A0 a00 = { 0 };
 NOIPA void ga00 ()
 {
   a00.a[0] = 0;                 // { dg-warning "\\\[-Wstringop-overflow" }
-  a00.a[1] = 0;                 // { dg-warning "\\\[-Wstringop-overflow" "" { xfail { vect_slp_v2qi_store_unalign } } }
+  a00.a[1] = 0;                 // { dg-warning "\\\[-Wstringop-overflow" "" { xfail { vect_slp_v2qi_store_misalign } } }
   a00.a[2] = 0;                 // { dg-warning "\\\[-Wstringop-overflow" }
 }
 
@@ -124,7 +124,7 @@ A0 a00_ = { 0, { } };
 NOIPA void ga00_ ()
 {
   a00_.a[0] = 0;                // { dg-warning "\\\[-Wstringop-overflow" }
-  a00_.a[1] = 0;                // { dg-warning "\\\[-Wstringop-overflow" "" { xfail { vect_slp_v2qi_store_unalign } } }
+  a00_.a[1] = 0;                // { dg-warning "\\\[-Wstringop-overflow" "" { xfail { vect_slp_v2qi_store_misalign } } }
   a00_.a[2] = 0;                // { dg-warning "\\\[-Wstringop-overflow" }
 }
 
@@ -168,8 +168,8 @@ A1 a1_;
 
 NOIPA void ga1_ ()
 {
-  a1_.a[0] = 0;                 // { dg-warning "\\\[-Wstringop-overflow" "" { target { vect_slp_v2qi_store_unalign } } }
-  a1_.a[1] = 0;                 // { dg-warning "\\\[-Wstringop-overflow" "" { xfail { vect_slp_v2qi_store_unalign } } }
+  a1_.a[0] = 0;                 // { dg-warning "\\\[-Wstringop-overflow" "" { target { vect_slp_v2qi_store_misalign } } }
+  a1_.a[1] = 0;                 // { dg-warning "\\\[-Wstringop-overflow" "" { xfail { vect_slp_v2qi_store_misalign } } }
   a1_.a[2] = 0;                 // { dg-warning "\\\[-Wstringop-overflow" }
 }
 
@@ -179,8 +179,8 @@ A1 a1__ = { 0 };
 
 NOIPA void ga1__ ()
 {
-  a1__.a[0] = 0;                 // { dg-warning "\\\[-Wstringop-overflow" "" { target { vect_slp_v2qi_store_unalign } } }
-  a1__.a[1] = 0;                 // { dg-warning "\\\[-Wstringop-overflow" "" { xfail { vect_slp_v2qi_store_unalign } } }
+  a1__.a[0] = 0;                 // { dg-warning "\\\[-Wstringop-overflow" "" { target { vect_slp_v2qi_store_misalign } } }
+  a1__.a[1] = 0;                 // { dg-warning "\\\[-Wstringop-overflow" "" { xfail { vect_slp_v2qi_store_misalign } } }
   a1__.a[2] = 0;                 // { dg-warning "\\\[-Wstringop-overflow" }
 }
 
@@ -190,8 +190,8 @@ A1 a1_0 = { 0, { } };
 
 NOIPA void ga1_0_ ()
 {
-  a1_0.a[0] = 0;                // { dg-warning "\\\[-Wstringop-overflow" "" { target { vect_slp_v2qi_store_unalign } } }
-  a1_0.a[1] = 0;                // { dg-warning "\\\[-Wstringop-overflow" "" { xfail { vect_slp_v2qi_store_unalign } } }
+  a1_0.a[0] = 0;                // { dg-warning "\\\[-Wstringop-overflow" "" { target { vect_slp_v2qi_store_misalign } } }
+  a1_0.a[1] = 0;                // { dg-warning "\\\[-Wstringop-overflow" "" { xfail { vect_slp_v2qi_store_misalign } } }
   a1_0.a[2] = 0;                // { dg-warning "\\\[-Wstringop-overflow" }
 }
 
@@ -201,8 +201,8 @@ A1 a1_1 = { 0, { 1 } };
 
 NOIPA void ga1_1 ()
 {
-  a1_1.a[0] = 0;                // { dg-warning "\\\[-Wstringop-overflow" "" { target { vect_slp_v2qi_store_unalign } } }
-  a1_1.a[1] = 0;                // { dg-warning "\\\[-Wstringop-overflow" "" { xfail { vect_slp_v2qi_store_unalign } } }
+  a1_1.a[0] = 0;                // { dg-warning "\\\[-Wstringop-overflow" "" { target { vect_slp_v2qi_store_misalign } } }
+  a1_1.a[1] = 0;                // { dg-warning "\\\[-Wstringop-overflow" "" { xfail { vect_slp_v2qi_store_misalign } } }
   a1_1.a[2] = 0;                // { dg-warning "\\\[-Wstringop-overflow" }
 }
 
@@ -244,7 +244,7 @@ A1i a1i_;
 NOIPA void ga1i_ ()
 {
   a1i_.a[0] = 0;
-  a1i_.a[1] = 0;                // { dg-warning "\\\[-Wstringop-overflow" "" { xfail { vect_slp_v2qi_store_unalign } } }
+  a1i_.a[1] = 0;                // { dg-warning "\\\[-Wstringop-overflow" "" { xfail { vect_slp_v2qi_store_misalign } } }
   a1i_.a[2] = 0;                // { dg-warning "\\\[-Wstringop-overflow" }
 }
 
@@ -255,7 +255,7 @@ A1i a1i__ = { 0 };
 NOIPA void ga1i__ ()
 {
   a1i__.a[0] = 0;
-  a1i__.a[1] = 0;                // { dg-warning "\\\[-Wstringop-overflow" "" { xfail { vect_slp_v2qi_store_unalign } } }
+  a1i__.a[1] = 0;                // { dg-warning "\\\[-Wstringop-overflow" "" { xfail { vect_slp_v2qi_store_misalign } } }
   a1i__.a[2] = 0;                // { dg-warning "\\\[-Wstringop-overflow" }
 }
 
@@ -265,8 +265,8 @@ A1 a1i_0 = { 0, { } };
 
 NOIPA void ga1i_0_ ()
 {
-  a1i_0.a[0] = 0;               // { dg-warning "\\\[-Wstringop-overflow" "" { target { vect_slp_v2qi_store_unalign } } }
-  a1i_0.a[1] = 0;               // { dg-warning "\\\[-Wstringop-overflow" "" { xfail { vect_slp_v2qi_store_unalign } } }
+  a1i_0.a[0] = 0;               // { dg-warning "\\\[-Wstringop-overflow" "" { target { vect_slp_v2qi_store_misalign } } }
+  a1i_0.a[1] = 0;               // { dg-warning "\\\[-Wstringop-overflow" "" { xfail { vect_slp_v2qi_store_misalign } } }
   a1i_0.a[2] = 0;               // { dg-warning "\\\[-Wstringop-overflow" }
 }
 
@@ -276,8 +276,8 @@ A1 a1i_1 = { 0, { 1 } };
 
 NOIPA void ga1i_1 ()
 {
-  a1i_1.a[0] = 0;               // { dg-warning "\\\[-Wstringop-overflow" "" { target { vect_slp_v2qi_store_unalign } } }
-  a1i_1.a[1] = 0;               // { dg-warning "\\\[-Wstringop-overflow" "" { xfail { vect_slp_v2qi_store_unalign } } }
+  a1i_1.a[0] = 0;               // { dg-warning "\\\[-Wstringop-overflow" "" { target { vect_slp_v2qi_store_misalign } } }
+  a1i_1.a[1] = 0;               // { dg-warning "\\\[-Wstringop-overflow" "" { xfail { vect_slp_v2qi_store_misalign } } }
   a1i_1.a[2] = 0;               // { dg-warning "\\\[-Wstringop-overflow" }
 }
 
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 42cbb5ce3df0d..d6878c6f2c3e1 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -9667,6 +9667,19 @@ proc check_vect_slp_store_usage { pattern macro } {
 	    p[0] = 0;
 	    p[1] = 1;
 	}
+	#elif TEST_V2QI_MISALIGN
+	struct A2
+	{
+	    char n;
+	    char a[2];
+	};
+	struct A2 p __attribute__ ((aligned (2)));
+	void
+	foo3_misalign ()
+	{
+	    p.a[0] = 0;
+	    p.a[1] = 1;
+	}
 	#elif TEST_V4HI
 	struct Ax
 	{
@@ -9776,6 +9789,15 @@ proc check_effective_target_vect_slp_v2qi_store_unalign { } {
 	expr [check_vect_slp_store_usage $pattern $macro ] }]
 }
 
+# Return the true if target support vectorization of 2-byte char stores
+# with a known one-byte misaligned address at plain O2.
+proc check_effective_target_vect_slp_v2qi_store_misalign { } {
+    set pattern {add new stmt: MEM <vector\(2\) char>}
+    set macro "TEST_V2QI_MISALIGN"
+    return [check_cached_effective_target vect_slp_v2qi_store_misalign {
+	expr [check_vect_slp_store_usage $pattern $macro ] }]
+}
+
 # Return the true if target support vectorization of 4-byte char stores
 # with 4-byte aligned address at plain O2.
 # NB: This target should be removed after real issues are fixed for
-- 
2.54.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.