Skip to content

Commit 2f5e0f9

Browse files
committed
target/ppc: Implement mffscdrn[i] instructions
Signed-off-by: Víctor Colombo <[email protected]>
1 parent e6dd681 commit 2f5e0f9

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

target/ppc/insn32.decode

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,9 @@
130130
&X_imm2 rt imm
131131
@X_imm2 ...... rt:5 ..... ... imm:2 .......... . &X_imm2
132132

133+
&X_imm3 rt imm
134+
@X_imm3 ...... rt:5 ..... .. imm:3 .......... . &X_imm3
135+
133136
%x_xt 0:1 21:5
134137
&X_imm5 xt imm:uint8_t vrb
135138
@X_imm5 ...... ..... imm:5 vrb:5 .......... . &X_imm5 xt=%x_xt
@@ -330,7 +333,9 @@ MFFS 111111 ..... 00000 ----- 1001000111 . @X_t_rc
330333
MFFSL 111111 ..... 11000 ----- 1001000111 - @X_t
331334
MFFSCE 111111 ..... 00001 ----- 1001000111 - @X_t
332335
MFFSCRN 111111 ..... 10110 ..... 1001000111 - @X_tb
336+
MFFSCDRN 111111 ..... 10100 ..... 1001000111 - @X_tb
333337
MFFSCRNI 111111 ..... 10111 ---.. 1001000111 - @X_imm2
338+
MFFSCDRNI 111111 ..... 10101 --... 1001000111 - @X_imm3
334339

335340
### Decimal Floating-Point Arithmetic Instructions
336341

target/ppc/translate/fp-impl.c.inc

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -679,6 +679,41 @@ static bool trans_MFFSCRNI(DisasContext *ctx, arg_X_imm2 *a)
679679
return true;
680680
}
681681

682+
static bool trans_MFFSCDRN(DisasContext *ctx, arg_X_tb *a)
683+
{
684+
TCGv_i64 t1;
685+
686+
REQUIRE_INSNS_FLAGS2(ctx, ISA300);
687+
REQUIRE_FPU(ctx);
688+
689+
t1 = tcg_temp_new_i64();
690+
get_fpr(t1, a->rb);
691+
tcg_gen_andi_i64(t1, t1, FP_DRN);
692+
693+
do_mffsc(a->rt, t1, FP_DRN | FP_ENABLES | FP_NI | FP_RN, ~FP_DRN, 0x0100);
694+
695+
tcg_temp_free_i64(t1);
696+
697+
return true;
698+
}
699+
700+
static bool trans_MFFSCDRNI(DisasContext *ctx, arg_X_imm3 *a)
701+
{
702+
TCGv_i64 t1;
703+
704+
REQUIRE_INSNS_FLAGS2(ctx, ISA300);
705+
REQUIRE_FPU(ctx);
706+
707+
t1 = tcg_temp_new_i64();
708+
tcg_gen_movi_i64(t1, (uint64_t)a->imm << FPSCR_DRN0);
709+
710+
do_mffsc(a->rt, t1, FP_DRN | FP_ENABLES | FP_NI | FP_RN, ~FP_DRN, 0x0100);
711+
712+
tcg_temp_free_i64(t1);
713+
714+
return true;
715+
}
716+
682717
/* mtfsb0 */
683718
static void gen_mtfsb0(DisasContext *ctx)
684719
{

0 commit comments

Comments
 (0)