Commit 6359706f9384d9d50fbd0ba92df18d3da5d7ed96
1 parent
0cfe58cd
tcg-ops.h: _i64 TCG immediate instructions cleanup
Move addi_i64, muli_i64 and subi_i64 out of #if TCG_TARGET_REG_BITS as both implementations are strictly identical. Use the same optimisation (ie when imm == 0) for addi_i64 and subi_64 than the 32-bit version. Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5598 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
31 additions
and
42 deletions
tcg/tcg-op.h
... | ... | @@ -673,26 +673,12 @@ static inline void tcg_gen_add_i64(TCGv ret, TCGv arg1, TCGv arg2) |
673 | 673 | arg1, TCGV_HIGH(arg1), arg2, TCGV_HIGH(arg2)); |
674 | 674 | } |
675 | 675 | |
676 | -static inline void tcg_gen_addi_i64(TCGv ret, TCGv arg1, int64_t arg2) | |
677 | -{ | |
678 | - TCGv t0 = tcg_const_i64(arg2); | |
679 | - tcg_gen_add_i64(ret, arg1, t0); | |
680 | - tcg_temp_free(t0); | |
681 | -} | |
682 | - | |
683 | 676 | static inline void tcg_gen_sub_i64(TCGv ret, TCGv arg1, TCGv arg2) |
684 | 677 | { |
685 | 678 | tcg_gen_op6(INDEX_op_sub2_i32, ret, TCGV_HIGH(ret), |
686 | 679 | arg1, TCGV_HIGH(arg1), arg2, TCGV_HIGH(arg2)); |
687 | 680 | } |
688 | 681 | |
689 | -static inline void tcg_gen_subi_i64(TCGv ret, TCGv arg1, int64_t arg2) | |
690 | -{ | |
691 | - TCGv t0 = tcg_const_i64(arg2); | |
692 | - tcg_gen_sub_i64(ret, arg1, t0); | |
693 | - tcg_temp_free(t0); | |
694 | -} | |
695 | - | |
696 | 682 | static inline void tcg_gen_and_i64(TCGv ret, TCGv arg1, TCGv arg2) |
697 | 683 | { |
698 | 684 | tcg_gen_and_i32(ret, arg1, arg2); |
... | ... | @@ -788,13 +774,6 @@ static inline void tcg_gen_mul_i64(TCGv ret, TCGv arg1, TCGv arg2) |
788 | 774 | tcg_temp_free(t1); |
789 | 775 | } |
790 | 776 | |
791 | -static inline void tcg_gen_muli_i64(TCGv ret, TCGv arg1, int64_t arg2) | |
792 | -{ | |
793 | - TCGv t0 = tcg_const_i64(arg2); | |
794 | - tcg_gen_mul_i64(ret, arg1, t0); | |
795 | - tcg_temp_free(t0); | |
796 | -} | |
797 | - | |
798 | 777 | static inline void tcg_gen_div_i64(TCGv ret, TCGv arg1, TCGv arg2) |
799 | 778 | { |
800 | 779 | tcg_gen_helper_1_2(tcg_helper_div_i64, ret, arg1, arg2); |
... | ... | @@ -897,25 +876,11 @@ static inline void tcg_gen_add_i64(TCGv ret, TCGv arg1, TCGv arg2) |
897 | 876 | tcg_gen_op3(INDEX_op_add_i64, ret, arg1, arg2); |
898 | 877 | } |
899 | 878 | |
900 | -static inline void tcg_gen_addi_i64(TCGv ret, TCGv arg1, int64_t arg2) | |
901 | -{ | |
902 | - TCGv t0 = tcg_const_i64(arg2); | |
903 | - tcg_gen_add_i64(ret, arg1, t0); | |
904 | - tcg_temp_free(t0); | |
905 | -} | |
906 | - | |
907 | 879 | static inline void tcg_gen_sub_i64(TCGv ret, TCGv arg1, TCGv arg2) |
908 | 880 | { |
909 | 881 | tcg_gen_op3(INDEX_op_sub_i64, ret, arg1, arg2); |
910 | 882 | } |
911 | 883 | |
912 | -static inline void tcg_gen_subi_i64(TCGv ret, TCGv arg1, int64_t arg2) | |
913 | -{ | |
914 | - TCGv t0 = tcg_const_i64(arg2); | |
915 | - tcg_gen_sub_i64(ret, arg1, t0); | |
916 | - tcg_temp_free(t0); | |
917 | -} | |
918 | - | |
919 | 884 | static inline void tcg_gen_and_i64(TCGv ret, TCGv arg1, TCGv arg2) |
920 | 885 | { |
921 | 886 | tcg_gen_op3(INDEX_op_and_i64, ret, arg1, arg2); |
... | ... | @@ -1011,13 +976,6 @@ static inline void tcg_gen_mul_i64(TCGv ret, TCGv arg1, TCGv arg2) |
1011 | 976 | tcg_gen_op3(INDEX_op_mul_i64, ret, arg1, arg2); |
1012 | 977 | } |
1013 | 978 | |
1014 | -static inline void tcg_gen_muli_i64(TCGv ret, TCGv arg1, int64_t arg2) | |
1015 | -{ | |
1016 | - TCGv t0 = tcg_const_i64(arg2); | |
1017 | - tcg_gen_mul_i64(ret, arg1, t0); | |
1018 | - tcg_temp_free(t0); | |
1019 | -} | |
1020 | - | |
1021 | 979 | #ifdef TCG_TARGET_HAS_div_i64 |
1022 | 980 | static inline void tcg_gen_div_i64(TCGv ret, TCGv arg1, TCGv arg2) |
1023 | 981 | { |
... | ... | @@ -1078,6 +1036,18 @@ static inline void tcg_gen_remu_i64(TCGv ret, TCGv arg1, TCGv arg2) |
1078 | 1036 | |
1079 | 1037 | #endif |
1080 | 1038 | |
1039 | +static inline void tcg_gen_addi_i64(TCGv ret, TCGv arg1, int64_t arg2) | |
1040 | +{ | |
1041 | + /* some cases can be optimized here */ | |
1042 | + if (arg2 == 0) { | |
1043 | + tcg_gen_mov_i64(ret, arg1); | |
1044 | + } else { | |
1045 | + TCGv t0 = tcg_const_i64(arg2); | |
1046 | + tcg_gen_add_i64(ret, arg1, t0); | |
1047 | + tcg_temp_free(t0); | |
1048 | + } | |
1049 | +} | |
1050 | + | |
1081 | 1051 | static inline void tcg_gen_brcondi_i64(int cond, TCGv arg1, int64_t arg2, |
1082 | 1052 | int label_index) |
1083 | 1053 | { |
... | ... | @@ -1086,6 +1056,25 @@ static inline void tcg_gen_brcondi_i64(int cond, TCGv arg1, int64_t arg2, |
1086 | 1056 | tcg_temp_free(t0); |
1087 | 1057 | } |
1088 | 1058 | |
1059 | +static inline void tcg_gen_muli_i64(TCGv ret, TCGv arg1, int64_t arg2) | |
1060 | +{ | |
1061 | + TCGv t0 = tcg_const_i64(arg2); | |
1062 | + tcg_gen_mul_i64(ret, arg1, t0); | |
1063 | + tcg_temp_free(t0); | |
1064 | +} | |
1065 | + | |
1066 | +static inline void tcg_gen_subi_i64(TCGv ret, TCGv arg1, int64_t arg2) | |
1067 | +{ | |
1068 | + /* some cases can be optimized here */ | |
1069 | + if (arg2 == 0) { | |
1070 | + tcg_gen_mov_i64(ret, arg1); | |
1071 | + } else { | |
1072 | + TCGv t0 = tcg_const_i64(arg2); | |
1073 | + tcg_gen_sub_i64(ret, arg1, t0); | |
1074 | + tcg_temp_free(t0); | |
1075 | + } | |
1076 | +} | |
1077 | + | |
1089 | 1078 | /***************************************/ |
1090 | 1079 | /* optional operations */ |
1091 | 1080 | ... | ... |