From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id 990173858D28 for ; Wed, 18 Jan 2023 09:02:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 990173858D28 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linux.ibm.com Received: from pps.filterd (m0187473.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30I8Id8h012997; Wed, 18 Jan 2023 09:02:56 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=pp1; bh=tSM8vMxfNy0qUC7fz+lZRdWeNUT/PecU2kxjICPsqKk=; b=MBgNEQBEASXsJ/o6EgSrSk8mSIdSa+0/KuI2VgscovH+eCV0ucKoxMH3gV6oQHYOHoWo 9bEq72nJPqwJeAT7RTwOfuxpcqU6eSSzi8m1RPvJt2EqMOR1pSvDaeG4r0tNO3K/qLc6 Rt0Z/3g9YuCSZYs5GSEa5DB8kNXPpBasxVPSM2K2A7PX2VTqtVi+ecEFSFY98sX13Rkt AJz8eayEv2/YizID09sueiEoqymm4eGE2nXbZwCH6Gm5OMC8zFQmrPgTnEzDfb6yQpm1 Q9qQJeNwTR4af6qcyOrpGVEx+Mis3U9GeRWcz+zEzeFDu8/ByV7nd4UUzH/UZJuaB8Ax 5Q== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3n6d570vav-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 18 Jan 2023 09:02:56 +0000 Received: from m0187473.ppops.net (m0187473.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 30I8Idds013063; Wed, 18 Jan 2023 09:02:55 GMT Received: from ppma02fra.de.ibm.com (47.49.7a9f.ip4.static.sl-reverse.com [159.122.73.71]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3n6d570va7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 18 Jan 2023 09:02:55 +0000 Received: from pps.filterd (ppma02fra.de.ibm.com [127.0.0.1]) by ppma02fra.de.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 30I7mBP3016548; Wed, 18 Jan 2023 09:02:53 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma02fra.de.ibm.com (PPS) with ESMTPS id 3n3m16kn1r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 18 Jan 2023 09:02:53 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 30I92oG950594246 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 18 Jan 2023 09:02:50 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C3BE320043; Wed, 18 Jan 2023 09:02:50 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id ACD732004B; Wed, 18 Jan 2023 09:02:48 +0000 (GMT) Received: from [9.197.238.43] (unknown [9.197.238.43]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 18 Jan 2023 09:02:48 +0000 (GMT) Message-ID: <130a6f1b-9089-8cdc-8e0c-0870139df7c7@linux.ibm.com> Date: Wed, 18 Jan 2023 17:02:47 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Subject: [PATCH 2/2] rs6000: Refactor genfusion.pl a bit further Content-Language: en-US To: GCC Patches Cc: Segher Boessenkool , David Edelsohn , Peter Bergner References: <55027326-ffe1-87e8-9e4b-08535425afdd@linux.ibm.com> From: "Kewen.Lin" In-Reply-To: <55027326-ffe1-87e8-9e4b-08535425afdd@linux.ibm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: ucNJ-LNK9xKSwRf9VfCZO59FYDzcVd6c X-Proofpoint-GUID: R-NqsDy1KPO1Yhzhtu5Xj1K-uLlrgSfP X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.923,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-18_03,2023-01-17_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 phishscore=0 spamscore=0 bulkscore=0 mlxlogscore=999 priorityscore=1501 impostorscore=0 lowpriorityscore=0 mlxscore=0 adultscore=0 malwarescore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301180078 X-Spam-Status: No, score=-10.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,GIT_PATCH_0,SCC_10_SHORT_WORD_LINES,SCC_20_SHORT_WORD_LINES,SCC_5_SHORT_WORD_LINES,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hi, To keep the previous refactoring patch not need to re-generate fusion.md and make the review easier, I didn't merge this patch into the previous one. But I think this one can help to make the subroutine gen_logical_addsubf_scalar more clear, by separating logical-logical and add-logical handlings into two different loops. It needs to regenerate fusion.md, since add-logical type definitions would have their own continuous area (it needs some rearrangments). Bootstrapped and regtested on powerpc64le-linux-gnu P10. Any comments are highly appreciated. BR, Kewen ----- gcc/ChangeLog: * config/rs6000/fusion.md : Regenerate. * config/rs6000/genfusion.pl (gen_logical_addsubf_scalar): Split logical-logical and add-logical handlings into two loops. --- gcc/config/rs6000/fusion.md | 288 ++++++++++++++++----------------- gcc/config/rs6000/genfusion.pl | 28 ++-- 2 files changed, 162 insertions(+), 154 deletions(-) diff --git a/gcc/config/rs6000/fusion.md b/gcc/config/rs6000/fusion.md index d45fb138a70..0427505b7f7 100644 --- a/gcc/config/rs6000/fusion.md +++ b/gcc/config/rs6000/fusion.md @@ -499,42 +499,6 @@ (define_insn "*fuse_xor_and" (set_attr "cost" "6") (set_attr "length" "8")]) -;; add-logical fusion pattern generated by gen_logical_addsubf -;; scalar add -> and -(define_insn "*fuse_add_and" - [(set (match_operand:GPR 3 "gpc_reg_operand" "=&0,&1,&r,r") - (and:GPR (plus:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r") - (match_operand:GPR 1 "gpc_reg_operand" "r,r,r,r")) - (match_operand:GPR 2 "gpc_reg_operand" "r,r,r,r"))) - (clobber (match_scratch:GPR 4 "=X,X,X,&r"))] - "(TARGET_P10_FUSION)" - "@ - add %3,%1,%0\;and %3,%3,%2 - add %3,%1,%0\;and %3,%3,%2 - add %3,%1,%0\;and %3,%3,%2 - add %4,%1,%0\;and %3,%4,%2" - [(set_attr "type" "fused_arith_logical") - (set_attr "cost" "6") - (set_attr "length" "8")]) - -;; add-logical fusion pattern generated by gen_logical_addsubf -;; scalar subf -> and -(define_insn "*fuse_subf_and" - [(set (match_operand:GPR 3 "gpc_reg_operand" "=&0,&1,&r,r") - (and:GPR (minus:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r") - (match_operand:GPR 1 "gpc_reg_operand" "r,r,r,r")) - (match_operand:GPR 2 "gpc_reg_operand" "r,r,r,r"))) - (clobber (match_scratch:GPR 4 "=X,X,X,&r"))] - "(TARGET_P10_FUSION)" - "@ - subf %3,%1,%0\;and %3,%3,%2 - subf %3,%1,%0\;and %3,%3,%2 - subf %3,%1,%0\;and %3,%3,%2 - subf %4,%1,%0\;and %3,%4,%2" - [(set_attr "type" "fused_arith_logical") - (set_attr "cost" "6") - (set_attr "length" "8")]) - ;; logical-logical fusion pattern generated by gen_logical_addsubf ;; scalar and -> andc (define_insn "*fuse_and_andc" @@ -967,42 +931,6 @@ (define_insn "*fuse_xor_nand" (set_attr "cost" "6") (set_attr "length" "8")]) -;; add-logical fusion pattern generated by gen_logical_addsubf -;; scalar add -> nand -(define_insn "*fuse_add_nand" - [(set (match_operand:GPR 3 "gpc_reg_operand" "=&0,&1,&r,r") - (ior:GPR (not:GPR (plus:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r") - (match_operand:GPR 1 "gpc_reg_operand" "r,r,r,r"))) - (not:GPR (match_operand:GPR 2 "gpc_reg_operand" "r,r,r,r")))) - (clobber (match_scratch:GPR 4 "=X,X,X,&r"))] - "(TARGET_P10_FUSION)" - "@ - add %3,%1,%0\;nand %3,%3,%2 - add %3,%1,%0\;nand %3,%3,%2 - add %3,%1,%0\;nand %3,%3,%2 - add %4,%1,%0\;nand %3,%4,%2" - [(set_attr "type" "fused_arith_logical") - (set_attr "cost" "6") - (set_attr "length" "8")]) - -;; add-logical fusion pattern generated by gen_logical_addsubf -;; scalar subf -> nand -(define_insn "*fuse_subf_nand" - [(set (match_operand:GPR 3 "gpc_reg_operand" "=&0,&1,&r,r") - (ior:GPR (not:GPR (minus:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r") - (match_operand:GPR 1 "gpc_reg_operand" "r,r,r,r"))) - (not:GPR (match_operand:GPR 2 "gpc_reg_operand" "r,r,r,r")))) - (clobber (match_scratch:GPR 4 "=X,X,X,&r"))] - "(TARGET_P10_FUSION)" - "@ - subf %3,%1,%0\;nand %3,%3,%2 - subf %3,%1,%0\;nand %3,%3,%2 - subf %3,%1,%0\;nand %3,%3,%2 - subf %4,%1,%0\;nand %3,%4,%2" - [(set_attr "type" "fused_arith_logical") - (set_attr "cost" "6") - (set_attr "length" "8")]) - ;; logical-logical fusion pattern generated by gen_logical_addsubf ;; scalar and -> nor (define_insn "*fuse_and_nor" @@ -1147,42 +1075,6 @@ (define_insn "*fuse_xor_nor" (set_attr "cost" "6") (set_attr "length" "8")]) -;; add-logical fusion pattern generated by gen_logical_addsubf -;; scalar add -> nor -(define_insn "*fuse_add_nor" - [(set (match_operand:GPR 3 "gpc_reg_operand" "=&0,&1,&r,r") - (and:GPR (not:GPR (plus:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r") - (match_operand:GPR 1 "gpc_reg_operand" "r,r,r,r"))) - (not:GPR (match_operand:GPR 2 "gpc_reg_operand" "r,r,r,r")))) - (clobber (match_scratch:GPR 4 "=X,X,X,&r"))] - "(TARGET_P10_FUSION)" - "@ - add %3,%1,%0\;nor %3,%3,%2 - add %3,%1,%0\;nor %3,%3,%2 - add %3,%1,%0\;nor %3,%3,%2 - add %4,%1,%0\;nor %3,%4,%2" - [(set_attr "type" "fused_arith_logical") - (set_attr "cost" "6") - (set_attr "length" "8")]) - -;; add-logical fusion pattern generated by gen_logical_addsubf -;; scalar subf -> nor -(define_insn "*fuse_subf_nor" - [(set (match_operand:GPR 3 "gpc_reg_operand" "=&0,&1,&r,r") - (and:GPR (not:GPR (minus:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r") - (match_operand:GPR 1 "gpc_reg_operand" "r,r,r,r"))) - (not:GPR (match_operand:GPR 2 "gpc_reg_operand" "r,r,r,r")))) - (clobber (match_scratch:GPR 4 "=X,X,X,&r"))] - "(TARGET_P10_FUSION)" - "@ - subf %3,%1,%0\;nor %3,%3,%2 - subf %3,%1,%0\;nor %3,%3,%2 - subf %3,%1,%0\;nor %3,%3,%2 - subf %4,%1,%0\;nor %3,%4,%2" - [(set_attr "type" "fused_arith_logical") - (set_attr "cost" "6") - (set_attr "length" "8")]) - ;; logical-logical fusion pattern generated by gen_logical_addsubf ;; scalar and -> or (define_insn "*fuse_and_or" @@ -1327,42 +1219,6 @@ (define_insn "*fuse_xor_or" (set_attr "cost" "6") (set_attr "length" "8")]) -;; add-logical fusion pattern generated by gen_logical_addsubf -;; scalar add -> or -(define_insn "*fuse_add_or" - [(set (match_operand:GPR 3 "gpc_reg_operand" "=&0,&1,&r,r") - (ior:GPR (plus:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r") - (match_operand:GPR 1 "gpc_reg_operand" "r,r,r,r")) - (match_operand:GPR 2 "gpc_reg_operand" "r,r,r,r"))) - (clobber (match_scratch:GPR 4 "=X,X,X,&r"))] - "(TARGET_P10_FUSION)" - "@ - add %3,%1,%0\;or %3,%3,%2 - add %3,%1,%0\;or %3,%3,%2 - add %3,%1,%0\;or %3,%3,%2 - add %4,%1,%0\;or %3,%4,%2" - [(set_attr "type" "fused_arith_logical") - (set_attr "cost" "6") - (set_attr "length" "8")]) - -;; add-logical fusion pattern generated by gen_logical_addsubf -;; scalar subf -> or -(define_insn "*fuse_subf_or" - [(set (match_operand:GPR 3 "gpc_reg_operand" "=&0,&1,&r,r") - (ior:GPR (minus:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r") - (match_operand:GPR 1 "gpc_reg_operand" "r,r,r,r")) - (match_operand:GPR 2 "gpc_reg_operand" "r,r,r,r"))) - (clobber (match_scratch:GPR 4 "=X,X,X,&r"))] - "(TARGET_P10_FUSION)" - "@ - subf %3,%1,%0\;or %3,%3,%2 - subf %3,%1,%0\;or %3,%3,%2 - subf %3,%1,%0\;or %3,%3,%2 - subf %4,%1,%0\;or %3,%4,%2" - [(set_attr "type" "fused_arith_logical") - (set_attr "cost" "6") - (set_attr "length" "8")]) - ;; logical-logical fusion pattern generated by gen_logical_addsubf ;; scalar and -> orc (define_insn "*fuse_and_orc" @@ -1651,6 +1507,150 @@ (define_insn "*fuse_xor_xor" (set_attr "cost" "6") (set_attr "length" "8")]) +;; add-logical fusion pattern generated by gen_logical_addsubf +;; scalar add -> and +(define_insn "*fuse_add_and" + [(set (match_operand:GPR 3 "gpc_reg_operand" "=&0,&1,&r,r") + (and:GPR (plus:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r") + (match_operand:GPR 1 "gpc_reg_operand" "r,r,r,r")) + (match_operand:GPR 2 "gpc_reg_operand" "r,r,r,r"))) + (clobber (match_scratch:GPR 4 "=X,X,X,&r"))] + "(TARGET_P10_FUSION)" + "@ + add %3,%1,%0\;and %3,%3,%2 + add %3,%1,%0\;and %3,%3,%2 + add %3,%1,%0\;and %3,%3,%2 + add %4,%1,%0\;and %3,%4,%2" + [(set_attr "type" "fused_arith_logical") + (set_attr "cost" "6") + (set_attr "length" "8")]) + +;; add-logical fusion pattern generated by gen_logical_addsubf +;; scalar subf -> and +(define_insn "*fuse_subf_and" + [(set (match_operand:GPR 3 "gpc_reg_operand" "=&0,&1,&r,r") + (and:GPR (minus:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r") + (match_operand:GPR 1 "gpc_reg_operand" "r,r,r,r")) + (match_operand:GPR 2 "gpc_reg_operand" "r,r,r,r"))) + (clobber (match_scratch:GPR 4 "=X,X,X,&r"))] + "(TARGET_P10_FUSION)" + "@ + subf %3,%1,%0\;and %3,%3,%2 + subf %3,%1,%0\;and %3,%3,%2 + subf %3,%1,%0\;and %3,%3,%2 + subf %4,%1,%0\;and %3,%4,%2" + [(set_attr "type" "fused_arith_logical") + (set_attr "cost" "6") + (set_attr "length" "8")]) + +;; add-logical fusion pattern generated by gen_logical_addsubf +;; scalar add -> nand +(define_insn "*fuse_add_nand" + [(set (match_operand:GPR 3 "gpc_reg_operand" "=&0,&1,&r,r") + (ior:GPR (not:GPR (plus:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r") + (match_operand:GPR 1 "gpc_reg_operand" "r,r,r,r"))) + (not:GPR (match_operand:GPR 2 "gpc_reg_operand" "r,r,r,r")))) + (clobber (match_scratch:GPR 4 "=X,X,X,&r"))] + "(TARGET_P10_FUSION)" + "@ + add %3,%1,%0\;nand %3,%3,%2 + add %3,%1,%0\;nand %3,%3,%2 + add %3,%1,%0\;nand %3,%3,%2 + add %4,%1,%0\;nand %3,%4,%2" + [(set_attr "type" "fused_arith_logical") + (set_attr "cost" "6") + (set_attr "length" "8")]) + +;; add-logical fusion pattern generated by gen_logical_addsubf +;; scalar subf -> nand +(define_insn "*fuse_subf_nand" + [(set (match_operand:GPR 3 "gpc_reg_operand" "=&0,&1,&r,r") + (ior:GPR (not:GPR (minus:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r") + (match_operand:GPR 1 "gpc_reg_operand" "r,r,r,r"))) + (not:GPR (match_operand:GPR 2 "gpc_reg_operand" "r,r,r,r")))) + (clobber (match_scratch:GPR 4 "=X,X,X,&r"))] + "(TARGET_P10_FUSION)" + "@ + subf %3,%1,%0\;nand %3,%3,%2 + subf %3,%1,%0\;nand %3,%3,%2 + subf %3,%1,%0\;nand %3,%3,%2 + subf %4,%1,%0\;nand %3,%4,%2" + [(set_attr "type" "fused_arith_logical") + (set_attr "cost" "6") + (set_attr "length" "8")]) + +;; add-logical fusion pattern generated by gen_logical_addsubf +;; scalar add -> nor +(define_insn "*fuse_add_nor" + [(set (match_operand:GPR 3 "gpc_reg_operand" "=&0,&1,&r,r") + (and:GPR (not:GPR (plus:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r") + (match_operand:GPR 1 "gpc_reg_operand" "r,r,r,r"))) + (not:GPR (match_operand:GPR 2 "gpc_reg_operand" "r,r,r,r")))) + (clobber (match_scratch:GPR 4 "=X,X,X,&r"))] + "(TARGET_P10_FUSION)" + "@ + add %3,%1,%0\;nor %3,%3,%2 + add %3,%1,%0\;nor %3,%3,%2 + add %3,%1,%0\;nor %3,%3,%2 + add %4,%1,%0\;nor %3,%4,%2" + [(set_attr "type" "fused_arith_logical") + (set_attr "cost" "6") + (set_attr "length" "8")]) + +;; add-logical fusion pattern generated by gen_logical_addsubf +;; scalar subf -> nor +(define_insn "*fuse_subf_nor" + [(set (match_operand:GPR 3 "gpc_reg_operand" "=&0,&1,&r,r") + (and:GPR (not:GPR (minus:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r") + (match_operand:GPR 1 "gpc_reg_operand" "r,r,r,r"))) + (not:GPR (match_operand:GPR 2 "gpc_reg_operand" "r,r,r,r")))) + (clobber (match_scratch:GPR 4 "=X,X,X,&r"))] + "(TARGET_P10_FUSION)" + "@ + subf %3,%1,%0\;nor %3,%3,%2 + subf %3,%1,%0\;nor %3,%3,%2 + subf %3,%1,%0\;nor %3,%3,%2 + subf %4,%1,%0\;nor %3,%4,%2" + [(set_attr "type" "fused_arith_logical") + (set_attr "cost" "6") + (set_attr "length" "8")]) + +;; add-logical fusion pattern generated by gen_logical_addsubf +;; scalar add -> or +(define_insn "*fuse_add_or" + [(set (match_operand:GPR 3 "gpc_reg_operand" "=&0,&1,&r,r") + (ior:GPR (plus:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r") + (match_operand:GPR 1 "gpc_reg_operand" "r,r,r,r")) + (match_operand:GPR 2 "gpc_reg_operand" "r,r,r,r"))) + (clobber (match_scratch:GPR 4 "=X,X,X,&r"))] + "(TARGET_P10_FUSION)" + "@ + add %3,%1,%0\;or %3,%3,%2 + add %3,%1,%0\;or %3,%3,%2 + add %3,%1,%0\;or %3,%3,%2 + add %4,%1,%0\;or %3,%4,%2" + [(set_attr "type" "fused_arith_logical") + (set_attr "cost" "6") + (set_attr "length" "8")]) + +;; add-logical fusion pattern generated by gen_logical_addsubf +;; scalar subf -> or +(define_insn "*fuse_subf_or" + [(set (match_operand:GPR 3 "gpc_reg_operand" "=&0,&1,&r,r") + (ior:GPR (minus:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r") + (match_operand:GPR 1 "gpc_reg_operand" "r,r,r,r")) + (match_operand:GPR 2 "gpc_reg_operand" "r,r,r,r"))) + (clobber (match_scratch:GPR 4 "=X,X,X,&r"))] + "(TARGET_P10_FUSION)" + "@ + subf %3,%1,%0\;or %3,%3,%2 + subf %3,%1,%0\;or %3,%3,%2 + subf %3,%1,%0\;or %3,%3,%2 + subf %4,%1,%0\;or %3,%4,%2" + [(set_attr "type" "fused_arith_logical") + (set_attr "cost" "6") + (set_attr "length" "8")]) + ;; logical-add fusion pattern generated by gen_logical_addsubf ;; scalar and -> add (define_insn "*fuse_and_add" diff --git a/gcc/config/rs6000/genfusion.pl b/gcc/config/rs6000/genfusion.pl index 487e662ce05..6002a3af578 100755 --- a/gcc/config/rs6000/genfusion.pl +++ b/gcc/config/rs6000/genfusion.pl @@ -335,22 +335,30 @@ sub gen_logical_addsubf_scalar my $constraint = 'r'; my @logicals = ( 'and', 'andc', 'eqv', 'nand', 'nor', 'or', 'orc', 'xor' ); + + # logical-logical + foreach my $outer_op ( @logicals ) { + foreach my $inner_op ( @logicals ) { + my $exp = logical_addsubf_make_exp ($outer_op, $inner_op, $mode, + $pred, $constraint); + logical_addsubf_emit_define ('logical-logical', 'scalar', $outer_op, + $inner_op, $mode, $pred, $constraint, + $exp, $fuse_type); + } + } + # logical ops which can fuse with add/subf/rsubf my @logicals2 = ( 'and', 'nand', 'nor', 'or' ); my @add_subf = ( 'add', 'subf' ); - # {logical, add}-logical - foreach my $outer_op ( @logicals ) { - foreach my $inner_op ( @logicals, @add_subf ) { - my $ftype = 'logical-logical'; - if (grep (/^$inner_op$/, @add_subf)) { - next unless grep (/^$outer_op$/, @logicals2); - $ftype = 'add-logical'; - } + # add-logical + foreach my $outer_op ( @logicals2 ) { + foreach my $inner_op ( @add_subf ) { my $exp = logical_addsubf_make_exp ($outer_op, $inner_op, $mode, $pred, $constraint); - logical_addsubf_emit_define ($ftype, 'scalar', $outer_op, $inner_op, - $mode, $pred, $constraint, $exp, $fuse_type); + logical_addsubf_emit_define ('add-logical', 'scalar', $outer_op, + $inner_op, $mode, $pred, $constraint, + $exp, $fuse_type); } } -- 2.37.0