From patchwork Sun May 3 16:12:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dimitar Dimitrov X-Patchwork-Id: 1282035 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=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=dinux.eu Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=dinux.eu header.i=@dinux.eu header.a=rsa-sha256 header.s=default header.b=H1UiYYuZ; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (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 49FWGz5lzjz9sRf for ; Mon, 4 May 2020 02:12:43 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 79A803851C3F; Sun, 3 May 2020 16:12:24 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from server28.superhosting.bg (server28.superhosting.bg [217.174.156.11]) by sourceware.org (Postfix) with ESMTPS id 5C1853851C1D for ; Sun, 3 May 2020 16:12:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 5C1853851C1D Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=dinux.eu Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=dimitar@dinux.eu DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=dinux.eu; s=default; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=4UR1MKcBtpPMkt59IFLvsnzVXbCYEJwxygcwj86AJNE=; b=H1UiYYuZNgfGNlWjm69WhkODuR zwyFtrI08IfYs8DbE03d1U5zeI4+gBvrgTLhmd1Vlk7W3rs6B6BLQdqzjBtoLWjkCv0q9uzgsSz4o wc7aGAL0efj8tqtzrUfdOk9aQSgzqHjypHxN8rGzkVeXZAYt+BBMP9dVvsAiTCA1Eq/IE0Hd67+j/ 28VNqy/0NmqVBWJ0YO4sLz541vWu2+k9SZXWoYUPLSY5STbzpqYqY874kMlwO8pYRnCd9Yg/8nN8k uStCAQAX3oTmFrrHK5j/V6ImKGiu9i1g4atd3cF2okc+BiLi7St3iTYXbRwEuExsXvWuTqdBqiE9i fpnKOH9Q==; Received: from [95.87.234.74] (port=33926 helo=localhost.localdomain) by server28.superhosting.bg with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1jVHE2-0002UW-35; Sun, 03 May 2020 19:12:20 +0300 From: Dimitar Dimitrov To: gcc-patches@gcc.gnu.org Subject: [PATCH v2 2/5] PRU: Simplify machine description Date: Sun, 3 May 2020 19:12:01 +0300 Message-Id: <20200503161204.18245-3-dimitar@dinux.eu> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200503161204.18245-1-dimitar@dinux.eu> References: <20200503161204.18245-1-dimitar@dinux.eu> MIME-Version: 1.0 X-OutGoing-Spam-Status: No, score=-1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - server28.superhosting.bg X-AntiAbuse: Original Domain - gcc.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - dinux.eu X-Get-Message-Sender-Via: server28.superhosting.bg: authenticated_id: dimitar@dinux.eu X-Authenticated-Sender: server28.superhosting.bg: dimitar@dinux.eu X-Source: X-Source-Args: X-Source-Dir: X-Spam-Status: No, score=-24.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_LOW, 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: , Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" Use the new @insn syntax for simpler gen_* invocation. gcc/ChangeLog: 2020-05-03 Dimitar Dimitrov * config/pru/pru.c (pru_emit_doloop): Use new gen_doloop_end_internal and gen_doloop_begin_internal. (pru_reorg_loop): Use gen_pruloop with mode. * config/pru/pru.md: Use new @insn syntax. Signed-off-by: Dimitar Dimitrov --- gcc/config/pru/pru.c | 44 +++++++++++++------------------------------ gcc/config/pru/pru.md | 6 +++--- 2 files changed, 16 insertions(+), 34 deletions(-) diff --git a/gcc/config/pru/pru.c b/gcc/config/pru/pru.c index e20b41c6d1f..45b18ed6fe4 100644 --- a/gcc/config/pru/pru.c +++ b/gcc/config/pru/pru.c @@ -2345,26 +2345,14 @@ pru_emit_doloop (rtx *operands, int is_end) tag = GEN_INT (cfun->machine->doloop_tags - 1); machine_mode opmode = GET_MODE (operands[0]); + gcc_assert (opmode == HImode || opmode == SImode); + if (is_end) - { - if (opmode == HImode) - emit_jump_insn (gen_doloop_end_internalhi (operands[0], - operands[1], tag)); - else if (opmode == SImode) - emit_jump_insn (gen_doloop_end_internalsi (operands[0], - operands[1], tag)); - else - gcc_unreachable (); - } + emit_jump_insn (gen_doloop_end_internal (opmode, operands[0], + operands[1], tag)); else - { - if (opmode == HImode) - emit_insn (gen_doloop_begin_internalhi (operands[0], operands[0], tag)); - else if (opmode == SImode) - emit_insn (gen_doloop_begin_internalsi (operands[0], operands[0], tag)); - else - gcc_unreachable (); - } + emit_insn (gen_doloop_begin_internal (opmode, operands[0], + operands[0], tag)); } @@ -2607,6 +2595,7 @@ pru_reorg_loop (rtx_insn *insns) /* Case (1) or (2). */ rtx_code_label *repeat_label; rtx label_ref; + rtx loop_rtx; /* Create a new label for the repeat insn. */ repeat_label = gen_label_rtx (); @@ -2616,23 +2605,16 @@ pru_reorg_loop (rtx_insn *insns) will utilize an internal for the PRU core LOOP register. */ label_ref = gen_rtx_LABEL_REF (VOIDmode, repeat_label); machine_mode loop_mode = GET_MODE (loop->begin->loop_count); - if (loop_mode == HImode) - emit_insn_before (gen_pruloophi (loop->begin->loop_count, label_ref), - loop->begin->insn); - else if (loop_mode == SImode) - { - rtx loop_rtx = gen_pruloopsi (loop->begin->loop_count, label_ref); - emit_insn_before (loop_rtx, loop->begin->insn); - } - else if (loop_mode == VOIDmode) + if (loop_mode == VOIDmode) { gcc_assert (CONST_INT_P (loop->begin->loop_count)); gcc_assert (UBYTE_INT ( INTVAL (loop->begin->loop_count))); - rtx loop_rtx = gen_pruloopsi (loop->begin->loop_count, label_ref); - emit_insn_before (loop_rtx, loop->begin->insn); + loop_mode = SImode; } - else - gcc_unreachable (); + gcc_assert (loop_mode == HImode || loop_mode == SImode); + loop_rtx = gen_pruloop (loop_mode, loop->begin->loop_count, label_ref); + emit_insn_before (loop_rtx, loop->begin->insn); + delete_insn (loop->begin->insn); /* Insert the repeat label before the first doloop_end. diff --git a/gcc/config/pru/pru.md b/gcc/config/pru/pru.md index 67624e2aac0..2f1bc21f025 100644 --- a/gcc/config/pru/pru.md +++ b/gcc/config/pru/pru.md @@ -887,7 +887,7 @@ (define_insn "cbranch_qbbx_4" ;; This insn is volatile because we'd like it to stay in its original ;; position, just before the loop header. If it stays there, we might ;; be able to convert it into a "loop" insn. -(define_insn "doloop_begin_internal" +(define_insn "@doloop_begin_internal" [(set (match_operand:HISI 0 "register_operand" "=r") (unspec_volatile:HISI [(match_operand:HISI 1 "reg_or_ubyte_operand" "rI") @@ -909,7 +909,7 @@ (define_expand "doloop_begin" ; Note: "JUMP_INSNs and CALL_INSNs are not allowed to have any output ; reloads;". Hence this insn must be prepared for a counter that is ; not a register. -(define_insn "doloop_end_internal" +(define_insn "@doloop_end_internal" [(set (pc) (if_then_else (ne (match_operand:HISI 0 "nonimmediate_operand" "+r,*m") (const_int 1)) @@ -951,7 +951,7 @@ (define_expand "doloop_end" DONE; }) -(define_insn "pruloop" +(define_insn "@pruloop" [(set (reg:HISI LOOPCNTR_REGNUM) (unspec:HISI [(match_operand:HISI 0 "reg_or_ubyte_operand" "rI") (label_ref (match_operand 1))]