summaryrefslogtreecommitdiff
path: root/tcg
diff options
context:
space:
mode:
authoraurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162>2009-03-13 09:35:03 +0000
committeraurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162>2009-03-13 09:35:03 +0000
commit7b3fb78b0179e3612f7f08fb3654cd85fb486a08 (patch)
tree931e4e513e60d5688c8ba53b962ddd4d0485e8d2 /tcg
parent6f36f10ba2adf0ae73206f0208941b53206c2230 (diff)
downloadqemu-7b3fb78b0179e3612f7f08fb3654cd85fb486a08.tar.gz
qemu-7b3fb78b0179e3612f7f08fb3654cd85fb486a08.tar.bz2
qemu-7b3fb78b0179e3612f7f08fb3654cd85fb486a08.zip
tcg: optimize tcg_gen_bswap16_i32
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6831 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'tcg')
-rw-r--r--tcg/tcg-op.h13
1 files changed, 5 insertions, 8 deletions
diff --git a/tcg/tcg-op.h b/tcg/tcg-op.h
index fa0f01cdd3..c413b28bdc 100644
--- a/tcg/tcg-op.h
+++ b/tcg/tcg-op.h
@@ -1207,16 +1207,13 @@ static inline void tcg_gen_bswap16_i32(TCGv_i32 ret, TCGv_i32 arg)
#ifdef TCG_TARGET_HAS_bswap16_i32
tcg_gen_op2_i32(INDEX_op_bswap16_i32, ret, arg);
#else
- TCGv_i32 t0, t1;
- t0 = tcg_temp_new_i32();
- t1 = tcg_temp_new_i32();
+ TCGv_i32 t0 = tcg_temp_new_i32();
- tcg_gen_shri_i32(t0, arg, 8);
- tcg_gen_andi_i32(t1, arg, 0x000000ff);
- tcg_gen_shli_i32(t1, t1, 8);
- tcg_gen_or_i32(ret, t0, t1);
+ tcg_gen_ext8u_i32(t0, arg);
+ tcg_gen_shli_i32(t0, t0, 8);
+ tcg_gen_shri_i32(ret, arg, 8);
+ tcg_gen_or_i32(ret, ret, t0);
tcg_temp_free_i32(t0);
- tcg_temp_free_i32(t1);
#endif
}