diff options
author | Blue Swirl <blauwirbel@gmail.com> | 2009-05-03 18:51:27 +0000 |
---|---|---|
committer | Blue Swirl <blauwirbel@gmail.com> | 2009-05-03 18:51:27 +0000 |
commit | 78b23717c6e5a395f7b4dfac8a30947ef0941634 (patch) | |
tree | 7554bafaff1d156efb4875cefb3c9cd32143d2d4 /target-sparc | |
parent | e74519d29f651b944931d8acc900d98860a159b9 (diff) | |
download | qemu-78b23717c6e5a395f7b4dfac8a30947ef0941634.tar.gz qemu-78b23717c6e5a395f7b4dfac8a30947ef0941634.tar.bz2 qemu-78b23717c6e5a395f7b4dfac8a30947ef0941634.zip |
Optimize cmp x, 0 case
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'target-sparc')
-rw-r--r-- | target-sparc/translate.c | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/target-sparc/translate.c b/target-sparc/translate.c index f095b9bc54..ae93614cc3 100644 --- a/target-sparc/translate.c +++ b/target-sparc/translate.c @@ -431,6 +431,18 @@ static inline void gen_cc_V_tag(TCGv src1, TCGv src2) gen_set_label(l1); } +static inline void gen_op_logic_cc(TCGv dst) +{ + tcg_gen_mov_tl(cpu_cc_dst, dst); + + gen_cc_clear_icc(); + gen_cc_NZ_icc(cpu_cc_dst); +#ifdef TARGET_SPARC64 + gen_cc_clear_xcc(); + gen_cc_NZ_xcc(cpu_cc_dst); +#endif +} + static inline void gen_tag_tv(TCGv src1, TCGv src2) { int l1; @@ -669,8 +681,13 @@ static inline void gen_op_subi_cc(TCGv dst, TCGv src1, target_long src2) { tcg_gen_mov_tl(cpu_cc_src, src1); tcg_gen_movi_tl(cpu_cc_src2, src2); - tcg_gen_subi_tl(cpu_cc_dst, cpu_cc_src, src2); - gen_op_sub_cc2(dst); + if (src2 == 0) { + tcg_gen_mov_tl(dst, src1); + gen_op_logic_cc(dst); + } else { + tcg_gen_subi_tl(cpu_cc_dst, cpu_cc_src, src2); + gen_op_sub_cc2(dst); + } } static inline void gen_op_sub_cc(TCGv dst, TCGv src1, TCGv src2) @@ -906,18 +923,6 @@ static inline void gen_op_div_cc(TCGv dst) gen_set_label(l1); } -static inline void gen_op_logic_cc(TCGv dst) -{ - tcg_gen_mov_tl(cpu_cc_dst, dst); - - gen_cc_clear_icc(); - gen_cc_NZ_icc(cpu_cc_dst); -#ifdef TARGET_SPARC64 - gen_cc_clear_xcc(); - gen_cc_NZ_xcc(cpu_cc_dst); -#endif -} - // 1 static inline void gen_op_eval_ba(TCGv dst) { |