Code Review for 6893554

Prepared by:twisti on Fri Oct 23 08:33:03 PDT 2009
Workspace:/home/twisti/hotspot-comp/6893554
Compare against: /home/twisti/hotspot-comp/hotspot
Summary of changes: 12 lines changed: 10 ins; 0 del; 2 mod; 9735 unchg
Patch of changes: 6893554.patch
Author comments:
The problem occurs with negative numbers, as the 32-bit input values
are sign extended into the 64-bit registers. When doing:
  // x |= (x >> 1);
  // x |= (x >> 2);
  // x |= (x >> 4);
  // x |= (x >> 8);
  // x |= (x >> 16);
  // return (WORDBITS - popc(x));

    __ srl(Rsrc, 1, Rtmp);
    __ or3(Rsrc, Rtmp, Rdst);
    <snip>
the 32-bit logical right shift clears the upper 32 bits but the OR
with the source value adds in the sign extended upper 32 bits again.
This leads to a POPC value for e.g. -1 of 64 instead of 32.

The fix is to zero-extend the 32-bit source value before applying the
algorithm on it.

Additionally two typos are fixed.

Bug id: Bug Database
Legend: Modified file
Deleted file
New file

Cdiffs Udiffs Sdiffs Frames Old New Patch Raw src/cpu/sparc/vm/sparc.ad

12 lines changed: 10 ins; 0 del; 2 mod; 9735 unchg

This code review page was prepared using /home/twisti/bin/webrev (vers 23.18-hg-never).