From patchwork Mon Aug 19 21:37:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 171699 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp3553973ily; Mon, 19 Aug 2019 15:09:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqwbX7V9r/fm6DOPG8btO6+YFFrqs8P0she7t70oAOWgeBfDLm7QgPjU9fT2wjqN0VeWLvxk X-Received: by 2002:a50:b4b4:: with SMTP id w49mr27058869edd.269.1566252545318; Mon, 19 Aug 2019 15:09:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566252545; cv=none; d=google.com; s=arc-20160816; b=hUAxekwTE2TEqTIfMIlVTFBhkciwfvtOde8i92GEAXIJmVsTNj9qJ8WCNU9Q3WO+ip S378MHHgwmvQUPHudwqeRI+DV33McpUH5h3owZWLUCWRP0rTaPPmAwi0gn5SHbnPz6U4 2kHvXDhciBYWp9li3vovvnTOa/sI6qCcbqdmw3z+TdQl0PYqKs8u76dnt4naT/VFuuuX WCK8PCWJ43LnNYKddsZZunMRjQTQTCs+gt8XiDoeEU87J+QrxZ/1N8o6EEY87LXrqZD2 v2NfB4du2ngHsRbunQpFVYl9kTAyLSEi8ZirRDR0zVYrEnlMzTvW15kezgfB2BqOEVu3 rUQA== 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=ciKrEcP+T8tnigUgJH1zluGMRq2FWUolUVP3r6kA9kc=; b=chMgCBSu0pE8gch00RPcgpumOVNH6ipQRV+0pWzvVmBpdx+G7Hvkp+0X6LzPFlrUk0 j/E2SMf+yfpXnzvmBbx2q08MEzB6eOtdHHs3xuR7xtbBKLlRJjxRIq0GJlIxFcKh2UQS BuDFzSntiHevdTWrKvk+M1PNhi4EDPj2DcXrkS9uNLi8pYfsn/7ghzWYuhLY6mgXaUaE iRiUQ1bjol/XU1u5nUBGMp7z2lorql2frHxbZ5lzI3Zpah9AB9VNOzN5K+fboEJNroe2 HgVeBIHsEpJNJbGENIFL4EDzW0D2xL/xNpFBueFBseYpGfnw5BuyWlMAqUUUcU+jE/XH rFJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=fe3pQIVm; 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 b23si9312233edb.202.2019.08.19.15.09.05 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 19 Aug 2019 15:09:05 -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=fe3pQIVm; 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]:59566 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hzppo-0000W8-22 for patch@linaro.org; Mon, 19 Aug 2019 18:09:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59724) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hzpMj-0002WC-5x for qemu-devel@nongnu.org; Mon, 19 Aug 2019 17:39:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hzpMh-0006hW-JV for qemu-devel@nongnu.org; Mon, 19 Aug 2019 17:39:01 -0400 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]:37306) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hzpMh-0006g1-C5 for qemu-devel@nongnu.org; Mon, 19 Aug 2019 17:38:59 -0400 Received: by mail-pf1-x441.google.com with SMTP id 129so1947366pfa.4 for ; Mon, 19 Aug 2019 14:38:57 -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=ciKrEcP+T8tnigUgJH1zluGMRq2FWUolUVP3r6kA9kc=; b=fe3pQIVmFqXxhHGKfazmDZloPrTMVRi1ogE0ZrUkuBENnP7krpW/s6a9ftqrY6fHEa lOlCC+GTZIaKPVykfUKA3LXzvXyW0eHOppJCLgB1uw8En+RRr2t+3B+1TzjrC4Ud422C I1JkzqsxsAGVZkIA47vt3jByG9+lL7NmGOv1XN6gMFmeEXQXpat8hrP1zu2g4yXS0xVX bg33uRQjlJprecdBHQt9rUi3yxTyap7SVfrzvxB5cShNyLigU+E1pj0bjMIfWClneSJa BjTNSK7o6wyw5yPWM0RXHL2uxvEMwvkC7yVAoyBqr4Q+j7cEoZ94QUC+wap4WdWrnI5P iXhA== 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=ciKrEcP+T8tnigUgJH1zluGMRq2FWUolUVP3r6kA9kc=; b=iQMZ5Q4iekf79zcCq8k/zjrp7b7Sq0t6yEUIvJHAH46NwaViIZjElcCKAL7LV0LUtx iePm/h+KSiEXwR0CXF3tgx6RbiM8K/SC7WEuGnLXUued17VGwskVMhMRavM4XuwmINL7 elBo3ZrTimCNikCvry2ez9G1pyzztbik8vHXNigY50Nfl8D7HLZP7oYic03cy334DWSO N8ZKGMR+adsiTVlYETf5MLaYy8B0UBbsGVQdYbZD9hylYF69P3Iaw18vkzBLiwR+RaQ8 tAbiTlLfMPfy6wr5STEx+PiRWbMhk10OPJenooQeAwZDhSB9JGyRmV7YOmrKmFl/aqLt M5ig== X-Gm-Message-State: APjAAAUO78tfz34Mn8sZYDzRBXbzjqKio/ajbo4JyvZj89YsvfV5OEcP HhNCCis/VsmB75BfbMDU3bc72R7Pxsw= X-Received: by 2002:aa7:818b:: with SMTP id g11mr26769834pfi.122.1566250736820; Mon, 19 Aug 2019 14:38:56 -0700 (PDT) Received: from localhost.localdomain (97-113-7-119.tukw.qwest.net. [97.113.7.119]) by smtp.gmail.com with ESMTPSA id d2sm13446951pjs.21.2019.08.19.14.38.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Aug 2019 14:38:56 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Mon, 19 Aug 2019 14:37:36 -0700 Message-Id: <20190819213755.26175-50-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190819213755.26175-1-richard.henderson@linaro.org> References: <20190819213755.26175-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::441 Subject: [Qemu-devel] [PATCH v2 49/68] target/arm: Convert T16 load/store multiple 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 Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- target/arm/translate.c | 48 ++++++++---------------------------------- target/arm/t16.decode | 8 +++++++ 2 files changed, 17 insertions(+), 39 deletions(-) -- 2.17.1 Reviewed-by: Peter Maydell diff --git a/target/arm/translate.c b/target/arm/translate.c index 2640f50fcf..d417958b23 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -9976,6 +9976,14 @@ static bool trans_LDM_t32(DisasContext *s, arg_ldst_block *a) return do_ldm(s, a, 2); } +static bool trans_LDM_t16(DisasContext *s, arg_ldst_block *a) +{ + /* Writeback is conditional on the base register not being loaded. */ + a->w = !(a->list & (1 << a->rn)); + /* BitCount(list) < 1 is UNPREDICTABLE */ + return do_ldm(s, a, 1); +} + /* * Branch, branch with link */ @@ -10750,6 +10758,7 @@ static void disas_thumb_insn(DisasContext *s, uint32_t insn) case 8: /* load/store halfword immediate offset, in decodetree */ case 9: /* load/store from stack, in decodetree */ case 10: /* add PC/SP (immediate), in decodetree */ + case 12: /* load/store multiple, in decodetree */ goto illegal_op; case 11: @@ -10973,45 +10982,6 @@ static void disas_thumb_insn(DisasContext *s, uint32_t insn) } break; - case 12: - { - /* load/store multiple */ - TCGv_i32 loaded_var = NULL; - rn = (insn >> 8) & 0x7; - addr = load_reg(s, rn); - for (i = 0; i < 8; i++) { - if (insn & (1 << i)) { - if (insn & (1 << 11)) { - /* load */ - tmp = tcg_temp_new_i32(); - gen_aa32_ld32u(s, tmp, addr, get_mem_index(s)); - if (i == rn) { - loaded_var = tmp; - } else { - store_reg(s, i, tmp); - } - } else { - /* store */ - 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); - } - } - if ((insn & (1 << rn)) == 0) { - /* base reg not in list: base register writeback */ - store_reg(s, rn, addr); - } else { - /* base reg in list: if load, complete it now */ - if (insn & (1 << 11)) { - store_reg(s, rn, loaded_var); - } - tcg_temp_free_i32(addr); - } - break; - } case 13: /* conditional branch or swi */ cond = (insn >> 8) & 0xf; diff --git a/target/arm/t16.decode b/target/arm/t16.decode index 71b3e8f02e..a7a437f930 100644 --- a/target/arm/t16.decode +++ b/target/arm/t16.decode @@ -26,6 +26,7 @@ &ri !extern rd imm &ldst_rr !extern p w u rn rt rm shimm shtype &ldst_ri !extern p w u rn rt imm +&ldst_block !extern rn i b u w list # Set S if the instruction is outside of an IT block. %s !function=t16_setflags @@ -109,3 +110,10 @@ LDR_ri 10011 ... ........ @ldst_spec_i rn=13 ADR 10100 rd:3 ........ imm=%imm8_0x4 ADD_rri 10101 rd:3 ........ \ &s_rri_rot rn=13 s=0 rot=0 imm=%imm8_0x4 # SP + +# Load/store multiple + +@ldstm ..... rn:3 list:8 &ldst_block i=1 b=0 u=0 w=1 + +STM 11000 ... ........ @ldstm +LDM_t16 11001 ... ........ @ldstm