Uploaded image for project: 'Harmony'
  1. Harmony
  2. HARMONY-5901

[drlvm][jit]integer MUL, DIV and REM strength reduction

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 5.0M9
    • DRLVM
    • None
    • Patch Available

    Description

      1. Mulitiplication replacement
      a. It's about integer multiplication.
      b. One of two multipliers is a power of 2.
      c. The power of 2 could be negative.
      For example, 23*4 is transformed to 23<<2 and 23*(-4) is transformed to (23<<2)*(-1).

      2. Division replacement
      a. It's about integer division.
      b. The divisor is a power of 2.
      c. The power of 2 could be negative.
      d. Because of round-up difference between division and shift right, the following equations from Aleksey are used.
      Baseline: q = a / (1 << d);
      Optimized: q = (a + [(1 << d) - 1] & (a >> 31)) >> d;
      For example, 23/4 is transformed to (23+((1<<2)-1)&(23>>31))>>2. and (-23)/(-4) is transformed to ((-23+((1<<2)-1)&(-23>>31))>>2)*(-1).

      3. Comments for SAR and SHR swapped
      The comments for the two similar operations were misplaced in working_vm/vm/port/src/encoder/ia32_em64t.

      Attachments

        1. 5901.patch
          7 kB
          Xiaoming Gu
        2. H5901-V2.patch
          8 kB
          Aleksey Shipilev
        3. H5901-V3.patch
          8 kB
          Xiaoming Gu
        4. H5901-V4.patch
          10 kB
          Xiaoming Gu
        5. H5901-V5.patch
          10 kB
          Xiaoming Gu
        6. H5901-V6.patch
          14 kB
          Xiaoming Gu
        7. H5901-V7.patch
          19 kB
          Xiaoming Gu
        8. H5901-V8.patch
          32 kB
          Xiaoming Gu
        9. H5901-V9.patch
          32 kB
          Xiaoming Gu

        Issue Links

          Activity

            People

              chunrong lai Chunrong Lai
              xiaoming Xiaoming Gu
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: