From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by sourceware.org (Postfix) with ESMTPS id 6AB1E3858C30 for ; Wed, 8 Mar 2023 07:49:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6AB1E3858C30 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 57C641F383; Wed, 8 Mar 2023 07:49:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1678261767; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=O0yLyktXYn/B0zHPTWzQ4+coydaX46ylI9h5qxVpUFQ=; b=g9bVRyAANGcJ4sYEtj9Hr2gvCRJO1lhbA8NM4IxRCm8gpHQJbFTVBpGOdZFyFDODqWEwfI sCVSno7j14Pu71wbbhRcuHtWjJ8d/qRqmpoRvK07I/H2qdqQb3Eky9EqwhP+h6fXGeUcYX tGte5DtA99J340/uvN2p+MtvAw3KadM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1678261767; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=O0yLyktXYn/B0zHPTWzQ4+coydaX46ylI9h5qxVpUFQ=; b=hM8vXXlUha1VoHJtqVfAR+c3U3sNfQs7Vl7n/H1m4ynPt1N+6Pvr7HnAZU+6EUD/4wCRGx ZKWq9V+7jWhvgPCA== Received: from wotan.suse.de (wotan.suse.de [10.160.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 0D11B2C141; Wed, 8 Mar 2023 07:49:26 +0000 (UTC) Date: Wed, 8 Mar 2023 07:49:26 +0000 (UTC) From: Richard Biener To: Ju-Zhe Zhong cc: gcc-patches@gcc.gnu.org, kito.cheng@gmail.com, jeffreyalaw@gmail.com, richard.sandiford@arm.com Subject: Re: [PATCH] Extend nops num in "maybe_gen_insn" for RISC-V Vector intrinsics In-Reply-To: <20230308074213.97404-1-juzhe.zhong@rivai.ai> Message-ID: References: <20230308074213.97404-1-juzhe.zhong@rivai.ai> User-Agent: Alpine 2.22 (LSU 394 2020-01-19) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-11.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,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: On Wed, 8 Mar 2023, juzhe.zhong@rivai.ai wrote: > From: Ju-Zhe Zhong > > Hi, current maybe_gen_insn can only expand 9 nops. > For RVV intrinsics, I need to extend it as 10, otherwise I should use GEN_FCN. > This patch is quite obvious change, Ok for trunk ? The optabs.cc change is OK. Thanks, Richard. > Thanks. > > gcc/ChangeLog: > > * config/riscv/riscv-vector-builtins.cc (function_expander::use_ternop_insn): Use maybe_gen_insn instead. > (function_expander::use_widen_ternop_insn): Ditto. > * optabs.cc (maybe_gen_insn): Extend nops handling. > > --- > gcc/config/riscv/riscv-vector-builtins.cc | 24 ++--------------------- > gcc/optabs.cc | 5 +++++ > 2 files changed, 7 insertions(+), 22 deletions(-) > > diff --git a/gcc/config/riscv/riscv-vector-builtins.cc b/gcc/config/riscv/riscv-vector-builtins.cc > index 60381cfe98f..fcda3863576 100644 > --- a/gcc/config/riscv/riscv-vector-builtins.cc > +++ b/gcc/config/riscv/riscv-vector-builtins.cc > @@ -3154,17 +3154,7 @@ function_expander::use_ternop_insn (bool vd_accum_p, insn_code icode) > add_input_operand (Pmode, get_tail_policy_for_pred (pred)); > add_input_operand (Pmode, get_mask_policy_for_pred (pred)); > add_input_operand (Pmode, get_avl_type_rtx (avl_type::NONVLMAX)); > - > - /* See optabs.cc, the maximum nops is 9 for using 'maybe_gen_insn'. > - We temporarily use GCN directly. We will change it back it we > - can support nops >= 10. */ > - gcc_assert (maybe_legitimize_operands (icode, 0, opno, m_ops)); > - rtx_insn *pat = GEN_FCN ( > - icode) (m_ops[0].value, m_ops[1].value, m_ops[2].value, m_ops[3].value, > - m_ops[4].value, m_ops[5].value, m_ops[6].value, m_ops[7].value, > - m_ops[8].value, m_ops[9].value); > - emit_insn (pat); > - return m_ops[0].value; > + return generate_insn (icode); > } > > /* Implement the call using instruction ICODE, with a 1:1 mapping between > @@ -3196,17 +3186,7 @@ function_expander::use_widen_ternop_insn (insn_code icode) > add_input_operand (Pmode, get_tail_policy_for_pred (pred)); > add_input_operand (Pmode, get_mask_policy_for_pred (pred)); > add_input_operand (Pmode, get_avl_type_rtx (avl_type::NONVLMAX)); > - > - /* See optabs.cc, the maximum nops is 9 for using 'maybe_gen_insn'. > - We temporarily use GCN directly. We will change it back it we > - can support nops >= 10. */ > - gcc_assert (maybe_legitimize_operands (icode, 0, opno, m_ops)); > - rtx_insn *pat = GEN_FCN ( > - icode) (m_ops[0].value, m_ops[1].value, m_ops[2].value, m_ops[3].value, > - m_ops[4].value, m_ops[5].value, m_ops[6].value, m_ops[7].value, > - m_ops[8].value, m_ops[9].value); > - emit_insn (pat); > - return m_ops[0].value; > + return generate_insn (icode); > } > > /* Implement the call using instruction ICODE, with a 1:1 mapping between > diff --git a/gcc/optabs.cc b/gcc/optabs.cc > index cf22bfec3f5..4c641cab192 100644 > --- a/gcc/optabs.cc > +++ b/gcc/optabs.cc > @@ -8091,6 +8091,11 @@ maybe_gen_insn (enum insn_code icode, unsigned int nops, > return GEN_FCN (icode) (ops[0].value, ops[1].value, ops[2].value, > ops[3].value, ops[4].value, ops[5].value, > ops[6].value, ops[7].value, ops[8].value); > + case 10: > + return GEN_FCN (icode) (ops[0].value, ops[1].value, ops[2].value, > + ops[3].value, ops[4].value, ops[5].value, > + ops[6].value, ops[7].value, ops[8].value, > + ops[9].value); > } > gcc_unreachable (); > } > -- Richard Biener SUSE Software Solutions Germany GmbH, Frankenstrasse 146, 90461 Nuernberg, Germany; GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman; HRB 36809 (AG Nuernberg)