From patchwork Fri Apr 22 16:52:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 564884 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp691921map; Fri, 22 Apr 2022 10:39:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxTajn6Q1N36igiHPgfQwI3m4cyoQjSg2PUcKiaaBDYuP41EA5riIb0ZfpqmY6eirHj0Qqz X-Received: by 2002:a05:620a:2886:b0:699:bab7:ae78 with SMTP id j6-20020a05620a288600b00699bab7ae78mr3369773qkp.618.1650649192121; Fri, 22 Apr 2022 10:39:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650649192; cv=none; d=google.com; s=arc-20160816; b=J6sal1OynqHmbHng1wN4wgHPSFrWl6WZoLApd2nSEMXqlHX5jjtlFSv5hVmKaTTMkY 4gx/e97w8ao8YQBDkuC2cuRmZ5sJ1xZtmjZuNsj0q/GUsCiGDajarC+3VyqiZ3SRuujn 94+GmDwGNx8rWjOCJmSgpDuIihqMaL3oRj51/OK+xgxdR1p0trBDQ6zXijeZNQ4jlLJt vvvwSlzwiKzAgawKACXU6UYO+vy4eO8tA+j0OkodIPpuPbLU3Buo3C/ohY6C1PMFnOiA Ei5ojYG1yz/jrJnsDxLrPahNUwmcjP1iyL/H4tZFaUS9edCDd+1wXh6plElZmVcFbxoC kbIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=yLnKk6KeXtnOdH9WAfFyAEdKebgTI3uohXWuThUdcek=; b=Rki7F/94NI00Tlmy4x/KrGoFC08cgk0seSWmKzQ6aAIYx/k6q3m+KZYu0pgEdCpE0I Os1kinhll4cDHWU5TRF4+lsem3OiJxl47ETtMpo7uv2W0sIUJlUwrk8JTXGnIR+eqkPp 1IGxTjefFrIwsDoOl2e716sOUyYj7C8D6uhWwLGGK1mfc/omCIFX7H0VIbshyGbI0WcN CRjF3lSggfXJOv/68sc5gCzpn2lxSZREX51o14olyJesOZKY6DMy1e6CTnmsf/X8R3CG ZwNsA+On/hEeiAoxsgNQgzq1oby6+Pzoq+ZCLAMIYwWg5oKOgdNcOk5FUFPhy3qRcJoJ B/nw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FVxODr7q; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id t20-20020a05622a149400b002ebd874b439si2436705qtx.289.2022.04.22.10.39.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Apr 2022 10:39:52 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FVxODr7q; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:40668 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhxG3-0003Ow-Kf for patch@linaro.org; Fri, 22 Apr 2022 13:39:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49996) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhwah-0008Vg-Sr for qemu-devel@nongnu.org; Fri, 22 Apr 2022 12:57:07 -0400 Received: from mail-il1-x134.google.com ([2607:f8b0:4864:20::134]:42506) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhwag-0007zs-Ap for qemu-devel@nongnu.org; Fri, 22 Apr 2022 12:57:07 -0400 Received: by mail-il1-x134.google.com with SMTP id r17so5413488iln.9 for ; Fri, 22 Apr 2022 09:57:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=yLnKk6KeXtnOdH9WAfFyAEdKebgTI3uohXWuThUdcek=; b=FVxODr7qSXnXdWGJfWCWCYxIjfIuryTcqYc6V/TFhtEtYBLpfATWllmH1pPZI3yw6c 5k8ZhK7CbGGMXakwIOoSWOo9tKTu2t/wpdfjFvt54pVP1kmiDVngID+uEkiqJbRtQGpo lNyWzkGLr94lthCW4GHi2j90YMbxHtgRAjXXyb34ZM7qRncay3Ohkfi9l/aM1G72Nl4U LO+7In0NOq9a+DOEbc99fXtKbcVj00gyxFIl4PbU5HkoR70vXdCu5a1GtxplL0+rmGy4 lY2QvA3dour9cuZOY6Aoq21XO25QX5pGs6TuC9MD8JyAFfRBO8bmsVSK+gZRNUkNoV6K wbAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yLnKk6KeXtnOdH9WAfFyAEdKebgTI3uohXWuThUdcek=; b=wpEI/ft/w7oZLKt7tl8KrNrJPEvewdWzDXMUBjIKK8dkNPOvPWk+vWNXoWW6Qpdlii 54FzZpJq/IU7XEisBmFzbBAr6pb+HrIyVO1Vb8IFzcs/mdDNKEkcpB/7QnZD/QJEAFY1 FfM6iD/iY0wLxGWp1hZgMRiP5v6J+Nd4eZGsMc3QTJrRXswKPj2ibOMGMhMn06+Bc45q meq7X7cRHjfj9S5GFXarCSGwENRyiNsTOnwskOLA05eWSKWqsx6yj9bVRWYsc1AZ9BYl Wqa/bbvd2mwpM0r4PfFxBX4zYGtt+k7ik4h99vPIxMNte+T9oNflqvYxMJ4FqiUbmbfm GKow== X-Gm-Message-State: AOAM530PdP3IlL5I9uI+r+qDykQMhExB2VbbGznOVnt3fwNIRCCEoL27 w9led7rpV+iGAZIlEqm6yv8WxvzV+Qn4xaYb X-Received: by 2002:a05:6e02:1563:b0:2cb:88aa:fd18 with SMTP id k3-20020a056e02156300b002cb88aafd18mr2414507ilu.216.1650646625288; Fri, 22 Apr 2022 09:57:05 -0700 (PDT) Received: from stoup.. ([2607:fb90:27d0:b0f2:934d:3e2:9f8c:dd1]) by smtp.gmail.com with ESMTPSA id n23-20020a6b8b17000000b00649a2634725sm816380iod.17.2022.04.22.09.57.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 09:57:04 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v8 47/68] target/nios2: Split out helpers for gen_rr_mul_high Date: Fri, 22 Apr 2022 09:52:17 -0700 Message-Id: <20220422165238.1971496-48-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220422165238.1971496-1-richard.henderson@linaro.org> References: <20220422165238.1971496-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::134; envelope-from=richard.henderson@linaro.org; helo=mail-il1-x134.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Rename the macro from gen_r_mul, because these are the multiply variants that produce a high-part result. Do as little work as possible within the macro; split out helper functions and pass in arguments instead. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/nios2/translate.c | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/target/nios2/translate.c b/target/nios2/translate.c index 4f52606516..5979427c8e 100644 --- a/target/nios2/translate.c +++ b/target/nios2/translate.c @@ -122,6 +122,7 @@ typedef struct { typedef void GenFn2i(TCGv, TCGv, target_long); typedef void GenFn3(TCGv, TCGv, TCGv); +typedef void GenFn4(TCGv, TCGv, TCGv, TCGv); typedef struct DisasContext { DisasContextBase base; @@ -669,21 +670,25 @@ gen_ri_math_logic(srli, shri) gen_ri_math_logic(slli, shli) gen_ri_math_logic(roli, rotli) -#define gen_r_mul(fname, insn) \ -static void (fname)(DisasContext *dc, uint32_t code, uint32_t flags) \ -{ \ - R_TYPE(instr, (code)); \ - if (likely(instr.c != R_ZERO)) { \ - TCGv t0 = tcg_temp_new(); \ - tcg_gen_##insn(t0, cpu_R[instr.c], \ - load_gpr(dc, instr.a), load_gpr(dc, instr.b)); \ - tcg_temp_free(t0); \ - } \ +static void do_rr_mul_high(DisasContext *dc, uint32_t insn, GenFn4 *fn) +{ + R_TYPE(instr, insn); + + if (likely(instr.c != R_ZERO)) { + TCGv discard = tcg_temp_new(); + fn(discard, cpu_R[instr.c], load_gpr(dc, instr.a), + load_gpr(dc, instr.b)); + tcg_temp_free(discard); + } } -gen_r_mul(mulxss, muls2_tl) -gen_r_mul(mulxuu, mulu2_tl) -gen_r_mul(mulxsu, mulsu2_tl) +#define gen_rr_mul_high(fname, insn) \ + static void (fname)(DisasContext *dc, uint32_t code, uint32_t flags) \ + { do_rr_mul_high(dc, code, tcg_gen_##insn##_tl); } + +gen_rr_mul_high(mulxss, muls2) +gen_rr_mul_high(mulxuu, mulu2) +gen_rr_mul_high(mulxsu, mulsu2) #define gen_r_shift_s(fname, insn) \ static void (fname)(DisasContext *dc, uint32_t code, uint32_t flags) \