From patchwork Mon Aug 19 21:37:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 171690 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp3548325ily; Mon, 19 Aug 2019 15:03:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqxEJENKj/yy1dwWgo0ZglexLkcCZhPWUs4LSphLuMSOc8hmvKUidO0XzfsUuH23Tph+LDzs X-Received: by 2002:aed:3b30:: with SMTP id p45mr22552545qte.84.1566252207523; Mon, 19 Aug 2019 15:03:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566252207; cv=none; d=google.com; s=arc-20160816; b=Mp1/buJ/PzUDk6ZUc3PQjfNPWYyOoNxhfym/wHFBv8gz24xRXNkt3nYBGaV3M0I6YD djNtTXU/88cWce+QrIZAS7rYfUEiHFJ9y/cr4UBO7IUsfMRiTK3p/ggkgB454/27/EC+ bPdIzfCpegEjNNy0895ur7FLwYBzKOsFdpWep3en/qiZODoSJoXa+93PUPVpcQWwzdR9 uYEFcDpjJaD/xJX1OZA/XicSvf4+Ol/QGKyVOx5BO1SULXE+T57Qydxr5G61EdtnuU2x 9xWkzKRKgjNZwY7A//VLqhc8pNs+34evVi5F3vQLpCrnQJ+LZEgy2EjrzmfGv6/0N5TZ OPWg== 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=lmni/76O+knM0gbFh8KJGT9HS18kVAz/Vke5rjDhrnk=; b=X3tG+iHN3PT/KH1PfMslEGSAhC6i4BAeyILlk83rehi4/J87nT2PL09128/Yd2HzZ8 XT2+4sMos9gY3x86KfeDPgf1/D+JN8HghZMJ1jbgYnfB8oOcaxyrI1JGClB77LQIycUG Ray43eKo5GNeS4Q2v6uTpYb28AbmIOdedxCa8iMlXEfprb3JBYwYnTAfW4KeyC+Nlr+r 7uf4O/zlCB1/cN6/lPduDGXjbjIT8Qb0D5lCWKLc8UU5BJH99bsBECffK3Vwe7jy2q4Y aCYx5ytKGCBBPGMIYcuI4kXeING7um972FOH0kFR3Ihjsf8KOyAPVeHlloYGXjDBEvRm Wg/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=hCX45omn; 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 c36si10332486qvc.201.2019.08.19.15.03.27 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 19 Aug 2019 15:03:27 -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=hCX45omn; 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]:59414 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hzpkL-0008BD-Oe for patch@linaro.org; Mon, 19 Aug 2019 18:03:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58911) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hzpM8-0001kd-3E for qemu-devel@nongnu.org; Mon, 19 Aug 2019 17:38:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hzpM6-0006CF-Rt for qemu-devel@nongnu.org; Mon, 19 Aug 2019 17:38:23 -0400 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]:37825) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hzpM6-0006Bi-MT for qemu-devel@nongnu.org; Mon, 19 Aug 2019 17:38:22 -0400 Received: by mail-pg1-x541.google.com with SMTP id d1so1932952pgp.4 for ; Mon, 19 Aug 2019 14:38:22 -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=lmni/76O+knM0gbFh8KJGT9HS18kVAz/Vke5rjDhrnk=; b=hCX45omn7zmvTg4bYLt5wK3G4l7dfL2jPcgj+kXHf97Kyb9DpZ27nhjvkAhBGgOwPI vYc3HvxNaMhHHLRGBANezEMGtlPfTEibk2+VpxP7C5dmxkXWYty7v95a+CicdSgYTg9y Gm3X1bJ1Em/YpbwVjWpRsbdsQua/dK5LRXl3qLbHwvtdn8ebEizXiRemV71jt+6L0jm/ vmNDL+/Fk00mc7kqoY1FBVHv9NJEzR37Fq7LyFC1qcNDUQWKvcmXq35iSnxacRJWoCCX dU+Iu0PiK7oCegktiMExarNnSkS0Cda+wCGEpG4tgyxgKFR0VRAi2kwqYWBVSAL7+H2l HdGA== 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=lmni/76O+knM0gbFh8KJGT9HS18kVAz/Vke5rjDhrnk=; b=qZa3JHgk9PauIcDrM/+4tKZoft0RXChJhig5YYO9m2AVoe9lQqTQeWOe2b7wTVFdrL ldL8Le1Opa5Dxg2bIbm+3bmUbtEovvw72NQM89AYnXo62QTfR8YqJaOs5AGsGapLMB+G /+W9d/EevN5DXJ4vrJ65t6VntpLcecNUzfGcBd2oPrQBNe4BEbEmjrPfnPlB0E+1hBHr B7riFiMcLhETuPRp40AOZYlXr64HYhzyfYEzXB0h39lkt3n8h0RG+lcxK0D0nrrYpz+c hUxXWSRtmNqRXx8Vmd0pTTDdH1Oa6qwkJoR19P6vOaXtgz00HIIhpB857vSvFAEWXjGW ekJA== X-Gm-Message-State: APjAAAVTgtWazY/uODgKg3FMDzSfZcWKuRfUo0so5vvX5+Dvwvf8Nff8 CSzxYJsZSnZvwOxupoPwRGc84Eu0rPg= X-Received: by 2002:a63:b64:: with SMTP id a36mr22296590pgl.215.1566250701387; Mon, 19 Aug 2019 14:38:21 -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.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Aug 2019 14:38:20 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Mon, 19 Aug 2019 14:37:06 -0700 Message-Id: <20190819213755.26175-20-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::541 Subject: [Qemu-devel] [PATCH v2 19/68] target/arm: Convert T32 ADDW/SUBW 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 | 24 +++++++++++++----------- target/arm/a32.decode | 1 + target/arm/t32.decode | 19 +++++++++++++++++++ 3 files changed, 33 insertions(+), 11 deletions(-) -- 2.17.1 diff --git a/target/arm/translate.c b/target/arm/translate.c index cb6296dc12..0e51289928 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -7626,6 +7626,11 @@ static void arm_skip_unless(DisasContext *s, uint32_t cond) * Constant expanders for the decoders. */ +static int negate(DisasContext *s, int x) +{ + return -x; +} + static int times_2(DisasContext *s, int x) { return x * 2; @@ -7975,6 +7980,12 @@ static bool trans_ORN_rri(DisasContext *s, arg_s_rri_rot *a) #undef DO_ANY2 #undef DO_CMP2 +static bool trans_ADR(DisasContext *s, arg_ri *a) +{ + store_reg_bx(s, a->rd, add_reg_for_lit(s, 15, a->imm)); + return true; +} + /* * Multiply and multiply accumulate */ @@ -10670,17 +10681,8 @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn) } store_reg(s, rd, tmp); } else { - /* Add/sub 12-bit immediate. */ - if (insn & (1 << 23)) { - imm = -imm; - } - tmp = add_reg_for_lit(s, rn, imm); - if (rn == 13 && rd == 13) { - /* ADD SP, SP, imm or SUB SP, SP, imm */ - store_sp_checked(s, tmp); - } else { - store_reg(s, rd, tmp); - } + /* Add/sub 12-bit immediate, in decodetree */ + goto illegal_op; } } } else { diff --git a/target/arm/a32.decode b/target/arm/a32.decode index c7f156be6d..aac991664d 100644 --- a/target/arm/a32.decode +++ b/target/arm/a32.decode @@ -30,6 +30,7 @@ &rrrr rd rn rm ra &rrr rd rn rm &rr rd rm +&ri rd imm &r rm &i imm &msr_reg rn r mask diff --git a/target/arm/t32.decode b/target/arm/t32.decode index 5116c6165a..be4e5f087c 100644 --- a/target/arm/t32.decode +++ b/target/arm/t32.decode @@ -27,6 +27,7 @@ &rrrr !extern rd rn rm ra &rrr !extern rd rn rm &rr !extern rd rm +&ri !extern rd imm &r !extern rm &i !extern imm &msr_reg !extern rn r mask @@ -121,6 +122,24 @@ SBC_rri 1111 0.0 1011 . .... 0 ... .... ........ @s_rri_rot } RSB_rri 1111 0.0 1110 . .... 0 ... .... ........ @s_rri_rot +# Data processing (plain binary immediate) + +%imm12_26_12_0 26:1 12:3 0:8 +%neg12_26_12_0 26:1 12:3 0:8 !function=negate +@s0_rri_12 .... ... .... . rn:4 . ... rd:4 ........ \ + &s_rri_rot imm=%imm12_26_12_0 rot=0 s=0 + +{ + ADR 1111 0.1 0000 0 1111 0 ... rd:4 ........ \ + &ri imm=%imm12_26_12_0 + ADD_rri 1111 0.1 0000 0 .... 0 ... .... ........ @s0_rri_12 +} +{ + ADR 1111 0.1 0101 0 1111 0 ... rd:4 ........ \ + &ri imm=%neg12_26_12_0 + SUB_rri 1111 0.1 0101 0 .... 0 ... .... ........ @s0_rri_12 +} + # Multiply and multiply accumulate @s0_rnadm .... .... .... rn:4 ra:4 rd:4 .... rm:4 &s_rrrr s=0