From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id 4ABD53858C42 for ; Sun, 4 Feb 2024 03:22:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4ABD53858C42 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linux.ibm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 4ABD53858C42 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707016925; cv=none; b=QvwrHCOgrM4UK8UG30eaOVnRsbP2jCwhGm0Jxp9xST5oj3sA+NXvJ5MI4cXxJGg3YyjFSnD9oWsU36EYlHd24TI8GhJj9CKLS1BOfKZB0WX10atJgXwaV9mwFPQuhgqrt3T4im9ngOg4XTtbWCYV4hc6xuLN96NBbumhp7Wmun8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707016925; c=relaxed/simple; bh=O7oK5hW+W6aQtqwkxRcG8K7S4qQ7sqChnyQEyFvsfuM=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:From:To; b=PNvH1lzCKpQ5LQ+cAlDdAVTB2TH5gn+NCr8+5CCGx1kgww0TKpT4WDMnJ+jn8a04ffGwcc0a6xw/cCwHj37adXw7/28NAzryfzMQX+mBpTyt4Kn0NS06k5m9Q5GY91FscpjPMcDpXoqTIKBivreeTjoJ9DMHxpwLW3hhNhI7lxk= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 4142Ou2p028612; Sun, 4 Feb 2024 03:22:00 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : date : mime-version : subject : references : from : to : cc : in-reply-to : content-type : content-transfer-encoding; s=pp1; bh=TRGEDI7KGJsdZDk3rKUzA3AyQOaez7hz1VUb4zGkijM=; b=QjQT7jDreDw/DOivaTyw1QzLEax++IGVoHqjIzItNzfTrHQV0dxvvr3AzRC0FvMdrOKk tSadbE9B8EkIdGulWDGYXb/xs3pvBJ62BODDLTQwhJg39+ID22Sz5Wmva5yPHeVvPidk r0924CqNsSKvP5BNUhr6c6iyv4GINhBtSbl27VdwR+H8mPxnyK+b5puO5UN169QmPdBu IqStbx8QO8HpCgBJ5YwsaRtXOWebgE4eY1/wXddstZAbqPpf1A7DZ7wOYr4/VMPX6cnU Q+KA5sBfQ/V0nAdZdMbtMPsSFKS9cMwCuFtU2K2qKE2E/NYX10QWbcDN/n3ouVCS2ThR 2g== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3w204evab2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 04 Feb 2024 03:21:59 +0000 Received: from m0353729.ppops.net (m0353729.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 41438vOW023012; Sun, 4 Feb 2024 03:21:59 GMT Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3w204evaak-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 04 Feb 2024 03:21:59 +0000 Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 4141rRj3005756; Sun, 4 Feb 2024 03:21:58 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3w21ak0c7u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 04 Feb 2024 03:21:57 +0000 Received: from smtpav02.fra02v.mail.ibm.com (smtpav02.fra02v.mail.ibm.com [10.20.54.101]) by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 4143LsWQ1442498 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 4 Feb 2024 03:21:54 GMT Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9743F20043; Sun, 4 Feb 2024 03:21:54 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E1D4D20040; Sun, 4 Feb 2024 03:21:51 +0000 (GMT) Received: from [9.197.233.44] (unknown [9.197.233.44]) by smtpav02.fra02v.mail.ibm.com (Postfix) with ESMTP; Sun, 4 Feb 2024 03:21:51 +0000 (GMT) Message-ID: <4a75ccec-b099-d689-636e-f9265b3d0c9c@linux.ibm.com> Date: Sun, 4 Feb 2024 11:21:49 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: Repost [PATCH 4/6] PowerPC: Make MMA insns support DMR registers. Content-Language: en-US References: From: "Kewen.Lin" To: Michael Meissner Cc: gcc-patches@gcc.gnu.org, Segher Boessenkool , David Edelsohn , Peter Bergner In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: HCeG_2QHixU6mKEE65I8l8TtNjlWBz2y X-Proofpoint-ORIG-GUID: 9kElCWY39QhiqCOi5w8rivEaEnDJDbSb X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-03_18,2024-01-31_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 mlxlogscore=999 phishscore=0 clxscore=1015 spamscore=0 adultscore=0 malwarescore=0 mlxscore=0 impostorscore=0 priorityscore=1501 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402040024 X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,GIT_PATCH_0,NICE_REPLY_A,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hi Mike, on 2024/1/6 07:39, Michael Meissner wrote: > This patch changes the MMA instructions to use either FPR registers > (-mcpu=power10) or DMRs (-mcpu=future). In this patch, the existing MMA > instruction names are used. > > A macro (__PPC_DMR__) is defined if the MMA instructions use the DMRs. > > The patches have been tested on both little and big endian systems. Can I check > it into the master branch? > > 2024-01-05 Michael Meissner > > gcc/ > > * config/rs6000/mma.md (mma_): New define_expand to handle > mma_ for dense math and non dense math. > (mma_ insn): Restrict to non dense math. > (mma_xxsetaccz): Convert to define_expand to handle non dense math and > dense math. > (mma_xxsetaccz_vsx): Rename from mma_xxsetaccz and restrict usage to non > dense math. > (mma_xxsetaccz_dm): Dense math version of mma_xxsetaccz. > (mma_): Add support for dense math. > (mma_): Likewise. > (mma_): Likewise. > (mma_): Likewise. > (mma_): Likewise. > (mma_): Likewise. > (mma_): Likewise. > (mma_): Likewise. > (mma_): Likewise. > (mma_): Likewise. > (mma_): Likewise. > (mma_): Likewise. > (mma_): Likewise. > (mma_): Likewise. > * config/rs6000/rs6000-c.cc (rs6000_target_modify_macros): Define > __PPC_DMR__ if we have dense math instructions. > * config/rs6000/rs6000.cc (print_operand): Make %A handle only DMRs if > dense math and only FPRs if not dense math. > (rs6000_split_multireg_move): Do not generate the xxmtacc instruction to > prime the DMR registers or the xxmfacc instruction to de-prime > instructions if we have dense math register support. > --- > gcc/config/rs6000/mma.md | 247 +++++++++++++++++++++------------- > gcc/config/rs6000/rs6000-c.cc | 3 + > gcc/config/rs6000/rs6000.cc | 35 ++--- > 3 files changed, 176 insertions(+), 109 deletions(-) > > diff --git a/gcc/config/rs6000/mma.md b/gcc/config/rs6000/mma.md > index bb898919ab5..525a85146ff 100644 > --- a/gcc/config/rs6000/mma.md > +++ b/gcc/config/rs6000/mma.md > @@ -559,190 +559,249 @@ (define_insn "*mma_disassemble_acc_dm" > "dmxxextfdmr256 %0,%1,2" > [(set_attr "type" "mma")]) > > -(define_insn "mma_" > +;; MMA instructions that do not use their accumulators as an input, still must > +;; not allow their vector operands to overlap the registers used by the > +;; accumulator. We enforce this by marking the output as early clobber. If we > +;; have dense math, we don't need the whole prime/de-prime action, so just make > +;; thse instructions be NOPs. typo: thse. > + > +(define_expand "mma_" > + [(set (match_operand:XO 0 "register_operand") > + (unspec:XO [(match_operand:XO 1 "register_operand")] s/register_operand/accumulator_operand/? > + MMA_ACC))] > + "TARGET_MMA" > +{ > + if (TARGET_DENSE_MATH) > + { > + if (!rtx_equal_p (operands[0], operands[1])) > + emit_move_insn (operands[0], operands[1]); > + DONE; > + } > + > + /* Generate the prime/de-prime code. */ > +}) > + > +(define_insn "*mma_" May be better to name with "*mma__nodm"? > [(set (match_operand:XO 0 "fpr_reg_operand" "=&d") > (unspec:XO [(match_operand:XO 1 "fpr_reg_operand" "0")] > MMA_ACC))] > - "TARGET_MMA" > + "TARGET_MMA && !TARGET_DENSE_MATH" I found that "TARGET_MMA && !TARGET_DENSE_MATH" is used much (like changes in function rs6000_split_multireg_move in this patch and some places in previous patches), maybe we can introduce a macro named as TARGET_MMA_NODM short for it? > " %A0" > [(set_attr "type" "mma")]) > > ;; We can't have integer constants in XOmode so we wrap this in an > -;; UNSPEC_VOLATILE. > +;; UNSPEC_VOLATILE for the non-dense math case. For dense math, we don't need > +;; to disable optimization and we can do a normal UNSPEC. > > -(define_insn "mma_xxsetaccz" > - [(set (match_operand:XO 0 "fpr_reg_operand" "=d") > +(define_expand "mma_xxsetaccz" > + [(set (match_operand:XO 0 "register_operand") s/register_operand/accumulator_operand/? > (unspec_volatile:XO [(const_int 0)] > UNSPECV_MMA_XXSETACCZ))] > "TARGET_MMA" > +{ > + if (TARGET_DENSE_MATH) > + { > + emit_insn (gen_mma_xxsetaccz_dm (operands[0])); > + DONE; > + } > +}) > + > +(define_insn "*mma_xxsetaccz_vsx" s/vsx/nodm/ > + [(set (match_operand:XO 0 "fpr_reg_operand" "=d") > + (unspec_volatile:XO [(const_int 0)] > + UNSPECV_MMA_XXSETACCZ))] > + "TARGET_MMA && !TARGET_DENSE_MATH" > "xxsetaccz %A0" > [(set_attr "type" "mma")]) > > + > +(define_insn "mma_xxsetaccz_dm" > + [(set (match_operand:XO 0 "dmr_operand" "=wD") > + (unspec:XO [(const_int 0)] > + UNSPECV_MMA_XXSETACCZ))] > + "TARGET_DENSE_MATH" > + "dmsetdmrz %0" > + [(set_attr "type" "mma")]) > + > (define_insn "mma_" > - [(set (match_operand:XO 0 "fpr_reg_operand" "=&d,&d") > - (unspec:XO [(match_operand:V16QI 1 "vsx_register_operand" "v,?wa") > - (match_operand:V16QI 2 "vsx_register_operand" "v,?wa")] > + [(set (match_operand:XO 0 "accumulator_operand" "=wD,&d,&d") > + (unspec:XO [(match_operand:V16QI 1 "vsx_register_operand" "wa,v,?wa") > + (match_operand:V16QI 2 "vsx_register_operand" "wa,v,?wa")] > MMA_VV))] > "TARGET_MMA" > " %A0,%x1,%x2" > - [(set_attr "type" "mma")]) > + [(set_attr "type" "mma") > + (set_attr "isa" "dm,not_dm,not_dm")]) Like what's suggested in previous patches, s/not_dm/nodm/ The others look good to me, thanks! BR, Kewen > > (define_insn "mma_" > - [(set (match_operand:XO 0 "fpr_reg_operand" "=&d,&d") > - (unspec:XO [(match_operand:XO 1 "fpr_reg_operand" "0,0") > - (match_operand:V16QI 2 "vsx_register_operand" "v,?wa") > - (match_operand:V16QI 3 "vsx_register_operand" "v,?wa")] > + [(set (match_operand:XO 0 "accumulator_operand" "=wD,&d,&d") > + (unspec:XO [(match_operand:XO 1 "accumulator_operand" "0,0,0") > + (match_operand:V16QI 2 "vsx_register_operand" "wa,v,?wa") > + (match_operand:V16QI 3 "vsx_register_operand" "wa,v,?wa")] > MMA_AVV))] > "TARGET_MMA" > " %A0,%x2,%x3" > - [(set_attr "type" "mma")]) > + [(set_attr "type" "mma") > + (set_attr "isa" "dm,not_dm,not_dm")]) > > (define_insn "mma_" > - [(set (match_operand:XO 0 "fpr_reg_operand" "=&d,&d") > - (unspec:XO [(match_operand:OO 1 "vsx_register_operand" "v,?wa") > - (match_operand:V16QI 2 "vsx_register_operand" "v,?wa")] > + [(set (match_operand:XO 0 "accumulator_operand" "=wD,&d,&d") > + (unspec:XO [(match_operand:OO 1 "vsx_register_operand" "wa,v,?wa") > + (match_operand:V16QI 2 "vsx_register_operand" "wa,v,?wa")] > MMA_PV))] > "TARGET_MMA" > " %A0,%x1,%x2" > - [(set_attr "type" "mma")]) > + [(set_attr "type" "mma") > + (set_attr "isa" "dm,not_dm,not_dm")]) > > (define_insn "mma_" > - [(set (match_operand:XO 0 "fpr_reg_operand" "=&d,&d") > - (unspec:XO [(match_operand:XO 1 "fpr_reg_operand" "0,0") > - (match_operand:OO 2 "vsx_register_operand" "v,?wa") > - (match_operand:V16QI 3 "vsx_register_operand" "v,?wa")] > + [(set (match_operand:XO 0 "accumulator_operand" "=wD,&d,&d") > + (unspec:XO [(match_operand:XO 1 "accumulator_operand" "0,0,0") > + (match_operand:OO 2 "vsx_register_operand" "wa,v,?wa") > + (match_operand:V16QI 3 "vsx_register_operand" "wa,v,?wa")] > MMA_APV))] > "TARGET_MMA" > " %A0,%x2,%x3" > - [(set_attr "type" "mma")]) > + [(set_attr "type" "mma") > + (set_attr "isa" "dm,not_dm,not_dm")]) > > (define_insn "mma_" > - [(set (match_operand:XO 0 "fpr_reg_operand" "=&d,&d") > - (unspec:XO [(match_operand:V16QI 1 "vsx_register_operand" "v,?wa") > - (match_operand:V16QI 2 "vsx_register_operand" "v,?wa") > - (match_operand:SI 3 "const_0_to_15_operand" "n,n") > - (match_operand:SI 4 "const_0_to_15_operand" "n,n") > - (match_operand:SI 5 "u8bit_cint_operand" "n,n")] > + [(set (match_operand:XO 0 "accumulator_operand" "=wD,&d,&d") > + (unspec:XO [(match_operand:V16QI 1 "vsx_register_operand" "wa,v,?wa") > + (match_operand:V16QI 2 "vsx_register_operand" "wa,v,?wa") > + (match_operand:SI 3 "const_0_to_15_operand" "n,n,n") > + (match_operand:SI 4 "const_0_to_15_operand" "n,n,n") > + (match_operand:SI 5 "u8bit_cint_operand" "n,n,n")] > MMA_VVI4I4I8))] > "TARGET_MMA" > " %A0,%x1,%x2,%3,%4,%5" > [(set_attr "type" "mma") > - (set_attr "prefixed" "yes")]) > + (set_attr "prefixed" "yes") > + (set_attr "isa" "dm,not_dm,not_dm")]) > > (define_insn "mma_" > - [(set (match_operand:XO 0 "fpr_reg_operand" "=&d,&d") > - (unspec:XO [(match_operand:XO 1 "fpr_reg_operand" "0,0") > - (match_operand:V16QI 2 "vsx_register_operand" "v,?wa") > - (match_operand:V16QI 3 "vsx_register_operand" "v,?wa") > - (match_operand:SI 4 "const_0_to_15_operand" "n,n") > - (match_operand:SI 5 "const_0_to_15_operand" "n,n") > - (match_operand:SI 6 "u8bit_cint_operand" "n,n")] > + [(set (match_operand:XO 0 "accumulator_operand" "=wD,&d,&d") > + (unspec:XO [(match_operand:XO 1 "accumulator_operand" "0,0,0") > + (match_operand:V16QI 2 "vsx_register_operand" "wa,v,?wa") > + (match_operand:V16QI 3 "vsx_register_operand" "wa,v,?wa") > + (match_operand:SI 4 "const_0_to_15_operand" "n,n,n") > + (match_operand:SI 5 "const_0_to_15_operand" "n,n,n") > + (match_operand:SI 6 "u8bit_cint_operand" "n,n,n")] > MMA_AVVI4I4I8))] > "TARGET_MMA" > " %A0,%x2,%x3,%4,%5,%6" > [(set_attr "type" "mma") > - (set_attr "prefixed" "yes")]) > + (set_attr "prefixed" "yes") > + (set_attr "isa" "dm,not_dm,not_dm")]) > > (define_insn "mma_" > - [(set (match_operand:XO 0 "fpr_reg_operand" "=&d,&d") > - (unspec:XO [(match_operand:V16QI 1 "vsx_register_operand" "v,?wa") > - (match_operand:V16QI 2 "vsx_register_operand" "v,?wa") > - (match_operand:SI 3 "const_0_to_15_operand" "n,n") > - (match_operand:SI 4 "const_0_to_15_operand" "n,n") > - (match_operand:SI 5 "const_0_to_3_operand" "n,n")] > + [(set (match_operand:XO 0 "accumulator_operand" "=wD,&d,&d") > + (unspec:XO [(match_operand:V16QI 1 "vsx_register_operand" "wa,v,?wa") > + (match_operand:V16QI 2 "vsx_register_operand" "wa,v,?wa") > + (match_operand:SI 3 "const_0_to_15_operand" "n,n,n") > + (match_operand:SI 4 "const_0_to_15_operand" "n,n,n") > + (match_operand:SI 5 "const_0_to_3_operand" "n,n,n")] > MMA_VVI4I4I2))] > "TARGET_MMA" > " %A0,%x1,%x2,%3,%4,%5" > [(set_attr "type" "mma") > - (set_attr "prefixed" "yes")]) > + (set_attr "prefixed" "yes") > + (set_attr "isa" "dm,not_dm,not_dm")]) > > (define_insn "mma_" > - [(set (match_operand:XO 0 "fpr_reg_operand" "=&d,&d") > - (unspec:XO [(match_operand:XO 1 "fpr_reg_operand" "0,0") > - (match_operand:V16QI 2 "vsx_register_operand" "v,?wa") > - (match_operand:V16QI 3 "vsx_register_operand" "v,?wa") > - (match_operand:SI 4 "const_0_to_15_operand" "n,n") > - (match_operand:SI 5 "const_0_to_15_operand" "n,n") > - (match_operand:SI 6 "const_0_to_3_operand" "n,n")] > + [(set (match_operand:XO 0 "accumulator_operand" "=wD,&d,&d") > + (unspec:XO [(match_operand:XO 1 "accumulator_operand" "0,0,0") > + (match_operand:V16QI 2 "vsx_register_operand" "wa,v,?wa") > + (match_operand:V16QI 3 "vsx_register_operand" "wa,v,?wa") > + (match_operand:SI 4 "const_0_to_15_operand" "n,n,n") > + (match_operand:SI 5 "const_0_to_15_operand" "n,n,n") > + (match_operand:SI 6 "const_0_to_3_operand" "n,n,n")] > MMA_AVVI4I4I2))] > "TARGET_MMA" > " %A0,%x2,%x3,%4,%5,%6" > [(set_attr "type" "mma") > - (set_attr "prefixed" "yes")]) > + (set_attr "prefixed" "yes") > + (set_attr "isa" "dm,not_dm,not_dm")]) > > (define_insn "mma_" > - [(set (match_operand:XO 0 "fpr_reg_operand" "=&d,&d") > - (unspec:XO [(match_operand:V16QI 1 "vsx_register_operand" "v,?wa") > - (match_operand:V16QI 2 "vsx_register_operand" "v,?wa") > - (match_operand:SI 3 "const_0_to_15_operand" "n,n") > - (match_operand:SI 4 "const_0_to_15_operand" "n,n")] > + [(set (match_operand:XO 0 "accumulator_operand" "=wD,&d,&d") > + (unspec:XO [(match_operand:V16QI 1 "vsx_register_operand" "wa,v,?wa") > + (match_operand:V16QI 2 "vsx_register_operand" "wa,v,?wa") > + (match_operand:SI 3 "const_0_to_15_operand" "n,n,n") > + (match_operand:SI 4 "const_0_to_15_operand" "n,n,n")] > MMA_VVI4I4))] > "TARGET_MMA" > " %A0,%x1,%x2,%3,%4" > [(set_attr "type" "mma") > - (set_attr "prefixed" "yes")]) > + (set_attr "prefixed" "yes") > + (set_attr "isa" "dm,not_dm,not_dm")]) > > (define_insn "mma_" > - [(set (match_operand:XO 0 "fpr_reg_operand" "=&d,&d") > - (unspec:XO [(match_operand:XO 1 "fpr_reg_operand" "0,0") > - (match_operand:V16QI 2 "vsx_register_operand" "v,?wa") > - (match_operand:V16QI 3 "vsx_register_operand" "v,?wa") > - (match_operand:SI 4 "const_0_to_15_operand" "n,n") > - (match_operand:SI 5 "const_0_to_15_operand" "n,n")] > + [(set (match_operand:XO 0 "accumulator_operand" "=wD,&d,&d") > + (unspec:XO [(match_operand:XO 1 "accumulator_operand" "0,0,0") > + (match_operand:V16QI 2 "vsx_register_operand" "wa,v,?wa") > + (match_operand:V16QI 3 "vsx_register_operand" "wa,v,?wa") > + (match_operand:SI 4 "const_0_to_15_operand" "n,n,n") > + (match_operand:SI 5 "const_0_to_15_operand" "n,n,n")] > MMA_AVVI4I4))] > "TARGET_MMA" > " %A0,%x2,%x3,%4,%5" > [(set_attr "type" "mma") > - (set_attr "prefixed" "yes")]) > + (set_attr "prefixed" "yes") > + (set_attr "isa" "dm,not_dm,not_dm")]) > > (define_insn "mma_" > - [(set (match_operand:XO 0 "fpr_reg_operand" "=&d,&d") > - (unspec:XO [(match_operand:OO 1 "vsx_register_operand" "v,?wa") > - (match_operand:V16QI 2 "vsx_register_operand" "v,?wa") > - (match_operand:SI 3 "const_0_to_15_operand" "n,n") > - (match_operand:SI 4 "const_0_to_3_operand" "n,n")] > + [(set (match_operand:XO 0 "accumulator_operand" "=wD,&d,&d") > + (unspec:XO [(match_operand:OO 1 "vsx_register_operand" "wa,v,?wa") > + (match_operand:V16QI 2 "vsx_register_operand" "wa,v,?wa") > + (match_operand:SI 3 "const_0_to_15_operand" "n,n,n") > + (match_operand:SI 4 "const_0_to_3_operand" "n,n,n")] > MMA_PVI4I2))] > "TARGET_MMA" > " %A0,%x1,%x2,%3,%4" > [(set_attr "type" "mma") > - (set_attr "prefixed" "yes")]) > + (set_attr "prefixed" "yes") > + (set_attr "isa" "dm,not_dm,not_dm")]) > > (define_insn "mma_" > - [(set (match_operand:XO 0 "fpr_reg_operand" "=&d,&d") > - (unspec:XO [(match_operand:XO 1 "fpr_reg_operand" "0,0") > - (match_operand:OO 2 "vsx_register_operand" "v,?wa") > - (match_operand:V16QI 3 "vsx_register_operand" "v,?wa") > - (match_operand:SI 4 "const_0_to_15_operand" "n,n") > - (match_operand:SI 5 "const_0_to_3_operand" "n,n")] > + [(set (match_operand:XO 0 "accumulator_operand" "=wD,&d,&d") > + (unspec:XO [(match_operand:XO 1 "accumulator_operand" "0,0,0") > + (match_operand:OO 2 "vsx_register_operand" "wa,v,?wa") > + (match_operand:V16QI 3 "vsx_register_operand" "wa,v,?wa") > + (match_operand:SI 4 "const_0_to_15_operand" "n,n,n") > + (match_operand:SI 5 "const_0_to_3_operand" "n,n,n")] > MMA_APVI4I2))] > "TARGET_MMA" > " %A0,%x2,%x3,%4,%5" > [(set_attr "type" "mma") > - (set_attr "prefixed" "yes")]) > + (set_attr "prefixed" "yes") > + (set_attr "isa" "dm,not_dm,not_dm")]) > > (define_insn "mma_" > - [(set (match_operand:XO 0 "fpr_reg_operand" "=&d,&d") > - (unspec:XO [(match_operand:V16QI 1 "vsx_register_operand" "v,?wa") > - (match_operand:V16QI 2 "vsx_register_operand" "v,?wa") > - (match_operand:SI 3 "const_0_to_15_operand" "n,n") > - (match_operand:SI 4 "const_0_to_15_operand" "n,n") > - (match_operand:SI 5 "const_0_to_15_operand" "n,n")] > + [(set (match_operand:XO 0 "accumulator_operand" "=wD,&d,&d") > + (unspec:XO [(match_operand:V16QI 1 "vsx_register_operand" "wa,v,?wa") > + (match_operand:V16QI 2 "vsx_register_operand" "wa,v,?wa") > + (match_operand:SI 3 "const_0_to_15_operand" "n,n,n") > + (match_operand:SI 4 "const_0_to_15_operand" "n,n,n") > + (match_operand:SI 5 "const_0_to_15_operand" "n,n,n")] > MMA_VVI4I4I4))] > "TARGET_MMA" > " %A0,%x1,%x2,%3,%4,%5" > [(set_attr "type" "mma") > - (set_attr "prefixed" "yes")]) > + (set_attr "prefixed" "yes") > + (set_attr "isa" "dm,not_dm,not_dm")]) > > (define_insn "mma_" > - [(set (match_operand:XO 0 "fpr_reg_operand" "=&d,&d") > - (unspec:XO [(match_operand:XO 1 "fpr_reg_operand" "0,0") > - (match_operand:V16QI 2 "vsx_register_operand" "v,?wa") > - (match_operand:V16QI 3 "vsx_register_operand" "v,?wa") > - (match_operand:SI 4 "const_0_to_15_operand" "n,n") > - (match_operand:SI 5 "const_0_to_15_operand" "n,n") > - (match_operand:SI 6 "const_0_to_15_operand" "n,n")] > + [(set (match_operand:XO 0 "accumulator_operand" "=wD,&d,&d") > + (unspec:XO [(match_operand:XO 1 "accumulator_operand" "0,0,0") > + (match_operand:V16QI 2 "vsx_register_operand" "wa,v,?wa") > + (match_operand:V16QI 3 "vsx_register_operand" "wa,v,?wa") > + (match_operand:SI 4 "const_0_to_15_operand" "n,n,n") > + (match_operand:SI 5 "const_0_to_15_operand" "n,n,n") > + (match_operand:SI 6 "const_0_to_15_operand" "n,n,n")] > MMA_AVVI4I4I4))] > "TARGET_MMA" > " %A0,%x2,%x3,%4,%5,%6" > [(set_attr "type" "mma") > - (set_attr "prefixed" "yes")]) > + (set_attr "prefixed" "yes") > + (set_attr "isa" "dm,not_dm,not_dm")]) > diff --git a/gcc/config/rs6000/rs6000-c.cc b/gcc/config/rs6000/rs6000-c.cc > index f2fb5bef678..4342620f87f 100644 > --- a/gcc/config/rs6000/rs6000-c.cc > +++ b/gcc/config/rs6000/rs6000-c.cc > @@ -600,6 +600,9 @@ rs6000_target_modify_macros (bool define_p, HOST_WIDE_INT flags) > /* Tell the user if we support the MMA instructions. */ > if ((flags & OPTION_MASK_MMA) != 0) > rs6000_define_or_undefine_macro (define_p, "__MMA__"); > + /* Tell the user if we support the dense math instructions. */ > + if ((flags & OPTION_MASK_DENSE_MATH) != 0) > + rs6000_define_or_undefine_macro (define_p, "__PPC_DMR__"); > /* Whether pc-relative code is being generated. */ > if ((flags & OPTION_MASK_PCREL) != 0) > rs6000_define_or_undefine_macro (define_p, "__PCREL__"); > diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc > index 83e32f7a43a..59517c8608d 100644 > --- a/gcc/config/rs6000/rs6000.cc > +++ b/gcc/config/rs6000/rs6000.cc > @@ -14264,8 +14264,13 @@ print_operand (FILE *file, rtx x, int code) > overlapping with the FPR registers. */ > if (!REG_P (x)) > output_operand_lossage ("invalid %%A value"); > - else if (TARGET_DENSE_MATH && DMR_REGNO_P (REGNO (x))) > - fprintf (file, "%d", REGNO (x) - FIRST_DMR_REGNO); > + else if (TARGET_DENSE_MATH) > + { > + if (DMR_REGNO_P (REGNO (x))) > + fprintf (file, "%d", REGNO (x) - FIRST_DMR_REGNO); > + else > + output_operand_lossage ("%%A operand is not a DMR"); > + } > else if (!FP_REGNO_P (REGNO (x)) || (REGNO (x) % 4) != 0) > output_operand_lossage ("invalid %%A value"); > else > @@ -27719,7 +27724,7 @@ rs6000_split_multireg_move (rtx dst, rtx src) > > /* If we are reading an accumulator register, we have to > deprime it before we can access it. */ > - if (TARGET_MMA > + if (TARGET_MMA && !TARGET_DENSE_MATH > && GET_MODE (src) == XOmode && FP_REGNO_P (REGNO (src))) > emit_insn (gen_mma_xxmfacc (src, src)); > > @@ -27751,9 +27756,9 @@ rs6000_split_multireg_move (rtx dst, rtx src) > emit_insn (gen_rtx_SET (dst2, src2)); > } > > - /* If we are writing an accumulator register, we have to > - prime it after we've written it. */ > - if (TARGET_MMA > + /* If we are writing an accumulator register that overlaps with the > + FPR registers, we have to prime it after we've written it. */ > + if (TARGET_MMA && !TARGET_DENSE_MATH > && GET_MODE (dst) == XOmode && FP_REGNO_P (REGNO (dst))) > emit_insn (gen_mma_xxmtacc (dst, dst)); > > @@ -27822,9 +27827,9 @@ rs6000_split_multireg_move (rtx dst, rtx src) > emit_insn (gen_rtx_SET (dst_i, op)); > } > > - /* We are writing an accumulator register, so we have to > - prime it after we've written it. */ > - if (GET_MODE (src) == XOmode) > + /* On systems without dense math where accumulators overlap with the > + vector registers, we have to prime it after we've written it. */ > + if (GET_MODE (src) == XOmode && !TARGET_DENSE_MATH) > emit_insn (gen_mma_xxmtacc (dst, dst)); > > return; > @@ -27835,9 +27840,9 @@ rs6000_split_multireg_move (rtx dst, rtx src) > > if (REG_P (src) && REG_P (dst) && (REGNO (src) < REGNO (dst))) > { > - /* If we are reading an accumulator register, we have to > - deprime it before we can access it. */ > - if (TARGET_MMA > + /* If we are reading an accumulator register and we don't have dense > + math, we have to deprime it before we can access it. */ > + if (TARGET_MMA && !TARGET_DENSE_MATH > && GET_MODE (src) == XOmode && FP_REGNO_P (REGNO (src))) > emit_insn (gen_mma_xxmfacc (src, src)); > > @@ -27865,7 +27870,7 @@ rs6000_split_multireg_move (rtx dst, rtx src) > > /* If we are writing an accumulator register, we have to > prime it after we've written it. */ > - if (TARGET_MMA > + if (TARGET_MMA && !TARGET_DENSE_MATH > && GET_MODE (dst) == XOmode && FP_REGNO_P (REGNO (dst))) > emit_insn (gen_mma_xxmtacc (dst, dst)); > } > @@ -28002,7 +28007,7 @@ rs6000_split_multireg_move (rtx dst, rtx src) > > /* If we are reading an accumulator register, we have to > deprime it before we can access it. */ > - if (TARGET_MMA && REG_P (src) > + if (TARGET_MMA && !TARGET_DENSE_MATH && REG_P (src) > && GET_MODE (src) == XOmode && FP_REGNO_P (REGNO (src))) > emit_insn (gen_mma_xxmfacc (src, src)); > > @@ -28034,7 +28039,7 @@ rs6000_split_multireg_move (rtx dst, rtx src) > > /* If we are writing an accumulator register, we have to > prime it after we've written it. */ > - if (TARGET_MMA && REG_P (dst) > + if (TARGET_MMA && !TARGET_DENSE_MATH && REG_P (dst) > && GET_MODE (dst) == XOmode && FP_REGNO_P (REGNO (dst))) > emit_insn (gen_mma_xxmtacc (dst, dst)); > ≈