diff mbox series

[PULL,11/13] target/loongarch: Change asrtle_d()/asrtgt_d() for signed integer comparison

Message ID 20261105065345.966691-12-maobibo@loongson.cn
State New
Headers show
Series [PULL,01/13] bios-tables-test-allowed-diff.h: Allow LoongArch DSDT.* | expand

Commit Message

Bibo Mao Nov. 5, 2026, 6:53 a.m. UTC
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>
---
 target/loongarch/tcg/op_helper.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

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());
     }