From 5a37b8c28e6166fe91f12e0b0e822a53cc246235 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 4 Feb 2018 14:51:46 -0500 Subject: [PATCH] Backport optimizations to AArch32's REV16 handling Backports commit 68cedf733ae32363ccf54f0b52c8a424d5ec98ed from qemu --- qemu/target-arm/translate.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/qemu/target-arm/translate.c b/qemu/target-arm/translate.c index 27527811..aa79f3d9 100644 --- a/qemu/target-arm/translate.c +++ b/qemu/target-arm/translate.c @@ -248,11 +248,13 @@ static void gen_rev16(DisasContext *s, TCGv_i32 var) { TCGContext *tcg_ctx = s->uc->tcg_ctx; TCGv_i32 tmp = tcg_temp_new_i32(tcg_ctx); + TCGv_i32 mask = tcg_const_i32(tcg_ctx, 0x00ff00ff); tcg_gen_shri_i32(tcg_ctx, tmp, var, 8); - tcg_gen_andi_i32(tcg_ctx, tmp, tmp, 0x00ff00ff); + tcg_gen_and_i32(tcg_ctx, tmp, tmp, mask); + tcg_gen_and_i32(tcg_ctx, var, var, mask); tcg_gen_shli_i32(tcg_ctx, var, var, 8); - tcg_gen_andi_i32(tcg_ctx, var, var, 0xff00ff00); tcg_gen_or_i32(tcg_ctx, var, var, tmp); + tcg_temp_free_i32(tcg_ctx, mask); tcg_temp_free_i32(tcg_ctx, tmp); }