From patchwork Tue Oct 25 16:29:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Segher Boessenkool X-Patchwork-Id: 10882 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1100027wru; Tue, 25 Oct 2022 09:30:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4BHz2ko0l76qZAOCrYX920Weskqn4+BY3vDvjukX279PCVqjzZCm08kcSLBGGqcojy6zE5 X-Received: by 2002:a17:907:a059:b0:7a5:587d:d315 with SMTP id gz25-20020a170907a05900b007a5587dd315mr12211697ejc.631.1666715401330; Tue, 25 Oct 2022 09:30:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666715401; cv=none; d=google.com; s=arc-20160816; b=YjEITWQJWCBN05yT+thM92lnVvG/8yGdDj1ec189hFKI/IdtwRrV6cwhKC+nnr7JZx EcRjZVY7VYikvp65NY7Uk7Dr9IhVmRVw2ROazOHdx+elBBzjPq2x7SrS0MploWh74Iik pVmZkzpDGk+8GmIZkYTGk6ugwdpF+MaEE+PY4og59UTDKB79dbrksKntyMkZDW7WcOvo 8o2xPy2drbMIrIVYb+TYjM4QBq+CMTNvikZLuu4UEVRkF23R9tpWUVTdHk5SzYKAnKaY UYl7Ip5Xe7cuG3CCCvONl1TShdKSMb4a+3yOFd7Wob1xQIxgrSsOjaL2ROt1oArgQcW4 7FPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:message-id:date:subject:to:from :dkim-filter:dkim-filter:dmarc-filter:delivered-to; bh=c3gS6ZcFkd8RxWXsLpUL8gALFO3IWLST5jW/S95CAbo=; b=lBSw9o4+iOwByPXxNX6Gho95VltJHqr26DWNAH23gVa1nF0MUKFPh+TReKv3f4WwIO oV7/XLESA7SzRWTHWArShznU53oYsdH42jU4iAi5Hoc34iz3tzwDtL0Az9a2CrVXsY2r NQQJL97/4JSohCuPCBVrifOGG8wZ6z5aLxeJ5xHcnp0KeMWOausLHi7b2AVqfdMtN1Yw EXS2HhWOEUF0Nnr+8m8E3Cb/Gkkp69enh/tDyxu204EOnFAKmepVrt7SLaNqdbpw3rGq +ih3aVei+caO60ovQXA3Z0eM/XboDyi1P13VSXRQTPLoqtk9/JNEv+gCRskUrhJau0di zbJQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id qf29-20020a1709077f1d00b0078dec48d439si3330945ejc.590.2022.10.25.09.30.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Oct 2022 09:30:01 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DB56F3856948 for ; Tue, 25 Oct 2022 16:29:59 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by sourceware.org (Postfix) with ESMTPS id A9D9C385702E for ; Tue, 25 Oct 2022 16:29:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A9D9C385702E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=kernel.crashing.org Authentication-Results: sourceware.org; spf=none smtp.mailfrom=gcc135.osuosl.org Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 5C1444026F; Tue, 25 Oct 2022 16:29:30 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 5C1444026F X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id oUbDm_HwGuSL; Tue, 25 Oct 2022 16:29:29 +0000 (UTC) Received: from gcc135.osuosl.org (gcc135.osuosl.org [140.211.9.83]) by smtp2.osuosl.org (Postfix) with ESMTP id 294CC40018; Tue, 25 Oct 2022 16:29:29 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 294CC40018 Received: by gcc135.osuosl.org (Postfix, from userid 61019) id 152782004B8; Tue, 25 Oct 2022 16:29:29 +0000 (UTC) From: Segher Boessenkool To: gcc-patches@gcc.gnu.org Subject: [PATCH] rs6000: Add CCANY; replace signed by Date: Tue, 25 Oct 2022 16:29:21 +0000 Message-Id: X-Mailer: git-send-email 1.8.3.1 X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, 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 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: , Cc: Segher Boessenkool , dje.gcc@gmail.com, "Kewen.Lin" Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747677768563793111?= X-GMAIL-MSGID: =?utf-8?q?1747677768563793111?= This is in preparation for adding CCFP, and maybe CCEQ, and whatever other CC mode we may want later. CCANY is used for CC mode consumers that actually can take any of the four CR field bits. Tested on p7 and p9; committing, Segher 2022-10-25 Segher Boessenkool * config/rs6000/rs6000.md (CCEITHER): Delete. (CCANY): New. (un): Delete. (isel_signed_): Rename to... (isel__): ... this. Adjust. (*isel_reversed_signed_): Rename to... (*isel_reversed__): ... this. Adjust. (setbc_signed_): Rename to... (setbc__C): ... this. Adjust." (*setbcr_signed_): Rename to ... (*setbcr__): ... this. Adjust. (*setnbc_signed_): Rename to ... (*setnbc__): ... this. Adjust. (*setnbcr_signed_): Rename to ... (*setnbcr__): ... this. Adjust. (eq3 for GPR): Adjust. (ne3 for GPR): Adjust. * config/rs6000/rs6000-string.cc (do_isel): Adjust. * config/rs6000/rs6000.cc (rs6000_emit_int_cmove): Adjust. --- gcc/config/rs6000/rs6000-string.cc | 4 ++-- gcc/config/rs6000/rs6000.cc | 4 ++-- gcc/config/rs6000/rs6000.md | 31 +++++++++++++++---------------- 3 files changed, 19 insertions(+), 20 deletions(-) diff --git a/gcc/config/rs6000/rs6000-string.cc b/gcc/config/rs6000/rs6000-string.cc index 59d901a..cd8ee8c 100644 --- a/gcc/config/rs6000/rs6000-string.cc +++ b/gcc/config/rs6000/rs6000-string.cc @@ -414,9 +414,9 @@ static void do_isel (rtx dest, rtx cmp, rtx src_t, rtx src_f, rtx cr) { if (GET_MODE (dest) == DImode) - emit_insn (gen_isel_signed_di (dest, cmp, src_t, src_f, cr)); + emit_insn (gen_isel_cc_di (dest, cmp, src_t, src_f, cr)); else - emit_insn (gen_isel_signed_si (dest, cmp, src_t, src_f, cr)); + emit_insn (gen_isel_cc_si (dest, cmp, src_t, src_f, cr)); } /* Emit a subtract of the proper mode for DEST. diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc index d2743f7..01e5bbc 100644 --- a/gcc/config/rs6000/rs6000.cc +++ b/gcc/config/rs6000/rs6000.cc @@ -16341,8 +16341,8 @@ rs6000_emit_int_cmove (rtx dest, rtx op, rtx true_cond, rtx false_cond) signedp = GET_MODE (cr) == CCmode; isel_func = (mode == SImode - ? (signedp ? gen_isel_signed_si : gen_isel_unsigned_si) - : (signedp ? gen_isel_signed_di : gen_isel_unsigned_di)); + ? (signedp ? gen_isel_cc_si : gen_isel_ccuns_si) + : (signedp ? gen_isel_cc_di : gen_isel_ccuns_di)); switch (cond_code) { diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index ad5a4cf..3bae303 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -5428,13 +5428,12 @@ (define_expand "movcc" ;; leave out the mode in operand 4 and use one pattern, but reload can ;; change the mode underneath our feet and then gets confused trying ;; to reload the value. -(define_mode_iterator CCEITHER [CC CCUNS]) -(define_mode_attr un [(CC "") (CCUNS "un")]) -(define_insn "isel_signed_" +(define_mode_iterator CCANY [CC CCUNS]) +(define_insn "isel__" [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r") (if_then_else:GPR (match_operator 1 "scc_comparison_operator" - [(match_operand:CCEITHER 4 "cc_reg_operand" "y,y") + [(match_operand:CCANY 4 "cc_reg_operand" "y,y") (const_int 0)]) (match_operand:GPR 2 "reg_or_zero_operand" "O,b") (match_operand:GPR 3 "gpc_reg_operand" "r,r")))] @@ -5446,11 +5445,11 @@ (define_insn "isel_signed_" ;; isel can handle reversed comparisons so long as the operands are ;; registers. -(define_insn "*isel_reversed_signed_" +(define_insn "*isel_reversed__" [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r") (if_then_else:GPR (match_operator 1 "scc_rev_comparison_operator" - [(match_operand:CCEITHER 4 "cc_reg_operand" "y,y") + [(match_operand:CCANY 4 "cc_reg_operand" "y,y") (const_int 0)]) (match_operand:GPR 2 "gpc_reg_operand" "r,r") (match_operand:GPR 3 "reg_or_zero_operand" "O,b")))] @@ -5462,38 +5461,38 @@ (define_insn "*isel_reversed_signed_" [(set_attr "type" "isel")]) ; Set Boolean Condition (Reverse) -(define_insn "setbc_signed_" +(define_insn "setbc__" [(set (match_operand:GPR 0 "gpc_reg_operand" "=r") (match_operator:GPR 1 "scc_comparison_operator" - [(match_operand:CCEITHER 2 "cc_reg_operand" "y") + [(match_operand:CCANY 2 "cc_reg_operand" "y") (const_int 0)]))] "TARGET_POWER10" "setbc %0,%j1" [(set_attr "type" "isel")]) -(define_insn "*setbcr_signed_" +(define_insn "*setbcr__" [(set (match_operand:GPR 0 "gpc_reg_operand" "=r") (match_operator:GPR 1 "scc_rev_comparison_operator" - [(match_operand:CCEITHER 2 "cc_reg_operand" "y") + [(match_operand:CCANY 2 "cc_reg_operand" "y") (const_int 0)]))] "TARGET_POWER10" "setbcr %0,%j1" [(set_attr "type" "isel")]) ; Set Negative Boolean Condition (Reverse) -(define_insn "*setnbc_signed_" +(define_insn "*setnbc__" [(set (match_operand:GPR 0 "gpc_reg_operand" "=r") (neg:GPR (match_operator:GPR 1 "scc_comparison_operator" - [(match_operand:CCEITHER 2 "cc_reg_operand" "y") + [(match_operand:CCANY 2 "cc_reg_operand" "y") (const_int 0)])))] "TARGET_POWER10" "setnbc %0,%j1" [(set_attr "type" "isel")]) -(define_insn "*setnbcr_signed_" +(define_insn "*setnbcr__" [(set (match_operand:GPR 0 "gpc_reg_operand" "=r") (neg:GPR (match_operator:GPR 1 "scc_rev_comparison_operator" - [(match_operand:CCEITHER 2 "cc_reg_operand" "y") + [(match_operand:CCANY 2 "cc_reg_operand" "y") (const_int 0)])))] "TARGET_POWER10" "setnbcr %0,%j1" @@ -12644,7 +12643,7 @@ (define_expand "eq3" rtx compare = gen_rtx_COMPARE (CCmode, operands[1], operands[2]); emit_insn (gen_rtx_SET (cc, compare)); rtx eq = gen_rtx_fmt_ee (EQ, mode, cc, const0_rtx); - emit_insn (gen_setbc_signed_ (operands[0], eq, cc)); + emit_insn (gen_setbc_cc_ (operands[0], eq, cc)); DONE; } @@ -12700,7 +12699,7 @@ (define_expand "ne3" rtx compare = gen_rtx_COMPARE (CCmode, operands[1], operands[2]); emit_insn (gen_rtx_SET (cc, compare)); rtx ne = gen_rtx_fmt_ee (NE, mode, cc, const0_rtx); - emit_insn (gen_setbc_signed_ (operands[0], ne, cc)); + emit_insn (gen_setbc_cc_ (operands[0], ne, cc)); DONE; }