From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3CD3C388F9 for ; Thu, 19 Nov 2020 21:11:38 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1A98022255 for ; Thu, 19 Nov 2020 21:11:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Vc6/ESAC" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1A98022255 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:50580 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kfrDN-0006Q4-1l for qemu-devel@archiver.kernel.org; Thu, 19 Nov 2020 16:11:37 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40474) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kfr6W-00076g-Ad for qemu-devel@nongnu.org; Thu, 19 Nov 2020 16:04:32 -0500 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]:44158) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kfr6P-0002RN-6l for qemu-devel@nongnu.org; Thu, 19 Nov 2020 16:04:32 -0500 Received: by mail-pf1-x434.google.com with SMTP id y7so5659520pfq.11 for ; Thu, 19 Nov 2020 13:04:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:from:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=BmOR9YJnGmLqOYKphHeQjePxwlSG50eELAbZRz5jfOQ=; b=Vc6/ESACnXeUYepmE7lFR4YF15K/cT7AE5pq7rtllgP1q1f/+0covg5Pq1nWOcK9Ab uVZIk0By/x8BZYwPuo+RDPgzisziwgkCtG9KmxiUFgRlAOJJWt3P+3NgDwJnhUGwaF73 VMb51FlhGz5rUvoK7URXlJs+BtcNP9QUx5c30TfFpGknQKuj/H4Kj8d+FuII6CKR3Lq9 34vnRtbHQjTptCJYzFtBwoXKb9Jr8eOSFbbtwu1qgzqlWbRn3wBylc2BGOpoSzumhCc5 lqTDQmM27RK9d04Wq06NLs6X2eQ8Vt9z5qvwUARvq80mUmLbSueJqHLjo8yVwhnVTA8j yVfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=BmOR9YJnGmLqOYKphHeQjePxwlSG50eELAbZRz5jfOQ=; b=BWLtOWqE5Wq8H2dJoLHw188sSqTbmV6JRpl1PeHvRr+/uM7nOCZ5PtYmrq8azon55a L7eqCK9psYThHCQEWM2YSdXmNuunNlMIb+Lnh1oI2lvSksYh/HNG+HHar5zC+OcDkUt8 S+p7t0qxCaRA/vZVBxW50LPEXytwjrp2vedHfGPAGD+SsVuljVta1Ul7u1nrU8lLErU4 SZ157OiOXAEclCqS7I0S0KDUeB9RfkiReKpZlrr9JmiwptzpCAk4Om2xrmqfFqs9Hujo SgCHTC7+Rd5GUVyG9u+ljaAUAPg16bizd9WTgc+mks09P3CM3pG+IfktpXkRpu1LFWtO za7g== X-Gm-Message-State: AOAM533/m+MKrKLHVVSAaahL15x1wj8RachLRiXh9M0kIxzitQVfEXsZ 8ElEZ9kPnAaprLbSkCG7UsrhAw== X-Google-Smtp-Source: ABdhPJwXQzy3xUeRVpKw7rIKp/Ddw02ORjaoSBXTW0tiCRx2qgrHhc8njOhRtzFHZAwUVxwEFUgFKA== X-Received: by 2002:a65:5cc6:: with SMTP id b6mr14335468pgt.417.1605819859757; Thu, 19 Nov 2020 13:04:19 -0800 (PST) Received: from [192.168.1.11] ([71.212.141.89]) by smtp.gmail.com with ESMTPSA id e14sm582151pga.61.2020.11.19.13.04.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 19 Nov 2020 13:04:19 -0800 (PST) Subject: Re: [RFC 08/15] target/riscv: rvb: single-bit instructions From: Richard Henderson To: frank.chang@sifive.com, qemu-devel@nongnu.org, qemu-riscv@nongnu.org References: <20201118083044.13992-1-frank.chang@sifive.com> <20201118083044.13992-9-frank.chang@sifive.com> <299ed3c1-fcb1-aa34-a595-5f86b8466d18@linaro.org> Message-ID: Date: Thu, 19 Nov 2020 13:04:17 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <299ed3c1-fcb1-aa34-a595-5f86b8466d18@linaro.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=2607:f8b0:4864:20::434; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x434.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bastian Koppelmann , Kito Cheng , Alistair Francis , Palmer Dabbelt , Sagar Karandikar Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On 11/19/20 12:35 PM, Richard Henderson wrote: > On 11/18/20 12:29 AM, frank.chang@sifive.com wrote: >> +static bool trans_sbset(DisasContext *ctx, arg_sbset *a) >> +{ >> + REQUIRE_EXT(ctx, RVB); >> + return gen_arith(ctx, a, &gen_sbset); >> +} >> + >> +static bool trans_sbseti(DisasContext *ctx, arg_sbseti *a) >> +{ >> + REQUIRE_EXT(ctx, RVB); >> + return gen_arith_shamt_tl(ctx, a, &gen_sbset); >> +} >> + >> +static bool trans_sbclr(DisasContext *ctx, arg_sbclr *a) >> +{ >> + REQUIRE_EXT(ctx, RVB); >> + return gen_arith(ctx, a, &gen_sbclr); >> +} > > Coming back to my re-use of code thing, these should use gen_shift. That > handles the truncate of source2 to the shift amount. > >> +static bool trans_sbclri(DisasContext *ctx, arg_sbclri *a) >> +{ >> + REQUIRE_EXT(ctx, RVB); >> + return gen_arith_shamt_tl(ctx, a, &gen_sbclr); >> +} >> + >> +static bool trans_sbinv(DisasContext *ctx, arg_sbinv *a) >> +{ >> + REQUIRE_EXT(ctx, RVB); >> + return gen_arith(ctx, a, &gen_sbinv); >> +} >> + >> +static bool trans_sbinvi(DisasContext *ctx, arg_sbinvi *a) >> +{ >> + REQUIRE_EXT(ctx, RVB); >> + return gen_arith_shamt_tl(ctx, a, &gen_sbinv); >> +} > > I think there ought to be a gen_shifti for these. Hmm. I just realized that gen_shifti would have a generator callback with a constant argument, a-la tcg_gen_shli_tl. I don't know if it's worth duplicating gen_sbclr et al for a constant argument. And the sloi/sroi insns besides. Perhaps a gen_shifti_var helper instead? Let me know what you think, but at the moment we're left with an incoherent set of helpers that seem split along lines that are less than ideal. r~ From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1kfr6W-00076b-8x for mharc-qemu-riscv@gnu.org; Thu, 19 Nov 2020 16:04:32 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40450) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kfr6T-000759-R1 for qemu-riscv@nongnu.org; Thu, 19 Nov 2020 16:04:30 -0500 Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]:33673) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kfr6P-0002RO-6m for qemu-riscv@nongnu.org; Thu, 19 Nov 2020 16:04:28 -0500 Received: by mail-pf1-x42a.google.com with SMTP id q10so5696704pfn.0 for ; Thu, 19 Nov 2020 13:04:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:from:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=BmOR9YJnGmLqOYKphHeQjePxwlSG50eELAbZRz5jfOQ=; b=Vc6/ESACnXeUYepmE7lFR4YF15K/cT7AE5pq7rtllgP1q1f/+0covg5Pq1nWOcK9Ab uVZIk0By/x8BZYwPuo+RDPgzisziwgkCtG9KmxiUFgRlAOJJWt3P+3NgDwJnhUGwaF73 VMb51FlhGz5rUvoK7URXlJs+BtcNP9QUx5c30TfFpGknQKuj/H4Kj8d+FuII6CKR3Lq9 34vnRtbHQjTptCJYzFtBwoXKb9Jr8eOSFbbtwu1qgzqlWbRn3wBylc2BGOpoSzumhCc5 lqTDQmM27RK9d04Wq06NLs6X2eQ8Vt9z5qvwUARvq80mUmLbSueJqHLjo8yVwhnVTA8j yVfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=BmOR9YJnGmLqOYKphHeQjePxwlSG50eELAbZRz5jfOQ=; b=l/ddS3tavumCb3TYfRFqA89kU7SdzlkP60wogTZJmq9ynMpgT5ObjaInA9uVOjIpeh B42x2XQ5EzCpKxllgFk7Tfn3yGYFPncB/aOoeiYfbMzgKCLO38AHKosSDBUrvde1CaU4 j5vo529YVs4alA9YFs6h/TcCT1KrW1PeYPUXUpEaCUcP1Ip+Nc92FNIULJ118khS7V/v 0/MlwSlO+fD1Zh8jG76T+ELFPaXeU4+Y0xvO3WZdYY38yKOzr5iAySIBlYFmifXCU15L 1/uySuBx1zFy9bnsXSKqp5dKH43P6lUMCDymOyogjOYuv1RWGVYPaV6qolzdortR/XWi B1Yw== X-Gm-Message-State: AOAM533rqk6qmhQfl+Ak0jDAELJ2nBnyZ2lPRCV2cO66rUL55jYH94/n Yd1eP7WNf2eVEmdw/ZLuKMLz2Q== X-Google-Smtp-Source: ABdhPJwXQzy3xUeRVpKw7rIKp/Ddw02ORjaoSBXTW0tiCRx2qgrHhc8njOhRtzFHZAwUVxwEFUgFKA== X-Received: by 2002:a65:5cc6:: with SMTP id b6mr14335468pgt.417.1605819859757; Thu, 19 Nov 2020 13:04:19 -0800 (PST) Received: from [192.168.1.11] ([71.212.141.89]) by smtp.gmail.com with ESMTPSA id e14sm582151pga.61.2020.11.19.13.04.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 19 Nov 2020 13:04:19 -0800 (PST) Subject: Re: [RFC 08/15] target/riscv: rvb: single-bit instructions From: Richard Henderson To: frank.chang@sifive.com, qemu-devel@nongnu.org, qemu-riscv@nongnu.org Cc: Sagar Karandikar , Bastian Koppelmann , Alistair Francis , Palmer Dabbelt , Kito Cheng References: <20201118083044.13992-1-frank.chang@sifive.com> <20201118083044.13992-9-frank.chang@sifive.com> <299ed3c1-fcb1-aa34-a595-5f86b8466d18@linaro.org> Message-ID: Date: Thu, 19 Nov 2020 13:04:17 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <299ed3c1-fcb1-aa34-a595-5f86b8466d18@linaro.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=2607:f8b0:4864:20::42a; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-riscv@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Nov 2020 21:04:30 -0000 On 11/19/20 12:35 PM, Richard Henderson wrote: > On 11/18/20 12:29 AM, frank.chang@sifive.com wrote: >> +static bool trans_sbset(DisasContext *ctx, arg_sbset *a) >> +{ >> + REQUIRE_EXT(ctx, RVB); >> + return gen_arith(ctx, a, &gen_sbset); >> +} >> + >> +static bool trans_sbseti(DisasContext *ctx, arg_sbseti *a) >> +{ >> + REQUIRE_EXT(ctx, RVB); >> + return gen_arith_shamt_tl(ctx, a, &gen_sbset); >> +} >> + >> +static bool trans_sbclr(DisasContext *ctx, arg_sbclr *a) >> +{ >> + REQUIRE_EXT(ctx, RVB); >> + return gen_arith(ctx, a, &gen_sbclr); >> +} > > Coming back to my re-use of code thing, these should use gen_shift. That > handles the truncate of source2 to the shift amount. > >> +static bool trans_sbclri(DisasContext *ctx, arg_sbclri *a) >> +{ >> + REQUIRE_EXT(ctx, RVB); >> + return gen_arith_shamt_tl(ctx, a, &gen_sbclr); >> +} >> + >> +static bool trans_sbinv(DisasContext *ctx, arg_sbinv *a) >> +{ >> + REQUIRE_EXT(ctx, RVB); >> + return gen_arith(ctx, a, &gen_sbinv); >> +} >> + >> +static bool trans_sbinvi(DisasContext *ctx, arg_sbinvi *a) >> +{ >> + REQUIRE_EXT(ctx, RVB); >> + return gen_arith_shamt_tl(ctx, a, &gen_sbinv); >> +} > > I think there ought to be a gen_shifti for these. Hmm. I just realized that gen_shifti would have a generator callback with a constant argument, a-la tcg_gen_shli_tl. I don't know if it's worth duplicating gen_sbclr et al for a constant argument. And the sloi/sroi insns besides. Perhaps a gen_shifti_var helper instead? Let me know what you think, but at the moment we're left with an incoherent set of helpers that seem split along lines that are less than ideal. r~