Commit e924bbec7a7b4e10f058a443c848c20f08a37536
1 parent
880e52b8
Set the L field of CMP[L][I] when dealing with 64 bit quantities
This (along with previous 2 commits) makes X86_64 work on ppc64 too. git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4960 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
12 additions
and
7 deletions
tcg/ppc64/tcg-target.c
| @@ -34,8 +34,10 @@ static uint8_t *tb_ret_addr; | @@ -34,8 +34,10 @@ static uint8_t *tb_ret_addr; | ||
| 34 | 34 | ||
| 35 | #if TARGET_LONG_BITS == 32 | 35 | #if TARGET_LONG_BITS == 32 |
| 36 | #define LD_ADDR LWZU | 36 | #define LD_ADDR LWZU |
| 37 | +#define CMP_L 0 | ||
| 37 | #else | 38 | #else |
| 38 | #define LD_ADDR LDU | 39 | #define LD_ADDR LDU |
| 40 | +#define CMP_L (1<<21) | ||
| 39 | #endif | 41 | #endif |
| 40 | 42 | ||
| 41 | static const char * const tcg_target_reg_names[TCG_TARGET_NB_REGS] = { | 43 | static const char * const tcg_target_reg_names[TCG_TARGET_NB_REGS] = { |
| @@ -588,7 +590,7 @@ static void tcg_out_qemu_ld (TCGContext *s, const TCGArg *args, int opc) | @@ -588,7 +590,7 @@ static void tcg_out_qemu_ld (TCGContext *s, const TCGArg *args, int opc) | ||
| 588 | tcg_out_tlb_read (s, r0, r1, r2, addr_reg, s_bits, | 590 | tcg_out_tlb_read (s, r0, r1, r2, addr_reg, s_bits, |
| 589 | offsetof (CPUState, tlb_table[mem_index][0].addr_read)); | 591 | offsetof (CPUState, tlb_table[mem_index][0].addr_read)); |
| 590 | 592 | ||
| 591 | - tcg_out32 (s, CMP | BF (7) | RA (r2) | RB (r1)); | 593 | + tcg_out32 (s, CMP | BF (7) | RA (r2) | RB (r1) | CMP_L); |
| 592 | 594 | ||
| 593 | label1_ptr = s->code_ptr; | 595 | label1_ptr = s->code_ptr; |
| 594 | #ifdef FAST_PATH | 596 | #ifdef FAST_PATH |
| @@ -715,7 +717,7 @@ static void tcg_out_qemu_st (TCGContext *s, const TCGArg *args, int opc) | @@ -715,7 +717,7 @@ static void tcg_out_qemu_st (TCGContext *s, const TCGArg *args, int opc) | ||
| 715 | tcg_out_tlb_read (s, r0, r1, r2, addr_reg, opc, | 717 | tcg_out_tlb_read (s, r0, r1, r2, addr_reg, opc, |
| 716 | offsetof (CPUState, tlb_table[mem_index][0].addr_write)); | 718 | offsetof (CPUState, tlb_table[mem_index][0].addr_write)); |
| 717 | 719 | ||
| 718 | - tcg_out32 (s, CMP | BF (7) | RA (r2) | RB (r1)); | 720 | + tcg_out32 (s, CMP | BF (7) | RA (r2) | RB (r1) | CMP_L); |
| 719 | 721 | ||
| 720 | label1_ptr = s->code_ptr; | 722 | label1_ptr = s->code_ptr; |
| 721 | #ifdef FAST_PATH | 723 | #ifdef FAST_PATH |
| @@ -882,7 +884,7 @@ static void tcg_out_addi (TCGContext *s, int reg, tcg_target_long val) | @@ -882,7 +884,7 @@ static void tcg_out_addi (TCGContext *s, int reg, tcg_target_long val) | ||
| 882 | } | 884 | } |
| 883 | 885 | ||
| 884 | static void tcg_out_cmp (TCGContext *s, int cond, TCGArg arg1, TCGArg arg2, | 886 | static void tcg_out_cmp (TCGContext *s, int cond, TCGArg arg1, TCGArg arg2, |
| 885 | - int const_arg2, int cr) | 887 | + int const_arg2, int cr, int arch64) |
| 886 | { | 888 | { |
| 887 | int imm; | 889 | int imm; |
| 888 | uint32_t op; | 890 | uint32_t op; |
| @@ -939,7 +941,7 @@ static void tcg_out_cmp (TCGContext *s, int cond, TCGArg arg1, TCGArg arg2, | @@ -939,7 +941,7 @@ static void tcg_out_cmp (TCGContext *s, int cond, TCGArg arg1, TCGArg arg2, | ||
| 939 | default: | 941 | default: |
| 940 | tcg_abort (); | 942 | tcg_abort (); |
| 941 | } | 943 | } |
| 942 | - op |= BF (cr); | 944 | + op |= BF (cr) | (arch64 << 21); |
| 943 | 945 | ||
| 944 | if (imm) | 946 | if (imm) |
| 945 | tcg_out32 (s, op | RA (arg1) | (arg2 & 0xffff)); | 947 | tcg_out32 (s, op | RA (arg1) | (arg2 & 0xffff)); |
| @@ -971,9 +973,9 @@ static void tcg_out_bc (TCGContext *s, int bc, int label_index) | @@ -971,9 +973,9 @@ static void tcg_out_bc (TCGContext *s, int bc, int label_index) | ||
| 971 | 973 | ||
| 972 | static void tcg_out_brcond (TCGContext *s, int cond, | 974 | static void tcg_out_brcond (TCGContext *s, int cond, |
| 973 | TCGArg arg1, TCGArg arg2, int const_arg2, | 975 | TCGArg arg1, TCGArg arg2, int const_arg2, |
| 974 | - int label_index) | 976 | + int label_index, int arch64) |
| 975 | { | 977 | { |
| 976 | - tcg_out_cmp (s, cond, arg1, arg2, const_arg2, 7); | 978 | + tcg_out_cmp (s, cond, arg1, arg2, const_arg2, 7, arch64); |
| 977 | tcg_out_bc (s, tcg_to_bc[cond], label_index); | 979 | tcg_out_bc (s, tcg_to_bc[cond], label_index); |
| 978 | } | 980 | } |
| 979 | 981 | ||
| @@ -1245,8 +1247,11 @@ static void tcg_out_op (TCGContext *s, int opc, const TCGArg *args, | @@ -1245,8 +1247,11 @@ static void tcg_out_op (TCGContext *s, int opc, const TCGArg *args, | ||
| 1245 | break; | 1247 | break; |
| 1246 | 1248 | ||
| 1247 | case INDEX_op_brcond_i32: | 1249 | case INDEX_op_brcond_i32: |
| 1250 | + tcg_out_brcond (s, args[2], args[0], args[1], const_args[1], args[3], 0); | ||
| 1251 | + break; | ||
| 1252 | + | ||
| 1248 | case INDEX_op_brcond_i64: | 1253 | case INDEX_op_brcond_i64: |
| 1249 | - tcg_out_brcond (s, args[2], args[0], args[1], const_args[1], args[3]); | 1254 | + tcg_out_brcond (s, args[2], args[0], args[1], const_args[1], args[3], 1); |
| 1250 | break; | 1255 | break; |
| 1251 | 1256 | ||
| 1252 | case INDEX_op_neg_i32: | 1257 | case INDEX_op_neg_i32: |