From patchwork Mon Aug 31 16:05:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 248816 Delivered-To: patch@linaro.org Received: by 2002:a92:5b9c:0:0:0:0:0 with SMTP id c28csp3462643ilg; Mon, 31 Aug 2020 09:35:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw0lyC757hnA5YI9GHDW46pCGEb/nNIT+/XdBAKJ2ykNATrRHlt+Ufh9NEMecUTXfPQMNZm X-Received: by 2002:a25:ba4f:: with SMTP id z15mr3470894ybj.171.1598891727908; Mon, 31 Aug 2020 09:35:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598891727; cv=none; d=google.com; s=arc-20160816; b=k5lD+gatK4TZRNDV6CKQ+dEKCCJLuJnlFJId0XCXfcETzwBlA8xCf6YKAcNHZsVz95 YzKsQ7qafb49zkEbzXl9zK1TIJITth/5ds+hAy10sAO1oskdgGIMHyAwfpSrgK/oYtoS NvJoGC04CDOhNMHDeUaULZBIYWMN8fJqzG4in06pdDUH1kxGfp8on0N8M2jrwGenZqsJ BzhOW4YmQhYm+Wx3PZyRou+0Oct8uzUcfefe/z78/2YIK+TRBDcOL62rosSJsu2lbR5W P7nGuSLsgAk9n3/GNTFSIuxCa5dkeC/lCHC+Us6PrcC1d+wVdbGrab6UyPVaVD5VTbLo QfEw== 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=C3as3kqyszotGpdBkj2bOoUSS0AWrFxb8GKuwRxYQYE=; b=wj6Ryojz1zTP3cdq8gPNkpQBvmzo6sWyrYkZH69olwuAkC4e5vuOEyMAWDpR/nGDbe zNMGd7y7ndthtDMInrnhtkDYorf19krjq+FKw6DRo8W5uxSq2P3MFBPFF7SoCxfUm8G4 TJZICXJ2OJTStnc956PhPxbSB/O9SYKNJI9T+YEHlRj8t8scd6Tmb4DSjYUTEJIYzHme jGKa4TFEAEIqlwcLJNWssXhNHbyc3H3rIkTGHZC8WlMw8cLjI6s1QLx13AO+UMc+/9P4 JACIOcMu4Lnepqo4k0Tob0YTGdZcTaIIrZDghmXN3i0C/t3NxCauxRPioEhRqvbjbDmG TL8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=mT8X+1VN; 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 a5si5214974ybn.107.2020.08.31.09.35.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 31 Aug 2020 09:35:27 -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=mT8X+1VN; 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]:58622 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kCmmF-0004nZ-Cs for patch@linaro.org; Mon, 31 Aug 2020 12:35:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34826) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kCmLR-0006o9-0w for qemu-devel@nongnu.org; Mon, 31 Aug 2020 12:07:45 -0400 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]:40976) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kCmLO-0006BE-Eb for qemu-devel@nongnu.org; Mon, 31 Aug 2020 12:07:44 -0400 Received: by mail-pf1-x42b.google.com with SMTP id t9so806719pfq.8 for ; Mon, 31 Aug 2020 09:07:41 -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=C3as3kqyszotGpdBkj2bOoUSS0AWrFxb8GKuwRxYQYE=; b=mT8X+1VN1HgSi0mpV3XkzeuIp/VDAYCP6lNT1rQ/W11XO/Z4RP8STF/UcB4vuJkZOc 3oxvXgTi5V8eeAaw/cr7eJ6Phu7W6wJO19UeFZr/fHMCcyIJms5xQgncKslqSGUHjrMh R2UNoatuKOl8mbPLrBLENqftWbexoLb4Fi04r6vy9PKUOCGPCqtSsBHeeQ3nL9gHPngX jorzeQ6yR+uSdoVazaEnwph0zxrGe5OO5PYJEsGc5Uu4ARrcJmLne6puMkMhoHfwOVOp 8FeQtvsCE+xwQ2ougaXLqo1TJIj6FyekJHFpkuVtz9zMl6aIQaS3UfMEwLTafzFTAyvc 12aw== 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=C3as3kqyszotGpdBkj2bOoUSS0AWrFxb8GKuwRxYQYE=; b=gGp/8qScSyKKdhSRAvpJAwfBu0mtnBNurt+V28KGAkYYUG9S9SKrhzfge8MTs0V9RE RyWOFgtQ2i7aunlRTP41l9zWS9Xk17Za7OBQJUws8HnUNjWlFpSOpzA6MCaAFo4m3PfZ lsbZNinY3/SNVSY++HGSG4g0Gp5uverw0seHPi9hEuo7mhjdIikcrAyGVEui/emZGOYC 6MnuIYkX0fpSQCjN8IL1svwOlWQjixXBVeQ8HzV7wTxJvJdntr5yQqwM2zrZhO2ney6h Jc0/R65n9VRyI+1q9Imc+JS6Fu0hhabEYRcicpaCPAEbm53TtNs6PvuZiBTHdzf4D2KI qgPw== X-Gm-Message-State: AOAM530e/KjU6lOKTCb8wbFr29aXVR04Bj2KKx3gGiRHVpMaiXXIlFzr m+9aTLy0wjUo+prsSbG+PRSQihfZua/5cg== X-Received: by 2002:a62:c5c6:: with SMTP id j189mr1861039pfg.145.1598890060751; Mon, 31 Aug 2020 09:07:40 -0700 (PDT) Received: from localhost.localdomain ([71.212.141.89]) by smtp.gmail.com with ESMTPSA id gt13sm17218pjb.43.2020.08.31.09.07.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Aug 2020 09:07:39 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 72/76] target/microblaze: Convert dec_stream to decodetree Date: Mon, 31 Aug 2020 09:05:57 -0700 Message-Id: <20200831160601.833692-73-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::42b; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42b.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 | 64 ++++++++++++++++++++++++++-------- 2 files changed, 55 insertions(+), 15 deletions(-) -- 2.25.1 diff --git a/target/microblaze/insns.decode b/target/microblaze/insns.decode index 43c9e16819..fb0f0e6838 100644 --- a/target/microblaze/insns.decode +++ b/target/microblaze/insns.decode @@ -159,6 +159,9 @@ flt 010110 ..... ..... ----- 0101 000 0000 @typea0 fint 010110 ..... ..... ----- 0110 000 0000 @typea0 fsqrt 010110 ..... ..... 00000 0111 000 0000 @typea0 +get 011011 rd:5 00000 0 ctrl:5 000000 imm:4 +getd 010011 rd:5 00000 rb:5 0 ctrl:5 00000 + idiv 010010 ..... ..... ..... 000 0000 0000 @typea idivu 010010 ..... ..... ..... 000 0000 0010 @typea @@ -201,6 +204,9 @@ pcmpbf 100000 ..... ..... ..... 100 0000 0000 @typea pcmpeq 100010 ..... ..... ..... 100 0000 0000 @typea pcmpne 100011 ..... ..... ..... 100 0000 0000 @typea +put 011011 00000 ra:5 1 ctrl:5 000000 imm:4 +putd 010011 00000 ra:5 rb:5 1 ctrl:5 00000 + rsub 000001 ..... ..... ..... 000 0000 0000 @typea rsubc 000011 ..... ..... ..... 000 0000 0000 @typea rsubk 000101 ..... ..... ..... 000 0000 0000 @typea diff --git a/target/microblaze/translate.c b/target/microblaze/translate.c index 582f5a1577..2c87d671ae 100644 --- a/target/microblaze/translate.c +++ b/target/microblaze/translate.c @@ -1560,33 +1560,68 @@ static void dec_null(DisasContext *dc) } /* Insns connected to FSL or AXI stream attached devices. */ -static void dec_stream(DisasContext *dc) +static bool do_get(DisasContext *dc, int rd, int rb, int imm, int ctrl) { TCGv_i32 t_id, t_ctrl; - int ctrl; if (trap_userspace(dc, true)) { - return; + return true; } t_id = tcg_temp_new_i32(); - if (dc->type_b) { - tcg_gen_movi_i32(t_id, dc->imm & 0xf); - ctrl = dc->imm >> 10; + if (rb) { + tcg_gen_andi_i32(t_id, cpu_R[rb], 0xf); } else { - tcg_gen_andi_i32(t_id, cpu_R[dc->rb], 0xf); - ctrl = dc->imm >> 5; + tcg_gen_movi_i32(t_id, imm); } t_ctrl = tcg_const_i32(ctrl); - - if (dc->rd == 0) { - gen_helper_put(t_id, t_ctrl, cpu_R[dc->ra]); - } else { - gen_helper_get(cpu_R[dc->rd], t_id, t_ctrl); - } + gen_helper_get(reg_for_write(dc, rd), t_id, t_ctrl); tcg_temp_free_i32(t_id); tcg_temp_free_i32(t_ctrl); + return true; +} + +static bool trans_get(DisasContext *dc, arg_get *arg) +{ + return do_get(dc, arg->rd, 0, arg->imm, arg->ctrl); +} + +static bool trans_getd(DisasContext *dc, arg_getd *arg) +{ + return do_get(dc, arg->rd, arg->rb, 0, arg->ctrl); +} + +static bool do_put(DisasContext *dc, int ra, int rb, int imm, int ctrl) +{ + TCGv_i32 t_id, t_ctrl; + + if (trap_userspace(dc, true)) { + return true; + } + + t_id = tcg_temp_new_i32(); + if (rb) { + tcg_gen_andi_i32(t_id, cpu_R[rb], 0xf); + } else { + tcg_gen_movi_i32(t_id, imm); + } + + t_ctrl = tcg_const_i32(ctrl); + gen_helper_put(t_id, t_ctrl, reg_for_read(dc, ra)); + tcg_temp_free_i32(t_id); + tcg_temp_free_i32(t_ctrl); + return true; +} + +static bool trans_put(DisasContext *dc, arg_put *arg) +{ + return do_put(dc, arg->ra, 0, arg->imm, arg->ctrl); +} + +static bool trans_putd(DisasContext *dc, arg_putd *arg) +{ + return do_put(dc, arg->ra, arg->rb, 0, arg->ctrl); } static struct decoder_info { @@ -1596,7 +1631,6 @@ static struct decoder_info { }; void (*dec)(DisasContext *dc); } decinfo[] = { - {DEC_STREAM, dec_stream}, {{0, 0}, dec_null} };