From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1923) id 190403858C62; Wed, 17 Jan 2024 19:15:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 190403858C62 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1705518912; bh=A0pW0zMZpLrOzINhs4W2chGSUbLTc8oErzAZh+RcAcU=; h=From:To:Subject:Date:From; b=L5+HwB4xp0o6CCAhsahpNJPmC/0EFF5pNakyXNDejA6uepxPDQHmmkBSKLk9wXzvV FPCqeeQhW7EIJs2qBMOZwM9pOsDSHCTVHXHS0Zn3m5tKywTBQvckhxBaQqBiluoAXb trnUhhy4ugtMZWHiE/tuAO97fjJoDFAD3e8Tbhy8= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Philipp Tomsich To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/vendors/vrull/heads/slp-improvements)] Fix: Do not rearrange splat vectors in try_rearrange_oprnd_info X-Act-Checkin: gcc X-Git-Author: Manolis Tsamis X-Git-Refname: refs/vendors/vrull/heads/slp-improvements X-Git-Oldrev: 8b4e76d1ec32f1158415f93584bb4805b7c61e4f X-Git-Newrev: e6131c9e42d5bae8586341c60ca8cb0a26b595ca Message-Id: <20240117191512.190403858C62@sourceware.org> Date: Wed, 17 Jan 2024 19:15:12 +0000 (GMT) List-Id: https://gcc.gnu.org/g:e6131c9e42d5bae8586341c60ca8cb0a26b595ca commit e6131c9e42d5bae8586341c60ca8cb0a26b595ca Author: Manolis Tsamis Date: Wed Dec 6 14:34:50 2023 +0100 Fix: Do not rearrange splat vectors in try_rearrange_oprnd_info Check that the vector elements taking part in a rearranged pattern (e.g. ABAB) are actually different. Otherwise a splat vector (AAAA) would be considered to fulfill any rearrangement pattern. We don't want to merge splat vectors together in a mixed node as that can both reduce performance and cause codegen issues. Ref #342 Diff: --- gcc/tree-vect-slp.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc index 8f2993b84f1..28defc56d29 100644 --- a/gcc/tree-vect-slp.cc +++ b/gcc/tree-vect-slp.cc @@ -1842,15 +1842,18 @@ try_rearrange_oprnd_info (vec &oprnds_info, unsigned group_size) int cur_pattern = 0; /* Check for an ABAB... pattern. */ if ((oprnd_info->def_stmts[j] == oprnd_info->def_stmts[j + 2]) - && (oprnd_info->def_stmts[j + 1] == oprnd_info->def_stmts[j + 3])) + && (oprnd_info->def_stmts[j + 1] == oprnd_info->def_stmts[j + 3]) + && (oprnd_info->def_stmts[j] != oprnd_info->def_stmts[j + 1])) cur_pattern = 1; /* Check for an AABB... pattern. */ else if ((oprnd_info->def_stmts[j] == oprnd_info->def_stmts[j + 1]) - && (oprnd_info->def_stmts[j + 2] == oprnd_info->def_stmts[j + 3])) + && (oprnd_info->def_stmts[j + 2] == oprnd_info->def_stmts[j + 3]) + && (oprnd_info->def_stmts[j] != oprnd_info->def_stmts[j + 2])) cur_pattern = 2; /* Check for an ABBA... pattern. */ else if ((oprnd_info->def_stmts[j] == oprnd_info->def_stmts[j + 3]) - && (oprnd_info->def_stmts[j + 1] == oprnd_info->def_stmts[j + 2])) + && (oprnd_info->def_stmts[j + 1] == oprnd_info->def_stmts[j + 2]) + && (oprnd_info->def_stmts[j] != oprnd_info->def_stmts[j + 1])) cur_pattern = 3; /* Unrecognised pattern. */ else