From patchwork Sat Feb 17 20:31:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 128744 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp1899364ljc; Sat, 17 Feb 2018 12:35:06 -0800 (PST) X-Google-Smtp-Source: AH8x225YtcB/On63LzfNuKYj2zKdSF9FnX3h/nVdxTTfGJj0vV6XXPa9Nvs1yTHqL1w+MTBACMwA X-Received: by 10.37.185.74 with SMTP id s10mr7474477ybm.207.1518899706558; Sat, 17 Feb 2018 12:35:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518899706; cv=none; d=google.com; s=arc-20160816; b=TLPcto3b2pbrY24/X+yZvLlOUvRQmkSldIijY7IHo5gb2kZvMmI7iILh+ycJEOQdGw lC4DMb9eSrZNgEgoI49JIS7md5Y+pMzx+IMuasN0/T1ppO3H5H0yy/37ePlzGORPFdZG NbukbrFMlWcIIAm8G2Fvtek74M9/fcGLob7tAaB69R5HDJIPHoBMqx0j4Mr9UzsT5AUF ucZC1iKjNolc2MAH5U8tNCmg0HfL30uDFhkzmLSwYpnhf+mQWdkXCb92ieeJ/mVZQk5J oROfwc2YVtWH8d2MORrzhNh5PGHywi8EDtyLbDT1TkFI5e94Fk+Vd94tMUykoONdcLPo Q34w== 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:subject:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=V1qVkdGwJ5uAH1cHcFxDoh8H2nBzLR04ryVwSIkfqj4=; b=uuvaaHvp/k+MjvRPIEQtjqXqBEmECBP1agivYYB6aNUue93pGg6QyiuKoz0tDQvs6i hnzTj1QmlzM8cF9bRcfgIQQWDJGXxxFR7sR4mn+h7djMy0Jkq+gFAoPpFQcOEqjWpAH4 RLj9rJWyQdGc+X0dRws22UTAmvj9cyvzfnLdwwaD+nFYREOKnFjku0zg1rAmLabBgi5q KoJ6yvh2BnyM+4ILw3uenA7eevRiuAihQgub4C4Hlsfoh4mzCOvXO3OdKDPEn9aJLCGV LzW3B0dJ5y8jf7NyKbUL4EcAR0drJT3ku8IIxIMkl+sPO2mNJtnvQGa1gLEOsMQ+hT8C jNIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=U6zgbSBL; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 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. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id w124si3148646ywf.310.2018.02.17.12.35.06 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sat, 17 Feb 2018 12:35:06 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=U6zgbSBL; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 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]:60383 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1en9CM-0002a0-0O for patch@linaro.org; Sat, 17 Feb 2018 15:35:06 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41903) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1en999-0008St-4q for qemu-devel@nongnu.org; Sat, 17 Feb 2018 15:31:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1en998-0000l3-1V for qemu-devel@nongnu.org; Sat, 17 Feb 2018 15:31:47 -0500 Received: from mail-pf0-x241.google.com ([2607:f8b0:400e:c00::241]:38817) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1en997-0000kw-PZ for qemu-devel@nongnu.org; Sat, 17 Feb 2018 15:31:45 -0500 Received: by mail-pf0-x241.google.com with SMTP id i3so659255pfe.5 for ; Sat, 17 Feb 2018 12:31:45 -0800 (PST) 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; bh=V1qVkdGwJ5uAH1cHcFxDoh8H2nBzLR04ryVwSIkfqj4=; b=U6zgbSBLHBiOfazNdY+8gPF9Pm6qCUX14QfN/OKNwspGOJfmCm3kDlCRA5o6Lxd7Le 8NoRUatLTGmSYhTlM/g8eHUyu5nlNYXdnsh37kVri0ENEwHOIPxY/hCivmLLy7k8jEOD J374A+sX+1zN0FliW5+bjdlFnltp0Cu4A21j8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=V1qVkdGwJ5uAH1cHcFxDoh8H2nBzLR04ryVwSIkfqj4=; b=eYGpKj8Ep9QQJL50944PlhdJvgszcAnrjSl/jJy41YDa2o5ZZwwWWwuoHJvsW9q64R 1Yd1sCEMHCgyO84JKBG+/hbRcscdPa32eAKaFy2zg5q4KOtXV1VG2yyQDRUfV55Hkd9/ xr6dAuUDQK1XWtxvh61moqgBNO5tt6JRvd2NRj1GzFFWHimRB8cuZrLHPx/Wcw9zxlwZ BgnQpPrpTXrVbThxysowkaL3BikdCmh7gztKSLE9wvidI756bkyPvfgzFtCFisny1WRb xaB6hQ2F6e4zDiLkO0Ngtf+R4Kjxx89kqZGc8gnq6QNq2hpJg7Ao31bi7DppPhEOkncd sIEw== X-Gm-Message-State: APf1xPCfkZLP6KuweJ8eL7lL8FJ7DXtL8VaX8Hcz2nNFhYBnB0C7G1dN M62zcNWahmuHfs24yaTXf2Hkr0MXp7I= X-Received: by 10.101.71.141 with SMTP id e13mr8371387pgs.438.1518899504363; Sat, 17 Feb 2018 12:31:44 -0800 (PST) Received: from cloudburst.twiddle.net ([50.0.192.64]) by smtp.gmail.com with ESMTPSA id y7sm48203797pfe.26.2018.02.17.12.31.43 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 17 Feb 2018 12:31:43 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sat, 17 Feb 2018 12:31:18 -0800 Message-Id: <20180217203132.31780-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180217203132.31780-1-richard.henderson@linaro.org> References: <20180217203132.31780-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c00::241 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: , 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, 60 insertions(+), 48 deletions(-) -- 2.14.3 Reviewed-by: Bastian Koppelmann diff --git a/target/hppa/translate.c b/target/hppa/translate.c index ae5969be0b..074234b1e0 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -2634,20 +2634,70 @@ static void trans_log(DisasContext *ctx, uint32_t insn, const DisasInsn *di) nullify_end(ctx); } -/* OR r,0,t -> COPY (according to gas) */ -static void trans_copy(DisasContext *ctx, uint32_t insn, const DisasInsn *di) +static void 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; + } + 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; + } +#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; + + nullify_end(ctx); + return; + } +#endif } - cond_free(&ctx->null_cond); + + 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); + nullify_end(ctx); } static void trans_cmpclr(DisasContext *ctx, uint32_t insn, const DisasInsn *di) @@ -2792,48 +2842,10 @@ static void trans_ds(DisasContext *ctx, uint32_t insn, const DisasInsn *di) 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 void 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; - - 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 },