Commit 719f66a770f18c07a14935e418e339b462571f36
1 parent
dc1a6971
Optimize cmp x, 0 case
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Showing
1 changed file
with
19 additions
and
14 deletions
target-sparc/translate.c
... | ... | @@ -431,6 +431,18 @@ static inline void gen_cc_V_tag(TCGv src1, TCGv src2) |
431 | 431 | gen_set_label(l1); |
432 | 432 | } |
433 | 433 | |
434 | +static inline void gen_op_logic_cc(TCGv dst) | |
435 | +{ | |
436 | + tcg_gen_mov_tl(cpu_cc_dst, dst); | |
437 | + | |
438 | + gen_cc_clear_icc(); | |
439 | + gen_cc_NZ_icc(cpu_cc_dst); | |
440 | +#ifdef TARGET_SPARC64 | |
441 | + gen_cc_clear_xcc(); | |
442 | + gen_cc_NZ_xcc(cpu_cc_dst); | |
443 | +#endif | |
444 | +} | |
445 | + | |
434 | 446 | static inline void gen_tag_tv(TCGv src1, TCGv src2) |
435 | 447 | { |
436 | 448 | int l1; |
... | ... | @@ -669,8 +681,13 @@ static inline void gen_op_subi_cc(TCGv dst, TCGv src1, target_long src2) |
669 | 681 | { |
670 | 682 | tcg_gen_mov_tl(cpu_cc_src, src1); |
671 | 683 | tcg_gen_movi_tl(cpu_cc_src2, src2); |
672 | - tcg_gen_subi_tl(cpu_cc_dst, cpu_cc_src, src2); | |
673 | - gen_op_sub_cc2(dst); | |
684 | + if (src2 == 0) { | |
685 | + tcg_gen_mov_tl(dst, src1); | |
686 | + gen_op_logic_cc(dst); | |
687 | + } else { | |
688 | + tcg_gen_subi_tl(cpu_cc_dst, cpu_cc_src, src2); | |
689 | + gen_op_sub_cc2(dst); | |
690 | + } | |
674 | 691 | } |
675 | 692 | |
676 | 693 | 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) |
906 | 923 | gen_set_label(l1); |
907 | 924 | } |
908 | 925 | |
909 | -static inline void gen_op_logic_cc(TCGv dst) | |
910 | -{ | |
911 | - tcg_gen_mov_tl(cpu_cc_dst, dst); | |
912 | - | |
913 | - gen_cc_clear_icc(); | |
914 | - gen_cc_NZ_icc(cpu_cc_dst); | |
915 | -#ifdef TARGET_SPARC64 | |
916 | - gen_cc_clear_xcc(); | |
917 | - gen_cc_NZ_xcc(cpu_cc_dst); | |
918 | -#endif | |
919 | -} | |
920 | - | |
921 | 926 | // 1 |
922 | 927 | static inline void gen_op_eval_ba(TCGv dst) |
923 | 928 | { | ... | ... |