diff options
author | Richard Henderson <rth@twiddle.net> | 2013-01-21 13:32:02 -0800 |
---|---|---|
committer | Richard Henderson <rth@twiddle.net> | 2013-02-19 23:05:18 -0800 |
commit | 321c535105a182501b888f095f7ec4dbb5f3f6ae (patch) | |
tree | 432e174bd4f4404b2ee4f0107260333d797a828f /target-i386/int_helper.c | |
parent | f1300734cbca515d30953b2c87e259fa378ea301 (diff) |
target-i386: Implement tzcnt and fix lzcnt
We weren't computing flags for lzcnt at all. At the same time,
adjust the implementation of bsf/bsr to avoid the local branch,
using movcond instead.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Diffstat (limited to 'target-i386/int_helper.c')
-rw-r--r-- | target-i386/int_helper.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/target-i386/int_helper.c b/target-i386/int_helper.c index 7bec4ebdd6..3b56075a9d 100644 --- a/target-i386/int_helper.c +++ b/target-i386/int_helper.c @@ -456,19 +456,14 @@ void helper_idivq_EAX(CPUX86State *env, target_ulong t0) #endif /* bit operations */ -target_ulong helper_bsf(target_ulong t0) +target_ulong helper_ctz(target_ulong t0) { return ctztl(t0); } -target_ulong helper_lzcnt(target_ulong t0, int wordsize) +target_ulong helper_clz(target_ulong t0) { - return clztl(t0) - (TARGET_LONG_BITS - wordsize); -} - -target_ulong helper_bsr(target_ulong t0) -{ - return clztl(t0) ^ (TARGET_LONG_BITS - 1); + return clztl(t0); } target_ulong helper_pdep(target_ulong src, target_ulong mask) |