From nobody Tue Feb 10 14:32:14 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1566253406; cv=none; d=zoho.com; s=zohoarc; b=dmDytlKx9lCGEKYgGy96qLkFH3WnQH9kkdo8xtUe+iHGIko0lRCBj4IJg50dowFFD4dlPdStZEWFa87CDnjyiuhYXwLWU+mc74iXgwBk3VbtZQ612YPLuzaxbYPNuSWPUHW63dmHizdecp2sapH9bncbcP8yCe096RstJAV1NII= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1566253406; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=VFBU7xB1tZeQF9Ur7x5GUr3vG1VIlCf7jhvfNaK9tC0=; b=iJxADxQRymZGyOOS+lgQeRCuV6FMSwsRYLIMymmgWU5Mc/IPJRteMkm0uEbGCIOpA72XS/LdlkCx7wBFl9SR8A/rwjAZI0ibcX7alBXo1hF62M09pyS619KqG91zzluOdVDkFVYKknrKmHbZBxxqM9dv/F8/qtft4C2fclLKhw4= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1566253406095954.7235662763362; Mon, 19 Aug 2019 15:23:26 -0700 (PDT) Received: from localhost ([::1]:59914 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hzq3f-0004hY-0G for importer@patchew.org; Mon, 19 Aug 2019 18:23:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59717) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hzpMj-0002Vr-26 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-0006h2-Cc for qemu-devel@nongnu.org; Mon, 19 Aug 2019 17:39:00 -0400 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]:46045) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hzpMf-0006cQ-7A for qemu-devel@nongnu.org; Mon, 19 Aug 2019 17:38:59 -0400 Received: by mail-pg1-x543.google.com with SMTP id o13so1921286pgp.12 for ; Mon, 19 Aug 2019 14:38:55 -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.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Aug 2019 14:38:53 -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=VFBU7xB1tZeQF9Ur7x5GUr3vG1VIlCf7jhvfNaK9tC0=; b=l6E8rkRCcCq9NjGdgmdCaOfUp1hUCk8OnzveXy+ovospNVBusw/ZuE+U6GsDHVqN6/ OLvheKhhduzX8D9Vc7rE05wC5yDgFDmtW/prE85Kt+Ol8YWCuMlweacUfbk93gmdARES k/fiVLxdDn6zqswtTVtrEzfo7A/TgiOyD9Qj4zGdGLSIbnrBnGImCbkpShNEehNpmyYO x6+fU07BTW2Azevcoo6ufxAhxEdEdNcMrCbFY/0PxGHW+jaNPq6hZJuRmLcT5HWWhN/Z b4KNKJDjg4CuawJjv6ANQLaWuIWhQ5FGa2997h8R4iBwgwI3k2mLx1e/l6ni+iOh8v63 PyrQ== 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=VFBU7xB1tZeQF9Ur7x5GUr3vG1VIlCf7jhvfNaK9tC0=; b=dQW30+9m8UrHLvH6Dk8zABntFHGqcjXs2TixqNK/CecQdvKX3qRkOSSXHg1ngx+0xf uF3KPEGD0CHDKammU7ZBwOKOcmts5qK1mJ7k4xgfb3Cr/R7KNgsmpzdyQIMWuyBoVdxC FRGLu3jouBRzwhlZkwcK/sf7610CD93YC9IE3WIWniSN4YSddjzxdPVa6yKJkYBQd8IO pkhCGFWHpTU0Pd2hRJt15jKgI3KoMv+C2toFKEV176ieQEhwWqS01VM0yYX26tcqTK/i f0jiqdd7vs97CJ146Ycnuks3lcudR5MVbbOkpYl4yTbbSYOOxOXgpuFSdrm1AyNLPyd7 5Hnw== X-Gm-Message-State: APjAAAVHalKhwSfb6vW8PoBXuL8c6UrpH4pV2tXRWS5hdIqWM3IqmFM8 HhYBBylammoe2FUcJ0V1uLK0aQwGbcg= X-Google-Smtp-Source: APXvYqzBFkjYhsJ3+06HVnFoKbDVQh/Y+XC98FdQcjajdgM+7Hyf1QRez2vD2lI31hWt4rs8vEWmpQ== X-Received: by 2002:a62:584:: with SMTP id 126mr26624406pff.73.1566250734445; Mon, 19 Aug 2019 14:38:54 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Mon, 19 Aug 2019 14:37:34 -0700 Message-Id: <20190819213755.26175-48-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::543 Subject: [Qemu-devel] [PATCH v2 47/68] target/arm: Convert T16 load/store (immediate offset) 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/translate.c | 94 +++--------------------------------------- target/arm/t16.decode | 33 +++++++++++++++ 2 files changed, 38 insertions(+), 89 deletions(-) diff --git a/target/arm/translate.c b/target/arm/translate.c index e19961fb6c..24537fc107 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -10744,97 +10744,13 @@ static void disas_thumb_insn(DisasContext *s, uin= t32_t insn) */ goto illegal_op; =20 - case 5: - /* load/store register offset, in decodetree */ + case 5: /* load/store register offset, in decodetree */ + case 6: /* load/store word immediate offset, in decodetree */ + case 7: /* load/store byte immediate offset, in decodetree */ + case 8: /* load/store halfword immediate offset, in decodetree */ + case 9: /* load/store from stack, in decodetree */ goto illegal_op; =20 - case 6: - /* load/store word immediate offset */ - rd =3D insn & 7; - rn =3D (insn >> 3) & 7; - addr =3D load_reg(s, rn); - val =3D (insn >> 4) & 0x7c; - tcg_gen_addi_i32(addr, addr, val); - - if (insn & (1 << 11)) { - /* load */ - tmp =3D tcg_temp_new_i32(); - gen_aa32_ld32u(s, tmp, addr, get_mem_index(s)); - store_reg(s, rd, tmp); - } else { - /* store */ - tmp =3D load_reg(s, rd); - gen_aa32_st32(s, tmp, addr, get_mem_index(s)); - tcg_temp_free_i32(tmp); - } - tcg_temp_free_i32(addr); - break; - - case 7: - /* load/store byte immediate offset */ - rd =3D insn & 7; - rn =3D (insn >> 3) & 7; - addr =3D load_reg(s, rn); - val =3D (insn >> 6) & 0x1f; - tcg_gen_addi_i32(addr, addr, val); - - if (insn & (1 << 11)) { - /* load */ - tmp =3D tcg_temp_new_i32(); - gen_aa32_ld8u_iss(s, tmp, addr, get_mem_index(s), rd | ISSIs16= Bit); - store_reg(s, rd, tmp); - } else { - /* store */ - tmp =3D load_reg(s, rd); - gen_aa32_st8_iss(s, tmp, addr, get_mem_index(s), rd | ISSIs16B= it); - tcg_temp_free_i32(tmp); - } - tcg_temp_free_i32(addr); - break; - - case 8: - /* load/store halfword immediate offset */ - rd =3D insn & 7; - rn =3D (insn >> 3) & 7; - addr =3D load_reg(s, rn); - val =3D (insn >> 5) & 0x3e; - tcg_gen_addi_i32(addr, addr, val); - - if (insn & (1 << 11)) { - /* load */ - tmp =3D tcg_temp_new_i32(); - gen_aa32_ld16u_iss(s, tmp, addr, get_mem_index(s), rd | ISSIs1= 6Bit); - store_reg(s, rd, tmp); - } else { - /* store */ - tmp =3D load_reg(s, rd); - gen_aa32_st16_iss(s, tmp, addr, get_mem_index(s), rd | ISSIs16= Bit); - tcg_temp_free_i32(tmp); - } - tcg_temp_free_i32(addr); - break; - - case 9: - /* load/store from stack */ - rd =3D (insn >> 8) & 7; - addr =3D load_reg(s, 13); - val =3D (insn & 0xff) * 4; - tcg_gen_addi_i32(addr, addr, val); - - if (insn & (1 << 11)) { - /* load */ - tmp =3D tcg_temp_new_i32(); - gen_aa32_ld32u_iss(s, tmp, addr, get_mem_index(s), rd | ISSIs1= 6Bit); - store_reg(s, rd, tmp); - } else { - /* store */ - tmp =3D load_reg(s, rd); - gen_aa32_st32_iss(s, tmp, addr, get_mem_index(s), rd | ISSIs16= Bit); - tcg_temp_free_i32(tmp); - } - tcg_temp_free_i32(addr); - break; - case 10: /* * 0b1010_xxxx_xxxx_xxxx diff --git a/target/arm/t16.decode b/target/arm/t16.decode index 83fe4363c7..1cf79789ac 100644 --- a/target/arm/t16.decode +++ b/target/arm/t16.decode @@ -24,6 +24,7 @@ &s_rri_rot !extern s rn rd imm rot &s_rrrr !extern s rd rn rm ra &ldst_rr !extern p w u rn rt rm shimm shtype +&ldst_ri !extern p w u rn rt imm =20 # Set S if the instruction is outside of an IT block. %s !function=3Dt16_setflags @@ -69,3 +70,35 @@ LDR_rr 0101 100 ... ... ... @ldst_rr LDRH_rr 0101 101 ... ... ... @ldst_rr LDRB_rr 0101 110 ... ... ... @ldst_rr LDRSH_rr 0101 111 ... ... ... @ldst_rr + +# Load/store word/byte (immediate offset) + +%imm5_6x4 6:5 !function=3Dtimes_4 + +@ldst_ri_1 ..... imm:5 rn:3 rt:3 \ + &ldst_ri p=3D1 w=3D0 u=3D1 +@ldst_ri_4 ..... ..... rn:3 rt:3 \ + &ldst_ri p=3D1 w=3D0 u=3D1 imm=3D%imm5_6x4 + +STR_ri 01100 ..... ... ... @ldst_ri_4 +LDR_ri 01101 ..... ... ... @ldst_ri_4 +STRB_ri 01110 ..... ... ... @ldst_ri_1 +LDRB_ri 01111 ..... ... ... @ldst_ri_1 + +# Load/store halfword (immediate offset) + +%imm5_6x2 6:5 !function=3Dtimes_2 +@ldst_ri_2 ..... ..... rn:3 rt:3 \ + &ldst_ri p=3D1 w=3D0 u=3D1 imm=3D%imm5_6x2 + +STRH_ri 10000 ..... ... ... @ldst_ri_2 +LDRH_ri 10001 ..... ... ... @ldst_ri_2 + +# Load/store (SP-relative) + +%imm8_0x4 0:8 !function=3Dtimes_4 +@ldst_spec_i ..... rt:3 ........ \ + &ldst_ri p=3D1 w=3D0 u=3D1 imm=3D%imm8_0x4 + +STR_ri 10010 ... ........ @ldst_spec_i rn=3D13 +LDR_ri 10011 ... ........ @ldst_spec_i rn=3D13 --=20 2.17.1