Message ID | YkHiFLLuHIS4R59K@toto.the-meissners.org |
---|---|
State | New |
Headers |
Return-Path: <gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BA5FA3858036 for <patchwork@sourceware.org>; Mon, 28 Mar 2022 16:28:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BA5FA3858036 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1648484919; bh=gzTkSL4YQXPl+YCUq2utDRBOeRryk1qriCPoaAtYD2k=; h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=bmBvSj393WnwPHbMuisDA/iQNKS+5AJhV6lYny8rdf22Zl4tuJ8NVkoOsO7tYJy36 68en0Yy6yqRRhinpb0Y1MSSF/LZr3aX2GYdahgGY6IjObKYX9TnVDO41sf7Jd6/cRE Edr1YRKmkuTCNxfOnc7HSafYT9seE//eVwUCzKL8= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id 661B23857C4D for <gcc-patches@gcc.gnu.org>; Mon, 28 Mar 2022 16:28:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 661B23857C4D Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 22SFIfH6007073; Mon, 28 Mar 2022 16:28:09 GMT Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3f3fj31e8v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 28 Mar 2022 16:28:08 +0000 Received: from m0098396.ppops.net (m0098396.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 22SGE91v008244; Mon, 28 Mar 2022 16:28:08 GMT Received: from ppma03wdc.us.ibm.com (ba.79.3fa9.ip4.static.sl-reverse.com [169.63.121.186]) by mx0a-001b2d01.pphosted.com with ESMTP id 3f3fj31e8f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 28 Mar 2022 16:28:08 +0000 Received: from pps.filterd (ppma03wdc.us.ibm.com [127.0.0.1]) by ppma03wdc.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 22SGHMkH003604; Mon, 28 Mar 2022 16:28:07 GMT Received: from b03cxnp07029.gho.boulder.ibm.com (b03cxnp07029.gho.boulder.ibm.com [9.17.130.16]) by ppma03wdc.us.ibm.com with ESMTP id 3f1tf9efy4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 28 Mar 2022 16:28:07 +0000 Received: from b03ledav003.gho.boulder.ibm.com (b03ledav003.gho.boulder.ibm.com [9.17.130.234]) by b03cxnp07029.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 22SGS6P333816966 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 28 Mar 2022 16:28:06 GMT Received: from b03ledav003.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 243B86A054; Mon, 28 Mar 2022 16:28:06 +0000 (GMT) Received: from b03ledav003.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A0D8B6A047; Mon, 28 Mar 2022 16:28:05 +0000 (GMT) Received: from toto.the-meissners.org (unknown [9.65.244.27]) by b03ledav003.gho.boulder.ibm.com (Postfix) with ESMTPS; Mon, 28 Mar 2022 16:28:05 +0000 (GMT) Date: Mon, 28 Mar 2022 12:28:04 -0400 To: Michael Meissner <meissner@linux.ibm.com>, gcc-patches@gcc.gnu.org, Segher Boessenkool <segher@kernel.crashing.org>, David Edelsohn <dje.gcc@gmail.com>, Peter Bergner <bergner@linux.ibm.com>, Will Schmidt <will_schmidt@vnet.ibm.com> Subject: [PATCH 3/4] Make vsx_extract_<mode> use correct insn attributes, PR target 99293. Message-ID: <YkHiFLLuHIS4R59K@toto.the-meissners.org> Mail-Followup-To: Michael Meissner <meissner@linux.ibm.com>, gcc-patches@gcc.gnu.org, Segher Boessenkool <segher@kernel.crashing.org>, David Edelsohn <dje.gcc@gmail.com>, Peter Bergner <bergner@linux.ibm.com>, Will Schmidt <will_schmidt@vnet.ibm.com> References: <YkHhL5rL39UoKIHC@toto.the-meissners.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <YkHhL5rL39UoKIHC@toto.the-meissners.org> X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 5IfdjZmyIrSpl0c9DXzAWf34P7w1_-Be X-Proofpoint-GUID: l5ehJnf48DLb8RvzVnAnZq62ZdDG7hSj X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.850,Hydra:6.0.425,FMLib:17.11.64.514 definitions=2022-03-28_07,2022-03-28_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 bulkscore=0 adultscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 spamscore=0 priorityscore=1501 phishscore=0 suspectscore=0 clxscore=1015 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2203280090 X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> From: Michael Meissner via Gcc-patches <gcc-patches@gcc.gnu.org> Reply-To: Michael Meissner <meissner@linux.ibm.com> Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org> |
Series |
Optimize vec_splats of vec_extract, PR target/99293
|
|
Commit Message
Michael Meissner
March 28, 2022, 4:28 p.m. UTC
Make vsx_extract_<mode> use correct insn attributes, PR target 99293. In looking at PR target/99293, I noticed that the insn "type" attribute is incorrect for the vsx_extract_<mode> insns. In particular: 1) Simple vector register move should be vecmove (alternative 1); 2) Xxpermdi should be vecperm (alternative 2); (and) 3) Mfvsrld should be mfvsr (alternative 4). This patch fixes those attributes. I have built the spec 2017 benchmark with this patch (#3) and the previous patch (#2), along with the first patch in the series for power9 and power10 targets. Most of the floating point benchmarks changed code slightly, due to the scheduling changes that came from changing the insn type attribute. I ran the spec 2017 suite on power9, and I did not not notice any significant changes from these changes. The power9 benchmarks that had code differences with these 2 patches applied in addition to the build with just the first patch applied were: namd_r, pareset_r, povray_r, wrf_r, blender_r, cam4_r, deepsjeng_r, imagick_r, roms_r The power9 benchmarks that had code differences with these 2 patches applied in addition to the build with just the first patch applied were (cactuBSSN_r had changes for power10 but not power9): cactuBSSN_r, namd_r, pareset_r, povray_r, wrf_r, blender_r, cam4_r, deepsjeng_r, imagick_r, nab_r, roms_r I have built bootstrap versions on the following systems. There were no regressions in the runs: Power9 little endian, --with-cpu=power9 Power10 little endian, --with-cpu=power10 Power8 big endian, --with-cpu=power8 (both 32-bit & 64-bit tests) Can I install this into the trunk? After a burn-in period, can I backport and install this into GCC 11 and GCC 10 branches? 2022-03-28 Michael Meissner <meissner@linux.ibm.com> gcc/ PR target/99293 * config/rs6000/rs6000.md (vsx_extract_<mode>): Use the correct insn type for the alternatives. --- gcc/config/rs6000/vsx.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Comments
Hi! On Mon, Mar 28, 2022 at 12:28:04PM -0400, Michael Meissner wrote: > In looking at PR target/99293, I noticed that the insn "type" attribute is > incorrect for the vsx_extract_<mode> insns. In particular: > > 1) Simple vector register move should be vecmove (alternative 1); > 2) Xxpermdi should be vecperm (alternative 2); (and) > 3) Mfvsrld should be mfvsr (alternative 4). > > This patch fixes those attributes. But the code does not correspond well to the alternatives, even worse for BE. It would be much clearer (and even possibly correct!) if it would just use the alternative # in the code, instead of using twenty different conditions. There are some important cases that have no alternative right now, like, when op 1 is the same as op 0: it should have the constraint "0" for op 1 then, and have cost 0. The register allocator will then hopefully try to make that happen. > --- a/gcc/config/rs6000/vsx.md > +++ b/gcc/config/rs6000/vsx.md > @@ -3451,7 +3451,7 @@ (define_insn "vsx_extract_<mode>" > else > gcc_unreachable (); > } > - [(set_attr "type" "veclogical,mfvsr,mfvsr,vecperm") > + [(set_attr "type" "vecmove,vecperm,mfvsr,mfvsr") > (set_attr "isa" "*,*,p8v,p9v")]) The generated code is one of no-op mfvsrd fmr xxlor mfvsrld xxpermdi Which of the 4 alts are meant to correspond to which of those six possible generated pieces of code? Segher
On Mon, Mar 28, 2022 at 05:06:00PM -0500, Segher Boessenkool wrote: > Hi! > > On Mon, Mar 28, 2022 at 12:28:04PM -0400, Michael Meissner wrote: > > In looking at PR target/99293, I noticed that the insn "type" attribute is > > incorrect for the vsx_extract_<mode> insns. In particular: > > > > 1) Simple vector register move should be vecmove (alternative 1); > > 2) Xxpermdi should be vecperm (alternative 2); (and) > > 3) Mfvsrld should be mfvsr (alternative 4). > > > > This patch fixes those attributes. > > But the code does not correspond well to the alternatives, even worse > for BE. It would be much clearer (and even possibly correct!) if it > would just use the alternative # in the code, instead of using twenty > different conditions. There are some important cases that have no > alternative right now, like, when op 1 is the same as op 0: it should > have the constraint "0" for op 1 then, and have cost 0. The register > allocator will then hopefully try to make that happen. > > > --- a/gcc/config/rs6000/vsx.md > > +++ b/gcc/config/rs6000/vsx.md > > @@ -3451,7 +3451,7 @@ (define_insn "vsx_extract_<mode>" > > else > > gcc_unreachable (); > > } > > - [(set_attr "type" "veclogical,mfvsr,mfvsr,vecperm") > > + [(set_attr "type" "vecmove,vecperm,mfvsr,mfvsr") > > (set_attr "isa" "*,*,p8v,p9v")]) > > The generated code is one of > no-op > mfvsrd > fmr > xxlor > mfvsrld > xxpermdi > > Which of the 4 alts are meant to correspond to which of those six > possible generated pieces of code? The mop comment, fmr, and xxlor are all alternative 1 (target is a VSX register, element number is which double-word that that is in the upper 64-bits of the register). The xxpermdi is alternative 2 (target is a VSX register, elment number is which double-word that is in the lower 64-bits of the register). The mfvsrd is alternative 3 (target is a GPR register, element number is which double-word that is in the upper 64-bits of the register). The mfvsrld is alternative 4 (target is a GPR register, elment number is which double-word that is in the lower 64-bits of the register). In terms of this patch, I had originally rewritten the insn as a define_insn_and_split, and changed the move case into just a move to let the later passes just delete moves to the same register. However, it caused some unrelated errors (in the gcc.dg/tree-ssa/builtin-s*printf tests), so I backed out the code to use split to create moves. But it looks like alternative 2 and alternative 4 have the insn attribute "type" mixed up (alternative 2 should be vecperm, alternative 4 should be move from vsr).
diff --git a/gcc/config/rs6000/vsx.md b/gcc/config/rs6000/vsx.md index ad722cff70f..2a23807c2dc 100644 --- a/gcc/config/rs6000/vsx.md +++ b/gcc/config/rs6000/vsx.md @@ -3451,7 +3451,7 @@ (define_insn "vsx_extract_<mode>" else gcc_unreachable (); } - [(set_attr "type" "veclogical,mfvsr,mfvsr,vecperm") + [(set_attr "type" "vecmove,vecperm,mfvsr,mfvsr") (set_attr "isa" "*,*,p8v,p9v")]) ;; Optimize extracting a single scalar element from memory.