Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8365205

C2: Optimize popcount value computation using knownbits

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 26
    • hotspot

      popcount :-
        Count set bits in an integral number.

      KnownBits:-
        Captures both compile time know ZEROS and ONE bits in the value range.

      KnownBits to Range:-
        - MAX = ~ZEROS
        - MIN = ONES

      Proof:-
        - ZEROS and ONES are inferred out of common prefix of value range delimiting bounds.
        - Thus, ~ZEROS will not only include common prefix but will also set all other bits
          not included in common prefix, which also cover set bits in non-common prefix of
          actual value range b/w delimiting bounds.

      Result Value Range:-
        - TypeInt::make(popcount(ONES), popcount(~ZEROS));

      Proof:-
        - Given that ~ZEROS >= UB >= LB >= ONES
        - Therefore, popcount(~ZEROS) will always be guarantted to be greater than popcount(ONES).
        - Also, popcount(~ZEROS) >= Res.UB >= Res.LB >= popcount(ONES)

            jbhateja Jatin Bhateja
            jbhateja Jatin Bhateja
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: