From patchwork Mon Dec 9 12:32:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Segher Boessenkool X-Patchwork-Id: 1206166 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=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-515512-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=kernel.crashing.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="jXnqypwy"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47WjJx31tFz9sPc for ; Mon, 9 Dec 2019 23:33:03 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id; q=dns; s=default; b=EAK6RWnTzFml th553tlqKsQDnhKG0eNlbRfEGlqusKMb3SWengDRCHMN/NDX2DkUkLTtea85BfOT p0SsncZtkvD/RxZ7eDqbEyb6xwtjxmJXCtDWNIDV9qUzP95OSZUrjREyff/c3DA8 mZ4B/A6sDOQQ/iMLfgq2oASTE//jgqQ= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id; s=default; bh=/KMrCsN2ywtMl5bDC+ i3XSfz6aM=; b=jXnqypwy3YuvSFGw8mqscixU6TBdqekb58oz78DzS2VPjXGlI+ w0ebSKFnP9LfmzAjuJBcUHoXvaCnu0u+q5dMuIK6CdKFfGPsJhyuQP8UEjxHXgp1 Eo8RjnMz2WvSNP8vMC9xkKFcBuOBwbOibcbiRYjYT0qezbdIZQVw+JM4M= Received: (qmail 51168 invoked by alias); 9 Dec 2019 12:32:56 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 51151 invoked by uid 89); 9 Dec 2019 12:32:56 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-18.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3 autolearn=ham version=3.3.1 spammy=HX-Languages-Length:4587 X-HELO: gcc1-power7.osuosl.org Received: from gcc1-power7.osuosl.org (HELO gcc1-power7.osuosl.org) (140.211.15.137) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 09 Dec 2019 12:32:54 +0000 Received: by gcc1-power7.osuosl.org (Postfix, from userid 10019) id 133DA1240861; Mon, 9 Dec 2019 12:32:52 +0000 (UTC) From: Segher Boessenkool To: gcc-patches@gcc.gnu.org Cc: dje.gcc@gmail.com, Segher Boessenkool Subject: [PATCH] rs6000: Name set_cc, and delete some old mfcr patterns Date: Mon, 9 Dec 2019 12:32:51 +0000 Message-Id: <8cd40878227aed86ff1aa341630fdbafc9ad5330.1575893841.git.segher@kernel.crashing.org> X-IsSubscribed: yes This names the so far unnamed basic mfcr pattern "set_cc", and it deletes all the others (only the ashift one ever was generated, and even that one only once during a whole bootstrap+regtest, and that one is questionable -- we don't cost that pattern correctly). Tested on powerpc64-linux {-m32,-m64}. (This defaults to power4, so this code actually is tested then). Committing to trunk. Segher 2019-12-09 Segher Boessenkool * config/rs6000/rs6000.md (unnamed mfcr define_insn): Name this set_cc. (unnamed define_insn_and_split): Delete. (unnamed define_insn): Delete. (unnamed define_insn): Delete. (unnamed define_split): Delete. --- gcc/config/rs6000/rs6000.md | 111 +------------------------------------------- 1 file changed, 1 insertion(+), 110 deletions(-) diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index f3c8eb0..4c44c1f 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -11838,7 +11838,7 @@ (define_insn_and_split "*cmp_internal2" ;; 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 "" +(define_insn "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") @@ -11852,115 +11852,6 @@ (define_insn "" (const_string "mfcr"))) (set_attr "length" "8")]) -(define_insn_and_split "" - [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y") - (compare:CC (match_operator:SI 1 "scc_comparison_operator" - [(match_operand 2 "cc_reg_operand" "y,y") - (const_int 0)]) - (const_int 0))) - (set (match_operand:SI 3 "gpc_reg_operand" "=r,r") - (match_op_dup 1 [(match_dup 2) (const_int 0)]))] - "TARGET_32BIT" - "@ - mfcr %3%Q2\;rlwinm. %3,%3,%J1,1 - #" - "&& reload_completed" - [(set (match_dup 3) - (match_op_dup 1 [(match_dup 2) (const_int 0)])) - (set (match_dup 0) - (compare:CC (match_dup 3) - (const_int 0)))] - "" - [(set_attr "type" "shift") - (set_attr "dot" "yes") - (set_attr "length" "8,16")]) - -(define_insn "" - [(set (match_operand:SI 0 "gpc_reg_operand" "=r") - (ashift:SI (match_operator:SI 1 "scc_comparison_operator" - [(match_operand 2 "cc_reg_operand" "y") - (const_int 0)]) - (match_operand:SI 3 "const_int_operand" "n")))] - "" -{ - int is_bit = ccr_bit (operands[1], 1); - int put_bit = 31 - (INTVAL (operands[3]) & 31); - int count; - - gcc_assert (is_bit != -1); - if (is_bit >= put_bit) - count = is_bit - put_bit; - else - count = 32 - (put_bit - is_bit); - - operands[4] = GEN_INT (count); - operands[5] = GEN_INT (put_bit); - - return "mfcr %0%Q2\;rlwinm %0,%0,%4,%5,%5"; -} - [(set (attr "type") - (cond [(match_test "TARGET_MFCRF") - (const_string "mfcrf") - ] - (const_string "mfcr"))) - (set_attr "length" "8")]) - -(define_insn "" - [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y") - (compare:CC - (ashift:SI (match_operator:SI 1 "scc_comparison_operator" - [(match_operand 2 "cc_reg_operand" "y,y") - (const_int 0)]) - (match_operand:SI 3 "const_int_operand" "n,n")) - (const_int 0))) - (set (match_operand:SI 4 "gpc_reg_operand" "=r,r") - (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)]) - (match_dup 3)))] - "" -{ - int is_bit = ccr_bit (operands[1], 1); - int put_bit = 31 - (INTVAL (operands[3]) & 31); - int count; - - gcc_assert (is_bit != -1); - /* Force split for non-cc0 compare. */ - if (which_alternative == 1) - return "#"; - - if (is_bit >= put_bit) - count = is_bit - put_bit; - else - count = 32 - (put_bit - is_bit); - - operands[5] = GEN_INT (count); - operands[6] = GEN_INT (put_bit); - - return "mfcr %4%Q2\;rlwinm. %4,%4,%5,%6,%6"; -} - [(set_attr "type" "shift") - (set_attr "dot" "yes") - (set_attr "length" "8,16")]) - -(define_split - [(set (match_operand:CC 0 "cc_reg_not_cr0_operand") - (compare:CC - (ashift:SI (match_operator:SI 1 "scc_comparison_operator" - [(match_operand 2 "cc_reg_operand") - (const_int 0)]) - (match_operand:SI 3 "const_int_operand")) - (const_int 0))) - (set (match_operand:SI 4 "gpc_reg_operand") - (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)]) - (match_dup 3)))] - "reload_completed" - [(set (match_dup 4) - (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)]) - (match_dup 3))) - (set (match_dup 0) - (compare:CC (match_dup 4) - (const_int 0)))] - "") - (define_code_iterator cmp [eq ne lt ltu gt gtu le leu ge geu]) (define_code_attr UNS [(eq "CC")