Commit 1ec6d2ea991a1605b9e0898aa9b6e0a2f56c6881

Authored by blueswir1
1 parent a98824ac

Use tcg_const_tl for zero constant


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4054 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 19 additions and 42 deletions
target-sparc/translate.c
... ... @@ -389,8 +389,7 @@ static inline void gen_cc_NZ(TCGv dst)
389 389  
390 390 l1 = gen_new_label();
391 391 l2 = gen_new_label();
392   - r_zero = tcg_temp_new(TCG_TYPE_TL);
393   - tcg_gen_movi_tl(r_zero, 0);
  392 + r_zero = tcg_const_tl(0);
394 393 tcg_gen_brcond_i32(TCG_COND_NE, dst, r_zero, l1);
395 394 tcg_gen_ori_i32(cpu_psr, cpu_psr, PSR_ZERO);
396 395 gen_set_label(l1);
... ... @@ -451,8 +450,7 @@ static inline void gen_cc_V_add(TCGv dst, TCGv src1, TCGv src2)
451 450 r_temp = tcg_temp_new(TCG_TYPE_TL);
452 451 r_temp2 = tcg_temp_new(TCG_TYPE_TL);
453 452 r_temp3 = tcg_temp_new(TCG_TYPE_TL);
454   - r_zero = tcg_temp_new(TCG_TYPE_TL);
455   - tcg_gen_movi_tl(r_zero, 0);
  453 + r_zero = tcg_const_tl(0);
456 454 tcg_gen_xor_tl(r_temp, src1, src2);
457 455 tcg_gen_xori_tl(r_temp, r_temp, -1);
458 456 tcg_gen_xor_tl(r_temp2, src1, dst);
... ... @@ -466,7 +464,6 @@ static inline void gen_cc_V_add(TCGv dst, TCGv src1, TCGv src2)
466 464 int l2;
467 465  
468 466 l2 = gen_new_label();
469   - tcg_gen_movi_tl(r_zero, 0);
470 467 tcg_gen_xor_tl(r_temp, src1, src2);
471 468 tcg_gen_xori_tl(r_temp, r_temp, -1);
472 469 tcg_gen_xor_tl(r_temp2, src1, dst);
... ... @@ -489,8 +486,7 @@ static inline void gen_add_tv(TCGv dst, TCGv src1, TCGv src2)
489 486 r_temp = tcg_temp_new(TCG_TYPE_TL);
490 487 r_temp2 = tcg_temp_new(TCG_TYPE_TL);
491 488 r_temp3 = tcg_temp_new(TCG_TYPE_TL);
492   - r_zero = tcg_temp_new(TCG_TYPE_TL);
493   - tcg_gen_movi_tl(r_zero, 0);
  489 + r_zero = tcg_const_tl(0);
494 490 tcg_gen_xor_tl(r_temp, src1, src2);
495 491 tcg_gen_xori_tl(r_temp, r_temp, -1);
496 492 tcg_gen_xor_tl(r_temp2, src1, dst);
... ... @@ -504,7 +500,6 @@ static inline void gen_add_tv(TCGv dst, TCGv src1, TCGv src2)
504 500 int l2;
505 501  
506 502 l2 = gen_new_label();
507   - tcg_gen_movi_tl(r_zero, 0);
508 503 tcg_gen_xor_tl(r_temp, src1, src2);
509 504 tcg_gen_xori_tl(r_temp, r_temp, -1);
510 505 tcg_gen_xor_tl(r_temp2, src1, dst);
... ... @@ -523,9 +518,8 @@ static inline void gen_cc_V_tag(TCGv src1, TCGv src2)
523 518 TCGv r_zero, r_temp;
524 519  
525 520 l1 = gen_new_label();
526   - r_zero = tcg_temp_new(TCG_TYPE_TL);
  521 + r_zero = tcg_const_tl(0);
