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 <[email protected]>
---
 target/loongarch/tcg/op_helper.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

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


Reply via email to