4 * Standard FPU translation
7 static inline void gen_reset_fpstatus(void)
9 gen_helper_reset_fpstatus(cpu_env
);
12 static inline void gen_compute_fprf_float64(TCGv_i64 arg
)
14 gen_helper_compute_fprf_float64(cpu_env
, arg
);
15 gen_helper_float_check_status(cpu_env
);
18 #if defined(TARGET_PPC64)
19 static void gen_set_cr1_from_fpscr(DisasContext
*ctx
)
21 TCGv_i32 tmp
= tcg_temp_new_i32();
22 tcg_gen_trunc_tl_i32(tmp
, cpu_fpscr
);
23 tcg_gen_shri_i32(cpu_crf
[1], tmp
, 28);
24 tcg_temp_free_i32(tmp
);
27 static void gen_set_cr1_from_fpscr(DisasContext
*ctx
)
29 tcg_gen_shri_tl(cpu_crf
[1], cpu_fpscr
, 28);
33 /*** Floating-Point arithmetic ***/
34 #define _GEN_FLOAT_ACB(name, op, op1, op2, isfloat, set_fprf, type) \
35 static void gen_f##name(DisasContext *ctx) \
41 if (unlikely(!ctx->fpu_enabled)) { \
42 gen_exception(ctx, POWERPC_EXCP_FPU); \
45 t0 = tcg_temp_new_i64(); \
46 t1 = tcg_temp_new_i64(); \
47 t2 = tcg_temp_new_i64(); \
48 t3 = tcg_temp_new_i64(); \
49 gen_reset_fpstatus(); \
50 get_fpr(t0, rA(ctx->opcode)); \
51 get_fpr(t1, rC(ctx->opcode)); \
52 get_fpr(t2, rB(ctx->opcode)); \
53 gen_helper_f##op(t3, cpu_env, t0, t1, t2); \
55 gen_helper_frsp(t3, cpu_env, t3); \
57 set_fpr(rD(ctx->opcode), t3); \
59 gen_compute_fprf_float64(t3); \
61 if (unlikely(Rc(ctx->opcode) != 0)) { \
62 gen_set_cr1_from_fpscr(ctx); \
64 tcg_temp_free_i64(t0); \
65 tcg_temp_free_i64(t1); \
66 tcg_temp_free_i64(t2); \
67 tcg_temp_free_i64(t3); \
70 #define GEN_FLOAT_ACB(name, op2, set_fprf, type) \
71 _GEN_FLOAT_ACB(name, name, 0x3F, op2, 0, set_fprf, type); \
72 _GEN_FLOAT_ACB(name##s, name, 0x3B, op2, 1, set_fprf, type);
74 #define _GEN_FLOAT_AB(name, op, op1, op2, inval, isfloat, set_fprf, type) \
75 static void gen_f##name(DisasContext *ctx) \
80 if (unlikely(!ctx->fpu_enabled)) { \
81 gen_exception(ctx, POWERPC_EXCP_FPU); \
84 t0 = tcg_temp_new_i64(); \
85 t1 = tcg_temp_new_i64(); \
86 t2 = tcg_temp_new_i64(); \
87 gen_reset_fpstatus(); \
88 get_fpr(t0, rA(ctx->opcode)); \
89 get_fpr(t1, rB(ctx->opcode)); \
90 gen_helper_f##op(t2, cpu_env, t0, t1); \
92 gen_helper_frsp(t2, cpu_env, t2); \
94 set_fpr(rD(ctx->opcode), t2); \
96 gen_compute_fprf_float64(t2); \
98 if (unlikely(Rc(ctx->opcode) != 0)) { \
99 gen_set_cr1_from_fpscr(ctx); \
101 tcg_temp_free_i64(t0); \
102 tcg_temp_free_i64(t1); \
103 tcg_temp_free_i64(t2); \
105 #define GEN_FLOAT_AB(name, op2, inval, set_fprf, type) \
106 _GEN_FLOAT_AB(name, name, 0x3F, op2, inval, 0, set_fprf, type); \
107 _GEN_FLOAT_AB(name##s, name, 0x3B, op2, inval, 1, set_fprf, type);
109 #define _GEN_FLOAT_AC(name, op, op1, op2, inval, isfloat, set_fprf, type) \
110 static void gen_f##name(DisasContext *ctx) \
115 if (unlikely(!ctx->fpu_enabled)) { \
116 gen_exception(ctx, POWERPC_EXCP_FPU); \
119 t0 = tcg_temp_new_i64(); \
120 t1 = tcg_temp_new_i64(); \
121 t2 = tcg_temp_new_i64(); \
122 gen_reset_fpstatus(); \
123 get_fpr(t0, rA(ctx->opcode)); \
124 get_fpr(t1, rC(ctx->opcode)); \
125 gen_helper_f##op(t2, cpu_env, t0, t1); \
127 gen_helper_frsp(t2, cpu_env, t2); \
129 set_fpr(rD(ctx->opcode), t2); \
131 gen_compute_fprf_float64(t2); \
133 if (unlikely(Rc(ctx->opcode) != 0)) { \
134 gen_set_cr1_from_fpscr(ctx); \
136 tcg_temp_free_i64(t0); \
137 tcg_temp_free_i64(t1); \
138 tcg_temp_free_i64(t2); \
140 #define GEN_FLOAT_AC(name, op2, inval, set_fprf, type) \
141 _GEN_FLOAT_AC(name, name, 0x3F, op2, inval, 0, set_fprf, type); \
142 _GEN_FLOAT_AC(name##s, name, 0x3B, op2, inval, 1, set_fprf, type);
144 #define GEN_FLOAT_B(name, op2, op3, set_fprf, type) \
145 static void gen_f##name(DisasContext *ctx) \
149 if (unlikely(!ctx->fpu_enabled)) { \
150 gen_exception(ctx, POWERPC_EXCP_FPU); \
153 t0 = tcg_temp_new_i64(); \
154 t1 = tcg_temp_new_i64(); \
155 gen_reset_fpstatus(); \
156 get_fpr(t0, rB(ctx->opcode)); \
157 gen_helper_f##name(t1, cpu_env, t0); \
158 set_fpr(rD(ctx->opcode), t1); \
160 gen_compute_fprf_float64(t1); \
162 if (unlikely(Rc(ctx->opcode) != 0)) { \
163 gen_set_cr1_from_fpscr(ctx); \
165 tcg_temp_free_i64(t0); \
166 tcg_temp_free_i64(t1); \
169 #define GEN_FLOAT_BS(name, op1, op2, set_fprf, type) \
170 static void gen_f##name(DisasContext *ctx) \
174 if (unlikely(!ctx->fpu_enabled)) { \
175 gen_exception(ctx, POWERPC_EXCP_FPU); \
178 t0 = tcg_temp_new_i64(); \
179 t1 = tcg_temp_new_i64(); \
180 gen_reset_fpstatus(); \
181 get_fpr(t0, rB(ctx->opcode)); \
182 gen_helper_f##name(t1, cpu_env, t0); \
183 set_fpr(rD(ctx->opcode), t1); \
185 gen_compute_fprf_float64(t1); \
187 if (unlikely(Rc(ctx->opcode) != 0)) { \
188 gen_set_cr1_from_fpscr(ctx); \
190 tcg_temp_free_i64(t0); \
191 tcg_temp_free_i64(t1); \
195 GEN_FLOAT_AB(add
, 0x15, 0x000007C0, 1, PPC_FLOAT
);
197 GEN_FLOAT_AB(div
, 0x12, 0x000007C0, 1, PPC_FLOAT
);
199 GEN_FLOAT_AC(mul
, 0x19, 0x0000F800, 1, PPC_FLOAT
);
202 GEN_FLOAT_BS(re
, 0x3F, 0x18, 1, PPC_FLOAT_EXT
);
205 GEN_FLOAT_BS(res
, 0x3B, 0x18, 1, PPC_FLOAT_FRES
);
208 GEN_FLOAT_BS(rsqrte
, 0x3F, 0x1A, 1, PPC_FLOAT_FRSQRTE
);
211 static void gen_frsqrtes(DisasContext
*ctx
)
215 if (unlikely(!ctx
->fpu_enabled
)) {
216 gen_exception(ctx
, POWERPC_EXCP_FPU
);
219 t0
= tcg_temp_new_i64();
220 t1
= tcg_temp_new_i64();
221 gen_reset_fpstatus();
222 get_fpr(t0
, rB(ctx
->opcode
));
223 gen_helper_frsqrte(t1
, cpu_env
, t0
);
224 gen_helper_frsp(t1
, cpu_env
, t1
);
225 set_fpr(rD(ctx
->opcode
), t1
);
226 gen_compute_fprf_float64(t1
);
227 if (unlikely(Rc(ctx
->opcode
) != 0)) {
228 gen_set_cr1_from_fpscr(ctx
);
230 tcg_temp_free_i64(t0
);
231 tcg_temp_free_i64(t1
);
235 _GEN_FLOAT_ACB(sel
, sel
, 0x3F, 0x17, 0, 0, PPC_FLOAT_FSEL
);
237 GEN_FLOAT_AB(sub
, 0x14, 0x000007C0, 1, PPC_FLOAT
);
241 static void gen_fsqrt(DisasContext
*ctx
)
245 if (unlikely(!ctx
->fpu_enabled
)) {
246 gen_exception(ctx
, POWERPC_EXCP_FPU
);
249 t0
= tcg_temp_new_i64();
250 t1
= tcg_temp_new_i64();
251 gen_reset_fpstatus();
252 get_fpr(t0
, rB(ctx
->opcode
));
253 gen_helper_fsqrt(t1
, cpu_env
, t0
);
254 set_fpr(rD(ctx
->opcode
), t1
);
255 gen_compute_fprf_float64(t1
);
256 if (unlikely(Rc(ctx
->opcode
) != 0)) {
257 gen_set_cr1_from_fpscr(ctx
);
259 tcg_temp_free_i64(t0
);
260 tcg_temp_free_i64(t1
);
263 static void gen_fsqrts(DisasContext
*ctx
)
267 if (unlikely(!ctx
->fpu_enabled
)) {
268 gen_exception(ctx
, POWERPC_EXCP_FPU
);
271 t0
= tcg_temp_new_i64();
272 t1
= tcg_temp_new_i64();
273 gen_reset_fpstatus();
274 get_fpr(t0
, rB(ctx
->opcode
));
275 gen_helper_fsqrt(t1
, cpu_env
, t0
);
276 gen_helper_frsp(t1
, cpu_env
, t1
);
277 set_fpr(rD(ctx
->opcode
), t1
);
278 gen_compute_fprf_float64(t1
);
279 if (unlikely(Rc(ctx
->opcode
) != 0)) {
280 gen_set_cr1_from_fpscr(ctx
);
282 tcg_temp_free_i64(t0
);
283 tcg_temp_free_i64(t1
);
286 /*** Floating-Point multiply-and-add ***/
288 GEN_FLOAT_ACB(madd
, 0x1D, 1, PPC_FLOAT
);
290 GEN_FLOAT_ACB(msub
, 0x1C, 1, PPC_FLOAT
);
291 /* fnmadd - fnmadds */
292 GEN_FLOAT_ACB(nmadd
, 0x1F, 1, PPC_FLOAT
);
293 /* fnmsub - fnmsubs */
294 GEN_FLOAT_ACB(nmsub
, 0x1E, 1, PPC_FLOAT
);
296 /*** Floating-Point round & convert ***/
298 GEN_FLOAT_B(ctiw
, 0x0E, 0x00, 0, PPC_FLOAT
);
300 GEN_FLOAT_B(ctiwu
, 0x0E, 0x04, 0, PPC2_FP_CVT_ISA206
);
302 GEN_FLOAT_B(ctiwz
, 0x0F, 0x00, 0, PPC_FLOAT
);
304 GEN_FLOAT_B(ctiwuz
, 0x0F, 0x04, 0, PPC2_FP_CVT_ISA206
);
306 GEN_FLOAT_B(rsp
, 0x0C, 0x00, 1, PPC_FLOAT
);
308 GEN_FLOAT_B(cfid
, 0x0E, 0x1A, 1, PPC2_FP_CVT_S64
);
310 GEN_FLOAT_B(cfids
, 0x0E, 0x1A, 0, PPC2_FP_CVT_ISA206
);
312 GEN_FLOAT_B(cfidu
, 0x0E, 0x1E, 0, PPC2_FP_CVT_ISA206
);
314 GEN_FLOAT_B(cfidus
, 0x0E, 0x1E, 0, PPC2_FP_CVT_ISA206
);
316 GEN_FLOAT_B(ctid
, 0x0E, 0x19, 0, PPC2_FP_CVT_S64
);
318 GEN_FLOAT_B(ctidu
, 0x0E, 0x1D, 0, PPC2_FP_CVT_ISA206
);
320 GEN_FLOAT_B(ctidz
, 0x0F, 0x19, 0, PPC2_FP_CVT_S64
);
322 GEN_FLOAT_B(ctiduz
, 0x0F, 0x1D, 0, PPC2_FP_CVT_ISA206
);
325 GEN_FLOAT_B(rin
, 0x08, 0x0C, 1, PPC_FLOAT_EXT
);
327 GEN_FLOAT_B(riz
, 0x08, 0x0D, 1, PPC_FLOAT_EXT
);
329 GEN_FLOAT_B(rip
, 0x08, 0x0E, 1, PPC_FLOAT_EXT
);
331 GEN_FLOAT_B(rim
, 0x08, 0x0F, 1, PPC_FLOAT_EXT
);
333 static void gen_ftdiv(DisasContext
*ctx
)
337 if (unlikely(!ctx
->fpu_enabled
)) {
338 gen_exception(ctx
, POWERPC_EXCP_FPU
);
341 t0
= tcg_temp_new_i64();
342 t1
= tcg_temp_new_i64();
343 get_fpr(t0
, rA(ctx
->opcode
));
344 get_fpr(t1
, rB(ctx
->opcode
));
345 gen_helper_ftdiv(cpu_crf
[crfD(ctx
->opcode
)], t0
, t1
);
346 tcg_temp_free_i64(t0
);
347 tcg_temp_free_i64(t1
);
350 static void gen_ftsqrt(DisasContext
*ctx
)
353 if (unlikely(!ctx
->fpu_enabled
)) {
354 gen_exception(ctx
, POWERPC_EXCP_FPU
);
357 t0
= tcg_temp_new_i64();
358 get_fpr(t0
, rB(ctx
->opcode
));
359 gen_helper_ftsqrt(cpu_crf
[crfD(ctx
->opcode
)], t0
);
360 tcg_temp_free_i64(t0
);
365 /*** Floating-Point compare ***/
368 static void gen_fcmpo(DisasContext
*ctx
)
373 if (unlikely(!ctx
->fpu_enabled
)) {
374 gen_exception(ctx
, POWERPC_EXCP_FPU
);
377 t0
= tcg_temp_new_i64();
378 t1
= tcg_temp_new_i64();
379 gen_reset_fpstatus();
380 crf
= tcg_const_i32(crfD(ctx
->opcode
));
381 get_fpr(t0
, rA(ctx
->opcode
));
382 get_fpr(t1
, rB(ctx
->opcode
));
383 gen_helper_fcmpo(cpu_env
, t0
, t1
, crf
);
384 tcg_temp_free_i32(crf
);
385 gen_helper_float_check_status(cpu_env
);
386 tcg_temp_free_i64(t0
);
387 tcg_temp_free_i64(t1
);
391 static void gen_fcmpu(DisasContext
*ctx
)
396 if (unlikely(!ctx
->fpu_enabled
)) {
397 gen_exception(ctx
, POWERPC_EXCP_FPU
);
400 t0
= tcg_temp_new_i64();
401 t1
= tcg_temp_new_i64();
402 gen_reset_fpstatus();
403 crf
= tcg_const_i32(crfD(ctx
->opcode
));
404 get_fpr(t0
, rA(ctx
->opcode
));
405 get_fpr(t1
, rB(ctx
->opcode
));
406 gen_helper_fcmpu(cpu_env
, t0
, t1
, crf
);
407 tcg_temp_free_i32(crf
);
408 gen_helper_float_check_status(cpu_env
);
409 tcg_temp_free_i64(t0
);
410 tcg_temp_free_i64(t1
);
413 /*** Floating-point move ***/
415 /* XXX: beware that fabs never checks for NaNs nor update FPSCR */
416 static void gen_fabs(DisasContext
*ctx
)
420 if (unlikely(!ctx
->fpu_enabled
)) {
421 gen_exception(ctx
, POWERPC_EXCP_FPU
);
424 t0
= tcg_temp_new_i64();
425 t1
= tcg_temp_new_i64();
426 get_fpr(t0
, rB(ctx
->opcode
));
427 tcg_gen_andi_i64(t1
, t0
, ~(1ULL << 63));
428 set_fpr(rD(ctx
->opcode
), t1
);
429 if (unlikely(Rc(ctx
->opcode
))) {
430 gen_set_cr1_from_fpscr(ctx
);
432 tcg_temp_free_i64(t0
);
433 tcg_temp_free_i64(t1
);
437 /* XXX: beware that fmr never checks for NaNs nor update FPSCR */
438 static void gen_fmr(DisasContext
*ctx
)
441 if (unlikely(!ctx
->fpu_enabled
)) {
442 gen_exception(ctx
, POWERPC_EXCP_FPU
);
445 t0
= tcg_temp_new_i64();
446 get_fpr(t0
, rB(ctx
->opcode
));
447 set_fpr(rD(ctx
->opcode
), t0
);
448 if (unlikely(Rc(ctx
->opcode
))) {
449 gen_set_cr1_from_fpscr(ctx
);
451 tcg_temp_free_i64(t0
);
455 /* XXX: beware that fnabs never checks for NaNs nor update FPSCR */
456 static void gen_fnabs(DisasContext
*ctx
)
460 if (unlikely(!ctx
->fpu_enabled
)) {
461 gen_exception(ctx
, POWERPC_EXCP_FPU
);
464 t0
= tcg_temp_new_i64();
465 t1
= tcg_temp_new_i64();
466 get_fpr(t0
, rB(ctx
->opcode
));
467 tcg_gen_ori_i64(t1
, t0
, 1ULL << 63);
468 set_fpr(rD(ctx
->opcode
), t1
);
469 if (unlikely(Rc(ctx
->opcode
))) {
470 gen_set_cr1_from_fpscr(ctx
);
472 tcg_temp_free_i64(t0
);
473 tcg_temp_free_i64(t1
);
477 /* XXX: beware that fneg never checks for NaNs nor update FPSCR */
478 static void gen_fneg(DisasContext
*ctx
)
482 if (unlikely(!ctx
->fpu_enabled
)) {
483 gen_exception(ctx
, POWERPC_EXCP_FPU
);
486 t0
= tcg_temp_new_i64();
487 t1
= tcg_temp_new_i64();
488 get_fpr(t0
, rB(ctx
->opcode
));
489 tcg_gen_xori_i64(t1
, t0
, 1ULL << 63);
490 set_fpr(rD(ctx
->opcode
), t1
);
491 if (unlikely(Rc(ctx
->opcode
))) {
492 gen_set_cr1_from_fpscr(ctx
);
494 tcg_temp_free_i64(t0
);
495 tcg_temp_free_i64(t1
);
498 /* fcpsgn: PowerPC 2.05 specification */
499 /* XXX: beware that fcpsgn never checks for NaNs nor update FPSCR */
500 static void gen_fcpsgn(DisasContext
*ctx
)
505 if (unlikely(!ctx
->fpu_enabled
)) {
506 gen_exception(ctx
, POWERPC_EXCP_FPU
);
509 t0
= tcg_temp_new_i64();
510 t1
= tcg_temp_new_i64();
511 t2
= tcg_temp_new_i64();
512 get_fpr(t0
, rA(ctx
->opcode
));
513 get_fpr(t1
, rB(ctx
->opcode
));
514 tcg_gen_deposit_i64(t2
, t0
, t1
, 0, 63);
515 set_fpr(rD(ctx
->opcode
), t2
);
516 if (unlikely(Rc(ctx
->opcode
))) {
517 gen_set_cr1_from_fpscr(ctx
);
519 tcg_temp_free_i64(t0
);
520 tcg_temp_free_i64(t1
);
521 tcg_temp_free_i64(t2
);
524 static void gen_fmrgew(DisasContext
*ctx
)
529 if (unlikely(!ctx
->fpu_enabled
)) {
530 gen_exception(ctx
, POWERPC_EXCP_FPU
);
533 b0
= tcg_temp_new_i64();
534 t0
= tcg_temp_new_i64();
535 t1
= tcg_temp_new_i64();
536 get_fpr(t0
, rB(ctx
->opcode
));
537 tcg_gen_shri_i64(b0
, t0
, 32);
538 get_fpr(t0
, rA(ctx
->opcode
));
539 tcg_gen_deposit_i64(t1
, t0
, b0
, 0, 32);
540 set_fpr(rD(ctx
->opcode
), t1
);
541 tcg_temp_free_i64(b0
);
542 tcg_temp_free_i64(t0
);
543 tcg_temp_free_i64(t1
);
546 static void gen_fmrgow(DisasContext
*ctx
)
551 if (unlikely(!ctx
->fpu_enabled
)) {
552 gen_exception(ctx
, POWERPC_EXCP_FPU
);
555 t0
= tcg_temp_new_i64();
556 t1
= tcg_temp_new_i64();
557 t2
= tcg_temp_new_i64();
558 get_fpr(t0
, rB(ctx
->opcode
));
559 get_fpr(t1
, rA(ctx
->opcode
));
560 tcg_gen_deposit_i64(t2
, t0
, t1
, 32, 32);
561 set_fpr(rD(ctx
->opcode
), t2
);
562 tcg_temp_free_i64(t0
);
563 tcg_temp_free_i64(t1
);
564 tcg_temp_free_i64(t2
);
567 /*** Floating-Point status & ctrl register ***/
570 static void gen_mcrfs(DisasContext
*ctx
)
572 TCGv tmp
= tcg_temp_new();
574 TCGv_i64 tnew_fpscr
= tcg_temp_new_i64();
579 if (unlikely(!ctx
->fpu_enabled
)) {
580 gen_exception(ctx
, POWERPC_EXCP_FPU
);
583 bfa
= crfS(ctx
->opcode
);
586 tcg_gen_shri_tl(tmp
, cpu_fpscr
, shift
);
587 tcg_gen_trunc_tl_i32(cpu_crf
[crfD(ctx
->opcode
)], tmp
);
588 tcg_gen_andi_i32(cpu_crf
[crfD(ctx
->opcode
)], cpu_crf
[crfD(ctx
->opcode
)],
591 tcg_gen_extu_tl_i64(tnew_fpscr
, cpu_fpscr
);
592 /* Only the exception bits (including FX) should be cleared if read */
593 tcg_gen_andi_i64(tnew_fpscr
, tnew_fpscr
,
594 ~((0xF << shift
) & FP_EX_CLEAR_BITS
));
595 /* FEX and VX need to be updated, so don't set fpscr directly */
596 tmask
= tcg_const_i32(1 << nibble
);
597 gen_helper_store_fpscr(cpu_env
, tnew_fpscr
, tmask
);
598 tcg_temp_free_i32(tmask
);
599 tcg_temp_free_i64(tnew_fpscr
);
603 static void gen_mffs(DisasContext
*ctx
)
606 if (unlikely(!ctx
->fpu_enabled
)) {
607 gen_exception(ctx
, POWERPC_EXCP_FPU
);
610 t0
= tcg_temp_new_i64();
611 gen_reset_fpstatus();
612 tcg_gen_extu_tl_i64(t0
, cpu_fpscr
);
613 set_fpr(rD(ctx
->opcode
), t0
);
614 if (unlikely(Rc(ctx
->opcode
))) {
615 gen_set_cr1_from_fpscr(ctx
);
617 tcg_temp_free_i64(t0
);
621 static void gen_mtfsb0(DisasContext
*ctx
)
625 if (unlikely(!ctx
->fpu_enabled
)) {
626 gen_exception(ctx
, POWERPC_EXCP_FPU
);
629 crb
= 31 - crbD(ctx
->opcode
);
630 gen_reset_fpstatus();
631 if (likely(crb
!= FPSCR_FEX
&& crb
!= FPSCR_VX
)) {
633 t0
= tcg_const_i32(crb
);
634 gen_helper_fpscr_clrbit(cpu_env
, t0
);
635 tcg_temp_free_i32(t0
);
637 if (unlikely(Rc(ctx
->opcode
) != 0)) {
638 tcg_gen_trunc_tl_i32(cpu_crf
[1], cpu_fpscr
);
639 tcg_gen_shri_i32(cpu_crf
[1], cpu_crf
[1], FPSCR_OX
);
644 static void gen_mtfsb1(DisasContext
*ctx
)
648 if (unlikely(!ctx
->fpu_enabled
)) {
649 gen_exception(ctx
, POWERPC_EXCP_FPU
);
652 crb
= 31 - crbD(ctx
->opcode
);
653 gen_reset_fpstatus();
654 /* XXX: we pretend we can only do IEEE floating-point computations */
655 if (likely(crb
!= FPSCR_FEX
&& crb
!= FPSCR_VX
&& crb
!= FPSCR_NI
)) {
657 t0
= tcg_const_i32(crb
);
658 gen_helper_fpscr_setbit(cpu_env
, t0
);
659 tcg_temp_free_i32(t0
);
661 if (unlikely(Rc(ctx
->opcode
) != 0)) {
662 tcg_gen_trunc_tl_i32(cpu_crf
[1], cpu_fpscr
);
663 tcg_gen_shri_i32(cpu_crf
[1], cpu_crf
[1], FPSCR_OX
);
665 /* We can raise a differed exception */
666 gen_helper_float_check_status(cpu_env
);
670 static void gen_mtfsf(DisasContext
*ctx
)
676 if (unlikely(!ctx
->fpu_enabled
)) {
677 gen_exception(ctx
, POWERPC_EXCP_FPU
);
680 flm
= FPFLM(ctx
->opcode
);
681 l
= FPL(ctx
->opcode
);
682 w
= FPW(ctx
->opcode
);
683 if (unlikely(w
& !(ctx
->insns_flags2
& PPC2_ISA205
))) {
684 gen_inval_exception(ctx
, POWERPC_EXCP_INVAL_INVAL
);
687 gen_reset_fpstatus();
689 t0
= tcg_const_i32((ctx
->insns_flags2
& PPC2_ISA205
) ? 0xffff : 0xff);
691 t0
= tcg_const_i32(flm
<< (w
* 8));
693 t1
= tcg_temp_new_i64();
694 get_fpr(t1
, rB(ctx
->opcode
));
695 gen_helper_store_fpscr(cpu_env
, t1
, t0
);
696 tcg_temp_free_i32(t0
);
697 if (unlikely(Rc(ctx
->opcode
) != 0)) {
698 tcg_gen_trunc_tl_i32(cpu_crf
[1], cpu_fpscr
);
699 tcg_gen_shri_i32(cpu_crf
[1], cpu_crf
[1], FPSCR_OX
);
701 /* We can raise a differed exception */
702 gen_helper_float_check_status(cpu_env
);
703 tcg_temp_free_i64(t1
);
707 static void gen_mtfsfi(DisasContext
*ctx
)
713 if (unlikely(!ctx
->fpu_enabled
)) {
714 gen_exception(ctx
, POWERPC_EXCP_FPU
);
717 w
= FPW(ctx
->opcode
);
718 bf
= FPBF(ctx
->opcode
);
719 if (unlikely(w
& !(ctx
->insns_flags2
& PPC2_ISA205
))) {
720 gen_inval_exception(ctx
, POWERPC_EXCP_INVAL_INVAL
);
723 sh
= (8 * w
) + 7 - bf
;
724 gen_reset_fpstatus();
725 t0
= tcg_const_i64(((uint64_t)FPIMM(ctx
->opcode
)) << (4 * sh
));
726 t1
= tcg_const_i32(1 << sh
);
727 gen_helper_store_fpscr(cpu_env
, t0
, t1
);
728 tcg_temp_free_i64(t0
);
729 tcg_temp_free_i32(t1
);
730 if (unlikely(Rc(ctx
->opcode
) != 0)) {
731 tcg_gen_trunc_tl_i32(cpu_crf
[1], cpu_fpscr
);
732 tcg_gen_shri_i32(cpu_crf
[1], cpu_crf
[1], FPSCR_OX
);
734 /* We can raise a differed exception */
735 gen_helper_float_check_status(cpu_env
);
738 /*** Floating-point load ***/
739 #define GEN_LDF(name, ldop, opc, type) \
740 static void glue(gen_, name)(DisasContext *ctx) \
744 if (unlikely(!ctx->fpu_enabled)) { \
745 gen_exception(ctx, POWERPC_EXCP_FPU); \
748 gen_set_access_type(ctx, ACCESS_FLOAT); \
749 EA = tcg_temp_new(); \
750 t0 = tcg_temp_new_i64(); \
751 gen_addr_imm_index(ctx, EA, 0); \
752 gen_qemu_##ldop(ctx, t0, EA); \
753 set_fpr(rD(ctx->opcode), t0); \
755 tcg_temp_free_i64(t0); \
758 #define GEN_LDUF(name, ldop, opc, type) \
759 static void glue(gen_, name##u)(DisasContext *ctx) \
763 if (unlikely(!ctx->fpu_enabled)) { \
764 gen_exception(ctx, POWERPC_EXCP_FPU); \
767 if (unlikely(rA(ctx->opcode) == 0)) { \
768 gen_inval_exception(ctx, POWERPC_EXCP_INVAL_INVAL); \
771 gen_set_access_type(ctx, ACCESS_FLOAT); \
772 EA = tcg_temp_new(); \
773 t0 = tcg_temp_new_i64(); \
774 gen_addr_imm_index(ctx, EA, 0); \
775 gen_qemu_##ldop(ctx, t0, EA); \
776 set_fpr(rD(ctx->opcode), t0); \
777 tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], EA); \
779 tcg_temp_free_i64(t0); \
782 #define GEN_LDUXF(name, ldop, opc, type) \
783 static void glue(gen_, name##ux)(DisasContext *ctx) \
787 if (unlikely(!ctx->fpu_enabled)) { \
788 gen_exception(ctx, POWERPC_EXCP_FPU); \
791 t0 = tcg_temp_new_i64(); \
792 if (unlikely(rA(ctx->opcode) == 0)) { \
793 gen_inval_exception(ctx, POWERPC_EXCP_INVAL_INVAL); \
796 gen_set_access_type(ctx, ACCESS_FLOAT); \
797 EA = tcg_temp_new(); \
798 gen_addr_reg_index(ctx, EA); \
799 gen_qemu_##ldop(ctx, t0, EA); \
800 set_fpr(rD(ctx->opcode), t0); \
801 tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], EA); \
803 tcg_temp_free_i64(t0); \
806 #define GEN_LDXF(name, ldop, opc2, opc3, type) \
807 static void glue(gen_, name##x)(DisasContext *ctx) \
811 if (unlikely(!ctx->fpu_enabled)) { \
812 gen_exception(ctx, POWERPC_EXCP_FPU); \
815 gen_set_access_type(ctx, ACCESS_FLOAT); \
816 EA = tcg_temp_new(); \
817 t0 = tcg_temp_new_i64(); \
818 gen_addr_reg_index(ctx, EA); \
819 gen_qemu_##ldop(ctx, t0, EA); \
820 set_fpr(rD(ctx->opcode), t0); \
822 tcg_temp_free_i64(t0); \
825 #define GEN_LDFS(name, ldop, op, type) \
826 GEN_LDF(name, ldop, op | 0x20, type); \
827 GEN_LDUF(name, ldop, op | 0x21, type); \
828 GEN_LDUXF(name, ldop, op | 0x01, type); \
829 GEN_LDXF(name, ldop, 0x17, op | 0x00, type)
831 static void gen_qemu_ld32fs(DisasContext
*ctx
, TCGv_i64 dest
, TCGv addr
)
833 TCGv_i32 tmp
= tcg_temp_new_i32();
834 tcg_gen_qemu_ld_i32(tmp
, addr
, ctx
->mem_idx
, DEF_MEMOP(MO_UL
));
835 gen_helper_todouble(dest
, tmp
);
836 tcg_temp_free_i32(tmp
);
839 /* lfd lfdu lfdux lfdx */
840 GEN_LDFS(lfd
, ld64_i64
, 0x12, PPC_FLOAT
);
841 /* lfs lfsu lfsux lfsx */
842 GEN_LDFS(lfs
, ld32fs
, 0x10, PPC_FLOAT
);
844 /* lfdepx (external PID lfdx) */
845 static void gen_lfdepx(DisasContext
*ctx
)
850 if (unlikely(!ctx
->fpu_enabled
)) {
851 gen_exception(ctx
, POWERPC_EXCP_FPU
);
854 gen_set_access_type(ctx
, ACCESS_FLOAT
);
856 t0
= tcg_temp_new_i64();
857 gen_addr_reg_index(ctx
, EA
);
858 tcg_gen_qemu_ld_i64(t0
, EA
, PPC_TLB_EPID_LOAD
, DEF_MEMOP(MO_Q
));
859 set_fpr(rD(ctx
->opcode
), t0
);
861 tcg_temp_free_i64(t0
);
865 static void gen_lfdp(DisasContext
*ctx
)
869 if (unlikely(!ctx
->fpu_enabled
)) {
870 gen_exception(ctx
, POWERPC_EXCP_FPU
);
873 gen_set_access_type(ctx
, ACCESS_FLOAT
);
875 gen_addr_imm_index(ctx
, EA
, 0);
876 t0
= tcg_temp_new_i64();
878 * We only need to swap high and low halves. gen_qemu_ld64_i64
879 * does necessary 64-bit byteswap already.
881 if (unlikely(ctx
->le_mode
)) {
882 gen_qemu_ld64_i64(ctx
, t0
, EA
);
883 set_fpr(rD(ctx
->opcode
) + 1, t0
);
884 tcg_gen_addi_tl(EA
, EA
, 8);
885 gen_qemu_ld64_i64(ctx
, t0
, EA
);
886 set_fpr(rD(ctx
->opcode
), t0
);
888 gen_qemu_ld64_i64(ctx
, t0
, EA
);
889 set_fpr(rD(ctx
->opcode
), t0
);
890 tcg_gen_addi_tl(EA
, EA
, 8);
891 gen_qemu_ld64_i64(ctx
, t0
, EA
);
892 set_fpr(rD(ctx
->opcode
) + 1, t0
);
895 tcg_temp_free_i64(t0
);
899 static void gen_lfdpx(DisasContext
*ctx
)
903 if (unlikely(!ctx
->fpu_enabled
)) {
904 gen_exception(ctx
, POWERPC_EXCP_FPU
);
907 gen_set_access_type(ctx
, ACCESS_FLOAT
);
909 gen_addr_reg_index(ctx
, EA
);
910 t0
= tcg_temp_new_i64();
912 * We only need to swap high and low halves. gen_qemu_ld64_i64
913 * does necessary 64-bit byteswap already.
915 if (unlikely(ctx
->le_mode
)) {
916 gen_qemu_ld64_i64(ctx
, t0
, EA
);
917 set_fpr(rD(ctx
->opcode
) + 1, t0
);
918 tcg_gen_addi_tl(EA
, EA
, 8);
919 gen_qemu_ld64_i64(ctx
, t0
, EA
);
920 set_fpr(rD(ctx
->opcode
), t0
);
922 gen_qemu_ld64_i64(ctx
, t0
, EA
);
923 set_fpr(rD(ctx
->opcode
), t0
);
924 tcg_gen_addi_tl(EA
, EA
, 8);
925 gen_qemu_ld64_i64(ctx
, t0
, EA
);
926 set_fpr(rD(ctx
->opcode
) + 1, t0
);
929 tcg_temp_free_i64(t0
);
933 static void gen_lfiwax(DisasContext
*ctx
)
938 if (unlikely(!ctx
->fpu_enabled
)) {
939 gen_exception(ctx
, POWERPC_EXCP_FPU
);
942 gen_set_access_type(ctx
, ACCESS_FLOAT
);
945 t1
= tcg_temp_new_i64();
946 gen_addr_reg_index(ctx
, EA
);
947 gen_qemu_ld32s(ctx
, t0
, EA
);
948 tcg_gen_ext_tl_i64(t1
, t0
);
949 set_fpr(rD(ctx
->opcode
), t1
);
952 tcg_temp_free_i64(t1
);
956 static void gen_lfiwzx(DisasContext
*ctx
)
960 if (unlikely(!ctx
->fpu_enabled
)) {
961 gen_exception(ctx
, POWERPC_EXCP_FPU
);
964 gen_set_access_type(ctx
, ACCESS_FLOAT
);
966 t0
= tcg_temp_new_i64();
967 gen_addr_reg_index(ctx
, EA
);
968 gen_qemu_ld32u_i64(ctx
, t0
, EA
);
969 set_fpr(rD(ctx
->opcode
), t0
);
971 tcg_temp_free_i64(t0
);
973 /*** Floating-point store ***/
974 #define GEN_STF(name, stop, opc, type) \
975 static void glue(gen_, name)(DisasContext *ctx) \
979 if (unlikely(!ctx->fpu_enabled)) { \
980 gen_exception(ctx, POWERPC_EXCP_FPU); \
983 gen_set_access_type(ctx, ACCESS_FLOAT); \
984 EA = tcg_temp_new(); \
985 t0 = tcg_temp_new_i64(); \
986 gen_addr_imm_index(ctx, EA, 0); \
987 get_fpr(t0, rS(ctx->opcode)); \
988 gen_qemu_##stop(ctx, t0, EA); \
990 tcg_temp_free_i64(t0); \
993 #define GEN_STUF(name, stop, opc, type) \
994 static void glue(gen_, name##u)(DisasContext *ctx) \
998 if (unlikely(!ctx->fpu_enabled)) { \
999 gen_exception(ctx, POWERPC_EXCP_FPU); \
1002 if (unlikely(rA(ctx->opcode) == 0)) { \
1003 gen_inval_exception(ctx, POWERPC_EXCP_INVAL_INVAL); \
1006 gen_set_access_type(ctx, ACCESS_FLOAT); \
1007 EA = tcg_temp_new(); \
1008 t0 = tcg_temp_new_i64(); \
1009 gen_addr_imm_index(ctx, EA, 0); \
1010 get_fpr(t0, rS(ctx->opcode)); \
1011 gen_qemu_##stop(ctx, t0, EA); \
1012 tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], EA); \
1013 tcg_temp_free(EA); \
1014 tcg_temp_free_i64(t0); \
1017 #define GEN_STUXF(name, stop, opc, type) \
1018 static void glue(gen_, name##ux)(DisasContext *ctx) \
1022 if (unlikely(!ctx->fpu_enabled)) { \
1023 gen_exception(ctx, POWERPC_EXCP_FPU); \
1026 if (unlikely(rA(ctx->opcode) == 0)) { \
1027 gen_inval_exception(ctx, POWERPC_EXCP_INVAL_INVAL); \
1030 gen_set_access_type(ctx, ACCESS_FLOAT); \
1031 EA = tcg_temp_new(); \
1032 t0 = tcg_temp_new_i64(); \
1033 gen_addr_reg_index(ctx, EA); \
1034 get_fpr(t0, rS(ctx->opcode)); \
1035 gen_qemu_##stop(ctx, t0, EA); \
1036 tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], EA); \
1037 tcg_temp_free(EA); \
1038 tcg_temp_free_i64(t0); \
1041 #define GEN_STXF(name, stop, opc2, opc3, type) \
1042 static void glue(gen_, name##x)(DisasContext *ctx) \
1046 if (unlikely(!ctx->fpu_enabled)) { \
1047 gen_exception(ctx, POWERPC_EXCP_FPU); \
1050 gen_set_access_type(ctx, ACCESS_FLOAT); \
1051 EA = tcg_temp_new(); \
1052 t0 = tcg_temp_new_i64(); \
1053 gen_addr_reg_index(ctx, EA); \
1054 get_fpr(t0, rS(ctx->opcode)); \
1055 gen_qemu_##stop(ctx, t0, EA); \
1056 tcg_temp_free(EA); \
1057 tcg_temp_free_i64(t0); \
1060 #define GEN_STFS(name, stop, op, type) \
1061 GEN_STF(name, stop, op | 0x20, type); \
1062 GEN_STUF(name, stop, op | 0x21, type); \
1063 GEN_STUXF(name, stop, op | 0x01, type); \
1064 GEN_STXF(name, stop, 0x17, op | 0x00, type)
1066 static void gen_qemu_st32fs(DisasContext
*ctx
, TCGv_i64 src
, TCGv addr
)
1068 TCGv_i32 tmp
= tcg_temp_new_i32();
1069 gen_helper_tosingle(tmp
, src
);
1070 tcg_gen_qemu_st_i32(tmp
, addr
, ctx
->mem_idx
, DEF_MEMOP(MO_UL
));
1071 tcg_temp_free_i32(tmp
);
1074 /* stfd stfdu stfdux stfdx */
1075 GEN_STFS(stfd
, st64_i64
, 0x16, PPC_FLOAT
);
1076 /* stfs stfsu stfsux stfsx */
1077 GEN_STFS(stfs
, st32fs
, 0x14, PPC_FLOAT
);
1079 /* stfdepx (external PID lfdx) */
1080 static void gen_stfdepx(DisasContext
*ctx
)
1085 if (unlikely(!ctx
->fpu_enabled
)) {
1086 gen_exception(ctx
, POWERPC_EXCP_FPU
);
1089 gen_set_access_type(ctx
, ACCESS_FLOAT
);
1090 EA
= tcg_temp_new();
1091 t0
= tcg_temp_new_i64();
1092 gen_addr_reg_index(ctx
, EA
);
1093 get_fpr(t0
, rD(ctx
->opcode
));
1094 tcg_gen_qemu_st_i64(t0
, EA
, PPC_TLB_EPID_STORE
, DEF_MEMOP(MO_Q
));
1096 tcg_temp_free_i64(t0
);
1100 static void gen_stfdp(DisasContext
*ctx
)
1104 if (unlikely(!ctx
->fpu_enabled
)) {
1105 gen_exception(ctx
, POWERPC_EXCP_FPU
);
1108 gen_set_access_type(ctx
, ACCESS_FLOAT
);
1109 EA
= tcg_temp_new();
1110 t0
= tcg_temp_new_i64();
1111 gen_addr_imm_index(ctx
, EA
, 0);
1113 * We only need to swap high and low halves. gen_qemu_st64_i64
1114 * does necessary 64-bit byteswap already.
1116 if (unlikely(ctx
->le_mode
)) {
1117 get_fpr(t0
, rD(ctx
->opcode
) + 1);
1118 gen_qemu_st64_i64(ctx
, t0
, EA
);
1119 tcg_gen_addi_tl(EA
, EA
, 8);
1120 get_fpr(t0
, rD(ctx
->opcode
));
1121 gen_qemu_st64_i64(ctx
, t0
, EA
);
1123 get_fpr(t0
, rD(ctx
->opcode
));
1124 gen_qemu_st64_i64(ctx
, t0
, EA
);
1125 tcg_gen_addi_tl(EA
, EA
, 8);
1126 get_fpr(t0
, rD(ctx
->opcode
) + 1);
1127 gen_qemu_st64_i64(ctx
, t0
, EA
);
1130 tcg_temp_free_i64(t0
);
1134 static void gen_stfdpx(DisasContext
*ctx
)
1138 if (unlikely(!ctx
->fpu_enabled
)) {
1139 gen_exception(ctx
, POWERPC_EXCP_FPU
);
1142 gen_set_access_type(ctx
, ACCESS_FLOAT
);
1143 EA
= tcg_temp_new();
1144 t0
= tcg_temp_new_i64();
1145 gen_addr_reg_index(ctx
, EA
);
1147 * We only need to swap high and low halves. gen_qemu_st64_i64
1148 * does necessary 64-bit byteswap already.
1150 if (unlikely(ctx
->le_mode
)) {
1151 get_fpr(t0
, rD(ctx
->opcode
) + 1);
1152 gen_qemu_st64_i64(ctx
, t0
, EA
);
1153 tcg_gen_addi_tl(EA
, EA
, 8);
1154 get_fpr(t0
, rD(ctx
->opcode
));
1155 gen_qemu_st64_i64(ctx
, t0
, EA
);
1157 get_fpr(t0
, rD(ctx
->opcode
));
1158 gen_qemu_st64_i64(ctx
, t0
, EA
);
1159 tcg_gen_addi_tl(EA
, EA
, 8);
1160 get_fpr(t0
, rD(ctx
->opcode
) + 1);
1161 gen_qemu_st64_i64(ctx
, t0
, EA
);
1164 tcg_temp_free_i64(t0
);
1168 static inline void gen_qemu_st32fiw(DisasContext
*ctx
, TCGv_i64 arg1
, TCGv arg2
)
1170 TCGv t0
= tcg_temp_new();
1171 tcg_gen_trunc_i64_tl(t0
, arg1
),
1172 gen_qemu_st32(ctx
, t0
, arg2
);
1176 GEN_STXF(stfiw
, st32fiw
, 0x17, 0x1E, PPC_FLOAT_STFIWX
);
1178 /* POWER2 specific instructions */
1179 /* Quad manipulation (load/store two floats at a time) */
1182 static void gen_lfq(DisasContext
*ctx
)
1184 int rd
= rD(ctx
->opcode
);
1187 gen_set_access_type(ctx
, ACCESS_FLOAT
);
1188 t0
= tcg_temp_new();
1189 t1
= tcg_temp_new_i64();
1190 gen_addr_imm_index(ctx
, t0
, 0);
1191 gen_qemu_ld64_i64(ctx
, t1
, t0
);
1193 gen_addr_add(ctx
, t0
, t0
, 8);
1194 gen_qemu_ld64_i64(ctx
, t1
, t0
);
1195 set_fpr((rd
+ 1) % 32, t1
);
1197 tcg_temp_free_i64(t1
);
1201 static void gen_lfqu(DisasContext
*ctx
)
1203 int ra
= rA(ctx
->opcode
);
1204 int rd
= rD(ctx
->opcode
);
1207 gen_set_access_type(ctx
, ACCESS_FLOAT
);
1208 t0
= tcg_temp_new();
1209 t1
= tcg_temp_new();
1210 t2
= tcg_temp_new_i64();
1211 gen_addr_imm_index(ctx
, t0
, 0);
1212 gen_qemu_ld64_i64(ctx
, t2
, t0
);
1214 gen_addr_add(ctx
, t1
, t0
, 8);
1215 gen_qemu_ld64_i64(ctx
, t2
, t1
);
1216 set_fpr((rd
+ 1) % 32, t2
);
1218 tcg_gen_mov_tl(cpu_gpr
[ra
], t0
);
1222 tcg_temp_free_i64(t2
);
1226 static void gen_lfqux(DisasContext
*ctx
)
1228 int ra
= rA(ctx
->opcode
);
1229 int rd
= rD(ctx
->opcode
);
1230 gen_set_access_type(ctx
, ACCESS_FLOAT
);
1233 t2
= tcg_temp_new_i64();
1234 t0
= tcg_temp_new();
1235 gen_addr_reg_index(ctx
, t0
);
1236 gen_qemu_ld64_i64(ctx
, t2
, t0
);
1238 t1
= tcg_temp_new();
1239 gen_addr_add(ctx
, t1
, t0
, 8);
1240 gen_qemu_ld64_i64(ctx
, t2
, t1
);
1241 set_fpr((rd
+ 1) % 32, t2
);
1244 tcg_gen_mov_tl(cpu_gpr
[ra
], t0
);
1247 tcg_temp_free_i64(t2
);
1251 static void gen_lfqx(DisasContext
*ctx
)
1253 int rd
= rD(ctx
->opcode
);
1256 gen_set_access_type(ctx
, ACCESS_FLOAT
);
1257 t0
= tcg_temp_new();
1258 t1
= tcg_temp_new_i64();
1259 gen_addr_reg_index(ctx
, t0
);
1260 gen_qemu_ld64_i64(ctx
, t1
, t0
);
1262 gen_addr_add(ctx
, t0
, t0
, 8);
1263 gen_qemu_ld64_i64(ctx
, t1
, t0
);
1264 set_fpr((rd
+ 1) % 32, t1
);
1266 tcg_temp_free_i64(t1
);
1270 static void gen_stfq(DisasContext
*ctx
)
1272 int rd
= rD(ctx
->opcode
);
1275 gen_set_access_type(ctx
, ACCESS_FLOAT
);
1276 t0
= tcg_temp_new();
1277 t1
= tcg_temp_new_i64();
1278 gen_addr_imm_index(ctx
, t0
, 0);
1280 gen_qemu_st64_i64(ctx
, t1
, t0
);
1281 gen_addr_add(ctx
, t0
, t0
, 8);
1282 get_fpr(t1
, (rd
+ 1) % 32);
1283 gen_qemu_st64_i64(ctx
, t1
, t0
);
1285 tcg_temp_free_i64(t1
);
1289 static void gen_stfqu(DisasContext
*ctx
)
1291 int ra
= rA(ctx
->opcode
);
1292 int rd
= rD(ctx
->opcode
);
1295 gen_set_access_type(ctx
, ACCESS_FLOAT
);
1296 t2
= tcg_temp_new_i64();
1297 t0
= tcg_temp_new();
1298 gen_addr_imm_index(ctx
, t0
, 0);
1300 gen_qemu_st64_i64(ctx
, t2
, t0
);
1301 t1
= tcg_temp_new();
1302 gen_addr_add(ctx
, t1
, t0
, 8);
1303 get_fpr(t2
, (rd
+ 1) % 32);
1304 gen_qemu_st64_i64(ctx
, t2
, t1
);
1307 tcg_gen_mov_tl(cpu_gpr
[ra
], t0
);
1310 tcg_temp_free_i64(t2
);
1314 static void gen_stfqux(DisasContext
*ctx
)
1316 int ra
= rA(ctx
->opcode
);
1317 int rd
= rD(ctx
->opcode
);
1320 gen_set_access_type(ctx
, ACCESS_FLOAT
);
1321 t2
= tcg_temp_new_i64();
1322 t0
= tcg_temp_new();
1323 gen_addr_reg_index(ctx
, t0
);
1325 gen_qemu_st64_i64(ctx
, t2
, t0
);
1326 t1
= tcg_temp_new();
1327 gen_addr_add(ctx
, t1
, t0
, 8);
1328 get_fpr(t2
, (rd
+ 1) % 32);
1329 gen_qemu_st64_i64(ctx
, t2
, t1
);
1332 tcg_gen_mov_tl(cpu_gpr
[ra
], t0
);
1335 tcg_temp_free_i64(t2
);
1339 static void gen_stfqx(DisasContext
*ctx
)
1341 int rd
= rD(ctx
->opcode
);
1344 gen_set_access_type(ctx
, ACCESS_FLOAT
);
1345 t1
= tcg_temp_new_i64();
1346 t0
= tcg_temp_new();
1347 gen_addr_reg_index(ctx
, t0
);
1349 gen_qemu_st64_i64(ctx
, t1
, t0
);
1350 gen_addr_add(ctx
, t0
, t0
, 8);
1351 get_fpr(t1
, (rd
+ 1) % 32);
1352 gen_qemu_st64_i64(ctx
, t1
, t0
);
1354 tcg_temp_free_i64(t1
);
1357 #undef _GEN_FLOAT_ACB
1358 #undef GEN_FLOAT_ACB
1359 #undef _GEN_FLOAT_AB
1361 #undef _GEN_FLOAT_AC