Commit 1cd4ea4897 for qemu.org
commit 1cd4ea48976668e2e1c8fd4f3199fcf51bd8717a
Author: Bibo Mao <maobibo@loongson.cn>
Date: Thu Oct 29 21:01:09 2026 +0800
target/loongarch: Change asrtle_d()/asrtgt_d() for signed integer comparison
Make the asrtle_d() and asrtgt_d() helpers perform signed integer
comparison. These helpers are used by the asrtle/asrtgt instructions.
Signed-off-by: Bibo Mao <maobibo@loongson.cn>
Reviewed-by: Xianglai Li <lixianglai@loongson.cn>
diff --git a/target/loongarch/tcg/op_helper.c b/target/loongarch/tcg/op_helper.c
index 25ed328753..f8a91bed5d 100644
--- a/target/loongarch/tcg/op_helper.c
+++ b/target/loongarch/tcg/op_helper.c
@@ -27,7 +27,7 @@ void HELPER(asrtle_d)(CPULoongArchState *env, target_ulong rj, target_ulong rk)
{
CPUSysState *sys = env_sys(env);
- if (rj > rk) {
+ if ((target_long)rj > (target_long)rk) {
sys->CSR_BADV = rj;
do_raise_exception(env, EXCCODE_BCE, GETPC());
}
@@ -37,7 +37,7 @@ void HELPER(asrtgt_d)(CPULoongArchState *env, target_ulong rj, target_ulong rk)
{
CPUSysState *sys = env_sys(env);
- if (rj <= rk) {
+ if ((target_long)rj <= (target_long)rk) {
sys->CSR_BADV = rj;
do_raise_exception(env, EXCCODE_BCE, GETPC());
}