From patchwork Mon Sep 14 13:52:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 53583 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by patches.linaro.org (Postfix) with ESMTPS id C88B02056A for ; Mon, 14 Sep 2015 14:05:04 +0000 (UTC) Received: by wicuu12 with SMTP id uu12sf41829312wic.2 for ; Mon, 14 Sep 2015 07:05:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:date :message-id:in-reply-to:references:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=QRVPWq7rBvbupab/7eU0JK2GjO7tt1gCVLkaRR4uOrM=; b=V+3WYH4YXCnNcRa6bDe2xkq3ORfQH3FIfanbfGk/D2hXCtVcHCFPcyIxHDlGSAVyMG oxKrZPRz1XTR9rvxWKZbfPyYGAdYe+lGyjuVfoK0JKKz2HlDvMLKzMGH2JV88hBitPUY edDHTXD7QVFEvja4FikScFedb7p3+dIgJl04/pM9hTa+fUlyn3ZPW1B48VzTfiAL/j44 U4LSDSOEzdeYZg2m6EdOnXTf4wSEYMuSVZ5ACNylc4y/VcmrOo4iIieEWlwVsw4a/l8Q HxFPhlQhRvlVDuSpU48hj/l74u8BsJVy4G8bE7yTAwQdjOpgCAZjgmgBrMYVfwS5OjPJ JoGg== X-Gm-Message-State: ALoCoQmw5abQYnlgeOAIQc3yuLP7PF6VYoTZMw+tDA0iIdh29+hzrLLBLDFCsOFvn1E4DA6RnYoA X-Received: by 10.112.57.194 with SMTP id k2mr3088626lbq.10.1442239504009; Mon, 14 Sep 2015 07:05:04 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.5.202 with SMTP id u10ls646099lau.23.gmail; Mon, 14 Sep 2015 07:05:03 -0700 (PDT) X-Received: by 10.112.180.65 with SMTP id dm1mr1794637lbc.90.1442239503703; Mon, 14 Sep 2015 07:05:03 -0700 (PDT) Received: from mail-la0-f49.google.com (mail-la0-f49.google.com. [209.85.215.49]) by mx.google.com with ESMTPS id rc5si9828574lac.42.2015.09.14.07.05.03 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Sep 2015 07:05:03 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) client-ip=209.85.215.49; Received: by lahg1 with SMTP id g1so57665078lah.1 for ; Mon, 14 Sep 2015 07:05:03 -0700 (PDT) X-Received: by 10.112.168.66 with SMTP id zu2mr14159819lbb.29.1442239503586; Mon, 14 Sep 2015 07:05:03 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp1218793lbq; Mon, 14 Sep 2015 07:05:01 -0700 (PDT) X-Received: by 10.107.3.170 with SMTP id e42mr24137451ioi.72.1442239501842; Mon, 14 Sep 2015 07:05:01 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id r32si9287498ioe.69.2015.09.14.07.05.01 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 14 Sep 2015 07:05:01 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:41075 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZbUNQ-0006xS-Pg for patch@linaro.org; Mon, 14 Sep 2015 10:05:00 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54871) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZbUCG-0004pO-5S for qemu-devel@nongnu.org; Mon, 14 Sep 2015 09:53:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZbUCB-0000Dt-5Q for qemu-devel@nongnu.org; Mon, 14 Sep 2015 09:53:28 -0400 Received: from mnementh.archaic.org.uk ([2001:8b0:1d0::1]:35073) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZbUCA-00005c-VI for qemu-devel@nongnu.org; Mon, 14 Sep 2015 09:53:23 -0400 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1ZbUBz-0007tA-N3 for qemu-devel@nongnu.org; Mon, 14 Sep 2015 14:53:11 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Mon, 14 Sep 2015 14:52:56 +0100 Message-Id: <1442238791-30255-10-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1442238791-30255-1-git-send-email-peter.maydell@linaro.org> References: <1442238791-30255-1-git-send-email-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:8b0:1d0::1 Subject: [Qemu-devel] [PULL 09/24] target-arm: Recognize SXTB, SXTH, SXTW, ASR X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: peter.maydell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: Richard Henderson These are all special case aliases of SBFM. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 1441909103-24666-8-git-send-email-rth@twiddle.net Signed-off-by: Peter Maydell --- target-arm/translate-a64.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/target-arm/translate-a64.c b/target-arm/translate-a64.c index d17ca19..8ae6814 100644 --- a/target-arm/translate-a64.c +++ b/target-arm/translate-a64.c @@ -3017,7 +3017,28 @@ static void disas_bitfield(DisasContext *s, uint32_t insn) tcg_rd = cpu_reg(s, rd); tcg_tmp = read_cpu_reg(s, rn, sf); - /* OPTME: probably worth recognizing common cases of ext{8,16,32}{u,s} */ + /* Recognize the common aliases. */ + if (opc == 0) { /* SBFM */ + if (ri == 0) { + if (si == 7) { /* SXTB */ + tcg_gen_ext8s_i64(tcg_rd, tcg_tmp); + goto done; + } else if (si == 15) { /* SXTH */ + tcg_gen_ext16s_i64(tcg_rd, tcg_tmp); + goto done; + } else if (si == 31) { /* SXTW */ + tcg_gen_ext32s_i64(tcg_rd, tcg_tmp); + goto done; + } + } + if (si == 63 || (si == 31 && ri <= si)) { /* ASR */ + if (si == 31) { + tcg_gen_ext32s_i64(tcg_tmp, tcg_tmp); + } + tcg_gen_sari_i64(tcg_rd, tcg_tmp, ri); + goto done; + } + } if (opc != 1) { /* SBFM or UBFM */ tcg_gen_movi_i64(tcg_rd, 0); @@ -3042,6 +3063,7 @@ static void disas_bitfield(DisasContext *s, uint32_t insn) tcg_gen_sari_i64(tcg_rd, tcg_rd, 64 - (pos + len)); } + done: if (!sf) { /* zero extend final result */ tcg_gen_ext32u_i64(tcg_rd, tcg_rd); }