From patchwork Fri Jul 26 17:49:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 169878 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp356278ilk; Fri, 26 Jul 2019 10:53:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqwS/uhwyili8kIKG4/Lq3Mhy50y4gWTT+1WD612yX3B/fmeWhGHm7dP8KPeiOyJ12u0H9Jn X-Received: by 2002:aed:3461:: with SMTP id w88mr67815813qtd.13.1564163635272; Fri, 26 Jul 2019 10:53:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564163635; cv=none; d=google.com; s=arc-20160816; b=tul/0GwDR49BOhPwtQn8D5ZCBUSDcgY/PaJv2S77UCJra1htcZAoXRoN9H8oL+W8SW OjlBtF+fCOpIQzIPcUN2KpDF+cE5DFpQ2/BZvL3kdH9+Nb4p2Ge+9AoBpwzw9yyaBCWR 8SoI65niwONnr+aKN7P4Rh/a7eX/06gQ72iHLeJNnGgiRVZX1lVEfJV4X1AbH/rLY1AY qsH6e1n5LaUDpfwjMiUSP3lTKKPGeNkRNlSv0jIStM9MEYfpFM9uhoRyBJ3yVaDp91Gl 44S6yYxayBNHYX/osxGcmj32Fnh+MKMexshVqs3miEZkXIuw26peC2O0Ns3rOFHJQqJ6 tmKg== 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=ukXEAQeVlVRr0NDtltS3ky/umJGI1MT5scY2efu29x8=; b=bMeRoT+EfRmmCJ5yp47L645TpL3MbIGCQHGDdniAcKHWEr8/Kf1vV0qWiUcUgoevbk AdkSxrrecfyK+ZkXRDOStRBbOgWcaGUze5MguTakvBjQpfCaExpS0v972vhReLzjSE7n TfchvJIxzkIpDKlRKssCYRh+PSAV1j05pqZ76GcGSAIaW/C6DDHgGYxsug00ydGigBdm 22/ynStypnz1px57q54HeigLi4f5eke8IwNnFfnIGwoUaeYH95rx/6i/DyDXyVSu8Tbt F9VtlLqKLK7CS6JA05ogmxvSlY4kCA5btYozK/pSMirS3SIZ4t4624IlJcZckCT2+PuB Kn2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=rGfwYEjj; 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 h28si21390564qvd.53.2019.07.26.10.53.55 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 26 Jul 2019 10:53:55 -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=rGfwYEjj; 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]:42286 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hr4Ph-0005mZ-37 for patch@linaro.org; Fri, 26 Jul 2019 13:53:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57835) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hr4Mx-00038w-98 for qemu-devel@nongnu.org; Fri, 26 Jul 2019 13:51:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hr4Mu-00088X-2A for qemu-devel@nongnu.org; Fri, 26 Jul 2019 13:51:02 -0400 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]:39971) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hr4Mt-00086Z-Qu for qemu-devel@nongnu.org; Fri, 26 Jul 2019 13:51:00 -0400 Received: by mail-pg1-x544.google.com with SMTP id w10so25118261pgj.7 for ; Fri, 26 Jul 2019 10:50:59 -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=ukXEAQeVlVRr0NDtltS3ky/umJGI1MT5scY2efu29x8=; b=rGfwYEjjH1zbSGoLAJkn1Y0CKXSSsSU6We6F5QakfoswaOEfaMrNaZ/MOXtJlSCY83 NXT7YNqwfoZ+o3ayyQJL/+X55FLA8xpHycQCUezKhoIe1BKw5qAiy6H6Y7ct6LRRSUQo vaT5TzUetA99hu5m0vG67feKLagNoji2lCMdpYjHmr2FfGJ7o6Yp4jmotB24+WyTvPMI kg6YjfWWY/pt0A4hnE8Xf+Tz/FdoCXkZ1kc2J7Nipq5FwbU6rnQAuBhzr6/rzKXMqQX7 6mhYm3YdVIl2HyoBT1mhBNgSOuGStzODjPvdMP5r9ZHD+9a8V7bxYm5o0swrkltZHVe7 RfEg== 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=ukXEAQeVlVRr0NDtltS3ky/umJGI1MT5scY2efu29x8=; b=LKTjomBDEWW26YGO8KbVC9FGqKZqGvAzg88QCr/sDji9kBukMBhxqmAjMLpbxF1Qh9 gdyAEaByJCfQHFHVt/kvn+J8RxNP/cN796q4WnTCjub2sdzt319Yj56gl32D1aJqUnzR AcGls2PSgQygdmEARptA1ifmwQMATT/OcYhs0PAJcCX5n6I143+fs6Np+MoypEGMXw7d cMmSNg3SJVmCThT7d5UdHfJCdMBwNiomewmDOk2DwqytF8LL7lXutdVFXFue91ZOE3JP 2sFQLpsETaakP9aAJ+1v2t98sde59uq9Y4MPPArs17BPi8DXaKJ/jvouis6K2SWueUnr PkLg== X-Gm-Message-State: APjAAAXGC07t+0P2b4Yx7cOol6vr19gX7mbcKrPO2nvkXMxNAU95ZQzq YUOjSW0pBCuBfOqXNMD/DQmrEQoUM2M= X-Received: by 2002:a63:36cc:: with SMTP id d195mr51512589pga.157.1564163458590; Fri, 26 Jul 2019 10:50:58 -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.50.57 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 26 Jul 2019 10:50:57 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 26 Jul 2019 10:49:46 -0700 Message-Id: <20190726175032.6769-22-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::544 Subject: [Qemu-devel] [PATCH 21/67] 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, 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 | 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 09310b1c3a..d19131d594 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -7683,6 +7683,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; @@ -8053,6 +8058,12 @@ static bool trans_ORN_rri(DisasContext *s, arg_s_rri_rot *a) #undef DO_ANY #undef DO_LOGIC +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 */ @@ -10758,17 +10769,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 32d1833037..baae62dea9 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 abd233180d..69e81ef71a 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