Commit d84763bc1771583e1731c6a351daa157e2d02125
1 parent
c5d04e99
Convert rest of ops using float32 to TCG, remove FT0 and FT1
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5193 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
5 changed files
with
39 additions
and
64 deletions
target-sparc/cpu.h
@@ -303,7 +303,6 @@ typedef struct CPUSPARCState { | @@ -303,7 +303,6 @@ typedef struct CPUSPARCState { | ||
303 | uint64_t prom_addr; | 303 | uint64_t prom_addr; |
304 | #endif | 304 | #endif |
305 | /* temporary float registers */ | 305 | /* temporary float registers */ |
306 | - float32 ft0, ft1; | ||
307 | float64 dt0, dt1; | 306 | float64 dt0, dt1; |
308 | float128 qt0, qt1; | 307 | float128 qt0, qt1; |
309 | float_status fp_status; | 308 | float_status fp_status; |
target-sparc/exec.h
@@ -5,8 +5,6 @@ | @@ -5,8 +5,6 @@ | ||
5 | 5 | ||
6 | register struct CPUSPARCState *env asm(AREG0); | 6 | register struct CPUSPARCState *env asm(AREG0); |
7 | 7 | ||
8 | -#define FT0 (env->ft0) | ||
9 | -#define FT1 (env->ft1) | ||
10 | #define DT0 (env->dt0) | 8 | #define DT0 (env->dt0) |
11 | #define DT1 (env->dt1) | 9 | #define DT1 (env->dt1) |
12 | #define QT0 (env->qt0) | 10 | #define QT0 (env->qt0) |
target-sparc/helper.h
@@ -93,10 +93,6 @@ DEF_HELPER(void, helper_fcmpeq_fcc3, (void)) | @@ -93,10 +93,6 @@ DEF_HELPER(void, helper_fcmpeq_fcc3, (void)) | ||
93 | #endif | 93 | #endif |
94 | DEF_HELPER(void, raise_exception, (int tt)) | 94 | DEF_HELPER(void, raise_exception, (int tt)) |
95 | #define F_HELPER_0_0(name) DEF_HELPER(void, helper_f ## name, (void)) | 95 | #define F_HELPER_0_0(name) DEF_HELPER(void, helper_f ## name, (void)) |
96 | -#define F_HELPER_SDQ_0_0(name) \ | ||
97 | - F_HELPER_0_0(name ## s); \ | ||
98 | - F_HELPER_0_0(name ## d); \ | ||
99 | - F_HELPER_0_0(name ## q) | ||
100 | #define F_HELPER_DQ_0_0(name) \ | 96 | #define F_HELPER_DQ_0_0(name) \ |
101 | F_HELPER_0_0(name ## d); \ | 97 | F_HELPER_0_0(name ## d); \ |
102 | F_HELPER_0_0(name ## q) | 98 | F_HELPER_0_0(name ## q) |
@@ -111,11 +107,11 @@ DEF_HELPER(float32, helper_fsubs, (float32 src1, float32 src2)) | @@ -111,11 +107,11 @@ DEF_HELPER(float32, helper_fsubs, (float32 src1, float32 src2)) | ||
111 | DEF_HELPER(float32, helper_fmuls, (float32 src1, float32 src2)) | 107 | DEF_HELPER(float32, helper_fmuls, (float32 src1, float32 src2)) |
112 | DEF_HELPER(float32, helper_fdivs, (float32 src1, float32 src2)) | 108 | DEF_HELPER(float32, helper_fdivs, (float32 src1, float32 src2)) |
113 | 109 | ||
114 | -F_HELPER_0_0(smuld); | 110 | +DEF_HELPER(void, helper_fsmuld, (float32 src1, float32 src2)) |
115 | F_HELPER_0_0(dmulq); | 111 | F_HELPER_0_0(dmulq); |
116 | 112 | ||
117 | DEF_HELPER(float32, helper_fnegs, (float32 src)) | 113 | DEF_HELPER(float32, helper_fnegs, (float32 src)) |
118 | -F_HELPER_0_0(itod); | 114 | +DEF_HELPER(void, helper_fitod, (int32_t src)) |
119 | DEF_HELPER(void, helper_fitoq, (int32_t src)) | 115 | DEF_HELPER(void, helper_fitoq, (int32_t src)) |
120 | 116 | ||
121 | DEF_HELPER(float32, helper_fitos, (int32_t src)) | 117 | DEF_HELPER(float32, helper_fitos, (int32_t src)) |
@@ -123,19 +119,20 @@ DEF_HELPER(float32, helper_fitos, (int32_t src)) | @@ -123,19 +119,20 @@ DEF_HELPER(float32, helper_fitos, (int32_t src)) | ||
123 | #ifdef TARGET_SPARC64 | 119 | #ifdef TARGET_SPARC64 |
124 | DEF_HELPER(void, helper_fnegd, (void)) | 120 | DEF_HELPER(void, helper_fnegd, (void)) |
125 | DEF_HELPER(void, helper_fnegq, (void)) | 121 | DEF_HELPER(void, helper_fnegq, (void)) |
126 | -F_HELPER_SDQ_0_0(xto); | 122 | +DEF_HELPER(uint32_t, helper_fxtos, (void)) |
123 | +F_HELPER_DQ_0_0(xto); | ||
127 | #endif | 124 | #endif |
128 | -F_HELPER_0_0(dtos); | ||
129 | -F_HELPER_0_0(stod); | 125 | +DEF_HELPER(float32, helper_fdtos, (void)) |
126 | +DEF_HELPER(void, helper_fstod, (float32 src)) | ||
130 | DEF_HELPER(float32, helper_fqtos, (void)) | 127 | DEF_HELPER(float32, helper_fqtos, (void)) |
131 | DEF_HELPER(void, helper_fstoq, (float32 src)) | 128 | DEF_HELPER(void, helper_fstoq, (float32 src)) |
132 | F_HELPER_0_0(qtod); | 129 | F_HELPER_0_0(qtod); |
133 | F_HELPER_0_0(dtoq); | 130 | F_HELPER_0_0(dtoq); |
134 | DEF_HELPER(int32_t, helper_fstoi, (float32 src)) | 131 | DEF_HELPER(int32_t, helper_fstoi, (float32 src)) |
135 | -F_HELPER_0_0(dtoi); | 132 | +DEF_HELPER(int32_t, helper_fdtoi, (void)) |
136 | DEF_HELPER(int32_t, helper_fqtoi, (void)) | 133 | DEF_HELPER(int32_t, helper_fqtoi, (void)) |
137 | #ifdef TARGET_SPARC64 | 134 | #ifdef TARGET_SPARC64 |
138 | -F_HELPER_0_0(stox); | 135 | +DEF_HELPER(void, helper_fstox, (uint32_t src)) |
139 | F_HELPER_0_0(dtox); | 136 | F_HELPER_0_0(dtox); |
140 | F_HELPER_0_0(qtox); | 137 | F_HELPER_0_0(qtox); |
141 | F_HELPER_0_0(aligndata); | 138 | F_HELPER_0_0(aligndata); |
target-sparc/op_helper.c
@@ -106,10 +106,10 @@ F_BINOP(mul); | @@ -106,10 +106,10 @@ F_BINOP(mul); | ||
106 | F_BINOP(div); | 106 | F_BINOP(div); |
107 | #undef F_BINOP | 107 | #undef F_BINOP |
108 | 108 | ||
109 | -void helper_fsmuld(void) | 109 | +void helper_fsmuld(float32 src1, float32 src2) |
110 | { | 110 | { |
111 | - DT0 = float64_mul(float32_to_float64(FT0, &env->fp_status), | ||
112 | - float32_to_float64(FT1, &env->fp_status), | 111 | + DT0 = float64_mul(float32_to_float64(src1, &env->fp_status), |
112 | + float32_to_float64(src2, &env->fp_status), | ||
113 | &env->fp_status); | 113 | &env->fp_status); |
114 | } | 114 | } |
115 | 115 | ||
@@ -143,9 +143,9 @@ float32 helper_fitos(int32_t src) | @@ -143,9 +143,9 @@ float32 helper_fitos(int32_t src) | ||
143 | return int32_to_float32(src, &env->fp_status); | 143 | return int32_to_float32(src, &env->fp_status); |
144 | } | 144 | } |
145 | 145 | ||
146 | -F_HELPER(ito, d) | 146 | +void helper_fitod(int32_t src) |
147 | { | 147 | { |
148 | - DT0 = int32_to_float64(*((int32_t *)&FT1), &env->fp_status); | 148 | + DT0 = int32_to_float64(src, &env->fp_status); |
149 | } | 149 | } |
150 | 150 | ||
151 | void helper_fitoq(int32_t src) | 151 | void helper_fitoq(int32_t src) |
@@ -154,9 +154,9 @@ void helper_fitoq(int32_t src) | @@ -154,9 +154,9 @@ void helper_fitoq(int32_t src) | ||
154 | } | 154 | } |
155 | 155 | ||
156 | #ifdef TARGET_SPARC64 | 156 | #ifdef TARGET_SPARC64 |
157 | -F_HELPER(xto, s) | 157 | +float32 helper_fxtos(void) |
158 | { | 158 | { |
159 | - FT0 = int64_to_float32(*((int64_t *)&DT1), &env->fp_status); | 159 | + return int64_to_float32(*((int64_t *)&DT1), &env->fp_status); |
160 | } | 160 | } |
161 | 161 | ||
162 | F_HELPER(xto, d) | 162 | F_HELPER(xto, d) |
@@ -172,14 +172,14 @@ F_HELPER(xto, q) | @@ -172,14 +172,14 @@ F_HELPER(xto, q) | ||
172 | #undef F_HELPER | 172 | #undef F_HELPER |
173 | 173 | ||
174 | /* floating point conversion */ | 174 | /* floating point conversion */ |
175 | -void helper_fdtos(void) | 175 | +float32 helper_fdtos(void) |
176 | { | 176 | { |
177 | - FT0 = float64_to_float32(DT1, &env->fp_status); | 177 | + return float64_to_float32(DT1, &env->fp_status); |
178 | } | 178 | } |
179 | 179 | ||
180 | -void helper_fstod(void) | 180 | +void helper_fstod(float32 src) |
181 | { | 181 | { |
182 | - DT0 = float32_to_float64(FT1, &env->fp_status); | 182 | + DT0 = float32_to_float64(src, &env->fp_status); |
183 | } | 183 | } |
184 | 184 | ||
185 | float32 helper_fqtos(void) | 185 | float32 helper_fqtos(void) |
@@ -208,9 +208,9 @@ int32_t helper_fstoi(float32 src) | @@ -208,9 +208,9 @@ int32_t helper_fstoi(float32 src) | ||
208 | return float32_to_int32_round_to_zero(src, &env->fp_status); | 208 | return float32_to_int32_round_to_zero(src, &env->fp_status); |
209 | } | 209 | } |
210 | 210 | ||
211 | -void helper_fdtoi(void) | 211 | +int32_t helper_fdtoi(void) |
212 | { | 212 | { |
213 | - *((int32_t *)&FT0) = float64_to_int32_round_to_zero(DT1, &env->fp_status); | 213 | + return float64_to_int32_round_to_zero(DT1, &env->fp_status); |
214 | } | 214 | } |
215 | 215 | ||
216 | int32_t helper_fqtoi(void) | 216 | int32_t helper_fqtoi(void) |
@@ -219,9 +219,9 @@ int32_t helper_fqtoi(void) | @@ -219,9 +219,9 @@ int32_t helper_fqtoi(void) | ||
219 | } | 219 | } |
220 | 220 | ||
221 | #ifdef TARGET_SPARC64 | 221 | #ifdef TARGET_SPARC64 |
222 | -void helper_fstox(void) | 222 | +void helper_fstox(float32 src) |
223 | { | 223 | { |
224 | - *((int64_t *)&DT0) = float32_to_int64_round_to_zero(FT1, &env->fp_status); | 224 | + *((int64_t *)&DT0) = float32_to_int64_round_to_zero(src, &env->fp_status); |
225 | } | 225 | } |
226 | 226 | ||
227 | void helper_fdtox(void) | 227 | void helper_fdtox(void) |
target-sparc/translate.c
@@ -102,21 +102,6 @@ static int sign_extend(int x, int len) | @@ -102,21 +102,6 @@ static int sign_extend(int x, int len) | ||
102 | #define IS_IMM (insn & (1<<13)) | 102 | #define IS_IMM (insn & (1<<13)) |
103 | 103 | ||
104 | /* floating point registers moves */ | 104 | /* floating point registers moves */ |
105 | -static void gen_op_load_fpr_FT0(unsigned int src) | ||
106 | -{ | ||
107 | - tcg_gen_st_i32(cpu_fpr[src], cpu_env, offsetof(CPUSPARCState, ft0)); | ||
108 | -} | ||
109 | - | ||
110 | -static void gen_op_load_fpr_FT1(unsigned int src) | ||
111 | -{ | ||
112 | - tcg_gen_st_i32(cpu_fpr[src], cpu_env, offsetof(CPUSPARCState, ft1)); | ||
113 | -} | ||
114 | - | ||
115 | -static void gen_op_store_FT0_fpr(unsigned int dst) | ||
116 | -{ | ||
117 | - tcg_gen_ld_i32(cpu_fpr[dst], cpu_env, offsetof(CPUSPARCState, ft0)); | ||
118 | -} | ||
119 | - | ||
120 | static void gen_op_load_fpr_DT0(unsigned int src) | 105 | static void gen_op_load_fpr_DT0(unsigned int src) |
121 | { | 106 | { |
122 | tcg_gen_st_i32(cpu_fpr[src], cpu_env, offsetof(CPUSPARCState, dt0) + | 107 | tcg_gen_st_i32(cpu_fpr[src], cpu_env, offsetof(CPUSPARCState, dt0) + |
@@ -2475,12 +2460,11 @@ static void disas_sparc_insn(DisasContext * dc) | @@ -2475,12 +2460,11 @@ static void disas_sparc_insn(DisasContext * dc) | ||
2475 | tcg_gen_helper_0_0(helper_check_ieee_exceptions); | 2460 | tcg_gen_helper_0_0(helper_check_ieee_exceptions); |
2476 | gen_op_store_QT0_fpr(QFPREG(rd)); | 2461 | gen_op_store_QT0_fpr(QFPREG(rd)); |
2477 | break; | 2462 | break; |
2478 | - case 0x69: | 2463 | + case 0x69: /* fsmuld */ |
2479 | CHECK_FPU_FEATURE(dc, FSMULD); | 2464 | CHECK_FPU_FEATURE(dc, FSMULD); |
2480 | - gen_op_load_fpr_FT0(rs1); | ||
2481 | - gen_op_load_fpr_FT1(rs2); | ||
2482 | gen_clear_float_exceptions(); | 2465 | gen_clear_float_exceptions(); |
2483 | - tcg_gen_helper_0_0(helper_fsmuld); | 2466 | + tcg_gen_helper_0_2(helper_fsmuld, cpu_fpr[rs1], |
2467 | + cpu_fpr[rs2]); | ||
2484 | tcg_gen_helper_0_0(helper_check_ieee_exceptions); | 2468 | tcg_gen_helper_0_0(helper_check_ieee_exceptions); |
2485 | gen_op_store_DT0_fpr(DFPREG(rd)); | 2469 | gen_op_store_DT0_fpr(DFPREG(rd)); |
2486 | break; | 2470 | break; |
@@ -2500,12 +2484,12 @@ static void disas_sparc_insn(DisasContext * dc) | @@ -2500,12 +2484,12 @@ static void disas_sparc_insn(DisasContext * dc) | ||
2500 | tcg_gen_helper_0_0(helper_check_ieee_exceptions); | 2484 | tcg_gen_helper_0_0(helper_check_ieee_exceptions); |
2501 | tcg_gen_mov_i32(cpu_fpr[rd], cpu_tmp32); | 2485 | tcg_gen_mov_i32(cpu_fpr[rd], cpu_tmp32); |
2502 | break; | 2486 | break; |
2503 | - case 0xc6: | 2487 | + case 0xc6: /* fdtos */ |
2504 | gen_op_load_fpr_DT1(DFPREG(rs2)); | 2488 | gen_op_load_fpr_DT1(DFPREG(rs2)); |
2505 | gen_clear_float_exceptions(); | 2489 | gen_clear_float_exceptions(); |
2506 | - tcg_gen_helper_0_0(helper_fdtos); | 2490 | + tcg_gen_helper_1_0(helper_fdtos, cpu_tmp32); |
2507 | tcg_gen_helper_0_0(helper_check_ieee_exceptions); | 2491 | tcg_gen_helper_0_0(helper_check_ieee_exceptions); |
2508 | - gen_op_store_FT0_fpr(rd); | 2492 | + tcg_gen_mov_i32(cpu_fpr[rd], cpu_tmp32); |
2509 | break; | 2493 | break; |
2510 | case 0xc7: /* fqtos */ | 2494 | case 0xc7: /* fqtos */ |
2511 | CHECK_FPU_FEATURE(dc, FLOAT128); | 2495 | CHECK_FPU_FEATURE(dc, FLOAT128); |
@@ -2515,14 +2499,12 @@ static void disas_sparc_insn(DisasContext * dc) | @@ -2515,14 +2499,12 @@ static void disas_sparc_insn(DisasContext * dc) | ||
2515 | tcg_gen_helper_0_0(helper_check_ieee_exceptions); | 2499 | tcg_gen_helper_0_0(helper_check_ieee_exceptions); |
2516 | tcg_gen_mov_i32(cpu_fpr[rd], cpu_tmp32); | 2500 | tcg_gen_mov_i32(cpu_fpr[rd], cpu_tmp32); |
2517 | break; | 2501 | break; |
2518 | - case 0xc8: | ||
2519 | - gen_op_load_fpr_FT1(rs2); | ||
2520 | - tcg_gen_helper_0_0(helper_fitod); | 2502 | + case 0xc8: /* fitod */ |
2503 | + tcg_gen_helper_0_1(helper_fitod, cpu_fpr[rs2]); | ||
2521 | gen_op_store_DT0_fpr(DFPREG(rd)); | 2504 | gen_op_store_DT0_fpr(DFPREG(rd)); |
2522 | break; | 2505 | break; |
2523 | - case 0xc9: | ||
2524 | - gen_op_load_fpr_FT1(rs2); | ||
2525 | - tcg_gen_helper_0_0(helper_fstod); | 2506 | + case 0xc9: /* fstod */ |
2507 | + tcg_gen_helper_0_1(helper_fstod, cpu_fpr[rs2]); | ||
2526 | gen_op_store_DT0_fpr(DFPREG(rd)); | 2508 | gen_op_store_DT0_fpr(DFPREG(rd)); |
2527 | break; | 2509 | break; |
2528 | case 0xcb: /* fqtod */ | 2510 | case 0xcb: /* fqtod */ |
@@ -2556,12 +2538,12 @@ static void disas_sparc_insn(DisasContext * dc) | @@ -2556,12 +2538,12 @@ static void disas_sparc_insn(DisasContext * dc) | ||
2556 | tcg_gen_helper_0_0(helper_check_ieee_exceptions); | 2538 | tcg_gen_helper_0_0(helper_check_ieee_exceptions); |
2557 | tcg_gen_mov_i32(cpu_fpr[rd], cpu_tmp32); | 2539 | tcg_gen_mov_i32(cpu_fpr[rd], cpu_tmp32); |
2558 | break; | 2540 | break; |
2559 | - case 0xd2: | 2541 | + case 0xd2: /* fdtoi */ |
2560 | gen_op_load_fpr_DT1(DFPREG(rs2)); | 2542 | gen_op_load_fpr_DT1(DFPREG(rs2)); |
2561 | gen_clear_float_exceptions(); | 2543 | gen_clear_float_exceptions(); |
2562 | - tcg_gen_helper_0_0(helper_fdtoi); | 2544 | + tcg_gen_helper_1_0(helper_fdtoi, cpu_tmp32); |
2563 | tcg_gen_helper_0_0(helper_check_ieee_exceptions); | 2545 | tcg_gen_helper_0_0(helper_check_ieee_exceptions); |
2564 | - gen_op_store_FT0_fpr(rd); | 2546 | + tcg_gen_mov_i32(cpu_fpr[rd], cpu_tmp32); |
2565 | break; | 2547 | break; |
2566 | case 0xd3: /* fqtoi */ | 2548 | case 0xd3: /* fqtoi */ |
2567 | CHECK_FPU_FEATURE(dc, FLOAT128); | 2549 | CHECK_FPU_FEATURE(dc, FLOAT128); |
@@ -2612,9 +2594,8 @@ static void disas_sparc_insn(DisasContext * dc) | @@ -2612,9 +2594,8 @@ static void disas_sparc_insn(DisasContext * dc) | ||
2612 | gen_op_store_QT0_fpr(QFPREG(rd)); | 2594 | gen_op_store_QT0_fpr(QFPREG(rd)); |
2613 | break; | 2595 | break; |
2614 | case 0x81: /* V9 fstox */ | 2596 | case 0x81: /* V9 fstox */ |
2615 | - gen_op_load_fpr_FT1(rs2); | ||
2616 | gen_clear_float_exceptions(); | 2597 | gen_clear_float_exceptions(); |
2617 | - tcg_gen_helper_0_0(helper_fstox); | 2598 | + tcg_gen_helper_0_1(helper_fstox, cpu_fpr[rs2]); |
2618 | tcg_gen_helper_0_0(helper_check_ieee_exceptions); | 2599 | tcg_gen_helper_0_0(helper_check_ieee_exceptions); |
2619 | gen_op_store_DT0_fpr(DFPREG(rd)); | 2600 | gen_op_store_DT0_fpr(DFPREG(rd)); |
2620 | break; | 2601 | break; |
@@ -2636,9 +2617,9 @@ static void disas_sparc_insn(DisasContext * dc) | @@ -2636,9 +2617,9 @@ static void disas_sparc_insn(DisasContext * dc) | ||
2636 | case 0x84: /* V9 fxtos */ | 2617 | case 0x84: /* V9 fxtos */ |
2637 | gen_op_load_fpr_DT1(DFPREG(rs2)); | 2618 | gen_op_load_fpr_DT1(DFPREG(rs2)); |
2638 | gen_clear_float_exceptions(); | 2619 | gen_clear_float_exceptions(); |
2639 | - tcg_gen_helper_0_0(helper_fxtos); | 2620 | + tcg_gen_helper_1_0(helper_fxtos, cpu_tmp32); |
2640 | tcg_gen_helper_0_0(helper_check_ieee_exceptions); | 2621 | tcg_gen_helper_0_0(helper_check_ieee_exceptions); |
2641 | - gen_op_store_FT0_fpr(rd); | 2622 | + tcg_gen_mov_i32(cpu_fpr[rd], cpu_tmp32); |
2642 | break; | 2623 | break; |
2643 | case 0x88: /* V9 fxtod */ | 2624 | case 0x88: /* V9 fxtod */ |
2644 | gen_op_load_fpr_DT1(DFPREG(rs2)); | 2625 | gen_op_load_fpr_DT1(DFPREG(rs2)); |