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

AArch64: Combine Multiply and Neg operations in C2

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 12
    • 12
    • hotspot
    • b09
    • aarch64
    • linux

      Below Java code patterns

      int c = a * (-b);
      int d = (-a) * b;
      long p = m * (-n);
      long q = (-m) * n;

      generates code like

      0x0000ffff88ae66d4: neg w10, w2
      0x0000ffff88ae66d8: mul w0, w1, w10

      OR

      0x0000ffff88ae66d4: neg x10, x2
      0x0000ffff88ae66d8: mul x0, x1, x10

      The neg & mul instructions can be combined into one single mneg instruction like

      mneg w0, w1, w2

      OR

      mneg x0, x1, x2

            zyao Zhongwei Yao
            zyao Zhongwei Yao
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: