From patchwork Mon Apr 26 20:21:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Li, Pan2 via Gcc-patches" X-Patchwork-Id: 1470478 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=tOuVa1Um; dkim-atps=neutral Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FTbv04gqBz9sXG for ; Tue, 27 Apr 2021 06:23:24 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9EE8C395704F; Mon, 26 Apr 2021 20:23:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9EE8C395704F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1619468602; bh=IJDah2wylse4PXSSeQCVk5Oxz4EQLnssCukOmQXqCpk=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=tOuVa1UmC6u9KshEeBDa/EA3tDkLBB41jPqAlVdMq79Zl/ifaMh7ZbcXFM0nBVDyZ hbwHTbnW9zSCsBz2AzoMJBbUDfgQI66bqcQwrn8jlS5I9yXzFQzSih/YwyU3gAlA6M Shi2i4RINC11lZQfZsgxj0Kq01YeSrt8/AD/igCE= 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 0E54838930DF for ; Mon, 26 Apr 2021 20:23:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 0E54838930DF Received: from pps.filterd (m0187473.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 13QK355v147146; Mon, 26 Apr 2021 16:23:18 -0400 Received: from ppma04wdc.us.ibm.com (1a.90.2fa9.ip4.static.sl-reverse.com [169.47.144.26]) by mx0a-001b2d01.pphosted.com with ESMTP id 3863ga9n58-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 26 Apr 2021 16:23:17 -0400 Received: from pps.filterd (ppma04wdc.us.ibm.com [127.0.0.1]) by ppma04wdc.us.ibm.com (8.16.0.43/8.16.0.43) with SMTP id 13QKMuu6007007; Mon, 26 Apr 2021 20:23:16 GMT Received: from b01cxnp22035.gho.pok.ibm.com (b01cxnp22035.gho.pok.ibm.com [9.57.198.25]) by ppma04wdc.us.ibm.com with ESMTP id 384ay98qar-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 26 Apr 2021 20:23:16 +0000 Received: from b01ledav003.gho.pok.ibm.com (b01ledav003.gho.pok.ibm.com [9.57.199.108]) by b01cxnp22035.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 13QKNFYw36176176 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 26 Apr 2021 20:23:15 GMT Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 717AAB206B; Mon, 26 Apr 2021 20:23:15 +0000 (GMT) Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4CEB4B205F; Mon, 26 Apr 2021 20:23:15 +0000 (GMT) Received: from ltcden2-lp1.aus.stglabs.ibm.com (unknown [9.53.174.68]) by b01ledav003.gho.pok.ibm.com (Postfix) with ESMTPS; Mon, 26 Apr 2021 20:23:15 +0000 (GMT) Received: by ltcden2-lp1.aus.stglabs.ibm.com (Postfix, from userid 1008) id 74CFB44D7FCC; Mon, 26 Apr 2021 15:23:14 -0500 (CDT) To: gcc-patches@gcc.gnu.org Subject: [PATCH,rs6000 1/2] combine patterns for add-add fusion Date: Mon, 26 Apr 2021 15:21:29 -0500 Message-Id: <20210426202130.3882980-2-acsawdey@linux.ibm.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210426202130.3882980-1-acsawdey@linux.ibm.com> References: <20210426202130.3882980-1-acsawdey@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: NH6LCa8ybu7oE_y5RcQ6-cqNquPFo_2S X-Proofpoint-GUID: NH6LCa8ybu7oE_y5RcQ6-cqNquPFo_2S X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.761 definitions=2021-04-26_09:2021-04-26, 2021-04-26 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 mlxlogscore=999 malwarescore=0 phishscore=0 mlxscore=0 suspectscore=0 bulkscore=0 adultscore=0 lowpriorityscore=0 impostorscore=0 clxscore=1015 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104260153 X-Spam-Status: No, score=-14.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: acsawdey--- via Gcc-patches From: "Li, Pan2 via Gcc-patches" Reply-To: acsawdey@linux.ibm.com Cc: wschmidt@linux.ibm.com, segher@kernel.crashing.org Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" From: Aaron Sawdey This patch adds a function to genfusion.pl to add a couple more patterns so combine can do fusion of pairs of add and vaddudm instructions. gcc/ChangeLog: * gcc/config/rs6000/genfusion.pl (gen_addadd): New function. * gcc/config/rs6000/fusion.md: Regenerate file. * gcc/config/rs6000/rs6000-cpus.def: Add OPTION_MASK_P10_FUSION_2ADD to masks. * gcc/config/rs6000/rs6000.c (rs6000_option_override_internal): Handle default value of OPTION_MASK_P10_FUSION_2ADD. * gcc/config/rs6000/rs6000.opt: Add -mpower10-fusion-2add. gcc/testsuite/ChangeLog: * gcc.target/powerpc/fusion-p10-addadd.c: New file. --- gcc/config/rs6000/fusion.md | 36 +++++++++++++++ gcc/config/rs6000/genfusion.pl | 44 +++++++++++++++++++ gcc/config/rs6000/rs6000-cpus.def | 4 +- gcc/config/rs6000/rs6000.c | 3 ++ gcc/config/rs6000/rs6000.opt | 4 ++ .../gcc.target/powerpc/fusion-p10-addadd.c | 41 +++++++++++++++++ 6 files changed, 131 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.target/powerpc/fusion-p10-addadd.c diff --git a/gcc/config/rs6000/fusion.md b/gcc/config/rs6000/fusion.md index 6d71bc2df73..6dfe1fa4508 100644 --- a/gcc/config/rs6000/fusion.md +++ b/gcc/config/rs6000/fusion.md @@ -2658,3 +2658,39 @@ (define_insn "*fuse_vxor_vxor" [(set_attr "type" "fused_vector") (set_attr "cost" "6") (set_attr "length" "8")]) + +;; add-add fusion pattern generated by gen_addadd +(define_insn "*fuse_add_add" + [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") + (plus: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 && TARGET_P10_FUSION_2ADD)" + "@ + add %3,%1,%0\;add %3,%3,%2 + add %3,%1,%0\;add %3,%3,%2 + add %3,%1,%0\;add %3,%3,%2 + add %4,%1,%0\;add %3,%4,%2" + [(set_attr "type" "fuse_arithlog") + (set_attr "cost" "6") + (set_attr "length" "8")]) + +;; vaddudm-vaddudm fusion pattern generated by gen_addadd +(define_insn "*fuse_vaddudm_vaddudm" + [(set (match_operand:V2DI 3 "altivec_register_operand" "=0,1,&v,v") + (plus:V2DI + (plus:V2DI (match_operand:V2DI 0 "altivec_register_operand" "v,v,v,v") + (match_operand:V2DI 1 "altivec_register_operand" "%v,v,v,v")) + (match_operand:V2DI 2 "altivec_register_operand" "v,v,v,v"))) + (clobber (match_scratch:V2DI 4 "=X,X,X,&v"))] + "(TARGET_P10_FUSION && TARGET_P10_FUSION_2ADD)" + "@ + vaddudm %3,%1,%0\;vaddudm %3,%3,%2 + vaddudm %3,%1,%0\;vaddudm %3,%3,%2 + vaddudm %3,%1,%0\;vaddudm %3,%3,%2 + vaddudm %4,%1,%0\;vaddudm %3,%4,%2" + [(set_attr "type" "fuse_vec") + (set_attr "cost" "6") + (set_attr "length" "8")]) diff --git a/gcc/config/rs6000/genfusion.pl b/gcc/config/rs6000/genfusion.pl index ce48fd94f95..8ed3c3617ec 100755 --- a/gcc/config/rs6000/genfusion.pl +++ b/gcc/config/rs6000/genfusion.pl @@ -240,8 +240,52 @@ EOF } } +sub gen_addadd +{ + my ($kind, $vchr, $op, $ty, $mode, $pred, $constraint); + KIND: foreach $kind ('scalar','vector') { + if ( $kind eq 'vector' ) { + $vchr = "v"; + $op = "vaddudm"; + $ty = "fuse_vec"; + $mode = "V2DI"; + $pred = "altivec_register_operand"; + $constraint = "v"; + } else { + $vchr = ""; + $op = "add"; + $ty = "fuse_arithlog"; + $mode = "GPR"; + $pred = "gpc_reg_operand"; + $constraint = "r"; + } + my $c4 = "${constraint},${constraint},${constraint},${constraint}"; + print <<"EOF"; + +;; ${op}-${op} fusion pattern generated by gen_addadd +(define_insn "*fuse_${op}_${op}" + [(set (match_operand:${mode} 3 "${pred}" "=0,1,&${constraint},${constraint}") + (plus:${mode} + (plus:${mode} (match_operand:${mode} 0 "${pred}" "${c4}") + (match_operand:${mode} 1 "${pred}" "%${c4}")) + (match_operand:${mode} 2 "${pred}" "${c4}"))) + (clobber (match_scratch:${mode} 4 "=X,X,X,&${constraint}"))] + "(TARGET_P10_FUSION && TARGET_P10_FUSION_2ADD)" + "@ + ${op} %3,%1,%0\\;${op} %3,%3,%2 + ${op} %3,%1,%0\\;${op} %3,%3,%2 + ${op} %3,%1,%0\\;${op} %3,%3,%2 + ${op} %4,%1,%0\\;${op} %3,%4,%2" + [(set_attr "type" "${ty}") + (set_attr "cost" "6") + (set_attr "length" "8")]) +EOF + } +} + gen_ld_cmpi_p10(); gen_2logical(); +gen_addadd(); exit(0); diff --git a/gcc/config/rs6000/rs6000-cpus.def b/gcc/config/rs6000/rs6000-cpus.def index cbbb42c1b3a..d46a91dd11b 100644 --- a/gcc/config/rs6000/rs6000-cpus.def +++ b/gcc/config/rs6000/rs6000-cpus.def @@ -85,7 +85,8 @@ | OTHER_POWER10_MASKS \ | OPTION_MASK_P10_FUSION \ | OPTION_MASK_P10_FUSION_LD_CMPI \ - | OPTION_MASK_P10_FUSION_2LOGICAL) + | OPTION_MASK_P10_FUSION_2LOGICAL \ + | OPTION_MASK_P10_FUSION_2ADD) /* Flags that need to be turned off if -mno-power9-vector. */ #define OTHER_P9_VECTOR_MASKS (OPTION_MASK_FLOAT128_HW \ @@ -135,6 +136,7 @@ | OPTION_MASK_P10_FUSION \ | OPTION_MASK_P10_FUSION_LD_CMPI \ | OPTION_MASK_P10_FUSION_2LOGICAL \ + | OPTION_MASK_P10_FUSION_2ADD \ | OPTION_MASK_HTM \ | OPTION_MASK_ISEL \ | OPTION_MASK_MFCRF \ diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 844fee88cf3..9488a54a1d7 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -4467,6 +4467,9 @@ rs6000_option_override_internal (bool global_init_p) if (TARGET_POWER10 && (rs6000_isa_flags_explicit & OPTION_MASK_P10_FUSION_2LOGICAL) == 0) rs6000_isa_flags |= OPTION_MASK_P10_FUSION_2LOGICAL; + if (TARGET_POWER10 && (rs6000_isa_flags_explicit & OPTION_MASK_P10_FUSION_2ADD) == 0) + rs6000_isa_flags |= OPTION_MASK_P10_FUSION_2ADD; + /* Turn off vector pair/mma options on non-power10 systems. */ else if (!TARGET_POWER10 && TARGET_MMA) { diff --git a/gcc/config/rs6000/rs6000.opt b/gcc/config/rs6000/rs6000.opt index 0dbdf753673..fc14325ed33 100644 --- a/gcc/config/rs6000/rs6000.opt +++ b/gcc/config/rs6000/rs6000.opt @@ -502,6 +502,10 @@ mpower10-fusion-2logical Target Undocumented Mask(P10_FUSION_2LOGICAL) Var(rs6000_isa_flags) Fuse certain integer operations together for better performance on power10. +mpower10-fusion-2add +Target Undocumented Mask(P10_FUSION_2ADD) Var(rs6000_isa_flags) +Fuse certain add operations together for better performance on power10. + mcrypto Target Mask(CRYPTO) Var(rs6000_isa_flags) Use ISA 2.07 Category:Vector.AES and Category:Vector.SHA2 instructions. diff --git a/gcc/testsuite/gcc.target/powerpc/fusion-p10-addadd.c b/gcc/testsuite/gcc.target/powerpc/fusion-p10-addadd.c new file mode 100644 index 00000000000..41d71dbf3cb --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/fusion-p10-addadd.c @@ -0,0 +1,41 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-skip-if "" { powerpc*-*-darwin* } } */ +/* { dg-options "-mdejagnu-cpu=power10 -O3 -dp" } */ + +long addadd0(long a, long b, long c) +{ + return a+b+c; +} +long addadd1(long a, long b, long c, long *t) +{ + long r=a+b+c; + *t = b; + return r; +} +long addadd2(long s, long a, long b, long c) +{ + return b+c+a; +} + +typedef vector long vlong; +vlong vaddadd(vlong a, vlong b, vlong c) +{ + return a+b+c; +} +vlong vaddadd1(vlong a, vlong b, vlong c, vlong *t) +{ + vlong r=a+b+c; + *t = b; + return r; +} +vlong vaddadd2(vlong s, vlong a, vlong b, vlong c) +{ + return a+b+c; +} + +/* { dg-final { scan-assembler-times "fuse_add_add/0" 1 } } */ +/* { dg-final { scan-assembler-times "fuse_add_add/1" 1 } } */ +/* { dg-final { scan-assembler-times "fuse_add_add/2" 1 } } */ +/* { dg-final { scan-assembler-times "fuse_vaddudm_vaddudm/0" 1 } } */ +/* { dg-final { scan-assembler-times "fuse_vaddudm_vaddudm/1" 1 } } */ +/* { dg-final { scan-assembler-times "fuse_vaddudm_vaddudm/2" 1 } } */ From patchwork Mon Apr 26 20:21:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Li, Pan2 via Gcc-patches" X-Patchwork-Id: 1470479 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=brc0ut22; dkim-atps=neutral Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FTbwh74PNz9sXH for ; Tue, 27 Apr 2021 06:24:52 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 832513958C05; Mon, 26 Apr 2021 20:24:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 832513958C05 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1619468690; bh=OqVI27F5kCBeyLU92JZ7uskDOlpIq+SzM+MVW6lBzec=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=brc0ut22nvVhAVWlWJVfKQ5pvEtixU4WOxmzY8ICNphu15GPS4RpY2044K9RZdUWc snqKPK3qnflzvOG9I0CLfcCSwiVkZdiy7v3AOrF7NIkOW5UsJcdTZX/L8GYAgCDauV aHYjkOV3zwCipZoUTykYWPojFj+v+mJOh6spOC08= 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 A3ED5395543C for ; Mon, 26 Apr 2021 20:24:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org A3ED5395543C Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 13QK46Kf127311; Mon, 26 Apr 2021 16:24:38 -0400 Received: from ppma01wdc.us.ibm.com (fd.55.37a9.ip4.static.sl-reverse.com [169.55.85.253]) by mx0a-001b2d01.pphosted.com with ESMTP id 38639pa2jr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 26 Apr 2021 16:24:37 -0400 Received: from pps.filterd (ppma01wdc.us.ibm.com [127.0.0.1]) by ppma01wdc.us.ibm.com (8.16.0.43/8.16.0.43) with SMTP id 13QKLgBf010895; Mon, 26 Apr 2021 20:24:36 GMT Received: from b03cxnp08028.gho.boulder.ibm.com (b03cxnp08028.gho.boulder.ibm.com [9.17.130.20]) by ppma01wdc.us.ibm.com with ESMTP id 384ay98qxt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 26 Apr 2021 20:24:35 +0000 Received: from b03ledav004.gho.boulder.ibm.com (b03ledav004.gho.boulder.ibm.com [9.17.130.235]) by b03cxnp08028.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 13QKOXlR22544658 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 26 Apr 2021 20:24:33 GMT Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 59B8F7805F; Mon, 26 Apr 2021 20:24:33 +0000 (GMT) Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 328807805C; Mon, 26 Apr 2021 20:24:32 +0000 (GMT) Received: from ltcden2-lp1.aus.stglabs.ibm.com (unknown [9.53.174.68]) by b03ledav004.gho.boulder.ibm.com (Postfix) with ESMTPS; Mon, 26 Apr 2021 20:24:32 +0000 (GMT) Received: by ltcden2-lp1.aus.stglabs.ibm.com (Postfix, from userid 1008) id 99AE144D7FCC; Mon, 26 Apr 2021 15:24:31 -0500 (CDT) To: gcc-patches@gcc.gnu.org Subject: [PATCH,rs6000 2/2] Fusion patterns for add-logical/logical-add Date: Mon, 26 Apr 2021 15:21:30 -0500 Message-Id: <20210426202130.3882980-3-acsawdey@linux.ibm.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210426202130.3882980-1-acsawdey@linux.ibm.com> References: <20210426202130.3882980-1-acsawdey@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: HZzAz6fz42UejPo1KnL9HdA_E2EliV-O X-Proofpoint-GUID: HZzAz6fz42UejPo1KnL9HdA_E2EliV-O X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.761 definitions=2021-04-26_09:2021-04-26, 2021-04-26 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 clxscore=1015 impostorscore=0 mlxscore=0 malwarescore=0 spamscore=0 priorityscore=1501 phishscore=0 lowpriorityscore=0 mlxlogscore=999 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104260153 X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SCC_10_SHORT_WORD_LINES, SCC_20_SHORT_WORD_LINES, SCC_35_SHORT_WORD_LINES, SCC_5_SHORT_WORD_LINES, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: acsawdey--- via Gcc-patches From: "Li, Pan2 via Gcc-patches" Reply-To: acsawdey@linux.ibm.com Cc: wschmidt@linux.ibm.com, segher@kernel.crashing.org Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" From: Aaron Sawdey This patch modifies the function in genfusion.pl for generating the logical-logical patterns so that it can also generate the add-logical and logical-add patterns which are very similar. gcc/ChangeLog: * config/rs6000/genfusion.pl (gen_logical_addsubf): Refactor to add generation of logical-add and add-logical fusion pairs. * config/rs6000/rs6000-cpus.def: Add new fusion to ISA 3.1 mask and powerpc mask. * config/rs6000/rs6000.c (rs6000_option_override_internal): Turn on logical-add and add-logical fusion by default. * config/rs6000.opt: Add -mpower10-fusion-logical-add and -mpower10-fusion-add-logical options. * config/rs6000/fusion.md: Regenerate file. gcc/testsuite/ChangeLog: * gcc.target/powerpc/fusion-p10-logadd.c: New file. --- gcc/config/rs6000/fusion.md | 876 ++++++++++++------ gcc/config/rs6000/genfusion.pl | 87 +- gcc/config/rs6000/rs6000-cpus.def | 4 + gcc/config/rs6000/rs6000.c | 6 + gcc/config/rs6000/rs6000.opt | 8 + .../gcc.target/powerpc/fusion-p10-logadd.c | 98 ++ 6 files changed, 798 insertions(+), 281 deletions(-) create mode 100644 gcc/testsuite/gcc.target/powerpc/fusion-p10-logadd.c diff --git a/gcc/config/rs6000/fusion.md b/gcc/config/rs6000/fusion.md index 6dfe1fa4508..6c7c94c44c1 100644 --- a/gcc/config/rs6000/fusion.md +++ b/gcc/config/rs6000/fusion.md @@ -355,11 +355,11 @@ (define_insn_and_split "*lbz_cmpldi_cr0_QI_GPR_CCUNS_zero" (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; scalar and -> and (define_insn "*fuse_and_and" [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") - (and:GPR (and:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r") + (and:GPR (and: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"))] @@ -373,11 +373,11 @@ (define_insn "*fuse_and_and" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; scalar andc -> and (define_insn "*fuse_andc_and" [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") - (and:GPR (and:GPR (not:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r")) + (and:GPR (and:GPR (not: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"))] @@ -391,11 +391,11 @@ (define_insn "*fuse_andc_and" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; scalar eqv -> and (define_insn "*fuse_eqv_and" [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") - (and:GPR (not:GPR (xor:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r") + (and:GPR (not:GPR (xor: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"))] @@ -409,11 +409,11 @@ (define_insn "*fuse_eqv_and" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; scalar nand -> and (define_insn "*fuse_nand_and" [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") - (and:GPR (ior:GPR (not:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r")) + (and:GPR (ior:GPR (not:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r")) (not:GPR (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"))] @@ -427,11 +427,11 @@ (define_insn "*fuse_nand_and" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; scalar nor -> and (define_insn "*fuse_nor_and" [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") - (and:GPR (and:GPR (not:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r")) + (and:GPR (and:GPR (not:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r")) (not:GPR (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"))] @@ -445,11 +445,11 @@ (define_insn "*fuse_nor_and" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; scalar or -> and (define_insn "*fuse_or_and" [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") - (and:GPR (ior:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r") + (and:GPR (ior: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"))] @@ -463,11 +463,11 @@ (define_insn "*fuse_or_and" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; scalar orc -> and (define_insn "*fuse_orc_and" [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") - (and:GPR (ior:GPR (not:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r")) + (and:GPR (ior:GPR (not: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"))] @@ -481,11 +481,11 @@ (define_insn "*fuse_orc_and" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; scalar xor -> and (define_insn "*fuse_xor_and" [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") - (and:GPR (xor:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r") + (and:GPR (xor: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"))] @@ -499,11 +499,47 @@ (define_insn "*fuse_xor_and" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; 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 && TARGET_P10_FUSION_ADDLOG)" + "@ + 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 && TARGET_P10_FUSION_ADDLOG)" + "@ + 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" [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") - (and:GPR (and:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r") + (and:GPR (and: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"))] @@ -517,11 +553,11 @@ (define_insn "*fuse_and_andc" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; scalar andc -> andc (define_insn "*fuse_andc_andc" [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") - (and:GPR (and:GPR (not:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r")) + (and:GPR (and:GPR (not: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"))] @@ -535,11 +571,11 @@ (define_insn "*fuse_andc_andc" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; scalar eqv -> andc (define_insn "*fuse_eqv_andc" [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") - (and:GPR (not:GPR (xor:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r") + (and:GPR (not:GPR (xor: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"))] @@ -553,11 +589,11 @@ (define_insn "*fuse_eqv_andc" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; scalar nand -> andc (define_insn "*fuse_nand_andc" [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") - (and:GPR (ior:GPR (not:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r")) + (and:GPR (ior:GPR (not:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r")) (not:GPR (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"))] @@ -571,11 +607,11 @@ (define_insn "*fuse_nand_andc" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; scalar nor -> andc (define_insn "*fuse_nor_andc" [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") - (and:GPR (and:GPR (not:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r")) + (and:GPR (and:GPR (not:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r")) (not:GPR (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"))] @@ -589,11 +625,11 @@ (define_insn "*fuse_nor_andc" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; scalar or -> andc (define_insn "*fuse_or_andc" [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") - (and:GPR (ior:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r") + (and:GPR (ior: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"))] @@ -607,11 +643,11 @@ (define_insn "*fuse_or_andc" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; scalar orc -> andc (define_insn "*fuse_orc_andc" [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") - (and:GPR (ior:GPR (not:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r")) + (and:GPR (ior:GPR (not: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"))] @@ -625,11 +661,11 @@ (define_insn "*fuse_orc_andc" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; scalar xor -> andc (define_insn "*fuse_xor_andc" [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") - (and:GPR (xor:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r") + (and:GPR (xor: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"))] @@ -643,11 +679,11 @@ (define_insn "*fuse_xor_andc" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; scalar and -> eqv (define_insn "*fuse_and_eqv" [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") - (not:GPR (xor:GPR (and:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r") + (not:GPR (xor:GPR (and: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"))] @@ -661,11 +697,11 @@ (define_insn "*fuse_and_eqv" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; scalar andc -> eqv (define_insn "*fuse_andc_eqv" [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") - (not:GPR (xor:GPR (and:GPR (not:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r")) + (not:GPR (xor:GPR (and:GPR (not: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"))] @@ -679,11 +715,11 @@ (define_insn "*fuse_andc_eqv" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; scalar eqv -> eqv (define_insn "*fuse_eqv_eqv" [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") - (not:GPR (xor:GPR (not:GPR (xor:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r") + (not:GPR (xor:GPR (not:GPR (xor: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"))] @@ -697,11 +733,11 @@ (define_insn "*fuse_eqv_eqv" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; scalar nand -> eqv (define_insn "*fuse_nand_eqv" [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") - (not:GPR (xor:GPR (ior:GPR (not:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r")) + (not:GPR (xor:GPR (ior:GPR (not:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r")) (not:GPR (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"))] @@ -715,11 +751,11 @@ (define_insn "*fuse_nand_eqv" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; scalar nor -> eqv (define_insn "*fuse_nor_eqv" [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") - (not:GPR (xor:GPR (and:GPR (not:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r")) + (not:GPR (xor:GPR (and:GPR (not:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r")) (not:GPR (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"))] @@ -733,11 +769,11 @@ (define_insn "*fuse_nor_eqv" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; scalar or -> eqv (define_insn "*fuse_or_eqv" [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") - (not:GPR (xor:GPR (ior:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r") + (not:GPR (xor:GPR (ior: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"))] @@ -751,11 +787,11 @@ (define_insn "*fuse_or_eqv" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; scalar orc -> eqv (define_insn "*fuse_orc_eqv" [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") - (not:GPR (xor:GPR (ior:GPR (not:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r")) + (not:GPR (xor:GPR (ior:GPR (not: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"))] @@ -769,11 +805,11 @@ (define_insn "*fuse_orc_eqv" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; scalar xor -> eqv (define_insn "*fuse_xor_eqv" [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") - (not:GPR (xor:GPR (xor:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r") + (not:GPR (xor:GPR (xor: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"))] @@ -787,11 +823,11 @@ (define_insn "*fuse_xor_eqv" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; scalar and -> nand (define_insn "*fuse_and_nand" [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") - (ior:GPR (not:GPR (and:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r") + (ior:GPR (not:GPR (and: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"))] @@ -805,11 +841,11 @@ (define_insn "*fuse_and_nand" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; scalar andc -> nand (define_insn "*fuse_andc_nand" [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") - (ior:GPR (not:GPR (and:GPR (not:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r")) + (ior:GPR (not:GPR (and:GPR (not: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"))] @@ -823,11 +859,11 @@ (define_insn "*fuse_andc_nand" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; scalar eqv -> nand (define_insn "*fuse_eqv_nand" [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") - (ior:GPR (not:GPR (not:GPR (xor:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r") + (ior:GPR (not:GPR (not:GPR (xor: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"))] @@ -841,11 +877,11 @@ (define_insn "*fuse_eqv_nand" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; scalar nand -> nand (define_insn "*fuse_nand_nand" [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") - (ior:GPR (not:GPR (ior:GPR (not:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r")) + (ior:GPR (not:GPR (ior:GPR (not:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r")) (not:GPR (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"))] @@ -859,11 +895,11 @@ (define_insn "*fuse_nand_nand" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; scalar nor -> nand (define_insn "*fuse_nor_nand" [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") - (ior:GPR (not:GPR (and:GPR (not:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r")) + (ior:GPR (not:GPR (and:GPR (not:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r")) (not:GPR (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"))] @@ -877,11 +913,11 @@ (define_insn "*fuse_nor_nand" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; scalar or -> nand (define_insn "*fuse_or_nand" [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") - (ior:GPR (not:GPR (ior:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r") + (ior:GPR (not:GPR (ior: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"))] @@ -895,11 +931,11 @@ (define_insn "*fuse_or_nand" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; scalar orc -> nand (define_insn "*fuse_orc_nand" [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") - (ior:GPR (not:GPR (ior:GPR (not:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r")) + (ior:GPR (not:GPR (ior:GPR (not: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"))] @@ -913,11 +949,11 @@ (define_insn "*fuse_orc_nand" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; scalar xor -> nand (define_insn "*fuse_xor_nand" [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") - (ior:GPR (not:GPR (xor:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r") + (ior:GPR (not:GPR (xor: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"))] @@ -931,11 +967,47 @@ (define_insn "*fuse_xor_nand" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; 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 && TARGET_P10_FUSION_ADDLOG)" + "@ + 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 && TARGET_P10_FUSION_ADDLOG)" + "@ + 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" [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") - (and:GPR (not:GPR (and:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r") + (and:GPR (not:GPR (and: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"))] @@ -949,11 +1021,11 @@ (define_insn "*fuse_and_nor" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; scalar andc -> nor (define_insn "*fuse_andc_nor" [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") - (and:GPR (not:GPR (and:GPR (not:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r")) + (and:GPR (not:GPR (and:GPR (not: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"))] @@ -967,11 +1039,11 @@ (define_insn "*fuse_andc_nor" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; scalar eqv -> nor (define_insn "*fuse_eqv_nor" [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") - (and:GPR (not:GPR (not:GPR (xor:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r") + (and:GPR (not:GPR (not:GPR (xor: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"))] @@ -985,11 +1057,11 @@ (define_insn "*fuse_eqv_nor" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; scalar nand -> nor (define_insn "*fuse_nand_nor" [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") - (and:GPR (not:GPR (ior:GPR (not:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r")) + (and:GPR (not:GPR (ior:GPR (not:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r")) (not:GPR (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"))] @@ -1003,11 +1075,11 @@ (define_insn "*fuse_nand_nor" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; scalar nor -> nor (define_insn "*fuse_nor_nor" [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") - (and:GPR (not:GPR (and:GPR (not:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r")) + (and:GPR (not:GPR (and:GPR (not:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r")) (not:GPR (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"))] @@ -1021,11 +1093,11 @@ (define_insn "*fuse_nor_nor" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; scalar or -> nor (define_insn "*fuse_or_nor" [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") - (and:GPR (not:GPR (ior:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r") + (and:GPR (not:GPR (ior: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"))] @@ -1039,11 +1111,11 @@ (define_insn "*fuse_or_nor" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; scalar orc -> nor (define_insn "*fuse_orc_nor" [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") - (and:GPR (not:GPR (ior:GPR (not:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r")) + (and:GPR (not:GPR (ior:GPR (not: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"))] @@ -1057,11 +1129,11 @@ (define_insn "*fuse_orc_nor" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; scalar xor -> nor (define_insn "*fuse_xor_nor" [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") - (and:GPR (not:GPR (xor:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r") + (and:GPR (not:GPR (xor: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"))] @@ -1075,11 +1147,47 @@ (define_insn "*fuse_xor_nor" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; 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 && TARGET_P10_FUSION_ADDLOG)" + "@ + 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 && TARGET_P10_FUSION_ADDLOG)" + "@ + 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" [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") - (ior:GPR (and:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r") + (ior:GPR (and: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"))] @@ -1093,11 +1201,11 @@ (define_insn "*fuse_and_or" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; scalar andc -> or (define_insn "*fuse_andc_or" [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") - (ior:GPR (and:GPR (not:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r")) + (ior:GPR (and:GPR (not: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"))] @@ -1111,11 +1219,11 @@ (define_insn "*fuse_andc_or" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; scalar eqv -> or (define_insn "*fuse_eqv_or" [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") - (ior:GPR (not:GPR (xor:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r") + (ior:GPR (not:GPR (xor: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"))] @@ -1129,11 +1237,11 @@ (define_insn "*fuse_eqv_or" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; scalar nand -> or (define_insn "*fuse_nand_or" [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") - (ior:GPR (ior:GPR (not:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r")) + (ior:GPR (ior:GPR (not:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r")) (not:GPR (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"))] @@ -1147,11 +1255,11 @@ (define_insn "*fuse_nand_or" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; scalar nor -> or (define_insn "*fuse_nor_or" [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") - (ior:GPR (and:GPR (not:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r")) + (ior:GPR (and:GPR (not:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r")) (not:GPR (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"))] @@ -1165,11 +1273,11 @@ (define_insn "*fuse_nor_or" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; scalar or -> or (define_insn "*fuse_or_or" [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") - (ior:GPR (ior:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r") + (ior:GPR (ior: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"))] @@ -1183,11 +1291,11 @@ (define_insn "*fuse_or_or" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; scalar orc -> or (define_insn "*fuse_orc_or" [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") - (ior:GPR (ior:GPR (not:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r")) + (ior:GPR (ior:GPR (not: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"))] @@ -1201,11 +1309,11 @@ (define_insn "*fuse_orc_or" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; scalar xor -> or (define_insn "*fuse_xor_or" [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") - (ior:GPR (xor:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r") + (ior:GPR (xor: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"))] @@ -1219,11 +1327,47 @@ (define_insn "*fuse_xor_or" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; 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 && TARGET_P10_FUSION_ADDLOG)" + "@ + 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 && TARGET_P10_FUSION_ADDLOG)" + "@ + 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" [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") - (ior:GPR (and:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r") + (ior:GPR (and: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"))] @@ -1237,11 +1381,11 @@ (define_insn "*fuse_and_orc" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; scalar andc -> orc (define_insn "*fuse_andc_orc" [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") - (ior:GPR (and:GPR (not:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r")) + (ior:GPR (and:GPR (not: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"))] @@ -1255,11 +1399,11 @@ (define_insn "*fuse_andc_orc" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; scalar eqv -> orc (define_insn "*fuse_eqv_orc" [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") - (ior:GPR (not:GPR (xor:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r") + (ior:GPR (not:GPR (xor: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"))] @@ -1273,11 +1417,11 @@ (define_insn "*fuse_eqv_orc" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; scalar nand -> orc (define_insn "*fuse_nand_orc" [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") - (ior:GPR (ior:GPR (not:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r")) + (ior:GPR (ior:GPR (not:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r")) (not:GPR (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"))] @@ -1291,11 +1435,11 @@ (define_insn "*fuse_nand_orc" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; scalar nor -> orc (define_insn "*fuse_nor_orc" [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") - (ior:GPR (and:GPR (not:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r")) + (ior:GPR (and:GPR (not:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r")) (not:GPR (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"))] @@ -1309,11 +1453,11 @@ (define_insn "*fuse_nor_orc" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; scalar or -> orc (define_insn "*fuse_or_orc" [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") - (ior:GPR (ior:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r") + (ior:GPR (ior: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"))] @@ -1327,11 +1471,11 @@ (define_insn "*fuse_or_orc" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; scalar orc -> orc (define_insn "*fuse_orc_orc" [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") - (ior:GPR (ior:GPR (not:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r")) + (ior:GPR (ior:GPR (not: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"))] @@ -1345,11 +1489,11 @@ (define_insn "*fuse_orc_orc" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; scalar xor -> orc (define_insn "*fuse_xor_orc" [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") - (ior:GPR (xor:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r") + (ior:GPR (xor: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"))] @@ -1363,11 +1507,11 @@ (define_insn "*fuse_xor_orc" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; scalar and -> xor (define_insn "*fuse_and_xor" [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") - (xor:GPR (and:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r") + (xor:GPR (and: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"))] @@ -1381,11 +1525,11 @@ (define_insn "*fuse_and_xor" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; scalar andc -> xor (define_insn "*fuse_andc_xor" [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") - (xor:GPR (and:GPR (not:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r")) + (xor:GPR (and:GPR (not: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"))] @@ -1399,11 +1543,11 @@ (define_insn "*fuse_andc_xor" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; scalar eqv -> xor (define_insn "*fuse_eqv_xor" [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") - (xor:GPR (not:GPR (xor:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r") + (xor:GPR (not:GPR (xor: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"))] @@ -1417,11 +1561,11 @@ (define_insn "*fuse_eqv_xor" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; scalar nand -> xor (define_insn "*fuse_nand_xor" [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") - (xor:GPR (ior:GPR (not:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r")) + (xor:GPR (ior:GPR (not:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r")) (not:GPR (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"))] @@ -1435,11 +1579,11 @@ (define_insn "*fuse_nand_xor" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; scalar nor -> xor (define_insn "*fuse_nor_xor" [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") - (xor:GPR (and:GPR (not:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r")) + (xor:GPR (and:GPR (not:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r")) (not:GPR (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"))] @@ -1453,11 +1597,11 @@ (define_insn "*fuse_nor_xor" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; scalar or -> xor (define_insn "*fuse_or_xor" [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") - (xor:GPR (ior:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r") + (xor:GPR (ior: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"))] @@ -1471,11 +1615,11 @@ (define_insn "*fuse_or_xor" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; scalar orc -> xor (define_insn "*fuse_orc_xor" [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") - (xor:GPR (ior:GPR (not:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r")) + (xor:GPR (ior:GPR (not: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"))] @@ -1489,11 +1633,11 @@ (define_insn "*fuse_orc_xor" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; scalar xor -> xor (define_insn "*fuse_xor_xor" [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") - (xor:GPR (xor:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r") + (xor:GPR (xor: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"))] @@ -1507,11 +1651,227 @@ (define_insn "*fuse_xor_xor" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-add fusion pattern generated by gen_logical_addsubf +;; scalar nor -> add +(define_insn "*fuse_nor_add" + [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") + (plus:GPR (and:GPR (not:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r")) + (not:GPR (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 && TARGET_P10_FUSION_LOGADD)" + "@ + nor %3,%1,%0\;add %3,%3,%2 + nor %3,%1,%0\;add %3,%3,%2 + nor %3,%1,%0\;add %3,%3,%2 + nor %4,%1,%0\;add %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 nand -> add +(define_insn "*fuse_nand_add" + [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") + (plus:GPR (ior:GPR (not:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r")) + (not:GPR (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 && TARGET_P10_FUSION_LOGADD)" + "@ + nand %3,%1,%0\;add %3,%3,%2 + nand %3,%1,%0\;add %3,%3,%2 + nand %3,%1,%0\;add %3,%3,%2 + nand %4,%1,%0\;add %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 or -> add +(define_insn "*fuse_or_add" + [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") + (plus:GPR (ior: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 && TARGET_P10_FUSION_LOGADD)" + "@ + or %3,%1,%0\;add %3,%3,%2 + or %3,%1,%0\;add %3,%3,%2 + or %3,%1,%0\;add %3,%3,%2 + or %4,%1,%0\;add %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" + [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") + (plus:GPR (and: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 && TARGET_P10_FUSION_LOGADD)" + "@ + and %3,%1,%0\;add %3,%3,%2 + and %3,%1,%0\;add %3,%3,%2 + and %3,%1,%0\;add %3,%3,%2 + and %4,%1,%0\;add %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 nor -> subf +(define_insn "*fuse_nor_subf" + [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") + (minus:GPR (and:GPR (not:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r")) + (not:GPR (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 && TARGET_P10_FUSION_LOGADD)" + "@ + nor %3,%1,%0\;subf %3,%3,%2 + nor %3,%1,%0\;subf %3,%3,%2 + nor %3,%1,%0\;subf %3,%3,%2 + nor %4,%1,%0\;subf %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 nand -> subf +(define_insn "*fuse_nand_subf" + [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") + (minus:GPR (ior:GPR (not:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r")) + (not:GPR (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 && TARGET_P10_FUSION_LOGADD)" + "@ + nand %3,%1,%0\;subf %3,%3,%2 + nand %3,%1,%0\;subf %3,%3,%2 + nand %3,%1,%0\;subf %3,%3,%2 + nand %4,%1,%0\;subf %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 or -> subf +(define_insn "*fuse_or_subf" + [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") + (minus:GPR (ior: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 && TARGET_P10_FUSION_LOGADD)" + "@ + or %3,%1,%0\;subf %3,%3,%2 + or %3,%1,%0\;subf %3,%3,%2 + or %3,%1,%0\;subf %3,%3,%2 + or %4,%1,%0\;subf %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 -> subf +(define_insn "*fuse_and_subf" + [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") + (minus:GPR (and: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 && TARGET_P10_FUSION_LOGADD)" + "@ + and %3,%1,%0\;subf %3,%3,%2 + and %3,%1,%0\;subf %3,%3,%2 + and %3,%1,%0\;subf %3,%3,%2 + and %4,%1,%0\;subf %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 nor -> rsubf +(define_insn "*fuse_nor_rsubf" + [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") + (minus:GPR (match_operand:GPR 2 "gpc_reg_operand" "r,r,r,r") + (and:GPR (not:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r")) + (not:GPR (match_operand:GPR 1 "gpc_reg_operand" "r,r,r,r"))))) + (clobber (match_scratch:GPR 4 "=X,X,X,&r"))] + "(TARGET_P10_FUSION && TARGET_P10_FUSION_LOGADD)" + "@ + nor %3,%1,%0\;subf %3,%2,%3 + nor %3,%1,%0\;subf %3,%2,%3 + nor %3,%1,%0\;subf %3,%2,%3 + nor %4,%1,%0\;subf %3,%2,%4" + [(set_attr "type" "fused_arith_logical") + (set_attr "cost" "6") + (set_attr "length" "8")]) + +;; logical-add fusion pattern generated by gen_logical_addsubf +;; scalar nand -> rsubf +(define_insn "*fuse_nand_rsubf" + [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") + (minus:GPR (match_operand:GPR 2 "gpc_reg_operand" "r,r,r,r") + (ior:GPR (not:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r")) + (not:GPR (match_operand:GPR 1 "gpc_reg_operand" "r,r,r,r"))))) + (clobber (match_scratch:GPR 4 "=X,X,X,&r"))] + "(TARGET_P10_FUSION && TARGET_P10_FUSION_LOGADD)" + "@ + nand %3,%1,%0\;subf %3,%2,%3 + nand %3,%1,%0\;subf %3,%2,%3 + nand %3,%1,%0\;subf %3,%2,%3 + nand %4,%1,%0\;subf %3,%2,%4" + [(set_attr "type" "fused_arith_logical") + (set_attr "cost" "6") + (set_attr "length" "8")]) + +;; logical-add fusion pattern generated by gen_logical_addsubf +;; scalar or -> rsubf +(define_insn "*fuse_or_rsubf" + [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") + (minus:GPR (match_operand:GPR 2 "gpc_reg_operand" "r,r,r,r") + (ior:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r") + (match_operand:GPR 1 "gpc_reg_operand" "r,r,r,r")))) + (clobber (match_scratch:GPR 4 "=X,X,X,&r"))] + "(TARGET_P10_FUSION && TARGET_P10_FUSION_LOGADD)" + "@ + or %3,%1,%0\;subf %3,%2,%3 + or %3,%1,%0\;subf %3,%2,%3 + or %3,%1,%0\;subf %3,%2,%3 + or %4,%1,%0\;subf %3,%2,%4" + [(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 -> rsubf +(define_insn "*fuse_and_rsubf" + [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") + (minus:GPR (match_operand:GPR 2 "gpc_reg_operand" "r,r,r,r") + (and:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r") + (match_operand:GPR 1 "gpc_reg_operand" "r,r,r,r")))) + (clobber (match_scratch:GPR 4 "=X,X,X,&r"))] + "(TARGET_P10_FUSION && TARGET_P10_FUSION_LOGADD)" + "@ + and %3,%1,%0\;subf %3,%2,%3 + and %3,%1,%0\;subf %3,%2,%3 + and %3,%1,%0\;subf %3,%2,%3 + and %4,%1,%0\;subf %3,%2,%4" + [(set_attr "type" "fused_arith_logical") + (set_attr "cost" "6") + (set_attr "length" "8")]) + +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; vector vand -> vand (define_insn "*fuse_vand_vand" [(set (match_operand:VM 3 "altivec_register_operand" "=0,1,&v,v") - (and:VM (and:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v") + (and:VM (and:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v") (match_operand:VM 1 "altivec_register_operand" "%v,v,v,v")) (match_operand:VM 2 "altivec_register_operand" "v,v,v,v"))) (clobber (match_scratch:VM 4 "=X,X,X,&r"))] @@ -1525,11 +1885,11 @@ (define_insn "*fuse_vand_vand" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; vector vandc -> vand (define_insn "*fuse_vandc_vand" [(set (match_operand:VM 3 "altivec_register_operand" "=0,1,&v,v") - (and:VM (and:VM (not:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v")) + (and:VM (and:VM (not:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v")) (match_operand:VM 1 "altivec_register_operand" "v,v,v,v")) (match_operand:VM 2 "altivec_register_operand" "v,v,v,v"))) (clobber (match_scratch:VM 4 "=X,X,X,&r"))] @@ -1543,11 +1903,11 @@ (define_insn "*fuse_vandc_vand" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; vector veqv -> vand (define_insn "*fuse_veqv_vand" [(set (match_operand:VM 3 "altivec_register_operand" "=0,1,&v,v") - (and:VM (not:VM (xor:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v") + (and:VM (not:VM (xor:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v") (match_operand:VM 1 "altivec_register_operand" "v,v,v,v"))) (match_operand:VM 2 "altivec_register_operand" "v,v,v,v"))) (clobber (match_scratch:VM 4 "=X,X,X,&r"))] @@ -1561,11 +1921,11 @@ (define_insn "*fuse_veqv_vand" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; vector vnand -> vand (define_insn "*fuse_vnand_vand" [(set (match_operand:VM 3 "altivec_register_operand" "=0,1,&v,v") - (and:VM (ior:VM (not:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v")) + (and:VM (ior:VM (not:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v")) (not:VM (match_operand:VM 1 "altivec_register_operand" "v,v,v,v"))) (match_operand:VM 2 "altivec_register_operand" "v,v,v,v"))) (clobber (match_scratch:VM 4 "=X,X,X,&r"))] @@ -1579,11 +1939,11 @@ (define_insn "*fuse_vnand_vand" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; vector vnor -> vand (define_insn "*fuse_vnor_vand" [(set (match_operand:VM 3 "altivec_register_operand" "=0,1,&v,v") - (and:VM (and:VM (not:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v")) + (and:VM (and:VM (not:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v")) (not:VM (match_operand:VM 1 "altivec_register_operand" "v,v,v,v"))) (match_operand:VM 2 "altivec_register_operand" "v,v,v,v"))) (clobber (match_scratch:VM 4 "=X,X,X,&r"))] @@ -1597,11 +1957,11 @@ (define_insn "*fuse_vnor_vand" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; vector vor -> vand (define_insn "*fuse_vor_vand" [(set (match_operand:VM 3 "altivec_register_operand" "=0,1,&v,v") - (and:VM (ior:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v") + (and:VM (ior:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v") (match_operand:VM 1 "altivec_register_operand" "v,v,v,v")) (match_operand:VM 2 "altivec_register_operand" "v,v,v,v"))) (clobber (match_scratch:VM 4 "=X,X,X,&r"))] @@ -1615,11 +1975,11 @@ (define_insn "*fuse_vor_vand" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; vector vorc -> vand (define_insn "*fuse_vorc_vand" [(set (match_operand:VM 3 "altivec_register_operand" "=0,1,&v,v") - (and:VM (ior:VM (not:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v")) + (and:VM (ior:VM (not:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v")) (match_operand:VM 1 "altivec_register_operand" "v,v,v,v")) (match_operand:VM 2 "altivec_register_operand" "v,v,v,v"))) (clobber (match_scratch:VM 4 "=X,X,X,&r"))] @@ -1633,11 +1993,11 @@ (define_insn "*fuse_vorc_vand" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; vector vxor -> vand (define_insn "*fuse_vxor_vand" [(set (match_operand:VM 3 "altivec_register_operand" "=0,1,&v,v") - (and:VM (xor:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v") + (and:VM (xor:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v") (match_operand:VM 1 "altivec_register_operand" "v,v,v,v")) (match_operand:VM 2 "altivec_register_operand" "v,v,v,v"))) (clobber (match_scratch:VM 4 "=X,X,X,&r"))] @@ -1651,11 +2011,11 @@ (define_insn "*fuse_vxor_vand" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; vector vand -> vandc (define_insn "*fuse_vand_vandc" [(set (match_operand:VM 3 "altivec_register_operand" "=0,1,&v,v") - (and:VM (and:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v") + (and:VM (and:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v") (match_operand:VM 1 "altivec_register_operand" "v,v,v,v")) (not:VM (match_operand:VM 2 "altivec_register_operand" "v,v,v,v")))) (clobber (match_scratch:VM 4 "=X,X,X,&r"))] @@ -1669,11 +2029,11 @@ (define_insn "*fuse_vand_vandc" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; vector vandc -> vandc (define_insn "*fuse_vandc_vandc" [(set (match_operand:VM 3 "altivec_register_operand" "=0,1,&v,v") - (and:VM (and:VM (not:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v")) + (and:VM (and:VM (not:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v")) (match_operand:VM 1 "altivec_register_operand" "v,v,v,v")) (not:VM (match_operand:VM 2 "altivec_register_operand" "v,v,v,v")))) (clobber (match_scratch:VM 4 "=X,X,X,&r"))] @@ -1687,11 +2047,11 @@ (define_insn "*fuse_vandc_vandc" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; vector veqv -> vandc (define_insn "*fuse_veqv_vandc" [(set (match_operand:VM 3 "altivec_register_operand" "=0,1,&v,v") - (and:VM (not:VM (xor:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v") + (and:VM (not:VM (xor:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v") (match_operand:VM 1 "altivec_register_operand" "v,v,v,v"))) (not:VM (match_operand:VM 2 "altivec_register_operand" "v,v,v,v")))) (clobber (match_scratch:VM 4 "=X,X,X,&r"))] @@ -1705,11 +2065,11 @@ (define_insn "*fuse_veqv_vandc" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; vector vnand -> vandc (define_insn "*fuse_vnand_vandc" [(set (match_operand:VM 3 "altivec_register_operand" "=0,1,&v,v") - (and:VM (ior:VM (not:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v")) + (and:VM (ior:VM (not:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v")) (not:VM (match_operand:VM 1 "altivec_register_operand" "v,v,v,v"))) (not:VM (match_operand:VM 2 "altivec_register_operand" "v,v,v,v")))) (clobber (match_scratch:VM 4 "=X,X,X,&r"))] @@ -1723,11 +2083,11 @@ (define_insn "*fuse_vnand_vandc" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; vector vnor -> vandc (define_insn "*fuse_vnor_vandc" [(set (match_operand:VM 3 "altivec_register_operand" "=0,1,&v,v") - (and:VM (and:VM (not:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v")) + (and:VM (and:VM (not:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v")) (not:VM (match_operand:VM 1 "altivec_register_operand" "v,v,v,v"))) (not:VM (match_operand:VM 2 "altivec_register_operand" "v,v,v,v")))) (clobber (match_scratch:VM 4 "=X,X,X,&r"))] @@ -1741,11 +2101,11 @@ (define_insn "*fuse_vnor_vandc" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; vector vor -> vandc (define_insn "*fuse_vor_vandc" [(set (match_operand:VM 3 "altivec_register_operand" "=0,1,&v,v") - (and:VM (ior:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v") + (and:VM (ior:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v") (match_operand:VM 1 "altivec_register_operand" "v,v,v,v")) (not:VM (match_operand:VM 2 "altivec_register_operand" "v,v,v,v")))) (clobber (match_scratch:VM 4 "=X,X,X,&r"))] @@ -1759,11 +2119,11 @@ (define_insn "*fuse_vor_vandc" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; vector vorc -> vandc (define_insn "*fuse_vorc_vandc" [(set (match_operand:VM 3 "altivec_register_operand" "=0,1,&v,v") - (and:VM (ior:VM (not:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v")) + (and:VM (ior:VM (not:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v")) (match_operand:VM 1 "altivec_register_operand" "v,v,v,v")) (not:VM (match_operand:VM 2 "altivec_register_operand" "v,v,v,v")))) (clobber (match_scratch:VM 4 "=X,X,X,&r"))] @@ -1777,11 +2137,11 @@ (define_insn "*fuse_vorc_vandc" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; vector vxor -> vandc (define_insn "*fuse_vxor_vandc" [(set (match_operand:VM 3 "altivec_register_operand" "=0,1,&v,v") - (and:VM (xor:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v") + (and:VM (xor:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v") (match_operand:VM 1 "altivec_register_operand" "v,v,v,v")) (not:VM (match_operand:VM 2 "altivec_register_operand" "v,v,v,v")))) (clobber (match_scratch:VM 4 "=X,X,X,&r"))] @@ -1795,11 +2155,11 @@ (define_insn "*fuse_vxor_vandc" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; vector vand -> veqv (define_insn "*fuse_vand_veqv" [(set (match_operand:VM 3 "altivec_register_operand" "=0,1,&v,v") - (not:VM (xor:VM (and:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v") + (not:VM (xor:VM (and:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v") (match_operand:VM 1 "altivec_register_operand" "v,v,v,v")) (match_operand:VM 2 "altivec_register_operand" "v,v,v,v")))) (clobber (match_scratch:VM 4 "=X,X,X,&r"))] @@ -1813,11 +2173,11 @@ (define_insn "*fuse_vand_veqv" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; vector vandc -> veqv (define_insn "*fuse_vandc_veqv" [(set (match_operand:VM 3 "altivec_register_operand" "=0,1,&v,v") - (not:VM (xor:VM (and:VM (not:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v")) + (not:VM (xor:VM (and:VM (not:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v")) (match_operand:VM 1 "altivec_register_operand" "v,v,v,v")) (match_operand:VM 2 "altivec_register_operand" "v,v,v,v")))) (clobber (match_scratch:VM 4 "=X,X,X,&r"))] @@ -1831,11 +2191,11 @@ (define_insn "*fuse_vandc_veqv" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; vector veqv -> veqv (define_insn "*fuse_veqv_veqv" [(set (match_operand:VM 3 "altivec_register_operand" "=0,1,&v,v") - (not:VM (xor:VM (not:VM (xor:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v") + (not:VM (xor:VM (not:VM (xor:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v") (match_operand:VM 1 "altivec_register_operand" "%v,v,v,v"))) (match_operand:VM 2 "altivec_register_operand" "v,v,v,v")))) (clobber (match_scratch:VM 4 "=X,X,X,&r"))] @@ -1849,11 +2209,11 @@ (define_insn "*fuse_veqv_veqv" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; vector vnand -> veqv (define_insn "*fuse_vnand_veqv" [(set (match_operand:VM 3 "altivec_register_operand" "=0,1,&v,v") - (not:VM (xor:VM (ior:VM (not:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v")) + (not:VM (xor:VM (ior:VM (not:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v")) (not:VM (match_operand:VM 1 "altivec_register_operand" "v,v,v,v"))) (match_operand:VM 2 "altivec_register_operand" "v,v,v,v")))) (clobber (match_scratch:VM 4 "=X,X,X,&r"))] @@ -1867,11 +2227,11 @@ (define_insn "*fuse_vnand_veqv" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; vector vnor -> veqv (define_insn "*fuse_vnor_veqv" [(set (match_operand:VM 3 "altivec_register_operand" "=0,1,&v,v") - (not:VM (xor:VM (and:VM (not:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v")) + (not:VM (xor:VM (and:VM (not:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v")) (not:VM (match_operand:VM 1 "altivec_register_operand" "v,v,v,v"))) (match_operand:VM 2 "altivec_register_operand" "v,v,v,v")))) (clobber (match_scratch:VM 4 "=X,X,X,&r"))] @@ -1885,11 +2245,11 @@ (define_insn "*fuse_vnor_veqv" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; vector vor -> veqv (define_insn "*fuse_vor_veqv" [(set (match_operand:VM 3 "altivec_register_operand" "=0,1,&v,v") - (not:VM (xor:VM (ior:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v") + (not:VM (xor:VM (ior:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v") (match_operand:VM 1 "altivec_register_operand" "v,v,v,v")) (match_operand:VM 2 "altivec_register_operand" "v,v,v,v")))) (clobber (match_scratch:VM 4 "=X,X,X,&r"))] @@ -1903,11 +2263,11 @@ (define_insn "*fuse_vor_veqv" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; vector vorc -> veqv (define_insn "*fuse_vorc_veqv" [(set (match_operand:VM 3 "altivec_register_operand" "=0,1,&v,v") - (not:VM (xor:VM (ior:VM (not:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v")) + (not:VM (xor:VM (ior:VM (not:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v")) (match_operand:VM 1 "altivec_register_operand" "v,v,v,v")) (match_operand:VM 2 "altivec_register_operand" "v,v,v,v")))) (clobber (match_scratch:VM 4 "=X,X,X,&r"))] @@ -1921,11 +2281,11 @@ (define_insn "*fuse_vorc_veqv" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; vector vxor -> veqv (define_insn "*fuse_vxor_veqv" [(set (match_operand:VM 3 "altivec_register_operand" "=0,1,&v,v") - (not:VM (xor:VM (xor:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v") + (not:VM (xor:VM (xor:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v") (match_operand:VM 1 "altivec_register_operand" "v,v,v,v")) (match_operand:VM 2 "altivec_register_operand" "v,v,v,v")))) (clobber (match_scratch:VM 4 "=X,X,X,&r"))] @@ -1939,11 +2299,11 @@ (define_insn "*fuse_vxor_veqv" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; vector vand -> vnand (define_insn "*fuse_vand_vnand" [(set (match_operand:VM 3 "altivec_register_operand" "=0,1,&v,v") - (ior:VM (not:VM (and:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v") + (ior:VM (not:VM (and:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v") (match_operand:VM 1 "altivec_register_operand" "v,v,v,v"))) (not:VM (match_operand:VM 2 "altivec_register_operand" "v,v,v,v")))) (clobber (match_scratch:VM 4 "=X,X,X,&r"))] @@ -1957,11 +2317,11 @@ (define_insn "*fuse_vand_vnand" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; vector vandc -> vnand (define_insn "*fuse_vandc_vnand" [(set (match_operand:VM 3 "altivec_register_operand" "=0,1,&v,v") - (ior:VM (not:VM (and:VM (not:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v")) + (ior:VM (not:VM (and:VM (not:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v")) (match_operand:VM 1 "altivec_register_operand" "v,v,v,v"))) (not:VM (match_operand:VM 2 "altivec_register_operand" "v,v,v,v")))) (clobber (match_scratch:VM 4 "=X,X,X,&r"))] @@ -1975,11 +2335,11 @@ (define_insn "*fuse_vandc_vnand" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; vector veqv -> vnand (define_insn "*fuse_veqv_vnand" [(set (match_operand:VM 3 "altivec_register_operand" "=0,1,&v,v") - (ior:VM (not:VM (not:VM (xor:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v") + (ior:VM (not:VM (not:VM (xor:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v") (match_operand:VM 1 "altivec_register_operand" "v,v,v,v")))) (not:VM (match_operand:VM 2 "altivec_register_operand" "v,v,v,v")))) (clobber (match_scratch:VM 4 "=X,X,X,&r"))] @@ -1993,11 +2353,11 @@ (define_insn "*fuse_veqv_vnand" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; vector vnand -> vnand (define_insn "*fuse_vnand_vnand" [(set (match_operand:VM 3 "altivec_register_operand" "=0,1,&v,v") - (ior:VM (not:VM (ior:VM (not:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v")) + (ior:VM (not:VM (ior:VM (not:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v")) (not:VM (match_operand:VM 1 "altivec_register_operand" "v,v,v,v")))) (not:VM (match_operand:VM 2 "altivec_register_operand" "v,v,v,v")))) (clobber (match_scratch:VM 4 "=X,X,X,&r"))] @@ -2011,11 +2371,11 @@ (define_insn "*fuse_vnand_vnand" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; vector vnor -> vnand (define_insn "*fuse_vnor_vnand" [(set (match_operand:VM 3 "altivec_register_operand" "=0,1,&v,v") - (ior:VM (not:VM (and:VM (not:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v")) + (ior:VM (not:VM (and:VM (not:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v")) (not:VM (match_operand:VM 1 "altivec_register_operand" "v,v,v,v")))) (not:VM (match_operand:VM 2 "altivec_register_operand" "v,v,v,v")))) (clobber (match_scratch:VM 4 "=X,X,X,&r"))] @@ -2029,11 +2389,11 @@ (define_insn "*fuse_vnor_vnand" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; vector vor -> vnand (define_insn "*fuse_vor_vnand" [(set (match_operand:VM 3 "altivec_register_operand" "=0,1,&v,v") - (ior:VM (not:VM (ior:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v") + (ior:VM (not:VM (ior:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v") (match_operand:VM 1 "altivec_register_operand" "v,v,v,v"))) (not:VM (match_operand:VM 2 "altivec_register_operand" "v,v,v,v")))) (clobber (match_scratch:VM 4 "=X,X,X,&r"))] @@ -2047,11 +2407,11 @@ (define_insn "*fuse_vor_vnand" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; vector vorc -> vnand (define_insn "*fuse_vorc_vnand" [(set (match_operand:VM 3 "altivec_register_operand" "=0,1,&v,v") - (ior:VM (not:VM (ior:VM (not:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v")) + (ior:VM (not:VM (ior:VM (not:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v")) (match_operand:VM 1 "altivec_register_operand" "v,v,v,v"))) (not:VM (match_operand:VM 2 "altivec_register_operand" "v,v,v,v")))) (clobber (match_scratch:VM 4 "=X,X,X,&r"))] @@ -2065,11 +2425,11 @@ (define_insn "*fuse_vorc_vnand" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; vector vxor -> vnand (define_insn "*fuse_vxor_vnand" [(set (match_operand:VM 3 "altivec_register_operand" "=0,1,&v,v") - (ior:VM (not:VM (xor:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v") + (ior:VM (not:VM (xor:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v") (match_operand:VM 1 "altivec_register_operand" "v,v,v,v"))) (not:VM (match_operand:VM 2 "altivec_register_operand" "v,v,v,v")))) (clobber (match_scratch:VM 4 "=X,X,X,&r"))] @@ -2083,11 +2443,11 @@ (define_insn "*fuse_vxor_vnand" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; vector vand -> vnor (define_insn "*fuse_vand_vnor" [(set (match_operand:VM 3 "altivec_register_operand" "=0,1,&v,v") - (and:VM (not:VM (and:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v") + (and:VM (not:VM (and:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v") (match_operand:VM 1 "altivec_register_operand" "v,v,v,v"))) (not:VM (match_operand:VM 2 "altivec_register_operand" "v,v,v,v")))) (clobber (match_scratch:VM 4 "=X,X,X,&r"))] @@ -2101,11 +2461,11 @@ (define_insn "*fuse_vand_vnor" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; vector vandc -> vnor (define_insn "*fuse_vandc_vnor" [(set (match_operand:VM 3 "altivec_register_operand" "=0,1,&v,v") - (and:VM (not:VM (and:VM (not:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v")) + (and:VM (not:VM (and:VM (not:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v")) (match_operand:VM 1 "altivec_register_operand" "v,v,v,v"))) (not:VM (match_operand:VM 2 "altivec_register_operand" "v,v,v,v")))) (clobber (match_scratch:VM 4 "=X,X,X,&r"))] @@ -2119,11 +2479,11 @@ (define_insn "*fuse_vandc_vnor" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; vector veqv -> vnor (define_insn "*fuse_veqv_vnor" [(set (match_operand:VM 3 "altivec_register_operand" "=0,1,&v,v") - (and:VM (not:VM (not:VM (xor:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v") + (and:VM (not:VM (not:VM (xor:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v") (match_operand:VM 1 "altivec_register_operand" "v,v,v,v")))) (not:VM (match_operand:VM 2 "altivec_register_operand" "v,v,v,v")))) (clobber (match_scratch:VM 4 "=X,X,X,&r"))] @@ -2137,11 +2497,11 @@ (define_insn "*fuse_veqv_vnor" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; vector vnand -> vnor (define_insn "*fuse_vnand_vnor" [(set (match_operand:VM 3 "altivec_register_operand" "=0,1,&v,v") - (and:VM (not:VM (ior:VM (not:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v")) + (and:VM (not:VM (ior:VM (not:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v")) (not:VM (match_operand:VM 1 "altivec_register_operand" "v,v,v,v")))) (not:VM (match_operand:VM 2 "altivec_register_operand" "v,v,v,v")))) (clobber (match_scratch:VM 4 "=X,X,X,&r"))] @@ -2155,11 +2515,11 @@ (define_insn "*fuse_vnand_vnor" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; vector vnor -> vnor (define_insn "*fuse_vnor_vnor" [(set (match_operand:VM 3 "altivec_register_operand" "=0,1,&v,v") - (and:VM (not:VM (and:VM (not:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v")) + (and:VM (not:VM (and:VM (not:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v")) (not:VM (match_operand:VM 1 "altivec_register_operand" "v,v,v,v")))) (not:VM (match_operand:VM 2 "altivec_register_operand" "v,v,v,v")))) (clobber (match_scratch:VM 4 "=X,X,X,&r"))] @@ -2173,11 +2533,11 @@ (define_insn "*fuse_vnor_vnor" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; vector vor -> vnor (define_insn "*fuse_vor_vnor" [(set (match_operand:VM 3 "altivec_register_operand" "=0,1,&v,v") - (and:VM (not:VM (ior:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v") + (and:VM (not:VM (ior:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v") (match_operand:VM 1 "altivec_register_operand" "v,v,v,v"))) (not:VM (match_operand:VM 2 "altivec_register_operand" "v,v,v,v")))) (clobber (match_scratch:VM 4 "=X,X,X,&r"))] @@ -2191,11 +2551,11 @@ (define_insn "*fuse_vor_vnor" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; vector vorc -> vnor (define_insn "*fuse_vorc_vnor" [(set (match_operand:VM 3 "altivec_register_operand" "=0,1,&v,v") - (and:VM (not:VM (ior:VM (not:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v")) + (and:VM (not:VM (ior:VM (not:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v")) (match_operand:VM 1 "altivec_register_operand" "v,v,v,v"))) (not:VM (match_operand:VM 2 "altivec_register_operand" "v,v,v,v")))) (clobber (match_scratch:VM 4 "=X,X,X,&r"))] @@ -2209,11 +2569,11 @@ (define_insn "*fuse_vorc_vnor" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; vector vxor -> vnor (define_insn "*fuse_vxor_vnor" [(set (match_operand:VM 3 "altivec_register_operand" "=0,1,&v,v") - (and:VM (not:VM (xor:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v") + (and:VM (not:VM (xor:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v") (match_operand:VM 1 "altivec_register_operand" "v,v,v,v"))) (not:VM (match_operand:VM 2 "altivec_register_operand" "v,v,v,v")))) (clobber (match_scratch:VM 4 "=X,X,X,&r"))] @@ -2227,11 +2587,11 @@ (define_insn "*fuse_vxor_vnor" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; vector vand -> vor (define_insn "*fuse_vand_vor" [(set (match_operand:VM 3 "altivec_register_operand" "=0,1,&v,v") - (ior:VM (and:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v") + (ior:VM (and:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v") (match_operand:VM 1 "altivec_register_operand" "v,v,v,v")) (match_operand:VM 2 "altivec_register_operand" "v,v,v,v"))) (clobber (match_scratch:VM 4 "=X,X,X,&r"))] @@ -2245,11 +2605,11 @@ (define_insn "*fuse_vand_vor" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; vector vandc -> vor (define_insn "*fuse_vandc_vor" [(set (match_operand:VM 3 "altivec_register_operand" "=0,1,&v,v") - (ior:VM (and:VM (not:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v")) + (ior:VM (and:VM (not:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v")) (match_operand:VM 1 "altivec_register_operand" "v,v,v,v")) (match_operand:VM 2 "altivec_register_operand" "v,v,v,v"))) (clobber (match_scratch:VM 4 "=X,X,X,&r"))] @@ -2263,11 +2623,11 @@ (define_insn "*fuse_vandc_vor" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; vector veqv -> vor (define_insn "*fuse_veqv_vor" [(set (match_operand:VM 3 "altivec_register_operand" "=0,1,&v,v") - (ior:VM (not:VM (xor:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v") + (ior:VM (not:VM (xor:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v") (match_operand:VM 1 "altivec_register_operand" "v,v,v,v"))) (match_operand:VM 2 "altivec_register_operand" "v,v,v,v"))) (clobber (match_scratch:VM 4 "=X,X,X,&r"))] @@ -2281,11 +2641,11 @@ (define_insn "*fuse_veqv_vor" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; vector vnand -> vor (define_insn "*fuse_vnand_vor" [(set (match_operand:VM 3 "altivec_register_operand" "=0,1,&v,v") - (ior:VM (ior:VM (not:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v")) + (ior:VM (ior:VM (not:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v")) (not:VM (match_operand:VM 1 "altivec_register_operand" "v,v,v,v"))) (match_operand:VM 2 "altivec_register_operand" "v,v,v,v"))) (clobber (match_scratch:VM 4 "=X,X,X,&r"))] @@ -2299,11 +2659,11 @@ (define_insn "*fuse_vnand_vor" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; vector vnor -> vor (define_insn "*fuse_vnor_vor" [(set (match_operand:VM 3 "altivec_register_operand" "=0,1,&v,v") - (ior:VM (and:VM (not:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v")) + (ior:VM (and:VM (not:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v")) (not:VM (match_operand:VM 1 "altivec_register_operand" "v,v,v,v"))) (match_operand:VM 2 "altivec_register_operand" "v,v,v,v"))) (clobber (match_scratch:VM 4 "=X,X,X,&r"))] @@ -2317,11 +2677,11 @@ (define_insn "*fuse_vnor_vor" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; vector vor -> vor (define_insn "*fuse_vor_vor" [(set (match_operand:VM 3 "altivec_register_operand" "=0,1,&v,v") - (ior:VM (ior:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v") + (ior:VM (ior:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v") (match_operand:VM 1 "altivec_register_operand" "%v,v,v,v")) (match_operand:VM 2 "altivec_register_operand" "v,v,v,v"))) (clobber (match_scratch:VM 4 "=X,X,X,&r"))] @@ -2335,11 +2695,11 @@ (define_insn "*fuse_vor_vor" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; vector vorc -> vor (define_insn "*fuse_vorc_vor" [(set (match_operand:VM 3 "altivec_register_operand" "=0,1,&v,v") - (ior:VM (ior:VM (not:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v")) + (ior:VM (ior:VM (not:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v")) (match_operand:VM 1 "altivec_register_operand" "v,v,v,v")) (match_operand:VM 2 "altivec_register_operand" "v,v,v,v"))) (clobber (match_scratch:VM 4 "=X,X,X,&r"))] @@ -2353,11 +2713,11 @@ (define_insn "*fuse_vorc_vor" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; vector vxor -> vor (define_insn "*fuse_vxor_vor" [(set (match_operand:VM 3 "altivec_register_operand" "=0,1,&v,v") - (ior:VM (xor:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v") + (ior:VM (xor:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v") (match_operand:VM 1 "altivec_register_operand" "v,v,v,v")) (match_operand:VM 2 "altivec_register_operand" "v,v,v,v"))) (clobber (match_scratch:VM 4 "=X,X,X,&r"))] @@ -2371,11 +2731,11 @@ (define_insn "*fuse_vxor_vor" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; vector vand -> vorc (define_insn "*fuse_vand_vorc" [(set (match_operand:VM 3 "altivec_register_operand" "=0,1,&v,v") - (ior:VM (and:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v") + (ior:VM (and:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v") (match_operand:VM 1 "altivec_register_operand" "v,v,v,v")) (not:VM (match_operand:VM 2 "altivec_register_operand" "v,v,v,v")))) (clobber (match_scratch:VM 4 "=X,X,X,&r"))] @@ -2389,11 +2749,11 @@ (define_insn "*fuse_vand_vorc" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; vector vandc -> vorc (define_insn "*fuse_vandc_vorc" [(set (match_operand:VM 3 "altivec_register_operand" "=0,1,&v,v") - (ior:VM (and:VM (not:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v")) + (ior:VM (and:VM (not:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v")) (match_operand:VM 1 "altivec_register_operand" "v,v,v,v")) (not:VM (match_operand:VM 2 "altivec_register_operand" "v,v,v,v")))) (clobber (match_scratch:VM 4 "=X,X,X,&r"))] @@ -2407,11 +2767,11 @@ (define_insn "*fuse_vandc_vorc" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; vector veqv -> vorc (define_insn "*fuse_veqv_vorc" [(set (match_operand:VM 3 "altivec_register_operand" "=0,1,&v,v") - (ior:VM (not:VM (xor:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v") + (ior:VM (not:VM (xor:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v") (match_operand:VM 1 "altivec_register_operand" "v,v,v,v"))) (not:VM (match_operand:VM 2 "altivec_register_operand" "v,v,v,v")))) (clobber (match_scratch:VM 4 "=X,X,X,&r"))] @@ -2425,11 +2785,11 @@ (define_insn "*fuse_veqv_vorc" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; vector vnand -> vorc (define_insn "*fuse_vnand_vorc" [(set (match_operand:VM 3 "altivec_register_operand" "=0,1,&v,v") - (ior:VM (ior:VM (not:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v")) + (ior:VM (ior:VM (not:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v")) (not:VM (match_operand:VM 1 "altivec_register_operand" "v,v,v,v"))) (not:VM (match_operand:VM 2 "altivec_register_operand" "v,v,v,v")))) (clobber (match_scratch:VM 4 "=X,X,X,&r"))] @@ -2443,11 +2803,11 @@ (define_insn "*fuse_vnand_vorc" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; vector vnor -> vorc (define_insn "*fuse_vnor_vorc" [(set (match_operand:VM 3 "altivec_register_operand" "=0,1,&v,v") - (ior:VM (and:VM (not:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v")) + (ior:VM (and:VM (not:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v")) (not:VM (match_operand:VM 1 "altivec_register_operand" "v,v,v,v"))) (not:VM (match_operand:VM 2 "altivec_register_operand" "v,v,v,v")))) (clobber (match_scratch:VM 4 "=X,X,X,&r"))] @@ -2461,11 +2821,11 @@ (define_insn "*fuse_vnor_vorc" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; vector vor -> vorc (define_insn "*fuse_vor_vorc" [(set (match_operand:VM 3 "altivec_register_operand" "=0,1,&v,v") - (ior:VM (ior:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v") + (ior:VM (ior:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v") (match_operand:VM 1 "altivec_register_operand" "v,v,v,v")) (not:VM (match_operand:VM 2 "altivec_register_operand" "v,v,v,v")))) (clobber (match_scratch:VM 4 "=X,X,X,&r"))] @@ -2479,11 +2839,11 @@ (define_insn "*fuse_vor_vorc" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; vector vorc -> vorc (define_insn "*fuse_vorc_vorc" [(set (match_operand:VM 3 "altivec_register_operand" "=0,1,&v,v") - (ior:VM (ior:VM (not:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v")) + (ior:VM (ior:VM (not:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v")) (match_operand:VM 1 "altivec_register_operand" "v,v,v,v")) (not:VM (match_operand:VM 2 "altivec_register_operand" "v,v,v,v")))) (clobber (match_scratch:VM 4 "=X,X,X,&r"))] @@ -2497,11 +2857,11 @@ (define_insn "*fuse_vorc_vorc" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; vector vxor -> vorc (define_insn "*fuse_vxor_vorc" [(set (match_operand:VM 3 "altivec_register_operand" "=0,1,&v,v") - (ior:VM (xor:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v") + (ior:VM (xor:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v") (match_operand:VM 1 "altivec_register_operand" "v,v,v,v")) (not:VM (match_operand:VM 2 "altivec_register_operand" "v,v,v,v")))) (clobber (match_scratch:VM 4 "=X,X,X,&r"))] @@ -2515,11 +2875,11 @@ (define_insn "*fuse_vxor_vorc" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; vector vand -> vxor (define_insn "*fuse_vand_vxor" [(set (match_operand:VM 3 "altivec_register_operand" "=0,1,&v,v") - (xor:VM (and:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v") + (xor:VM (and:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v") (match_operand:VM 1 "altivec_register_operand" "v,v,v,v")) (match_operand:VM 2 "altivec_register_operand" "v,v,v,v"))) (clobber (match_scratch:VM 4 "=X,X,X,&r"))] @@ -2533,11 +2893,11 @@ (define_insn "*fuse_vand_vxor" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; vector vandc -> vxor (define_insn "*fuse_vandc_vxor" [(set (match_operand:VM 3 "altivec_register_operand" "=0,1,&v,v") - (xor:VM (and:VM (not:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v")) + (xor:VM (and:VM (not:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v")) (match_operand:VM 1 "altivec_register_operand" "v,v,v,v")) (match_operand:VM 2 "altivec_register_operand" "v,v,v,v"))) (clobber (match_scratch:VM 4 "=X,X,X,&r"))] @@ -2551,11 +2911,11 @@ (define_insn "*fuse_vandc_vxor" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; vector veqv -> vxor (define_insn "*fuse_veqv_vxor" [(set (match_operand:VM 3 "altivec_register_operand" "=0,1,&v,v") - (xor:VM (not:VM (xor:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v") + (xor:VM (not:VM (xor:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v") (match_operand:VM 1 "altivec_register_operand" "v,v,v,v"))) (match_operand:VM 2 "altivec_register_operand" "v,v,v,v"))) (clobber (match_scratch:VM 4 "=X,X,X,&r"))] @@ -2569,11 +2929,11 @@ (define_insn "*fuse_veqv_vxor" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; vector vnand -> vxor (define_insn "*fuse_vnand_vxor" [(set (match_operand:VM 3 "altivec_register_operand" "=0,1,&v,v") - (xor:VM (ior:VM (not:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v")) + (xor:VM (ior:VM (not:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v")) (not:VM (match_operand:VM 1 "altivec_register_operand" "v,v,v,v"))) (match_operand:VM 2 "altivec_register_operand" "v,v,v,v"))) (clobber (match_scratch:VM 4 "=X,X,X,&r"))] @@ -2587,11 +2947,11 @@ (define_insn "*fuse_vnand_vxor" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; vector vnor -> vxor (define_insn "*fuse_vnor_vxor" [(set (match_operand:VM 3 "altivec_register_operand" "=0,1,&v,v") - (xor:VM (and:VM (not:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v")) + (xor:VM (and:VM (not:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v")) (not:VM (match_operand:VM 1 "altivec_register_operand" "v,v,v,v"))) (match_operand:VM 2 "altivec_register_operand" "v,v,v,v"))) (clobber (match_scratch:VM 4 "=X,X,X,&r"))] @@ -2605,11 +2965,11 @@ (define_insn "*fuse_vnor_vxor" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; vector vor -> vxor (define_insn "*fuse_vor_vxor" [(set (match_operand:VM 3 "altivec_register_operand" "=0,1,&v,v") - (xor:VM (ior:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v") + (xor:VM (ior:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v") (match_operand:VM 1 "altivec_register_operand" "v,v,v,v")) (match_operand:VM 2 "altivec_register_operand" "v,v,v,v"))) (clobber (match_scratch:VM 4 "=X,X,X,&r"))] @@ -2623,11 +2983,11 @@ (define_insn "*fuse_vor_vxor" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; vector vorc -> vxor (define_insn "*fuse_vorc_vxor" [(set (match_operand:VM 3 "altivec_register_operand" "=0,1,&v,v") - (xor:VM (ior:VM (not:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v")) + (xor:VM (ior:VM (not:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v")) (match_operand:VM 1 "altivec_register_operand" "v,v,v,v")) (match_operand:VM 2 "altivec_register_operand" "v,v,v,v"))) (clobber (match_scratch:VM 4 "=X,X,X,&r"))] @@ -2641,11 +3001,11 @@ (define_insn "*fuse_vorc_vxor" (set_attr "cost" "6") (set_attr "length" "8")]) -;; logical-logical fusion pattern generated by gen_2logical +;; logical-logical fusion pattern generated by gen_logical_addsubf ;; vector vxor -> vxor (define_insn "*fuse_vxor_vxor" [(set (match_operand:VM 3 "altivec_register_operand" "=0,1,&v,v") - (xor:VM (xor:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v") + (xor:VM (xor:VM (match_operand:VM 0 "altivec_register_operand" "v,v,v,v") (match_operand:VM 1 "altivec_register_operand" "%v,v,v,v")) (match_operand:VM 2 "altivec_register_operand" "v,v,v,v"))) (clobber (match_scratch:VM 4 "=X,X,X,&r"))] @@ -2673,7 +3033,7 @@ (define_insn "*fuse_add_add" add %3,%1,%0\;add %3,%3,%2 add %3,%1,%0\;add %3,%3,%2 add %4,%1,%0\;add %3,%4,%2" - [(set_attr "type" "fuse_arithlog") + [(set_attr "type" "fused_arith_logical") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -2691,6 +3051,6 @@ (define_insn "*fuse_vaddudm_vaddudm" vaddudm %3,%1,%0\;vaddudm %3,%3,%2 vaddudm %3,%1,%0\;vaddudm %3,%3,%2 vaddudm %4,%1,%0\;vaddudm %3,%4,%2" - [(set_attr "type" "fuse_vec") + [(set_attr "type" "fused_vector") (set_attr "cost" "6") (set_attr "length" "8")]) diff --git a/gcc/config/rs6000/genfusion.pl b/gcc/config/rs6000/genfusion.pl index 8ed3c3617ec..7768d434bd2 100755 --- a/gcc/config/rs6000/genfusion.pl +++ b/gcc/config/rs6000/genfusion.pl @@ -144,23 +144,32 @@ sub gen_ld_cmpi_p10 } } -sub gen_2logical +sub gen_logical_addsubf { my @logicals = ( "and", "andc", "eqv", "nand", "nor", "or", "orc", "xor" ); + my %logicals_addsub = ( "and"=>1, "nand"=>1, "nor"=>1, "or"=>1 ); + my @addsub = ( "add", "subf" ); + my %isaddsub = ( "add"=>1, "subf"=>1 ); my %complement = ( "and"=> 0, "andc"=> 1, "eqv"=> 0, "nand"=> 3, - "nor"=> 3, "or"=> 0, "orc"=> 1, "xor"=> 0 ); + "nor"=> 3, "or"=> 0, "orc"=> 1, "xor"=> 0, + "add"=> 0, "subf"=> 0 ); my %invert = ( "and"=> 0, "andc"=> 0, "eqv"=> 1, "nand"=> 0, - "nor"=> 0, "or"=> 0, "orc"=> 0, "xor"=> 0 ); + "nor"=> 0, "or"=> 0, "orc"=> 0, "xor"=> 0, + "add"=> 0, "subf"=> 0 ); my %commute2 = ( "and"=> 1, "andc"=> 0, "eqv"=> 1, "nand"=> 0, "nor"=> 0, "or"=> 1, "orc"=> 0, "xor"=> 1 ); my %rtlop = ( "and"=>"and", "andc"=>"and", "eqv"=>"xor", "nand"=>"ior", - "nor"=>"and", "or"=>"ior", "orc"=>"ior", "xor"=>"xor" ); + "nor"=>"and", "or"=>"ior", "orc"=>"ior", "xor"=>"xor", + "add"=>"plus", "subf"=>"minus" ); - my ($kind, $vchr, $mode, $pred, $constraint, $cr, $outer, $outer_op, - $outer_comp, $outer_inv, $outer_rtl, $inner, $inner_comp, $inner_inv, - $inner_rtl, $inner_op, $both_commute, $c4, $bc, $inner_arg0, - $inner_arg1, $inner_exp, $outer_arg2, $outer_exp, $insn, $fuse_type); + my ($kind, $vchr, $mode, $pred, $constraint, $cr, $outer, @outer_ops, + $outer_op, $outer_comp, $outer_inv, $outer_rtl, $inner, @inner_ops, + $inner_comp, $inner_inv, $inner_rtl, $inner_op, $both_commute, $c4, + $bc, $inner_arg0, $inner_arg1, $inner_exp, $outer_arg2, $outer_exp, + $target_flag, $ftype, $insn, $is_rsubf, $outer_32, $outer_42, + $outer_name, $fuse_type); KIND: foreach $kind ('scalar','vector') { + @outer_ops = @logicals; if ( $kind eq 'vector' ) { $vchr = "v"; $mode = "VM"; @@ -173,14 +182,37 @@ sub gen_2logical $pred = "gpc_reg_operand"; $constraint = "r"; $fuse_type = "fused_arith_logical"; + push (@outer_ops, @addsub); + push (@outer_ops, ( "rsubf" )); } $c4 = "${constraint},${constraint},${constraint},${constraint}"; - OUTER: foreach $outer ( @logicals ) { + OUTER: foreach $outer ( @outer_ops ) { + $outer_name = "${vchr}${outer}"; + if ( $outer eq "rsubf" ) { + $is_rsubf = 1; + $outer = "subf"; + } else { + $is_rsubf = 0; + } $outer_op = "${vchr}${outer}"; $outer_comp = $complement{$outer}; $outer_inv = $invert{$outer}; $outer_rtl = $rtlop{$outer}; - INNER: foreach $inner ( @logicals ) { + @inner_ops = @logicals; + $ftype = "logical-logical"; + $target_flag = "TARGET_P10_FUSION_2LOGICAL"; + if ( exists $isaddsub{$outer} ) { + @inner_ops = keys %logicals_addsub; + $ftype = "logical-add"; + $target_flag = "TARGET_P10_FUSION_LOGADD"; + } elsif ( $kind ne 'vector' && exists $logicals_addsub{$outer} ) { + push (@inner_ops, @addsub); + } + INNER: foreach $inner ( @inner_ops ) { + if ( exists $isaddsub{$inner} ) { + $ftype = "add-logical"; + $target_flag = "TARGET_P10_FUSION_ADDLOG"; + } $inner_comp = $complement{$inner}; $inner_inv = $invert{$inner}; $inner_rtl = $rtlop{$inner}; @@ -197,7 +229,7 @@ sub gen_2logical if ( ($inner_comp & 2) == 2 ) { $inner_arg1 = "(not:${mode} $inner_arg1)"; } - $inner_exp = "(${inner_rtl}:${mode} ${inner_arg0} + $inner_exp = "(${inner_rtl}:${mode} ${inner_arg0} ${inner_arg1})"; if ( $inner_inv == 1 ) { $inner_exp = "(not:${mode} $inner_exp)"; @@ -209,26 +241,35 @@ sub gen_2logical if ( ($outer_comp & 2) == 2 ) { $inner_exp = "(not:${mode} $inner_exp)"; } - $outer_exp = "(${outer_rtl}:${mode} ${inner_exp} + if ( $is_rsubf == 1 ) { + $outer_exp = "(${outer_rtl}:${mode} ${outer_arg2} + ${inner_exp})"; + $outer_32 = "%2,%3"; + $outer_42 = "%2,%4"; + } else { + $outer_exp = "(${outer_rtl}:${mode} ${inner_exp} ${outer_arg2})"; + $outer_32 = "%3,%2"; + $outer_42 = "%4,%2"; + } if ( $outer_inv == 1 ) { $outer_exp = "(not:${mode} $outer_exp)"; } $insn = <<"EOF"; -;; logical-logical fusion pattern generated by gen_2logical -;; $kind $inner_op -> $outer_op -(define_insn "*fuse_${inner_op}_${outer_op}" +;; $ftype fusion pattern generated by gen_logical_addsubf +;; $kind $inner_op -> $outer_name +(define_insn "*fuse_${inner_op}_${outer_name}" [(set (match_operand:${mode} 3 "${pred}" "=0,1,&${constraint},${constraint}") ${outer_exp}) (clobber (match_scratch:${mode} 4 "=X,X,X,&r"))] - "(TARGET_P10_FUSION && TARGET_P10_FUSION_2LOGICAL)" + "(TARGET_P10_FUSION && $target_flag)" "@ - ${inner_op} %3,%1,%0\\;${outer_op} %3,%3,%2 - ${inner_op} %3,%1,%0\\;${outer_op} %3,%3,%2 - ${inner_op} %3,%1,%0\\;${outer_op} %3,%3,%2 - ${inner_op} %4,%1,%0\\;${outer_op} %3,%4,%2" + ${inner_op} %3,%1,%0\\;${outer_op} %3,${outer_32} + ${inner_op} %3,%1,%0\\;${outer_op} %3,${outer_32} + ${inner_op} %3,%1,%0\\;${outer_op} %3,${outer_32} + ${inner_op} %4,%1,%0\\;${outer_op} %3,${outer_42}" [(set_attr "type" "$fuse_type") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -247,14 +288,14 @@ sub gen_addadd if ( $kind eq 'vector' ) { $vchr = "v"; $op = "vaddudm"; - $ty = "fuse_vec"; + $ty = "fused_vector"; $mode = "V2DI"; $pred = "altivec_register_operand"; $constraint = "v"; } else { $vchr = ""; $op = "add"; - $ty = "fuse_arithlog"; + $ty = "fused_arith_logical"; $mode = "GPR"; $pred = "gpc_reg_operand"; $constraint = "r"; @@ -284,7 +325,7 @@ EOF } gen_ld_cmpi_p10(); -gen_2logical(); +gen_logical_addsubf(); gen_addadd(); exit(0); diff --git a/gcc/config/rs6000/rs6000-cpus.def b/gcc/config/rs6000/rs6000-cpus.def index d46a91dd11b..52ce84835f7 100644 --- a/gcc/config/rs6000/rs6000-cpus.def +++ b/gcc/config/rs6000/rs6000-cpus.def @@ -86,6 +86,8 @@ | OPTION_MASK_P10_FUSION \ | OPTION_MASK_P10_FUSION_LD_CMPI \ | OPTION_MASK_P10_FUSION_2LOGICAL \ + | OPTION_MASK_P10_FUSION_LOGADD \ + | OPTION_MASK_P10_FUSION_ADDLOG \ | OPTION_MASK_P10_FUSION_2ADD) /* Flags that need to be turned off if -mno-power9-vector. */ @@ -136,6 +138,8 @@ | OPTION_MASK_P10_FUSION \ | OPTION_MASK_P10_FUSION_LD_CMPI \ | OPTION_MASK_P10_FUSION_2LOGICAL \ + | OPTION_MASK_P10_FUSION_LOGADD \ + | OPTION_MASK_P10_FUSION_ADDLOG \ | OPTION_MASK_P10_FUSION_2ADD \ | OPTION_MASK_HTM \ | OPTION_MASK_ISEL \ diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 9488a54a1d7..d7ae73827c5 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -4467,6 +4467,12 @@ rs6000_option_override_internal (bool global_init_p) if (TARGET_POWER10 && (rs6000_isa_flags_explicit & OPTION_MASK_P10_FUSION_2LOGICAL) == 0) rs6000_isa_flags |= OPTION_MASK_P10_FUSION_2LOGICAL; + if (TARGET_POWER10 && (rs6000_isa_flags_explicit & OPTION_MASK_P10_FUSION_LOGADD) == 0) + rs6000_isa_flags |= OPTION_MASK_P10_FUSION_LOGADD; + + if (TARGET_POWER10 && (rs6000_isa_flags_explicit & OPTION_MASK_P10_FUSION_ADDLOG) == 0) + rs6000_isa_flags |= OPTION_MASK_P10_FUSION_ADDLOG; + if (TARGET_POWER10 && (rs6000_isa_flags_explicit & OPTION_MASK_P10_FUSION_2ADD) == 0) rs6000_isa_flags |= OPTION_MASK_P10_FUSION_2ADD; diff --git a/gcc/config/rs6000/rs6000.opt b/gcc/config/rs6000/rs6000.opt index fc14325ed33..07ce9aba18b 100644 --- a/gcc/config/rs6000/rs6000.opt +++ b/gcc/config/rs6000/rs6000.opt @@ -502,6 +502,14 @@ mpower10-fusion-2logical Target Undocumented Mask(P10_FUSION_2LOGICAL) Var(rs6000_isa_flags) Fuse certain integer operations together for better performance on power10. +mpower10-fusion-logical-add +Target Undocumented Mask(P10_FUSION_LOGADD) Var(rs6000_isa_flags) +Fuse certain integer operations together for better performance on power10. + +mpower10-fusion-add-logical +Target Undocumented Mask(P10_FUSION_ADDLOG) Var(rs6000_isa_flags) +Fuse certain integer operations together for better performance on power10. + mpower10-fusion-2add Target Undocumented Mask(P10_FUSION_2ADD) Var(rs6000_isa_flags) Fuse certain add operations together for better performance on power10. diff --git a/gcc/testsuite/gcc.target/powerpc/fusion-p10-logadd.c b/gcc/testsuite/gcc.target/powerpc/fusion-p10-logadd.c new file mode 100644 index 00000000000..0367abe6aad --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/fusion-p10-logadd.c @@ -0,0 +1,98 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-skip-if "" { powerpc*-*-darwin* } } */ +/* { dg-options "-mdejagnu-cpu=power10 -O3 -dp" } */ + +#include +#include + +#define ADD(a,b) ((a)+(b)) +#define SUB1(a,b) ((a)-(b)) +#define SUB2(a,b) ((b)-(a)) + +/* and/andc/eqv/nand/nor/or/orc/xor */ +#define AND(a,b) ((a)&(b)) +#define NAND(a,b) (~((a)&(b))) +#define NOR(a,b) (~((a)|(b))) +#define OR(a,b) ((a)|(b)) +#define TEST1(type, func) \ + type func ## _add_T_ ## type (type a, type b, type c) { return ADD(func(a,b),c); } \ + type func ## _sub1_T_ ## type (type a, type b, type c) { return SUB1(func(a,b),c); } \ + type func ## _sub2_T_ ## type (type a, type b, type c) { return SUB2(func(a,b),c); } \ + type func ## _rev_add_T_ ## type (type a, type b, type c) { return ADD(c,func(a,b)); } \ + type func ## _rev_sub1_T_ ## type (type a, type b, type c) { return SUB1(c,func(a,b)); } \ + type func ## _rev_sub2_T_ ## type (type a, type b, type c) { return SUB2(c,func(a,b)); } +#define TEST2(type, func) \ + type func ## _and_T_ ## type (type a, type b, type c) { return AND(func(a,b),c); } \ + type func ## _nand_T_ ## type (type a, type b, type c) { return NAND(func(a,b),c); } \ + type func ## _or_T_ ## type (type a, type b, type c) { return OR(func(a,b),c); } \ + type func ## _nor_T_ ## type (type a, type b, type c) { return NOR(func(a,b),c); } \ + type func ## _rev_and_T_ ## type (type a, type b, type c) { return AND(c,func(a,b)); } \ + type func ## _rev_nand_T_ ## type (type a, type b, type c) { return NAND(c,func(a,b)); } \ + type func ## _rev_or_T_ ## type (type a, type b, type c) { return OR(c,func(a,b)); } \ + type func ## _rev_nor_T_ ## type (type a, type b, type c) { return NOR(c,func(a,b)); } +#define TEST(type) \ + TEST1(type,AND) \ + TEST1(type,NAND) \ + TEST1(type,NOR) \ + TEST1(type,OR) \ + TEST2(type,ADD) \ + TEST2(type,SUB1) \ + TEST2(type,SUB2) + +typedef vector bool char vboolchar_t; +typedef vector unsigned int vuint_t; + +TEST(uint8_t); +TEST(int8_t); +TEST(uint16_t); +TEST(int16_t); +TEST(uint32_t); +TEST(int32_t); +TEST(uint64_t); +TEST(int64_t); + +/* { dg-final { scan-assembler-times "fuse_nand_rsubf/0" 2 } } */ +/* { dg-final { scan-assembler-times "fuse_nand_rsubf/2" 2 } } */ +/* { dg-final { scan-assembler-times "fuse_nor_rsubf/0" 2 } } */ +/* { dg-final { scan-assembler-times "fuse_nor_rsubf/2" 2 } } */ +/* { dg-final { scan-assembler-times "fuse_add_nand/0" 4 } } */ +/* { dg-final { scan-assembler-times "fuse_add_nor/0" 4 } } */ +/* { dg-final { scan-assembler-times "fuse_add_or/0" 4 } } */ +/* { dg-final { scan-assembler-times "fuse_and_rsubf/0" 4 } } */ +/* { dg-final { scan-assembler-times "fuse_and_subf/0" 4 } } */ +/* { dg-final { scan-assembler-times "fuse_nand_add/0" 4 } } */ +/* { dg-final { scan-assembler-times "fuse_nand_subf/0" 4 } } */ +/* { dg-final { scan-assembler-times "fuse_nor_add/0" 4 } } */ +/* { dg-final { scan-assembler-times "fuse_nor_subf/0" 4 } } */ +/* { dg-final { scan-assembler-times "fuse_or_rsubf/0" 4 } } */ +/* { dg-final { scan-assembler-times "fuse_or_subf/0" 4 } } */ +/* { dg-final { scan-assembler-times "fuse_subf_nand/0" 4 } } */ +/* { dg-final { scan-assembler-times "fuse_subf_nand/1" 4 } } */ +/* { dg-final { scan-assembler-times "fuse_subf_nor/0" 4 } } */ +/* { dg-final { scan-assembler-times "fuse_subf_nor/1" 4 } } */ +/* { dg-final { scan-assembler-times "fuse_subf_or/0" 4 } } */ +/* { dg-final { scan-assembler-times "fuse_subf_or/1" 4 } } */ +/* { dg-final { scan-assembler-times "fuse_and_add/0" 6 } } */ +/* { dg-final { scan-assembler-times "fuse_or_add/0" 6 } } */ +/* { dg-final { scan-assembler-times "fuse_add_and/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_add_and/2" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_subf_and/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_subf_and/1" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_add_nand/2" 12 } } */ +/* { dg-final { scan-assembler-times "fuse_add_nor/2" 12 } } */ +/* { dg-final { scan-assembler-times "fuse_add_or/2" 12 } } */ +/* { dg-final { scan-assembler-times "fuse_and_rsubf/2" 12 } } */ +/* { dg-final { scan-assembler-times "fuse_and_subf/2" 12 } } */ +/* { dg-final { scan-assembler-times "fuse_nand_add/2" 12 } } */ +/* { dg-final { scan-assembler-times "fuse_nand_subf/2" 12 } } */ +/* { dg-final { scan-assembler-times "fuse_nor_add/2" 12 } } */ +/* { dg-final { scan-assembler-times "fuse_nor_subf/2" 12 } } */ +/* { dg-final { scan-assembler-times "fuse_or_rsubf/2" 12 } } */ +/* { dg-final { scan-assembler-times "fuse_or_subf/2" 12 } } */ +/* { dg-final { scan-assembler-times "fuse_subf_and/2" 16 } } */ +/* { dg-final { scan-assembler-times "fuse_and_add/2" 22 } } */ +/* { dg-final { scan-assembler-times "fuse_or_add/2" 22 } } */ +/* { dg-final { scan-assembler-times "fuse_subf_nand/2" 24 } } */ +/* { dg-final { scan-assembler-times "fuse_subf_nor/2" 24 } } */ +/* { dg-final { scan-assembler-times "fuse_subf_or/2" 24 } } */ +