]> Git Repo - qemu.git/commitdiff
target-openrisc: Use clz and ctz opcodes
authorRichard Henderson <[email protected]>
Wed, 16 Nov 2016 10:17:45 +0000 (11:17 +0100)
committerRichard Henderson <[email protected]>
Tue, 10 Jan 2017 16:06:11 +0000 (08:06 -0800)
Signed-off-by: Richard Henderson <[email protected]>
target/openrisc/helper.h
target/openrisc/int_helper.c
target/openrisc/translate.c

index f53fa213448d2cce6b7a3178ea31d81d08f2bbb5..bcc7245fc3d947094abc77e348ca9855dfef2e2e 100644 (file)
@@ -54,8 +54,6 @@ FOP_CMP(ge)
 #undef FOP_CMP
 
 /* int */
-DEF_HELPER_FLAGS_1(ff1, 0, tl, tl)
-DEF_HELPER_FLAGS_1(fl1, 0, tl, tl)
 DEF_HELPER_FLAGS_3(mul32, 0, i32, env, i32, i32)
 
 /* interrupt */
index 4d1f958901174ada65c5a440be254d558a08aaf3..ba0fd277cd174ed1b8b858c1bed2061056e8d9f3 100644 (file)
 #include "exception.h"
 #include "qemu/host-utils.h"
 
-target_ulong HELPER(ff1)(target_ulong x)
-{
-/*#ifdef TARGET_OPENRISC64
-    return x ? ctz64(x) + 1 : 0;
-#else*/
-    return x ? ctz32(x) + 1 : 0;
-/*#endif*/
-}
-
-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*/
-}
-
 uint32_t HELPER(mul32)(CPUOpenRISCState *env,
                        uint32_t ra, uint32_t rb)
 {
index 229361aed18ed7979f1c4033b38411513668f8fd..03fa7db5708c176bd7198bfd9c5c80d803cdc46d 100644 (file)
@@ -602,11 +602,13 @@ static void dec_calc(DisasContext *dc, uint32_t insn)
         switch (op1) {
         case 0x00:    /* l.ff1 */
             LOG_DIS("l.ff1 r%d, r%d, r%d\n", rd, ra, rb);
-            gen_helper_ff1(cpu_R[rd], cpu_R[ra]);
+            tcg_gen_ctzi_tl(cpu_R[rd], cpu_R[ra], -1);
+            tcg_gen_addi_tl(cpu_R[rd], cpu_R[rd], 1);
             break;
         case 0x01:    /* l.fl1 */
             LOG_DIS("l.fl1 r%d, r%d, r%d\n", rd, ra, rb);
-            gen_helper_fl1(cpu_R[rd], cpu_R[ra]);
+            tcg_gen_clzi_tl(cpu_R[rd], cpu_R[ra], TARGET_LONG_BITS);
+            tcg_gen_subfi_tl(cpu_R[rd], TARGET_LONG_BITS, cpu_R[rd]);
             break;
 
         default:
This page took 0.031867 seconds and 4 git commands to generate.