OSDN Git Service

Implement CountLeadingZeros for x86
authorMark Mendell <mark.p.mendell@intel.com>
Thu, 13 Aug 2015 01:16:41 +0000 (21:16 -0400)
committerRoland Levillain <rpl@google.com>
Mon, 17 Aug 2015 11:36:34 +0000 (12:36 +0100)
commitd5897678eb555a797d4e84e07814d79f0e0bb465
treebcf7df2382200011fb43a59f49d008852368b355
parent8ecc1357e2c682165467ca8e10c7a748f7554df2
Implement CountLeadingZeros for x86

Generate Long and Integer numberOfLeadingZeros for x86 and x86_64. Uses
'bsr' instruction to find the first one bit, and then corrects the
result.

Added some more tests with constant values to test constant folding.
Also add a runtime test with 0 as the input.

Change-Id: I920b21bb00069bccf5f921f8f87a77e334114926
Signed-off-by: Mark Mendell <mark.p.mendell@intel.com>
compiler/optimizing/intrinsics_x86.cc
compiler/optimizing/intrinsics_x86_64.cc
test/082-inline-execute/src/Main.java