From patchwork Mon Aug 31 16:05:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 248784 Delivered-To: patch@linaro.org Received: by 2002:a92:5b9c:0:0:0:0:0 with SMTP id c28csp3452452ilg; Mon, 31 Aug 2020 09:21:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxwgjgHaU9YoS/E2R14KQVFEAZZUqcQ5o12b6RJrX4Lb7dU3Dp3D8dHCGfJcS2gNORsw5hr X-Received: by 2002:a25:c7cd:: with SMTP id w196mr3024816ybe.351.1598890896435; Mon, 31 Aug 2020 09:21:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598890896; cv=none; d=google.com; s=arc-20160816; b=SLxTFp3/HN0XFFjO+kqxugHzHjlvEB9azid2pTIH8xwQ3PU5X6c1yowEsK6r/tcE9Q uk7VtkLTy4+9ualVzJJ/cgL5k4QjO3yuoesWinaTybw/NXCq2QPYs2+vUesEL2j8dAct Hx55mBaVS5Ba4M/nohO+LqkYkJ3vmzhEk33Xa5KVjbTgVyNND/DUko+bScpo8/kC9T+D t5ppO+ySusP+VsMhd9mgWkHj0JVnle7eVZ0cRd6rK/Q3sZDNJokfak/BR5M0aGAjlAcN trdQTWnZMK6/TV5zELbtLdUX0l7z6ReeOvtfC71rrY+BMngokuF+aIgWnOj/aQtL4VjG LblQ== 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=McrdZ6KxrFqHOEaBx6VbvyuikujwerCjRA8qh9K2y7E=; b=W/7FKSlhYFW4FC3CukaBQaq3rCUJJIssweoXOUMp563K36rjXAjxKvzqhkpml6GZ3B tP1dF3bjl51dXKyTUuQchY/iQ4rFEFAV4fuOodO9glv14RTzeESD41qI1vV5+FObMH4T T6eUCoQFnCACXhkaRbqo4VwWlZaiUQtoxZssivjXc273RKDFrZ80x6YYIPt8pth6Exuf Xn1FF0KkiLh35G2yU3vluVE9semx+vIF5I+2Bttyi5ho81QxWRVP3rpFaQ4+1aTJDXve wM36xsIvTVDCkA3XoVK1dMDOgmX0lqY0P46LIM5uh/vutAfsWDzf4YcC4YRqLlaXxhyt 9XHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=F5SxQKa3; 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 l14si11136281ybt.321.2020.08.31.09.21.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 31 Aug 2020 09:21:36 -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=F5SxQKa3; 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]:40454 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kCmYp-0008M2-S7 for patch@linaro.org; Mon, 31 Aug 2020 12:21:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34180) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kCmKi-00057x-MT for qemu-devel@nongnu.org; Mon, 31 Aug 2020 12:07:00 -0400 Received: from mail-pj1-x1036.google.com ([2607:f8b0:4864:20::1036]:33657) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kCmKg-00063B-MV for qemu-devel@nongnu.org; Mon, 31 Aug 2020 12:07:00 -0400 Received: by mail-pj1-x1036.google.com with SMTP id np15so179831pjb.0 for ; Mon, 31 Aug 2020 09:06:58 -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=McrdZ6KxrFqHOEaBx6VbvyuikujwerCjRA8qh9K2y7E=; b=F5SxQKa3n5qWf1xi6KVvx9P+wP+PGUXBYVzAuXLfprr99h96NeCnLlZFQLZR7mQEwy nFdT8cbQGq7wyUTSBbHWlwKSn+fdQw6hw/62NZDU2sGXHWkY0Ekd+EHSWz/HqHMDYuUI cfaApwf3iEXF0k4NNP0fmFIbSTF82LABLAmMRGlNY2/DGuHdwHxC4ojm1L2RU48Km6lc wt122SXyatOmg7I380v6Pp1cRE7SQclvF5zdi7IgR7MjTgDktHKkP9GVD5HddQ9x92Nn 2K5c3AQhwBn7pwaaj0VH+lXWXoVmq1zHkK1LwxwdwBNz/b7Z7fHPQ1DoX5svMYUtysNm QMMA== 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=McrdZ6KxrFqHOEaBx6VbvyuikujwerCjRA8qh9K2y7E=; b=uiTRhs288Sqkz1r4qZWOolApJmsh2KcjYKhYuRxi3DeS4o4xKOkT6Nk4qvY/D5/srv zi5xLqABuExur4MWEkfebb1ryQvCY2N8DjoDXOIEfoPjQUIGj8PQwqD77H/ztqz3COjv H46T84ZTPOQYyiq0V8KgY3Q+E7xQTyy0+qj797XT3q5p+DSM0A1yTWiYb16h1v0wDaOa /6iax4soCDAyvy8lDqp+sKb3jlnezjpLJuQIYbghDzbfKWBuBIIyHi1LF9KUhr1+adtp XdH0BbxxB4MBnLF8YfnmRkBalF5JBc4KsiJzUKPhUK70L0Q0P5Yl+sgOKodE0b5PQ/wy SAyQ== X-Gm-Message-State: AOAM532KJO58oFiLDhjyBCcvnWiVvYL7s6HZJy5i+4DoU5ng0bMZzGBP jYD4bO/qM53bhhZ47hWHHlOftHowePJBGg== X-Received: by 2002:a17:90b:2388:: with SMTP id mr8mr62823pjb.161.1598890016919; Mon, 31 Aug 2020 09:06:56 -0700 (PDT) Received: from localhost.localdomain ([71.212.141.89]) by smtp.gmail.com with ESMTPSA id gt13sm17218pjb.43.2020.08.31.09.06.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Aug 2020 09:06:56 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 39/76] target/microblaze: Convert dec_pattern to decodetree Date: Mon, 31 Aug 2020 09:05:24 -0700 Message-Id: <20200831160601.833692-40-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::1036; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1036.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 | 4 ++ target/microblaze/translate.c | 67 +++++++++------------------------- 2 files changed, 22 insertions(+), 49 deletions(-) -- 2.25.1 diff --git a/target/microblaze/insns.decode b/target/microblaze/insns.decode index a611cc83a7..16519f05dc 100644 --- a/target/microblaze/insns.decode +++ b/target/microblaze/insns.decode @@ -44,6 +44,10 @@ addikc 001110 ..... ..... ................ @typeb cmp 000101 ..... ..... ..... 000 0000 0001 @typea cmpu 000101 ..... ..... ..... 000 0000 0011 @typea +pcmpbf 100000 ..... ..... ..... 100 0000 0000 @typea +pcmpeq 100010 ..... ..... ..... 100 0000 0000 @typea +pcmpne 100011 ..... ..... ..... 100 0000 0000 @typea + 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 8da477457d..7ebf0e1e7d 100644 --- a/target/microblaze/translate.c +++ b/target/microblaze/translate.c @@ -279,6 +279,10 @@ static bool do_typeb_val(DisasContext *dc, arg_typeb *arg, bool side_effects, static bool trans_##NAME(DisasContext *dc, arg_typea *a) \ { return do_typea(dc, a, SE, FN); } +#define DO_TYPEA_CFG(NAME, CFG, SE, FN) \ + static bool trans_##NAME(DisasContext *dc, arg_typea *a) \ + { return dc->cpu->cfg.CFG && do_typea(dc, a, SE, FN); } + #define DO_TYPEBI(NAME, SE, FNI) \ static bool trans_##NAME(DisasContext *dc, arg_typeb *a) \ { return do_typeb_imm(dc, a, SE, FNI); } @@ -350,6 +354,20 @@ 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_pcmpeq(TCGv_i32 out, TCGv_i32 ina, TCGv_i32 inb) +{ + tcg_gen_setcond_i32(TCG_COND_EQ, out, ina, inb); +} + +static void gen_pcmpne(TCGv_i32 out, TCGv_i32 ina, TCGv_i32 inb) +{ + tcg_gen_setcond_i32(TCG_COND_NE, out, ina, inb); +} + +DO_TYPEA_CFG(pcmpbf, use_pcmp_instr, false, gen_helper_pcmpbf) +DO_TYPEA_CFG(pcmpeq, use_pcmp_instr, false, gen_pcmpeq) +DO_TYPEA_CFG(pcmpne, use_pcmp_instr, false, gen_pcmpne) + /* No input carry, but output carry. */ static void gen_rsub(TCGv_i32 out, TCGv_i32 ina, TCGv_i32 inb) { @@ -413,49 +431,10 @@ static bool trans_zero(DisasContext *dc, arg_zero *arg) return false; } -static void dec_pattern(DisasContext *dc) -{ - unsigned int mode; - - if (trap_illegal(dc, !dc->cpu->cfg.use_pcmp_instr)) { - return; - } - - mode = dc->opcode & 3; - switch (mode) { - case 0: - /* pcmpbf. */ - if (dc->rd) - gen_helper_pcmpbf(cpu_R[dc->rd], cpu_R[dc->ra], cpu_R[dc->rb]); - break; - case 2: - if (dc->rd) { - tcg_gen_setcond_i32(TCG_COND_EQ, cpu_R[dc->rd], - cpu_R[dc->ra], cpu_R[dc->rb]); - } - break; - case 3: - if (dc->rd) { - tcg_gen_setcond_i32(TCG_COND_NE, cpu_R[dc->rd], - cpu_R[dc->ra], cpu_R[dc->rb]); - } - break; - default: - cpu_abort(CPU(dc->cpu), - "unsupported pattern insn opcode=%x\n", dc->opcode); - break; - } -} - static void dec_and(DisasContext *dc) { unsigned int not; - if (!dc->type_b && (dc->imm & (1 << 10))) { - dec_pattern(dc); - return; - } - not = dc->opcode & (1 << 1); if (!dc->rd) @@ -469,22 +448,12 @@ static void dec_and(DisasContext *dc) static void dec_or(DisasContext *dc) { - if (!dc->type_b && (dc->imm & (1 << 10))) { - dec_pattern(dc); - return; - } - if (dc->rd) tcg_gen_or_i32(cpu_R[dc->rd], cpu_R[dc->ra], *(dec_alu_op_b(dc))); } static void dec_xor(DisasContext *dc) { - if (!dc->type_b && (dc->imm & (1 << 10))) { - dec_pattern(dc); - return; - } - if (dc->rd) tcg_gen_xor_i32(cpu_R[dc->rd], cpu_R[dc->ra], *(dec_alu_op_b(dc))); }