From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id 8832C3858D35 for ; Tue, 7 May 2024 02:16:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8832C3858D35 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 8832C3858D35 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715048167; cv=none; b=AjeemPgMgo1l1cXfWusMKCkL9qgwq0OHmg2saB12+X0AZezYr6xp9TQWI2zJHmCo5bED2uzlyZeA0g+6TiOkl9d1nBK5oDO7RQt20I8mU4A/T5rZsiA9uJd+CwhzRM+B/xke0lLURGBNoVkqzDO9CDc9V5GCK7m/ZZVFvIv4xMg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715048167; c=relaxed/simple; bh=Giilu0CYqvtO5peRnYGrJAfLIs1tI68fQp3EY/Dagi8=; h=DKIM-Signature:Message-ID:Date:MIME-Version:To:From:Subject; b=BaEuhmChtzHwfYXdXBIXSQKegWDWnEzOktdEhGUA//M32yMtLdNhgxyuSk9ZHNR1QCwfHRdecgJNfM9Bk0fIt7NDb6ZSYFSDoZIrLxHGyOys0/P5Vz1Dpkegks/eJuJCIVf9MOyKOy9FJBjuOBJvHrKmtbHnS7WMVCrQK5/pcy8= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0356516.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 4471qtqi032190; Tue, 7 May 2024 02:16:03 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : date : mime-version : to : cc : from : subject : content-type : content-transfer-encoding; s=pp1; bh=9PaKssxDRBAphfIJq5vPzeT+rjYKZe+kApXqUl4LlNc=; b=TdWXt58H7UFxvZ0F5uU9cDykaBHOUglL2pCNkE2doJ1G/HcNWmp43Hf/PHeTB4UM0dlD gIYPhABSwrYUqX19y2JgdIdgakLFz1EioIfPC76YgKzzy3WzDLinl4YEq6gBl+MG+giB KVJvTk8dcA4mvwQdSVUDrCXdn1FLJUi+j8xSaa0g668lPUBiCl3hxnEr3KxnalgRYxoA YiyCz8jcr0dkRp4VCecT++c4r0KpK/brnaO7AhlUi2dtCbsqhLC3UNuZCbCi1D7G7nzw 0jsOcE31rPe7PrZcSF5YMiJqfDQmuIeED48mHPilA+7MAzAuYRlzqwL0VeivXfstkdOe MQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3xyb1481bf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 May 2024 02:16:02 +0000 Received: from m0356516.ppops.net (m0356516.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 4472G24c031482; Tue, 7 May 2024 02:16:02 GMT Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3xyb1481bd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 May 2024 02:16:02 +0000 Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 4470FGZv013977; Tue, 7 May 2024 02:16:01 GMT Received: from smtprelay02.fra02v.mail.ibm.com ([9.218.2.226]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 3xx222u1pv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 May 2024 02:16:01 +0000 Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay02.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 4472FuKk48103786 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 7 May 2024 02:15:58 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2C0F120043; Tue, 7 May 2024 02:15:56 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BD58A2004B; Tue, 7 May 2024 02:15:54 +0000 (GMT) Received: from [9.200.103.244] (unknown [9.200.103.244]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Tue, 7 May 2024 02:15:54 +0000 (GMT) Message-ID: Date: Tue, 7 May 2024 10:15:54 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: gcc-patches Cc: Segher Boessenkool , David , "Kewen.Lin" , Peter Bergner From: HAO CHEN GUI Subject: [PATCH-6, rs6000] Split setcc to two insns after reload Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 8h1o2gTP9GThLmbreL2h6lZ-rk4zNErf X-Proofpoint-ORIG-GUID: cX2Cs8zO1CmWy9BLB1IjDQ9NGy9Bp8Hz X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.11.176.26 definitions=2024-05-06_19,2024-05-06_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 mlxscore=0 bulkscore=0 adultscore=0 impostorscore=0 lowpriorityscore=0 clxscore=1015 priorityscore=1501 spamscore=0 mlxlogscore=999 phishscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2404010000 definitions=main-2405070016 X-Spam-Status: No, score=-12.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hi, It's the sixth patch of a series of patches optimizing CC modes on rs6000. This patch splits setcc to two separate insns after reload so that other insns can be inserted between them. It should increase the parallelism. The rotate_cr pattern still needs the info of the number of cr fields as the pass pro_and_epilogue might change the cr register. Bootstrapped and tested on powerpc64-linux BE and LE with no regressions. Is it OK for the trunk? Thanks Gui Haochen ChangeLog rs6000: Split setcc to two insns after reload This patch splits setcc to two separate insns after reload so that other insns can be inserted between them. gcc/ * config/rs6000/rs6000.md (c_enum unpsec): Add UNSPEC_MFCR and UNSPEC_ROTATE_CR. (*move_from_cr): New. (insn set_cc): Remove. (*rotate_cr): New. (insn_and_split set_cc): New. patch.diff diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index ccf392b6409..0ad08e3111e 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -159,6 +159,8 @@ (define_c_enum "unspec" UNSPEC_XXSPLTIW_CONST UNSPEC_FMAX UNSPEC_FMIN + UNSPEC_MFCR + UNSPEC_ROTATE_CR ]) ;; @@ -12744,26 +12746,51 @@ (define_insn_and_split "*cmp_internal2" } }) -;; Now we have the scc insns. We can do some combinations because of the -;; way the machine works. -;; -;; Note that this is probably faster if we can put an insn between the -;; mfcr and rlinm, but this is tricky. Let's leave it for now. In most -;; cases the insns below which don't use an intermediate CR field will -;; be used instead. -(define_insn "set_cc" + +(define_insn "*move_from_cr" [(set (match_operand:GPR 0 "gpc_reg_operand" "=r") - (match_operator:GPR 1 "scc_comparison_operator" - [(match_operand 2 "cc_reg_operand" "y") - (const_int 0)]))] + (unspec:GPR [(match_operand 1 "cc_reg_operand" "y")] + UNSPEC_MFCR))] "" - "mfcr %0%Q2\;rlwinm %0,%0,%J1,1" + "mfcr %0%Q1" [(set (attr "type") (cond [(match_test "TARGET_MFCRF") (const_string "mfcrf") ] - (const_string "mfcr"))) - (set_attr "length" "8")]) + (const_string "mfcr")))]) + +;; Split the insn after reload so that other insns can be inserted +;; between mfcr and rlinm. +(define_insn_and_split "set_cc" + [(set (match_operand:GPR 0 "gpc_reg_operand" "=r") + (match_operator:GPR 1 "scc_comparison_operator" + [(match_operand 2 "cc_reg_operand" "y") + (const_int 0)]))] + "!TARGET_POWER10 + || (GET_MODE (operands[2]) != CCmode + && GET_MODE (operands[2]) != CCUNSmode)" + "#" + "&& reload_completed" + [(set (match_dup 0) + (unspec:GPR [(match_dup 2)] + UNSPEC_MFCR)) + (set (match_dup 0) + (unspec:GPR [(match_dup 0) + (match_dup 1)] + UNSPEC_ROTATE_CR))] + "" + [(set_attr "length" "8")]) + +(define_insn "*rotate_cr" + [(set (match_operand:GPR 0 "gpc_reg_operand" "=r") + (unspec:GPR [(match_operand:GPR 3 "gpc_reg_operand" "r") + (match_operator:GPR 1 "scc_comparison_operator" + [(match_operand 2 "cc_reg_operand" "y") + (const_int 0)])] + UNSPEC_ROTATE_CR))] + "" + "rlwinm %0,%3,%J1,1" +) (define_insn_and_split "*set_rev" [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")