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

Add ideal rule to convert floating point multiply by 2 into addition

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 20
    • 20
    • hotspot
    • b22

      Copy from the PR description: https://github.com/openjdk/jdk/pull/9642

      I would like to propose an ideal transform that converts floating point multiplication by 2 (x * 2) into an addition operation instead. This would allow for the elimination of the memory reference for the constant two, and keep the whole operation inside registers. My justifications for this optimization include:

      - As per Agner Fog's instruction tables many older systems, such as the sandy bridge and ivy bridge architectures, have different latencies for addition and multiplication meaning this change could have beneficial effects when in hot code.

      - The removal of the memory load would have a beneficial effect in cache-bound situations.

      - Multiplication by 2 is a relatively common construct so this change can apply to a wide range of Java code.

            chagedorn Christian Hagedorn
            qamai Quan Anh Mai
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: