From patchwork Mon Aug 31 16:05:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 248788 Delivered-To: patch@linaro.org Received: by 2002:a92:5b9c:0:0:0:0:0 with SMTP id c28csp3453461ilg; Mon, 31 Aug 2020 09:22:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwV3OOtwHuds/JdEQAG6E1Le4NEUeo2/pgfTRV56FlVVO99x6GpZOjmvPAmcfmJ4sjh7fMa X-Received: by 2002:a25:ca57:: with SMTP id a84mr3421884ybg.313.1598890975778; Mon, 31 Aug 2020 09:22:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598890975; cv=none; d=google.com; s=arc-20160816; b=lNRsnMPO1/PUZfW14FuXFJtzicVJ3V+F0azmPL7f65pzY55Q1pEnhCXBCumxuJ/F9u Dka6xUoHs9x2bFf660Od8yuAszWn3qo++5qQhQxunKgZOALYmtwziLVl7S5FrlbMQPyM bEpxQsbXnqHgSjP2+kWzCA5sM9IN2qNVHHQEwpy2BTq3S8SQ0nl8h5iqCmdfEHzJUE0Z 4ZPqJmy8ddnkSde4EVOi0dg9+4b6RLqrSHV4aZiTI6eC93sPxecRmcGHXTRg/ZONLgcc m/hCFTFJ8sIQDEru3SqP++FyJIr9lS1Xp8dpO1rvFwCJlicQmRs4kWK4m8n+VysZ8WeY Kt4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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=EI+R+4tP0x4knj3otgEq+jCMs+pFcf+NyvuwzVQpXIE=; b=vWOKYqudvt1yRsNFeYCzolql3GgvH5rqiFeahVgNarBFOM/LCtwiT0IKutmtm4xHmY pqquRtWtvZ/y1UdNCy2AQ6w62EPEw5zD2gsyHV8fSz+smGG+Bf2lMrzNcCw47cNOU7Fd c8iivHhA1gUjPauPWk6pqixsLFafo7jOlH5dAJNfcipjMY7JosYTypriOXDFcA9/brRB o2taO54Lk+2di0r4ROQYvQpa7axFO/TuihJwtJmkHXElEVpnGfmSL+YctAr9/5pkeQmB YcRRtEjej8G65CKB+9wY2FXhw1lX5gR1F0VhLD1OUSptXdQtAKxu5CTYRdVd90zDd7zU efgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=LTfocQDJ; 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=fail (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 w138si7917849ybg.423.2020.08.31.09.22.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 31 Aug 2020 09:22:55 -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=fail header.i=@linaro.org header.s=google header.b=LTfocQDJ; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:48926 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kCma7-0003ID-8T for patch@linaro.org; Mon, 31 Aug 2020 12:22:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34238) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kCmKm-0005Hl-KI for qemu-devel@nongnu.org; Mon, 31 Aug 2020 12:07:04 -0400 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]:33646) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kCmKj-00063e-Gz for qemu-devel@nongnu.org; Mon, 31 Aug 2020 12:07:04 -0400 Received: by mail-pj1-x102a.google.com with SMTP id np15so179866pjb.0 for ; Mon, 31 Aug 2020 09:07:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=EI+R+4tP0x4knj3otgEq+jCMs+pFcf+NyvuwzVQpXIE=; b=LTfocQDJ5u07X2Wa1qppcpeAo9gjdFJZotwqEDmCYgSXk7VXF1aP5+O5+0Y8vHN1Ie sI8upcUbTY0yNb3f2AlTRRIMztnxHUg3LZNbZzD3dRqsslvYe1gDNIlooVjwW8B2LTUY aq/akQXn7GuAT72sxUS3jZNLV4IxdFrVYmyx8jcLe+qCqurIZHVrH7xiST8xRhHW3GuS oRBdZHw+6X12VZDJcEDPPIwjZMueY9chw/SgNNNB7X+iziz7S6b6KnWIeiN8GhC3drKn 4ulINwb8D2ByUsCJs2hpHltpA2gOCGdHKaS9aDCcWTD1X81IduchM7IEjqBjdn/BJBfW WY4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=EI+R+4tP0x4knj3otgEq+jCMs+pFcf+NyvuwzVQpXIE=; b=aMBAu3LPizcO0gChoe1D2Os1RZlawMuiyO/AQnk6kfBXqSNon+SOgydxeXf6yYZgSb A1vDwIs95BzBLSSTTULNxuUYh+ceTfWjm/lWjorKMi4h2JKBJEiiWlfiWdQEwfHzQwWy UPK1wQz8o/LYZl/jlqeg1CclhGaS0wQbiEpgg5XBU/CEGORsNfKMurHo9eMl0kq4rV9S 9Y0MBh2dHEpnFgnkpOcqlj2XFvOD1Zj47hm7XpfOXzaMnvERfJ6UFZmtpVP1xZm3tAj3 BERJ9PHXcxm+pXQjDfRxVuDCSlCx2Hu/B58FOtBul0iyhuP5WuxtUdznr3LVfO0L1sWE XKEg== X-Gm-Message-State: AOAM532CJ4VXzEiq8I4lU2lzX/bVVFEVd1nfSb3OHbKGKQMPJUwDITR5 o9cgsMzAvzrSO7BX7DdVWyR7IZ5NgTI/fQ== X-Received: by 2002:a17:90a:384c:: with SMTP id l12mr73115pjf.27.1598890019651; Mon, 31 Aug 2020 09:06:59 -0700 (PDT) Received: from localhost.localdomain ([71.212.141.89]) by smtp.gmail.com with ESMTPSA id gt13sm17218pjb.43.2020.08.31.09.06.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Aug 2020 09:06:58 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 41/76] target/microblaze: Convert dec_mul to decodetree Date: Mon, 31 Aug 2020 09:05:26 -0700 Message-Id: <20200831160601.833692-42-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200831160601.833692-1-richard.henderson@linaro.org> References: <20200831160601.833692-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102a; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102a.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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 autolearn=ham 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: "Edgar E . Iglesias" , peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Tested-by: Edgar E. Iglesias Reviewed-by: Edgar E. Iglesias Signed-off-by: Richard Henderson --- target/microblaze/insns.decode | 6 +++ target/microblaze/translate.c | 77 ++++++++++++++-------------------- 2 files changed, 37 insertions(+), 46 deletions(-) -- 2.25.1 diff --git a/target/microblaze/insns.decode b/target/microblaze/insns.decode index 93bd51c78b..1a2e22e44a 100644 --- a/target/microblaze/insns.decode +++ b/target/microblaze/insns.decode @@ -50,6 +50,12 @@ andni 101011 ..... ..... ................ @typeb cmp 000101 ..... ..... ..... 000 0000 0001 @typea cmpu 000101 ..... ..... ..... 000 0000 0011 @typea +mul 010000 ..... ..... ..... 000 0000 0000 @typea +mulh 010000 ..... ..... ..... 000 0000 0001 @typea +mulhu 010000 ..... ..... ..... 000 0000 0011 @typea +mulhsu 010000 ..... ..... ..... 000 0000 0010 @typea +muli 011000 ..... ..... ................ @typeb + or 100000 ..... ..... ..... 000 0000 0000 @typea ori 101000 ..... ..... ................ @typeb diff --git a/target/microblaze/translate.c b/target/microblaze/translate.c index a143f17e9d..617e208583 100644 --- a/target/microblaze/translate.c +++ b/target/microblaze/translate.c @@ -287,6 +287,10 @@ static bool do_typeb_val(DisasContext *dc, arg_typeb *arg, bool side_effects, static bool trans_##NAME(DisasContext *dc, arg_typeb *a) \ { return do_typeb_imm(dc, a, SE, FNI); } +#define DO_TYPEBI_CFG(NAME, CFG, SE, FNI) \ + static bool trans_##NAME(DisasContext *dc, arg_typeb *a) \ + { return dc->cpu->cfg.CFG && do_typeb_imm(dc, a, SE, FNI); } + #define DO_TYPEBV(NAME, SE, FN) \ static bool trans_##NAME(DisasContext *dc, arg_typeb *a) \ { return do_typeb_val(dc, a, SE, FN); } @@ -364,6 +368,33 @@ static void gen_cmpu(TCGv_i32 out, TCGv_i32 ina, TCGv_i32 inb) DO_TYPEA(cmp, false, gen_cmp) DO_TYPEA(cmpu, false, gen_cmpu) +static void gen_mulh(TCGv_i32 out, TCGv_i32 ina, TCGv_i32 inb) +{ + TCGv_i32 tmp = tcg_temp_new_i32(); + tcg_gen_muls2_i32(tmp, out, ina, inb); + tcg_temp_free_i32(tmp); +} + +static void gen_mulhu(TCGv_i32 out, TCGv_i32 ina, TCGv_i32 inb) +{ + TCGv_i32 tmp = tcg_temp_new_i32(); + tcg_gen_mulu2_i32(tmp, out, ina, inb); + tcg_temp_free_i32(tmp); +} + +static void gen_mulhsu(TCGv_i32 out, TCGv_i32 ina, TCGv_i32 inb) +{ + TCGv_i32 tmp = tcg_temp_new_i32(); + tcg_gen_mulsu2_i32(tmp, out, ina, inb); + tcg_temp_free_i32(tmp); +} + +DO_TYPEA_CFG(mul, use_hw_mul, false, tcg_gen_mul_i32) +DO_TYPEA_CFG(mulh, use_hw_mul >= 2, false, gen_mulh) +DO_TYPEA_CFG(mulhu, use_hw_mul >= 2, false, gen_mulhu) +DO_TYPEA_CFG(mulhsu, use_hw_mul >= 2, false, gen_mulhsu) +DO_TYPEBI_CFG(muli, use_hw_mul, false, tcg_gen_muli_i32) + DO_TYPEA(or, false, tcg_gen_or_i32) DO_TYPEBI(ori, false, tcg_gen_ori_i32) @@ -652,51 +683,6 @@ static void dec_msr(DisasContext *dc) } } -/* Multiplier unit. */ -static void dec_mul(DisasContext *dc) -{ - TCGv_i32 tmp; - unsigned int subcode; - - if (trap_illegal(dc, !dc->cpu->cfg.use_hw_mul)) { - return; - } - - subcode = dc->imm & 3; - - if (dc->type_b) { - tcg_gen_mul_i32(cpu_R[dc->rd], cpu_R[dc->ra], *(dec_alu_op_b(dc))); - return; - } - - /* mulh, mulhsu and mulhu are not available if C_USE_HW_MUL is < 2. */ - if (subcode >= 1 && subcode <= 3 && dc->cpu->cfg.use_hw_mul < 2) { - /* nop??? */ - } - - tmp = tcg_temp_new_i32(); - switch (subcode) { - case 0: - tcg_gen_mul_i32(cpu_R[dc->rd], cpu_R[dc->ra], cpu_R[dc->rb]); - break; - case 1: - tcg_gen_muls2_i32(tmp, cpu_R[dc->rd], - cpu_R[dc->ra], cpu_R[dc->rb]); - break; - case 2: - tcg_gen_mulsu2_i32(tmp, cpu_R[dc->rd], - cpu_R[dc->ra], cpu_R[dc->rb]); - break; - case 3: - tcg_gen_mulu2_i32(tmp, cpu_R[dc->rd], cpu_R[dc->ra], cpu_R[dc->rb]); - break; - default: - cpu_abort(CPU(dc->cpu), "unknown MUL insn %x\n", subcode); - break; - } - tcg_temp_free_i32(tmp); -} - /* Div unit. */ static void dec_div(DisasContext *dc) { @@ -1579,7 +1565,6 @@ static struct decoder_info { {DEC_BCC, dec_bcc}, {DEC_RTS, dec_rts}, {DEC_FPU, dec_fpu}, - {DEC_MUL, dec_mul}, {DEC_DIV, dec_div}, {DEC_MSR, dec_msr}, {DEC_STREAM, dec_stream},