Received: from eggs.gnu.org ([2001:4830:134:3::10]:47256) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d91NJ-0006YZ-1B for qemu-devel@nongnu.org; Thu, 11 May 2017 23:36:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d91NF-0003dD-0p for qemu-devel@nongnu.org; Thu, 11 May 2017 23:36:16 -0400 Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Fri, 12 May 2017 00:35:40 -0300 Message-Id: <20170512033543.6789-3-f4bug@amsat.org> In-Reply-To: <20170512033543.6789-1-f4bug@amsat.org> References: <20170512033543.6789-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [Qemu-devel] [PATCH v3 2/5] target/arm: optimize rev16() using extract op List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, Peter Maydell , Aurelien Jarno , Richard Henderson , qemu-arm@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Patch created mechanically using Coccinelle script via: $ spatch --macro-file scripts/cocci-macro-file.h --in-place \ --sp-file scripts/coccinelle/tcg_gen_extract.cocci --dir target Signed-off-by: Philippe Mathieu-Daudé --- target/arm/translate-a64.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 24de30d92c..7ea130107e 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -4038,14 +4038,12 @@ static void handle_rev16(DisasContext *s, unsigned int sf, 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_extract_i64(tcg_tmp, tcg_rn, 16, 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_extract_i64(tcg_tmp, tcg_rn, 32, 0xffff); tcg_gen_bswap16_i64(tcg_tmp, tcg_tmp); tcg_gen_deposit_i64(tcg_rd, tcg_rd, tcg_tmp, 32, 16); -- 2.11.0