From patchwork Wed Sep 2 11:17:14 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Torbj=C3=B6rn_Svensson_via_Sourceware_Forge?= X-Patchwork-Id: 142700 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3D4364BA23F4 for ; Wed, 2 Sep 2026 11:19:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3D4364BA23F4 X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from forge-stage.sourceware.org (vm08.sourceware.org [IPv6:2620:52:6:3111::39]) by sourceware.org (Postfix) with ESMTPS id 8B2A44BA2E1F for ; Wed, 2 Sep 2026 11:18:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8B2A44BA2E1F Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=forge-stage.sourceware.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=forge-stage.sourceware.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 8B2A44BA2E1F Authentication-Results: sourceware.org; arc=none smtp.remote-ip=2620:52:6:3111::39 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1788347900; cv=none; b=C3V9tlClQhrAXOaKJX4NVSnuPeJzZI8RPXdApuRNXOIridM1h0EUfJDOgW/XmBy7ZpSsfTT1F3AfwWTq4/Mpop5ExRAe7Er3KkXIqsE1lNjSO81xdKDBGrX4PYSqid13vzzt+UXv4xrTpV036iT8yyQPWIMAWiXHICPlMA9a1gU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1788347900; c=relaxed/simple; bh=H7MdQRK/j5sV+HUrQYUjTDTXt1HFl/Hl5u8RDOvQNgs=; h=From:Date:Subject:MIME-Version:To:Message-ID; b=GNagC0cSe10JVUuZBD8VEd2pS2HVLJNgtzHBcOmVOjmlnHpN1nqAWbQN28WL/+SrYSEpOILAR6Ccixna8MsO1AKUfMa8GrOtlokUjPAwXUc1NGu3Eqp8TzTNZ39fLB3QQn4VFydKN2/01hZmi66hcMlf8zKjtnQxZouaJ2k367U= ARC-Authentication-Results: i=1; sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8B2A44BA2E1F Received: from forge-stage.sourceware.org (localhost [IPv6:::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by forge-stage.sourceware.org (Postfix) with ESMTPS id 5742142592; Wed, 02 Sep 2026 11:18:20 +0000 (UTC) From: =?utf-8?q?Torbj=C3=B6rn_Svensson_via_Sourceware_Forge?= Date: Wed, 02 Sep 2026 11:17:14 +0000 Subject: [PATCH v2] testsuite: Split out known-misaligned V2QI store target [PR124342] [PR124619] MIME-Version: 1.0 To: gcc-patches mailing list Cc: richard.guenther@gmail.com, Richard.Earnshaw@arm.com Message-ID: X-Mailer: batrachomyomachia X-Pull-Request-Organization: gcc X-Pull-Request-Repository: gcc X-Pull-Request: https://forge.sourceware.org/gcc/gcc/pulls/215 X-Patch-URL: https://forge.sourceware.org/azoff/gcc/commit/3f5592502b2ba71cb4088daeae109915f431b6a9 X-Spam-Status: No, score=-8.8 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_REPLYTO, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: gcc-patches mailing list , richard.guenther@gmail.com, Richard.Earnshaw@arm.com, torbjorn.svensson@foss.st.com Errors-To: gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org From: Torbjörn SVENSSON 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. Renamed TEST_V2QI to TEST_V2QI_ALIGN and TEST_V2QI_2 to TEST_V2QI_UNALIGN. (check_effective_target_vect_slp_v2qi_store_misalign): New proc. (check_effective_target_vect_slp_v2qi_store_align): Define TEST_V2QI_ALIGN. (check_effective_target_vect_slp_v2qi_store_unalign): Define TEST_V2QI_UNALIGN. * c-c++-common/Wstringop-overflow-2.c: Use check_effective_target_vect_slp_v2qi_store_misalign. * g++.dg/warn/Wstringop-overflow-3.C: Likewise. Signed-off-by: Torbjörn SVENSSON --- Changes since v1: - Renamed define TEST_V2QI to TEST_V2QI_ALIGN - Renamed define TEST_V2QI_2 to TEST_V2QI_UNALIGN I've tested this change on top of r17-3738-gaaa0f6b1e87bc6 and r16-9620-g04c3e1efd4917e. Ok for trunk and releases/gcc-16? -- This is a forge pull request published on the gcc-patches mailing list mailing list as requested by Torbjörn Svensson via Sourceware Forge . 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-v2" "refs/versioned_pull/215/2/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-09-02 11:17:13+00:00 Changes: 4 changed files, 81 additions, 51 deletions Head revision: azoff/gcc ref pr/Wstringop-overflow commit 3f5592502b2ba71cb4088daeae109915f431b6a9 Base revision: gcc/gcc ref trunk commit aaa0f6b1e87bc62ea15da6eab431af6dcebf6414 r17-3738-gaaa0f6b1e87bc6 Merge base: aaa0f6b1e87bc62ea15da6eab431af6dcebf6414 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 | 30 +++++++++-- 4 files changed, 81 insertions(+), 51 deletions(-) Range-diff against v1: 1: 1a3f4342b3ffa ! 1: 3f5592502b2ba testsuite: Split out known-misaligned V2QI store target [PR124342] [PR124619] @@ Commit message gcc/testsuite/ChangeLog: * lib/target-supports.exp (check_vect_slp_store_usage): Add - TEST_V2QI_MISALIGN. + TEST_V2QI_MISALIGN. Renamed TEST_V2QI to TEST_V2QI_ALIGN and + TEST_V2QI_2 to TEST_V2QI_UNALIGN. (check_effective_target_vect_slp_v2qi_store_misalign): New proc. - * c-c++-common/Wstringop-overflow-2.c: Use it. + (check_effective_target_vect_slp_v2qi_store_align): Define + TEST_V2QI_ALIGN. + (check_effective_target_vect_slp_v2qi_store_unalign): Define + TEST_V2QI_UNALIGN. + * c-c++-common/Wstringop-overflow-2.c: Use + check_effective_target_vect_slp_v2qi_store_misalign. * g++.dg/warn/Wstringop-overflow-3.C: Likewise. Signed-off-by: Torbjörn SVENSSON @@ gcc/testsuite/g++.dg/warn/Wstringop-overflow-3.C: A1 a1i_1 = { 0, { 1 } }; ## gcc/testsuite/lib/target-supports.exp ## +@@ gcc/testsuite/lib/target-supports.exp: proc check_vect_slp_store_usage { pattern macro } { + { + *(AC4*)a = Ac4; + } +- #elif TEST_V2QI ++ #elif TEST_V2QI_ALIGN + struct A2 + { + char a[2]; +@@ gcc/testsuite/lib/target-supports.exp: proc check_vect_slp_store_usage { pattern macro } { + a.a[1] = 4; + sink (&a); + } +- #elif TEST_V2QI_2 ++ #elif TEST_V2QI_UNALIGN + extern char p[2]; + void + foo3_2 () @@ gcc/testsuite/lib/target-supports.exp: proc check_vect_slp_store_usage { pattern macro } { p[0] = 0; p[1] = 1; @@ gcc/testsuite/lib/target-supports.exp: proc check_vect_slp_store_usage { pattern #elif TEST_V4HI struct Ax { -@@ gcc/testsuite/lib/target-supports.exp: proc check_effective_target_vect_slp_v2qi_store_unalign { } { +@@ gcc/testsuite/lib/target-supports.exp: proc check_vect_slp_store_usage { pattern macro } { + # is the exact match of relative testcases + proc check_effective_target_vect_slp_v2qi_store_align { } { + set pattern {add new stmt: MEM } +- set macro "TEST_V2QI" ++ set macro "TEST_V2QI_ALIGN" + return [check_cached_effective_target vect_slp_v2qi_store_align { + expr [check_vect_slp_store_usage $pattern $macro] }] + } +@@ gcc/testsuite/lib/target-supports.exp: proc check_effective_target_vect_slp_v2qi_store_align { } { + # with unaligned address at plain O2. + proc check_effective_target_vect_slp_v2qi_store_unalign { } { + set pattern {add new stmt: MEM } +- set macro "TEST_V2QI_2" ++ set macro "TEST_V2QI_UNALIGN" + return [check_cached_effective_target vect_slp_v2qi_store_unalign { expr [check_vect_slp_store_usage $pattern $macro ] }] } diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi index aad51550eba40..5215d5a9529d5 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 d467e9fa3b7fd..e752532298901 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -9696,7 +9696,7 @@ proc check_vect_slp_store_usage { pattern macro } { { *(AC4*)a = Ac4; } - #elif TEST_V2QI + #elif TEST_V2QI_ALIGN struct A2 { char a[2]; @@ -9709,7 +9709,7 @@ proc check_vect_slp_store_usage { pattern macro } { a.a[1] = 4; sink (&a); } - #elif TEST_V2QI_2 + #elif TEST_V2QI_UNALIGN extern char p[2]; void foo3_2 () @@ -9717,6 +9717,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 { @@ -9812,7 +9825,7 @@ proc check_vect_slp_store_usage { pattern macro } { # is the exact match of relative testcases proc check_effective_target_vect_slp_v2qi_store_align { } { set pattern {add new stmt: MEM } - set macro "TEST_V2QI" + set macro "TEST_V2QI_ALIGN" return [check_cached_effective_target vect_slp_v2qi_store_align { expr [check_vect_slp_store_usage $pattern $macro] }] } @@ -9821,11 +9834,20 @@ proc check_effective_target_vect_slp_v2qi_store_align { } { # with unaligned address at plain O2. proc check_effective_target_vect_slp_v2qi_store_unalign { } { set pattern {add new stmt: MEM } - set macro "TEST_V2QI_2" + set macro "TEST_V2QI_UNALIGN" return [check_cached_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 } + 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