Commit 2fdbad255e73c7422dacd43bd0d2e627270104de

Authored by aurel32
1 parent 9507fb52

TCG fixes for target-mips

This patch fixes TCG errors reported on the MIPS target when TCG_DEBUG
is enabled.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Acked-by: Thiemo Seufer <ths@networkno.de>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5164 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 27 additions and 26 deletions
target-mips/translate.c
@@ -427,7 +427,8 @@ static TCGv cpu_env, bcond, btarget, current_fpu; @@ -427,7 +427,8 @@ static TCGv cpu_env, bcond, btarget, current_fpu;
427 427
428 #include "gen-icount.h" 428 #include "gen-icount.h"
429 429
430 -static inline void tcg_gen_helper_0_i(void *func, TCGv arg) 430 +static inline void tcg_gen_helper_0_i(void *func, uint32_t arg)
  431 +
431 { 432 {
432 TCGv tmp = tcg_const_i32(arg); 433 TCGv tmp = tcg_const_i32(arg);
433 434
@@ -435,7 +436,7 @@ static inline void tcg_gen_helper_0_i(void *func, TCGv arg) @@ -435,7 +436,7 @@ static inline void tcg_gen_helper_0_i(void *func, TCGv arg)
435 tcg_temp_free(tmp); 436 tcg_temp_free(tmp);
436 } 437 }
437 438
438 -static inline void tcg_gen_helper_0_ii(void *func, TCGv arg1, TCGv arg2) 439 +static inline void tcg_gen_helper_0_ii(void *func, uint32_t arg1, uint32_t arg2)
439 { 440 {
440 TCGv tmp1 = tcg_const_i32(arg1); 441 TCGv tmp1 = tcg_const_i32(arg1);
441 TCGv tmp2 = tcg_const_i32(arg2); 442 TCGv tmp2 = tcg_const_i32(arg2);
@@ -445,7 +446,7 @@ static inline void tcg_gen_helper_0_ii(void *func, TCGv arg1, TCGv arg2) @@ -445,7 +446,7 @@ static inline void tcg_gen_helper_0_ii(void *func, TCGv arg1, TCGv arg2)
445 tcg_temp_free(tmp2); 446 tcg_temp_free(tmp2);
446 } 447 }
447 448
448 -static inline void tcg_gen_helper_0_1i(void *func, TCGv arg1, TCGv arg2) 449 +static inline void tcg_gen_helper_0_1i(void *func, TCGv arg1, uint32_t arg2)
449 { 450 {
450 TCGv tmp = tcg_const_i32(arg2); 451 TCGv tmp = tcg_const_i32(arg2);
451 452
@@ -453,7 +454,7 @@ static inline void tcg_gen_helper_0_1i(void *func, TCGv arg1, TCGv arg2) @@ -453,7 +454,7 @@ static inline void tcg_gen_helper_0_1i(void *func, TCGv arg1, TCGv arg2)
453 tcg_temp_free(tmp); 454 tcg_temp_free(tmp);
454 } 455 }
455 456
456 -static inline void tcg_gen_helper_0_2i(void *func, TCGv arg1, TCGv arg2, TCGv arg3) 457 +static inline void tcg_gen_helper_0_2i(void *func, TCGv arg1, TCGv arg2, uint32_t arg3)
457 { 458 {
458 TCGv tmp = tcg_const_i32(arg3); 459 TCGv tmp = tcg_const_i32(arg3);
459 460
@@ -461,7 +462,7 @@ static inline void tcg_gen_helper_0_2i(void *func, TCGv arg1, TCGv arg2, TCGv ar @@ -461,7 +462,7 @@ static inline void tcg_gen_helper_0_2i(void *func, TCGv arg1, TCGv arg2, TCGv ar
461 tcg_temp_free(tmp); 462 tcg_temp_free(tmp);
462 } 463 }
463 464
464 -static inline void tcg_gen_helper_0_1ii(void *func, TCGv arg1, TCGv arg2, TCGv arg3) 465 +static inline void tcg_gen_helper_0_1ii(void *func, TCGv arg1, uint32_t arg2, uint32_t arg3)
465 { 466 {
466 TCGv tmp1 = tcg_const_i32(arg2); 467 TCGv tmp1 = tcg_const_i32(arg2);
467 TCGv tmp2 = tcg_const_i32(arg3); 468 TCGv tmp2 = tcg_const_i32(arg3);
@@ -471,7 +472,7 @@ static inline void tcg_gen_helper_0_1ii(void *func, TCGv arg1, TCGv arg2, TCGv a @@ -471,7 +472,7 @@ static inline void tcg_gen_helper_0_1ii(void *func, TCGv arg1, TCGv arg2, TCGv a
471 tcg_temp_free(tmp2); 472 tcg_temp_free(tmp2);
472 } 473 }
473 474
474 -static inline void tcg_gen_helper_1_i(void *func, TCGv ret, TCGv arg) 475 +static inline void tcg_gen_helper_1_i(void *func, TCGv ret, uint32_t arg)
475 { 476 {
476 TCGv tmp = tcg_const_i32(arg); 477 TCGv tmp = tcg_const_i32(arg);
477 478
@@ -479,7 +480,7 @@ static inline void tcg_gen_helper_1_i(void *func, TCGv ret, TCGv arg) @@ -479,7 +480,7 @@ static inline void tcg_gen_helper_1_i(void *func, TCGv ret, TCGv arg)
479 tcg_temp_free(tmp); 480 tcg_temp_free(tmp);
480 } 481 }
481 482
482 -static inline void tcg_gen_helper_1_1i(void *func, TCGv ret, TCGv arg1, TCGv arg2) 483 +static inline void tcg_gen_helper_1_1i(void *func, TCGv ret, TCGv arg1, uint32_t arg2)
483 { 484 {
484 TCGv tmp = tcg_const_i32(arg2); 485 TCGv tmp = tcg_const_i32(arg2);
485 486
@@ -487,7 +488,7 @@ static inline void tcg_gen_helper_1_1i(void *func, TCGv ret, TCGv arg1, TCGv arg @@ -487,7 +488,7 @@ static inline void tcg_gen_helper_1_1i(void *func, TCGv ret, TCGv arg1, TCGv arg
487 tcg_temp_free(tmp); 488 tcg_temp_free(tmp);
488 } 489 }
489 490
490 -static inline void tcg_gen_helper_1_1ii(void *func, TCGv ret, TCGv arg1, TCGv arg2, TCGv arg3) 491 +static inline void tcg_gen_helper_1_1ii(void *func, TCGv ret, TCGv arg1, uint32_t arg2, uint32_t arg3)
491 { 492 {
492 TCGv tmp1 = tcg_const_i32(arg2); 493 TCGv tmp1 = tcg_const_i32(arg2);
493 TCGv tmp2 = tcg_const_i32(arg3); 494 TCGv tmp2 = tcg_const_i32(arg3);
@@ -497,7 +498,7 @@ static inline void tcg_gen_helper_1_1ii(void *func, TCGv ret, TCGv arg1, TCGv ar @@ -497,7 +498,7 @@ static inline void tcg_gen_helper_1_1ii(void *func, TCGv ret, TCGv arg1, TCGv ar
497 tcg_temp_free(tmp2); 498 tcg_temp_free(tmp2);
498 } 499 }
499 500
500 -static inline void tcg_gen_helper_1_2i(void *func, TCGv ret, TCGv arg1, TCGv arg2, TCGv arg3) 501 +static inline void tcg_gen_helper_1_2i(void *func, TCGv ret, TCGv arg1, TCGv arg2, uint32_t arg3)
501 { 502 {
502 TCGv tmp = tcg_const_i32(arg3); 503 TCGv tmp = tcg_const_i32(arg3);
503 504
@@ -505,7 +506,7 @@ static inline void tcg_gen_helper_1_2i(void *func, TCGv ret, TCGv arg1, TCGv arg @@ -505,7 +506,7 @@ static inline void tcg_gen_helper_1_2i(void *func, TCGv ret, TCGv arg1, TCGv arg
505 tcg_temp_free(tmp); 506 tcg_temp_free(tmp);
506 } 507 }
507 508
508 -static inline void tcg_gen_helper_1_2ii(void *func, TCGv ret, TCGv arg1, TCGv arg2, TCGv arg3, TCGv arg4) 509 +static inline void tcg_gen_helper_1_2ii(void *func, TCGv ret, TCGv arg1, TCGv arg2, uint32_t arg3, uint32_t arg4)
509 { 510 {
510 TCGv tmp1 = tcg_const_i32(arg3); 511 TCGv tmp1 = tcg_const_i32(arg3);
511 TCGv tmp2 = tcg_const_i32(arg4); 512 TCGv tmp2 = tcg_const_i32(arg4);
@@ -722,7 +723,7 @@ static inline void get_fp_cond (TCGv t) @@ -722,7 +723,7 @@ static inline void get_fp_cond (TCGv t)
722 typedef void (fcmp_fun32)(uint32_t, uint32_t, int); 723 typedef void (fcmp_fun32)(uint32_t, uint32_t, int);
723 typedef void (fcmp_fun64)(uint64_t, uint64_t, int); 724 typedef void (fcmp_fun64)(uint64_t, uint64_t, int);
724 725
725 -#define FOP_CONDS(fcmp_fun, type, arg0, arg1, fmt) \ 726 +#define FOP_CONDS(fcmp_fun, type, fmt) \
726 static fcmp_fun * fcmp ## type ## _ ## fmt ## _table[16] = { \ 727 static fcmp_fun * fcmp ## type ## _ ## fmt ## _table[16] = { \
727 do_cmp ## type ## _ ## fmt ## _f, \ 728 do_cmp ## type ## _ ## fmt ## _f, \
728 do_cmp ## type ## _ ## fmt ## _un, \ 729 do_cmp ## type ## _ ## fmt ## _un, \
@@ -741,17 +742,17 @@ static fcmp_fun * fcmp ## type ## _ ## fmt ## _table[16] = { \ @@ -741,17 +742,17 @@ static fcmp_fun * fcmp ## type ## _ ## fmt ## _table[16] = { \
741 do_cmp ## type ## _ ## fmt ## _le, \ 742 do_cmp ## type ## _ ## fmt ## _le, \
742 do_cmp ## type ## _ ## fmt ## _ngt, \ 743 do_cmp ## type ## _ ## fmt ## _ngt, \
743 }; \ 744 }; \
744 -static inline void gen_cmp ## type ## _ ## fmt(int n, arg0 a, arg1 b, int cc) \ 745 +static inline void gen_cmp ## type ## _ ## fmt(int n, TCGv a, TCGv b, int cc) \
745 { \ 746 { \
746 tcg_gen_helper_0_2i(fcmp ## type ## _ ## fmt ## _table[n], a, b, cc); \ 747 tcg_gen_helper_0_2i(fcmp ## type ## _ ## fmt ## _table[n], a, b, cc); \
747 } 748 }
748 749
749 -FOP_CONDS(fcmp_fun64, , uint64_t, uint64_t, d)  
750 -FOP_CONDS(fcmp_fun64, abs, uint64_t, uint64_t, d)  
751 -FOP_CONDS(fcmp_fun32, , uint32_t, uint32_t, s)  
752 -FOP_CONDS(fcmp_fun32, abs, uint32_t, uint32_t, s)  
753 -FOP_CONDS(fcmp_fun64, , uint64_t, uint64_t, ps)  
754 -FOP_CONDS(fcmp_fun64, abs, uint64_t, uint64_t, ps) 750 +FOP_CONDS(fcmp_fun64, , d)
  751 +FOP_CONDS(fcmp_fun64, abs, d)
  752 +FOP_CONDS(fcmp_fun32, , s)
  753 +FOP_CONDS(fcmp_fun32, abs, s)
  754 +FOP_CONDS(fcmp_fun64, , ps)
  755 +FOP_CONDS(fcmp_fun64, abs, ps)
755 #undef FOP_CONDS 756 #undef FOP_CONDS
756 757
757 /* Tests */ 758 /* Tests */
@@ -2498,7 +2499,7 @@ static void gen_compute_branch (DisasContext *ctx, uint32_t opc, @@ -2498,7 +2499,7 @@ static void gen_compute_branch (DisasContext *ctx, uint32_t opc,
2498 { 2499 {
2499 target_ulong btgt = -1; 2500 target_ulong btgt = -1;
2500 int blink = 0; 2501 int blink = 0;
2501 - int bcond = 0; 2502 + int bcond_compute = 0;
2502 TCGv t0 = tcg_temp_local_new(TCG_TYPE_TL); 2503 TCGv t0 = tcg_temp_local_new(TCG_TYPE_TL);
2503 TCGv t1 = tcg_temp_local_new(TCG_TYPE_TL); 2504 TCGv t1 = tcg_temp_local_new(TCG_TYPE_TL);
2504 2505
@@ -2524,7 +2525,7 @@ static void gen_compute_branch (DisasContext *ctx, uint32_t opc, @@ -2524,7 +2525,7 @@ static void gen_compute_branch (DisasContext *ctx, uint32_t opc,
2524 if (rs != rt) { 2525 if (rs != rt) {
2525 gen_load_gpr(t0, rs); 2526 gen_load_gpr(t0, rs);
2526 gen_load_gpr(t1, rt); 2527 gen_load_gpr(t1, rt);
2527 - bcond = 1; 2528 + bcond_compute = 1;
2528 } 2529 }
2529 btgt = ctx->pc + 4 + offset; 2530 btgt = ctx->pc + 4 + offset;
2530 break; 2531 break;
@@ -2543,7 +2544,7 @@ static void gen_compute_branch (DisasContext *ctx, uint32_t opc, @@ -2543,7 +2544,7 @@ static void gen_compute_branch (DisasContext *ctx, uint32_t opc,
2543 /* Compare to zero */ 2544 /* Compare to zero */
2544 if (rs != 0) { 2545 if (rs != 0) {
2545 gen_load_gpr(t0, rs); 2546 gen_load_gpr(t0, rs);
2546 - bcond = 1; 2547 + bcond_compute = 1;
2547 } 2548 }
2548 btgt = ctx->pc + 4 + offset; 2549 btgt = ctx->pc + 4 + offset;
2549 break; 2550 break;
@@ -2569,7 +2570,7 @@ static void gen_compute_branch (DisasContext *ctx, uint32_t opc, @@ -2569,7 +2570,7 @@ static void gen_compute_branch (DisasContext *ctx, uint32_t opc,
2569 generate_exception(ctx, EXCP_RI); 2570 generate_exception(ctx, EXCP_RI);
2570 goto out; 2571 goto out;
2571 } 2572 }
2572 - if (bcond == 0) { 2573 + if (bcond_compute == 0) {
2573 /* No condition to be computed */ 2574 /* No condition to be computed */
2574 switch (opc) { 2575 switch (opc) {
2575 case OPC_BEQ: /* rx == rx */ 2576 case OPC_BEQ: /* rx == rx */
@@ -6045,7 +6046,7 @@ static inline void gen_movcf_s (int fs, int fd, int cc, int tf) @@ -6045,7 +6046,7 @@ static inline void gen_movcf_s (int fs, int fd, int cc, int tf)
6045 tcg_gen_ld_i32(r_tmp1, current_fpu, offsetof(CPUMIPSFPUContext, fcr31)); 6046 tcg_gen_ld_i32(r_tmp1, current_fpu, offsetof(CPUMIPSFPUContext, fcr31));
6046 tcg_gen_andi_i32(r_tmp1, r_tmp1, ccbit); 6047 tcg_gen_andi_i32(r_tmp1, r_tmp1, ccbit);
6047 tcg_gen_brcondi_i32(cond, r_tmp1, 0, l1); 6048 tcg_gen_brcondi_i32(cond, r_tmp1, 0, l1);
6048 - tcg_gen_movi_i32(fp1, fp0); 6049 + tcg_gen_mov_i32(fp1, fp0);
6049 tcg_temp_free(fp0); 6050 tcg_temp_free(fp0);
6050 gen_set_label(l1); 6051 gen_set_label(l1);
6051 tcg_temp_free(r_tmp1); 6052 tcg_temp_free(r_tmp1);
@@ -6077,7 +6078,7 @@ static inline void gen_movcf_d (DisasContext *ctx, int fs, int fd, int cc, int t @@ -6077,7 +6078,7 @@ static inline void gen_movcf_d (DisasContext *ctx, int fs, int fd, int cc, int t
6077 tcg_gen_ld_i32(r_tmp1, current_fpu, offsetof(CPUMIPSFPUContext, fcr31)); 6078 tcg_gen_ld_i32(r_tmp1, current_fpu, offsetof(CPUMIPSFPUContext, fcr31));
6078 tcg_gen_andi_i32(r_tmp1, r_tmp1, ccbit); 6079 tcg_gen_andi_i32(r_tmp1, r_tmp1, ccbit);
6079 tcg_gen_brcondi_i32(cond, r_tmp1, 0, l1); 6080 tcg_gen_brcondi_i32(cond, r_tmp1, 0, l1);
6080 - tcg_gen_movi_i64(fp1, fp0); 6081 + tcg_gen_mov_i64(fp1, fp0);
6081 tcg_temp_free(fp0); 6082 tcg_temp_free(fp0);
6082 gen_set_label(l1); 6083 gen_set_label(l1);
6083 tcg_temp_free(r_tmp1); 6084 tcg_temp_free(r_tmp1);
@@ -6110,12 +6111,12 @@ static inline void gen_movcf_ps (int fs, int fd, int cc, int tf) @@ -6110,12 +6111,12 @@ static inline void gen_movcf_ps (int fs, int fd, int cc, int tf)
6110 tcg_gen_shri_i32(r_tmp1, r_tmp1, cc); 6111 tcg_gen_shri_i32(r_tmp1, r_tmp1, cc);
6111 tcg_gen_andi_i32(r_tmp2, r_tmp1, 0x1); 6112 tcg_gen_andi_i32(r_tmp2, r_tmp1, 0x1);
6112 tcg_gen_brcondi_i32(cond, r_tmp2, 0, l1); 6113 tcg_gen_brcondi_i32(cond, r_tmp2, 0, l1);
6113 - tcg_gen_movi_i32(fp1, fp0); 6114 + tcg_gen_mov_i32(fp1, fp0);
6114 tcg_temp_free(fp0); 6115 tcg_temp_free(fp0);
6115 gen_set_label(l1); 6116 gen_set_label(l1);
6116 tcg_gen_andi_i32(r_tmp2, r_tmp1, 0x2); 6117 tcg_gen_andi_i32(r_tmp2, r_tmp1, 0x2);
6117 tcg_gen_brcondi_i32(cond, r_tmp2, 0, l2); 6118 tcg_gen_brcondi_i32(cond, r_tmp2, 0, l2);
6118 - tcg_gen_movi_i32(fph1, fph0); 6119 + tcg_gen_mov_i32(fph1, fph0);
6119 tcg_temp_free(fph0); 6120 tcg_temp_free(fph0);
6120 gen_set_label(l2); 6121 gen_set_label(l2);
6121 tcg_temp_free(r_tmp1); 6122 tcg_temp_free(r_tmp1);