Commit 6ad025921c4d6e63e7065ba084ffe6ddf709c4de
1 parent
b3249f63
target-alpha: switch a few helpers to TCG
Switch a few helpers to TCG and implement RC and RS instructions Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5247 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
6 changed files
with
41 additions
and
67 deletions
target-alpha/cpu.h
| @@ -269,6 +269,7 @@ struct CPUAlphaState { | @@ -269,6 +269,7 @@ struct CPUAlphaState { | ||
| 269 | uint64_t ps; | 269 | uint64_t ps; |
| 270 | uint64_t unique; | 270 | uint64_t unique; |
| 271 | int saved_mode; /* Used for HW_LD / HW_ST */ | 271 | int saved_mode; /* Used for HW_LD / HW_ST */ |
| 272 | + int intr_flag; /* For RC and RS */ | ||
| 272 | 273 | ||
| 273 | #if TARGET_LONG_BITS > HOST_LONG_BITS | 274 | #if TARGET_LONG_BITS > HOST_LONG_BITS |
| 274 | /* temporary fixed-point registers | 275 | /* temporary fixed-point registers |
target-alpha/helper.h
| @@ -4,7 +4,12 @@ | @@ -4,7 +4,12 @@ | ||
| 4 | 4 | ||
| 5 | DEF_HELPER(void, helper_tb_flush, (void)) | 5 | DEF_HELPER(void, helper_tb_flush, (void)) |
| 6 | 6 | ||
| 7 | +DEF_HELPER(void, helper_excp, (int, int)) | ||
| 7 | DEF_HELPER(uint64_t, helper_amask, (uint64_t)) | 8 | DEF_HELPER(uint64_t, helper_amask, (uint64_t)) |
| 9 | +DEF_HELPER(uint64_t, helper_load_pcc, (void)) | ||
| 10 | +DEF_HELPER(uint64_t, helper_load_implver, (void)) | ||
| 11 | +DEF_HELPER(uint64_t, helper_rc, (void)) | ||
| 12 | +DEF_HELPER(uint64_t, helper_rs, (void)) | ||
| 8 | 13 | ||
| 9 | DEF_HELPER(uint64_t, helper_ctpop, (uint64_t)) | 14 | DEF_HELPER(uint64_t, helper_ctpop, (uint64_t)) |
| 10 | DEF_HELPER(uint64_t, helper_ctlz, (uint64_t)) | 15 | DEF_HELPER(uint64_t, helper_ctlz, (uint64_t)) |
target-alpha/op.c
| @@ -149,24 +149,6 @@ void OPPROTO op_no_op (void) | @@ -149,24 +149,6 @@ void OPPROTO op_no_op (void) | ||
| 149 | #endif | 149 | #endif |
| 150 | 150 | ||
| 151 | /* Misc */ | 151 | /* Misc */ |
| 152 | -void OPPROTO op_excp (void) | ||
| 153 | -{ | ||
| 154 | - helper_excp(PARAM(1), PARAM(2)); | ||
| 155 | - RETURN(); | ||
| 156 | -} | ||
| 157 | - | ||
| 158 | -void OPPROTO op_load_pcc (void) | ||
| 159 | -{ | ||
| 160 | - helper_load_pcc(); | ||
| 161 | - RETURN(); | ||
| 162 | -} | ||
| 163 | - | ||
| 164 | -void OPPROTO op_load_implver (void) | ||
| 165 | -{ | ||
| 166 | - helper_load_implver(); | ||
| 167 | - RETURN(); | ||
| 168 | -} | ||
| 169 | - | ||
| 170 | void OPPROTO op_load_fpcr (void) | 152 | void OPPROTO op_load_fpcr (void) |
| 171 | { | 153 | { |
| 172 | helper_load_fpcr(); | 154 | helper_load_fpcr(); |
| @@ -179,24 +161,6 @@ void OPPROTO op_store_fpcr (void) | @@ -179,24 +161,6 @@ void OPPROTO op_store_fpcr (void) | ||
| 179 | RETURN(); | 161 | RETURN(); |
| 180 | } | 162 | } |
| 181 | 163 | ||
| 182 | -void OPPROTO op_load_irf (void) | ||
| 183 | -{ | ||
| 184 | - helper_load_irf(); | ||
| 185 | - RETURN(); | ||
| 186 | -} | ||
| 187 | - | ||
| 188 | -void OPPROTO op_set_irf (void) | ||
| 189 | -{ | ||
| 190 | - helper_set_irf(); | ||
| 191 | - RETURN(); | ||
| 192 | -} | ||
| 193 | - | ||
| 194 | -void OPPROTO op_clear_irf (void) | ||
| 195 | -{ | ||
| 196 | - helper_clear_irf(); | ||
| 197 | - RETURN(); | ||
| 198 | -} | ||
| 199 | - | ||
| 200 | /* Arithmetic */ | 164 | /* Arithmetic */ |
| 201 | void OPPROTO op_addqv (void) | 165 | void OPPROTO op_addqv (void) |
| 202 | { | 166 | { |
target-alpha/op_helper.c
| @@ -58,7 +58,7 @@ void helper_print_mem_EA (target_ulong EA) | @@ -58,7 +58,7 @@ void helper_print_mem_EA (target_ulong EA) | ||
| 58 | 58 | ||
| 59 | /*****************************************************************************/ | 59 | /*****************************************************************************/ |
| 60 | /* Exceptions processing helpers */ | 60 | /* Exceptions processing helpers */ |
| 61 | -void helper_excp (uint32_t excp, uint32_t error) | 61 | +void helper_excp (int excp, int error) |
| 62 | { | 62 | { |
| 63 | env->exception_index = excp; | 63 | env->exception_index = excp; |
| 64 | env->error_code = error; | 64 | env->error_code = error; |
| @@ -80,15 +80,15 @@ uint64_t helper_amask (uint64_t arg) | @@ -80,15 +80,15 @@ uint64_t helper_amask (uint64_t arg) | ||
| 80 | return arg; | 80 | return arg; |
| 81 | } | 81 | } |
| 82 | 82 | ||
| 83 | -void helper_load_pcc (void) | 83 | +uint64_t helper_load_pcc (void) |
| 84 | { | 84 | { |
| 85 | /* XXX: TODO */ | 85 | /* XXX: TODO */ |
| 86 | - T0 = 0; | 86 | + return 0; |
| 87 | } | 87 | } |
| 88 | 88 | ||
| 89 | -void helper_load_implver (void) | 89 | +uint64_t helper_load_implver (void) |
| 90 | { | 90 | { |
| 91 | - T0 = env->implver; | 91 | + return env->implver; |
| 92 | } | 92 | } |
| 93 | 93 | ||
| 94 | void helper_load_fpcr (void) | 94 | void helper_load_fpcr (void) |
| @@ -137,20 +137,30 @@ void helper_store_fpcr (void) | @@ -137,20 +137,30 @@ void helper_store_fpcr (void) | ||
| 137 | } | 137 | } |
| 138 | } | 138 | } |
| 139 | 139 | ||
| 140 | -void helper_load_irf (void) | ||
| 141 | -{ | ||
| 142 | - /* XXX: TODO */ | ||
| 143 | - T0 = 0; | ||
| 144 | -} | 140 | +spinlock_t intr_cpu_lock = SPIN_LOCK_UNLOCKED; |
| 145 | 141 | ||
| 146 | -void helper_set_irf (void) | 142 | +uint64_t helper_rs(void) |
| 147 | { | 143 | { |
| 148 | - /* XXX: TODO */ | 144 | + uint64_t tmp; |
| 145 | + | ||
| 146 | + spin_lock(&intr_cpu_lock); | ||
| 147 | + tmp = env->intr_flag; | ||
| 148 | + env->intr_flag = 1; | ||
| 149 | + spin_unlock(&intr_cpu_lock); | ||
| 150 | + | ||
| 151 | + return tmp; | ||
| 149 | } | 152 | } |
| 150 | 153 | ||
| 151 | -void helper_clear_irf (void) | 154 | +uint64_t helper_rc(void) |
| 152 | { | 155 | { |
| 153 | - /* XXX: TODO */ | 156 | + uint64_t tmp; |
| 157 | + | ||
| 158 | + spin_lock(&intr_cpu_lock); | ||
| 159 | + tmp = env->intr_flag; | ||
| 160 | + env->intr_flag = 0; | ||
| 161 | + spin_unlock(&intr_cpu_lock); | ||
| 162 | + | ||
| 163 | + return tmp; | ||
| 154 | } | 164 | } |
| 155 | 165 | ||
| 156 | void helper_addqv (void) | 166 | void helper_addqv (void) |
target-alpha/op_helper.h
| @@ -19,14 +19,8 @@ | @@ -19,14 +19,8 @@ | ||
| 19 | */ | 19 | */ |
| 20 | 20 | ||
| 21 | void helper_call_pal (uint32_t palcode); | 21 | void helper_call_pal (uint32_t palcode); |
| 22 | -void helper_excp (uint32_t excp, uint32_t error); | ||
| 23 | -void helper_load_pcc (void); | ||
| 24 | -void helper_load_implver (void); | ||
| 25 | void helper_load_fpcr (void); | 22 | void helper_load_fpcr (void); |
| 26 | void helper_store_fpcr (void); | 23 | void helper_store_fpcr (void); |
| 27 | -void helper_load_irf (void); | ||
| 28 | -void helper_set_irf (void); | ||
| 29 | -void helper_clear_irf (void); | ||
| 30 | void helper_addqv (void); | 24 | void helper_addqv (void); |
| 31 | void helper_addlv (void); | 25 | void helper_addlv (void); |
| 32 | void helper_subqv (void); | 26 | void helper_subqv (void); |
target-alpha/translate.c
| @@ -250,8 +250,14 @@ static always_inline void _gen_op_bcond (DisasContext *ctx) | @@ -250,8 +250,14 @@ static always_inline void _gen_op_bcond (DisasContext *ctx) | ||
| 250 | static always_inline void gen_excp (DisasContext *ctx, | 250 | static always_inline void gen_excp (DisasContext *ctx, |
| 251 | int exception, int error_code) | 251 | int exception, int error_code) |
| 252 | { | 252 | { |
| 253 | + TCGv tmp1, tmp2; | ||
| 254 | + | ||
| 253 | tcg_gen_movi_i64(cpu_pc, ctx->pc); | 255 | tcg_gen_movi_i64(cpu_pc, ctx->pc); |
| 254 | - gen_op_excp(exception, error_code); | 256 | + tmp1 = tcg_const_i32(exception); |
| 257 | + tmp2 = tcg_const_i32(error_code); | ||
| 258 | + tcg_gen_helper_0_2(helper_excp, tmp1, tmp2); | ||
| 259 | + tcg_temp_free(tmp2); | ||
| 260 | + tcg_temp_free(tmp1); | ||
| 255 | } | 261 | } |
| 256 | 262 | ||
| 257 | static always_inline void gen_invalid (DisasContext *ctx) | 263 | static always_inline void gen_invalid (DisasContext *ctx) |
| @@ -1176,9 +1182,8 @@ static always_inline int translate_one (DisasContext *ctx, uint32_t insn) | @@ -1176,9 +1182,8 @@ static always_inline int translate_one (DisasContext *ctx, uint32_t insn) | ||
| 1176 | break; | 1182 | break; |
| 1177 | case 0x6C: | 1183 | case 0x6C: |
| 1178 | /* IMPLVER */ | 1184 | /* IMPLVER */ |
| 1179 | - gen_op_load_implver(); | ||
| 1180 | if (rc != 31) | 1185 | if (rc != 31) |
| 1181 | - tcg_gen_mov_i64(cpu_ir[rc], cpu_T[0]); | 1186 | + tcg_gen_helper_1_0(helper_load_implver, cpu_ir[rc]); |
| 1182 | break; | 1187 | break; |
| 1183 | default: | 1188 | default: |
| 1184 | goto invalid_opc; | 1189 | goto invalid_opc; |
| @@ -1699,16 +1704,13 @@ static always_inline int translate_one (DisasContext *ctx, uint32_t insn) | @@ -1699,16 +1704,13 @@ static always_inline int translate_one (DisasContext *ctx, uint32_t insn) | ||
| 1699 | break; | 1704 | break; |
| 1700 | case 0xC000: | 1705 | case 0xC000: |
| 1701 | /* RPCC */ | 1706 | /* RPCC */ |
| 1702 | - gen_op_load_pcc(); | ||
| 1703 | if (ra != 31) | 1707 | if (ra != 31) |
| 1704 | - tcg_gen_mov_i64(cpu_ir[ra], cpu_T[0]); | 1708 | + tcg_gen_helper_1_0(helper_load_pcc, cpu_ir[ra]); |
| 1705 | break; | 1709 | break; |
| 1706 | case 0xE000: | 1710 | case 0xE000: |
| 1707 | /* RC */ | 1711 | /* RC */ |
| 1708 | - gen_op_load_irf(); | ||
| 1709 | if (ra != 31) | 1712 | if (ra != 31) |
| 1710 | - tcg_gen_mov_i64(cpu_ir[ra], cpu_T[0]); | ||
| 1711 | - gen_op_clear_irf(); | 1713 | + tcg_gen_helper_1_0(helper_rc, cpu_ir[ra]); |
| 1712 | break; | 1714 | break; |
| 1713 | case 0xE800: | 1715 | case 0xE800: |
| 1714 | /* ECB */ | 1716 | /* ECB */ |
| @@ -1721,10 +1723,8 @@ static always_inline int translate_one (DisasContext *ctx, uint32_t insn) | @@ -1721,10 +1723,8 @@ static always_inline int translate_one (DisasContext *ctx, uint32_t insn) | ||
| 1721 | break; | 1723 | break; |
| 1722 | case 0xF000: | 1724 | case 0xF000: |
| 1723 | /* RS */ | 1725 | /* RS */ |
| 1724 | - gen_op_load_irf(); | ||
| 1725 | if (ra != 31) | 1726 | if (ra != 31) |
| 1726 | - tcg_gen_mov_i64(cpu_ir[ra], cpu_T[0]); | ||
| 1727 | - gen_op_set_irf(); | 1727 | + tcg_gen_helper_1_0(helper_rs, cpu_ir[ra]); |
| 1728 | break; | 1728 | break; |
| 1729 | case 0xF800: | 1729 | case 0xF800: |
| 1730 | /* WH64 */ | 1730 | /* WH64 */ |