[aarch64-port-dev ] RFR(S): 8239914: AArch64: Combine add/sub with comparison against zero

Pengfei Li Pengfei.Li at arm.com
Thu Feb 27 03:41:27 UTC 2020


Hi,

This is a small enhancement in AArch64 C2 matching rules.

For Java code like "if (a + b > 0) {...}", C2 AArch64 backend generates
instructions like below.
  add     w10, w2, w1
  cmp     w10, #0x0
  b.gt    0x0000ffff790d5274

Indeed, the ADD with the following CMP against 0 can be combined into a
CMN (an alias of ADDS). Also, a SUB with a following CMP against 0 can
be combined into a single CMP (an alias of SUBS).

JBS: https://bugs.openjdk.java.net/browse/JDK-8239914
Webrev: http://cr.openjdk.java.net/~pli/rfr/8239914/webrev.00/

[Tests]
Jtreg hotspot::hotspot_all_no_apps, jdk::jdk_core and langtools::tier1.
No new failure found.

Side effect: After this patch, libjvm.so size changes from 20,479,712 bytes
to 20,523,952 bytes in release build. (~0.2% up)

Please let me know if this enhancement is valuable or not.

--
Thanks,
Pengfei



More information about the aarch64-port-dev mailing list