diff options
author | Richard Henderson <rth@twiddle.net> | 2012-08-24 07:39:11 -0700 |
---|---|---|
committer | Richard Henderson <rth@twiddle.net> | 2013-01-05 12:18:41 -0800 |
commit | 102bf2c63535122cba0d7917ed8cfb8cc1c7b14c (patch) | |
tree | f66ce31acb76df233d7a75d908795eac19ea31e0 /target-s390x/int_helper.c | |
parent | 683bb9a8889cd00e69b05ba78bd5ba27f2e4e958 (diff) |
target-s390: Convert FLOGR
Signed-off-by: Richard Henderson <rth@twiddle.net>
Diffstat (limited to 'target-s390x/int_helper.c')
-rw-r--r-- | target-s390x/int_helper.c | 22 |
1 files changed, 3 insertions, 19 deletions
diff --git a/target-s390x/int_helper.c b/target-s390x/int_helper.c index 839c0e1500..dc16de206c 100644 --- a/target-s390x/int_helper.c +++ b/target-s390x/int_helper.c @@ -165,26 +165,10 @@ int64_t HELPER(nabs_i64)(int64_t val) } } -/* find leftmost one */ -uint32_t HELPER(flogr)(CPUS390XState *env, uint32_t r1, uint64_t v2) +/* count leading zeros, for find leftmost one */ +uint64_t HELPER(clz)(uint64_t v) { - uint64_t res = 0; - uint64_t ov2 = v2; - - while (!(v2 & 0x8000000000000000ULL) && v2) { - v2 <<= 1; - res++; - } - - if (!v2) { - env->regs[r1] = 64; - env->regs[r1 + 1] = 0; - return 0; - } else { - env->regs[r1] = res; - env->regs[r1 + 1] = ov2 & ~(0x8000000000000000ULL >> res); - return 2; - } + return clz64(v); } uint64_t HELPER(cvd)(int32_t bin) |