Commit dfa1a3f1c40b120e863cd56605ddbec276569bcd
1 parent
84aafb06
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
Showing
1 changed file
with
5 additions
and
8 deletions
tcg/tcg-op.h
@@ -1207,16 +1207,13 @@ static inline void tcg_gen_bswap16_i32(TCGv_i32 ret, TCGv_i32 arg) | @@ -1207,16 +1207,13 @@ static inline void tcg_gen_bswap16_i32(TCGv_i32 ret, TCGv_i32 arg) | ||
1207 | #ifdef TCG_TARGET_HAS_bswap16_i32 | 1207 | #ifdef TCG_TARGET_HAS_bswap16_i32 |
1208 | tcg_gen_op2_i32(INDEX_op_bswap16_i32, ret, arg); | 1208 | tcg_gen_op2_i32(INDEX_op_bswap16_i32, ret, arg); |
1209 | #else | 1209 | #else |
1210 | - TCGv_i32 t0, t1; | ||
1211 | - t0 = tcg_temp_new_i32(); | ||
1212 | - t1 = tcg_temp_new_i32(); | 1210 | + TCGv_i32 t0 = tcg_temp_new_i32(); |
1213 | 1211 | ||
1214 | - tcg_gen_shri_i32(t0, arg, 8); | ||
1215 | - tcg_gen_andi_i32(t1, arg, 0x000000ff); | ||
1216 | - tcg_gen_shli_i32(t1, t1, 8); | ||
1217 | - tcg_gen_or_i32(ret, t0, t1); | 1212 | + tcg_gen_ext8u_i32(t0, arg); |
1213 | + tcg_gen_shli_i32(t0, t0, 8); | ||
1214 | + tcg_gen_shri_i32(ret, arg, 8); | ||
1215 | + tcg_gen_or_i32(ret, ret, t0); | ||
1218 | tcg_temp_free_i32(t0); | 1216 | tcg_temp_free_i32(t0); |
1219 | - tcg_temp_free_i32(t1); | ||
1220 | #endif | 1217 | #endif |
1221 | } | 1218 | } |
1222 | 1219 |