From patchwork Fri Jul 26 17:50:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 169920 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp367282ilk; Fri, 26 Jul 2019 11:03:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqzVZXHcuc4+K9hvRYdr/aXxZpU4Sa/U41JbTvNRQZVZMqEvk4P9GdJDEUK0reln4GxxtCp0 X-Received: by 2002:ae9:e217:: with SMTP id c23mr21496592qkc.227.1564164239128; Fri, 26 Jul 2019 11:03:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564164239; cv=none; d=google.com; s=arc-20160816; b=nqtxTP5KKrRtYdIHqCwHlfxqCCZivMFaC9Dhq+6Zn6kZKMQ4BvDOpR26aHjNMLRIPi m2rQe1Mz9WgHXXKujdPyKnnwwWqrcpI78X/RXAmghMzSjXx+r1CoEhrJisDWEcStEtax lQeOm0hOiidW5DzAGFGQzlUxJQKmFe5vT/Zi6MiF7Cb7Ifa7wK5dIm5yHC9eIRFv//Au Dgk2AyU0b6bE+sez+8xfs0SDFlOtX6eYMt2Dl9gYVUj1W9zFHET9nSy6+KDCeRPyHFWk toRpdS+jBrLK+MtJt6aeKsyeMBp+pthPmprXTWbj06KWKdwOfcxPe0CG8WkfxtZcBGER xmOw== 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=C70Yg+46c/XVZyXVh4QRHDyUG/TqYDz7LEEkFesYi6Q=; b=tf3yA3T2zlIO1Z8TRC6ud4LoBgasj4Bx9y4RpJjxUby6H3V34WXZ2PSp5zrjsOyvIy I61c9Bfh2e1mX6Z1WAjzJzfqxuCTsJXfkDn8et7WQoyqYUP4RLOx+yquX/nBroyIhDw6 pm3gj8YqU6yjyJUw8WJiwirzw007OnRzht9gA90hUt9pLKeMf/nBcOy2HnXpMkG2mN9f vVw5HQyZNGMV3FbxOVkKvjsb/+SZW++i6kKShxsFg8/0pe91s7AZWgEqiwykPLzFQt9H eDAjYiiopRFQnKcpawyuEnIESX4I+PNYZnQ6JD8/VpeiuvLdlnIlcmjeLsFeQZZNwLSR C6cw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=NzxCzQPw; 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 v22si30872940qta.332.2019.07.26.11.03.59 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 26 Jul 2019 11:03:59 -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=NzxCzQPw; 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]:42702 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hr4ZR-00037P-W2 for patch@linaro.org; Fri, 26 Jul 2019 14:03:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59738) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hr4Nv-0007X2-Ot for qemu-devel@nongnu.org; Fri, 26 Jul 2019 13:52:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hr4Nt-0001OU-Ri for qemu-devel@nongnu.org; Fri, 26 Jul 2019 13:52:03 -0400 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]:46825) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hr4Nt-00014l-Ge for qemu-devel@nongnu.org; Fri, 26 Jul 2019 13:52:01 -0400 Received: by mail-pf1-x429.google.com with SMTP id c3so1720839pfa.13 for ; Fri, 26 Jul 2019 10:51:44 -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; bh=C70Yg+46c/XVZyXVh4QRHDyUG/TqYDz7LEEkFesYi6Q=; b=NzxCzQPwDL2RHpSKettJLJJ3w8c0BDGTVv1D2coZzWHKoMplL/ZnUe4nh5V15XPe6O 2wvHwYgFDvS5rWbFipEQDZqV3L/elqF1/YwK94JB3inJTWRaic+RNfKB6FtMaGYBh+LY 7ddtzIuW02hHgXU+WObCHgWmrEqaFhWP1/vn+vZ6AoDhdBmcIpwu0YwksdtzqVcjd+ih IxICgFMB4AidU6+tIdQBC5GXSekfcHFMhtegGtvcdsnelu0WW6RYGHkGdWpLxRL11MgW J6xLpCfeMpwGfP/KNsXqU6iaA2poW4fHJR1JRQVrwIQ3DXvx32rxQj6xCrplH0avJlxB Acrg== 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=C70Yg+46c/XVZyXVh4QRHDyUG/TqYDz7LEEkFesYi6Q=; b=AmrI8spPKH3QnbnW+7MQxpZtLc7mTYqg6s3f7SpkkcmgEE92xEG5a0d9WLKe9UI8mk vII89VozCnZmExbnKyVpLFVxEV7sr31GKyouBdqxShBdJu3KE3Z0HlO9KpIdoG0SOFz2 IcZJme0sC12My/XAXFMFvFBhccjp4OnYeZGinIexEa/QKJ/F95g1NRNnHf2o/eNH6y9y hz9RmLQCMSMxWwTc2bJ3OO++k3J671X4v2p9rmnW366oGl2HHz4ZdClS0m4BCq4AJ15J afp5wG6TYrBPeTOevOy8Zd0ZMEabDnnQbSGevWEki72D1KRL8OoF9iwN/gCPGjkMtT4o evnw== X-Gm-Message-State: APjAAAV/PTinB7D7coR/M8HsTBLGa80nlXxtZgn4kokW0kU4TbWadg6e QKpAQAUc5RIiyEBHLSMpAuROS4MkF6I= X-Received: by 2002:a63:ee08:: with SMTP id e8mr38601581pgi.70.1564163503573; Fri, 26 Jul 2019 10:51:43 -0700 (PDT) Received: from localhost.localdomain (97-126-117-207.tukw.qwest.net. [97.126.117.207]) by smtp.gmail.com with ESMTPSA id o24sm104287919pfp.135.2019.07.26.10.51.42 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 26 Jul 2019 10:51:42 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 26 Jul 2019 10:50:23 -0700 Message-Id: <20190726175032.6769-59-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190726175032.6769-1-richard.henderson@linaro.org> References: <20190726175032.6769-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::429 Subject: [Qemu-devel] [PATCH 58/67] target/arm: Convert T16, push and pop 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: peter.maydell@linaro.org, qemu-arm@nongnu.org, alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- target/arm/translate.c | 83 ++++++------------------------------------ target/arm/t16.decode | 10 +++++ 2 files changed, 22 insertions(+), 71 deletions(-) -- 2.17.1 diff --git a/target/arm/translate.c b/target/arm/translate.c index 55404414a2..5d0d0779c8 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -7593,6 +7593,16 @@ static int t16_setflags(DisasContext *s, int x) return s->condexec_mask == 0; } +static int t16_push_list(DisasContext *s, int x) +{ + return (x & 0xff) | (x & 0x100) << (14 - 8); +} + +static int t16_pop_list(DisasContext *s, int x) +{ + return (x & 0xff) | (x & 0x100) << (15 - 8); +} + /* * Include the generated decoders. * Note that the T32 decoder reuses some of the trans_* functions @@ -10618,7 +10628,6 @@ static void disas_thumb_insn(DisasContext *s, uint32_t insn) { uint32_t val, op, rm, rd, shift, cond; int32_t offset; - int i; TCGv_i32 tmp; TCGv_i32 tmp2; TCGv_i32 addr; @@ -10691,76 +10700,8 @@ static void disas_thumb_insn(DisasContext *s, uint32_t insn) goto illegal_op; case 4: case 5: case 0xc: case 0xd: - /* - * 0b1011_x10x_xxxx_xxxx - * - push/pop - */ - addr = load_reg(s, 13); - if (insn & (1 << 8)) - offset = 4; - else - offset = 0; - for (i = 0; i < 8; i++) { - if (insn & (1 << i)) - offset += 4; - } - if ((insn & (1 << 11)) == 0) { - tcg_gen_addi_i32(addr, addr, -offset); - } - - if (s->v8m_stackcheck) { - /* - * Here 'addr' is the lower of "old SP" and "new SP"; - * if this is a pop that starts below the limit and ends - * above it, it is UNKNOWN whether the limit check triggers; - * we choose to trigger. - */ - gen_helper_v8m_stackcheck(cpu_env, addr); - } - - for (i = 0; i < 8; i++) { - if (insn & (1 << i)) { - if (insn & (1 << 11)) { - /* pop */ - tmp = tcg_temp_new_i32(); - gen_aa32_ld32u(s, tmp, addr, get_mem_index(s)); - store_reg(s, i, tmp); - } else { - /* push */ - tmp = load_reg(s, i); - gen_aa32_st32(s, tmp, addr, get_mem_index(s)); - tcg_temp_free_i32(tmp); - } - /* advance to the next address. */ - tcg_gen_addi_i32(addr, addr, 4); - } - } - tmp = NULL; - if (insn & (1 << 8)) { - if (insn & (1 << 11)) { - /* pop pc */ - tmp = tcg_temp_new_i32(); - gen_aa32_ld32u(s, tmp, addr, get_mem_index(s)); - /* don't set the pc until the rest of the instruction - has completed */ - } else { - /* push lr */ - tmp = load_reg(s, 14); - gen_aa32_st32(s, tmp, addr, get_mem_index(s)); - tcg_temp_free_i32(tmp); - } - tcg_gen_addi_i32(addr, addr, 4); - } - if ((insn & (1 << 11)) == 0) { - tcg_gen_addi_i32(addr, addr, -offset); - } - /* write back the new stack pointer */ - store_reg(s, 13, addr); - /* set the new PC value */ - if ((insn & 0x0900) == 0x0900) { - store_reg_from_load(s, 15, tmp); - } - break; + /* push/pop, in decodetree */ + goto illegal_op; case 1: case 3: case 9: case 11: /* czb */ rm = insn & 7; diff --git a/target/arm/t16.decode b/target/arm/t16.decode index 90a4b71a45..10cdca1fbb 100644 --- a/target/arm/t16.decode +++ b/target/arm/t16.decode @@ -221,3 +221,13 @@ REVSH 1011 1010 11 ... ... @rdm # rest of the space is a reserved hint, behaves as nop. NOP 1011 1111 ---- 0000 } + +# Push and Pop + +%push_list 0:9 !function=t16_push_list +%pop_list 0:9 !function=t16_pop_list + +STM 1011 010 ......... \ + &ldst_block i=0 b=1 u=0 w=1 rn=13 list=%push_list +LDM 1011 110 ......... \ + &ldst_block i=1 b=0 u=0 w=1 rn=13 list=%pop_list