527 522 r_temp = tcg_temp_new(TCG_TYPE_TL);
528   - tcg_gen_movi_tl(r_zero, 0);
529 523 tcg_gen_or_tl(r_temp, src1, src2);
530 524 tcg_gen_andi_tl(r_temp, r_temp, 0x3);
531 525 tcg_gen_brcond_tl(TCG_COND_EQ, r_temp, r_zero, l1);
... ... @@ -539,9 +533,8 @@ static inline void gen_tag_tv(TCGv src1, TCGv src2)
539 533 TCGv r_zero, r_temp;
540 534  
541 535 l1 = gen_new_label();
542   - r_zero = tcg_temp_new(TCG_TYPE_TL);
  536 + r_zero = tcg_const_tl(0);
543 537 r_temp = tcg_temp_new(TCG_TYPE_TL);
544   - tcg_gen_movi_tl(r_zero, 0);
545 538 tcg_gen_or_tl(r_temp, src1, src2);
546 539 tcg_gen_andi_tl(r_temp, r_temp, 0x3);
547 540 tcg_gen_brcond_tl(TCG_COND_EQ, r_temp, r_zero, l1);
... ... @@ -632,8 +625,7 @@ static inline void gen_cc_V_sub(TCGv dst, TCGv src1, TCGv src2)
632 625 r_temp = tcg_temp_new(TCG_TYPE_TL);
633 626 r_temp2 = tcg_temp_new(TCG_TYPE_TL);
634 627 r_temp3 = tcg_temp_new(TCG_TYPE_TL);
635   - r_zero = tcg_temp_new(TCG_TYPE_TL);
636   - tcg_gen_movi_tl(r_zero, 0);
  628 + r_zero = tcg_const_tl(0);
637 629 tcg_gen_xor_tl(r_temp, src1, src2);
638 630 tcg_gen_xor_tl(r_temp2, src1, dst);
639 631 tcg_gen_and_tl(r_temp, r_temp, r_temp2);
... ... @@ -646,7 +638,6 @@ static inline void gen_cc_V_sub(TCGv dst, TCGv src1, TCGv src2)
646 638 int l2;
647 639  
648 640 l2 = gen_new_label();
649   - tcg_gen_movi_tl(r_zero, 0);
650 641 tcg_gen_xor_tl(r_temp, src1, src2);
651 642 tcg_gen_xor_tl(r_temp2, src1, dst);
652 643 tcg_gen_and_tl(r_temp, r_temp, r_temp2);
... ... @@ -668,8 +659,7 @@ static inline void gen_sub_tv(TCGv dst, TCGv src1, TCGv src2)
668 659 r_temp = tcg_temp_new(TCG_TYPE_TL);
669 660 r_temp2 = tcg_temp_new(TCG_TYPE_TL);
670 661 r_temp3 = tcg_temp_new(TCG_TYPE_TL);
671   - r_zero = tcg_temp_new(TCG_TYPE_TL);
672   - tcg_gen_movi_tl(r_zero, 0);
  662 + r_zero = tcg_const_tl(0);
673 663 tcg_gen_xor_tl(r_temp, src1, src2);
674 664 tcg_gen_xor_tl(r_temp2, src1, dst);
675 665 tcg_gen_and_tl(r_temp, r_temp, r_temp2);
... ... @@ -682,7 +672,6 @@ static inline void gen_sub_tv(TCGv dst, TCGv src1, TCGv src2)
682 672 int l2;
683 673  
684 674 l2 = gen_new_label();
685   - tcg_gen_movi_tl(r_zero, 0);
686 675 tcg_gen_xor_tl(r_temp, src1, src2);
687 676 tcg_gen_xor_tl(r_temp2, src1, dst);
688 677 tcg_gen_and_tl(r_temp, r_temp, r_temp2);
... ... @@ -747,8 +736,7 @@ static inline void gen_op_div_cc(void)
747 736 gen_cc_clear();
748 737 gen_cc_NZ(cpu_T[0]);
749 738 l1 = gen_new_label();
750   - r_zero = tcg_temp_new(TCG_TYPE_TL);
751   - tcg_gen_movi_tl(r_zero, 0);
  739 + r_zero = tcg_const_tl(0);
