From patchwork Sat Feb 23 23:29:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 159135 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp476226jad; Sat, 23 Feb 2019 15:33:38 -0800 (PST) X-Google-Smtp-Source: AHgI3IYu5eQB3xZ45sd2py4YluUXj8cMwwfsuPD1PiV5HE8DqR6Q9JPiwxrYrrXa5RI2z9zO7dke X-Received: by 2002:a0d:ecd2:: with SMTP id v201mr8362178ywe.96.1550964818343; Sat, 23 Feb 2019 15:33:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550964818; cv=none; d=google.com; s=arc-20160816; b=MSjNMG3DdG8tpv1KiJEVDIuG/QdBQBV0uMVGgWGFjVgaxa5xhLiM5TtEoGwp10hk1x XZdyW8fbXMG+mMmadrQV0GmzRFv4Zx8IAw/8uzomBoVadgdtQ6FfJKlcU38mo0YL0oD+ OC8P7lDK9ZFyz0R7r9AhyhNvHMQcQ6iSv38icsMJwnZZ9rJ4kCaECCe1K0NOSmbaSXP5 g/7RJFNtpN/Pc8h1OQT/UzwcIIzz6A53ODgTlFNC92x2L1HFa255l8gP627HJr+E8v/L fC8GH7DrvHMXdW2BpVZqB/LNpQ+8BM7UvNWiR/5uhRJVJoupcL2YPRTt6oXAyV1UC2GN AQsA== 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=xHXkXT6lJgVBbNX0LyuxrSI32KVu1StCWGgAmzm2ig0=; b=GXlJ7Q+yfS24B12Rv3U2fvo2hy3TdeV7nXqhkQEGIe06BsF9YPa7wN3WNpktfZi8/N u1R6taz/fFjjIpGEppnSsO5YuiYxLbFoQYb9ob9aI7bXsEJdTCMmWE2fLfXUdFLs4nru 7o+0iPIZDvTxiyIpuqP0HX1hhLDfQtjgccndhNi8v98xutqPjt1ExtPyBjoPQeXOcrzK CKycqhhqBSs7XGJyCwkToHt4JwRHTpoCTuJ0wgbmGs90iFyeVg8NlRkzSt41ebzsGJPb O+nA4omBk12vCaAHcGi4ol5HWGOYLTLGSauFj63OibnnCVfggrmSvv/BdbexmPlY5IpG JNQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=J9P8VipO; 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" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id t185si3088987yba.139.2019.02.23.15.33.38 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sat, 23 Feb 2019 15:33:38 -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=J9P8VipO; 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" Received: from localhost ([127.0.0.1]:43849 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gxgnZ-0001gD-QE for patch@linaro.org; Sat, 23 Feb 2019 18:33:37 -0500 Received: from eggs.gnu.org ([209.51.188.92]:45440) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gxgkB-0000PN-Nh for qemu-devel@nongnu.org; Sat, 23 Feb 2019 18:30:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gxgk9-0007NQ-OH for qemu-devel@nongnu.org; Sat, 23 Feb 2019 18:30:07 -0500 Received: from mail-pg1-x534.google.com ([2607:f8b0:4864:20::534]:36317) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gxgk9-0007KQ-GA for qemu-devel@nongnu.org; Sat, 23 Feb 2019 18:30:05 -0500 Received: by mail-pg1-x534.google.com with SMTP id r124so2781673pgr.3 for ; Sat, 23 Feb 2019 15:30:05 -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=xHXkXT6lJgVBbNX0LyuxrSI32KVu1StCWGgAmzm2ig0=; b=J9P8VipOKoapixpi+J/A+XVBn5AGtVIvS8OnYfN1XWZdJMOCnhl+gOKtAlZKGuAu6O avYX+YM/ySvvp/D5SLBS5SjxXitGw6PpGA+I3dhyTSv+LrlWu67OqbGabxe5xKh2/C6A WBj68zBvAdlZfzHflSQWWUAR1R0lr8zpWebWIUmOsyFk+A1DmrexoqBBLwq6jLK591TN KINw20v6RvyEIFbjrF2afTV7EMQ7NB6/NufoddEuXEcO1+11m7RmKlNHojc+tGb6s8CC O3Rh6/oCBDOgc4EKxaEtS6eUDNnf4Hrihhoa8PDJ49nFmYgvO91vXeYgg1uixm+ryail hEvQ== 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=xHXkXT6lJgVBbNX0LyuxrSI32KVu1StCWGgAmzm2ig0=; b=Rd5C9nfeyLwNrkBf9JKzbTI0sGJy0sCItovimrnaWye9lAPkLctVRVm9Um5JFAVggD mAAA1b/QfBcu6SV6yEIAUVWRQaUpPE51V0j4ZtPd+yV/pMARkYgDRgoKyjczU4i6K5kW 5SPKNHdwLDG5x811co3rNc8s9JuZupm1x8KKGhvhVqNcTq5eCwqad9+5ovzHLIJIxFKl 2pgE1pcvxfohfr+EnzoFl0BntfkTsRGdNWOmzsSF3pZUfcsVY5OnjefCJ0/mrjIPHBkV DKYPCMNbTCVfNy5yQkQB//V1RlWiIcsfNlBLop1eklYEGCIHN/yQScgzGSaJvyfhFjDm 2d/w== X-Gm-Message-State: AHQUAubw5TlM1u8QckKs3zzAKrx6zQR7hfh9ON9rcVCGWDYlZf0ZpAdY k39x1vRC1XSVgjPNHYEnpSTiceOJtlI= X-Received: by 2002:a63:2c8a:: with SMTP id s132mr10778860pgs.440.1550964604063; Sat, 23 Feb 2019 15:30:04 -0800 (PST) Received: from cloudburst.twiddle.net (97-113-188-82.tukw.qwest.net. [97.113.188.82]) by smtp.gmail.com with ESMTPSA id n1sm13214842pfi.123.2019.02.23.15.30.02 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 23 Feb 2019 15:30:03 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sat, 23 Feb 2019 15:29:53 -0800 Message-Id: <20190223232954.7185-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190223232954.7185-1-richard.henderson@linaro.org> References: <20190223232954.7185-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::534 Subject: [Qemu-devel] [RFC 6/7] target/hppa: Use pattern groups to decode 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: kbastian@mail.uni-paderborn.de, f4bug@amsat.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" It seems clearer to decode specializations of OR within decodetree instead of by hand within the translation function. Signed-off-by: Richard Henderson --- target/hppa/translate.c | 106 ++++++++++++++++++++------------------- target/hppa/insns.decode | 10 +++- 2 files changed, 64 insertions(+), 52 deletions(-) -- 2.17.2 diff --git a/target/hppa/translate.c b/target/hppa/translate.c index b4fd307b77..8f5010b633 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -2619,59 +2619,63 @@ static bool trans_and(DisasContext *ctx, arg_rrr_cf *a) return do_log_reg(ctx, a, tcg_gen_and_reg); } +static bool trans_copy(DisasContext *ctx, arg_copy *a) +{ + unsigned r = a->r; + unsigned t = a->t; + + if (r == 0) { + TCGv_reg dest = dest_gpr(ctx, t); + tcg_gen_movi_reg(dest, 0); + save_gpr(ctx, t, dest); + } else { + save_gpr(ctx, t, cpu_gr[r]); + } + cond_free(&ctx->null_cond); + return true; +} + +static bool trans_pause(DisasContext *ctx, arg_pause *a) +{ +#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. + */ + 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); +#else + /* For user-only, don't pause but treat as nop. */ + cond_free(&ctx->null_cond); + return true; +#endif +} + static bool trans_or(DisasContext *ctx, arg_rrr_cf *a) { - if (a->cf == 0) { - unsigned r2 = a->r2; - unsigned r1 = a->r1; - unsigned rt = a->t; - - 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 - } return do_log_reg(ctx, a, tcg_gen_or_reg); } diff --git a/target/hppa/insns.decode b/target/hppa/insns.decode index 55ff39dd05..46c64334d1 100644 --- a/target/hppa/insns.decode +++ b/target/hppa/insns.decode @@ -148,7 +148,15 @@ lci 000001 ----- ----- -- 01001100 0 t:5 andcm 000010 ..... ..... .... 000000 0 ..... @rrr_cf and 000010 ..... ..... .... 001000 0 ..... @rrr_cf -or 000010 ..... ..... .... 001001 0 ..... @rrr_cf +{ + { + nop 000010 ----- ----- 0000 001001 0 00000 + copy 000010 00000 r:5 0000 001001 0 t:5 + pause 000010 01010 01010 0000 001001 0 01010 + pause 000010 11111 11111 0000 001001 0 11111 + } + or 000010 ..... ..... .... 001001 0 ..... @rrr_cf +} xor 000010 ..... ..... .... 001010 0 ..... @rrr_cf uxor 000010 ..... ..... .... 001110 0 ..... @rrr_cf ds 000010 ..... ..... .... 010001 0 ..... @rrr_cf