From patchwork Mon Sep 14 13:52:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 53574 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by patches.linaro.org (Postfix) with ESMTPS id 5FB0D2056A for ; Mon, 14 Sep 2015 14:00:25 +0000 (UTC) Received: by wicuu12 with SMTP id uu12sf41772194wic.2 for ; Mon, 14 Sep 2015 07:00:24 -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=XglnceoSR7lmrUEbhK6XunlzCqu5mOdnBjUsq4CDtCM=; b=d5FQ2vNcL7FIPt2wHAsrhNZ7grg19myEoFsgG4MJcUPZzY74cClk6pocpxndZa5Cka txanOGYRofvVQN0W5Catxdy6fTaipCyZCI4qpH5IMjbbhB2y6OG+VpwygYGiV43ZKLEY p/fjF4EcpOwf1RANwD9W9UStBxgvEmSuLzmdH1hp4WugfrR7TI4W+JeKY+alGWpdgDnL BoN57lRbTBpcMNCJ7LFyBKHDgEkIBNbsM0xofFRbNiKvXwtjr+FUoxcnuTjCqDSojqkM PnosVBYXl2k7XxXvZTU2Bqfe5wsqtJoAkHaNhKBIhGF26UXyTXMVxuK0bPmKMNSgN0ui Gcsw== X-Gm-Message-State: ALoCoQlIt6rJ0JKNV+uyYxMSlOJlZVZwQSbQgP9UbT2VHDxN4pzjpS9yHwQpxDkDfdKiPo4BLwEl X-Received: by 10.152.6.201 with SMTP id d9mr2595199laa.6.1442239224660; Mon, 14 Sep 2015 07:00:24 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.9.66 with SMTP id x2ls580987laa.107.gmail; Mon, 14 Sep 2015 07:00:24 -0700 (PDT) X-Received: by 10.112.64.72 with SMTP id m8mr7331554lbs.41.1442239224288; Mon, 14 Sep 2015 07:00:24 -0700 (PDT) Received: from mail-la0-f52.google.com (mail-la0-f52.google.com. [209.85.215.52]) by mx.google.com with ESMTPS id u9si9805461lbw.89.2015.09.14.07.00.23 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Sep 2015 07:00:23 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.52 as permitted sender) client-ip=209.85.215.52; Received: by lahg1 with SMTP id g1so57556726lah.1 for ; Mon, 14 Sep 2015 07:00:23 -0700 (PDT) X-Received: by 10.112.146.104 with SMTP id tb8mr12106626lbb.35.1442239223866; Mon, 14 Sep 2015 07:00:23 -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 w3csp1216110lbq; Mon, 14 Sep 2015 07:00:21 -0700 (PDT) X-Received: by 10.107.38.210 with SMTP id m201mr27050926iom.98.1442239221095; Mon, 14 Sep 2015 07:00:21 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [208.118.235.17]) by mx.google.com with ESMTPS id nv10si1088340igb.87.2015.09.14.07.00.20 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 14 Sep 2015 07:00:21 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; Received: from localhost ([::1]:41031 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZbUIt-0007LS-JU for patch@linaro.org; Mon, 14 Sep 2015 10:00:19 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54728) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZbUCB-0004h9-7i for qemu-devel@nongnu.org; Mon, 14 Sep 2015 09:53:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZbUCA-0000DC-CS for qemu-devel@nongnu.org; Mon, 14 Sep 2015 09:53:23 -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-6H for qemu-devel@nongnu.org; Mon, 14 Sep 2015 09:53:22 -0400 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1ZbUBz-0007tP-Se 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:59 +0100 Message-Id: <1442238791-30255-13-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 12/24] target-arm: Recognize ROR 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.52 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 Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 1441909103-24666-11-git-send-email-rth@twiddle.net Signed-off-by: Peter Maydell --- target-arm/translate-a64.c | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/target-arm/translate-a64.c b/target-arm/translate-a64.c index 3ab0b42..04e7479 100644 --- a/target-arm/translate-a64.c +++ b/target-arm/translate-a64.c @@ -3117,17 +3117,7 @@ static void disas_extract(DisasContext *s, uint32_t insn) tcg_rd = cpu_reg(s, rd); - if (imm) { - /* OPTME: we can special case rm==rn as a rotate */ - tcg_rm = read_cpu_reg(s, rm, sf); - tcg_rn = read_cpu_reg(s, rn, sf); - tcg_gen_shri_i64(tcg_rm, tcg_rm, imm); - tcg_gen_shli_i64(tcg_rn, tcg_rn, bitsize - imm); - tcg_gen_or_i64(tcg_rd, tcg_rm, tcg_rn); - if (!sf) { - tcg_gen_ext32u_i64(tcg_rd, tcg_rd); - } - } else { + if (unlikely(imm == 0)) { /* tcg shl_i32/shl_i64 is undefined for 32/64 bit shifts, * so an extract from bit 0 is a special case. */ @@ -3136,8 +3126,27 @@ static void disas_extract(DisasContext *s, uint32_t insn) } else { tcg_gen_ext32u_i64(tcg_rd, cpu_reg(s, rm)); } + } else if (rm == rn) { /* ROR */ + tcg_rm = cpu_reg(s, rm); + if (sf) { + tcg_gen_rotri_i64(tcg_rd, tcg_rm, imm); + } else { + TCGv_i32 tmp = tcg_temp_new_i32(); + tcg_gen_extrl_i64_i32(tmp, tcg_rm); + tcg_gen_rotri_i32(tmp, tmp, imm); + tcg_gen_extu_i32_i64(tcg_rd, tmp); + tcg_temp_free_i32(tmp); + } + } else { + tcg_rm = read_cpu_reg(s, rm, sf); + tcg_rn = read_cpu_reg(s, rn, sf); + tcg_gen_shri_i64(tcg_rm, tcg_rm, imm); + tcg_gen_shli_i64(tcg_rn, tcg_rn, bitsize - imm); + tcg_gen_or_i64(tcg_rd, tcg_rm, tcg_rn); + if (!sf) { + tcg_gen_ext32u_i64(tcg_rd, tcg_rd); + } } - } }