Commit 0045734ab789d0adea94c32efb60ed596e4853aa

Authored by aurel32
1 parent 6359706f

tcg-ops.h: add a subfi wrapper

Add a subfi (subtract from immediate) wrapper, useful for the PPC target.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5599 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 16 additions and 0 deletions
tcg/tcg-op.h
... ... @@ -377,6 +377,13 @@ static inline void tcg_gen_sub_i32(TCGv ret, TCGv arg1, TCGv arg2)
377 377 tcg_gen_op3(INDEX_op_sub_i32, ret, arg1, arg2);
378 378 }
379 379  
  380 +static inline void tcg_gen_subfi_i32(TCGv ret, int32_t arg1, TCGv arg2)
  381 +{
  382 + TCGv t0 = tcg_const_i32(arg1);
  383 + tcg_gen_sub_i32(ret, t0, arg2);
  384 + tcg_temp_free(t0);
  385 +}
  386 +
380 387 static inline void tcg_gen_subi_i32(TCGv ret, TCGv arg1, int32_t arg2)
381 388 {
382 389 /* some cases can be optimized here */
... ... @@ -1063,6 +1070,13 @@ static inline void tcg_gen_muli_i64(TCGv ret, TCGv arg1, int64_t arg2)
1063 1070 tcg_temp_free(t0);
1064 1071 }
1065 1072  
  1073 +static inline void tcg_gen_subfi_i64(TCGv ret, int64_t arg1, TCGv arg2)
  1074 +{
  1075 + TCGv t0 = tcg_const_i64(arg1);
  1076 + tcg_gen_sub_i64(ret, t0, arg2);
  1077 + tcg_temp_free(t0);
  1078 +}
  1079 +
1066 1080 static inline void tcg_gen_subi_i64(TCGv ret, TCGv arg1, int64_t arg2)
1067 1081 {
1068 1082 /* some cases can be optimized here */
... ... @@ -1725,6 +1739,7 @@ static inline void tcg_gen_qemu_st64(TCGv arg, TCGv addr, int mem_index)
1725 1739 #define tcg_gen_addi_tl tcg_gen_addi_i64
1726 1740 #define tcg_gen_sub_tl tcg_gen_sub_i64
1727 1741 #define tcg_gen_neg_tl tcg_gen_neg_i64
  1742 +#define tcg_gen_subfi_tl tcg_gen_subi_i64
1728 1743 #define tcg_gen_subi_tl tcg_gen_subi_i64
1729 1744 #define tcg_gen_and_tl tcg_gen_and_i64
1730 1745 #define tcg_gen_andi_tl tcg_gen_andi_i64
... ... @@ -1783,6 +1798,7 @@ static inline void tcg_gen_qemu_st64(TCGv arg, TCGv addr, int mem_index)
1783 1798 #define tcg_gen_addi_tl tcg_gen_addi_i32
1784 1799 #define tcg_gen_sub_tl tcg_gen_sub_i32
1785 1800 #define tcg_gen_neg_tl tcg_gen_neg_i32
  1801 +#define tcg_gen_subfi_tl tcg_gen_subfi_i32
1786 1802 #define tcg_gen_subi_tl tcg_gen_subi_i32
1787 1803 #define tcg_gen_and_tl tcg_gen_and_i32
1788 1804 #define tcg_gen_andi_tl tcg_gen_andi_i32
... ...