From patchwork Thu Feb 7 11:53:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 157712 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp551275jaa; Thu, 7 Feb 2019 03:55:35 -0800 (PST) X-Google-Smtp-Source: AHgI3IaYHmmjlimPHi3iYPfjd2QKaUcJPyq0fJyJ4h6UhI2Pa/swWf1LgRrfHqcKdXdWDebBfYdX X-Received: by 2002:a5d:614c:: with SMTP id y12mr9723320wrt.106.1549540534929; Thu, 07 Feb 2019 03:55:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549540534; cv=none; d=google.com; s=arc-20160816; b=u+dIAQMPMCLagPmG9fHQ+V7Kk+MMaKDkKh4sW8XYUnJgMDHzV67HjfrxekfhpAFiGT nPDQrbqxGYO9m9pKs19J7RC636LGGYsR9VeuOPvgIn4MsDHf6fW4mrHzs1fb5Gv+GiAo bUmY2Vi5n3zMYb1AKban+txL3IwUEdFFhK0/5fdyjEGgfu6vAxj/sHK8l6uqdZ6K1ngW 4i274uQGKMF+sUldwxWQnxpqJ2HJUz9j0KiHzi59m5EGwpdsFzQhlLKYw7o4Eqfvj1+9 XDDAEBfr9Z0GbvppEFLUdkYGU7hk8QkinhpEfXaCIw0D9TLRqZSv4WOHQ6Ly/7wPbNj2 YG3g== 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:subject:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=a7A9JHzFz+k2ObzwXU3JQvBwVEI9BlyynE0BG5Df/vs=; b=u/d/7VFi/KESZZYB2CS+boc3Eios08JYF+TATCnuBaJ/+F1qb3YpHWV8aba/H2lkYQ 7S6i8eqGairs/rVv9hU3JBYGGlSEyr4ABZL2+y2VD/lSsqngbNFyAPIYBKbQZCqhdk3x K2Q6qgOkyW86475Q6luu4st6KznI/1IDrBB3A++D2YC7s5N5VJ0LvN2mMTYZCacTqFZ7 HinRXD2BU9XEWrJTNW05Uuova8NGuLEMJ3Ebcu2A3Dx3AUJvJAtYxU+UdOId1x6Zlszn vk45EfmkuHsPGPfwPLTAoFTNRU2AhAcKaH+n/nC2KXpXqaW7udqrelIVKPDC5wZD3ZDp eg9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=OiQkXe7C; 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 f10si17593192wrq.38.2019.02.07.03.55.28 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 07 Feb 2019 03:55:34 -0800 (PST) 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=OiQkXe7C; 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 ([127.0.0.1]:38404 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1griH9-00086b-AA for patch@linaro.org; Thu, 07 Feb 2019 06:55:27 -0500 Received: from eggs.gnu.org ([209.51.188.92]:58180) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1griFw-0007CN-Kk for qemu-devel@nongnu.org; Thu, 07 Feb 2019 06:54:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1griFv-0001Ph-Ls for qemu-devel@nongnu.org; Thu, 07 Feb 2019 06:54:12 -0500 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:45587) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1griFv-0001P8-FY for qemu-devel@nongnu.org; Thu, 07 Feb 2019 06:54:11 -0500 Received: by mail-wr1-x442.google.com with SMTP id q15so11164507wro.12 for ; Thu, 07 Feb 2019 03:54:11 -0800 (PST) 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; bh=a7A9JHzFz+k2ObzwXU3JQvBwVEI9BlyynE0BG5Df/vs=; b=OiQkXe7CxprRBuFBUvJ8WHFIo67P0M31XblXkh8umr9eN+h3JECtFK04XCq2LZabEU Dr3d3dOfwk3spzHoOwVl80ywrHOvExryYlsFF1lnAOSphFBTeRjV0IpwZdJ33EPGHq2i GZTV+o92L5BM2SlFxmM/COSbOQnhO1lfkhfabQSAl8KpwHWHFkLYQMBZE0oIT8CbZk6C KUxT0YR1FzQYc6Ood4OX3dQp/9110i7+rRTdkFNBSJ4cEE2OoZplgomlcwCL+oM24jEh n0Xf6vjLm3q4FXwFqEpfB1iWwp69PZ1MAPEGALks0hDLFl7QALLv2MJVtm8CKuUZLGlP H1YA== 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; bh=a7A9JHzFz+k2ObzwXU3JQvBwVEI9BlyynE0BG5Df/vs=; b=JolFRgLq1A5IVYefndRqg0xRM2D3+jzI8TiQeONbXTU6Nq8mANLhcu5MyzVBiVTiMq 5VjfLtadaPh34GYJBPn6k8y8Qm7GmWPaHLX9P1rkDDdyzpE84TR3SOb/eIr9SViedD32 i9FXegoMVt16VuvizT6CikNLrwG7DF3+QK6UtsCFAvq9ehjr0CmDrP9MiWhqJ458m9eM QpI0KWFqyxZF5MlR2Qk67sfUzrRUaJkxY9Y3kXHnKxwG5WCybN2EQ4ynqGIG9mJRmzmm TxcQy7Xjd7i1rBMP2lQF08SJM/FGxm3r6+SgkdfmTZWjaDA5wEynjYbhlvG11SjibSaC 3YdA== X-Gm-Message-State: AHQUAuYfZtnZH1g1mLvZIC0UmIJCgBh1VCYKspcPW5tQekot8E8hShQw 6TnBP4QyTUrHBcRvRg1QV0iTbWVTendJhg== X-Received: by 2002:adf:f401:: with SMTP id g1mr12304931wro.103.1549540450121; Thu, 07 Feb 2019 03:54:10 -0800 (PST) Received: from cloudburst.twiddle.net ([37.205.61.206]) by smtp.gmail.com with ESMTPSA id w16sm34030016wrp.1.2019.02.07.03.54.08 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 07 Feb 2019 03:54:08 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 7 Feb 2019 11:53:46 +0000 Message-Id: <20190207115400.647-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190207115400.647-1-richard.henderson@linaro.org> References: <20190207115400.647-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::442 Subject: [Qemu-devel] [PATCH 05/19] target/hppa: Unify specializations of OR X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: deller@gmx.de, svens@stackframe.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" With decodetree.py, the specializations would conflict so we must have a single entry point for all variants of OR. Signed-off-by: Richard Henderson --- target/hppa/translate.c | 108 ++++++++++++++++++++++------------------ 1 file changed, 59 insertions(+), 49 deletions(-) -- 2.17.2 diff --git a/target/hppa/translate.c b/target/hppa/translate.c index 2ca0f5da10..6c2f560fc1 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -2622,21 +2622,69 @@ static bool trans_log(DisasContext *ctx, uint32_t insn, const DisasInsn *di) return nullify_end(ctx); } -/* OR r,0,t -> COPY (according to gas) */ -static bool trans_copy(DisasContext *ctx, uint32_t insn, const DisasInsn *di) +static bool trans_or(DisasContext *ctx, uint32_t insn, const DisasInsn *di) { + unsigned r2 = extract32(insn, 21, 5); unsigned r1 = extract32(insn, 16, 5); + unsigned cf = extract32(insn, 12, 4); unsigned rt = extract32(insn, 0, 5); + TCGv_reg tcg_r1, tcg_r2; - if (r1 == 0) { - TCGv_reg dest = dest_gpr(ctx, rt); - tcg_gen_movi_reg(dest, 0); - save_gpr(ctx, rt, dest); - } else { - save_gpr(ctx, rt, cpu_gr[r1]); + if (cf == 0) { + if (rt == 0) { /* NOP */ + cond_free(&ctx->null_cond); + return true; + } + if (r2 == 0) { /* COPY */ + if (r1 == 0) { + TCGv_reg dest = dest_gpr(ctx, rt); + tcg_gen_movi_reg(dest, 0); + save_gpr(ctx, rt, dest); + } else { + save_gpr(ctx, rt, cpu_gr[r1]); + } + cond_free(&ctx->null_cond); + return true; + } +#ifndef CONFIG_USER_ONLY + /* These are QEMU extensions and are nops in the real architecture: + * + * or %r10,%r10,%r10 -- idle loop; wait for interrupt + * or %r31,%r31,%r31 -- death loop; offline cpu + * currently implemented as idle. + */ + if ((rt == 10 || rt == 31) && r1 == rt && r2 == rt) { /* PAUSE */ + TCGv_i32 tmp; + + /* No need to check for supervisor, as userland can only pause + until the next timer interrupt. */ + nullify_over(ctx); + + /* Advance the instruction queue. */ + copy_iaoq_entry(cpu_iaoq_f, ctx->iaoq_b, cpu_iaoq_b); + copy_iaoq_entry(cpu_iaoq_b, ctx->iaoq_n, ctx->iaoq_n_var); + nullify_set(ctx, 0); + + /* Tell the qemu main loop to halt until this cpu has work. */ + tmp = tcg_const_i32(1); + tcg_gen_st_i32(tmp, cpu_env, -offsetof(HPPACPU, env) + + offsetof(CPUState, halted)); + tcg_temp_free_i32(tmp); + gen_excp_1(EXCP_HALTED); + ctx->base.is_jmp = DISAS_NORETURN; + + return nullify_end(ctx); + } +#endif } - cond_free(&ctx->null_cond); - return true; + + if (cf) { + nullify_over(ctx); + } + tcg_r1 = load_gpr(ctx, r1); + tcg_r2 = load_gpr(ctx, r2); + do_log(ctx, rt, tcg_r1, tcg_r2, cf, tcg_gen_or_reg); + return nullify_end(ctx); } static bool trans_cmpclr(DisasContext *ctx, uint32_t insn, const DisasInsn *di) @@ -2781,48 +2829,10 @@ static bool trans_ds(DisasContext *ctx, uint32_t insn, const DisasInsn *di) return nullify_end(ctx); } -#ifndef CONFIG_USER_ONLY -/* These are QEMU extensions and are nops in the real architecture: - * - * or %r10,%r10,%r10 -- idle loop; wait for interrupt - * or %r31,%r31,%r31 -- death loop; offline cpu - * currently implemented as idle. - */ -static bool trans_pause(DisasContext *ctx, uint32_t insn, const DisasInsn *di) -{ - TCGv_i32 tmp; - - /* No need to check for supervisor, as userland can only pause - until the next timer interrupt. */ - nullify_over(ctx); - - /* Advance the instruction queue. */ - copy_iaoq_entry(cpu_iaoq_f, ctx->iaoq_b, cpu_iaoq_b); - copy_iaoq_entry(cpu_iaoq_b, ctx->iaoq_n, ctx->iaoq_n_var); - nullify_set(ctx, 0); - - /* Tell the qemu main loop to halt until this cpu has work. */ - tmp = tcg_const_i32(1); - tcg_gen_st_i32(tmp, cpu_env, -offsetof(HPPACPU, env) + - offsetof(CPUState, halted)); - tcg_temp_free_i32(tmp); - gen_excp_1(EXCP_HALTED); - ctx->base.is_jmp = DISAS_NORETURN; - - return nullify_end(ctx); -} -#endif - static const DisasInsn table_arith_log[] = { - { 0x08000240u, 0xfc00ffffu, trans_nop }, /* or x,y,0 */ - { 0x08000240u, 0xffe0ffe0u, trans_copy }, /* or x,0,t */ -#ifndef CONFIG_USER_ONLY - { 0x094a024au, 0xffffffffu, trans_pause }, /* or r10,r10,r10 */ - { 0x0bff025fu, 0xffffffffu, trans_pause }, /* or r31,r31,r31 */ -#endif + { 0x08000240u, 0xfc000fe0u, trans_or }, { 0x08000000u, 0xfc000fe0u, trans_log, .f.ttt = tcg_gen_andc_reg }, { 0x08000200u, 0xfc000fe0u, trans_log, .f.ttt = tcg_gen_and_reg }, - { 0x08000240u, 0xfc000fe0u, trans_log, .f.ttt = tcg_gen_or_reg }, { 0x08000280u, 0xfc000fe0u, trans_log, .f.ttt = tcg_gen_xor_reg }, { 0x08000880u, 0xfc000fe0u, trans_cmpclr }, { 0x08000380u, 0xfc000fe0u, trans_uxor },