United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-8005033 : clear high word for integer pop count on SPARC

Details
Type:
Bug
Submit Date:
2012-12-13
Status:
Resolved
Updated Date:
2013-04-25
Project Name:
JDK
Resolved Date:
2012-12-20
Component:
hotspot
OS:
generic
Sub-Component:
compiler
CPU:
sparc
Priority:
P3
Resolution:
Fixed
Affected Versions:
Fixed Versions:
hs25 (b14)

Related Reports
Backport:
Backport:
Backport:

Sub Tasks

Description
http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/2012-December/009139.html


Hi,

I would like to submit a bugfix for C2's Integer.bitCount() intrinsic on sparcv9.

On sparcv9, the C2 intrinsic for Integer.bitCount() is a POPC instruction. POPC operates on the whole register, including the high word, but for Integer.bitCount(), this is not correct, because the value of the high word is undefined. There could be bits set as a result of an int overflow or from a shift operation for example. Of course the bits in the high word have to be ignored for Integer.bitCount().

I have prepared a small webrev with the suggested fix and a regression test:

  http://www.sapjvm.com/rr/webrevs/bitCount_intrinsic_sparc_01/

Could you please review the patch and create a bug id? Thanks!

Cheers,
Richard.
                                    

Comments
URL:   http://hg.openjdk.java.net/hsx/hsx25/hotspot/rev/65c8342f726a
User:  amurillo
Date:  2012-12-21 20:28:27 +0000

                                     
2012-12-21
URL:   http://hg.openjdk.java.net/hsx/hotspot-comp/hotspot/rev/65c8342f726a
User:  twisti
Date:  2012-12-20 02:53:32 +0000

                                     
2012-12-20
The SPARC instruction set manual states:

Programming Note: POPC is a ???64-bit-only??? instruction; there is no version of this instruction that operates on just the less-significant 32 bits of its source operand.
                                     
2012-12-13



Hardware and Software, Engineered to Work Together