diff options
author | Andre Przywara <andre.przywara@amd.com> | 2009-10-23 13:44:31 +0200 |
---|---|---|
committer | Aurelien Jarno <aurelien@aurel32.net> | 2009-10-23 17:10:36 +0200 |
commit | 31501a714b7a99fd7b937a45558ed02aa1b57d58 (patch) | |
tree | ff6ad928f74dd654a02770cd90a799ae8d17a83e /target-i386/helper.h | |
parent | cb2dbfc3516f3fc6b49c52c759b2023d5a824b52 (diff) |
target-i386: implement lzcnt emulation
lzcnt is a AMD Phenom/Barcelona added instruction returning the
number of leading zero bits in a word.
As this is similar to the "bsr" instruction, reuse the existing
code. There need to be some more changes, though, as lzcnt always
returns a valid value (in opposite to bsr, which has a special
case when the operand is 0).
lzcnt is guarded by the ABM CPUID bit (Fn8000_0001:ECX_5).
Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Diffstat (limited to 'target-i386/helper.h')
-rw-r--r-- | target-i386/helper.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/target-i386/helper.h b/target-i386/helper.h index ca953f47d9..6b518ad89f 100644 --- a/target-i386/helper.h +++ b/target-i386/helper.h @@ -193,6 +193,7 @@ DEF_HELPER_2(fxsave, void, tl, int) DEF_HELPER_2(fxrstor, void, tl, int) DEF_HELPER_1(bsf, tl, tl) DEF_HELPER_1(bsr, tl, tl) +DEF_HELPER_2(lzcnt, tl, tl, int) /* MMX/SSE */ |