Commit 34151a20ea237dd21dc1e39a0c25d715ed39d989
1 parent
c1c37968
small shift opts
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4525 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
30 additions
and
6 deletions
tcg/tcg-op.h
... | ... | @@ -404,7 +404,11 @@ static inline void tcg_gen_shl_i32(TCGv ret, TCGv arg1, TCGv arg2) |
404 | 404 | |
405 | 405 | static inline void tcg_gen_shli_i32(TCGv ret, TCGv arg1, int32_t arg2) |
406 | 406 | { |
407 | - tcg_gen_shl_i32(ret, arg1, tcg_const_i32(arg2)); | |
407 | + if (arg2 == 0) { | |
408 | + tcg_gen_mov_i32(ret, arg1); | |
409 | + } else { | |
410 | + tcg_gen_shl_i32(ret, arg1, tcg_const_i32(arg2)); | |
411 | + } | |
408 | 412 | } |
409 | 413 | |
410 | 414 | static inline void tcg_gen_shr_i32(TCGv ret, TCGv arg1, TCGv arg2) |
... | ... | @@ -414,7 +418,11 @@ static inline void tcg_gen_shr_i32(TCGv ret, TCGv arg1, TCGv arg2) |
414 | 418 | |
415 | 419 | static inline void tcg_gen_shri_i32(TCGv ret, TCGv arg1, int32_t arg2) |
416 | 420 | { |
417 | - tcg_gen_shr_i32(ret, arg1, tcg_const_i32(arg2)); | |
421 | + if (arg2 == 0) { | |
422 | + tcg_gen_mov_i32(ret, arg1); | |
423 | + } else { | |
424 | + tcg_gen_shr_i32(ret, arg1, tcg_const_i32(arg2)); | |
425 | + } | |
418 | 426 | } |
419 | 427 | |
420 | 428 | static inline void tcg_gen_sar_i32(TCGv ret, TCGv arg1, TCGv arg2) |
... | ... | @@ -424,7 +432,11 @@ static inline void tcg_gen_sar_i32(TCGv ret, TCGv arg1, TCGv arg2) |
424 | 432 | |
425 | 433 | static inline void tcg_gen_sari_i32(TCGv ret, TCGv arg1, int32_t arg2) |
426 | 434 | { |
427 | - tcg_gen_sar_i32(ret, arg1, tcg_const_i32(arg2)); | |
435 | + if (arg2 == 0) { | |
436 | + tcg_gen_mov_i32(ret, arg1); | |
437 | + } else { | |
438 | + tcg_gen_sar_i32(ret, arg1, tcg_const_i32(arg2)); | |
439 | + } | |
428 | 440 | } |
429 | 441 | |
430 | 442 | static inline void tcg_gen_brcond_i32(int cond, TCGv arg1, TCGv arg2, |
... | ... | @@ -862,7 +874,11 @@ static inline void tcg_gen_shl_i64(TCGv ret, TCGv arg1, TCGv arg2) |
862 | 874 | |
863 | 875 | static inline void tcg_gen_shli_i64(TCGv ret, TCGv arg1, int64_t arg2) |
864 | 876 | { |
865 | - tcg_gen_shl_i64(ret, arg1, tcg_const_i64(arg2)); | |
877 | + if (arg2 == 0) { | |
878 | + tcg_gen_mov_i64(ret, arg1); | |
879 | + } else { | |
880 | + tcg_gen_shl_i64(ret, arg1, tcg_const_i64(arg2)); | |
881 | + } | |
866 | 882 | } |
867 | 883 | |
868 | 884 | static inline void tcg_gen_shr_i64(TCGv ret, TCGv arg1, TCGv arg2) |
... | ... | @@ -872,7 +888,11 @@ static inline void tcg_gen_shr_i64(TCGv ret, TCGv arg1, TCGv arg2) |
872 | 888 | |
873 | 889 | static inline void tcg_gen_shri_i64(TCGv ret, TCGv arg1, int64_t arg2) |
874 | 890 | { |
875 | - tcg_gen_shr_i64(ret, arg1, tcg_const_i64(arg2)); | |
891 | + if (arg2 == 0) { | |
892 | + tcg_gen_mov_i64(ret, arg1); | |
893 | + } else { | |
894 | + tcg_gen_shr_i64(ret, arg1, tcg_const_i64(arg2)); | |
895 | + } | |
876 | 896 | } |
877 | 897 | |
878 | 898 | static inline void tcg_gen_sar_i64(TCGv ret, TCGv arg1, TCGv arg2) |
... | ... | @@ -882,7 +902,11 @@ static inline void tcg_gen_sar_i64(TCGv ret, TCGv arg1, TCGv arg2) |
882 | 902 | |
883 | 903 | static inline void tcg_gen_sari_i64(TCGv ret, TCGv arg1, int64_t arg2) |
884 | 904 | { |
885 | - tcg_gen_sar_i64(ret, arg1, tcg_const_i64(arg2)); | |
905 | + if (arg2 == 0) { | |
906 | + tcg_gen_mov_i64(ret, arg1); | |
907 | + } else { | |
908 | + tcg_gen_sar_i64(ret, arg1, tcg_const_i64(arg2)); | |
909 | + } | |
886 | 910 | } |
887 | 911 | |
888 | 912 | static inline void tcg_gen_brcond_i64(int cond, TCGv arg1, TCGv arg2, | ... | ... |