mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 16:23:55 -06:00
BSR/BSF TCG conversion
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4477 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
parent
7c6ce4baed
commit
6191b05901
4 changed files with 54 additions and 72 deletions
|
@ -5240,6 +5240,37 @@ void helper_movq(uint64_t *d, uint64_t *s)
|
|||
|
||||
#endif
|
||||
|
||||
/* bit operations */
|
||||
target_ulong helper_bsf(target_ulong t0)
|
||||
{
|
||||
int count;
|
||||
target_ulong res;
|
||||
|
||||
res = t0;
|
||||
count = 0;
|
||||
while ((res & 1) == 0) {
|
||||
count++;
|
||||
res >>= 1;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
target_ulong helper_bsr(target_ulong t0)
|
||||
{
|
||||
int count;
|
||||
target_ulong res, mask;
|
||||
|
||||
res = t0;
|
||||
count = TARGET_LONG_BITS - 1;
|
||||
mask = (target_ulong)1 << (TARGET_LONG_BITS - 1);
|
||||
while ((res & mask) == 0) {
|
||||
count--;
|
||||
res <<= 1;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
static int compute_all_eflags(void)
|
||||
{
|
||||
return CC_SRC;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue