qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 09/25] target-openrisc: Implement ff1 and fl1 for 64


From: Richard Henderson
Subject: [Qemu-devel] [PATCH 09/25] target-openrisc: Implement ff1 and fl1 for 64-bit
Date: Mon, 13 Jun 2016 16:58:09 -0700

True, this is unused so far, but commented out is worse than
actually implemented properly.

Reviewed-by: Bastian Koppelmann <address@hidden>
Signed-off-by: Richard Henderson <address@hidden>
---
 target-openrisc/int_helper.c | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/target-openrisc/int_helper.c b/target-openrisc/int_helper.c
index 6482f8c..64f837c 100644
--- a/target-openrisc/int_helper.c
+++ b/target-openrisc/int_helper.c
@@ -26,19 +26,20 @@
 
 target_ulong HELPER(ff1)(target_ulong x)
 {
-/*#ifdef TARGET_OPENRISC64
-    return x ? ctz64(x) + 1 : 0;
-#else*/
-    return x ? ctz32(x) + 1 : 0;
-/*#endif*/
+    if (x == 0) {
+        return 0;
+    } else if (TARGET_LONG_BITS == 64) {
+        return ctz64(x) + 1;
+    } else {
+        return ctz32(x) + 1;
+    }
 }
 
 target_ulong HELPER(fl1)(target_ulong x)
 {
-/* not used yet, open it when we need or64.  */
-/*#ifdef TARGET_OPENRISC64
-    return 64 - clz64(x);
-#else*/
-    return 32 - clz32(x);
-/*#endif*/
+    if (TARGET_LONG_BITS == 64) {
+        return 64 - clz64(x);
+    } else {
+        return 32 - clz32(x);
+    }
 }
-- 
2.5.5




reply via email to

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