lightning
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 1/2] mips: CLO/CLZ are available on MIPSr1


From: Paul Cercueil
Subject: [PATCH 1/2] mips: CLO/CLZ are available on MIPSr1
Date: Wed, 8 Mar 2023 00:33:00 +0000

The CLO, CLZ and DCLO, DCLZ instructions were present in the first
revision of the MIPS32 and MIPS64 specifications.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
 lib/jit_mips-cpu.c | 50 ++++++++++++++++++++--------------------------
 1 file changed, 22 insertions(+), 28 deletions(-)

diff --git a/lib/jit_mips-cpu.c b/lib/jit_mips-cpu.c
index 69f7ed0..d71a5b5 100644
--- a/lib/jit_mips-cpu.c
+++ b/lib/jit_mips-cpu.c
@@ -1636,41 +1636,35 @@ _insr(jit_state_t *_jit, jit_int32_t r0, jit_int32_t r1,
 static void
 _clor(jit_state_t *_jit, jit_int32_t r0, jit_int32_t r1)
 {
-    if (jit_mips2_p()) {
-#if __WORDSIZE == 32
-       if (jit_mips6_p())
-           CLO_R6(r0, r1);
-       else
-           CLO(r0, r1);
-#else
-       if (jit_mips6_p())
-           DCLO_R6(r0, r1);
-       else
-           DCLO(r0, r1);
-#endif
+    if (__WORDSIZE == 32) {
+        if (jit_mips6_p())
+            CLO_R6(r0, r1);
+        else
+            CLO(r0, r1);
+    }
+    else {
+        if (jit_mips6_p())
+            DCLO_R6(r0, r1);
+        else
+            DCLO(r0, r1);
     }
-    else
-       fallback_clo(r0, r1);
 }
 
 static void
 _clzr(jit_state_t *_jit, jit_int32_t r0, jit_int32_t r1)
 {
-    if (jit_mips2_p()) {
-#if __WORDSIZE == 32
-       if (jit_mips6_p())
-           CLZ_R6(r0, r1);
-       else
-           CLZ(r0, r1);
-#else
-       if (jit_mips6_p())
-           DCLZ_R6(r0, r1);
-       else
-           DCLZ(r0, r1);
-#endif
+    if (__WORDSIZE == 32) {
+        if (jit_mips6_p())
+            CLZ_R6(r0, r1);
+        else
+            CLZ(r0, r1);
+    }
+    else {
+        if (jit_mips6_p())
+            DCLZ_R6(r0, r1);
+        else
+            DCLZ(r0, r1);
     }
-    else
-       fallback_clz(r0, r1);
 }
 
 static void
-- 
2.39.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]