target-mips: Fix Loongson multimedia instructions.
PATCH 2/2 target-mips: Fix Loongson multimedia instructions.
From: Heiher <[email protected]>
Needed to emit FPU exception on Loongson multimedia instructions executing if Status:CU1 is clear. or FPR changes may be missed on Linux.
--- target-mips/translate.c | 1 + 1 file changed, 1 insertion(+)
target-mips/translate.c +1 -0
@@ -3871,6 +3871,7 @@ static void gen_loongson_multimedia(DisasContext *ctx, int rd, int rs, int rt)break ; } +check_cp1_enabled (ctx);gen_load_fpr64 (ctx, t0, rs);gen_load_fpr64 (ctx, t1, rt);
Signature · 1 line
2.10.0
Quoted 17 lines · Heiher
From: Heiher <[email protected]>
Needed to emit FPU exception on Loongson multimedia instructions executing if Status:CU1 is clear. or FPR changes may be missed on Linux.
Signed-off-by Heiher <[email protected]>Signed-off-by Fuxin Zhang <[email protected]>--- target-mips/translate.c | 1 + 1 file changed, 1 insertion(+)target-mips/translate.c +0
-0
target-mips/translate.c static void gen_loongson_multimedia(DisasContext *ctx, int rd, int rs, int rt) · line 3874
Quoted 4 lines
target-mips/translate.c +1
-0@@ -3871,6 +3871,7 @@ static void gen_loongson_multimedia(DisasContext *ctx, int rd, int rs, int rt)break ; } +check_cp1_enabled (ctx);
Isn't it also required to check Status.CU2 bit? I guess the Loongson Multimedia instructions was implemented as the Cop2? Please correct me if I am wrong with this.
target-mips/translate.c static void gen_loongson_multimedia(DisasContext *ctx, int rd, int rs, int rt) · line 3877
Quoted 4 lines
target-mips/translate.c +0
-0gen_load_fpr64 (ctx, t0, rs);gen_load_fpr64 (ctx, t1, rt);
Regards,
Yongbok
Quoted 23 lines · Yongbok Kim
Quoted 20 lines · Heiher
From: Heiher <[email protected]>
Needed to emit FPU exception on Loongson multimedia instructions executing if Status:CU1 is clear. or FPR changes may be missed on Linux.
Signed-off-by Heiher <[email protected]>Signed-off-by Fuxin Zhang <[email protected]>--- target-mips/translate.c | 1 + 1 file changed, 1 insertion(+)target-mips/translate.c +0
-0@@ -3871,6 +3871,7 @@ static void gen_loongson_multimedia(DisasContext *ctx, int rd, int rs, int rt)break ; }
Quoted 5 lines
target-mips/translate.c static void gen_loongson_multimedia(DisasContext *ctx, int rd, int rs, int rt) · line 3874
Quoted 1 line
target-mips/translate.c +1
-0+check_cp1_enabled (ctx);Isn't it also required to check Status.CU2 bit? I guess the Loongson Multimedia instructions was implemented as the Cop2? Please correct me if I am wrong with this.
I don't think the Loongson CPUs have real coprocessor 2 although these multimedia instructions are encoding as Cp2. Similar to MSA, these instructions reusing 64-bit FPRs. In fact, The older Loongson CPUs emit Cp2 unusable exception, so a cp2 hook is needed to combine FPU and Cp2 in kernel. In new revision, Cp1 exception is emitted.
Quoted 8 lines
target-mips/translate.c static void gen_loongson_multimedia(DisasContext *ctx, int rd, int rs, int rt) · line 3877
Quoted 5 lines
target-mips/translate.c +0
-0gen_load_fpr64 (ctx, t0, rs);gen_load_fpr64 (ctx, t1, rt);Regards,
Yongbok
Signature · 3 lines
Best regards! Heiher http://hev.cc