752 740 tcg_gen_brcond_i32(TCG_COND_EQ, cpu_T[1], r_zero, l1);
753 741 tcg_gen_ori_i32(cpu_psr, cpu_psr, PSR_OVF);
754 742 gen_set_label(l1);
... ... @@ -1084,8 +1072,7 @@ static inline void gen_branch2(DisasContext *dc, target_ulong pc1,
1084 1072 int l1;
1085 1073  
1086 1074 l1 = gen_new_label();
1087   - r_zero = tcg_temp_new(TCG_TYPE_TL);
1088   - tcg_gen_movi_tl(r_zero, 0);
  1075 + r_zero = tcg_const_tl(0);
1089 1076  
1090 1077 tcg_gen_brcond_tl(TCG_COND_EQ, r_cond, r_zero, l1);
1091 1078  
... ... @@ -1102,8 +1089,7 @@ static inline void gen_branch_a(DisasContext *dc, target_ulong pc1,
1102 1089 int l1;
1103 1090  
1104 1091 l1 = gen_new_label();
1105   - r_zero = tcg_temp_new(TCG_TYPE_TL);
1106   - tcg_gen_movi_tl(r_zero, 0);
  1092 + r_zero = tcg_const_tl(0);
1107 1093  
1108 1094 tcg_gen_brcond_tl(TCG_COND_EQ, r_cond, r_zero, l1);
1109 1095  
... ... @@ -1127,8 +1113,7 @@ static inline void gen_generic_branch(target_ulong npc1, target_ulong npc2,
1127 1113  
1128 1114 l1 = gen_new_label();
1129 1115 l2 = gen_new_label();
1130   - r_zero = tcg_temp_new(TCG_TYPE_TL);
1131   - tcg_gen_movi_tl(r_zero, 0);
  1116 + r_zero = tcg_const_tl(0);
1132 1117  
1133 1118 tcg_gen_brcond_tl(TCG_COND_EQ, r_cond, r_zero, l1);
1134 1119  
... ... @@ -1348,8 +1333,7 @@ static inline void gen_cond_reg(TCGv r_dst, int cond)
1348 1333 int l1;
1349 1334  
1350 1335 l1 = gen_new_label();
1351   - r_zero = tcg_temp_new(TCG_TYPE_TL);
1352   - tcg_gen_movi_tl(r_zero, 0);
  1336 + r_zero = tcg_const_tl(0);
1353 1337 tcg_gen_mov_tl(r_dst, r_zero);
1354 1338 tcg_gen_brcond_tl(gen_tcg_cond_reg[cond], cpu_T[0], r_zero, l1);
1355 1339 tcg_gen_movi_tl(r_dst, 1);
... ... @@ -2658,11 +2642,10 @@ static void disas_sparc_insn(DisasContext * dc)
2658 2642 int l1;
2659 2643  
2660 2644 l1 = gen_new_label();
2661   - r_zero = tcg_temp_new(TCG_TYPE_TL);
  2645 + r_zero = tcg_const_tl(0);
2662 2646 cond = GET_FIELD_SP(insn, 14, 17);
2663 2647 rs1 = GET_FIELD(insn, 13, 17);
2664 2648 gen_movl_reg_T0(rs1);
2665   - tcg_gen_movi_tl(r_zero, 0);
2666 2649 tcg_gen_brcond_tl(gen_tcg_cond_reg[cond], cpu_T[0], r_zero, l1);
2667 2650 gen_op_load_fpr_FT0(rs2);
2668 2651 gen_op_store_FT0_fpr(rd);
... ... @@ -2673,11 +2656,10 @@ static void disas_sparc_insn(DisasContext * dc)
2673 2656 int l1;
2674 2657  
2675 2658 l1 = gen_new_label();
2676   - r_zero = tcg_temp_new(TCG_TYPE_TL);
  2659 + r_zero = tcg_const_tl(0);
2677 2660 cond = GET_FIELD_SP(insn, 14, 17);
2678 2661 rs1 = GET_FIELD(insn, 13, 17);
2679 2662 gen_movl_reg_T0(rs1);
2680   - tcg_gen_movi_tl(r_zero, 0);
2681 2663 tcg_gen_brcond_tl(gen_tcg_cond_reg[cond], cpu_T[0], r_zero, l1);
2682 2664 gen_op_load_fpr_DT0(DFPREG(rs2));
2683 2665 gen_op_store_DT0_fpr(DFPREG(rd));
... ... @@ -2689,11 +2671,10 @@ static void disas_sparc_insn(DisasContext * dc)
2689 2671 int l1;
2690 2672  
2691 2673 l1 = gen_new_label();
2692   - r_zero = tcg_temp_new(TCG_TYPE_TL);
  2674 + r_zero = tcg_const_tl(0);
2693 2675 cond = GET_FIELD_SP(insn, 14, 17);
2694 2676 rs1 = GET_FIELD(insn, 13, 17);
2695 2677 gen_movl_reg_T0(rs1);
2696   - tcg_gen_movi_tl(r_zero, 0);
2697 2678 tcg_gen_brcond_tl(gen_tcg_cond_reg[cond], cpu_T[0], r_zero, l1);
2698 2679 gen_op_load_fpr_QT0(QFPREG(rs2));
2699 2680 gen_op_store_QT0_fpr(QFPREG(rd));
... ... @@ -2712,9 +2693,8 @@ static void disas_sparc_insn(DisasContext * dc)
2712 2693 int l1; \
2713 2694 \
2714 2695 l1 = gen_new_label(); \
2715   - r_zero = tcg_temp_new(TCG_TYPE_TL); \
  2696 + r_zero = tcg_const_tl(0); \
2716 2697 r_cond = tcg_temp_new(TCG_TYPE_TL); \
2717   - tcg_gen_movi_tl(r_zero, 0); \
2718 2698 cond = GET_FIELD_SP(insn, 14, 17); \
2719 2699 gen_fcond(r_cond, fcc, cond); \
2720 2700 tcg_gen_brcond_tl(TCG_COND_EQ, r_cond, r_zero, l1); \
... ... @@ -2781,9 +2761,8 @@ static void disas_sparc_insn(DisasContext * dc)
2781 2761 int l1; \
2782 2762 \
2783 2763 l1 = gen_new_label(); \
2784   - r_zero = tcg_temp_new(TCG_TYPE_TL); \
  2764 + r_zero = tcg_const_tl(0); \
2785 2765 r_cond = tcg_temp_new(TCG_TYPE_TL); \
2786   - tcg_gen_movi_tl(r_zero, 0); \
2787 2766 cond = GET_FIELD_SP(insn, 14, 17); \
2788 2767 gen_cond(r_cond, icc, cond); \
2789 2768 tcg_gen_brcond_tl(TCG_COND_EQ, r_cond, r_zero, l1); \
... ... @@ -3441,8 +3420,7 @@ static void disas_sparc_insn(DisasContext * dc)
3441 3420  
3442 3421 l1 = gen_new_label();
3443 3422  
3444   - r_zero = tcg_temp_new(TCG_TYPE_TL);
3445   - tcg_gen_movi_tl(r_zero, 0);
  3423 + r_zero = tcg_const_tl(0);
3446 3424 tcg_gen_brcond_tl(TCG_COND_EQ, cpu_T[2], r_zero, l1);
3447 3425 if (IS_IMM) { /* immediate */
3448 3426 rs2 = GET_FIELD_SPs(insn, 0, 10);
... ... @@ -3485,8 +3463,7 @@ static void disas_sparc_insn(DisasContext * dc)
3485 3463  
3486 3464 l1 = gen_new_label();
3487 3465  
3488   - r_zero = tcg_temp_new(TCG_TYPE_TL);
3489   - tcg_gen_movi_tl(r_zero, 0);
  3466 + r_zero = tcg_const_tl(0);
3490 3467 tcg_gen_brcond_tl(gen_tcg_cond_reg[cond], cpu_T[0], r_zero, l1);
3491 3468 if (IS_IMM) { /* immediate */
3492 3469 rs2 = GET_FIELD_SPs(insn, 0, 9);
... ...