target/mips: Fix loongson multimedia condition instructions
PATCH 1/1 target/mips: Fix loongson multimedia condition instructions
Loongson multimedia condition instructions were previously implemented as write 0 to rd due to lack of documentation. So I just confirmed with Loongson about their encoding and implemented them correctly.
---
v1: Use deposit opreations according to Richard's suggestion.
--- target/mips/translate.c | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-)
target/mips/translate.c +31 -4
@@ -5529,6 +5529,7 @@ static void gen_loongson_multimedia(DisasContext *ctx, int rd, int rs, int rt) {uint32_t opc, shift_max;TCGv_i64 t0, t1; +TCGCond cond; opc =MASK_LMI (ctx->opcode);switch (opc) {
@@ -5862,14 +5863,39 @@ static void gen_loongson_multimedia(DisasContext *ctx, int rd, int rs, int rt)case OPC_SEQU_CP2 :case OPC_SEQ_CP2 : + cond =TCG_COND_EQ ; + goto do_cc_cond; +break ;case OPC_SLTU_CP2 : + cond =TCG_COND_LTU ; + goto do_cc_cond; +break ;case OPC_SLT_CP2 : + cond =TCG_COND_LT ; + goto do_cc_cond; +break ;case OPC_SLEU_CP2 : + cond =TCG_COND_LEU ; + goto do_cc_cond; +break ;case OPC_SLE_CP2 : -/* -* ??? Document is unclear: Set FCC[CC]. Does that mean the -* FD field is the CC field? -*/ + cond =TCG_COND_LE ; + do_cc_cond: + { +int cc = (ctx->opcode >>8 ) &0x7 ; +TCGv_i64 t64 =tcg_temp_new_i64 (); +TCGv_i32 t32 =tcg_temp_new_i32 (); + +tcg_gen_setcond_i64 (cond, t64, t0, t1); +tcg_gen_extrl_i64_i32 (t32, t64); +tcg_gen_deposit_i32 (fpu_fcr31, fpu_fcr31, t32, +get_fp_bit (cc),1 ); + +tcg_temp_free_i32 (t32); +tcg_temp_free_i64 (t64); + } + goto no_rd; +break ;default :MIPS_INVAL ("loongson_cp2" );generate_exception_end (ctx,EXCP_RI );
@@ -5878,6 +5904,7 @@ static void gen_loongson_multimedia(DisasContext *ctx, int rd, int rs, int rt)gen_store_fpr64 (ctx, t0, rd); +no_rd:tcg_temp_free_i64 (t0);tcg_temp_free_i64 (t1); }
Signature · 1 line
2.26.0.rc2
Quoted 11 lines · Jiaxun Yang
Loongson multimedia condition instructions were previously implemented as write 0 to rd due to lack of documentation. So I just confirmed with Loongson about their encoding and implemented them correctly.
Signed-off-by Jiaxun Yang <[email protected]>Acked-by Huacai Chen <[email protected]>---
v1: Use deposit opreations according to Richard's suggestion.--- target/mips/translate.c | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-)
r~
Aleksandar Markovic
Reviewed-by16:59 Uto, 24.03.2020. Richard Henderson <[email protected]> је написао/ла:
Quoted 3 lines · Jiaxun Yang
Quoted 1 line
Loongson multimedia condition instructions were previously implemented
as
Quoted 1 line
Quoted 1 line
write 0 to rd due to lack of documentation. So I just confirmed with
Loongson
Quoted 10 lines
Quoted 9 lines
about their encoding and implemented them correctly.
Signed-off-by Jiaxun Yang <[email protected]>Acked-by Huacai Chen <[email protected]>---
v1: Use deposit opreations according to Richard's suggestion.--- target/mips/translate.c | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-)
Quoted 2 lines
Reviewed-by Richard Henderson <[email protected]>
I just have a couple of mon-essential suggestions wrt coding style, but since all that is really of very insignificant nauture, I wouldn't even mention them.
May I ask you, Richard, to select this patch for your next TCG-for-5.0 queue, so that I don't go through a MIPS queue process for just a single patch?
Thanks to all involved people!
Aleksandar
Quoted 2 lines
r~
Aleksandar Markovic
Reviewed-by12:44 Sre, 25.03.2020. Aleksandar Markovic <[email protected]> је написао/ла:
Quoted 2 lines
16:59 Uto, 24.03.2020. Richard Henderson <[email protected]>
је написао/ла:
Quoted 3 lines
Quoted 3 lines · Jiaxun Yang
Quoted 1 line
Loongson multimedia condition instructions were previously
implemented as
Quoted 1 line
Quoted 1 line
Quoted 1 line
write 0 to rd due to lack of documentation. So I just confirmed with
Loongson
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
about their encoding and implemented them correctly.
Signed-off-by Jiaxun Yang <[email protected]>Acked-by Huacai Chen <[email protected]>---
v1: Use deposit opreations according to Richard's suggestion.--- target/mips/translate.c | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-)
Quoted 4 lines
Quoted 2 lines
Reviewed-by Richard Henderson <[email protected]>I just have a couple of mon-essential suggestions wrt coding style, but
since all that is really of very insignificant nauture, I wouldn't even mention them.
Quoted 3 lines
Reviewed-by Aleksandar Markovic <[email protected]>
Sorry, there was a typo. It should be:
("u" instead of "i" in "qemi")
Quoted 1 line
May I ask you, Richard, to select this patch for your next TCG-for-5.0
queue, so that I don't go through a MIPS queue process for just a single patch?
Quoted 7 lines
Thanks to all involved people!
Aleksandar
Quoted 2 lines
r~
Aleksandar Markovic
Reviewed-by12:47 Sre, 25.03.2020. Aleksandar Markovic <[email protected]> је написао/ла:
Quoted 2 lines
12:44 Sre, 25.03.2020. Aleksandar Markovic <
[email protected]> је написао/ла:
Quoted 2 lines
Quoted 2 lines
16:59 Uto, 24.03.2020. Richard Henderson <[email protected]>
је написао/ла:
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines · Jiaxun Yang
Quoted 1 line
Loongson multimedia condition instructions were previously
implemented as
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
write 0 to rd due to lack of documentation. So I just confirmed
with Loongson
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
about their encoding and implemented them correctly.
Signed-off-by Jiaxun Yang <[email protected]>Acked-by Huacai Chen <[email protected]>---
v1: Use deposit opreations according to Richard's suggestion.--- target/mips/translate.c | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-)
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
Reviewed-by Richard Henderson <[email protected]>I just have a couple of mon-essential suggestions wrt coding style, but
since all that is really of very insignificant nauture, I wouldn't even mention them.
Quoted 10 lines
Quoted 3 lines
Reviewed-by Aleksandar Markovic <[email protected]>Sorry, there was a typo. It should be:
Reviewed-by Aleksandar Markovic <aleksandar.qem [email protected]>("u" instead of "i" in "qemi")
Another problem with text formatting on mobile phones, this line should be:
Hope this all right now.
Sorry about that.
Quoted 1 line
Quoted 1 line
May I ask you, Richard, to select this patch for your next TCG-for-5.0
queue, so that I don't go through a MIPS queue process for just a single patch?
Quoted 7 lines
Quoted 7 lines
Thanks to all involved people!
Aleksandar
Quoted 2 lines
r~
Quoted 3 lines · Aleksandar Markovic
May I ask you, Richard, to select this patch for your next TCG-for-5.0 queue, so that I don't go through a MIPS queue process for just a single patch?
I suppose I could, but at present I have nothing in the tcg queue, so it would be just the single patch.
r~
03:30 Čet, 26.03.2020. Richard Henderson <[email protected]> је написао/ла:
Quoted 3 lines · Aleksandar Markovic
Quoted 1 line
May I ask you, Richard, to select this patch for your next TCG-for-5.0
queue,
Quoted 4 lines
Quoted 2 lines
so that I don't go through a MIPS queue process for just a single patch?
I suppose I could, but at present I have nothing in the tcg queue, so it
would
Quoted 2 lines
be just the single patch.
Yes, Richard, even if it is just a single pending patch to you at the moment, I would prefer you sending the pull request - in a way it represents the final completion touch of LMI module that was authored by you, but unclear docs prevented us from getting these last bits and pieces. Please go ahead with the pull request at any time convenient to you - at least it symbolically belongs to you (and I am sure you are glad about the patch).
Yours, Aleksansar
Quoted 2 lines
r~
14:23 Uto, 24.03.2020. Jiaxun Yang <[email protected]> је написао/ла:
Quoted 3 lines
Loongson multimedia condition instructions were previously implemented as write 0 to rd due to lack of documentation. So I just confirmed with
Loongson
Quoted 7 lines
about their encoding and implemented them correctly.
Signed-off-by Jiaxun Yang <[email protected]>Acked-by Huacai Chen <[email protected]>---
v1: Use deposit opreations according to Richard's suggestion.
---
Thanks, Jiaxun!
But, your numeration of patches is wrong. The first version of the patch should be sent with prefix [PATCH]
and the second (this) version of the patch with prefix [PATCH v2]. This is the second time you make the same mistake. Please make sure that you have the correct numeration in future. But, anyhow, thanks for this version.
Yours,
Aleksandar
target/mips/translate.c static void gen_loongson_multimedia(DisasContext
Quoted 8 lines
target/mips/translate.c | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-)target/mips/translate.c +0
-0@@ -5529,6 +5529,7 @@ static void gen_loongson_multimedia(DisasContext
*ctx, int rd, int rs, int rt)
target/mips/translate.c static void gen_loongson_multimedia(DisasContext
Quoted 8 lines
target/mips/translate.c +1
-0{uint32_t opc, shift_max;TCGv_i64 t0, t1; +TCGCond cond; opc =MASK_LMI (ctx->opcode);switch (opc) {@@ -5862,14 +5863,39 @@ static void gen_loongson_multimedia(DisasContext
*ctx, int rd, int rs, int rt)
target/mips/translate.c static void gen_loongson_multimedia(DisasContext
Quoted 44 lines
target/mips/translate.c +29
-4case OPC_SEQU_CP2 :case OPC_SEQ_CP2 : + cond =TCG_COND_EQ ; + goto do_cc_cond; +break ;case OPC_SLTU_CP2 : + cond =TCG_COND_LTU ; + goto do_cc_cond; +break ;case OPC_SLT_CP2 : + cond =TCG_COND_LT ; + goto do_cc_cond; +break ;case OPC_SLEU_CP2 : + cond =TCG_COND_LEU ; + goto do_cc_cond; +break ;case OPC_SLE_CP2 : -/* -* ??? Document is unclear: Set FCC[CC]. Does that mean the -* FD field is the CC field? -*/ + cond =TCG_COND_LE ; + do_cc_cond: + { +int cc = (ctx->opcode >>8 ) &0x7 ; +TCGv_i64 t64 =tcg_temp_new_i64 (); +TCGv_i32 t32 =tcg_temp_new_i32 (); + +tcg_gen_setcond_i64 (cond, t64, t0, t1); +tcg_gen_extrl_i64_i32 (t32, t64); +tcg_gen_deposit_i32 (fpu_fcr31, fpu_fcr31, t32, +get_fp_bit (cc),1 ); + +tcg_temp_free_i32 (t32); +tcg_temp_free_i64 (t64); + } + goto no_rd; +break ;default :MIPS_INVAL ("loongson_cp2" );generate_exception_end (ctx,EXCP_RI );@@ -5878,6 +5904,7 @@ static void gen_loongson_multimedia(DisasContext
*ctx, int rd, int rs, int rt)
Quoted 11 lines
target/mips/translate.c +1
-1gen_store_fpr64 (ctx, t0, rd); +no_rd:tcg_temp_free_i64 (t0);tcg_temp_free_i64 (t1); } --2.26.0.rc2
于 2020年3月25日 GMT+08:00 上午12:56:41, Aleksandar Markovic <[email protected]> 写到:
Quoted 17 lines
14:23 Uto, 24.03.2020. Jiaxun Yang <[email protected]> је написао/ла:
Quoted 2 lines
Loongson multimedia condition instructions were previously
implemented as
Quoted 1 line
write 0 to rd due to lack of documentation. So I just confirmed with
Loongson
Quoted 7 lines
about their encoding and implemented them correctly.
Signed-off-by Jiaxun Yang <[email protected]>Acked-by Huacai Chen <[email protected]>---
v1: Use deposit opreations according to Richard's suggestion.
---Thanks, Jiaxun!
Quoted 8 lines
But, your numeration of patches is wrong. The first version of the patch
should be sent with prefix [PATCH]
and the second (this) version of the patch with prefix [PATCH v2]. This is
the second time you make the same mistake. Please make sure that you have
the correct numeration in future. But, anyhow, thanks for this version.
Sorry for that.
I'm doing like this for years.
I promise it won't happen in future.
Thanks.
Quoted 4 lines
Yours,
Aleksandar
Signature · 1 line
Jiaxun Yang
19:09 Uto, 24.03.2020. Jiaxun Yang <[email protected]> је написао/ла:
Quoted 4 lines
于 2020年3月25日 GMT+08:00 上午12:56:41, Aleksandar Markovic <
[email protected]> 写到:
Quoted 26 lines
Quoted 17 lines
14:23 Uto, 24.03.2020. Jiaxun Yang <[email protected]> је написао/ла:
Quoted 2 lines
Loongson multimedia condition instructions were previously
implemented as
Quoted 1 line
write 0 to rd due to lack of documentation. So I just confirmed with
Loongson
Quoted 7 lines
about their encoding and implemented them correctly.
Signed-off-by Jiaxun Yang <[email protected]>Acked-by Huacai Chen <[email protected]>---
v1: Use deposit opreations according to Richard's suggestion.
---Thanks, Jiaxun!
Quoted 8 lines
But, your numeration of patches is wrong. The first version of the patch
should be sent with prefix [PATCH]
and the second (this) version of the patch with prefix [PATCH v2]. This is
the second time you make the same mistake. Please make sure that you have
the correct numeration in future. But, anyhow, thanks for this version.
Quoted 4 lines
Sorry for that.
I'm doing like this for years.
I promise it won't happen in future.
Cool, thanks again!
Quoted 8 lines
Thanks.
Quoted 4 lines
Yours,
Aleksandar--
Jiaxun Yang
Hi Jiaxun Yang,
Quoted 3 lines · Jiaxun Yang
Loongson multimedia condition instructions were previously implemented as write 0 to rd due to lack of documentation. So I just confirmed with Loongson about their encoding and implemented them correctly.
If you have a binary using loongson multimedia instructions, can you add a test? So this code won't bitrot.
I'm in particular interested by a test covering the MAC2008 instructions. You can look at examples in the tests/tcg/mips/ directory, Aleksandar added a lot of tests there.
Thanks,
Phil.
Quoted 74 lines
Signed-off-by Jiaxun Yang <[email protected]>Acked-by Huacai Chen <[email protected]>---
v1: Use deposit opreations according to Richard's suggestion.--- target/mips/translate.c | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-)target/mips/translate.c +31
-4@@ -5529,6 +5529,7 @@ static void gen_loongson_multimedia(DisasContext *ctx, int rd, int rs, int rt) {uint32_t opc, shift_max;TCGv_i64 t0, t1; +TCGCond cond; opc =MASK_LMI (ctx->opcode);switch (opc) {@@ -5862,14 +5863,39 @@ static void gen_loongson_multimedia(DisasContext *ctx, int rd, int rs, int rt)case OPC_SEQU_CP2 :case OPC_SEQ_CP2 : + cond =TCG_COND_EQ ; + goto do_cc_cond; +break ;case OPC_SLTU_CP2 : + cond =TCG_COND_LTU ; + goto do_cc_cond; +break ;case OPC_SLT_CP2 : + cond =TCG_COND_LT ; + goto do_cc_cond; +break ;case OPC_SLEU_CP2 : + cond =TCG_COND_LEU ; + goto do_cc_cond; +break ;case OPC_SLE_CP2 : -/* -* ??? Document is unclear: Set FCC[CC]. Does that mean the -* FD field is the CC field? -*/ + cond =TCG_COND_LE ; + do_cc_cond: + { +int cc = (ctx->opcode >>8 ) &0x7 ; +TCGv_i64 t64 =tcg_temp_new_i64 (); +TCGv_i32 t32 =tcg_temp_new_i32 (); + +tcg_gen_setcond_i64 (cond, t64, t0, t1); +tcg_gen_extrl_i64_i32 (t32, t64); +tcg_gen_deposit_i32 (fpu_fcr31, fpu_fcr31, t32, +get_fp_bit (cc),1 ); + +tcg_temp_free_i32 (t32); +tcg_temp_free_i64 (t64); + } + goto no_rd; +break ;default :MIPS_INVAL ("loongson_cp2" );generate_exception_end (ctx,EXCP_RI );@@ -5878,6 +5904,7 @@ static void gen_loongson_multimedia(DisasContext *ctx, int rd, int rs, int rt)gen_store_fpr64 (ctx, t0, rd); +no_rd:tcg_temp_free_i64 (t0);tcg_temp_free_i64 (t1); }
于 2020年3月30日 GMT+08:00 下午11:39:44, "Philippe Mathieu-Daudé" <[email protected]> 写到:
Quoted 4 lines
Hi Jiaxun Yang,
Quoted 1 line · Jiaxun Yang
Loongson multimedia condition instructions were previously
Quoted 8 lines
implemented as
Quoted 1 line
write 0 to rd due to lack of documentation. So I just confirmed with
Loongson
Quoted 1 line
about their encoding and implemented them correctly.
If you have a binary using loongson multimedia instructions, can you add
a test? So this code won't bitrot.
I know ffmpeg uses it.
But I think that's too fat.
Quoted 5 lines
I'm in particular interested by a test covering the MAC2008 instructions. You can look at examples in the tests/tcg/mips/ directory,
Aleksandar added a lot of tests there.
I'm going to try that.
Thanks.
Quoted 82 lines
Thanks,
Phil.
target/mips/translate.c static void
Quoted 14 lines
Signed-off-by Jiaxun Yang <[email protected]>Acked-by Huacai Chen <[email protected]>---
v1: Use deposit opreations according to Richard's suggestion.--- target/mips/translate.c | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-)target/mips/translate.c +0
-0@@ -5529,6 +5529,7 @@ static void
gen_loongson_multimedia(DisasContext *ctx, int rd, int rs, int rt)target/mips/translate.c static void
Quoted 8 lines
target/mips/translate.c +1
-0{uint32_t opc, shift_max;TCGv_i64 t0, t1; +TCGCond cond; opc =MASK_LMI (ctx->opcode);switch (opc) {@@ -5862,14 +5863,39 @@ static void
gen_loongson_multimedia(DisasContext *ctx, int rd, int rs, int rt)target/mips/translate.c static void
Quoted 44 lines
target/mips/translate.c +29
-4case OPC_SEQU_CP2 :case OPC_SEQ_CP2 : + cond =TCG_COND_EQ ; + goto do_cc_cond; +break ;case OPC_SLTU_CP2 : + cond =TCG_COND_LTU ; + goto do_cc_cond; +break ;case OPC_SLT_CP2 : + cond =TCG_COND_LT ; + goto do_cc_cond; +break ;case OPC_SLEU_CP2 : + cond =TCG_COND_LEU ; + goto do_cc_cond; +break ;case OPC_SLE_CP2 : -/* -* ??? Document is unclear: Set FCC[CC]. Does that mean the -* FD field is the CC field? -*/ + cond =TCG_COND_LE ; + do_cc_cond: + { +int cc = (ctx->opcode >>8 ) &0x7 ; +TCGv_i64 t64 =tcg_temp_new_i64 (); +TCGv_i32 t32 =tcg_temp_new_i32 (); + +tcg_gen_setcond_i64 (cond, t64, t0, t1); +tcg_gen_extrl_i64_i32 (t32, t64); +tcg_gen_deposit_i32 (fpu_fcr31, fpu_fcr31, t32, +get_fp_bit (cc),1 ); + +tcg_temp_free_i32 (t32); +tcg_temp_free_i64 (t64); + } + goto no_rd; +break ;default :MIPS_INVAL ("loongson_cp2" );generate_exception_end (ctx,EXCP_RI );@@ -5878,6 +5904,7 @@ static void
gen_loongson_multimedia(DisasContext *ctx, int rd, int rs, int rt)Quoted 8 lines
target/mips/translate.c +1
-0gen_store_fpr64 (ctx, t0, rd); +no_rd:tcg_temp_free_i64 (t0);tcg_temp_free_i64 (t1); }
Signature · 1 line
Jiaxun Yang
Quoted 10 lines · Jiaxun Yang
于 2020年3月30日 GMT+08:00 下午11:39:44, "Philippe Mathieu-Daudé" <[email protected]> 写到:
Quoted 7 lines
Hi Jiaxun Yang,
Quoted 1 line · Jiaxun Yang
Loongson multimedia condition instructions were previously
implemented as
Quoted 1 line
write 0 to rd due to lack of documentation. So I just confirmed with
Loongson
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
about their encoding and implemented them correctly.
If you have a binary using loongson multimedia instructions, can you add
a test? So this code won't bitrot.I know ffmpeg uses it.
But I think that's too fat.
Looks perfect to me!
It'll be simpler if you use a pre-build binary from a known distribution.
Quoted 94 lines
Quoted 6 lines
I'm in particular interested by a test covering the MAC2008 instructions. You can look at examples in the tests/tcg/mips/ directory,
Aleksandar added a lot of tests there.I'm going to try that.
Thanks.
Quoted 82 lines
Thanks,
Phil.
target/mips/translate.c static void
Quoted 14 lines
Signed-off-by Jiaxun Yang <[email protected]>Acked-by Huacai Chen <[email protected]>---
v1: Use deposit opreations according to Richard's suggestion.--- target/mips/translate.c | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-)target/mips/translate.c +0
-0@@ -5529,6 +5529,7 @@ static void
gen_loongson_multimedia(DisasContext *ctx, int rd, int rs, int rt)target/mips/translate.c static void
Quoted 8 lines
target/mips/translate.c +1
-0{uint32_t opc, shift_max;TCGv_i64 t0, t1; +TCGCond cond; opc =MASK_LMI (ctx->opcode);switch (opc) {@@ -5862,14 +5863,39 @@ static void
gen_loongson_multimedia(DisasContext *ctx, int rd, int rs, int rt)target/mips/translate.c static void
Quoted 44 lines
target/mips/translate.c +29
-4case OPC_SEQU_CP2 :case OPC_SEQ_CP2 : + cond =TCG_COND_EQ ; + goto do_cc_cond; +break ;case OPC_SLTU_CP2 : + cond =TCG_COND_LTU ; + goto do_cc_cond; +break ;case OPC_SLT_CP2 : + cond =TCG_COND_LT ; + goto do_cc_cond; +break ;case OPC_SLEU_CP2 : + cond =TCG_COND_LEU ; + goto do_cc_cond; +break ;case OPC_SLE_CP2 : -/* -* ??? Document is unclear: Set FCC[CC]. Does that mean the -* FD field is the CC field? -*/ + cond =TCG_COND_LE ; + do_cc_cond: + { +int cc = (ctx->opcode >>8 ) &0x7 ; +TCGv_i64 t64 =tcg_temp_new_i64 (); +TCGv_i32 t32 =tcg_temp_new_i32 (); + +tcg_gen_setcond_i64 (cond, t64, t0, t1); +tcg_gen_extrl_i64_i32 (t32, t64); +tcg_gen_deposit_i32 (fpu_fcr31, fpu_fcr31, t32, +get_fp_bit (cc),1 ); + +tcg_temp_free_i32 (t32); +tcg_temp_free_i64 (t64); + } + goto no_rd; +break ;default :MIPS_INVAL ("loongson_cp2" );generate_exception_end (ctx,EXCP_RI );@@ -5878,6 +5904,7 @@ static void
gen_loongson_multimedia(DisasContext *ctx, int rd, int rs, int rt)Quoted 8 lines
target/mips/translate.c +1
-0gen_store_fpr64 (ctx, t0, rd); +no_rd:tcg_temp_free_i64 (t0);tcg_temp_free_i64 (t1); }
于 2020年3月31日 GMT+08:00 上午12:22:43, "Philippe Mathieu-Daudé" <[email protected]> 写到:
Quoted 19 lines · Jiaxun Yang
Quoted 3 lines
于 2020年3月30日 GMT+08:00 下午11:39:44, "Philippe Mathieu-Daudé"
<[email protected]> 写到:
Quoted 6 lines
Quoted 6 lines
Hi Jiaxun Yang,
Quoted 1 line · Jiaxun Yang
Loongson multimedia condition instructions were previously
implemented as
Quoted 1 line
write 0 to rd due to lack of documentation. So I just confirmed
with
Quoted 7 lines
Quoted 6 lines
Loongson
Quoted 1 line
about their encoding and implemented them correctly.
If you have a binary using loongson multimedia instructions, can you add
a test? So this code won't bitrot.
Quoted 7 lines
Quoted 2 lines
I know ffmpeg uses it.
But I think that's too fat.Looks perfect to me!
It'll be simpler if you use a pre-build binary from a known distribution.
Unfortunately none of the distribution built ffmpeg with loongson insns enabled, as it can't be enabled at runtime.
I'll try that after fulfill Loongson Extensions in QEMU.
FFmpeg do use some other Loongson insns despite mmi.
There are still 15+ instructions for me to work.
Thanks
Signature · 1 line
Jiaxun Yang
18:31 Pon, 30.03.2020. Jiaxun Yang <[email protected]> је написао/ла:
Quoted 4 lines
于 2020年3月31日 GMT+08:00 上午12:22:43, "Philippe Mathieu-Daudé" <
[email protected]> 写到:
Quoted 22 lines
Quoted 22 lines · Jiaxun Yang
Quoted 3 lines
于 2020年3月30日 GMT+08:00 下午11:39:44, "Philippe Mathieu-Daudé"
<[email protected]> 写到:
Quoted 6 lines
Quoted 6 lines
Hi Jiaxun Yang,
Quoted 1 line · Jiaxun Yang
Loongson multimedia condition instructions were previously
implemented as
Quoted 1 line
write 0 to rd due to lack of documentation. So I just confirmed
with
Quoted 9 lines
Quoted 6 lines
Loongson
Quoted 1 line
about their encoding and implemented them correctly.
If you have a binary using loongson multimedia instructions, can you add
a test? So this code won't bitrot.I know ffmpeg uses it.
But I think that's too fat.
Quoted 6 lines
Quoted 4 lines
Looks perfect to me!
It'll be simpler if you use a pre-build binary from a known distribution.
Unfortunately none of the distribution built ffmpeg with loongson insns
enabled,
Quoted 8 lines
as it can't be enabled at runtime.
I'll try that after fulfill Loongson Extensions in QEMU.
FFmpeg do use some other Loongson insns despite mmi.
There are still 15+ instructions for me to work.
Jiaxun, hi.
My advice is to think about integrating Loongson-relared test into QEMU "in background", with the intention that you possibly develop them later on.
Let's focus first on the code you want to add to enhance core Loongson-related QEMU features, and we'll help you later on about Loongton tests that could also be added to QEMU upstream.
I am sure you have some informal tests for all code you develop, but there is a long way from these tests to the test that can be integrated in QEMU upetream.
Just for reference, and something for you to think about in breaks between real coding:
Basically, in QEMU, there are several kind of tests you could have in mind:
1) Unit tests yhat typically test emulation of just a single instruction (see /tests/tcg/mips/user/ase/msa for example);
2) Acceptance test that test boot/shutdown and possibly other features of virtual machines prepared in advance (kernel, rootfs, etc.), residing in test/acceptance;
3) Tests that may use tests made for libraries and applicstions that use the functionality of your newly-added features;
4) Other test that you may devise by your own and think are usefull and make sense.
But again, let's focus and show us the main body of your code (as you already started doing), let's start from there, and see how is it going and what happens.
Thanks again for your work so far!
Yours,
Aleksandar
Quoted 3 lines
Thanks
--
Jiaxun Yang
13:23 Uto, 24.03.2020. Jiaxun Yang <[email protected]> је написао/ла:
Quoted 3 lines
Loongson multimedia condition instructions were previously implemented as write 0 to rd due to lack of documentation. So I just confirmed with
Loongson
Quoted 2 lines
about their encoding and implemented them correctly.
Hi, Jiaxun,
Richard Henderson selected your patch to be in his pull request, and the main maintainer, Peter Maydell, accepted it and integrated it into main tree:
I gather this is your first patch merged in QEMU upstream.
Congratulations!!
There is a place for you in QEMU community.
Hope we hear from you soon, with more fixes, improvements, and new features.
Yours,
Aleksandar
target/mips/translate.c static void gen_loongson_multimedia(DisasContext
Quoted 13 lines
Signed-off-by Jiaxun Yang <[email protected]>Acked-by Huacai Chen <[email protected]>---
v1: Use deposit opreations according to Richard's suggestion.--- target/mips/translate.c | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-)target/mips/translate.c +0
-0@@ -5529,6 +5529,7 @@ static void gen_loongson_multimedia(DisasContext
*ctx, int rd, int rs, int rt)
target/mips/translate.c static void gen_loongson_multimedia(DisasContext
Quoted 8 lines
target/mips/translate.c +1
-0{uint32_t opc, shift_max;TCGv_i64 t0, t1; +TCGCond cond; opc =MASK_LMI (ctx->opcode);switch (opc) {@@ -5862,14 +5863,39 @@ static void gen_loongson_multimedia(DisasContext
*ctx, int rd, int rs, int rt)
target/mips/translate.c static void gen_loongson_multimedia(DisasContext
Quoted 44 lines
target/mips/translate.c +29
-4case OPC_SEQU_CP2 :case OPC_SEQ_CP2 : + cond =TCG_COND_EQ ; + goto do_cc_cond; +break ;case OPC_SLTU_CP2 : + cond =TCG_COND_LTU ; + goto do_cc_cond; +break ;case OPC_SLT_CP2 : + cond =TCG_COND_LT ; + goto do_cc_cond; +break ;case OPC_SLEU_CP2 : + cond =TCG_COND_LEU ; + goto do_cc_cond; +break ;case OPC_SLE_CP2 : -/* -* ??? Document is unclear: Set FCC[CC]. Does that mean the -* FD field is the CC field? -*/ + cond =TCG_COND_LE ; + do_cc_cond: + { +int cc = (ctx->opcode >>8 ) &0x7 ; +TCGv_i64 t64 =tcg_temp_new_i64 (); +TCGv_i32 t32 =tcg_temp_new_i32 (); + +tcg_gen_setcond_i64 (cond, t64, t0, t1); +tcg_gen_extrl_i64_i32 (t32, t64); +tcg_gen_deposit_i32 (fpu_fcr31, fpu_fcr31, t32, +get_fp_bit (cc),1 ); + +tcg_temp_free_i32 (t32); +tcg_temp_free_i64 (t64); + } + goto no_rd; +break ;default :MIPS_INVAL ("loongson_cp2" );generate_exception_end (ctx,EXCP_RI );@@ -5878,6 +5904,7 @@ static void gen_loongson_multimedia(DisasContext
*ctx, int rd, int rs, int rt)
Quoted 11 lines
target/mips/translate.c +1
-1gen_store_fpr64 (ctx, t0, rd); +no_rd:tcg_temp_free_i64 (t0);tcg_temp_free_i64 (t1); } --2.26.0.rc2