From patchwork Wed Jul 19 23:34:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 9853375 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3CFF660392 for ; Wed, 19 Jul 2017 23:42:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1CEC42870B for ; Wed, 19 Jul 2017 23:42:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1076E28705; Wed, 19 Jul 2017 23:42:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8D1B828705 for ; Wed, 19 Jul 2017 23:42:19 +0000 (UTC) Received: from localhost ([::1]:35410 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dXybi-0004U3-IT for patchwork-qemu-devel@patchwork.kernel.org; Wed, 19 Jul 2017 19:42:18 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33232) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dXyVa-0008AJ-Kf for qemu-devel@nongnu.org; Wed, 19 Jul 2017 19:35:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dXyVX-0006di-Gw for qemu-devel@nongnu.org; Wed, 19 Jul 2017 19:35:58 -0400 Received: from mail-qt0-x244.google.com ([2607:f8b0:400d:c0d::244]:33678) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dXyVX-0006dS-CH for qemu-devel@nongnu.org; Wed, 19 Jul 2017 19:35:55 -0400 Received: by mail-qt0-x244.google.com with SMTP id 50so1792746qtz.0 for ; Wed, 19 Jul 2017 16:35:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=S1EqYke6bHWeThh7NLjBieo6NVqpOk6KHa8GTKD4Stk=; b=GsTJtonznEvTbM17yPquP9FEi8rCQGSUYMjhTQAu/nnlQ0LW+OrTSwi5yvE/wYY6/x fJqpzCkIwYcamBthu9paOflNtQMsTWt+r6XU2bXenY9y4ePW+lebsjSusI724I2opuLK YWFKU8lFT6cFSMp7vSCDzZ7zLXXHv1hdetZH+IZdmQeN9eWKEIZLgMgVc94pp6jVdZYQ UN1Y3ZpUFKhK2vZE4r4en2Zq8kvgwSL0lDJUAsX2VnsX1yA3C04oCbScRAhQGHy7pVFU IlTu4VBE6h61edsS79DAhXjQShOn8vHrZ8qKIb+tZUEFVMrByBwSokr/I0DSdY+YrI+o SVNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=S1EqYke6bHWeThh7NLjBieo6NVqpOk6KHa8GTKD4Stk=; b=F1sIxyBOIwFj3ECQihPR6gA7stWUZqTAXuCqWLdJBwJcnGYqArm8+Y2fLuuzRj/aO4 rdNwqXP6+qnOU9+2ex+Eh+O4S0hzZTYfHDhpC5E2QSwoXTskNeOgOb7EcRZmr/O9Vimm YSV2dd9eOw2BV/Flk6SVIFMXAH1WukxFhK7CZfE4gY5bxRhVG6/r5K9Rov3rpOdBrl+p bpIhKydAMALlIBVbUQFAKe1z9QTeeH18vn4RmvBcD2CVnKFlYBcHc3zfmuuMRl8UqES4 n4eWr8RmN2ieHOrBxGrUFvwIY3QJ6RHBXMQYaQHzgkG6cOnPBvEytb37R5DnleNs7jMx xpHQ== X-Gm-Message-State: AIVw110yMyomd0OtdbtYQZ9+AI8RXg4J9T/T8MfqzeXuheChKQrKblh9 KzzRbhCWVa1Ap5L0FW4= X-Received: by 10.237.35.156 with SMTP id j28mr2523893qtc.284.1500507354677; Wed, 19 Jul 2017 16:35:54 -0700 (PDT) Received: from bigtime.com ([203.221.203.174]) by smtp.gmail.com with ESMTPSA id w33sm857130qth.96.2017.07.19.16.35.52 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 19 Jul 2017 16:35:54 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 19 Jul 2017 13:34:47 -1000 Message-Id: <20170719233455.8740-7-rth@twiddle.net> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20170719233455.8740-1-rth@twiddle.net> References: <20170719233455.8740-1-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c0d::244 Subject: [Qemu-devel] [PULL v2 06/14] target/arm: Optimize aarch64 rev16 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP It is much shorter to reverse all 4 half-words in parallel than extract, reverse, and deposit each in turn. Suggested-by: Aurelien Jarno Signed-off-by: Richard Henderson --- target/arm/translate-a64.c | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 3fa39023ca..5bb0f8ef22 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -4043,25 +4043,13 @@ static void handle_rev16(DisasContext *s, unsigned int sf, TCGv_i64 tcg_rd = cpu_reg(s, rd); TCGv_i64 tcg_tmp = tcg_temp_new_i64(); TCGv_i64 tcg_rn = read_cpu_reg(s, rn, sf); + TCGv_i64 mask = tcg_const_i64(sf ? 0x00ff00ff00ff00ffull : 0x00ff00ff); - tcg_gen_andi_i64(tcg_tmp, tcg_rn, 0xffff); - tcg_gen_bswap16_i64(tcg_rd, tcg_tmp); - - tcg_gen_shri_i64(tcg_tmp, tcg_rn, 16); - tcg_gen_andi_i64(tcg_tmp, tcg_tmp, 0xffff); - tcg_gen_bswap16_i64(tcg_tmp, tcg_tmp); - tcg_gen_deposit_i64(tcg_rd, tcg_rd, tcg_tmp, 16, 16); - - if (sf) { - tcg_gen_shri_i64(tcg_tmp, tcg_rn, 32); - tcg_gen_andi_i64(tcg_tmp, tcg_tmp, 0xffff); - tcg_gen_bswap16_i64(tcg_tmp, tcg_tmp); - tcg_gen_deposit_i64(tcg_rd, tcg_rd, tcg_tmp, 32, 16); - - tcg_gen_shri_i64(tcg_tmp, tcg_rn, 48); - tcg_gen_bswap16_i64(tcg_tmp, tcg_tmp); - tcg_gen_deposit_i64(tcg_rd, tcg_rd, tcg_tmp, 48, 16); - } + tcg_gen_shri_i64(tcg_tmp, tcg_rn, 8); + tcg_gen_and_i64(tcg_rd, tcg_rn, mask); + tcg_gen_and_i64(tcg_tmp, tcg_tmp, mask); + tcg_gen_shli_i64(tcg_rd, tcg_rd, 8); + tcg_gen_or_i64(tcg_rd, tcg_rd, tcg_tmp); tcg_temp_free_i64(tcg_tmp); }