target/loongarch/tcg/insn_trans/trans_vec.c.inc | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
on qemu we got an aborted error
**
ERROR:../target/loongarch/tcg/insn_trans/trans_vec.c.inc:3574:vldi_get_value: code should not be reached
Bail out! ERROR:../target/loongarch/tcg/insn_trans/trans_vec.c.inc:3574:vldi_get_value: code should not be reached
Aborted (core dumped)
bu on 3A600/3A5000 we got a "Illegal instruction" error.
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2971
Signed-off-by: Song Gao <gaosong@loongson.cn>
---
target/loongarch/tcg/insn_trans/trans_vec.c.inc | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/target/loongarch/tcg/insn_trans/trans_vec.c.inc b/target/loongarch/tcg/insn_trans/trans_vec.c.inc
index dff92772ad..cadc00e75e 100644
--- a/target/loongarch/tcg/insn_trans/trans_vec.c.inc
+++ b/target/loongarch/tcg/insn_trans/trans_vec.c.inc
@@ -3465,7 +3465,7 @@ TRANS(xvmsknz_b, LASX, gen_xx, gen_helper_vmsknz_b)
static uint64_t vldi_get_value(DisasContext *ctx, uint32_t imm)
{
int mode;
- uint64_t data, t;
+ uint64_t data = 0, t;
/*
* imm bit [11:8] is mode, mode value is 0-12.
@@ -3570,8 +3570,7 @@ static uint64_t vldi_get_value(DisasContext *ctx, uint32_t imm)
}
break;
default:
- generate_exception(ctx, EXCCODE_INE);
- g_assert_not_reached();
+ data = -1;
}
return data;
}
@@ -3579,7 +3578,12 @@ static uint64_t vldi_get_value(DisasContext *ctx, uint32_t imm)
static bool gen_vldi(DisasContext *ctx, arg_vldi *a, uint32_t oprsz)
{
int sel, vece;
- uint64_t value;
+ uint64_t value = vldi_get_value(ctx, a->imm);
+
+ if (value == -1){
+ generate_exception(ctx, EXCCODE_INE);
+ return true;
+ }
if (!check_vec(ctx, oprsz)) {
return true;
@@ -3588,7 +3592,6 @@ static bool gen_vldi(DisasContext *ctx, arg_vldi *a, uint32_t oprsz)
sel = (a->imm >> 12) & 0x1;
if (sel) {
- value = vldi_get_value(ctx, a->imm);
vece = MO_64;
} else {
value = ((int32_t)(a->imm << 22)) >> 22;
--
2.34.1
On 6/3/25 03:48, Song Gao wrote:
> on qemu we got an aborted error
> **
> ERROR:../target/loongarch/tcg/insn_trans/trans_vec.c.inc:3574:vldi_get_value: code should not be reached
> Bail out! ERROR:../target/loongarch/tcg/insn_trans/trans_vec.c.inc:3574:vldi_get_value: code should not be reached
> Aborted (core dumped)
> bu on 3A600/3A5000 we got a "Illegal instruction" error.
>
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2971
>
> Signed-off-by: Song Gao <gaosong@loongson.cn>
> ---
> target/loongarch/tcg/insn_trans/trans_vec.c.inc | 13 ++++++++-----
> 1 file changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/target/loongarch/tcg/insn_trans/trans_vec.c.inc b/target/loongarch/tcg/insn_trans/trans_vec.c.inc
> index dff92772ad..cadc00e75e 100644
> --- a/target/loongarch/tcg/insn_trans/trans_vec.c.inc
> +++ b/target/loongarch/tcg/insn_trans/trans_vec.c.inc
> @@ -3465,7 +3465,7 @@ TRANS(xvmsknz_b, LASX, gen_xx, gen_helper_vmsknz_b)
> static uint64_t vldi_get_value(DisasContext *ctx, uint32_t imm)
> {
> int mode;
> - uint64_t data, t;
> + uint64_t data = 0, t;
>
> /*
> * imm bit [11:8] is mode, mode value is 0-12.
> @@ -3570,8 +3570,7 @@ static uint64_t vldi_get_value(DisasContext *ctx, uint32_t imm)
> }
> break;
> default:
> - generate_exception(ctx, EXCCODE_INE);
> - g_assert_not_reached();
> + data = -1;
> }
> return data;
> }
> @@ -3579,7 +3578,12 @@ static uint64_t vldi_get_value(DisasContext *ctx, uint32_t imm)
> static bool gen_vldi(DisasContext *ctx, arg_vldi *a, uint32_t oprsz)
> {
> int sel, vece;
> - uint64_t value;
> + uint64_t value = vldi_get_value(ctx, a->imm);
> +
> + if (value == -1){
> + generate_exception(ctx, EXCCODE_INE);
> + return true;
> + }
Incorrect. -1 is a valid return value for several modes.
r~
在 2025/6/3 下午3:42, Richard Henderson 写道:
> On 6/3/25 03:48, Song Gao wrote:
>> on qemu we got an aborted error
>> **
>> ERROR:../target/loongarch/tcg/insn_trans/trans_vec.c.inc:3574:vldi_get_value:
>> code should not be reached
>> Bail out!
>> ERROR:../target/loongarch/tcg/insn_trans/trans_vec.c.inc:3574:vldi_get_value:
>> code should not be reached
>> Aborted (core dumped)
>> bu on 3A600/3A5000 we got a "Illegal instruction" error.
>>
>> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2971
>>
>> Signed-off-by: Song Gao <gaosong@loongson.cn>
>> ---
>> target/loongarch/tcg/insn_trans/trans_vec.c.inc | 13 ++++++++-----
>> 1 file changed, 8 insertions(+), 5 deletions(-)
>>
>> diff --git a/target/loongarch/tcg/insn_trans/trans_vec.c.inc
>> b/target/loongarch/tcg/insn_trans/trans_vec.c.inc
>> index dff92772ad..cadc00e75e 100644
>> --- a/target/loongarch/tcg/insn_trans/trans_vec.c.inc
>> +++ b/target/loongarch/tcg/insn_trans/trans_vec.c.inc
>> @@ -3465,7 +3465,7 @@ TRANS(xvmsknz_b, LASX, gen_xx,
>> gen_helper_vmsknz_b)
>> static uint64_t vldi_get_value(DisasContext *ctx, uint32_t imm)
>> {
>> int mode;
>> - uint64_t data, t;
>> + uint64_t data = 0, t;
>> /*
>> * imm bit [11:8] is mode, mode value is 0-12.
>> @@ -3570,8 +3570,7 @@ static uint64_t vldi_get_value(DisasContext
>> *ctx, uint32_t imm)
>> }
>> break;
>> default:
>> - generate_exception(ctx, EXCCODE_INE);
>> - g_assert_not_reached();
>> + data = -1;
>> }
>> return data;
>> }
>> @@ -3579,7 +3578,12 @@ static uint64_t vldi_get_value(DisasContext
>> *ctx, uint32_t imm)
>> static bool gen_vldi(DisasContext *ctx, arg_vldi *a, uint32_t oprsz)
>> {
>> int sel, vece;
>> - uint64_t value;
>> + uint64_t value = vldi_get_value(ctx, a->imm);
>> +
>> + if (value == -1){
>> + generate_exception(ctx, EXCCODE_INE);
>> + return true;
>> + }
>
> Incorrect. -1 is a valid return value for several modes.
>
My negligence.
thanks.
Song Gao
>
> r~
© 2016 - 2025 Red Hat, Inc.